@@ -47,7 +47,6 @@ import androidx.compose.runtime.mutableFloatStateOf
47
47
import androidx.compose.runtime.remember
48
48
import androidx.compose.runtime.rememberCoroutineScope
49
49
import androidx.compose.runtime.setValue
50
- import androidx.compose.runtime.snapshotFlow
51
50
import androidx.compose.ui.Alignment
52
51
import androidx.compose.ui.Modifier
53
52
import androidx.compose.ui.geometry.Offset
@@ -71,7 +70,6 @@ import com.google.accompanist.permissions.ExperimentalPermissionsApi
71
70
import com.google.accompanist.permissions.isGranted
72
71
import com.google.accompanist.permissions.rememberPermissionState
73
72
import com.google.accompanist.permissions.shouldShowRationale
74
- import kotlinx.coroutines.flow.takeWhile
75
73
import kotlinx.coroutines.launch
76
74
77
75
@OptIn(
@@ -131,22 +129,6 @@ fun CameraPreviewScreen(
131
129
}
132
130
133
131
uiState.surfaceRequest?.let { surface ->
134
- // Workaround for https://issuetracker.google.com/275157240
135
- // When switching to/from tabletop posture, the underlying SurfaceView
136
- // destroys its Surface. Invalidate the SurfaceRequest when this happens
137
- // so CameraX can retrieve the new Surface.
138
- LaunchedEffect (surface) {
139
- val oldIsTableTop = isTableTopPosture(foldingFeature)
140
-
141
- snapshotFlow { foldingFeature }
142
- .takeWhile {
143
- val newIsTableTop = isTableTopPosture(it)
144
- val shouldInvalidate = oldIsTableTop != newIsTableTop
145
- if (shouldInvalidate) surface.invalidate()
146
- ! shouldInvalidate
147
- }.collect {}
148
- }
149
-
150
132
CameraPreviewContent (
151
133
surfaceRequest = surface,
152
134
autofocusUiState = uiState.autofocusUiState,
0 commit comments