Merge "Fix an NPE and possible unsynchronized call of Locked method." into jb-dev
This commit is contained in:
@@ -87,26 +87,29 @@ final class InputMonitor implements InputManagerService.Callbacks {
|
||||
public long notifyANR(InputApplicationHandle inputApplicationHandle,
|
||||
InputWindowHandle inputWindowHandle) {
|
||||
AppWindowToken appWindowToken = null;
|
||||
if (inputWindowHandle != null) {
|
||||
synchronized (mService.mWindowMap) {
|
||||
WindowState windowState = (WindowState) inputWindowHandle.windowState;
|
||||
synchronized (mService.mWindowMap) {
|
||||
WindowState windowState = null;
|
||||
if (inputWindowHandle != null) {
|
||||
windowState = (WindowState) inputWindowHandle.windowState;
|
||||
if (windowState != null) {
|
||||
Slog.i(WindowManagerService.TAG, "Input event dispatching timed out sending to "
|
||||
+ windowState.mAttrs.getTitle());
|
||||
appWindowToken = windowState.mAppToken;
|
||||
mService.saveANRStateLocked(appWindowToken, windowState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (appWindowToken == null && inputApplicationHandle != null) {
|
||||
appWindowToken = (AppWindowToken)inputApplicationHandle.appWindowToken;
|
||||
if (appWindowToken != null) {
|
||||
Slog.i(WindowManagerService.TAG,
|
||||
"Input event dispatching timed out sending to application "
|
||||
+ appWindowToken.stringName);
|
||||
mService.saveANRStateLocked(appWindowToken, null);
|
||||
if (appWindowToken == null && inputApplicationHandle != null) {
|
||||
appWindowToken = (AppWindowToken)inputApplicationHandle.appWindowToken;
|
||||
}
|
||||
|
||||
if (windowState != null) {
|
||||
Slog.i(WindowManagerService.TAG, "Input event dispatching timed out "
|
||||
+ "sending to " + windowState.mAttrs.getTitle());
|
||||
} else if (appWindowToken != null) {
|
||||
Slog.i(WindowManagerService.TAG, "Input event dispatching timed out "
|
||||
+ "sending to application " + appWindowToken.stringName);
|
||||
} else {
|
||||
Slog.i(WindowManagerService.TAG, "Input event dispatching timed out.");
|
||||
}
|
||||
|
||||
mService.saveANRStateLocked(appWindowToken, windowState);
|
||||
}
|
||||
|
||||
if (appWindowToken != null && appWindowToken.appToken != null) {
|
||||
|
||||
@@ -9860,14 +9860,16 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
* the time an ANR occurred before anything else in the system changes
|
||||
* in response.
|
||||
*
|
||||
* @param appWindowToken The application that ANR'd, never null.
|
||||
* @param appWindowToken The application that ANR'd, may be null.
|
||||
* @param windowState The window that ANR'd, may be null.
|
||||
*/
|
||||
public void saveANRStateLocked(AppWindowToken appWindowToken, WindowState windowState) {
|
||||
StringWriter sw = new StringWriter();
|
||||
PrintWriter pw = new PrintWriter(sw);
|
||||
pw.println(" ANR time: " + DateFormat.getInstance().format(new Date()));
|
||||
pw.println(" Application at fault: " + appWindowToken.stringName);
|
||||
if (appWindowToken != null) {
|
||||
pw.println(" Application at fault: " + appWindowToken.stringName);
|
||||
}
|
||||
if (windowState != null) {
|
||||
pw.println(" Window at fault: " + windowState.mAttrs.getTitle());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user