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

Commit 3e900e92 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Use Telecomm API to build emergency dialer intent."

parents 9f4153da f991476a
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -50,14 +50,6 @@ import com.android.systemui.util.EmergencyDialerConstants;
 * allows the user to return to the call.
 */
public class EmergencyButton extends Button {
    private static final Intent INTENT_EMERGENCY_DIAL = new Intent()
            .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)
            .putExtra(EmergencyDialerConstants.EXTRA_ENTRY_TYPE,
                    EmergencyDialerConstants.ENTRY_TYPE_LOCKSCREEN_BUTTON);

    private static final String LOG_TAG = "EmergencyButton";
    private final EmergencyAffordanceManager mEmergencyAffordanceManager;
@@ -189,7 +181,15 @@ public class EmergencyButton extends Button {
        } else {
            Dependency.get(KeyguardUpdateMonitor.class).reportEmergencyCallAction(
                    true /* bypassHandler */);
            getContext().startActivityAsUser(INTENT_EMERGENCY_DIAL,
            Intent emergencyDialIntent =
                    getTelecommManager().createLaunchEmergencyDialerIntent(null /* number*/)
                            .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
                                    | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
                                    | Intent.FLAG_ACTIVITY_CLEAR_TOP)
                            .putExtra(EmergencyDialerConstants.EXTRA_ENTRY_TYPE,
                                    EmergencyDialerConstants.ENTRY_TYPE_LOCKSCREEN_BUTTON);

            getContext().startActivityAsUser(emergencyDialIntent,
                    ActivityOptions.makeCustomAnimation(getContext(), 0, 0).toBundle(),
                    new UserHandle(KeyguardUpdateMonitor.getCurrentUser()));
        }
+3 −1
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@ import android.os.Vibrator;
import android.provider.Settings;
import android.service.dreams.DreamService;
import android.service.dreams.IDreamManager;
import android.telecom.TelecomManager;
import android.telephony.PhoneStateListener;
import android.telephony.ServiceState;
import android.telephony.TelephonyManager;
@@ -563,7 +564,8 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
        @Override
        public void onPress() {
            MetricsLogger.action(mContext, MetricsEvent.ACTION_EMERGENCY_DIALER_FROM_POWER_MENU);
            Intent intent = new Intent(EmergencyDialerConstants.ACTION_DIAL);
            Intent intent = mContext.getSystemService(TelecomManager.class)
                    .createLaunchEmergencyDialerIntent(null /* number */);
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
                    | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
                    | Intent.FLAG_ACTIVITY_CLEAR_TOP);
+2 −3
Original line number Diff line number Diff line
@@ -21,11 +21,10 @@ package com.android.systemui.util;
 * 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
     * Extra included in {@link android.telecom.TelecomManager#createLaunchEmergencyDialerIntent}
     * to indicate the entry type that user starts
     * the emergency dialer.
     */
    public static final String EXTRA_ENTRY_TYPE =