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

Commit 1924d238 authored by Polina Bondarenko's avatar Polina Bondarenko Committed by android-build-merger
Browse files

Merge "Added skin temperature, thresholds to HardwarePropertiesManager" into nyc-dev

am: c1d317f7

* commit 'c1d317f7':
  Added skin temperature, thresholds to HardwarePropertiesManager
parents ded80508 c1d317f7
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -28753,14 +28753,16 @@ package android.os {
  public class HardwarePropertiesManager {
    method public android.os.CpuUsageInfo[] getCpuUsages();
    method public float[] getDeviceTemperatures(int);
    method public float[] getDeviceTemperatures(int, int);
    method public float[] getFanSpeeds();
    field public static final int DEVICE_TEMPERATURE_BATTERY = 2; // 0x2
    field public static final int DEVICE_TEMPERATURE_CPU = 0; // 0x0
    field public static final int DEVICE_TEMPERATURE_GPU = 1; // 0x1
  }
  public static abstract class HardwarePropertiesManager.DeviceTemperatureType implements java.lang.annotation.Annotation {
    field public static final int DEVICE_TEMPERATURE_SKIN = 3; // 0x3
    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 float UNDEFINED_TEMPERATURE = -3.4028235E38f;
  }
  public abstract interface IBinder {
+6 −4
Original line number Diff line number Diff line
@@ -30996,14 +30996,16 @@ package android.os {
  public class HardwarePropertiesManager {
    method public android.os.CpuUsageInfo[] getCpuUsages();
    method public float[] getDeviceTemperatures(int);
    method public float[] getDeviceTemperatures(int, int);
    method public float[] getFanSpeeds();
    field public static final int DEVICE_TEMPERATURE_BATTERY = 2; // 0x2
    field public static final int DEVICE_TEMPERATURE_CPU = 0; // 0x0
    field public static final int DEVICE_TEMPERATURE_GPU = 1; // 0x1
  }
  public static abstract class HardwarePropertiesManager.DeviceTemperatureType implements java.lang.annotation.Annotation {
    field public static final int DEVICE_TEMPERATURE_SKIN = 3; // 0x3
    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 float UNDEFINED_TEMPERATURE = -3.4028235E38f;
  }
  public abstract interface IBinder {
+6 −4
Original line number Diff line number Diff line
@@ -28809,14 +28809,16 @@ package android.os {
  public class HardwarePropertiesManager {
    method public android.os.CpuUsageInfo[] getCpuUsages();
    method public float[] getDeviceTemperatures(int);
    method public float[] getDeviceTemperatures(int, int);
    method public float[] getFanSpeeds();
    field public static final int DEVICE_TEMPERATURE_BATTERY = 2; // 0x2
    field public static final int DEVICE_TEMPERATURE_CPU = 0; // 0x0
    field public static final int DEVICE_TEMPERATURE_GPU = 1; // 0x1
  }
  public static abstract class HardwarePropertiesManager.DeviceTemperatureType implements java.lang.annotation.Annotation {
    field public static final int DEVICE_TEMPERATURE_SKIN = 3; // 0x3
    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 float UNDEFINED_TEMPERATURE = -3.4028235E38f;
  }
  public abstract interface IBinder {
+60 −16
Original line number Diff line number Diff line
@@ -33,12 +33,25 @@ public class HardwarePropertiesManager {

    private final IHardwarePropertiesManager mService;

    /**
     * @hide
     */
    @Retention(RetentionPolicy.SOURCE)
    @IntDef({
        DEVICE_TEMPERATURE_CPU, DEVICE_TEMPERATURE_GPU, DEVICE_TEMPERATURE_BATTERY
        DEVICE_TEMPERATURE_CPU, DEVICE_TEMPERATURE_GPU, DEVICE_TEMPERATURE_BATTERY,
                DEVICE_TEMPERATURE_SKIN
    })
    public @interface DeviceTemperatureType {}

    /**
     * @hide
     */
    @Retention(RetentionPolicy.SOURCE)
    @IntDef({
        TEMPERATURE_CURRENT, TEMPERATURE_THROTTLING, TEMPERATURE_SHUTDOWN
    })
    public @interface TemperatureSource {}

    /**
     * Device temperature types. These must match the values in
     * frameworks/native/include/hardwareproperties/HardwarePropertiesManager.h
@@ -52,6 +65,21 @@ public class HardwarePropertiesManager {
    /** Temperature of battery in Celsius. */
    public static final int DEVICE_TEMPERATURE_BATTERY = 2;

    /** Temperature of device skin in Celsius. */
    public static final int DEVICE_TEMPERATURE_SKIN = 3;

    /** Get current temperature. */
    public static final int TEMPERATURE_CURRENT = 0;

    /** Get throttling temperature threshold. */
    public static final int TEMPERATURE_THROTTLING = 1;

    /** Get shutdown temperature threshold. */
    public static final int TEMPERATURE_SHUTDOWN = 2;

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

    /** Calling app context. */
    private final Context mContext;

@@ -65,22 +93,37 @@ public class HardwarePropertiesManager {
     * Return an array of device temperatures in Celsius.
     *
     * @param type type of requested device temperature, one of {@link #DEVICE_TEMPERATURE_CPU},
     * {@link #DEVICE_TEMPERATURE_GPU} or {@link #DEVICE_TEMPERATURE_BATTERY}.
     * @return an array of requested float device temperatures.
     * {@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}.
     * @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.
     *
     * @throws SecurityException if a non profile or device owner tries to call this method.
    */
    public @NonNull float[] getDeviceTemperatures(@DeviceTemperatureType int type) {
    public @NonNull float[] getDeviceTemperatures(@DeviceTemperatureType int type,
            @TemperatureSource int source) {
        switch (type) {
            case DEVICE_TEMPERATURE_CPU:
            case DEVICE_TEMPERATURE_GPU:
            case DEVICE_TEMPERATURE_BATTERY:
            case DEVICE_TEMPERATURE_SKIN:
                switch (source) {
                    case TEMPERATURE_CURRENT:
                    case TEMPERATURE_THROTTLING:
                    case TEMPERATURE_SHUTDOWN:
                        try {
                return mService.getDeviceTemperatures(mContext.getOpPackageName(), type);
                            return mService.getDeviceTemperatures(mContext.getOpPackageName(), type,
                                    source);
                        } catch (RemoteException e) {
                            throw e.rethrowFromSystemServer();
                        }
                    default:
                        Log.w(TAG, "Unknown device temperature source.");
                        return new float[0];
                }
            default:
                Log.w(TAG, "Unknown device temperature type.");
                return new float[0];
@@ -90,7 +133,8 @@ public class HardwarePropertiesManager {
    /**
     * Return an array of CPU usage info for each core.
     *
     * @return an array of {@link android.os.CpuUsageInfo} for each core.
     * @return an array of {@link android.os.CpuUsageInfo} for each core. Return {@code null} for
     *         each unplugged core.
     *         Empty if CPU usage is not supported on this system.
     *
     * @throws SecurityException if a non profile or device owner tries to call this method.
+1 −1
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ import android.os.CpuUsageInfo;
/** @hide */

interface IHardwarePropertiesManager {
    float[] getDeviceTemperatures(String callingPackage, int type);
    float[] getDeviceTemperatures(String callingPackage, int type, int source);
    CpuUsageInfo[] getCpuUsages(String callingPackage);
    float[] getFanSpeeds(String callingPackage);
}
Loading