Reduce unnecessary redraw of wallpaper when switching orientation
In legacy transition, the wallpaper can change to invisible from: ActivityRecord#onAnimationFinished -> onExitAnimationDone -> hideWallpapers Since shell transition no longer calls onAnimationFinished, it usually relies on the next prepareSurface after the wallpaper target finishes transition. But when launching activity with orientation change, the display transition will execute right after the open transition is done. Then all windows are in transition and wallpaper will keep visible. That causes wallpaper to receive a redraw request for new rotation. But actually the wallpaper target is already invisible. So 1. Check isVisible instead of inTransition because everything is in transition for a display transition. 2. As legacy transition, when committing invisible for the wallpaper target, request to hide wallpaper as well. Then with VisibleRequested=false, it won't be requested to redraw. This also reduces the chance to update wallpaper offset with inconsistent orientation because the wallpaper won't perform relayout to change requested size. Bug: 281973565 Bug: 283952978 Test: Launch landscape app from portrait home. There should not have "finishDrawing of orientation" for wallpaper. And the window frame of wallpaper in dumpsys should still be portrait. Change-Id: Ib84b86784477684bf4a2cebeee70a61f98ae57a0
Loading
Please register or sign in to comment