[DO NOT MERGE] Fix can't change notification sound for work profile.

Use correct user id context to query the type,
so we won't get empty result unexpectedly.

If we get the null result, then we won't set sound sucessfully.

Bug: 233580016
Bug: 221041256
Test: Manual test and set work profile sound works.
Change-Id: I7f8fb737a7c6f77a380f3f075a5c89a1970e39ad
Merged-In: I7f8fb737a7c6f77a380f3f075a5c89a1970e39ad
(cherry picked from commit 0d8d05a22138a2d64cb3690af8edf88c1782a901)
Merged-In: I7f8fb737a7c6f77a380f3f075a5c89a1970e39ad
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