From f31e6d704efc41c87526d0da2ac12a59d5e2f6b9 Mon Sep 17 00:00:00 2001 From: Jason Monk Date: Mon, 13 Jun 2016 15:39:11 -0400 Subject: [PATCH] Make sure we don't accidentally allow the night mode tile Bug: 28887927 Change-Id: I7cf9ae3f0c853d70172b2af3e75cd8d0106afde1 --- .../statusbar/phone/AutoTileManager.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/AutoTileManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/AutoTileManager.java index 6d0fbb15ca64b..58fbd4c954d20 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/AutoTileManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/AutoTileManager.java @@ -80,14 +80,16 @@ public class AutoTileManager { new NightModeController.Listener() { @Override public void onNightModeChanged() { - mHost.addTile("night"); - Prefs.putBoolean(mContext, Key.QS_NIGHT_ADDED, true); - mHandler.post(new Runnable() { - @Override - public void run() { - mHost.getNightModeController().removeListener(mNightModeListener); - } - }); + if (mHost.getNightModeController().isEnabled()) { + mHost.addTile("night"); + Prefs.putBoolean(mContext, Key.QS_NIGHT_ADDED, true); + mHandler.post(new Runnable() { + @Override + public void run() { + mHost.getNightModeController().removeListener(mNightModeListener); + } + }); + } } @Override