Commit 948d183
committed
Workaround for blank camera preview when switching to tabletop mode
Switching to/from tabletop mode causes the underlying SurfaceView to
destroy and recreate its Surface, but the Camera doesn't know its
been destroyed. This is a known issue with SurfaceView in Compose.
See: https://issuetracker.google.com/275157240
To workaround this issue, detect when the folding state enters or
leaves tabletop mode and manually invalidate the CameraX
SurfaceRequest so it will generate a new one.1 parent cc9aa39 commit 948d183
File tree
1 file changed
+17
-0
lines changed- feature/camera/src/main/java/com/android/developers/androidify/camera
1 file changed
+17
-0
lines changedLines changed: 17 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
| |||
70 | 71 | | |
71 | 72 | | |
72 | 73 | | |
| 74 | + | |
73 | 75 | | |
74 | 76 | | |
75 | 77 | | |
| |||
129 | 131 | | |
130 | 132 | | |
131 | 133 | | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
132 | 149 | | |
133 | 150 | | |
134 | 151 | | |
| |||
0 commit comments