Nexus 4 flash does not fire when focus mode is set to continuous image

I had a strange problem, especially on Nexus 4 (although it may exist on other devices), where the camera flash does not fire if the focus mode is set to FOCUS_MODE_CONTINUOUS_PICTURE . The same code works fine on the Galaxy Nexus with the same version of Android (4.2.1). Has anyone encountered this problem before? I can fix the problem by simply switching the focus mode to FOCUS_MODE_AUTO . I hope there is easy work for this problem, because the continuous focus mode of the image is very important.

+5
source share
2 answers

(Why just end my comment in response.)

The reason I suspect that the continuous focus does not work on Nexus 4 is because I heard some errors from the barcode scanner database about it (I am the author). Nexus 4 does not seem to work, or without continuous focus.

I did not see any more details to confirm / refute this, but of course I saw this exact problem on other devices. In particular, the Galaxy S2 has some bad focal errors.

This manifests itself as something a little different: there is some third parameter that you set, which must be supported, or says that it is supported, but actually leads to a driver shutdown. Then it does not honor the focus or setting of the torch. Maybe continuous focus and torch work. But the third parameter disables it.

Look at the output of logcat . You should see debug messages from the driver. The exact nature is highly dependent on the firmware. But in such cases, you will most likely see errors in the driver. Usually I see "unsupported parameter X" and cryptic numbers; sometimes he is much clearer about what he does not like.

This may give you the advantage that it is actually something like a scene mode or measurement area. (And I saw that each of them causes this problem on at least one device.)

I also have a Galaxy Nexus and have never seen any problems with this form on it.

I will also say that continuous focus may work well on some devices; it's worse on some devices like my old Desire HD than the simple auto focus mode. YMMV; I came to the conclusion that this is not necessarily useful, so regular default autofocus has been done in the barcode scanner.

+4
source

There are camera issues on the Nexsus 4.

First try the .getSupportedFocusModes () options

To restore autofocus, simply click "cancelAutoFocus ()" on the camera in "AutoFocusCallback.java",

 { if (autoFocusHandler != null) { camera.cancelAutoFocus(); ... } 

This call does not work if the focus mode is "FOCUS_MODE_AUTO" because autofocus is completed anyway when onAutoFocus () is called. But it restores continuous autofocus when "FOCUS_MODE_CONTINUOUS_PICTURE" is used.

Hope this helps. I will work more and be updated.

0
source

Source: https://habr.com/ru/post/976619/


All Articles