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

Commit 72c28487 authored by TeYuan Wang's avatar TeYuan Wang Committed by Kame(TeYuan) Wang
Browse files

thermal: support more temperature and cooling device type

Bug: 312540064
Test: make framework
Change-Id: Ia27a2608ae05c1a9d033e52f8d0244c886163112
parent 6627a307
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -106,7 +106,7 @@ filegroup {
        ":android.hardware.radio.voice-V3-java-source",
        ":android.hardware.security.keymint-V3-java-source",
        ":android.hardware.security.secureclock-V1-java-source",
        ":android.hardware.thermal-V1-java-source",
        ":android.hardware.thermal-V2-java-source",
        ":android.hardware.tv.tuner-V2-java-source",
        ":android.security.apc-java-source",
        ":android.security.authorization-java-source",
+14 −2
Original line number Diff line number Diff line
@@ -55,7 +55,11 @@ public final class CoolingDevice implements Parcelable {
            TYPE_TPU,
            TYPE_POWER_AMPLIFIER,
            TYPE_DISPLAY,
            TYPE_SPEAKER
            TYPE_SPEAKER,
            TYPE_WIFI,
            TYPE_CAMERA,
            TYPE_FLASHLIGHT,
            TYPE_USB_PORT
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface Type {}
@@ -84,6 +88,14 @@ public final class CoolingDevice implements Parcelable {
    public static final int TYPE_DISPLAY = CoolingType.DISPLAY;
    /** Speaker cooling device */
    public static final int TYPE_SPEAKER = CoolingType.SPEAKER;
    /** WiFi cooling device */
    public static final int TYPE_WIFI = CoolingType.WIFI;
    /** Camera cooling device */
    public static final int TYPE_CAMERA = CoolingType.CAMERA;
    /** Flashlight cooling device */
    public static final int TYPE_FLASHLIGHT = CoolingType.FLASHLIGHT;
    /** USB PORT cooling device */
    public static final int TYPE_USB_PORT = CoolingType.USB_PORT;

    /**
     * Verify a valid cooling device type.
@@ -91,7 +103,7 @@ public final class CoolingDevice implements Parcelable {
     * @return true if a cooling device type is valid otherwise false.
     */
    public static boolean isValidType(@Type int type) {
        return type >= TYPE_FAN && type <= TYPE_SPEAKER;
        return type >= TYPE_FAN && type <= TYPE_USB_PORT;
    }

    public CoolingDevice(long value, @Type int type, @NonNull String name) {
+14 −2
Original line number Diff line number Diff line
@@ -79,7 +79,13 @@ public final class Temperature implements Parcelable {
            TYPE_TPU,
            TYPE_DISPLAY,
            TYPE_MODEM,
            TYPE_SOC
            TYPE_SOC,
            TYPE_WIFI,
            TYPE_CAMERA,
            TYPE_FLASHLIGHT,
            TYPE_SPEAKER,
            TYPE_AMBIENT,
            TYPE_POGO
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface Type {}
@@ -101,6 +107,12 @@ public final class Temperature implements Parcelable {
    public static final int TYPE_DISPLAY = TemperatureType.DISPLAY;
    public static final int TYPE_MODEM = TemperatureType.MODEM;
    public static final int TYPE_SOC = TemperatureType.SOC;
    public static final int TYPE_WIFI = TemperatureType.WIFI;
    public static final int TYPE_CAMERA = TemperatureType.CAMERA;
    public static final int TYPE_FLASHLIGHT = TemperatureType.FLASHLIGHT;
    public static final int TYPE_SPEAKER = TemperatureType.SPEAKER;
    public static final int TYPE_AMBIENT = TemperatureType.AMBIENT;
    public static final int TYPE_POGO = TemperatureType.POGO;

    /**
     * Verify a valid Temperature type.
@@ -108,7 +120,7 @@ public final class Temperature implements Parcelable {
     * @return true if a Temperature type is valid otherwise false.
     */
    public static boolean isValidType(@Type int type) {
        return type >= TYPE_UNKNOWN && type <= TYPE_SOC;
        return type >= TYPE_UNKNOWN && type <= TYPE_POGO;
    }

    /**
+30 −0
Original line number Diff line number Diff line
@@ -759,6 +759,36 @@ public class ThermalManagerService extends SystemService {
                    case "NPU":
                        type = Temperature.TYPE_NPU;
                        break;
                    case "TPU":
                        type = Temperature.TYPE_TPU;
                        break;
                    case "DISPLAY":
                        type = Temperature.TYPE_DISPLAY;
                        break;
                    case "MODEM":
                        type = Temperature.TYPE_MODEM;
                        break;
                    case "SOC":
                        type = Temperature.TYPE_SOC;
                        break;
                    case "WIFI":
                        type = Temperature.TYPE_WIFI;
                        break;
                    case "CAMERA":
                        type = Temperature.TYPE_CAMERA;
                        break;
                    case "FLASHLIGHT":
                        type = Temperature.TYPE_FLASHLIGHT;
                        break;
                    case "SPEAKER":
                        type = Temperature.TYPE_SPEAKER;
                        break;
                    case "AMBIENT":
                        type = Temperature.TYPE_AMBIENT;
                        break;
                    case "POGO":
                        type = Temperature.TYPE_POGO;
                        break;
                    default:
                        pw.println("Invalid temperature type: " + typeName);
                        return -1;
+1 −1
Original line number Diff line number Diff line
@@ -187,7 +187,7 @@ cc_defaults {
        "android.hardware.power.stats@1.0",
        "android.hardware.power.stats-V1-ndk",
        "android.hardware.thermal@1.0",
        "android.hardware.thermal-V1-ndk",
        "android.hardware.thermal-V2-ndk",
        "android.hardware.tv.input@1.0",
        "android.hardware.tv.input-V2-ndk",
        "android.hardware.vibrator-V2-cpp",