diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 98b36c5c9cbfb..3effef2ff2fd4 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -4530,9 +4530,8 @@
shown in the warning dialog about the accessibility shortcut. -->
Color Correction
-
-
- Reduce Bright Colors
+
+ Reduce Brightness
Held volume keys. %1$s turned on.
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index d932395310382..589a39c16bcb1 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -954,11 +954,8 @@
On at %s
Until %s
-
-
- Reduce Bright Colors
-
- %d%% reduction
+
+ Reduce Brightness
NFC
diff --git a/packages/SystemUI/src/com/android/systemui/qs/dagger/QSFlagsModule.java b/packages/SystemUI/src/com/android/systemui/qs/dagger/QSFlagsModule.java
index 9ab2d7370ed8a..35a8257bd5a75 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/dagger/QSFlagsModule.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/dagger/QSFlagsModule.java
@@ -16,6 +16,9 @@
package com.android.systemui.qs.dagger;
+import android.content.Context;
+import android.hardware.display.ColorDisplayManager;
+
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.statusbar.FeatureFlags;
@@ -27,6 +30,7 @@ import dagger.Provides;
@Module
public interface QSFlagsModule {
String QS_LABELS_FLAG = "qs_labels_flag";
+ String RBC_AVAILABLE = "rbc_available";
@Provides
@SysUISingleton
@@ -34,4 +38,12 @@ public interface QSFlagsModule {
static boolean provideQSFlag(FeatureFlags featureFlags) {
return featureFlags.isQSLabelsEnabled();
}
+
+ /** */
+ @Provides
+ @SysUISingleton
+ @Named(RBC_AVAILABLE)
+ static boolean isReduceBrightColorsAvailable(Context context) {
+ return ColorDisplayManager.isReduceBrightColorsAvailable(context);
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/ReduceBrightColorsTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/ReduceBrightColorsTile.java
index 84c7611478cd7..f94cabcee2978 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/ReduceBrightColorsTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/ReduceBrightColorsTile.java
@@ -16,12 +16,13 @@
package com.android.systemui.qs.tiles;
+import static com.android.systemui.qs.dagger.QSFlagsModule.RBC_AVAILABLE;
+
import android.content.Intent;
import android.os.Handler;
import android.os.Looper;
import android.provider.Settings;
import android.service.quicksettings.Tile;
-import android.text.TextUtils;
import android.widget.Switch;
import com.android.internal.logging.MetricsLogger;
@@ -39,6 +40,7 @@ import com.android.systemui.settings.UserTracker;
import com.android.systemui.util.settings.SecureSettings;
import javax.inject.Inject;
+import javax.inject.Named;
/** Quick settings tile: Reduce Bright Colors **/
public class ReduceBrightColorsTile extends QSTileImpl {
@@ -46,9 +48,11 @@ public class ReduceBrightColorsTile extends QSTileImpl {
//TODO(b/170973645): get icon drawable
private final Icon mIcon = null;
private final SecureSetting mActivatedSetting;
+ private final boolean mIsAvailable;
@Inject
public ReduceBrightColorsTile(
+ @Named(RBC_AVAILABLE) boolean isAvailable,
QSHost host,
@Background Looper backgroundLooper,
@Main Handler mainHandler,
@@ -69,11 +73,12 @@ public class ReduceBrightColorsTile extends QSTileImpl {
refreshState();
}
};
+ mIsAvailable = isAvailable;
+
}
@Override
public boolean isAvailable() {
- // TODO(b/170970675): Call into ColorDisplayService to get availability/config status
- return true;
+ return mIsAvailable;
}
@Override
@@ -121,15 +126,6 @@ public class ReduceBrightColorsTile extends QSTileImpl {
state.label = mContext.getString(R.string.quick_settings_reduce_bright_colors_label);
state.expandedAccessibilityClassName = Switch.class.getName();
state.contentDescription = state.label;
-
- final int intensity = Settings.Secure.getIntForUser(mContext.getContentResolver(),
- Settings.Secure.REDUCE_BRIGHT_COLORS_LEVEL, 0, mActivatedSetting.getCurrentUser());
- state.secondaryLabel = state.value ? mContext.getString(
- R.string.quick_settings_reduce_bright_colors_secondary_label, intensity) : "";
-
- state.contentDescription = TextUtils.isEmpty(state.secondaryLabel)
- ? state.label
- : TextUtils.concat(state.label, ", ", state.secondaryLabel);
}
@Override
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/ReduceBrightColorsTileTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/ReduceBrightColorsTileTest.java
index 78af20f9db31a..ffd747e09e232 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/ReduceBrightColorsTileTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/ReduceBrightColorsTileTest.java
@@ -75,6 +75,7 @@ public class ReduceBrightColorsTileTest extends SysuiTestCase {
mFakeSettings = new FakeSettings();
mTile = new ReduceBrightColorsTile(
+ true,
mHost,
mTestableLooper.getLooper(),
new Handler(mTestableLooper.getLooper()),
@@ -95,7 +96,6 @@ public class ReduceBrightColorsTileTest extends SysuiTestCase {
assertEquals(Tile.STATE_INACTIVE, mTile.getState().state);
assertEquals(mTile.getState().label.toString(),
mContext.getString(R.string.quick_settings_reduce_bright_colors_label));
- assertEquals(mTile.getState().secondaryLabel.toString(), "");
}
@Test
@@ -128,13 +128,5 @@ public class ReduceBrightColorsTileTest extends SysuiTestCase {
assertEquals(Tile.STATE_ACTIVE, mTile.getState().state);
assertEquals(mTile.getState().label.toString(),
mContext.getString(R.string.quick_settings_reduce_bright_colors_label));
-
- final int intensity = Settings.Secure.getIntForUser(mContext.getContentResolver(),
- Settings.Secure.REDUCE_BRIGHT_COLORS_LEVEL, 0, mUserTracker.getUserId());
-
- assertEquals(
- mContext.getString(
- R.string.quick_settings_reduce_bright_colors_secondary_label, intensity),
- mTile.getState().secondaryLabel.toString());
}
}