commit | 0fb2c352fd67cb7129db599898615e5aa6fefacd | [log] [tgz] |
---|---|---|
author | Gavin Corkery <[email protected]> | Mon Nov 04 16:51:11 2024 +0000 |
committer | Gavin Corkery <[email protected]> | Mon Nov 04 16:55:00 2024 +0000 |
tree | 238168c70e35053bcf8ebaa5f9309f10d6d9bdfb | |
parent | c0372bf2cec0280c694f70e36bdb5aaf56646cd2 [diff] |
Add additional checks when clipping bounds Returns early from clipping bounds when the content view is not a SurfaceView, or when the surfaceView's surface control is null. Test: Manual Bug: 367030479 Bug: 367030480 Change-Id: Iff4705991c8f88942378f75f67369d572c53382f
diff --git a/privacysandbox/ui/ui-client/src/main/java/androidx/privacysandbox/ui/client/view/SandboxedSdkView.kt b/privacysandbox/ui/ui-client/src/main/java/androidx/privacysandbox/ui/client/view/SandboxedSdkView.kt index c66933f..f662792 100644 --- a/privacysandbox/ui/ui-client/src/main/java/androidx/privacysandbox/ui/client/view/SandboxedSdkView.kt +++ b/privacysandbox/ui/ui-client/src/main/java/androidx/privacysandbox/ui/client/view/SandboxedSdkView.kt
@@ -714,7 +714,11 @@ checkNotNull(contentView) check(isAttachedToWindow) - val surfaceView: SurfaceView = contentView as SurfaceView + val surfaceView: SurfaceView? = contentView as? SurfaceView + // TODO(b/339377737): Remove the need for this check with better listener handling. + if (surfaceView?.surfaceControl == null) { + return + } val attachedSurfaceControl = checkNotNull(surfaceView.rootSurfaceControl) { "attachedSurfaceControl should be non-null if the window is attached"