0

I am developing a ROM for the HTC Doubleshot, and I ran into some trouble with the camera (it force closes). Particularly the stock camera, and most third party cameras out there (UCam Ultra Camera does not).

I have a few logcats (fun starts at line 696 of the latest one) of the situation, and I am stumped as to what is going on. Other cameras, like Google Camera, have the same result.

My ROM is a build of CarbonROM 4.4.4, where successful work had been done by a developer in building Cyanogenmod 11. So my manifest has been split between my github (joelmaxuel) and his (EmmanuelU, KitKatDS):

<?xml version="1.0" encoding="UTF-8"?>

<manifest>

    <remote name="DS"
       fetch="git://github.com/KitKatDS/"/>

    <remote name="emmanuel"
       fetch="git://github.com/EmmanuelU/"/>

    <remote name="joelmaxuel"
       fetch="git://github.com/joelmaxuel/"/>

    <remote name="githubby"
       fetch="git://github.com/"/>

    <project path="buildbot" name="James_Buildbot" revision="master" remote="emmanuel">
        <copyfile src="James" dest="James" />
    </project>

    <project name="android_device_htc_common" path="device/htc/common" revision="gingerbread" remote="DS" />

    <project path="device/htc/doubleshot" name="android_device_htc_doubleshot" remote="joelmaxuel" revision="kk" />
    <project path="device/htc/msm8660-common" name="android_device_htc_msm8660-common" remote="joelmaxuel" revision="kk" />
    <project path="vendor/htc/doubleshot" name="android_vendor_htc_doubleshot" remote="joelmaxuel" revision="kk" />
    <project path="kernel/htc/doubleshot" name="wild_kernel_htc_msm8660" remote="emmanuel" revision="android-msm-doubleshot-3.0-ion" />

    <remove-project name="CyanogenMod/android_hardware_libhardware_legacy" />
    <remove-project name="CarbonDev/android_frameworks_av" />
    <remove-project name="CarbonDev/android_frameworks_native" />
    <remove-project name="CarbonDev/android_packages_apps_Camera2" />
    <project name="android_hardware_libhardware_legacy" path="hardware/libhardware_legacy" revision="cm-11.0" remote="DS" />
    <project name="android_hardware_qcom_media-legacy" path="hardware/qcom/media-legacy" revision="cm-11.0-ion" remote="DS" />
    <project name="android_hardware_qcom_display-legacy" path="hardware/qcom/display-legacy" revision="cm-11.0-ion" remote="DS" />
    <project name="android_frameworks_av" path="frameworks/av" revision="cm-11.0" remote="DS" />
    <project name="android_packages_apps_Camera2" path="packages/apps/Camera2" revision="cm-11.0" remote="DS" />
    <project name="android_frameworks_native" path="frameworks/native" revision="kk" remote="joelmaxuel" />

</manifest>

I made sure this was in my BoardConfigCommon.mk:

# Camera
BOARD_USES_QCOM_LEGACY_CAM_PARAMS := true
COMMON_GLOBAL_CFLAGS += -DICS_CAMERA_BLOB -DNO_UPDATE_PREVIEW -DQCOM_BSP_CAMERA_ABI_HACK

And the code for BOARD_USES_QCOM_LEGACY_CAM_PARAMS would add the appropriate CFLAG (I checked the frameworks_av code, file camera/Android.mk):

ifeq ($(BOARD_USES_QCOM_HARDWARE),true)
LOCAL_CFLAGS += -DQCOM_HARDWARE
endif
ifeq ($(BOARD_USES_QCOM_LEGACY_CAM_PARAMS),true)
LOCAL_CFLAGS += -DQCOM_LEGACY_CAM_PARAMS
endif

I am at a loss as what to check next. Any suggestions?

  • Have you stumbled across this yet? It sounds similar: http://stackoverflow.com/questions/3890381/camera-setparameters-failed-in-android – Craig Otis Apr 16 '15 at 01:59
  • 1
    I did. Thanks for putting it to my attention again. I dismissed it originally because it's more about camera design, where my problem is framework design (or maybe more appropriately, device tree design). I could (theoretically) disable a bunch of stuff (or modify to suit my needs) in the stock camera2 app to make it work, but that doesn't solve the third party cameras (like google camera, which also FC's). – Joel Maxuel Apr 16 '15 at 02:12

1 Answers1

0

The device's camera implementation believes you're passing in an invalid setting value.

It's a bit hard to see the actual complaint between all the other camera logging, but it's in the log:

E/QualcommCameraHardwareZSL( 171): Invalid focus mode value: continuous-picture E/QualcommCameraHardwareZSL( 171): virtual android::status_t android::QualcommCameraHardware::setParameters(const android::CameraParameters&): 6487, rc = -22

If continuous picture is not defined in the list of supported AF modes, then the app is invalidly trying to set it. If it is listed, then the camera implementation is incorrectly rejecting it.

Eddy Talvala
  • 17,243
  • 2
  • 42
  • 47
  • I see it now... Here I was battling the last week kludging out face detection based on AndroidCameraManagerImpl.java:298 (which the line initializes face detection). I may have a working compile tonight, we shall see by morning. But if you are right, it will still crash. For the continuous AF - Is there a device tree flag I am supposed to be using, do I kludge the camera (again), or am I missing the point altogether? I am looking for a solution that solves other camera apps as well, not just the stock one. Thanks. – Joel Maxuel Apr 24 '15 at 22:32
  • Once I looked at it, I think it is the latter, according to the frameworks AV file [https://github.com/CarbonDev/android_frameworks_av/blob/kk/camera/CameraParameters.cpp ]: `const char CameraParameters::FOCUS_MODE_CONTINUOUS_PICTURE[] = "continuous-picture";`. Additionally, it is not hiding behind any #ifdef's. Which means I'm stuck again. – Joel Maxuel Apr 25 '15 at 01:03
  • With insight from you and help from another developer on this device, bug squashed! All that was needed to be done was comment out/remove `params.set(android::CameraParameters::KEY_SUPPORTED_FOCUS_MODES, "auto,infinity,normal,macro,continuous-picture");` under the device tree's camerawrapper/CameraWrapper.cpp file. There is still a camcorder bug, but that is another problem for another time! – Joel Maxuel Apr 27 '15 at 02:22
  • There are several lists of capabilities that the camera HAL needs to report correctly, including the supported focus modes. The correct list depends on your camera hardware, and the HAL then also needs to accept whatever it advertises as supported. Several keys are mandatory, so just commenting them out may cause other crashes - instead, you should figure out what's actually supported, and include only those values. (Generally, anything that's KEY_SUPPORTED_* you need to set valid values to in the camera HAL) – Eddy Talvala Apr 28 '15 at 19:59
  • Thanks for the hint, I will investigate the supported focus modes (and revert my commit) once the camcorder encoding is ready-to-go again. – Joel Maxuel Apr 29 '15 at 23:43