Merge "WindowContainerTransaction: Support PIP Transition" into rvc-dev
This commit is contained in:
@@ -130,6 +130,31 @@ public class WindowContainerTransaction implements Parcelable {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the windowing mode of children of a given root task, without changing
|
||||
* the windowing mode of the Task itself. This can be used during transitions
|
||||
* for example to make the activity render it's fullscreen configuration
|
||||
* while the Task is still in PIP, so you can complete the animation.
|
||||
*
|
||||
* TODO(b/134365562): Can be removed once TaskOrg drives full-screen
|
||||
*/
|
||||
public WindowContainerTransaction setActivityWindowingMode(IWindowContainer container,
|
||||
int windowingMode) {
|
||||
Change chg = getOrCreateChange(container.asBinder());
|
||||
chg.mActivityWindowingMode = windowingMode;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the windowing mode of the given container.
|
||||
*/
|
||||
public WindowContainerTransaction setWindowingMode(IWindowContainer container,
|
||||
int windowingMode) {
|
||||
Change chg = getOrCreateChange(container.asBinder());
|
||||
chg.mWindowingMode = windowingMode;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether a container or any of its children can be focusable. When {@code false}, no
|
||||
* child can be focused; however, when {@code true}, it is still possible for children to be
|
||||
@@ -235,6 +260,9 @@ public class WindowContainerTransaction implements Parcelable {
|
||||
private Rect mPinnedBounds = null;
|
||||
private SurfaceControl.Transaction mBoundsChangeTransaction = null;
|
||||
|
||||
private int mActivityWindowingMode = -1;
|
||||
private int mWindowingMode = -1;
|
||||
|
||||
public Change() {}
|
||||
|
||||
protected Change(Parcel in) {
|
||||
@@ -251,6 +279,17 @@ public class WindowContainerTransaction implements Parcelable {
|
||||
mBoundsChangeTransaction =
|
||||
SurfaceControl.Transaction.CREATOR.createFromParcel(in);
|
||||
}
|
||||
|
||||
mWindowingMode = in.readInt();
|
||||
mActivityWindowingMode = in.readInt();
|
||||
}
|
||||
|
||||
public int getWindowingMode() {
|
||||
return mWindowingMode;
|
||||
}
|
||||
|
||||
public int getActivityWindowingMode() {
|
||||
return mActivityWindowingMode;
|
||||
}
|
||||
|
||||
public Configuration getConfiguration() {
|
||||
@@ -340,6 +379,9 @@ public class WindowContainerTransaction implements Parcelable {
|
||||
if (mBoundsChangeTransaction != null) {
|
||||
mBoundsChangeTransaction.writeToParcel(dest, flags);
|
||||
}
|
||||
|
||||
dest.writeInt(mWindowingMode);
|
||||
dest.writeInt(mActivityWindowingMode);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -4123,8 +4123,16 @@ class Task extends WindowContainer<WindowContainer> {
|
||||
return mMainWindowSizeChangeTransaction;
|
||||
}
|
||||
|
||||
void setActivityWindowingMode(int windowingMode) {
|
||||
PooledConsumer c = PooledLambda.obtainConsumer(ActivityRecord::setWindowingMode,
|
||||
PooledLambda.__(ActivityRecord.class), windowingMode);
|
||||
forAllActivities(c);
|
||||
c.recycle();
|
||||
}
|
||||
|
||||
@Override
|
||||
long getProtoFieldId() {
|
||||
return TASK;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -553,18 +553,28 @@ class TaskOrganizerController extends ITaskOrganizerController.Stub
|
||||
WindowContainerTransaction.Change c) {
|
||||
int effects = sanitizeAndApplyChange(wc, c);
|
||||
|
||||
final Task tr = wc.asTask();
|
||||
|
||||
final SurfaceControl.Transaction t = c.getBoundsChangeTransaction();
|
||||
if (t != null) {
|
||||
Task tr = (Task) wc;
|
||||
tr.setMainWindowSizeChangeTransaction(t);
|
||||
}
|
||||
|
||||
Rect enterPipBounds = c.getEnterPipBounds();
|
||||
if (enterPipBounds != null) {
|
||||
Task tr = (Task) wc;
|
||||
mService.mStackSupervisor.updatePictureInPictureMode(tr,
|
||||
enterPipBounds, true);
|
||||
}
|
||||
|
||||
final int windowingMode = c.getWindowingMode();
|
||||
if (windowingMode > -1) {
|
||||
tr.setWindowingMode(windowingMode);
|
||||
}
|
||||
final int childWindowingMode = c.getActivityWindowingMode();
|
||||
if (childWindowingMode > -1) {
|
||||
tr.setActivityWindowingMode(childWindowingMode);
|
||||
}
|
||||
|
||||
return effects;
|
||||
}
|
||||
|
||||
|
||||
@@ -240,6 +240,32 @@ public class TaskOrganizerTests extends WindowTestsBase {
|
||||
assertEquals(newBounds, stack.getBounds());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetWindowingMode() {
|
||||
final ActivityStack stack = new ActivityTestsBase.StackBuilder(mWm.mRoot)
|
||||
.setWindowingMode(WINDOWING_MODE_FREEFORM).build();
|
||||
final WindowContainerTransaction t = new WindowContainerTransaction();
|
||||
|
||||
t.setWindowingMode(stack.mRemoteToken, WINDOWING_MODE_FULLSCREEN);
|
||||
mWm.mAtmService.mTaskOrganizerController.applyContainerTransaction(t, null);
|
||||
|
||||
assertEquals(WINDOWING_MODE_FULLSCREEN, stack.getWindowingMode());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetActivityWindowingMode() {
|
||||
final ActivityRecord record = makePipableActivity();
|
||||
final ActivityStack stack = record.getStack();
|
||||
final WindowContainerTransaction t = new WindowContainerTransaction();
|
||||
|
||||
t.setWindowingMode(stack.mRemoteToken, WINDOWING_MODE_PINNED);
|
||||
t.setActivityWindowingMode(stack.mRemoteToken, WINDOWING_MODE_FULLSCREEN);
|
||||
mWm.mAtmService.mTaskOrganizerController.applyContainerTransaction(t, null);
|
||||
|
||||
assertEquals(WINDOWING_MODE_FULLSCREEN, record.getWindowingMode());
|
||||
assertEquals(WINDOWING_MODE_PINNED, stack.getWindowingMode());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testContainerChanges() {
|
||||
removeGlobalMinSizeRestriction();
|
||||
|
||||
Reference in New Issue
Block a user