Revert "liblight: Add brightness level extension support"

This reverts commit 586c6d5f9af3177e4af73d3663e2cd7b3eadcf5a.

Change-Id: I7af568b0924b6d1bfce903f8d758f21d369c193c
diff --git a/liblight/Android.mk b/liblight/Android.mk
index cf53b2c..5720bba 100644
--- a/liblight/Android.mk
+++ b/liblight/Android.mk
@@ -17,12 +17,9 @@
 # hw/<COPYPIX_HARDWARE_MODULE_ID>.<ro.board.platform>.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\"
 ifeq ($(LLVM_SA), true)
diff --git a/liblight/lights.c b/liblight/lights.c
index d511395..e83be16 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 <sys/types.h>
 
 #include <hardware/lights.h>
-#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_battery;
 static int g_last_backlight_mode = BRIGHTNESS_MODE_USER;
 static int g_attention = 0;
-static int g_brightness_max = 0;
 static bool g_has_persistence_node = false;
 
 char const*const RED_LED_FILE
@@ -170,28 +168,6 @@
 }
 
 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)
 {
@@ -246,15 +222,15 @@
         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);
@@ -350,19 +326,8 @@
             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 {
-            g_has_persistence_node = !access(PERSISTENCE_FILE, F_OK);
-            set_light = set_light_backlight;
-        }
+        g_has_persistence_node = !access(PERSISTENCE_FILE, F_OK);
+        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 f916ed2..0000000
--- 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 <hardware/hwcomposer_defs.h>
-#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 e0ec736..0000000
--- 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