summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorRobert Carr <racarr@google.com>2021-05-05 13:22:57 -0700
committerRobert Carr <racarr@google.com>2021-05-05 14:28:25 -0700
commit599f912e4e3611ca5d537b6780c026bcf44e8395 (patch)
tree1c0e13a7bb3bc3796f30c9535d6b1f9bf66fa373 /core/java/android
parent0e4d7f142b781bb6721c574592ba62a062bad183 (diff)
AttachedSurfaceControl: Respond to API feedback.
"Root" is eliminated from the interface name as it is a property of the object and not the interface, but remains highlighted in the getters to express the relationship between the called and returned object. Bug: 185365821 Test: Existing tests pass Change-Id: I163fc23f2c37c984ef3ffeb7514c4d8c1c1a3f90
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/view/AttachedSurfaceControl.java (renamed from core/java/android/view/ViewRoot.java)21
-rw-r--r--core/java/android/view/View.java20
-rw-r--r--core/java/android/view/ViewRootImpl.java3
-rw-r--r--core/java/android/view/Window.java7
4 files changed, 28 insertions, 23 deletions
diff --git a/core/java/android/view/ViewRoot.java b/core/java/android/view/AttachedSurfaceControl.java
index 3c755981a440..bcc5b56459bb 100644
--- a/core/java/android/view/ViewRoot.java
+++ b/core/java/android/view/AttachedSurfaceControl.java
@@ -22,16 +22,19 @@ import android.annotation.UiThread;
/**
* Provides an interface to the root-Surface of a View Hierarchy or Window. This
* is used in combination with the {@link android.view.SurfaceControl} API to enable
- * attaching app created SurfaceControl to the ViewRoot's surface hierarchy, and enable
- * SurfaceTransactions to be performed in sync with the ViewRoot drawing. This object
- * is obtained from {@link android.view.View#getViewRoot} and
- * {@link android.view.Window#getViewRoot}. It must be used from the UI thread of
+ * attaching app created SurfaceControl to the SurfaceControl hierarchy used
+ * by the app, and enable SurfaceTransactions to be performed in sync with the
+ * View hierarchy drawing.
+ *
+ * This object is obtained from {@link android.view.View#getRootSurfaceControl} and
+ * {@link android.view.Window#getRootSurfaceControl}. It must be used from the UI thread of
* the object it was obtained from.
*/
@UiThread
-public interface ViewRoot {
+public interface AttachedSurfaceControl {
/**
- * Create a transaction which will reparent {@param child} to the ViewRoot. See
+ * Create a transaction which will reparent {@param child} to the View hierarchy
+ * root SurfaceControl. See
* {@link SurfaceControl.Transaction#reparent}. This transacton must be applied
* or merged in to another transaction by the caller, otherwise it will have
* no effect.
@@ -42,9 +45,9 @@ public interface ViewRoot {
@Nullable SurfaceControl.Transaction buildReparentTransaction(@NonNull SurfaceControl child);
/**
- * Consume the passed in transaction, and request the ViewRoot to apply it with the
- * next draw. This transaction will be merged with the buffer transaction from the ViewRoot
- * and they will show up on-screen atomically synced.
+ * Consume the passed in transaction, and request the View hierarchy to apply it atomically
+ * with the next draw. This transaction will be merged with the buffer transaction from the
+ * ViewRoot and they will show up on-screen atomically synced.
*
* This will not cause a draw to be scheduled, and if there are no other changes
* to the View hierarchy you may need to call {@link android.view.View#invalidate}
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 11fac0561907..72103dccff2e 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -29594,7 +29594,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
return mScrollCaptureInternal;
}
- ViewRoot getViewRoot() {
+ AttachedSurfaceControl getRootSurfaceControl() {
return mViewRootImpl;
}
@@ -31038,17 +31038,17 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
}
/**
- * @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}.
+ * The AttachedSurfaceControl 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}.
+
+ * @return The {@link android.view.AttachedSurfaceControl} interface for this View.
+ * This will only return a non-null value when called between {@link #onAttachedToWindow}
+ * and {@link #onDetachedFromWindow}.
*/
- public @Nullable ViewRoot getViewRoot() {
+ public @Nullable AttachedSurfaceControl getRootSurfaceControl() {
if (mAttachInfo != null) {
- return mAttachInfo.getViewRoot();
+ return mAttachInfo.getRootSurfaceControl();
}
return null;
}
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 0958f3fbd771..78d4e42916df 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -224,7 +224,8 @@ import java.util.concurrent.CountDownLatch;
*/
@SuppressWarnings({"EmptyCatchBlock", "PointlessBooleanExpression"})
public final class ViewRootImpl implements ViewParent,
- View.AttachInfo.Callbacks, ThreadedRenderer.DrawCallbacks, ViewRoot {
+ View.AttachInfo.Callbacks, ThreadedRenderer.DrawCallbacks,
+ AttachedSurfaceControl {
private static final String TAG = "ViewRootImpl";
private static final boolean DBG = false;
private static final boolean LOCAL_LOGV = false;
diff --git a/core/java/android/view/Window.java b/core/java/android/view/Window.java
index 52a09701803d..5fb4e705c831 100644
--- a/core/java/android/view/Window.java
+++ b/core/java/android/view/Window.java
@@ -2722,11 +2722,12 @@ public abstract class Window {
/**
* This will be null before a content view is added, e.g. via
- * {@link #setContentView} or {@link #addContentView}.
+ * {@link #setContentView} or {@link #addContentView}. See
+ * {@link android.view.View#getRootSurfaceControl}.
*
- * @return The {@link android.view.ViewRoot} interface for this Window
+ * @return The {@link android.view.AttachedSurfaceControl} interface for this Window
*/
- public @Nullable ViewRoot getViewRoot() {
+ public @Nullable AttachedSurfaceControl getRootSurfaceControl() {
return null;
}
}