Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit be225b0

Browse files
See b/26741728. This fixes an issue reported by third party devs
in which the app sometimes crashes when locking/unlocking the device. Change-Id: I3ba4e6d77b79bec2db0e4417fb09794b6ff07645
1 parent a9e7d46 commit be225b0

File tree

1 file changed

+10
-4
lines changed
  • visionSamples/barcode-reader/app/src/main/java/com/google/android/gms/samples/vision/barcodereader/ui/camera

1 file changed

+10
-4
lines changed

‎visionSamples/barcode-reader/app/src/main/java/com/google/android/gms/samples/vision/barcodereader/ui/camera/CameraSource.java‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,10 @@ private Camera createCamera() {
510510

511511
Camera.Parameters parameters = camera.getParameters();
512512

513-
parameters.setPictureSize(pictureSize.getWidth(), pictureSize.getHeight());
513+
if (pictureSize != null) {
514+
parameters.setPictureSize(pictureSize.getWidth(), pictureSize.getHeight());
515+
}
516+
514517
parameters.setPreviewSize(mPreviewSize.getWidth(), mPreviewSize.getHeight());
515518
parameters.setPreviewFpsRange(
516519
previewFpsRange[Camera.Parameters.PREVIEW_FPS_MIN_INDEX],
@@ -618,7 +621,9 @@ private static class SizePair {
618621
public SizePair(android.hardware.Camera.Size previewSize,
619622
android.hardware.Camera.Size pictureSize) {
620623
mPreview = new Size(previewSize.width, previewSize.height);
621-
mPicture = new Size(pictureSize.width, pictureSize.height);
624+
if (pictureSize != null) {
625+
mPicture = new Size(pictureSize.width, pictureSize.height);
626+
}
622627
}
623628

624629
public Size previewSize() {
@@ -862,8 +867,9 @@ void setNextFrame(byte[] data, Camera camera) {
862867
}
863868

864869
if (!mBytesToByteBuffer.containsKey(data)) {
865-
Log.d(TAG, "Skipping frame. Could not find ByteBuffer associated with the " +
866-
"image data from the camera.");
870+
Log.d(TAG,
871+
"Skipping frame. Could not find ByteBuffer associated with the image " +
872+
"data from the camera.");
867873
return;
868874
}
869875

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /