38 lines
1.0 KiB
C++
38 lines
1.0 KiB
C++
/*
|
|
* Copyright (c) CompanyNameMagicTag 2024-2024. All rights reserved.
|
|
* Description: TjdUiAppAodPresenter
|
|
* Author:
|
|
* Create: 2024-10-30
|
|
*/
|
|
|
|
#include "TjdUiAppAodPresenter.h"
|
|
#include "NativeAbility.h"
|
|
#include "TjdUiRegisterManager.h"
|
|
#include "TjdUiSettingCenter.h"
|
|
#include "power_display_service.h"
|
|
|
|
namespace TJD {
|
|
|
|
TJD_REGIST_SLICE(TJD_APP_VIEW_AOD, TjdUiAppAodView, TjdUiAppAodPresenter);
|
|
|
|
void TjdUiAppAodPresenter::OnResume() { TjdUiSettingCenter::GetInstance().SetLowPowerMode(true); }
|
|
|
|
void TjdUiAppAodPresenter::OnPause() { TjdUiSettingCenter::GetInstance().SetLowPowerMode(false); }
|
|
|
|
void TjdUiAppAodPresenter::Notify()
|
|
{
|
|
view_->PeriodicUpdate();
|
|
uint32_t preiod = GetPeriod();
|
|
/* 十秒自动灭屏 */
|
|
timerCount_ += preiod;
|
|
if (timerCount_ >= 10000) {
|
|
timerCount_ = 0;
|
|
const power_display_svr_api_t *screenApi = power_display_svr_get_api();
|
|
if (screenApi->get_screen_state() != screen_state_t::SCREEN_OFF) {
|
|
screenApi->turn_off_screen();
|
|
}
|
|
}
|
|
}
|
|
|
|
} // namespace TJD
|