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

Commit ee1062e4 authored by Ruben Brunk's avatar Ruben Brunk Committed by Android (Google) Code Review
Browse files

Merge "Include VR throttling limit in hardware properties." into nyc-dev

parents becc3019 946ef641
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -28707,6 +28707,7 @@ package android.os {
    field public static final int TEMPERATURE_CURRENT = 0; // 0x0
    field public static final int TEMPERATURE_SHUTDOWN = 2; // 0x2
    field public static final int TEMPERATURE_THROTTLING = 1; // 0x1
    field public static final int TEMPERATURE_THROTTLING_BELOW_VR_MIN = 3; // 0x3
    field public static final float UNDEFINED_TEMPERATURE = -3.4028235E38f;
  }
+1 −0
Original line number Diff line number Diff line
@@ -30951,6 +30951,7 @@ package android.os {
    field public static final int TEMPERATURE_CURRENT = 0; // 0x0
    field public static final int TEMPERATURE_SHUTDOWN = 2; // 0x2
    field public static final int TEMPERATURE_THROTTLING = 1; // 0x1
    field public static final int TEMPERATURE_THROTTLING_BELOW_VR_MIN = 3; // 0x3
    field public static final float UNDEFINED_TEMPERATURE = -3.4028235E38f;
  }
+1 −0
Original line number Diff line number Diff line
@@ -28772,6 +28772,7 @@ package android.os {
    field public static final int TEMPERATURE_CURRENT = 0; // 0x0
    field public static final int TEMPERATURE_SHUTDOWN = 2; // 0x2
    field public static final int TEMPERATURE_THROTTLING = 1; // 0x1
    field public static final int TEMPERATURE_THROTTLING_BELOW_VR_MIN = 3; // 0x3
    field public static final float UNDEFINED_TEMPERATURE = -3.4028235E38f;
  }
+11 −2
Original line number Diff line number Diff line
@@ -48,7 +48,8 @@ public class HardwarePropertiesManager {
     */
    @Retention(RetentionPolicy.SOURCE)
    @IntDef({
        TEMPERATURE_CURRENT, TEMPERATURE_THROTTLING, TEMPERATURE_SHUTDOWN
        TEMPERATURE_CURRENT, TEMPERATURE_THROTTLING, TEMPERATURE_SHUTDOWN,
                TEMPERATURE_THROTTLING_BELOW_VR_MIN
    })
    public @interface TemperatureSource {}

@@ -77,6 +78,12 @@ public class HardwarePropertiesManager {
    /** Get shutdown temperature threshold. */
    public static final int TEMPERATURE_SHUTDOWN = 2;

    /**
     * Get throttling temperature threshold above which minimum clockrates for VR mode will not be
     * met.
     */
    public static final int TEMPERATURE_THROTTLING_BELOW_VR_MIN = 3;

    /** Undefined temperature constant. */
    public static final float UNDEFINED_TEMPERATURE = -Float.MAX_VALUE;

@@ -96,7 +103,8 @@ public class HardwarePropertiesManager {
     * {@link #DEVICE_TEMPERATURE_GPU}, {@link #DEVICE_TEMPERATURE_BATTERY} or {@link
     * #DEVICE_TEMPERATURE_SKIN}.
     * @param source source of requested device temperature, one of {@link #TEMPERATURE_CURRENT},
     * {@link #TEMPERATURE_THROTTLING} or {@link #TEMPERATURE_SHUTDOWN}.
     * {@link #TEMPERATURE_THROTTLING}, {@link #TEMPERATURE_THROTTLING_BELOW_VR_MIN} or
     * {@link #TEMPERATURE_SHUTDOWN}.
     * @return an array of requested float device temperatures. Temperature equals to
     *         {@link #UNDEFINED_TEMPERATURE} if undefined.
     *         Empty if platform doesn't provide the queried temperature.
@@ -115,6 +123,7 @@ public class HardwarePropertiesManager {
                    case TEMPERATURE_CURRENT:
                    case TEMPERATURE_THROTTLING:
                    case TEMPERATURE_SHUTDOWN:
                    case TEMPERATURE_THROTTLING_BELOW_VR_MIN:
                        try {
                            return mService.getDeviceTemperatures(mContext.getOpPackageName(), type,
                                    source);
+9 −1
Original line number Diff line number Diff line
@@ -36,7 +36,8 @@ namespace android {
enum {
    TEMPERATURE_CURRENT = 0,
    TEMPERATURE_THROTTLING = 1,
    TEMPERATURE_SHUTDOWN = 2
    TEMPERATURE_SHUTDOWN = 2,
    TEMPERATURE_THROTTLING_BELOW_VR_MIN = 3
};

static struct {
@@ -127,6 +128,13 @@ static jfloatArray nativeGetDeviceTemperatures(JNIEnv *env, jclass /* clazz */,
                                    values[length++] = list[i].shutdown_threshold;
                                }
                                break;
                            case TEMPERATURE_THROTTLING_BELOW_VR_MIN:
                                if (list[i].vr_throttling_threshold == UNKNOWN_TEMPERATURE) {
                                    values[length++] = gUndefinedTemperature;
                                } else {
                                    values[length++] = list[i].vr_throttling_threshold;
                                }
                                break;
                        }
                    }
                }