!10894 开机状态检测

Merge pull request !10894 from HUMBLE./new
This commit is contained in:
openharmony_ci 2024-11-20 07:14:52 +00:00 committed by Gitee
commit 78c0b82e75
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 24 additions and 15 deletions

View File

@ -53,7 +53,7 @@ public:
FoldStatus MatchSuperFoldStatusToFoldStatus(SuperFoldStatus superFoldStatus);
private:
std::atomic<SuperFoldStatus> curState_ = SuperFoldStatus::HALF_FOLDED;
std::atomic<SuperFoldStatus> curState_ = SuperFoldStatus::UNKNOWN;
struct Transition {
SuperFoldStatus nextState;
@ -75,8 +75,6 @@ private:
static void DoFoldedToHalfFolded(SuperFoldStatusChangeEvents event);
static void DoExpandedToKeyboard(SuperFoldStatusChangeEvents event);
void SetCurrentStatus(SuperFoldStatus curState);
void HandleDisplayNotify(SuperFoldStatusChangeEvents changeEvent);

View File

@ -102,8 +102,8 @@ void SuperFoldSensorManager::RegisterHallCallback()
void SuperFoldSensorManager::UnregisterHallCallback()
{
int32_t deactivateRet = DeactivateSensor(SENSOR_TYPE_ID_HALL_EXT, &hallUser);
int32_t unsubscribeRet = UnsubscribeSensor(SENSOR_TYPE_ID_HALL_EXT, &hallUser);
int32_t deactivateRet = DeactivateSensor(SENSOR_TYPE_ID_HALL, &hallUser);
int32_t unsubscribeRet = UnsubscribeSensor(SENSOR_TYPE_ID_HALL, &hallUser);
if (deactivateRet == SENSOR_SUCCESS && unsubscribeRet == SENSOR_SUCCESS) {
TLOGI(WmsLogTag::DMS, "UnRegisterHallCallback success.");
}

View File

@ -110,11 +110,6 @@ void SuperFoldStateManager::DoFoldedToHalfFolded(SuperFoldStatusChangeEvents eve
TLOGI(WmsLogTag::DMS, "SuperFoldStateManager::DoFoldedToHalfFolded()");
}
void SuperFoldStateManager::DoExpandedToKeyboard(SuperFoldStatusChangeEvents event)
{
TLOGI(WmsLogTag::DMS, "SuperFoldStateManager::DoExpandedToKeyboard()");
}
SuperFoldStateManager::SuperFoldStateManager()
{
AddStateManagerMap(SuperFoldStatus::HALF_FOLDED,
@ -142,15 +137,31 @@ SuperFoldStateManager::SuperFoldStateManager()
SuperFoldStatus::KEYBOARD,
&SuperFoldStateManager::DoKeyboardOn);
AddStateManagerMap(SuperFoldStatus::EXPANDED,
SuperFoldStatusChangeEvents::KEYBOARD_ON,
SuperFoldStatus::HALF_FOLDED,
&SuperFoldStateManager::DoExpandedToKeyboard);
AddStateManagerMap(SuperFoldStatus::KEYBOARD,
SuperFoldStatusChangeEvents::KEYBOARD_OFF,
SuperFoldStatus::HALF_FOLDED,
&SuperFoldStateManager::DoKeyboardOff);
// 开机状态自检
AddStateManagerMap(SuperFoldStatus::UNKNOWN,
SuperFoldStatusChangeEvents::KEYBOARD_ON,
SuperFoldStatus::KEYBOARD,
[&](SuperFoldStatusChangeEvents events) {});
AddStateManagerMap(SuperFoldStatus::UNKNOWN,
SuperFoldStatusChangeEvents::ANGLE_CHANGE_HALF_FOLDED,
SuperFoldStatus::HALF_FOLDED,
[&](SuperFoldStatusChangeEvents events) {});
AddStateManagerMap(SuperFoldStatus::UNKNOWN,
SuperFoldStatusChangeEvents::ANGLE_CHANGE_EXPANDED,
SuperFoldStatus::EXPANDED,
[&](SuperFoldStatusChangeEvents events) {});
AddStateManagerMap(SuperFoldStatus::UNKNOWN,
SuperFoldStatusChangeEvents::ANGLE_CHANGE_FOLDED,
SuperFoldStatus::FOLDED,
[&](SuperFoldStatusChangeEvents events) {});
}
SuperFoldStateManager::~SuperFoldStateManager() = default;