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

Commit a8473623 authored by DvTonder's avatar DvTonder
Browse files

Framework: Show the Advanced reboot menu only for the primary user

Change-Id: I73f82eade26f268e2b4608fa23cabcf0bb8fc862
parent 6e9e4389
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;