Loading core/java/android/view/ViewRootImpl.java +241 −234 Original line number Original line Diff line number Diff line Loading @@ -3735,7 +3735,8 @@ public final class ViewRootImpl implements ViewParent, ((View) msg.obj).invalidate(); ((View) msg.obj).invalidate(); break; break; case MSG_INVALIDATE_RECT: case MSG_INVALIDATE_RECT: final View.AttachInfo.InvalidateInfo info = (View.AttachInfo.InvalidateInfo) msg.obj; final View.AttachInfo.InvalidateInfo info = (View.AttachInfo.InvalidateInfo) msg.obj; info.target.invalidate(info.left, info.top, info.right, info.bottom); info.target.invalidate(info.left, info.top, info.right, info.bottom); info.recycle(); info.recycle(); break; break; Loading Loading @@ -3774,10 +3775,11 @@ public final class ViewRootImpl implements ViewParent, final boolean displayChanged = mDisplay.getDisplayId() != displayId; final boolean displayChanged = mDisplay.getDisplayId() != displayId; if (!mLastReportedMergedConfiguration.equals(mergedConfiguration)) { if (!mLastReportedMergedConfiguration.equals(mergedConfiguration)) { // If configuration changed - notify about that and, maybe, about move to // If configuration changed - notify about that and, maybe, // display. // about move to display. performConfigurationChange(mergedConfiguration, false /* force */, performConfigurationChange(mergedConfiguration, false /* force */, displayChanged ? displayId : INVALID_DISPLAY /* same display */); displayChanged ? displayId : INVALID_DISPLAY /* same display */); } else if (displayChanged) { } else if (displayChanged) { // Moved to display without config change - report last applied one. // Moved to display without config change - report last applied one. onMovedToDisplay(displayId, mLastConfigurationFromResources); onMovedToDisplay(displayId, mLastConfigurationFromResources); Loading Loading @@ -3849,13 +3851,15 @@ public final class ViewRootImpl implements ViewParent, Log.e(mTag, "OutOfResourcesException locking surface", e); Log.e(mTag, "OutOfResourcesException locking surface", e); try { try { if (!mWindowSession.outOfMemory(mWindow)) { if (!mWindowSession.outOfMemory(mWindow)) { Slog.w(mTag, "No processes killed for memory; killing self"); Slog.w(mTag, "No processes killed for memory; killing self"); Process.killProcess(Process.myPid()); Process.killProcess(Process.myPid()); } } } catch (RemoteException ex) { } catch (RemoteException ex) { } } // Retry in a bit. // Retry in a bit. sendMessageDelayed(obtainMessage(msg.what, msg.arg1, msg.arg2), 500); sendMessageDelayed(obtainMessage(msg.what, msg.arg1, msg.arg2), 500); return; return; } } } } Loading Loading @@ -3892,7 +3896,8 @@ public final class ViewRootImpl implements ViewParent, ~WindowManager.LayoutParams.SOFT_INPUT_IS_FORWARD_NAVIGATION; ~WindowManager.LayoutParams.SOFT_INPUT_IS_FORWARD_NAVIGATION; ((WindowManager.LayoutParams) mView.getLayoutParams()) ((WindowManager.LayoutParams) mView.getLayoutParams()) .softInputMode &= .softInputMode &= ~WindowManager.LayoutParams.SOFT_INPUT_IS_FORWARD_NAVIGATION; ~WindowManager.LayoutParams .SOFT_INPUT_IS_FORWARD_NAVIGATION; mHasHadWindowFocus = true; mHasHadWindowFocus = true; } else { } else { if (mPointerCapture) { if (mPointerCapture) { Loading @@ -3916,16 +3921,16 @@ public final class ViewRootImpl implements ViewParent, enqueueInputEvent(event, null, QueuedInputEvent.FLAG_UNHANDLED, true); enqueueInputEvent(event, null, QueuedInputEvent.FLAG_UNHANDLED, true); } break; } break; case MSG_DISPATCH_KEY_FROM_IME: { case MSG_DISPATCH_KEY_FROM_IME: { if (LOCAL_LOGV) Log.v( if (LOCAL_LOGV) { TAG, "Dispatching key " Log.v(TAG, "Dispatching key " + msg.obj + " from IME to " + mView); + msg.obj + " from IME to " + mView); } KeyEvent event = (KeyEvent) msg.obj; KeyEvent event = (KeyEvent) msg.obj; if ((event.getFlags() & KeyEvent.FLAG_FROM_SYSTEM) != 0) { if ((event.getFlags() & KeyEvent.FLAG_FROM_SYSTEM) != 0) { // The IME is trying to say this event is from the // The IME is trying to say this event is from the // system! Bad bad bad! // system! Bad bad bad! //noinspection UnusedAssignment //noinspection UnusedAssignment event = KeyEvent.changeFlags(event, event.getFlags() & event = KeyEvent.changeFlags(event, event.getFlags() ~KeyEvent.FLAG_FROM_SYSTEM); & ~KeyEvent.FLAG_FROM_SYSTEM); } } enqueueInputEvent(event, null, QueuedInputEvent.FLAG_DELIVER_POST_IME, true); enqueueInputEvent(event, null, QueuedInputEvent.FLAG_DELIVER_POST_IME, true); } break; } break; Loading @@ -3940,10 +3945,12 @@ public final class ViewRootImpl implements ViewParent, mView.onCloseSystemDialogs((String) msg.obj); mView.onCloseSystemDialogs((String) msg.obj); } } } break; } break; case MSG_DISPATCH_DRAG_EVENT: case MSG_DISPATCH_DRAG_EVENT: { } // fall through case MSG_DISPATCH_DRAG_LOCATION_EVENT: { case MSG_DISPATCH_DRAG_LOCATION_EVENT: { DragEvent event = (DragEvent) msg.obj; DragEvent event = (DragEvent) msg.obj; event.mLocalState = mLocalDragState; // only present when this app called startDrag() // only present when this app called startDrag() event.mLocalState = mLocalDragState; handleDragEvent(event); handleDragEvent(event); } break; } break; case MSG_DISPATCH_SYSTEM_UI_VISIBILITY: { case MSG_DISPATCH_SYSTEM_UI_VISIBILITY: { Loading Loading
core/java/android/view/ViewRootImpl.java +241 −234 Original line number Original line Diff line number Diff line Loading @@ -3735,7 +3735,8 @@ public final class ViewRootImpl implements ViewParent, ((View) msg.obj).invalidate(); ((View) msg.obj).invalidate(); break; break; case MSG_INVALIDATE_RECT: case MSG_INVALIDATE_RECT: final View.AttachInfo.InvalidateInfo info = (View.AttachInfo.InvalidateInfo) msg.obj; final View.AttachInfo.InvalidateInfo info = (View.AttachInfo.InvalidateInfo) msg.obj; info.target.invalidate(info.left, info.top, info.right, info.bottom); info.target.invalidate(info.left, info.top, info.right, info.bottom); info.recycle(); info.recycle(); break; break; Loading Loading @@ -3774,10 +3775,11 @@ public final class ViewRootImpl implements ViewParent, final boolean displayChanged = mDisplay.getDisplayId() != displayId; final boolean displayChanged = mDisplay.getDisplayId() != displayId; if (!mLastReportedMergedConfiguration.equals(mergedConfiguration)) { if (!mLastReportedMergedConfiguration.equals(mergedConfiguration)) { // If configuration changed - notify about that and, maybe, about move to // If configuration changed - notify about that and, maybe, // display. // about move to display. performConfigurationChange(mergedConfiguration, false /* force */, performConfigurationChange(mergedConfiguration, false /* force */, displayChanged ? displayId : INVALID_DISPLAY /* same display */); displayChanged ? displayId : INVALID_DISPLAY /* same display */); } else if (displayChanged) { } else if (displayChanged) { // Moved to display without config change - report last applied one. // Moved to display without config change - report last applied one. onMovedToDisplay(displayId, mLastConfigurationFromResources); onMovedToDisplay(displayId, mLastConfigurationFromResources); Loading Loading @@ -3849,13 +3851,15 @@ public final class ViewRootImpl implements ViewParent, Log.e(mTag, "OutOfResourcesException locking surface", e); Log.e(mTag, "OutOfResourcesException locking surface", e); try { try { if (!mWindowSession.outOfMemory(mWindow)) { if (!mWindowSession.outOfMemory(mWindow)) { Slog.w(mTag, "No processes killed for memory; killing self"); Slog.w(mTag, "No processes killed for memory; killing self"); Process.killProcess(Process.myPid()); Process.killProcess(Process.myPid()); } } } catch (RemoteException ex) { } catch (RemoteException ex) { } } // Retry in a bit. // Retry in a bit. sendMessageDelayed(obtainMessage(msg.what, msg.arg1, msg.arg2), 500); sendMessageDelayed(obtainMessage(msg.what, msg.arg1, msg.arg2), 500); return; return; } } } } Loading Loading @@ -3892,7 +3896,8 @@ public final class ViewRootImpl implements ViewParent, ~WindowManager.LayoutParams.SOFT_INPUT_IS_FORWARD_NAVIGATION; ~WindowManager.LayoutParams.SOFT_INPUT_IS_FORWARD_NAVIGATION; ((WindowManager.LayoutParams) mView.getLayoutParams()) ((WindowManager.LayoutParams) mView.getLayoutParams()) .softInputMode &= .softInputMode &= ~WindowManager.LayoutParams.SOFT_INPUT_IS_FORWARD_NAVIGATION; ~WindowManager.LayoutParams .SOFT_INPUT_IS_FORWARD_NAVIGATION; mHasHadWindowFocus = true; mHasHadWindowFocus = true; } else { } else { if (mPointerCapture) { if (mPointerCapture) { Loading @@ -3916,16 +3921,16 @@ public final class ViewRootImpl implements ViewParent, enqueueInputEvent(event, null, QueuedInputEvent.FLAG_UNHANDLED, true); enqueueInputEvent(event, null, QueuedInputEvent.FLAG_UNHANDLED, true); } break; } break; case MSG_DISPATCH_KEY_FROM_IME: { case MSG_DISPATCH_KEY_FROM_IME: { if (LOCAL_LOGV) Log.v( if (LOCAL_LOGV) { TAG, "Dispatching key " Log.v(TAG, "Dispatching key " + msg.obj + " from IME to " + mView); + msg.obj + " from IME to " + mView); } KeyEvent event = (KeyEvent) msg.obj; KeyEvent event = (KeyEvent) msg.obj; if ((event.getFlags() & KeyEvent.FLAG_FROM_SYSTEM) != 0) { if ((event.getFlags() & KeyEvent.FLAG_FROM_SYSTEM) != 0) { // The IME is trying to say this event is from the // The IME is trying to say this event is from the // system! Bad bad bad! // system! Bad bad bad! //noinspection UnusedAssignment //noinspection UnusedAssignment event = KeyEvent.changeFlags(event, event.getFlags() & event = KeyEvent.changeFlags(event, event.getFlags() ~KeyEvent.FLAG_FROM_SYSTEM); & ~KeyEvent.FLAG_FROM_SYSTEM); } } enqueueInputEvent(event, null, QueuedInputEvent.FLAG_DELIVER_POST_IME, true); enqueueInputEvent(event, null, QueuedInputEvent.FLAG_DELIVER_POST_IME, true); } break; } break; Loading @@ -3940,10 +3945,12 @@ public final class ViewRootImpl implements ViewParent, mView.onCloseSystemDialogs((String) msg.obj); mView.onCloseSystemDialogs((String) msg.obj); } } } break; } break; case MSG_DISPATCH_DRAG_EVENT: case MSG_DISPATCH_DRAG_EVENT: { } // fall through case MSG_DISPATCH_DRAG_LOCATION_EVENT: { case MSG_DISPATCH_DRAG_LOCATION_EVENT: { DragEvent event = (DragEvent) msg.obj; DragEvent event = (DragEvent) msg.obj; event.mLocalState = mLocalDragState; // only present when this app called startDrag() // only present when this app called startDrag() event.mLocalState = mLocalDragState; handleDragEvent(event); handleDragEvent(event); } break; } break; case MSG_DISPATCH_SYSTEM_UI_VISIBILITY: { case MSG_DISPATCH_SYSTEM_UI_VISIBILITY: { Loading