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

Commit 7c4ce2fb authored by Brian Lindahl's avatar Brian Lindahl Committed by Android (Google) Code Review
Browse files

Merge "Invert content priority so higher value is higher priority" into main

parents fc3f2de6 15455bbc
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -4671,8 +4671,7 @@ public final class SurfaceControl implements Parcelable {
         * Sets the importance the layer's contents has to the app's user experience.
         * <p>
         * When a two layers within the same app are competing for a limited rendering resource,
         * the priority will determine which layer gets access to the resource. The lower the
         * priority, the more likely the layer will get access to the resource.
         * the layer with the highest priority will gets access to the resource.
         * <p>
         * Resources managed by this priority:
         * <ul>
+5 −7
Original line number Diff line number Diff line
@@ -203,12 +203,10 @@ public class SurfaceControlPictureProfileTest {
            transaction
                    .setBuffer(mSurfaceControls[i], buffer)
                    .setPictureProfileHandle(mSurfaceControls[i], handle)
                    .setContentPriority(mSurfaceControls[i], 0);
                    .setContentPriority(mSurfaceControls[i], 1);
        }
        // Make the first layer low priority (high value)
        transaction.setContentPriority(mSurfaceControls[0], 2);
        // Make the last layer higher priority (lower value)
        transaction.setContentPriority(mSurfaceControls[maxPictureProfiles], 1);
        transaction.setContentPriority(mSurfaceControls[0], -1);
        transaction.setContentPriority(mSurfaceControls[maxPictureProfiles], 0);
        transaction.apply();

        pictures = pollMs(picturesQueue, 200);
@@ -219,8 +217,8 @@ public class SurfaceControlPictureProfileTest {
        assertThat(stream(pictures).map(picture -> picture.getPictureProfileHandle().getId()))
                .containsExactlyElementsIn(toIterableRange(2, maxPictureProfiles + 1));

        // Change priority and ensure that the first layer gets access
        new SurfaceControl.Transaction().setContentPriority(mSurfaceControls[0], 0).apply();
        // Elevate priority for the first layer and verify it gets to use a profile
        new SurfaceControl.Transaction().setContentPriority(mSurfaceControls[0], 2).apply();
        pictures = pollMs(picturesQueue, 200);
        assertThat(pictures).isNotNull();
        // Expect all but the last layer to be listed as an active picture