Loading core/api/current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -52657,6 +52657,8 @@ package android.view { ctor public SurfaceView(android.content.Context, android.util.AttributeSet, int); ctor public SurfaceView(android.content.Context, android.util.AttributeSet, int, int); method public void applyTransactionToFrame(@NonNull android.view.SurfaceControl.Transaction); method @FlaggedApi("android.view.flags.surface_view_get_surface_package") public void clearChildSurfacePackage(); method @FlaggedApi("android.view.flags.surface_view_get_surface_package") @Nullable public android.view.SurfaceControlViewHost.SurfacePackage getChildSurfacePackage(); method @FlaggedApi("android.view.flags.surface_view_set_composition_order") public int getCompositionOrder(); method public android.view.SurfaceHolder getHolder(); method @Deprecated @Nullable public android.os.IBinder getHostToken(); core/java/android/view/SurfaceView.java +45 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.view; import static android.view.flags.Flags.FLAG_SURFACE_VIEW_GET_SURFACE_PACKAGE; import static android.view.flags.Flags.FLAG_SURFACE_VIEW_SET_COMPOSITION_ORDER; import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; import static android.view.WindowManagerPolicyConstants.APPLICATION_MEDIA_OVERLAY_SUBLAYER; Loading @@ -27,6 +28,7 @@ import android.annotation.FloatRange; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SuppressLint; import android.compat.annotation.UnsupportedAppUsage; import android.content.Context; import android.content.res.CompatibilityInfo.Translator; Loading Loading @@ -2112,7 +2114,7 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall } /** * Display the view-hierarchy embedded within a {@link SurfaceControlViewHost.SurfacePackage} * Displays the view-hierarchy embedded within a {@link SurfaceControlViewHost.SurfacePackage} * within this SurfaceView. * * This can be called independently of the SurfaceView lifetime callbacks. SurfaceView Loading @@ -2132,6 +2134,8 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall * SurfaceView the underlying {@link SurfaceControlViewHost} remains managed by it's original * remote-owner. * * Users can call {@link SurfaceView#clearChildSurfacePackage} to clear the package. * * @param p The SurfacePackage to embed. */ public void setChildSurfacePackage(@NonNull SurfaceControlViewHost.SurfacePackage p) { Loading @@ -2155,6 +2159,46 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall invalidate(); } /** * Returns the {@link SurfaceControlViewHost.SurfacePackage} that was set on this SurfaceView. * * Note: This method will return {@code null} if * {@link #setChildSurfacePackage(SurfaceControlViewHost.SurfacePackage)} * has not been called or if {@link #clearChildSurfacePackage()} has been called. * * @see #setChildSurfacePackage(SurfaceControlViewHost.SurfacePackage) */ @SuppressLint("GetterSetterNullability") @FlaggedApi(FLAG_SURFACE_VIEW_GET_SURFACE_PACKAGE) public @Nullable SurfaceControlViewHost.SurfacePackage getChildSurfacePackage() { return mSurfacePackage; } /** * Clears the {@link SurfaceControlViewHost.SurfacePackage} that was set on this SurfaceView. * This hides any content rendered by the provided * {@link SurfaceControlViewHost.SurfacePackage}. * * @see #setChildSurfacePackage(SurfaceControlViewHost.SurfacePackage) */ @FlaggedApi(FLAG_SURFACE_VIEW_GET_SURFACE_PACKAGE) public void clearChildSurfacePackage() { if (mSurfacePackage != null) { mSurfaceControlViewHostParent.detach(); mEmbeddedWindowParams.clear(); // Reparent the SurfaceControl to remove the content on screen. final SurfaceControl sc = mSurfacePackage.getSurfaceControl(); final SurfaceControl.Transaction transaction = new Transaction(); transaction.reparent(sc, null); mSurfacePackage.release(); applyTransactionOnVriDraw(transaction); mSurfacePackage = null; invalidate(); } } private void reparentSurfacePackage(SurfaceControl.Transaction t, SurfaceControlViewHost.SurfacePackage p) { final SurfaceControl sc = p.getSurfaceControl(); Loading core/java/android/view/flags/view_flags.aconfig +8 −0 Original line number Diff line number Diff line Loading @@ -118,6 +118,14 @@ flag { is_fixed_read_only: true } flag { name: "surface_view_get_surface_package" namespace: "window_surfaces" description: "Add APIs to manage SurfacePackage of the parent SurfaceView." bug: "341021569" is_fixed_read_only: true } flag { name: "use_refactored_round_scrollbar" namespace: "wear_frameworks" Loading Loading
core/api/current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -52657,6 +52657,8 @@ package android.view { ctor public SurfaceView(android.content.Context, android.util.AttributeSet, int); ctor public SurfaceView(android.content.Context, android.util.AttributeSet, int, int); method public void applyTransactionToFrame(@NonNull android.view.SurfaceControl.Transaction); method @FlaggedApi("android.view.flags.surface_view_get_surface_package") public void clearChildSurfacePackage(); method @FlaggedApi("android.view.flags.surface_view_get_surface_package") @Nullable public android.view.SurfaceControlViewHost.SurfacePackage getChildSurfacePackage(); method @FlaggedApi("android.view.flags.surface_view_set_composition_order") public int getCompositionOrder(); method public android.view.SurfaceHolder getHolder(); method @Deprecated @Nullable public android.os.IBinder getHostToken();
core/java/android/view/SurfaceView.java +45 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.view; import static android.view.flags.Flags.FLAG_SURFACE_VIEW_GET_SURFACE_PACKAGE; import static android.view.flags.Flags.FLAG_SURFACE_VIEW_SET_COMPOSITION_ORDER; import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; import static android.view.WindowManagerPolicyConstants.APPLICATION_MEDIA_OVERLAY_SUBLAYER; Loading @@ -27,6 +28,7 @@ import android.annotation.FloatRange; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SuppressLint; import android.compat.annotation.UnsupportedAppUsage; import android.content.Context; import android.content.res.CompatibilityInfo.Translator; Loading Loading @@ -2112,7 +2114,7 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall } /** * Display the view-hierarchy embedded within a {@link SurfaceControlViewHost.SurfacePackage} * Displays the view-hierarchy embedded within a {@link SurfaceControlViewHost.SurfacePackage} * within this SurfaceView. * * This can be called independently of the SurfaceView lifetime callbacks. SurfaceView Loading @@ -2132,6 +2134,8 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall * SurfaceView the underlying {@link SurfaceControlViewHost} remains managed by it's original * remote-owner. * * Users can call {@link SurfaceView#clearChildSurfacePackage} to clear the package. * * @param p The SurfacePackage to embed. */ public void setChildSurfacePackage(@NonNull SurfaceControlViewHost.SurfacePackage p) { Loading @@ -2155,6 +2159,46 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall invalidate(); } /** * Returns the {@link SurfaceControlViewHost.SurfacePackage} that was set on this SurfaceView. * * Note: This method will return {@code null} if * {@link #setChildSurfacePackage(SurfaceControlViewHost.SurfacePackage)} * has not been called or if {@link #clearChildSurfacePackage()} has been called. * * @see #setChildSurfacePackage(SurfaceControlViewHost.SurfacePackage) */ @SuppressLint("GetterSetterNullability") @FlaggedApi(FLAG_SURFACE_VIEW_GET_SURFACE_PACKAGE) public @Nullable SurfaceControlViewHost.SurfacePackage getChildSurfacePackage() { return mSurfacePackage; } /** * Clears the {@link SurfaceControlViewHost.SurfacePackage} that was set on this SurfaceView. * This hides any content rendered by the provided * {@link SurfaceControlViewHost.SurfacePackage}. * * @see #setChildSurfacePackage(SurfaceControlViewHost.SurfacePackage) */ @FlaggedApi(FLAG_SURFACE_VIEW_GET_SURFACE_PACKAGE) public void clearChildSurfacePackage() { if (mSurfacePackage != null) { mSurfaceControlViewHostParent.detach(); mEmbeddedWindowParams.clear(); // Reparent the SurfaceControl to remove the content on screen. final SurfaceControl sc = mSurfacePackage.getSurfaceControl(); final SurfaceControl.Transaction transaction = new Transaction(); transaction.reparent(sc, null); mSurfacePackage.release(); applyTransactionOnVriDraw(transaction); mSurfacePackage = null; invalidate(); } } private void reparentSurfacePackage(SurfaceControl.Transaction t, SurfaceControlViewHost.SurfacePackage p) { final SurfaceControl sc = p.getSurfaceControl(); Loading
core/java/android/view/flags/view_flags.aconfig +8 −0 Original line number Diff line number Diff line Loading @@ -118,6 +118,14 @@ flag { is_fixed_read_only: true } flag { name: "surface_view_get_surface_package" namespace: "window_surfaces" description: "Add APIs to manage SurfacePackage of the parent SurfaceView." bug: "341021569" is_fixed_read_only: true } flag { name: "use_refactored_round_scrollbar" namespace: "wear_frameworks" Loading