Avoid additional focus change when entering PiP from fullscreen
When entering PiP, the task will also be moved to top (from onRootTaskWindowingModeChanged), and because the activity is still fullscreen mode during animation, it will be detected as focusable, that may cause additional focus change. Also set defer-visibility-update if it is not called from a WCT, which can reduce additional ensureActivitiesVisible and resumeFocusedTasksTopActivities when setting the windowing mode of task (Task#setWindowingModeInSurfaceTransaction). That also avoid visibility and other states from being updated too early before a series of PiP operations are done. E.g. moveActivityToPinnedRootTask task.setWindowingMode(WINDOWING_MODE_PINNED) > ensureActivitiesVisible (can be omitted) > resumeFocusedTasksTopActivities (can be omitted) task.setBounds(bounds) task... ensureActivitiesVisible resumeFocusedTasksTopActivities Note that if isPip2ExperimentEnabled() is true, it means that moveActivityToPinnedRootTask is called from a WCT, and the WCT should already use setDeferRootVisibilityUpdate. So the logic of localVisibilityDeferred is the same as !isPip2ExperimentEnabled(). Bug: 307214895 Test: Swipe an immersive auto pip activity to home. The bar won't be flickering by changing focus from home->pip->home. Change-Id: I3cb601c4f4c63e2b22e0413764d2eef53387232d
Loading
Please register or sign in to comment