From 53b854ad7de5c22e03383b0f6538a493f601b7c9 Mon Sep 17 00:00:00 2001 From: Michael Wright Date: Tue, 12 Apr 2016 19:22:41 -0400 Subject: [PATCH] Crash early when requesting a keyboard shortcut helper... with a null IResultReceiver. We're seeing Dialer crashes in this code path but they happen in the main Handler loop so we can't see where the request with the null request is coming from. Crashing earlier will hopefully give us a stack trace that we can use to diagnose the issue. Bug: 27963013 Change-Id: I60e4ef2ef328fa69790bbcaa4f196c02f7443296 --- core/java/android/view/ViewRootImpl.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index 420c4f272ff0f..78ac964447dab 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -3370,6 +3370,16 @@ public final class ViewRootImpl implements ViewParent, return super.getMessageName(message); } + @Override + public boolean sendMessageAtTime(Message msg, long uptimeMillis) { + if (msg.what == MSG_REQUEST_KEYBOARD_SHORTCUTS && msg.obj == null) { + // Debugging for b/27963013 + throw new NullPointerException( + "Attempted to call MSG_REQUEST_KEYBOARD_SHORTCUTS with null receiver:"); + } + return super.sendMessageAtTime(msg, uptimeMillis); + } + @Override public void handleMessage(Message msg) { switch (msg.what) {