backlight
This commit is contained in:
parent
8f26f434af
commit
162369b604
61
patches/button_backlight.patch
Normal file
61
patches/button_backlight.patch
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
diff --git a/services/core/java/com/android/server/display/DisplayPowerController.java b/services/core/java/com/android/server/display/DisplayPowerController.java
|
||||||
|
index 7c0f4197363..16758ba496e 100644
|
||||||
|
--- a/services/core/java/com/android/server/display/DisplayPowerController.java
|
||||||
|
+++ b/services/core/java/com/android/server/display/DisplayPowerController.java
|
||||||
|
@@ -63,7 +63,12 @@ import com.android.server.display.whitebalance.DisplayWhiteBalanceFactory;
|
||||||
|
import com.android.server.display.whitebalance.DisplayWhiteBalanceSettings;
|
||||||
|
import com.android.server.policy.WindowManagerPolicy;
|
||||||
|
|
||||||
|
+import java.io.BufferedWriter;
|
||||||
|
+import java.io.File;
|
||||||
|
+import java.io.FileWriter;
|
||||||
|
+import java.io.IOException;
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
+import java.io.Writer;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
@@ -561,6 +566,18 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
|
||||||
|
mDisplayWhiteBalanceController = displayWhiteBalanceController;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ private void changeKeyboardBacklightState(String value) {
|
||||||
|
+ try {
|
||||||
|
+ File outputFile = new File("/sys/class/leds/keyboard_light/", "brightness");
|
||||||
|
+ Writer writer = new BufferedWriter(new FileWriter(outputFile));
|
||||||
|
+
|
||||||
|
+ writer.write(value);
|
||||||
|
+ writer.close();
|
||||||
|
+ } catch (IOException e) {
|
||||||
|
+ Slog.d("NEHEMIAH", "Sorry, failed to change the value of the keyboard backlight");
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
private Sensor findDisplayLightSensor(String sensorType) {
|
||||||
|
if (!TextUtils.isEmpty(sensorType)) {
|
||||||
|
List<Sensor> sensors = mSensorManager.getSensorList(Sensor.TYPE_ALL);
|
||||||
|
@@ -1154,6 +1171,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
|
||||||
|
&& mReportedScreenStateToPolicy == REPORTED_TO_POLICY_SCREEN_TURNING_ON) {
|
||||||
|
setReportedScreenState(REPORTED_TO_POLICY_SCREEN_ON);
|
||||||
|
mWindowManagerPolicy.screenTurnedOn();
|
||||||
|
+ changeKeyboardBacklightState("255");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Grab a wake lock if we have unfinished business.
|
||||||
|
@@ -1310,6 +1328,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
|
||||||
|
setReportedScreenState(REPORTED_TO_POLICY_SCREEN_OFF);
|
||||||
|
unblockScreenOn();
|
||||||
|
mWindowManagerPolicy.screenTurnedOff();
|
||||||
|
+ changeKeyboardBacklightState("0");
|
||||||
|
} else if (!isOff
|
||||||
|
&& mReportedScreenStateToPolicy == REPORTED_TO_POLICY_SCREEN_TURNING_OFF) {
|
||||||
|
|
||||||
|
@@ -1317,6 +1336,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
|
||||||
|
// Complete the full state transition on -> turningOff -> off.
|
||||||
|
unblockScreenOff();
|
||||||
|
mWindowManagerPolicy.screenTurnedOff();
|
||||||
|
+ changeKeyboardBacklightState("0");
|
||||||
|
setReportedScreenState(REPORTED_TO_POLICY_SCREEN_OFF);
|
||||||
|
}
|
||||||
|
if (!isOff && mReportedScreenStateToPolicy == REPORTED_TO_POLICY_SCREEN_OFF) {
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user