@@ -1106,7 +1106,12 @@ public void handleMessage(Message msg) {
11061106 mHandler.sendMessageDelayed(nmsg, BROADCAST_TIMEOUT);
11071107 return;
11081108 }
1109- broadcastTimeout();
1109+ // Only process broadcast timeouts if the system is ready. That way
1110+ // PRE_BOOT_COMPLETED broadcasts can't timeout as they are intended
1111+ // to do heavy lifting for system up
1112+ if (mSystemReady) {
1113+ broadcastTimeout();
1114+ }
11101115 } break;
11111116 case PAUSE_TIMEOUT_MSG: {
11121117 IBinder token = (IBinder)msg.obj;
@@ -13116,10 +13121,15 @@ private final void processNextBroadcast(boolean fromMsg) {
1311613121
1311713122 // Ensure that even if something goes awry with the timeout
1311813123 // detection, we catch "hung" broadcasts here, discard them,
13119- // and continue to make progress.
13124+ // and continue to make progress.
13125+ //
13126+ // This is only done if the system is ready so that PRE_BOOT_COMPLETED
13127+ // receivers don't get executed with with timeouts. They're intended for
13128+ // one time heavy lifting after system upgrades and can take
13129+ // significant amounts of time.
1312013130 int numReceivers = (r.receivers != null) ? r.receivers.size() : 0;
13121- long now = SystemClock.uptimeMillis();
13122- if (r.dispatchTime > 0) {
13131+ if (mSystemReady && r.dispatchTime > 0) {
13132+ long now = SystemClock.uptimeMillis();
1312313133 if ((numReceivers > 0) &&
1312413134 (now > r.dispatchTime + (2*BROADCAST_TIMEOUT*numReceivers))) {
1312513135 Slog.w(TAG, "Hung broadcast discarded after timeout failure:"
0 commit comments