解决声音与震动界面息屏后滑动监听失效问题;运动识别弹窗震动两次,默认强度设置为强 3147/1 3147/head 3148/target/1
authorluozheng <1732036298@qq.com>
Wed, 28 Jan 2026 09:28:12 +0000 (17:28 +0800)
committerluozheng <1732036298@qq.com>
Wed, 28 Jan 2026 09:28:12 +0000 (17:28 +0800)
code/sdk/application/wearable/fd272/nativeapp/nativeui/soundandvibration/include/SoundAndVibrationView.h
code/sdk/application/wearable/fd272/nativeapp/nativeui/soundandvibration/src/CallVolumeView.cpp
code/sdk/application/wearable/fd272/nativeapp/nativeui/soundandvibration/src/SoundAndVibrationView.cpp
code/sdk/application/wearable/fd272/nativeapp/nativeui/soundandvibration/src/SystemVolumeView.cpp
code/sdk/application/wearable/fd272/service/msg_center/src/notify/motion_recognition_notification.cpp
code/sdk/zhihui/config/include/ConfigModel.h

index 7922a1c..2e29672 100644 (file)
@@ -83,6 +83,7 @@ namespace OHOS
         bool InitSoundAndVibrationToggleButton(void);\r
 \r
     private:\r
+        UIViewGroup *group{nullptr};\r
         UIScrollView *SoundAndVibrationScrollView[MAX_SOUNDANDVIBRATIONVIEWID]{nullptr};\r
         UILabelExt *Title{nullptr};                         // 标题:“声音与震动”\r
         // UILabelButtonExt *SystemVolumeButton{nullptr};      // 系统音量按钮\r
index cf6910a..0831a85 100644 (file)
@@ -63,16 +63,13 @@ namespace OHOS
                 return nullptr;\r
             }\r
         }\r
+        CallVolumeScrollView->SetOnDragListener(presenter_);\r
 \r
         return CallVolumeScrollView;\r
     }\r
 \r
     void CallVolumeView::OnStart()\r
     {\r
-        GetRootContainer()->SetTouchable(true);\r
-        GetRootContainer()->SetDraggable(true);\r
-        GetRootContainer()->SetOnDragListener(presenter_);\r
-\r
         if (!initViewStatus)\r
         {\r
             CallVolumeViewInit();\r
index 9ab595b..e97a12a 100644 (file)
@@ -54,6 +54,10 @@ namespace OHOS
         if (initViewStatus == true)\r
         {\r
 \r
+            group->RemoveAll();\r
+            delete group;\r
+            group = nullptr;\r
+\r
             if (SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW] != nullptr)\r
             {\r
                 SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW]->RemoveAll();\r
@@ -128,7 +132,7 @@ namespace OHOS
         FocusManager::GetInstance()->RequestFocus(SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW]);\r
         FocusManager::GetInstance()->RequestFocusByDirection(FOCUS_DIRECTION_UP);\r
         SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW]->SetRotateFactor(1.0);\r
-        AddViewToRootContainer(SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW]);\r
+        group->Add(SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW]);\r
 \r
         return true;\r
     }\r
@@ -338,9 +342,20 @@ namespace OHOS
 \r
     void SoundAndVibrationView::OnStart()\r
     {\r
-        GetRootContainer()->SetTouchable(true);\r
-        GetRootContainer()->SetDraggable(true);\r
-        GetRootContainer()->SetOnDragListener(presenter_);\r
+        if (group == nullptr)\r
+        {\r
+            group = new UIViewGroup();\r
+            if (group == nullptr)\r
+            {\r
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "group new fail");\r
+                return ;\r
+            }\r
+        }\r
+        group->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);\r
+        group->SetDraggable(true);\r
+        group->SetTouchable(true);\r
+        group->SetOnDragListener(presenter_);\r
+        AddViewToRootContainer(group);\r
 \r
         if (!initViewStatus)\r
         {\r
@@ -354,7 +369,7 @@ namespace OHOS
         if (SoundAndVibrationScrollView[thisView] == nullptr)\r
         {\r
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SoundAndVibrationView::ChangeSoundAndVibrationView");\r
-            AddViewToRootContainer(SoundAndVibrationScrollView[thisView]);\r
+            group->Add(SoundAndVibrationScrollView[thisView]);\r
         }\r
         return true;\r
     }\r
@@ -375,7 +390,7 @@ namespace OHOS
                 }\r
             }\r
             SoundAndVibrationScrollView[thisView] = vibrationModeView->VibrationModeViewInit();\r
-            AddViewToRootContainer(SoundAndVibrationScrollView[thisView]);\r
+            group->Add(SoundAndVibrationScrollView[thisView]);\r
         }\r
         return true;\r
     }\r
index 541b566..873279f 100644 (file)
@@ -74,16 +74,13 @@ namespace OHOS
                 return nullptr;\r
             }\r
         }\r
+        SystemVolumeScrollView->SetOnDragListener(presenter_);\r
 \r
         return SystemVolumeScrollView;\r
     }\r
 \r
     void SystemVolumeView::OnStart()\r
     {\r
-        GetRootContainer()->SetTouchable(true);\r
-        GetRootContainer()->SetDraggable(true);\r
-        GetRootContainer()->SetOnDragListener(presenter_);\r
-\r
         if (!initViewStatus)\r
         {\r
             SystemVolumeViewInit();\r
index 786ab97..37cab10 100644 (file)
@@ -353,6 +353,7 @@ namespace OHOS
         if (true != OHOS::ConfigModel::GetInstance()->GetDnotdisturb() && (!uapi_sleep_mode_flag_get()))
         {
             custom_VibratorFunc_int(0);
+            custom_VibratorFunc_int(0);
         }
         /* -------------------------------------------------------------------------- */
         NotificationManager::GetInstance()->RegisterNotifyCleanupFunction(FreeMotionRecognitionView);
index 6ca170d..7ba93ba 100644 (file)
@@ -336,7 +336,7 @@ namespace OHOS
             {ConfigDataType::DATATYPE_STRING,  "language_code",             "zh"      },//CONFIGMODEL_ITEM_LANGUAGE_CODE, //默认没有选择语言
             {ConfigDataType::DATATYPE_INT,     "timezone",                 "32"      },//CONFIGMODEL_ITEM_TIMEZONE, //单位刻钟  默认+8 小时 = 4*8 = 32 刻钟
             {ConfigDataType::DATATYPE_BOOL,    "slient_mode",               "false" },//CONFIGMODEL_ITEM_SILENT_MODE,
-            {ConfigDataType::DATATYPE_INT,     "vibrator_switch",           "2"     },//CONFIGMODEL_ITEM_VIBRATOR_SWITCH, // 马达 开关,3 强,2 中,1 弱,0 关
+            {ConfigDataType::DATATYPE_INT,     "vibrator_switch",           "3"     },//CONFIGMODEL_ITEM_VIBRATOR_SWITCH, // 马达 开关,3 强,2 中,1 弱,0 关
             {ConfigDataType::DATATYPE_BOOL,    "rase2wake",                "true"  },//CONFIGMODEL_ITEM_RAISE_TO_WAKE,
             {ConfigDataType::DATATYPE_INT,     "stepcount",                "0"     },//CONFIGMODEL_ITEM_ACTIVITY_VALUES_STEPCOUNT,      //活动数据步数
             {ConfigDataType::DATATYPE_INT,     "calories",                 "0"     },// CONFIGMODEL_ITEM_ACTIVITY_VALUES_CALORIES,      //活动数据卡路里,