You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: visionSamples/barcode-reader/app/src/main/java/com/google/android/gms/samples/vision/barcodereader/ui/camera/CameraSource.java
+76-17Lines changed: 76 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -122,11 +122,14 @@ public class CameraSource {
122
122
123
123
privateintmFacing = CAMERA_FACING_BACK;
124
124
125
+
privatebooleanmCameraFallbackAllowed = true;
126
+
125
127
/**
126
128
* Rotation of the device, and thus the associated preview images captured from the device.
127
129
* See {@link Frame.Metadata#getRotation()}.
128
130
*/
129
131
privateintmRotation;
132
+
privateintmRequestedCameraId;
130
133
131
134
privateSizemPreviewSize;
132
135
@@ -143,7 +146,9 @@ public class CameraSource {
143
146
// These instances need to be held onto to avoid GC of their underlying resources. Even though
144
147
// these aren't used outside of the method that creates them, they still must have hard
145
148
// references maintained to them.
149
+
@SuppressWarnings("FieldCanBeLocal")
146
150
privateSurfaceViewmDummySurfaceView;
151
+
@SuppressWarnings("FieldCanBeLocal")
147
152
privateSurfaceTexturemDummySurfaceTexture;
148
153
149
154
/**
@@ -153,6 +158,8 @@ public class CameraSource {
153
158
privateThreadmProcessingThread;
154
159
privateFrameProcessingRunnablemFrameProcessor;
155
160
161
+
privatebooleanmCanTakePicture = false;
162
+
156
163
/**
157
164
* Map to convert between a byte array, received from the camera, and its associated byte
158
165
* buffer. We use byte buffers internally because this is a more efficient way to call into
@@ -240,6 +247,16 @@ public Builder setFacing(int facing) {
240
247
returnthis;
241
248
}
242
249
250
+
/**
251
+
* Sets whether fallback from front to back or vice versa is allowed.
252
+
* Used in case the requested camera was not available.
0 commit comments