diff options
author | Craig Mautner <cmautner@google.com> | 2014-07-21 15:26:58 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-07-17 23:22:21 +0000 |
commit | 02fd104f303cb7d55d6af42be8fe7be543e9aba5 (patch) | |
tree | e42cf621dcef08a7394f35ea7370bda7a6a46a7c | |
parent | 3bdbf644d61f46b531838558fabbd5b990fc4913 (diff) | |
parent | 63909886b2e594a9aec27fe6e4e540e97dcde5a6 (diff) | |
download | base-02fd104f303cb7d55d6af42be8fe7be543e9aba5.tar.gz |
Merge "Skip broadcasting to a receiver if the receiver seems to be dead"
-rw-r--r-- | services/java/com/android/server/am/BroadcastQueue.java | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/services/java/com/android/server/am/BroadcastQueue.java b/services/java/com/android/server/am/BroadcastQueue.java index bfb667f8aca0..ea1565332f56 100644 --- a/services/java/com/android/server/am/BroadcastQueue.java +++ b/services/java/com/android/server/am/BroadcastQueue.java @@ -415,11 +415,16 @@ public final class BroadcastQueue { Intent intent, int resultCode, String data, Bundle extras, boolean ordered, boolean sticky, int sendingUser) throws RemoteException { // Send the intent to the receiver asynchronously using one-way binder calls. - if (app != null && app.thread != null) { - // If we have an app thread, do the call through that so it is - // correctly ordered with other one-way calls. - app.thread.scheduleRegisteredReceiver(receiver, intent, resultCode, - data, extras, ordered, sticky, sendingUser, app.repProcState); + if (app != null) { + if (app.thread != null) { + // If we have an app thread, do the call through that so it is + // correctly ordered with other one-way calls. + app.thread.scheduleRegisteredReceiver(receiver, intent, resultCode, + data, extras, ordered, sticky, sendingUser, app.repProcState); + } else { + // Application has died. Receiver doesn't exist. + throw new RemoteException("app.thread must not be null"); + } } else { receiver.performReceive(intent, resultCode, data, extras, ordered, sticky, sendingUser); @@ -661,6 +666,7 @@ public final class BroadcastQueue { // (local and remote) isn't kept in the mBroadcastHistory. r.resultTo = null; } catch (RemoteException e) { + r.resultTo = null; Slog.w(TAG, "Failure [" + mQueueName + "] sending broadcast result of " + r.intent, e); |