Merge changes from topic "oct26b"

* changes:
  Enable "modern" BroadcastQueue by default; take three.
  Subtle fix when queue becomes unrunnable.
This commit is contained in:
Jeff Sharkey
2022-10-26 19:20:03 +00:00
committed by Android (Google) Code Review
3 changed files with 13 additions and 2 deletions

View File

@@ -133,7 +133,7 @@ public class BroadcastConstants {
*/
public boolean MODERN_QUEUE_ENABLED = DEFAULT_MODERN_QUEUE_ENABLED;
private static final String KEY_MODERN_QUEUE_ENABLED = "modern_queue_enabled";
private static final boolean DEFAULT_MODERN_QUEUE_ENABLED = false;
private static final boolean DEFAULT_MODERN_QUEUE_ENABLED = true;
/**
* For {@link BroadcastQueueModernImpl}: Maximum number of process queues to

View File

@@ -831,7 +831,7 @@ class BroadcastProcessQueue {
@NeverCompile
public void dumpLocked(@UptimeMillisLong long now, @NonNull IndentingPrintWriter pw) {
if ((mActive == null) && mPending.isEmpty()) return;
if ((mActive == null) && isEmpty()) return;
pw.print(toShortString());
if (isRunnable()) {
@@ -847,6 +847,10 @@ class BroadcastProcessQueue {
if (mActive != null) {
dumpRecord(now, pw, mActive, mActiveIndex, mActiveBlockedUntilTerminalCount);
}
for (SomeArgs args : mPendingUrgent) {
final BroadcastRecord r = (BroadcastRecord) args.arg1;
dumpRecord(now, pw, r, args.argi1, args.argi2);
}
for (SomeArgs args : mPending) {
final BroadcastRecord r = (BroadcastRecord) args.arg1;
dumpRecord(now, pw, r, args.argi1, args.argi2);

View File

@@ -365,6 +365,13 @@ class BroadcastQueueModernImpl extends BroadcastQueue {
BroadcastProcessQueue nextQueue = queue.runnableAtNext;
final long runnableAt = queue.getRunnableAt();
// When broadcasts are skipped or failed during list traversal, we
// might encounter a queue that is no longer runnable; skip it
if (!queue.isRunnable()) {
queue = nextQueue;
continue;
}
// If queues beyond this point aren't ready to run yet, schedule
// another pass when they'll be runnable
if (runnableAt > now && !waitingFor) {