From a175a5b7ea3682cb58cca7f9726d0b8171cd549d Mon Sep 17 00:00:00 2001 From: Jeff Brown Date: Wed, 15 Feb 2012 19:18:31 -0800 Subject: Encapsulate the ViewRootImpl's handler. This change makes it much easier to make sense of the messages that get posted to the ViewRootImpl's handler by encapsulating their point of dispatch within the ViewRootImpl itself. As part of this change, the View.AttachInfo now carries a reference to the ViewRootImpl itself, which simplifies some code that used to try to find the ViewRootImpl by getting the root view's parent. In principle, it might have been nice to hide the ViewRootImpl from the View hierarchy but in practice the two were coupled in many ways. Change-Id: I51ebccdf5f8c8c505cd6f17cdf594174d041dc54 --- core/java/android/view/ViewDebug.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'core/java/android/view/ViewDebug.java') diff --git a/core/java/android/view/ViewDebug.java b/core/java/android/view/ViewDebug.java index c1db5720e2f1..2a178451df9e 100644 --- a/core/java/android/view/ViewDebug.java +++ b/core/java/android/view/ViewDebug.java @@ -375,7 +375,7 @@ public class ViewDebug { } private static BufferedWriter sHierarchyTraces; - private static ViewRootImpl sHierarhcyRoot; + private static ViewRootImpl sHierarchyRoot; private static String sHierarchyTracePrefix; /** @@ -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!"); } @@ -874,7 +874,7 @@ public class ViewDebug { return; } - sHierarhcyRoot = (ViewRootImpl) view.getRootView().getParent(); + sHierarchyRoot = view.getViewRootImpl(); } /** @@ -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()!"); } @@ -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); @@ -932,7 +932,7 @@ public class ViewDebug { } } - sHierarhcyRoot = null; + sHierarchyRoot = null; } static void dispatchCommand(View view, String command, String parameters, -- cgit v1.2.3