Opencamera camera-in-use SFOS 4.5

note: using an android camera app is the only way to access the camera2 api. on 10III, this is required because there is a focus bug in camera1 api, which breaks all sailfish camera apps. opencamera with camera2 includes manual focus slider and a working auto-focus model and everything else.

recording a video on opencamera works, but it then crashes the app. re-opening the opencamera app after shows FAILED TO OPEN CAMERA. CAMERA MAY BE IN USE BY ANOTHER APPLICATION? ID:0.

on SFOS 4.4, you can easily fix this with pkill -9 -f /system/bin/cameraserver.
on SFOS 4.5, however, once you restart the cameraserver, opencamera never works ever again, until you restart android support. anyone happen to know why?

side-note: opencamera config sub-pages still dont render. you can sort of workaround this issue by rotating the phone a few times

2 Likes

Um, 4.5.0.24, 10III, camera1 api works fine with, among others, my Stopmotion app. Just saying since I’m debugging and test across devices. Since when are you unable to use a jolla (or advanced or other) native camera app?

there is a focus bug, only on XperiaIII, and only in camera1 api (in SFOS, and also in stock android and AOSP/etc), that makes everyday picture taking unfeasible. it affects jolla-camera, harbour-advanced-camera, and android camera apps like OpenCamera that allow you to use camera1.

focus requires something like a full second of absolute stability in the frame. if you have even the tiniest bit of pixel churn, it will not focus. (and of course, even in manual-focus mode, the camera model must focus before taking a picture)
this means that for most users, in the real world, taking the picture is delayed, sometimes for minutes, even with steady hands and a group of people standing very still.

edit: so, to be clear, i am using the term “broken” to mean “unusably buggy” and not, say, “app segfaults on open”. i do, however, assert that “broken” applies to all SFOS camera apps. it does NOT apply to stopmotion, though, because your use case is very different from real world casual photography.

Hmmm. Like I said, with and Xperia 10III, running 4.5.0.24 I don’t get hanging focus. Even if I do ‘start/stop’ recording of sequences (with continuous auto focus). The amount of movement doesn’t matter. I don’t use the Xperia that much, but I’ve been testing with it for updates I’m working on. It IS a bit slow to focus (in comparison to a GS5 or Rephone), but doesn’t ever churn.

The point of Stopmotion is to continuously take in focus pictures at an interval (for animations I’m using one second). And with the testing I’m doing, it does that and the series is almost always (not 100% but 98%) in focus.

I read through the original report and have an odd feeling that maybe some phones have hardware issues? I guess I could try to use the open camera app, but this feels like a hardware issue?

Um, well, I tested Jolla’s and @piggz camera apps, too. They all focus in under a second even if I’m not that steady (or the subject is moving). EDIT: Which version of 4.5 are you running?

no, it is not a hardware issue. its also not a sailfish issue. it is universal to all versions of sailfish AND android. it is a bug in sony’s camera firmware that affects the camera1 api.

you do have the bug, i promise. try taking a pic in advanced-camera while making gentle circles with the phone.

stopmotion is a completely different use case where the bug doesnt matter, but it DOES have the focus model bug. you can see that it refuses to focus, forever, while in gentle motion

Nope. I just took six photos while gently making small circles. EDIT, using the jolla camera app. And the methods (from QML) that I use to make photos in Stopmotion where largely derived from the code in Advanced Camera.

I’m not saying it’s not a firmware issue, but it certainly doesn’t effect all phones. I cannot reproduce the symptoms you have. I recently had to send a ‘new’ sony camera to be serviced for firmware defects which apparently effect a not insignificant number of users. But not all.

1 Like

Also works fine in Advanced Camera. I don’t get it. Maybe we should look at the binary blobs on my phone? EDIT: just to make sure we’re talking about the same phone:

1 Like

if you truly dont have the bug, that is wonderful news! there is a chance that you are not triggering it, especially because you are into photography and not trying to casually take a picture at a concert. to be clear, focus lock is very fast if you are not in motion. also, once focus is locked, you can remain in motion and take pictures instantly.

try this. open adv-camera. change focus mode to manual. put the lens a few inches away from a table and tap-to-focus. the white circle appears, and turns green quickly, and the table is focused. pull the phone away until the table is blurry. circle is still green. start swirling the phone gently but continuously, and then tap. the white circle appears, and never turns green. table stays unfocused. stop swirling, and focus happens instantly.

as for blobs, lets start with the sony binaries image you flashed to oem (since this was the only constant between AOSP and SFOS for me, i assume the buggy firmware is in there somewhere).
this is the md5 of mine:
2cf9bce4107aa6d249f049a87e7b6700 SW_binaries_for_Xperia_Android_11_4.19_v9a_lena.img

EDIT: either that, or maybe starting with a different stock sony android before flashing SFOS or other ROMs is what causes/solves the bug.

Ok, I did two things. First, went outside to see if lighting makes a difference and can say that the delay to focus is more than I’d like. That’s in the second domain. It ‘does’ seem to be more pronounced, more delayed if you make circles than move in a lateral motion. If I move FAST enough, then it does, in fact seem to hang waiting to get focus. But that’s extreme movement, not gentle movement.

Then I did this test you suggest. After pulling to blur, circle still green, swirling all the while, I tapped, the white circle appeared and very quickly turned green. I took a foto while still swirling and got a somewhat less than sharp photo. So, even when swirling around a radius of about 5-6 cms, I can tap to focus while swirling and get a focus/green ring quickly.

I think I can certainly agree that the focus is relatively slow.

Ok, I get another sum (assuming md5sum -b)

71f3e5a5d58e746d5ac00186420c1929 
SW_binaries_for_Xperia_Android_11_4.19_v9a_lena.zip

EDIT, that’s from

139831672 Mar 16 15:41

OOPs, wrong file.

2cf9bce4107aa6d249f049a87e7b6700 *SW_binaries_for_Xperia_Android_11_4.19_v9a_lena.img

looks the same.

once the focus is green, you can take photos instantly. the bug is only about locking focus.

to reproduce the forever-not-focus-bug, lock focus at one depth, then point the camera at something that is very blurry at that depth. NOW swirl the camera GENTLY (say 2cm diameter circle), WHILE the displayed image is very blurry, THEN tap to focus, and circle stays white forever.

At another depth, not the same depth, I think I finally see what you mean, in manual focus mode with Advanced camera. But that seems like pretty extreme photography to me :wink: It does however hang. Do the same dance with jolla’s camera app (focus on some text on a document on the table at 5 cm) I get a white to ‘red’ ring, quickly sweep up to the monitor at 25 cm distance while swirling and tap to focus, get a red ring, tap while swirling, get a photo.

Since I’ve also been testing (after making really silly errors) the GS5 and rephone cameras, I managed with the manual focus experiment to get Advanced camera to not get the sensor working at all (ie, black screen)! But the jolla app I could not force there. On the Volla phones (GS5 models, anyway) you have access to more cameras, so I’m not sure what it all means.

i assure you, it is not. it seems like that in your careful tests only because you’re not trying to use the camera in ordinary mixed usage. try taking a picture of the dog, a sunset, a concert, a sporting event, and you will miss > 30% of the shots you want. the camera api is broken.

So, although I hate installing android apps, I can confirm this behaviour.

2 Likes

I have a ten year old child. I do a lot of that. However, most of it with other phones. Last summer, in France, I used the 10III for about a week and never experienced what you are describing. I produce a book (year in the life of the child) every year, so I’m quite sensitive to missing/missed opportunities. It could, of course, be that I’m a stable photographer, though I find that hard to believe.

In any case, I believe I see what you mean and see a difference depending on focal mode and app involved, so the best I can do is try to gather more data, systematically.

That the api is WAY deprecated and that a variety of bugs will appear when you least expect I’ll agree. I recently forgot that the GS5/Volla22 can only do video at a certain resolution and ran around in circles trying to fix a bug which was just a RTFM.

1 Like

yes, restarting appsupport fixes the video-crash problem. on SFOS 4.5, nothing else seems to work. on SFOS 4.4, simply restarting cameraserver in android fixed it (pkill cameraserver). i made a wrapper for opencamera than killed cameraserver before starting it and that worked well enough, but its broken now.

back to the actual bug in THIS issue, i still do not have a solution to this, and have no idea why it doesnt work:

on SFOS 4.4, you can easily fix this with pkill -9 -f /system/bin/cameraserver .
on SFOS 4.5, however, once you restart the cameraserver, opencamera never works ever again, until you restart android support. anyone happen to know why?

ive tried many things, but i once cameraserver is restarted, nothing works.

so far, ive learned that this error message actually appears when everything is working, as well as after pkill:
CameraService_proxy: Calling UID: 0 doesn't match expected camera service UID!

this error only shows up when its broken:

10-07 12:46:54.404  1641  1652 I CameraService: CameraService::connect call (PID -1 "net.sourceforge.opencamera", camera ID 0) for HAL version default and Camera API version 2
10-07 12:46:54.404  1641  1652 E CameraService: CameraService::connect X (PID 1656) rejected (cannot connect from device user 0, currently allowed device users: )
10-07 12:46:54.405  1656  1703 W System.err: java.lang.SecurityException: validateClientPermissionsLocked:1204: Callers from device user 0 are not currently allowed to connect to camera "0"

i tried using service call media.camera to set doUserSwitch, but every call gives me validateClientPermissionsLocked even though im user 0

what does alien do at startup that restarting cameraserver no longer does?
why is the allowed user list null?