Loading services/core/java/com/android/server/am/BroadcastQueueModernImpl.java +18 −11 Original line number Diff line number Diff line Loading @@ -508,16 +508,7 @@ class BroadcastQueueModernImpl extends BroadcastQueue { mService.updateOomAdjPendingTargetsLocked(OOM_ADJ_REASON_START_RECEIVER); } if (waitingFor) { mWaitingFor.removeIf((pair) -> { if (pair.first.getAsBoolean()) { pair.second.countDown(); return true; } else { return false; } }); } checkAndRemoveWaitingFor(); traceEnd(cookie); } Loading Loading @@ -1181,6 +1172,9 @@ class BroadcastQueueModernImpl extends BroadcastQueue { mLocalHandler.removeMessages(MSG_DELIVERY_TIMEOUT_HARD, queue); } // Given that a receiver just finished, check if the "waitingFor" conditions are met. checkAndRemoveWaitingFor(); if (early) { // This is an early receiver that was transmitted as part of a group. The delivery // state has been updated but don't make any further decisions. Loading Loading @@ -1509,7 +1503,7 @@ class BroadcastQueueModernImpl extends BroadcastQueue { waitFor(() -> isBeyondBarrierLocked(now, pw)); } public void waitFor(@NonNull BooleanSupplier condition) { private void waitFor(@NonNull BooleanSupplier condition) { final CountDownLatch latch = new CountDownLatch(1); synchronized (mService) { mWaitingFor.add(Pair.create(condition, latch)); Loading @@ -1531,6 +1525,19 @@ class BroadcastQueueModernImpl extends BroadcastQueue { } } private void checkAndRemoveWaitingFor() { if (!mWaitingFor.isEmpty()) { mWaitingFor.removeIf((pair) -> { if (pair.first.getAsBoolean()) { pair.second.countDown(); return true; } else { return false; } }); } } @Override public void forceDelayBroadcastDelivery(@NonNull String targetPackage, long delayedDurationMs) { Loading Loading
services/core/java/com/android/server/am/BroadcastQueueModernImpl.java +18 −11 Original line number Diff line number Diff line Loading @@ -508,16 +508,7 @@ class BroadcastQueueModernImpl extends BroadcastQueue { mService.updateOomAdjPendingTargetsLocked(OOM_ADJ_REASON_START_RECEIVER); } if (waitingFor) { mWaitingFor.removeIf((pair) -> { if (pair.first.getAsBoolean()) { pair.second.countDown(); return true; } else { return false; } }); } checkAndRemoveWaitingFor(); traceEnd(cookie); } Loading Loading @@ -1181,6 +1172,9 @@ class BroadcastQueueModernImpl extends BroadcastQueue { mLocalHandler.removeMessages(MSG_DELIVERY_TIMEOUT_HARD, queue); } // Given that a receiver just finished, check if the "waitingFor" conditions are met. checkAndRemoveWaitingFor(); if (early) { // This is an early receiver that was transmitted as part of a group. The delivery // state has been updated but don't make any further decisions. Loading Loading @@ -1509,7 +1503,7 @@ class BroadcastQueueModernImpl extends BroadcastQueue { waitFor(() -> isBeyondBarrierLocked(now, pw)); } public void waitFor(@NonNull BooleanSupplier condition) { private void waitFor(@NonNull BooleanSupplier condition) { final CountDownLatch latch = new CountDownLatch(1); synchronized (mService) { mWaitingFor.add(Pair.create(condition, latch)); Loading @@ -1531,6 +1525,19 @@ class BroadcastQueueModernImpl extends BroadcastQueue { } } private void checkAndRemoveWaitingFor() { if (!mWaitingFor.isEmpty()) { mWaitingFor.removeIf((pair) -> { if (pair.first.getAsBoolean()) { pair.second.countDown(); return true; } else { return false; } }); } } @Override public void forceDelayBroadcastDelivery(@NonNull String targetPackage, long delayedDurationMs) { Loading