Untangle creation of Task from addition of AppToken in WM.
Makes it easier to follow what is going on and also clean-up in
preparation of stand way for AM to interact with containers in WM.
Test: Existing tests pass and manual testing
Change-Id: I91754b6d974dce2f696453cdaed175efb0f10c73
diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java
index 612af75..aa6e3c7 100644
--- a/services/core/java/com/android/server/wm/Task.java
+++ b/services/core/java/com/android/server/wm/Task.java
@@ -88,12 +88,15 @@
private boolean mIsOnTopLauncher;
Task(int taskId, TaskStack stack, int userId, WindowManagerService service, Rect bounds,
- Configuration overrideConfig, boolean isOnTopLauncher) {
+ Configuration overrideConfig, boolean isOnTopLauncher, int resizeMode,
+ boolean homeTask) {
mTaskId = taskId;
mStack = stack;
mUserId = userId;
mService = service;
mIsOnTopLauncher = isOnTopLauncher;
+ mResizeMode = resizeMode;
+ mHomeTask = homeTask;
setBounds(bounds, overrideConfig);
}
@@ -101,7 +104,8 @@
return mStack.getDisplayContent();
}
- void addAppToken(int addPos, AppWindowToken wtoken, int resizeMode, boolean homeTask) {
+ @Override
+ void addChild(AppWindowToken wtoken, int addPos) {
final int lastPos = mChildren.size();
if (addPos >= lastPos) {
addPos = lastPos;
@@ -118,11 +122,9 @@
if (parent != null) {
parent.removeChild(wtoken);
}
- addChild(wtoken, addPos);
+ super.addChild(wtoken, addPos);
wtoken.mTask = this;
mDeferRemoval = false;
- mResizeMode = resizeMode;
- mHomeTask = homeTask;
}
private boolean hasWindowsAlive() {
@@ -536,7 +538,7 @@
boolean showForAllUsers() {
final int tokensCount = mChildren.size();
- return (tokensCount != 0) && mChildren.get(tokensCount - 1).showForAllUsers;
+ return (tokensCount != 0) && mChildren.get(tokensCount - 1).mShowForAllUsers;
}
boolean inFreeformWorkspace() {