Remove deferred bounds updates

The purpose of deferring bounds updates was to avoid flicker
in app transition to split-screen-primary.

Not really working anymore since the task bounds are updated as
long as being reparented to split-screen organized tasks.

Bug: 153579514
Test: existing test pass
Change-Id: I02fc7d680403e87dea670f4f0e4e610821818274
This commit is contained in:
Louis Chang
2020-05-05 11:06:49 +08:00
committed by Evan Rosky
parent defd82296d
commit 794525fe4c
3 changed files with 0 additions and 96 deletions

View File

@@ -242,12 +242,6 @@ class ActivityStack extends Task {
*/
boolean mInResumeTopActivity = false;
private boolean mUpdateBoundsDeferred;
private boolean mUpdateBoundsDeferredCalled;
private boolean mUpdateDisplayedBoundsDeferredCalled;
private final Rect mDeferredBounds = new Rect();
private final Rect mDeferredDisplayedBounds = new Rect();
int mCurrentUser;
/** For comparison with DisplayContent bounds. */
@@ -846,58 +840,6 @@ class ActivityStack extends Task {
return getDisplayContent();
}
/**
* Defers updating the bounds of the stack. If the stack was resized/repositioned while
* deferring, the bounds will update in {@link #continueUpdateBounds()}.
*/
void deferUpdateBounds() {
if (!mUpdateBoundsDeferred) {
mUpdateBoundsDeferred = true;
mUpdateBoundsDeferredCalled = false;
}
}
/**
* Continues updating bounds after updates have been deferred. If there was a resize attempt
* between {@link #deferUpdateBounds()} and {@link #continueUpdateBounds()}, the stack will
* be resized to that bounds.
*/
void continueUpdateBounds() {
if (mUpdateBoundsDeferred) {
mUpdateBoundsDeferred = false;
if (mUpdateBoundsDeferredCalled) {
setTaskBounds(mDeferredBounds);
setBounds(mDeferredBounds);
}
}
}
private boolean updateBoundsAllowed(Rect bounds) {
if (!mUpdateBoundsDeferred) {
return true;
}
if (bounds != null) {
mDeferredBounds.set(bounds);
} else {
mDeferredBounds.setEmpty();
}
mUpdateBoundsDeferredCalled = true;
return false;
}
private boolean updateDisplayedBoundsAllowed(Rect bounds) {
if (!mUpdateBoundsDeferred) {
return true;
}
if (bounds != null) {
mDeferredDisplayedBounds.set(bounds);
} else {
mDeferredDisplayedBounds.setEmpty();
}
mUpdateDisplayedBoundsDeferredCalled = true;
return false;
}
/** @return true if the stack can only contain one task */
boolean isSingleTaskInstance() {
final DisplayContent display = getDisplay();
@@ -2687,10 +2629,6 @@ class ActivityStack extends Task {
// TODO: Can only be called from special methods in ActivityStackSupervisor.
// Need to consolidate those calls points into this resize method so anyone can call directly.
void resize(Rect displayedBounds, boolean preserveWindows, boolean deferResume) {
if (!updateBoundsAllowed(displayedBounds)) {
return;
}
Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "stack.resize_" + getRootTaskId());
mAtmService.deferWindowLayout();
try {
@@ -2730,10 +2668,6 @@ class ActivityStack extends Task {
* basically resizes both stack and task bounds to the same bounds.
*/
private void setTaskBounds(Rect bounds) {
if (!updateBoundsAllowed(bounds)) {
return;
}
final PooledConsumer c = PooledLambda.obtainConsumer(ActivityStack::setTaskBounds,
PooledLambda.__(Task.class), bounds);
forAllLeafTasks(c, true /* traverseTopToBottom */);

View File

@@ -1415,18 +1415,7 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks {
return mLaunchParamsController;
}
private void deferUpdateRecentsHomeStackBounds() {
mRootWindowContainer.deferUpdateBounds(ACTIVITY_TYPE_RECENTS);
mRootWindowContainer.deferUpdateBounds(ACTIVITY_TYPE_HOME);
}
private void continueUpdateRecentsHomeStackBounds() {
mRootWindowContainer.continueUpdateBounds(ACTIVITY_TYPE_RECENTS);
mRootWindowContainer.continueUpdateBounds(ACTIVITY_TYPE_HOME);
}
void notifyAppTransitionDone() {
continueUpdateRecentsHomeStackBounds();
for (int i = mResizingTasksDuringAnimation.size() - 1; i >= 0; i--) {
final int taskId = mResizingTasksDuringAnimation.valueAt(i);
final Task task =
@@ -2509,10 +2498,6 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks {
mService.deferWindowLayout();
try {
if (windowingMode == WINDOWING_MODE_SPLIT_SCREEN_PRIMARY) {
// Defer updating the stack in which recents is until the app transition is done, to
// not run into issues where we still need to draw the task in recents but the
// docked stack is already created.
deferUpdateRecentsHomeStackBounds();
// TODO(task-hierarchy): Remove when tiles are in hierarchy.
// Unset launching windowing mode to prevent creating split-screen-primary stack
// in RWC#anyTaskForId() below.
@@ -2522,7 +2507,6 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks {
task = mRootWindowContainer.anyTaskForId(taskId,
MATCH_TASK_IN_STACKS_OR_RECENT_TASKS_AND_RESTORE, activityOptions, ON_TOP);
if (task == null) {
continueUpdateRecentsHomeStackBounds();
mWindowManager.executeAppTransition();
throw new IllegalArgumentException(
"startActivityFromRecents: Task " + taskId + " not found.");

View File

@@ -2504,20 +2504,6 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
return list;
}
void deferUpdateBounds(int activityType) {
final ActivityStack stack = getStack(WINDOWING_MODE_UNDEFINED, activityType);
if (stack != null) {
stack.deferUpdateBounds();
}
}
void continueUpdateBounds(int activityType) {
final ActivityStack stack = getStack(WINDOWING_MODE_UNDEFINED, activityType);
if (stack != null) {
stack.continueUpdateBounds();
}
}
@Override
public void onDisplayAdded(int displayId) {
if (DEBUG_STACK) Slog.v(TAG, "Display added displayId=" + displayId);