key文件夹合并 1753/target/2 1754/1 1754/head
authorluozheng <1732036298@qq.com>
Thu, 15 May 2025 09:33:57 +0000 (17:33 +0800)
committerluozheng <1732036298@qq.com>
Thu, 15 May 2025 09:33:57 +0000 (17:33 +0800)
code/sdk/application/wearable/fd230/nativeapp/nativelauncher/include/UiConfig.h
code/sdk/application/wearable/fd230/nativeapp/nativeui/applist/src/ApplistModel.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/flashlight/src/FlashlightPresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/key/include/KeyInputListener.h
code/sdk/application/wearable/fd230/nativeapp/nativeui/key/src/KeyInputListener.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/main/include/MainPresenterSample.h
code/sdk/application/wearable/fd230/nativeapp/nativeui/main/src/ConnectedStatusView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/main/src/PullUpDownView.cpp
code/sdk/application/wstp/at_service/app/app_at_process.c
code/sdk/open_source/openharmony/base/startup/syspara_lite/src/parameter_common.c

index 9ad77d2..0f36770 100644 (file)
@@ -45,9 +45,9 @@
      /*主界面上下拉界面*/
      typedef enum
      {
-         PULLUP,//主界面下拉
-         DROPDOWN,//主界面上拉
-         UNKOWNPAG,
+        PULLUP,     //主界面下拉
+        DROPDOWN,   //主界面上拉
+        UNKOWNPAG,
      }PULLPAGE;
  
  #ifndef UNUSED
index 03bf44d..a11a9ab 100644 (file)
 #include "ApplistPresenter.h"
 #include "SetDesktopView.h"
 #include "NativeRegisterManager.h"
-
-
-#ifdef XTS_SUPPORT
-#include "hal_tick.h"
-#ifdef __cplusplus
-#if __cplusplus
-extern "C"
-{
-#endif
-#endif
-#ifdef XTS_SUPPORT
-    extern uint8_t is_xts_test_done(void);
-#endif
-#ifdef __cplusplus
-#if __cplusplus
-}
-#endif
-#endif
-#endif
-
 namespace OHOS {
     #define FOOTBALL_PLANE_MAX_NUM 20
 
index fe26aed..3f9c1dc 100644 (file)
@@ -92,7 +92,7 @@ namespace OHOS
                 return true;
             }
 
-            NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS);
+            NativeAbility::GetInstance().Back();
             X_DRAG_FLAG = false;
         }
         return true;
index 44d87ef..86b362c 100644 (file)
@@ -21,11 +21,10 @@ public:
 private:\r
     KeyInputListener() {}\r
     ~KeyInputListener() {}\r
-    void OnKeyPress(void);\r
+    void OnKeyPress(const KeyEvent &event);\r
     void OnKeyLongPress(const KeyEvent& event);\r
     void OnKeyRelease(const KeyEvent& event);\r
-    void CallVolumeDipSwitchControl(uint8_t status);\r
-    void PlayerVolumeDipSwitchControl(uint8_t status);\r
+    void HandlePowerKeyPress(uint16_t currentViewId);\r
 private:\r
     int32 pressFlag{0};\r
     int32 longPressFlag{0};\r
index 94f098f..cef7b17 100644 (file)
 #include "MainCallingPresenter.h"
 #include "ApplistModel.h"
 
-namespace OHOS {
-static bool IsNotifyCallStatus()
-{
-    uint16_t notifyId = NotificationManager::GetInstance()->GetShowingNotifyId();
-    if (NotificationManager::GetInstance()->HasNotifyShowing() &&
-        (notifyId == TOPIC_EVENT_HFP_WATCH_ACTIVE ||
-         notifyId == TOPIC_EVENT_HFP_PHONE_TO_WATCH)) {
-        return true;
-    } else {
-        return false;
-    }
-}
-
-static void PressAlarmNotify()
-{
-    uint16_t notifyId = NotificationManager::GetInstance()->GetShowingNotifyId();
-    if (NotificationManager::GetInstance()->HasNotifyShowing() && notifyId == TOPIC_EVENT_ALARM_RING) {
-        AlarmClockModel::GetInstance()->AlarmGetClockNum();
-        AlarmPopUpPresenter::GetInstance()->DelayAlarmRing();
-        NotificationManager::GetInstance()->StopNotify();
-    }
-}
+#include "UiConfig.h"
+#include "custom_runtime.h"
 
+extern "C" uint8_t mcu_pms_is_screen_on(void);
+extern "C" uint8_t uapi_dev_runtime_get_lock_status(void);
+namespace OHOS {
 KeyInputListener* KeyInputListener::GetInstance()
 {
     static KeyInputListener instance;
     return &instance;
 }
 
-void KeyInputListener::OnKeyPress(void)
+void KeyInputListener::OnKeyPress(const KeyEvent &event)
 {
     pressFlag = 1; // 短按标志
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "OnKeyPress: pressFlag = %d", pressFlag);
+    uint16_t currentViewId = NativeAbility::GetInstance().GetCurSliceId();
+    uint16 keyID = event.GetKeyId();
+    if (keyID == static_cast<uint16_t>(ZliteKeyCode::ZLITE_KEY_POWER))
+    {
+        if (longPressFlag == 0 && pressFlag == 1)
+        {
+            HandlePowerKeyPress(currentViewId);
+        }
+    }
     return;
 }
 
 void KeyInputListener::OnKeyLongPress(const KeyEvent& event)
 {
     longPressFlag = 1; // 长按标志
+    uint16 keyID = event.GetKeyId();
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "OnKeyLongPress: keyID = %d, longPressFlag = %d", keyID, longPressFlag);
+    return;
+}
 
+void KeyInputListener::OnKeyRelease(const KeyEvent& event)
+{
+    uint16_t currentViewId = NativeAbility::GetInstance().GetCurSliceId();
     uint16 keyID = event.GetKeyId();
-    if (keyID == static_cast<uint16_t>(ZliteKeyCode::ZLITE_KEY_POWER)) { // 电源按键
-        // 切换到关机/重启卡片
-        NativeAbility::GetInstance().ChangeSlice(VIEW_REBOOT);
-    } else if (keyID == static_cast<uint16_t>(ZliteKeyCode::ZLITE_KEY_FUNC)) { // 功能按键
-        // 切换到查看系统版本卡片
-    }
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "OnKeyRelease: keyID = %d, currentViewId = %d, longPressFlag = %d, pressFlag = %d", 
+                keyID, currentViewId, longPressFlag, pressFlag);
+    // 重置标志
+    pressFlag = 0;
+    longPressFlag = 0;
     return;
 }
 
-void KeyInputListener::CallVolumeDipSwitchControl(uint8_t status)
+//处理power键的按下逻辑
+void KeyInputListener::HandlePowerKeyPress(uint16_t currentViewId)
 {
-    VolumeSliderEventListener *volumeSliderEventListener = nullptr;
-    if (MainCallingPresenter::GetInstance() != nullptr && CallerLogModel::GetInstance()->GetCallStatus()) {
-        if (CallerLogModel::GetInstance()->GetVolumeScreenStatus()) {
-            VolumeSettingView *settingView = MainCallingPresenter::GetInstance()->GetvolumeSetting();
-            if (settingView == nullptr) {
-                return;
-            }
-            volumeSliderEventListener = settingView->GetVolumeEventListener();
-            if (volumeSliderEventListener == nullptr) {
-                return;
-            }
-            volumeSliderEventListener->ChangeVolume(static_cast<VolumeChangeStatus>(status));
-        } else {
-            MainCallingPresenter::GetInstance()->HonrsViewChange();
-            CallerLogModel::GetInstance()->SetVolumeScreenStatus(true);
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "HandlePowerKeyPress: currentViewId = %d", currentViewId);
+
+    if (currentViewId != VIEW_MAIN)
+    {
+        if (mcu_pms_is_screen_on())
+        {
+            NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN,TransitionType::TRANSITION_ZOOM);
         }
     }
-    if (IsNotifyCallStatus()) {
-        if (NotificationManager::GetInstance()->GetVolumeScreenStatus()) {
-            VolumeSettingView *settingView = GetvolumeSetting();
-            if (settingView == nullptr) {
-                return;
-            }
-            volumeSliderEventListener = settingView->GetVolumeEventListener();
-            if (volumeSliderEventListener == nullptr) {
-                return;
+    else // 当前页面是主表盘
+    {
+        if (mcu_pms_is_screen_on())
+        {
+            if (!MainViewSample::GetInstance()->IsMainClockPage())
+            {
+                if(MainViewSample::GetInstance()->IsPullUpViewPage() == PULLUP)
+                {
+                    MainViewSample::GetInstance()->HandOnKeyEventSwitchMainPullDownView();
+                }
+                MainViewSample::GetInstance()->SwitchToClockPage(); //当前页面为主表盘的其他页面时,切换回主表盘页面
             }
-            volumeSliderEventListener->ChangeVolume(static_cast<VolumeChangeStatus>(status));
-        } else {
-            HonrsViewChange();
-            NotificationManager::GetInstance()->SetVolumeScreenStatus(true);
-        }
-    }
-}
-
-void KeyInputListener::OnKeyRelease(const KeyEvent& event)
-{
-    uint16_t currentViewId = NativeAbility::GetInstance().GetCurSliceId();
-    uint16 keyID = event.GetKeyId();
-    if (keyID == static_cast<uint16_t>(ZliteKeyCode::ZLITE_KEY_POWER)) { // 电源按键
-        if (longPressFlag == 0 && pressFlag == 1) { // 短按电源键
-            if (currentViewId == VIEW_MAEKPHONE_SAMPLE ||
-                NotificationManager::GetInstance()->GetWatchCallStatus()) { // 音量卡片
-                // 音量+
-                CallVolumeDipSwitchControl(VOLUMEUP);
-            } else if (currentViewId != VIEW_MAIN) { // 主表盘
-                PressAlarmNotify(); // 当前为闹钟通知页面时,先处理闹钟再切换页面
-                NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN, TransitionType::TRANSITION_ZOOM);
-            } else {
-                PressAlarmNotify(); // 当前为闹钟通知页面时,先处理闹钟再切换页面
-                if (!MainViewSample::GetInstance()->IsMainClockPage()) { // 当前页面为主表盘的其他页面时,切换回主表盘页面
-                    MainViewSample::GetInstance()->SwitchToClockPage();
-                } else {
+            else
+            {
+                if (uapi_dev_runtime_get_lock_status())
+                {
+                    NativeAbility::GetInstance().ChangeSlice(VIEW_CODED_LOCK);
+                }
+                else
+                {
                     if (ApplistModel::GetInstance().GetCurrentStyle() == AppListStyle::WATERFALL_STYLE) {
                         NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST, TransitionType::TRANSITION_ENTER_WATERFALL);
                     } else {
@@ -131,21 +107,11 @@ void KeyInputListener::OnKeyRelease(const KeyEvent& event)
                 }
             }
         }
-    } else if (keyID == static_cast<uint16_t>(ZliteKeyCode::ZLITE_KEY_FUNC)) { // 功能按键
-        if (longPressFlag == 0 && pressFlag == 1) { // 短按功能键
-            if (currentViewId == VIEW_MAEKPHONE_SAMPLE ||
-                NotificationManager::GetInstance()->GetWatchCallStatus()) { // 音量卡片
-                // 音量-
-                CallVolumeDipSwitchControl(VOLUMEDOWN);
-            } else {
-                // 切换到用户配置的快捷卡片
-            }
+        else
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Screen is off");
         }
     }
-
-    pressFlag = 0;
-    longPressFlag = 0;
-    return;
 }
 
 bool KeyInputListener::OnKeyAct(UIView& view, const KeyEvent& event)
@@ -156,7 +122,7 @@ bool KeyInputListener::OnKeyAct(UIView& view, const KeyEvent& event)
 
     switch (state) {
         case InputDevice::STATE_PRESS: // 短按
-            OnKeyPress();
+            OnKeyPress(event);
             break;
 #ifdef __LITEOS_M__
         case InputDevice::STATE_LONG_PRESS: // 长按
index d544024..5b4a2ad 100644 (file)
@@ -49,10 +49,8 @@ static constexpr const char *DROPDOWN_CLICK_SAVEELE =
 static constexpr const char *DROPDOWN_CLICK_FINDMYPHONE =
     "dropdownclickfindmyphone"; // ���ֻ�
 
-static constexpr const char *CONNECTEDSTATUSBACKGROUNDBUTTON =
-    "connectedstatusbackgroundbutton"; // ����״̬��ť
-static constexpr const char *CONNECTEDSTATUSVIEWCLOSEBUTTON =
-    "connectedstatusviewclosebutton"; // ����״̬��ͼ�Ĺرհ�ť
+static constexpr const char *CONNECTEDSTATUSBACKGROUNDBUTTON = "connectedstatusbackgroundbutton"; // 下拉界面的连接状态按钮视图ID
+static constexpr const char *CONNECTEDSTATUSVIEWCLOSEBUTTON = "connectedstatusviewclosebutton";   // 下拉连接界面的关闭按钮视图ID
 
 constexpr uint16_t VERTICAL_STATUS = 1;
 constexpr uint16_t HORIZONTAL_STATUS = 0;
@@ -117,7 +115,6 @@ private:
   void SetCompassRotate(void);
   void OpenCompassSensor(void);
   void CloseCompassSensor(void);
-  KeyInputListener *keyActListener_{nullptr};
   uint8_t state_ = UICheckBox::UICheckBoxState::MAX_STATUS_NUM;
   int64_t playerCurrentTime_{0};
   int64_t playerMusicDuration_{0};
index 51cf384..9fe460c 100644 (file)
@@ -286,9 +286,7 @@ namespace OHOS
             return false;
         }
         CloseButton->SetPosition(118, 340, 230, 80);
-#ifdef FD230_650
         CloseButton->SetViewId(CONNECTEDSTATUSVIEWCLOSEBUTTON);
-#endif
         CloseButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
         CloseButton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff000000, UIButton::PRESSED);
         UIView::OnClickListener *listener = static_cast<UIView::OnClickListener *>(MainPresenterSample::GetInstance());
index c6c4099..f764cc6 100644 (file)
@@ -267,9 +267,7 @@ namespace OHOS
             }
         }
         connectedStatusBackgroundButton->SetPosition(153, 10, 160, 50);
-#ifdef FD230_650
         connectedStatusBackgroundButton->SetViewId(CONNECTEDSTATUSBACKGROUNDBUTTON);
-#endif
         connectedStatusBackgroundButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
         connectedStatusBackgroundButton->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
         connectedStatusBackgroundButton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff383838, UIButton::PRESSED);
@@ -895,7 +893,7 @@ namespace OHOS
         }
 
         // bool isCharging = get_charge_stat(); // 获取充电状态
-           bool isCharging = true; 
+           bool isCharging = false; 
 
         if (isCharging)
         {
index b12ef21..b8f5324 100644 (file)
@@ -2340,6 +2340,18 @@ static uint32_t mcu_pms_get_screen_state(uint8_t *para, uint32_t para_len)
     wstp_print("app get screen state = %s . \r\n", state==SCREEN_ON?"on":"off");\r
     return ERRCODE_SUCC;\r
 }\r
+\r
+uint8_t mcu_pms_is_screen_on(void)\r
+{\r
+    const power_display_svr_api_t *display_api = power_display_svr_get_api();\r
+    screen_state_t state = display_api->get_screen_state();\r
+    wstp_print("app get screen state = %u, on is %u, off is %u. \r\n", state, SCREEN_ON, SCREEN_OFF);\r
+    if( state == SCREEN_ON){\r
+        return 1;\r
+    }else{\r
+        return 0;\r
+    }\r
+}\r
 #endif\r
 \r
 #ifdef FT_DONGLE\r
index e58aff1..6cb6b64 100644 (file)
@@ -31,7 +31,7 @@
 #define BUILD_TYPE "release"\r
 #define BUILD_USER "luozheng"\r
 #define BUILD_HOST "linux"\r
-#define BUILD_TIME "20250508"//ci处本来是和真正的编译时间一致的,当下写死,因为后面提交的时候也要求必须一致。动态是我们平时release的状态,这个功能以后添加\r
+#define BUILD_TIME "20250514"//ci处本来是和真正的编译时间一致的,当下写死,因为后面提交的时候也要求必须一致。动态是我们平时release的状态,这个功能以后添加\r
 #define BUILD_ROOTHASH "default"\r
 \r
 #define HASH_LENGTH 32\r