OSDN Git Service

Don't apply broadcast deferral policy to system uids
authorChristopher Tate <ctate@google.com>
Sat, 9 Mar 2019 00:23:06 +0000 (16:23 -0800)
committerChristopher Tate <ctate@google.com>
Mon, 11 Mar 2019 22:38:47 +0000 (15:38 -0700)
Fixes: 127961911
Test: manual
Test: tests/ActivityTests
Change-Id: Ic6fc49db3cc2aabdd2543a7f2fd08b67a7bda0bf

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

index 70733ef..ea23081 100644 (file)
@@ -477,14 +477,22 @@ public final class BroadcastQueue {
         // when processNextBroadcastLocked() next finds this uid as a receiver identity.
         if (!r.timeoutExempt) {
             if (mConstants.SLOW_TIME > 0 && elapsed > mConstants.SLOW_TIME) {
-                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);
+                // 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);
+                    }
                 } else {
-                    Slog.d(TAG_BROADCAST, "finish receiver curApp is null? " + r);
+                    if (DEBUG_BROADCAST_DEFERRAL) {
+                        Slog.i(TAG_BROADCAST, "Core uid " + r.curApp.uid
+                                + " receiver was slow but not deferring: " + receiver + " br=" + r);
+                    }
                 }
             }
         } else {