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

Unverified Commit 19568d5d authored by DvTonder's avatar DvTonder Committed by Michael Bestas
Browse files

Power menu customizations [1/2]



power
reboot
screenshot
profile switcher
airplane mode
user switcher
bug reports
sound modes

[mikeioannina]: Modify for CyanogenMod

framework: Add advanced reboot options (2 of 2)

This commit is an squash of the commits below and re-adds the reboot
logic to CM.

I took the liberty to rewrite some of the ShutdownThread code because
it had some lingering issues present since I originally wrote this
for CM7 (!!). Namely, the reboot reason was being changed when the items
are pressed instead of when the user presses the positive button. This
made some people add workarounds like handling back button presses and
whatnot, these are gone now.

commit 588464bea40b92b04c4aeee35c47f7becceeed56
Author: Roman Birg <roman@cyngn.com>
Date:   Thu Jul 10 14:20:42 2014 -0700

    advanced reboot: add soft reboot option

    Adds a "Soft reboot" option which restarts zygote, as requested in JIRA
    CYAN-3998

    Signed-off-by: default avatarRoman Birg <roman@cyngn.com>

    Conflicts:
        core/res/res/values/cm_arrays.xml
        core/res/res/values/cm_strings.xml
        services/java/com/android/server/power/ShutdownThread.java

commit 3e7b92551bbf818ace41cd9b9532473ed7d18f2f
Author: Veeti Paananen <veeti.paananen@rojekti.fi>
Date:   Tue Jul 23 16:34:35 2013 +0300

    Show advanced reboot if using an insecure lock screen

    Enables the advanced reboot menu when locked if the selected lock method
    is insecure (= slide unlock).

    Conflicts:
        services/java/com/android/server/power/ShutdownThread.java

commit cf42ed3993d5d05c9b2591883fefb6338fbcdd40
Author: DvTonder <david.vantonder@gmail.com>
Date:   Thu Feb 21 18:20:01 2013 -0500

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

    Conflicts:
        services/java/com/android/server/power/ShutdownThread.java

commit 08aa6fd643e0359114b86f50053921dd2d86fc50
Author: Ricardo Cerqueira <cyanogenmod@cerqueira.org>
Date:   Mon Nov 4 03:37:40 2013 +0000

    Framework: Add Advanced reboot (2 of 2)

    This commit responds to a setting in Development settings for including
    options in the power menu for rebooting into recovery or bootloader. It
    is defauled to off.

    When enabled, the Advanced reboot options will only be available once the
    device is unlocked.

Enhance power menu reboot option

* Use our old reboot icon
* Set correct dialog title & message when rebooting
* Move strings to cm_strings
* Add back reboot_download string used by samsung devices
* Remove Chinese translations, will be handled through crowdin

policy: Remove references of Profiles in android.policy.

  We can't reference the CMSDK within a jar that is exported in the
  BOOTCLASSPATH, otherwise we end up overriding the 3rd party
  applications classloaded jar and causing various issues during
  runtime.

Change-Id: Ia0b7950d17bb7450347b57d8a423c44df982b195
parent f7a43f36
Loading
Loading
Loading
Loading
+9 −0
Original line number Original line Diff line number Diff line
@@ -1935,6 +1935,15 @@ public class Intent implements Parcelable, Cloneable {
     * dialogs are the notification window-shade and the recent tasks dialog.
     * dialogs are the notification window-shade and the recent tasks dialog.
     */
     */
    public static final String ACTION_CLOSE_SYSTEM_DIALOGS = "android.intent.action.CLOSE_SYSTEM_DIALOGS";
    public static final String ACTION_CLOSE_SYSTEM_DIALOGS = "android.intent.action.CLOSE_SYSTEM_DIALOGS";
    /**
     * Broadcast Action: Update preferences for the power menu dialog.  This is to provide a
     * way for the preferences that need to be enabled/disabled to update because they were
     * toggled elsewhere in the settings (ie profiles, immersive desktop, etc) so we don't have
     * to do constant lookups while we wait for the menu to be created. Getting the values once
     * when necessary is enough.
     *@hide
     */
    public static final String UPDATE_POWER_MENU = "android.intent.action.UPDATE_POWER_MENU";
    /**
    /**
     * Broadcast Action: Trigger the download and eventual installation
     * Broadcast Action: Trigger the download and eventual installation
     * of a package.
     * of a package.
+14 −1
Original line number Original line Diff line number Diff line
@@ -6572,6 +6572,12 @@ public final class Settings {
         */
         */
        public static final String WEB_ACTION_ENABLED = "web_action_enabled";
        public static final String WEB_ACTION_ENABLED = "web_action_enabled";


        /**
         * Whether to include options in power menu for rebooting into recovery or bootloader
         * @hide
         */
        public static final String ADVANCED_REBOOT = "advanced_reboot";

        /**
        /**
         * This are the settings to be backed up.
         * This are the settings to be backed up.
         *
         *
@@ -6656,7 +6662,8 @@ public final class Settings {
            QS_TILES,
            QS_TILES,
            DOZE_ENABLED,
            DOZE_ENABLED,
            DOZE_PULSE_ON_PICK_UP,
            DOZE_PULSE_ON_PICK_UP,
            DOZE_PULSE_ON_DOUBLE_TAP
            DOZE_PULSE_ON_DOUBLE_TAP,
            ADVANCED_REBOOT
        };
        };


        /**
        /**
@@ -7111,6 +7118,12 @@ public final class Settings {
         */
         */
        public static final String ADB_ENABLED = "adb_enabled";
        public static final String ADB_ENABLED = "adb_enabled";


        /**
         * String to contain power menu actions
         * @hide
         */
        public static final String POWER_MENU_ACTIONS = "power_menu_actions";

        /**
        /**
         * Whether Views are allowed to save their attribute data.
         * Whether Views are allowed to save their attribute data.
         * @hide
         * @hide
+50 −0
Original line number Original line Diff line number Diff line
/*
 * Copyright (C) 2015 The CyanogenMod Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.internal.util.cm;

/* Master list of all actions for the power menu */
public class PowerMenuConstants {
    public static final String GLOBAL_ACTION_KEY_POWER = "power";
    public static final String GLOBAL_ACTION_KEY_REBOOT = "reboot";
    public static final String GLOBAL_ACTION_KEY_SCREENSHOT = "screenshot";
    public static final String GLOBAL_ACTION_KEY_AIRPLANE = "airplane";
    public static final String GLOBAL_ACTION_KEY_USERS = "users";
    public static final String GLOBAL_ACTION_KEY_SETTINGS = "settings";
    public static final String GLOBAL_ACTION_KEY_LOCKDOWN = "lockdown";
    public static final String GLOBAL_ACTION_KEY_BUGREPORT = "bugreport";
    public static final String GLOBAL_ACTION_KEY_SILENT = "silent";
    public static final String GLOBAL_ACTION_KEY_VOICEASSIST = "voiceassist";
    public static final String GLOBAL_ACTION_KEY_ASSIST = "assist";

    private static String[] ALL_ACTIONS = {
        GLOBAL_ACTION_KEY_POWER,
        GLOBAL_ACTION_KEY_REBOOT,
        GLOBAL_ACTION_KEY_SCREENSHOT,
        GLOBAL_ACTION_KEY_AIRPLANE,
        GLOBAL_ACTION_KEY_USERS,
        GLOBAL_ACTION_KEY_SETTINGS,
        GLOBAL_ACTION_KEY_LOCKDOWN,
        GLOBAL_ACTION_KEY_BUGREPORT,
        GLOBAL_ACTION_KEY_SILENT,
        GLOBAL_ACTION_KEY_VOICEASSIST,
        GLOBAL_ACTION_KEY_ASSIST
    };

    public static String[] getAllActions() {
        return ALL_ACTIONS;
    }
}
+186 B (1.61 KiB)
Loading image diff...
+3.83 KiB
Loading image diff...
Loading