Loading core/java/android/view/SurfaceView.java +1 −1 Original line number Diff line number Diff line Loading @@ -384,7 +384,7 @@ public class SurfaceView extends View { if (!mHaveFrame) { return; } ViewRootImpl viewRoot = (ViewRootImpl) getRootView().getParent(); ViewRootImpl viewRoot = getViewRootImpl(); if (viewRoot != null) { mTranslator = viewRoot.mTranslator; } Loading core/java/android/view/View.java +36 −54 Original line number Diff line number Diff line Loading @@ -5442,12 +5442,6 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal return true; } /** Gets the ViewAncestor, or null if not attached. */ /*package*/ ViewRootImpl getViewRootImpl() { View root = getRootView(); return root != null ? (ViewRootImpl)root.getParent() : null; } /** * Call this to try to give focus to a specific view or to one of its descendants. This is a * special variant of {@link #requestFocus() } that will allow views that are not focuable in Loading Loading @@ -8684,6 +8678,18 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal return null; } /** * Gets the view root associated with the View. * @return The view root, or null if none. * @hide */ public ViewRootImpl getViewRootImpl() { if (mAttachInfo != null) { return mAttachInfo.mViewRootImpl; } return null; } /** * <p>Causes the Runnable to be added to the message queue. * The runnable will be run on the user interface thread.</p> Loading @@ -8698,19 +8704,15 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * looper processing the message queue is exiting. */ public boolean post(Runnable action) { Handler handler; AttachInfo attachInfo = mAttachInfo; final AttachInfo attachInfo = mAttachInfo; if (attachInfo != null) { handler = attachInfo.mHandler; } else { return attachInfo.mHandler.post(action); } // Assume that post will succeed later ViewRootImpl.getRunQueue().post(action); return true; } return handler.post(action); } /** * <p>Causes the Runnable to be added to the message queue, to be run * after the specified amount of time elapses. Loading @@ -8731,19 +8733,15 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * occurs then the message will be dropped. */ public boolean postDelayed(Runnable action, long delayMillis) { Handler handler; AttachInfo attachInfo = mAttachInfo; final AttachInfo attachInfo = mAttachInfo; if (attachInfo != null) { handler = attachInfo.mHandler; } else { return attachInfo.mHandler.postDelayed(action, delayMillis); } // Assume that post will succeed later ViewRootImpl.getRunQueue().postDelayed(action, delayMillis); return true; } return handler.postDelayed(action, delayMillis); } /** * <p>Removes the specified Runnable from the message queue.</p> * Loading @@ -8758,17 +8756,13 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * (for instance, if the Runnable was not in the queue already.) */ public boolean removeCallbacks(Runnable action) { Handler handler; AttachInfo attachInfo = mAttachInfo; final AttachInfo attachInfo = mAttachInfo; if (attachInfo != null) { handler = attachInfo.mHandler; attachInfo.mHandler.removeCallbacks(action); } else { // Assume that post will succeed later ViewRootImpl.getRunQueue().removeCallbacks(action); return true; } handler.removeCallbacks(action); return true; } Loading Loading @@ -8817,12 +8811,9 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal public void postInvalidateDelayed(long delayMilliseconds) { // We try only with the AttachInfo because there's no point in invalidating // if we are not attached to our window AttachInfo attachInfo = mAttachInfo; final AttachInfo attachInfo = mAttachInfo; if (attachInfo != null) { Message msg = Message.obtain(); msg.what = AttachInfo.INVALIDATE_MSG; msg.obj = this; attachInfo.mHandler.sendMessageDelayed(msg, delayMilliseconds); attachInfo.mViewRootImpl.dispatchInvalidateDelayed(this, delayMilliseconds); } } Loading @@ -8845,7 +8836,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal // We try only with the AttachInfo because there's no point in invalidating // if we are not attached to our window AttachInfo attachInfo = mAttachInfo; final AttachInfo attachInfo = mAttachInfo; if (attachInfo != null) { final AttachInfo.InvalidateInfo info = AttachInfo.InvalidateInfo.acquire(); info.target = this; Loading @@ -8854,10 +8845,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal info.right = right; info.bottom = bottom; final Message msg = Message.obtain(); msg.what = AttachInfo.INVALIDATE_RECT_MSG; msg.obj = info; attachInfo.mHandler.sendMessageDelayed(msg, delayMilliseconds); attachInfo.mViewRootImpl.dispatchInvalidateRectDelayed(info, delayMilliseconds); } } Loading Loading @@ -9702,7 +9690,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal } if (mAttachInfo != null) { mAttachInfo.mHandler.removeMessages(AttachInfo.INVALIDATE_MSG, this); mAttachInfo.mViewRootImpl.cancelInvalidate(this); } mCurrentAnimation = null; Loading Loading @@ -14991,22 +14979,15 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal Canvas mCanvas; /** * A Handler supplied by a view's {@link android.view.ViewRootImpl}. This * handler can be used to pump events in the UI events queue. */ final Handler mHandler; /** * Identifier for messages requesting the view to be invalidated. * Such messages should be sent to {@link #mHandler}. * The view root impl. */ static final int INVALIDATE_MSG = 0x1; final ViewRootImpl mViewRootImpl; /** * Identifier for messages requesting the view to invalidate a region. * Such messages should be sent to {@link #mHandler}. * A Handler supplied by a view's {@link android.view.ViewRootImpl}. This * handler can be used to pump events in the UI events queue. */ static final int INVALIDATE_RECT_MSG = 0x2; final Handler mHandler; /** * Temporary for use in computing invalidate rectangles while Loading Loading @@ -15036,10 +15017,11 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * @param handler the events handler the view must use */ AttachInfo(IWindowSession session, IWindow window, Handler handler, Callbacks effectPlayer) { ViewRootImpl viewRootImpl, Handler handler, Callbacks effectPlayer) { mSession = session; mWindow = window; mWindowToken = window.asBinder(); mViewRootImpl = viewRootImpl; mHandler = handler; mRootCallbacks = effectPlayer; } core/java/android/view/ViewDebug.java +6 −6 Original line number Diff line number Diff line Loading @@ -375,7 +375,7 @@ public class ViewDebug { } private static BufferedWriter sHierarchyTraces; private static ViewRootImpl sHierarhcyRoot; private static ViewRootImpl sHierarchyRoot; private static String sHierarchyTracePrefix; /** Loading Loading @@ -855,7 +855,7 @@ public class ViewDebug { return; } if (sHierarhcyRoot != null) { if (sHierarchyRoot != null) { throw new IllegalStateException("You must call stopHierarchyTracing() before running" + " a new trace!"); } Loading @@ -874,7 +874,7 @@ public class ViewDebug { return; } sHierarhcyRoot = (ViewRootImpl) view.getRootView().getParent(); sHierarchyRoot = view.getViewRootImpl(); } /** Loading @@ -896,7 +896,7 @@ public class ViewDebug { return; } if (sHierarhcyRoot == null || sHierarchyTraces == null) { if (sHierarchyRoot == null || sHierarchyTraces == null) { throw new IllegalStateException("You must call startHierarchyTracing() before" + " stopHierarchyTracing()!"); } Loading @@ -921,7 +921,7 @@ public class ViewDebug { return; } View view = sHierarhcyRoot.getView(); View view = sHierarchyRoot.getView(); if (view instanceof ViewGroup) { ViewGroup group = (ViewGroup) view; dumpViewHierarchy(group, out, 0); Loading @@ -932,7 +932,7 @@ public class ViewDebug { } } sHierarhcyRoot = null; sHierarchyRoot = null; } static void dispatchCommand(View view, String command, String parameters, Loading core/java/android/view/ViewRootImpl.java +339 −301 File changed.Preview size limit exceeded, changes collapsed. Show changes core/java/android/view/inputmethod/BaseInputConnection.java +5 −6 Original line number Diff line number Diff line Loading @@ -497,15 +497,14 @@ public class BaseInputConnection implements InputConnection { */ public boolean sendKeyEvent(KeyEvent event) { synchronized (mIMM.mH) { Handler h = mTargetView != null ? mTargetView.getHandler() : null; if (h == null) { ViewRootImpl viewRootImpl = mTargetView != null ? mTargetView.getViewRootImpl() : null; if (viewRootImpl == null) { if (mIMM.mServedView != null) { h = mIMM.mServedView.getHandler(); viewRootImpl = mIMM.mServedView.getViewRootImpl(); } } if (h != null) { h.sendMessage(h.obtainMessage(ViewRootImpl.DISPATCH_KEY_FROM_IME, event)); if (viewRootImpl != null) { viewRootImpl.dispatchKeyFromIme(event); } } return false; Loading Loading
core/java/android/view/SurfaceView.java +1 −1 Original line number Diff line number Diff line Loading @@ -384,7 +384,7 @@ public class SurfaceView extends View { if (!mHaveFrame) { return; } ViewRootImpl viewRoot = (ViewRootImpl) getRootView().getParent(); ViewRootImpl viewRoot = getViewRootImpl(); if (viewRoot != null) { mTranslator = viewRoot.mTranslator; } Loading
core/java/android/view/View.java +36 −54 Original line number Diff line number Diff line Loading @@ -5442,12 +5442,6 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal return true; } /** Gets the ViewAncestor, or null if not attached. */ /*package*/ ViewRootImpl getViewRootImpl() { View root = getRootView(); return root != null ? (ViewRootImpl)root.getParent() : null; } /** * Call this to try to give focus to a specific view or to one of its descendants. This is a * special variant of {@link #requestFocus() } that will allow views that are not focuable in Loading Loading @@ -8684,6 +8678,18 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal return null; } /** * Gets the view root associated with the View. * @return The view root, or null if none. * @hide */ public ViewRootImpl getViewRootImpl() { if (mAttachInfo != null) { return mAttachInfo.mViewRootImpl; } return null; } /** * <p>Causes the Runnable to be added to the message queue. * The runnable will be run on the user interface thread.</p> Loading @@ -8698,19 +8704,15 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * looper processing the message queue is exiting. */ public boolean post(Runnable action) { Handler handler; AttachInfo attachInfo = mAttachInfo; final AttachInfo attachInfo = mAttachInfo; if (attachInfo != null) { handler = attachInfo.mHandler; } else { return attachInfo.mHandler.post(action); } // Assume that post will succeed later ViewRootImpl.getRunQueue().post(action); return true; } return handler.post(action); } /** * <p>Causes the Runnable to be added to the message queue, to be run * after the specified amount of time elapses. Loading @@ -8731,19 +8733,15 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * occurs then the message will be dropped. */ public boolean postDelayed(Runnable action, long delayMillis) { Handler handler; AttachInfo attachInfo = mAttachInfo; final AttachInfo attachInfo = mAttachInfo; if (attachInfo != null) { handler = attachInfo.mHandler; } else { return attachInfo.mHandler.postDelayed(action, delayMillis); } // Assume that post will succeed later ViewRootImpl.getRunQueue().postDelayed(action, delayMillis); return true; } return handler.postDelayed(action, delayMillis); } /** * <p>Removes the specified Runnable from the message queue.</p> * Loading @@ -8758,17 +8756,13 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * (for instance, if the Runnable was not in the queue already.) */ public boolean removeCallbacks(Runnable action) { Handler handler; AttachInfo attachInfo = mAttachInfo; final AttachInfo attachInfo = mAttachInfo; if (attachInfo != null) { handler = attachInfo.mHandler; attachInfo.mHandler.removeCallbacks(action); } else { // Assume that post will succeed later ViewRootImpl.getRunQueue().removeCallbacks(action); return true; } handler.removeCallbacks(action); return true; } Loading Loading @@ -8817,12 +8811,9 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal public void postInvalidateDelayed(long delayMilliseconds) { // We try only with the AttachInfo because there's no point in invalidating // if we are not attached to our window AttachInfo attachInfo = mAttachInfo; final AttachInfo attachInfo = mAttachInfo; if (attachInfo != null) { Message msg = Message.obtain(); msg.what = AttachInfo.INVALIDATE_MSG; msg.obj = this; attachInfo.mHandler.sendMessageDelayed(msg, delayMilliseconds); attachInfo.mViewRootImpl.dispatchInvalidateDelayed(this, delayMilliseconds); } } Loading @@ -8845,7 +8836,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal // We try only with the AttachInfo because there's no point in invalidating // if we are not attached to our window AttachInfo attachInfo = mAttachInfo; final AttachInfo attachInfo = mAttachInfo; if (attachInfo != null) { final AttachInfo.InvalidateInfo info = AttachInfo.InvalidateInfo.acquire(); info.target = this; Loading @@ -8854,10 +8845,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal info.right = right; info.bottom = bottom; final Message msg = Message.obtain(); msg.what = AttachInfo.INVALIDATE_RECT_MSG; msg.obj = info; attachInfo.mHandler.sendMessageDelayed(msg, delayMilliseconds); attachInfo.mViewRootImpl.dispatchInvalidateRectDelayed(info, delayMilliseconds); } } Loading Loading @@ -9702,7 +9690,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal } if (mAttachInfo != null) { mAttachInfo.mHandler.removeMessages(AttachInfo.INVALIDATE_MSG, this); mAttachInfo.mViewRootImpl.cancelInvalidate(this); } mCurrentAnimation = null; Loading Loading @@ -14991,22 +14979,15 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal Canvas mCanvas; /** * A Handler supplied by a view's {@link android.view.ViewRootImpl}. This * handler can be used to pump events in the UI events queue. */ final Handler mHandler; /** * Identifier for messages requesting the view to be invalidated. * Such messages should be sent to {@link #mHandler}. * The view root impl. */ static final int INVALIDATE_MSG = 0x1; final ViewRootImpl mViewRootImpl; /** * Identifier for messages requesting the view to invalidate a region. * Such messages should be sent to {@link #mHandler}. * A Handler supplied by a view's {@link android.view.ViewRootImpl}. This * handler can be used to pump events in the UI events queue. */ static final int INVALIDATE_RECT_MSG = 0x2; final Handler mHandler; /** * Temporary for use in computing invalidate rectangles while Loading Loading @@ -15036,10 +15017,11 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * @param handler the events handler the view must use */ AttachInfo(IWindowSession session, IWindow window, Handler handler, Callbacks effectPlayer) { ViewRootImpl viewRootImpl, Handler handler, Callbacks effectPlayer) { mSession = session; mWindow = window; mWindowToken = window.asBinder(); mViewRootImpl = viewRootImpl; mHandler = handler; mRootCallbacks = effectPlayer; }
core/java/android/view/ViewDebug.java +6 −6 Original line number Diff line number Diff line Loading @@ -375,7 +375,7 @@ public class ViewDebug { } private static BufferedWriter sHierarchyTraces; private static ViewRootImpl sHierarhcyRoot; private static ViewRootImpl sHierarchyRoot; private static String sHierarchyTracePrefix; /** Loading Loading @@ -855,7 +855,7 @@ public class ViewDebug { return; } if (sHierarhcyRoot != null) { if (sHierarchyRoot != null) { throw new IllegalStateException("You must call stopHierarchyTracing() before running" + " a new trace!"); } Loading @@ -874,7 +874,7 @@ public class ViewDebug { return; } sHierarhcyRoot = (ViewRootImpl) view.getRootView().getParent(); sHierarchyRoot = view.getViewRootImpl(); } /** Loading @@ -896,7 +896,7 @@ public class ViewDebug { return; } if (sHierarhcyRoot == null || sHierarchyTraces == null) { if (sHierarchyRoot == null || sHierarchyTraces == null) { throw new IllegalStateException("You must call startHierarchyTracing() before" + " stopHierarchyTracing()!"); } Loading @@ -921,7 +921,7 @@ public class ViewDebug { return; } View view = sHierarhcyRoot.getView(); View view = sHierarchyRoot.getView(); if (view instanceof ViewGroup) { ViewGroup group = (ViewGroup) view; dumpViewHierarchy(group, out, 0); Loading @@ -932,7 +932,7 @@ public class ViewDebug { } } sHierarhcyRoot = null; sHierarchyRoot = null; } static void dispatchCommand(View view, String command, String parameters, Loading
core/java/android/view/ViewRootImpl.java +339 −301 File changed.Preview size limit exceeded, changes collapsed. Show changes
core/java/android/view/inputmethod/BaseInputConnection.java +5 −6 Original line number Diff line number Diff line Loading @@ -497,15 +497,14 @@ public class BaseInputConnection implements InputConnection { */ public boolean sendKeyEvent(KeyEvent event) { synchronized (mIMM.mH) { Handler h = mTargetView != null ? mTargetView.getHandler() : null; if (h == null) { ViewRootImpl viewRootImpl = mTargetView != null ? mTargetView.getViewRootImpl() : null; if (viewRootImpl == null) { if (mIMM.mServedView != null) { h = mIMM.mServedView.getHandler(); viewRootImpl = mIMM.mServedView.getViewRootImpl(); } } if (h != null) { h.sendMessage(h.obtainMessage(ViewRootImpl.DISPATCH_KEY_FROM_IME, event)); if (viewRootImpl != null) { viewRootImpl.dispatchKeyFromIme(event); } } return false; Loading