diff options
| author | Craig Donner <cdonner@google.com> | 2016-07-13 09:55:30 -0700 |
|---|---|---|
| committer | Craig Donner <cdonner@google.com> | 2016-07-15 10:08:15 -0700 |
| commit | e8637f060c800d7d11e938b6a93453d86716e5c6 (patch) | |
| tree | 5dc6793e6ebf96f37cb9584d5590f920ee99aa77 /liblight | |
| parent | b1f83185c1a193e1727b579e293fde87b5be41c4 (diff) | |
marlin/sailfish: set fixed brightness when entering LP mode
It's necessary to set maximum brightness while in low persistence mode
to maintain constant brightness regardless of the system brightness setting.
Note that since different devices require slightly different brightness settings
to achieve the same output intensity the value is specified in a new BoardConfig
variable.
Bug: 28121551
Change-Id: I3cdd28baf39a3468fbbb1674d2176e5b4825d80e
Diffstat (limited to 'liblight')
| -rw-r--r-- | liblight/Android.mk | 2 | ||||
| -rw-r--r-- | liblight/lights.c | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/liblight/Android.mk b/liblight/Android.mk index bab9e308..db8643c7 100644 --- a/liblight/Android.mk +++ b/liblight/Android.mk @@ -20,7 +20,7 @@ include $(CLEAR_VARS) LOCAL_SRC_FILES := lights.c LOCAL_MODULE_RELATIVE_PATH := hw LOCAL_SHARED_LIBRARIES := libc libcutils liblog -LOCAL_CFLAGS := $(common_flags) -DLOG_TAG=\"qdlights\" +LOCAL_CFLAGS := $(common_flags) -DLOG_TAG=\"qdlights\" -DDEFAULT_LOW_PERSISTENCE_MODE_BRIGHTNESS=$(DEFAULT_LOW_PERSISTENCE_MODE_BRIGHTNESS) LOCAL_CLANG := true LOCAL_MODULE := lights.$(TARGET_DEVICE) LOCAL_MODULE_TAGS := optional diff --git a/liblight/lights.c b/liblight/lights.c index 800e7017..7ceec6e5 100644 --- a/liblight/lights.c +++ b/liblight/lights.c @@ -197,11 +197,15 @@ set_light_backlight(struct light_device_t* dev, ALOGE("%s: Failed to write to %s: %s\n", __FUNCTION__, PERSISTENCE_FILE, strerror(errno)); } + if (lpEnabled != 0) { + // This is defined in BoardConfig.mk. + brightness = DEFAULT_LOW_PERSISTENCE_MODE_BRIGHTNESS; + } } g_last_backlight_mode = state->brightnessMode; - if (!lpEnabled) { + if (!err) { err = write_int(LCD_FILE, brightness); } |
