Make PINNED mode alwaysCreateStack
Now that we don't have a re-used pinned stack anymore, this is how it should be. This also helps CTS align closer to actual app usage. Also don't perform transactions on detached containers (but log an error). This is because CTS triggers various pip events which fire callbacks after the test tears-down. Bug: 153201813 Test: PinnedStackTests pass Change-Id: I57bf4db35f7c05c18a69d2bf39b66ccca07d39f2
This commit is contained in:
@@ -783,6 +783,11 @@ class ActivityStack extends Task {
|
||||
if (currentMode == WINDOWING_MODE_PINNED) {
|
||||
mAtmService.getTaskChangeNotificationController().notifyActivityUnpinned();
|
||||
}
|
||||
if (likelyResolvedMode == WINDOWING_MODE_PINNED
|
||||
&& taskDisplayArea.getRootPinnedTask() != null) {
|
||||
// Can only have 1 pip at a time, so replace an existing pip
|
||||
taskDisplayArea.getRootPinnedTask().dismissPip();
|
||||
}
|
||||
if (likelyResolvedMode != WINDOWING_MODE_FULLSCREEN
|
||||
&& topActivity != null && !topActivity.noDisplay
|
||||
&& topActivity.isNonResizableOrForcedResizable(likelyResolvedMode)) {
|
||||
|
||||
@@ -25,6 +25,7 @@ import static android.app.WindowConfiguration.ROTATION_UNDEFINED;
|
||||
import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
|
||||
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
|
||||
import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW;
|
||||
import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
|
||||
import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_SECONDARY;
|
||||
import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
|
||||
import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSET;
|
||||
@@ -5028,6 +5029,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
|
||||
return activityType == ACTIVITY_TYPE_STANDARD
|
||||
&& (windowingMode == WINDOWING_MODE_FULLSCREEN
|
||||
|| windowingMode == WINDOWING_MODE_FREEFORM
|
||||
|| windowingMode == WINDOWING_MODE_PINNED
|
||||
|| windowingMode == WINDOWING_MODE_SPLIT_SCREEN_SECONDARY
|
||||
|| windowingMode == WINDOWING_MODE_MULTI_WINDOW);
|
||||
}
|
||||
|
||||
@@ -3072,6 +3072,7 @@ class Task extends WindowContainer<WindowContainer> {
|
||||
mForceShowForAllUsers = forceShowForAllUsers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAttached() {
|
||||
final TaskDisplayArea taskDisplayArea = getDisplayArea();
|
||||
return taskDisplayArea != null && !taskDisplayArea.isRemoved();
|
||||
|
||||
@@ -879,6 +879,11 @@ final class TaskDisplayArea extends DisplayArea<ActivityStack> {
|
||||
+ windowingMode);
|
||||
}
|
||||
|
||||
if (windowingMode == WINDOWING_MODE_PINNED && getRootPinnedTask() != null) {
|
||||
// Only 1 stack can be PINNED at a time, so dismiss the existing one
|
||||
getRootPinnedTask().dismissPip();
|
||||
}
|
||||
|
||||
final int stackId = getNextStackId();
|
||||
return createStackUnchecked(windowingMode, activityType, stackId, onTop, info, intent,
|
||||
createdByOrganizer);
|
||||
|
||||
@@ -737,6 +737,10 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
|
||||
return parent != null ? parent.getDisplayArea() : null;
|
||||
}
|
||||
|
||||
boolean isAttached() {
|
||||
return getDisplayArea() != null;
|
||||
}
|
||||
|
||||
void setWaitingForDrawnIfResizingChanged() {
|
||||
for (int i = mChildren.size() - 1; i >= 0; --i) {
|
||||
final WindowContainer wc = mChildren.get(i);
|
||||
|
||||
@@ -129,6 +129,10 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
|
||||
final Map.Entry<IBinder, WindowContainerTransaction.Change> entry =
|
||||
entries.next();
|
||||
final WindowContainer wc = WindowContainer.fromBinder(entry.getKey());
|
||||
if (!wc.isAttached()) {
|
||||
Slog.e(TAG, "Attempt to operate on detached container: " + wc);
|
||||
continue;
|
||||
}
|
||||
int containerEffect = applyWindowContainerChange(wc, entry.getValue());
|
||||
effects |= containerEffect;
|
||||
|
||||
@@ -146,6 +150,10 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
|
||||
for (int i = 0, n = hops.size(); i < n; ++i) {
|
||||
final WindowContainerTransaction.HierarchyOp hop = hops.get(i);
|
||||
final WindowContainer wc = WindowContainer.fromBinder(hop.getContainer());
|
||||
if (!wc.isAttached()) {
|
||||
Slog.e(TAG, "Attempt to operate on detached container: " + wc);
|
||||
continue;
|
||||
}
|
||||
effects |= sanitizeAndApplyHierarchyOp(wc, hop);
|
||||
}
|
||||
if ((effects & TRANSACT_EFFECTS_LIFECYCLE) != 0) {
|
||||
|
||||
@@ -172,7 +172,7 @@ public class TaskDisplayAreaTests extends WindowTestsBase {
|
||||
assertGetOrCreateStack(WINDOWING_MODE_SPLIT_SCREEN_PRIMARY, type, candidateTask,
|
||||
false /* reuseCandidate */);
|
||||
assertGetOrCreateStack(WINDOWING_MODE_PINNED, type, candidateTask,
|
||||
false /* reuseCandidate */);
|
||||
true /* reuseCandidate */);
|
||||
|
||||
final int windowingMode = WINDOWING_MODE_FULLSCREEN;
|
||||
assertGetOrCreateStack(windowingMode, ACTIVITY_TYPE_HOME, candidateTask,
|
||||
|
||||
Reference in New Issue
Block a user