Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 21ea187c authored by chaviw's avatar chaviw
Browse files

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
parent 9511c45e
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -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() {
+4 −4
Original line number Diff line number Diff line
@@ -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.