diff options
3 files changed, 18 insertions, 4 deletions
diff --git a/core/java/android/app/LoadedApk.java b/core/java/android/app/LoadedApk.java index 7d43a1155e61..3f870005abfe 100644 --- a/core/java/android/app/LoadedApk.java +++ b/core/java/android/app/LoadedApk.java @@ -1046,11 +1046,17 @@ public final class LoadedApk { @Override public void performReceive(Intent intent, int resultCode, String data, Bundle extras, boolean ordered, boolean sticky, int sendingUser) { - LoadedApk.ReceiverDispatcher rd = mDispatcher.get(); + final LoadedApk.ReceiverDispatcher rd; + if (intent == null) { + Log.wtf(TAG, "Null intent received"); + rd = null; + } else { + rd = mDispatcher.get(); + } if (ActivityThread.DEBUG_BROADCAST) { int seq = intent.getIntExtra("seq", -1); - Slog.i(ActivityThread.TAG, "Receiving broadcast " + intent.getAction() + " seq=" + seq - + " to " + (rd != null ? rd.mReceiver : null)); + Slog.i(ActivityThread.TAG, "Receiving broadcast " + intent.getAction() + + " seq=" + seq + " to " + (rd != null ? rd.mReceiver : null)); } if (rd != null) { rd.performReceive(intent, resultCode, data, extras, diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index a0664627629d..a7ea62851520 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -7057,6 +7057,15 @@ public final class ActivityManagerService extends ActivityManagerNative return ((PendingIntentRecord)target).sendWithResult(code, intent, resolvedType, finishedReceiver, requiredPermission, options); } else { + if (intent == null) { + // Weird case: someone has given us their own custom IIntentSender, and now + // they have someone else trying to send to it but of course this isn't + // really a PendingIntent, so there is no base Intent, and the caller isn't + // supplying an Intent... but we never want to dispatch a null Intent to + // a receiver, so um... let's make something up. + Slog.wtf(TAG, "Can't use null intent with direct IIntentSender call"); + intent = new Intent(Intent.ACTION_MAIN); + } try { target.send(code, intent, resolvedType, null, requiredPermission, options); } catch (RemoteException e) { diff --git a/services/core/java/com/android/server/am/BroadcastQueue.java b/services/core/java/com/android/server/am/BroadcastQueue.java index 1222f54d15e8..0acc2a07e153 100644 --- a/services/core/java/com/android/server/am/BroadcastQueue.java +++ b/services/core/java/com/android/server/am/BroadcastQueue.java @@ -38,7 +38,6 @@ import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.os.Build; import android.os.Bundle; -import android.os.DeadObjectException; import android.os.Handler; import android.os.IBinder; import android.os.Looper; |