Loading core/java/android/view/IWindowManager.aidl +0 −3 Original line number Diff line number Diff line Loading @@ -97,9 +97,6 @@ interface IWindowManager void startAppFreezingScreen(IBinder token, int configChanges); void stopAppFreezingScreen(IBinder token, boolean force); void removeAppToken(IBinder token); void moveAppToken(int index, IBinder token); void moveAppTokensToTop(in List<IBinder> tokens); void moveAppTokensToBottom(in List<IBinder> tokens); // Re-evaluate the current orientation from the caller's state. // If there is a change, the new Configuration is returned and the Loading services/java/com/android/server/am/ActivityStack.java +0 −4 Original line number Diff line number Diff line Loading @@ -2145,7 +2145,6 @@ final class ActivityStack { } mHistory.remove(srcPos); mHistory.add(dstPos, p); // mService.mWindowManager.moveAppToken(dstPos, p.appToken); mService.mWindowManager.setAppGroupId(p.appToken, taskId); dstPos++; i++; Loading Loading @@ -2297,7 +2296,6 @@ final class ActivityStack { if (DEBUG_TASKS) Slog.v(TAG, "Pulling activity " + p + " from " + srcPos + " to " + lastReparentPos + " in to resetting task " + task); // mService.mWindowManager.moveAppToken(lastReparentPos, p.appToken); mService.mWindowManager.setAppGroupId(p.appToken, taskId); } // TODO: This is wrong because it doesn't take lastReparentPos into account. Loading Loading @@ -4566,7 +4564,6 @@ final class ActivityStack { updateTransitLocked(AppTransition.TRANSIT_TASK_TO_FRONT, options); } // mService.mWindowManager.moveAppTokensToTop(moved); mService.mWindowManager.moveTaskToTop(task); if (VALIDATE_TOKENS) { validateAppTokensLocked(); Loading Loading @@ -4659,7 +4656,6 @@ final class ActivityStack { mService.mWindowManager.prepareAppTransition( AppTransition.TRANSIT_TASK_TO_BACK, false); } // mService.mWindowManager.moveAppTokensToBottom(moved); mService.mWindowManager.moveTaskToBottom(task); if (VALIDATE_TOKENS) { validateAppTokensLocked(); Loading services/java/com/android/server/wm/DisplayContent.java +0 −25 Original line number Diff line number Diff line Loading @@ -307,31 +307,6 @@ class DisplayContent { } } void verifyAppTokens() { AppTokenIterator iterator = new AppTokenIterator(); for (int i = 0; i < mAppTokens.size(); ++i) { if (!iterator.hasNext()) { Slog.e(TAG, "compareAppTokens: More mAppTokens than TaskList tokens. Callers=" + Debug.getCallers(4)); while (i < mAppTokens.size()) { Slog.e(TAG, "compareAppTokens: mAppTokens[" + i + "]=" + mAppTokens.get(i)); i++; } return; } AppWindowToken appToken = mAppTokens.get(i); AppWindowToken taskListToken = iterator.next(); if (appToken != taskListToken) { Slog.e(TAG, "compareAppTokens: Mismatch at " + i + " appToken=" + appToken + " taskListToken=" + taskListToken + ". Callers=" + Debug.getCallers(4)); } } if (iterator.hasNext()) { Slog.e(TAG, "compareAppTokens: More TaskList tokens than mAppTokens Callers=" + Debug.getCallers(4)); } } public void dump(String prefix, PrintWriter pw) { pw.print(prefix); pw.print("Display: mDisplayId="); pw.println(mDisplayId); final String subPrefix = " " + prefix; Loading services/java/com/android/server/wm/WindowManagerService.java +0 −288 Original line number Diff line number Diff line Loading @@ -4390,61 +4390,6 @@ public class WindowManagerService extends IWindowManager.Stub } } private int findWindowOffsetLocked(DisplayContent displayContent, int tokenPos) { final WindowList windows = displayContent.getWindowList(); final int NW = windows.size(); if (tokenPos >= displayContent.mAnimatingAppTokens.size()) { int i = NW; while (i > 0) { i--; WindowState win = windows.get(i); if (win.getAppToken() != null) { return i+1; } } } final AppTokenList appTokens = displayContent.mAppTokens; while (tokenPos > 0) { // Find the first app token below the new position that has // a window displayed. final AppWindowToken wtoken = appTokens.get(tokenPos-1); if (DEBUG_REORDER) Slog.v(TAG, "Looking for lower windows @ " + tokenPos + " -- " + wtoken.token); if (wtoken.sendingToBottom) { if (DEBUG_REORDER) Slog.v(TAG, "Skipping token -- currently sending to bottom"); tokenPos--; continue; } for (int i = wtoken.windows.size() - 1; i >= 0; --i) { WindowState win = wtoken.windows.get(i); for (int j = win.mChildWindows.size() - 1; j >= 0; --j) { WindowState cwin = win.mChildWindows.get(j); if (cwin.mSubLayer >= 0) { for (int pos = NW - 1; pos >= 0; pos--) { if (windows.get(pos) == cwin) { if (DEBUG_REORDER) Slog.v(TAG, "Found child win @" + (pos + 1)); return pos + 1; } } } } for (int pos = NW - 1; pos >= 0; pos--) { if (windows.get(pos) == win) { if (DEBUG_REORDER) Slog.v(TAG, "Found win @" + (pos + 1)); return pos + 1; } } } tokenPos--; } return 0; } private int findAppWindowInsertionPointLocked(AppWindowToken target) { final int taskId = target.groupId; DisplayContent displayContent = mTaskIdToDisplayContents.get(taskId); Loading Loading @@ -4540,215 +4485,6 @@ public class WindowManagerService extends IWindowManager.Stub return index; } @Override public void moveAppToken(int index, IBinder token) { if (!checkCallingPermission(android.Manifest.permission.MANAGE_APP_TOKENS, "moveAppToken()")) { throw new SecurityException("Requires MANAGE_APP_TOKENS permission"); } synchronized(mWindowMap) { if (DEBUG_REORDER) Slog.v(TAG, "Initial app tokens:"); if (DEBUG_REORDER) dumpAppTokensLocked(); final AppWindowToken wtoken = findAppWindowToken(token); DisplayContent displayContent = mTaskIdToDisplayContents.get(wtoken.groupId); final AppTokenList appTokens = displayContent.mAppTokens; final int oldIndex = appTokens.indexOf(wtoken); if (DEBUG_TOKEN_MOVEMENT || DEBUG_REORDER) Slog.v(TAG, "Start moving token " + wtoken + " initially at " + oldIndex); if (oldIndex > index && mAppTransition.isTransitionSet()) { // animation towards back has not started, copy old list for duration of animation. displayContent.refillAnimatingAppTokens(); } if (wtoken == null || !appTokens.remove(wtoken)) { Slog.w(TAG, "Attempting to reorder token that doesn't exist: " + token + " (" + wtoken + ")"); return; } appTokens.add(index, wtoken); if (DEBUG_REORDER) Slog.v(TAG, "Moved " + token + " to " + index + ":"); else if (DEBUG_TOKEN_MOVEMENT) Slog.v(TAG, "Moved " + token + " to " + index); if (DEBUG_REORDER) dumpAppTokensLocked(); if (!mAppTransition.isTransitionSet()) { // Not animating, bring animating app list in line with mAppTokens. displayContent.refillAnimatingAppTokens(); // Bring window ordering, window focus and input window in line with new app token final long origId = Binder.clearCallingIdentity(); if (DEBUG_REORDER) Slog.v(TAG, "Removing windows in " + token + ":"); if (DEBUG_REORDER) dumpWindowsLocked(); if (tmpRemoveAppWindowsLocked(wtoken)) { if (DEBUG_REORDER) Slog.v(TAG, "Adding windows back in:"); if (DEBUG_REORDER) dumpWindowsLocked(); DisplayContentsIterator iterator = new DisplayContentsIterator(); while(iterator.hasNext()) { displayContent = iterator.next(); final int pos = findWindowOffsetLocked(displayContent, index); final int newPos = reAddAppWindowsLocked(displayContent, pos, wtoken); if (pos != newPos) { displayContent.layoutNeeded = true; } } if (DEBUG_REORDER) Slog.v(TAG, "Final window list:"); if (DEBUG_REORDER) dumpWindowsLocked(); updateFocusedWindowLocked(UPDATE_FOCUS_WILL_PLACE_SURFACES, false /*updateInputWindows*/); mInputMonitor.setUpdateInputWindowsNeededLw(); performLayoutAndPlaceSurfacesLocked(); mInputMonitor.updateInputWindowsLw(false /*force*/); } Binder.restoreCallingIdentity(origId); } } } private void removeAppTokensLocked(List<IBinder> tokens) { // XXX This should be done more efficiently! // (take advantage of the fact that both lists should be // ordered in the same way.) int N = tokens.size(); for (int i=0; i<N; i++) { IBinder token = tokens.get(i); final AppWindowToken wtoken = findAppWindowToken(token); if (wtoken != null) { final DisplayContent displayContent = mTaskIdToDisplayContents.get(wtoken.groupId); if (DEBUG_REORDER || DEBUG_TOKEN_MOVEMENT) Slog.v(TAG, "Temporarily removing " + wtoken); if (!displayContent.mAppTokens.remove(wtoken)) { Slog.w(TAG, "Attempting to reorder token that doesn't exist: " + token + " (" + wtoken + ")"); i--; N--; } } } } WindowList mSavedWindows; private void moveAppWindowsLocked(List<IBinder> tokens, DisplayContent displayContent, int tokenPos) { if (DEBUG_TASK_MOVEMENT) { mSavedWindows = new WindowList(displayContent.getWindowList()); } // First remove all of the windows from the list. final int N = tokens.size(); int i; for (i=0; i<N; i++) { WindowToken token = mTokenMap.get(tokens.get(i)); if (token != null) { tmpRemoveAppWindowsLocked(token); } } // And now add them back at the correct place. // Where to start adding? int pos = findWindowOffsetLocked(displayContent, tokenPos); for (i=0; i<N; i++) { WindowToken token = mTokenMap.get(tokens.get(i)); if (token != null) { final int newPos = reAddAppWindowsLocked(displayContent, pos, token); if (newPos != pos) { displayContent.layoutNeeded = true; } pos = newPos; } } if (!updateFocusedWindowLocked(UPDATE_FOCUS_WILL_PLACE_SURFACES, false /*updateInputWindows*/)) { assignLayersLocked(displayContent.getWindowList()); } mInputMonitor.setUpdateInputWindowsNeededLw(); // Note that the above updateFocusedWindowLocked used to sit here. performLayoutAndPlaceSurfacesLocked(); mInputMonitor.updateInputWindowsLw(false /*force*/); //dump(); } @Override public void moveAppTokensToTop(List<IBinder> tokens) { if (!checkCallingPermission(android.Manifest.permission.MANAGE_APP_TOKENS, "moveAppTokensToTop()")) { throw new SecurityException("Requires MANAGE_APP_TOKENS permission"); } final long origId = Binder.clearCallingIdentity(); synchronized(mWindowMap) { DisplayContent displayContent = null; removeAppTokensLocked(tokens); final int N = tokens.size(); for (int i=0; i<N; i++) { AppWindowToken wt = findAppWindowToken(tokens.get(i)); if (wt != null) { if (DEBUG_TOKEN_MOVEMENT || DEBUG_REORDER) { Slog.v(TAG, "Adding next to top: " + wt); if (displayContent != null && displayContent != mTaskIdToDisplayContents.get(wt.groupId)) Slog.e( TAG, "moveAppTokensToTop: Not all tokens on same display"); } displayContent = mTaskIdToDisplayContents.get(wt.groupId); displayContent.mAppTokens.add(wt); if (mAppTransition.isTransitionSet()) { wt.sendingToBottom = false; } } } displayContent.refillAnimatingAppTokens(); moveAppWindowsLocked(tokens, displayContent, displayContent.mAppTokens.size()); } Binder.restoreCallingIdentity(origId); } @Override public void moveAppTokensToBottom(List<IBinder> tokens) { if (!checkCallingPermission(android.Manifest.permission.MANAGE_APP_TOKENS, "moveAppTokensToBottom()")) { throw new SecurityException("Requires MANAGE_APP_TOKENS permission"); } final long origId = Binder.clearCallingIdentity(); synchronized(mWindowMap) { DisplayContent displayContent = null; final int N = tokens.size(); if (N > 0) { // animating towards back, hang onto old list for duration of animation. AppWindowToken wt = findAppWindowToken(tokens.get(0)); if (wt != null) { displayContent = mTaskIdToDisplayContents.get(wt.groupId); displayContent.refillAnimatingAppTokens(); } } removeAppTokensLocked(tokens); int pos = 0; for (int i=0; i<N; i++) { AppWindowToken wt = findAppWindowToken(tokens.get(i)); if (wt != null) { if (DEBUG_TOKEN_MOVEMENT) { Slog.v(TAG, "Adding next to bottom: " + wt + " at " + pos); if (displayContent != null && displayContent != mTaskIdToDisplayContents.get(wt.groupId)) Slog.e( TAG, "moveAppTokensToBottom: Not all tokens on same display"); } displayContent = mTaskIdToDisplayContents.get(wt.groupId); displayContent.mAppTokens.add(pos, wt); if (mAppTransition.isTransitionSet()) { wt.sendingToBottom = true; } pos++; } } displayContent.refillAnimatingAppTokens(); moveAppWindowsLocked(tokens, displayContent, 0); } Binder.restoreCallingIdentity(origId); } private void moveTaskWindowsLocked(int taskId) { DisplayContent displayContent = mTaskIdToDisplayContents.get(taskId); if (displayContent == null) { Loading @@ -4756,15 +4492,6 @@ public class WindowManagerService extends IWindowManager.Stub return; } WindowList windows; WindowList windowsAtStart; if (DEBUG_TASK_MOVEMENT) { windows = displayContent.getWindowList(); windowsAtStart = new WindowList(windows); windows.clear(); windows.addAll(mSavedWindows); } TaskList taskList = displayContent.mTaskIdToTaskList.get(taskId); if (taskList == null) { Slog.w(TAG, "moveTaskWindowsLocked: can't find TaskList for taskId=" + taskId); Loading Loading @@ -4793,19 +4520,6 @@ public class WindowManagerService extends IWindowManager.Stub assignLayersLocked(displayContent.getWindowList()); } if (DEBUG_TASK_MOVEMENT) { // Compare windowsAtStart with current windows. if (windowsAtStart.size() != windows.size()) { Slog.e(TAG, "moveTaskWindowsLocked: Mismatch in size!"); } for (int i = 0; i < windowsAtStart.size(); i++) { if (windowsAtStart.get(i) != windows.get(i)) { Slog.e(TAG, "moveTaskWindowsLocked: Mismatch at " + i + " app=" + windowsAtStart.get(i) + " task=" + windows.get(i)); } } } updateFocusedWindowLocked(UPDATE_FOCUS_WILL_PLACE_SURFACES, false /*updateInputWindows*/); mInputMonitor.setUpdateInputWindowsNeededLw(); Loading Loading @@ -4835,7 +4549,6 @@ public class WindowManagerService extends IWindowManager.Stub Slog.e(TAG, "moveTaskToTop: taskId=" + taskId + " not found in mTaskLists"); } displayContent.mTaskLists.add(taskList); displayContent.verifyAppTokens(); displayContent.refillAnimatingAppTokens(); moveTaskWindowsLocked(taskId); Loading Loading @@ -4865,7 +4578,6 @@ public class WindowManagerService extends IWindowManager.Stub Slog.e(TAG, "moveTaskToBottom: taskId=" + taskId + " not found in mTaskLists"); } displayContent.mTaskLists.add(0, taskList); displayContent.verifyAppTokens(); displayContent.refillAnimatingAppTokens(); moveTaskWindowsLocked(taskId); Loading tools/layoutlib/bridge/src/android/view/IWindowManagerImpl.java +0 −18 Original line number Diff line number Diff line Loading @@ -203,24 +203,6 @@ public class IWindowManagerImpl implements IWindowManager { return false; } @Override public void moveAppToken(int arg0, IBinder arg1) throws RemoteException { // TODO Auto-generated method stub } @Override public void moveAppTokensToBottom(List<IBinder> arg0) throws RemoteException { // TODO Auto-generated method stub } @Override public void moveAppTokensToTop(List<IBinder> arg0) throws RemoteException { // TODO Auto-generated method stub } @Override public IWindowSession openSession(IInputMethodClient arg0, IInputContext arg1) throws RemoteException { Loading Loading
core/java/android/view/IWindowManager.aidl +0 −3 Original line number Diff line number Diff line Loading @@ -97,9 +97,6 @@ interface IWindowManager void startAppFreezingScreen(IBinder token, int configChanges); void stopAppFreezingScreen(IBinder token, boolean force); void removeAppToken(IBinder token); void moveAppToken(int index, IBinder token); void moveAppTokensToTop(in List<IBinder> tokens); void moveAppTokensToBottom(in List<IBinder> tokens); // Re-evaluate the current orientation from the caller's state. // If there is a change, the new Configuration is returned and the Loading
services/java/com/android/server/am/ActivityStack.java +0 −4 Original line number Diff line number Diff line Loading @@ -2145,7 +2145,6 @@ final class ActivityStack { } mHistory.remove(srcPos); mHistory.add(dstPos, p); // mService.mWindowManager.moveAppToken(dstPos, p.appToken); mService.mWindowManager.setAppGroupId(p.appToken, taskId); dstPos++; i++; Loading Loading @@ -2297,7 +2296,6 @@ final class ActivityStack { if (DEBUG_TASKS) Slog.v(TAG, "Pulling activity " + p + " from " + srcPos + " to " + lastReparentPos + " in to resetting task " + task); // mService.mWindowManager.moveAppToken(lastReparentPos, p.appToken); mService.mWindowManager.setAppGroupId(p.appToken, taskId); } // TODO: This is wrong because it doesn't take lastReparentPos into account. Loading Loading @@ -4566,7 +4564,6 @@ final class ActivityStack { updateTransitLocked(AppTransition.TRANSIT_TASK_TO_FRONT, options); } // mService.mWindowManager.moveAppTokensToTop(moved); mService.mWindowManager.moveTaskToTop(task); if (VALIDATE_TOKENS) { validateAppTokensLocked(); Loading Loading @@ -4659,7 +4656,6 @@ final class ActivityStack { mService.mWindowManager.prepareAppTransition( AppTransition.TRANSIT_TASK_TO_BACK, false); } // mService.mWindowManager.moveAppTokensToBottom(moved); mService.mWindowManager.moveTaskToBottom(task); if (VALIDATE_TOKENS) { validateAppTokensLocked(); Loading
services/java/com/android/server/wm/DisplayContent.java +0 −25 Original line number Diff line number Diff line Loading @@ -307,31 +307,6 @@ class DisplayContent { } } void verifyAppTokens() { AppTokenIterator iterator = new AppTokenIterator(); for (int i = 0; i < mAppTokens.size(); ++i) { if (!iterator.hasNext()) { Slog.e(TAG, "compareAppTokens: More mAppTokens than TaskList tokens. Callers=" + Debug.getCallers(4)); while (i < mAppTokens.size()) { Slog.e(TAG, "compareAppTokens: mAppTokens[" + i + "]=" + mAppTokens.get(i)); i++; } return; } AppWindowToken appToken = mAppTokens.get(i); AppWindowToken taskListToken = iterator.next(); if (appToken != taskListToken) { Slog.e(TAG, "compareAppTokens: Mismatch at " + i + " appToken=" + appToken + " taskListToken=" + taskListToken + ". Callers=" + Debug.getCallers(4)); } } if (iterator.hasNext()) { Slog.e(TAG, "compareAppTokens: More TaskList tokens than mAppTokens Callers=" + Debug.getCallers(4)); } } public void dump(String prefix, PrintWriter pw) { pw.print(prefix); pw.print("Display: mDisplayId="); pw.println(mDisplayId); final String subPrefix = " " + prefix; Loading
services/java/com/android/server/wm/WindowManagerService.java +0 −288 Original line number Diff line number Diff line Loading @@ -4390,61 +4390,6 @@ public class WindowManagerService extends IWindowManager.Stub } } private int findWindowOffsetLocked(DisplayContent displayContent, int tokenPos) { final WindowList windows = displayContent.getWindowList(); final int NW = windows.size(); if (tokenPos >= displayContent.mAnimatingAppTokens.size()) { int i = NW; while (i > 0) { i--; WindowState win = windows.get(i); if (win.getAppToken() != null) { return i+1; } } } final AppTokenList appTokens = displayContent.mAppTokens; while (tokenPos > 0) { // Find the first app token below the new position that has // a window displayed. final AppWindowToken wtoken = appTokens.get(tokenPos-1); if (DEBUG_REORDER) Slog.v(TAG, "Looking for lower windows @ " + tokenPos + " -- " + wtoken.token); if (wtoken.sendingToBottom) { if (DEBUG_REORDER) Slog.v(TAG, "Skipping token -- currently sending to bottom"); tokenPos--; continue; } for (int i = wtoken.windows.size() - 1; i >= 0; --i) { WindowState win = wtoken.windows.get(i); for (int j = win.mChildWindows.size() - 1; j >= 0; --j) { WindowState cwin = win.mChildWindows.get(j); if (cwin.mSubLayer >= 0) { for (int pos = NW - 1; pos >= 0; pos--) { if (windows.get(pos) == cwin) { if (DEBUG_REORDER) Slog.v(TAG, "Found child win @" + (pos + 1)); return pos + 1; } } } } for (int pos = NW - 1; pos >= 0; pos--) { if (windows.get(pos) == win) { if (DEBUG_REORDER) Slog.v(TAG, "Found win @" + (pos + 1)); return pos + 1; } } } tokenPos--; } return 0; } private int findAppWindowInsertionPointLocked(AppWindowToken target) { final int taskId = target.groupId; DisplayContent displayContent = mTaskIdToDisplayContents.get(taskId); Loading Loading @@ -4540,215 +4485,6 @@ public class WindowManagerService extends IWindowManager.Stub return index; } @Override public void moveAppToken(int index, IBinder token) { if (!checkCallingPermission(android.Manifest.permission.MANAGE_APP_TOKENS, "moveAppToken()")) { throw new SecurityException("Requires MANAGE_APP_TOKENS permission"); } synchronized(mWindowMap) { if (DEBUG_REORDER) Slog.v(TAG, "Initial app tokens:"); if (DEBUG_REORDER) dumpAppTokensLocked(); final AppWindowToken wtoken = findAppWindowToken(token); DisplayContent displayContent = mTaskIdToDisplayContents.get(wtoken.groupId); final AppTokenList appTokens = displayContent.mAppTokens; final int oldIndex = appTokens.indexOf(wtoken); if (DEBUG_TOKEN_MOVEMENT || DEBUG_REORDER) Slog.v(TAG, "Start moving token " + wtoken + " initially at " + oldIndex); if (oldIndex > index && mAppTransition.isTransitionSet()) { // animation towards back has not started, copy old list for duration of animation. displayContent.refillAnimatingAppTokens(); } if (wtoken == null || !appTokens.remove(wtoken)) { Slog.w(TAG, "Attempting to reorder token that doesn't exist: " + token + " (" + wtoken + ")"); return; } appTokens.add(index, wtoken); if (DEBUG_REORDER) Slog.v(TAG, "Moved " + token + " to " + index + ":"); else if (DEBUG_TOKEN_MOVEMENT) Slog.v(TAG, "Moved " + token + " to " + index); if (DEBUG_REORDER) dumpAppTokensLocked(); if (!mAppTransition.isTransitionSet()) { // Not animating, bring animating app list in line with mAppTokens. displayContent.refillAnimatingAppTokens(); // Bring window ordering, window focus and input window in line with new app token final long origId = Binder.clearCallingIdentity(); if (DEBUG_REORDER) Slog.v(TAG, "Removing windows in " + token + ":"); if (DEBUG_REORDER) dumpWindowsLocked(); if (tmpRemoveAppWindowsLocked(wtoken)) { if (DEBUG_REORDER) Slog.v(TAG, "Adding windows back in:"); if (DEBUG_REORDER) dumpWindowsLocked(); DisplayContentsIterator iterator = new DisplayContentsIterator(); while(iterator.hasNext()) { displayContent = iterator.next(); final int pos = findWindowOffsetLocked(displayContent, index); final int newPos = reAddAppWindowsLocked(displayContent, pos, wtoken); if (pos != newPos) { displayContent.layoutNeeded = true; } } if (DEBUG_REORDER) Slog.v(TAG, "Final window list:"); if (DEBUG_REORDER) dumpWindowsLocked(); updateFocusedWindowLocked(UPDATE_FOCUS_WILL_PLACE_SURFACES, false /*updateInputWindows*/); mInputMonitor.setUpdateInputWindowsNeededLw(); performLayoutAndPlaceSurfacesLocked(); mInputMonitor.updateInputWindowsLw(false /*force*/); } Binder.restoreCallingIdentity(origId); } } } private void removeAppTokensLocked(List<IBinder> tokens) { // XXX This should be done more efficiently! // (take advantage of the fact that both lists should be // ordered in the same way.) int N = tokens.size(); for (int i=0; i<N; i++) { IBinder token = tokens.get(i); final AppWindowToken wtoken = findAppWindowToken(token); if (wtoken != null) { final DisplayContent displayContent = mTaskIdToDisplayContents.get(wtoken.groupId); if (DEBUG_REORDER || DEBUG_TOKEN_MOVEMENT) Slog.v(TAG, "Temporarily removing " + wtoken); if (!displayContent.mAppTokens.remove(wtoken)) { Slog.w(TAG, "Attempting to reorder token that doesn't exist: " + token + " (" + wtoken + ")"); i--; N--; } } } } WindowList mSavedWindows; private void moveAppWindowsLocked(List<IBinder> tokens, DisplayContent displayContent, int tokenPos) { if (DEBUG_TASK_MOVEMENT) { mSavedWindows = new WindowList(displayContent.getWindowList()); } // First remove all of the windows from the list. final int N = tokens.size(); int i; for (i=0; i<N; i++) { WindowToken token = mTokenMap.get(tokens.get(i)); if (token != null) { tmpRemoveAppWindowsLocked(token); } } // And now add them back at the correct place. // Where to start adding? int pos = findWindowOffsetLocked(displayContent, tokenPos); for (i=0; i<N; i++) { WindowToken token = mTokenMap.get(tokens.get(i)); if (token != null) { final int newPos = reAddAppWindowsLocked(displayContent, pos, token); if (newPos != pos) { displayContent.layoutNeeded = true; } pos = newPos; } } if (!updateFocusedWindowLocked(UPDATE_FOCUS_WILL_PLACE_SURFACES, false /*updateInputWindows*/)) { assignLayersLocked(displayContent.getWindowList()); } mInputMonitor.setUpdateInputWindowsNeededLw(); // Note that the above updateFocusedWindowLocked used to sit here. performLayoutAndPlaceSurfacesLocked(); mInputMonitor.updateInputWindowsLw(false /*force*/); //dump(); } @Override public void moveAppTokensToTop(List<IBinder> tokens) { if (!checkCallingPermission(android.Manifest.permission.MANAGE_APP_TOKENS, "moveAppTokensToTop()")) { throw new SecurityException("Requires MANAGE_APP_TOKENS permission"); } final long origId = Binder.clearCallingIdentity(); synchronized(mWindowMap) { DisplayContent displayContent = null; removeAppTokensLocked(tokens); final int N = tokens.size(); for (int i=0; i<N; i++) { AppWindowToken wt = findAppWindowToken(tokens.get(i)); if (wt != null) { if (DEBUG_TOKEN_MOVEMENT || DEBUG_REORDER) { Slog.v(TAG, "Adding next to top: " + wt); if (displayContent != null && displayContent != mTaskIdToDisplayContents.get(wt.groupId)) Slog.e( TAG, "moveAppTokensToTop: Not all tokens on same display"); } displayContent = mTaskIdToDisplayContents.get(wt.groupId); displayContent.mAppTokens.add(wt); if (mAppTransition.isTransitionSet()) { wt.sendingToBottom = false; } } } displayContent.refillAnimatingAppTokens(); moveAppWindowsLocked(tokens, displayContent, displayContent.mAppTokens.size()); } Binder.restoreCallingIdentity(origId); } @Override public void moveAppTokensToBottom(List<IBinder> tokens) { if (!checkCallingPermission(android.Manifest.permission.MANAGE_APP_TOKENS, "moveAppTokensToBottom()")) { throw new SecurityException("Requires MANAGE_APP_TOKENS permission"); } final long origId = Binder.clearCallingIdentity(); synchronized(mWindowMap) { DisplayContent displayContent = null; final int N = tokens.size(); if (N > 0) { // animating towards back, hang onto old list for duration of animation. AppWindowToken wt = findAppWindowToken(tokens.get(0)); if (wt != null) { displayContent = mTaskIdToDisplayContents.get(wt.groupId); displayContent.refillAnimatingAppTokens(); } } removeAppTokensLocked(tokens); int pos = 0; for (int i=0; i<N; i++) { AppWindowToken wt = findAppWindowToken(tokens.get(i)); if (wt != null) { if (DEBUG_TOKEN_MOVEMENT) { Slog.v(TAG, "Adding next to bottom: " + wt + " at " + pos); if (displayContent != null && displayContent != mTaskIdToDisplayContents.get(wt.groupId)) Slog.e( TAG, "moveAppTokensToBottom: Not all tokens on same display"); } displayContent = mTaskIdToDisplayContents.get(wt.groupId); displayContent.mAppTokens.add(pos, wt); if (mAppTransition.isTransitionSet()) { wt.sendingToBottom = true; } pos++; } } displayContent.refillAnimatingAppTokens(); moveAppWindowsLocked(tokens, displayContent, 0); } Binder.restoreCallingIdentity(origId); } private void moveTaskWindowsLocked(int taskId) { DisplayContent displayContent = mTaskIdToDisplayContents.get(taskId); if (displayContent == null) { Loading @@ -4756,15 +4492,6 @@ public class WindowManagerService extends IWindowManager.Stub return; } WindowList windows; WindowList windowsAtStart; if (DEBUG_TASK_MOVEMENT) { windows = displayContent.getWindowList(); windowsAtStart = new WindowList(windows); windows.clear(); windows.addAll(mSavedWindows); } TaskList taskList = displayContent.mTaskIdToTaskList.get(taskId); if (taskList == null) { Slog.w(TAG, "moveTaskWindowsLocked: can't find TaskList for taskId=" + taskId); Loading Loading @@ -4793,19 +4520,6 @@ public class WindowManagerService extends IWindowManager.Stub assignLayersLocked(displayContent.getWindowList()); } if (DEBUG_TASK_MOVEMENT) { // Compare windowsAtStart with current windows. if (windowsAtStart.size() != windows.size()) { Slog.e(TAG, "moveTaskWindowsLocked: Mismatch in size!"); } for (int i = 0; i < windowsAtStart.size(); i++) { if (windowsAtStart.get(i) != windows.get(i)) { Slog.e(TAG, "moveTaskWindowsLocked: Mismatch at " + i + " app=" + windowsAtStart.get(i) + " task=" + windows.get(i)); } } } updateFocusedWindowLocked(UPDATE_FOCUS_WILL_PLACE_SURFACES, false /*updateInputWindows*/); mInputMonitor.setUpdateInputWindowsNeededLw(); Loading Loading @@ -4835,7 +4549,6 @@ public class WindowManagerService extends IWindowManager.Stub Slog.e(TAG, "moveTaskToTop: taskId=" + taskId + " not found in mTaskLists"); } displayContent.mTaskLists.add(taskList); displayContent.verifyAppTokens(); displayContent.refillAnimatingAppTokens(); moveTaskWindowsLocked(taskId); Loading Loading @@ -4865,7 +4578,6 @@ public class WindowManagerService extends IWindowManager.Stub Slog.e(TAG, "moveTaskToBottom: taskId=" + taskId + " not found in mTaskLists"); } displayContent.mTaskLists.add(0, taskList); displayContent.verifyAppTokens(); displayContent.refillAnimatingAppTokens(); moveTaskWindowsLocked(taskId); Loading
tools/layoutlib/bridge/src/android/view/IWindowManagerImpl.java +0 −18 Original line number Diff line number Diff line Loading @@ -203,24 +203,6 @@ public class IWindowManagerImpl implements IWindowManager { return false; } @Override public void moveAppToken(int arg0, IBinder arg1) throws RemoteException { // TODO Auto-generated method stub } @Override public void moveAppTokensToBottom(List<IBinder> arg0) throws RemoteException { // TODO Auto-generated method stub } @Override public void moveAppTokensToTop(List<IBinder> arg0) throws RemoteException { // TODO Auto-generated method stub } @Override public IWindowSession openSession(IInputMethodClient arg0, IInputContext arg1) throws RemoteException { Loading