Fixed pinned stack lockscreen interaction

- Use focused stack to determine of an activity can occlude the
lockscreen instead of the topmost stack. The topmost stack should be the
pinned stack which we don't want to decide if the lockscreen should be
occluded. Should be based on the stack that can contain a resume
activity.
- Make sure the remove AppWindowToken from the display if some one ever
calls removeImmediately() directly on it. This makes sure internal
states are clean-up correctly if the removal wasn't triggered from the
AM side.
- Remove some logs that end up causing confusion for testers thinking
something is broken.

Change-Id: I635f6c9a372882ff33d2e9780a1407f78cddf457
Fixes: 37208509
Test: android.server.cts.KeyguardLockedTests#testShowWhenLockedActivityAndPipActivity
Test: android.server.cts.KeyguardLockedTests#testShowWhenLockedPipActivity
This commit is contained in:
Wale Ogunwale
2017-04-21 09:30:12 -07:00
parent 0db9724b6c
commit e287e19fda
3 changed files with 32 additions and 15 deletions

View File

@@ -204,12 +204,11 @@ class KeyguardController {
mOccluded = false;
mDismissingKeyguardActivity = null;
final ArrayList<ActivityStack> stacks = mStackSupervisor.getStacksOnDefaultDisplay();
final int topStackNdx = stacks.size() - 1;
for (int stackNdx = topStackNdx; stackNdx >= 0; --stackNdx) {
for (int stackNdx = stacks.size() - 1; stackNdx >= 0; --stackNdx) {
final ActivityStack stack = stacks.get(stackNdx);
// Only the very top activity may control occluded state
if (stackNdx == topStackNdx) {
// Only the focused stack top activity may control occluded state
if (mStackSupervisor.isFocusedStack(stack)) {
// A dismissing activity occludes Keyguard in the insecure case for legacy reasons.
final ActivityRecord topDismissing = stack.getTopDismissingKeyguardActivity();

View File

@@ -95,6 +95,9 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
// change.
private boolean mReparenting;
// True if we are current in the process of removing this app token from the display
private boolean mRemovingFromDisplay = false;
// The input dispatching timeout for this application token in nanoseconds.
long mInputDispatchingTimeoutNanos;
@@ -464,6 +467,12 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
return !hidden;
}
@Override
void removeImmediately() {
onRemovedFromDisplay();
super.removeImmediately();
}
@Override
void removeIfPossible() {
mIsExiting = false;
@@ -480,6 +489,11 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
}
void onRemovedFromDisplay() {
if (mRemovingFromDisplay) {
return;
}
mRemovingFromDisplay = true;
if (DEBUG_APP_TRANSITIONS) Slog.v(TAG_WM, "Removing app token: " + this);
boolean delayed = setVisibility(null, false, TRANSIT_UNSET, true, mVoiceInteraction);
@@ -512,12 +526,14 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
mService.mNoAnimationNotifyOnTransitionFinished.add(token);
}
final TaskStack stack = getTask().mStack;
final TaskStack stack = getStack();
if (delayed && !isEmpty()) {
// set the token aside because it has an active animation to be finished
if (DEBUG_ADD_REMOVE || DEBUG_TOKEN_MOVEMENT) Slog.v(TAG_WM,
"removeAppToken make exiting: " + this);
stack.mExitingAppTokens.add(this);
if (stack != null) {
stack.mExitingAppTokens.add(this);
}
mIsExiting = true;
} else {
// Make sure there is no animation running on this token, so any windows associated
@@ -540,6 +556,8 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
if (!delayed) {
updateReportedVisibilityLocked();
}
mRemovingFromDisplay = false;
}
void clearAnimatingFlags() {
@@ -1558,6 +1576,9 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
if (getController() != null) {
pw.print(prefix); pw.print("controller="); pw.println(getController());
}
if (mRemovingFromDisplay) {
pw.println(prefix + "mRemovingFromDisplay=" + mRemovingFromDisplay);
}
}
@Override

View File

@@ -5606,22 +5606,19 @@ public class WindowManagerService extends IWindowManager.Stub
WindowState win = mWindowMap.get(client);
if (localLOGV) Slog.v(TAG_WM, "Looking up client " + client + ": " + win);
if (win == null) {
RuntimeException ex = new IllegalArgumentException(
"Requested window " + client + " does not exist");
if (throwOnError) {
throw ex;
throw new IllegalArgumentException(
"Requested window " + client + " does not exist");
}
Slog.w(TAG_WM, "Failed looking up window", ex);
Slog.w(TAG_WM, "Failed looking up window callers=" + Debug.getCallers(3));
return null;
}
if (session != null && win.mSession != session) {
RuntimeException ex = new IllegalArgumentException(
"Requested window " + client + " is in session " +
win.mSession + ", not " + session);
if (throwOnError) {
throw ex;
throw new IllegalArgumentException("Requested window " + client + " is in session "
+ win.mSession + ", not " + session);
}
Slog.w(TAG_WM, "Failed looking up window", ex);
Slog.w(TAG_WM, "Failed looking up window callers=" + Debug.getCallers(3));
return null;
}