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

Commit 15455bbc authored by Brian Lindahl's avatar Brian Lindahl
Browse files

Invert content priority so higher value is higher priority

Bug: 337330263
Test: atest SurfaceControlPictureProfileTest
Flag: com.android.graphics.libgui.flags.apply_picture_profiles
Change-Id: Ic60782c6cefb7c700d0db6b0ca1e3726ade35cac
parent 505ac56c
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