diff options
| author | 2018-09-06 05:22:11 +0000 | |
|---|---|---|
| committer | 2018-09-06 05:22:11 +0000 | |
| commit | 2a81fdb49aaf1294def152c038a5d1ccedf9677e (patch) | |
| tree | 60fe874a1be1183e2b4d3f9b58e88fb5890fd8d0 | |
| parent | c96ae50295fce79bbb0d6b51873d11a09d398619 (diff) | |
| parent | 5c42263488e90d5e8c82b46073a83c1dde9cdfa7 (diff) | |
Merge "Add extra data when starting emergency dialer intent"
3 files changed, 47 insertions, 6 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/EmergencyButton.java b/packages/SystemUI/src/com/android/keyguard/EmergencyButton.java index 5605b7a4babe..ac8f0246a608 100644 --- a/packages/SystemUI/src/com/android/keyguard/EmergencyButton.java +++ b/packages/SystemUI/src/com/android/keyguard/EmergencyButton.java @@ -39,6 +39,7 @@ import com.android.internal.logging.nano.MetricsProto.MetricsEvent; import com.android.internal.telephony.IccCardConstants.State; import com.android.internal.widget.LockPatternUtils; import com.android.internal.util.EmergencyAffordanceManager; +import com.android.systemui.util.EmergencyDialerConstants; /** * This class implements a smart emergency button that updates itself based @@ -48,11 +49,13 @@ import com.android.internal.util.EmergencyAffordanceManager; */ public class EmergencyButton extends Button { private static final Intent INTENT_EMERGENCY_DIAL = new Intent() - .setAction("com.android.phone.EmergencyDialer.DIAL") + .setAction(EmergencyDialerConstants.ACTION_DIAL) .setPackage("com.android.phone") .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS - | Intent.FLAG_ACTIVITY_CLEAR_TOP); + | Intent.FLAG_ACTIVITY_CLEAR_TOP) + .putExtra(EmergencyDialerConstants.EXTRA_ENTRY_TYPE, + EmergencyDialerConstants.ENTRY_TYPE_LOCKSCREEN_BUTTON); private static final String LOG_TAG = "EmergencyButton"; private final EmergencyAffordanceManager mEmergencyAffordanceManager; diff --git a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java index 06d44346bf9a..cc1b9e8f9c49 100644 --- a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java +++ b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java @@ -89,6 +89,7 @@ import com.android.systemui.Interpolators; import com.android.systemui.colorextraction.SysuiColorExtractor; import com.android.systemui.plugins.GlobalActions.GlobalActionsManager; import com.android.systemui.statusbar.phone.ScrimController; +import com.android.systemui.util.EmergencyDialerConstants; import com.android.systemui.volume.SystemUIInterpolators.LogAccelerateInterpolator; import java.util.ArrayList; @@ -449,9 +450,6 @@ class GlobalActionsDialog implements DialogInterface.OnDismissListener, } private class EmergencyDialerAction extends SinglePressAction { - private static final String ACTION_EMERGENCY_DIALER_DIAL = - "com.android.phone.EmergencyDialer.DIAL"; - private EmergencyDialerAction() { super(R.drawable.ic_faster_emergency, R.string.global_action_emergency); @@ -460,8 +458,10 @@ class GlobalActionsDialog implements DialogInterface.OnDismissListener, @Override public void onPress() { MetricsLogger.action(mContext, MetricsEvent.ACTION_EMERGENCY_DIALER_FROM_POWER_MENU); - Intent intent = new Intent(ACTION_EMERGENCY_DIALER_DIAL); + Intent intent = new Intent(EmergencyDialerConstants.ACTION_DIAL); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); + intent.putExtra(EmergencyDialerConstants.EXTRA_ENTRY_TYPE, + EmergencyDialerConstants.ENTRY_TYPE_POWER_MENU); mContext.startActivityAsUser(intent, UserHandle.CURRENT); } diff --git a/packages/SystemUI/src/com/android/systemui/util/EmergencyDialerConstants.java b/packages/SystemUI/src/com/android/systemui/util/EmergencyDialerConstants.java new file mode 100644 index 000000000000..d101ccbe30ea --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/util/EmergencyDialerConstants.java @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.util; + +/** + * Constants defined and used in emergency dialer. + * Please keep these constants being consistent with those in com.android.phone.EmergencyDialer. + */ +public class EmergencyDialerConstants { + // Intent action for emergency dialer activity. + public static final String ACTION_DIAL = "com.android.phone.EmergencyDialer.DIAL"; + + /** + * Extra included in {@link #ACTION_DIAL} to indicate the entry type that user starts + * the emergency dialer. + */ + public static final String EXTRA_ENTRY_TYPE = + "com.android.phone.EmergencyDialer.extra.ENTRY_TYPE"; + + // Indicating the entrance to emergency dialer + public static final int ENTRY_TYPE_UNKNOWN = 0; + public static final int ENTRY_TYPE_LOCKSCREEN_BUTTON = 1; + public static final int ENTRY_TYPE_POWER_MENU = 2; +} |