Loading services/java/com/android/server/am/ActivityStack.java +15 −13 Original line number Original line Diff line number Diff line Loading @@ -2120,6 +2120,7 @@ final class ActivityStack { int dstPos = 0; int dstPos = 0; ThumbnailHolder curThumbHolder = target.thumbHolder; ThumbnailHolder curThumbHolder = target.thumbHolder; boolean gotOptions = !canMoveOptions; boolean gotOptions = !canMoveOptions; final int taskId = target.task.taskId; for (int srcPos=targetI; srcPos<=replyChainEnd; srcPos++) { for (int srcPos=targetI; srcPos<=replyChainEnd; srcPos++) { p = mHistory.get(srcPos); p = mHistory.get(srcPos); if (p.finishing) { if (p.finishing) { Loading @@ -2145,14 +2146,14 @@ final class ActivityStack { mHistory.remove(srcPos); mHistory.remove(srcPos); mHistory.add(dstPos, p); mHistory.add(dstPos, p); mService.mWindowManager.moveAppToken(dstPos, p.appToken); mService.mWindowManager.moveAppToken(dstPos, p.appToken); mService.mWindowManager.setAppGroupId(p.appToken, p.task.taskId); mService.mWindowManager.setAppGroupId(p.appToken, taskId); dstPos++; dstPos++; i++; } mService.mWindowManager.moveTaskToBottom(taskId); if (VALIDATE_TOKENS) { if (VALIDATE_TOKENS) { validateAppTokensLocked(); validateAppTokensLocked(); } } i++; } mService.mWindowManager.moveTaskToBottom(target.task.taskId); if (taskTop == p) { if (taskTop == p) { taskTop = below; taskTop = below; } } Loading Loading @@ -2270,6 +2271,7 @@ final class ActivityStack { if (replyChainEnd < 0) { if (replyChainEnd < 0) { replyChainEnd = targetI; replyChainEnd = targetI; } } final int taskId = task.taskId; if (DEBUG_TASKS) Slog.v(TAG, "Reparenting task at index " if (DEBUG_TASKS) Slog.v(TAG, "Reparenting task at index " + targetI + " to " + replyChainEnd); + targetI + " to " + replyChainEnd); for (int srcPos=replyChainEnd; srcPos>=targetI; srcPos--) { for (int srcPos=replyChainEnd; srcPos>=targetI; srcPos--) { Loading @@ -2296,13 +2298,13 @@ final class ActivityStack { + " from " + srcPos + " to " + lastReparentPos + " from " + srcPos + " to " + lastReparentPos + " in to resetting task " + task); + " in to resetting task " + task); mService.mWindowManager.moveAppToken(lastReparentPos, p.appToken); mService.mWindowManager.moveAppToken(lastReparentPos, p.appToken); mService.mWindowManager.setAppGroupId(p.appToken, p.task.taskId); mService.mWindowManager.setAppGroupId(p.appToken, taskId); } // TODO: This is wrong because it doesn't take lastReparentPos into account. mService.mWindowManager.moveTaskToTop(taskId); if (VALIDATE_TOKENS) { if (VALIDATE_TOKENS) { validateAppTokensLocked(); validateAppTokensLocked(); } } } // TODO: This is wrong because it doesn't take lastReparentPos into account. mService.mWindowManager.moveTaskToTop(task.taskId); replyChainEnd = -1; replyChainEnd = -1; // Now we've moved it in to place... but what if this is // Now we've moved it in to place... but what if this is Loading Loading @@ -4565,10 +4567,10 @@ final class ActivityStack { } } mService.mWindowManager.moveAppTokensToTop(moved); mService.mWindowManager.moveAppTokensToTop(moved); mService.mWindowManager.moveTaskToTop(task); if (VALIDATE_TOKENS) { if (VALIDATE_TOKENS) { validateAppTokensLocked(); validateAppTokensLocked(); } } mService.mWindowManager.moveTaskToTop(task); finishTaskMoveLocked(task); finishTaskMoveLocked(task); EventLog.writeEvent(EventLogTags.AM_TASK_TO_FRONT, tr.userId, task); EventLog.writeEvent(EventLogTags.AM_TASK_TO_FRONT, tr.userId, task); Loading Loading @@ -4658,10 +4660,10 @@ final class ActivityStack { AppTransition.TRANSIT_TASK_TO_BACK, false); AppTransition.TRANSIT_TASK_TO_BACK, false); } } mService.mWindowManager.moveAppTokensToBottom(moved); mService.mWindowManager.moveAppTokensToBottom(moved); mService.mWindowManager.moveTaskToBottom(task); if (VALIDATE_TOKENS) { if (VALIDATE_TOKENS) { validateAppTokensLocked(); validateAppTokensLocked(); } } mService.mWindowManager.moveTaskToBottom(task); finishTaskMoveLocked(task); finishTaskMoveLocked(task); return true; return true; Loading services/java/com/android/server/wm/DisplayContent.java +9 −0 Original line number Original line Diff line number Diff line Loading @@ -293,6 +293,15 @@ class DisplayContent { public void remove() { public void remove() { throw new IllegalArgumentException(); throw new IllegalArgumentException(); } } int size() { int size = 0; final TaskListsIterator iterator = new TaskListsIterator(); while (iterator.hasNext()) { size += iterator.next().mAppTokens.size(); } return size; } } } void verifyAppTokens() { void verifyAppTokens() { Loading services/java/com/android/server/wm/WindowManagerService.java +37 −40 Original line number Original line Diff line number Diff line Loading @@ -58,6 +58,7 @@ import com.android.server.display.DisplayManagerService; import com.android.server.input.InputManagerService; import com.android.server.input.InputManagerService; import com.android.server.power.PowerManagerService; import com.android.server.power.PowerManagerService; import com.android.server.power.ShutdownThread; import com.android.server.power.ShutdownThread; import com.android.server.wm.DisplayContent.AppTokenIterator; import android.Manifest; import android.Manifest; import android.app.ActivityManagerNative; import android.app.ActivityManagerNative; Loading Loading @@ -3118,9 +3119,8 @@ public class WindowManagerService extends IWindowManager.Stub Slog.w(TAG, "validateAppTokens: no Display for taskId=" + taskId); Slog.w(TAG, "validateAppTokens: no Display for taskId=" + taskId); return; return; } } AppTokenList appTokens = displayContent.mAppTokens; int m = appTokens.size() - 1; AppTokenIterator iterator = displayContent.new AppTokenIterator(true); for ( ; t >= 0; --t) { for ( ; t >= 0; --t) { task = tasks.get(t); task = tasks.get(t); List<IApplicationToken> tokens = task.tokens; List<IApplicationToken> tokens = task.tokens; Loading @@ -3133,18 +3133,16 @@ public class WindowManagerService extends IWindowManager.Stub return; return; } } while (v >= 0 && m >= 0) { while (v >= 0 && iterator.hasNext()) { AppWindowToken atoken = appTokens.get(m); AppWindowToken atoken = iterator.next(); if (atoken.removed) { if (atoken.removed) { m--; continue; continue; } } if (tokens.get(v) != atoken.token) { if (tokens.get(v) != atoken.token) { Slog.w(TAG, "Tokens out of sync: external is " + tokens.get(v) Slog.w(TAG, "Tokens out of sync: external is " + tokens.get(v) + " @ " + v + ", internal is " + atoken.token + " @ " + m); + " @ " + v + ", internal is " + atoken.token); } } v--; v--; m--; } } while (v >= 0) { while (v >= 0) { Slog.w(TAG, "External token not found: " + tokens.get(v) + " @ " + v); Slog.w(TAG, "External token not found: " + tokens.get(v) + " @ " + v); Loading @@ -3152,12 +3150,11 @@ public class WindowManagerService extends IWindowManager.Stub } } } } while (m >= 0) { while (iterator.hasNext()) { AppWindowToken atoken = appTokens.get(m); AppWindowToken atoken = iterator.next(); if (!atoken.removed) { if (!atoken.removed) { Slog.w(TAG, "Invalid internal atoken: " + atoken.token + " @ " + m); Slog.w(TAG, "Invalid internal atoken: " + atoken.token); } } m--; } } } } Loading Loading @@ -3389,9 +3386,9 @@ public class WindowManagerService extends IWindowManager.Stub boolean lastFullscreen = false; boolean lastFullscreen = false; // TODO: Multi window. // TODO: Multi window. DisplayContent displayContent = getDefaultDisplayContentLocked(); DisplayContent displayContent = getDefaultDisplayContentLocked(); AppTokenList appTokens = displayContent.mAppTokens; AppTokenIterator iterator = displayContent.new AppTokenIterator(true); for (int pos = appTokens.size() - 1; pos >= 0; pos--) { while (iterator.hasNext()) { AppWindowToken atoken = appTokens.get(pos); AppWindowToken atoken = iterator.next(); if (DEBUG_APP_ORIENTATION) Slog.v(TAG, "Checking app orientation: " + atoken); if (DEBUG_APP_ORIENTATION) Slog.v(TAG, "Checking app orientation: " + atoken); Loading Loading @@ -4372,9 +4369,10 @@ public class WindowManagerService extends IWindowManager.Stub while (iterator.hasNext()) { while (iterator.hasNext()) { DisplayContent displayContent = iterator.next(); DisplayContent displayContent = iterator.next(); Slog.v(TAG, " Display " + displayContent.getDisplayId()); Slog.v(TAG, " Display " + displayContent.getDisplayId()); AppTokenList appTokens = displayContent.mAppTokens; AppTokenIterator appIterator = displayContent.new AppTokenIterator(true); for (int i=appTokens.size()-1; i>=0; i--) { int i = appIterator.size(); Slog.v(TAG, " #" + i + ": " + appTokens.get(i).token); while (appIterator.hasNext()) { Slog.v(TAG, " #" + --i + ": " + appIterator.next().token); } } } } } } Loading Loading @@ -4428,13 +4426,9 @@ public class WindowManagerService extends IWindowManager.Stub tokenPos--; tokenPos--; continue; continue; } } int i = wtoken.windows.size(); for (int i = wtoken.windows.size() - 1; i >= 0; --i) { while (i > 0) { i--; WindowState win = wtoken.windows.get(i); WindowState win = wtoken.windows.get(i); int j = win.mChildWindows.size(); for (int j = win.mChildWindows.size() - 1; j >= 0; --j) { while (j > 0) { j--; WindowState cwin = win.mChildWindows.get(j); WindowState cwin = win.mChildWindows.get(j); if (cwin.mSubLayer >= 0) { if (cwin.mSubLayer >= 0) { for (int pos = NW - 1; pos >= 0; pos--) { for (int pos = NW - 1; pos >= 0; pos--) { Loading Loading @@ -8825,8 +8819,7 @@ public class WindowManagerService extends IWindowManager.Stub token.mAppAnimator.animating = false; token.mAppAnimator.animating = false; 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); displayContent.mAppTokens.remove(token); displayContent.removeAppToken(token); displayContent.mAnimatingAppTokens.remove(token); exitingAppTokens.remove(i); exitingAppTokens.remove(i); } } } } Loading Loading @@ -9263,9 +9256,8 @@ public class WindowManagerService extends IWindowManager.Stub } } private WindowState findFocusedWindowLocked(DisplayContent displayContent) { private WindowState findFocusedWindowLocked(DisplayContent displayContent) { final AppTokenList appTokens = displayContent.mAppTokens; AppTokenIterator iterator = displayContent.new AppTokenIterator(true); int nextAppIndex = appTokens.size()-1; WindowToken nextApp = iterator.hasNext() ? iterator.next() : null; WindowToken nextApp = nextAppIndex >= 0 ? appTokens.get(nextAppIndex) : null; final WindowList windows = displayContent.getWindowList(); final WindowList windows = displayContent.getWindowList(); for (int i = windows.size() - 1; i >= 0; i--) { for (int i = windows.size() - 1; i >= 0; i--) { Loading @@ -9291,8 +9283,8 @@ public class WindowManagerService extends IWindowManager.Stub // through the app tokens until we find its app. // through the app tokens until we find its app. if (thisApp != null && nextApp != null && thisApp != nextApp if (thisApp != null && nextApp != null && thisApp != nextApp && win.mAttrs.type != TYPE_APPLICATION_STARTING) { && win.mAttrs.type != TYPE_APPLICATION_STARTING) { int origAppIndex = nextAppIndex; final WindowToken origAppToken = nextApp; while (nextAppIndex > 0) { while (iterator.hasNext()) { if (nextApp == mFocusedApp) { if (nextApp == mFocusedApp) { // Whoops, we are below the focused app... no focus // Whoops, we are below the focused app... no focus // for you! // for you! Loading @@ -9300,8 +9292,7 @@ public class WindowManagerService extends IWindowManager.Stub TAG, "Reached focused app: " + mFocusedApp); TAG, "Reached focused app: " + mFocusedApp); return null; return null; } } nextAppIndex--; nextApp = iterator.next(); nextApp = appTokens.get(nextAppIndex); if (nextApp == thisApp) { if (nextApp == thisApp) { break; break; } } Loading @@ -9310,8 +9301,14 @@ public class WindowManagerService extends IWindowManager.Stub // Uh oh, the app token doesn't exist! This shouldn't // Uh oh, the app token doesn't exist! This shouldn't // happen, but if it does we can get totally hosed... // happen, but if it does we can get totally hosed... // so restart at the original app. // so restart at the original app. nextAppIndex = origAppIndex; nextApp = origAppToken; nextApp = appTokens.get(nextAppIndex); iterator = displayContent.new AppTokenIterator(true); while (iterator.hasNext()) { // return iterator to same place. if (iterator.next() == origAppToken) { break; } } } } } } Loading Loading
services/java/com/android/server/am/ActivityStack.java +15 −13 Original line number Original line Diff line number Diff line Loading @@ -2120,6 +2120,7 @@ final class ActivityStack { int dstPos = 0; int dstPos = 0; ThumbnailHolder curThumbHolder = target.thumbHolder; ThumbnailHolder curThumbHolder = target.thumbHolder; boolean gotOptions = !canMoveOptions; boolean gotOptions = !canMoveOptions; final int taskId = target.task.taskId; for (int srcPos=targetI; srcPos<=replyChainEnd; srcPos++) { for (int srcPos=targetI; srcPos<=replyChainEnd; srcPos++) { p = mHistory.get(srcPos); p = mHistory.get(srcPos); if (p.finishing) { if (p.finishing) { Loading @@ -2145,14 +2146,14 @@ final class ActivityStack { mHistory.remove(srcPos); mHistory.remove(srcPos); mHistory.add(dstPos, p); mHistory.add(dstPos, p); mService.mWindowManager.moveAppToken(dstPos, p.appToken); mService.mWindowManager.moveAppToken(dstPos, p.appToken); mService.mWindowManager.setAppGroupId(p.appToken, p.task.taskId); mService.mWindowManager.setAppGroupId(p.appToken, taskId); dstPos++; dstPos++; i++; } mService.mWindowManager.moveTaskToBottom(taskId); if (VALIDATE_TOKENS) { if (VALIDATE_TOKENS) { validateAppTokensLocked(); validateAppTokensLocked(); } } i++; } mService.mWindowManager.moveTaskToBottom(target.task.taskId); if (taskTop == p) { if (taskTop == p) { taskTop = below; taskTop = below; } } Loading Loading @@ -2270,6 +2271,7 @@ final class ActivityStack { if (replyChainEnd < 0) { if (replyChainEnd < 0) { replyChainEnd = targetI; replyChainEnd = targetI; } } final int taskId = task.taskId; if (DEBUG_TASKS) Slog.v(TAG, "Reparenting task at index " if (DEBUG_TASKS) Slog.v(TAG, "Reparenting task at index " + targetI + " to " + replyChainEnd); + targetI + " to " + replyChainEnd); for (int srcPos=replyChainEnd; srcPos>=targetI; srcPos--) { for (int srcPos=replyChainEnd; srcPos>=targetI; srcPos--) { Loading @@ -2296,13 +2298,13 @@ final class ActivityStack { + " from " + srcPos + " to " + lastReparentPos + " from " + srcPos + " to " + lastReparentPos + " in to resetting task " + task); + " in to resetting task " + task); mService.mWindowManager.moveAppToken(lastReparentPos, p.appToken); mService.mWindowManager.moveAppToken(lastReparentPos, p.appToken); mService.mWindowManager.setAppGroupId(p.appToken, p.task.taskId); mService.mWindowManager.setAppGroupId(p.appToken, taskId); } // TODO: This is wrong because it doesn't take lastReparentPos into account. mService.mWindowManager.moveTaskToTop(taskId); if (VALIDATE_TOKENS) { if (VALIDATE_TOKENS) { validateAppTokensLocked(); validateAppTokensLocked(); } } } // TODO: This is wrong because it doesn't take lastReparentPos into account. mService.mWindowManager.moveTaskToTop(task.taskId); replyChainEnd = -1; replyChainEnd = -1; // Now we've moved it in to place... but what if this is // Now we've moved it in to place... but what if this is Loading Loading @@ -4565,10 +4567,10 @@ final class ActivityStack { } } mService.mWindowManager.moveAppTokensToTop(moved); mService.mWindowManager.moveAppTokensToTop(moved); mService.mWindowManager.moveTaskToTop(task); if (VALIDATE_TOKENS) { if (VALIDATE_TOKENS) { validateAppTokensLocked(); validateAppTokensLocked(); } } mService.mWindowManager.moveTaskToTop(task); finishTaskMoveLocked(task); finishTaskMoveLocked(task); EventLog.writeEvent(EventLogTags.AM_TASK_TO_FRONT, tr.userId, task); EventLog.writeEvent(EventLogTags.AM_TASK_TO_FRONT, tr.userId, task); Loading Loading @@ -4658,10 +4660,10 @@ final class ActivityStack { AppTransition.TRANSIT_TASK_TO_BACK, false); AppTransition.TRANSIT_TASK_TO_BACK, false); } } mService.mWindowManager.moveAppTokensToBottom(moved); mService.mWindowManager.moveAppTokensToBottom(moved); mService.mWindowManager.moveTaskToBottom(task); if (VALIDATE_TOKENS) { if (VALIDATE_TOKENS) { validateAppTokensLocked(); validateAppTokensLocked(); } } mService.mWindowManager.moveTaskToBottom(task); finishTaskMoveLocked(task); finishTaskMoveLocked(task); return true; return true; Loading
services/java/com/android/server/wm/DisplayContent.java +9 −0 Original line number Original line Diff line number Diff line Loading @@ -293,6 +293,15 @@ class DisplayContent { public void remove() { public void remove() { throw new IllegalArgumentException(); throw new IllegalArgumentException(); } } int size() { int size = 0; final TaskListsIterator iterator = new TaskListsIterator(); while (iterator.hasNext()) { size += iterator.next().mAppTokens.size(); } return size; } } } void verifyAppTokens() { void verifyAppTokens() { Loading
services/java/com/android/server/wm/WindowManagerService.java +37 −40 Original line number Original line Diff line number Diff line Loading @@ -58,6 +58,7 @@ import com.android.server.display.DisplayManagerService; import com.android.server.input.InputManagerService; import com.android.server.input.InputManagerService; import com.android.server.power.PowerManagerService; import com.android.server.power.PowerManagerService; import com.android.server.power.ShutdownThread; import com.android.server.power.ShutdownThread; import com.android.server.wm.DisplayContent.AppTokenIterator; import android.Manifest; import android.Manifest; import android.app.ActivityManagerNative; import android.app.ActivityManagerNative; Loading Loading @@ -3118,9 +3119,8 @@ public class WindowManagerService extends IWindowManager.Stub Slog.w(TAG, "validateAppTokens: no Display for taskId=" + taskId); Slog.w(TAG, "validateAppTokens: no Display for taskId=" + taskId); return; return; } } AppTokenList appTokens = displayContent.mAppTokens; int m = appTokens.size() - 1; AppTokenIterator iterator = displayContent.new AppTokenIterator(true); for ( ; t >= 0; --t) { for ( ; t >= 0; --t) { task = tasks.get(t); task = tasks.get(t); List<IApplicationToken> tokens = task.tokens; List<IApplicationToken> tokens = task.tokens; Loading @@ -3133,18 +3133,16 @@ public class WindowManagerService extends IWindowManager.Stub return; return; } } while (v >= 0 && m >= 0) { while (v >= 0 && iterator.hasNext()) { AppWindowToken atoken = appTokens.get(m); AppWindowToken atoken = iterator.next(); if (atoken.removed) { if (atoken.removed) { m--; continue; continue; } } if (tokens.get(v) != atoken.token) { if (tokens.get(v) != atoken.token) { Slog.w(TAG, "Tokens out of sync: external is " + tokens.get(v) Slog.w(TAG, "Tokens out of sync: external is " + tokens.get(v) + " @ " + v + ", internal is " + atoken.token + " @ " + m); + " @ " + v + ", internal is " + atoken.token); } } v--; v--; m--; } } while (v >= 0) { while (v >= 0) { Slog.w(TAG, "External token not found: " + tokens.get(v) + " @ " + v); Slog.w(TAG, "External token not found: " + tokens.get(v) + " @ " + v); Loading @@ -3152,12 +3150,11 @@ public class WindowManagerService extends IWindowManager.Stub } } } } while (m >= 0) { while (iterator.hasNext()) { AppWindowToken atoken = appTokens.get(m); AppWindowToken atoken = iterator.next(); if (!atoken.removed) { if (!atoken.removed) { Slog.w(TAG, "Invalid internal atoken: " + atoken.token + " @ " + m); Slog.w(TAG, "Invalid internal atoken: " + atoken.token); } } m--; } } } } Loading Loading @@ -3389,9 +3386,9 @@ public class WindowManagerService extends IWindowManager.Stub boolean lastFullscreen = false; boolean lastFullscreen = false; // TODO: Multi window. // TODO: Multi window. DisplayContent displayContent = getDefaultDisplayContentLocked(); DisplayContent displayContent = getDefaultDisplayContentLocked(); AppTokenList appTokens = displayContent.mAppTokens; AppTokenIterator iterator = displayContent.new AppTokenIterator(true); for (int pos = appTokens.size() - 1; pos >= 0; pos--) { while (iterator.hasNext()) { AppWindowToken atoken = appTokens.get(pos); AppWindowToken atoken = iterator.next(); if (DEBUG_APP_ORIENTATION) Slog.v(TAG, "Checking app orientation: " + atoken); if (DEBUG_APP_ORIENTATION) Slog.v(TAG, "Checking app orientation: " + atoken); Loading Loading @@ -4372,9 +4369,10 @@ public class WindowManagerService extends IWindowManager.Stub while (iterator.hasNext()) { while (iterator.hasNext()) { DisplayContent displayContent = iterator.next(); DisplayContent displayContent = iterator.next(); Slog.v(TAG, " Display " + displayContent.getDisplayId()); Slog.v(TAG, " Display " + displayContent.getDisplayId()); AppTokenList appTokens = displayContent.mAppTokens; AppTokenIterator appIterator = displayContent.new AppTokenIterator(true); for (int i=appTokens.size()-1; i>=0; i--) { int i = appIterator.size(); Slog.v(TAG, " #" + i + ": " + appTokens.get(i).token); while (appIterator.hasNext()) { Slog.v(TAG, " #" + --i + ": " + appIterator.next().token); } } } } } } Loading Loading @@ -4428,13 +4426,9 @@ public class WindowManagerService extends IWindowManager.Stub tokenPos--; tokenPos--; continue; continue; } } int i = wtoken.windows.size(); for (int i = wtoken.windows.size() - 1; i >= 0; --i) { while (i > 0) { i--; WindowState win = wtoken.windows.get(i); WindowState win = wtoken.windows.get(i); int j = win.mChildWindows.size(); for (int j = win.mChildWindows.size() - 1; j >= 0; --j) { while (j > 0) { j--; WindowState cwin = win.mChildWindows.get(j); WindowState cwin = win.mChildWindows.get(j); if (cwin.mSubLayer >= 0) { if (cwin.mSubLayer >= 0) { for (int pos = NW - 1; pos >= 0; pos--) { for (int pos = NW - 1; pos >= 0; pos--) { Loading Loading @@ -8825,8 +8819,7 @@ public class WindowManagerService extends IWindowManager.Stub token.mAppAnimator.animating = false; token.mAppAnimator.animating = false; 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); displayContent.mAppTokens.remove(token); displayContent.removeAppToken(token); displayContent.mAnimatingAppTokens.remove(token); exitingAppTokens.remove(i); exitingAppTokens.remove(i); } } } } Loading Loading @@ -9263,9 +9256,8 @@ public class WindowManagerService extends IWindowManager.Stub } } private WindowState findFocusedWindowLocked(DisplayContent displayContent) { private WindowState findFocusedWindowLocked(DisplayContent displayContent) { final AppTokenList appTokens = displayContent.mAppTokens; AppTokenIterator iterator = displayContent.new AppTokenIterator(true); int nextAppIndex = appTokens.size()-1; WindowToken nextApp = iterator.hasNext() ? iterator.next() : null; WindowToken nextApp = nextAppIndex >= 0 ? appTokens.get(nextAppIndex) : null; final WindowList windows = displayContent.getWindowList(); final WindowList windows = displayContent.getWindowList(); for (int i = windows.size() - 1; i >= 0; i--) { for (int i = windows.size() - 1; i >= 0; i--) { Loading @@ -9291,8 +9283,8 @@ public class WindowManagerService extends IWindowManager.Stub // through the app tokens until we find its app. // through the app tokens until we find its app. if (thisApp != null && nextApp != null && thisApp != nextApp if (thisApp != null && nextApp != null && thisApp != nextApp && win.mAttrs.type != TYPE_APPLICATION_STARTING) { && win.mAttrs.type != TYPE_APPLICATION_STARTING) { int origAppIndex = nextAppIndex; final WindowToken origAppToken = nextApp; while (nextAppIndex > 0) { while (iterator.hasNext()) { if (nextApp == mFocusedApp) { if (nextApp == mFocusedApp) { // Whoops, we are below the focused app... no focus // Whoops, we are below the focused app... no focus // for you! // for you! Loading @@ -9300,8 +9292,7 @@ public class WindowManagerService extends IWindowManager.Stub TAG, "Reached focused app: " + mFocusedApp); TAG, "Reached focused app: " + mFocusedApp); return null; return null; } } nextAppIndex--; nextApp = iterator.next(); nextApp = appTokens.get(nextAppIndex); if (nextApp == thisApp) { if (nextApp == thisApp) { break; break; } } Loading @@ -9310,8 +9301,14 @@ public class WindowManagerService extends IWindowManager.Stub // Uh oh, the app token doesn't exist! This shouldn't // Uh oh, the app token doesn't exist! This shouldn't // happen, but if it does we can get totally hosed... // happen, but if it does we can get totally hosed... // so restart at the original app. // so restart at the original app. nextAppIndex = origAppIndex; nextApp = origAppToken; nextApp = appTokens.get(nextAppIndex); iterator = displayContent.new AppTokenIterator(true); while (iterator.hasNext()) { // return iterator to same place. if (iterator.next() == origAppToken) { break; } } } } } } Loading