static int g_retNum{0}; // 电话个数
static int g_volumeLocal{0}; // 错误码返回
osTimerId_t g_startCounting = nullptr; // 定时器
+//
+osTimerId_t g_shake = nullptr; // 循环震动定时器
+
static constexpr uint64_t MS_ONE_SECONDS = 1000;
static PhoneCallInfo callList[MULTI_CALL_MAX_NUME]{};
// 电话优先级标志位
return;
}
+
+static void DisshakeTimer()
+{
+ if (g_shake != nullptr) {
+ osStatus_t ret = osTimerDelete(g_shake);
+ if (ret != osOK) {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ScanTimerCallback osTimerDelete failed, ret = %lx!!", ret);
+ return;
+ }
+ g_shake = nullptr;
+ }
+}
+
/* 关闭定时器 */
static void DisableCallingTimer()
{
CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::callleisure);
NotificationManager::GetInstance()->SetWatchCallStatus(false);
CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourcePhone);
-
- PhoneServiceScreenCtr(false);
+ DisshakeTimer();
// If the call is handling in the notification, the slice is not switched
if (!CallerLogModel::GetInstance()->GetNotifyFlag())
{
+ PhoneServiceScreenCtr(false);
if(NativeAbility::GetInstance().GetCurSliceId() == VIEW_INCOMING_CALL)
{
- //NativeAbility::GetInstance().ChangeSlice(NativeAbility::GetInstance().GetPreSliceId());
NativeAbility::GetInstance().Back_CountSlice_make_phone();
}
SetText(CallerLogModel::GetInstance()->DisplayCallDuration().c_str());
}
+static void snakeCallback(int data)
+{
+ if (true != OHOS::ConfigModel::GetInstance()->GetDnotdisturb() && (!uapi_sleep_mode_flag_get()))
+ {
+ ui_api_vibrate_once_func();
+ }
+}
+
+
static void CallTimerCallback(int data)
{
GraphicService::GetInstance()->PostGraphicEvent(std::bind(CallTimerCallbackProc, data));
}
+
+
/* 开启定时器 */
static void InitCallingTimer()
{
}
}
+static void InitshakeTimer()
+{
+ if (g_shake != nullptr) {
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CallerLogModel::CallerTimer already exists!!");
+ return;
+ }
+ g_shake = osTimerNew((osTimerFunc_t)snakeCallback, osTimerPeriodic, nullptr, nullptr);
+ if (g_shake == nullptr) {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallerLogModel::CallerTimer osTimerNew failed!!");
+ return;
+ }
+ int tick = osMs2Tick(MS_ONE_SECONDS);
+ osStatus_t retTimer = osTimerStart(g_shake, tick);
+ if (retTimer != osOK) {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallerLogModel::CallerTimer osTimerStart failed, ret = %lx!!", retTimer);
+ if (g_shake != nullptr) {
+ retTimer = osTimerDelete(g_shake);
+ if (retTimer != osOK) {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallerLogModel::osTimerDelete failed, ret = %lx!!", retTimer);
+ return;
+ }
+ g_shake = nullptr;
+ }
+ return;
+ }
+}
+
+
+
/* 判断是否有电话,判断优先级 */
bool FindCallListInfoAndSetPriorityNumber()
{
{
// If the call is handling in the notification, the slice is not switched
if (lastStatus != OPERATE_PHONE_ACTIVE) {
- NativeAbility::GetInstance().ChangeSlice(VIEW_INCOMING_CALL, TransitionType::TRANSITION_INVALID,
+ NativeAbility::GetInstance().ChangeSlice(VIEW_INCOMING_CALL, TransitionType::TRANSITION_INVALID,
PRIORITY_ONE);
}
}
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[UsingPhoneChangeStatusCallback] operate:%d, callNUm:%d, call flow:%d",
phoneCall->operate, GetCurrCallNum(), IsCompleteCallFlow());
+ DisshakeTimer();
+
if (phoneCall->operate == OPERATE_WATCH_FINISH && GetCurrCallNum() == 0) {
g_callOperate = OPERATE_WATCH_FINISH;
WatchFinishHandle();
case OPERATE_INCOMING:
// 显示电话呼入
{
- IncomingHandle();
+ InitshakeTimer();
+
+ IncomingHandle();
+
}
break;
case OPERATE_WAITING: