intermediaterepresentation / android_device_htc_endeavor

HTC Endeavor device
18 stars 24 forks source link

Camera fix #57

Closed tgascoigne closed 12 years ago

tgascoigne commented 12 years ago

This is one proposed fix for the face detection issue. It works, only issue is that we now have to maintain libcamera_client.so and rebuild it when it gets updated in the cyanogen repos. Fixes #25

See the following commit for whats actually modified: https://github.com/tgascoigne/android_frameworks_base/commit/f66e4f

note: this does not fix the video recording resolution (yet)

gorbi commented 12 years ago

@tgascoigne Nice going :)

tbalden commented 12 years ago

so if i understand it correctly face recognition will work with this patch. kudos! i'll test it too, and you should gerrit it. HTC One S cm9 would benefit from it.

tgascoigne commented 12 years ago

Unfortunately hardware face recognition won't work, because I'm not sure how HTC actually sends the face data. This just means that if it turns out we're doing something wrong and the libs start sending the missing data, then it'll start working without modification. Also, the modification is just a validation check that will pass when using libraries that do send the data correctly, so this code could be merged into the main cm branch without disrupting other devices.

tbalden commented 12 years ago

screw htc. :) we used @intervigiliums patch, commenting out the whole start up of face recognition. do you think reverse engineering the framework of sense rom would help, or is this a library/ABI incompatibility on lower level?

tbalden commented 12 years ago

ah, i see that your patch contains a hacked blob. i think @intervigiliums patch is better then, just commenting in Camera.java the part where it starts face recog. on the long run it could be added as a fw-resource, and bothe one x and s could set that resource to false ('like ''useCameraFaceRecog"" = false)

tgascoigne commented 12 years ago

The way I see it, there are 3 possible explanations: 1) HTC's libraries send the face data in a separate parcel object, or use a somehow different protocol. If this is the case, we'll have no choice really but to fork the relevant camera libs completely to add support for the different protocol (or do it with ugly preprocessor checks) 2) HTC's libs dont send the face data at all, which is what it looks like but I doubt is actually the case 3) We're missing some libraries, config, or something else, and somehow the effect of that is the face data doesn't get sent

If we could crack open the android.hardware.camera source and look at the messages it receives it might offer some explanation. The relevant function here is the EventHandler.handleMessage function. See line 689 in frameworks/base/core/java/android/hardware/Camera.java for what it should look like.

I've noticed with this patch, we get the message "Unknown message type 32767". Looking to see how HTC handle this message would be a good starting point. It might just be the message without the face objects that we're discarding but worth a look.

tbalden commented 12 years ago

hmm, ill have a look at deodexed smali later.

tgascoigne commented 12 years ago

Nah, including the modified binary in the device tree means that the changes actually get built when building from the device tree, and doesn't require the builder to replace any of Cyanogenmod's repos with your own forked ones. We can maintain the binary manually and keep it up to date with Cyanogenmod's changes. It's no different to including a prebuilt kernel. With this patch we can also consider submitting the code to gerrit to get included into the main repo (as I said before, it doesn't break other devices by disabling face recognition altogether), so we wouldn't need to include the binary. Edit: It's been uploaded to Gerrit. Hopefully we wont have to include the binary in future.

tgascoigne commented 12 years ago

I'm going to merge this because I'm fairly certain this works well, and it's a good solution in the meantime until it gets reviewed on Gerrit.

intervigilium commented 12 years ago

is there a link to the patch on gerrit?

gorbi commented 12 years ago

@intervigilium http://review.cyanogenmod.com/#/c/18276/

tgascoigne commented 12 years ago

I think this is causing an issue with the video camera. When stopping a recording it segfaults. Can anyone confirm so I know its not just me? Not sure whats causing it..

tbalden commented 12 years ago

i can verify it causes serious issue now after further testing this lib. Here it starts to act funky after video taken, preview mode in photo mode gets distorted then after a while camera crashes.