summaryrefslogtreecommitdiff
path: root/core/java/android/view/View.java
diff options
context:
space:
mode:
authorRob Carr <racarr@google.com>2021-03-31 01:35:49 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2021-03-31 01:35:49 +0000
commit2b434b28b0b87ce0f7012207d96df9ee658e5c10 (patch)
treec524db14ddd9a3a19d4ba63f0adc9067b158d0ac /core/java/android/view/View.java
parent0ad02d42136b4c77b598dd5f701cc04278ae2ad5 (diff)
parentee90cd4871121ae02da9b0b4d3fd7573084d729e (diff)
Merge "Expose API for using SurfaceControl with ViewRootImpl" into sc-dev
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 63a7dea058c8..61d74a40bee5 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -29543,6 +29543,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:");
@@ -30930,4 +30934,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;
+ }
}