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

Commit 8f26826b authored by Nilesh Poddar's avatar Nilesh Poddar Committed by Steve Kondik
Browse files

Fix tracking of broadcast reference count

Decrement the mBroadcastrefCount when an element is
deleted from mTriggeredUids list. And in failure case
reset mBroadcastRefCount to 0.

Change-Id: Id002bb7a8439ef93eabe031bf318bd424cefc88b
parent d995f0e9
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -1632,11 +1632,11 @@ class AlarmManagerService extends IAlarmManager.Stub {
                } else {
                    mLog.w("No in-flight alarm for " + pi + " " + intent);
                }
                mTriggeredUids.remove(new Integer(uid));
                if(mBlockedUids.contains(new Integer(uid))) {
                    mBlockedUids.remove(new Integer(uid));
                } else {
                    if(mBroadcastRefCount > 0){
                        mTriggeredUids.remove(new Integer(uid));
                        mBroadcastRefCount--;
                        if (mBroadcastRefCount == 0) {
                            mWakeLock.release();
@@ -1664,7 +1664,8 @@ class AlarmManagerService extends IAlarmManager.Stub {
                        // should never happen
                        try {
                        mLog.w("Alarm wakelock still held but sent queue empty");
                        mWakeLock.setWorkSource(null);
                        mBroadcastRefCount = 0;
                        mWakeLock.release();
                        } catch (IllegalArgumentException ex) {
                            ex.printStackTrace();
                        }