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

Commit c906be3b authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Separated emergency option final UI"

parents e58c7805 d560e8f5
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
@@ -2976,7 +2976,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