Integrate refactored device-state auto-rotate setting manager

Added DeviceStateAutoRotateSettingManagerProvider to provide appropriate implementation of DeviceStateAutoRotateSettingManager based on flag.
Integrate DeviceStateAutoRotateSettingManagerImpl to be used when auto-rotate refactor flag is ON.
For more info:go/auto-rotate-refactor
Bug: 394303723
Bug: 394303731
Flag: com.android.window.flags.enable_device_state_auto_rotate_setting_refactor
Test: atest DeviceStateAutoRotateSettingManagerProviderTest

Change-Id: I63494b6548f1f533a9a1979f2b19640c3ad1dc8d
This commit is contained in:
Shivangi Dubey
2025-03-17 05:11:25 -07:00
committed by dshivangi
parent a9ef330701
commit b830e703f3
9 changed files with 201 additions and 31 deletions

View File

@@ -58,7 +58,6 @@ import com.android.settings.testutils.ResolveInfoBuilder;
import com.android.settings.testutils.shadow.ShadowDeviceStateRotationLockSettingsManager;
import com.android.settings.testutils.shadow.ShadowRotationPolicy;
import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.devicestate.DeviceStateRotationLockSettingsManager;
import org.junit.Before;
import org.junit.Test;
@@ -258,15 +257,14 @@ public class SmartAutoRotatePreferenceFragmentTest {
private void enableDeviceStateSettableRotationStates(
String[] settableStates, String[] settableStatesDescriptions) {
when(mResources.getStringArray(
com.android.internal.R.array.config_perDeviceStateRotationLockDefaults))
com.android.internal.R.array.config_perDeviceStateRotationLockDefaults))
.thenReturn(settableStates);
when(mResources.getStringArray(R.array.config_settableAutoRotationDeviceStatesDescriptions))
.thenReturn(settableStatesDescriptions);
when(mResources.getBoolean(R.bool.config_auto_rotate_face_detection_available))
.thenReturn(true);
DeviceStateRotationLockSettingsManager.resetInstance();
DeviceStateRotationLockSettingsManager.getInstance(mContext)
.resetStateForTesting(mResources);
DeviceStateAutoRotateSettingManagerProvider.resetInstance();
when(mContext.getResources()).thenReturn(mResources);
}
// Sets up posture mappings for PosturesHelper