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

Commit be8de6fe authored by haiyangl's avatar haiyangl Committed by Steve Kondik
Browse files

SystemUI: Add global reboot option

Add global reboot option when long press power key and confirmation dialog
when user chooses to reboot device

Change-Id: I23286cb655a4fead8dfc450f08f27d9588e47686
parent 4daf7332
Loading
Loading
Loading
Loading
+34 −1
Original line number Diff line number Diff line
@@ -402,8 +402,41 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
        }
    }

    private class BugReportAction extends SinglePressAction implements LongPressAction {
    private final class RebootAction extends SinglePressAction {
        private RebootAction() {
            super(com.android.internal.R.drawable.ic_lock_power_reboot,
                    R.string.global_action_reboot);
        }

        @Override
        public boolean showDuringKeyguard() {
            return true;
        }

        @Override
        public boolean showBeforeProvisioning() {
            return true;
        }

        @Override
        public void onPress() {
            try {
                IPowerManager pm = IPowerManager.Stub.asInterface(ServiceManager
                        .getService(Context.POWER_SERVICE));
                pm.reboot(true, null, false);
            } catch (RemoteException e) {
                Log.e(TAG, "PowerManager service died!", e);
                return;
            }
        }
    }

    private Action getBugReportAction() {
        return new SinglePressAction(com.android.internal.R.drawable.ic_lock_bugreport,
                R.string.bugreport_title) {
    }

    private class BugReportAction extends SinglePressAction implements LongPressAction {
        public BugReportAction() {
            super(com.android.internal.R.drawable.ic_lock_bugreport, R.string.bugreport_title);
        }