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

Commit 3248b476 authored by Suprabh Shukla's avatar Suprabh Shukla
Browse files

Fix NPE and turn on logging for device-idle alarms

Test: Manually, using shell commands:
adb shell dumpsys battery unplug
adb shell dumpsys deviceidle force-idle deep
should not cause a crash. Also the output of the logging can be verified
by running:
adb shell dumpsys alarm

Bug: 178687870
Change-Id: Ib085aae73571ff5bfc841a1cc44337c0f7dc64d2
parent 00951f6c
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -151,7 +151,8 @@ public class AlarmManagerService extends SystemService {
    static final boolean DEBUG_BG_LIMIT = localLOGV || false;
    static final boolean DEBUG_STANDBY = localLOGV || false;
    static final boolean RECORD_ALARMS_IN_HISTORY = true;
    static final boolean RECORD_DEVICE_IDLE_ALARMS = false;
    // TODO(b/178484639) : Turn off once alarms and reminders work is complete.
    static final boolean RECORD_DEVICE_IDLE_ALARMS = true;
    static final String TIMEZONE_PROPERTY = "persist.sys.timezone";

    static final int TICK_HISTORY_DEPTH = 10;
@@ -1731,8 +1732,8 @@ public class AlarmManagerService extends SystemService {
            if (RECORD_DEVICE_IDLE_ALARMS) {
                IdleDispatchEntry ent = new IdleDispatchEntry();
                ent.uid = a.uid;
                ent.pkg = a.operation.getCreatorPackage();
                ent.tag = a.operation.getTag("");
                ent.pkg = a.sourcePackage;
                ent.tag = a.statsTag;
                ent.op = "START IDLE";
                ent.elapsedRealtime = mInjector.getElapsedRealtime();
                ent.argRealtime = a.getWhenElapsed();
@@ -3151,8 +3152,8 @@ public class AlarmManagerService extends SystemService {
                if (RECORD_DEVICE_IDLE_ALARMS) {
                    IdleDispatchEntry ent = new IdleDispatchEntry();
                    ent.uid = alarm.uid;
                    ent.pkg = alarm.operation.getCreatorPackage();
                    ent.tag = alarm.operation.getTag("");
                    ent.pkg = alarm.sourcePackage;
                    ent.tag = alarm.statsTag;
                    ent.op = "END IDLE";
                    ent.elapsedRealtime = mInjector.getElapsedRealtime();
                    ent.argRealtime = alarm.getWhenElapsed();