Merge "Separated emergency option final UI"
am: c906be3b4f
Change-Id: I14c3d0146d02ecd770a00a099231eeb7b3d9d03a
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 5119e2c..4b92fd8 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -2987,7 +2987,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