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
This commit is contained in:
Sunny Shao
2023-09-27 10:52:41 +08:00
parent 21c967bc96
commit 383edb4afa
2 changed files with 12 additions and 8 deletions

View File

@@ -190,15 +190,17 @@ public class AutoRotatePreferenceControllerTest {
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() {