Merge "Fix can't change notification sound for work profile." into tm-dev
diff --git a/src/com/android/settings/DefaultRingtonePreference.java b/src/com/android/settings/DefaultRingtonePreference.java
index 824a5a0..9bf626c 100644
--- a/src/com/android/settings/DefaultRingtonePreference.java
+++ b/src/com/android/settings/DefaultRingtonePreference.java
@@ -51,7 +51,7 @@
             return;
         }
 
-        String mimeType = getContext().getContentResolver().getType(ringtoneUri);
+        String mimeType = mUserContext.getContentResolver().getType(ringtoneUri);
         if (mimeType == null) {
             Log.e(TAG, "onSaveRingtone for URI:" + ringtoneUri
                     + " ignored: failure to find mimeType (no access from this context?)");
diff --git a/tests/unit/src/com/android/settings/DefaultRingtonePreferenceTest.java b/tests/unit/src/com/android/settings/DefaultRingtonePreferenceTest.java
index b9dea01..7877684 100644
--- a/tests/unit/src/com/android/settings/DefaultRingtonePreferenceTest.java
+++ b/tests/unit/src/com/android/settings/DefaultRingtonePreferenceTest.java
@@ -59,6 +59,7 @@
         when(mDefaultRingtonePreference.getRingtoneType())
                 .thenReturn(RingtoneManager.TYPE_RINGTONE);
         mDefaultRingtonePreference.setUserId(1);
+        mDefaultRingtonePreference.mUserContext = context;
     }
 
     @Test