Allow Tasks to set some properties for migrated SC

Tasks had an overriden makeSurface that automatically made it a color
layer and added metadata. If the Task SC is transferred, it won't get
those values since we no longer are calling makeSurface. Instead have
Task override setInitialSurfaceControlProperties so it can set the
desired values on the builder.

Test: Exit pip and see that new Task is color and has taskId
Bug: 153579514
Change-Id: I78b887fb7bf4e273ed8e8283ae6287f8fcfb2596
This commit is contained in:
chaviw
2020-05-28 17:26:38 -07:00
parent 9511c45efc
commit 21ea187cfb
2 changed files with 7 additions and 6 deletions

View File

@@ -3209,8 +3209,9 @@ class Task extends WindowContainer<WindowContainer> {
}
@Override
SurfaceControl.Builder makeSurface() {
return super.makeSurface().setColorLayer().setMetadata(METADATA_TASK_ID, mTaskId);
void setInitialSurfaceControlProperties(SurfaceControl.Builder b) {
b.setColorLayer().setMetadata(METADATA_TASK_ID, mTaskId);
super.setInitialSurfaceControlProperties(b);
}
boolean isTaskAnimating() {

View File

@@ -399,11 +399,11 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
}
void createSurfaceControl(boolean force) {
setInitialSurfaceControlProperties(makeSurface().build());
setInitialSurfaceControlProperties(makeSurface());
}
private void setInitialSurfaceControlProperties(SurfaceControl surfaceControl) {
setSurfaceControl(surfaceControl);
void setInitialSurfaceControlProperties(SurfaceControl.Builder b) {
setSurfaceControl(b.build());
getSyncTransaction().show(mSurfaceControl);
onSurfaceShown(getSyncTransaction());
updateSurfacePosition();
@@ -431,7 +431,7 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
.setContainerLayer()
.setName(getName());
setInitialSurfaceControlProperties(b.build());
setInitialSurfaceControlProperties(b);
// If parent is null, the layer should be placed offscreen so reparent to null. Otherwise,
// set to the available parent.