Creates a flag for auto-rotate with face detection
The flag is enabled by default. And will be disabled on foldable devices. Test: locally Bug: 236249360 Change-Id: I8c90533f6011531a4f00af5f2514579638604067
This commit is contained in:
@@ -111,6 +111,8 @@ public class SmartAutoRotatePreferenceFragmentTest {
|
||||
when(mActivity.getPackageManager()).thenReturn(mPackageManager);
|
||||
when(mFragment.getActivity()).thenReturn(mActivity);
|
||||
when(mFragment.getContext()).thenReturn(mContext);
|
||||
when(mActivity.getResources()).thenReturn(mResources);
|
||||
|
||||
doReturn(mView).when(mFragment).getView();
|
||||
|
||||
when(mFragment.findPreference(AUTO_ROTATE_SWITCH_PREFERENCE_KEY)).thenReturn(
|
||||
@@ -152,6 +154,17 @@ public class SmartAutoRotatePreferenceFragmentTest {
|
||||
verify(mRotateSwitchPreference, never()).setVisible(false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createHeader_faceDetectionNotEnabledByConfig_switchBarIsDisabled() {
|
||||
doReturn(false).when(mResources).getBoolean(
|
||||
R.bool.config_auto_rotate_face_detection_available);
|
||||
|
||||
mFragment.createHeader(mActivity);
|
||||
|
||||
verify(mRotateMainSwitchPreference, times(1)).setVisible(false);
|
||||
verify(mRotateSwitchPreference, never()).setVisible(false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createPreferenceControllers_noSettableDeviceStates_returnsEmptyList() {
|
||||
enableDeviceStateSettableRotationStates(new String[]{}, new String[]{});
|
||||
@@ -198,6 +211,8 @@ public class SmartAutoRotatePreferenceFragmentTest {
|
||||
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);
|
||||
|
Reference in New Issue
Block a user