From 787056d4f221d28d31a04311ab54720440f3769a Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E7=BD=97=E6=AD=A3?= <1732036298@qq.com> Date: Thu, 19 Dec 2024 03:20:07 +0000 Subject: [PATCH] Merge #1531 into sdk602patch0911 from refs/changes/1531/head MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit - 解决闹钟弹窗取消其他界面的长亮屏操作 - 添加手表运行时操作log记录 --- .../nativeui/aivoice/src/AiVoiceModel.cpp | 5 ++- .../nativeui/countdown/src/CountDownModel.cpp | 12 +++++-- .../nativeui/player/src/PlayersModel.cpp | 31 +++++++++++++++-- .../nativeui/player/src/PlayersPresenter.cpp | 5 +++ .../record/src/RecordingPresenter.cpp | 5 ++- .../nativeui/system/src/SystemLogModel.cpp | 24 +++++++++++++- .../include/notify/alarm_notification.h | 2 ++ .../include/notify/findwatch_notification.h | 6 ++-- .../msg_center/src/msg_center_customer.cpp | 17 ++++++++-- .../src/notify/alarm_notification.cpp | 19 ++++++++++- .../src/notify/findwatch_notification.cpp | 13 +++++--- .../src/actions/display_action.c | 4 ++- .../peripheral/utils/custom_save_runtime.h | 33 +++++++++++++++++-- tools/log_parser/runtimeanalysis.py | 26 +++++++++++++-- 14 files changed, 180 insertions(+), 22 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceModel.cpp index 16eb9612a..2199c1b71 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceModel.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-06-20 15:14:50 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-12-05 15:04:21 + * @LastEditTime: 2024-12-18 14:33:30 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceModel.cpp */ #include "aivoice/include/AiVoiceModel.h" @@ -27,6 +27,7 @@ #include #include #include "bleService.h" +#include namespace OHOS { // 声明定时器变量 @@ -538,6 +539,7 @@ namespace OHOS #elif CURRENT_AIAUDIO_TYPE == AIAUDIO_TYPE_MSBC const char *defaultArgs[6] = {"01", "msbc", "16000", "1", "16", audioPath.c_str()}; #endif + uapi_save_runtime_log(RUNTIME_LOG_RECORD_START_AI);//TOOD* AudioCaptureSample(6, (const char **)defaultArgs); } return; @@ -550,6 +552,7 @@ namespace OHOS int32_t argc = 1; uint8_t *argv = (uint8_t *)"stop"; AudioCaptureSample(argc, (const char **)&argv); + uapi_save_runtime_log(RUNTIME_LOG_RECORD_STOP_AI);//TOOD* return; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/countdown/src/CountDownModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/countdown/src/CountDownModel.cpp index 9c8817f6a..f32602644 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/countdown/src/CountDownModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/countdown/src/CountDownModel.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-04-07 18:15:53 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-11-21 16:38:01 + * @LastEditTime: 2024-12-18 17:42:19 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/countdown/src/CountDownModel.cpp */ #include "countdown/include/CountDownModel.h" @@ -20,6 +20,7 @@ #include "NativeAbility.h" #include #include +#include namespace OHOS { /* -------------------------------------------------------------------------- */ @@ -208,7 +209,12 @@ namespace OHOS // playerCtr->SetVolume(50, 50); // 将左声道和右声道音量都设置为50 playerCtr->SetAudioSessionId(sessionId); // 播放 - playerCtr->Play(); + ret = playerCtr->Play(); + if(ret == 0) + { + //如果倒计时铃声播放成功,记录该事件 + uapi_save_runtime_log(RUNTIME_LOG_RING_PLAY_START_COUNTDOWN);//TOOD* + } playerCtr->EnableSingleLooping(true); // 设置是否循环播放 return OHOS_SUCCESS; } @@ -258,6 +264,8 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[CountDownModel] Failed to stop the player"); return OHOS_FAILURE; } + //如果倒计时铃声停止播放成功,记录该事件 + uapi_save_runtime_log(RUNTIME_LOG_RING_PLAY_STOP_COUNTDOWN);//TOOD* } ret = playerCtr->Reset(); if (ret != 0) diff --git a/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersModel.cpp index bf5da77ba..5ab941c6b 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersModel.cpp @@ -23,6 +23,7 @@ #include "bluetooth/include/BluetoothHeadsetEvent.h" #include #include "system/include/SystemLogModel.h" +#include namespace OHOS { static constexpr int VOLUME_MAXIMUM = 100; @@ -139,6 +140,9 @@ int PlayersModel::PlayerStat() } AudioManager::GetInstance().DeactivateAudioInterrupt(interrupt); isActivateAudioInterrupt = false; + } else { + //如果播放成功,记录该事件 + uapi_save_runtime_log(RUNTIME_LOG_LOCAL_MUSIC_PLAY_START);//TOOD* } return OHOS_SUCCESS; } @@ -485,6 +489,9 @@ int PlayersModel::PlayerPlay(void) if (ret != 0) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Play err, ret:%d", ret); return EXECUTE_FUNC_FAILED; + } else { + //如果播放成功,记录该事件 + uapi_save_runtime_log(RUNTIME_LOG_LOCAL_MUSIC_PLAY_START);//TOOD* } PlayersModel::GetInstance()->SetPlayButtonState(true); // 播放控件图形同步 ConncetBtResetButton(); // 蓝牙连接的音频控制,对按钮属性进行设置 @@ -526,6 +533,8 @@ int PlayersModel::PlayerPause(void) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Pause err, ret:%d!!", ret); return EXECUTE_FUNC_FAILED; } else { + //本地音乐暂停成功,记录该事件 + uapi_save_runtime_log(RUNTIME_LOG_LOCAL_MUSIC_PLAY_PAUSE);//TOOD* PlayersModel::GetInstance()->SetPlayButtonState(false); ConncetBtResetButton(); return NORMAL; @@ -550,6 +559,7 @@ int PlayersModel::PlayerStop(void) return EXECUTE_FUNC_FAILED; } if (state == PlayerStates::PLAYER_STARTED || state == PlayerStates::PLAYER_PLAYBACK_COMPLETE) { + int ret = playerCtr->Stop(); if (ret != 0) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Stop err, ret:%d", ret); @@ -564,6 +574,8 @@ int PlayersModel::PlayerStop(void) PlayersModel::GetInstance()->SetPlayButtonState(false); PlayersModel::GetInstance()->SetCircleProgress(0); ConncetBtResetButton(); + // 本地音乐停止成功,记录该事件 + uapi_save_runtime_log(RUNTIME_LOG_LOCAL_MUSIC_PLAY_STOP);//TOOD* } AudioManager::GetInstance().DeactivateAudioInterrupt(interrupt); return NORMAL; @@ -576,6 +588,8 @@ int PlayersModel::PlayerStop(void) PlayersModel::GetInstance()->SetPlayButtonState(false); PlayersModel::GetInstance()->SetCircleProgress(0); ConncetBtResetButton(); + // 本地音乐停止成功,记录该事件 + uapi_save_runtime_log(RUNTIME_LOG_LOCAL_MUSIC_PLAY_STOP);//TOOD* } AudioManager::GetInstance().DeactivateAudioInterrupt(interrupt); return NORMAL; @@ -693,7 +707,11 @@ void PlayersModel::ConnectBtAndLocalPlay(int32_t connCtState, int32_t connTgStat if (connCtState == HFP_SCO_STATE_CONNECTED || connTgState == HFP_SCO_STATE_CONNECTED) { if (playerState == PlayerStates::PLAYER_PAUSED) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BTPLAYER_PAUSED play, 122."); - PlayersModel::GetInstance()->GetPlayerCtr()->Play(); // 暂停后的播放 + ret = PlayersModel::GetInstance()->GetPlayerCtr()->Play(); // 暂停后的播放 + if (ret == 0) { + //如果播放成功,记录该事件 + uapi_save_runtime_log(RUNTIME_LOG_LOCAL_MUSIC_PLAY_START);//TOOD* + } PlayersModel::GetInstance()->SetBTMusicPlay(playNotification); } else { ret = PlayersModel::GetInstance()->PlayerStat(); // 蓝牙连接播放 @@ -706,7 +724,11 @@ void PlayersModel::ConnectBtAndLocalPlay(int32_t connCtState, int32_t connTgStat } else { if (playerState == PlayerStates::PLAYER_PAUSED) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PLAYER_PAUSED play, 122."); - PlayersModel::GetInstance()->GetPlayerCtr()->Play(); + ret = PlayersModel::GetInstance()->GetPlayerCtr()->Play(); + if (ret == 0) { + //如果播放成功,记录该事件 + uapi_save_runtime_log(RUNTIME_LOG_LOCAL_MUSIC_PLAY_START);//TOOD* + } } else { ret = PlayersModel::GetInstance()->PlayerStat(); // 本地播放 if (ret != 0) { @@ -737,6 +759,11 @@ void PlayersModel::ConnectBtAndLocalPause(int32_t connCtState, int32_t connTgSta ret = PlayersModel::GetInstance()->GetPlayerCtr()->Pause(); // 本地暂停 WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Pause, ret:%d", ret); } + if(ret == 0) + { + //本地音乐暂停成功,记录该事件 + uapi_save_runtime_log(RUNTIME_LOG_LOCAL_MUSIC_PLAY_PAUSE);//TOOD* + } } void PlayersModel::ClearActivateAudioInterrupt() diff --git a/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersPresenter.cpp index 987d0062d..70c45b43f 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersPresenter.cpp @@ -26,6 +26,7 @@ #include "ConfigModel.h" #include "ctype.h" #include +#include namespace OHOS { static PlayerOnDragListener *g_pPlayerOnDragListener = nullptr; static JumpView *g_pJumpView = nullptr; @@ -1021,6 +1022,8 @@ static void Pause(void) if (state == PLAYER_STARTED) { ret = player->Pause(); if (ret == 0) { + //本地音乐暂停成功,记录该事件 + uapi_save_runtime_log(RUNTIME_LOG_LOCAL_MUSIC_PLAY_PAUSE);//TOOD* if (playersView == nullptr) { PlayersModel::GetInstance()->SetPlayButtonState(false); } else { @@ -1062,6 +1065,8 @@ static void Resume(void) if (state == PLAYER_PAUSED && PlayerIntrptListener->IsPaused() == true) { ret = player->Play(); if (ret == 0) { + //如果播放成功,记录该事件 + uapi_save_runtime_log(RUNTIME_LOG_LOCAL_MUSIC_PLAY_START);//TOOD* if (playersView == nullptr) { PlayersModel::GetInstance()->SetPlayButtonState(true); } else { diff --git a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingPresenter.cpp index ac456644a..84a7b8fc3 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingPresenter.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-03-30 09:14:38 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-11-05 14:38:39 + * @LastEditTime: 2024-12-18 14:33:46 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingPresenter.cpp */ @@ -20,6 +20,7 @@ #include #include "record/include/RecordingModel.h" #include +#include namespace OHOS { @@ -198,6 +199,7 @@ namespace OHOS p_RecordingModel->SetRecordFileName(recordfileNme); sprintf(args[5], "%s%s.mp3", RecordingModel::GetInstance()->GetRecordDirectory(), recordfileNme.c_str()); /* ---------------------------------- 开始录音 ---------------------------------- */ + uapi_save_runtime_log(RUNTIME_LOG_RECORD_START);//TOOD* AudioCaptureSample(6, (const char **)args); /* --------------------------------- 跳转到录音界面 -------------------------------- */ view_->ChangeView(RECORDINGVIEW, RECORDGOINGVIEW); @@ -217,6 +219,7 @@ namespace OHOS int32_t argc = 1; uint8_t *argv = (uint8_t *)"stop"; AudioCaptureSample(argc, (const char **)&argv); + uapi_save_runtime_log(RUNTIME_LOG_RECORD_STOP);//TOOD* /* ---------------------------------- 停止定时器 --------------------------------- */ p_RecordingModel->Recording_StopTimer(); /* --------------------------------- 录音数量加1 --------------------------------- */ diff --git a/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemLogModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemLogModel.cpp index 231b4bd7d..8de463f01 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemLogModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemLogModel.cpp @@ -27,7 +27,7 @@ #include #include #include "ConfigModel.h" - +#include "custom_save_runtime.h" #define SYSTEM_LOG_PATH "/user/system/" #define SYSTEM_LOG_FILE_PATH "/user/system/system_log.txt" #define SYSTEM_LOG_FILE_PATH_NEXTDAY "/user/system/system_log_nextday.txt" @@ -106,6 +106,28 @@ uint32_t SystemLogModel::GetCurrentTime() { // 保存日志 bool SystemLogModel::saveLog(SystemLogData data) { + //记录开机,关机,重启,ota升级,恢复出厂事件 + switch (data.type) + { + case SystemLogType::POWER_ON: + uapi_save_runtime_log(RUNTIME_LOG_POWER_ON);//TOOD* + break; + case SystemLogType::POWER_OFF: + uapi_save_runtime_log(RUNTIME_LOG_POWER_OFF);//TOOD* + break; + case SystemLogType::RESTART: + uapi_save_runtime_log(RUNTIME_LOG_REBOOT);//TOOD* + break; + case SystemLogType::FACTORY_RESET: + uapi_save_runtime_log(RUNTIME_LOG_FACTORY_RESET);//TOOD* + break; + case SystemLogType::SOFTWARE_UPDATE: + uapi_save_runtime_log(RUNTIME_LOG_OTA);//TOOD* + break; + default: + break; + } + // 将新日志添加到日志数据 logData.push_back(data); diff --git a/code/sdk/application/wearable/service/msg_center/include/notify/alarm_notification.h b/code/sdk/application/wearable/service/msg_center/include/notify/alarm_notification.h index 48a98bdff..79f8828d2 100755 --- a/code/sdk/application/wearable/service/msg_center/include/notify/alarm_notification.h +++ b/code/sdk/application/wearable/service/msg_center/include/notify/alarm_notification.h @@ -62,6 +62,8 @@ public: { return true; } + + static uint8_t pre_screen_status; }; }; // namespace OHOS diff --git a/code/sdk/application/wearable/service/msg_center/include/notify/findwatch_notification.h b/code/sdk/application/wearable/service/msg_center/include/notify/findwatch_notification.h index 0aee89176..9fc0eeb8c 100644 --- a/code/sdk/application/wearable/service/msg_center/include/notify/findwatch_notification.h +++ b/code/sdk/application/wearable/service/msg_center/include/notify/findwatch_notification.h @@ -1,8 +1,8 @@ /* * @Author: luozheng 1732036298@qq.com * @Date: 2024-03-25 17:31:19 - * @LastEditors: penglei 1624952103@qq.com - * @LastEditTime: 2024-11-27 10:44:16 + * @LastEditors: luozheng 1732036298@qq.com + * @LastEditTime: 2024-12-18 15:22:38 * @FilePath: /FD230/code/sdk/application/wearable/service/msg_center/include/notify/findwatch_notification.h */ #ifndef FIND_WATCH_NOTIFICATION_H @@ -92,6 +92,8 @@ namespace OHOS void setVolumeVal(int val); + static uint8_t pre_screen_status; + private: FindWatchViewEventListener(); ~FindWatchViewEventListener(); diff --git a/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp b/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp index 56ca0bf28..18304240b 100644 --- a/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp @@ -87,6 +87,7 @@ #include "DialModelStepgoal.h" #include "msg_center_customerC.h" #include "PhoneAGService.h" +#include #define DIALDATASET 1 //#include "Systemupgrade.h" @@ -552,12 +553,17 @@ void MsgCenterNotifyChargePlugProc(const Topic topic, Request* req) display_api->turn_on_screen(); } + //充电开始事件 + uapi_save_runtime_log(RUNTIME_LOG_CHARGE_START);//TOOD* + #if DIALDATASET DialModelCharge::GetInstance()->UpdatechargeStatus(1); #endif SaveEleModel::GetInstance()->SetChargeStatus(true); if(PullUpDownView::GetInstance()){ - PullUpDownView::GetInstance()->UpdateBatteryProcess(); + // PullUpDownView::GetInstance()->UpdateBatteryProcess(); + GraphicService::GetInstance()->PostGraphicEvent( + std::bind(&OHOS::PullUpDownView::UpdateBatteryProcess, OHOS::PullUpDownView::GetInstance() )); } /* ---------------------------------- 充电弹窗 * ---------------------------------- */ @@ -584,6 +590,9 @@ void MsgCenterNotifyChargePlugProc(const Topic topic, Request* req) /*充电器已拔掉*/ void MsgCenterNotifyChargeUnPlugProc(const Topic topic, Request* req) { + //充电停止事件 + uapi_save_runtime_log(RUNTIME_LOG_CHARGE_STOP);//TOOD* + unused(req); unused(topic); WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyProc:: CHarger UnPlug !"); @@ -593,7 +602,9 @@ void MsgCenterNotifyChargeUnPlugProc(const Topic topic, Request* req) #endif SaveEleModel::GetInstance()->SetChargeStatus(false); if(PullUpDownView::GetInstance()){ - PullUpDownView::GetInstance()->UpdateBatteryProcess(); + // PullUpDownView::GetInstance()->UpdateBatteryProcess(); + GraphicService::GetInstance()->PostGraphicEvent( + std::bind(&OHOS::PullUpDownView::UpdateBatteryProcess, OHOS::PullUpDownView::GetInstance() )); } /* ---------------------------------- 充电弹窗 ---------------------------------- */ testCHANINGView *t=testCHANINGView::GetInstance(); @@ -1433,6 +1444,8 @@ void MsgCenterNotifyFindWatchProc(const Topic topic, Request* req) FindWatchViewEventListener::GetInstance().PopInterPlayMusic(nullptr);//播放铃声 NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO); NotificationManager::GetInstance()->ShowNotify(showFindWatchNotify, (uint16_t)topic, true); + //如果查找手表铃声播放成功,记录该事件 + uapi_save_runtime_log(RUNTIME_LOG_RING_PLAY_START_FINDWATCH);//TOOD* } else { diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/alarm_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/alarm_notification.cpp index adc756196..937abc949 100755 --- a/code/sdk/application/wearable/service/msg_center/src/notify/alarm_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/alarm_notification.cpp @@ -20,6 +20,7 @@ #include #include "../../../../../../drivers/peripheral/vibrator/service/vibrator_service.h" #include +#include namespace OHOS { static constexpr const char *RING_AGAIN = "响铃将在十分钟后再次响起"; @@ -87,6 +88,8 @@ namespace OHOS constexpr int16_t DELAY_LABEL_HEIGHT = 35; constexpr int16_t DELAY_LABEL_FONT = 25; + uint8_t AlarmViewEventListener::pre_screen_status = 0;//屏幕之前的状态 + void StopNotifyCallback() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "StopNotifyCallback"); @@ -505,6 +508,12 @@ namespace OHOS /* -------------------------------------------------------------------------- */ StartAlarmTimer(AlarmTimerType::NOTIFY_ALARM_RING, NOTIFY_ONE_SECOND); ScreenAlwaysOnCtr(OPEN_SCREEN_ALWAYS_ON); + + AlarmViewEventListener::pre_screen_status = uapi_dev_runtime_get_screen_always_on_status();//获取闹钟弹窗之前是否是长亮屏状态 + if(!AlarmViewEventListener::pre_screen_status) + { + ScreenAlwaysOnCtr(OPEN_SCREEN_ALWAYS_ON); + } } NotificationManager::GetInstance()->RegisterNotifyCleanupFunction(FreeAlarmView); return g_alarmView; @@ -544,7 +553,10 @@ namespace OHOS RootView::GetInstance()->Remove(g_alarmView); delete g_alarmView; g_alarmView = nullptr; - ScreenAlwaysOnCtr(CANCEL_SCREEN_ALWAYS_ON); + if(!AlarmViewEventListener::pre_screen_status) //如果闹钟弹窗之前不是长亮屏状态,就取消闹钟弹窗设置的常亮屏 + { + ScreenAlwaysOnCtr(CANCEL_SCREEN_ALWAYS_ON); + } WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "FreeAlarmView over!!"); } } @@ -645,6 +657,8 @@ namespace OHOS #else FindWatchViewEventListener::GetInstance().PopInterPlayMusic("/music/ring/alarm.mp3");//播放铃声 #endif + //如果闹钟铃声播放成功,记录该事件 + uapi_save_runtime_log(RUNTIME_LOG_RING_PLAY_START_ALARM);//TOOD* } void AlarmViewEventListener::CancelAlarmRing() @@ -653,6 +667,9 @@ namespace OHOS FindWatchViewEventListener::GetInstance().PopInterCancelMusic(); AlarmClockModel::GetInstance()->CancelAlarmRing(); NotificationManager::GetInstance()->StopNotify(); + + //如果闹钟铃声停止播放成功,记录该事件 + uapi_save_runtime_log(RUNTIME_LOG_RING_PLAY_STOP_ALARM);//TOOD* } void AlarmViewEventListener::DelayAlarmRing() diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/findwatch_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/findwatch_notification.cpp index 0072bb4fa..e8209845c 100644 --- a/code/sdk/application/wearable/service/msg_center/src/notify/findwatch_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/findwatch_notification.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-03-25 17:33:47 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-12-10 15:03:45 + * @LastEditTime: 2024-12-18 15:23:13 * @FilePath: /FD230/code/sdk/application/wearable/service/msg_center/src/notify/findwatch_notification.cpp * @details:实现查找手表的功能一般需要手表和智能手机之间的配合,通常是通过手机上的应用(App)或其他设备发送指令给手表,触发手表的查找功能。 * 以下是基本的实现步骤: @@ -41,12 +41,13 @@ #include "../../../../../../../drivers/peripheral/utils/custom_runtime.h" #include #include "aivoice/include/AiVoiceModel.h" +#include namespace OHOS { UIViewGroup *FindWatchGroupView{nullptr}; UIButton *FindWatchButton{nullptr}; - uint8_t pre_screen_status = 0;//屏幕之前的状态之前 + uint8_t FindWatchViewEventListener::pre_screen_status = 0;//屏幕之前的状态 FindWatchViewEventListener::FindWatchViewEventListener() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "FindWatchViewEventListener::FindWatchViewEventListener"); @@ -474,8 +475,8 @@ namespace OHOS FindWatchViewEventListener::GetInstance().FindWatch_StartTimer(700); FindWatchViewEventListener::GetInstance().SetScreenBrightness(); - pre_screen_status = uapi_dev_runtime_get_screen_always_on_status();//获取查找手表之前是否是长亮屏状态 - if(!pre_screen_status) + FindWatchViewEventListener::pre_screen_status = uapi_dev_runtime_get_screen_always_on_status();//获取查找手表之前是否是长亮屏状态 + if(!FindWatchViewEventListener::pre_screen_status) { ScreenAlwaysOnCtr(OPEN_SCREEN_ALWAYS_ON); } @@ -505,10 +506,12 @@ namespace OHOS FindWatchViewEventListener::GetInstance().FindWatchRingPlayStop(); FindWatchViewEventListener::GetInstance().ResumeScreenBrightness(); FindWatchViewEventListener::GetInstance().FindWatch_StopTimer(); - if(!pre_screen_status) //如果查找手表之前不是长亮屏状态,就取消查找手表设置的常亮屏 + if(!FindWatchViewEventListener::pre_screen_status) //如果查找手表之前不是长亮屏状态,就取消查找手表设置的常亮屏 { ScreenAlwaysOnCtr(CANCEL_SCREEN_ALWAYS_ON); } + //如果查找手表铃声停止播放成功,记录该事件 + uapi_save_runtime_log(RUNTIME_LOG_RING_PLAY_STOP_FINDWATCH);//TOOD* } /* ----------------------- FindWatchRingPlayerListener ---------------------- */ diff --git a/code/sdk/application/wearable/service/power_manager/src/actions/display_action.c b/code/sdk/application/wearable/service/power_manager/src/actions/display_action.c index acc67a002..58601b56d 100755 --- a/code/sdk/application/wearable/service/power_manager/src/actions/display_action.c +++ b/code/sdk/application/wearable/service/power_manager/src/actions/display_action.c @@ -4,7 +4,7 @@ * Author: * Create: */ - +#include #include "power_display_service.h" #include "display_action.h" #include "common_def.h" @@ -186,6 +186,7 @@ static uint32_t action_display_lcd_on() //增加视频表盘的播放; PRINT("开始亮屏\n"); + uapi_save_runtime_log(RUNTIME_LOG_LCD_ON);//TOOD* return ERRCODE_SUCC; } @@ -208,6 +209,7 @@ static uint32_t action_display_lcd_off() } //增加视频表盘的暂停; PRINT("开始灭屏\n"); + uapi_save_runtime_log(RUNTIME_LOG_LCD_OFF);//TOOD* last_screen_off_timestamp = get_display_timestamp(); caculate_screen_on_time(); diff --git a/code/sdk/drivers/peripheral/utils/custom_save_runtime.h b/code/sdk/drivers/peripheral/utils/custom_save_runtime.h index 03ef145ca..4e5464d82 100644 --- a/code/sdk/drivers/peripheral/utils/custom_save_runtime.h +++ b/code/sdk/drivers/peripheral/utils/custom_save_runtime.h @@ -1,3 +1,10 @@ +/* + * @Author: luozheng 1732036298@qq.com + * @Date: 2024-12-18 10:27:52 + * @LastEditors: luozheng 1732036298@qq.com + * @LastEditTime: 2024-12-18 16:53:11 + * @FilePath: /FD230/code/sdk/drivers/peripheral/utils/custom_save_runtime.h + */ /** * Copyright (c) @CompanyNameMagicTag 2022-2022. All rights reserved. \n * @@ -22,8 +29,11 @@ extern "C" { typedef enum { //开机关机 RUNTIME_LOG_POWER_MIN =0x0000, - RUNTIME_LOG_POWER_ON,//0x0001 - RUNTIME_LOG_OTA, // + RUNTIME_LOG_POWER_ON, //0x0001 开机 + RUNTIME_LOG_POWER_OFF, //0x0002 关机 + RUNTIME_LOG_REBOOT, //0x0003 重启 + RUNTIME_LOG_OTA, //0x0004 ota升级 + RUNTIME_LOG_FACTORY_RESET, //0x0005 恢复出厂设置 //蓝牙 RUNTIME_LOG_BLE_MIN=0x0100, @@ -81,24 +91,43 @@ typedef enum { RUNTIME_LOG_OXTGEN_MIN= 0x0700, //LCD RUNTIME_LOG_LCD_MIN=0x0800, + RUNTIME_LOG_LCD_ON, //0x0801 屏幕亮 + RUNTIME_LOG_LCD_OFF, //0x0802 屏幕灭 //抬腕 RUNTIME_LOG_RAISE_MIN=0x0900, //充电 RUNTIME_LOG_CHARGE_MIN=0x0A00, + RUNTIME_LOG_CHARGE_START, //0x0A01 充电开始 + RUNTIME_LOG_CHARGE_STOP, //0x0A02 充电停止 //电池电量变化 RUNTIME_LOG_BATTERY_MIN=0x0B00, //马达 RUNTIME_LOG_MOTOR_MIN=0x0C00, + RUNTIME_LOG_MOTOR_START, //0x0C01 马达开始转动 + RUNTIME_LOG_MOTOR_STOP, //0x0C02 马达停止转动 //表盘 RUNTIME_LOG_DIAL_MIN=0x0D00, //音乐 RUNTIME_LOG_MUSIC_MIN=0x0E00, + RUNTIME_LOG_LOCAL_MUSIC_PLAY_START, //0x0E01 本地音乐开始播放 + RUNTIME_LOG_LOCAL_MUSIC_PLAY_PAUSE, //0x0E02 本地音乐开始暂停 + RUNTIME_LOG_LOCAL_MUSIC_PLAY_STOP, //0x0E03 本地音乐播放停止 //铃声 RUNTIME_LOG_RING_MIN=0x0F00, + RUNTIME_LOG_RING_PLAY_START_ALARM, //0x0F01 闹钟铃声开始播放 + RUNTIME_LOG_RING_PLAY_STOP_ALARM, //0x0F02 闹钟铃声播放停止 + RUNTIME_LOG_RING_PLAY_START_COUNTDOWN, //0x0F03 倒计时铃声开始播放 + RUNTIME_LOG_RING_PLAY_STOP_COUNTDOWN, //0x0F04 倒计时铃声播放停止 + RUNTIME_LOG_RING_PLAY_START_FINDWATCH, //0x0F05 查找手表铃声开始播放 + RUNTIME_LOG_RING_PLAY_STOP_FINDWATCH, //0x0F06 查找手表铃声播放停止 //低功耗记录 RUNTIME_LOG_lOW_POWER_MIN=0x1000, //录音 RUNTIME_LOG_RECORD_MIN=0x1100, + RUNTIME_LOG_RECORD_START, //0x1101 录音开始 + RUNTIME_LOG_RECORD_STOP, //0x1102 录音停止 + RUNTIME_LOG_RECORD_START_AI, //0x1103 AI录音开始 + RUNTIME_LOG_RECORD_STOP_AI, //0x1104 AI录音停止 } runtime_log_cmd_Id; diff --git a/tools/log_parser/runtimeanalysis.py b/tools/log_parser/runtimeanalysis.py index da3d327a1..480c62428 100644 --- a/tools/log_parser/runtimeanalysis.py +++ b/tools/log_parser/runtimeanalysis.py @@ -6,8 +6,30 @@ path = r"." txtname = sys.argv[-1] -str_bin_list =[['0000',"测试 "], - ['0001',"测试2 "] +# 字母要小写 +str_bin_list =[ + ['0001',"开机 "], + ['0002',"关机 "], + ['0003',"重启 "], + ['0004',"ota升级 "], + ['0005',"恢复出厂设置 "], + ['0801',"屏幕亮 "], + ['0802',"屏幕灭 "], + ['0a01',"充电开始 "], + ['0a02',"充电停止 "], + ['0e01',"本地音乐开始播放 "], + ['0e02',"本地音乐开始暂停 "], + ['0e03',"本地音乐播放停止 "], + ['0f01',"闹钟铃声开始播放 "], + ['0f02',"闹钟铃声播放停止 "], + ['0f03',"倒计时铃声开始播放 "], + ['0f04',"倒计时铃声播放停止 "], + ['0f05',"查找手表铃声开始播放 "], + ['0f06',"查找手表铃声播放停止 "], + ['1101',"录音开始 "], + ['1102',"录音停止 "], + ['1103',"AI录音开始 "], + ['1104',"AI录音停止 "] ] -- 2.17.1