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

Commit c87d03a0 authored by Rachel Lee's avatar Rachel Lee
Browse files

Rename frame rate selection strategies

SELF -> PROPAGATE (default)
DO_NOT_PROPAGATE -> SELF

No behavioral changes.

Test: atest CtsSurfaceControlTestsStaging
Test: atest SystemPerformanceHinterTests
Bug: 309687765
Change-Id: I82d211109b036c326dfa0a61966ad5987a8bccaa
parent 4c8073d8
Loading
Loading
Loading
Loading
+15 −13
Original line number Diff line number Diff line
@@ -859,29 +859,31 @@ public final class SurfaceControl implements Parcelable {
    /** @hide */
    @Retention(RetentionPolicy.SOURCE)
    @IntDef(prefix = {"FRAME_RATE_SELECTION_STRATEGY_"},
            value = {FRAME_RATE_SELECTION_STRATEGY_SELF,
            value = {FRAME_RATE_SELECTION_STRATEGY_PROPAGATE,
                    FRAME_RATE_SELECTION_STRATEGY_OVERRIDE_CHILDREN,
                    FRAME_RATE_SELECTION_STRATEGY_DO_NOT_PROPAGATE})
                    FRAME_RATE_SELECTION_STRATEGY_SELF})
    public @interface FrameRateSelectionStrategy {}

    // From window.h. Keep these in sync.
    /**
     * Default value. The layer uses its own frame rate specifications, assuming it has any
     * specifications, instead of its parent's. If it does not have its own frame rate
     * specifications, it will try to use its parent's.
     * specifications, it will try to use its parent's. It will propagate its specifications to any
     * descendants that do not have their own.
     *
     * However, {@link #FRAME_RATE_SELECTION_STRATEGY_OVERRIDE_CHILDREN} on an ancestor layer
     * supersedes this behavior, meaning that this layer will inherit the frame rate specifications
     * of that ancestor layer.
     * supersedes this behavior, meaning that this layer will inherit frame rate specifications
     * regardless of whether it has its own.
     * @hide
     */
    public static final int FRAME_RATE_SELECTION_STRATEGY_SELF = 0;
    public static final int FRAME_RATE_SELECTION_STRATEGY_PROPAGATE = 0;

    /**
     * The layer's frame rate specifications will propagate to and override those of its descendant
     * layers.
     * The layer with this strategy has the {@link #FRAME_RATE_SELECTION_STRATEGY_SELF} behavior
     * for itself. This does mean that any parent or ancestor layer that also has the strategy
     *
     * The layer itself has the {@link #FRAME_RATE_SELECTION_STRATEGY_PROPAGATE} behavior.
     * Thus, ancestor layer that also has the strategy
     * {@link #FRAME_RATE_SELECTION_STRATEGY_OVERRIDE_CHILDREN} will override this layer's
     * frame rate specifications.
     * @hide
@@ -889,13 +891,13 @@ public final class SurfaceControl implements Parcelable {
    public static final int FRAME_RATE_SELECTION_STRATEGY_OVERRIDE_CHILDREN = 1;

    /**
     * The layer's frame rate specifications will never propagate to its descendant
     * layers.
     * {@link #FRAME_RATE_SELECTION_STRATEGY_OVERRIDE_CHILDREN} on an ancestor layer supersedes
     * this behavior.
     * The layer's frame rate specifications will not propagate to its descendant
     * layers, even if the descendant layer has no frame rate specifications.
     * However, {@link #FRAME_RATE_SELECTION_STRATEGY_OVERRIDE_CHILDREN} on an ancestor
     * layer supersedes this behavior.
     * @hide
     */
    public static final int FRAME_RATE_SELECTION_STRATEGY_DO_NOT_PROPAGATE = 2;
    public static final int FRAME_RATE_SELECTION_STRATEGY_SELF = 2;

    /**
     * Builder class for {@link SurfaceControl} objects.
+2 −2
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER;
import static android.view.Surface.FRAME_RATE_CATEGORY_DEFAULT;
import static android.view.Surface.FRAME_RATE_CATEGORY_HIGH;
import static android.view.SurfaceControl.FRAME_RATE_SELECTION_STRATEGY_OVERRIDE_CHILDREN;
import static android.view.SurfaceControl.FRAME_RATE_SELECTION_STRATEGY_SELF;
import static android.view.SurfaceControl.FRAME_RATE_SELECTION_STRATEGY_PROPAGATE;

import android.annotation.IntDef;
import android.annotation.NonNull;
@@ -303,7 +303,7 @@ public class SystemPerformanceHinter {
            SurfaceControl displaySurfaceControl = mDisplayRootProvider.getRootForDisplay(
                    session.displayId);
            mTransaction.setFrameRateSelectionStrategy(displaySurfaceControl,
                    FRAME_RATE_SELECTION_STRATEGY_SELF);
                    FRAME_RATE_SELECTION_STRATEGY_PROPAGATE);
            // smoothSwitchOnly is false to request a higher framerate, even if it means switching
            // the display mode will cause would jank on non-VRR devices because keeping a lower
            // refresh rate would mean a poorer user experience.
+7 −7
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ import static android.os.PerformanceHintManager.Session.CPU_LOAD_UP;
import static android.view.Surface.FRAME_RATE_CATEGORY_DEFAULT;
import static android.view.Surface.FRAME_RATE_CATEGORY_HIGH;
import static android.view.SurfaceControl.FRAME_RATE_SELECTION_STRATEGY_OVERRIDE_CHILDREN;
import static android.view.SurfaceControl.FRAME_RATE_SELECTION_STRATEGY_SELF;
import static android.view.SurfaceControl.FRAME_RATE_SELECTION_STRATEGY_PROPAGATE;
import static android.window.SystemPerformanceHinter.HINT_ADPF;
import static android.window.SystemPerformanceHinter.HINT_ALL;
import static android.window.SystemPerformanceHinter.HINT_SF_EARLY_WAKEUP;
@@ -170,7 +170,7 @@ public class SystemPerformanceHinterTests {
        // Verify we call SF
        verify(mTransaction).setFrameRateSelectionStrategy(
                eq(mDefaultDisplayRoot),
                eq(FRAME_RATE_SELECTION_STRATEGY_SELF));
                eq(FRAME_RATE_SELECTION_STRATEGY_PROPAGATE));
        verify(mTransaction).setFrameRateCategory(
                eq(mDefaultDisplayRoot),
                eq(FRAME_RATE_CATEGORY_DEFAULT),
@@ -262,7 +262,7 @@ public class SystemPerformanceHinterTests {
        // Verify we call SF and perf manager to clean up
        verify(mTransaction).setFrameRateSelectionStrategy(
                eq(mDefaultDisplayRoot),
                eq(FRAME_RATE_SELECTION_STRATEGY_SELF));
                eq(FRAME_RATE_SELECTION_STRATEGY_PROPAGATE));
        verify(mTransaction).setFrameRateCategory(
                eq(mDefaultDisplayRoot),
                eq(FRAME_RATE_CATEGORY_DEFAULT),
@@ -283,7 +283,7 @@ public class SystemPerformanceHinterTests {
            // Verify we call SF and perf manager to clean up
            verify(mTransaction).setFrameRateSelectionStrategy(
                    eq(mDefaultDisplayRoot),
                    eq(FRAME_RATE_SELECTION_STRATEGY_SELF));
                    eq(FRAME_RATE_SELECTION_STRATEGY_PROPAGATE));
            verify(mTransaction).setFrameRateCategory(
                    eq(mDefaultDisplayRoot),
                    eq(FRAME_RATE_CATEGORY_DEFAULT),
@@ -334,7 +334,7 @@ public class SystemPerformanceHinterTests {
        // Verify we call SF and perf manager to clean up
        verify(mTransaction).setFrameRateSelectionStrategy(
                eq(mDefaultDisplayRoot),
                eq(FRAME_RATE_SELECTION_STRATEGY_SELF));
                eq(FRAME_RATE_SELECTION_STRATEGY_PROPAGATE));
        verify(mTransaction).setFrameRateCategory(
                eq(mDefaultDisplayRoot),
                eq(FRAME_RATE_CATEGORY_DEFAULT),
@@ -385,7 +385,7 @@ public class SystemPerformanceHinterTests {
        session1.close();
        verify(mTransaction).setFrameRateSelectionStrategy(
                eq(mDefaultDisplayRoot),
                eq(FRAME_RATE_SELECTION_STRATEGY_SELF));
                eq(FRAME_RATE_SELECTION_STRATEGY_PROPAGATE));
        verify(mTransaction).setFrameRateCategory(
                eq(mDefaultDisplayRoot),
                eq(FRAME_RATE_CATEGORY_DEFAULT),
@@ -410,7 +410,7 @@ public class SystemPerformanceHinterTests {
                anyInt());
        verify(mTransaction).setFrameRateSelectionStrategy(
                eq(mSecondaryDisplayRoot),
                eq(FRAME_RATE_SELECTION_STRATEGY_SELF));
                eq(FRAME_RATE_SELECTION_STRATEGY_PROPAGATE));
        verify(mTransaction).setFrameRateCategory(
                eq(mSecondaryDisplayRoot),
                eq(FRAME_RATE_CATEGORY_DEFAULT),
+2 −2
Original line number Diff line number Diff line
@@ -712,8 +712,8 @@ public class GraphicsActivity extends Activity {
            int initialNumEvents = mModeChangedEvents.size();
            parent.setFrameRateSelectionStrategy(parentStrategy);

            // For DoNotPropagate case, we want to test that child gets default behavior
            if (parentStrategy == SurfaceControl.FRAME_RATE_SELECTION_STRATEGY_DO_NOT_PROPAGATE) {
            // For Self case, we want to test that child gets default behavior
            if (parentStrategy == SurfaceControl.FRAME_RATE_SELECTION_STRATEGY_SELF) {
                parent.setFrameRateCategory(Surface.FRAME_RATE_CATEGORY_NO_PREFERENCE);
            } else {
                parent.setFrameRate(parentFrameRate);
+5 −4
Original line number Diff line number Diff line
@@ -111,10 +111,11 @@ public class SurfaceControlTest {
    }

    @Test
    public void testSurfaceControlFrameRateSelectionStrategySelf() throws InterruptedException {
    public void testSurfaceControlFrameRateSelectionStrategyPropagate()
            throws InterruptedException {
        GraphicsActivity activity = mActivityRule.getActivity();
        activity.testSurfaceControlFrameRateSelectionStrategy(
                SurfaceControl.FRAME_RATE_SELECTION_STRATEGY_SELF);
                SurfaceControl.FRAME_RATE_SELECTION_STRATEGY_PROPAGATE);
    }

    @Test
@@ -126,10 +127,10 @@ public class SurfaceControlTest {
    }

    @Test
    public void testSurfaceControlFrameRateSelectionStrategyDoNotPropagate()
    public void testSurfaceControlFrameRateSelectionStrategySelf()
            throws InterruptedException {
        GraphicsActivity activity = mActivityRule.getActivity();
        activity.testSurfaceControlFrameRateSelectionStrategy(
                SurfaceControl.FRAME_RATE_SELECTION_STRATEGY_DO_NOT_PROPAGATE);
                SurfaceControl.FRAME_RATE_SELECTION_STRATEGY_SELF);
    }
}