diff --git a/liblight/Android.mk b/liblight/Android.mk index bbb076f0..ae01ece8 100644 --- a/liblight/Android.mk +++ b/liblight/Android.mk @@ -17,12 +17,10 @@ LOCAL_PATH:= $(call my-dir) # hw/..so include $(CLEAR_VARS) -LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/common/inc -LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/qdcm/inc -LOCAL_SRC_FILES := lights.c lights_prv.cpp +LOCAL_SRC_FILES := lights.c LOCAL_MODULE_RELATIVE_PATH := hw -LOCAL_SHARED_LIBRARIES := liblog libcutils libsdm-disp-vndapis +LOCAL_SHARED_LIBRARIES := liblog LOCAL_HEADER_LIBRARIES := libhardware_headers LOCAL_CFLAGS := -DLOG_TAG=\"qdlights\" LOCAL_CLANG := true diff --git a/liblight/lights.c b/liblight/lights.c index eed6a250..e20c1aba 100644 --- a/liblight/lights.c +++ b/liblight/lights.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014, 2017 The Linux Foundation. All rights reserved. + * Copyright (C) 2014, 2017-2018 The Linux Foundation. All rights reserved. * Not a contribution * Copyright (C) 2008 The Android Open Source Project * @@ -33,7 +33,6 @@ #include #include -#include "lights_prv.h" #ifndef DEFAULT_LOW_PERSISTENCE_MODE_BRIGHTNESS #define DEFAULT_LOW_PERSISTENCE_MODE_BRIGHTNESS 0x80 @@ -47,7 +46,6 @@ static struct light_state_t g_notification; static struct light_state_t g_battery; static int g_last_backlight_mode = BRIGHTNESS_MODE_USER; static int g_attention = 0; -static int g_brightness_max = 0; char const*const RED_LED_FILE = "/sys/class/leds/red/brightness"; @@ -165,28 +163,6 @@ set_light_backlight(struct light_device_t* dev, return err; } -static int -set_light_backlight_ext(struct light_device_t* dev, - struct light_state_t const* state) -{ - int err = 0; - - if(!dev) { - return -1; - } - - int brightness = state->color & 0x00ffffff; - pthread_mutex_lock(&g_lock); - - if (brightness >= 0 && brightness <= g_brightness_max) { - set_brightness_ext_level(brightness); - } - - pthread_mutex_unlock(&g_lock); - - return err; -} - static int set_speaker_light_locked(struct light_device_t* dev, struct light_state_t const* state) @@ -242,15 +218,15 @@ set_speaker_light_locked(struct light_device_t* dev, if (red) { if (write_int(RED_BLINK_FILE, blink)) write_int(RED_LED_FILE, 0); - } + } if (green) { if (write_int(GREEN_BLINK_FILE, blink)) write_int(GREEN_LED_FILE, 0); - } + } if (blue) { if (write_int(BLUE_BLINK_FILE, blink)) write_int(BLUE_LED_FILE, 0); - } + } } else { write_int(RED_LED_FILE, red); write_int(GREEN_LED_FILE, green); @@ -346,17 +322,7 @@ static int open_lights(const struct hw_module_t* module, char const* name, struct light_state_t const* state); if (0 == strcmp(LIGHT_ID_BACKLIGHT, name)) { - char property[PROPERTY_VALUE_MAX]; - property_get("persist.extend.brightness", property, "0"); - - if(!(strncmp(property, "1", PROPERTY_VALUE_MAX)) || - !(strncmp(property, "true", PROPERTY_VALUE_MAX))) { - property_get("persist.display.max_brightness", property, "255"); - g_brightness_max = atoi(property); - set_brightness_ext_init(); - set_light = set_light_backlight_ext; - } else - set_light = set_light_backlight; + set_light = set_light_backlight; } else if (0 == strcmp(LIGHT_ID_BATTERY, name)) set_light = set_light_battery; else if (0 == strcmp(LIGHT_ID_NOTIFICATIONS, name)) diff --git a/liblight/lights_prv.cpp b/liblight/lights_prv.cpp deleted file mode 100644 index f916ed2f..00000000 --- a/liblight/lights_prv.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2017, 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 "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. - */ - - - -#include -#include "disp_color_apis.h" -#include "lights_prv.h" - -/******************************************************************************/ -static DISPAPI_HANDLE g_ctx; - -/** - * device methods - */ - -void set_brightness_ext_init(void) -{ - disp_api_init((DISPAPI_HANDLE*) &g_ctx, 0); -} - -int set_brightness_ext_level(int level) -{ - int err = disp_api_set_panel_brightness_level_ext(g_ctx, HWC_DISPLAY_PRIMARY, - level, 0); - - return err; -} diff --git a/liblight/lights_prv.h b/liblight/lights_prv.h deleted file mode 100644 index e0ec7362..00000000 --- a/liblight/lights_prv.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2017, 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 "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. - */ - -#ifndef LIGHTS_PRV_H -#define LIGHTS_PRV_H - -#ifdef __cplusplus -extern "C" { -#endif - -extern void set_brightness_ext_init(void); -extern int set_brightness_ext_level(int level); - -#ifdef __cplusplus -} -#endif -#endif