From 67d93c24bc8f3d9f52a91de0a15298fb257aa665 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Thu, 13 Jun 2019 10:36:58 -0700 Subject: Ensure snapshot orientation matches snapshot buffer size - We take/create the snapshot based on the bounds of the task, which are taken from the task's configuration. However, the orientation is taken from the app window's configuration, and if it has a requested orientation then the snapshot bounds can differ from the orientation (which makes it impossible for Launcher to render it correctly). This is visible when returning home from a landscape app where we update the configuration of the display as a part of resuming the home activity, which propagates down to the task, but where the app window's override configuration is still landscape while the bounds are portrait. Bug: 132687470 Test: Open Hearthstone, hit home and then go to overview Change-Id: I748a60c50a8f79a861b721dc490bd359d14d8160 --- .../core/java/com/android/server/wm/TaskSnapshotController.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/wm/TaskSnapshotController.java b/services/core/java/com/android/server/wm/TaskSnapshotController.java index d526e7c13041..101c4b86fbfa 100644 --- a/services/core/java/com/android/server/wm/TaskSnapshotController.java +++ b/services/core/java/com/android/server/wm/TaskSnapshotController.java @@ -306,7 +306,8 @@ class TaskSnapshotController { final boolean isWindowTranslucent = mainWindow.getAttrs().format != PixelFormat.OPAQUE; return new TaskSnapshot( appWindowToken.mActivityComponent, screenshotBuffer.getGraphicBuffer(), - screenshotBuffer.getColorSpace(), appWindowToken.getConfiguration().orientation, + screenshotBuffer.getColorSpace(), + appWindowToken.getTask().getConfiguration().orientation, getInsets(mainWindow), isLowRamDevice /* reduced */, scaleFraction /* scale */, true /* isRealSnapshot */, task.getWindowingMode(), getSystemUiVisibility(task), !appWindowToken.fillsParent() || isWindowTranslucent); @@ -394,10 +395,11 @@ class TaskSnapshotController { if (hwBitmap == null) { return null; } + // Note, the app theme snapshot is never translucent because we enforce a non-translucent // color above return new TaskSnapshot(topChild.mActivityComponent, hwBitmap.createGraphicBufferHandle(), - hwBitmap.getColorSpace(), topChild.getConfiguration().orientation, + hwBitmap.getColorSpace(), topChild.getTask().getConfiguration().orientation, getInsets(mainWindow), ActivityManager.isLowRamDeviceStatic() /* reduced */, 1.0f /* scale */, false /* isRealSnapshot */, task.getWindowingMode(), getSystemUiVisibility(task), false); -- cgit v1.2.3-59-g8ed1b