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

Commit 5a43151b authored by Ricardo Cerqueira's avatar Ricardo Cerqueira Committed by Gerrit Code Review
Browse files

Merge "Framework: Show the Advanced reboot menu only for the primary user" into cm-10.1

parents 1248bdca a8473623
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -150,9 +150,11 @@ public final class ShutdownThread extends Thread {
                sConfirmDialog = null;
            }
            if (mReboot && !mRebootSafeMode) {
                // See if the advanced reboot menu is enabled and check the keyguard state
                boolean advancedReboot = Settings.Secure.getInt(context.getContentResolver(),
                        Settings.Secure.ADVANCED_REBOOT, 0) == 1;
                // Determine if primary user is logged in
                boolean isPrimary = UserHandle.getCallingUserId() == UserHandle.USER_OWNER;

                // See if the advanced reboot menu is enabled (only if primary user) and check the keyguard state
                boolean advancedReboot = isPrimary ? advancedRebootEnabled(context) : false;
                KeyguardManager km = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
                boolean locked = km.inKeyguardRestrictedInputMode();

@@ -219,6 +221,10 @@ public final class ShutdownThread extends Thread {
        }
    }

    private static boolean advancedRebootEnabled(Context context) {
        return Settings.Secure.getInt(context.getContentResolver(), Settings.Secure.ADVANCED_REBOOT, 0) == 1;
    }

    private static class CloseDialogReceiver extends BroadcastReceiver
            implements DialogInterface.OnDismissListener {
        private Context mContext;