msm8226-common: camera: fixes for matisse/millet devices

* They don't support ZSL and HFR, so disable them (it generated dark slugghish back camera)
* Set different required preview sizes for photos and videos
* Remove exposure hack (it doesn't work)
* Fix indentations and make code more readable by putting the settings of s3ve3g, ms01 and kmini3g all together and matisse and millet in another if
* Add support for matisse3gjv, matissewifiue, milletwifiue
This commit is contained in:
matteo0026 2020-09-11 15:09:01 +02:00
parent 3f083f4311
commit 9e95d65e33

View file

@ -59,6 +59,7 @@ const char KEY_SUPPORTED_ISO_MODES[] = "iso-values";
const char KEY_SAMSUNG_CAMERA_MODE[] = "cam_mode"; const char KEY_SAMSUNG_CAMERA_MODE[] = "cam_mode";
const char KEY_ISO_MODE[] = "iso"; const char KEY_ISO_MODE[] = "iso";
const char KEY_ZSL[] = "zsl"; const char KEY_ZSL[] = "zsl";
static const char OFF[] = "off";
const char KEY_CAMERA_MODE[] = "camera-mode"; const char KEY_CAMERA_MODE[] = "camera-mode";
const char KEY_SUPPORTED_HFR_SIZES[] = "hfr-size-values"; const char KEY_SUPPORTED_HFR_SIZES[] = "hfr-size-values";
const char KEY_SUPPORTED_MEM_COLOR_ENHANCE_MODES[] = "mce-values"; const char KEY_SUPPORTED_MEM_COLOR_ENHANCE_MODES[] = "mce-values";
@ -127,12 +128,18 @@ static int get_product_device()
product_device = MS01; product_device = MS01;
else if (device == "matissewifi") else if (device == "matissewifi")
product_device = MATISSE; product_device = MATISSE;
else if (device == "matissewifiue")
product_device = MATISSE;
else if (device == "matisse3g") else if (device == "matisse3g")
product_device = MATISSE; product_device = MATISSE;
else if (device == "matisse3gjv")
product_device = MATISSE;
else if (device == "matisselte") else if (device == "matisselte")
product_device = MATISSE; product_device = MATISSE;
else if (device == "milletwifi") else if (device == "milletwifi")
product_device = MILLET; product_device = MILLET;
else if (device == "milletwifiue")
product_device = MILLET;
else if (device == "millet3g") else if (device == "millet3g")
product_device = MILLET; product_device = MILLET;
else if (device == "milletlte") else if (device == "milletlte")
@ -221,31 +228,17 @@ static char* camera_fixup_getparams(int id, const char* settings) {
params.set(CameraParameters::KEY_SUPPORTED_SCENE_MODES, params.set(CameraParameters::KEY_SUPPORTED_SCENE_MODES,
"auto,asd,action,portrait,landscape,night,night-portrait,theatre,beach,snow,sunset," "auto,asd,action,portrait,landscape,night,night-portrait,theatre,beach,snow,sunset,"
"steadyphoto,fireworks,sports,party,candlelight,backlight,flowers,AR"); "steadyphoto,fireworks,sports,party,candlelight,backlight,flowers,AR");
} /* If the vendor has HFR values but doesn't also expose that
* this can be turned off, fixup the params to tell the Camera
if (( get_product_device() == MATISSE) || ( get_product_device() == MILLET)) { * that it really is okay to turn it off.
params.set(CameraParameters::KEY_PREFERRED_PREVIEW_SIZE_FOR_VIDEO, "640x480" ); */
} const char *hfrModeValues = params.get(KEY_VIDEO_HFR_VALUES);
if (hfrModeValues && !strstr(hfrModeValues, "off")) {
/* If the vendor has HFR values but doesn't also expose that char hfrModes[strlen(hfrModeValues) + 4 + 1];
* this can be turned off, fixup the params to tell the Camera sprintf(hfrModes, "%s,off", hfrModeValues);
* that it really is okay to turn it off. params.set(KEY_VIDEO_HFR_VALUES, hfrModes);
*/ }
if (get_product_device() == S3VE3G || get_product_device() == MS01 || get_product_device() == KMINI3G) { if (id == BACK_CAMERA_ID) {
const char *hfrModeValues = params.get(KEY_VIDEO_HFR_VALUES);
if (hfrModeValues && !strstr(hfrModeValues, "off")) {
char hfrModes[strlen(hfrModeValues) + 4 + 1];
sprintf(hfrModes, "%s,off", hfrModeValues);
params.set(KEY_VIDEO_HFR_VALUES, hfrModes);
}
}
if (( get_product_device() == MATISSE) || ( get_product_device() == MILLET)) {
params.set(KEY_VIDEO_HFR_VALUES, "off");
}
if (id == BACK_CAMERA_ID) {
if (get_product_device() == S3VE3G || get_product_device() == MS01 || get_product_device() == KMINI3G) {
params.set(CameraParameters::KEY_SUPPORTED_FLASH_MODES, "auto,on,off,torch"); params.set(CameraParameters::KEY_SUPPORTED_FLASH_MODES, "auto,on,off,torch");
params.set(KEY_SUPPORTED_HFR_SIZES, "1280x720,720x480"); params.set(KEY_SUPPORTED_HFR_SIZES, "1280x720,720x480");
params.set(KEY_SUPPORTED_VIDEO_HIGH_FRAME_RATE_MODES, "60,off"); params.set(KEY_SUPPORTED_VIDEO_HIGH_FRAME_RATE_MODES, "60,off");
@ -253,17 +246,16 @@ static char* camera_fixup_getparams(int id, const char* settings) {
} }
if (( get_product_device() == MATISSE) || ( get_product_device() == MILLET)) { if (( get_product_device() == MATISSE) || ( get_product_device() == MILLET)) {
params.set(CameraParameters::KEY_EXPOSURE_COMPENSATION_STEP, "0.5"); params.set(CameraParameters::KEY_PREFERRED_PREVIEW_SIZE_FOR_VIDEO, "640x480" );
params.set(CameraParameters::KEY_MIN_EXPOSURE_COMPENSATION, "-4");
params.set(CameraParameters::KEY_MAX_EXPOSURE_COMPENSATION, "4");
params.set(CameraParameters::KEY_SUPPORTED_PREVIEW_SIZES, "640x360,640x480,352x288,320x240,176x144"); params.set(CameraParameters::KEY_SUPPORTED_PREVIEW_SIZES, "640x360,640x480,352x288,320x240,176x144");
params.set(KEY_VIDEO_HFR_VALUES, "off");
} }
#if !LOG_NDEBUG #if !LOG_NDEBUG
ALOGV("%s: fixed parameters:", __FUNCTION__); ALOGV("%s: fixed parameters:", __FUNCTION__);
params.dump(); params.dump();
#endif #endif
String8 strParams = params.flatten(); String8 strParams = params.flatten();
char* ret = strdup(strParams.string()); char* ret = strdup(strParams.string());
@ -308,6 +300,10 @@ static char* camera_fixup_setparams(struct camera_device* device, const char* se
params.set(KEY_CAMERA_MODE, isVideo ? "0" : "1"); params.set(KEY_CAMERA_MODE, isVideo ? "0" : "1");
} }
if (( get_product_device() == MATISSE) || ( get_product_device() == MILLET)) {
params.set(KEY_ZSL, OFF);
}
#if !LOG_NDEBUG #if !LOG_NDEBUG
ALOGV("%s: fixed parameters:", __FUNCTION__); ALOGV("%s: fixed parameters:", __FUNCTION__);
params.dump(); params.dump();