Fix "alarms in flight?" reporting

Autoboxing considered harmful: attempting to obtain a Message with a
particular int value for arg1 was instead matching the supplied-Object
obtainer because of it.

Bug: 207352051
Test: atest FrameworksMockingServicesTests:com.android.server.alarm
Test: atest com.android.server.DeviceIdleControllerTest
Change-Id: I759ef29342cc64fa72f941f6f21f0909bbd2fe4b
This commit is contained in:
Christopher Tate
2021-11-22 10:58:09 -08:00
committed by Chris Tate
parent 3a5489c63c
commit e66bcb43a1

View File

@@ -5142,7 +5142,7 @@ public class AlarmManagerService extends SystemService {
Slog.d(TAG, "mBroadcastRefCount -> " + mBroadcastRefCount);
}
if (mBroadcastRefCount == 0) {
mHandler.obtainMessage(AlarmHandler.REPORT_ALARMS_ACTIVE, 0).sendToTarget();
mHandler.obtainMessage(AlarmHandler.REPORT_ALARMS_ACTIVE, 0, 0).sendToTarget();
mWakeLock.release();
if (mInFlight.size() > 0) {
mLog.w("Finished all dispatches with " + mInFlight.size()
@@ -5314,7 +5314,7 @@ public class AlarmManagerService extends SystemService {
if (mBroadcastRefCount == 0) {
setWakelockWorkSource(alarm.workSource, alarm.creatorUid, alarm.statsTag, true);
mWakeLock.acquire();
mHandler.obtainMessage(AlarmHandler.REPORT_ALARMS_ACTIVE, 1).sendToTarget();
mHandler.obtainMessage(AlarmHandler.REPORT_ALARMS_ACTIVE, 1, 0).sendToTarget();
}
final InFlight inflight = new InFlight(AlarmManagerService.this, alarm, nowELAPSED);
mInFlight.add(inflight);