Instantiate SurfaceView
on main thread
On some devices/builds it seems that the `SurfaceView` constructor tries to create a handler. Move instantiation to the main thread when getting the debug surface view so that handler creation succeeds. PiperOrigin-RevId: 505745387
This commit is contained in:
parent
ff56b7d294
commit
4fb651b116
@ -737,9 +737,9 @@ public final class TransformerActivity extends AppCompatActivity {
|
||||
|
||||
// Update the UI on the main thread and wait for the output surface to be available.
|
||||
CountDownLatch surfaceCreatedCountDownLatch = new CountDownLatch(1);
|
||||
SurfaceView surfaceView = new SurfaceView(/* context= */ TransformerActivity.this);
|
||||
runOnUiThread(
|
||||
() -> {
|
||||
surfaceView = new SurfaceView(/* context= */ TransformerActivity.this);
|
||||
AspectRatioFrameLayout debugFrame = checkNotNull(TransformerActivity.this.debugFrame);
|
||||
debugFrame.addView(surfaceView);
|
||||
debugFrame.setAspectRatio((float) width / height);
|
||||
@ -771,7 +771,6 @@ public final class TransformerActivity extends AppCompatActivity {
|
||||
Thread.currentThread().interrupt();
|
||||
return null;
|
||||
}
|
||||
this.surfaceView = surfaceView;
|
||||
return surfaceView;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user