OpenNoteScanner icon indicating copy to clipboard operation
OpenNoteScanner copied to clipboard

Android 8.1 stuck on take secound picture/scan

Open graczu0x0x0x0x0 opened this issue 7 years ago • 7 comments

Tested on compiled app and on app from google play.

On phone with android 8.1 ( Motorola g5s ) first scan taking without issue, when taking secound one after first one we se a rolling circle and photo don't shoot. We need to enter gallery, go back to scaner and press once again and photo is done, when trying to take another we need go to gallery, go back and press photo, on Android 8.0 and lower everything working good.

Steps to reproduce

Android 8.1 Open ONS, take scan, take secound scan ( stuck !), go to gallery, go back, take scan and it's working.

Expected behaviour

Stuck on secound scan. ons_log.txt

graczu0x0x0x0x0 avatar Nov 23 '18 08:11 graczu0x0x0x0x0

I was unable to reproduce it here (have only android 8.0). Will try to put some more debug messages on next release, in the mean time if somebody have the same issue and is able to give some hint, help are welcome!

allgood avatar Nov 23 '18 10:11 allgood

I waiting for release with debug i will upload logs, i was testing this on current release, current master, google play version, and release before current.

graczu0x0x0x0x0 avatar Nov 23 '18 13:11 graczu0x0x0x0x0

On my small debug skills i can tell that in: OpenNoteScannerActivity -> requestPicture, code:

mCamera.autoFocus(new Camera.AutoFocusCallback() { @Override public void onAutoFocus(boolean success, Camera camera) { Log.d(TAG, "requestPicture - attemptToFocus: " + attemptToFocus); if (attemptToFocus) { Log.d(TAG, "requestPicture - Focus"); return; } else { attemptToFocus = true; } Log.d(TAG, "requestPicture - Taking"); camera.takePicture(null,null,mThis); } }); return true;

is not running during the second photo request. So the "safeToTakePicture" bool is false becouse "takePicture" dont change it and it going to infinity loop.

graczu0x0x0x0x0 avatar Nov 26 '18 09:11 graczu0x0x0x0x0

I was able to fix this by adding: camera.cancelAutoFocus(); in OpenNoteScannerActivity -> onPictureTaken at the end.

graczu0x0x0x0x0 avatar Nov 26 '18 10:11 graczu0x0x0x0x0

Hi @graczu0x0x0x0x0 , I always prefer to add code through pull request, so it's easy to track it back if needed. Please look if you can create a pull request with your contributions. You can aggregate them in one pull request.

allgood avatar Dec 11 '18 11:12 allgood

Same issue on latest lineageos (i.e. also Android 8.1).

fajabird avatar Jan 25 '19 23:01 fajabird

I had this problem on a Moto G5 and Android 7.0. I then upgraded to Android 8.1 and the issue still persists. It sometimes happens at the second picture taken, sometimes at the third, if memory serves me right. This makes the app, basically, unusable on my device.

bmix avatar Dec 21 '21 12:12 bmix