Skip to content

Commit 468651c

Browse files
Hall LiuThe Android Automerger
authored andcommitted
DO NOT MERGE Disable app pinning when emergency call button pressed
Also disables app pinning when the "return to call" button is pressed and brings up the in-call screen when app pinning is stopped if there is an existing call. Combination of ag/1091397 and ag/1085584 adapted for MNC. Bug: 28558307 Bug: 28761672 Change-Id: I82ec4042bff387c845ce571b197a4a86e1dd5ec8
1 parent a75537b commit 468651c

3 files changed

Lines changed: 18 additions & 1 deletion

File tree

packages/Keyguard/src/com/android/keyguard/EmergencyButton.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,18 @@
1616

1717
package com.android.keyguard;
1818

19+
import android.app.ActivityManagerNative;
1920
import android.app.ActivityOptions;
2021
import android.content.Context;
2122
import android.content.Intent;
2223
import android.content.res.Configuration;
2324
import android.os.PowerManager;
25+
import android.os.RemoteException;
2426
import android.os.SystemClock;
2527
import android.os.UserHandle;
2628
import android.telecom.TelecomManager;
2729
import android.util.AttributeSet;
30+
import android.util.Slog;
2831
import android.view.View;
2932
import android.widget.Button;
3033

@@ -46,6 +49,8 @@ public class EmergencyButton extends Button {
4649
| Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
4750
| Intent.FLAG_ACTIVITY_CLEAR_TOP);
4851

52+
private static final String LOG_TAG = "EmergencyButton";
53+
4954
KeyguardUpdateMonitorCallback mInfoCallback = new KeyguardUpdateMonitorCallback() {
5055

5156
@Override
@@ -121,6 +126,11 @@ public void takeEmergencyCallAction() {
121126
// TODO: implement a shorter timeout once new PowerManager API is ready.
122127
// should be the equivalent to the old userActivity(EMERGENCY_CALL_TIMEOUT)
123128
mPowerManager.userActivity(SystemClock.uptimeMillis(), true);
129+
try {
130+
ActivityManagerNative.getDefault().stopLockTaskMode();
131+
} catch (RemoteException e) {
132+
Slog.w(LOG_TAG, "Failed to stop app pinning");
133+
}
124134
if (isInCall()) {
125135
resumeCall();
126136
if (mEmergencyButtonCallback != null) {

services/core/java/com/android/server/am/ActivityManagerService.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@
213213
import android.os.UserHandle;
214214
import android.os.UserManager;
215215
import android.provider.Settings;
216+
import android.telecom.TelecomManager;
216217
import android.text.format.DateUtils;
217218
import android.text.format.Time;
218219
import android.util.AtomicFile;
@@ -9179,6 +9180,10 @@ public void stopLockTaskMode() {
91799180
mStackSupervisor.setLockTaskModeLocked(null, ActivityManager.LOCK_TASK_MODE_NONE,
91809181
"stopLockTask", true);
91819182
}
9183+
TelecomManager tm = (TelecomManager) mContext.getSystemService(Context.TELECOM_SERVICE);
9184+
if (tm != null) {
9185+
tm.showInCallScreen(false);
9186+
}
91829187
} finally {
91839188
Binder.restoreCallingIdentity(ident);
91849189
}

services/core/java/com/android/server/am/ActivityStackSupervisor.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3868,7 +3868,9 @@ void removeLockedTaskLocked(final TaskRecord task) {
38683868
}
38693869

38703870
void showLockTaskToast() {
3871-
mLockTaskNotify.showToast(mLockTaskModeState);
3871+
if (mLockTaskNotify != null) {
3872+
mLockTaskNotify.showToast(mLockTaskModeState);
3873+
}
38723874
}
38733875

38743876
void showLockTaskEscapeMessageLocked(TaskRecord task) {

0 commit comments

Comments
 (0)