Merge "Misc fixes"
diff --git a/tests/robotests/OWNERS b/tests/robotests/OWNERS
new file mode 100644
index 0000000..8a7a27e
--- /dev/null
+++ b/tests/robotests/OWNERS
@@ -0,0 +1,2 @@
+# We do not guard tests - everyone is welcomed to contribute to tests.
+per-file *.java=*
\ No newline at end of file
diff --git a/tests/robotests/src/com/android/settings/notification/SoundPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/SoundPreferenceControllerTest.java
index 9025979..33d5073 100644
--- a/tests/robotests/src/com/android/settings/notification/SoundPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/notification/SoundPreferenceControllerTest.java
@@ -20,14 +20,11 @@
 import static android.app.NotificationManager.IMPORTANCE_DEFAULT;
 import static android.app.NotificationManager.IMPORTANCE_HIGH;
 import static android.app.NotificationManager.IMPORTANCE_LOW;
-
 import static junit.framework.Assert.assertFalse;
 import static junit.framework.Assert.assertTrue;
-
 import static org.junit.Assert.assertEquals;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.anyInt;
-import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.spy;
@@ -50,8 +47,10 @@
 import com.android.settings.SettingsPreferenceFragment;
 import com.android.settings.TestConfig;
 import com.android.settings.testutils.SettingsRobolectricTestRunner;
+import com.android.settings.testutils.shadow.SettingsShadowResources;
 import com.android.settingslib.RestrictedLockUtils;
 
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -62,7 +61,9 @@
 import org.robolectric.shadows.ShadowApplication;
 
 @RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION, shadows = {
+        SettingsShadowResources.class
+})
 public class SoundPreferenceControllerTest {
 
     private Context mContext;
@@ -87,11 +88,18 @@
         ShadowApplication shadowApplication = ShadowApplication.getInstance();
         shadowApplication.setSystemService(Context.NOTIFICATION_SERVICE, mNm);
         shadowApplication.setSystemService(Context.USER_SERVICE, mUm);
+        SettingsShadowResources.overrideResource(com.android.internal.R.string.ringtone_silent,
+                "silent");
         mContext = shadowApplication.getApplicationContext();
         mController = spy(new SoundPreferenceController(
                 mContext, mFragment, mImportanceListener, mBackend));
     }
 
+    @After
+    public void tearDown() {
+        SettingsShadowResources.reset();
+    }
+
     @Test
     public void testNoCrashIfNoOnResume() throws Exception {
         mController.isAvailable();