Allow onTaskInfoChanged dispatch immediately

When TaskOrganizerController#onTaskInfoChanged receives the request to
change aspect ratio of an existing PiP window, such request would be
queued in mPendingTaskEvents and get dispatched on the next
- RootWindowContainer#performSurfacePlacementNotrace OR
- WindowAnimator#animate

In case there is no event queued in PendingTaskEvent, we change to
dispatch the event immediately. Otherwise, the next drawn should
dispatch all pending events.

Bug: 218456378
Test: atest PinnedStackTests#testChangeAspectRationWhenInPipMode \
            WmTests:WindowOrganizerTests
Change-Id: I09b43c362013b694d13566ece42a6f5be2225108
This commit is contained in:
Hongwei Wang
2022-02-16 15:51:41 -08:00
parent b70d7493c6
commit ab9bd401a9

View File

@@ -729,6 +729,16 @@ class TaskOrganizerController extends ITaskOrganizerController.Stub {
// Skip if task still not appeared.
return;
}
if (force && mPendingTaskEvents.isEmpty()) {
// There are task-info changed events do not result in
// - RootWindowContainer#performSurfacePlacementNoTrace OR
// - WindowAnimator#animate
// For instance, when an app requesting aspect ratio change when in PiP mode.
// To solve this, we directly dispatch the pending event if there are no events queued (
// otherwise, all pending events should be dispatched on next drawn).
dispatchTaskInfoChanged(task, true /* force */);
return;
}
// Defer task info reporting while layout is deferred. This is because layout defer
// blocks tend to do lots of re-ordering which can mess up animations in receivers.