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
diff --git a/core/res/res/drawable/emergency_icon.xml b/core/res/res/drawable/emergency_icon.xml
index b2ffa2b..c142be3 100644
--- a/core/res/res/drawable/emergency_icon.xml
+++ b/core/res/res/drawable/emergency_icon.xml
@@ -18,7 +18,7 @@
         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"/>
diff --git a/packages/SystemUI/res/drawable/faster_emergency_icon.xml b/core/res/res/drawable/ic_faster_emergency.xml
similarity index 64%
rename from packages/SystemUI/res/drawable/faster_emergency_icon.xml
rename to core/res/res/drawable/ic_faster_emergency.xml
index 208ff41..680dfce 100644
--- a/packages/SystemUI/res/drawable/faster_emergency_icon.xml
+++ b/core/res/res/drawable/ic_faster_emergency.xml
@@ -13,18 +13,19 @@
     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>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 95af9a6..eaaa866 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -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" />
diff --git a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java
index 532fa034a..8320d32 100644
--- a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java
+++ b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java
@@ -146,11 +146,11 @@
     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 @@
         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 @@
                 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 @@
                     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 @@
             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 @@
         }
     }
 
-    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 @@
     }
 
     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