diff options
| author | 2020-07-10 06:39:54 +0000 | |
|---|---|---|
| committer | 2020-07-10 06:39:54 +0000 | |
| commit | ee77a1bd52c4566e8db60442e8088956290adca3 (patch) | |
| tree | 506f23f008297da22f9460ff3e89dbe1e3dffed5 | |
| parent | d53e749e8acacb8363609685e1c7d4ef99551848 (diff) | |
| parent | b3f96855a8d257991637592c7af2168d89708ce4 (diff) | |
Merge "Don't assume r.curApp is valid when finalizing broadcasts" into rvc-dev am: 33e8dc7978 am: b3f96855a8
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12088000
Change-Id: I7c6635be1fd6ee59bd6102130929665b8293c400
| -rw-r--r-- | services/core/java/com/android/server/am/BroadcastQueue.java | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/services/core/java/com/android/server/am/BroadcastQueue.java b/services/core/java/com/android/server/am/BroadcastQueue.java index 5124c4a4797e..a2eea1348d5c 100644 --- a/services/core/java/com/android/server/am/BroadcastQueue.java +++ b/services/core/java/com/android/server/am/BroadcastQueue.java @@ -470,22 +470,23 @@ public final class BroadcastQueue { // if this receiver was slow, impose deferral policy on the app. This will kick in // when processNextBroadcastLocked() next finds this uid as a receiver identity. if (!r.timeoutExempt) { - if (mConstants.SLOW_TIME > 0 && elapsed > mConstants.SLOW_TIME) { + // r.curApp can be null if finish has raced with process death - benign + // edge case, and we just ignore it because we're already cleaning up + // as expected. + if (r.curApp != null + && mConstants.SLOW_TIME > 0 && elapsed > mConstants.SLOW_TIME) { // Core system packages are exempt from deferral policy if (!UserHandle.isCore(r.curApp.uid)) { if (DEBUG_BROADCAST_DEFERRAL) { Slog.i(TAG_BROADCAST, "Broadcast receiver " + (r.nextReceiver - 1) + " was slow: " + receiver + " br=" + r); } - if (r.curApp != null) { - mDispatcher.startDeferring(r.curApp.uid); - } else { - Slog.d(TAG_BROADCAST, "finish receiver curApp is null? " + r); - } + mDispatcher.startDeferring(r.curApp.uid); } else { if (DEBUG_BROADCAST_DEFERRAL) { Slog.i(TAG_BROADCAST, "Core uid " + r.curApp.uid - + " receiver was slow but not deferring: " + receiver + " br=" + r); + + " receiver was slow but not deferring: " + + receiver + " br=" + r); } } } |