Rename ViewRoot to ViewAncestor.

ViewRoot is about to be a new public class for poking at ViewAncestor.

Change-Id: Ie95d707c6d8bbb48f78d093d7b2667851812a7d5
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index 4dfba91..79552bf 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -70,7 +70,7 @@
 import android.view.View;
 import android.view.ViewDebug;
 import android.view.ViewManager;
-import android.view.ViewRoot;
+import android.view.ViewAncestor;
 import android.view.Window;
 import android.view.WindowManager;
 import android.view.WindowManagerImpl;
@@ -728,7 +728,7 @@
             long dalvikFree = runtime.freeMemory() / 1024;
             long dalvikAllocated = dalvikMax - dalvikFree;
             long viewInstanceCount = ViewDebug.getViewInstanceCount();
-            long viewRootInstanceCount = ViewDebug.getViewRootInstanceCount();
+            long viewRootInstanceCount = ViewDebug.getViewAncestorInstanceCount();
             long appContextInstanceCount = Debug.countInstancesOfClass(ContextImpl.class);
             long activityInstanceCount = Debug.countInstancesOfClass(Activity.class);
             int globalAssetCount = AssetManager.getGlobalAssetCount();
@@ -843,7 +843,7 @@
 
             pw.println(" ");
             pw.println(" Objects");
-            printRow(pw, TWO_COUNT_COLUMNS, "Views:", viewInstanceCount, "ViewRoots:",
+            printRow(pw, TWO_COUNT_COLUMNS, "Views:", viewInstanceCount, "ViewAncestors:",
                     viewRootInstanceCount);
 
             printRow(pw, TWO_COUNT_COLUMNS, "AppContexts:", appContextInstanceCount,
@@ -3918,7 +3918,7 @@
         sThreadLocal.set(this);
         mSystemThread = system;
         if (!system) {
-            ViewRoot.addFirstDrawHandler(new Runnable() {
+            ViewAncestor.addFirstDrawHandler(new Runnable() {
                 public void run() {
                     ensureJitEnabled();
                 }
@@ -3948,7 +3948,7 @@
             }
         }
         
-        ViewRoot.addConfigCallback(new ComponentCallbacks() {
+        ViewAncestor.addConfigCallback(new ComponentCallbacks() {
             public void onConfigurationChanged(Configuration newConfig) {
                 synchronized (mPackages) {
                     // We need to apply this change to the resources
diff --git a/core/java/android/app/WallpaperManager.java b/core/java/android/app/WallpaperManager.java
index 13a8b78..113c610 100644
--- a/core/java/android/app/WallpaperManager.java
+++ b/core/java/android/app/WallpaperManager.java
@@ -38,7 +38,7 @@
 import android.os.ServiceManager;
 import android.util.DisplayMetrics;
 import android.util.Log;
-import android.view.ViewRoot;
+import android.view.ViewAncestor;
 
 import java.io.FileOutputStream;
 import java.io.IOException;
@@ -632,7 +632,7 @@
     public void setWallpaperOffsets(IBinder windowToken, float xOffset, float yOffset) {
         try {
             //Log.v(TAG, "Sending new wallpaper offsets from app...");
-            ViewRoot.getWindowSession(mContext.getMainLooper()).setWallpaperPosition(
+            ViewAncestor.getWindowSession(mContext.getMainLooper()).setWallpaperPosition(
                     windowToken, xOffset, yOffset, mWallpaperXStep, mWallpaperYStep);
             //Log.v(TAG, "...app returning after sending offsets!");
         } catch (RemoteException e) {
@@ -670,7 +670,7 @@
             int x, int y, int z, Bundle extras) {
         try {
             //Log.v(TAG, "Sending new wallpaper offsets from app...");
-            ViewRoot.getWindowSession(mContext.getMainLooper()).sendWallpaperCommand(
+            ViewAncestor.getWindowSession(mContext.getMainLooper()).sendWallpaperCommand(
                     windowToken, action, x, y, z, extras, false);
             //Log.v(TAG, "...app returning after sending offsets!");
         } catch (RemoteException e) {
@@ -690,7 +690,7 @@
      */
     public void clearWallpaperOffsets(IBinder windowToken) {
         try {
-            ViewRoot.getWindowSession(mContext.getMainLooper()).setWallpaperPosition(
+            ViewAncestor.getWindowSession(mContext.getMainLooper()).setWallpaperPosition(
                     windowToken, -1, -1, -1, -1);
         } catch (RemoteException e) {
             // Ignore.
diff --git a/core/java/android/service/wallpaper/WallpaperService.java b/core/java/android/service/wallpaper/WallpaperService.java
index 20661d7..eae7574 100644
--- a/core/java/android/service/wallpaper/WallpaperService.java
+++ b/core/java/android/service/wallpaper/WallpaperService.java
@@ -51,7 +51,7 @@
 import android.view.SurfaceHolder;
 import android.view.View;
 import android.view.ViewGroup;
-import android.view.ViewRoot;
+import android.view.ViewAncestor;
 import android.view.WindowManager;
 import android.view.WindowManagerImpl;
 import android.view.WindowManagerPolicy;
@@ -650,7 +650,7 @@
             mWindowToken = wrapper.mWindowToken;
             mSurfaceHolder.setSizeFromLayout();
             mInitializing = true;
-            mSession = ViewRoot.getWindowSession(getMainLooper());
+            mSession = ViewAncestor.getWindowSession(getMainLooper());
             
             mWindow.setSession(mSession);
             
diff --git a/core/java/android/view/HardwareRenderer.java b/core/java/android/view/HardwareRenderer.java
index 7ca6e09..845fbc3 100644
--- a/core/java/android/view/HardwareRenderer.java
+++ b/core/java/android/view/HardwareRenderer.java
@@ -34,7 +34,7 @@
 import javax.microedition.khronos.opengles.GL;
 
 /**
- * Interface for rendering a ViewRoot using hardware acceleration.
+ * Interface for rendering a ViewAncestor using hardware acceleration.
  * 
  * @hide
  */
@@ -209,7 +209,7 @@
     
     /**
      * Initializes the hardware renderer for the specified surface and setup the
-     * renderer for drawing, if needed. This is invoked when the ViewRoot has
+     * renderer for drawing, if needed. This is invoked when the ViewAncestor has
      * potentially lost the hardware renderer. The hardware renderer should be
      * reinitialized and setup when the render {@link #isRequested()} and
      * {@link #isEnabled()}.
diff --git a/core/java/android/view/SurfaceView.java b/core/java/android/view/SurfaceView.java
index 0a7a375..a98c669 100644
--- a/core/java/android/view/SurfaceView.java
+++ b/core/java/android/view/SurfaceView.java
@@ -427,7 +427,7 @@
         if (!mHaveFrame) {
             return;
         }
-        ViewRoot viewRoot = (ViewRoot) getRootView().getParent();
+        ViewAncestor viewRoot = (ViewAncestor) getRootView().getParent();
         if (viewRoot != null) {
             mTranslator = viewRoot.mTranslator;
         }
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 5af2e56..e47b499 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -4496,10 +4496,10 @@
         return true;
     }
 
-    /** Gets the ViewRoot, or null if not attached. */
-    /*package*/ ViewRoot getViewRoot() {
+    /** Gets the ViewAncestor, or null if not attached. */
+    /*package*/ ViewAncestor getViewAncestor() {
         View root = getRootView();
-        return root != null ? (ViewRoot)root.getParent() : null;
+        return root != null ? (ViewAncestor)root.getParent() : null;
     }
 
     /**
@@ -4515,7 +4515,7 @@
     public final boolean requestFocusFromTouch() {
         // Leave touch mode if we need to
         if (isInTouchMode()) {
-            ViewRoot viewRoot = getViewRoot();
+            ViewAncestor viewRoot = getViewAncestor();
             if (viewRoot != null) {
                 viewRoot.ensureTouchMode(false);
             }
@@ -5083,7 +5083,7 @@
         if (mAttachInfo != null) {
             return mAttachInfo.mInTouchMode;
         } else {
-            return ViewRoot.isInTouchMode();
+            return ViewAncestor.isInTouchMode();
         }
     }
 
@@ -7311,7 +7311,7 @@
             if (!HardwareRenderer.RENDER_DIRTY_REGIONS) {
                 if (p != null && ai != null && ai.mHardwareAccelerated) {
                     // fast-track for GL-enabled applications; just invalidate the whole hierarchy
-                    // with a null dirty rect, which tells the ViewRoot to redraw everything
+                    // with a null dirty rect, which tells the ViewAncestor to redraw everything
                     p.invalidateChild(this, null);
                     return;
                 }
@@ -7354,7 +7354,7 @@
             if (!HardwareRenderer.RENDER_DIRTY_REGIONS) {
                 if (p != null && ai != null && ai.mHardwareAccelerated) {
                     // fast-track for GL-enabled applications; just invalidate the whole hierarchy
-                    // with a null dirty rect, which tells the ViewRoot to redraw everything
+                    // with a null dirty rect, which tells the ViewAncestor to redraw everything
                     p.invalidateChild(this, null);
                     return;
                 }
@@ -7409,7 +7409,7 @@
             if (!HardwareRenderer.RENDER_DIRTY_REGIONS) {
                 if (p != null && ai != null && ai.mHardwareAccelerated) {
                     // fast-track for GL-enabled applications; just invalidate the whole hierarchy
-                    // with a null dirty rect, which tells the ViewRoot to redraw everything
+                    // with a null dirty rect, which tells the ViewAncestor to redraw everything
                     p.invalidateChild(this, null);
                     return;
                 }
@@ -7558,7 +7558,7 @@
             handler = attachInfo.mHandler;
         } else {
             // Assume that post will succeed later
-            ViewRoot.getRunQueue().post(action);
+            ViewAncestor.getRunQueue().post(action);
             return true;
         }
 
@@ -7588,7 +7588,7 @@
             handler = attachInfo.mHandler;
         } else {
             // Assume that post will succeed later
-            ViewRoot.getRunQueue().postDelayed(action, delayMillis);
+            ViewAncestor.getRunQueue().postDelayed(action, delayMillis);
             return true;
         }
 
@@ -7612,7 +7612,7 @@
             handler = attachInfo.mHandler;
         } else {
             // Assume that post will succeed later
-            ViewRoot.getRunQueue().removeCallbacks(action);
+            ViewAncestor.getRunQueue().removeCallbacks(action);
             return true;
         }
 
@@ -10593,9 +10593,9 @@
             viewParent = view.mParent;
         }
 
-        if (viewParent instanceof ViewRoot) {
+        if (viewParent instanceof ViewAncestor) {
             // *cough*
-            final ViewRoot vr = (ViewRoot)viewParent;
+            final ViewAncestor vr = (ViewAncestor)viewParent;
             location[1] -= vr.mCurScrollY;
         }
     }
@@ -11405,7 +11405,7 @@
      * therefore all View objects remove themselves from the global transparent
      * region (passed as a parameter to this function).
      *
-     * @param region The transparent region for this ViewRoot (window).
+     * @param region The transparent region for this ViewAncestor (window).
      *
      * @return Returns true if the effective visibility of the view at this
      * point is opaque, regardless of the transparent region; returns false
@@ -11711,7 +11711,7 @@
                     surface.unlockCanvasAndPost(canvas);
                 }
 
-                final ViewRoot root = getViewRoot();
+                final ViewAncestor root = getViewAncestor();
 
                 // Cache the local state object for delivery with DragEvents
                 root.setLocalDragState(myLocalState);
@@ -12497,7 +12497,7 @@
         boolean mScalingRequired;
 
         /**
-         * If set, ViewRoot doesn't use its lame animation for when the window resizes.
+         * If set, ViewAncestor doesn't use its lame animation for when the window resizes.
          */
         boolean mTurnOffWindowResizeAnim;
 
@@ -12576,7 +12576,7 @@
         boolean mInTouchMode;
 
         /**
-         * Indicates that ViewRoot should trigger a global layout change
+         * Indicates that ViewAncestor should trigger a global layout change
          * the next time it performs a traversal
          */
         boolean mRecomputeGlobalAttributes;
@@ -12638,7 +12638,7 @@
         Canvas mCanvas;
 
         /**
-         * A Handler supplied by a view's {@link android.view.ViewRoot}. This
+         * A Handler supplied by a view's {@link android.view.ViewAncestor}. This
          * handler can be used to pump events in the UI events queue.
          */
         final Handler mHandler;
diff --git a/core/java/android/view/ViewRoot.java b/core/java/android/view/ViewAncestor.java
similarity index 98%
rename from core/java/android/view/ViewRoot.java
rename to core/java/android/view/ViewAncestor.java
index f02daba..0a91d8e 100644
--- a/core/java/android/view/ViewRoot.java
+++ b/core/java/android/view/ViewAncestor.java
@@ -82,9 +82,9 @@
  * {@hide}
  */
 @SuppressWarnings({"EmptyCatchBlock", "PointlessBooleanExpression"})
-public final class ViewRoot extends Handler implements ViewParent,
+public final class ViewAncestor extends Handler implements ViewParent,
         View.AttachInfo.Callbacks, HardwareRenderer.HardwareDrawCallbacks {
-    private static final String TAG = "ViewRoot";
+    private static final String TAG = "ViewAncestor";
     private static final boolean DBG = false;
     private static final boolean SHOW_FPS = false;
     private static final boolean LOCAL_LOGV = false;
@@ -273,7 +273,7 @@
         }
     }
     
-    public ViewRoot(Context context) {
+    public ViewAncestor(Context context) {
         super();
 
         if (MEASURE_LATENCY) {
@@ -515,7 +515,7 @@
             }
 
             // Only enable hardware acceleration if we are not in the system process
-            // The window manager creates ViewRoots to display animated preview windows
+            // The window manager creates ViewAncestors to display animated preview windows
             // of launching apps and we don't want those to be hardware accelerated
 
             final boolean systemHwAccelerated =
@@ -2038,7 +2038,7 @@
             break;
         case DO_TRAVERSAL:
             if (mProfile) {
-                Debug.startMethodTracing("ViewRoot");
+                Debug.startMethodTracing("ViewAncestor");
             }
 
             final long traversalStartTime;
@@ -3546,7 +3546,7 @@
     }
 
     public void requestDisallowInterceptTouchEvent(boolean disallowIntercept) {
-        // ViewRoot never intercepts touch event, so this can be a no-op
+        // ViewAncestor never intercepts touch event, so this can be a no-op
     }
 
     public boolean requestChildRectangleOnScreen(View child, Rect rectangle,
@@ -3595,14 +3595,14 @@
     }
     
     static class InputMethodCallback extends IInputMethodCallback.Stub {
-        private WeakReference<ViewRoot> mViewRoot;
+        private WeakReference<ViewAncestor> mViewAncestor;
 
-        public InputMethodCallback(ViewRoot viewRoot) {
-            mViewRoot = new WeakReference<ViewRoot>(viewRoot);
+        public InputMethodCallback(ViewAncestor viewRoot) {
+            mViewAncestor = new WeakReference<ViewAncestor>(viewRoot);
         }
 
         public void finishedEvent(int seq, boolean handled) {
-            final ViewRoot viewRoot = mViewRoot.get();
+            final ViewAncestor viewRoot = mViewAncestor.get();
             if (viewRoot != null) {
                 viewRoot.dispatchFinishedEvent(seq, handled);
             }
@@ -3614,36 +3614,36 @@
     }
 
     static class W extends IWindow.Stub {
-        private final WeakReference<ViewRoot> mViewRoot;
+        private final WeakReference<ViewAncestor> mViewAncestor;
 
-        W(ViewRoot viewRoot) {
-            mViewRoot = new WeakReference<ViewRoot>(viewRoot);
+        W(ViewAncestor viewRoot) {
+            mViewAncestor = new WeakReference<ViewAncestor>(viewRoot);
         }
 
         public void resized(int w, int h, Rect coveredInsets, Rect visibleInsets,
                 boolean reportDraw, Configuration newConfig) {
-            final ViewRoot viewRoot = mViewRoot.get();
+            final ViewAncestor viewRoot = mViewAncestor.get();
             if (viewRoot != null) {
                 viewRoot.dispatchResized(w, h, coveredInsets, visibleInsets, reportDraw, newConfig);
             }
         }
 
         public void dispatchAppVisibility(boolean visible) {
-            final ViewRoot viewRoot = mViewRoot.get();
+            final ViewAncestor viewRoot = mViewAncestor.get();
             if (viewRoot != null) {
                 viewRoot.dispatchAppVisibility(visible);
             }
         }
 
         public void dispatchGetNewSurface() {
-            final ViewRoot viewRoot = mViewRoot.get();
+            final ViewAncestor viewRoot = mViewAncestor.get();
             if (viewRoot != null) {
                 viewRoot.dispatchGetNewSurface();
             }
         }
 
         public void windowFocusChanged(boolean hasFocus, boolean inTouchMode) {
-            final ViewRoot viewRoot = mViewRoot.get();
+            final ViewAncestor viewRoot = mViewAncestor.get();
             if (viewRoot != null) {
                 viewRoot.windowFocusChanged(hasFocus, inTouchMode);
             }
@@ -3663,7 +3663,7 @@
         }
 
         public void executeCommand(String command, String parameters, ParcelFileDescriptor out) {
-            final ViewRoot viewRoot = mViewRoot.get();
+            final ViewAncestor viewRoot = mViewAncestor.get();
             if (viewRoot != null) {
                 final View view = viewRoot.mView;
                 if (view != null) {
@@ -3694,7 +3694,7 @@
         }
         
         public void closeSystemDialogs(String reason) {
-            final ViewRoot viewRoot = mViewRoot.get();
+            final ViewAncestor viewRoot = mViewAncestor.get();
             if (viewRoot != null) {
                 viewRoot.dispatchCloseSystemDialogs(reason);
             }
@@ -3722,7 +3722,7 @@
 
         /* Drag/drop */
         public void dispatchDragEvent(DragEvent event) {
-            final ViewRoot viewRoot = mViewRoot.get();
+            final ViewAncestor viewRoot = mViewAncestor.get();
             if (viewRoot != null) {
                 viewRoot.dispatchDragEvent(event);
             }
@@ -3730,7 +3730,7 @@
 
         @Override
         public void dispatchSystemUiVisibilityChanged(int visibility) {
-            final ViewRoot viewRoot = mViewRoot.get();
+            final ViewAncestor viewRoot = mViewAncestor.get();
             if (viewRoot != null) {
                 viewRoot.dispatchSystemUiVisibilityChanged(visibility);
             }
diff --git a/core/java/android/view/ViewDebug.java b/core/java/android/view/ViewDebug.java
index 881cb76..3f05b29 100644
--- a/core/java/android/view/ViewDebug.java
+++ b/core/java/android/view/ViewDebug.java
@@ -395,7 +395,7 @@
     }
 
     private static BufferedWriter sHierarchyTraces;
-    private static ViewRoot sHierarhcyRoot;
+    private static ViewAncestor sHierarhcyRoot;
     private static String sHierarchyTracePrefix;
 
     /**
@@ -434,7 +434,7 @@
     }
 
     private static BufferedWriter sMotionEventTraces;
-    private static ViewRoot sMotionEventRoot;
+    private static ViewAncestor sMotionEventRoot;
     private static String sMotionEventTracePrefix;
 
     /**
@@ -449,14 +449,14 @@
     }
 
     /**
-     * Returns the number of instanciated ViewRoots.
+     * Returns the number of instanciated ViewAncestors.
      *
-     * @return The number of ViewRoots instanciated in the current process.
+     * @return The number of ViewAncestors instanciated in the current process.
      *
      * @hide
      */
-    public static long getViewRootInstanceCount() {
-        return Debug.countInstancesOfClass(ViewRoot.class);
+    public static long getViewAncestorInstanceCount() {
+        return Debug.countInstancesOfClass(ViewAncestor.class);
     }
 
     /**
@@ -670,7 +670,7 @@
             return;
         }
 
-        sHierarhcyRoot = (ViewRoot) view.getRootView().getParent();
+        sHierarhcyRoot = (ViewAncestor) view.getRootView().getParent();
     }
 
     /**
@@ -808,7 +808,7 @@
             return;
         }
 
-        sMotionEventRoot = (ViewRoot) view.getRootView().getParent();
+        sMotionEventRoot = (ViewAncestor) view.getRootView().getParent();
     }
 
     /**
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index 1a84175..7b8242d 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -536,7 +536,7 @@
                 // note: knowing that mFocused is non-null is not a good enough reason
                 // to break the traversal since in that case we'd actually have to find
                 // the focused view and make sure it wasn't FOCUS_AFTER_DESCENDANTS and
-                // an ancestor of v; this will get checked for at ViewRoot
+                // an ancestor of v; this will get checked for at ViewAncestor
                 && !(isFocused() && getDescendantFocusability() != FOCUS_AFTER_DESCENDANTS)) {
             mParent.focusableViewAvailable(v);
         }
@@ -936,7 +936,7 @@
         final float tx = event.mX;
         final float ty = event.mY;
 
-        ViewRoot root = getViewRoot();
+        ViewAncestor root = getViewAncestor();
 
         // Dispatch down the view hierarchy
         switch (event.mAction) {
@@ -3828,13 +3828,13 @@
                     if (drawAnimation) {
                         if (view != null) {
                             view.mPrivateFlags |= DRAW_ANIMATION;
-                        } else if (parent instanceof ViewRoot) {
-                            ((ViewRoot) parent).mIsAnimating = true;
+                        } else if (parent instanceof ViewAncestor) {
+                            ((ViewAncestor) parent).mIsAnimating = true;
                         }
                     }
 
-                    if (parent instanceof ViewRoot) {
-                        ((ViewRoot) parent).invalidate();
+                    if (parent instanceof ViewAncestor) {
+                        ((ViewAncestor) parent).invalidate();
                         parent = null;
                     } else if (view != null) {
                         if ((view.mPrivateFlags & DRAWN) == DRAWN ||
@@ -3889,8 +3889,8 @@
                     if (drawAnimation) {
                         if (view != null) {
                             view.mPrivateFlags |= DRAW_ANIMATION;
-                        } else if (parent instanceof ViewRoot) {
-                            ((ViewRoot) parent).mIsAnimating = true;
+                        } else if (parent instanceof ViewAncestor) {
+                            ((ViewAncestor) parent).mIsAnimating = true;
                         }
                     }
 
@@ -4413,7 +4413,7 @@
             // If this group is dirty, check that the parent is dirty as well
             if ((mPrivateFlags & DIRTY_MASK) != 0) {
                 final ViewParent parent = getParent();
-                if (parent != null && !(parent instanceof ViewRoot)) {
+                if (parent != null && !(parent instanceof ViewAncestor)) {
                     if ((((View) parent).mPrivateFlags & DIRTY_MASK) == 0) {
                         result = false;
                         android.util.Log.d(ViewDebug.CONSISTENCY_LOG_TAG,
diff --git a/core/java/android/view/WindowManagerImpl.java b/core/java/android/view/WindowManagerImpl.java
index 8336959..d7a3096 100644
--- a/core/java/android/view/WindowManagerImpl.java
+++ b/core/java/android/view/WindowManagerImpl.java
@@ -111,7 +111,7 @@
         final WindowManager.LayoutParams wparams
                 = (WindowManager.LayoutParams)params;
         
-        ViewRoot root;
+        ViewAncestor root;
         View panelParentView = null;
         
         synchronized (this) {
@@ -148,7 +148,7 @@
                 }
             }
             
-            root = new ViewRoot(view.getContext());
+            root = new ViewAncestor(view.getContext());
             root.mAddNesting = 1;
 
             view.setLayoutParams(wparams);
@@ -156,7 +156,7 @@
             if (mViews == null) {
                 index = 1;
                 mViews = new View[1];
-                mRoots = new ViewRoot[1];
+                mRoots = new ViewAncestor[1];
                 mParams = new WindowManager.LayoutParams[1];
             } else {
                 index = mViews.length + 1;
@@ -164,7 +164,7 @@
                 mViews = new View[index];
                 System.arraycopy(old, 0, mViews, 0, index-1);
                 old = mRoots;
-                mRoots = new ViewRoot[index];
+                mRoots = new ViewAncestor[index];
                 System.arraycopy(old, 0, mRoots, 0, index-1);
                 old = mParams;
                 mParams = new WindowManager.LayoutParams[index];
@@ -192,7 +192,7 @@
 
         synchronized (this) {
             int index = findViewLocked(view, true);
-            ViewRoot root = mRoots[index];
+            ViewAncestor root = mRoots[index];
             mParams[index] = wparams;
             root.setLayoutParams(wparams, false);
         }
@@ -207,14 +207,14 @@
             }
             
             throw new IllegalStateException("Calling with view " + view
-                    + " but the ViewRoot is attached to " + curView);
+                    + " but the ViewAncestor is attached to " + curView);
         }
     }
 
     public void removeViewImmediate(View view) {
         synchronized (this) {
             int index = findViewLocked(view, true);
-            ViewRoot root = mRoots[index];
+            ViewAncestor root = mRoots[index];
             View curView = root.getView();
             
             root.mAddNesting = 0;
@@ -225,12 +225,12 @@
             }
             
             throw new IllegalStateException("Calling with view " + view
-                    + " but the ViewRoot is attached to " + curView);
+                    + " but the ViewAncestor is attached to " + curView);
         }
     }
     
     View removeViewLocked(int index) {
-        ViewRoot root = mRoots[index];
+        ViewAncestor root = mRoots[index];
         View view = root.getView();
         
         // Don't really remove until we have matched all calls to add().
@@ -256,7 +256,7 @@
         removeItem(tmpViews, mViews, index);
         mViews = tmpViews;
         
-        ViewRoot[] tmpRoots = new ViewRoot[count-1];
+        ViewAncestor[] tmpRoots = new ViewAncestor[count-1];
         removeItem(tmpRoots, mRoots, index);
         mRoots = tmpRoots;
         
@@ -281,7 +281,7 @@
                 //Log.i("foo", "@ " + i + " token " + mParams[i].token
                 //        + " view " + mRoots[i].getView());
                 if (token == null || mParams[i].token == token) {
-                    ViewRoot root = mRoots[i];
+                    ViewAncestor root = mRoots[i];
                     root.mAddNesting = 1;
                     
                     //Log.i("foo", "Force closing " + root);
@@ -308,7 +308,7 @@
             int count = mViews.length;
             for (int i=0; i<count; i++) {
                 if (token == null || mParams[i].token == token) {
-                    ViewRoot root = mRoots[i];
+                    ViewAncestor root = mRoots[i];
                     root.setStopped(stopped);
                 }
             }
@@ -317,13 +317,13 @@
     
     public WindowManager.LayoutParams getRootViewLayoutParameter(View view) {
         ViewParent vp = view.getParent();
-        while (vp != null && !(vp instanceof ViewRoot)) {
+        while (vp != null && !(vp instanceof ViewAncestor)) {
             vp = vp.getParent();
         }
         
         if (vp == null) return null;
         
-        ViewRoot vr = (ViewRoot)vp;
+        ViewAncestor vr = (ViewAncestor)vp;
         
         int N = mRoots.length;
         for (int i = 0; i < N; ++i) {
@@ -344,7 +344,7 @@
     }
 
     private View[] mViews;
-    private ViewRoot[] mRoots;
+    private ViewAncestor[] mRoots;
     private WindowManager.LayoutParams[] mParams;
 
     private static void removeItem(Object[] dst, Object[] src, int index)
diff --git a/core/java/android/view/inputmethod/BaseInputConnection.java b/core/java/android/view/inputmethod/BaseInputConnection.java
index dd2d00d..b4303f4 100644
--- a/core/java/android/view/inputmethod/BaseInputConnection.java
+++ b/core/java/android/view/inputmethod/BaseInputConnection.java
@@ -34,7 +34,7 @@
 import android.view.KeyCharacterMap;
 import android.view.KeyEvent;
 import android.view.View;
-import android.view.ViewRoot;
+import android.view.ViewAncestor;
 
 class ComposingText implements NoCopySpan {
 }
@@ -501,7 +501,7 @@
                 }
             }
             if (h != null) {
-                h.sendMessage(h.obtainMessage(ViewRoot.DISPATCH_KEY_FROM_IME,
+                h.sendMessage(h.obtainMessage(ViewAncestor.DISPATCH_KEY_FROM_IME,
                         event));
             }
         }
diff --git a/core/java/android/view/inputmethod/InputMethodManager.java b/core/java/android/view/inputmethod/InputMethodManager.java
index eef2a33..27cbaf7 100644
--- a/core/java/android/view/inputmethod/InputMethodManager.java
+++ b/core/java/android/view/inputmethod/InputMethodManager.java
@@ -41,7 +41,7 @@
 import android.view.KeyEvent;
 import android.view.MotionEvent;
 import android.view.View;
-import android.view.ViewRoot;
+import android.view.ViewAncestor;
 
 import java.io.FileDescriptor;
 import java.io.PrintWriter;
@@ -636,7 +636,7 @@
                 if (vh != null) {
                     // This will result in a call to reportFinishInputConnection()
                     // below.
-                    vh.sendMessage(vh.obtainMessage(ViewRoot.FINISH_INPUT_CONNECTION,
+                    vh.sendMessage(vh.obtainMessage(ViewAncestor.FINISH_INPUT_CONNECTION,
                             mServedInputConnection));
                 }
             }
@@ -1093,9 +1093,9 @@
 
     void scheduleCheckFocusLocked(View view) {
         Handler vh = view.getHandler();
-        if (vh != null && !vh.hasMessages(ViewRoot.CHECK_FOCUS)) {
+        if (vh != null && !vh.hasMessages(ViewAncestor.CHECK_FOCUS)) {
             // This will result in a call to checkFocus() below.
-            vh.sendMessage(vh.obtainMessage(ViewRoot.CHECK_FOCUS));
+            vh.sendMessage(vh.obtainMessage(ViewAncestor.CHECK_FOCUS));
         }
     }
     
@@ -1150,7 +1150,7 @@
     }
     
     /**
-     * Called by ViewRoot when its window gets input focus.
+     * Called by ViewAncestor when its window gets input focus.
      * @hide
      */
     public void onWindowFocus(View rootView, View focusedView, int softInputMode,
diff --git a/core/java/android/webkit/BrowserFrame.java b/core/java/android/webkit/BrowserFrame.java
index 6306274..9f2fd12 100644
--- a/core/java/android/webkit/BrowserFrame.java
+++ b/core/java/android/webkit/BrowserFrame.java
@@ -35,7 +35,7 @@
 import android.util.Log;
 import android.util.TypedValue;
 import android.view.Surface;
-import android.view.ViewRoot;
+import android.view.ViewAncestor;
 import android.view.WindowManager;
 
 import junit.framework.Assert;
@@ -222,7 +222,7 @@
             sConfigCallback = new ConfigCallback(
                     (WindowManager) appContext.getSystemService(
                             Context.WINDOW_SERVICE));
-            ViewRoot.addConfigCallback(sConfigCallback);
+            ViewAncestor.addConfigCallback(sConfigCallback);
         }
         sConfigCallback.addHandler(this);
 
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index d63d421..df4c4ed 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -2818,7 +2818,7 @@
                         if (ev.getEdgeFlags() != 0 && motionPosition < 0) {
                             // If we couldn't find a view to click on, but the down event
                             // was touching the edge, we will bail out and try again.
-                            // This allows the edge correcting code in ViewRoot to try to
+                            // This allows the edge correcting code in ViewAncestor to try to
                             // find a nearby view to select
                             return false;
                         }
@@ -5021,7 +5021,7 @@
                     public boolean sendKeyEvent(KeyEvent event) {
                         // Use our own input connection, since the filter
                         // text view may not be shown in a window so has
-                        // no ViewRoot to dispatch events with.
+                        // no ViewAncestor to dispatch events with.
                         return mDefInputConnection.sendKeyEvent(event);
                     }
                 };
diff --git a/core/java/android/widget/ListView.java b/core/java/android/widget/ListView.java
index d115364..e11f5bb 100644
--- a/core/java/android/widget/ListView.java
+++ b/core/java/android/widget/ListView.java
@@ -1568,7 +1568,7 @@
 
             // take focus back to us temporarily to avoid the eventual
             // call to clear focus when removing the focused child below
-            // from messing things up when ViewRoot assigns focus back
+            // from messing things up when ViewAncestor assigns focus back
             // to someone else
             final View focusedChild = getFocusedChild();
             if (focusedChild != null) {
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 24b176d..c38624f 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -113,7 +113,7 @@
 import android.view.ViewGroup;
 import android.view.ViewGroup.LayoutParams;
 import android.view.ViewParent;
-import android.view.ViewRoot;
+import android.view.ViewAncestor;
 import android.view.ViewTreeObserver;
 import android.view.WindowManager;
 import android.view.accessibility.AccessibilityEvent;
@@ -3373,13 +3373,13 @@
         Handler h = getHandler();
         if (h != null) {
             long eventTime = SystemClock.uptimeMillis();
-            h.sendMessage(h.obtainMessage(ViewRoot.DISPATCH_KEY_FROM_IME,
+            h.sendMessage(h.obtainMessage(ViewAncestor.DISPATCH_KEY_FROM_IME,
                     new KeyEvent(eventTime, eventTime,
                     KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_ENTER, 0, 0,
                     KeyCharacterMap.VIRTUAL_KEYBOARD, 0,
                     KeyEvent.FLAG_SOFT_KEYBOARD | KeyEvent.FLAG_KEEP_TOUCH_MODE
                     | KeyEvent.FLAG_EDITOR_ACTION)));
-            h.sendMessage(h.obtainMessage(ViewRoot.DISPATCH_KEY_FROM_IME,
+            h.sendMessage(h.obtainMessage(ViewAncestor.DISPATCH_KEY_FROM_IME,
                     new KeyEvent(SystemClock.uptimeMillis(), eventTime,
                     KeyEvent.ACTION_UP, KeyEvent.KEYCODE_ENTER, 0, 0,
                     KeyCharacterMap.VIRTUAL_KEYBOARD, 0,
@@ -7152,7 +7152,7 @@
                 }
 
                 // The DecorView does not have focus when the 'Done' ExtractEditText button is
-                // pressed. Since it is the ViewRoot's mView, it requests focus before
+                // pressed. Since it is the ViewAncestor's mView, it requests focus before
                 // ExtractEditText clears focus, which gives focus to the ExtractEditText.
                 // This special case ensure that we keep current selection in that case.
                 // It would be better to know why the DecorView does not have focus at that time.
diff --git a/core/java/android/widget/ZoomButtonsController.java b/core/java/android/widget/ZoomButtonsController.java
index 450c966..9e37c7b 100644
--- a/core/java/android/widget/ZoomButtonsController.java
+++ b/core/java/android/widget/ZoomButtonsController.java
@@ -33,7 +33,7 @@
 import android.view.ViewConfiguration;
 import android.view.ViewGroup;
 import android.view.ViewParent;
-import android.view.ViewRoot;
+import android.view.ViewAncestor;
 import android.view.WindowManager;
 import android.view.View.OnClickListener;
 import android.view.WindowManager.LayoutParams;
@@ -501,7 +501,7 @@
 
         } else {
 
-            ViewRoot viewRoot = getOwnerViewRoot();
+            ViewAncestor viewRoot = getOwnerViewAncestor();
             if (viewRoot != null) {
                 viewRoot.dispatchKey(event);
             }
@@ -526,15 +526,15 @@
         }
     }
 
-    private ViewRoot getOwnerViewRoot() {
+    private ViewAncestor getOwnerViewAncestor() {
         View rootViewOfOwner = mOwnerView.getRootView();
         if (rootViewOfOwner == null) {
             return null;
         }
 
         ViewParent parentOfRootView = rootViewOfOwner.getParent();
-        if (parentOfRootView instanceof ViewRoot) {
-            return (ViewRoot) parentOfRootView;
+        if (parentOfRootView instanceof ViewAncestor) {
+            return (ViewAncestor) parentOfRootView;
         } else {
             return null;
         }
diff --git a/core/java/com/android/internal/widget/PasswordEntryKeyboardHelper.java b/core/java/com/android/internal/widget/PasswordEntryKeyboardHelper.java
index 65973b6..3070e3e 100644
--- a/core/java/com/android/internal/widget/PasswordEntryKeyboardHelper.java
+++ b/core/java/com/android/internal/widget/PasswordEntryKeyboardHelper.java
@@ -29,7 +29,7 @@
 import android.view.KeyCharacterMap;
 import android.view.KeyEvent;
 import android.view.View;
-import android.view.ViewRoot;
+import android.view.ViewAncestor;
 import com.android.internal.R;
 
 public class PasswordEntryKeyboardHelper implements OnKeyboardActionListener {
@@ -150,7 +150,7 @@
                 KeyEvent event = events[i];
                 event = KeyEvent.changeFlags(event, event.getFlags()
                         | KeyEvent.FLAG_SOFT_KEYBOARD | KeyEvent.FLAG_KEEP_TOUCH_MODE);
-                handler.sendMessage(handler.obtainMessage(ViewRoot.DISPATCH_KEY, event));
+                handler.sendMessage(handler.obtainMessage(ViewAncestor.DISPATCH_KEY, event));
             }
         }
     }
@@ -158,11 +158,11 @@
     public void sendDownUpKeyEvents(int keyEventCode) {
         long eventTime = SystemClock.uptimeMillis();
         Handler handler = mTargetView.getHandler();
-        handler.sendMessage(handler.obtainMessage(ViewRoot.DISPATCH_KEY_FROM_IME,
+        handler.sendMessage(handler.obtainMessage(ViewAncestor.DISPATCH_KEY_FROM_IME,
                 new KeyEvent(eventTime, eventTime, KeyEvent.ACTION_DOWN, keyEventCode, 0, 0,
                         KeyCharacterMap.VIRTUAL_KEYBOARD, 0,
                     KeyEvent.FLAG_SOFT_KEYBOARD|KeyEvent.FLAG_KEEP_TOUCH_MODE)));
-        handler.sendMessage(handler.obtainMessage(ViewRoot.DISPATCH_KEY_FROM_IME,
+        handler.sendMessage(handler.obtainMessage(ViewAncestor.DISPATCH_KEY_FROM_IME,
                 new KeyEvent(eventTime, eventTime, KeyEvent.ACTION_UP, keyEventCode, 0, 0,
                         KeyCharacterMap.VIRTUAL_KEYBOARD, 0,
                         KeyEvent.FLAG_SOFT_KEYBOARD|KeyEvent.FLAG_KEEP_TOUCH_MODE)));
diff --git a/core/jni/Android.mk b/core/jni/Android.mk
index 95224a4..8beb94b 100644
--- a/core/jni/Android.mk
+++ b/core/jni/Android.mk
@@ -48,7 +48,7 @@
 	android_view_Display.cpp \
 	android_view_Surface.cpp \
 	android_view_TextureView.cpp \
-	android_view_ViewRoot.cpp \
+	android_view_ViewAncestor.cpp \
 	android_view_InputChannel.cpp \
 	android_view_InputQueue.cpp \
 	android_view_KeyEvent.cpp \
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp
index c915753..17f9246 100644
--- a/core/jni/AndroidRuntime.cpp
+++ b/core/jni/AndroidRuntime.cpp
@@ -119,7 +119,7 @@
 extern int register_android_view_GLES20Canvas(JNIEnv* env);
 extern int register_android_view_Surface(JNIEnv* env);
 extern int register_android_view_TextureView(JNIEnv* env);
-extern int register_android_view_ViewRoot(JNIEnv* env);
+extern int register_android_view_ViewAncestor(JNIEnv* env);
 extern int register_android_database_CursorWindow(JNIEnv* env);
 extern int register_android_database_SQLiteCompiledSql(JNIEnv* env);
 extern int register_android_database_SQLiteDatabase(JNIEnv* env);
@@ -1124,7 +1124,7 @@
     REG_JNI(register_android_view_GLES20Canvas),
     REG_JNI(register_android_view_Surface),
     REG_JNI(register_android_view_TextureView),
-    REG_JNI(register_android_view_ViewRoot),
+    REG_JNI(register_android_view_ViewAncestor),
     REG_JNI(register_com_google_android_gles_jni_EGLImpl),
     REG_JNI(register_com_google_android_gles_jni_GLImpl),
     REG_JNI(register_android_opengl_jni_GLES10),
diff --git a/core/jni/android_view_ViewRoot.cpp b/core/jni/android_view_ViewAncestor.cpp
similarity index 91%
rename from core/jni/android_view_ViewRoot.cpp
rename to core/jni/android_view_ViewAncestor.cpp
index 2988ae8..d8e1124 100644
--- a/core/jni/android_view_ViewRoot.cpp
+++ b/core/jni/android_view_ViewAncestor.cpp
@@ -35,7 +35,7 @@
 
 static int gPrevDur;
 
-static void android_view_ViewRoot_showFPS(JNIEnv* env, jobject, jobject jcanvas,
+static void android_view_ViewAncestor_showFPS(JNIEnv* env, jobject, jobject jcanvas,
                                           jint dur) {
     NPE_CHECK_RETURN_VOID(env, jcanvas);
     SkCanvas* canvas = GraphicsJNI::getNativeCanvas(env, jcanvas);
@@ -79,14 +79,14 @@
 
 // ----------------------------------------------------------------------------
 
-const char* const kClassPathName = "android/view/ViewRoot";
+const char* const kClassPathName = "android/view/ViewAncestor";
 
 static JNINativeMethod gMethods[] = {
     {   "nativeShowFPS", "(Landroid/graphics/Canvas;I)V",
-                                        (void*)android_view_ViewRoot_showFPS }
+                                        (void*)android_view_ViewAncestor_showFPS }
 };
 
-int register_android_view_ViewRoot(JNIEnv* env) {
+int register_android_view_ViewAncestor(JNIEnv* env) {
     return AndroidRuntime::registerNativeMethods(env,
             kClassPathName, gMethods, NELEM(gMethods));
 }
diff --git a/core/tests/coretests/src/android/widget/focus/RequestFocusTest.java b/core/tests/coretests/src/android/widget/focus/RequestFocusTest.java
index 477831e..909a8c9 100644
--- a/core/tests/coretests/src/android/widget/focus/RequestFocusTest.java
+++ b/core/tests/coretests/src/android/widget/focus/RequestFocusTest.java
@@ -90,7 +90,7 @@
             fail("requestFocus from wrong thread should raise exception.");
         } catch (AndroidRuntimeException e) {
             // Expected.  The actual exception is not public, so we can't catch it.
-            assertEquals("android.view.ViewRoot$CalledFromWrongThreadException",
+            assertEquals("android.view.ViewAncestor$CalledFromWrongThreadException",
                          e.getClass().getName());
         }
     }
diff --git a/core/tests/coretests/src/android/widget/listview/ListViewHeight.java b/core/tests/coretests/src/android/widget/listview/ListViewHeight.java
index 64f280a..5cf3ff6 100644
--- a/core/tests/coretests/src/android/widget/listview/ListViewHeight.java
+++ b/core/tests/coretests/src/android/widget/listview/ListViewHeight.java
@@ -88,7 +88,7 @@
 
         // Clicking this button will remove the list adapter and hide the outer enclosing view.
         // We have to climb all the way to the top because the bug (not checking visibility)
-        // only occurs at the very outer loop of ViewRoot.performTraversals and in the case of
+        // only occurs at the very outer loop of ViewAncestor.performTraversals and in the case of
         // an Activity, this means you have to crawl all the way out to the root view.
         // In the search manager, it's sufficient to simply show/hide the outer search manager
         // view to trigger the same bug.