diff options
author | Jerome Gaillard <jgaillard@google.com> | 2023-09-19 16:19:41 +0100 |
---|---|---|
committer | Cherrypicker Worker <android-build-cherrypicker-worker@google.com> | 2023-09-20 11:38:07 +0000 |
commit | cf5f6c63917fa0fe30ebd91718f53c7f4228f1b7 (patch) | |
tree | 5ec539f50963fb576ecfce3d8cc2098116772e14 | |
parent | 9bece20919d659f126da8b5ea285651653dc9039 (diff) | |
download | layoutlib-cf5f6c63917fa0fe30ebd91718f53c7f4228f1b7.tar.gz |
Complete layoutlib SurfaceView
This adds to the layoutlib version of SurfaceView missing public methods
from the original SurfaceView.
Bug: 301064843
Test: N/A
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:d55d2e8ab60b4ab747ed155fa6eae29c761ec2ee)
Merged-In: I7ff96ce1ee513aebb2db819c332385e67c48f927
Change-Id: I7ff96ce1ee513aebb2db819c332385e67c48f927
-rw-r--r-- | bridge/src/android/view/SurfaceView.java | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/bridge/src/android/view/SurfaceView.java b/bridge/src/android/view/SurfaceView.java index ebb2af4532..2c1d6747e7 100644 --- a/bridge/src/android/view/SurfaceView.java +++ b/bridge/src/android/view/SurfaceView.java @@ -18,11 +18,17 @@ package android.view; import com.android.layoutlib.bridge.MockView; +import android.annotation.NonNull; +import android.annotation.Nullable; import android.content.Context; import android.graphics.Canvas; import android.graphics.Rect; import android.graphics.Region; +import android.os.IBinder; import android.util.AttributeSet; +import android.view.SurfaceControl.Transaction; + +import java.util.function.Consumer; /** * Mock version of the SurfaceView. @@ -50,6 +56,11 @@ public class SurfaceView extends MockView { super(context, attrs, defStyleAttr, defStyleRes); } + public SurfaceView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr, + int defStyleRes, boolean disableBackgroundLayer) { + super(context, attrs, defStyleAttr, defStyleRes); + } + public boolean gatherTransparentRegion(Region region) { return false; } @@ -60,6 +71,14 @@ public class SurfaceView extends MockView { public void setZOrderOnTop(boolean onTop) { } + public boolean isZOrderedOnTop() { + return false; + } + + public boolean setZOrderedOnTop(boolean onTop, boolean allowDynamicChange) { + return true; + } + public void setSecure(boolean isSecure) { } @@ -67,6 +86,60 @@ public class SurfaceView extends MockView { return mSurfaceHolder; } + public void setUseAlpha() { + } + + public void setEnableSurfaceClipping(boolean enabled) { + } + + public void setCornerRadius(float cornerRadius) { + } + + public float getCornerRadius() { + return 0; + } + + public void setSurfaceLifecycle(int lifecycleStrategy) { + } + + public String getName() { + return "MockSurfaceView"; + } + + public void requestUpdateSurfacePositionAndScale() { + } + + public @NonNull Rect getSurfaceRenderPosition() { + return new Rect(); + } + + public boolean isFixedSize() { + return true; + } + + public void setResizeBackgroundColor(int bgColor) { + } + + public void setResizeBackgroundColor(@NonNull SurfaceControl.Transaction t, int bgColor) { + } + + public SurfaceControl getSurfaceControl() { + return null; + } + + public @Nullable IBinder getHostToken() { + return null; + } + + public void setChildSurfacePackage(@NonNull SurfaceControlViewHost.SurfacePackage p) { + } + + public void syncNextFrame(Consumer<Transaction> t) { + } + + public void applyTransactionToFrame(@NonNull SurfaceControl.Transaction transaction) { + } + private SurfaceHolder mSurfaceHolder = new SurfaceHolder() { @Override |