Isolate layout and animation wallpaper objects.
Provide separate copies of mWallpaperTarget, mWallpaperTokens, and
mLower/UpperWallpaperTarget in the layout and animation sides of
Window Manager.
Simplify constructors of WindowAnimator and WindowStateAnimator.
Change-Id: I7e35794a432c25c4194c046e9e27150d1c905403
diff --git a/services/java/com/android/server/wm/WindowStateAnimator.java b/services/java/com/android/server/wm/WindowStateAnimator.java
index 794dade..464df6e 100644
--- a/services/java/com/android/server/wm/WindowStateAnimator.java
+++ b/services/java/com/android/server/wm/WindowStateAnimator.java
@@ -3,7 +3,6 @@
package com.android.server.wm;
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING;
-import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER;
import static com.android.server.wm.WindowManagerService.LayoutFields.SET_ORIENTATION_CHANGE_COMPLETE;
import static com.android.server.wm.WindowManagerService.LayoutFields.SET_TURN_ON_SCREEN;
@@ -48,6 +47,7 @@
static final String TAG = "WindowStateAnimator";
+ // Unchanging local convenience fields.
final WindowManagerService mService;
final WindowState mWin;
final WindowState mAttachedWindow;
@@ -55,6 +55,7 @@
final Session mSession;
final WindowManagerPolicy mPolicy;
final Context mContext;
+ final boolean mIsWallpaper;
// If this is a universe background window, this is the transformation
// it is applying to the rest of the universe.
@@ -142,19 +143,22 @@
int mAttrFlags;
int mAttrType;
- public WindowStateAnimator(final WindowManagerService service, final WindowState win,
- final WindowState attachedWindow) {
+ public WindowStateAnimator(final WindowState win) {
+ final WindowManagerService service = win.mService;
+
mService = service;
- mWin = win;
- mAttachedWindow = attachedWindow;
- mAnimator = mService.mAnimator;
- mSession = win.mSession;
- mPolicy = mService.mPolicy;
- mContext = mService.mContext;
- mAttrFlags = win.mAttrs.flags;
- mAttrType = win.mAttrs.type;
+ mAnimator = service.mAnimator;
+ mPolicy = service.mPolicy;
+ mContext = service.mContext;
mAnimDw = service.mAppDisplayWidth;
mAnimDh = service.mAppDisplayHeight;
+
+ mWin = win;
+ mAttachedWindow = win.mAttachedWindow;
+ mSession = win.mSession;
+ mAttrFlags = win.mAttrs.flags;
+ mAttrType = win.mAttrs.type;
+ mIsWallpaper = win.mIsWallpaper;
}
public void setAnimation(Animation anim) {
@@ -309,7 +313,7 @@
mAnimLayer = mWin.mLayer;
if (mWin.mIsImWindow) {
mAnimLayer += mService.mInputMethodAnimLayerAdjustment;
- } else if (mWin.mIsWallpaper) {
+ } else if (mIsWallpaper) {
mAnimLayer += mService.mWallpaperAnimLayerAdjustment;
}
if (DEBUG_LAYERS) Slog.v(TAG, "Stepping win " + this
@@ -812,22 +816,21 @@
// Wallpapers are animated based on the "real" window they
// are currently targeting.
- if (mWin.mAttrs.type == TYPE_WALLPAPER && mService.mLowerWallpaperTarget == null
- && mService.mWallpaperTarget != null) {
- if (mService.mWallpaperTarget.mWinAnimator.mHasLocalTransformation &&
- mService.mWallpaperTarget.mWinAnimator.mAnimation != null &&
- !mService.mWallpaperTarget.mWinAnimator.mAnimation.getDetachWallpaper()) {
- attachedTransformation = mService.mWallpaperTarget.mWinAnimator.mTransformation;
+ if (mIsWallpaper && mAnimator.mLowerWallpaperTarget == null
+ && mAnimator.mWallpaperTarget != null) {
+ final WindowStateAnimator wallpaperAnimator = mAnimator.mWallpaperTarget.mWinAnimator;
+ if (wallpaperAnimator.mHasLocalTransformation &&
+ wallpaperAnimator.mAnimation != null &&
+ !wallpaperAnimator.mAnimation.getDetachWallpaper()) {
+ attachedTransformation = wallpaperAnimator.mTransformation;
if (WindowManagerService.DEBUG_WALLPAPER && attachedTransformation != null) {
Slog.v(TAG, "WP target attached xform: " + attachedTransformation);
}
}
- final AppWindowAnimator wpAppAnimator = mService.mWallpaperTarget.mAppToken == null
- ? null : mService.mWallpaperTarget.mAppToken.mAppAnimator;
- if (wpAppAnimator != null &&
- wpAppAnimator.hasTransformation &&
- wpAppAnimator.animation != null &&
- !wpAppAnimator.animation.getDetachWallpaper()) {
+ final AppWindowAnimator wpAppAnimator = mAnimator.mWpAppAnimator;
+ if (wpAppAnimator != null && wpAppAnimator.hasTransformation
+ && wpAppAnimator.animation != null
+ && !wpAppAnimator.animation.getDetachWallpaper()) {
appTransformation = wpAppAnimator.transformation;
if (WindowManagerService.DEBUG_WALLPAPER && appTransformation != null) {
Slog.v(TAG, "WP target app xform: " + appTransformation);
@@ -940,7 +943,7 @@
" screen=" + (screenAnimation ? mService.mAnimator.mScreenRotationAnimation.getEnterTransformation().getAlpha()
: "null"));
return;
- } else if (mWin.mIsWallpaper &&
+ } else if (mIsWallpaper &&
(mAnimator.mPendingActions & WindowAnimator.WALLPAPER_ACTION_PENDING) != 0) {
return;
}
@@ -1140,7 +1143,7 @@
setSurfaceBoundaries(recoveringMemory);
- if (mWin.mIsWallpaper && !mWin.mWallpaperVisible) {
+ if (mIsWallpaper && !mWin.mWallpaperVisible) {
// Wallpaper is no longer visible and there is no wp target => hide it.
hide();
} else if (w.mAttachedHidden || !w.isReadyForDisplay()) {
@@ -1199,7 +1202,7 @@
+ " during relayout");
if (showSurfaceRobustlyLocked()) {
mLastHidden = false;
- if (w.mIsWallpaper) {
+ if (mIsWallpaper) {
mService.dispatchWallpaperVisibility(w, true);
}
} else {