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

Commit a7234499 authored by Tej Singh's avatar Tej Singh Committed by Maggie White
Browse files

Fix thermal throttling atoms

Adds a ThermalThrottlingSeverityStateChanged atom to replace
ThermalThrottlingStateChanged. The new atom logs per severity level and
temperature type/name.

Test: print-logs and testdrive while injecting a high temperature via
emul_temp
Bug: 119688911

Change-Id: I2fbcae36eec96bd2c484e0d85ca1617f802a79d9
parent f96a3cba
Loading
Loading
Loading
Loading
+25 −9
Original line number Diff line number Diff line
@@ -156,7 +156,7 @@ message Atom {
        KeyValuePairsAtom key_value_pairs_atom = 83 [(allow_from_any_uid) = true];
        VibratorStateChanged vibrator_state_changed = 84;
        DeferredJobStatsReported deferred_job_stats_reported = 85;
        ThermalThrottlingStateChanged thermal_throttling = 86;
        ThermalThrottlingStateChanged thermal_throttling = 86 [deprecated=true];
        BiometricAcquired biometric_acquired = 87;
        BiometricAuthenticated biometric_authenticated = 88;
        BiometricErrorOccurred biometric_error_occurred = 89;
@@ -280,6 +280,7 @@ message Atom {
        BluetoothClassOfDeviceReported bluetooth_class_of_device_reported = 187;
        IntelligenceEventReported intelligence_event_reported =
            188 [(log_from_module) = "intelligence"];
        ThermalThrottlingSeverityStateChanged thermal_throttling_severity_state_changed = 189;
    }

    // Pulled events will start at field 10000.
@@ -409,6 +410,7 @@ message KeyValuePairsAtom {
 */

/**
 * This atom is deprecated starting in Q. Please use ThermalThrottlingSeverityStateChanged.
 * Logs when the Thermal service HAL notifies the throttling start/stop events.
 *
 * Logged from:
@@ -426,14 +428,7 @@ message ThermalThrottlingStateChanged {
    }
    optional State state = 2;

    // Temperature in deci degrees celsius
    optional float temperature = 3;

    // Severity of throttling
    optional android.os.ThrottlingSeverityEnum severity = 4;

    // Thermistor name
    optional string sensor_name = 5;
}

/**
@@ -2363,6 +2358,27 @@ message BatteryCausedShutdown {
    optional int32 last_recorded_micro_volt = 1;
}

/**
 * Logs when ThermalService receives throttling events.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
 */
message ThermalThrottlingSeverityStateChanged {
    // The type of temperature being reported (CPU, GPU, SKIN, etc)
    optional android.os.TemperatureTypeEnum sensor_type = 1;

    // The name of the temperature source. Eg. CPU0
    optional string sensor_name = 2;

    // Temperature in tenths of a degree C.
    // For BCL, it is decimillivolt, decimilliamps, and percentage * 10.
    optional int32 temperature_deci_celsius = 3;

    // Relative severity of the throttling, see enum definition.
    optional android.os.ThrottlingSeverityEnum severity = 4;
}

/**
 * Logs the duration of a davey (jank of >=700ms) when it occurs
 *
+2 −3
Original line number Diff line number Diff line
@@ -2562,9 +2562,8 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
    private static final class ThermalEventListener extends IThermalEventListener.Stub {
        @Override
        public void notifyThrottling(Temperature temp) {
            StatsLog.write(StatsLog.THERMAL_THROTTLING, temp.getType(),
                    StatsLog.THERMAL_THROTTLING_STATE_CHANGED__STATE__UNKNOWN,
                    temp.getValue(), temp.getStatus(), temp.getName());
            StatsLog.write(StatsLog.THERMAL_THROTTLING_SEVERITY_STATE_CHANGED, temp.getType(),
                    temp.getName(), (int) (temp.getValue() * 10), temp.getStatus());
        }
    }