For my barcode scanner app, I am leveraging parts of the CameraSourcePreview class found in the Google Vision sample code.
I then leverage this class in my Fragment using this XML snippet:
<com.mattdonders.android.barcodescanner.barcode.CameraSourcePreview
android:id="@+id/cameraSourcePreview"
android:layout_width="match_parent"
android:layout_height="320dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="16dp" />
I have a function in my Fragment that launches an instance of this CameraSourcePreview when a button is pressed.
public void scanBarcode() {
Log.i(TAG, "Barcode scanner called.");
// Check for the camera permission before accessing the camera. If the
// permission is not granted yet, request permission.
int rc = ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.CAMERA);
if (rc == PackageManager.PERMISSION_GRANTED) {
createCameraSource();
} else {
requestCameraPermission();
}
if (ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.CAMERA)
!= PackageManager.PERMISSION_GRANTED) {
requestPermissions(new String[]{Manifest.permission.CAMERA}, RC_HANDLE_CAMERA_PERM);
}
// Show & Hide CardViews for Barcode Scanner Function
showField(cardViewBarcodeScanner);
// Starting camera source
startCameraSource();
}
When the view appears on screen and the camera starts, my Logcat starts getting spammed with these log items. They don't seem to affect performance, but I have no idea what it means and if it's something I should be worried about.
The only reference I can find to this error are from the AOSP framework code that exists on Github. Here is a specific example and here is a broad search with all the results I found, none of which seem to indicate exactly what causes the error when this SurfaceView appears.
The only thing I noticed is that I don't see these errors when I launch the Barcode Scanner / CameraSourcePreview in its own Activity (with just that and a LinearLayout element).
2018-08-26 22:10:24.608 1413-1413/? W/Layer: [SurfaceView - com.mattdonders.android.barcodescanner/com.mattdonders.android.barcodescanner.MainActivity#0] Timestamp 233137964798000 seems implausible relative to expectedPresent 99377402186342
2018-08-26 22:10:24.663 1413-1413/? W/Layer: [SurfaceView - com.mattdonders.android.barcodescanner/com.mattdonders.android.barcodescanner.MainActivity#0] Timestamp 233137996282000 seems implausible relative to expectedPresent 99377456284340
2018-08-26 22:10:24.687 1413-1413/? W/Layer: [SurfaceView - com.mattdonders.android.barcodescanner/com.mattdonders.android.barcodescanner.MainActivity#0] Timestamp 233138032277000 seems implausible relative to expectedPresent 99377474317006
2018-08-26 22:10:24.752 1413-1413/? W/Layer: [SurfaceView - com.mattdonders.android.barcodescanner/com.mattdonders.android.barcodescanner.MainActivity#0] Timestamp 233138117551000 seems implausible relative to expectedPresent 99377546447670
2018-08-26 22:10:24.846 1413-1413/? W/Layer: [SurfaceView - com.mattdonders.android.barcodescanner/com.mattdonders.android.barcodescanner.MainActivity#0] Timestamp 233138173687000 seems implausible relative to expectedPresent 99377636611000
2018-08-26 22:10:24.862 1413-1413/? W/Layer: [SurfaceView - com.mattdonders.android.barcodescanner/com.mattdonders.android.barcodescanner.MainActivity#0] Timestamp 233138205545000 seems implausible relative to expectedPresent 99377654643666
2018-08-26 22:10:24.898 1413-1413/? W/Layer: [SurfaceView - com.mattdonders.android.barcodescanner/com.mattdonders.android.barcodescanner.MainActivity#0] Timestamp 233138244564000 seems implausible relative to expectedPresent 99377690708998
2018-08-26 22:10:24.951 1413-1413/? W/Layer: [SurfaceView - com.mattdonders.android.barcodescanner/com.mattdonders.android.barcodescanner.MainActivity#0] Timestamp 233138311966000 seems implausible relative to expectedPresent 99377744806996