Added backlight patch for CAT
This commit is contained in:
parent
37440670a7
commit
0c1ca8abe8
@ -1,60 +1,60 @@
|
|||||||
diff --git a/services/core/java/com/android/server/display/DisplayPowerController.java b/services/core/java/com/android/server/display/DisplayPowerController.java
|
diff --git a/services/core/java/com/android/server/display/DisplayPowerController.java b/services/core/java/com/android/server/display/DisplayPowerController.java
|
||||||
index 7c0f4197363..a46b96ae5fa 100644
|
index 7c0f4197363..16758ba496e 100644
|
||||||
--- a/services/core/java/com/android/server/display/DisplayPowerController.java
|
--- a/services/core/java/com/android/server/display/DisplayPowerController.java
|
||||||
+++ b/services/core/java/com/android/server/display/DisplayPowerController.java
|
+++ b/services/core/java/com/android/server/display/DisplayPowerController.java
|
||||||
@@ -63,6 +63,10 @@ import com.android.server.display.whitebalance.DisplayWhiteBalanceFactory;
|
@@ -63,7 +63,12 @@ import com.android.server.display.whitebalance.DisplayWhiteBalanceFactory;
|
||||||
import com.android.server.display.whitebalance.DisplayWhiteBalanceSettings;
|
import com.android.server.display.whitebalance.DisplayWhiteBalanceSettings;
|
||||||
import com.android.server.policy.WindowManagerPolicy;
|
import com.android.server.policy.WindowManagerPolicy;
|
||||||
|
|
||||||
+// Button backlights
|
+import java.io.BufferedWriter;
|
||||||
+import com.android.server.lights.LightsManager;
|
+import java.io.File;
|
||||||
+import com.android.server.lights.LogicalLight;
|
+import java.io.FileWriter;
|
||||||
+
|
+import java.io.IOException;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
|
+import java.io.Writer;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -258,6 +262,10 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
|
/**
|
||||||
// Must only be accessed on the handler thread.
|
@@ -561,6 +566,18 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
|
||||||
private DisplayPowerState mPowerState;
|
mDisplayWhiteBalanceController = displayWhiteBalanceController;
|
||||||
|
}
|
||||||
|
|
||||||
+ // Buttons backlight
|
+ private void changeKeyboardBacklightState(String value) {
|
||||||
+ private LightsManager mLightsManager;
|
+ try {
|
||||||
+ private LogicalLight mButtonsLight;
|
+ File outputFile = new File("/sys/class/leds/keyboard_light/", "brightness");
|
||||||
|
+ Writer writer = new BufferedWriter(new FileWriter(outputFile));
|
||||||
+
|
+
|
||||||
// True if the device should wait for negative proximity sensor before
|
+ writer.write(value);
|
||||||
// waking up the screen. This is set to false as soon as a negative
|
+ writer.close();
|
||||||
// proximity sensor measurement is observed or when the device is forced to
|
+ } catch (IOException e) {
|
||||||
@@ -686,6 +694,9 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
|
+ Slog.d("NEHEMIAH", "Sorry, failed to change the value of the keyboard backlight");
|
||||||
mPowerState = new DisplayPowerState(mBlanker,
|
+ }
|
||||||
mColorFadeEnabled ? new ColorFade(Display.DEFAULT_DISPLAY) : null);
|
+ }
|
||||||
|
|
||||||
+ mLightsManager = LocalServices.getService(LightsManager.class);
|
|
||||||
+ mButtonsLight = mLightsManager.getLight(LightsManager.LIGHT_ID_KEYBOARD);
|
|
||||||
+
|
+
|
||||||
if (mColorFadeEnabled) {
|
private Sensor findDisplayLightSensor(String sensorType) {
|
||||||
mColorFadeOnAnimator = ObjectAnimator.ofFloat(
|
if (!TextUtils.isEmpty(sensorType)) {
|
||||||
mPowerState, DisplayPowerState.COLOR_FADE_LEVEL, 0.0f, 1.0f);
|
List<Sensor> sensors = mSensorManager.getSensorList(Sensor.TYPE_ALL);
|
||||||
@@ -1154,6 +1165,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
|
@@ -1154,6 +1171,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
|
||||||
&& mReportedScreenStateToPolicy == REPORTED_TO_POLICY_SCREEN_TURNING_ON) {
|
&& mReportedScreenStateToPolicy == REPORTED_TO_POLICY_SCREEN_TURNING_ON) {
|
||||||
setReportedScreenState(REPORTED_TO_POLICY_SCREEN_ON);
|
setReportedScreenState(REPORTED_TO_POLICY_SCREEN_ON);
|
||||||
mWindowManagerPolicy.screenTurnedOn();
|
mWindowManagerPolicy.screenTurnedOn();
|
||||||
+ mButtonsLight.setBrightness(PowerManager.BRIGHTNESS_MAX);
|
+ changeKeyboardBacklightState("255");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Grab a wake lock if we have unfinished business.
|
// Grab a wake lock if we have unfinished business.
|
||||||
@@ -1310,6 +1322,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
|
@@ -1310,6 +1328,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
|
||||||
setReportedScreenState(REPORTED_TO_POLICY_SCREEN_OFF);
|
setReportedScreenState(REPORTED_TO_POLICY_SCREEN_OFF);
|
||||||
unblockScreenOn();
|
unblockScreenOn();
|
||||||
mWindowManagerPolicy.screenTurnedOff();
|
mWindowManagerPolicy.screenTurnedOff();
|
||||||
+ mButtonsLight.setBrightness(PowerManager.BRIGHTNESS_MIN);
|
+ changeKeyboardBacklightState("0");
|
||||||
} else if (!isOff
|
} else if (!isOff
|
||||||
&& mReportedScreenStateToPolicy == REPORTED_TO_POLICY_SCREEN_TURNING_OFF) {
|
&& mReportedScreenStateToPolicy == REPORTED_TO_POLICY_SCREEN_TURNING_OFF) {
|
||||||
|
|
||||||
@@ -1317,6 +1330,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
|
@@ -1317,6 +1336,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
|
||||||
// Complete the full state transition on -> turningOff -> off.
|
// Complete the full state transition on -> turningOff -> off.
|
||||||
unblockScreenOff();
|
unblockScreenOff();
|
||||||
mWindowManagerPolicy.screenTurnedOff();
|
mWindowManagerPolicy.screenTurnedOff();
|
||||||
+ mButtonsLight.setBrightness(PowerManager.BRIGHTNESS_MIN);
|
+ changeKeyboardBacklightState("0");
|
||||||
setReportedScreenState(REPORTED_TO_POLICY_SCREEN_OFF);
|
setReportedScreenState(REPORTED_TO_POLICY_SCREEN_OFF);
|
||||||
}
|
}
|
||||||
if (!isOff && mReportedScreenStateToPolicy == REPORTED_TO_POLICY_SCREEN_OFF) {
|
if (!isOff && mReportedScreenStateToPolicy == REPORTED_TO_POLICY_SCREEN_OFF) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user