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

Commit 4fa7af16 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add emergency dialer option on power menu"

parents a4e6ce36 8d07276f
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -11271,6 +11271,14 @@ public final class Settings {
         */
        public static final String EMERGENCY_AFFORDANCE_NEEDED = "emergency_affordance_needed";
        /**
         * Enable faster emergency phone call feature.
         * The value is a boolean (1 or 0).
         * @hide
         */
        public static final String FASTER_EMERGENCY_PHONE_CALL_ENABLED =
                "faster_emergency_phone_call_enabled";
        /**
         * See RIL_PreferredNetworkType in ril.h
         * @hide
+2 −0
Original line number Diff line number Diff line
@@ -2576,6 +2576,7 @@
         "silent" = silent mode
         "users" = list of users
         "restart" = restart device
         "emergency" = Launch emergency dialer
         "lockdown" = Lock down device until the user authenticates
         "logout" =  Logout the current user
         -->
@@ -2585,6 +2586,7 @@
        <item>lockdown</item>
        <item>logout</item>
        <item>bugreport</item>
        <item>emergency</item>
        <item>screenshot</item>
    </string-array>

+1 −0
Original line number Diff line number Diff line
@@ -236,6 +236,7 @@ public class SettingsBackupTest {
                    Settings.Global.EUICC_SUPPORTED_COUNTRIES,
                    Settings.Global.EUICC_FACTORY_RESET_TIMEOUT_MILLIS,
                    Settings.Global.FANCY_IME_ANIMATIONS,
                    Settings.Global.FASTER_EMERGENCY_PHONE_CALL_ENABLED,
                    Settings.Global.FORCE_ALLOW_ON_EXTERNAL,
                    Settings.Global.FORCED_APP_STANDBY_ENABLED,
                    Settings.Global.FORCED_APP_STANDBY_FOR_SMALL_BATTERY_ENABLED,
+33 −0
Original line number Diff line number Diff line
@@ -127,6 +127,7 @@ class GlobalActionsDialog implements DialogInterface.OnDismissListener,
    private static final String GLOBAL_ACTION_KEY_ASSIST = "assist";
    private static final String GLOBAL_ACTION_KEY_RESTART = "restart";
    private static final String GLOBAL_ACTION_KEY_LOGOUT = "logout";
    private static final String GLOBAL_ACTION_KEY_EMERGENCY = "emergency";
    private static final String GLOBAL_ACTION_KEY_SCREENSHOT = "screenshot";

    private final Context mContext;
@@ -357,6 +358,12 @@ class GlobalActionsDialog implements DialogInterface.OnDismissListener,
                mItems.add(getAssistAction());
            } else if (GLOBAL_ACTION_KEY_RESTART.equals(actionKey)) {
                mItems.add(new RestartAction());
            } else if (GLOBAL_ACTION_KEY_EMERGENCY.equals(actionKey)) {
                if (Settings.Global.getInt(mContext.getContentResolver(),
                        Settings.Global.FASTER_EMERGENCY_PHONE_CALL_ENABLED, 0) != 0
                        && !mEmergencyAffordanceManager.needsEmergencyAffordance()) {
                    mItems.add(new EmergencyAction());
                }
            } else if (GLOBAL_ACTION_KEY_SCREENSHOT.equals(actionKey)) {
                mItems.add(new ScreenshotAction());
            } else if (GLOBAL_ACTION_KEY_LOGOUT.equals(actionKey)) {
@@ -441,6 +448,32 @@ class GlobalActionsDialog implements DialogInterface.OnDismissListener,
        }
    }

    private class EmergencyAction extends SinglePressAction {
        private static final String ACTION_EMERGENCY_DIALER_DIAL =
                "com.android.phone.EmergencyDialer.DIAL";

        private EmergencyAction() {
            super(R.drawable.emergency_icon, R.string.global_action_emergency);
        }

        @Override
        public void onPress() {
            Intent intent = new Intent(ACTION_EMERGENCY_DIALER_DIAL);
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
            mContext.startActivityAsUser(intent, UserHandle.CURRENT);
        }

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

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

    private final class RestartAction extends SinglePressAction implements LongPressAction {
        private RestartAction() {
            super(R.drawable.ic_restart, R.string.global_action_restart);