Prompt to start user before choosing a new ringtone

Dead users can't hear, nor see, ringtones. Let's wake them up and give
them a good shake first.

Until then, show a nice friendly "work profile isn't available" message.
Or depending on locale something confusing, egregious, and mismatched
like "work profile isn't available" instead.

Fix: 34735015
Bug: 34734809
Test: make RunSettingsRoboTests && make Settings && adb install -r $OUT/system/priv-app/Settings/Settings.apk && then reboot the device to see what happens
Change-Id: I86e61a7f3f654d7f38f04c43227a31e2f288e18f
This commit is contained in:
Robin Lee
2017-01-26 18:14:08 +00:00
parent 6596c8ff4e
commit 2953f31b61
2 changed files with 11 additions and 14 deletions

View File

@@ -157,9 +157,8 @@ public class WorkSoundPreferenceController extends PreferenceController implemen
}
private CharSequence updateRingtoneName(Context context, int type) {
if (context == null) {
Log.e(TAG, "Unable to update ringtone name, no context provided");
return null;
if (context == null || !UserManager.get(context).isUserUnlocked(context.getUserId())) {
return context.getString(R.string.managed_profile_not_available_label);
}
Uri ringtoneUri = RingtoneManager.getActualDefaultRingtoneUri(context, type);
return Ringtone.getTitle(context, ringtoneUri, false /* followSettingsUri */,