davinci: parts: Restore the LED's previous state after popup
* We are using the left led as notification LED and hence it could be breathing or shining while we open or close the camera. So we don't just set it's brightness to 0 but read and store the state of the LED before enabling it and restoring that afterwards. * To ensure that the left LED is shining while the camera opens or closes we set it's breathing effect to 0 before enabling the LEDs. Change-Id: Ibdfbff3072398bc77ec3257b60622cfc50e8d857
This commit is contained in:
parent
1db9129db8
commit
472e0182dc
@ -36,6 +36,7 @@ public class Constants {
|
||||
public static final String OPEN_CAMERA_STATE = "1";
|
||||
|
||||
public static final String FRONT_CAMERA_ID = "1";
|
||||
public static final String LEFT_LED_BREATH_PATH = "/sys/class/leds/left/breath";
|
||||
public static final String LEFT_LED_PATH = "/sys/class/leds/left/brightness";
|
||||
public static final String RIGHT_LED_PATH = "/sys/class/leds/right/brightness";
|
||||
public static final String POPUP_SOUND_PATH = "/system/media/audio/ui/";
|
||||
|
@ -278,11 +278,19 @@ public class PopupCameraService extends Service implements Handler.Callback {
|
||||
|
||||
private void lightUp() {
|
||||
if (mPopupCameraPreferences.isLedAllowed()) {
|
||||
String ledBreathing = FileUtils.readOneLine(Constants.LEFT_LED_BREATH_PATH);
|
||||
String ledBrightness = FileUtils.readOneLine(Constants.LEFT_LED_PATH);
|
||||
|
||||
FileUtils.writeLine(Constants.LEFT_LED_BREATH_PATH, "0");
|
||||
FileUtils.writeLine(Constants.LEFT_LED_PATH, "255");
|
||||
FileUtils.writeLine(Constants.RIGHT_LED_PATH, "255");
|
||||
|
||||
mHandler.postDelayed(() -> {
|
||||
FileUtils.writeLine(Constants.LEFT_LED_PATH, "0");
|
||||
if (ledBreathing.equals("1")) {
|
||||
FileUtils.writeLine(Constants.LEFT_LED_BREATH_PATH, ledBreathing);
|
||||
} else {
|
||||
FileUtils.writeLine(Constants.LEFT_LED_PATH, ledBrightness);
|
||||
}
|
||||
FileUtils.writeLine(Constants.RIGHT_LED_PATH, "0");
|
||||
}, 1200);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user