From 0fad7808d04605b18caa089f2a718f0ac11e2de7 Mon Sep 17 00:00:00 2001 From: xkeita Date: Sat, 27 May 2017 07:47:42 +0000 Subject: shinano-common: camera: Enable sonycamera proprietary capabilities MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sony camera blobs are encrypted, so they need com.sonyericsson.permission.CAMERA_EXTENDED permission from original camera to be present in apk to enable Sony custom options (4k video, iso settings, etc) camera.qcom.so checks if this permission is available in current camera app but it can be bypassed when "ro.build.type=eng" thus enabling Sony camera options. The point of this shim is to make camera.qcom.so believe that we're currently on an engineering android rom so it bypasses the permission check allowing camera apps to have full capabilities. ----------------------------------------------------------------------- Credits to Balázs Triszka from sony-kitakami Change-Id: I14ef800608c7ed7a95921dd71a56702ed2d68b18 ----------------------------------------------------------------------- Change-Id: I2052aa30fbd30a730ea7b9c60b98f35f99314a51 --- libshims/Android.mk | 8 ++++++++ libshims/libsonycamera.cpp | 16 ++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 libshims/libsonycamera.cpp (limited to 'libshims') diff --git a/libshims/Android.mk b/libshims/Android.mk index 88e307f..e4bfd9f 100644 --- a/libshims/Android.mk +++ b/libshims/Android.mk @@ -43,3 +43,11 @@ LOCAL_MODULE_TAGS := optional LOCAL_32_BIT_ONLY := true include $(BUILD_SHARED_LIBRARY) +include $(CLEAR_VARS) +LOCAL_SRC_FILES := libsonycamera.cpp +LOCAL_MODULE := libsonycamera +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE_CLASS := SHARED_LIBRARIES +LOCAL_SHARED_LIBRARIES := liblog +LOCAL_32_BIT_ONLY := true +include $(BUILD_SHARED_LIBRARY) diff --git a/libshims/libsonycamera.cpp b/libshims/libsonycamera.cpp new file mode 100644 index 0000000..8d759fe --- /dev/null +++ b/libshims/libsonycamera.cpp @@ -0,0 +1,16 @@ +#include +#include +#include +#include + +// Unlock all Sony parameters +extern "C" { + int property_get(const char * key, char * value, const char * default_value) { + if (strcmp("ro.build.type", key) == 0) { + strcpy(value, "eng"); + return 3; + } + + return ((int( * )(const char * , char *, const char * ))(dlsym((void * ) - 1, "property_get")))(key, value, default_value); + } +} \ No newline at end of file -- cgit v1.2.3