summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jerry Chang <chenghsiuchang@google.com> 2022-04-14 02:37:16 +0000
committer Jerry Chang <chenghsiuchang@google.com> 2022-04-20 09:26:26 +0000
commit8fc91fa0f612ddde9bfe8c7847eaa3e6e2ddd2ae (patch)
tree12b13ac3f5dc900f32c78d3ddbdfe0a3cb4ace9c
parentf0af066196b5572acfcc3ff341148f278897340a (diff)
Fix flicker while resizing split screen
Client app in split screen without focus was considered as occluded unexpectedly while applying transaction to resize split screen, so it won't process the new size config until the client app been relaunched due to configuration changed later and thus introduce a flicker. Refines ActivityRecord#shouldBeVisible to respect leaf task occluding state. Fix: 228569855 Test: client app on non-focused side of the split screen won't flicker after resized Change-Id: I19ac501526c6a4662609ef84532dc093acb63f54
-rw-r--r--services/core/java/com/android/server/wm/ActivityRecord.java18
-rw-r--r--services/core/java/com/android/server/wm/Task.java22
2 files changed, 13 insertions, 27 deletions
diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java
index 1956cee11f90..652fd4007f58 100644
--- a/services/core/java/com/android/server/wm/ActivityRecord.java
+++ b/services/core/java/com/android/server/wm/ActivityRecord.java
@@ -5515,8 +5515,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
}
/** @return {@code true} if this activity should be made visible. */
- private boolean shouldBeVisible(boolean behindFullscreenActivity, boolean ignoringKeyguard) {
- updateVisibilityIgnoringKeyguard(behindFullscreenActivity);
+ private boolean shouldBeVisible(boolean behindOccludedContainer, boolean ignoringKeyguard) {
+ updateVisibilityIgnoringKeyguard(behindOccludedContainer);
if (ignoringKeyguard) {
return visibleIgnoringKeyguard;
@@ -5574,20 +5574,20 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
return differentUidOverlayActivity != null;
}
- void updateVisibilityIgnoringKeyguard(boolean behindFullscreenActivity) {
- visibleIgnoringKeyguard = (!behindFullscreenActivity || mLaunchTaskBehind)
+ void updateVisibilityIgnoringKeyguard(boolean behindOccludedContainer) {
+ visibleIgnoringKeyguard = (!behindOccludedContainer || mLaunchTaskBehind)
&& showToCurrentUser();
}
boolean shouldBeVisible() {
- final Task rootTask = getRootTask();
- if (rootTask == null) {
+ final Task task = getTask();
+ if (task == null) {
return false;
}
- final boolean behindFullscreenActivity = !rootTask.shouldBeVisible(null /* starting */)
- || rootTask.getOccludingActivityAbove(this) != null;
- return shouldBeVisible(behindFullscreenActivity, false /* ignoringKeyguard */);
+ final boolean behindOccludedContainer = !task.shouldBeVisible(null /* starting */)
+ || task.getOccludingActivityAbove(this) != null;
+ return shouldBeVisible(behindOccludedContainer, false /* ignoringKeyguard */);
}
void makeVisibleIfNeeded(ActivityRecord starting, boolean reportToClient) {
diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java
index 9ea566ece6ec..e43b10255362 100644
--- a/services/core/java/com/android/server/wm/Task.java
+++ b/services/core/java/com/android/server/wm/Task.java
@@ -5047,21 +5047,9 @@ class Task extends TaskFragment {
positionChildAtTop(rTask);
}
Task task = null;
- if (!newTask && isOrhasTask) {
- // Starting activity cannot be occluding activity, otherwise starting window could be
- // remove immediately without transferring to starting activity.
- final ActivityRecord occludingActivity = getOccludingActivityAbove(r);
- if (occludingActivity != null) {
- // Here it is! Now, if this is not yet visible (occluded by another task) to the
- // user, then just add it without starting; it will get started when the user
- // navigates back to it.
- ProtoLog.i(WM_DEBUG_ADD_REMOVE, "Adding activity %s to task %s "
- + "callers: %s", r, task,
- new RuntimeException("here").fillInStackTrace());
- rTask.positionChildAtTop(r);
- ActivityOptions.abort(options);
- return;
- }
+ if (!newTask && isOrhasTask && !r.shouldBeVisible()) {
+ ActivityOptions.abort(options);
+ return;
}
// Place a new activity at top of root task, so it is next to interact with the user.
@@ -5691,9 +5679,7 @@ class Task extends TaskFragment {
return false;
}
- // See if there is an occluding activity on-top of this one.
- final ActivityRecord occludingActivity = getOccludingActivityAbove(r);
- if (occludingActivity != null) return false;
+ if (!r.shouldBeVisible()) return false;
if (r.finishing) Slog.e(TAG, "willActivityBeVisible: Returning false,"
+ " would have returned true for r=" + r);