applist增加心率充电判断 2016/1 2016/head 2017/target/1
authorCaisking <Casiking@zhihuishixun.com>
Tue, 29 Jul 2025 02:13:58 +0000 (10:13 +0800)
committerCaisking <Casiking@zhihuishixun.com>
Tue, 29 Jul 2025 02:13:58 +0000 (10:13 +0800)
code/sdk/application/wearable/fd230/nativeapp/nativeui/applist/src/ApplistPresenter.cpp

index 673315a..dfcaccc 100644 (file)
 #include "TransitionType.h"
 #include "NativeRegisterManager.h"
 
+#include "health/health_service/health_service.h"
+#include "battery_hal.h"
+#include "ConfigModelC.h"
+#include "ConfigModel.h"
+#include <custom_utils.h>
+#include "custom_runtime.h"
 namespace OHOS {
 
 REGIST_SLICE(VIEW_APPLIST, ApplistView, ApplistPresenter);
@@ -137,15 +143,27 @@ REGIST_SLICE(VIEW_APPLIST, ApplistView, ApplistPresenter);
             uid = (char *)itemView->GetAppUid();
         }
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistPresenter::OnClick viewid = %d", viewId);
-        if (viewId < VIEW_MAX_INTER_APP) {
-            if (viewId == VIEW_SETTING && style == AppListStyle::APPLIST_STYLE) {
-                // NativeAbility::GetInstance().EnterSlice(viewId, type, gSliceDefaultPriority, true);
-                NativeAbility::GetInstance().EnterSlice(viewId, type); 
-            } else {
-                NativeAbility::GetInstance().EnterSlice(viewId, type);
+        if (viewId < VIEW_MAX_INTER_APP)
+        {
+            /*心率Slice需要增加特殊配置*/
+            bool isCharging = get_charge_stat(); // 获取充电状态
+            if (isCharging && viewId == VIEW_HEART_CHART)
+            {
+                HealthState highHealthState;
+                highHealthState.checkType = CHARGE;
+                HealthService::GetInstance()->SetHealthCurrent(highHealthState);
+                viewId = VIEW_CHECK_INVALID;
             }
+            if(uapi_sleep_mode_flag_get())
+            {
+                if(VIEW_DNOTDISTURB == viewId)
+                    return false; 
+            }
+            NativeAbility::GetInstance().EnterSlice(viewId, type);
             return true;
-        } else if (viewId == VIEW_EXTERN_APP) {
+        }
+        else if (viewId == VIEW_EXTERN_APP)
+        {
 #ifdef JS_ENABLE
             WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistPresenter::OnClick bundleName = %s", uid);
             Want *want = new Want();