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

Commit cfecc72b authored by Wei Wang's avatar Wei Wang Committed by android-build-merger
Browse files

Merge "ThermalService: add event log when temperature changed" into qt-qpr1-dev

am: a046613c

Change-Id: Ia9d3677a1335ec61e006700da857e6ca7de1a147
parents ce95274a a046613c
Loading
Loading
Loading
Loading
+6 −0
Original line number Original line Diff line number Diff line
@@ -39,6 +39,12 @@ option java_package com.android.server
27391 user_activity_timeout_override (override|2|3)
27391 user_activity_timeout_override (override|2|3)
27392 battery_saver_setting (threshold|1)
27392 battery_saver_setting (threshold|1)



# ---------------------------
# ThermalManagerService.java
# ---------------------------
2737 thermal_changed (name|3),(type|1|5),(temperature|5),(sensor_status|1|5),(previous_system_status|1|5)

#
#
# Leave IDs through 2740 for more power logs (2730 used by battery_discharge above)
# Leave IDs through 2740 for more power logs (2730 used by battery_discharge above)
#
#
+9 −4
Original line number Original line Diff line number Diff line
@@ -38,11 +38,13 @@ import android.os.ShellCallback;
import android.os.ShellCommand;
import android.os.ShellCommand;
import android.os.Temperature;
import android.os.Temperature;
import android.util.ArrayMap;
import android.util.ArrayMap;
import android.util.EventLog;
import android.util.Slog;
import android.util.Slog;


import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.DumpUtils;
import com.android.internal.util.DumpUtils;
import com.android.server.EventLogTags;
import com.android.server.FgThread;
import com.android.server.FgThread;
import com.android.server.SystemService;
import com.android.server.SystemService;


@@ -250,6 +252,8 @@ public class ThermalManagerService extends SystemService {
        } finally {
        } finally {
            mThermalEventListeners.finishBroadcast();
            mThermalEventListeners.finishBroadcast();
        }
        }
        EventLog.writeEvent(EventLogTags.THERMAL_CHANGED, temperature.getName(),
                temperature.getType(), temperature.getValue(), temperature.getStatus(), mStatus);
    }
    }


    private void shutdownIfNeeded(Temperature temperature) {
    private void shutdownIfNeeded(Temperature temperature) {
@@ -860,10 +864,10 @@ public class ThermalManagerService extends SystemService {
                    mThermalHal11.linkToDeath(new DeathRecipient(),
                    mThermalHal11.linkToDeath(new DeathRecipient(),
                            THERMAL_HAL_DEATH_COOKIE);
                            THERMAL_HAL_DEATH_COOKIE);
                    mThermalHal11.registerThermalCallback(mThermalCallback11);
                    mThermalHal11.registerThermalCallback(mThermalCallback11);
                    Slog.i(TAG, "Thermal HAL 1.1 service connected, limited thermal functions "
                            + "due to legacy API.");
                } catch (NoSuchElementException | RemoteException e) {
                } catch (NoSuchElementException | RemoteException e) {
                    Slog.e(TAG,
                    Slog.e(TAG, "Thermal HAL 1.1 service not connected.");
                            "Thermal HAL 1.1 service not connected, no thermal call back will be "
                                    + "called.");
                    mThermalHal11 = null;
                    mThermalHal11 = null;
                }
                }
                return (mThermalHal11 != null);
                return (mThermalHal11 != null);
@@ -978,8 +982,9 @@ public class ThermalManagerService extends SystemService {
                    mThermalHal20.linkToDeath(new DeathRecipient(), THERMAL_HAL_DEATH_COOKIE);
                    mThermalHal20.linkToDeath(new DeathRecipient(), THERMAL_HAL_DEATH_COOKIE);
                    mThermalHal20.registerThermalChangedCallback(mThermalCallback20, false,
                    mThermalHal20.registerThermalChangedCallback(mThermalCallback20, false,
                            0 /* not used */);
                            0 /* not used */);
                    Slog.i(TAG, "Thermal HAL 2.0 service connected.");
                } catch (NoSuchElementException | RemoteException e) {
                } catch (NoSuchElementException | RemoteException e) {
                    Slog.e(TAG, "Thermal HAL 2.0 service not connected, trying 1.1.");
                    Slog.e(TAG, "Thermal HAL 2.0 service not connected.");
                    mThermalHal20 = null;
                    mThermalHal20 = null;
                }
                }
                return (mThermalHal20 != null);
                return (mThermalHal20 != null);