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

Commit 313c7390 authored by Xiang Wang's avatar Xiang Wang
Browse files

Remove the constants for calculation window size

Bug: 346604998
Bug: 380858230
API-Coverage-Bug: 378780498
Flag: android.os.cpu_gpu_headrooms
Test: atest HeadroomTest PerformanceHintNativeTestCases \
            HintManagerServiceTest PowerHalWrapperAidlTest
Change-Id: I6cf59a95b144600b58b45cb491adb267d758970a
parent 768c9f7d
Loading
Loading
Loading
Loading
+4 −8
Original line number Original line Diff line number Diff line
@@ -33613,14 +33613,12 @@ package android.os {
  @FlaggedApi("android.os.cpu_gpu_headrooms") public final class CpuHeadroomParams {
  @FlaggedApi("android.os.cpu_gpu_headrooms") public final class CpuHeadroomParams {
    ctor public CpuHeadroomParams();
    ctor public CpuHeadroomParams();
    method public int getCalculationType();
    method public int getCalculationType();
    method @IntRange(from=android.os.CpuHeadroomParams.CPU_HEADROOM_CALCULATION_WINDOW_MILLIS_MIN, to=android.os.CpuHeadroomParams.CPU_HEADROOM_CALCULATION_WINDOW_MILLIS_MAX) public long getCalculationWindowMillis();
    method @IntRange(from=0x32, to=0x2710) public long getCalculationWindowMillis();
    method public void setCalculationType(int);
    method public void setCalculationType(int);
    method public void setCalculationWindowMillis(@IntRange(from=android.os.CpuHeadroomParams.CPU_HEADROOM_CALCULATION_WINDOW_MILLIS_MIN, to=android.os.CpuHeadroomParams.CPU_HEADROOM_CALCULATION_WINDOW_MILLIS_MAX) int);
    method public void setCalculationWindowMillis(@IntRange(from=0x32, to=0x2710) int);
    method public void setTids(@NonNull int...);
    method public void setTids(@NonNull int...);
    field public static final int CPU_HEADROOM_CALCULATION_TYPE_AVERAGE = 1; // 0x1
    field public static final int CPU_HEADROOM_CALCULATION_TYPE_AVERAGE = 1; // 0x1
    field public static final int CPU_HEADROOM_CALCULATION_TYPE_MIN = 0; // 0x0
    field public static final int CPU_HEADROOM_CALCULATION_TYPE_MIN = 0; // 0x0
    field public static final int CPU_HEADROOM_CALCULATION_WINDOW_MILLIS_MAX = 10000; // 0x2710
    field public static final int CPU_HEADROOM_CALCULATION_WINDOW_MILLIS_MIN = 50; // 0x32
  }
  }
  public final class CpuUsageInfo implements android.os.Parcelable {
  public final class CpuUsageInfo implements android.os.Parcelable {
@@ -33873,13 +33871,11 @@ package android.os {
  @FlaggedApi("android.os.cpu_gpu_headrooms") public final class GpuHeadroomParams {
  @FlaggedApi("android.os.cpu_gpu_headrooms") public final class GpuHeadroomParams {
    ctor public GpuHeadroomParams();
    ctor public GpuHeadroomParams();
    method public int getCalculationType();
    method public int getCalculationType();
    method @IntRange(from=android.os.GpuHeadroomParams.GPU_HEADROOM_CALCULATION_WINDOW_MILLIS_MIN, to=android.os.GpuHeadroomParams.GPU_HEADROOM_CALCULATION_WINDOW_MILLIS_MAX) public int getCalculationWindowMillis();
    method @IntRange(from=0x32, to=0x2710) public int getCalculationWindowMillis();
    method public void setCalculationType(int);
    method public void setCalculationType(int);
    method public void setCalculationWindowMillis(@IntRange(from=android.os.GpuHeadroomParams.GPU_HEADROOM_CALCULATION_WINDOW_MILLIS_MIN, to=android.os.GpuHeadroomParams.GPU_HEADROOM_CALCULATION_WINDOW_MILLIS_MAX) int);
    method public void setCalculationWindowMillis(@IntRange(from=0x32, to=0x2710) int);
    field public static final int GPU_HEADROOM_CALCULATION_TYPE_AVERAGE = 1; // 0x1
    field public static final int GPU_HEADROOM_CALCULATION_TYPE_AVERAGE = 1; // 0x1
    field public static final int GPU_HEADROOM_CALCULATION_TYPE_MIN = 0; // 0x0
    field public static final int GPU_HEADROOM_CALCULATION_TYPE_MIN = 0; // 0x0
    field public static final int GPU_HEADROOM_CALCULATION_WINDOW_MILLIS_MAX = 10000; // 0x2710
    field public static final int GPU_HEADROOM_CALCULATION_WINDOW_MILLIS_MIN = 50; // 0x32
  }
  }
  public class Handler {
  public class Handler {
+14 −22
Original line number Original line Diff line number Diff line
@@ -56,15 +56,9 @@ public final class CpuHeadroomParams {
     */
     */
    public static final int CPU_HEADROOM_CALCULATION_TYPE_AVERAGE = 1;
    public static final int CPU_HEADROOM_CALCULATION_TYPE_AVERAGE = 1;


    /**
    private static final int CALCULATION_WINDOW_MILLIS_MIN = 50;
     * Minimum CPU headroom calculation window size.
    private static final int CALCULATION_WINDOW_MILLIS_MAX = 10000;
     */
    private static final int MAX_TID_COUNT = 5;
    public static final int CPU_HEADROOM_CALCULATION_WINDOW_MILLIS_MIN = 50;

    /**
     * Maximum CPU headroom calculation window size.
     */
    public static final int CPU_HEADROOM_CALCULATION_WINDOW_MILLIS_MAX = 10000;


    /**
    /**
     * Sets the headroom calculation type.
     * Sets the headroom calculation type.
@@ -99,20 +93,18 @@ public final class CpuHeadroomParams {
     * Sets the headroom calculation window size in milliseconds.
     * Sets the headroom calculation window size in milliseconds.
     * <p>
     * <p>
     *
     *
     * @param windowMillis the window size in milliseconds, ranged from
     * @param windowMillis the window size in milliseconds ranges from [50, 10000]. The smaller the
     *                     [{@link #CPU_HEADROOM_CALCULATION_WINDOW_MILLIS_MIN},
     *                     window size, the larger fluctuation in the headroom value should be
     *                     {@link #CPU_HEADROOM_CALCULATION_WINDOW_MILLIS_MAX}]. The smaller
     *                     expected. The default value can be retrieved from the
     *                     the value, the larger fluctuation in value should be expected. The
     *                     default value can be retrieved from the
     *                     {@link #getCalculationWindowMillis}. The device will try to use the
     *                     {@link #getCalculationWindowMillis}. The device will try to use the
     *                     closest feasible window size to this param.
     *                     closest feasible window size to this param.
     * @throws IllegalArgumentException if the window size is not in allowed range.
     * @throws IllegalArgumentException if the window size is not in allowed range.
     */
     */
    public void setCalculationWindowMillis(
    public void setCalculationWindowMillis(
            @IntRange(from = CPU_HEADROOM_CALCULATION_WINDOW_MILLIS_MIN, to =
            @IntRange(from = CALCULATION_WINDOW_MILLIS_MIN, to =
                    CPU_HEADROOM_CALCULATION_WINDOW_MILLIS_MAX) int windowMillis) {
                    CALCULATION_WINDOW_MILLIS_MAX) int windowMillis) {
        if (windowMillis < CPU_HEADROOM_CALCULATION_WINDOW_MILLIS_MIN
        if (windowMillis < CALCULATION_WINDOW_MILLIS_MIN
                || windowMillis > CPU_HEADROOM_CALCULATION_WINDOW_MILLIS_MAX) {
                || windowMillis > CALCULATION_WINDOW_MILLIS_MAX) {
            throw new IllegalArgumentException("Invalid calculation window: " + windowMillis);
            throw new IllegalArgumentException("Invalid calculation window: " + windowMillis);
        }
        }
        mInternal.calculationWindowMillis = windowMillis;
        mInternal.calculationWindowMillis = windowMillis;
@@ -121,10 +113,10 @@ public final class CpuHeadroomParams {
    /**
    /**
     * Gets the headroom calculation window size in milliseconds.
     * Gets the headroom calculation window size in milliseconds.
     * <p>
     * <p>
     * This will return the default value chosen by the device if not set.
     * This will return the default value chosen by the device if the params is not set.
     */
     */
    public @IntRange(from = CPU_HEADROOM_CALCULATION_WINDOW_MILLIS_MIN, to =
    public @IntRange(from = CALCULATION_WINDOW_MILLIS_MIN, to =
            CPU_HEADROOM_CALCULATION_WINDOW_MILLIS_MAX) long getCalculationWindowMillis() {
            CALCULATION_WINDOW_MILLIS_MAX) long getCalculationWindowMillis() {
        return mInternal.calculationWindowMillis;
        return mInternal.calculationWindowMillis;
    }
    }


@@ -141,7 +133,7 @@ public final class CpuHeadroomParams {
     *                                  positive.
     *                                  positive.
     */
     */
    public void setTids(@NonNull int... tids) {
    public void setTids(@NonNull int... tids) {
        if (tids.length == 0 || tids.length > 5) {
        if (tids.length == 0 || tids.length > MAX_TID_COUNT) {
            throw new IllegalArgumentException("Invalid number of TIDs: " + tids.length);
            throw new IllegalArgumentException("Invalid number of TIDs: " + tids.length);
        }
        }
        for (int tid : tids) {
        for (int tid : tids) {
+13 −22
Original line number Original line Diff line number Diff line
@@ -54,15 +54,8 @@ public final class GpuHeadroomParams {
     */
     */
    public static final int GPU_HEADROOM_CALCULATION_TYPE_AVERAGE = 1;
    public static final int GPU_HEADROOM_CALCULATION_TYPE_AVERAGE = 1;


    /**
    private static final int CALCULATION_WINDOW_MILLIS_MIN = 50;
     * Minimum GPU headroom calculation window size.
    private static final int CALCULATION_WINDOW_MILLIS_MAX = 10000;
     */
    public static final int GPU_HEADROOM_CALCULATION_WINDOW_MILLIS_MIN = 50;

    /**
     * Maximum GPU headroom calculation window size.
     */
    public static final int GPU_HEADROOM_CALCULATION_WINDOW_MILLIS_MAX = 10000;


    /**
    /**
     * Sets the headroom calculation type.
     * Sets the headroom calculation type.
@@ -82,7 +75,7 @@ public final class GpuHeadroomParams {


    /**
    /**
     * Gets the headroom calculation type.
     * Gets the headroom calculation type.
     * Default to {@link #GPU_HEADROOM_CALCULATION_TYPE_MIN} if not set.
     * Default to {@link #GPU_HEADROOM_CALCULATION_TYPE_MIN} if the params is not set.
     */
     */
    public @GpuHeadroomCalculationType int getCalculationType() {
    public @GpuHeadroomCalculationType int getCalculationType() {
        @GpuHeadroomCalculationType int validatedType = switch ((int) mInternal.calculationType) {
        @GpuHeadroomCalculationType int validatedType = switch ((int) mInternal.calculationType) {
@@ -97,20 +90,18 @@ public final class GpuHeadroomParams {
     * Sets the headroom calculation window size in milliseconds.
     * Sets the headroom calculation window size in milliseconds.
     * <p>
     * <p>
     *
     *
     * @param windowMillis the window size in milliseconds, ranged from
     * @param windowMillis the window size in milliseconds ranges from [50, 10000]. The smaller the
     *                     [{@link #GPU_HEADROOM_CALCULATION_WINDOW_MILLIS_MIN},
     *                     window size, the larger fluctuation in the headroom value should be
     *                     {@link #GPU_HEADROOM_CALCULATION_WINDOW_MILLIS_MAX}]. The smaller
     *                     expected. The default value can be retrieved from the
     *                     the value, the larger fluctuation in value should be expected. The
     *                     {@link #getCalculationWindowMillis}. The device will try to use the
     *                     default value can be retrieved from the
     *                     {@link #getCalculationWindowMillis}. If the device will try to use the
     *                     closest feasible window size to this param.
     *                     closest feasible window size to this param.
     * @throws IllegalArgumentException if the window is invalid.
     * @throws IllegalArgumentException if the window is invalid.
     */
     */
    public void setCalculationWindowMillis(
    public void setCalculationWindowMillis(
            @IntRange(from = GPU_HEADROOM_CALCULATION_WINDOW_MILLIS_MIN, to =
            @IntRange(from = CALCULATION_WINDOW_MILLIS_MIN, to =
                    GPU_HEADROOM_CALCULATION_WINDOW_MILLIS_MAX) int windowMillis) {
                    CALCULATION_WINDOW_MILLIS_MAX) int windowMillis) {
        if (windowMillis < GPU_HEADROOM_CALCULATION_WINDOW_MILLIS_MIN
        if (windowMillis < CALCULATION_WINDOW_MILLIS_MIN
                || windowMillis > GPU_HEADROOM_CALCULATION_WINDOW_MILLIS_MAX) {
                || windowMillis > CALCULATION_WINDOW_MILLIS_MAX) {
            throw new IllegalArgumentException("Invalid calculation window: " + windowMillis);
            throw new IllegalArgumentException("Invalid calculation window: " + windowMillis);
        }
        }
        mInternal.calculationWindowMillis = windowMillis;
        mInternal.calculationWindowMillis = windowMillis;
@@ -121,8 +112,8 @@ public final class GpuHeadroomParams {
     * <p>
     * <p>
     * This will return the default value chosen by the device if not set.
     * This will return the default value chosen by the device if not set.
     */
     */
    public @IntRange(from = GPU_HEADROOM_CALCULATION_WINDOW_MILLIS_MIN, to =
    public @IntRange(from = CALCULATION_WINDOW_MILLIS_MIN, to =
            GPU_HEADROOM_CALCULATION_WINDOW_MILLIS_MAX) int getCalculationWindowMillis() {
            CALCULATION_WINDOW_MILLIS_MAX) int getCalculationWindowMillis() {
        return mInternal.calculationWindowMillis;
        return mInternal.calculationWindowMillis;
    }
    }