Add system properties for plug type and charging state.

This will allow us to see the initial state in Perfetto traces.

Bug: 265917166
Test: Recorded a trace.
Change-Id: Iedfa3586a0504fdd63455f6b61fed9ce15356c2c
This commit is contained in:
Simon MacMullen
2023-01-19 10:50:39 +00:00
parent 37ea02cabf
commit 36eec1fbf6

View File

@@ -52,6 +52,7 @@ import android.os.ServiceManager;
import android.os.ShellCallback;
import android.os.ShellCommand;
import android.os.SystemClock;
import android.os.SystemProperties;
import android.os.Trace;
import android.os.UEventObserver;
import android.os.UserHandle;
@@ -574,6 +575,10 @@ public final class BatteryService extends SystemService {
EventLog.writeEvent(EventLogTags.BATTERY_STATUS,
mHealthInfo.batteryStatus, mHealthInfo.batteryHealth, mHealthInfo.batteryPresent ? 1 : 0,
mPlugType, mHealthInfo.batteryTechnology);
SystemProperties.set(
"debug.tracing.battery_status",
Integer.toString(mHealthInfo.batteryStatus));
SystemProperties.set("debug.tracing.plug_type", Integer.toString(mPlugType));
}
if (mHealthInfo.batteryLevel != mLastBatteryLevel) {
// Don't do this just from voltage or temperature changes, that is