Loading packages/SettingsProvider/Android.bp +9 −1 Original line number Diff line number Diff line Loading @@ -67,6 +67,7 @@ android_test { // Note we statically link SettingsProviderLib to do some unit tests. It's not accessible otherwise // because this test is not an instrumentation test. (because the target runs in the system process.) "SettingsProviderLib", "DSAutoRotateSetting-testutils", "androidx.test.rules", "frameworks-base-testutils", "device_config_service_flags_java", Loading @@ -74,7 +75,7 @@ android_test { "junit", "junit-params", "libaconfig_java_proto_lite", "mockito-target-minus-junit4", "mockito-target-extended-minus-junit4", "platform-test-annotations", "truth", "Nene", Loading @@ -86,6 +87,13 @@ android_test { "android.test.mock.stubs.system", "unsupportedappusage", ], defaults: [ "modules-utils-testable-device-config-defaults", ], jni_libs: [ "libdexmakerjvmtiagent", "libstaticjvmtiagent", ], resource_dirs: [], platform_apis: true, certificate: "platform", Loading packages/SettingsProvider/test/AndroidManifest.xml +1 −1 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL"/> <uses-permission android:name="android.permission.MANAGE_USERS"/> <application> <application android:debuggable="true"> <uses-library android:name="android.test.runner" /> </application> Loading packages/SettingsProvider/test/src/com/android/providers/settings/SettingsHelperTest.java +9 −4 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.providers.settings; import static com.android.settings.testutils.DeviceStateAutoRotateSettingTestUtils.setDeviceStateRotationLockEnabled; import static com.google.common.truth.Truth.assertThat; import static junit.framework.Assert.assertEquals; Loading @@ -40,6 +42,7 @@ import android.content.res.Configuration; import android.content.res.Resources; import android.database.Cursor; import android.database.MatrixCursor; import android.hardware.devicestate.DeviceStateManager; import android.media.AudioManager; import android.media.Utils; import android.net.Uri; Loading Loading @@ -103,6 +106,7 @@ public class SettingsHelperTest { @Mock private Resources mResources; @Mock private AudioManager mAudioManager; @Mock private TelephonyManager mTelephonyManager; @Mock private DeviceStateManager mDeviceStateManager; private MockContentResolver mContentResolver; private MockSettingsProvider mSettingsProvider; Loading @@ -112,6 +116,9 @@ public class SettingsHelperTest { @Before public void setUp() { MockitoAnnotations.initMocks(this); when(mContext.getSystemService(eq(DeviceStateManager.class))).thenReturn( mDeviceStateManager); when(mContext.getSystemService(eq(Context.AUDIO_SERVICE))).thenReturn(mAudioManager); when(mContext.getSystemService(eq(Context.TELEPHONY_SERVICE))).thenReturn( mTelephonyManager); Loading Loading @@ -951,8 +958,7 @@ public class SettingsHelperTest { @Test public void restoreValue_autoRotation_deviceStateAutoRotationDisabled_restoresValue() { when(mResources.getStringArray(R.array.config_perDeviceStateRotationLockDefaults)) .thenReturn(new String[]{}); setDeviceStateRotationLockEnabled(/* enable= */ false, mResources, mDeviceStateManager); int previousValue = 0; int newValue = 1; setAutoRotationSettingValue(previousValue); Loading @@ -964,8 +970,7 @@ public class SettingsHelperTest { @Test public void restoreValue_autoRotation_deviceStateAutoRotationEnabled_doesNotRestoreValue() { when(mResources.getStringArray(R.array.config_perDeviceStateRotationLockDefaults)) .thenReturn(new String[]{"0:1", "1:1"}); setDeviceStateRotationLockEnabled(/* enable= */ true, mResources, mDeviceStateManager); int previousValue = 0; int newValue = 1; setAutoRotationSettingValue(previousValue); Loading Loading
packages/SettingsProvider/Android.bp +9 −1 Original line number Diff line number Diff line Loading @@ -67,6 +67,7 @@ android_test { // Note we statically link SettingsProviderLib to do some unit tests. It's not accessible otherwise // because this test is not an instrumentation test. (because the target runs in the system process.) "SettingsProviderLib", "DSAutoRotateSetting-testutils", "androidx.test.rules", "frameworks-base-testutils", "device_config_service_flags_java", Loading @@ -74,7 +75,7 @@ android_test { "junit", "junit-params", "libaconfig_java_proto_lite", "mockito-target-minus-junit4", "mockito-target-extended-minus-junit4", "platform-test-annotations", "truth", "Nene", Loading @@ -86,6 +87,13 @@ android_test { "android.test.mock.stubs.system", "unsupportedappusage", ], defaults: [ "modules-utils-testable-device-config-defaults", ], jni_libs: [ "libdexmakerjvmtiagent", "libstaticjvmtiagent", ], resource_dirs: [], platform_apis: true, certificate: "platform", Loading
packages/SettingsProvider/test/AndroidManifest.xml +1 −1 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL"/> <uses-permission android:name="android.permission.MANAGE_USERS"/> <application> <application android:debuggable="true"> <uses-library android:name="android.test.runner" /> </application> Loading
packages/SettingsProvider/test/src/com/android/providers/settings/SettingsHelperTest.java +9 −4 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.providers.settings; import static com.android.settings.testutils.DeviceStateAutoRotateSettingTestUtils.setDeviceStateRotationLockEnabled; import static com.google.common.truth.Truth.assertThat; import static junit.framework.Assert.assertEquals; Loading @@ -40,6 +42,7 @@ import android.content.res.Configuration; import android.content.res.Resources; import android.database.Cursor; import android.database.MatrixCursor; import android.hardware.devicestate.DeviceStateManager; import android.media.AudioManager; import android.media.Utils; import android.net.Uri; Loading Loading @@ -103,6 +106,7 @@ public class SettingsHelperTest { @Mock private Resources mResources; @Mock private AudioManager mAudioManager; @Mock private TelephonyManager mTelephonyManager; @Mock private DeviceStateManager mDeviceStateManager; private MockContentResolver mContentResolver; private MockSettingsProvider mSettingsProvider; Loading @@ -112,6 +116,9 @@ public class SettingsHelperTest { @Before public void setUp() { MockitoAnnotations.initMocks(this); when(mContext.getSystemService(eq(DeviceStateManager.class))).thenReturn( mDeviceStateManager); when(mContext.getSystemService(eq(Context.AUDIO_SERVICE))).thenReturn(mAudioManager); when(mContext.getSystemService(eq(Context.TELEPHONY_SERVICE))).thenReturn( mTelephonyManager); Loading Loading @@ -951,8 +958,7 @@ public class SettingsHelperTest { @Test public void restoreValue_autoRotation_deviceStateAutoRotationDisabled_restoresValue() { when(mResources.getStringArray(R.array.config_perDeviceStateRotationLockDefaults)) .thenReturn(new String[]{}); setDeviceStateRotationLockEnabled(/* enable= */ false, mResources, mDeviceStateManager); int previousValue = 0; int newValue = 1; setAutoRotationSettingValue(previousValue); Loading @@ -964,8 +970,7 @@ public class SettingsHelperTest { @Test public void restoreValue_autoRotation_deviceStateAutoRotationEnabled_doesNotRestoreValue() { when(mResources.getStringArray(R.array.config_perDeviceStateRotationLockDefaults)) .thenReturn(new String[]{"0:1", "1:1"}); setDeviceStateRotationLockEnabled(/* enable= */ true, mResources, mDeviceStateManager); int previousValue = 0; int newValue = 1; setAutoRotationSettingValue(previousValue); Loading