Use parent frame to calculate wallpaper offset
Session#setWallpaperZoomOut may be called when display is rotated (DisplayInfo is updated) but wallpaper window has stopped to update frame (isVisibleRequested() of wallpaper window is false). In this case, when the zoom request calls to WallpaperController# updateWallpaperOffset, it calculates the offset with inconsistent orientation that causes unexpected wallpaper shift. Because wallpaper has no fit-insets, its parent frame should equal to display size. The example of wallaper WindowFrame: containing=[0,0][1080,2160] parent=[0,0][1080,2160] display=[-10000,-10000][10000,10000] mFrame=[0,0][1763,2160] So use the parent frame to ensure that the offset is computed from the frames with the same orientation. Bug: 183181781 Test: WallpaperControllerTests Change-Id: Icf55e3570c260b963fab6dc85814f9e8e305163c
This commit is contained in:
@@ -43,7 +43,6 @@ import android.os.SystemClock;
|
||||
import android.util.ArraySet;
|
||||
import android.util.MathUtils;
|
||||
import android.util.Slog;
|
||||
import android.view.DisplayInfo;
|
||||
import android.view.SurfaceControl;
|
||||
import android.view.WindowManager;
|
||||
import android.view.animation.Animation;
|
||||
@@ -296,9 +295,9 @@ class WallpaperController {
|
||||
}
|
||||
|
||||
boolean updateWallpaperOffset(WindowState wallpaperWin, boolean sync) {
|
||||
final DisplayInfo displayInfo = wallpaperWin.getDisplayInfo();
|
||||
final int dw = displayInfo.logicalWidth;
|
||||
final int dh = displayInfo.logicalHeight;
|
||||
final Rect parentFrame = wallpaperWin.getParentFrame();
|
||||
final int dw = parentFrame.width();
|
||||
final int dh = parentFrame.height();
|
||||
|
||||
int xOffset = 0;
|
||||
int yOffset = 0;
|
||||
|
||||
Reference in New Issue
Block a user