Fixed the robo test failed in AutoRotatePreferenceControllerTest
and SmartAutoRotatePreferenceControllerTest
- Use the correct Settings.System.putIntForUser API.
Fixes: 300200193
Fixes: 300201185
Test: atest AutoRotatePreferenceControllerTest
Test: atest SmartAutoRotatePreferenceControllerTest
Change-Id: Iadd890f21431ccb5d538e40426b0c7d43d46ba52
diff --git a/tests/robotests/src/com/android/settings/display/AutoRotatePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/display/AutoRotatePreferenceControllerTest.java
index 2bcf060..fd91867 100644
--- a/tests/robotests/src/com/android/settings/display/AutoRotatePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/display/AutoRotatePreferenceControllerTest.java
@@ -190,15 +190,17 @@
private void enableAutoRotationPreference() {
when(mPackageManager.hasSystemFeature(anyString())).thenReturn(true);
when(mContext.getResources().getBoolean(anyInt())).thenReturn(true);
- Settings.System.putInt(mContentResolver,
- Settings.System.HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY, 0);
+ Settings.System.putIntForUser(mContentResolver,
+ Settings.System.HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY, 0,
+ UserHandle.USER_CURRENT);
}
private void disableAutoRotationPreference() {
when(mPackageManager.hasSystemFeature(anyString())).thenReturn(true);
when(mContext.getResources().getBoolean(anyInt())).thenReturn(true);
- Settings.System.putInt(mContentResolver,
- Settings.System.HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY, 1);
+ Settings.System.putIntForUser(mContentResolver,
+ Settings.System.HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY, 1,
+ UserHandle.USER_CURRENT);
}
private void enableAutoRotation() {
diff --git a/tests/robotests/src/com/android/settings/display/SmartAutoRotatePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/display/SmartAutoRotatePreferenceControllerTest.java
index d9187eb..9f1b5d4 100644
--- a/tests/robotests/src/com/android/settings/display/SmartAutoRotatePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/display/SmartAutoRotatePreferenceControllerTest.java
@@ -236,15 +236,17 @@
private void enableAutoRotationPreference() {
when(mPackageManager.hasSystemFeature(anyString())).thenReturn(true);
when(mResources.getBoolean(anyInt())).thenReturn(true);
- Settings.System.putInt(mContentResolver,
- Settings.System.HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY, 0);
+ Settings.System.putIntForUser(mContentResolver,
+ Settings.System.HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY, 0,
+ UserHandle.USER_CURRENT);
}
private void disableAutoRotationPreference() {
when(mPackageManager.hasSystemFeature(anyString())).thenReturn(true);
when(mResources.getBoolean(anyInt())).thenReturn(true);
- Settings.System.putInt(mContentResolver,
- Settings.System.HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY, 1);
+ Settings.System.putIntForUser(mContentResolver,
+ Settings.System.HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY, 1,
+ UserHandle.USER_CURRENT);
}
private void enableAutoRotation() {