Skip to content

Commit

Permalink
liblight: Change method to get LP mode brightness
Browse files Browse the repository at this point in the history
Bug : 62663757

If sys.display.low_persistence_mode_brightness is set, get brightness
from sys.display.low_persistence_mode_brightness.

Change-Id: I21a7583f535f8797300bab738cc4c8805ca06b90
  • Loading branch information
jiwon912.choi authored and pattjin committed Jul 7, 2017
1 parent 81cec40 commit 98a24a3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions liblight/lights.c
Expand Up @@ -39,6 +39,8 @@
#define LIGHTS_SUPPORT_BATTERY 0
#define CG_COLOR_ID_PROPERTY "ro.boot.hardware.color"

#define LP_MODE_BRIGHTNESS_PROPERTY "sys.display.low_persistence_mode_brightness"

static pthread_once_t g_init = PTHREAD_ONCE_INIT;
static pthread_mutex_t g_lock = PTHREAD_MUTEX_INITIALIZER;
static struct light_state_t g_notification;
Expand Down Expand Up @@ -195,8 +197,10 @@ set_light_backlight(struct light_device_t* dev,
strerror(errno));
}
if (lpEnabled != 0) {
// This is defined in BoardConfig.mk.
brightness = DEFAULT_LOW_PERSISTENCE_MODE_BRIGHTNESS;
// Try to get the brigntess though property, otherwise it will
// set the default brightness, which is defined in BoardConfig.mk.
brightness = property_get_int32(LP_MODE_BRIGHTNESS_PROPERTY,
DEFAULT_LOW_PERSISTENCE_MODE_BRIGHTNESS);
}
}

Expand Down

0 comments on commit 98a24a3

Please sign in to comment.