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

Commit c5bcd81d authored by Xiang Wang's avatar Xiang Wang Committed by Android (Google) Code Review
Browse files

Merge "Remove the constants for calculation window size" into main

parents 72061cd0 313c7390
Loading
Loading
Loading
Loading
+4 −8
Original line number Diff line number Diff line
@@ -33617,14 +33617,12 @@ package android.os {
  @FlaggedApi("android.os.cpu_gpu_headrooms") public final class CpuHeadroomParams {
    ctor public CpuHeadroomParams();
    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 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...);
    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_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 {
@@ -33877,13 +33875,11 @@ package android.os {
  @FlaggedApi("android.os.cpu_gpu_headrooms") public final class GpuHeadroomParams {
    ctor public GpuHeadroomParams();
    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 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_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 {
+14 −22
Original line number Diff line number Diff line
@@ -56,15 +56,9 @@ public final class CpuHeadroomParams {
     */
    public static final int CPU_HEADROOM_CALCULATION_TYPE_AVERAGE = 1;

    /**
     * Minimum CPU headroom calculation window size.
     */
    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;
    private static final int CALCULATION_WINDOW_MILLIS_MIN = 50;
    private static final int CALCULATION_WINDOW_MILLIS_MAX = 10000;
    private static final int MAX_TID_COUNT = 5;

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

@@ -141,7 +133,7 @@ public final class CpuHeadroomParams {
     *                                  positive.
     */
    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);
        }
        for (int tid : tids) {
+13 −22
Original line number Diff line number Diff line
@@ -54,15 +54,8 @@ public final class GpuHeadroomParams {
     */
    public static final int GPU_HEADROOM_CALCULATION_TYPE_AVERAGE = 1;

    /**
     * Minimum GPU headroom calculation window size.
     */
    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;
    private static final int CALCULATION_WINDOW_MILLIS_MIN = 50;
    private static final int CALCULATION_WINDOW_MILLIS_MAX = 10000;

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

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