summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordianlujitao <dianlujitao@lineageos.org>2019-08-06 16:27:50 (GMT)
committerMichael Bestas <mkbestas@lineageos.org>2019-08-20 15:17:36 (GMT)
commit3aafeec8342a7a3f08136bebf0368855b20f3102 (patch)
treef5eb4e588c784e1ef25feb55a40928a06c87c1eb
parentd1a8aade1dc2c99926e82e06e5eaab584c837cac (diff)
downloadframeworks_base-3aafeec8342a7a3f08136bebf0368855b20f3102.zip
frameworks_base-3aafeec8342a7a3f08136bebf0368855b20f3102.tar.gz
frameworks_base-3aafeec8342a7a3f08136bebf0368855b20f3102.tar.bz2
LiveDisplayTile: Enable for outdoor mode and skip night display on HWC2
Change-Id: I00ab654033827388f8063eafb98a89315cb47aa9
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/LiveDisplayTile.java14
1 files changed, 9 insertions, 5 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/LiveDisplayTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/LiveDisplayTile.java
index db8fecf..97d9381 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/LiveDisplayTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/LiveDisplayTile.java
@@ -20,6 +20,7 @@ package com.android.systemui.qs.tiles;
import static lineageos.hardware.LiveDisplayManager.FEATURE_MANAGED_OUTDOOR_MODE;
import static lineageos.hardware.LiveDisplayManager.MODE_AUTO;
import static lineageos.hardware.LiveDisplayManager.MODE_DAY;
+import static lineageos.hardware.LiveDisplayManager.MODE_NIGHT;
import static lineageos.hardware.LiveDisplayManager.MODE_OFF;
import static lineageos.hardware.LiveDisplayManager.MODE_OUTDOOR;
@@ -29,7 +30,6 @@ import android.content.res.TypedArray;
import android.database.ContentObserver;
import android.os.Handler;
import android.os.UserHandle;
-import android.provider.Settings;
import android.service.quicksettings.Tile;
import com.android.internal.app.ColorDisplayController;
@@ -62,6 +62,7 @@ public class LiveDisplayTile extends QSTileImpl<LiveDisplayState> {
private int mDayTemperature;
+ private final boolean mNightDisplayAvailable;
private final boolean mOutdoorModeAvailable;
private final LiveDisplayManager mLiveDisplay;
@@ -70,6 +71,7 @@ public class LiveDisplayTile extends QSTileImpl<LiveDisplayState> {
public LiveDisplayTile(QSHost host) {
super(host);
+ mNightDisplayAvailable = ColorDisplayController.isAvailable(mContext);
Resources res = mContext.getResources();
TypedArray typedArray = res.obtainTypedArray(R.array.live_display_drawables);
@@ -106,7 +108,7 @@ public class LiveDisplayTile extends QSTileImpl<LiveDisplayState> {
@Override
public boolean isAvailable() {
- return !ColorDisplayController.isAvailable(mContext);
+ return !mNightDisplayAvailable || mOutdoorModeAvailable;
}
@Override
@@ -184,10 +186,12 @@ public class LiveDisplayTile extends QSTileImpl<LiveDisplayState> {
while (true) {
nextMode = Integer.valueOf(mValues[next]);
- // Skip outdoor mode if it's unsupported, and skip the day setting
- // if it's the same as the off setting
+ // Skip outdoor mode if it's unsupported, skip the day setting
+ // if it's the same as the off setting, and skip night display
+ // on HWC2
if ((!mOutdoorModeAvailable && nextMode == MODE_OUTDOOR) ||
- (mDayTemperature == OFF_TEMPERATURE && nextMode == MODE_DAY)) {
+ (mDayTemperature == OFF_TEMPERATURE && nextMode == MODE_DAY) ||
+ (mNightDisplayAvailable && (nextMode == MODE_DAY || nextMode == MODE_NIGHT))) {
next++;
if (next >= mValues.length) {
next = 0;