summaryrefslogtreecommitdiff
path: root/core/java/android/view/View.java
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/android/view/View.java')
-rw-r--r--core/java/android/view/View.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 615dd82fb848..612058ebcea5 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -29541,6 +29541,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
return mScrollCaptureInternal;
}
+ ViewRoot getViewRoot() {
+ return mViewRootImpl;
+ }
+
public void dump(String prefix, PrintWriter writer) {
String innerPrefix = prefix + " ";
writer.println(prefix + "AttachInfo:");
@@ -30928,4 +30932,20 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
callback.onDisplayHashError(DISPLAY_HASH_ERROR_UNKNOWN);
}
}
+
+ /**
+ * @return The {@link android.view.ViewRoot} interface for this View. This will only
+ * return a non-null value when called between {@link #onAttachedToWindow} and
+ * {@link #onDetachedFromWindow}.
+ *
+ * The ViewRoot itself is not a View, it is just the interface to the windowing-system
+ * object that contains the entire view hierarchy. For the root View of a given hierarchy
+ * see {@link #getRootView}.
+ */
+ public @Nullable ViewRoot getViewRoot() {
+ if (mAttachInfo != null) {
+ return mAttachInfo.getViewRoot();
+ }
+ return null;
+ }
}