Merge "Skip broadcasting to a receiver if the receiver seems to be dead"
This commit is contained in:
@@ -415,11 +415,16 @@ public final class BroadcastQueue {
|
|||||||
Intent intent, int resultCode, String data, Bundle extras,
|
Intent intent, int resultCode, String data, Bundle extras,
|
||||||
boolean ordered, boolean sticky, int sendingUser) throws RemoteException {
|
boolean ordered, boolean sticky, int sendingUser) throws RemoteException {
|
||||||
// Send the intent to the receiver asynchronously using one-way binder calls.
|
// Send the intent to the receiver asynchronously using one-way binder calls.
|
||||||
if (app != null && app.thread != null) {
|
if (app != null) {
|
||||||
|
if (app.thread != null) {
|
||||||
// If we have an app thread, do the call through that so it is
|
// If we have an app thread, do the call through that so it is
|
||||||
// correctly ordered with other one-way calls.
|
// correctly ordered with other one-way calls.
|
||||||
app.thread.scheduleRegisteredReceiver(receiver, intent, resultCode,
|
app.thread.scheduleRegisteredReceiver(receiver, intent, resultCode,
|
||||||
data, extras, ordered, sticky, sendingUser, app.repProcState);
|
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 {
|
} else {
|
||||||
receiver.performReceive(intent, resultCode, data, extras, ordered,
|
receiver.performReceive(intent, resultCode, data, extras, ordered,
|
||||||
sticky, sendingUser);
|
sticky, sendingUser);
|
||||||
@@ -661,6 +666,7 @@ public final class BroadcastQueue {
|
|||||||
// (local and remote) isn't kept in the mBroadcastHistory.
|
// (local and remote) isn't kept in the mBroadcastHistory.
|
||||||
r.resultTo = null;
|
r.resultTo = null;
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
|
r.resultTo = null;
|
||||||
Slog.w(TAG, "Failure ["
|
Slog.w(TAG, "Failure ["
|
||||||
+ mQueueName + "] sending broadcast result of "
|
+ mQueueName + "] sending broadcast result of "
|
||||||
+ r.intent, e);
|
+ r.intent, e);
|
||||||
|
|||||||
Reference in New Issue
Block a user