Show RingtonePickerActivity in work user instead
Test: make RunSettingsRoboTests Test: Try to import custom ringtone in work profile, no crash observed Test: Set the custom ringtone as default. Tested both work gmail and calendar can play that ringtone. Test: Try to import the peresonal ringtone, it is still working. Bug: 37197930 Change-Id: I2b662247d7e70b59bae08e082e9682d74d797484
This commit is contained in:
@@ -27,6 +27,7 @@ import android.telephony.TelephonyManager;
|
||||
|
||||
import com.android.settings.DefaultRingtonePreference;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.RingtonePreference;
|
||||
import com.android.settings.SettingsRobolectricTestRunner;
|
||||
import com.android.settings.TestConfig;
|
||||
|
||||
@@ -251,4 +252,26 @@ public class WorkSoundPreferenceControllerTest {
|
||||
verify(mWorkCategory.findPreference(KEY_WORK_ALARM_RINGTONE))
|
||||
.setSummary(eq(notAvailable));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onResume_shouldSetUserIdToPreference() {
|
||||
final int managedProfileUserId = 10;
|
||||
when(mAudioHelper.getManagedProfileId(any(UserManager.class)))
|
||||
.thenReturn(managedProfileUserId);
|
||||
when(mAudioHelper.isUserUnlocked(any(UserManager.class), anyInt())).thenReturn(true);
|
||||
when(mAudioHelper.isSingleVolume()).thenReturn(false);
|
||||
when(mFragment.getPreferenceScreen()).thenReturn(mScreen);
|
||||
when(mAudioHelper.createPackageContextAsUser(anyInt())).thenReturn(mContext);
|
||||
|
||||
mController.displayPreference(mScreen);
|
||||
mController.onResume();
|
||||
|
||||
verify((RingtonePreference) mWorkCategory.findPreference(KEY_WORK_PHONE_RINGTONE))
|
||||
.setUserId(managedProfileUserId);
|
||||
verify((RingtonePreference) mWorkCategory.findPreference(KEY_WORK_NOTIFICATION_RINGTONE))
|
||||
.setUserId(managedProfileUserId);
|
||||
verify((RingtonePreference) mWorkCategory.findPreference(KEY_WORK_ALARM_RINGTONE))
|
||||
.setUserId(managedProfileUserId);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user