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

Commit 37245dd5 authored by DvTonder's avatar DvTonder Committed by Ricardo Cerqueira
Browse files

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

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

                // 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);
                KeyguardManager km = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
                boolean locked = km.inKeyguardRestrictedInputMode();
                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
    private static class CloseDialogReceiver extends BroadcastReceiver
            implements DialogInterface.OnDismissListener {
            implements DialogInterface.OnDismissListener {
        private Context mContext;
        private Context mContext;