Fix NPE in notifyFocusChanged
Before the first focus change, mFocusedWindow is null. Bug: 121122996 Test: manual - Switch between activities without exception log. Change-Id: Id09ec08296daab5335a4c3167d61e5e21f148016
This commit is contained in:
@@ -1761,12 +1761,15 @@ public class InputManagerService extends IInputManager.Stub
|
||||
|
||||
// Native callback
|
||||
private void notifyFocusChanged(IBinder oldToken, IBinder newToken) {
|
||||
if (mFocusedWindow.asBinder() == newToken) {
|
||||
Log.w(TAG, "notifyFocusChanged called with unchanged mFocusedWindow=" + mFocusedWindow);
|
||||
return;
|
||||
if (mFocusedWindow != null) {
|
||||
if (mFocusedWindow.asBinder() == newToken) {
|
||||
Slog.w(TAG, "notifyFocusChanged called with unchanged mFocusedWindow="
|
||||
+ mFocusedWindow);
|
||||
return;
|
||||
}
|
||||
setPointerCapture(false);
|
||||
}
|
||||
|
||||
setPointerCapture(false);
|
||||
mFocusedWindow = IWindow.Stub.asInterface(newToken);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user