Fix invalid stackId bug.
Eliminate race condition by executing window manager createStack directly from activity manager. Change-Id: I2dda276d07d0ae09c7c958980bc5ebffe72ebd92
This commit is contained in:
@@ -4817,27 +4817,20 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
}
|
||||
}
|
||||
|
||||
public void createStack(int stackId, int displayId) {
|
||||
mH.sendMessage(mH.obtainMessage(H.CREATE_STACK, stackId, displayId));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new TaskStack and place it next to an existing stack.
|
||||
* Create a new TaskStack and place it on a DisplayContent.
|
||||
* @param stackId The unique identifier of the new stack.
|
||||
* @param displayId The unique identifier of the DisplayContent.
|
||||
*/
|
||||
private void createStackLocked(int stackId, int displayId) {
|
||||
public void createStack(int stackId, int displayId) {
|
||||
final long origId = Binder.clearCallingIdentity();
|
||||
try {
|
||||
synchronized (mWindowMap) {
|
||||
final int numDisplays = mDisplayContents.size();
|
||||
for (int displayNdx = 0; displayNdx < numDisplays; ++displayNdx) {
|
||||
final DisplayContent displayContent = mDisplayContents.valueAt(displayNdx);
|
||||
if (displayContent.getDisplayId() == displayId) {
|
||||
TaskStack stack = displayContent.createStack(stackId);
|
||||
mStackIdToStack.put(stackId, stack);
|
||||
performLayoutAndPlaceSurfacesLocked();
|
||||
return;
|
||||
}
|
||||
final DisplayContent displayContent = mDisplayContents.get(displayId);
|
||||
if (displayContent != null) {
|
||||
TaskStack stack = displayContent.createStack(stackId);
|
||||
mStackIdToStack.put(stackId, stack);
|
||||
performLayoutAndPlaceSurfacesLocked();
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
@@ -7047,8 +7040,6 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
|
||||
public static final int REMOVE_STARTING_TIMEOUT = 33;
|
||||
|
||||
public static final int CREATE_STACK = 34;
|
||||
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
if (DEBUG_WINDOW_TRACE) {
|
||||
@@ -7492,11 +7483,6 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
break;
|
||||
case CREATE_STACK:
|
||||
synchronized (mWindowMap) {
|
||||
createStackLocked(msg.arg1, msg.arg2);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (DEBUG_WINDOW_TRACE) {
|
||||
Slog.v(TAG, "handleMessage: exit");
|
||||
|
||||
Reference in New Issue
Block a user