summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authortiger_huang <tiger_huang@htc.com>2015-02-16 21:37:12 +0800
committertiger_huang <tiger_huang@htc.com>2015-03-11 16:38:27 +0800
commit4a7f8b99f82559e3a2fa02c5499a4d77cd79c707 (patch)
tree620d77fc0c3b43f406f89891acb45ce7c34c02c2 /services
parenta6ed1b9547dcd592031a415739cc7e672c068f7c (diff)
downloadframeworks_base-4a7f8b99f82559e3a2fa02c5499a4d77cd79c707.zip
frameworks_base-4a7f8b99f82559e3a2fa02c5499a4d77cd79c707.tar.gz
frameworks_base-4a7f8b99f82559e3a2fa02c5499a4d77cd79c707.tar.bz2
Wait for visible wallpaper drawn before starting app transitions
If the opening app has wallpaper, when the closing app starts hiding, the wallpaper would be revealed. It would be nice if we play the app transitions while opening apps, closing apps, and visible wallpapers are all drawn. https://code.google.com/p/android/issues/detail?id=150811 Change-Id: I3c7d140f6f6e43e18119e48f9cab441ee96b17e5
Diffstat (limited to 'services')
-rw-r--r--services/core/java/com/android/server/wm/WindowManagerService.java52
1 files changed, 52 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index 4dd4e1e..a25a84c 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -613,6 +613,13 @@ public class WindowManagerService extends IWindowManager.Stub
static final long WALLPAPER_TIMEOUT_RECOVERY = 10000;
boolean mAnimateWallpaperWithTarget;
+ // We give a wallpaper up to 1000ms to finish drawing before playing app transitions.
+ static final long WALLPAPER_DRAW_PENDING_TIMEOUT_DURATION = 1000;
+ static final int WALLPAPER_DRAW_NORMAL = 0;
+ static final int WALLPAPER_DRAW_PENDING = 1;
+ static final int WALLPAPER_DRAW_TIMEOUT = 2;
+ int mWallpaperDrawState = WALLPAPER_DRAW_NORMAL;
+
AppWindowToken mFocusedApp = null;
PowerManager mPowerManager;
@@ -7644,6 +7651,7 @@ public class WindowManagerService extends IWindowManager.Stub
public static final int CHECK_IF_BOOT_ANIMATION_FINISHED = 37;
public static final int RESET_ANR_MESSAGE = 38;
+ public static final int WALLPAPER_DRAW_PENDING_TIMEOUT = 39;
@Override
public void handleMessage(Message msg) {
@@ -8160,6 +8168,17 @@ public class WindowManagerService extends IWindowManager.Stub
}
}
break;
+ case WALLPAPER_DRAW_PENDING_TIMEOUT: {
+ synchronized (mWindowMap) {
+ if (mWallpaperDrawState == WALLPAPER_DRAW_PENDING) {
+ mWallpaperDrawState = WALLPAPER_DRAW_TIMEOUT;
+ if (DEBUG_APP_TRANSITIONS || DEBUG_WALLPAPER) Slog.v(TAG,
+ "*** WALLPAPER DRAW TIMEOUT");
+ performLayoutAndPlaceSurfacesLocked();
+ }
+ }
+ }
+ break;
}
if (DEBUG_WINDOW_TRACE) {
Slog.v(TAG, "handleMessage: exit");
@@ -9066,6 +9085,39 @@ public class WindowManagerService extends IWindowManager.Stub
goodToGo = false;
}
}
+ if (goodToGo && isWallpaperVisible(mWallpaperTarget)) {
+ boolean wallpaperGoodToGo = true;
+ for (int curTokenIndex = mWallpaperTokens.size() - 1;
+ curTokenIndex >= 0 && wallpaperGoodToGo; curTokenIndex--) {
+ WindowToken token = mWallpaperTokens.get(curTokenIndex);
+ for (int curWallpaperIndex = token.windows.size() - 1; curWallpaperIndex >= 0;
+ curWallpaperIndex--) {
+ WindowState wallpaper = token.windows.get(curWallpaperIndex);
+ if (wallpaper.mWallpaperVisible && !wallpaper.isDrawnLw()) {
+ // We've told this wallpaper to be visible, but it is not drawn yet
+ wallpaperGoodToGo = false;
+ if (mWallpaperDrawState != WALLPAPER_DRAW_TIMEOUT) {
+ // wait for this wallpaper until it is drawn or timeout
+ goodToGo = false;
+ }
+ if (mWallpaperDrawState == WALLPAPER_DRAW_NORMAL) {
+ mWallpaperDrawState = WALLPAPER_DRAW_PENDING;
+ mH.removeMessages(H.WALLPAPER_DRAW_PENDING_TIMEOUT);
+ mH.sendEmptyMessageDelayed(H.WALLPAPER_DRAW_PENDING_TIMEOUT,
+ WALLPAPER_DRAW_PENDING_TIMEOUT_DURATION);
+ }
+ if (DEBUG_APP_TRANSITIONS || DEBUG_WALLPAPER) Slog.v(TAG,
+ "Wallpaper should be visible but has not been drawn yet. " +
+ "mWallpaperDrawState=" + mWallpaperDrawState);
+ break;
+ }
+ }
+ }
+ if (wallpaperGoodToGo) {
+ mWallpaperDrawState = WALLPAPER_DRAW_NORMAL;
+ mH.removeMessages(H.WALLPAPER_DRAW_PENDING_TIMEOUT);
+ }
+ }
}
if (goodToGo) {
if (DEBUG_APP_TRANSITIONS) Slog.v(TAG, "**** GOOD TO GO");