fix audio

This commit is contained in:
leonardo meitz 2018-05-25 12:56:14 +02:00
parent adf91e39c2
commit dba5bd24a4
13 changed files with 1924 additions and 652 deletions

View file

@ -1,3 +1,4 @@
subdirs = [ subdirs = [
"camera",
"sensors", "sensors",
] ]

5
camera/Android.bp Normal file
View file

@ -0,0 +1,5 @@
cc_library_static {
name: "libcamera_parameters_ext",
include_dirs: ["device/samsung/msm8226-common/include"],
srcs: ["CameraParameters.cpp"],
}

View file

@ -1,19 +1,72 @@
ifeq ($(TARGET_PROVIDES_CAMERA_HAL),true)
LOCAL_PATH := $(call my-dir) LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS) include $(CLEAR_VARS)
ifeq ($(TARGET_NEED_DISABLE_AUTOFOCUS),true)
LOCAL_CFLAGS += -DDISABLE_AUTOFOCUS
endif
ifeq ($(TARGET_NEED_DISABLE_FACE_DETECTION),true)
LOCAL_CFLAGS += -DDISABLE_FACE_DETECTION
endif
ifeq ($(TARGET_NEED_DISABLE_FACE_DETECTION_BOTH_CAMERAS),true)
LOCAL_CFLAGS += -DDISABLE_FACE_DETECTION_BOTH_CAMERAS
endif
ifeq ($(TARGET_NEED_CAMERA_ZSL),true)
LOCAL_CFLAGS += -DENABLE_ZSL
endif
ifeq ($(TARGET_NEED_FFC_PICTURE_FIXUP),true)
LOCAL_CFLAGS += -DFFC_PICTURE_FIXUP
endif
ifeq ($(TARGET_NEED_FFC_VIDEO_FIXUP),true)
LOCAL_CFLAGS += -DFFC_VIDEO_FIXUP
endif
ifeq ($(TARGET_NEED_SAMSUNG_CAMERA_MODE),true)
LOCAL_CFLAGS += -DSAMSUNG_CAMERA_MODE
endif
ifeq ($(TARGET_ADD_ISO_MODE_50),true)
LOCAL_CFLAGS += -DISO_MODE_50
endif
ifeq ($(TARGET_ADD_ISO_MODE_1600),true)
LOCAL_CFLAGS += -DISO_MODE_1600
endif
ifeq ($(TARGET_ADD_ISO_MODE_HJR),true)
LOCAL_CFLAGS += -DISO_MODE_HJR
endif
LOCAL_C_INCLUDES := \ LOCAL_C_INCLUDES := \
system/media/camera/include \ framework/native/include \
frameworks/native/include/media/openmax system/media/camera/include
LOCAL_SRC_FILES := \ LOCAL_SRC_FILES := \
CameraWrapper.cpp CameraWrapper.cpp
LOCAL_SHARED_LIBRARIES := \ LOCAL_SHARED_LIBRARIES := \
libhardware liblog libcamera_client libutils libcutils libgui libsensor libhardware \
liblog \
libcamera_client \
libgui \
libhidltransport \
libutils \
android.hidl.token@1.0-utils
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_SHARED_LIBRARIES)/hw LOCAL_STATIC_LIBRARIES := \
LOCAL_MODULE := camera.msm8226 libarect
LOCAL_MODULE := camera.$(TARGET_BOARD_PLATFORM)
LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_MODULE_TAGS := optional LOCAL_MODULE_TAGS := optional
LOCAL_PROPRIETARY_MODULE := true LOCAL_PROPRIETARY_MODULE := true
include $(BUILD_SHARED_LIBRARY) include $(BUILD_SHARED_LIBRARY)
endif

701
camera/CameraParameters.cpp Normal file
View file

@ -0,0 +1,701 @@
/*
**
** Copyright 2008, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
#define LOG_TAG "CameraParams"
#include <utils/Log.h>
#include <string.h>
#include <stdlib.h>
#include <camera/CameraParameters.h>
#include <system/graphics.h>
namespace android {
// Parameter keys to communicate between camera application and driver.
const char CameraParameters::KEY_PREVIEW_SIZE[] = "preview-size";
const char CameraParameters::KEY_SUPPORTED_PREVIEW_SIZES[] = "preview-size-values";
const char CameraParameters::KEY_PREVIEW_FORMAT[] = "preview-format";
const char CameraParameters::KEY_SUPPORTED_PREVIEW_FORMATS[] = "preview-format-values";
const char CameraParameters::KEY_PREVIEW_FRAME_RATE[] = "preview-frame-rate";
const char CameraParameters::KEY_SUPPORTED_PREVIEW_FRAME_RATES[] = "preview-frame-rate-values";
const char CameraParameters::KEY_PREVIEW_FPS_RANGE[] = "preview-fps-range";
const char CameraParameters::KEY_SUPPORTED_PREVIEW_FPS_RANGE[] = "preview-fps-range-values";
const char CameraParameters::KEY_PICTURE_SIZE[] = "picture-size";
const char CameraParameters::KEY_SUPPORTED_PICTURE_SIZES[] = "picture-size-values";
const char CameraParameters::KEY_PICTURE_FORMAT[] = "picture-format";
const char CameraParameters::KEY_SUPPORTED_PICTURE_FORMATS[] = "picture-format-values";
const char CameraParameters::KEY_JPEG_THUMBNAIL_WIDTH[] = "jpeg-thumbnail-width";
const char CameraParameters::KEY_JPEG_THUMBNAIL_HEIGHT[] = "jpeg-thumbnail-height";
const char CameraParameters::KEY_SUPPORTED_JPEG_THUMBNAIL_SIZES[] = "jpeg-thumbnail-size-values";
const char CameraParameters::KEY_JPEG_THUMBNAIL_QUALITY[] = "jpeg-thumbnail-quality";
const char CameraParameters::KEY_JPEG_QUALITY[] = "jpeg-quality";
const char CameraParameters::KEY_ROTATION[] = "rotation";
const char CameraParameters::KEY_GPS_LATITUDE[] = "gps-latitude";
const char CameraParameters::KEY_GPS_LONGITUDE[] = "gps-longitude";
const char CameraParameters::KEY_GPS_ALTITUDE[] = "gps-altitude";
const char CameraParameters::KEY_GPS_TIMESTAMP[] = "gps-timestamp";
const char CameraParameters::KEY_GPS_PROCESSING_METHOD[] = "gps-processing-method";
const char CameraParameters::KEY_WHITE_BALANCE[] = "whitebalance";
const char CameraParameters::KEY_SUPPORTED_WHITE_BALANCE[] = "whitebalance-values";
const char CameraParameters::KEY_EFFECT[] = "effect";
const char CameraParameters::KEY_SUPPORTED_EFFECTS[] = "effect-values";
const char CameraParameters::KEY_ANTIBANDING[] = "antibanding";
const char CameraParameters::KEY_SUPPORTED_ANTIBANDING[] = "antibanding-values";
const char CameraParameters::KEY_SCENE_MODE[] = "scene-mode";
const char CameraParameters::KEY_SUPPORTED_SCENE_MODES[] = "scene-mode-values";
const char CameraParameters::KEY_FLASH_MODE[] = "flash-mode";
const char CameraParameters::KEY_SUPPORTED_FLASH_MODES[] = "flash-mode-values";
const char CameraParameters::KEY_FOCUS_MODE[] = "focus-mode";
const char CameraParameters::KEY_SUPPORTED_FOCUS_MODES[] = "focus-mode-values";
const char CameraParameters::KEY_MAX_NUM_FOCUS_AREAS[] = "max-num-focus-areas";
const char CameraParameters::KEY_FOCUS_AREAS[] = "focus-areas";
const char CameraParameters::KEY_FOCAL_LENGTH[] = "focal-length";
const char CameraParameters::KEY_HORIZONTAL_VIEW_ANGLE[] = "horizontal-view-angle";
const char CameraParameters::KEY_VERTICAL_VIEW_ANGLE[] = "vertical-view-angle";
const char CameraParameters::KEY_EXPOSURE_COMPENSATION[] = "exposure-compensation";
const char CameraParameters::KEY_MAX_EXPOSURE_COMPENSATION[] = "max-exposure-compensation";
const char CameraParameters::KEY_MIN_EXPOSURE_COMPENSATION[] = "min-exposure-compensation";
const char CameraParameters::KEY_EXPOSURE_COMPENSATION_STEP[] = "exposure-compensation-step";
const char CameraParameters::KEY_AUTO_EXPOSURE_LOCK[] = "auto-exposure-lock";
const char CameraParameters::KEY_AUTO_EXPOSURE_LOCK_SUPPORTED[] = "auto-exposure-lock-supported";
const char CameraParameters::KEY_AUTO_WHITEBALANCE_LOCK[] = "auto-whitebalance-lock";
const char CameraParameters::KEY_AUTO_WHITEBALANCE_LOCK_SUPPORTED[] = "auto-whitebalance-lock-supported";
const char CameraParameters::KEY_MAX_NUM_METERING_AREAS[] = "max-num-metering-areas";
const char CameraParameters::KEY_METERING_AREAS[] = "metering-areas";
const char CameraParameters::KEY_ZOOM[] = "zoom";
const char CameraParameters::KEY_MAX_ZOOM[] = "max-zoom";
const char CameraParameters::KEY_ZOOM_RATIOS[] = "zoom-ratios";
const char CameraParameters::KEY_ZOOM_SUPPORTED[] = "zoom-supported";
const char CameraParameters::KEY_SMOOTH_ZOOM_SUPPORTED[] = "smooth-zoom-supported";
const char CameraParameters::KEY_FOCUS_DISTANCES[] = "focus-distances";
const char CameraParameters::KEY_VIDEO_FRAME_FORMAT[] = "video-frame-format";
const char CameraParameters::KEY_VIDEO_SIZE[] = "video-size";
const char CameraParameters::KEY_SUPPORTED_VIDEO_SIZES[] = "video-size-values";
const char CameraParameters::KEY_PREFERRED_PREVIEW_SIZE_FOR_VIDEO[] = "preferred-preview-size-for-video";
const char CameraParameters::KEY_MAX_NUM_DETECTED_FACES_HW[] = "max-num-detected-faces-hw";
const char CameraParameters::KEY_MAX_NUM_DETECTED_FACES_SW[] = "max-num-detected-faces-sw";
const char CameraParameters::KEY_RECORDING_HINT[] = "recording-hint";
const char CameraParameters::KEY_VIDEO_SNAPSHOT_SUPPORTED[] = "video-snapshot-supported";
const char CameraParameters::KEY_VIDEO_STABILIZATION[] = "video-stabilization";
const char CameraParameters::KEY_VIDEO_STABILIZATION_SUPPORTED[] = "video-stabilization-supported";
const char CameraParameters::KEY_LIGHTFX[] = "light-fx";
const char CameraParameters::TRUE[] = "true";
const char CameraParameters::FALSE[] = "false";
const char CameraParameters::FOCUS_DISTANCE_INFINITY[] = "Infinity";
// Values for white balance settings.
const char CameraParameters::WHITE_BALANCE_AUTO[] = "auto";
const char CameraParameters::WHITE_BALANCE_INCANDESCENT[] = "incandescent";
const char CameraParameters::WHITE_BALANCE_FLUORESCENT[] = "fluorescent";
const char CameraParameters::WHITE_BALANCE_WARM_FLUORESCENT[] = "warm-fluorescent";
const char CameraParameters::WHITE_BALANCE_DAYLIGHT[] = "daylight";
const char CameraParameters::WHITE_BALANCE_CLOUDY_DAYLIGHT[] = "cloudy-daylight";
const char CameraParameters::WHITE_BALANCE_TWILIGHT[] = "twilight";
const char CameraParameters::WHITE_BALANCE_SHADE[] = "shade";
// Values for effect settings.
const char CameraParameters::EFFECT_NONE[] = "none";
const char CameraParameters::EFFECT_MONO[] = "mono";
const char CameraParameters::EFFECT_NEGATIVE[] = "negative";
const char CameraParameters::EFFECT_SOLARIZE[] = "solarize";
const char CameraParameters::EFFECT_SEPIA[] = "sepia";
const char CameraParameters::EFFECT_POSTERIZE[] = "posterize";
const char CameraParameters::EFFECT_WHITEBOARD[] = "whiteboard";
const char CameraParameters::EFFECT_BLACKBOARD[] = "blackboard";
const char CameraParameters::EFFECT_AQUA[] = "aqua";
// Values for antibanding settings.
const char CameraParameters::ANTIBANDING_AUTO[] = "auto";
const char CameraParameters::ANTIBANDING_50HZ[] = "50hz";
const char CameraParameters::ANTIBANDING_60HZ[] = "60hz";
const char CameraParameters::ANTIBANDING_OFF[] = "off";
// Values for flash mode settings.
const char CameraParameters::FLASH_MODE_OFF[] = "off";
const char CameraParameters::FLASH_MODE_AUTO[] = "auto";
const char CameraParameters::FLASH_MODE_ON[] = "on";
const char CameraParameters::FLASH_MODE_RED_EYE[] = "red-eye";
const char CameraParameters::FLASH_MODE_TORCH[] = "torch";
// Values for scene mode settings.
const char CameraParameters::SCENE_MODE_AUTO[] = "auto";
const char CameraParameters::SCENE_MODE_ACTION[] = "action";
const char CameraParameters::SCENE_MODE_PORTRAIT[] = "portrait";
const char CameraParameters::SCENE_MODE_LANDSCAPE[] = "landscape";
const char CameraParameters::SCENE_MODE_NIGHT[] = "night";
const char CameraParameters::SCENE_MODE_NIGHT_PORTRAIT[] = "night-portrait";
const char CameraParameters::SCENE_MODE_THEATRE[] = "theatre";
const char CameraParameters::SCENE_MODE_BEACH[] = "beach";
const char CameraParameters::SCENE_MODE_SNOW[] = "snow";
const char CameraParameters::SCENE_MODE_SUNSET[] = "sunset";
const char CameraParameters::SCENE_MODE_STEADYPHOTO[] = "steadyphoto";
const char CameraParameters::SCENE_MODE_FIREWORKS[] = "fireworks";
const char CameraParameters::SCENE_MODE_SPORTS[] = "sports";
const char CameraParameters::SCENE_MODE_PARTY[] = "party";
const char CameraParameters::SCENE_MODE_CANDLELIGHT[] = "candlelight";
const char CameraParameters::SCENE_MODE_BARCODE[] = "barcode";
const char CameraParameters::SCENE_MODE_HDR[] = "hdr";
const char CameraParameters::PIXEL_FORMAT_YUV422SP[] = "yuv422sp";
const char CameraParameters::PIXEL_FORMAT_YUV420SP[] = "yuv420sp";
const char CameraParameters::PIXEL_FORMAT_YUV422I[] = "yuv422i-yuyv";
const char CameraParameters::PIXEL_FORMAT_YUV420P[] = "yuv420p";
const char CameraParameters::PIXEL_FORMAT_RGB565[] = "rgb565";
const char CameraParameters::PIXEL_FORMAT_RGBA8888[] = "rgba8888";
const char CameraParameters::PIXEL_FORMAT_JPEG[] = "jpeg";
const char CameraParameters::PIXEL_FORMAT_BAYER_RGGB[] = "bayer-rggb";
const char CameraParameters::PIXEL_FORMAT_ANDROID_OPAQUE[] = "android-opaque";
// Values for focus mode settings.
const char CameraParameters::FOCUS_MODE_AUTO[] = "auto";
const char CameraParameters::FOCUS_MODE_INFINITY[] = "infinity";
const char CameraParameters::FOCUS_MODE_MACRO[] = "macro";
const char CameraParameters::FOCUS_MODE_FIXED[] = "fixed";
const char CameraParameters::FOCUS_MODE_EDOF[] = "edof";
const char CameraParameters::FOCUS_MODE_CONTINUOUS_VIDEO[] = "continuous-video";
const char CameraParameters::FOCUS_MODE_CONTINUOUS_PICTURE[] = "continuous-picture";
// Values for light fx settings
const char CameraParameters::LIGHTFX_LOWLIGHT[] = "low-light";
const char CameraParameters::LIGHTFX_HDR[] = "high-dynamic-range";
// Custom parameters for Samsung
const char CameraParameters::KEY_SUPPORTED_ISO_MODES[] = "iso-values";
const char CameraParameters::KEY_QC_FACE_RECOGNITION[] = "face-recognition";
const char CameraParameters::KEY_QC_SUPPORTED_FACE_RECOGNITION[] = "face-recognition-values";
const char CameraParameters::KEY_QC_SUPPORTED_FACE_RECOGNITION_MODES[] = "face-recognition-values";
const char CameraParameters::KEY_QC_FACE_DETECTION[] = "face-detection";
const char CameraParameters::KEY_QC_SUPPORTED_FACE_DETECTION[] = "face-detection-values";
const char CameraParameters::KEY_FACE_DETECTION[] = "face-detection";
const char CameraParameters::KEY_SUPPORTED_FACE_DETECTION[] = "face-detection-values";
const char CameraParameters::FACE_DETECTION_OFF[] = "off";
const char CameraParameters::FACE_DETECTION_ON[] = "on";
const char CameraParameters::KEY_ZSL[] = "zsl";
const char CameraParameters::KEY_SUPPORTED_ZSL_MODES[] = "zsl-values";
const char CameraParameters::ZSL_OFF[] = "off";
const char CameraParameters::ZSL_ON[] = "on";
const char CameraParameters::KEY_ISO_MODE[] = "iso";
const char CameraParameters::KEY_CAMERA_MODE[] = "camera-mode";
const char CameraParameters::KEY_SAMSUNG_CAMERA_MODE[] = "cam_mode";
const char CameraParameters::KEY_SELECTABLE_ZONE_AF[] = "selectable-zone-af";
const char CameraParameters::KEY_SUPPORTED_SELECTABLE_ZONE_AF[] = "selectable-zone-af-values";
const char CameraParameters::SELECTABLE_ZONE_AF_AUTO[] = "auto";
const char CameraParameters::SELECTABLE_ZONE_AF_SPOT_METERING[] = "spot-metering";
const char CameraParameters::SELECTABLE_ZONE_AF_CENTER_WEIGHTED[] = "center-weighted";
const char CameraParameters::SELECTABLE_ZONE_AF_FRAME_AVERAGE[] = "frame-average";
const char CameraParameters::KEY_PREVIEW_FRAME_RATE_MODE[] = "preview-frame-rate-mode";
const char CameraParameters::KEY_SUPPORTED_PREVIEW_FRAME_RATE_MODES[] = "preview-frame-rate-modes";
const char CameraParameters::KEY_PREVIEW_FRAME_RATE_AUTO_MODE[] = "frame-rate-auto";
const char CameraParameters::KEY_PREVIEW_FRAME_RATE_FIXED_MODE[] = "frame-rate-fixed";
const char CameraParameters::KEY_SHARPNESS[] = "sharpness";
const char CameraParameters::KEY_SATURATION[] = "saturation";
const char CameraParameters::KEY_CONTRAST[] = "contrast";
const char CameraParameters::KEY_SCENE_DETECT[] = "scene-detect";
const char CameraParameters::KEY_SUPPORTED_SCENE_DETECT[] = "scene-detect-values";
const char CameraParameters::SCENE_DETECT_OFF[] = "off";
const char CameraParameters::SCENE_DETECT_ON[] = "on";
const char CameraParameters::KEY_WEATHER[] = "weather";
const char CameraParameters::KEY_CITYID[] = "contextualtag-cityid";
const char CameraParameters::KEY_TOUCH_AF_AEC[] = "touch-af-aec";
const char CameraParameters::KEY_SUPPORTED_TOUCH_AF_AEC[] = "touch-af-aec-values";
const char CameraParameters::TOUCH_AF_AEC_OFF[] = "touch-off";
const char CameraParameters::TOUCH_AF_AEC_ON[] = "touch-on";
const char CameraParameters::KEY_MEMORY_COLOR_ENHANCEMENT[] = "mce";
const char CameraParameters::KEY_LENSSHADE[] = "lensshade";
const char CameraParameters::KEY_REDEYE_REDUCTION[] = "redeye-reduction";
const char CameraParameters::KEY_SUPPORTED_REDEYE_REDUCTION[] = "redeye-reduction-values";
const char CameraParameters::REDEYE_REDUCTION_ENABLE[] = "enable";
const char CameraParameters::REDEYE_REDUCTION_DISABLE[] = "disable";
const char CameraParameters::KEY_GPS_LATITUDE_REF[] = "gps-latitude-ref";
const char CameraParameters::KEY_GPS_LONGITUDE_REF[] = "gps-longitude-ref";
const char CameraParameters::KEY_GPS_ALTITUDE_REF[] = "gps-altitude-ref";
const char CameraParameters::KEY_GPS_STATUS[] = "gps-status";
const char CameraParameters::KEY_EXIF_DATETIME[] = "exif-datetime";
const char CameraParameters::KEY_AUTO_EXPOSURE[] = "auto-exposure";
const char CameraParameters::KEY_SUPPORTED_AUTO_EXPOSURE[] = "auto-exposure-values";
const char CameraParameters::KEY_SUPPORTED_LENSSHADE_MODES[] = "lensshade-values";
const char CameraParameters::LENSSHADE_ENABLE[] = "enable";
const char CameraParameters::LENSSHADE_DISABLE[] = "disable";
const char CameraParameters::MCE_ENABLE[] = "enable";
const char CameraParameters::MCE_DISABLE[] = "disable";
const char CameraParameters::ISO_AUTO[] = "auto";
const char CameraParameters::ISO_HJR[] = "ISO_HJR";
const char CameraParameters::ISO_100[] = "ISO100";
const char CameraParameters::ISO_200[] = "ISO200";
const char CameraParameters::ISO_400[] = "ISO400";
const char CameraParameters::ISO_800[] = "ISO800";
const char CameraParameters::ISO_1600[] = "ISO1600";
const char CameraParameters::ISO_3200[] = "ISO3200";
const char CameraParameters::ISO_6400[] = "ISO6400";
const char CameraParameters::KEY_SUPPORTED_HFR_SIZES[] = "hfr-size-values";
const char CameraParameters::KEY_SUPPORTED_MEM_COLOR_ENHANCE_MODES[] = "mce-values";
const char CameraParameters::VIDEO_HFR_OFF[] = "off";
const char CameraParameters::VIDEO_HFR_2X[] = "60";
const char CameraParameters::VIDEO_HFR_3X[] = "90";
const char CameraParameters::VIDEO_HFR_4X[] = "120";
const char CameraParameters::KEY_VIDEO_HIGH_FRAME_RATE[] = "video-hfr";
const char CameraParameters::KEY_SUPPORTED_VIDEO_HIGH_FRAME_RATE_MODES[] = "video-hfr-values";
const char CameraParameters::KEY_HISTOGRAM[] = "histogram";
const char CameraParameters::KEY_SUPPORTED_HISTOGRAM_MODES[] = "histogram-values";
const char CameraParameters::HISTOGRAM_ENABLE[] = "enable";
const char CameraParameters::HISTOGRAM_DISABLE[] = "disable";
const char CameraParameters::SKIN_TONE_ENHANCEMENT_ENABLE[] = "enable";
const char CameraParameters::SKIN_TONE_ENHANCEMENT_DISABLE[] = "disable";
const char CameraParameters::KEY_SKIN_TONE_ENHANCEMENT[] = "skinToneEnhancement";
const char CameraParameters::KEY_SUPPORTED_SKIN_TONE_ENHANCEMENT_MODES[] = "skinToneEnhancement-values";
const char CameraParameters::DENOISE_OFF[] = "denoise-off";
const char CameraParameters::DENOISE_ON[] = "denoise-on";
const char CameraParameters::KEY_DENOISE[] = "denoise";
const char CameraParameters::KEY_SUPPORTED_DENOISE[] = "denoise-values";
const char CameraParameters::EFFECT_EMBOSS[] = "emboss";
const char CameraParameters::EFFECT_SKETCH[] = "sketch";
const char CameraParameters::EFFECT_NEON[] = "neon";
const char CameraParameters::SCENE_MODE_FLOWERS[] = "flowers";
const char CameraParameters::SCENE_MODE_AR[] = "AR";
const char CameraParameters::PIXEL_FORMAT_YUV420SP_ADRENO[] = "yuv420sp-adreno";
const char CameraParameters::PIXEL_FORMAT_RAW[] = "raw";
const char CameraParameters::PIXEL_FORMAT_YV12[] = "yuv420p";
const char CameraParameters::PIXEL_FORMAT_NV12[] = "nv12";
const char CameraParameters::EFFECT_CARTOONIZE[] = "cartoonize";
const char CameraParameters::EFFECT_POINT_RED_YELLOW[] = "point-red-yellow";
const char CameraParameters::EFFECT_POINT_GREEN[] = "point-green";
const char CameraParameters::EFFECT_POINT_BLUE[] = "point-blue";
const char CameraParameters::EFFECT_VINTAGE_COLD[] = "vintage-cold";
const char CameraParameters::EFFECT_VINTAGE_WARM[] = "vintage-warm";
const char CameraParameters::EFFECT_WASHED[] = "washed";
const char CameraParameters::SCENE_MODE_BACKLIGHT[] = "backlight";
const char CameraParameters::SCENE_MODE_ASD[] = "asd";
CameraParameters::CameraParameters()
: mMap()
{
}
CameraParameters::~CameraParameters()
{
}
String8 CameraParameters::flatten() const
{
String8 flattened("");
size_t size = mMap.size();
for (size_t i = 0; i < size; i++) {
String8 k, v;
k = mMap.keyAt(i);
v = mMap.valueAt(i);
flattened += k;
flattened += "=";
flattened += v;
if (i != size-1)
flattened += ";";
}
return flattened;
}
void CameraParameters::unflatten(const String8 &params)
{
const char *a = params.string();
const char *b;
mMap.clear();
for (;;) {
// Find the bounds of the key name.
b = strchr(a, '=');
if (b == 0)
break;
// Create the key string.
String8 k(a, (size_t)(b-a));
// Find the value.
a = b+1;
b = strchr(a, ';');
if (b == 0) {
// If there's no semicolon, this is the last item.
String8 v(a);
mMap.add(k, v);
break;
}
String8 v(a, (size_t)(b-a));
mMap.add(k, v);
a = b+1;
}
}
void CameraParameters::set(const char *key, const char *value)
{
if (key == NULL || value == NULL)
return;
// XXX i think i can do this with strspn()
if (strchr(key, '=') || strchr(key, ';')) {
//XXX ALOGE("Key \"%s\"contains invalid character (= or ;)", key);
return;
}
if (strchr(value, '=') || strchr(value, ';')) {
//XXX ALOGE("Value \"%s\"contains invalid character (= or ;)", value);
return;
}
#ifdef QCOM_HARDWARE
// qcom cameras default to delivering an extra zero-exposure frame on HDR.
// The android SDK only wants one frame, so disable this unless the app
// explicitly asks for it
if (!get("hdr-need-1x")) {
mMap.replaceValueFor(String8("hdr-need-1x"), String8("false"));
}
#endif
mMap.replaceValueFor(String8(key), String8(value));
}
void CameraParameters::set(const char *key, int value)
{
char str[16];
sprintf(str, "%d", value);
set(key, str);
}
void CameraParameters::setFloat(const char *key, float value)
{
char str[16]; // 14 should be enough. We overestimate to be safe.
snprintf(str, sizeof(str), "%g", value);
set(key, str);
}
const char *CameraParameters::get(const char *key) const
{
String8 v = mMap.valueFor(String8(key));
if (v.length() == 0)
return 0;
return v.string();
}
int CameraParameters::getInt(const char *key) const
{
const char *v = get(key);
if (v == 0)
return -1;
return strtol(v, 0, 0);
}
float CameraParameters::getFloat(const char *key) const
{
const char *v = get(key);
if (v == 0) return -1;
return strtof(v, 0);
}
void CameraParameters::remove(const char *key)
{
mMap.removeItem(String8(key));
}
// Parse string like "640x480" or "10000,20000"
static int parse_pair(const char *str, int *first, int *second, char delim,
char **endptr = NULL)
{
// Find the first integer.
char *end;
int w = (int)strtol(str, &end, 10);
// If a delimeter does not immediately follow, give up.
if (*end != delim) {
ALOGE("Cannot find delimeter (%c) in str=%s", delim, str);
return -1;
}
// Find the second integer, immediately after the delimeter.
int h = (int)strtol(end+1, &end, 10);
*first = w;
*second = h;
if (endptr) {
*endptr = end;
}
return 0;
}
static void parseSizesList(const char *sizesStr, Vector<Size> &sizes)
{
if (sizesStr == 0) {
return;
}
char *sizeStartPtr = (char *)sizesStr;
while (true) {
int width, height;
int success = parse_pair(sizeStartPtr, &width, &height, 'x',
&sizeStartPtr);
if (success == -1 || (*sizeStartPtr != ',' && *sizeStartPtr != '\0')) {
ALOGE("Picture sizes string \"%s\" contains invalid character.", sizesStr);
return;
}
sizes.push(Size(width, height));
if (*sizeStartPtr == '\0') {
return;
}
sizeStartPtr++;
}
}
void CameraParameters::setPreviewSize(int width, int height)
{
char str[32];
sprintf(str, "%dx%d", width, height);
set(KEY_PREVIEW_SIZE, str);
}
void CameraParameters::getPreviewSize(int *width, int *height) const
{
*width = *height = -1;
// Get the current string, if it doesn't exist, leave the -1x-1
const char *p = get(KEY_PREVIEW_SIZE);
if (p == 0) return;
parse_pair(p, width, height, 'x');
}
void CameraParameters::getPreferredPreviewSizeForVideo(int *width, int *height) const
{
*width = *height = -1;
const char *p = get(KEY_PREFERRED_PREVIEW_SIZE_FOR_VIDEO);
if (p == 0) return;
parse_pair(p, width, height, 'x');
}
void CameraParameters::getSupportedPreviewSizes(Vector<Size> &sizes) const
{
const char *previewSizesStr = get(KEY_SUPPORTED_PREVIEW_SIZES);
parseSizesList(previewSizesStr, sizes);
}
void CameraParameters::setVideoSize(int width, int height)
{
char str[32];
sprintf(str, "%dx%d", width, height);
set(KEY_VIDEO_SIZE, str);
}
void CameraParameters::getVideoSize(int *width, int *height) const
{
*width = *height = -1;
const char *p = get(KEY_VIDEO_SIZE);
if (p == 0) return;
parse_pair(p, width, height, 'x');
}
void CameraParameters::getSupportedVideoSizes(Vector<Size> &sizes) const
{
const char *videoSizesStr = get(KEY_SUPPORTED_VIDEO_SIZES);
parseSizesList(videoSizesStr, sizes);
}
void CameraParameters::setPreviewFrameRate(int fps)
{
set(KEY_PREVIEW_FRAME_RATE, fps);
}
int CameraParameters::getPreviewFrameRate() const
{
return getInt(KEY_PREVIEW_FRAME_RATE);
}
void CameraParameters::getPreviewFpsRange(int *min_fps, int *max_fps) const
{
*min_fps = *max_fps = -1;
const char *p = get(KEY_PREVIEW_FPS_RANGE);
if (p == 0) return;
parse_pair(p, min_fps, max_fps, ',');
}
void CameraParameters::setPreviewFormat(const char *format)
{
set(KEY_PREVIEW_FORMAT, format);
}
const char *CameraParameters::getPreviewFormat() const
{
return get(KEY_PREVIEW_FORMAT);
}
void CameraParameters::setPictureSize(int width, int height)
{
char str[32];
sprintf(str, "%dx%d", width, height);
set(KEY_PICTURE_SIZE, str);
}
void CameraParameters::getPictureSize(int *width, int *height) const
{
*width = *height = -1;
// Get the current string, if it doesn't exist, leave the -1x-1
const char *p = get(KEY_PICTURE_SIZE);
if (p == 0) return;
parse_pair(p, width, height, 'x');
}
void CameraParameters::getSupportedPictureSizes(Vector<Size> &sizes) const
{
const char *pictureSizesStr = get(KEY_SUPPORTED_PICTURE_SIZES);
parseSizesList(pictureSizesStr, sizes);
}
void CameraParameters::setPictureFormat(const char *format)
{
set(KEY_PICTURE_FORMAT, format);
}
const char *CameraParameters::getPictureFormat() const
{
return get(KEY_PICTURE_FORMAT);
}
void CameraParameters::dump() const
{
ALOGD("dump: mMap.size = %zu", mMap.size());
for (size_t i = 0; i < mMap.size(); i++) {
String8 k, v;
k = mMap.keyAt(i);
v = mMap.valueAt(i);
ALOGD("%s: %s\n", k.string(), v.string());
}
}
status_t CameraParameters::dump(int fd, const Vector<String16>& /*args*/) const
{
const size_t SIZE = 256;
char buffer[SIZE];
String8 result;
snprintf(buffer, 255, "CameraParameters::dump: mMap.size = %zu\n", mMap.size());
result.append(buffer);
for (size_t i = 0; i < mMap.size(); i++) {
String8 k, v;
k = mMap.keyAt(i);
v = mMap.valueAt(i);
snprintf(buffer, 255, "\t%s: %s\n", k.string(), v.string());
result.append(buffer);
}
write(fd, result.string(), result.size());
return NO_ERROR;
}
void CameraParameters::getSupportedPreviewFormats(Vector<int>& formats) const {
const char* supportedPreviewFormats =
get(CameraParameters::KEY_SUPPORTED_PREVIEW_FORMATS);
if (supportedPreviewFormats == NULL) {
ALOGW("%s: No supported preview formats.", __FUNCTION__);
return;
}
String8 fmtStr(supportedPreviewFormats);
char* prevFmts = fmtStr.lockBuffer(fmtStr.size());
char* savePtr;
char* fmt = strtok_r(prevFmts, ",", &savePtr);
while (fmt) {
int actual = previewFormatToEnum(fmt);
if (actual != -1) {
formats.add(actual);
}
fmt = strtok_r(NULL, ",", &savePtr);
}
fmtStr.unlockBuffer(fmtStr.size());
}
int CameraParameters::previewFormatToEnum(const char* format) {
return
!format ?
HAL_PIXEL_FORMAT_YCrCb_420_SP :
!strcmp(format, PIXEL_FORMAT_YUV422SP) ?
HAL_PIXEL_FORMAT_YCbCr_422_SP : // NV16
!strcmp(format, PIXEL_FORMAT_YUV420SP) ?
HAL_PIXEL_FORMAT_YCrCb_420_SP : // NV21
!strcmp(format, PIXEL_FORMAT_YUV422I) ?
HAL_PIXEL_FORMAT_YCbCr_422_I : // YUY2
!strcmp(format, PIXEL_FORMAT_YUV420P) ?
HAL_PIXEL_FORMAT_YV12 : // YV12
!strcmp(format, PIXEL_FORMAT_RGB565) ?
HAL_PIXEL_FORMAT_RGB_565 : // RGB565
!strcmp(format, PIXEL_FORMAT_RGBA8888) ?
HAL_PIXEL_FORMAT_RGBA_8888 : // RGB8888
!strcmp(format, PIXEL_FORMAT_BAYER_RGGB) ?
HAL_PIXEL_FORMAT_RAW16 : // Raw sensor data
-1;
}
bool CameraParameters::isEmpty() const {
return mMap.isEmpty();
}
// Custom parameters for Samsung
int CameraParameters::getInt64(const char *key __unused) const
{
return -1;
}
const char * CameraParameters::getPreviewFrameRateMode() const
{
return mParams->get("preview-frame-rate-mode");
}
void CameraParameters::setPreviewFrameRateMode(const char *mode)
{
mParams->set("preview-frame-rate-mode", mode);
}
void CameraParameters::getMeteringAreaCenter(int *x, int *y) const
{
const char *p;
*x = *y = -2000;
p = mParams->get("metering-areas");
parse_pair(p, x, y, 'x');
*x /= 2;
*y /= 2;
}
void CameraParameters::setTouchIndexAec(int x, int y)
{
char buf[32];
snprintf(buf, 32, "%dx%d", x, y);
mParams->set("touch-index-aec", buf);
}
void CameraParameters::setTouchIndexAf(int x, int y)
{
char buf[32];
snprintf(buf, 32, "%dx%d", x, y);
mParams->set("touch-index-af", buf);
}
void CameraParameters::setPreviewFpsRange(int min, int max)
{
char buf[32];
snprintf(buf, 32, "%d,%d", min, max);
mParams->set("preview-fps-range", buf);
}
}; // namespace android

View file

@ -1,6 +1,6 @@
/* /*
* Copyright (C) 2016 The CyanogenMod Project * Copyright (C) 2013-2016, The CyanogenMod Project
* Copyright (C) 2018 The LineageOS Project * Copyright (C) 2017, The LineageOS Project
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -23,26 +23,21 @@
*/ */
//#define LOG_NDEBUG 0 //#define LOG_NDEBUG 0
#define LOG_TAG "CameraWrapper" #define LOG_TAG "CameraWrapper"
#include <cutils/log.h> #include <cutils/log.h>
#include <utils/threads.h>
#include <utils/String8.h>
#include <hardware/hardware.h>
#include <hardware/camera.h>
#include <camera/Camera.h> #include <camera/Camera.h>
#include <camera/CameraParameters.h> #include <camera/CameraParameters.h>
#include <hardware/camera.h>
#include <hardware/hardware.h>
#include <utils/String8.h>
#include <utils/threads.h>
#include "CameraWrapper.h" static android::Mutex gCameraWrapperLock;
static camera_module_t* gVendorModule = 0;
static const char PIXEL_FORMAT_YUV420SP_NV21E[] = "yuv420sp-nv21e"; static char** fixed_set_params = NULL;
#define BACK_CAMERA 0
#define FRONT_CAMERA 1
using namespace android;
static Mutex gCameraWrapperLock;
static camera_module_t *gVendorModule = 0;
static camera_notify_callback gUserNotifyCb = NULL; static camera_notify_callback gUserNotifyCb = NULL;
static camera_data_callback gUserDataCb = NULL; static camera_data_callback gUserDataCb = NULL;
@ -50,123 +45,231 @@ static camera_data_timestamp_callback gUserDataCbTimestamp = NULL;
static camera_request_memory gUserGetMemory = NULL; static camera_request_memory gUserGetMemory = NULL;
static void *gUserCameraDevice = NULL; static void *gUserCameraDevice = NULL;
static char **fixed_set_params = NULL; static int camera_device_open(const hw_module_t* module, const char* name, hw_device_t** device);
static int camera_device_open(const hw_module_t *module, const char *name,
hw_device_t **device);
static int camera_get_number_of_cameras(void); static int camera_get_number_of_cameras(void);
static int camera_get_camera_info(int camera_id, struct camera_info *info); static int camera_get_camera_info(int camera_id, struct camera_info* info);
static int camera_send_command(struct camera_device* device, int32_t cmd, int32_t arg1,
int32_t arg2);
static struct hw_module_methods_t camera_module_methods = { static struct hw_module_methods_t camera_module_methods = {
.open = camera_device_open .open = camera_device_open,
}; };
camera_module_t HAL_MODULE_INFO_SYM = { camera_module_t HAL_MODULE_INFO_SYM = {
.common = { .common =
.tag = HARDWARE_MODULE_TAG, {
.version_major = 1, .tag = HARDWARE_MODULE_TAG,
.version_minor = 0, .module_api_version = CAMERA_MODULE_API_VERSION_1_0,
.id = CAMERA_HARDWARE_MODULE_ID, .hal_api_version = HARDWARE_HAL_API_VERSION,
.name = "MSM8226 Camera Wrapper", .id = CAMERA_HARDWARE_MODULE_ID,
.author = "The LineageOS Project", .name = "Samsung msm8930 Camera Wrapper",
.methods = &camera_module_methods, .author = "The CyanogenMod Project",
.dso = NULL, /* remove compilation warnings */ .methods = &camera_module_methods,
.reserved = {0}, /* remove compilation warnings */ .dso = NULL, /* remove compilation warnings */
}, .reserved = {0}, /* remove compilation warnings */
},
.get_number_of_cameras = camera_get_number_of_cameras, .get_number_of_cameras = camera_get_number_of_cameras,
.get_camera_info = camera_get_camera_info, .get_camera_info = camera_get_camera_info,
.set_callbacks = NULL, /* remove compilation warnings */ .set_callbacks = NULL, /* remove compilation warnings */
.get_vendor_tag_ops = NULL, /* remove compilation warnings */ .get_vendor_tag_ops = NULL, /* remove compilation warnings */
.open_legacy = NULL, /* remove compilation warnings */ .open_legacy = NULL, /* remove compilation warnings */
.set_torch_mode = camera_set_torch_mode, .set_torch_mode = NULL, /* remove compilation warnings */
.init = NULL, /* remove compilation warnings */ .init = NULL, /* remove compilation warnings */
.reserved = {0}, /* remove compilation warnings */ .reserved = {0}, /* remove compilation warnings */
}; };
typedef struct wrapper_camera_device { typedef struct wrapper_camera_device {
camera_device_t base; camera_device_t base;
int camera_released; int camera_released;
int id; int id;
camera_device_t *vendor; camera_device_t* vendor;
} wrapper_camera_device_t; } wrapper_camera_device_t;
#define VENDOR_CALL(device, func, ...) ({ \ void camera_notify_cb(int32_t msg_type, int32_t ext1, int32_t ext2, void * /*user*/) {
wrapper_camera_device_t *__wrapper_dev = (wrapper_camera_device_t*) device; \ gUserNotifyCb(msg_type, ext1, ext2, gUserCameraDevice);
__wrapper_dev->vendor->ops->func(__wrapper_dev->vendor, ##__VA_ARGS__); \ }
})
#define CAMERA_ID(device) (((wrapper_camera_device_t *)(device))->id) void camera_data_cb(int32_t msg_type, const camera_memory_t *data, unsigned int index,
camera_frame_metadata_t *metadata, void * /*user*/) {
gUserDataCb(msg_type, data, index, metadata, gUserCameraDevice);
}
static int check_vendor_module() void camera_data_cb_timestamp(nsecs_t timestamp, int32_t msg_type,
{ const camera_memory_t *data, unsigned index, void * /*user*/) {
gUserDataCbTimestamp(timestamp, msg_type, data, index, gUserCameraDevice);
}
camera_memory_t* camera_get_memory(int fd, size_t buf_size,
uint_t num_bufs, void * /*user*/) {
return gUserGetMemory(fd, buf_size, num_bufs, gUserCameraDevice);
}
#define VENDOR_CALL(device, func, ...) \
({ \
wrapper_camera_device_t* __wrapper_dev = (wrapper_camera_device_t*)device; \
__wrapper_dev->vendor->ops->func(__wrapper_dev->vendor, ##__VA_ARGS__); \
})
#define CAMERA_ID(device) (((wrapper_camera_device_t*)(device))->id)
static int check_vendor_module() {
int rv = 0; int rv = 0;
ALOGV("%s", __FUNCTION__); ALOGV("%s", __FUNCTION__);
if (gVendorModule) if (gVendorModule) return 0;
return 0;
rv = hw_get_module_by_class("camera", "vendor", rv = hw_get_module_by_class("camera", "vendor", (const hw_module_t**)&gVendorModule);
(const hw_module_t**)&gVendorModule); if (rv) ALOGE("failed to open vendor camera module");
if (rv)
ALOGE("failed to open vendor camera module");
return rv; return rv;
} }
static char *camera_fixup_getparams(int id, const char *settings) const static char* iso_values[] = {
{ "auto,"
CameraParameters params; #ifdef ISO_MODE_50
params.unflatten(String8(settings)); "ISO50,"
#endif
#ifdef ISO_MODE_HJR
"ISO_HJR,"
#endif
"ISO100,ISO200,ISO400,ISO800"
#ifdef ISO_MODE_1600
",ISO1600"
#endif
};
static char* camera_fixup_getparams(int id, const char* settings) {
android::CameraParameters params;
params.unflatten(android::String8(settings));
#if !LOG_NDEBUG #if !LOG_NDEBUG
ALOGV("%s: original parameters:", __FUNCTION__); ALOGV("%s: original parameters:", __FUNCTION__);
params.dump(); params.dump();
#endif #endif
// fix params here params.set(android::CameraParameters::KEY_SUPPORTED_ISO_MODES, iso_values[id]);
params.set(android::CameraParameters::KEY_EXPOSURE_COMPENSATION_STEP, "0.5"); params.set(android::CameraParameters::KEY_PREFERRED_PREVIEW_SIZE_FOR_VIDEO, "1280x720");
params.set(android::CameraParameters::KEY_MIN_EXPOSURE_COMPENSATION, "-2"); params.set(android::CameraParameters::KEY_SUPPORTED_SCENE_MODES,
params.set(android::CameraParameters::KEY_MAX_EXPOSURE_COMPENSATION, "2"); "auto,asd,action,portrait,landscape,night,night-portrait,theatre,beach,snow,sunset,"
"steadyphoto,fireworks,sports,party,candlelight,backlight,flowers,AR");
params.set(android::CameraParameters::KEY_SUPPORTED_PREVIEW_SIZES, "640x360,640x480,352x288,320x240,176x144"); #ifdef FFC_PICTURE_FIXUP
if (id == 1) {
params.set(android::CameraParameters::KEY_SUPPORTED_PICTURE_SIZES,
"1392x1392,1280x720,640x480");
}
#endif
#ifdef FFC_VIDEO_FIXUP
if (id == 1) {
if (!params.get(android::CameraParameters::KEY_SUPPORTED_VIDEO_SIZES)) {
params.set(android::CameraParameters::KEY_SUPPORTED_VIDEO_SIZES,
"1280x720,640x480,320x240,176x144");
}
}
#endif
/* Enforce video-snapshot-supported to true */ #ifdef DISABLE_FACE_DETECTION
params.set(android::CameraParameters::KEY_VIDEO_SNAPSHOT_SUPPORTED, "true"); #ifndef DISABLE_FACE_DETECTION_BOTH_CAMERAS
/* Disable face detection for front facing camera */
if (id == 1) {
#endif
params.remove(android::CameraParameters::KEY_QC_FACE_RECOGNITION);
params.remove(android::CameraParameters::KEY_QC_SUPPORTED_FACE_RECOGNITION);
params.remove(android::CameraParameters::KEY_QC_SUPPORTED_FACE_RECOGNITION_MODES);
params.remove(android::CameraParameters::KEY_QC_FACE_DETECTION);
params.remove(android::CameraParameters::KEY_QC_SUPPORTED_FACE_DETECTION);
params.remove(android::CameraParameters::KEY_FACE_DETECTION);
params.remove(android::CameraParameters::KEY_SUPPORTED_FACE_DETECTION);
#ifndef DISABLE_FACE_DETECTION_BOTH_CAMERAS
}
#endif
#endif
#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(); android::String8 strParams = params.flatten();
char *ret = strdup(strParams.string()); char* ret = strdup(strParams.string());
return ret; return ret;
} }
static char *camera_fixup_setparams(int id, const char *settings) static bool wasVideo = false;
{
CameraParameters params; static char* camera_fixup_setparams(struct camera_device* device, const char* settings) {
params.unflatten(String8(settings)); int id = CAMERA_ID(device);
android::CameraParameters params;
params.unflatten(android::String8(settings));
const char* camMode = params.get(android::CameraParameters::KEY_SAMSUNG_CAMERA_MODE);
const char* recordingHint = params.get(android::CameraParameters::KEY_RECORDING_HINT);
bool isVideo = false;
if (recordingHint) isVideo = !strcmp(recordingHint, "true");
#if !LOG_NDEBUG #if !LOG_NDEBUG
ALOGV("%s: original parameters:", __FUNCTION__); ALOGV("%s: original parameters:", __FUNCTION__);
params.dump(); params.dump();
#endif #endif
params.set(android::CameraParameters::KEY_SUPPORTED_PREVIEW_SIZES, "640x360,640x480,528x432,352x288,320x240,176x144"); if (params.get("iso")) {
params.set(android::CameraParameters::KEY_PREVIEW_FPS_RANGE, "7500,30000"); const char* isoMode = params.get(android::CameraParameters::KEY_ISO_MODE);
if (strcmp(isoMode, "ISO50") == 0)
params.set(android::CameraParameters::KEY_ISO_MODE, "50");
else if (strcmp(isoMode, "ISO100") == 0)
params.set(android::CameraParameters::KEY_ISO_MODE, "100");
else if (strcmp(isoMode, "ISO200") == 0)
params.set(android::CameraParameters::KEY_ISO_MODE, "200");
else if (strcmp(isoMode, "ISO400") == 0)
params.set(android::CameraParameters::KEY_ISO_MODE, "400");
else if (strcmp(isoMode, "ISO800") == 0)
params.set(android::CameraParameters::KEY_ISO_MODE, "800");
else if (strcmp(isoMode, "ISO1600") == 0)
params.set(android::CameraParameters::KEY_ISO_MODE, "1600");
}
#ifdef SAMSUNG_CAMERA_MODE
/* Samsung camcorder mode */
if (id == 1) {
/* Enable for front camera only */
if (!(!strcmp(camMode, "1") && !isVideo) || wasVideo) {
/* Enable only if not already set (Snapchat) but do enable if the setting is left
over while switching from stills to video */
if ((!strcmp(params.get(android::CameraParameters::KEY_PREVIEW_FRAME_RATE), "15") ||
(!strcmp(params.get(android::CameraParameters::KEY_PREVIEW_SIZE), "320x240") &&
!strcmp(params.get(android::CameraParameters::KEY_JPEG_QUALITY), "96"))) &&
!isVideo) {
/* Do not set for video chat in Hangouts (Frame rate 15) or Skype (Preview size
320x240 and jpeg quality 96 */
} else {
/* "Normal case". Required to prevent distorted video and reboots
while taking snaps */
params.set(android::CameraParameters::KEY_SAMSUNG_CAMERA_MODE, isVideo ? "1" : "0");
}
wasVideo = (isVideo || wasVideo);
}
} else {
wasVideo = false;
}
#endif
#ifdef ENABLE_ZSL
if (id != 1) {
params.set(android::CameraParameters::KEY_ZSL, isVideo ? "off" : "on");
params.set(android::CameraParameters::KEY_CAMERA_MODE, isVideo ? "0" : "1");
}
#endif
#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(); android::String8 strParams = params.flatten();
if (fixed_set_params[id])
free(fixed_set_params[id]); if (fixed_set_params[id]) free(fixed_set_params[id]);
fixed_set_params[id] = strdup(strParams.string()); fixed_set_params[id] = strdup(strParams.string());
char *ret = fixed_set_params[id]; char* ret = fixed_set_params[id];
return ret; return ret;
} }
@ -175,49 +278,24 @@ static char *camera_fixup_setparams(int id, const char *settings)
* implementation of camera_device_ops functions * implementation of camera_device_ops functions
*******************************************************************/ *******************************************************************/
static int camera_set_preview_window(struct camera_device *device, static int camera_set_preview_window(struct camera_device* device,
struct preview_stream_ops *window) struct preview_stream_ops* window) {
{
if (!device)
return -EINVAL;
ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device,
(uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
if (!device) return -EINVAL;
return VENDOR_CALL(device, set_preview_window, window); return VENDOR_CALL(device, set_preview_window, window);
} }
void camera_notify_cb(int32_t msg_type, int32_t ext1, int32_t ext2, void *user) { static void camera_set_callbacks(struct camera_device* device, camera_notify_callback notify_cb,
gUserNotifyCb(msg_type, ext1, ext2, gUserCameraDevice); camera_data_callback data_cb,
} camera_data_timestamp_callback data_cb_timestamp,
camera_request_memory get_memory, void* user) {
void camera_data_cb(int32_t msg_type, const camera_memory_t *data, unsigned int index,
camera_frame_metadata_t *metadata, void *user) {
gUserDataCb(msg_type, data, index, metadata, gUserCameraDevice);
}
void camera_data_cb_timestamp(nsecs_t timestamp, int32_t msg_type,
const camera_memory_t *data, unsigned index, void *user) {
gUserDataCbTimestamp(timestamp, msg_type, data, index, gUserCameraDevice);
}
camera_memory_t* camera_get_memory(int fd, size_t buf_size,
uint_t num_bufs, void *user) {
return gUserGetMemory(fd, buf_size, num_bufs, gUserCameraDevice);
}
static void camera_set_callbacks(struct camera_device *device,
camera_notify_callback notify_cb,
camera_data_callback data_cb,
camera_data_timestamp_callback data_cb_timestamp,
camera_request_memory get_memory,
void *user)
{
if (!device)
return;
ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device,
(uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
if (!device) return;
gUserNotifyCb = notify_cb; gUserNotifyCb = notify_cb;
gUserDataCb = data_cb; gUserDataCb = data_cb;
@ -229,264 +307,226 @@ static void camera_set_callbacks(struct camera_device *device,
camera_data_cb_timestamp, camera_get_memory, user); camera_data_cb_timestamp, camera_get_memory, user);
} }
static void camera_enable_msg_type(struct camera_device *device, static void camera_enable_msg_type(struct camera_device* device, int32_t msg_type) {
int32_t msg_type)
{
if (!device)
return;
ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device,
(uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
if (!device) return;
VENDOR_CALL(device, enable_msg_type, msg_type); VENDOR_CALL(device, enable_msg_type, msg_type);
} }
static void camera_disable_msg_type(struct camera_device *device, static void camera_disable_msg_type(struct camera_device* device, int32_t msg_type) {
int32_t msg_type)
{
if (!device)
return;
ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device,
(uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
if (!device) return;
VENDOR_CALL(device, disable_msg_type, msg_type); VENDOR_CALL(device, disable_msg_type, msg_type);
} }
static int camera_msg_type_enabled(struct camera_device *device, static int camera_msg_type_enabled(struct camera_device* device, int32_t msg_type) {
int32_t msg_type)
{
if (!device)
return 0;
ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device,
(uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
if (!device) return 0;
return VENDOR_CALL(device, msg_type_enabled, msg_type); return VENDOR_CALL(device, msg_type_enabled, msg_type);
} }
static int camera_start_preview(struct camera_device *device) static int camera_start_preview(struct camera_device* device) {
{
if (!device)
return -EINVAL;
ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device,
(uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
if (!device) return -EINVAL;
return VENDOR_CALL(device, start_preview); return VENDOR_CALL(device, start_preview);
} }
static void camera_stop_preview(struct camera_device *device) static void camera_stop_preview(struct camera_device* device) {
{
if (!device)
return;
ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device,
(uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
if (!device) return;
VENDOR_CALL(device, stop_preview); VENDOR_CALL(device, stop_preview);
} }
static int camera_preview_enabled(struct camera_device *device) static int camera_preview_enabled(struct camera_device* device) {
{
if (!device)
return -EINVAL;
ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device,
(uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
if (!device) return -EINVAL;
return VENDOR_CALL(device, preview_enabled); return VENDOR_CALL(device, preview_enabled);
} }
static int camera_store_meta_data_in_buffers(struct camera_device *device, static int camera_store_meta_data_in_buffers(struct camera_device* device, int enable) {
int enable)
{
if (!device)
return -EINVAL;
ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device,
(uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
if (!device) return -EINVAL;
return VENDOR_CALL(device, store_meta_data_in_buffers, enable); return VENDOR_CALL(device, store_meta_data_in_buffers, enable);
} }
static int camera_start_recording(struct camera_device *device) static int camera_start_recording(struct camera_device* device) {
{
if (!device)
return EINVAL;
ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device,
(uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
if (!device) return EINVAL;
return VENDOR_CALL(device, start_recording); return VENDOR_CALL(device, start_recording);
} }
static void camera_stop_recording(struct camera_device *device) static void camera_stop_recording(struct camera_device* device) {
{
if (!device)
return;
ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device,
(uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
if (!device) return;
VENDOR_CALL(device, stop_recording); VENDOR_CALL(device, stop_recording);
} }
static int camera_recording_enabled(struct camera_device *device) static int camera_recording_enabled(struct camera_device* device) {
{
if (!device)
return -EINVAL;
ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device,
(uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
if (!device) return -EINVAL;
return VENDOR_CALL(device, recording_enabled); return VENDOR_CALL(device, recording_enabled);
} }
static void camera_release_recording_frame(struct camera_device *device, static void camera_release_recording_frame(struct camera_device* device, const void* opaque) {
const void *opaque)
{
if (!device)
return;
ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device,
(uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
if (!device) return;
VENDOR_CALL(device, release_recording_frame, opaque); VENDOR_CALL(device, release_recording_frame, opaque);
} }
static int camera_auto_focus(struct camera_device *device) static int camera_auto_focus(struct camera_device* device) {
{
if (!device)
return -EINVAL;
ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device,
(uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
if (!device) return -EINVAL;
return VENDOR_CALL(device, auto_focus); return VENDOR_CALL(device, auto_focus);
} }
static int camera_cancel_auto_focus(struct camera_device *device) static int camera_cancel_auto_focus(struct camera_device* device) {
{ int ret = 0;
if (!device)
return -EINVAL;
ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device,
(uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
return VENDOR_CALL(device, cancel_auto_focus); if (!device) return -EINVAL;
/* APEXQ/EXPRESS: Calling cancel_auto_focus causes the camera to crash for unknown reasons.
* Disabling it has no adverse effect. For others, only call cancel_auto_focus when the
* preview is enabled. This is needed so some 3rd party camera apps don't lock up. */
#ifndef DISABLE_AUTOFOCUS
if (camera_preview_enabled(device)) ret = VENDOR_CALL(device, cancel_auto_focus);
#endif
return ret;
} }
static int camera_take_picture(struct camera_device *device) static int camera_take_picture(struct camera_device* device) {
{
if (!device)
return -EINVAL;
ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device,
(uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
if (!device) return -EINVAL;
return VENDOR_CALL(device, take_picture); return VENDOR_CALL(device, take_picture);
} }
static int camera_cancel_picture(struct camera_device *device) static int camera_cancel_picture(struct camera_device* device) {
{
if (!device)
return -EINVAL;
ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device,
(uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
if (!device) return -EINVAL;
return VENDOR_CALL(device, cancel_picture); return VENDOR_CALL(device, cancel_picture);
} }
static int camera_set_parameters(struct camera_device *device, static int camera_set_parameters(struct camera_device* device, const char* params) {
const char *params)
{
if (!device)
return -EINVAL;
ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device,
(uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
char *tmp = NULL; if (!device) return -EINVAL;
tmp = camera_fixup_setparams(CAMERA_ID(device), params);
char* tmp = NULL;
tmp = camera_fixup_setparams(device, params);
int ret = VENDOR_CALL(device, set_parameters, tmp); int ret = VENDOR_CALL(device, set_parameters, tmp);
return ret; return ret;
} }
static char *camera_get_parameters(struct camera_device *device) static char* camera_get_parameters(struct camera_device* device) {
{
if (!device)
return NULL;
ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device,
(uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
char *params = VENDOR_CALL(device, get_parameters); if (!device) return NULL;
char *tmp = camera_fixup_getparams(CAMERA_ID(device), params); char* params = VENDOR_CALL(device, get_parameters);
char* tmp = camera_fixup_getparams(CAMERA_ID(device), params);
VENDOR_CALL(device, put_parameters, params); VENDOR_CALL(device, put_parameters, params);
params = tmp; params = tmp;
return params; return params;
} }
static void camera_put_parameters(struct camera_device *device, char *params) static void camera_put_parameters(struct camera_device* device, char* params) {
{ ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device,
if (params) (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
free(params);
if (params) free(params);
} }
static int camera_send_command(struct camera_device *device, static int camera_send_command(struct camera_device* device, int32_t cmd, int32_t arg1,
int32_t cmd, int32_t arg1, int32_t arg2) int32_t arg2) {
{
if (!device)
return -EINVAL;
ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device,
(uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
if (!device) return -EINVAL;
return VENDOR_CALL(device, send_command, cmd, arg1, arg2); return VENDOR_CALL(device, send_command, cmd, arg1, arg2);
} }
static void camera_release(struct camera_device *device) static void camera_release(struct camera_device* device) {
{
wrapper_camera_device_t* wrapper_dev = NULL; wrapper_camera_device_t* wrapper_dev = NULL;
if (!device)
return;
wrapper_dev = (wrapper_camera_device_t*) device;
ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device,
(uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); (uintptr_t)(wrapper_dev->vendor));
if (!device) return;
VENDOR_CALL(device, release); VENDOR_CALL(device, release);
wrapper_dev->camera_released = true; wrapper_dev->camera_released = true;
} }
static int camera_dump(struct camera_device *device, int fd) static int camera_dump(struct camera_device* device, int fd) {
{
if (!device)
return -EINVAL;
ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device,
(uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
if (!device) return -EINVAL;
return VENDOR_CALL(device, dump, fd); return VENDOR_CALL(device, dump, fd);
} }
extern "C" void heaptracker_free_leaked_memory(void); extern "C" void heaptracker_free_leaked_memory(void);
static int camera_device_close(hw_device_t *device) static int camera_device_close(hw_device_t* device) {
{
int ret = 0; int ret = 0;
wrapper_camera_device_t *wrapper_dev = NULL; wrapper_camera_device_t* wrapper_dev = NULL;
ALOGV("%s", __FUNCTION__); ALOGV("%s", __FUNCTION__);
Mutex::Autolock lock(gCameraWrapperLock); android::Mutex::Autolock lock(gCameraWrapperLock);
if (!device) { if (!device) {
ret = -EINVAL; ret = -EINVAL;
@ -494,11 +534,10 @@ static int camera_device_close(hw_device_t *device)
} }
for (int i = 0; i < camera_get_number_of_cameras(); i++) { for (int i = 0; i < camera_get_number_of_cameras(); i++) {
if (fixed_set_params[i]) if (fixed_set_params[i]) free(fixed_set_params[i]);
free(fixed_set_params[i]);
} }
wrapper_dev = (wrapper_camera_device_t*) device; wrapper_dev = (wrapper_camera_device_t*)device;
if (!wrapper_dev->camera_released) { if (!wrapper_dev->camera_released) {
ALOGI("%s: releasing camera device with id %d", __FUNCTION__, ALOGI("%s: releasing camera device with id %d", __FUNCTION__,
@ -510,8 +549,7 @@ static int camera_device_close(hw_device_t *device)
} }
wrapper_dev->vendor->common.close((hw_device_t*)wrapper_dev->vendor); wrapper_dev->vendor->common.close((hw_device_t*)wrapper_dev->vendor);
if (wrapper_dev->base.ops) if (wrapper_dev->base.ops) free(wrapper_dev->base.ops);
free(wrapper_dev->base.ops);
free(wrapper_dev); free(wrapper_dev);
done: done:
#ifdef HEAPTRACKER #ifdef HEAPTRACKER
@ -530,38 +568,37 @@ done:
* so this function will always only be called once per camera instance * so this function will always only be called once per camera instance
*/ */
static int camera_device_open(const hw_module_t *module, const char *name, static int camera_device_open(const hw_module_t* module, const char* name, hw_device_t** device) {
hw_device_t **device)
{
int rv = 0; int rv = 0;
int num_cameras = 0; int num_cameras = 0;
int cameraid; int cameraid;
wrapper_camera_device_t *camera_device = NULL; wrapper_camera_device_t* camera_device = NULL;
camera_device_ops_t *camera_ops = NULL; camera_device_ops_t* camera_ops = NULL;
wasVideo = false;
Mutex::Autolock lock(gCameraWrapperLock); android::Mutex::Autolock lock(gCameraWrapperLock);
ALOGV("%s", __FUNCTION__); ALOGV("%s", __FUNCTION__);
if (name != NULL) { if (name != NULL) {
if (check_vendor_module()) if (check_vendor_module()) return -EINVAL;
return -EINVAL;
cameraid = atoi(name); cameraid = atoi(name);
num_cameras = gVendorModule->get_number_of_cameras(); num_cameras = gVendorModule->get_number_of_cameras();
fixed_set_params = (char **) malloc(sizeof(char *) * num_cameras); fixed_set_params = (char**)malloc(sizeof(char*) * num_cameras);
if (!fixed_set_params) { if (!fixed_set_params) {
ALOGE("parameter memory allocation fail"); ALOGE("parameter memory allocation fail");
rv = -ENOMEM; rv = -ENOMEM;
goto fail; goto fail;
} }
memset(fixed_set_params, 0, sizeof(char *) * num_cameras); memset(fixed_set_params, 0, sizeof(char*) * num_cameras);
if (cameraid > num_cameras) { if (cameraid > num_cameras) {
ALOGE("camera service provided cameraid out of bounds, " ALOGE(
"cameraid = %d, num supported = %d", "camera service provided cameraid out of bounds, "
cameraid, num_cameras); "cameraid = %d, num supported = %d",
cameraid, num_cameras);
rv = -EINVAL; rv = -EINVAL;
goto fail; goto fail;
} }
@ -576,15 +613,14 @@ static int camera_device_open(const hw_module_t *module, const char *name,
camera_device->camera_released = false; camera_device->camera_released = false;
camera_device->id = cameraid; camera_device->id = cameraid;
rv = gVendorModule->common.methods->open( rv = gVendorModule->common.methods->open((const hw_module_t*)gVendorModule, name,
(const hw_module_t*)gVendorModule, name, (hw_device_t**)&(camera_device->vendor));
(hw_device_t**)&(camera_device->vendor));
if (rv) { if (rv) {
ALOGE("vendor camera open fail"); ALOGE("vendor camera open fail");
goto fail; goto fail;
} }
ALOGV("%s: got vendor camera device 0x%08X", ALOGV("%s: got vendor camera device 0x%08X", __FUNCTION__,
__FUNCTION__, (uintptr_t)(camera_device->vendor)); (uintptr_t)(camera_device->vendor));
camera_ops = (camera_device_ops_t*)malloc(sizeof(*camera_ops)); camera_ops = (camera_device_ops_t*)malloc(sizeof(*camera_ops));
if (!camera_ops) { if (!camera_ops) {
@ -596,8 +632,8 @@ static int camera_device_open(const hw_module_t *module, const char *name,
memset(camera_ops, 0, sizeof(*camera_ops)); memset(camera_ops, 0, sizeof(*camera_ops));
camera_device->base.common.tag = HARDWARE_DEVICE_TAG; camera_device->base.common.tag = HARDWARE_DEVICE_TAG;
camera_device->base.common.version = CAMERA_MODULE_API_VERSION_1_0; camera_device->base.common.version = HARDWARE_DEVICE_API_VERSION(1, 0);
camera_device->base.common.module = (hw_module_t *)(module); camera_device->base.common.module = (hw_module_t*)(module);
camera_device->base.common.close = camera_device_close; camera_device->base.common.close = camera_device_close;
camera_device->base.ops = camera_ops; camera_device->base.ops = camera_ops;
@ -643,26 +679,14 @@ fail:
return rv; return rv;
} }
static int camera_get_number_of_cameras(void) static int camera_get_number_of_cameras(void) {
{
ALOGV("%s", __FUNCTION__); ALOGV("%s", __FUNCTION__);
if (check_vendor_module()) if (check_vendor_module()) return 0;
return 0;
return gVendorModule->get_number_of_cameras(); return gVendorModule->get_number_of_cameras();
} }
static int camera_get_camera_info(int camera_id, struct camera_info *info) static int camera_get_camera_info(int camera_id, struct camera_info* info) {
{
ALOGV("%s", __FUNCTION__); ALOGV("%s", __FUNCTION__);
if (check_vendor_module()) if (check_vendor_module()) return 0;
return 0;
return gVendorModule->get_camera_info(camera_id, info); return gVendorModule->get_camera_info(camera_id, info);
} }
static int camera_set_torch_mode(const char* camera_id, bool enabled)
{
ALOGV("%s", __FUNCTION__);
if (check_vendor_module())
return 0;
return gVendorModule->set_torch_mode(camera_id, enabled);
}

View file

@ -1,19 +0,0 @@
/*
* Copyright (C) 2018, The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <hardware/camera.h>
static int camera_set_torch_mode(const char* camera_id, bool enabled);

View file

@ -1,94 +0,0 @@
/*
* Copyright (C) 2014 The CyanogenMod Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.lineageos.hardware;
import org.lineageos.internal.util.FileUtils;
/*
* Display RGB intensity calibration (kcal)
*
* Exports methods to get the valid value boundaries, the
* current color values, and a method to set new ones.
*
* Values exported by min/max can be the direct values required
* by the hardware, or a local (to DisplayColorCalibration) abstraction
* that's internally converted to something else prior to actual use. The
* Settings user interface will normalize these into a 0-100 (percentage)
* scale before showing them to the user, but all values passed to/from
* the client (Settings) are in this class' scale.
*/
public class DisplayColorCalibration {
private static final String COLOR_FILE = "/sys/class/graphics/fb0/kcal";
/*
* All HAF classes should export this boolean.
* Real implementations must, of course, return true
*/
public static boolean isSupported() {
return FileUtils.isFileWritable(COLOR_FILE);
}
/*
* What's the maximum integer value we take for a color
*/
public static int getMaxValue() {
return 255;
}
/*
* What's the minimum integer value we take for a color
*/
public static int getMinValue() {
return 0;
}
/*
* What's the default integer value we take for a color
*/
public static int getDefValue() {
return getMaxValue();
}
/*
* What's the current RGB triplet?
* This should return a space-separated set of integers in
* a string, same format as the input to setColors()
*/
public static String getCurColors() {
return FileUtils.readOneLine(COLOR_FILE);
}
/*
* Set the RGB values to the given input triplet. Input is
* expected to consist of 3 values, space-separated, each to
* be a value between the boundaries set by get(Max|Min)Value
* (see below), and it's meant to be locally interpreted/used.
*/
public static boolean setColors(String colors) {
if (!FileUtils.writeLine(COLOR_FILE, colors)) {
return false;
}
return true;
}
}

View file

@ -118,5 +118,4 @@
</MediaCodec> </MediaCodec>
</Decoders> </Decoders>
<Include href="media_codecs_google_video.xml" /> <Include href="media_codecs_google_video.xml" />
<Include href="media_codecs_ffmpeg.xml" />
</MediaCodecs> </MediaCodecs>

View file

@ -0,0 +1,818 @@
/*
* Copyright (C) 2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_CAMERA_PARAMETERS_H
#define ANDROID_HARDWARE_CAMERA_PARAMETERS_H
#include <utils/KeyedVector.h>
#include <utils/String8.h>
namespace android {
struct Size {
int width;
int height;
Size() {
width = 0;
height = 0;
}
Size(int w, int h) {
width = w;
height = h;
}
};
class CameraParameters
{
public:
CameraParameters();
CameraParameters(const String8 &params) { unflatten(params); }
~CameraParameters();
String8 flatten() const;
void unflatten(const String8 &params);
void set(const char *key, const char *value);
void set(const char *key, int value);
void setFloat(const char *key, float value);
const char *get(const char *key) const;
int getInt(const char *key) const;
float getFloat(const char *key) const;
void remove(const char *key);
void setPreviewSize(int width, int height);
void getPreviewSize(int *width, int *height) const;
void getSupportedPreviewSizes(Vector<Size> &sizes) const;
// Set the dimensions in pixels to the given width and height
// for video frames. The given width and height must be one
// of the supported dimensions returned from
// getSupportedVideoSizes(). Must not be called if
// getSupportedVideoSizes() returns an empty Vector of Size.
void setVideoSize(int width, int height);
// Retrieve the current dimensions (width and height)
// in pixels for video frames, which must be one of the
// supported dimensions returned from getSupportedVideoSizes().
// Must not be called if getSupportedVideoSizes() returns an
// empty Vector of Size.
void getVideoSize(int *width, int *height) const;
// Retrieve a Vector of supported dimensions (width and height)
// in pixels for video frames. If sizes returned from the method
// is empty, the camera does not support calls to setVideoSize()
// or getVideoSize(). In adddition, it also indicates that
// the camera only has a single output, and does not have
// separate output for video frames and preview frame.
void getSupportedVideoSizes(Vector<Size> &sizes) const;
// Retrieve the preferred preview size (width and height) in pixels
// for video recording. The given width and height must be one of
// supported preview sizes returned from getSupportedPreviewSizes().
// Must not be called if getSupportedVideoSizes() returns an empty
// Vector of Size. If getSupportedVideoSizes() returns an empty
// Vector of Size, the width and height returned from this method
// is invalid, and is "-1x-1".
void getPreferredPreviewSizeForVideo(int *width, int *height) const;
void setPreviewFrameRate(int fps);
int getPreviewFrameRate() const;
void getPreviewFpsRange(int *min_fps, int *max_fps) const;
void setPreviewFormat(const char *format);
const char *getPreviewFormat() const;
void setPictureSize(int width, int height);
void getPictureSize(int *width, int *height) const;
void getSupportedPictureSizes(Vector<Size> &sizes) const;
void setPictureFormat(const char *format);
const char *getPictureFormat() const;
void dump() const;
status_t dump(int fd, const Vector<String16>& args) const;
/**
* Returns a Vector containing the supported preview formats
* as enums given in graphics.h.
*/
void getSupportedPreviewFormats(Vector<int>& formats) const;
// Returns true if no keys are present
bool isEmpty() const;
// Parameter keys to communicate between camera application and driver.
// The access (read/write, read only, or write only) is viewed from the
// perspective of applications, not driver.
// Preview frame size in pixels (width x height).
// Example value: "480x320". Read/Write.
static const char KEY_PREVIEW_SIZE[];
// Supported preview frame sizes in pixels.
// Example value: "800x600,480x320". Read only.
static const char KEY_SUPPORTED_PREVIEW_SIZES[];
// The current minimum and maximum preview fps. This controls the rate of
// preview frames received (CAMERA_MSG_PREVIEW_FRAME). The minimum and
// maximum fps must be one of the elements from
// KEY_SUPPORTED_PREVIEW_FPS_RANGE parameter.
// Example value: "10500,26623"
static const char KEY_PREVIEW_FPS_RANGE[];
// The supported preview fps (frame-per-second) ranges. Each range contains
// a minimum fps and maximum fps. If minimum fps equals to maximum fps, the
// camera outputs frames in fixed frame rate. If not, the camera outputs
// frames in auto frame rate. The actual frame rate fluctuates between the
// minimum and the maximum. The list has at least one element. The list is
// sorted from small to large (first by maximum fps and then minimum fps).
// Example value: "(10500,26623),(15000,26623),(30000,30000)"
static const char KEY_SUPPORTED_PREVIEW_FPS_RANGE[];
// The image format for preview frames. See CAMERA_MSG_PREVIEW_FRAME in
// frameworks/av/include/camera/Camera.h. The default is
// PIXEL_FORMAT_YUV420SP. Example value: "yuv420sp" or PIXEL_FORMAT_XXX
// constants. Read/write.
static const char KEY_PREVIEW_FORMAT[];
// Supported image formats for preview frames.
// Example value: "yuv420sp,yuv422i-yuyv". Read only.
static const char KEY_SUPPORTED_PREVIEW_FORMATS[];
// Number of preview frames per second. This is the target frame rate. The
// actual frame rate depends on the driver.
// Example value: "15". Read/write.
static const char KEY_PREVIEW_FRAME_RATE[];
// Supported number of preview frames per second.
// Example value: "24,15,10". Read.
static const char KEY_SUPPORTED_PREVIEW_FRAME_RATES[];
// The dimensions for captured pictures in pixels (width x height).
// Example value: "1024x768". Read/write.
static const char KEY_PICTURE_SIZE[];
// Supported dimensions for captured pictures in pixels.
// Example value: "2048x1536,1024x768". Read only.
static const char KEY_SUPPORTED_PICTURE_SIZES[];
// The image format for captured pictures. See CAMERA_MSG_COMPRESSED_IMAGE
// in frameworks/base/include/camera/Camera.h.
// Example value: "jpeg" or PIXEL_FORMAT_XXX constants. Read/write.
static const char KEY_PICTURE_FORMAT[];
// Supported image formats for captured pictures.
// Example value: "jpeg,rgb565". Read only.
static const char KEY_SUPPORTED_PICTURE_FORMATS[];
// The width (in pixels) of EXIF thumbnail in Jpeg picture.
// Example value: "512". Read/write.
static const char KEY_JPEG_THUMBNAIL_WIDTH[];
// The height (in pixels) of EXIF thumbnail in Jpeg picture.
// Example value: "384". Read/write.
static const char KEY_JPEG_THUMBNAIL_HEIGHT[];
// Supported EXIF thumbnail sizes (width x height). 0x0 means not thumbnail
// in EXIF.
// Example value: "512x384,320x240,0x0". Read only.
static const char KEY_SUPPORTED_JPEG_THUMBNAIL_SIZES[];
// The quality of the EXIF thumbnail in Jpeg picture. The range is 1 to 100,
// with 100 being the best.
// Example value: "90". Read/write.
static const char KEY_JPEG_THUMBNAIL_QUALITY[];
// Jpeg quality of captured picture. The range is 1 to 100, with 100 being
// the best.
// Example value: "90". Read/write.
static const char KEY_JPEG_QUALITY[];
// The rotation angle in degrees relative to the orientation of the camera.
// This affects the pictures returned from CAMERA_MSG_COMPRESSED_IMAGE. The
// camera driver may set orientation in the EXIF header without rotating the
// picture. Or the driver may rotate the picture and the EXIF thumbnail. If
// the Jpeg picture is rotated, the orientation in the EXIF header will be
// missing or 1 (row #0 is top and column #0 is left side).
//
// Note that the JPEG pictures of front-facing cameras are not mirrored
// as in preview display.
//
// For example, suppose the natural orientation of the device is portrait.
// The device is rotated 270 degrees clockwise, so the device orientation is
// 270. Suppose a back-facing camera sensor is mounted in landscape and the
// top side of the camera sensor is aligned with the right edge of the
// display in natural orientation. So the camera orientation is 90. The
// rotation should be set to 0 (270 + 90).
//
// Example value: "0" or "90" or "180" or "270". Write only.
static const char KEY_ROTATION[];
// GPS latitude coordinate. GPSLatitude and GPSLatitudeRef will be stored in
// JPEG EXIF header.
// Example value: "25.032146" or "-33.462809". Write only.
static const char KEY_GPS_LATITUDE[];
// GPS longitude coordinate. GPSLongitude and GPSLongitudeRef will be stored
// in JPEG EXIF header.
// Example value: "121.564448" or "-70.660286". Write only.
static const char KEY_GPS_LONGITUDE[];
// GPS altitude. GPSAltitude and GPSAltitudeRef will be stored in JPEG EXIF
// header.
// Example value: "21.0" or "-5". Write only.
static const char KEY_GPS_ALTITUDE[];
// GPS timestamp (UTC in seconds since January 1, 1970). This should be
// stored in JPEG EXIF header.
// Example value: "1251192757". Write only.
static const char KEY_GPS_TIMESTAMP[];
// GPS Processing Method
// Example value: "GPS" or "NETWORK". Write only.
static const char KEY_GPS_PROCESSING_METHOD[];
// Current white balance setting.
// Example value: "auto" or WHITE_BALANCE_XXX constants. Read/write.
static const char KEY_WHITE_BALANCE[];
// Supported white balance settings.
// Example value: "auto,incandescent,daylight". Read only.
static const char KEY_SUPPORTED_WHITE_BALANCE[];
// Current color effect setting.
// Example value: "none" or EFFECT_XXX constants. Read/write.
static const char KEY_EFFECT[];
// Supported color effect settings.
// Example value: "none,mono,sepia". Read only.
static const char KEY_SUPPORTED_EFFECTS[];
// Current antibanding setting.
// Example value: "auto" or ANTIBANDING_XXX constants. Read/write.
static const char KEY_ANTIBANDING[];
// Supported antibanding settings.
// Example value: "auto,50hz,60hz,off". Read only.
static const char KEY_SUPPORTED_ANTIBANDING[];
// Current scene mode.
// Example value: "auto" or SCENE_MODE_XXX constants. Read/write.
static const char KEY_SCENE_MODE[];
// Supported scene mode settings.
// Example value: "auto,night,fireworks". Read only.
static const char KEY_SUPPORTED_SCENE_MODES[];
// Current flash mode.
// Example value: "auto" or FLASH_MODE_XXX constants. Read/write.
static const char KEY_FLASH_MODE[];
// Supported flash modes.
// Example value: "auto,on,off". Read only.
static const char KEY_SUPPORTED_FLASH_MODES[];
// Current focus mode. This will not be empty. Applications should call
// CameraHardwareInterface.autoFocus to start the focus if focus mode is
// FOCUS_MODE_AUTO or FOCUS_MODE_MACRO.
// Example value: "auto" or FOCUS_MODE_XXX constants. Read/write.
static const char KEY_FOCUS_MODE[];
// Supported focus modes.
// Example value: "auto,macro,fixed". Read only.
static const char KEY_SUPPORTED_FOCUS_MODES[];
// The maximum number of focus areas supported. This is the maximum length
// of KEY_FOCUS_AREAS.
// Example value: "0" or "2". Read only.
static const char KEY_MAX_NUM_FOCUS_AREAS[];
// Current focus areas.
//
// Before accessing this parameter, apps should check
// KEY_MAX_NUM_FOCUS_AREAS first to know the maximum number of focus areas
// first. If the value is 0, focus area is not supported.
//
// Each focus area is a five-element int array. The first four elements are
// the rectangle of the area (left, top, right, bottom). The direction is
// relative to the sensor orientation, that is, what the sensor sees. The
// direction is not affected by the rotation or mirroring of
// CAMERA_CMD_SET_DISPLAY_ORIENTATION. Coordinates range from -1000 to 1000.
// (-1000,-1000) is the upper left point. (1000, 1000) is the lower right
// point. The width and height of focus areas cannot be 0 or negative.
//
// The fifth element is the weight. Values for weight must range from 1 to
// 1000. The weight should be interpreted as a per-pixel weight - all
// pixels in the area have the specified weight. This means a small area
// with the same weight as a larger area will have less influence on the
// focusing than the larger area. Focus areas can partially overlap and the
// driver will add the weights in the overlap region.
//
// A special case of single focus area (0,0,0,0,0) means driver to decide
// the focus area. For example, the driver may use more signals to decide
// focus areas and change them dynamically. Apps can set (0,0,0,0,0) if they
// want the driver to decide focus areas.
//
// Focus areas are relative to the current field of view (KEY_ZOOM). No
// matter what the zoom level is, (-1000,-1000) represents the top of the
// currently visible camera frame. The focus area cannot be set to be
// outside the current field of view, even when using zoom.
//
// Focus area only has effect if the current focus mode is FOCUS_MODE_AUTO,
// FOCUS_MODE_MACRO, FOCUS_MODE_CONTINUOUS_VIDEO, or
// FOCUS_MODE_CONTINUOUS_PICTURE.
// Example value: "(-10,-10,0,0,300),(0,0,10,10,700)". Read/write.
static const char KEY_FOCUS_AREAS[];
// Focal length in millimeter.
// Example value: "4.31". Read only.
static const char KEY_FOCAL_LENGTH[];
// Horizontal angle of view in degrees.
// Example value: "54.8". Read only.
static const char KEY_HORIZONTAL_VIEW_ANGLE[];
// Vertical angle of view in degrees.
// Example value: "42.5". Read only.
static const char KEY_VERTICAL_VIEW_ANGLE[];
// Exposure compensation index. 0 means exposure is not adjusted.
// Example value: "-5" or "5". Read/write.
static const char KEY_EXPOSURE_COMPENSATION[];
// The maximum exposure compensation index (>=0).
// Example value: "6". Read only.
static const char KEY_MAX_EXPOSURE_COMPENSATION[];
// The minimum exposure compensation index (<=0).
// Example value: "-6". Read only.
static const char KEY_MIN_EXPOSURE_COMPENSATION[];
// The exposure compensation step. Exposure compensation index multiply by
// step eqals to EV. Ex: if exposure compensation index is -6 and step is
// 0.3333, EV is -2.
// Example value: "0.333333333" or "0.5". Read only.
static const char KEY_EXPOSURE_COMPENSATION_STEP[];
// The state of the auto-exposure lock. "true" means that
// auto-exposure is locked to its current value and will not
// change. "false" means the auto-exposure routine is free to
// change exposure values. If auto-exposure is already locked,
// setting this to true again has no effect (the driver will not
// recalculate exposure values). Changing exposure compensation
// settings will still affect the exposure settings while
// auto-exposure is locked. Stopping preview or taking a still
// image will not change the lock. In conjunction with
// exposure compensation, this allows for capturing multi-exposure
// brackets with known relative exposure values. Locking
// auto-exposure after open but before the first call to
// startPreview may result in severely over- or under-exposed
// images. The driver will not change the AE lock after
// auto-focus completes.
static const char KEY_AUTO_EXPOSURE_LOCK[];
// Whether locking the auto-exposure is supported. "true" means it is, and
// "false" or this key not existing means it is not supported.
static const char KEY_AUTO_EXPOSURE_LOCK_SUPPORTED[];
// The state of the auto-white balance lock. "true" means that
// auto-white balance is locked to its current value and will not
// change. "false" means the auto-white balance routine is free to
// change white balance values. If auto-white balance is already
// locked, setting this to true again has no effect (the driver
// will not recalculate white balance values). Stopping preview or
// taking a still image will not change the lock. In conjunction
// with exposure compensation, this allows for capturing
// multi-exposure brackets with fixed white balance. Locking
// auto-white balance after open but before the first call to
// startPreview may result in severely incorrect color. The
// driver will not change the AWB lock after auto-focus
// completes.
static const char KEY_AUTO_WHITEBALANCE_LOCK[];
// Whether locking the auto-white balance is supported. "true"
// means it is, and "false" or this key not existing means it is
// not supported.
static const char KEY_AUTO_WHITEBALANCE_LOCK_SUPPORTED[];
// The maximum number of metering areas supported. This is the maximum
// length of KEY_METERING_AREAS.
// Example value: "0" or "2". Read only.
static const char KEY_MAX_NUM_METERING_AREAS[];
// Current metering areas. Camera driver uses these areas to decide
// exposure.
//
// Before accessing this parameter, apps should check
// KEY_MAX_NUM_METERING_AREAS first to know the maximum number of metering
// areas first. If the value is 0, metering area is not supported.
//
// Each metering area is a rectangle with specified weight. The direction is
// relative to the sensor orientation, that is, what the sensor sees. The
// direction is not affected by the rotation or mirroring of
// CAMERA_CMD_SET_DISPLAY_ORIENTATION. Coordinates of the rectangle range
// from -1000 to 1000. (-1000, -1000) is the upper left point. (1000, 1000)
// is the lower right point. The width and height of metering areas cannot
// be 0 or negative.
//
// The fifth element is the weight. Values for weight must range from 1 to
// 1000. The weight should be interpreted as a per-pixel weight - all
// pixels in the area have the specified weight. This means a small area
// with the same weight as a larger area will have less influence on the
// metering than the larger area. Metering areas can partially overlap and
// the driver will add the weights in the overlap region.
//
// A special case of all-zero single metering area means driver to decide
// the metering area. For example, the driver may use more signals to decide
// metering areas and change them dynamically. Apps can set all-zero if they
// want the driver to decide metering areas.
//
// Metering areas are relative to the current field of view (KEY_ZOOM).
// No matter what the zoom level is, (-1000,-1000) represents the top of the
// currently visible camera frame. The metering area cannot be set to be
// outside the current field of view, even when using zoom.
//
// No matter what metering areas are, the final exposure are compensated
// by KEY_EXPOSURE_COMPENSATION.
// Example value: "(-10,-10,0,0,300),(0,0,10,10,700)". Read/write.
static const char KEY_METERING_AREAS[];
// Current zoom value.
// Example value: "0" or "6". Read/write.
static const char KEY_ZOOM[];
// Maximum zoom value.
// Example value: "6". Read only.
static const char KEY_MAX_ZOOM[];
// The zoom ratios of all zoom values. The zoom ratio is in 1/100
// increments. Ex: a zoom of 3.2x is returned as 320. The number of list
// elements is KEY_MAX_ZOOM + 1. The first element is always 100. The last
// element is the zoom ratio of zoom value KEY_MAX_ZOOM.
// Example value: "100,150,200,250,300,350,400". Read only.
static const char KEY_ZOOM_RATIOS[];
// Whether zoom is supported. Zoom is supported if the value is "true". Zoom
// is not supported if the value is not "true" or the key does not exist.
// Example value: "true". Read only.
static const char KEY_ZOOM_SUPPORTED[];
// Whether if smooth zoom is supported. Smooth zoom is supported if the
// value is "true". It is not supported if the value is not "true" or the
// key does not exist.
// See CAMERA_CMD_START_SMOOTH_ZOOM, CAMERA_CMD_STOP_SMOOTH_ZOOM, and
// CAMERA_MSG_ZOOM in frameworks/base/include/camera/Camera.h.
// Example value: "true". Read only.
static const char KEY_SMOOTH_ZOOM_SUPPORTED[];
// The distances (in meters) from the camera to where an object appears to
// be in focus. The object is sharpest at the optimal focus distance. The
// depth of field is the far focus distance minus near focus distance.
//
// Focus distances may change after starting auto focus, canceling auto
// focus, or starting the preview. Applications can read this anytime to get
// the latest focus distances. If the focus mode is FOCUS_MODE_CONTINUOUS,
// focus distances may change from time to time.
//
// This is intended to estimate the distance between the camera and the
// subject. After autofocus, the subject distance may be within near and far
// focus distance. However, the precision depends on the camera hardware,
// autofocus algorithm, the focus area, and the scene. The error can be
// large and it should be only used as a reference.
//
// Far focus distance > optimal focus distance > near focus distance. If
// the far focus distance is infinity, the value should be "Infinity" (case
// sensitive). The format is three float values separated by commas. The
// first is near focus distance. The second is optimal focus distance. The
// third is far focus distance.
// Example value: "0.95,1.9,Infinity" or "0.049,0.05,0.051". Read only.
static const char KEY_FOCUS_DISTANCES[];
// The current dimensions in pixels (width x height) for video frames.
// The width and height must be one of the supported sizes retrieved
// via KEY_SUPPORTED_VIDEO_SIZES.
// Example value: "1280x720". Read/write.
static const char KEY_VIDEO_SIZE[];
// A list of the supported dimensions in pixels (width x height)
// for video frames. See CAMERA_MSG_VIDEO_FRAME for details in
// frameworks/base/include/camera/Camera.h.
// Example: "176x144,1280x720". Read only.
static const char KEY_SUPPORTED_VIDEO_SIZES[];
// The maximum number of detected faces supported by hardware face
// detection. If the value is 0, hardware face detection is not supported.
// Example: "5". Read only
static const char KEY_MAX_NUM_DETECTED_FACES_HW[];
// The maximum number of detected faces supported by software face
// detection. If the value is 0, software face detection is not supported.
// Example: "5". Read only
static const char KEY_MAX_NUM_DETECTED_FACES_SW[];
// Preferred preview frame size in pixels for video recording.
// The width and height must be one of the supported sizes retrieved
// via KEY_SUPPORTED_PREVIEW_SIZES. This key can be used only when
// getSupportedVideoSizes() does not return an empty Vector of Size.
// Camcorder applications are recommended to set the preview size
// to a value that is not larger than the preferred preview size.
// In other words, the product of the width and height of the
// preview size should not be larger than that of the preferred
// preview size. In addition, we recommend to choos a preview size
// that has the same aspect ratio as the resolution of video to be
// recorded.
// Example value: "800x600". Read only.
static const char KEY_PREFERRED_PREVIEW_SIZE_FOR_VIDEO[];
// The image format for video frames. See CAMERA_MSG_VIDEO_FRAME in
// frameworks/base/include/camera/Camera.h.
// Example value: "yuv420sp" or PIXEL_FORMAT_XXX constants. Read only.
static const char KEY_VIDEO_FRAME_FORMAT[];
// Sets the hint of the recording mode. If this is true, MediaRecorder.start
// may be faster or has less glitches. This should be called before starting
// the preview for the best result. But it is allowed to change the hint
// while the preview is active. The default value is false.
//
// The apps can still call Camera.takePicture when the hint is true. The
// apps can call MediaRecorder.start when the hint is false. But the
// performance may be worse.
// Example value: "true" or "false". Read/write.
static const char KEY_RECORDING_HINT[];
// Returns true if video snapshot is supported. That is, applications
// can call Camera.takePicture during recording. Applications do not need to
// call Camera.startPreview after taking a picture. The preview will be
// still active. Other than that, taking a picture during recording is
// identical to taking a picture normally. All settings and methods related
// to takePicture work identically. Ex: KEY_PICTURE_SIZE,
// KEY_SUPPORTED_PICTURE_SIZES, KEY_JPEG_QUALITY, KEY_ROTATION, and etc.
// The picture will have an EXIF header. FLASH_MODE_AUTO and FLASH_MODE_ON
// also still work, but the video will record the flash.
//
// Applications can set shutter callback as null to avoid the shutter
// sound. It is also recommended to set raw picture and post view callbacks
// to null to avoid the interrupt of preview display.
//
// Field-of-view of the recorded video may be different from that of the
// captured pictures.
// Example value: "true" or "false". Read only.
static const char KEY_VIDEO_SNAPSHOT_SUPPORTED[];
// The state of the video stabilization. If set to true, both the
// preview stream and the recorded video stream are stabilized by
// the camera. Only valid to set if KEY_VIDEO_STABILIZATION_SUPPORTED is
// set to true.
//
// The value of this key can be changed any time the camera is
// open. If preview or recording is active, it is acceptable for
// there to be a slight video glitch when video stabilization is
// toggled on and off.
//
// This only stabilizes video streams (between-frames stabilization), and
// has no effect on still image capture.
static const char KEY_VIDEO_STABILIZATION[];
// Returns true if video stabilization is supported. That is, applications
// can set KEY_VIDEO_STABILIZATION to true and have a stabilized preview
// stream and record stabilized videos.
static const char KEY_VIDEO_STABILIZATION_SUPPORTED[];
// Supported modes for special effects with light.
// Example values: "lowlight,hdr".
static const char KEY_LIGHTFX[];
// Value for KEY_ZOOM_SUPPORTED or KEY_SMOOTH_ZOOM_SUPPORTED.
static const char TRUE[];
static const char FALSE[];
// Value for KEY_FOCUS_DISTANCES.
static const char FOCUS_DISTANCE_INFINITY[];
// Values for white balance settings.
static const char WHITE_BALANCE_AUTO[];
static const char WHITE_BALANCE_INCANDESCENT[];
static const char WHITE_BALANCE_FLUORESCENT[];
static const char WHITE_BALANCE_WARM_FLUORESCENT[];
static const char WHITE_BALANCE_DAYLIGHT[];
static const char WHITE_BALANCE_CLOUDY_DAYLIGHT[];
static const char WHITE_BALANCE_TWILIGHT[];
static const char WHITE_BALANCE_SHADE[];
// Values for effect settings.
static const char EFFECT_NONE[];
static const char EFFECT_MONO[];
static const char EFFECT_NEGATIVE[];
static const char EFFECT_SOLARIZE[];
static const char EFFECT_SEPIA[];
static const char EFFECT_POSTERIZE[];
static const char EFFECT_WHITEBOARD[];
static const char EFFECT_BLACKBOARD[];
static const char EFFECT_AQUA[];
// Values for antibanding settings.
static const char ANTIBANDING_AUTO[];
static const char ANTIBANDING_50HZ[];
static const char ANTIBANDING_60HZ[];
static const char ANTIBANDING_OFF[];
// Values for flash mode settings.
// Flash will not be fired.
static const char FLASH_MODE_OFF[];
// Flash will be fired automatically when required. The flash may be fired
// during preview, auto-focus, or snapshot depending on the driver.
static const char FLASH_MODE_AUTO[];
// Flash will always be fired during snapshot. The flash may also be
// fired during preview or auto-focus depending on the driver.
static const char FLASH_MODE_ON[];
// Flash will be fired in red-eye reduction mode.
static const char FLASH_MODE_RED_EYE[];
// Constant emission of light during preview, auto-focus and snapshot.
// This can also be used for video recording.
static const char FLASH_MODE_TORCH[];
// Values for scene mode settings.
static const char SCENE_MODE_AUTO[];
static const char SCENE_MODE_ACTION[];
static const char SCENE_MODE_PORTRAIT[];
static const char SCENE_MODE_LANDSCAPE[];
static const char SCENE_MODE_NIGHT[];
static const char SCENE_MODE_NIGHT_PORTRAIT[];
static const char SCENE_MODE_THEATRE[];
static const char SCENE_MODE_BEACH[];
static const char SCENE_MODE_SNOW[];
static const char SCENE_MODE_SUNSET[];
static const char SCENE_MODE_STEADYPHOTO[];
static const char SCENE_MODE_FIREWORKS[];
static const char SCENE_MODE_SPORTS[];
static const char SCENE_MODE_PARTY[];
static const char SCENE_MODE_CANDLELIGHT[];
// Applications are looking for a barcode. Camera driver will be optimized
// for barcode reading.
static const char SCENE_MODE_BARCODE[];
// A high-dynamic range mode. In this mode, the HAL module will use a
// capture strategy that extends the dynamic range of the captured
// image in some fashion. Only the final image is returned.
static const char SCENE_MODE_HDR[];
// Pixel color formats for KEY_PREVIEW_FORMAT, KEY_PICTURE_FORMAT,
// and KEY_VIDEO_FRAME_FORMAT
static const char PIXEL_FORMAT_YUV422SP[];
static const char PIXEL_FORMAT_YUV420SP[]; // NV21
static const char PIXEL_FORMAT_YUV422I[]; // YUY2
static const char PIXEL_FORMAT_YUV420P[]; // YV12
static const char PIXEL_FORMAT_RGB565[];
static const char PIXEL_FORMAT_RGBA8888[];
static const char PIXEL_FORMAT_JPEG[];
// Raw bayer format used for images, which is 10 bit precision samples
// stored in 16 bit words. The filter pattern is RGGB.
static const char PIXEL_FORMAT_BAYER_RGGB[];
// Pixel format is not known to the framework
static const char PIXEL_FORMAT_ANDROID_OPAQUE[];
// Values for focus mode settings.
// Auto-focus mode. Applications should call
// CameraHardwareInterface.autoFocus to start the focus in this mode.
static const char FOCUS_MODE_AUTO[];
// Focus is set at infinity. Applications should not call
// CameraHardwareInterface.autoFocus in this mode.
static const char FOCUS_MODE_INFINITY[];
// Macro (close-up) focus mode. Applications should call
// CameraHardwareInterface.autoFocus to start the focus in this mode.
static const char FOCUS_MODE_MACRO[];
// Focus is fixed. The camera is always in this mode if the focus is not
// adjustable. If the camera has auto-focus, this mode can fix the
// focus, which is usually at hyperfocal distance. Applications should
// not call CameraHardwareInterface.autoFocus in this mode.
static const char FOCUS_MODE_FIXED[];
// Extended depth of field (EDOF). Focusing is done digitally and
// continuously. Applications should not call
// CameraHardwareInterface.autoFocus in this mode.
static const char FOCUS_MODE_EDOF[];
// Continuous auto focus mode intended for video recording. The camera
// continuously tries to focus. This is the best choice for video
// recording because the focus changes smoothly . Applications still can
// call CameraHardwareInterface.takePicture in this mode but the subject may
// not be in focus. Auto focus starts when the parameter is set.
//
// Applications can call CameraHardwareInterface.autoFocus in this mode. The
// focus callback will immediately return with a boolean that indicates
// whether the focus is sharp or not. The focus position is locked after
// autoFocus call. If applications want to resume the continuous focus,
// cancelAutoFocus must be called. Restarting the preview will not resume
// the continuous autofocus. To stop continuous focus, applications should
// change the focus mode to other modes.
static const char FOCUS_MODE_CONTINUOUS_VIDEO[];
// Continuous auto focus mode intended for taking pictures. The camera
// continuously tries to focus. The speed of focus change is more aggressive
// than FOCUS_MODE_CONTINUOUS_VIDEO. Auto focus starts when the parameter is
// set.
//
// Applications can call CameraHardwareInterface.autoFocus in this mode. If
// the autofocus is in the middle of scanning, the focus callback will
// return when it completes. If the autofocus is not scanning, focus
// callback will immediately return with a boolean that indicates whether
// the focus is sharp or not. The apps can then decide if they want to take
// a picture immediately or to change the focus mode to auto, and run a full
// autofocus cycle. The focus position is locked after autoFocus call. If
// applications want to resume the continuous focus, cancelAutoFocus must be
// called. Restarting the preview will not resume the continuous autofocus.
// To stop continuous focus, applications should change the focus mode to
// other modes.
static const char FOCUS_MODE_CONTINUOUS_PICTURE[];
// Values for light special effects
// Low-light enhancement mode
static const char LIGHTFX_LOWLIGHT[];
// High-dynamic range mode
static const char LIGHTFX_HDR[];
// Custom parameters for Samsung
static const char KEY_SUPPORTED_ISO_MODES[];
static const char KEY_QC_FACE_RECOGNITION[];
static const char KEY_QC_SUPPORTED_FACE_RECOGNITION[];
static const char KEY_QC_SUPPORTED_FACE_RECOGNITION_MODES[];
static const char KEY_QC_FACE_DETECTION[];
static const char KEY_QC_SUPPORTED_FACE_DETECTION[];
static const char KEY_FACE_DETECTION[];
static const char KEY_SUPPORTED_FACE_DETECTION[];
static const char FACE_DETECTION_OFF[];
static const char FACE_DETECTION_ON[];
static const char KEY_ZSL[];
static const char KEY_SUPPORTED_ZSL_MODES[];
static const char ZSL_OFF[];
static const char ZSL_ON[];
static const char KEY_ISO_MODE[];
static const char KEY_CAMERA_MODE[];
static const char KEY_SAMSUNG_CAMERA_MODE[];
static const char KEY_SELECTABLE_ZONE_AF[];
static const char KEY_SUPPORTED_SELECTABLE_ZONE_AF[];
static const char SELECTABLE_ZONE_AF_AUTO[];
static const char SELECTABLE_ZONE_AF_SPOT_METERING[];
static const char SELECTABLE_ZONE_AF_CENTER_WEIGHTED[];
static const char SELECTABLE_ZONE_AF_FRAME_AVERAGE[];
static const char KEY_PREVIEW_FRAME_RATE_MODE[];
static const char KEY_SUPPORTED_PREVIEW_FRAME_RATE_MODES[];
static const char KEY_PREVIEW_FRAME_RATE_AUTO_MODE[];
static const char KEY_PREVIEW_FRAME_RATE_FIXED_MODE[];
static const char KEY_SHARPNESS[];
static const char KEY_SATURATION[];
static const char KEY_CONTRAST[];
static const char KEY_SCENE_DETECT[];
static const char KEY_SUPPORTED_SCENE_DETECT[];
static const char SCENE_DETECT_OFF[];
static const char SCENE_DETECT_ON[];
static const char KEY_WEATHER[];
static const char KEY_CITYID[];
static const char KEY_TOUCH_AF_AEC[];
static const char KEY_SUPPORTED_TOUCH_AF_AEC[];
static const char TOUCH_AF_AEC_OFF[];
static const char TOUCH_AF_AEC_ON[];
static const char KEY_MEMORY_COLOR_ENHANCEMENT[];
static const char KEY_LENSSHADE[];
static const char KEY_REDEYE_REDUCTION[];
static const char KEY_SUPPORTED_REDEYE_REDUCTION[];
static const char REDEYE_REDUCTION_ENABLE[];
static const char REDEYE_REDUCTION_DISABLE[];
static const char KEY_GPS_LATITUDE_REF[];
static const char KEY_GPS_LONGITUDE_REF[];
static const char KEY_GPS_ALTITUDE_REF[];
static const char KEY_GPS_STATUS[];
static const char KEY_EXIF_DATETIME[];
static const char KEY_AUTO_EXPOSURE[];
static const char KEY_SUPPORTED_AUTO_EXPOSURE[];
static const char KEY_SUPPORTED_LENSSHADE_MODES[];
static const char LENSSHADE_ENABLE[];
static const char LENSSHADE_DISABLE[];
static const char MCE_ENABLE[];
static const char MCE_DISABLE[];
static const char ISO_AUTO[];
static const char ISO_HJR[];
static const char ISO_100[];
static const char ISO_200[];
static const char ISO_400[];
static const char ISO_800[];
static const char ISO_1600[];
static const char ISO_3200[];
static const char ISO_6400[];
static const char KEY_SUPPORTED_HFR_SIZES[];
static const char KEY_SUPPORTED_MEM_COLOR_ENHANCE_MODES[];
static const char VIDEO_HFR_OFF[];
static const char VIDEO_HFR_2X[];
static const char VIDEO_HFR_3X[];
static const char VIDEO_HFR_4X[];
static const char KEY_VIDEO_HIGH_FRAME_RATE[];
static const char KEY_SUPPORTED_VIDEO_HIGH_FRAME_RATE_MODES[];
static const char KEY_HISTOGRAM[];
static const char KEY_SUPPORTED_HISTOGRAM_MODES[];
static const char HISTOGRAM_ENABLE[];
static const char HISTOGRAM_DISABLE[];
static const char SKIN_TONE_ENHANCEMENT_ENABLE[];
static const char SKIN_TONE_ENHANCEMENT_DISABLE[];
static const char KEY_SKIN_TONE_ENHANCEMENT[];
static const char KEY_SUPPORTED_SKIN_TONE_ENHANCEMENT_MODES[];
static const char DENOISE_OFF[];
static const char DENOISE_ON[];
static const char KEY_DENOISE[];
static const char KEY_SUPPORTED_DENOISE[];
static const char EFFECT_EMBOSS[];
static const char EFFECT_SKETCH[];
static const char EFFECT_NEON[];
static const char SCENE_MODE_FLOWERS[];
static const char SCENE_MODE_AR[];
static const char PIXEL_FORMAT_YUV420SP_ADRENO[];
static const char PIXEL_FORMAT_RAW[];
static const char PIXEL_FORMAT_YV12[];
static const char PIXEL_FORMAT_NV12[];
static const char EFFECT_CARTOONIZE[];
static const char EFFECT_POINT_RED_YELLOW[];
static const char EFFECT_POINT_GREEN[];
static const char EFFECT_POINT_BLUE[];
static const char EFFECT_VINTAGE_COLD[];
static const char EFFECT_VINTAGE_WARM[];
static const char EFFECT_WASHED[];
static const char SCENE_MODE_BACKLIGHT[];
static const char SCENE_MODE_ASD[];
/**
* Returns the the supported preview formats as an enum given in graphics.h
* corrsponding to the format given in the input string or -1 if no such
* conversion exists.
*/
static int previewFormatToEnum(const char* format);
/**
* Custom parameters for Samsung
*/
int getInt64(const char *key) const;
const char *getPreviewFrameRateMode() const;
void setPreviewFrameRateMode(const char *mode);
void getMeteringAreaCenter(int *x, int *y) const;
void setTouchIndexAec(int x, int y);
void setTouchIndexAf(int x, int y);
void setPreviewFpsRange(int minFPS, int maxFPS);
private:
DefaultKeyedVector<String8,String8> mMap;
CameraParameters *mParams;
};
}; // namespace android
#endif

View file

@ -1,238 +0,0 @@
/*
* Copyright (C) 2014 The CyanogenMod Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define CAMERA_PARAMETERS_EXTRA_C \
const char CameraParameters::KEY_SUPPORTED_ISO_MODES[] = "iso-values"; \
const char CameraParameters::KEY_DIS[] = "dis"; \
const char CameraParameters::DIS_DISABLE[] = "disable"; \
const char CameraParameters::KEY_FACE_DETECTION[] = "face-detection"; \
const char CameraParameters::KEY_SUPPORTED_FACE_DETECTION[] = "face-detection-values"; \
const char CameraParameters::FACE_DETECTION_OFF[] = "off"; \
const char CameraParameters::FACE_DETECTION_ON[] = "on"; \
const char CameraParameters::KEY_ZSL[] = "zsl"; \
const char CameraParameters::KEY_SUPPORTED_ZSL_MODES[] = "zsl-values"; \
const char CameraParameters::ZSL_OFF[] = "off"; \
const char CameraParameters::ZSL_ON[] = "on"; \
const char CameraParameters::KEY_ISO_MODE[] = "iso"; \
const char CameraParameters::KEY_CAMERA_MODE[] = "camera-mode"; \
const char CameraParameters::KEY_SAMSUNG_CAMERA_MODE[] = "cam_mode"; \
const char CameraParameters::KEY_SELECTABLE_ZONE_AF[] = "selectable-zone-af"; \
const char CameraParameters::KEY_SUPPORTED_SELECTABLE_ZONE_AF[] = "selectable-zone-af-values"; \
const char CameraParameters::SELECTABLE_ZONE_AF_AUTO[] = "auto"; \
const char CameraParameters::SELECTABLE_ZONE_AF_SPOT_METERING[] = "spot-metering"; \
const char CameraParameters::SELECTABLE_ZONE_AF_CENTER_WEIGHTED[] = "center-weighted"; \
const char CameraParameters::SELECTABLE_ZONE_AF_FRAME_AVERAGE[] = "frame-average"; \
const char CameraParameters::KEY_PREVIEW_FRAME_RATE_MODE[] = "preview-frame-rate-mode"; \
const char CameraParameters::KEY_SUPPORTED_PREVIEW_FRAME_RATE_MODES[] = "preview-frame-rate-modes"; \
const char CameraParameters::KEY_PREVIEW_FRAME_RATE_AUTO_MODE[] = "frame-rate-auto"; \
const char CameraParameters::KEY_PREVIEW_FRAME_RATE_FIXED_MODE[] = "frame-rate-fixed"; \
const char CameraParameters::KEY_SHARPNESS[] = "sharpness"; \
const char CameraParameters::KEY_SATURATION[] = "saturation"; \
const char CameraParameters::KEY_CONTRAST[] = "contrast"; \
const char CameraParameters::KEY_SCENE_DETECT[] = "scene-detect"; \
const char CameraParameters::KEY_SUPPORTED_SCENE_DETECT[] = "scene-detect-values"; \
const char CameraParameters::SCENE_DETECT_OFF[] = "off"; \
const char CameraParameters::SCENE_DETECT_ON[] = "on"; \
const char CameraParameters::KEY_WEATHER[] = "weather"; \
const char CameraParameters::KEY_CITYID[] = "contextualtag-cityid"; \
const char CameraParameters::KEY_TOUCH_AF_AEC[] = "touch-af-aec"; \
const char CameraParameters::KEY_SUPPORTED_TOUCH_AF_AEC[] = "touch-af-aec-values"; \
const char CameraParameters::TOUCH_AF_AEC_OFF[] = "touch-off"; \
const char CameraParameters::TOUCH_AF_AEC_ON[] = "touch-on"; \
const char CameraParameters::KEY_MEMORY_COLOR_ENHANCEMENT[] = "mce"; \
const char CameraParameters::KEY_LENSSHADE[] = "lensshade"; \
const char CameraParameters::KEY_REDEYE_REDUCTION[] = "redeye-reduction"; \
const char CameraParameters::KEY_SUPPORTED_REDEYE_REDUCTION[] = "redeye-reduction-values"; \
const char CameraParameters::REDEYE_REDUCTION_ENABLE[] = "enable"; \
const char CameraParameters::REDEYE_REDUCTION_DISABLE[] = "disable"; \
const char CameraParameters::KEY_GPS_LATITUDE_REF[] = "gps-latitude-ref"; \
const char CameraParameters::KEY_GPS_LONGITUDE_REF[] = "gps-longitude-ref"; \
const char CameraParameters::KEY_GPS_ALTITUDE_REF[] = "gps-altitude-ref"; \
const char CameraParameters::KEY_GPS_STATUS[] = "gps-status"; \
const char CameraParameters::KEY_EXIF_DATETIME[] = "exif-datetime"; \
const char CameraParameters::KEY_AUTO_EXPOSURE[] = "auto-exposure"; \
const char CameraParameters::KEY_SUPPORTED_AUTO_EXPOSURE[] = "auto-exposure-values"; \
const char CameraParameters::KEY_SUPPORTED_LENSSHADE_MODES[] = "lensshade-values"; \
const char CameraParameters::LENSSHADE_ENABLE[] = "enable"; \
const char CameraParameters::LENSSHADE_DISABLE[] = "disable"; \
const char CameraParameters::MCE_ENABLE[] = "enable"; \
const char CameraParameters::MCE_DISABLE[] = "disable"; \
const char CameraParameters::ISO_AUTO[] = "auto"; \
const char CameraParameters::ISO_HJR[] = "ISO_HJR"; \
const char CameraParameters::ISO_100[] = "ISO100"; \
const char CameraParameters::ISO_200[] = "ISO200"; \
const char CameraParameters::ISO_400[] = "ISO400"; \
const char CameraParameters::ISO_800[] = "ISO800"; \
const char CameraParameters::ISO_1600[] = "ISO1600"; \
const char CameraParameters::ISO_3200[] = "ISO3200"; \
const char CameraParameters::ISO_6400[] = "ISO6400"; \
const char CameraParameters::KEY_SUPPORTED_HFR_SIZES[] = "hfr-size-values"; \
const char CameraParameters::KEY_SUPPORTED_MEM_COLOR_ENHANCE_MODES[] = "mce-values"; \
const char CameraParameters::VIDEO_HFR_OFF[] = "off"; \
const char CameraParameters::VIDEO_HFR_2X[] = "60"; \
const char CameraParameters::VIDEO_HFR_3X[] = "90"; \
const char CameraParameters::VIDEO_HFR_4X[] = "120"; \
const char CameraParameters::KEY_VIDEO_HIGH_FRAME_RATE[] = "video-hfr"; \
const char CameraParameters::KEY_SUPPORTED_VIDEO_HIGH_FRAME_RATE_MODES[] = "video-hfr-values"; \
const char CameraParameters::KEY_HISTOGRAM[] = "histogram"; \
const char CameraParameters::KEY_SUPPORTED_HISTOGRAM_MODES[] = "histogram-values"; \
const char CameraParameters::HISTOGRAM_ENABLE[] = "enable"; \
const char CameraParameters::HISTOGRAM_DISABLE[] = "disable"; \
const char CameraParameters::SKIN_TONE_ENHANCEMENT_ENABLE[] = "enable"; \
const char CameraParameters::SKIN_TONE_ENHANCEMENT_DISABLE[] = "disable"; \
const char CameraParameters::KEY_SKIN_TONE_ENHANCEMENT[] = "skinToneEnhancement"; \
const char CameraParameters::KEY_SUPPORTED_SKIN_TONE_ENHANCEMENT_MODES[] = "skinToneEnhancement-values"; \
const char CameraParameters::DENOISE_OFF[] = "denoise-off"; \
const char CameraParameters::DENOISE_ON[] = "denoise-on"; \
const char CameraParameters::KEY_DENOISE[] = "denoise"; \
const char CameraParameters::KEY_SUPPORTED_DENOISE[] = "denoise-values"; \
const char CameraParameters::EFFECT_EMBOSS[] = "emboss"; \
const char CameraParameters::EFFECT_SKETCH[] = "sketch"; \
const char CameraParameters::EFFECT_NEON[] = "neon"; \
const char CameraParameters::SCENE_MODE_FLOWERS[] = "flowers"; \
const char CameraParameters::SCENE_MODE_AR[] = "AR"; \
const char CameraParameters::PIXEL_FORMAT_YUV420SP_ADRENO[] = "yuv420sp-adreno"; \
const char CameraParameters::PIXEL_FORMAT_RAW[] = "raw"; \
const char CameraParameters::PIXEL_FORMAT_YV12[] = "yuv420p"; \
const char CameraParameters::PIXEL_FORMAT_NV12[] = "nv12"; \
const char CameraParameters::EFFECT_CARTOONIZE[] = "cartoonize"; \
const char CameraParameters::EFFECT_POINT_RED_YELLOW[] = "point-red-yellow"; \
const char CameraParameters::EFFECT_POINT_GREEN[] = "point-green"; \
const char CameraParameters::EFFECT_POINT_BLUE[] = "point-blue"; \
const char CameraParameters::EFFECT_VINTAGE_COLD[] = "vintage-cold"; \
const char CameraParameters::EFFECT_VINTAGE_WARM[] = "vintage-warm"; \
const char CameraParameters::EFFECT_WASHED[] = "washed"; \
const char CameraParameters::SCENE_MODE_BACKLIGHT[] = "backlight"; \
const char CameraParameters::SCENE_MODE_ASD[] = "asd"; \
int CameraParameters::getInt64(__attribute__((__unused__)) const char *key) const { return -1; } \
const char *CameraParameters::getPreviewFrameRateMode() const { return get(KEY_PREVIEW_FRAME_RATE_MODE); }; \
void CameraParameters::setPreviewFrameRateMode(const char *mode) { set(KEY_PREVIEW_FRAME_RATE_MODE, mode); }; \
void CameraParameters::getMeteringAreaCenter(int *x, int *y) const { }; \
void CameraParameters::setTouchIndexAec(int x, int y) { }; \
void CameraParameters::setTouchIndexAf(int x, int y) { }; \
void CameraParameters::setPreviewFpsRange(int minFPS, int maxFPS) { };
#define CAMERA_PARAMETERS_EXTRA_H \
static const char KEY_SUPPORTED_ISO_MODES[]; \
static const char KEY_DIS[]; \
static const char DIS_DISABLE[]; \
static const char KEY_FACE_DETECTION[]; \
static const char KEY_SUPPORTED_FACE_DETECTION[]; \
static const char FACE_DETECTION_OFF[]; \
static const char FACE_DETECTION_ON[]; \
static const char KEY_ZSL[]; \
static const char KEY_SUPPORTED_ZSL_MODES[]; \
static const char ZSL_OFF[]; \
static const char ZSL_ON[]; \
static const char KEY_ISO_MODE[]; \
static const char KEY_CAMERA_MODE[]; \
static const char KEY_SAMSUNG_CAMERA_MODE[]; \
static const char KEY_SELECTABLE_ZONE_AF[]; \
static const char KEY_SUPPORTED_SELECTABLE_ZONE_AF[]; \
static const char SELECTABLE_ZONE_AF_AUTO[]; \
static const char SELECTABLE_ZONE_AF_SPOT_METERING[]; \
static const char SELECTABLE_ZONE_AF_CENTER_WEIGHTED[]; \
static const char SELECTABLE_ZONE_AF_FRAME_AVERAGE[]; \
static const char KEY_PREVIEW_FRAME_RATE_MODE[]; \
static const char KEY_SUPPORTED_PREVIEW_FRAME_RATE_MODES[]; \
static const char KEY_PREVIEW_FRAME_RATE_AUTO_MODE[]; \
static const char KEY_PREVIEW_FRAME_RATE_FIXED_MODE[]; \
static const char KEY_SHARPNESS[]; \
static const char KEY_SATURATION[]; \
static const char KEY_CONTRAST[]; \
static const char KEY_SCENE_DETECT[]; \
static const char KEY_SUPPORTED_SCENE_DETECT[]; \
static const char SCENE_DETECT_OFF[]; \
static const char SCENE_DETECT_ON[]; \
static const char KEY_WEATHER[]; \
static const char KEY_CITYID[]; \
static const char KEY_TOUCH_AF_AEC[]; \
static const char KEY_SUPPORTED_TOUCH_AF_AEC[]; \
static const char TOUCH_AF_AEC_OFF[]; \
static const char TOUCH_AF_AEC_ON[]; \
static const char KEY_MEMORY_COLOR_ENHANCEMENT[]; \
static const char KEY_LENSSHADE[]; \
static const char KEY_REDEYE_REDUCTION[]; \
static const char KEY_SUPPORTED_REDEYE_REDUCTION[]; \
static const char REDEYE_REDUCTION_ENABLE[]; \
static const char REDEYE_REDUCTION_DISABLE[]; \
static const char KEY_GPS_LATITUDE_REF[]; \
static const char KEY_GPS_LONGITUDE_REF[]; \
static const char KEY_GPS_ALTITUDE_REF[]; \
static const char KEY_GPS_STATUS[]; \
static const char KEY_EXIF_DATETIME[]; \
static const char KEY_AUTO_EXPOSURE[]; \
static const char KEY_SUPPORTED_AUTO_EXPOSURE[]; \
static const char KEY_SUPPORTED_LENSSHADE_MODES[]; \
static const char LENSSHADE_ENABLE[]; \
static const char LENSSHADE_DISABLE[]; \
static const char MCE_ENABLE[]; \
static const char MCE_DISABLE[]; \
static const char ISO_AUTO[]; \
static const char ISO_HJR[]; \
static const char ISO_100[]; \
static const char ISO_200[]; \
static const char ISO_400[]; \
static const char ISO_800[]; \
static const char ISO_1600[]; \
static const char ISO_3200[]; \
static const char ISO_6400[]; \
static const char KEY_SUPPORTED_HFR_SIZES[]; \
static const char KEY_SUPPORTED_MEM_COLOR_ENHANCE_MODES[]; \
static const char VIDEO_HFR_OFF[]; \
static const char VIDEO_HFR_2X[]; \
static const char VIDEO_HFR_3X[]; \
static const char VIDEO_HFR_4X[]; \
static const char KEY_VIDEO_HIGH_FRAME_RATE[]; \
static const char KEY_SUPPORTED_VIDEO_HIGH_FRAME_RATE_MODES[]; \
static const char KEY_HISTOGRAM[]; \
static const char KEY_SUPPORTED_HISTOGRAM_MODES[]; \
static const char HISTOGRAM_ENABLE[]; \
static const char HISTOGRAM_DISABLE[]; \
static const char SKIN_TONE_ENHANCEMENT_ENABLE[]; \
static const char SKIN_TONE_ENHANCEMENT_DISABLE[]; \
static const char KEY_SKIN_TONE_ENHANCEMENT[]; \
static const char KEY_SUPPORTED_SKIN_TONE_ENHANCEMENT_MODES[]; \
static const char DENOISE_OFF[]; \
static const char DENOISE_ON[]; \
static const char KEY_DENOISE[]; \
static const char KEY_SUPPORTED_DENOISE[]; \
static const char EFFECT_EMBOSS[]; \
static const char EFFECT_SKETCH[]; \
static const char EFFECT_NEON[]; \
static const char SCENE_MODE_FLOWERS[]; \
static const char SCENE_MODE_AR[]; \
static const char PIXEL_FORMAT_YUV420SP_ADRENO[]; \
static const char PIXEL_FORMAT_RAW[]; \
static const char PIXEL_FORMAT_YV12[]; \
static const char PIXEL_FORMAT_NV12[]; \
static const char EFFECT_CARTOONIZE[]; \
static const char EFFECT_POINT_RED_YELLOW[]; \
static const char EFFECT_POINT_GREEN[]; \
static const char EFFECT_POINT_BLUE[]; \
static const char EFFECT_VINTAGE_COLD[]; \
static const char EFFECT_VINTAGE_WARM[]; \
static const char EFFECT_WASHED[]; \
static const char SCENE_MODE_BACKLIGHT[]; \
static const char SCENE_MODE_ASD[]; \
int getInt64(const char *key) const; \
const char *getPreviewFrameRateMode() const; \
void setPreviewFrameRateMode(const char *mode); \
void getMeteringAreaCenter(int *x, int *y) const; \
void setTouchIndexAec(int x, int y); \
void setTouchIndexAf(int x, int y); \
void setPreviewFpsRange(int minFPS, int maxFPS);

View file

@ -14,6 +14,11 @@
$(call inherit-product, $(SRC_TARGET_DIR)/product/languages_full.mk) $(call inherit-product, $(SRC_TARGET_DIR)/product/languages_full.mk)
# Seccomp policy
PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/seccomp_policy/mediacodec.policy:$(TARGET_COPY_OUT_VENDOR)/etc/seccomp_policy/mediacodec.policy \
$(LOCAL_PATH)/seccomp_policy/mediaextractor.policy:$(TARGET_COPY_OUT_VENDOR)/etc/seccomp_policy/mediaextractor.policy
# Overlay # Overlay
DEVICE_PACKAGE_OVERLAYS += $(LOCAL_PATH)/overlay DEVICE_PACKAGE_OVERLAYS += $(LOCAL_PATH)/overlay

View file

@ -0,0 +1,11 @@
# device specific syscalls
pselect6: 1
eventfd2: 1
sendto: 1
recvfrom: 1
_llseek: 1
sysinfo: 1
getcwd: 1
getsockopt: 1
# ffmpeg needs this
getdents64: 1

View file

@ -0,0 +1,6 @@
# device specific syscalls.
readlinkat: 1
pread64: 1
getsockopt: 1
# ffmpeg needs this
nanosleep: 1