Recouple layout and animation a bit.
Share state between layout and animation and stop copying redundant data between the two. Change-Id: If07d3fc3ddfd33e3d46bf45d24d7aca58067ee66
This commit is contained in:
@@ -129,7 +129,7 @@ public class AppWindowAnimator {
|
||||
if (w == mService.mInputMethodTarget && !mService.mInputMethodTargetWaitingAnim) {
|
||||
mService.setInputMethodAnimLayerAdjustment(adj);
|
||||
}
|
||||
if (w == mAnimator.mWallpaperTarget && mAnimator.mLowerWallpaperTarget == null) {
|
||||
if (w == mService.mWallpaperTarget && mService.mLowerWallpaperTarget == null) {
|
||||
mService.setWallpaperAnimLayerAdjustmentLocked(adj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@ import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Version of WindowToken that is specifically for a particular application (or
|
||||
@@ -42,7 +41,7 @@ class AppWindowToken extends WindowToken {
|
||||
|
||||
// All of the windows and child windows that are included in this
|
||||
// application token. Note this list is NOT sorted!
|
||||
final ArrayList<WindowState> allAppWindows = new ArrayList<WindowState>();
|
||||
final WindowList allAppWindows = new WindowList();
|
||||
final AppWindowAnimator mAppAnimator;
|
||||
|
||||
final WindowAnimator mAnimator;
|
||||
|
||||
@@ -183,8 +183,6 @@ final class DisplayMagnificationMediator extends IDisplayMagnificationMediator.S
|
||||
displayState.mMagnificationSpec.initialize(spec.scale, spec.offsetX,
|
||||
spec.offsetY);
|
||||
spec.recycle();
|
||||
}
|
||||
synchronized (mWindowManagerService.mLayoutToAnim) {
|
||||
mWindowManagerService.scheduleAnimationLocked();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,8 +9,7 @@ import static com.android.server.wm.WindowManagerService.LayoutFields.SET_UPDATE
|
||||
import static com.android.server.wm.WindowManagerService.LayoutFields.SET_WALLPAPER_MAY_CHANGE;
|
||||
import static com.android.server.wm.WindowManagerService.LayoutFields.SET_FORCE_HIDING_CHANGED;
|
||||
import static com.android.server.wm.WindowManagerService.LayoutFields.SET_ORIENTATION_CHANGE_COMPLETE;
|
||||
|
||||
import static com.android.server.wm.WindowManagerService.H.UPDATE_ANIM_PARAMETERS;
|
||||
import static com.android.server.wm.WindowManagerService.LayoutFields.SET_WALLPAPER_ACTION_PENDING;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Debug;
|
||||
@@ -25,9 +24,7 @@ import android.view.Surface;
|
||||
import android.view.WindowManagerPolicy;
|
||||
import android.view.animation.Animation;
|
||||
|
||||
import com.android.server.wm.WindowManagerService.AppWindowAnimParams;
|
||||
import com.android.server.wm.WindowManagerService.LayoutFields;
|
||||
import com.android.server.wm.WindowManagerService.LayoutToAnimatorParams;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
@@ -73,28 +70,6 @@ public class WindowAnimator {
|
||||
SparseArray<DisplayContentsAnimator> mDisplayContentsAnimators =
|
||||
new SparseArray<WindowAnimator.DisplayContentsAnimator>();
|
||||
|
||||
static final int WALLPAPER_ACTION_PENDING = 1;
|
||||
int mPendingActions;
|
||||
|
||||
WindowState mWallpaperTarget = null;
|
||||
AppWindowAnimator mWpAppAnimator = null;
|
||||
WindowState mLowerWallpaperTarget = null;
|
||||
WindowState mUpperWallpaperTarget = null;
|
||||
|
||||
ArrayList<AppWindowAnimator> mAppAnimators = new ArrayList<AppWindowAnimator>();
|
||||
|
||||
ArrayList<WindowToken> mWallpaperTokens = new ArrayList<WindowToken>();
|
||||
|
||||
/** Parameters being passed from this into mService. */
|
||||
static class AnimatorToLayoutParams {
|
||||
boolean mUpdateQueued;
|
||||
int mBulkUpdateParams;
|
||||
SparseIntArray mPendingLayoutChanges;
|
||||
WindowState mWindowDetachedWallpaper;
|
||||
}
|
||||
/** Do not modify unless holding mService.mWindowMap or this and mAnimToLayout in that order */
|
||||
final AnimatorToLayoutParams mAnimToLayout = new AnimatorToLayoutParams();
|
||||
|
||||
boolean mInitialized = false;
|
||||
|
||||
// forceHiding states.
|
||||
@@ -122,13 +97,9 @@ public class WindowAnimator {
|
||||
mAnimationRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// TODO(cmautner): When full isolation is achieved for animation, the first lock
|
||||
// goes away and only the WindowAnimator.this remains.
|
||||
synchronized(mService.mWindowMap) {
|
||||
synchronized(WindowAnimator.this) {
|
||||
copyLayoutToAnimParamsLocked();
|
||||
animateLocked();
|
||||
}
|
||||
synchronized (mService.mWindowMap) {
|
||||
mService.mAnimationScheduled = false;
|
||||
animateLocked();
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -160,119 +131,20 @@ public class WindowAnimator {
|
||||
}
|
||||
|
||||
mDisplayContentsAnimators.delete(displayId);
|
||||
mPendingLayoutChanges.delete(displayId);
|
||||
}
|
||||
|
||||
/** Locked on mAnimToLayout */
|
||||
void updateAnimToLayoutLocked() {
|
||||
final AnimatorToLayoutParams animToLayout = mAnimToLayout;
|
||||
synchronized (animToLayout) {
|
||||
animToLayout.mBulkUpdateParams = mBulkUpdateParams;
|
||||
animToLayout.mPendingLayoutChanges = mPendingLayoutChanges.clone();
|
||||
animToLayout.mWindowDetachedWallpaper = mWindowDetachedWallpaper;
|
||||
|
||||
if (!animToLayout.mUpdateQueued) {
|
||||
animToLayout.mUpdateQueued = true;
|
||||
mService.mH.sendMessage(mService.mH.obtainMessage(UPDATE_ANIM_PARAMETERS));
|
||||
}
|
||||
}
|
||||
AppWindowAnimator getWallpaperAppAnimator() {
|
||||
return mService.mWallpaperTarget == null
|
||||
? null : mService.mWallpaperTarget.mAppToken == null
|
||||
? null : mService.mWallpaperTarget.mAppToken.mAppAnimator;
|
||||
}
|
||||
|
||||
/** Copy all WindowManagerService params into local params here. Locked on 'this'. */
|
||||
private void copyLayoutToAnimParamsLocked() {
|
||||
final LayoutToAnimatorParams layoutToAnim = mService.mLayoutToAnim;
|
||||
synchronized(layoutToAnim) {
|
||||
layoutToAnim.mAnimationScheduled = false;
|
||||
|
||||
if (!layoutToAnim.mParamsModified) {
|
||||
return;
|
||||
}
|
||||
layoutToAnim.mParamsModified = false;
|
||||
|
||||
if ((layoutToAnim.mChanges & LayoutToAnimatorParams.WALLPAPER_TOKENS_CHANGED) != 0) {
|
||||
layoutToAnim.mChanges &= ~LayoutToAnimatorParams.WALLPAPER_TOKENS_CHANGED;
|
||||
mWallpaperTokens = new ArrayList<WindowToken>(layoutToAnim.mWallpaperTokens);
|
||||
}
|
||||
|
||||
if (WindowManagerService.DEBUG_WALLPAPER_LIGHT) {
|
||||
if (mWallpaperTarget != layoutToAnim.mWallpaperTarget
|
||||
|| mLowerWallpaperTarget != layoutToAnim.mLowerWallpaperTarget
|
||||
|| mUpperWallpaperTarget != layoutToAnim.mUpperWallpaperTarget) {
|
||||
Slog.d(TAG, "Pulling anim wallpaper: target=" + layoutToAnim.mWallpaperTarget
|
||||
+ " lower=" + layoutToAnim.mLowerWallpaperTarget + " upper="
|
||||
+ layoutToAnim.mUpperWallpaperTarget);
|
||||
}
|
||||
}
|
||||
mWallpaperTarget = layoutToAnim.mWallpaperTarget;
|
||||
mWpAppAnimator = mWallpaperTarget == null
|
||||
? null : mWallpaperTarget.mAppToken == null
|
||||
? null : mWallpaperTarget.mAppToken.mAppAnimator;
|
||||
mLowerWallpaperTarget = layoutToAnim.mLowerWallpaperTarget;
|
||||
mUpperWallpaperTarget = layoutToAnim.mUpperWallpaperTarget;
|
||||
|
||||
// Set the new DimAnimator params.
|
||||
final int numDisplays = mDisplayContentsAnimators.size();
|
||||
for (int i = 0; i < numDisplays; i++) {
|
||||
final int displayId = mDisplayContentsAnimators.keyAt(i);
|
||||
DisplayContentsAnimator displayAnimator = mDisplayContentsAnimators.valueAt(i);
|
||||
|
||||
displayAnimator.mWinAnimators.clear();
|
||||
final WinAnimatorList winAnimators = layoutToAnim.mWinAnimatorLists.get(displayId);
|
||||
if (winAnimators != null) {
|
||||
displayAnimator.mWinAnimators.addAll(winAnimators);
|
||||
}
|
||||
|
||||
DimAnimator.Parameters dimParams = layoutToAnim.mDimParams.get(displayId);
|
||||
if (dimParams == null) {
|
||||
displayAnimator.mDimParams = null;
|
||||
} else {
|
||||
final WindowStateAnimator newWinAnimator = dimParams.mDimWinAnimator;
|
||||
|
||||
// Only set dim params on the highest dimmed layer.
|
||||
final WindowStateAnimator existingDimWinAnimator =
|
||||
displayAnimator.mDimParams == null ?
|
||||
null : displayAnimator.mDimParams.mDimWinAnimator;
|
||||
// Don't turn on for an unshown surface, or for any layer but the highest
|
||||
// dimmed layer.
|
||||
if (newWinAnimator.mSurfaceShown && (existingDimWinAnimator == null
|
||||
|| !existingDimWinAnimator.mSurfaceShown
|
||||
|| existingDimWinAnimator.mAnimLayer < newWinAnimator.mAnimLayer)) {
|
||||
displayAnimator.mDimParams = new DimAnimator.Parameters(dimParams);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mAppAnimators.clear();
|
||||
final int N = layoutToAnim.mAppWindowAnimParams.size();
|
||||
for (int i = 0; i < N; i++) {
|
||||
final AppWindowAnimParams params = layoutToAnim.mAppWindowAnimParams.get(i);
|
||||
AppWindowAnimator appAnimator = params.mAppAnimator;
|
||||
appAnimator.mAllAppWinAnimators.clear();
|
||||
appAnimator.mAllAppWinAnimators.addAll(params.mWinAnimators);
|
||||
mAppAnimators.add(appAnimator);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void hideWallpapersLocked(final WindowState w, boolean fromAnimator) {
|
||||
// There is an issue where this function can be called either from
|
||||
// the animation or the layout side of the window manager. The problem
|
||||
// is that if it is called from the layout side, we may not yet have
|
||||
// propagated the current layout wallpaper state over into the animation
|
||||
// state. If that is the case, we can do bad things like hide the
|
||||
// wallpaper when we had just made it shown because the animation side
|
||||
// doesn't yet see that there is now a wallpaper target. As a temporary
|
||||
// work-around, we tell the function here which side of the window manager
|
||||
// is calling so it can use the right state.
|
||||
if (fromAnimator) {
|
||||
hideWallpapersLocked(w, mWallpaperTarget, mLowerWallpaperTarget, mWallpaperTokens);
|
||||
} else {
|
||||
hideWallpapersLocked(w, mService.mWallpaperTarget,
|
||||
mService.mLowerWallpaperTarget, mService.mWallpaperTokens);
|
||||
}
|
||||
}
|
||||
|
||||
void hideWallpapersLocked(final WindowState w, final WindowState wallpaperTarget,
|
||||
final WindowState lowerWallpaperTarget, final ArrayList<WindowToken> wallpaperTokens) {
|
||||
void hideWallpapersLocked(final WindowState w) {
|
||||
final WindowState wallpaperTarget = mService.mWallpaperTarget;
|
||||
final WindowState lowerWallpaperTarget = mService.mLowerWallpaperTarget;
|
||||
final ArrayList<WindowToken> wallpaperTokens = mService.mWallpaperTokens;
|
||||
|
||||
if ((wallpaperTarget == w && lowerWallpaperTarget == null) || wallpaperTarget == null) {
|
||||
final int numTokens = wallpaperTokens.size();
|
||||
for (int i = numTokens - 1; i >= 0; i--) {
|
||||
@@ -299,9 +171,10 @@ public class WindowAnimator {
|
||||
|
||||
private void updateAppWindowsLocked() {
|
||||
int i;
|
||||
final int NAT = mAppAnimators.size();
|
||||
final ArrayList<AppWindowToken> appTokens = mService.mAnimatingAppTokens;
|
||||
final int NAT = appTokens.size();
|
||||
for (i=0; i<NAT; i++) {
|
||||
final AppWindowAnimator appAnimator = mAppAnimators.get(i);
|
||||
final AppWindowAnimator appAnimator = appTokens.get(i).mAppAnimator;
|
||||
final boolean wasAnimating = appAnimator.animation != null
|
||||
&& appAnimator.animation != AppWindowAnimator.sDummyAnimation;
|
||||
if (appAnimator.stepAnimationLocked(mCurrentTime)) {
|
||||
@@ -335,15 +208,14 @@ public class WindowAnimator {
|
||||
private void updateWindowsLocked(final int displayId) {
|
||||
++mAnimTransactionSequence;
|
||||
|
||||
final WinAnimatorList winAnimatorList =
|
||||
getDisplayContentsAnimatorLocked(displayId).mWinAnimators;
|
||||
final WindowList windows = mService.getWindowListLocked(displayId);
|
||||
ArrayList<WindowStateAnimator> unForceHiding = null;
|
||||
boolean wallpaperInUnForceHiding = false;
|
||||
mForceHiding = KEYGUARD_NOT_SHOWN;
|
||||
|
||||
for (int i = winAnimatorList.size() - 1; i >= 0; i--) {
|
||||
WindowStateAnimator winAnimator = winAnimatorList.get(i);
|
||||
WindowState win = winAnimator.mWin;
|
||||
for (int i = windows.size() - 1; i >= 0; i--) {
|
||||
WindowState win = windows.get(i);
|
||||
WindowStateAnimator winAnimator = win.mWinAnimator;
|
||||
final int flags = winAnimator.mAttrFlags;
|
||||
|
||||
if (winAnimator.mSurface != null) {
|
||||
@@ -355,7 +227,7 @@ public class WindowAnimator {
|
||||
", nowAnimating=" + nowAnimating);
|
||||
}
|
||||
|
||||
if (wasAnimating && !winAnimator.mAnimating && mWallpaperTarget == win) {
|
||||
if (wasAnimating && !winAnimator.mAnimating && mService.mWallpaperTarget == win) {
|
||||
mBulkUpdateParams |= SET_WALLPAPER_MAY_CHANGE;
|
||||
setPendingLayoutChanges(Display.DEFAULT_DISPLAY,
|
||||
WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER);
|
||||
@@ -486,21 +358,21 @@ public class WindowAnimator {
|
||||
private void updateWallpaperLocked(int displayId) {
|
||||
final DisplayContentsAnimator displayAnimator =
|
||||
getDisplayContentsAnimatorLocked(displayId);
|
||||
final WinAnimatorList winAnimatorList = displayAnimator.mWinAnimators;
|
||||
final WindowList windows = mService.getWindowListLocked(displayId);
|
||||
WindowStateAnimator windowAnimationBackground = null;
|
||||
int windowAnimationBackgroundColor = 0;
|
||||
WindowState detachedWallpaper = null;
|
||||
final DimSurface windowAnimationBackgroundSurface =
|
||||
displayAnimator.mWindowAnimationBackgroundSurface;
|
||||
|
||||
for (int i = winAnimatorList.size() - 1; i >= 0; i--) {
|
||||
WindowStateAnimator winAnimator = winAnimatorList.get(i);
|
||||
for (int i = windows.size() - 1; i >= 0; i--) {
|
||||
final WindowState win = windows.get(i);
|
||||
WindowStateAnimator winAnimator = win.mWinAnimator;
|
||||
if (winAnimator.mSurface == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
final int flags = winAnimator.mAttrFlags;
|
||||
final WindowState win = winAnimator.mWin;
|
||||
|
||||
// If this window is animating, make a note that we have
|
||||
// an animating window and take care of a request to run
|
||||
@@ -559,11 +431,11 @@ public class WindowAnimator {
|
||||
// don't cause the wallpaper to suddenly disappear.
|
||||
int animLayer = windowAnimationBackground.mAnimLayer;
|
||||
WindowState win = windowAnimationBackground.mWin;
|
||||
if (mWallpaperTarget == win
|
||||
|| mLowerWallpaperTarget == win || mUpperWallpaperTarget == win) {
|
||||
final int N = winAnimatorList.size();
|
||||
if (mService.mWallpaperTarget == win || mService.mLowerWallpaperTarget == win
|
||||
|| mService.mUpperWallpaperTarget == win) {
|
||||
final int N = windows.size();
|
||||
for (int i = 0; i < N; i++) {
|
||||
WindowStateAnimator winAnimator = winAnimatorList.get(i);
|
||||
WindowStateAnimator winAnimator = windows.get(i).mWinAnimator;
|
||||
if (winAnimator.mIsWallpaper) {
|
||||
animLayer = winAnimator.mAnimLayer;
|
||||
break;
|
||||
@@ -586,10 +458,13 @@ public class WindowAnimator {
|
||||
/** See if any windows have been drawn, so they (and others associated with them) can now be
|
||||
* shown. */
|
||||
private void testTokenMayBeDrawnLocked() {
|
||||
final int NT = mAppAnimators.size();
|
||||
// See if any windows have been drawn, so they (and others
|
||||
// associated with them) can now be shown.
|
||||
final ArrayList<AppWindowToken> appTokens = mService.mAnimatingAppTokens;
|
||||
final int NT = appTokens.size();
|
||||
for (int i=0; i<NT; i++) {
|
||||
AppWindowAnimator appAnimator = mAppAnimators.get(i);
|
||||
AppWindowToken wtoken = appAnimator.mAppToken;
|
||||
AppWindowToken wtoken = appTokens.get(i);
|
||||
AppWindowAnimator appAnimator = wtoken.mAppAnimator;
|
||||
final boolean allDrawn = wtoken.allDrawn;
|
||||
if (allDrawn != appAnimator.allDrawn) {
|
||||
appAnimator.allDrawn = allDrawn;
|
||||
@@ -671,10 +546,10 @@ public class WindowAnimator {
|
||||
// associated with exiting/removed apps
|
||||
performAnimationsLocked(displayId);
|
||||
|
||||
final WinAnimatorList winAnimatorList = displayAnimator.mWinAnimators;
|
||||
final int N = winAnimatorList.size();
|
||||
final WindowList windows = mService.getWindowListLocked(displayId);
|
||||
final int N = windows.size();
|
||||
for (int j = 0; j < N; j++) {
|
||||
winAnimatorList.get(j).prepareSurfaceLocked(true);
|
||||
windows.get(j).mWinAnimator.prepareSurfaceLocked(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -715,18 +590,18 @@ public class WindowAnimator {
|
||||
for (int i = mPendingLayoutChanges.size() - 1; i >= 0; i--) {
|
||||
if ((mPendingLayoutChanges.valueAt(i)
|
||||
& WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER) != 0) {
|
||||
mPendingActions |= WALLPAPER_ACTION_PENDING;
|
||||
mBulkUpdateParams |= SET_WALLPAPER_ACTION_PENDING;
|
||||
}
|
||||
}
|
||||
|
||||
if (mBulkUpdateParams != 0 || mPendingLayoutChanges.size() > 0) {
|
||||
updateAnimToLayoutLocked();
|
||||
if (mService.copyAnimToLayoutParamsLocked()) {
|
||||
mService.requestTraversalLocked();
|
||||
}
|
||||
}
|
||||
|
||||
if (mAnimating) {
|
||||
synchronized (mService.mLayoutToAnim) {
|
||||
mService.scheduleAnimationLocked();
|
||||
}
|
||||
mService.scheduleAnimationLocked();
|
||||
} else if (wasAnimating) {
|
||||
mService.requestTraversalLocked();
|
||||
}
|
||||
@@ -777,51 +652,16 @@ public class WindowAnimator {
|
||||
final String subPrefix = " " + prefix;
|
||||
final String subSubPrefix = " " + subPrefix;
|
||||
|
||||
boolean needSep = false;
|
||||
if (mAppAnimators.size() > 0) {
|
||||
needSep = true;
|
||||
pw.println(" App Animators:");
|
||||
for (int i=mAppAnimators.size()-1; i>=0; i--) {
|
||||
AppWindowAnimator anim = mAppAnimators.get(i);
|
||||
pw.print(prefix); pw.print("App Animator #"); pw.print(i);
|
||||
pw.print(' '); pw.print(anim);
|
||||
if (dumpAll) {
|
||||
pw.println(':');
|
||||
anim.dump(pw, subPrefix, dumpAll);
|
||||
} else {
|
||||
pw.println();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (mWallpaperTokens.size() > 0) {
|
||||
if (needSep) {
|
||||
pw.println();
|
||||
}
|
||||
needSep = true;
|
||||
pw.print(prefix); pw.println("Wallpaper tokens:");
|
||||
for (int i=mWallpaperTokens.size()-1; i>=0; i--) {
|
||||
WindowToken token = mWallpaperTokens.get(i);
|
||||
pw.print(prefix); pw.print("Wallpaper #"); pw.print(i);
|
||||
pw.print(' '); pw.print(token);
|
||||
if (dumpAll) {
|
||||
pw.println(':');
|
||||
token.dump(pw, subPrefix);
|
||||
} else {
|
||||
pw.println();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (needSep) {
|
||||
pw.println();
|
||||
}
|
||||
for (int i = 0; i < mDisplayContentsAnimators.size(); i++) {
|
||||
pw.print(prefix); pw.print("DisplayContentsAnimator #");
|
||||
pw.print(mDisplayContentsAnimators.keyAt(i));
|
||||
pw.println(":");
|
||||
DisplayContentsAnimator displayAnimator = mDisplayContentsAnimators.valueAt(i);
|
||||
for (int j=0; j<displayAnimator.mWinAnimators.size(); j++) {
|
||||
WindowStateAnimator wanim = displayAnimator.mWinAnimators.get(j);
|
||||
final WindowList windows =
|
||||
mService.getWindowListLocked(mDisplayContentsAnimators.keyAt(i));
|
||||
final int N = windows.size();
|
||||
for (int j = 0; j < N; j++) {
|
||||
WindowStateAnimator wanim = windows.get(j).mWinAnimator;
|
||||
pw.print(subPrefix); pw.print("Window #"); pw.print(j);
|
||||
pw.print(": "); pw.println(wanim);
|
||||
}
|
||||
@@ -867,34 +707,16 @@ public class WindowAnimator {
|
||||
pw.print(Integer.toHexString(mBulkUpdateParams));
|
||||
pw.println(bulkUpdateParamsToString(mBulkUpdateParams));
|
||||
}
|
||||
if (mPendingActions != 0) {
|
||||
pw.print(prefix); pw.print("mPendingActions=0x");
|
||||
pw.println(Integer.toHexString(mPendingActions));
|
||||
}
|
||||
if (mWindowDetachedWallpaper != null) {
|
||||
pw.print(prefix); pw.print("mWindowDetachedWallpaper=");
|
||||
pw.println(mWindowDetachedWallpaper);
|
||||
}
|
||||
pw.print(prefix); pw.print("mWallpaperTarget="); pw.println(mWallpaperTarget);
|
||||
pw.print(prefix); pw.print("mWpAppAnimator="); pw.println(mWpAppAnimator);
|
||||
if (mLowerWallpaperTarget != null || mUpperWallpaperTarget != null) {
|
||||
pw.print(prefix); pw.print("mLowerWallpaperTarget=");
|
||||
pw.println(mLowerWallpaperTarget);
|
||||
pw.print(prefix); pw.print("mUpperWallpaperTarget=");
|
||||
pw.println(mUpperWallpaperTarget);
|
||||
}
|
||||
if (mUniverseBackground != null) {
|
||||
pw.print(prefix); pw.print("mUniverseBackground="); pw.print(mUniverseBackground);
|
||||
pw.print(" mAboveUniverseLayer="); pw.println(mAboveUniverseLayer);
|
||||
}
|
||||
}
|
||||
|
||||
void clearPendingActions() {
|
||||
synchronized (this) {
|
||||
mPendingActions = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void setPendingLayoutChanges(final int displayId, final int changes) {
|
||||
mPendingLayoutChanges.put(displayId, mPendingLayoutChanges.get(displayId) | changes);
|
||||
}
|
||||
@@ -902,9 +724,9 @@ public class WindowAnimator {
|
||||
void setAppLayoutChanges(final AppWindowAnimator appAnimator, final int changes, String s) {
|
||||
// Used to track which displays layout changes have been done.
|
||||
SparseIntArray displays = new SparseIntArray();
|
||||
for (int i = appAnimator.mAllAppWinAnimators.size() - 1; i >= 0; i--) {
|
||||
WindowStateAnimator winAnimator = appAnimator.mAllAppWinAnimators.get(i);
|
||||
final int displayId = winAnimator.mWin.mDisplayContent.getDisplayId();
|
||||
WindowList windows = appAnimator.mAppToken.allAppWindows;
|
||||
for (int i = windows.size() - 1; i >= 0; i--) {
|
||||
final int displayId = windows.get(i).getDisplayId();
|
||||
if (displays.indexOfKey(displayId) < 0) {
|
||||
setPendingLayoutChanges(displayId, changes);
|
||||
if (WindowManagerService.DEBUG_LAYOUT_REPEATS) {
|
||||
@@ -916,6 +738,27 @@ public class WindowAnimator {
|
||||
}
|
||||
}
|
||||
|
||||
void setDimParamsLocked(int displayId, DimAnimator.Parameters dimParams) {
|
||||
DisplayContentsAnimator displayAnimator = mDisplayContentsAnimators.get(displayId);
|
||||
if (dimParams == null) {
|
||||
displayAnimator.mDimParams = null;
|
||||
} else {
|
||||
final WindowStateAnimator newWinAnimator = dimParams.mDimWinAnimator;
|
||||
|
||||
// Only set dim params on the highest dimmed layer.
|
||||
final WindowStateAnimator existingDimWinAnimator =
|
||||
displayAnimator.mDimParams == null ?
|
||||
null : displayAnimator.mDimParams.mDimWinAnimator;
|
||||
// Don't turn on for an unshown surface, or for any layer but the highest
|
||||
// dimmed layer.
|
||||
if (newWinAnimator.mSurfaceShown && (existingDimWinAnimator == null
|
||||
|| !existingDimWinAnimator.mSurfaceShown
|
||||
|| existingDimWinAnimator.mAnimLayer < newWinAnimator.mAnimLayer)) {
|
||||
displayAnimator.mDimParams = new DimAnimator.Parameters(dimParams);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private DisplayContentsAnimator getDisplayContentsAnimatorLocked(int displayId) {
|
||||
DisplayContentsAnimator displayAnimator = mDisplayContentsAnimators.get(displayId);
|
||||
if (displayAnimator == null) {
|
||||
@@ -934,7 +777,6 @@ public class WindowAnimator {
|
||||
}
|
||||
|
||||
private class DisplayContentsAnimator {
|
||||
WinAnimatorList mWinAnimators = new WinAnimatorList();
|
||||
DimAnimator mDimAnimator = null;
|
||||
DimAnimator.Parameters mDimParams = null;
|
||||
DimSurface mWindowAnimationBackgroundSurface = null;
|
||||
|
||||
@@ -125,7 +125,6 @@ import android.view.InputDevice;
|
||||
import android.view.InputEvent;
|
||||
import android.view.InputEventReceiver;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MagnificationSpec;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.Surface;
|
||||
import android.view.SurfaceSession;
|
||||
@@ -522,7 +521,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
WindowState mLowerWallpaperTarget = null;
|
||||
// If non-null, we are in the middle of animating from one wallpaper target
|
||||
// to another, and this is the higher one in Z-order.
|
||||
private WindowState mUpperWallpaperTarget = null;
|
||||
WindowState mUpperWallpaperTarget = null;
|
||||
int mWallpaperAnimLayerAdjustment;
|
||||
float mLastWallpaperX = -1;
|
||||
float mLastWallpaperY = -1;
|
||||
@@ -566,6 +565,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
static final int SET_FORCE_HIDING_CHANGED = 1 << 2;
|
||||
static final int SET_ORIENTATION_CHANGE_COMPLETE = 1 << 3;
|
||||
static final int SET_TURN_ON_SCREEN = 1 << 4;
|
||||
static final int SET_WALLPAPER_ACTION_PENDING = 1 << 5;
|
||||
|
||||
boolean mWallpaperForceHidingChanged = false;
|
||||
boolean mWallpaperMayChange = false;
|
||||
@@ -579,6 +579,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
private float mButtonBrightness = -1;
|
||||
private long mUserActivityTimeout = -1;
|
||||
private boolean mUpdateRotation = false;
|
||||
boolean mWallpaperActionPending = false;
|
||||
|
||||
private static final int DISPLAY_CONTENT_UNKNOWN = 0;
|
||||
private static final int DISPLAY_CONTENT_MIRROR = 1;
|
||||
@@ -603,27 +604,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
}
|
||||
}
|
||||
|
||||
static class LayoutToAnimatorParams {
|
||||
boolean mParamsModified;
|
||||
|
||||
static final long WALLPAPER_TOKENS_CHANGED = 1 << 0;
|
||||
long mChanges;
|
||||
|
||||
boolean mAnimationScheduled;
|
||||
SparseArray<WinAnimatorList> mWinAnimatorLists = new SparseArray<WinAnimatorList>();
|
||||
WindowState mWallpaperTarget;
|
||||
WindowState mLowerWallpaperTarget;
|
||||
WindowState mUpperWallpaperTarget;
|
||||
SparseArray<DimAnimator.Parameters> mDimParams = new SparseArray<DimAnimator.Parameters>();
|
||||
ArrayList<WindowToken> mWallpaperTokens = new ArrayList<WindowToken>();
|
||||
ArrayList<AppWindowAnimParams> mAppWindowAnimParams = new ArrayList<AppWindowAnimParams>();
|
||||
}
|
||||
/** Params from WindowManagerService to WindowAnimator. Do not modify or read without first
|
||||
* locking on either mWindowMap or mAnimator and then on mLayoutToAnim */
|
||||
final LayoutToAnimatorParams mLayoutToAnim = new LayoutToAnimatorParams();
|
||||
|
||||
/** The lowest wallpaper target with a detached wallpaper animation on it. */
|
||||
WindowState mWindowDetachedWallpaper = null;
|
||||
boolean mAnimationScheduled;
|
||||
|
||||
/** Skip repeated AppWindowTokens initialization. Note that AppWindowsToken's version of this
|
||||
* is a long initialized to Long.MIN_VALUE so that it doesn't match this value on startup. */
|
||||
@@ -703,9 +684,6 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
*/
|
||||
boolean mInTouchMode = true;
|
||||
|
||||
// Temp regions for intermediary calculations.
|
||||
private final Region mTempRegion = new Region();
|
||||
|
||||
private ViewServer mViewServer;
|
||||
private ArrayList<WindowChangeListener> mWindowChangeListeners =
|
||||
new ArrayList<WindowChangeListener>();
|
||||
@@ -1592,7 +1570,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
continue;
|
||||
}
|
||||
topCurW = null;
|
||||
if (w != mWindowDetachedWallpaper && w.mAppToken != null) {
|
||||
if (w != mAnimator.mWindowDetachedWallpaper && w.mAppToken != null) {
|
||||
// If this window's app token is hidden and not animating,
|
||||
// it is of no interest to us.
|
||||
if (w.mAppToken.hidden && w.mAppToken.mAppAnimator.animation == null) {
|
||||
@@ -1618,7 +1596,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
} else if (w == mWindowDetachedWallpaper) {
|
||||
} else if (w == mAnimator.mWindowDetachedWallpaper) {
|
||||
windowDetachedI = i;
|
||||
}
|
||||
}
|
||||
@@ -2817,7 +2795,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
}
|
||||
if ((attrChanges&WindowManager.LayoutParams.FORMAT_CHANGED) != 0) {
|
||||
// To change the format, we need to re-build the surface.
|
||||
winAnimator.destroySurfaceLocked(false);
|
||||
winAnimator.destroySurfaceLocked();
|
||||
toBeDisplayed = true;
|
||||
surfaceChanged = true;
|
||||
}
|
||||
@@ -2898,7 +2876,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
if (mInputMethodWindow == win) {
|
||||
mInputMethodWindow = null;
|
||||
}
|
||||
winAnimator.destroySurfaceLocked(false);
|
||||
winAnimator.destroySurfaceLocked();
|
||||
}
|
||||
if (mMagnificationMediator != null) {
|
||||
mMagnificationMediator.onWindowTransitionLw(win, transit);
|
||||
@@ -3002,7 +2980,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
if (win == null) {
|
||||
return;
|
||||
}
|
||||
win.mWinAnimator.destroyDeferredSurfaceLocked(false);
|
||||
win.mWinAnimator.destroyDeferredSurfaceLocked();
|
||||
}
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(origId);
|
||||
@@ -3179,7 +3157,6 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
mTokenMap.put(token, wtoken);
|
||||
if (type == TYPE_WALLPAPER) {
|
||||
mWallpaperTokens.add(wtoken);
|
||||
updateLayoutToAnimWallpaperTokens();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3231,7 +3208,6 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
mExitingTokens.add(wtoken);
|
||||
} else if (wtoken.windowType == TYPE_WALLPAPER) {
|
||||
mWallpaperTokens.remove(wtoken);
|
||||
updateLayoutToAnimWallpaperTokens();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5593,7 +5569,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
rotation, mFxSession,
|
||||
MAX_ANIMATION_DURATION, mTransitionAnimationScale,
|
||||
displayInfo.logicalWidth, displayInfo.logicalHeight)) {
|
||||
updateLayoutToAnimationLocked();
|
||||
scheduleAnimationLocked();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6641,19 +6617,17 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
public static final int REPORT_HARD_KEYBOARD_STATUS_CHANGE = 22;
|
||||
public static final int BOOT_TIMEOUT = 23;
|
||||
public static final int WAITING_FOR_DRAWN_TIMEOUT = 24;
|
||||
public static final int UPDATE_ANIM_PARAMETERS = 25;
|
||||
public static final int SHOW_STRICT_MODE_VIOLATION = 26;
|
||||
public static final int DO_ANIMATION_CALLBACK = 27;
|
||||
public static final int SHOW_STRICT_MODE_VIOLATION = 25;
|
||||
public static final int DO_ANIMATION_CALLBACK = 26;
|
||||
|
||||
public static final int DO_DISPLAY_ADDED = 28;
|
||||
public static final int DO_DISPLAY_REMOVED = 29;
|
||||
public static final int DO_DISPLAY_CHANGED = 30;
|
||||
public static final int DO_DISPLAY_ADDED = 27;
|
||||
public static final int DO_DISPLAY_REMOVED = 28;
|
||||
public static final int DO_DISPLAY_CHANGED = 29;
|
||||
|
||||
public static final int CLIENT_FREEZE_TIMEOUT = 31;
|
||||
public static final int CLIENT_FREEZE_TIMEOUT = 30;
|
||||
|
||||
public static final int ANIMATOR_WHAT_OFFSET = 100000;
|
||||
public static final int SET_TRANSPARENT_REGION = ANIMATOR_WHAT_OFFSET + 1;
|
||||
public static final int CLEAR_PENDING_ACTIONS = ANIMATOR_WHAT_OFFSET + 2;
|
||||
|
||||
public H() {
|
||||
}
|
||||
@@ -6933,20 +6907,18 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
|
||||
case FORCE_GC: {
|
||||
synchronized (mWindowMap) {
|
||||
synchronized (mAnimator) {
|
||||
// Since we're holding both mWindowMap and mAnimator we don't need to
|
||||
// hold mAnimator.mLayoutToAnim.
|
||||
if (mAnimator.mAnimating || mLayoutToAnim.mAnimationScheduled) {
|
||||
// If we are animating, don't do the gc now but
|
||||
// delay a bit so we don't interrupt the animation.
|
||||
sendEmptyMessageDelayed(H.FORCE_GC, 2000);
|
||||
return;
|
||||
}
|
||||
// If we are currently rotating the display, it will
|
||||
// schedule a new message when done.
|
||||
if (mDisplayFrozen) {
|
||||
return;
|
||||
}
|
||||
// Since we're holding both mWindowMap and mAnimator we don't need to
|
||||
// hold mAnimator.mLayoutToAnim.
|
||||
if (mAnimator.mAnimating || mAnimationScheduled) {
|
||||
// If we are animating, don't do the gc now but
|
||||
// delay a bit so we don't interrupt the animation.
|
||||
sendEmptyMessageDelayed(H.FORCE_GC, 2000);
|
||||
return;
|
||||
}
|
||||
// If we are currently rotating the display, it will
|
||||
// schedule a new message when done.
|
||||
if (mDisplayFrozen) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
Runtime.getRuntime().gc();
|
||||
@@ -6960,16 +6932,14 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
|
||||
case APP_FREEZE_TIMEOUT: {
|
||||
synchronized (mWindowMap) {
|
||||
synchronized (mAnimator) {
|
||||
Slog.w(TAG, "App freeze timeout expired.");
|
||||
int i = mAppTokens.size();
|
||||
while (i > 0) {
|
||||
i--;
|
||||
AppWindowToken tok = mAppTokens.get(i);
|
||||
if (tok.mAppAnimator.freezingScreen) {
|
||||
Slog.w(TAG, "Force clearing freeze: " + tok);
|
||||
unsetAppFreezingScreenLocked(tok, true, true);
|
||||
}
|
||||
Slog.w(TAG, "App freeze timeout expired.");
|
||||
int i = mAppTokens.size();
|
||||
while (i > 0) {
|
||||
i--;
|
||||
AppWindowToken tok = mAppTokens.get(i);
|
||||
if (tok.mAppAnimator.freezingScreen) {
|
||||
Slog.w(TAG, "Force clearing freeze: " + tok);
|
||||
unsetAppFreezingScreenLocked(tok, true, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7060,17 +7030,6 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
break;
|
||||
}
|
||||
|
||||
case UPDATE_ANIM_PARAMETERS: {
|
||||
// Used to send multiple changes from the animation side to the layout side.
|
||||
synchronized (mWindowMap) {
|
||||
if (copyAnimToLayoutParamsLocked()) {
|
||||
sendEmptyMessage(CLEAR_PENDING_ACTIONS);
|
||||
performLayoutAndPlaceSurfacesLocked();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case SHOW_STRICT_MODE_VIOLATION: {
|
||||
showStrictModeViolation(msg.arg1, msg.arg2);
|
||||
break;
|
||||
@@ -7085,11 +7044,6 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
break;
|
||||
}
|
||||
|
||||
case CLEAR_PENDING_ACTIONS: {
|
||||
mAnimator.clearPendingActions();
|
||||
break;
|
||||
}
|
||||
|
||||
case DO_ANIMATION_CALLBACK: {
|
||||
try {
|
||||
((IRemoteCallback)msg.obj).sendResult(null);
|
||||
@@ -7468,7 +7422,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
pw.flush();
|
||||
Slog.w(TAG, "This window was lost: " + ws);
|
||||
Slog.w(TAG, sw.toString());
|
||||
ws.mWinAnimator.destroySurfaceLocked(false);
|
||||
ws.mWinAnimator.destroySurfaceLocked();
|
||||
}
|
||||
}
|
||||
Slog.w(TAG, "Current app token list:");
|
||||
@@ -7530,7 +7484,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
}
|
||||
if (layerChanged && mAnimator.isDimmingLocked(winAnimator)) {
|
||||
// Force an animation pass just to update the mDimAnimator layer.
|
||||
updateLayoutToAnimationLocked();
|
||||
scheduleAnimationLocked();
|
||||
}
|
||||
if (DEBUG_LAYERS) Slog.v(TAG, "Assign layer " + w + ": "
|
||||
+ "mBase=" + w.mBaseLayer
|
||||
@@ -7556,6 +7510,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
mH.removeMessages(H.DO_TRAVERSAL);
|
||||
loopCount--;
|
||||
} while (mTraversalScheduled && loopCount > 0);
|
||||
mInnerFields.mWallpaperActionPending = false;
|
||||
}
|
||||
|
||||
private boolean mInLayout = false;
|
||||
@@ -8780,7 +8735,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
if (win == mWallpaperTarget) {
|
||||
wallpaperDestroyed = true;
|
||||
}
|
||||
win.mWinAnimator.destroySurfaceLocked(false);
|
||||
win.mWinAnimator.destroySurfaceLocked();
|
||||
} while (i > 0);
|
||||
mDestroySurface.clear();
|
||||
}
|
||||
@@ -8792,7 +8747,6 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
mExitingTokens.remove(i);
|
||||
if (token.windowType == TYPE_WALLPAPER) {
|
||||
mWallpaperTokens.remove(token);
|
||||
updateLayoutToAnimWallpaperTokens();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8903,7 +8857,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
// be enabled, because the window obscured flags have changed.
|
||||
enableScreenIfNeededLocked();
|
||||
|
||||
updateLayoutToAnimationLocked();
|
||||
scheduleAnimationLocked();
|
||||
|
||||
if (DEBUG_WINDOW_TRACE) {
|
||||
Slog.e(TAG, "performLayoutAndPlaceSurfacesLockedInner exit: animating="
|
||||
@@ -9000,82 +8954,21 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
|
||||
/** Note that Locked in this case is on mLayoutToAnim */
|
||||
void scheduleAnimationLocked() {
|
||||
final LayoutToAnimatorParams layoutToAnim = mLayoutToAnim;
|
||||
if (!layoutToAnim.mAnimationScheduled) {
|
||||
layoutToAnim.mAnimationScheduled = true;
|
||||
if (!mAnimationScheduled) {
|
||||
mAnimationScheduled = true;
|
||||
mChoreographer.postCallback(
|
||||
Choreographer.CALLBACK_ANIMATION, mAnimator.mAnimationRunnable, null);
|
||||
}
|
||||
}
|
||||
|
||||
void updateLayoutToAnimationLocked() {
|
||||
final LayoutToAnimatorParams layoutToAnim = mLayoutToAnim;
|
||||
synchronized (layoutToAnim) {
|
||||
// Copy local params to transfer params.
|
||||
SparseArray<WinAnimatorList> allWinAnimatorLists = layoutToAnim.mWinAnimatorLists;
|
||||
allWinAnimatorLists.clear();
|
||||
DisplayContentsIterator iterator = new DisplayContentsIterator();
|
||||
while (iterator.hasNext()) {
|
||||
final DisplayContent displayContent = iterator.next();
|
||||
WinAnimatorList winAnimatorList = new WinAnimatorList();
|
||||
final WindowList windows = displayContent.getWindowList();
|
||||
int N = windows.size();
|
||||
for (int i = 0; i < N; i++) {
|
||||
final WindowStateAnimator winAnimator = windows.get(i).mWinAnimator;
|
||||
if (winAnimator.mSurface != null) {
|
||||
winAnimatorList.add(winAnimator);
|
||||
}
|
||||
}
|
||||
allWinAnimatorLists.put(displayContent.getDisplayId(), winAnimatorList);
|
||||
}
|
||||
|
||||
if (WindowManagerService.DEBUG_WALLPAPER_LIGHT) {
|
||||
if (mWallpaperTarget != layoutToAnim.mWallpaperTarget
|
||||
|| mLowerWallpaperTarget != layoutToAnim.mLowerWallpaperTarget
|
||||
|| mUpperWallpaperTarget != layoutToAnim.mUpperWallpaperTarget) {
|
||||
Slog.d(TAG, "Pushing anim wallpaper: target=" + mWallpaperTarget
|
||||
+ " lower=" + mLowerWallpaperTarget + " upper="
|
||||
+ mUpperWallpaperTarget + "\n" + Debug.getCallers(5, " "));
|
||||
}
|
||||
}
|
||||
layoutToAnim.mWallpaperTarget = mWallpaperTarget;
|
||||
layoutToAnim.mLowerWallpaperTarget = mLowerWallpaperTarget;
|
||||
layoutToAnim.mUpperWallpaperTarget = mUpperWallpaperTarget;
|
||||
|
||||
final ArrayList<AppWindowAnimParams> paramList = layoutToAnim.mAppWindowAnimParams;
|
||||
paramList.clear();
|
||||
int N = mAnimatingAppTokens.size();
|
||||
for (int i = 0; i < N; i++) {
|
||||
paramList.add(new AppWindowAnimParams(mAnimatingAppTokens.get(i).mAppAnimator));
|
||||
}
|
||||
|
||||
layoutToAnim.mParamsModified = true;
|
||||
scheduleAnimationLocked();
|
||||
}
|
||||
}
|
||||
|
||||
void updateLayoutToAnimWallpaperTokens() {
|
||||
synchronized(mLayoutToAnim) {
|
||||
mLayoutToAnim.mWallpaperTokens = new ArrayList<WindowToken>(mWallpaperTokens);
|
||||
mLayoutToAnim.mChanges |= LayoutToAnimatorParams.WALLPAPER_TOKENS_CHANGED;
|
||||
}
|
||||
}
|
||||
|
||||
void setAnimDimParams(int displayId, DimAnimator.Parameters params) {
|
||||
synchronized (mLayoutToAnim) {
|
||||
mLayoutToAnim.mDimParams.put(displayId, params);
|
||||
scheduleAnimationLocked();
|
||||
}
|
||||
}
|
||||
|
||||
void startDimmingLocked(final WindowStateAnimator winAnimator, final float target,
|
||||
final int width, final int height) {
|
||||
setAnimDimParams(winAnimator.mWin.getDisplayId(),
|
||||
mAnimator.setDimParamsLocked(winAnimator.mWin.getDisplayId(),
|
||||
new DimAnimator.Parameters(winAnimator, width, height, target));
|
||||
}
|
||||
|
||||
void stopDimmingLocked(int displayId) {
|
||||
setAnimDimParams(displayId, null);
|
||||
mAnimator.setDimParamsLocked(displayId, null);
|
||||
}
|
||||
|
||||
private boolean needsLayout() {
|
||||
@@ -9088,53 +8981,52 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean copyAnimToLayoutParamsLocked() {
|
||||
boolean copyAnimToLayoutParamsLocked() {
|
||||
boolean doRequest = false;
|
||||
final WindowAnimator.AnimatorToLayoutParams animToLayout = mAnimator.mAnimToLayout;
|
||||
synchronized (animToLayout) {
|
||||
animToLayout.mUpdateQueued = false;
|
||||
final int bulkUpdateParams = animToLayout.mBulkUpdateParams;
|
||||
// TODO(cmautner): As the number of bits grows, use masks of bit groups to
|
||||
// eliminate unnecessary tests.
|
||||
if ((bulkUpdateParams & LayoutFields.SET_UPDATE_ROTATION) != 0) {
|
||||
mInnerFields.mUpdateRotation = true;
|
||||
doRequest = true;
|
||||
}
|
||||
if ((bulkUpdateParams & LayoutFields.SET_WALLPAPER_MAY_CHANGE) != 0) {
|
||||
mInnerFields.mWallpaperMayChange = true;
|
||||
doRequest = true;
|
||||
}
|
||||
if ((bulkUpdateParams & LayoutFields.SET_FORCE_HIDING_CHANGED) != 0) {
|
||||
mInnerFields.mWallpaperForceHidingChanged = true;
|
||||
doRequest = true;
|
||||
}
|
||||
if ((bulkUpdateParams & LayoutFields.SET_ORIENTATION_CHANGE_COMPLETE) == 0) {
|
||||
mInnerFields.mOrientationChangeComplete = false;
|
||||
} else {
|
||||
mInnerFields.mOrientationChangeComplete = true;
|
||||
if (mWindowsFreezingScreen) {
|
||||
doRequest = true;
|
||||
}
|
||||
}
|
||||
if ((bulkUpdateParams & LayoutFields.SET_TURN_ON_SCREEN) != 0) {
|
||||
mTurnOnScreen = true;
|
||||
}
|
||||
|
||||
SparseIntArray pendingLayouts = animToLayout.mPendingLayoutChanges;
|
||||
final int count = pendingLayouts.size();
|
||||
if (count > 0) {
|
||||
doRequest = true;
|
||||
}
|
||||
for (int i = 0; i < count; ++i) {
|
||||
final DisplayContent displayContent =
|
||||
getDisplayContentLocked(pendingLayouts.keyAt(i));
|
||||
if (displayContent != null) {
|
||||
displayContent.pendingLayoutChanges |= pendingLayouts.valueAt(i);
|
||||
}
|
||||
}
|
||||
|
||||
mWindowDetachedWallpaper = animToLayout.mWindowDetachedWallpaper;
|
||||
final int bulkUpdateParams = mAnimator.mBulkUpdateParams;
|
||||
// TODO(cmautner): As the number of bits grows, use masks of bit groups to
|
||||
// eliminate unnecessary tests.
|
||||
if ((bulkUpdateParams & LayoutFields.SET_UPDATE_ROTATION) != 0) {
|
||||
mInnerFields.mUpdateRotation = true;
|
||||
doRequest = true;
|
||||
}
|
||||
if ((bulkUpdateParams & LayoutFields.SET_WALLPAPER_MAY_CHANGE) != 0) {
|
||||
mInnerFields.mWallpaperMayChange = true;
|
||||
doRequest = true;
|
||||
}
|
||||
if ((bulkUpdateParams & LayoutFields.SET_FORCE_HIDING_CHANGED) != 0) {
|
||||
mInnerFields.mWallpaperForceHidingChanged = true;
|
||||
doRequest = true;
|
||||
}
|
||||
if ((bulkUpdateParams & LayoutFields.SET_ORIENTATION_CHANGE_COMPLETE) == 0) {
|
||||
mInnerFields.mOrientationChangeComplete = false;
|
||||
} else {
|
||||
mInnerFields.mOrientationChangeComplete = true;
|
||||
if (mWindowsFreezingScreen) {
|
||||
doRequest = true;
|
||||
}
|
||||
}
|
||||
if ((bulkUpdateParams & LayoutFields.SET_TURN_ON_SCREEN) != 0) {
|
||||
mTurnOnScreen = true;
|
||||
}
|
||||
if ((bulkUpdateParams & LayoutFields.SET_WALLPAPER_ACTION_PENDING) != 0) {
|
||||
mInnerFields.mWallpaperActionPending = true;
|
||||
}
|
||||
|
||||
SparseIntArray pendingLayouts = mAnimator.mPendingLayoutChanges;
|
||||
final int count = pendingLayouts.size();
|
||||
if (count > 0) {
|
||||
doRequest = true;
|
||||
}
|
||||
for (int i = 0; i < count; ++i) {
|
||||
final DisplayContent displayContent =
|
||||
getDisplayContentLocked(pendingLayouts.keyAt(i));
|
||||
if (displayContent != null) {
|
||||
displayContent.pendingLayoutChanges |= pendingLayouts.valueAt(i);
|
||||
}
|
||||
}
|
||||
|
||||
return doRequest;
|
||||
}
|
||||
|
||||
@@ -9472,7 +9364,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
if (screenRotationAnimation.dismiss(mFxSession, MAX_ANIMATION_DURATION,
|
||||
mTransitionAnimationScale, displayInfo.logicalWidth,
|
||||
displayInfo.logicalHeight)) {
|
||||
updateLayoutToAnimationLocked();
|
||||
scheduleAnimationLocked();
|
||||
} else {
|
||||
screenRotationAnimation.kill();
|
||||
screenRotationAnimation = null;
|
||||
@@ -9668,14 +9560,17 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
return mPolicy.hasNavigationBar();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void lockNow(Bundle options) {
|
||||
mPolicy.lockNow(options);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSafeModeEnabled() {
|
||||
return mSafeMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showAssistant() {
|
||||
// TODO: What permission?
|
||||
if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER)
|
||||
@@ -10015,31 +9910,6 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
pw.print(" mStartingIconInTransition="); pw.print(mStartingIconInTransition);
|
||||
pw.print(" mSkipAppTransitionAnimation="); pw.println(mSkipAppTransitionAnimation);
|
||||
pw.println(" mLayoutToAnim:");
|
||||
pw.print(" mParamsModified="); pw.print(mLayoutToAnim.mParamsModified);
|
||||
pw.print(" mAnimationScheduled="); pw.print(mLayoutToAnim.mAnimationScheduled);
|
||||
pw.print(" mChanges=0x");
|
||||
pw.println(Long.toHexString(mLayoutToAnim.mChanges));
|
||||
pw.print(" mWallpaperTarget="); pw.println(mLayoutToAnim.mWallpaperTarget);
|
||||
if (mLayoutToAnim.mLowerWallpaperTarget != null
|
||||
|| mLayoutToAnim.mUpperWallpaperTarget != null) {
|
||||
pw.print(" mLowerWallpaperTarget=");
|
||||
pw.println(mLayoutToAnim.mLowerWallpaperTarget);
|
||||
pw.print(" mUpperWallpaperTarget=");
|
||||
pw.println(mLayoutToAnim.mUpperWallpaperTarget);
|
||||
}
|
||||
for (int i=0; i<mLayoutToAnim.mWinAnimatorLists.size(); i++) {
|
||||
pw.print(" Win Animator List #");
|
||||
pw.print(mLayoutToAnim.mWinAnimatorLists.keyAt(i)); pw.println(":");
|
||||
WinAnimatorList wanim = mLayoutToAnim.mWinAnimatorLists.valueAt(i);
|
||||
for (int wi=0; wi<wanim.size(); wi++) {
|
||||
pw.print(" "); pw.println(wanim.get(wi));
|
||||
}
|
||||
}
|
||||
for (int i=0; i<mLayoutToAnim.mWallpaperTokens.size(); i++) {
|
||||
pw.print(" Wallpaper Token #"); pw.print(i); pw.print(": ");
|
||||
pw.println(mLayoutToAnim.mWallpaperTokens.get(i));
|
||||
}
|
||||
// XXX also need to print mDimParams and mAppWindowAnimParams. I am lazy.
|
||||
mAppTransition.dump(pw);
|
||||
}
|
||||
}
|
||||
@@ -10250,6 +10120,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
}
|
||||
|
||||
// Called by the heartbeat to ensure locks are not held indefnitely (for deadlock detection).
|
||||
@Override
|
||||
public void monitor() {
|
||||
synchronized (mWindowMap) { }
|
||||
}
|
||||
@@ -10391,7 +10262,16 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
* @return The list of WindowStates on the screen, or null if the there is no screen.
|
||||
*/
|
||||
public WindowList getWindowListLocked(final Display display) {
|
||||
final DisplayContent displayContent = getDisplayContentLocked(display.getDisplayId());
|
||||
return getWindowListLocked(display.getDisplayId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the list of WindowStates associated on the passed display.
|
||||
* @param displayId The screen to return windows from.
|
||||
* @return The list of WindowStates on the screen, or null if the there is no screen.
|
||||
*/
|
||||
public WindowList getWindowListLocked(final int displayId) {
|
||||
final DisplayContent displayContent = getDisplayContentLocked(displayId);
|
||||
return displayContent != null ? displayContent.getWindowList() : null;
|
||||
}
|
||||
|
||||
|
||||
@@ -872,8 +872,8 @@ final class WindowState implements WindowManagerPolicy.WindowState {
|
||||
if (WindowManagerService.DEBUG_ADD_REMOVE) Slog.v(TAG, "Removing " + this + " from " + mAttachedWindow);
|
||||
mAttachedWindow.mChildWindows.remove(this);
|
||||
}
|
||||
mWinAnimator.destroyDeferredSurfaceLocked(false);
|
||||
mWinAnimator.destroySurfaceLocked(false);
|
||||
mWinAnimator.destroyDeferredSurfaceLocked();
|
||||
mWinAnimator.destroySurfaceLocked();
|
||||
mSession.windowRemovedLocked();
|
||||
try {
|
||||
mClient.asBinder().unlinkToDeath(mDeathRecipient, 0);
|
||||
@@ -974,7 +974,7 @@ final class WindowState implements WindowManagerPolicy.WindowState {
|
||||
mWinAnimator.applyAnimationLocked(WindowManagerPolicy.TRANSIT_ENTER, true);
|
||||
}
|
||||
if (requestAnim) {
|
||||
mService.updateLayoutToAnimationLocked();
|
||||
mService.scheduleAnimationLocked();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -1017,7 +1017,7 @@ final class WindowState implements WindowManagerPolicy.WindowState {
|
||||
}
|
||||
}
|
||||
if (requestAnim) {
|
||||
mService.updateLayoutToAnimationLocked();
|
||||
mService.scheduleAnimationLocked();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -226,7 +226,7 @@ class WindowStateAnimator {
|
||||
mAnimation.cancel();
|
||||
mAnimation = null;
|
||||
mLocalAnimating = false;
|
||||
destroySurfaceLocked(true);
|
||||
destroySurfaceLocked();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -413,7 +413,7 @@ class WindowStateAnimator {
|
||||
mService.mPendingRemove.add(mWin);
|
||||
mWin.mRemoveOnExit = false;
|
||||
}
|
||||
mAnimator.hideWallpapersLocked(mWin, true);
|
||||
mAnimator.hideWallpapersLocked(mWin);
|
||||
}
|
||||
|
||||
void hide() {
|
||||
@@ -752,7 +752,7 @@ class WindowStateAnimator {
|
||||
return mSurface;
|
||||
}
|
||||
|
||||
void destroySurfaceLocked(boolean fromAnimator) {
|
||||
void destroySurfaceLocked() {
|
||||
if (mWin.mAppToken != null && mWin == mWin.mAppToken.startingWindow) {
|
||||
mWin.mAppToken.startingDisplayed = false;
|
||||
}
|
||||
@@ -802,7 +802,7 @@ class WindowStateAnimator {
|
||||
}
|
||||
mSurface.destroy();
|
||||
}
|
||||
mAnimator.hideWallpapersLocked(mWin, fromAnimator);
|
||||
mAnimator.hideWallpapersLocked(mWin);
|
||||
} catch (RuntimeException e) {
|
||||
Slog.w(TAG, "Exception thrown when destroying Window " + this
|
||||
+ " surface " + mSurface + " session " + mSession
|
||||
@@ -816,7 +816,7 @@ class WindowStateAnimator {
|
||||
}
|
||||
}
|
||||
|
||||
void destroyDeferredSurfaceLocked(boolean fromAnimator) {
|
||||
void destroyDeferredSurfaceLocked() {
|
||||
try {
|
||||
if (mPendingDestroySurface != null) {
|
||||
if (SHOW_TRANSACTIONS || SHOW_SURFACE_ALLOC) {
|
||||
@@ -828,7 +828,7 @@ class WindowStateAnimator {
|
||||
WindowManagerService.logSurface(mWin, "DESTROY PENDING", e);
|
||||
}
|
||||
mPendingDestroySurface.destroy();
|
||||
mAnimator.hideWallpapersLocked(mWin, fromAnimator);
|
||||
mAnimator.hideWallpapersLocked(mWin);
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
Slog.w(TAG, "Exception thrown when destroying Window "
|
||||
@@ -849,9 +849,9 @@ class WindowStateAnimator {
|
||||
|
||||
// Wallpapers are animated based on the "real" window they
|
||||
// are currently targeting.
|
||||
if (mIsWallpaper && mAnimator.mLowerWallpaperTarget == null
|
||||
&& mAnimator.mWallpaperTarget != null) {
|
||||
final WindowStateAnimator wallpaperAnimator = mAnimator.mWallpaperTarget.mWinAnimator;
|
||||
if (mIsWallpaper && mService.mLowerWallpaperTarget == null
|
||||
&& mService.mWallpaperTarget != null) {
|
||||
final WindowStateAnimator wallpaperAnimator = mService.mWallpaperTarget.mWinAnimator;
|
||||
if (wallpaperAnimator.mHasLocalTransformation &&
|
||||
wallpaperAnimator.mAnimation != null &&
|
||||
!wallpaperAnimator.mAnimation.getDetachWallpaper()) {
|
||||
@@ -860,7 +860,7 @@ class WindowStateAnimator {
|
||||
Slog.v(TAG, "WP target attached xform: " + attachedTransformation);
|
||||
}
|
||||
}
|
||||
final AppWindowAnimator wpAppAnimator = mAnimator.mWpAppAnimator;
|
||||
final AppWindowAnimator wpAppAnimator = mAnimator.getWallpaperAppAnimator();
|
||||
if (wpAppAnimator != null && wpAppAnimator.hasTransformation
|
||||
&& wpAppAnimator.animation != null
|
||||
&& !wpAppAnimator.animation.getDetachWallpaper()) {
|
||||
@@ -986,8 +986,7 @@ class WindowStateAnimator {
|
||||
+ " screen=" + (screenAnimation ?
|
||||
screenRotationAnimation.getEnterTransformation().getAlpha() : "null"));
|
||||
return;
|
||||
} else if (mIsWallpaper &&
|
||||
(mAnimator.mPendingActions & WindowAnimator.WALLPAPER_ACTION_PENDING) != 0) {
|
||||
} else if (mIsWallpaper && mService.mInnerFields.mWallpaperActionPending) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1220,7 +1219,7 @@ class WindowStateAnimator {
|
||||
hide();
|
||||
} else if (w.mAttachedHidden || !w.isReadyForDisplay()) {
|
||||
hide();
|
||||
mAnimator.hideWallpapersLocked(w, true);
|
||||
mAnimator.hideWallpapersLocked(w);
|
||||
|
||||
// If we are waiting for this window to handle an
|
||||
// orientation change, well, it is hidden, so
|
||||
@@ -1414,7 +1413,7 @@ class WindowStateAnimator {
|
||||
if (DEBUG_SURFACE_TRACE || DEBUG_ANIM)
|
||||
Slog.v(TAG, "performShowLocked: mDrawState=HAS_DRAWN in " + this);
|
||||
mDrawState = HAS_DRAWN;
|
||||
mService.updateLayoutToAnimationLocked();
|
||||
mService.scheduleAnimationLocked();
|
||||
|
||||
int i = mWin.mChildWindows.size();
|
||||
while (i > 0) {
|
||||
|
||||
Reference in New Issue
Block a user