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

Commit 8b655e0f authored by Hall Liu's avatar Hall Liu Committed by Android (Google) Code Review
Browse files

Merge "Disable app pinning when emergency call button pressed" into nyc-dev

parents 21f98459 7dac366a
Loading
Loading
Loading
Loading
+10 −0
Original line number Original line Diff line number Diff line
@@ -16,15 +16,18 @@


package com.android.keyguard;
package com.android.keyguard;


import android.app.ActivityManagerNative;
import android.app.ActivityOptions;
import android.app.ActivityOptions;
import android.content.Context;
import android.content.Context;
import android.content.Intent;
import android.content.Intent;
import android.content.res.Configuration;
import android.content.res.Configuration;
import android.os.PowerManager;
import android.os.PowerManager;
import android.os.RemoteException;
import android.os.SystemClock;
import android.os.SystemClock;
import android.os.UserHandle;
import android.os.UserHandle;
import android.telecom.TelecomManager;
import android.telecom.TelecomManager;
import android.util.AttributeSet;
import android.util.AttributeSet;
import android.util.Slog;
import android.view.View;
import android.view.View;
import android.widget.Button;
import android.widget.Button;


@@ -47,6 +50,8 @@ public class EmergencyButton extends Button {
                    | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
                    | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
                    | Intent.FLAG_ACTIVITY_CLEAR_TOP);
                    | Intent.FLAG_ACTIVITY_CLEAR_TOP);


    private static final String LOG_TAG = "EmergencyButton";

    KeyguardUpdateMonitorCallback mInfoCallback = new KeyguardUpdateMonitorCallback() {
    KeyguardUpdateMonitorCallback mInfoCallback = new KeyguardUpdateMonitorCallback() {


        @Override
        @Override
@@ -122,6 +127,11 @@ public class EmergencyButton extends Button {
        // TODO: implement a shorter timeout once new PowerManager API is ready.
        // TODO: implement a shorter timeout once new PowerManager API is ready.
        // should be the equivalent to the old userActivity(EMERGENCY_CALL_TIMEOUT)
        // should be the equivalent to the old userActivity(EMERGENCY_CALL_TIMEOUT)
        mPowerManager.userActivity(SystemClock.uptimeMillis(), true);
        mPowerManager.userActivity(SystemClock.uptimeMillis(), true);
        try {
            ActivityManagerNative.getDefault().stopSystemLockTaskMode();
        } catch (RemoteException e) {
            Slog.w(LOG_TAG, "Failed to stop app pinning");
        }
        if (isInCall()) {
        if (isInCall()) {
            resumeCall();
            resumeCall();
            if (mEmergencyButtonCallback != null) {
            if (mEmergencyButtonCallback != null) {
+5 −0
Original line number Original line Diff line number Diff line
@@ -199,6 +199,7 @@ import android.provider.Settings;
import android.service.voice.IVoiceInteractionSession;
import android.service.voice.IVoiceInteractionSession;
import android.service.voice.VoiceInteractionManagerInternal;
import android.service.voice.VoiceInteractionManagerInternal;
import android.service.voice.VoiceInteractionSession;
import android.service.voice.VoiceInteractionSession;
import android.telecom.TelecomManager;
import android.text.format.DateUtils;
import android.text.format.DateUtils;
import android.text.format.Time;
import android.text.format.Time;
import android.text.style.SuggestionSpan;
import android.text.style.SuggestionSpan;
@@ -10167,6 +10168,10 @@ public final class ActivityManagerService extends ActivityManagerNative
                mStackSupervisor.setLockTaskModeLocked(null, ActivityManager.LOCK_TASK_MODE_NONE,
                mStackSupervisor.setLockTaskModeLocked(null, ActivityManager.LOCK_TASK_MODE_NONE,
                        "stopLockTask", true);
                        "stopLockTask", true);
            }
            }
            TelecomManager tm = (TelecomManager) mContext.getSystemService(Context.TELECOM_SERVICE);
            if (tm != null) {
                tm.showInCallScreen(false);
            }
        } finally {
        } finally {
            Binder.restoreCallingIdentity(ident);
            Binder.restoreCallingIdentity(ident);
        }
        }