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

Commit 71db1f76 authored by Wesley.CW Wang's avatar Wesley.CW Wang Committed by Leo Hsu
Browse files

Separated emergency option final UI

 - Refine faster emergency icon.
 - Add ic_faster_emergency.xml to framework/core/res/drawable.
 - Remove faster_emergency_icon.xml from SystemUI/res/drawable.
 - Change emergency_icon.xml color to colorError.
 - Emergency option(India case) will follow separated option design if
 separated option feature is enabled.

Test: Manually,
use "adb shell settings put global faster_emergency_phone_call_enabled 1" to show separated emergency option(default case),
use "adb shell settings put global emergency_affordance_needed 1" to show India emergency option(India case),
India emergency option will be separated button if feature is enabled,
otherwise it will be default design.
Change wallpaper to enable light/dark theme & check separated emergency option color.
(light theme color : D93025    dark theme color : E25142)

Bug: 112168722
Bug: 110658988

Change-Id: I2a3c5ce053aab05381806eedf108cec54af808b1
Merged-In: Id13bcb5b5242ded92b309667c5e2beb8694b9977
Merged-In: I2a3c5ce053aab05381806eedf108cec54af808b1
parent 3b0aa461
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ Copyright (C) 2014 The Android Open Source Project
        android:height="24.0dp"
        android:viewportWidth="24.0"
        android:viewportHeight="24.0"
        android:tint="?attr/colorControlNormal">
        android:tint="?attr/colorError">
    <path
        android:fillColor="#FF000000"
        android:pathData="M6.8,17.3C5.3,15.9 4.5,14.0 4.5,12.0c0.0,-2.0 0.8,-3.8 2.1,-5.2l1.4,1.4c-1.0,1.0 -1.6,2.4 -1.6,3.8c0.0,1.5 0.6,2.9 1.6,3.9L6.8,17.3z"/>
+7 −6
Original line number Diff line number Diff line
@@ -13,18 +13,19 @@ Copyright (C) 2018 The Android Open Source Project
    See the License for the specific language governing permissions and
    limitations under the License.
-->
<!-- TODO: For demo only, will change content after UI team provide new faster emergency icon. -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="24.0dp"
        android:height="24.0dp"
        android:viewportWidth="24.0"
        android:viewportHeight="24.0"
        android:tint="?attr/colorControlNormal">
        android:tint="?attr/colorError">
    <path
        android:fillColor="#D93025"
        android:pathData="M0,0h24v24H0z" />
        android:fillColor="#FF000000"
        android:pathData="M19,3H5C3.9,3,3.01,3.9,3.01,5L3,19c0,1.1,0.9,2,2,2h14c1.1,0,2-0.9,2-2V5C21,3.9,20.1,3,19,3z M19,19L5,19V5h14V19z" />
    <path
        android:fillColor="#FFFFFFFF"
        android:pathData="M19,3H5c-1.1,0-1.99,0.9,-1.99,2L3,19c0,1.1,0.9,2,2,2h14c1.1,0,2-0.9,2-2V5c0-1.1-0.9-2-2-2zm-1,11h-4v4h-4v-4H6v-4h4V6h4v4h4v4z" />
        android:fillColor="#FF000000"
        android:pathData="M 10.5 17 L 13.5 17 L 13.5 13.5 L 17 13.5 L 17 10.5 L 13.5 10.5 L 13.5 7 L 10.5 7 L 10.5 10.5 L 7 10.5 L 7 13.5 L 10.5 13.5 Z" />
    <path
        android:pathData="M0,0h24v24H0V0z" />

</vector>
+1 −1
Original line number Diff line number Diff line
@@ -2989,7 +2989,7 @@
  <!-- Global actions icons -->
  <java-symbol type="drawable" name="ic_restart" />
  <java-symbol type="drawable" name="ic_screenshot" />

  <java-symbol type="drawable" name="ic_faster_emergency" />
  <java-symbol type="drawable" name="emergency_icon" />

  <java-symbol type="array" name="config_convert_to_emergency_number_map" />
+18 −13
Original line number Diff line number Diff line
@@ -146,11 +146,11 @@ class GlobalActionsDialog implements DialogInterface.OnDismissListener,
    private boolean mDeviceProvisioned = false;
    private ToggleAction.State mAirplaneState = ToggleAction.State.Off;
    private boolean mIsWaitingForEcmExit = false;
    private boolean mHasFasterEmergencyButton;
    private boolean mHasTelephony;
    private boolean mHasVibrator;
    private boolean mHasLogoutButton;
    private boolean mHasLockdownButton;
    private boolean mSeparatedEmergencyButtonEnabled;
    private final boolean mShowSilentToggle;
    private final EmergencyAffordanceManager mEmergencyAffordanceManager;
    private final ScreenshotHelper mScreenshotHelper;
@@ -317,7 +317,8 @@ class GlobalActionsDialog implements DialogInterface.OnDismissListener,
        ArraySet<String> addedKeys = new ArraySet<String>();
        mHasLogoutButton = false;
        mHasLockdownButton = false;
        mHasFasterEmergencyButton = false;
        mSeparatedEmergencyButtonEnabled = Settings.Global.getInt(mContext.getContentResolver(),
                Settings.Global.FASTER_EMERGENCY_PHONE_CALL_ENABLED, 0) != 0;
        for (int i = 0; i < defaultActions.length; i++) {
            String actionKey = defaultActions[i];
            if (addedKeys.contains(actionKey)) {
@@ -356,13 +357,6 @@ 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());
                    mHasFasterEmergencyButton = true;
                }
            } else if (GLOBAL_ACTION_KEY_SCREENSHOT.equals(actionKey)) {
                mItems.add(new ScreenshotAction());
            } else if (GLOBAL_ACTION_KEY_LOGOUT.equals(actionKey)) {
@@ -371,6 +365,11 @@ class GlobalActionsDialog implements DialogInterface.OnDismissListener,
                    mItems.add(new LogoutAction());
                    mHasLogoutButton = true;
                }
            } else if (GLOBAL_ACTION_KEY_EMERGENCY.equals(actionKey)) {
                if (mSeparatedEmergencyButtonEnabled
                        && !mEmergencyAffordanceManager.needsEmergencyAffordance()) {
                    mItems.add(new EmergencyDialerAction());
                }
            } else {
                Log.e(TAG, "Invalid global action key " + actionKey);
            }
@@ -393,7 +392,7 @@ class GlobalActionsDialog implements DialogInterface.OnDismissListener,
            return false;
        };
        ActionsDialog dialog = new ActionsDialog(mContext, this, mAdapter, onItemLongClickListener,
                mHasFasterEmergencyButton);
                mSeparatedEmergencyButtonEnabled);
        dialog.setCanceledOnTouchOutside(false); // Handled by the custom class.
        dialog.setKeyguardShowing(mKeyguardShowing);

@@ -448,12 +447,12 @@ class GlobalActionsDialog implements DialogInterface.OnDismissListener,
        }
    }

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

        private EmergencyAction() {
            super(com.android.systemui.R.drawable.faster_emergency_icon,
        private EmergencyDialerAction() {
            super(R.drawable.ic_faster_emergency,
                    R.string.global_action_emergency);
        }

@@ -660,6 +659,12 @@ class GlobalActionsDialog implements DialogInterface.OnDismissListener,
    }

    private Action getEmergencyAction() {
        Drawable emergencyIcon = mContext.getDrawable(R.drawable.emergency_icon);
        if(!mSeparatedEmergencyButtonEnabled) {
            // use un-colored legacy treatment
            emergencyIcon.setTintList(null);
        }

        return new SinglePressAction(R.drawable.emergency_icon,
                R.string.global_action_emergency) {
            @Override