Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 765062ac authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Prompt credentials for installing/deleting sounds"

parents c260bcc6 cccf3244
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ public class DefaultRingtonePreference extends RingtonePreference {
    @Override
    public void performClick() {
        if (mUserId != UserHandle.USER_CURRENT) {
            if (Utils.unlockWorkProfileIfNecessary(getContext(), mUserId) ||
            if (Utils.confirmWorkProfileCredentialsIfNecessary(getContext(), mUserId) ||
                    Utils.startQuietModeDialogIfNecessary(getContext(),
                            UserManager.get(getContext()), mUserId)) {
                return;
+12 −1
Original line number Diff line number Diff line
@@ -1161,6 +1161,18 @@ public final class Utils extends com.android.settingslib.Utils {
        if (!(new LockPatternUtils(context)).isSecure(userId)) {
            return false;
        }
        return confirmWorkProfileCredentials(context, userId);
    }

    public static boolean confirmWorkProfileCredentialsIfNecessary(Context context, int userId) {
        KeyguardManager km = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
        if (!km.isDeviceLocked(userId)) {
            return false;
        }
        return confirmWorkProfileCredentials(context, userId);
    }

    private static boolean confirmWorkProfileCredentials(Context context, int userId) {
        final KeyguardManager km = (KeyguardManager) context.getSystemService(
                Context.KEYGUARD_SERVICE);
        final Intent unlockIntent = km.createConfirmDeviceCredentialIntent(null, null, userId);
@@ -1170,7 +1182,6 @@ public final class Utils extends com.android.settingslib.Utils {
        } else {
            return false;
        }

    }

    public static CharSequence getApplicationLabel(Context context, String packageName) {