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:
committed by
dshivangi
parent
a9ef330701
commit
b830e703f3
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.settings.display;
|
||||
|
||||
import static com.android.settingslib.devicestate.DeviceStateAutoRotateSettingUtils.isDeviceStateRotationLockEnabled;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
@@ -25,7 +27,6 @@ import com.android.internal.view.RotationPolicy;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.BasePreferenceController;
|
||||
import com.android.settingslib.core.AbstractPreferenceController;
|
||||
import com.android.settingslib.devicestate.DeviceStateRotationLockSettingsManager;
|
||||
import com.android.settingslib.devicestate.SettableDeviceState;
|
||||
import com.android.settingslib.search.SearchIndexableRaw;
|
||||
|
||||
@@ -51,8 +52,8 @@ public class DeviceStateAutoRotationHelper {
|
||||
|
||||
static ImmutableList<AbstractPreferenceController> createPreferenceControllers(
|
||||
Context context) {
|
||||
List<SettableDeviceState> settableDeviceStates = DeviceStateRotationLockSettingsManager
|
||||
.getInstance(context).getSettableDeviceStates();
|
||||
List<SettableDeviceState> settableDeviceStates = DeviceStateAutoRotateSettingManagerProvider
|
||||
.getSingletonInstance(context).getSettableDeviceStates();
|
||||
int numDeviceStates = settableDeviceStates.size();
|
||||
if (numDeviceStates == 0) {
|
||||
return ImmutableList.of();
|
||||
@@ -99,7 +100,7 @@ public class DeviceStateAutoRotationHelper {
|
||||
/** Returns whether the device state based auto-rotation settings are enabled. */
|
||||
public static boolean isDeviceStateRotationEnabled(Context context) {
|
||||
return RotationPolicy.isRotationLockToggleVisible(context)
|
||||
&& DeviceStateRotationLockSettingsManager.isDeviceStateRotationLockEnabled(context);
|
||||
&& isDeviceStateRotationLockEnabled(context);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -108,6 +109,6 @@ public class DeviceStateAutoRotationHelper {
|
||||
*/
|
||||
public static boolean isDeviceStateRotationEnabledForA11y(Context context) {
|
||||
return RotationPolicy.isRotationSupported(context)
|
||||
&& DeviceStateRotationLockSettingsManager.isDeviceStateRotationLockEnabled(context);
|
||||
&& isDeviceStateRotationLockEnabled(context);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user