From e56e9fb1c5c75832a199e0394250201a51004562 Mon Sep 17 00:00:00 2001 From: Dyneteve Date: Fri, 18 May 2018 13:22:52 -0400 Subject: [PATCH] msm8226: Update --- BoardConfigCommon.mk | 9 +- board/art.mk | 3 + board/camera.mk | 2 - board/shims.mk | 5 + camera/Android.mk | 19 + camera/Android.mk.1 | 19 - camera/CameraWrapper.cpp | 329 ++++++++------- camera/CameraWrapper.h | 19 + include/camera/CameraParametersExtra.h | 238 ----------- manifest.xml | 2 +- msm8226.mk | 30 +- .../base/core/res/res/values/config.xml | 44 +- power/Android.mk | 9 +- power/power.c | 95 +++-- power/power.h | 82 ++-- ril/Android.mk | 13 - ril/ril_shim.c | 70 ---- .../internal/telephony/SamsungMSM8226RIL.java | 375 ------------------ rootdir/init.qcom.power.rc | 130 +++--- rootdir/init.qcom.rc | 14 - sepolicy/bluetooth.te | 1 - sepolicy/camera.te | 37 -- sepolicy/cameraserver.te | 3 - sepolicy/device.te | 2 - sepolicy/file.te | 6 - sepolicy/file_contexts | 39 -- sepolicy/fingerprintd.te | 1 - sepolicy/fsck.te | 1 - sepolicy/healthd.te | 2 - sepolicy/hostapd.te | 2 - sepolicy/init.te | 3 - sepolicy/kernel.te | 2 - sepolicy/mediaserver.te | 7 - sepolicy/mm-qcamerad.te | 20 - sepolicy/mpdecision.te | 1 - sepolicy/platform_app.te | 1 - sepolicy/property.te | 1 - sepolicy/property_contexts | 2 - sepolicy/qseecomd.te | 1 - sepolicy/rild.te | 8 - sepolicy/system_app.te | 7 - sepolicy/system_server.te | 7 - sepolicy/tee.te | 2 - sepolicy/thermal-engine.te | 7 - sepolicy/ueventd.te | 3 - sepolicy/untrusted_app.te | 2 - sepolicy/vcs.te | 22 - sepolicy/vold.te | 4 - sepolicy/wcnss_service.te | 2 - sepolicy/wpa.te | 3 - shims/Android.mk | 5 + shims/imx175_shim.cpp | 17 + system.prop | 22 +- 53 files changed, 466 insertions(+), 1284 deletions(-) create mode 100644 board/art.mk create mode 100644 board/shims.mk create mode 100644 camera/Android.mk delete mode 100644 camera/Android.mk.1 create mode 100644 camera/CameraWrapper.h delete mode 100644 include/camera/CameraParametersExtra.h delete mode 100644 ril/Android.mk delete mode 100644 ril/ril_shim.c delete mode 100644 ril/telephony/java/com/android/internal/telephony/SamsungMSM8226RIL.java delete mode 100644 sepolicy/bluetooth.te delete mode 100644 sepolicy/camera.te delete mode 100644 sepolicy/cameraserver.te delete mode 100644 sepolicy/device.te delete mode 100644 sepolicy/file.te delete mode 100644 sepolicy/file_contexts delete mode 100644 sepolicy/fingerprintd.te delete mode 100644 sepolicy/fsck.te delete mode 100644 sepolicy/healthd.te delete mode 100644 sepolicy/hostapd.te delete mode 100644 sepolicy/init.te delete mode 100644 sepolicy/kernel.te delete mode 100644 sepolicy/mediaserver.te delete mode 100644 sepolicy/mm-qcamerad.te delete mode 100644 sepolicy/mpdecision.te delete mode 100644 sepolicy/platform_app.te delete mode 100644 sepolicy/property.te delete mode 100644 sepolicy/property_contexts delete mode 100644 sepolicy/qseecomd.te delete mode 100644 sepolicy/rild.te delete mode 100644 sepolicy/system_app.te delete mode 100644 sepolicy/system_server.te delete mode 100644 sepolicy/tee.te delete mode 100644 sepolicy/thermal-engine.te delete mode 100644 sepolicy/ueventd.te delete mode 100644 sepolicy/untrusted_app.te delete mode 100644 sepolicy/vcs.te delete mode 100644 sepolicy/vold.te delete mode 100644 sepolicy/wcnss_service.te delete mode 100644 sepolicy/wpa.te create mode 100644 shims/imx175_shim.cpp diff --git a/BoardConfigCommon.mk b/BoardConfigCommon.mk index a5518be..08b4ce7 100644 --- a/BoardConfigCommon.mk +++ b/BoardConfigCommon.mk @@ -20,6 +20,7 @@ VENDOR_PATH := device/samsung/msm8226-common include device/samsung/msm8226-common/board/*.mk TARGET_SPECIFIC_HEADER_PATH := $(VENDOR_PATH)/include + # CMHW BOARD_HARDWARE_CLASS += $(VENDOR_PATH)/cmhw @@ -33,9 +34,6 @@ TARGET_USES_LEGACY_ADB_INTERFACE :=true PRODUCT_COPY_FILES += \ $(VENDOR_PATH)/manifest.xml:system/vendor/manifest.xml -# Custom RIL class -BOARD_RIL_CLASS := ../../../$(VENDOR_PATH)/ril - # Fonts EXTENDED_FONT_FOOTPRINT := true @@ -43,6 +41,5 @@ EXTENDED_FONT_FOOTPRINT := true TARGET_SYSTEM_PROP := $(VENDOR_PATH)/system.prop # SELinux --include device/qcom/sepolicy/sepolicy.mk -BOARD_SEPOLICY_DIRS += $(VENDOR_PATH)/sepolicy - +include device/qcom/sepolicy/sepolicy.mk +include device/qcom/sepolicy/legacy-sepolicy.mk diff --git a/board/art.mk b/board/art.mk new file mode 100644 index 0000000..a01cb4c --- /dev/null +++ b/board/art.mk @@ -0,0 +1,3 @@ +# ART +WITH_DEXPREOPT := true +WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY ?= true diff --git a/board/camera.mk b/board/camera.mk index 4c2eaff..8624034 100644 --- a/board/camera.mk +++ b/board/camera.mk @@ -1,6 +1,4 @@ # Camera TARGET_HAS_LEGACY_CAMERA_HAL1 := true -TARGET_PROVIDES_CAMERA_HAL := true USE_DEVICE_SPECIFIC_CAMERA := true -#Faceproc needs this to load TARGET_NEEDS_PLATFORM_TEXT_RELOCATIONS := true diff --git a/board/shims.mk b/board/shims.mk new file mode 100644 index 0000000..4d53ba3 --- /dev/null +++ b/board/shims.mk @@ -0,0 +1,5 @@ +# Shims +TARGET_LD_SHIM_LIBS += \ + /system/vendor/lib/libwvm.so|libwvm_shim.so \ + /system/lib/libcrypto.so|libboringssl-compat.so \ + /system/vendor/lib/libmmcamera_imx175.so|libimx175_shim.so diff --git a/camera/Android.mk b/camera/Android.mk new file mode 100644 index 0000000..c56bc89 --- /dev/null +++ b/camera/Android.mk @@ -0,0 +1,19 @@ +LOCAL_PATH := $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_C_INCLUDES := \ + system/media/camera/include \ + frameworks/native/include/media/openmax + +LOCAL_SRC_FILES := \ + CameraWrapper.cpp + +LOCAL_SHARED_LIBRARIES := \ + libhardware liblog libcamera_client libutils libcutils libgui libsensor + +LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_SHARED_LIBRARIES)/hw +LOCAL_MODULE := camera.msm8226 +LOCAL_MODULE_TAGS := optional +LOCAL_PROPRIETARY_MODULE := true + +include $(BUILD_SHARED_LIBRARY) diff --git a/camera/Android.mk.1 b/camera/Android.mk.1 deleted file mode 100644 index 8e770ee..0000000 --- a/camera/Android.mk.1 +++ /dev/null @@ -1,19 +0,0 @@ -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_C_INCLUDES := \ - system/media/camera/include - -LOCAL_SRC_FILES := \ - CameraWrapper.cpp - -LOCAL_SHARED_LIBRARIES := \ - libhardware liblog libcamera_client libutils libdl \ - android.hidl.token@1.0-utils \ - android.hardware.graphics.bufferqueue@1.0 - -LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw -LOCAL_MODULE := camera.msm8226 -LOCAL_MODULE_TAGS := optional - -include $(BUILD_SHARED_LIBRARY) diff --git a/camera/CameraWrapper.cpp b/camera/CameraWrapper.cpp index faf0125..420a800 100644 --- a/camera/CameraWrapper.cpp +++ b/camera/CameraWrapper.cpp @@ -1,5 +1,6 @@ /* - * Copyright (C) 2014, The CyanogenMod Project + * Copyright (C) 2016 The CyanogenMod Project + * 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. @@ -22,28 +23,39 @@ */ //#define LOG_NDEBUG 0 - #define LOG_TAG "CameraWrapper" #include - #include #include #include #include #include -#include +#include -static android::Mutex gCameraWrapperLock; +#include "CameraWrapper.h" + +static const char PIXEL_FORMAT_YUV420SP_NV21E[] = "yuv420sp-nv21e"; + +#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_data_callback gUserDataCb = NULL; +static camera_data_timestamp_callback gUserDataCbTimestamp = NULL; +static camera_request_memory gUserGetMemory = 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_get_number_of_cameras(void); 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 = { .open = camera_device_open @@ -51,26 +63,30 @@ static struct hw_module_methods_t camera_module_methods = { camera_module_t HAL_MODULE_INFO_SYM = { .common = { - .tag = HARDWARE_MODULE_TAG, - .module_api_version = CAMERA_MODULE_API_VERSION_1_0, - .hal_api_version = HARDWARE_HAL_API_VERSION, - .id = CAMERA_HARDWARE_MODULE_ID, - .name = "Samsung MSM8226 Camera Wrapper", - .author = "The CyanogenMod Project", - .methods = &camera_module_methods, - .dso = NULL, /* remove compilation warnings */ - .reserved = {0}, /* remove compilation warnings */ + .tag = HARDWARE_MODULE_TAG, + .version_major = 1, + .version_minor = 0, + .id = CAMERA_HARDWARE_MODULE_ID, + .name = "msm8226 Camera Wrapper", + .author = "The CyanogenMod Project", + .methods = &camera_module_methods, + .dso = NULL, /* remove compilation warnings */ + .reserved = {0}, /* remove compilation warnings */ }, .get_number_of_cameras = camera_get_number_of_cameras, .get_camera_info = camera_get_camera_info, .set_callbacks = NULL, /* remove compilation warnings */ .get_vendor_tag_ops = NULL, /* remove compilation warnings */ .open_legacy = NULL, /* remove compilation warnings */ + .set_torch_mode = camera_set_torch_mode, + .init = NULL, /* remove compilation warnings */ .reserved = {0}, /* remove compilation warnings */ }; + typedef struct wrapper_camera_device { camera_device_t base; + int camera_released; int id; camera_device_t *vendor; } wrapper_camera_device_t; @@ -91,21 +107,16 @@ static int check_vendor_module() return 0; 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"); return rv; } -#define KEY_VIDEO_HFR_VALUES "video-hfr-values" - -const static char * iso_values[] = {"auto,ISO_HJR,ISO100,ISO200,ISO400,ISO800,ISO1600,auto"}; - static char *camera_fixup_getparams(int id, const char *settings) { - android::CameraParameters params; - params.unflatten(android::String8(settings)); + CameraParameters params; + params.unflatten(String8(settings)); #if !LOG_NDEBUG ALOGV("%s: original parameters:", __FUNCTION__); @@ -113,85 +124,50 @@ static char *camera_fixup_getparams(int id, const char *settings) #endif // fix params here - params.set(KEY_SUPPORTED_ISO_MODES, iso_values[id]); - params.set(KEY_EXPOSURE_COMPENSATION_STEP, "0.5"); - params.set(KEY_MIN_EXPOSURE_COMPENSATION, "-4"); - params.set(KEY_MAX_EXPOSURE_COMPENSATION, "4"); + params.set(android::CameraParameters::KEY_EXPOSURE_COMPENSATION_STEP, "0.5"); + params.set(android::CameraParameters::KEY_MIN_EXPOSURE_COMPENSATION, "-2"); + params.set(android::CameraParameters::KEY_MAX_EXPOSURE_COMPENSATION, "2"); - /* If the vendor has HFR values but doesn't also expose that - * this can be turned off, fixup the params to tell the Camera - * that it really is okay to turn it off. - */ - const char *hfrValues = params.get(KEY_VIDEO_HFR_VALUES); - if (hfrValues && *hfrValues && ! strstr(hfrValues, "off")) { - char tmp[strlen(hfrValues) + 4 + 1]; - sprintf(tmp, "%s,off", hfrValues); - params.set(KEY_VIDEO_HFR_VALUES, tmp); - } + params.set(android::CameraParameters::KEY_SUPPORTED_PREVIEW_SIZES, "640x360,640x480,352x288,320x240,176x144"); /* Enforce video-snapshot-supported to true */ - params.set(KEY_VIDEO_SNAPSHOT_SUPPORTED, "true"); - - android::String8 strParams = params.flatten(); - char *ret = strdup(strParams.string()); + params.set(android::CameraParameters::KEY_VIDEO_SNAPSHOT_SUPPORTED, "true"); #if !LOG_NDEBUG ALOGV("%s: fixed parameters:", __FUNCTION__); params.dump(); #endif + String8 strParams = params.flatten(); + char *ret = strdup(strParams.string()); + return ret; } -static char *camera_fixup_setparams(struct camera_device *device, const char *settings) +static char *camera_fixup_setparams(int id, const char *settings) { - int id = CAMERA_ID(device); - android::CameraParameters params; - params.unflatten(android::String8(settings)); + CameraParameters params; + params.unflatten(String8(settings)); #if !LOG_NDEBUG ALOGV("%s: original parameters:", __FUNCTION__); params.dump(); #endif - const char *recordingHint = params.get(KEY_RECORDING_HINT); - bool isVideo = recordingHint && !strcmp(recordingHint, "true"); - - if (isVideo) { - params.set(KEY_DIS, DIS_DISABLE); - params.set(KEY_ZSL, ZSL_OFF); - } else { - params.set(KEY_ZSL, ZSL_ON); - } - - // fix params here - // No need to fix-up ISO_HJR, it is the same for userspace and the camera lib - if (params.get("iso")) { - const char *isoMode = params.get(KEY_ISO_MODE); - if (strcmp(isoMode, "ISO100") == 0) - params.set(KEY_ISO_MODE, "100"); - else if (strcmp(isoMode, "ISO200") == 0) - params.set(KEY_ISO_MODE, "200"); - else if (strcmp(isoMode, "ISO400") == 0) - params.set(KEY_ISO_MODE, "400"); - else if (strcmp(isoMode, "ISO800") == 0) - params.set(KEY_ISO_MODE, "800"); - else if (strcmp(isoMode, "ISO1600") == 0) - params.set(KEY_ISO_MODE, "1600"); - } - - android::String8 strParams = params.flatten(); - - if (fixed_set_params[id]) - free(fixed_set_params[id]); - fixed_set_params[id] = strdup(strParams.string()); - char *ret = fixed_set_params[id]; + params.set(android::CameraParameters::KEY_SUPPORTED_PREVIEW_SIZES, "640x360,640x480,528x432,352x288,320x240,176x144"); + params.set(android::CameraParameters::KEY_PREVIEW_FPS_RANGE, "7500,30000"); #if !LOG_NDEBUG ALOGV("%s: fixed parameters:", __FUNCTION__); params.dump(); #endif + String8 strParams = params.flatten(); + if (fixed_set_params[id]) + free(fixed_set_params[id]); + fixed_set_params[id] = strdup(strParams.string()); + char *ret = fixed_set_params[id]; + return ret; } @@ -202,15 +178,34 @@ static char *camera_fixup_setparams(struct camera_device *device, const char *se static int camera_set_preview_window(struct camera_device *device, struct preview_stream_ops *window) { - ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, - (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if (!device) return -EINVAL; + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, + (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + return VENDOR_CALL(device, set_preview_window, window); } +void camera_notify_cb(int32_t msg_type, int32_t ext1, int32_t ext2, void *user) { + gUserNotifyCb(msg_type, ext1, ext2, gUserCameraDevice); +} + +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, @@ -218,195 +213,203 @@ static void camera_set_callbacks(struct camera_device *device, camera_request_memory get_memory, void *user) { - ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, - (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if (!device) return; - VENDOR_CALL(device, set_callbacks, notify_cb, data_cb, data_cb_timestamp, get_memory, user); + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, + (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + + gUserNotifyCb = notify_cb; + gUserDataCb = data_cb; + gUserDataCbTimestamp = data_cb_timestamp; + gUserGetMemory = get_memory; + gUserCameraDevice = user; + + VENDOR_CALL(device, set_callbacks, camera_notify_cb, camera_data_cb, + camera_data_cb_timestamp, camera_get_memory, user); } static void camera_enable_msg_type(struct camera_device *device, int32_t msg_type) { - ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, - (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if (!device) return; + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, + (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + VENDOR_CALL(device, enable_msg_type, msg_type); } static void camera_disable_msg_type(struct camera_device *device, int32_t msg_type) { - ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, - (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if (!device) return; + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, + (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + VENDOR_CALL(device, disable_msg_type, msg_type); } static int camera_msg_type_enabled(struct camera_device *device, int32_t msg_type) { - ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, - (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if (!device) return 0; + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, + (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + return VENDOR_CALL(device, msg_type_enabled, msg_type); } static int camera_start_preview(struct camera_device *device) { - ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, - (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if (!device) return -EINVAL; + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, + (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + return VENDOR_CALL(device, start_preview); } static void camera_stop_preview(struct camera_device *device) { - ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, - (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if (!device) return; + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, + (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + VENDOR_CALL(device, stop_preview); } static int camera_preview_enabled(struct camera_device *device) { - ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, - (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if (!device) return -EINVAL; + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, + (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + return VENDOR_CALL(device, preview_enabled); } static int camera_store_meta_data_in_buffers(struct camera_device *device, int enable) { - ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, - (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if (!device) return -EINVAL; + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, + (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + return VENDOR_CALL(device, store_meta_data_in_buffers, enable); } static int camera_start_recording(struct camera_device *device) { - ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, - (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if (!device) return EINVAL; + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, + (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + return VENDOR_CALL(device, start_recording); } static void camera_stop_recording(struct camera_device *device) { - ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, - (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if (!device) return; + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, + (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + VENDOR_CALL(device, stop_recording); } static int camera_recording_enabled(struct camera_device *device) { - ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, - (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if (!device) return -EINVAL; + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, + (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + return VENDOR_CALL(device, recording_enabled); } static void camera_release_recording_frame(struct camera_device *device, const void *opaque) { - ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, - (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if (!device) return; + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, + (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + VENDOR_CALL(device, release_recording_frame, opaque); } static int camera_auto_focus(struct camera_device *device) { - ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, - (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if (!device) return -EINVAL; + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, + (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + return VENDOR_CALL(device, auto_focus); } static int camera_cancel_auto_focus(struct camera_device *device) { - ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, - (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if (!device) return -EINVAL; + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, + (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + return VENDOR_CALL(device, cancel_auto_focus); } static int camera_take_picture(struct camera_device *device) { - ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, - (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if (!device) return -EINVAL; + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, + (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + return VENDOR_CALL(device, take_picture); } static int camera_cancel_picture(struct camera_device *device) { - ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, - (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if (!device) return -EINVAL; + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, + (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + return VENDOR_CALL(device, cancel_picture); } -static int camera_set_parameters(struct camera_device *device, const char *params) +static int camera_set_parameters(struct camera_device *device, + const char *params) { - ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, - (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if (!device) return -EINVAL; + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, + (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + char *tmp = NULL; - tmp = camera_fixup_setparams(device, params); + tmp = camera_fixup_setparams(CAMERA_ID(device), params); int ret = VENDOR_CALL(device, set_parameters, tmp); return ret; @@ -414,26 +417,22 @@ static int camera_set_parameters(struct camera_device *device, const char *param static char *camera_get_parameters(struct camera_device *device) { - ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, - (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if (!device) return NULL; + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, + (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + char *params = VENDOR_CALL(device, get_parameters); char *tmp = camera_fixup_getparams(CAMERA_ID(device), params); VENDOR_CALL(device, put_parameters, params); params = tmp; - return params; } static void camera_put_parameters(struct camera_device *device, char *params) { - ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, - (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if (params) free(params); } @@ -441,34 +440,40 @@ static void camera_put_parameters(struct camera_device *device, char *params) static int camera_send_command(struct camera_device *device, int32_t cmd, int32_t arg1, int32_t arg2) { - ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, - (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if (!device) return -EINVAL; + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, + (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + return VENDOR_CALL(device, send_command, cmd, arg1, arg2); } static void camera_release(struct camera_device *device) { - ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, - (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + 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, + (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + VENDOR_CALL(device, release); + + wrapper_dev->camera_released = true; } static int camera_dump(struct camera_device *device, int fd) { - ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, - (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - if (!device) return -EINVAL; + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, + (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); + return VENDOR_CALL(device, dump, fd); } @@ -481,7 +486,7 @@ static int camera_device_close(hw_device_t *device) ALOGV("%s", __FUNCTION__); - android::Mutex::Autolock lock(gCameraWrapperLock); + Mutex::Autolock lock(gCameraWrapperLock); if (!device) { ret = -EINVAL; @@ -495,6 +500,15 @@ static int camera_device_close(hw_device_t *device) wrapper_dev = (wrapper_camera_device_t*) device; + if (!wrapper_dev->camera_released) { + ALOGI("%s: releasing camera device with id %d", __FUNCTION__, + wrapper_dev->id); + + VENDOR_CALL(wrapper_dev, release); + + wrapper_dev->camera_released = true; + } + wrapper_dev->vendor->common.close((hw_device_t*)wrapper_dev->vendor); if (wrapper_dev->base.ops) free(wrapper_dev->base.ops); @@ -525,7 +539,7 @@ static int camera_device_open(const hw_module_t *module, const char *name, wrapper_camera_device_t *camera_device = NULL; camera_device_ops_t *camera_ops = NULL; - android::Mutex::Autolock lock(gCameraWrapperLock); + Mutex::Autolock lock(gCameraWrapperLock); ALOGV("%s", __FUNCTION__); @@ -559,6 +573,7 @@ static int camera_device_open(const hw_module_t *module, const char *name, goto fail; } memset(camera_device, 0, sizeof(*camera_device)); + camera_device->camera_released = false; camera_device->id = cameraid; rv = gVendorModule->common.methods->open( @@ -581,7 +596,7 @@ static int camera_device_open(const hw_module_t *module, const char *name, memset(camera_ops, 0, sizeof(*camera_ops)); camera_device->base.common.tag = HARDWARE_DEVICE_TAG; - camera_device->base.common.version = HARDWARE_DEVICE_API_VERSION(1, 0); + camera_device->base.common.version = CAMERA_MODULE_API_VERSION_1_0; camera_device->base.common.module = (hw_module_t *)(module); camera_device->base.common.close = camera_device_close; camera_device->base.ops = camera_ops; @@ -643,3 +658,11 @@ static int camera_get_camera_info(int camera_id, struct camera_info *info) return 0; 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); +} diff --git a/camera/CameraWrapper.h b/camera/CameraWrapper.h new file mode 100644 index 0000000..76eacec --- /dev/null +++ b/camera/CameraWrapper.h @@ -0,0 +1,19 @@ +/* + * 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 + +static int camera_set_torch_mode(const char* camera_id, bool enabled); diff --git a/include/camera/CameraParametersExtra.h b/include/camera/CameraParametersExtra.h deleted file mode 100644 index b312a49..0000000 --- a/include/camera/CameraParametersExtra.h +++ /dev/null @@ -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); - diff --git a/manifest.xml b/manifest.xml index bcb06f5..e73413f 100644 --- a/manifest.xml +++ b/manifest.xml @@ -11,7 +11,7 @@ android.hardware.wifi hwbinder - 1.0 + 1.1 IWifi default diff --git a/msm8226.mk b/msm8226.mk index 124b092..976d70c 100644 --- a/msm8226.mk +++ b/msm8226.mk @@ -27,26 +27,25 @@ TARGET_SCREEN_WIDTH := 720 # Audio PRODUCT_PACKAGES += \ - audiod \ + android.hardware.audio@2.0-impl \ + android.hardware.audio.effect@2.0-impl \ + audio_policy.msm8974 \ audio.a2dp.default \ audio.primary.msm8226 \ audio.r_submix.default \ - audio.usb.default - -# Also Audio -PRODUCT_PACKAGES += \ - android.hardware.audio@2.0-impl \ - android.hardware.audio.effect@2.0-impl \ - android.hardware.broadcastradio@1.0-impl \ - android.hardware.soundtrigger@2.0-impl - -PRODUCT_PACKAGES += \ + audio.usb.default \ libaudio-resampler \ - libqcompostprocbundle \ libqcomvisualizer \ + libqcompostprocbundle \ libqcomvoiceprocessing \ tinymix +# System properties +PRODUCT_PROPERTY_OVERRIDES += \ + audio.offload.buffer.size.kb=32 \ + audio.offload.gapless.enabled=false \ + av.offload.enable=true + PRODUCT_PACKAGES += \ libwvm_shim @@ -54,11 +53,9 @@ PRODUCT_PACKAGES += \ PRODUCT_PACKAGES += \ android.hardware.camera.provider@2.4-impl \ camera.device@1.0-impl \ - camera.vendor.msm8226 \ - camera.msm8226 \ libboringssl-compat \ - libxml2 \ - Snap + camera.msm8226 \ + libxml2 # CRDA PRODUCT_PACKAGES += \ @@ -75,7 +72,6 @@ PRODUCT_PACKAGES += \ memtrack.msm8226 \ android.hardware.graphics.allocator@2.0-impl \ android.hardware.graphics.allocator@2.0-service \ - android.hardware.graphics.composer@2.1-impl \ android.hardware.graphics.mapper@2.0-impl \ android.hardware.memtrack@1.0-impl diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index 16c367c..88ba24f 100644 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -1,24 +1,26 @@ - - - - 4dp + + + + + 3300 + + + + "/system/framework/arm/boot-framework.oat" + "/system/framework/arm/boot-framework.vdex" + "/system/framework/oat/arm/services.odex" + "/system/framework/oat/arm/services.vdex" + "/system/framework/arm/boot.oat" + "/system/framework/arm/boot.vdex" + "/system/framework/arm/boot-core-libart.oat" + "/system/framework/arm/boot-core-libart.vdex" + + + + true + false + diff --git a/power/Android.mk b/power/Android.mk index 6abb76a..f38ef9d 100644 --- a/power/Android.mk +++ b/power/Android.mk @@ -1,5 +1,5 @@ # -# Copyright 2015 The CyanogenMod Project +# Copyright 2016 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. @@ -15,11 +15,12 @@ # LOCAL_PATH:= $(call my-dir) - include $(CLEAR_VARS) -LOCAL_MODULE_RELATIVE_PATH := hw +LOCAL_C_INCLUDES := $(TARGET_POWERHAL_HEADER_PATH) LOCAL_SRC_FILES := power.c LOCAL_SHARED_LIBRARIES := liblog libcutils +LOCAL_MODULE_RELATIVE_PATH := hw LOCAL_MODULE_TAGS := optional -LOCAL_MODULE := power.$(TARGET_BOARD_PLATFORM) +LOCAL_MODULE := power.msm8226 +LOCAL_PROPRIETARY_MODULE := true include $(BUILD_SHARED_LIBRARY) diff --git a/power/power.c b/power/power.c index 6a604c6..93a7aaf 100644 --- a/power/power.c +++ b/power/power.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015 The CyanogenMod Project + * Copyright (C) 2016 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. @@ -18,27 +18,23 @@ #include #include -#include #include #include #include - -#include -#include -#include +#include #include #include "power.h" +#define CPUFREQ_PATH "/sys/devices/system/cpu/cpu0/cpufreq/" +#define INTERACTIVE_PATH "/sys/devices/system/cpu/cpufreq/interactive/" + /* touchkeys */ #define TK_POWER "/sys/class/input/input1/enabled" /* touchscreen */ #define TS_POWER "/sys/class/input/input2/enabled" -#define CPUFREQ_PATH "/sys/devices/system/cpu/cpu0/cpufreq/" -#define INTERACTIVE_PATH "/sys/devices/system/cpu/cpufreq/interactive/" - static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; static int boostpulse_fd = -1; @@ -78,15 +74,6 @@ static int sysfs_write_int(char *path, int value) return sysfs_write_str(path, buf); } -static bool check_governor(void) -{ - struct stat s; - int err = stat(INTERACTIVE_PATH, &s); - if (err != 0) return false; - if (S_ISDIR(s.st_mode)) return true; - return false; -} - static int is_profile_valid(int profile) { return profile >= 0 && profile < PROFILE_MAX; @@ -123,23 +110,24 @@ static void power_set_interactive(__attribute__((unused)) struct power_module *m power_set_interactive_ext(on); - // break out early if governor is not interactive - if (!check_governor()) return; - if (on) { sysfs_write_int(INTERACTIVE_PATH "hispeed_freq", profiles[current_power_profile].hispeed_freq); sysfs_write_int(INTERACTIVE_PATH "go_hispeed_load", profiles[current_power_profile].go_hispeed_load); - sysfs_write_str(INTERACTIVE_PATH "target_loads", + sysfs_write_int(INTERACTIVE_PATH "target_loads", profiles[current_power_profile].target_loads); + sysfs_write_int(CPUFREQ_PATH "scaling_min_freq", + profiles[current_power_profile].scaling_min_freq); } else { sysfs_write_int(INTERACTIVE_PATH "hispeed_freq", profiles[current_power_profile].hispeed_freq_off); sysfs_write_int(INTERACTIVE_PATH "go_hispeed_load", profiles[current_power_profile].go_hispeed_load_off); - sysfs_write_str(INTERACTIVE_PATH "target_loads", + sysfs_write_int(INTERACTIVE_PATH "target_loads", profiles[current_power_profile].target_loads_off); + sysfs_write_int(CPUFREQ_PATH "scaling_min_freq", + profiles[current_power_profile].scaling_min_freq_off); } } @@ -150,9 +138,6 @@ static void set_power_profile(int profile) return; } - // break out early if governor is not interactive - if (!check_governor()) return; - if (profile == current_power_profile) return; @@ -166,16 +151,18 @@ static void set_power_profile(int profile) profiles[profile].go_hispeed_load); sysfs_write_int(INTERACTIVE_PATH "hispeed_freq", profiles[profile].hispeed_freq); - sysfs_write_int(INTERACTIVE_PATH "io_is_busy", - profiles[profile].io_is_busy); sysfs_write_int(INTERACTIVE_PATH "min_sample_time", profiles[profile].min_sample_time); - sysfs_write_int(INTERACTIVE_PATH "sampling_down_factor", - profiles[profile].sampling_down_factor); - sysfs_write_str(INTERACTIVE_PATH "target_loads", + sysfs_write_int(INTERACTIVE_PATH "timer_rate", + profiles[profile].timer_rate); + sysfs_write_int(INTERACTIVE_PATH "above_hispeed_delay", + profiles[profile].above_hispeed_delay); + sysfs_write_int(INTERACTIVE_PATH "target_loads", profiles[profile].target_loads); sysfs_write_int(CPUFREQ_PATH "scaling_max_freq", profiles[profile].scaling_max_freq); + sysfs_write_int(CPUFREQ_PATH "scaling_min_freq", + profiles[profile].scaling_min_freq); current_power_profile = profile; } @@ -196,9 +183,6 @@ static void power_hint(__attribute__((unused)) struct power_module *module, if (!profiles[current_power_profile].boostpulse_duration) return; - // break out early if governor is not interactive - if (!check_governor()) return; - if (boostpulse_open() >= 0) { snprintf(buf, sizeof(buf), "%d", 1); len = write(boostpulse_fd, &buf, sizeof(buf)); @@ -226,10 +210,6 @@ static void power_hint(__attribute__((unused)) struct power_module *module, } } -static struct hw_module_methods_t power_module_methods = { - .open = NULL, -}; - static int get_feature(__attribute__((unused)) struct power_module *module, feature_t feature) { @@ -239,6 +219,43 @@ static int get_feature(__attribute__((unused)) struct power_module *module, return -1; } +static int power_open(const hw_module_t* module, const char* name, + hw_device_t** device) +{ + ALOGD("%s: enter; name=%s", __FUNCTION__, name); + + if (strcmp(name, POWER_HARDWARE_MODULE_ID)) { + return -EINVAL; + } + + power_module_t *dev = (power_module_t *)calloc(1, + sizeof(power_module_t)); + + if (!dev) { + ALOGD("%s: failed to allocate memory", __FUNCTION__); + return -ENOMEM; + } + + dev->common.tag = HARDWARE_MODULE_TAG; + dev->common.module_api_version = POWER_MODULE_API_VERSION_0_2; + dev->common.hal_api_version = HARDWARE_HAL_API_VERSION; + + dev->init = power_init; + dev->powerHint = power_hint; // This is handled by framework + dev->setInteractive = power_set_interactive; + dev->getFeature = get_feature; + + *device = (hw_device_t*)dev; + + ALOGD("%s: exit", __FUNCTION__); + + return 0; +} + +static struct hw_module_methods_t power_module_methods = { + .open = power_open, +}; + struct power_module HAL_MODULE_INFO_SYM = { .common = { .tag = HARDWARE_MODULE_TAG, @@ -246,7 +263,7 @@ struct power_module HAL_MODULE_INFO_SYM = { .hal_api_version = HARDWARE_HAL_API_VERSION, .id = POWER_HARDWARE_MODULE_ID, .name = "msm8226 Power HAL", - .author = "Gabriele M", + .author = "The LineageOS Project", .methods = &power_module_methods, }, diff --git a/power/power.h b/power/power.h index f6f9711..62aa806 100644 --- a/power/power.h +++ b/power/power.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015 The CyanogenMod Project + * Copyright (C) 2016 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. @@ -30,12 +30,14 @@ typedef struct governor_settings { int go_hispeed_load_off; int hispeed_freq; int hispeed_freq_off; - int io_is_busy; int min_sample_time; - int sampling_down_factor; - char *target_loads; - char *target_loads_off; + int timer_rate; + int above_hispeed_delay; + int target_loads; + int target_loads_off; int scaling_max_freq; + int scaling_min_freq; + int scaling_min_freq_off; } power_profile; static power_profile profiles[PROFILE_MAX] = { @@ -44,55 +46,65 @@ static power_profile profiles[PROFILE_MAX] = { .boostpulse_duration = 0, .go_hispeed_load = 90, .go_hispeed_load_off = 90, - .hispeed_freq = 787200, - .hispeed_freq_off = 787200, - .io_is_busy = 0, + .hispeed_freq = 800000, + .hispeed_freq_off = 800000, .min_sample_time = 60000, - .sampling_down_factor = 100000, - .target_loads = "95 1401600:99", - .target_loads_off = "95 1401600:99", - .scaling_max_freq = 787200, + .timer_rate = 20000, + .above_hispeed_delay = 20000, + .target_loads = 90, + .target_loads_off = 90, + .scaling_max_freq = 998400, + .scaling_min_freq = 400000, + .scaling_min_freq_off = 200000, }, [PROFILE_BALANCED] = { .boost = 0, .boostpulse_duration = 60000, - .go_hispeed_load = 50, + .go_hispeed_load = 80, .go_hispeed_load_off = 90, .hispeed_freq = 998400, - .hispeed_freq_off = 787200, - .io_is_busy = 1, + .hispeed_freq_off = 800000, .min_sample_time = 60000, - .sampling_down_factor = 100000, - .target_loads = "80 998400:90 1401600:99", - .target_loads_off = "95 1401600:99", - .scaling_max_freq = 1401600, + .timer_rate = 20000, + .above_hispeed_delay = 20000, + .target_loads = 80, + .target_loads_off = 90, + .scaling_max_freq = 1209600, + .scaling_min_freq = 800000, + .scaling_min_freq_off = 200000, }, [PROFILE_HIGH_PERFORMANCE] = { .boost = 1, - .boostpulse_duration = 0, /* prevent unnecessary write */ - .go_hispeed_load = 50, - .go_hispeed_load_off = 50, + /* The CPU is already boosted, set duration to zero + * to avoid unneccessary writes to boostpulse */ + .boostpulse_duration = 0, + .go_hispeed_load = 60, + .go_hispeed_load_off = 70, .hispeed_freq = 998400, .hispeed_freq_off = 998400, - .io_is_busy = 1, .min_sample_time = 60000, - .sampling_down_factor = 100000, - .target_loads = "80", - .target_loads_off = "80", - .scaling_max_freq = 1401600, + .timer_rate = 20000, + .above_hispeed_delay = 20000, + .target_loads = 60, + .target_loads_off = 70, + .scaling_max_freq = 1209600, + .scaling_min_freq = 800000, + .scaling_min_freq_off = 200000, }, [PROFILE_BIAS_POWER_SAVE] = { .boost = 0, - .boostpulse_duration = 0, + .boostpulse_duration = 40000, .go_hispeed_load = 90, .go_hispeed_load_off = 90, - .hispeed_freq = 787200, - .hispeed_freq_off = 787200, - .io_is_busy = 0, + .hispeed_freq = 800000, + .hispeed_freq_off = 800000, .min_sample_time = 60000, - .sampling_down_factor = 100000, - .target_loads = "95 1401600:99", - .target_loads_off = "95 1401600:99", - .scaling_max_freq = 1401600, + .timer_rate = 20000, + .above_hispeed_delay = 20000, + .target_loads = 90, + .target_loads_off = 90, + .scaling_max_freq = 1209600, + .scaling_min_freq = 400000, + .scaling_min_freq_off = 200000, }, }; diff --git a/ril/Android.mk b/ril/Android.mk deleted file mode 100644 index ae97e0a..0000000 --- a/ril/Android.mk +++ /dev/null @@ -1,13 +0,0 @@ -LOCAL_PATH := $(call my-dir) - -include $(CLEAR_VARS) - -LOCAL_SHARED_LIBRARIES := liblog libcutils libbinder libutils - -LOCAL_SRC_FILES := \ - ril_shim.c - -LOCAL_MODULE := libril_shim -LOCAL_MODULE_CLASS := SHARED_LIBRARIES - -include $(BUILD_SHARED_LIBRARY) diff --git a/ril/ril_shim.c b/ril/ril_shim.c deleted file mode 100644 index 45b0678..0000000 --- a/ril/ril_shim.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (C) 2015 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 LOG_TAG "SEC_RIL_SHIM" -#include -#include -#include - -#include - -//various funcs we'll need to call, in their mangled form - -//android::Parcel::writeString16(char16_t const*, unsigned int) -extern void _ZN7android6Parcel13writeString16EPKDsj(void **str16P, - uint16_t const *str, unsigned int len); - -//code exports we provide - -void _ZN7android6Parcel13writeString16EPKtj(void **str16P, - unsigned short const *str, unsigned int len); - -//library on-load and on-unload handlers (to help us set things up and tear them down) -void libEvtLoading(void) __attribute__((constructor)); -void libEvtUnloading(void) __attribute__((destructor)); - -/* - * FUNCTION: android::Parcel::writeString16(unsigned short const*, unsigned int) - * USE: INTERPOSE: write String16 to binder - * NOTES: This function no longer exists in M, instead now one must pass - * in a char16_t instead of a short. M So we'll craft the same call here. - */ -void _ZN7android6Parcel13writeString16EPKtj(void **str16P, - unsigned short const *str, unsigned int len) -{ - _ZN7android6Parcel13writeString16EPKDsj(str16P, str, len); -} - -/* - * FUNCTION: libEvtLoading() - * USE: Handle library loading - * NOTES: This is a good time to log the fact that we were loaded and plan to - * do our thing. - */ -void libEvtLoading(void) -{ - ALOGV("libbinder interposition library loaded"); -} - -/* - * FUNCTION: libEvtUnloading() - * USE: Handle library unloading - * NOTES: This is a good time to free whatever is unfreed and say goodbye - */ -void libEvtUnloading(void) -{ - ALOGV("libbinder interposition library unloading. Goodbye..."); -} \ No newline at end of file diff --git a/ril/telephony/java/com/android/internal/telephony/SamsungMSM8226RIL.java b/ril/telephony/java/com/android/internal/telephony/SamsungMSM8226RIL.java deleted file mode 100644 index cfe5e5e..0000000 --- a/ril/telephony/java/com/android/internal/telephony/SamsungMSM8226RIL.java +++ /dev/null @@ -1,375 +0,0 @@ -/* - * Copyright (c) 2014, The CyanogenMod Project. All rights reserved. - * - * 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 com.android.internal.telephony; - -import static com.android.internal.telephony.RILConstants.*; - -import android.content.Context; -import android.telephony.Rlog; -import android.os.AsyncResult; -import android.os.Message; -import android.os.Parcel; -import android.os.SystemProperties; -import android.telephony.PhoneNumberUtils; -import android.telephony.SignalStrength; -import com.android.internal.telephony.uicc.IccCardApplicationStatus; -import com.android.internal.telephony.uicc.IccCardStatus; -import java.util.ArrayList; -import java.util.Collections; -import com.android.internal.telephony.uicc.IccUtils; - -/** - * Qualcomm RIL for Samsung MSM8226 Single-sim devices - * {@hide} - */ -public class SamsungMSM8226RIL extends RIL { - - private static final int RIL_REQUEST_DIAL_EMERGENCY = 10001; - private static final int RIL_UNSOL_ON_SS_LL = 11055; - - public SamsungMSM8226RIL(Context context, int preferredNetworkType, int cdmaSubscription) { - super(context, preferredNetworkType, cdmaSubscription, null); - mQANElements = 6; - } - - public SamsungMSM8226RIL(Context context, int preferredNetworkType, - int cdmaSubscription, Integer instanceId) { - super(context, preferredNetworkType, cdmaSubscription, instanceId); - mQANElements = 6; - } - - @Override - public void - dial(String address, int clirMode, UUSInfo uusInfo, Message result) { - if (PhoneNumberUtils.isEmergencyNumber(address)) { - dialEmergencyCall(address, clirMode, result); - return; - } - - RILRequest rr = RILRequest.obtain(RIL_REQUEST_DIAL, result); - - rr.mParcel.writeString(address); - rr.mParcel.writeInt(clirMode); - rr.mParcel.writeInt(0); // CallDetails.call_type - rr.mParcel.writeInt(1); // CallDetails.call_domain - rr.mParcel.writeString(""); // CallDetails.getCsvFromExtras - - if (uusInfo == null) { - rr.mParcel.writeInt(0); // UUS information is absent - } else { - rr.mParcel.writeInt(1); // UUS information is present - rr.mParcel.writeInt(uusInfo.getType()); - rr.mParcel.writeInt(uusInfo.getDcs()); - rr.mParcel.writeByteArray(uusInfo.getUserData()); - } - - if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); - - send(rr); - } - - @Override - protected Object - responseIccCardStatus(Parcel p) { - IccCardApplicationStatus appStatus; - - IccCardStatus cardStatus = new IccCardStatus(); - cardStatus.setCardState(p.readInt()); - cardStatus.setUniversalPinState(p.readInt()); - cardStatus.mGsmUmtsSubscriptionAppIndex = p.readInt(); - cardStatus.mCdmaSubscriptionAppIndex = p.readInt(); - cardStatus.mImsSubscriptionAppIndex = p.readInt(); - - int numApplications = p.readInt(); - - // limit to maximum allowed applications - if (numApplications > IccCardStatus.CARD_MAX_APPS) { - numApplications = IccCardStatus.CARD_MAX_APPS; - } - cardStatus.mApplications = new IccCardApplicationStatus[numApplications]; - - for (int i = 0 ; i < numApplications ; i++) { - appStatus = new IccCardApplicationStatus(); - appStatus.app_type = appStatus.AppTypeFromRILInt(p.readInt()); - appStatus.app_state = appStatus.AppStateFromRILInt(p.readInt()); - appStatus.perso_substate = appStatus.PersoSubstateFromRILInt(p.readInt()); - appStatus.aid = p.readString(); - appStatus.app_label = p.readString(); - appStatus.pin1_replaced = p.readInt(); - appStatus.pin1 = appStatus.PinStateFromRILInt(p.readInt()); - appStatus.pin2 = appStatus.PinStateFromRILInt(p.readInt()); - p.readInt(); // pin1_num_retries - p.readInt(); // puk1_num_retries - p.readInt(); // pin2_num_retries - p.readInt(); // puk2_num_retries - p.readInt(); // perso_unblock_retries - - cardStatus.mApplications[i] = appStatus; - } - return cardStatus; - } - - @Override - protected Object - responseCallList(Parcel p) { - int num; - int voiceSettings; - ArrayList response; - DriverCall dc; - - num = p.readInt(); - response = new ArrayList(num); - - if (RILJ_LOGV) { - riljLog("responseCallList: num=" + num + - " mEmergencyCallbackModeRegistrant=" + mEmergencyCallbackModeRegistrant + - " mTestingEmergencyCall=" + mTestingEmergencyCall.get()); - } - for (int i = 0 ; i < num ; i++) { - dc = new DriverCall(); - - dc.state = DriverCall.stateFromCLCC(p.readInt()); - dc.index = p.readInt() & 0xff; - dc.TOA = p.readInt(); - dc.isMpty = (0 != p.readInt()); - dc.isMT = (0 != p.readInt()); - dc.als = p.readInt(); - voiceSettings = p.readInt(); - dc.isVoice = (0 == voiceSettings) ? false : true; - boolean isVideo; - int call_type = p.readInt(); // Samsung CallDetails - int call_domain = p.readInt(); // Samsung CallDetails - String csv = p.readString(); // Samsung CallDetails - dc.isVoicePrivacy = (0 != p.readInt()); - dc.number = p.readString(); - int np = p.readInt(); - dc.numberPresentation = DriverCall.presentationFromCLIP(np); - dc.name = p.readString(); - dc.namePresentation = DriverCall.presentationFromCLIP(p.readInt()); - int uusInfoPresent = p.readInt(); - if (uusInfoPresent == 1) { - dc.uusInfo = new UUSInfo(); - dc.uusInfo.setType(p.readInt()); - dc.uusInfo.setDcs(p.readInt()); - byte[] userData = p.createByteArray(); - dc.uusInfo.setUserData(userData); - riljLogv(String.format("Incoming UUS : type=%d, dcs=%d, length=%d", - dc.uusInfo.getType(), dc.uusInfo.getDcs(), - dc.uusInfo.getUserData().length)); - riljLogv("Incoming UUS : data (string)=" - + new String(dc.uusInfo.getUserData())); - riljLogv("Incoming UUS : data (hex): " - + IccUtils.bytesToHexString(dc.uusInfo.getUserData())); - } else { - riljLogv("Incoming UUS : NOT present!"); - } - - // Make sure there's a leading + on addresses with a TOA of 145 - dc.number = PhoneNumberUtils.stringFromStringAndTOA(dc.number, dc.TOA); - - response.add(dc); - - if (dc.isVoicePrivacy) { - mVoicePrivacyOnRegistrants.notifyRegistrants(); - riljLog("InCall VoicePrivacy is enabled"); - } else { - mVoicePrivacyOffRegistrants.notifyRegistrants(); - riljLog("InCall VoicePrivacy is disabled"); - } - } - - Collections.sort(response); - - if ((num == 0) && mTestingEmergencyCall.getAndSet(false)) { - if (mEmergencyCallbackModeRegistrant != null) { - riljLog("responseCallList: call ended, testing emergency call," + - " notify ECM Registrants"); - mEmergencyCallbackModeRegistrant.notifyRegistrant(); - } - } - - return response; - } - - @Override - protected Object - responseSignalStrength(Parcel p) { - int gsmSignalStrength = p.readInt() & 0xff; - int gsmBitErrorRate = p.readInt(); - int cdmaDbm = p.readInt(); - int cdmaEcio = p.readInt(); - int evdoDbm = p.readInt(); - int evdoEcio = p.readInt(); - int evdoSnr = p.readInt(); - int lteSignalStrength = p.readInt(); - int lteRsrp = p.readInt(); - int lteRsrq = p.readInt(); - int lteRssnr = p.readInt(); - int lteCqi = p.readInt(); - int tdScdmaRscp = p.readInt(); - // constructor sets default true, makeSignalStrengthFromRilParcel does not set it - boolean isGsm = true; - - if ((lteSignalStrength & 0xff) == 255 || lteSignalStrength == 99) { - lteSignalStrength = 99; - lteRsrp = SignalStrength.INVALID; - lteRsrq = SignalStrength.INVALID; - lteRssnr = SignalStrength.INVALID; - lteCqi = SignalStrength.INVALID; - } else { - lteSignalStrength &= 0xff; - } - - if (RILJ_LOGD) - riljLog("gsmSignalStrength:" + gsmSignalStrength + " gsmBitErrorRate:" + gsmBitErrorRate + - " cdmaDbm:" + cdmaDbm + " cdmaEcio:" + cdmaEcio + " evdoDbm:" + evdoDbm + - " evdoEcio: " + evdoEcio + " evdoSnr:" + evdoSnr + - " lteSignalStrength:" + lteSignalStrength + " lteRsrp:" + lteRsrp + - " lteRsrq:" + lteRsrq + " lteRssnr:" + lteRssnr + " lteCqi:" + lteCqi + - " tdScdmaRscp:" + tdScdmaRscp + " isGsm:" + (isGsm ? "true" : "false")); - - return new SignalStrength(gsmSignalStrength, gsmBitErrorRate, cdmaDbm, cdmaEcio, evdoDbm, - evdoEcio, evdoSnr, lteSignalStrength, lteRsrp, lteRsrq, lteRssnr, lteCqi, - tdScdmaRscp, isGsm); - } - - @Override - protected void - processUnsolicited (Parcel p, int type) { - Object ret; - int dataPosition = p.dataPosition(); - int response = p.readInt(); - int newResponse = response; - - switch(response) { - case RIL_UNSOL_ON_SS_LL: - newResponse = RIL_UNSOL_ON_SS; - break; - } - if (newResponse != response) { - p.setDataPosition(dataPosition); - p.writeInt(newResponse); - } - p.setDataPosition(dataPosition); - super.processUnsolicited(p, type); - } - - @Override - public void - acceptCall (Message result) { - RILRequest rr - = RILRequest.obtain(RIL_REQUEST_ANSWER, result); - - rr.mParcel.writeInt(1); - rr.mParcel.writeInt(0); - - if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); - - send(rr); - } - - - private void - dialEmergencyCall(String address, int clirMode, Message result) { - RILRequest rr; - - rr = RILRequest.obtain(RIL_REQUEST_DIAL_EMERGENCY, result); - rr.mParcel.writeString(address); - rr.mParcel.writeInt(clirMode); - rr.mParcel.writeInt(0); // CallDetails.call_type - rr.mParcel.writeInt(3); // CallDetails.call_domain - rr.mParcel.writeString(""); // CallDetails.getCsvFromExtra - rr.mParcel.writeInt(0); // Unknown - - if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); - - send(rr); - } - - @Override - protected RILRequest - processSolicited (Parcel p, int type) { - int serial, error; - boolean found = false; - int dataPosition = p.dataPosition(); // save off position within the Parcel - serial = p.readInt(); - error = p.readInt(); - RILRequest rr = null; - /* Pre-process the reply before popping it */ - synchronized (mRequestList) { - RILRequest tr = mRequestList.get(serial); - if (tr != null && tr.mSerial == serial) { - if (error == 0 || p.dataAvail() > 0) { - try {switch (tr.mRequest) { - /* Get those we're interested in */ - case RIL_REQUEST_DATA_REGISTRATION_STATE: - rr = tr; - break; - }} catch (Throwable thr) { - // Exceptions here usually mean invalid RIL responses - if (tr.mResult != null) { - AsyncResult.forMessage(tr.mResult, null, thr); - tr.mResult.sendToTarget(); - } - return tr; - } - } - } - } - if (rr == null) { - /* Nothing we care about, go up */ - p.setDataPosition(dataPosition); - // Forward responses that we are not overriding to the super class - return super.processSolicited(p, type); - } - rr = findAndRemoveRequestFromList(serial); - if (rr == null) { - return rr; - } - Object ret = null; - if (error == 0 || p.dataAvail() > 0) { - switch (rr.mRequest) { - case RIL_REQUEST_DATA_REGISTRATION_STATE: ret = responseDataRegistrationState(p); break; - default: - throw new RuntimeException("Unrecognized solicited response: " + rr.mRequest); - } - //break; - } - if (RILJ_LOGD) riljLog(rr.serialString() + "< " + requestToString(rr.mRequest) - + " " + retToString(rr.mRequest, ret)); - if (rr.mResult != null) { - AsyncResult.forMessage(rr.mResult, ret, null); - rr.mResult.sendToTarget(); - } - return rr; - } - - private Object - responseDataRegistrationState(Parcel p) { - String response[] = (String[])responseStrings(p); - /* DANGER WILL ROBINSON - * In some cases from Vodaphone we are receiving a RAT of 102 - * while in tunnels of the metro. Lets Assume that if we - * receive 102 we actually want a RAT of 2 for EDGE service */ - if (response.length > 4 && - response[0].equals("1") && - response[3].equals("102")) { - response[3] = "2"; - } - return response; - } -} \ No newline at end of file diff --git a/rootdir/init.qcom.power.rc b/rootdir/init.qcom.power.rc index 29474f3..eaef84b 100644 --- a/rootdir/init.qcom.power.rc +++ b/rootdir/init.qcom.power.rc @@ -1,89 +1,73 @@ -# Copyright (c) 2009-2012, The Linux Foundation. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# * Neither the name of The Linux Foundation nor -# the names of its contributors may be used to endorse or promote -# products derived from this software without specific prior written -# permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# +on init -on enable-low-power - write /sys/module/lpm_levels/enable_low_power/l2 4 - write /sys/module/msm_pm/modes/cpu0/power_collapse/suspend_enabled 1 - write /sys/module/msm_pm/modes/cpu1/power_collapse/suspend_enabled 1 - write /sys/module/msm_pm/modes/cpu2/power_collapse/suspend_enabled 1 - write /sys/module/msm_pm/modes/cpu3/power_collapse/suspend_enabled 1 - write /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/suspend_enabled 1 - write /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/suspend_enabled 1 - write /sys/module/msm_pm/modes/cpu2/standalone_power_collapse/suspend_enabled 1 - write /sys/module/msm_pm/modes/cpu3/standalone_power_collapse/suspend_enabled 1 - write /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/idle_enabled 1 - write /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/idle_enabled 1 - write /sys/module/msm_pm/modes/cpu2/standalone_power_collapse/idle_enabled 1 - write /sys/module/msm_pm/modes/cpu3/standalone_power_collapse/idle_enabled 1 - write /sys/module/msm_pm/modes/cpu0/power_collapse/idle_enabled 1 + # HMP scheduler settings + write /proc/sys/kernel/sched_ravg_hist_size 3 + write /proc/sys/kernel/sched_window_stats_policy 3 + # HMP Task packing settings for 8226 + write /proc/sys/kernel/sched_small_task 50 + + # disable thermal core_control to update interactive governor settings write /sys/module/msm_thermal/core_control/enabled 0 + # Switch to interactive and let PowerHAL configure it + write /sys/devices/system/cpu/cpu0/online 1 + write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor "interactive" + chown system system /sys/devices/system/cpu/cpufreq/interactive/boostpulse + chmod 0644 /sys/devices/system/cpu/cpufreq/interactive/boostpulse + chown system system /sys/devices/system/cpu/cpu0/cpufreq/interactive/go_hispeed_load + chmod 0644 /sys/devices/system/cpu/cpu0/cpufreq/interactive/go_hispeed_load + chown system system /sys/devices/system/cpu/cpu0/cpufreq/interactive/hispeed_freq + chmod 0644 /sys/devices/system/cpu/cpu0/cpufreq/interactive/hispeed_freq + chown system system /sys/devices/system/cpu/cpufreq/interactive/min_sample_time + chmod 0644 /sys/devices/system/cpu/cpufreq/interactive/min_sample_time + chown system system /sys/devices/system/cpu/cpufreq/interactive/timer_rate + chmod 0644 /sys/devices/system/cpu/cpufreq/interactive/timer_rate + chown system system /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay + chmod 0644 /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay + chown system system /sys/devices/system/cpu/cpufreq/interactive/target_loads + chmod 0644 /sys/devices/system/cpu/cpufreq/interactive/target_loads + chown system system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq + chown system system /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq + + # enable thermal core_control now + write /sys/module/msm_thermal/core_control/enabled 1 + + # bring all CPUs online write /sys/devices/system/cpu/cpu1/online 1 write /sys/devices/system/cpu/cpu2/online 1 write /sys/devices/system/cpu/cpu3/online 1 - write /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq 300000 + # Enable low power modes + write /sys/module/lpm_levels/parameters/sleep_disabled 0 - write /sys/module/msm_thermal/core_control/enabled 1 + # Set RPS mask + write /sys/class/net/rmnet0/queues/rx-0/rps_cpus 2 + + # add a cpuset for the camera daemon + # we want all the cores for camera + mkdir /dev/cpuset/camera-daemon + chown system system /dev/cpuset/camera-daemon + chown system system /dev/cpuset/camera-daemon/tasks + chmod 0664 /dev/cpuset/camera-daemon/tasks + + # Update foreground and background cpusets + # Reserve CPU 3 for the top app + write /dev/cpuset/foreground/cpus 0-2 + write /dev/cpuset/background/cpus 0-2 + write /dev/cpuset/system-background/cpus 0-1 + write /dev/cpuset/top-app/cpus 0-3 + write /dev/cpuset/camera-daemon/cpus 0-3 on charger - write /sys/module/lpm_levels/enable_low_power/l2 4 - write /sys/module/msm_pm/modes/cpu0/power_collapse/suspend_enabled 1 - write /sys/module/msm_pm/modes/cpu1/power_collapse/suspend_enabled 1 - write /sys/module/msm_pm/modes/cpu2/power_collapse/suspend_enabled 1 - write /sys/module/msm_pm/modes/cpu3/power_collapse/suspend_enabled 1 - write /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/suspend_enabled 1 - write /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/suspend_enabled 1 - write /sys/module/msm_pm/modes/cpu2/standalone_power_collapse/suspend_enabled 1 - write /sys/module/msm_pm/modes/cpu3/standalone_power_collapse/suspend_enabled 1 - write /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/idle_enabled 1 - write /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/idle_enabled 1 - write /sys/module/msm_pm/modes/cpu2/standalone_power_collapse/idle_enabled 1 - write /sys/module/msm_pm/modes/cpu3/standalone_power_collapse/idle_enabled 1 - write /sys/module/msm_pm/modes/cpu0/power_collapse/idle_enabled 1 + write /sys/module/lpm_levels/parameters/sleep_disabled 0 + write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor "powersave" - write /sys/module/msm_thermal/core_control/enabled 0 - - write /sys/devices/system/cpu/cpu1/online 1 - write /sys/devices/system/cpu/cpu2/online 1 - write /sys/devices/system/cpu/cpu3/online 1 - - write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor powersave - write /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq 300000 - - write /sys/module/msm_thermal/core_control/enabled 1 - - write /sys/devices/system/cpu/cpu1/online 0 - write /sys/devices/system/cpu/cpu2/online 0 - write /sys/devices/system/cpu/cpu3/online 0 - -on boot +on class_start:late_start trigger enable-low-power on property:init.svc.recovery=running trigger enable-low-power + +on property:dev.bootcomplete=1 + setprop sys.io.scheduler "bfq" diff --git a/rootdir/init.qcom.rc b/rootdir/init.qcom.rc index bdacd2a..dec28a5 100644 --- a/rootdir/init.qcom.rc +++ b/rootdir/init.qcom.rc @@ -30,7 +30,6 @@ import init.qcom.usb.rc import init.target.rc on early-init - export LD_SHIM_LIBS "/system/lib/hw/camera.vendor.msm8226.so|libboringssl-compat.so:/system/vendor/lib/libqomx_jpegenc.so|libboringssl-compat.so:/system/lib/libcrypto.so|libboringssl-compat.so:/system/lib/libril.so|libril_shim.so:/system/vendor/lib/libwvm.so|libwvm_shim.so" mount debugfs debugfs /sys/kernel/debug @@ -671,16 +670,3 @@ service dhcpcd_bnep3 /system/bin/dhcpcd -BKLG service dhcpcd_bnep4 /system/bin/dhcpcd -BKLG disabled oneshot - -# Dual-sim support -on property:persist.radio.multisim.config=dsds - stop ril-daemon - start ril-daemon - start ril-daemon1 - -service ril-daemon1 /vendor/bin/hw/rild -l /system/lib/libsec-ril-dsds.so -c 2 - class main - user radio - disabled - group radio cache inet misc audio log system drmrpc sdcard_r sdcard_rw shell wakelock - capabilities BLOCK_SUSPEND NET_ADMIN NET_RAW diff --git a/sepolicy/bluetooth.te b/sepolicy/bluetooth.te deleted file mode 100644 index 10b56e1..0000000 --- a/sepolicy/bluetooth.te +++ /dev/null @@ -1 +0,0 @@ -allow bluetooth bluetooth_efs_file:file read; diff --git a/sepolicy/camera.te b/sepolicy/camera.te deleted file mode 100644 index 6e01c54..0000000 --- a/sepolicy/camera.te +++ /dev/null @@ -1,37 +0,0 @@ -# Qualcomm MSM camera -type camera, domain; -type camera_exec, exec_type, file_type; - -# Started by init -init_daemon_domain(camera) - -allow camera self:process execmem; - -allow camera camera_device:dir search; -allow camera { video_device camera_device }:chr_file rw_file_perms; -allow camera { surfaceflinger mediaserver }:fd use; - -# Create /data/cam_socket0 as camera_socket -type_transition camera system_data_file:sock_file camera_socket "cam_socket0"; -type_transition camera system_data_file:sock_file camera_socket "cam_socket1"; -allow camera camera_socket:sock_file { create unlink }; -allow camera system_data_file:dir remove_name; -allow camera system_data_file:sock_file unlink; - -# All others under /data get camera_data_file -file_type_auto_trans(camera, system_data_file, camera_data_file); -allow camera camera_data_file:dir { write add_name }; -allow camera camera_data_file:file create_file_perms; - -# Connect to /data/app/sensor_ctl_socket -unix_socket_connect(camera, sensors, sensors) -allow camera sensors_socket:sock_file read; - -allow camera devpts:chr_file { read write getattr }; -allow camera device:chr_file { ioctl }; -allow camera mpdecision:unix_stream_socket connectto; -allow camera servicemanager:binder call; -allow camera socket_device:sock_file write; -#allow camera system:binder call; -#allow camera system:unix_stream_socket { read write setopt }; -allow camera system_data_file:file { open }; diff --git a/sepolicy/cameraserver.te b/sepolicy/cameraserver.te deleted file mode 100644 index 7c38d24..0000000 --- a/sepolicy/cameraserver.te +++ /dev/null @@ -1,3 +0,0 @@ -allow cameraserver system_data_file:sock_file write; -allow cameraserver camera_socket:sock_file write; -allow cameraserver mpctl_socket:dir search; diff --git a/sepolicy/device.te b/sepolicy/device.te deleted file mode 100644 index f789016..0000000 --- a/sepolicy/device.te +++ /dev/null @@ -1,2 +0,0 @@ -type io_device, dev_type; -type efs_block_device, dev_type; diff --git a/sepolicy/file.te b/sepolicy/file.te deleted file mode 100644 index f5c6255..0000000 --- a/sepolicy/file.te +++ /dev/null @@ -1,6 +0,0 @@ -type sensors_efs_file, file_type; -type sysfs_camera, fs_type, sysfs_type; -type sysfs_display, fs_type, sysfs_type; -type sysfs_vibeamp, fs_type, sysfs_type; -type wifi_efs_file, file_type; -type vcs_data_file, file_type, data_file_type; diff --git a/sepolicy/file_contexts b/sepolicy/file_contexts deleted file mode 100644 index 956db6b..0000000 --- a/sepolicy/file_contexts +++ /dev/null @@ -1,39 +0,0 @@ -# Bluetooth -/efs/bluetooth/bt_addr u:object_r:bluetooth_efs_file:s0 - -# Camera -/data/cam_socket.* u:object_r:camera_socket:s0 -/sys/devices/virtual/camera(/.*)? u:object_r:sysfs_camera:s0 - -# CMHW -/sys/devices/virtual/timed_output/vibrator(/.*)? u:object_r:sysfs_vibeamp:s0 -/sys/class/sec/sec_touchkey/keypad_enable u:object_r:sysfs_display:s0 - -# Display -/sys/devices/fd922800.qcom,mdss_dsi/lcd/panel/power_reduce u:object_r:sysfs_display:s0 - -# EFS -/dev/block/platform/msm_sdcc.1/by-name/efs u:object_r:efs_block_device:s0 - -# Fingerprint -/system/bin/vcsFPService u:object_r:vcs_exec:s0 -/data/validity(/.*)? u:object_r:vcs_data_file:s0 -/dev/validity(/.*)? u:object_r:vcs_device:s0 -/dev/vfsspi u:object_r:vcs_device:s0 - -# NFC -/dev/pn547 u:object_r:nfc_device:s0 - -# Sensors -/dev/alps_io u:object_r:io_device:s0 -/dev/iio:device0 u:object_r:io_device:s0 -/efs/FactoryApp/baro_delta u:object_r:sensors_efs_file:s0 -/efs/gyro_cal_data u:object_r:sensors_efs_file:s0 -/efs/prox_cal u:object_r:sensors_efs_file:s0 - -# Thermal engine -/system/bin/thermal-engine u:object_r:thermal-engine_exec:s0 - -# WiFi -/data/.wifiver.info u:object_r:wifi_data_file:s0 -/efs/wifi/.mac.info u:object_r:wifi_efs_file:s0 diff --git a/sepolicy/fingerprintd.te b/sepolicy/fingerprintd.te deleted file mode 100644 index 0844bf1..0000000 --- a/sepolicy/fingerprintd.te +++ /dev/null @@ -1 +0,0 @@ -allow fingerprintd system_app:unix_stream_socket { connectto read write setopt }; diff --git a/sepolicy/fsck.te b/sepolicy/fsck.te deleted file mode 100644 index 5d000b7..0000000 --- a/sepolicy/fsck.te +++ /dev/null @@ -1 +0,0 @@ -allow fsck efs_block_device:blk_file rw_file_perms; diff --git a/sepolicy/healthd.te b/sepolicy/healthd.te deleted file mode 100644 index cdf9e70..0000000 --- a/sepolicy/healthd.te +++ /dev/null @@ -1,2 +0,0 @@ -allow healthd device:dir r_dir_perms; -allow healthd rtc_device:chr_file rw_file_perms; diff --git a/sepolicy/hostapd.te b/sepolicy/hostapd.te deleted file mode 100644 index a4e8b76..0000000 --- a/sepolicy/hostapd.te +++ /dev/null @@ -1,2 +0,0 @@ -allow hostapd efs_file:dir search; -allow hostapd wifi_data_file:sock_file write; diff --git a/sepolicy/init.te b/sepolicy/init.te deleted file mode 100644 index 269169a..0000000 --- a/sepolicy/init.te +++ /dev/null @@ -1,3 +0,0 @@ -allow init tmpfs:lnk_file create_file_perms; -allow init debugfs:dir mounton; -allow init wcnss_device:chr_file write; diff --git a/sepolicy/kernel.te b/sepolicy/kernel.te deleted file mode 100644 index 52ff5c4..0000000 --- a/sepolicy/kernel.te +++ /dev/null @@ -1,2 +0,0 @@ -allow kernel block_device:blk_file rw_file_perms; - diff --git a/sepolicy/mediaserver.te b/sepolicy/mediaserver.te deleted file mode 100644 index 4aaf8ad..0000000 --- a/sepolicy/mediaserver.te +++ /dev/null @@ -1,7 +0,0 @@ -allow mediaserver system_prop:property_service set; -#allow mediaserver shell_data_file:dir search; -allow mediaserver socket_device:sock_file write; -allow mediaserver sysfs_camera:dir search; -allow mediaserver sysfs_camera:file { getattr open read }; -#allow mediaserver system_file:file execmod; - diff --git a/sepolicy/mm-qcamerad.te b/sepolicy/mm-qcamerad.te deleted file mode 100644 index dd60cb0..0000000 --- a/sepolicy/mm-qcamerad.te +++ /dev/null @@ -1,20 +0,0 @@ -allow mm-qcamerad media_rw_data_file:dir search; -allow mm-qcamerad sysfs_camera:dir search; -allow mm-qcamerad sysfs_camera:file rw_file_perms; -allow mm-qcamerad system_data_file:dir w_dir_perms; -allow mm-qcamerad system_data_file:file open; -#allow mm-qcamerad system_file:file execmod; -allow mm-qcamerad system_data_file:sock_file unlink; -allow mm-qcamerad sensors_socket:sock_file read; -allow mm-qcamerad system_data_file:sock_file rw_file_perms; -allow mm-qcamerad system_data_file:sock_file rw_file_perms; -allow mm-qcamerad system_data_file:dir { add_name remove_name write }; -allow mm-qcamerad system_data_file:sock_file { create unlink }; - -allow mm-qcamerad system_server:unix_stream_socket rw_socket_perms; -allow mm-qcamerad system_data_file:sock_file { create unlink }; - -binder_call(mm-qcamerad, servicemanager) -binder_call(mm-qcamerad, system_server) - -unix_socket_connect(mm-qcamerad, mpctl, mpdecision) diff --git a/sepolicy/mpdecision.te b/sepolicy/mpdecision.te deleted file mode 100644 index 5c07a7f..0000000 --- a/sepolicy/mpdecision.te +++ /dev/null @@ -1 +0,0 @@ -allow mpdecision socket_device:dir write; diff --git a/sepolicy/platform_app.te b/sepolicy/platform_app.te deleted file mode 100644 index 757015a..0000000 --- a/sepolicy/platform_app.te +++ /dev/null @@ -1 +0,0 @@ -allow platform_app time_daemon:unix_stream_socket connectto; diff --git a/sepolicy/property.te b/sepolicy/property.te deleted file mode 100644 index a9b1a48..0000000 --- a/sepolicy/property.te +++ /dev/null @@ -1 +0,0 @@ -type qseecomd_prop, property_type; diff --git a/sepolicy/property_contexts b/sepolicy/property_contexts deleted file mode 100644 index 8e1ff08..0000000 --- a/sepolicy/property_contexts +++ /dev/null @@ -1,2 +0,0 @@ -persist.sys.camera.preview u:object_r:camera_prop:s0 -sys.qseecomd.enable u:object_r:qseecomd_prop:s0 diff --git a/sepolicy/qseecomd.te b/sepolicy/qseecomd.te deleted file mode 100644 index 862b350..0000000 --- a/sepolicy/qseecomd.te +++ /dev/null @@ -1 +0,0 @@ -allow tee qseecomd_prop:property_service set; diff --git a/sepolicy/rild.te b/sepolicy/rild.te deleted file mode 100644 index 94331c4..0000000 --- a/sepolicy/rild.te +++ /dev/null @@ -1,8 +0,0 @@ -allow rild proc_net:file rw_file_perms; -allow rild self:capability { dac_override dac_read_search }; -allow rild radio_data_file:dir r_dir_perms; -allow rild radio_data_file:file r_file_perms; -allow rild radio_data_file:lnk_file r_file_perms; -#allow rild system_app_data_file:dir rw_dir_perms; -#allow rild system_app_data_file:file create_file_perms; - diff --git a/sepolicy/system_app.te b/sepolicy/system_app.te deleted file mode 100644 index 027926f..0000000 --- a/sepolicy/system_app.te +++ /dev/null @@ -1,7 +0,0 @@ -# For com.validity.fingerprint -allow system_app vcs:process signull; -allow system_app vcs_data_file:dir r_dir_perms; -allow system_app vcs_data_file:file r_file_perms; -allow system_app vcs_device:dir r_dir_perms; -allow system_app vcs_device:file r_file_perms; -allow system_app vcs_device:fifo_file create_file_perms; diff --git a/sepolicy/system_server.te b/sepolicy/system_server.te deleted file mode 100644 index c222a9c..0000000 --- a/sepolicy/system_server.te +++ /dev/null @@ -1,7 +0,0 @@ -allow system_server efs_file:dir search; -allow system_server io_device:chr_file rw_file_perms; -allow system_server sensors_efs_file:file r_file_perms; -allow system_server sysfs_display:file rw_file_perms;; -allow system_server sysfs_vibeamp:dir search; -allow system_server sysfs_vibeamp:file rw_file_perms; -allow system_server wifi_data_file:sock_file unlink; diff --git a/sepolicy/tee.te b/sepolicy/tee.te deleted file mode 100644 index 02eeef6..0000000 --- a/sepolicy/tee.te +++ /dev/null @@ -1,2 +0,0 @@ -allow tee vcs_data_file:dir create_dir_perms; -allow tee vcs_data_file:file create_file_perms; diff --git a/sepolicy/thermal-engine.te b/sepolicy/thermal-engine.te deleted file mode 100644 index 5f5dd27..0000000 --- a/sepolicy/thermal-engine.te +++ /dev/null @@ -1,7 +0,0 @@ -allow thermal-engine init:unix_stream_socket connectto; -allow thermal-engine sysfs_battery_supply:dir search; -allow thermal-engine sysfs_battery_supply:file { open read write }; - -allow thermal-engine self:capability chown; - -allow thermal-engine socket_device:sock_file create_file_perms; diff --git a/sepolicy/ueventd.te b/sepolicy/ueventd.te deleted file mode 100644 index 67f5db8..0000000 --- a/sepolicy/ueventd.te +++ /dev/null @@ -1,3 +0,0 @@ -allow ueventd sysfs_camera:file rw_file_perms; -allow ueventd sysfs_vibeamp:file rw_file_perms; -#allow ueventd vcs_device:chr_file create_file_perms; diff --git a/sepolicy/untrusted_app.te b/sepolicy/untrusted_app.te deleted file mode 100644 index d39bd7b..0000000 --- a/sepolicy/untrusted_app.te +++ /dev/null @@ -1,2 +0,0 @@ -allow untrusted_app fuse:lnk_file read; -allow untrusted_app sysfs:file { getattr open read }; diff --git a/sepolicy/vcs.te b/sepolicy/vcs.te deleted file mode 100644 index 2bcf124..0000000 --- a/sepolicy/vcs.te +++ /dev/null @@ -1,22 +0,0 @@ -type vcs, domain; -type vcs_exec, exec_type, file_type; - -# vcs -init_daemon_domain(vcs) -binder_use(vcs) - -allow vcs system_app:process signull; - -allow vcs vcs_data_file:dir create_dir_perms; -allow vcs vcs_data_file:file create_file_perms; - -allow vcs vcs_device:dir create_dir_perms; -allow vcs vcs_device:file create_file_perms; -allow vcs vcs_device:fifo_file create_file_perms; -#allow vcs vcs_device:chr_file create_file_perms; - -#allow vcs tee_device:chr_file rw_file_perms; - -allow vcs firmware_file:dir r_dir_perms; -allow vcs firmware_file:file r_file_perms; - diff --git a/sepolicy/vold.te b/sepolicy/vold.te deleted file mode 100644 index 778867b..0000000 --- a/sepolicy/vold.te +++ /dev/null @@ -1,4 +0,0 @@ -allow vold efs_file:dir r_file_perms; -allow vold persist_file:dir r_file_perms; -allow vold firmware_file:dir search; -allow vold firmware_file:file r_file_perms; diff --git a/sepolicy/wcnss_service.te b/sepolicy/wcnss_service.te deleted file mode 100644 index 0bfa877..0000000 --- a/sepolicy/wcnss_service.te +++ /dev/null @@ -1,2 +0,0 @@ -allow wcnss_service efs_file:dir search; -allow wcnss_service wifi_efs_file:file { getattr open read }; diff --git a/sepolicy/wpa.te b/sepolicy/wpa.te deleted file mode 100644 index b880451..0000000 --- a/sepolicy/wpa.te +++ /dev/null @@ -1,3 +0,0 @@ -#allow wpa efs_file:dir search; -#allow wpa wifi_efs_file:file r_file_perms; -#allow wpa wifi_data_file:sock_file rw_file_perms; diff --git a/shims/Android.mk b/shims/Android.mk index 8cd0e33..bcf5807 100644 --- a/shims/Android.mk +++ b/shims/Android.mk @@ -7,4 +7,9 @@ LOCAL_SHARED_LIBRARIES := libstagefright_foundation liblog libmedia libcutils LOCAL_MODULE := libwvm_shim LOCAL_MODULE_TAGS := optional +LOCAL_SRC_FILES := imx175_shim.cpp +LOCAL_MODULE := libimx175_shim +LOCAL_SHARED_LIBRARIES := liblog +LOCAL_MODULE_TAGS := optional + include $(BUILD_SHARED_LIBRARY) diff --git a/shims/imx175_shim.cpp b/shims/imx175_shim.cpp new file mode 100644 index 0000000..297187c --- /dev/null +++ b/shims/imx175_shim.cpp @@ -0,0 +1,17 @@ +#include +#include +#include +#include + +extern "C" { + int property_get(const char * key, char * value, const char * default_value) { + ALOGE("%s: E", __FUNCTION__); + if (strcmp("ro.revision", key) == 0) { + ALOGE("%s: ro.revision was called!", __FUNCTION__); + strcpy(value, "4"); + return 3; + } + ALOGE("%s: called other property: %s", __FUNCTION__, key); + return ((int( * )(const char * , char *, const char * ))(dlsym((void * ) - 1, "property_get")))(key, value, default_value); + } +} diff --git a/system.prop b/system.prop index 0ee71f1..7477fce 100644 --- a/system.prop +++ b/system.prop @@ -1,12 +1,25 @@ # Art dalvik.vm.dex2oat-swap=false +# Radio Temp +ro.carrier=wifi-only +ro.radio.noril=1 + # Audio -persist.media.treble_omx=false -media.aac_51_output_enabled=true -mm.enable.smoothstreaming=true -ro.qc.sdk.audio.fluencetype=none +af.fast_track_multiplier=1 +audio_hal.period_size=192 +audio.offload.video=true +persist.audio.fluence.speaker=true +persist.audio.fluence.voicecall=true +persist.audio.fluence.voicerec=false +ro.qc.sdk.audio.fluencetype=fluence use.voice.path.for.pcm.voip=false +use.dedicated.device.for.voip=true +audio.deep_buffer.media=true +audio.offload.pcm.16bit.enable=true +audio.offload.pcm.24bit.enable=true +audio.offload.multiple.enabled=false +audio.offload.buffer.size.kb=32 # Bluetooth qcom.bluetooth.soc=smd @@ -59,7 +72,6 @@ persist.data.qmi.adb_logmask=0 persist.radio.add_power_save=1 rild.libargs=-d /dev/smd0 rild.libpath=/system/lib/libsec-ril.so -ro.telephony.ril_class=SamsungMSM8226RIL ro.telephony.ril.config=simactivation ro.use_data_netmgrd=false