Loading packages/SystemUI/src/com/android/systemui/qs/tiles/NightDisplayTile.java +21 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.systemui.qs.tiles; import android.app.ActivityManager; import android.content.Intent; import android.provider.Settings; import android.widget.Switch; Loading @@ -29,11 +30,12 @@ import com.android.systemui.qs.QSTile; public class NightDisplayTile extends QSTile<QSTile.BooleanState> implements NightDisplayController.Callback { private final NightDisplayController mController; private NightDisplayController mController; private boolean mIsListening; public NightDisplayTile(Host host) { super(host); mController = new NightDisplayController(mContext); mController = new NightDisplayController(mContext, ActivityManager.getCurrentUser()); } @Override Loading @@ -53,6 +55,22 @@ public class NightDisplayTile extends QSTile<QSTile.BooleanState> mController.setActivated(activated); } @Override protected void handleUserSwitch(int newUserId) { // Stop listening to the old controller. if (mIsListening) { mController.setListener(null); } // Make a new controller for the new user. mController = new NightDisplayController(mContext, newUserId); if (mIsListening) { mController.setListener(this); } super.handleUserSwitch(newUserId); } @Override protected void handleUpdateState(BooleanState state, Object arg) { final boolean isActivated = mController.isActivated(); Loading @@ -79,6 +97,7 @@ public class NightDisplayTile extends QSTile<QSTile.BooleanState> @Override protected void setListening(boolean listening) { mIsListening = listening; if (listening) { mController.setListener(this); refreshState(); Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java +3 −0 Original line number Diff line number Diff line Loading @@ -334,6 +334,9 @@ public class QSTileHost implements QSTile.Host, Tunable { || ((CustomTile) tile).getUser() == currentUser)) { if (DEBUG) Log.d(TAG, "Adding " + tile); tile.removeCallbacks(); if (!(tile instanceof CustomTile) && mCurrentUser != currentUser) { tile.userSwitch(currentUser); } newTiles.put(tileSpec, tile); } else { if (DEBUG) Log.d(TAG, "Creating tile: " + tileSpec); Loading Loading
packages/SystemUI/src/com/android/systemui/qs/tiles/NightDisplayTile.java +21 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.systemui.qs.tiles; import android.app.ActivityManager; import android.content.Intent; import android.provider.Settings; import android.widget.Switch; Loading @@ -29,11 +30,12 @@ import com.android.systemui.qs.QSTile; public class NightDisplayTile extends QSTile<QSTile.BooleanState> implements NightDisplayController.Callback { private final NightDisplayController mController; private NightDisplayController mController; private boolean mIsListening; public NightDisplayTile(Host host) { super(host); mController = new NightDisplayController(mContext); mController = new NightDisplayController(mContext, ActivityManager.getCurrentUser()); } @Override Loading @@ -53,6 +55,22 @@ public class NightDisplayTile extends QSTile<QSTile.BooleanState> mController.setActivated(activated); } @Override protected void handleUserSwitch(int newUserId) { // Stop listening to the old controller. if (mIsListening) { mController.setListener(null); } // Make a new controller for the new user. mController = new NightDisplayController(mContext, newUserId); if (mIsListening) { mController.setListener(this); } super.handleUserSwitch(newUserId); } @Override protected void handleUpdateState(BooleanState state, Object arg) { final boolean isActivated = mController.isActivated(); Loading @@ -79,6 +97,7 @@ public class NightDisplayTile extends QSTile<QSTile.BooleanState> @Override protected void setListening(boolean listening) { mIsListening = listening; if (listening) { mController.setListener(this); refreshState(); Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java +3 −0 Original line number Diff line number Diff line Loading @@ -334,6 +334,9 @@ public class QSTileHost implements QSTile.Host, Tunable { || ((CustomTile) tile).getUser() == currentUser)) { if (DEBUG) Log.d(TAG, "Adding " + tile); tile.removeCallbacks(); if (!(tile instanceof CustomTile) && mCurrentUser != currentUser) { tile.userSwitch(currentUser); } newTiles.put(tileSpec, tile); } else { if (DEBUG) Log.d(TAG, "Creating tile: " + tileSpec); Loading