Skip to content

Commit 21ea187

Browse files
author
chaviw
committed
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
1 parent 9511c45 commit 21ea187

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

services/core/java/com/android/server/wm/Task.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3209,8 +3209,9 @@ void onSurfaceShown(SurfaceControl.Transaction t) {
32093209
}
32103210

32113211
@Override
3212-
SurfaceControl.Builder makeSurface() {
3213-
return super.makeSurface().setColorLayer().setMetadata(METADATA_TASK_ID, mTaskId);
3212+
void setInitialSurfaceControlProperties(SurfaceControl.Builder b) {
3213+
b.setColorLayer().setMetadata(METADATA_TASK_ID, mTaskId);
3214+
super.setInitialSurfaceControlProperties(b);
32143215
}
32153216

32163217
boolean isTaskAnimating() {

services/core/java/com/android/server/wm/WindowContainer.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -399,11 +399,11 @@ void onParentChanged(ConfigurationContainer newParent, ConfigurationContainer ol
399399
}
400400

401401
void createSurfaceControl(boolean force) {
402-
setInitialSurfaceControlProperties(makeSurface().build());
402+
setInitialSurfaceControlProperties(makeSurface());
403403
}
404404

405-
private void setInitialSurfaceControlProperties(SurfaceControl surfaceControl) {
406-
setSurfaceControl(surfaceControl);
405+
void setInitialSurfaceControlProperties(SurfaceControl.Builder b) {
406+
setSurfaceControl(b.build());
407407
getSyncTransaction().show(mSurfaceControl);
408408
onSurfaceShown(getSyncTransaction());
409409
updateSurfacePosition();
@@ -431,7 +431,7 @@ void migrateToNewSurfaceControl() {
431431
.setContainerLayer()
432432
.setName(getName());
433433

434-
setInitialSurfaceControlProperties(b.build());
434+
setInitialSurfaceControlProperties(b);
435435

436436
// If parent is null, the layer should be placed offscreen so reparent to null. Otherwise,
437437
// set to the available parent.

0 commit comments

Comments
 (0)