diff options
| author | 2014-10-28 10:35:29 -0700 | |
|---|---|---|
| committer | 2014-10-28 15:13:16 -0700 | |
| commit | c74b5723a4a368d572952ef52c92c5754b5fd26c (patch) | |
| tree | d414178a9e31f99cdb2c2ceb3523f7efd2e3db7f | |
| parent | ebee8a4d92a8e80b49feb51e9c9621c79398457c (diff) | |
Fix issue 6455374: Bad recent image on camera launch from lockscreen.
When transitioning from the lockscreen to the camera app,
the previous activity that was running before the screen was
locked is briefly resumed and then paused. During the pause
we take a screenshot of the activity for recents which ends up
being an image of the wallpaper, because the activity was
moved behind the wallpaper while the lockscreen is up. With
this change we no longer include the wallpaper layer in the
screenshot if it is layered on top of the window we are
targeting for the screenshot.
Bug: 6455374
Change-Id: I305950a32c176f55eeeb6358266746e32e848383
| -rw-r--r-- | services/core/java/com/android/server/wm/WindowManagerService.java | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index 0e55c1cecff6..13fb96fd620c 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -6049,6 +6049,10 @@ public class WindowManagerService extends IWindowManager.Stub while (true) { if (retryCount++ > 0) { + // Reset max/min layers on retries so we don't accidentally take a screenshot of a + // layer based on the previous try. + maxLayer = 0; + minLayer = Integer.MAX_VALUE; try { Thread.sleep(100); } catch (InterruptedException e) { @@ -6071,7 +6075,17 @@ public class WindowManagerService extends IWindowManager.Stub continue; } } else if (ws.mIsWallpaper) { - // Fall through. + if (appWin == null) { + // We have not ran across the target window yet, so it is probably + // behind the wallpaper. This can happen when the keyguard is up and + // all windows are moved behind the wallpaper. We don't want to + // include the wallpaper layer in the screenshot as it will coverup + // the layer of the target window. + continue; + } + // Fall through. The target window is in front of the wallpaper. For this + // case we want to include the wallpaper layer in the screenshot because + // the target window might have some transparent areas. } else if (appToken != null) { if (ws.mAppToken == null || ws.mAppToken.token != appToken) { // This app window is of no interest if it is not associated with the |