diff options
| author | 2020-04-13 18:54:59 +0000 | |
|---|---|---|
| committer | 2020-04-13 18:54:59 +0000 | |
| commit | b866719a1ddf9f86eb2bc3bb1b6ed70da2152213 (patch) | |
| tree | f32d6151cfb02377e0ee645c307257b2946f5965 | |
| parent | 01f473ab78d0edae3eef867d245e5cf82d97fdd5 (diff) | |
| parent | 14079c96bfe7278bf8d6f9feff82914935fca677 (diff) | |
Merge "Twilight mode tile when location is off" into rvc-dev
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/qs/tiles/NightDisplayTile.java | 6 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/qs/tiles/UiModeNightTile.java | 8 |
2 files changed, 11 insertions, 3 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/NightDisplayTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/NightDisplayTile.java index bc1c1e12203e..2f582727c766 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/NightDisplayTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/NightDisplayTile.java @@ -38,6 +38,7 @@ import com.android.systemui.R; import com.android.systemui.plugins.qs.QSTile.BooleanState; import com.android.systemui.qs.QSHost; import com.android.systemui.qs.tileimpl.QSTileImpl; +import com.android.systemui.statusbar.policy.LocationController; import java.text.DateFormat; import java.time.LocalTime; @@ -60,12 +61,14 @@ public class NightDisplayTile extends QSTileImpl<BooleanState> implements private static final String PATTERN_HOUR_NINUTE_24 = "HH:mm"; private final ColorDisplayManager mManager; + private final LocationController mLocationController; private NightDisplayListener mListener; private boolean mIsListening; @Inject - public NightDisplayTile(QSHost host) { + public NightDisplayTile(QSHost host, LocationController locationController) { super(host); + mLocationController = locationController; mManager = mContext.getSystemService(ColorDisplayManager.class); mListener = new NightDisplayListener(mContext, new Handler(Looper.myLooper())); } @@ -132,6 +135,7 @@ public class NightDisplayTile extends QSTileImpl<BooleanState> implements private String getSecondaryLabel(boolean isNightLightActivated) { switch (mManager.getNightDisplayAutoMode()) { case ColorDisplayManager.AUTO_MODE_TWILIGHT: + if (!mLocationController.isLocationEnabled()) return null; // Auto mode related to sunrise & sunset. If the light is on, it's guaranteed to be // turned off at sunrise. If it's off, it's guaranteed to be turned on at sunset. return isNightLightActivated diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/UiModeNightTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/UiModeNightTile.java index b90ca01df481..7b83c20d4b86 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/UiModeNightTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/UiModeNightTile.java @@ -31,6 +31,7 @@ import com.android.systemui.qs.QSHost; import com.android.systemui.qs.tileimpl.QSTileImpl; import com.android.systemui.statusbar.policy.BatteryController; import com.android.systemui.statusbar.policy.ConfigurationController; +import com.android.systemui.statusbar.policy.LocationController; import java.time.LocalTime; import java.time.format.DateTimeFormatter; @@ -51,13 +52,15 @@ public class UiModeNightTile extends QSTileImpl<QSTile.BooleanState> implements com.android.internal.R.drawable.ic_qs_ui_mode_night); private final UiModeManager mUiModeManager; private final BatteryController mBatteryController; + private final LocationController mLocationController; @Inject public UiModeNightTile(QSHost host, ConfigurationController configurationController, - BatteryController batteryController) { + BatteryController batteryController, LocationController locationController) { super(host); mBatteryController = batteryController; mUiModeManager = mContext.getSystemService(UiModeManager.class); + mLocationController = locationController; configurationController.observe(getLifecycle(), this); batteryController.observe(getLifecycle(), this); } @@ -97,7 +100,8 @@ public class UiModeNightTile extends QSTileImpl<QSTile.BooleanState> implements if (powerSave) { state.secondaryLabel = mContext.getResources().getString( R.string.quick_settings_dark_mode_secondary_label_battery_saver); - } else if (uiMode == UiModeManager.MODE_NIGHT_AUTO) { + } else if (uiMode == UiModeManager.MODE_NIGHT_AUTO + && mLocationController.isLocationEnabled()) { state.secondaryLabel = mContext.getResources().getString(nightMode ? R.string.quick_settings_dark_mode_secondary_label_until_sunrise : R.string.quick_settings_dark_mode_secondary_label_on_at_sunset); |