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:
@@ -30,7 +30,7 @@ import android.util.Log;
|
||||
public class DefaultRingtonePreference extends RingtonePreference {
|
||||
private static final String TAG = "DefaultRingtonePreference";
|
||||
|
||||
private int mUserId;
|
||||
private int mUserId = UserHandle.USER_CURRENT;
|
||||
protected Context mUserContext;
|
||||
|
||||
public DefaultRingtonePreference(Context context, AttributeSet attrs) {
|
||||
@@ -40,21 +40,19 @@ public class DefaultRingtonePreference extends RingtonePreference {
|
||||
|
||||
public void setUserId(int userId) {
|
||||
mUserId = userId;
|
||||
Context context = getContext();
|
||||
mUserContext = Utils.createPackageContextAsUser(context, mUserId);
|
||||
mUserContext = Utils.createPackageContextAsUser(getContext(), mUserId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performClick() {
|
||||
if (!Utils.startQuietModeDialogIfNecessary(getContext(), UserManager.get(getContext()),
|
||||
mUserId)) {
|
||||
super.performClick();
|
||||
if (mUserId != UserHandle.USER_CURRENT) {
|
||||
if (Utils.unlockWorkProfileIfNecessary(getContext(), mUserId) ||
|
||||
Utils.startQuietModeDialogIfNecessary(getContext(),
|
||||
UserManager.get(getContext()), mUserId)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void clearUserId(int userId) {
|
||||
mUserId = UserHandle.USER_CURRENT;
|
||||
mUserContext = getContext();
|
||||
super.performClick();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user