am 67e6070f: Merge "Change method of tracking moving AppWindowTokens." into jb-dev
* commit '67e6070fa10bbd313c8ebe0de4e0440b688c569e': Change method of tracking moving AppWindowTokens.
This commit is contained in:
@@ -134,10 +134,11 @@ public class WindowAnimator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateWindowsAppsAndRotationAnimationsLocked() {
|
private void updateWindowsAppsAndRotationAnimationsLocked() {
|
||||||
|
final ArrayList<AppWindowToken> appTokens = mService.mAnimatingAppTokens;
|
||||||
int i;
|
int i;
|
||||||
final int NAT = mService.mAppTokens.size();
|
final int NAT = appTokens.size();
|
||||||
for (i=0; i<NAT; i++) {
|
for (i=0; i<NAT; i++) {
|
||||||
final AppWindowAnimator appAnimator = mService.mAppTokens.get(i).mAppAnimator;
|
final AppWindowAnimator appAnimator = appTokens.get(i).mAppAnimator;
|
||||||
final boolean wasAnimating = appAnimator.animation != null
|
final boolean wasAnimating = appAnimator.animation != null
|
||||||
&& appAnimator.animation != AppWindowAnimator.sDummyAnimation;
|
&& appAnimator.animation != AppWindowAnimator.sDummyAnimation;
|
||||||
if (appAnimator.stepAnimationLocked(mCurrentTime, mInnerDw, mInnerDh)) {
|
if (appAnimator.stepAnimationLocked(mCurrentTime, mInnerDw, mInnerDh)) {
|
||||||
@@ -401,9 +402,10 @@ public class WindowAnimator {
|
|||||||
private void testTokenMayBeDrawnLocked() {
|
private void testTokenMayBeDrawnLocked() {
|
||||||
// See if any windows have been drawn, so they (and others
|
// See if any windows have been drawn, so they (and others
|
||||||
// associated with them) can now be shown.
|
// associated with them) can now be shown.
|
||||||
final int NT = mService.mAppTokens.size();
|
final ArrayList<AppWindowToken> appTokens = mService.mAnimatingAppTokens;
|
||||||
|
final int NT = appTokens.size();
|
||||||
for (int i=0; i<NT; i++) {
|
for (int i=0; i<NT; i++) {
|
||||||
AppWindowToken wtoken = mService.mAppTokens.get(i);
|
AppWindowToken wtoken = appTokens.get(i);
|
||||||
if (wtoken.mAppAnimator.freezingScreen) {
|
if (wtoken.mAppAnimator.freezingScreen) {
|
||||||
int numInteresting = wtoken.numInterestingWindows;
|
int numInteresting = wtoken.numInterestingWindows;
|
||||||
if (numInteresting > 0 && wtoken.numDrawnWindows >= numInteresting) {
|
if (numInteresting > 0 && wtoken.numDrawnWindows >= numInteresting) {
|
||||||
|
|||||||
@@ -351,12 +351,19 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
final ArrayList<WindowToken> mExitingTokens = new ArrayList<WindowToken>();
|
final ArrayList<WindowToken> mExitingTokens = new ArrayList<WindowToken>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Z-ordered (bottom-most first) list of all application tokens, for
|
* List controlling the ordering of windows in different applications which must
|
||||||
* controlling the ordering of windows in different applications. This
|
* be kept in sync with ActivityManager.
|
||||||
* contains AppWindowToken objects.
|
|
||||||
*/
|
*/
|
||||||
final ArrayList<AppWindowToken> mAppTokens = new ArrayList<AppWindowToken>();
|
final ArrayList<AppWindowToken> mAppTokens = new ArrayList<AppWindowToken>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AppWindowTokens in the Z order they were in at the start of an animation. Between
|
||||||
|
* animations this list is maintained in the exact order of mAppTokens. If tokens
|
||||||
|
* are added to mAppTokens during an animation an attempt is made to insert them at the same
|
||||||
|
* logical location in this list. Note that this list is always in sync with mWindows.
|
||||||
|
*/
|
||||||
|
ArrayList<AppWindowToken> mAnimatingAppTokens = new ArrayList<AppWindowToken>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Application tokens that are in the process of exiting, but still
|
* Application tokens that are in the process of exiting, but still
|
||||||
* on screen for animations.
|
* on screen for animations.
|
||||||
@@ -529,8 +536,6 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
boolean mSkipAppTransitionAnimation = false;
|
boolean mSkipAppTransitionAnimation = false;
|
||||||
final ArrayList<AppWindowToken> mOpeningApps = new ArrayList<AppWindowToken>();
|
final ArrayList<AppWindowToken> mOpeningApps = new ArrayList<AppWindowToken>();
|
||||||
final ArrayList<AppWindowToken> mClosingApps = new ArrayList<AppWindowToken>();
|
final ArrayList<AppWindowToken> mClosingApps = new ArrayList<AppWindowToken>();
|
||||||
final ArrayList<AppWindowToken> mToTopApps = new ArrayList<AppWindowToken>();
|
|
||||||
final ArrayList<AppWindowToken> mToBottomApps = new ArrayList<AppWindowToken>();
|
|
||||||
|
|
||||||
Display mDisplay;
|
Display mDisplay;
|
||||||
|
|
||||||
@@ -1010,10 +1015,10 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
+ client.asBinder() + " (token=" + token + ")");
|
+ client.asBinder() + " (token=" + token + ")");
|
||||||
// Figure out where the window should go, based on the
|
// Figure out where the window should go, based on the
|
||||||
// order of applications.
|
// order of applications.
|
||||||
final int NA = mAppTokens.size();
|
final int NA = mAnimatingAppTokens.size();
|
||||||
WindowState pos = null;
|
WindowState pos = null;
|
||||||
for (i=NA-1; i>=0; i--) {
|
for (i=NA-1; i>=0; i--) {
|
||||||
AppWindowToken t = mAppTokens.get(i);
|
AppWindowToken t = mAnimatingAppTokens.get(i);
|
||||||
if (t == token) {
|
if (t == token) {
|
||||||
i--;
|
i--;
|
||||||
break;
|
break;
|
||||||
@@ -1046,7 +1051,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
// Continue looking down until we find the first
|
// Continue looking down until we find the first
|
||||||
// token that has windows.
|
// token that has windows.
|
||||||
while (i >= 0) {
|
while (i >= 0) {
|
||||||
AppWindowToken t = mAppTokens.get(i);
|
AppWindowToken t = mAnimatingAppTokens.get(i);
|
||||||
final int NW = t.windows.size();
|
final int NW = t.windows.size();
|
||||||
if (NW > 0) {
|
if (NW > 0) {
|
||||||
pos = t.windows.get(NW-1);
|
pos = t.windows.get(NW-1);
|
||||||
@@ -1167,6 +1172,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** TODO(cmautner): Is this the same as {@link WindowState#canReceiveKeys()} */
|
||||||
static boolean canBeImeTarget(WindowState w) {
|
static boolean canBeImeTarget(WindowState w) {
|
||||||
final int fl = w.mAttrs.flags
|
final int fl = w.mAttrs.flags
|
||||||
& (FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM);
|
& (FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM);
|
||||||
@@ -1875,7 +1881,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
}
|
}
|
||||||
|
|
||||||
wallpaper.mWinAnimator.mAnimLayer = wallpaper.mLayer + mWallpaperAnimLayerAdjustment;
|
wallpaper.mWinAnimator.mAnimLayer = wallpaper.mLayer + mWallpaperAnimLayerAdjustment;
|
||||||
if (DEBUG_LAYERS || DEBUG_WALLPAPER) Slog.v(TAG, "Wallpaper win "
|
if (DEBUG_LAYERS || DEBUG_WALLPAPER) Slog.v(TAG, "adjustWallpaper win "
|
||||||
+ wallpaper + " anim layer: " + wallpaper.mWinAnimator.mAnimLayer);
|
+ wallpaper + " anim layer: " + wallpaper.mWinAnimator.mAnimLayer);
|
||||||
|
|
||||||
// First, if this window is at the current index, then all
|
// First, if this window is at the current index, then all
|
||||||
@@ -1929,7 +1935,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
curWallpaperIndex--;
|
curWallpaperIndex--;
|
||||||
WindowState wallpaper = token.windows.get(curWallpaperIndex);
|
WindowState wallpaper = token.windows.get(curWallpaperIndex);
|
||||||
wallpaper.mWinAnimator.mAnimLayer = wallpaper.mLayer + adj;
|
wallpaper.mWinAnimator.mAnimLayer = wallpaper.mLayer + adj;
|
||||||
if (DEBUG_LAYERS || DEBUG_WALLPAPER) Slog.v(TAG, "Wallpaper win "
|
if (DEBUG_LAYERS || DEBUG_WALLPAPER) Slog.v(TAG, "setWallpaper win "
|
||||||
+ wallpaper + " anim layer: " + wallpaper.mWinAnimator.mAnimLayer);
|
+ wallpaper + " anim layer: " + wallpaper.mWinAnimator.mAnimLayer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3487,6 +3493,25 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
Binder.restoreCallingIdentity(origId);
|
Binder.restoreCallingIdentity(origId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find the location to insert a new AppWindowToken into the window-ordered app token list.
|
||||||
|
* Note that mAppTokens.size() == mAnimatingAppTokens.size() + 1.
|
||||||
|
* @param addPos The location the token was inserted into in mAppTokens.
|
||||||
|
* @param wtoken The token to insert.
|
||||||
|
*/
|
||||||
|
private void addAppTokenToAnimating(final int addPos, final AppWindowToken wtoken) {
|
||||||
|
if (addPos == 0 || addPos == mAnimatingAppTokens.size()) {
|
||||||
|
// It was inserted into the beginning or end of mAppTokens. Honor that.
|
||||||
|
mAnimatingAppTokens.add(addPos, wtoken);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Find the item immediately above the mAppTokens insertion point and put the token
|
||||||
|
// immediately below that one in mAnimatingAppTokens.
|
||||||
|
final AppWindowToken aboveAnchor = mAppTokens.get(addPos + 1);
|
||||||
|
mAnimatingAppTokens.add(mAnimatingAppTokens.indexOf(aboveAnchor), wtoken);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void addAppToken(int addPos, IApplicationToken token,
|
public void addAppToken(int addPos, IApplicationToken token,
|
||||||
int groupId, int requestedOrientation, boolean fullscreen) {
|
int groupId, int requestedOrientation, boolean fullscreen) {
|
||||||
if (!checkCallingPermission(android.Manifest.permission.MANAGE_APP_TOKENS,
|
if (!checkCallingPermission(android.Manifest.permission.MANAGE_APP_TOKENS,
|
||||||
@@ -3521,6 +3546,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
wtoken.requestedOrientation = requestedOrientation;
|
wtoken.requestedOrientation = requestedOrientation;
|
||||||
if (DEBUG_TOKEN_MOVEMENT || DEBUG_ADD_REMOVE) Slog.v(TAG, "addAppToken: " + wtoken);
|
if (DEBUG_TOKEN_MOVEMENT || DEBUG_ADD_REMOVE) Slog.v(TAG, "addAppToken: " + wtoken);
|
||||||
mAppTokens.add(addPos, wtoken);
|
mAppTokens.add(addPos, wtoken);
|
||||||
|
addAppTokenToAnimating(addPos, wtoken);
|
||||||
mTokenMap.put(token.asBinder(), wtoken);
|
mTokenMap.put(token.asBinder(), wtoken);
|
||||||
|
|
||||||
// Application tokens start out hidden.
|
// Application tokens start out hidden.
|
||||||
@@ -3838,7 +3864,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
if (DEBUG_APP_TRANSITIONS) Slog.v(
|
if (DEBUG_APP_TRANSITIONS) Slog.v(
|
||||||
TAG, "Prepare app transition: transit=" + transit
|
TAG, "Prepare app transition: transit=" + transit
|
||||||
+ " mNextAppTransition=" + mNextAppTransition
|
+ " mNextAppTransition=" + mNextAppTransition
|
||||||
+ "\nCallers=" + Debug.getCallers(3));
|
+ " Callers=" + Debug.getCallers(3));
|
||||||
if (okToDisplay()) {
|
if (okToDisplay()) {
|
||||||
if (mNextAppTransition == WindowManagerPolicy.TRANSIT_UNSET
|
if (mNextAppTransition == WindowManagerPolicy.TRANSIT_UNSET
|
||||||
|| mNextAppTransition == WindowManagerPolicy.TRANSIT_NONE) {
|
|| mNextAppTransition == WindowManagerPolicy.TRANSIT_NONE) {
|
||||||
@@ -4470,6 +4496,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
if (DEBUG_ADD_REMOVE || DEBUG_TOKEN_MOVEMENT) Slog.v(TAG,
|
if (DEBUG_ADD_REMOVE || DEBUG_TOKEN_MOVEMENT) Slog.v(TAG,
|
||||||
"removeAppToken: " + wtoken);
|
"removeAppToken: " + wtoken);
|
||||||
mAppTokens.remove(wtoken);
|
mAppTokens.remove(wtoken);
|
||||||
|
mAnimatingAppTokens.remove(wtoken);
|
||||||
wtoken.removed = true;
|
wtoken.removed = true;
|
||||||
if (wtoken.startingData != null) {
|
if (wtoken.startingData != null) {
|
||||||
startingToken = wtoken;
|
startingToken = wtoken;
|
||||||
@@ -4501,11 +4528,13 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
|
|
||||||
private boolean tmpRemoveAppWindowsLocked(WindowToken token) {
|
private boolean tmpRemoveAppWindowsLocked(WindowToken token) {
|
||||||
final int NW = token.windows.size();
|
final int NW = token.windows.size();
|
||||||
|
if (NW > 0) {
|
||||||
|
mWindowsChanged = true;
|
||||||
|
}
|
||||||
for (int i=0; i<NW; i++) {
|
for (int i=0; i<NW; i++) {
|
||||||
WindowState win = token.windows.get(i);
|
WindowState win = token.windows.get(i);
|
||||||
if (DEBUG_WINDOW_MOVEMENT) Slog.v(TAG, "Tmp removing app window " + win);
|
if (DEBUG_WINDOW_MOVEMENT) Slog.v(TAG, "Tmp removing app window " + win);
|
||||||
mWindows.remove(win);
|
mWindows.remove(win);
|
||||||
mWindowsChanged = true;
|
|
||||||
int j = win.mChildWindows.size();
|
int j = win.mChildWindows.size();
|
||||||
while (j > 0) {
|
while (j > 0) {
|
||||||
j--;
|
j--;
|
||||||
@@ -4524,6 +4553,12 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void dumpAnimatingAppTokensLocked() {
|
||||||
|
for (int i=mAnimatingAppTokens.size()-1; i>=0; i--) {
|
||||||
|
Slog.v(TAG, " #" + i + ": " + mAnimatingAppTokens.get(i).token);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void dumpWindowsLocked() {
|
void dumpWindowsLocked() {
|
||||||
for (int i=mWindows.size()-1; i>=0; i--) {
|
for (int i=mWindows.size()-1; i>=0; i--) {
|
||||||
Slog.v(TAG, " #" + i + ": " + mWindows.get(i));
|
Slog.v(TAG, " #" + i + ": " + mWindows.get(i));
|
||||||
@@ -4533,7 +4568,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
private int findWindowOffsetLocked(int tokenPos) {
|
private int findWindowOffsetLocked(int tokenPos) {
|
||||||
final int NW = mWindows.size();
|
final int NW = mWindows.size();
|
||||||
|
|
||||||
if (tokenPos >= mAppTokens.size()) {
|
if (tokenPos >= mAnimatingAppTokens.size()) {
|
||||||
int i = NW;
|
int i = NW;
|
||||||
while (i > 0) {
|
while (i > 0) {
|
||||||
i--;
|
i--;
|
||||||
@@ -4547,7 +4582,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
while (tokenPos > 0) {
|
while (tokenPos > 0) {
|
||||||
// Find the first app token below the new position that has
|
// Find the first app token below the new position that has
|
||||||
// a window displayed.
|
// a window displayed.
|
||||||
final AppWindowToken wtoken = mAppTokens.get(tokenPos-1);
|
final AppWindowToken wtoken = mAnimatingAppTokens.get(tokenPos-1);
|
||||||
if (DEBUG_REORDER) Slog.v(TAG, "Looking for lower windows @ "
|
if (DEBUG_REORDER) Slog.v(TAG, "Looking for lower windows @ "
|
||||||
+ tokenPos + " -- " + wtoken.token);
|
+ tokenPos + " -- " + wtoken.token);
|
||||||
if (wtoken.sendingToBottom) {
|
if (wtoken.sendingToBottom) {
|
||||||
@@ -4635,9 +4670,16 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
if (DEBUG_REORDER) Slog.v(TAG, "Initial app tokens:");
|
if (DEBUG_REORDER) Slog.v(TAG, "Initial app tokens:");
|
||||||
if (DEBUG_REORDER) dumpAppTokensLocked();
|
if (DEBUG_REORDER) dumpAppTokensLocked();
|
||||||
final AppWindowToken wtoken = findAppWindowToken(token);
|
final AppWindowToken wtoken = findAppWindowToken(token);
|
||||||
|
final int oldIndex = mAppTokens.indexOf(wtoken);
|
||||||
if (DEBUG_TOKEN_MOVEMENT || DEBUG_REORDER) Slog.v(TAG,
|
if (DEBUG_TOKEN_MOVEMENT || DEBUG_REORDER) Slog.v(TAG,
|
||||||
"Start moving token " + wtoken + " initially at "
|
"Start moving token " + wtoken + " initially at "
|
||||||
+ mAppTokens.indexOf(wtoken));
|
+ oldIndex);
|
||||||
|
if (oldIndex > index && mNextAppTransition != WindowManagerPolicy.TRANSIT_UNSET
|
||||||
|
&& !mAppTransitionRunning) {
|
||||||
|
// animation towards back has not started, copy old list for duration of animation.
|
||||||
|
mAnimatingAppTokens.clear();
|
||||||
|
mAnimatingAppTokens.addAll(mAppTokens);
|
||||||
|
}
|
||||||
if (wtoken == null || !mAppTokens.remove(wtoken)) {
|
if (wtoken == null || !mAppTokens.remove(wtoken)) {
|
||||||
Slog.w(TAG, "Attempting to reorder token that doesn't exist: "
|
Slog.w(TAG, "Attempting to reorder token that doesn't exist: "
|
||||||
+ token + " (" + wtoken + ")");
|
+ token + " (" + wtoken + ")");
|
||||||
@@ -4647,24 +4689,30 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
if (DEBUG_REORDER) Slog.v(TAG, "Moved " + token + " to " + index + ":");
|
if (DEBUG_REORDER) Slog.v(TAG, "Moved " + token + " to " + index + ":");
|
||||||
else if (DEBUG_TOKEN_MOVEMENT) Slog.v(TAG, "Moved " + token + " to " + index);
|
else if (DEBUG_TOKEN_MOVEMENT) Slog.v(TAG, "Moved " + token + " to " + index);
|
||||||
if (DEBUG_REORDER) dumpAppTokensLocked();
|
if (DEBUG_REORDER) dumpAppTokensLocked();
|
||||||
|
if (mNextAppTransition == WindowManagerPolicy.TRANSIT_UNSET && !mAppTransitionRunning) {
|
||||||
|
// Not animating, bring animating app list in line with mAppTokens.
|
||||||
|
mAnimatingAppTokens.clear();
|
||||||
|
mAnimatingAppTokens.addAll(mAppTokens);
|
||||||
|
|
||||||
final long origId = Binder.clearCallingIdentity();
|
// Bring window ordering, window focus and input window in line with new app token
|
||||||
if (DEBUG_REORDER) Slog.v(TAG, "Removing windows in " + token + ":");
|
final long origId = Binder.clearCallingIdentity();
|
||||||
if (DEBUG_REORDER) dumpWindowsLocked();
|
if (DEBUG_REORDER) Slog.v(TAG, "Removing windows in " + token + ":");
|
||||||
if (tmpRemoveAppWindowsLocked(wtoken)) {
|
|
||||||
if (DEBUG_REORDER) Slog.v(TAG, "Adding windows back in:");
|
|
||||||
if (DEBUG_REORDER) dumpWindowsLocked();
|
if (DEBUG_REORDER) dumpWindowsLocked();
|
||||||
reAddAppWindowsLocked(findWindowOffsetLocked(index), wtoken);
|
if (tmpRemoveAppWindowsLocked(wtoken)) {
|
||||||
if (DEBUG_REORDER) Slog.v(TAG, "Final window list:");
|
if (DEBUG_REORDER) Slog.v(TAG, "Adding windows back in:");
|
||||||
if (DEBUG_REORDER) dumpWindowsLocked();
|
if (DEBUG_REORDER) dumpWindowsLocked();
|
||||||
updateFocusedWindowLocked(UPDATE_FOCUS_WILL_PLACE_SURFACES,
|
reAddAppWindowsLocked(findWindowOffsetLocked(index), wtoken);
|
||||||
false /*updateInputWindows*/);
|
if (DEBUG_REORDER) Slog.v(TAG, "Final window list:");
|
||||||
mLayoutNeeded = true;
|
if (DEBUG_REORDER) dumpWindowsLocked();
|
||||||
mInputMonitor.setUpdateInputWindowsNeededLw();
|
updateFocusedWindowLocked(UPDATE_FOCUS_WILL_PLACE_SURFACES,
|
||||||
performLayoutAndPlaceSurfacesLocked();
|
false /*updateInputWindows*/);
|
||||||
mInputMonitor.updateInputWindowsLw(false /*force*/);
|
mLayoutNeeded = true;
|
||||||
|
mInputMonitor.setUpdateInputWindowsNeededLw();
|
||||||
|
performLayoutAndPlaceSurfacesLocked();
|
||||||
|
mInputMonitor.updateInputWindowsLw(false /*force*/);
|
||||||
|
}
|
||||||
|
Binder.restoreCallingIdentity(origId);
|
||||||
}
|
}
|
||||||
Binder.restoreCallingIdentity(origId);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4705,7 +4753,9 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
assignLayersLocked();
|
assignLayersLocked();
|
||||||
}
|
}
|
||||||
mLayoutNeeded = true;
|
mLayoutNeeded = true;
|
||||||
performLayoutAndPlaceSurfacesLocked();
|
if (!mInLayout) {
|
||||||
|
performLayoutAndPlaceSurfacesLocked();
|
||||||
|
}
|
||||||
mInputMonitor.updateInputWindowsLw(false /*force*/);
|
mInputMonitor.updateInputWindowsLw(false /*force*/);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4761,22 +4811,22 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
"Adding next to top: " + wt);
|
"Adding next to top: " + wt);
|
||||||
mAppTokens.add(wt);
|
mAppTokens.add(wt);
|
||||||
if (mNextAppTransition != WindowManagerPolicy.TRANSIT_UNSET) {
|
if (mNextAppTransition != WindowManagerPolicy.TRANSIT_UNSET) {
|
||||||
mToTopApps.remove(wt);
|
|
||||||
mToBottomApps.remove(wt);
|
|
||||||
mToTopApps.add(wt);
|
|
||||||
wt.sendingToBottom = false;
|
wt.sendingToBottom = false;
|
||||||
wt.sendingToTop = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mNextAppTransition == WindowManagerPolicy.TRANSIT_UNSET) {
|
if (mNextAppTransition == WindowManagerPolicy.TRANSIT_UNSET
|
||||||
|
&& !mAppTransitionRunning) {
|
||||||
|
mAnimatingAppTokens.clear();
|
||||||
|
mAnimatingAppTokens.addAll(mAppTokens);
|
||||||
moveAppWindowsLocked(tokens, mAppTokens.size());
|
moveAppWindowsLocked(tokens, mAppTokens.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Binder.restoreCallingIdentity(origId);
|
Binder.restoreCallingIdentity(origId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void moveAppTokensToBottom(List<IBinder> tokens) {
|
public void moveAppTokensToBottom(List<IBinder> tokens) {
|
||||||
if (!checkCallingPermission(android.Manifest.permission.MANAGE_APP_TOKENS,
|
if (!checkCallingPermission(android.Manifest.permission.MANAGE_APP_TOKENS,
|
||||||
"moveAppTokensToBottom()")) {
|
"moveAppTokensToBottom()")) {
|
||||||
@@ -4785,8 +4835,14 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
|
|
||||||
final long origId = Binder.clearCallingIdentity();
|
final long origId = Binder.clearCallingIdentity();
|
||||||
synchronized(mWindowMap) {
|
synchronized(mWindowMap) {
|
||||||
removeAppTokensLocked(tokens);
|
|
||||||
final int N = tokens.size();
|
final int N = tokens.size();
|
||||||
|
if (N > 0 && mNextAppTransition != WindowManagerPolicy.TRANSIT_UNSET
|
||||||
|
&& !mAppTransitionRunning) {
|
||||||
|
// animating towards back, hang onto old list for duration of animation.
|
||||||
|
mAnimatingAppTokens.clear();
|
||||||
|
mAnimatingAppTokens.addAll(mAppTokens);
|
||||||
|
}
|
||||||
|
removeAppTokensLocked(tokens);
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
for (int i=0; i<N; i++) {
|
for (int i=0; i<N; i++) {
|
||||||
AppWindowToken wt = findAppWindowToken(tokens.get(i));
|
AppWindowToken wt = findAppWindowToken(tokens.get(i));
|
||||||
@@ -4795,17 +4851,16 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
"Adding next to bottom: " + wt + " at " + pos);
|
"Adding next to bottom: " + wt + " at " + pos);
|
||||||
mAppTokens.add(pos, wt);
|
mAppTokens.add(pos, wt);
|
||||||
if (mNextAppTransition != WindowManagerPolicy.TRANSIT_UNSET) {
|
if (mNextAppTransition != WindowManagerPolicy.TRANSIT_UNSET) {
|
||||||
mToTopApps.remove(wt);
|
|
||||||
mToBottomApps.remove(wt);
|
|
||||||
mToBottomApps.add(i, wt);
|
|
||||||
wt.sendingToTop = false;
|
|
||||||
wt.sendingToBottom = true;
|
wt.sendingToBottom = true;
|
||||||
}
|
}
|
||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mNextAppTransition == WindowManagerPolicy.TRANSIT_UNSET) {
|
if (mNextAppTransition == WindowManagerPolicy.TRANSIT_UNSET
|
||||||
|
&& !mAppTransitionRunning) {
|
||||||
|
mAnimatingAppTokens.clear();
|
||||||
|
mAnimatingAppTokens.addAll(mAppTokens);
|
||||||
moveAppWindowsLocked(tokens, 0);
|
moveAppWindowsLocked(tokens, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7013,6 +7068,8 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
"*** APP TRANSITION TIMEOUT");
|
"*** APP TRANSITION TIMEOUT");
|
||||||
mAppTransitionReady = true;
|
mAppTransitionReady = true;
|
||||||
mAppTransitionTimeout = true;
|
mAppTransitionTimeout = true;
|
||||||
|
mAnimatingAppTokens.clear();
|
||||||
|
mAnimatingAppTokens.addAll(mAppTokens);
|
||||||
performLayoutAndPlaceSurfacesLocked();
|
performLayoutAndPlaceSurfacesLocked();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7536,9 +7593,9 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
}
|
}
|
||||||
|
|
||||||
// And add in the still active app tokens in Z order.
|
// And add in the still active app tokens in Z order.
|
||||||
NT = mAppTokens.size();
|
NT = mAnimatingAppTokens.size();
|
||||||
for (int j=0; j<NT; j++) {
|
for (int j=0; j<NT; j++) {
|
||||||
i = reAddAppWindowsLocked(i, mAppTokens.get(j));
|
i = reAddAppWindowsLocked(i, mAnimatingAppTokens.get(j));
|
||||||
}
|
}
|
||||||
|
|
||||||
i -= lastWallpaper;
|
i -= lastWallpaper;
|
||||||
@@ -7558,7 +7615,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Slog.w(TAG, "Current app token list:");
|
Slog.w(TAG, "Current app token list:");
|
||||||
dumpAppTokensLocked();
|
dumpAnimatingAppTokensLocked();
|
||||||
Slog.w(TAG, "Final window list:");
|
Slog.w(TAG, "Final window list:");
|
||||||
dumpWindowsLocked();
|
dumpWindowsLocked();
|
||||||
}
|
}
|
||||||
@@ -7627,7 +7684,8 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
throw new RuntimeException("Recursive call!");
|
throw new RuntimeException("Recursive call!");
|
||||||
}
|
}
|
||||||
Slog.w(TAG, "performLayoutAndPlaceSurfacesLocked called while in layout");
|
Slog.w(TAG, "performLayoutAndPlaceSurfacesLocked called while in layout. Callers="
|
||||||
|
+ Debug.getCallers(3));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7916,22 +7974,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
|
|
||||||
mH.removeMessages(H.APP_TRANSITION_TIMEOUT);
|
mH.removeMessages(H.APP_TRANSITION_TIMEOUT);
|
||||||
|
|
||||||
// If there are applications waiting to come to the
|
rebuildAppWindowListLocked();
|
||||||
// top of the stack, now is the time to move their windows.
|
|
||||||
// (Note that we don't do apps going to the bottom
|
|
||||||
// here -- we want to keep their windows in the old
|
|
||||||
// Z-order until the animation completes.)
|
|
||||||
if (mToTopApps.size() > 0) {
|
|
||||||
NN = mAppTokens.size();
|
|
||||||
for (i=0; i<NN; i++) {
|
|
||||||
AppWindowToken wtoken = mAppTokens.get(i);
|
|
||||||
if (wtoken.sendingToTop) {
|
|
||||||
wtoken.sendingToTop = false;
|
|
||||||
moveAppWindowsLocked(wtoken, NN, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mToTopApps.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
// if wallpaper is animating in or out set oldWallpaper to null else to wallpaper
|
// if wallpaper is animating in or out set oldWallpaper to null else to wallpaper
|
||||||
WindowState oldWallpaper =
|
WindowState oldWallpaper =
|
||||||
@@ -8158,13 +8201,14 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
int changes = 0;
|
int changes = 0;
|
||||||
|
|
||||||
mAppTransitionRunning = false;
|
mAppTransitionRunning = false;
|
||||||
// Clear information about apps that were moving.
|
// Restore window app tokens to the ActivityManager views
|
||||||
mToBottomApps.clear();
|
mAnimatingAppTokens.clear();
|
||||||
|
mAnimatingAppTokens.addAll(mAppTokens);
|
||||||
rebuildAppWindowListLocked();
|
rebuildAppWindowListLocked();
|
||||||
|
|
||||||
changes |= PhoneWindowManager.FINISH_LAYOUT_REDO_LAYOUT;
|
changes |= PhoneWindowManager.FINISH_LAYOUT_REDO_LAYOUT;
|
||||||
mInnerFields.mAdjResult |= ADJUST_WALLPAPER_LAYERS_CHANGED;
|
mInnerFields.mAdjResult |= ADJUST_WALLPAPER_LAYERS_CHANGED;
|
||||||
moveInputMethodWindowsIfNeededLocked(false);
|
moveInputMethodWindowsIfNeededLocked(true);
|
||||||
mInnerFields.mWallpaperMayChange = true;
|
mInnerFields.mWallpaperMayChange = true;
|
||||||
// Since the window list has been rebuilt, focus might
|
// Since the window list has been rebuilt, focus might
|
||||||
// have to be recomputed since the actual order of windows
|
// have to be recomputed since the actual order of windows
|
||||||
@@ -8245,7 +8289,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
// to go through the process of getting informed
|
// to go through the process of getting informed
|
||||||
// by the application when it has finished drawing.
|
// by the application when it has finished drawing.
|
||||||
if (w.mOrientationChanging) {
|
if (w.mOrientationChanging) {
|
||||||
if (DEBUG_ANIM || DEBUG_ORIENTATION) Slog.v(TAG,
|
if (DEBUG_SURFACE_TRACE || DEBUG_ANIM || DEBUG_ORIENTATION) Slog.v(TAG,
|
||||||
"Orientation start waiting for draw mDrawState=DRAW_PENDING in "
|
"Orientation start waiting for draw mDrawState=DRAW_PENDING in "
|
||||||
+ w + ", surface " + winAnimator.mSurface);
|
+ w + ", surface " + winAnimator.mSurface);
|
||||||
winAnimator.mDrawState = WindowStateAnimator.DRAW_PENDING;
|
winAnimator.mDrawState = WindowStateAnimator.DRAW_PENDING;
|
||||||
@@ -8686,25 +8730,11 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
if (DEBUG_ADD_REMOVE || DEBUG_TOKEN_MOVEMENT) Slog.v(TAG,
|
if (DEBUG_ADD_REMOVE || DEBUG_TOKEN_MOVEMENT) Slog.v(TAG,
|
||||||
"performLayout: App token exiting now removed" + token);
|
"performLayout: App token exiting now removed" + token);
|
||||||
mAppTokens.remove(token);
|
mAppTokens.remove(token);
|
||||||
|
mAnimatingAppTokens.remove(token);
|
||||||
mExitingAppTokens.remove(i);
|
mExitingAppTokens.remove(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mAnimator.mAnimating && mAppTransitionRunning) {
|
|
||||||
// We have finished the animation of an app transition. To do
|
|
||||||
// this, we have delayed a lot of operations like showing and
|
|
||||||
// hiding apps, moving apps in Z-order, etc. The app token list
|
|
||||||
// reflects the correct Z-order, but the window list may now
|
|
||||||
// be out of sync with it. So here we will just rebuild the
|
|
||||||
// entire app window list. Fun!
|
|
||||||
mAppTransitionRunning = false;
|
|
||||||
mLayoutNeeded = true;
|
|
||||||
rebuildAppWindowListLocked();
|
|
||||||
assignLayersLocked();
|
|
||||||
// Clear information about apps that were moving.
|
|
||||||
mToBottomApps.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!mAnimator.mAnimating && mRelayoutWhileAnimating.size() > 0) {
|
if (!mAnimator.mAnimating && mRelayoutWhileAnimating.size() > 0) {
|
||||||
for (int j=mRelayoutWhileAnimating.size()-1; j>=0; j--) {
|
for (int j=mRelayoutWhileAnimating.size()-1; j>=0; j--) {
|
||||||
try {
|
try {
|
||||||
@@ -9033,7 +9063,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
AppWindowToken thisApp = win.mAppToken;
|
AppWindowToken thisApp = win.mAppToken;
|
||||||
|
|
||||||
// If this window's application has been removed, just skip it.
|
// If this window's application has been removed, just skip it.
|
||||||
if (thisApp != null && thisApp.removed) {
|
if (thisApp != null && (thisApp.removed || thisApp.sendingToBottom)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -9436,6 +9466,21 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (mAppTransitionRunning && mAnimatingAppTokens.size() > 0) {
|
||||||
|
pw.println();
|
||||||
|
pw.println(" Application tokens during animation:");
|
||||||
|
for (int i=mAnimatingAppTokens.size()-1; i>=0; i--) {
|
||||||
|
WindowToken token = mAnimatingAppTokens.get(i);
|
||||||
|
pw.print(" App moving to bottom #"); pw.print(i);
|
||||||
|
pw.print(' '); pw.print(token);
|
||||||
|
if (dumpAll) {
|
||||||
|
pw.println(':');
|
||||||
|
token.dump(pw, " ");
|
||||||
|
} else {
|
||||||
|
pw.println();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
pw.println();
|
pw.println();
|
||||||
if (mOpeningApps.size() > 0) {
|
if (mOpeningApps.size() > 0) {
|
||||||
pw.print(" mOpeningApps="); pw.println(mOpeningApps);
|
pw.print(" mOpeningApps="); pw.println(mOpeningApps);
|
||||||
@@ -9443,12 +9488,6 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
if (mClosingApps.size() > 0) {
|
if (mClosingApps.size() > 0) {
|
||||||
pw.print(" mClosingApps="); pw.println(mClosingApps);
|
pw.print(" mClosingApps="); pw.println(mClosingApps);
|
||||||
}
|
}
|
||||||
if (mToTopApps.size() > 0) {
|
|
||||||
pw.print(" mToTopApps="); pw.println(mToTopApps);
|
|
||||||
}
|
|
||||||
if (mToBottomApps.size() > 0) {
|
|
||||||
pw.print(" mToBottomApps="); pw.println(mToBottomApps);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void dumpSessionsLocked(FileDescriptor fd, PrintWriter pw, boolean dumpAll) {
|
void dumpSessionsLocked(FileDescriptor fd, PrintWriter pw, boolean dumpAll) {
|
||||||
|
|||||||
@@ -841,7 +841,9 @@ final class WindowState implements WindowManagerPolicy.WindowState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns true if this window desires key events. */
|
/** Returns true if this window desires key events.
|
||||||
|
* TODO(cmautner): Is this the same as {@link WindowManagerService#canBeImeTarget}
|
||||||
|
*/
|
||||||
public final boolean canReceiveKeys() {
|
public final boolean canReceiveKeys() {
|
||||||
return isVisibleOrAdding()
|
return isVisibleOrAdding()
|
||||||
&& (mViewVisibility == View.VISIBLE)
|
&& (mViewVisibility == View.VISIBLE)
|
||||||
|
|||||||
@@ -403,8 +403,8 @@ class WindowStateAnimator {
|
|||||||
|
|
||||||
boolean finishDrawingLocked() {
|
boolean finishDrawingLocked() {
|
||||||
if (mDrawState == DRAW_PENDING) {
|
if (mDrawState == DRAW_PENDING) {
|
||||||
if (DEBUG_ANIM || SHOW_TRANSACTIONS || DEBUG_ORIENTATION) Slog.v(
|
if (DEBUG_SURFACE_TRACE || DEBUG_ANIM || SHOW_TRANSACTIONS || DEBUG_ORIENTATION)
|
||||||
TAG, "finishDrawingLocked: mDrawState=COMMIT_DRAW_PENDING " + this + " in "
|
Slog.v(TAG, "finishDrawingLocked: mDrawState=COMMIT_DRAW_PENDING " + this + " in "
|
||||||
+ mSurface);
|
+ mSurface);
|
||||||
mDrawState = COMMIT_DRAW_PENDING;
|
mDrawState = COMMIT_DRAW_PENDING;
|
||||||
return true;
|
return true;
|
||||||
@@ -417,7 +417,7 @@ class WindowStateAnimator {
|
|||||||
if (mDrawState != COMMIT_DRAW_PENDING) {
|
if (mDrawState != COMMIT_DRAW_PENDING) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (DEBUG_ANIM)
|
if (DEBUG_SURFACE_TRACE || DEBUG_ANIM)
|
||||||
Slog.i(TAG, "commitFinishDrawingLocked: mDrawState=READY_TO_SHOW " + mSurface);
|
Slog.i(TAG, "commitFinishDrawingLocked: mDrawState=READY_TO_SHOW " + mSurface);
|
||||||
mDrawState = READY_TO_SHOW;
|
mDrawState = READY_TO_SHOW;
|
||||||
final boolean starting = mWin.mAttrs.type == TYPE_APPLICATION_STARTING;
|
final boolean starting = mWin.mAttrs.type == TYPE_APPLICATION_STARTING;
|
||||||
@@ -504,7 +504,9 @@ class WindowStateAnimator {
|
|||||||
@Override
|
@Override
|
||||||
public void setWindowCrop(Rect crop) {
|
public void setWindowCrop(Rect crop) {
|
||||||
super.setWindowCrop(crop);
|
super.setWindowCrop(crop);
|
||||||
mWindowCrop.set(crop);
|
if (crop != null) {
|
||||||
|
mWindowCrop.set(crop);
|
||||||
|
}
|
||||||
Slog.v(SURFACE_TAG, "setWindowCrop: " + this + ". Called by "
|
Slog.v(SURFACE_TAG, "setWindowCrop: " + this + ". Called by "
|
||||||
+ Debug.getCallers(3));
|
+ Debug.getCallers(3));
|
||||||
}
|
}
|
||||||
@@ -1232,7 +1234,8 @@ class WindowStateAnimator {
|
|||||||
|
|
||||||
// Force the show in the next prepareSurfaceLocked() call.
|
// Force the show in the next prepareSurfaceLocked() call.
|
||||||
mLastAlpha = -1;
|
mLastAlpha = -1;
|
||||||
if (DEBUG_ANIM) Slog.v(TAG, "performShowLocked: mDrawState=HAS_DRAWN");
|
if (DEBUG_SURFACE_TRACE || DEBUG_ANIM)
|
||||||
|
Slog.v(TAG, "performShowLocked: mDrawState=HAS_DRAWN in " + this);
|
||||||
mDrawState = HAS_DRAWN;
|
mDrawState = HAS_DRAWN;
|
||||||
mService.scheduleAnimationLocked();
|
mService.scheduleAnimationLocked();
|
||||||
|
|
||||||
|
|||||||
@@ -71,10 +71,6 @@ class WindowToken {
|
|||||||
// windows will be put to the bottom of the list.
|
// windows will be put to the bottom of the list.
|
||||||
boolean sendingToBottom;
|
boolean sendingToBottom;
|
||||||
|
|
||||||
// Set to true when this token is in a pending transaction where its
|
|
||||||
// windows will be put to the top of the list.
|
|
||||||
boolean sendingToTop;
|
|
||||||
|
|
||||||
WindowToken(WindowManagerService _service, IBinder _token, int type, boolean _explicit) {
|
WindowToken(WindowManagerService _service, IBinder _token, int type, boolean _explicit) {
|
||||||
service = _service;
|
service = _service;
|
||||||
token = _token;
|
token = _token;
|
||||||
@@ -88,11 +84,10 @@ class WindowToken {
|
|||||||
pw.print(prefix); pw.print("windowType="); pw.print(windowType);
|
pw.print(prefix); pw.print("windowType="); pw.print(windowType);
|
||||||
pw.print(" hidden="); pw.print(hidden);
|
pw.print(" hidden="); pw.print(hidden);
|
||||||
pw.print(" hasVisible="); pw.println(hasVisible);
|
pw.print(" hasVisible="); pw.println(hasVisible);
|
||||||
if (waitingToShow || waitingToHide || sendingToBottom || sendingToTop) {
|
if (waitingToShow || waitingToHide || sendingToBottom) {
|
||||||
pw.print(prefix); pw.print("waitingToShow="); pw.print(waitingToShow);
|
pw.print(prefix); pw.print("waitingToShow="); pw.print(waitingToShow);
|
||||||
pw.print(" waitingToHide="); pw.print(waitingToHide);
|
pw.print(" waitingToHide="); pw.print(waitingToHide);
|
||||||
pw.print(" sendingToBottom="); pw.print(sendingToBottom);
|
pw.print(" sendingToBottom="); pw.print(sendingToBottom);
|
||||||
pw.print(" sendingToTop="); pw.println(sendingToTop);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user