Patches as of 2018-03-06 release
diff --git a/patches/platform_frameworks_base/0001-renderthread-relax-error-handling-for-wide-gamut-EGL.patch b/patches/platform_frameworks_base/0001-renderthread-relax-error-handling-for-wide-gamut-EGL.patch
new file mode 100644
index 0000000..73d2590
--- /dev/null
+++ b/patches/platform_frameworks_base/0001-renderthread-relax-error-handling-for-wide-gamut-EGL.patch
@@ -0,0 +1,36 @@
+From 8aff32ec3106530d1ea81ba536cd548760bd4ded Mon Sep 17 00:00:00 2001
+From: Rob Herring <robh@kernel.org>
+Date: Wed, 29 Nov 2017 09:26:31 -0600
+Subject: [PATCH 1/3] renderthread: relax error handling for wide gamut EGL
+ configs
+
+It is valid to advertise EGL_EXT_pixel_format_float, but not have a
+the requested EGL config. Instead of aborting, fallback to the default
+behavior.
+
+Change-Id: I6c602233b627dc2070364434fece57d3d0aab435
+Cc: Romain Guy <romainguy@google.com>
+Signed-off-by: Rob Herring <robh@kernel.org>
+---
+ libs/hwui/renderthread/EglManager.cpp | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/libs/hwui/renderthread/EglManager.cpp b/libs/hwui/renderthread/EglManager.cpp
+index 16d77364942..bd4708da562 100644
+--- a/libs/hwui/renderthread/EglManager.cpp
++++ b/libs/hwui/renderthread/EglManager.cpp
+@@ -223,9 +223,9 @@ void EglManager::loadConfigs() {
+ numConfigs = 1;
+ if (!eglChooseConfig(mEglDisplay, attribs16F, &mEglConfigWideGamut, numConfigs, &numConfigs)
+ || numConfigs != 1) {
+- LOG_ALWAYS_FATAL(
+- "Device claims wide gamut support, cannot find matching config, error = %s",
++ ALOGE("Device claims wide gamut support, cannot find matching config, error = %s",
+ eglErrorString());
++ EglExtensions.pixelFormatFloat = false;
+ }
+ }
+ }
+--
+2.15.1
+
diff --git a/patches/platform_frameworks_base/0002-Reintroduce-button-backlight-and-respective-inactivi.patch b/patches/platform_frameworks_base/0002-Reintroduce-button-backlight-and-respective-inactivi.patch
new file mode 100644
index 0000000..e4afc1d
--- /dev/null
+++ b/patches/platform_frameworks_base/0002-Reintroduce-button-backlight-and-respective-inactivi.patch
@@ -0,0 +1,108 @@
+From d1cd1dbf69b4cb6c0046255c8015c58b10a90165 Mon Sep 17 00:00:00 2001
+From: Ricardo Cerqueira <cyanogenmod@cerqueira.org>
+Date: Fri, 23 Nov 2012 14:23:16 +0000
+Subject: [PATCH 2/3] Reintroduce button-backlight (and respective inactivity
+ timeout)
+
+The power manager rewrite from Change I1d7a52e98f0449f76d70bf421f6a7f245957d1d7
+completely removed support for control of the button backlights, which makes
+all capacitive buttons out there stay dark. The commit message in that change
+mentions it hasn't been implemented _yet_, so this fix should be temporary
+until upstream does their own implementation
+
+[RC: Updated to 5.0]
+
+Change-Id: I6094c446e0b8c23f57d30652a3cbd35dee5e821a
+---
+ .../com/android/server/display/DisplayPowerController.java | 11 +++++++++++
+ .../java/com/android/server/power/PowerManagerService.java | 10 ++++++++++
+ 2 files changed, 21 insertions(+)
+
+diff --git a/services/core/java/com/android/server/display/DisplayPowerController.java b/services/core/java/com/android/server/display/DisplayPowerController.java
+index f8e58362e7a..80bdf1ffade 100644
+--- a/services/core/java/com/android/server/display/DisplayPowerController.java
++++ b/services/core/java/com/android/server/display/DisplayPowerController.java
+@@ -20,6 +20,7 @@ import android.app.ActivityManager;
+ import com.android.internal.app.IBatteryStats;
+ import com.android.server.LocalServices;
+ import com.android.server.am.BatteryStatsService;
++import com.android.server.lights.LightsManager;
+
+ import android.animation.Animator;
+ import android.animation.ObjectAnimator;
+@@ -129,6 +130,9 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
+ // Battery stats.
+ private final IBatteryStats mBatteryStats;
+
++ // The lights service.
++ private final LightsManager mLights;
++
+ // The sensor manager.
+ private final SensorManager mSensorManager;
+
+@@ -300,6 +304,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
+ mCallbacks = callbacks;
+
+ mBatteryStats = BatteryStatsService.getService();
++ mLights = LocalServices.getService(LightsManager.class);
+ mSensorManager = sensorManager;
+ mWindowManagerPolicy = LocalServices.getService(WindowManagerPolicy.class);
+ mBlanker = blanker;
+@@ -678,6 +683,12 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
+ // Use zero brightness when screen is off.
+ if (state == Display.STATE_OFF) {
+ brightness = PowerManager.BRIGHTNESS_OFF;
++ mLights.getLight(LightsManager.LIGHT_ID_BUTTONS).setBrightness(brightness);
++ }
++
++ // Disable button lights when dozing
++ if (state == Display.STATE_DOZE || state == Display.STATE_DOZE_SUSPEND) {
++ mLights.getLight(LightsManager.LIGHT_ID_BUTTONS).setBrightness(PowerManager.BRIGHTNESS_OFF);
+ }
+
+ // Configure auto-brightness.
+diff --git a/services/core/java/com/android/server/power/PowerManagerService.java b/services/core/java/com/android/server/power/PowerManagerService.java
+index f84b20c0570..1ced53fe840 100644
+--- a/services/core/java/com/android/server/power/PowerManagerService.java
++++ b/services/core/java/com/android/server/power/PowerManagerService.java
+@@ -220,6 +220,8 @@ public final class PowerManagerService extends SystemService
+ private static final int HALT_MODE_REBOOT = 1;
+ private static final int HALT_MODE_REBOOT_SAFE_MODE = 2;
+
++ private static final int BUTTON_ON_DURATION = 5 * 1000;
++
+ // File location for last reboot reason
+ private static final String LAST_REBOOT_LOCATION = "/data/misc/reboot/last_reboot_reason";
+
+@@ -240,6 +242,7 @@ public final class PowerManagerService extends SystemService
+ private SettingsObserver mSettingsObserver;
+ private DreamManagerInternal mDreamManager;
+ private Light mAttentionLight;
++ private Light mButtonsLight;
+
+ private final Object mLock = LockGuard.installNewLock(LockGuard.INDEX_POWER);
+
+@@ -747,6 +750,7 @@ public final class PowerManagerService extends SystemService
+
+ mLightsManager = getLocalService(LightsManager.class);
+ mAttentionLight = mLightsManager.getLight(LightsManager.LIGHT_ID_ATTENTION);
++ mButtonsLight = mLightsManager.getLight(LightsManager.LIGHT_ID_BUTTONS);
+
+ // Initialize display power management.
+ mDisplayManagerInternal.initPowerManagement(
+@@ -1947,6 +1951,12 @@ public final class PowerManagerService extends SystemService
+ nextTimeout = mLastUserActivityTime
+ + screenOffTimeout - screenDimDuration;
+ if (now < nextTimeout) {
++ if (now > mLastUserActivityTime + BUTTON_ON_DURATION) {
++ mButtonsLight.setBrightness(0);
++ } else {
++ mButtonsLight.setBrightness(mDisplayPowerRequest.screenBrightness);
++ nextTimeout = now + BUTTON_ON_DURATION;
++ }
+ mUserActivitySummary = USER_ACTIVITY_SCREEN_BRIGHT;
+ } else {
+ nextTimeout = mLastUserActivityTime + screenOffTimeout;
+--
+2.15.1
+
diff --git a/patches/platform_frameworks_base/0003-power-Disable-keyboard-button-lights-while-dozing-dr.patch b/patches/platform_frameworks_base/0003-power-Disable-keyboard-button-lights-while-dozing-dr.patch
new file mode 100644
index 0000000..1c6606c
--- /dev/null
+++ b/patches/platform_frameworks_base/0003-power-Disable-keyboard-button-lights-while-dozing-dr.patch
@@ -0,0 +1,31 @@
+From 55bd603882486a351210d29ac7767d92f12000f2 Mon Sep 17 00:00:00 2001
+From: Steve Kondik <steve@cyngn.com>
+Date: Sat, 3 Jan 2015 05:13:26 -0800
+Subject: [PATCH 3/3] power: Disable keyboard/button lights while
+ dozing/dreaming
+
+ * With hardkeys and doze mode enabled, entering suspend results in
+ an epic battle over the lights. It's a bad situation. Disable
+ them when we're sleepy.
+
+Change-Id: I7f1fc35a1573717d1ea101a07c4171d6f66d1553
+---
+ services/core/java/com/android/server/power/PowerManagerService.java | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/services/core/java/com/android/server/power/PowerManagerService.java b/services/core/java/com/android/server/power/PowerManagerService.java
+index 1ced53fe840..9edf6fcae1e 100644
+--- a/services/core/java/com/android/server/power/PowerManagerService.java
++++ b/services/core/java/com/android/server/power/PowerManagerService.java
+@@ -1947,7 +1947,7 @@ public final class PowerManagerService extends SystemService
+ final boolean userInactiveOverride = mUserInactiveOverrideFromWindowManager;
+
+ mUserActivitySummary = 0;
+- if (mLastUserActivityTime >= mLastWakeTime) {
++ if (mWakefulness == WAKEFULNESS_AWAKE && mLastUserActivityTime >= mLastWakeTime) {
+ nextTimeout = mLastUserActivityTime
+ + screenOffTimeout - screenDimDuration;
+ if (now < nextTimeout) {
+--
+2.15.1
+