summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/view/SurfaceView.java56
1 files changed, 41 insertions, 15 deletions
diff --git a/core/java/android/view/SurfaceView.java b/core/java/android/view/SurfaceView.java
index 198ac9d81ce8..b24303b41abd 100644
--- a/core/java/android/view/SurfaceView.java
+++ b/core/java/android/view/SurfaceView.java
@@ -121,16 +121,23 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall
private static final boolean DEBUG = false;
private static final boolean DEBUG_POSITION = false;
- @UnsupportedAppUsage
+ @UnsupportedAppUsage(
+ maxTargetSdk = Build.VERSION_CODES.TIRAMISU,
+ publicAlternatives = "Track {@link SurfaceHolder#addCallback} instead")
final ArrayList<SurfaceHolder.Callback> mCallbacks = new ArrayList<>();
final int[] mLocation = new int[2];
- @UnsupportedAppUsage
+ @UnsupportedAppUsage(
+ maxTargetSdk = Build.VERSION_CODES.TIRAMISU,
+ publicAlternatives = "Use {@link SurfaceHolder#lockCanvas} instead")
final ReentrantLock mSurfaceLock = new ReentrantLock();
- @UnsupportedAppUsage
+ @UnsupportedAppUsage(
+ maxTargetSdk = Build.VERSION_CODES.TIRAMISU,
+ publicAlternatives = "Use {@link SurfaceHolder#getSurface} instead")
final Surface mSurface = new Surface(); // Current surface in use
- @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023,
+ publicAlternatives = "Use {@link View#getVisibility} instead")
boolean mDrawingStopped = true;
// We use this to track if the application has produced a frame
// in to the Surface. Up until that point, we should be careful not to punch
@@ -156,13 +163,16 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall
int mSubLayer = APPLICATION_MEDIA_SUBLAYER;
int mRequestedSubLayer = APPLICATION_MEDIA_SUBLAYER;
- @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023,
+ publicAlternatives = "Use {@link SurfaceHolder#isCreating} instead")
boolean mIsCreating = false;
private final ViewTreeObserver.OnScrollChangedListener mScrollChangedListener =
this::updateSurface;
- @UnsupportedAppUsage
+ @UnsupportedAppUsage(
+ maxTargetSdk = Build.VERSION_CODES.TIRAMISU,
+ publicAlternatives = "Rely on {@link ViewTreeObserver#dispatchOnPreDraw} instead")
private final ViewTreeObserver.OnPreDrawListener mDrawListener = () -> {
// reposition ourselves where the surface is
mHaveFrame = getWidth() > 0 && getHeight() > 0;
@@ -176,24 +186,32 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall
boolean mViewVisibility = false;
boolean mWindowStopped = false;
- @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023,
+ publicAlternatives = "Use {@link View#getWidth} instead")
int mRequestedWidth = -1;
- @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023,
+ publicAlternatives = "Use {@link View#getHeight} instead")
int mRequestedHeight = -1;
/* Set SurfaceView's format to 565 by default to maintain backward
* compatibility with applications assuming this format.
*/
- @UnsupportedAppUsage
+ @UnsupportedAppUsage(
+ maxTargetSdk = Build.VERSION_CODES.TIRAMISU,
+ publicAlternatives = "Use {@code SurfaceHolder.Callback#surfaceChanged} instead")
int mRequestedFormat = PixelFormat.RGB_565;
float mAlpha = 1f;
boolean mClipSurfaceToBounds;
int mBackgroundColor = Color.BLACK;
- @UnsupportedAppUsage
+ @UnsupportedAppUsage(
+ maxTargetSdk = Build.VERSION_CODES.TIRAMISU,
+ publicAlternatives = "Use {@link View#getWidth} and {@link View#getHeight} to "
+ + "determine if the SurfaceView is onscreen and has a frame")
boolean mHaveFrame = false;
boolean mSurfaceCreated = false;
- @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023,
+ publicAlternatives = "Time {@link SurfaceHolder#lockCanvas} instead")
long mLastLockTime = 0;
boolean mVisible = false;
@@ -202,9 +220,13 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall
int mSurfaceWidth = -1;
int mSurfaceHeight = -1;
float mCornerRadius;
- @UnsupportedAppUsage
+ @UnsupportedAppUsage(
+ maxTargetSdk = Build.VERSION_CODES.TIRAMISU,
+ publicAlternatives = "Use {@code SurfaceHolder.Callback#surfaceChanged} "
+ + "instead")
int mFormat = -1;
- @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023,
+ publicAlternatives = "Use {@link SurfaceHolder#getSurfaceFrame} instead")
final Rect mSurfaceFrame = new Rect();
int mLastSurfaceWidth = -1, mLastSurfaceHeight = -1;
@SurfaceControl.BufferTransform int mTransformHint = 0;
@@ -1410,7 +1432,9 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall
* @return true if the surface has dimensions that are fixed in size
* @hide
*/
- @UnsupportedAppUsage
+ @UnsupportedAppUsage(
+ maxTargetSdk = Build.VERSION_CODES.TIRAMISU,
+ publicAlternatives = "Track {@link SurfaceHolder#setFixedSize} instead")
public boolean isFixedSize() {
return (mRequestedWidth != -1 || mRequestedHeight != -1);
}
@@ -1446,7 +1470,9 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall
updateBackgroundColor(t);
}
- @UnsupportedAppUsage
+ @UnsupportedAppUsage(
+ maxTargetSdk = Build.VERSION_CODES.TIRAMISU,
+ publicAlternatives = "Use {@link SurfaceView#getHolder} instead")
private final SurfaceHolder mSurfaceHolder = new SurfaceHolder() {
private static final String LOG_TAG = "SurfaceHolder";