Skip to content

Commit 9a6e13c

Browse files
committed
Set broadcast nextReceiver correctly when package is disabled
When we are cleaning up broadcat receivers due to a package been disabled, it is possible to remove enough recievers to cause the nextReceiver index to be greater than the size of recievers list. We now set the nextReceiver to the size of the receiver list (which means done processing) for this case. Bug: 22874330 Change-Id: Ie151d1b5bff4c11533b3a8635fe5ee82eb21c13c
1 parent 405eceb commit 9a6e13c

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

services/core/java/com/android/server/am/BroadcastRecord.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,12 @@ boolean cleanupDisabledPackageReceiversLocked(
240240
}
241241
didSomething = true;
242242
receivers.remove(i);
243+
if (i < nextReceiver) {
244+
nextReceiver--;
245+
}
243246
}
244247
}
248+
nextReceiver = Math.min(nextReceiver, receivers.size());
245249

246250
return didSomething;
247251
}

0 commit comments

Comments
 (0)