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

Unverified Commit 8f15efb6 authored by Michael Bestas's avatar Michael Bestas
Browse files

frameworks: Add support for advanced restart options



Co-authored-by: default avatarBruno Martins <bgcngm@gmail.com>
Co-authored-by: default avatarDave Kessler <activethrasher00@gmail.com>
Co-authored-by: default avatarDvTonder <david.vantonder@gmail.com>
Co-authored-by: default avatarJorge Ruesga <jorge@ruesga.com>
Co-authored-by: default avatarmaxwen <max.weninger@gmail.com>
Co-authored-by: default avatarRicardo Cerqueira <cyanogenmod@cerqueira.org>
Co-authored-by: default avatarRoman Birg <roman@cyngn.com>
Co-authored-by: default avatarSagarMakhar <sagarmakhar@gmail.com>
Co-authored-by: default avatarVeeti Paananen <veeti.paananen@rojekti.fi>
Co-authored-by: default avatarZhao Wei Liew <zhaoweiliew@gmail.com>
Change-Id: I4b35d10b0811eff0d8e9ab68b2aedbe52b4aa53f
parent daa3f488
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -171,5 +171,6 @@ interface IPowerManager
    const int GO_TO_SLEEP_FLAG_NO_DOZE = 1 << 0;

    // Lineage custom API
    void rebootCustom(boolean confirm, String reason, boolean wait);
    void wakeUpWithProximityCheck(long time, int reason, String details, String opPackageName);
}
+39 −0
Original line number Diff line number Diff line
@@ -872,6 +872,27 @@ public final class PowerManager {
     */
    public static final String REBOOT_RECOVERY_UPDATE = "recovery-update";

    /**
     * The value to pass as the 'reason' argument to reboot() to
     * reboot into bootloader mode
     * @hide
     */
    public static final String REBOOT_BOOTLOADER = "bootloader";

    /**
     * The value to pass as the 'reason' argument to reboot() to
     * reboot into download mode
     * @hide
     */
    public static final String REBOOT_DOWNLOAD = "download";

    /**
     * The value to pass as the 'reason' argument to reboot() to
     * reboot into fastboot mode
     * @hide
     */
    public static final String REBOOT_FASTBOOT = "fastboot";

    /**
     * The value to pass as the 'reason' argument to reboot() when device owner requests a reboot on
     * the device.
@@ -1909,6 +1930,24 @@ public final class PowerManager {
        }
    }

    /**
     * Reboot the device.  Will not return if the reboot is successful.
     * <p>
     * Requires the {@link android.Manifest.permission#REBOOT} permission.
     * </p>
     *
     * @param reason code to pass to the kernel (e.g., "recovery", "bootloader", "download") to
     *               request special boot modes, or null.
     * @hide
     */
    public void rebootCustom(String reason) {
        try {
            mService.rebootCustom(false, reason, true);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * Reboot the device. Will not return if the reboot is successful.
     * <p>
+1 −1
Original line number Diff line number Diff line
@@ -174,7 +174,7 @@ oneway interface IStatusBar
    void showPinningEnterExitToast(boolean entering);
    void showPinningEscapeToast();

    void showShutdownUi(boolean isReboot, String reason);
    void showShutdownUi(boolean isReboot, String reason, boolean rebootCustom);

    /**
    * Used to show the authentication dialog (Biometrics, Device Credential).
+1 −1
Original line number Diff line number Diff line
@@ -102,7 +102,7 @@ interface IStatusBarService
     * These methods are needed for global actions control which the UI is shown in sysui.
     */
    void shutdown();
    void reboot(boolean safeMode);
    void reboot(boolean safeMode, String reason);

    /** just restarts android without rebooting device. Used for some feature flags. */
    void restart();
+2 −2
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ public interface GlobalActions extends Plugin {
    int VERSION = 1;

    void showGlobalActions(GlobalActionsManager manager);
    default void showShutdownUi(boolean isReboot, String reason) {
    default void showShutdownUi(boolean isReboot, String reason, boolean rebootCustom) {
    }

    default void destroy() {
@@ -40,6 +40,6 @@ public interface GlobalActions extends Plugin {
        void onGlobalActionsHidden();

        void shutdown();
        void reboot(boolean safeMode);
        void reboot(boolean safeMode, String reason);
    }
}
Loading