Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 21852969 authored by dshivangi's avatar dshivangi
Browse files

Encapsulate auto-rotate handling for non-user-settable device states

Encapsulate `DeviceStateAutoRotateSettingManagerImpl` to handle the specific logic for auto-rotate settings related to non-user-settable device states.

`DeviceStateAutoRotateSettingManagerImpl` will make sure:
- Ensures non-user-settable device states are always persisted with the value `0` (`DEVICE_STATE_ROTATION_LOCK_IGNORED`).
- When an auto-rotate setting is requested for a non-user-settable state, it resolves to the value held by its mapped fallback posture.
- The getter for settings will return `null` if the persisted setting is corrupted (e.g., a non-user-settable state has a value other than `DEVICE_STATE_ROTATION_LOCK_IGNORED`).
- When settings are written, any value specified for a non-user-settable state is instead persisted for its mapped fallback device posture.

The `DeviceStateAutoRotateSettingController` will interact with this manager and will only receive resolved setting values, without needing to know about the "IGNORED" non-user-settable states.
Next CL: Make sure SettingManager and SettingController dont use deviceState and devicePosture interchangeably

Test: atest DeviceStateAutoRotateSettingManagerImplTest DeviceStateAutoRotateSettingControllerTests DeviceStateRotationLockSettingsManagerTest FoldableAutoRotationSettings
Fixes: 418420376
Fixes: 418711335
Flag: com.android.window.flags.enable_device_state_auto_rotate_setting_refactor

Change-Id: I5c22fbb7c4e40d9360f229d1b7bac26a45515a7a
parent 8edc992d
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment