Loading packages/SystemUI/src/com/android/systemui/Prefs.java +8 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,10 @@ public final class Prefs { Key.DND_NONE_SELECTED, Key.DND_FAVORITE_ZEN, Key.TV_PICTURE_IN_PICTURE_ONBOARDING_SHOWN, Key.QS_HOTSPOT_ADDED, Key.QS_DATA_SAVER_ADDED, Key.QS_INVERT_COLORS_ADDED, Key.QS_WORK_ADDED, }) public @interface Key { String OVERVIEW_SEARCH_APP_WIDGET_ID = "searchAppWidgetId"; Loading @@ -60,6 +64,10 @@ public final class Prefs { String DND_NONE_SELECTED = "DndNoneSelected"; String DND_FAVORITE_ZEN = "DndFavoriteZen"; String TV_PICTURE_IN_PICTURE_ONBOARDING_SHOWN = "TvPictureInPictureOnboardingShown"; String QS_HOTSPOT_ADDED = "QsHotspotAdded"; String QS_DATA_SAVER_ADDED = "QsDataSaverAdded"; String QS_INVERT_COLORS_ADDED = "QsInvertColorsAdded"; String QS_WORK_ADDED = "QsWorkAdded"; } public static boolean getBoolean(Context context, @Key String key, boolean defaultValue) { Loading packages/SystemUI/src/com/android/systemui/qs/QSTile.java +11 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import android.view.ViewGroup; import com.android.settingslib.RestrictedLockUtils; import com.android.systemui.qs.QSTile.State; import com.android.systemui.qs.external.TileServices; import com.android.systemui.statusbar.phone.ManagedProfileController; import com.android.systemui.statusbar.policy.BatteryController; import com.android.systemui.statusbar.policy.BluetoothController; import com.android.systemui.statusbar.policy.CastController; Loading Loading @@ -114,6 +115,15 @@ public abstract class QSTile<TState extends State> implements Listenable { return null; // optional } /** * Is a startup check whether this device currently supports this tile. * Should not be used to conditionally hide tiles. Only checked on tile * creation or whether should be shown in edit screen. */ public boolean isAvailable() { return true; } public interface DetailAdapter { CharSequence getTitle(); Boolean getToggleState(); Loading Loading @@ -392,6 +402,7 @@ public abstract class QSTile<TState extends State> implements Listenable { TileServices getTileServices(); DisplayController getDisplayController(); void removeTile(String tileSpec); ManagedProfileController getManagedProfileController(); public interface Callback { Loading packages/SystemUI/src/com/android/systemui/qs/customize/TileQueryHelper.java +2 −2 Original line number Diff line number Diff line Loading @@ -55,14 +55,14 @@ public class TileQueryHelper { private void addSystemTiles(QSTileHost host) { boolean hasColorMod = host.getDisplayController().isEnabled(); String possible = mContext.getString(R.string.quick_settings_tiles_default) + ",hotspot,inversion,saver" + (hasColorMod ? ",colors" : ""); + ",hotspot,inversion,saver,work" + (hasColorMod ? ",colors" : ""); String[] possibleTiles = possible.split(","); final Handler qsHandler = new Handler(host.getLooper()); final Handler mainHandler = new Handler(Looper.getMainLooper()); for (int i = 0; i < possibleTiles.length; i++) { final String spec = possibleTiles[i]; final QSTile<?> tile = host.createTile(spec); if (tile == null) { if (tile == null || !tile.isAvailable()) { continue; } tile.setListening(true); Loading packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java +3 −2 Original line number Diff line number Diff line Loading @@ -146,8 +146,9 @@ public class BluetoothTile extends QSTile<QSTile.BooleanState> { } } public static boolean isSupported(Host host) { return host.getBluetoothController().isBluetoothSupported(); @Override public boolean isAvailable() { return mController.isBluetoothSupported(); } private final BluetoothController.Callback mCallback = new BluetoothController.Callback() { Loading packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java +5 −4 Original line number Diff line number Diff line Loading @@ -136,6 +136,11 @@ public class CellularTile extends QSTile<QSTile.SignalState> { return MetricsEvent.QS_CELLULAR; } @Override public boolean isAvailable() { return mController.hasMobileDataFeature(); } // Remove the period from the network name public static String removeTrailingPeriod(String string) { if (string == null) return null; Loading @@ -146,10 +151,6 @@ public class CellularTile extends QSTile<QSTile.SignalState> { return string; } public static boolean isSupported(Host host) { return host.getNetworkController().hasMobileDataFeature(); } private static final class CallbackInfo { boolean enabled; boolean wifiEnabled; Loading Loading
packages/SystemUI/src/com/android/systemui/Prefs.java +8 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,10 @@ public final class Prefs { Key.DND_NONE_SELECTED, Key.DND_FAVORITE_ZEN, Key.TV_PICTURE_IN_PICTURE_ONBOARDING_SHOWN, Key.QS_HOTSPOT_ADDED, Key.QS_DATA_SAVER_ADDED, Key.QS_INVERT_COLORS_ADDED, Key.QS_WORK_ADDED, }) public @interface Key { String OVERVIEW_SEARCH_APP_WIDGET_ID = "searchAppWidgetId"; Loading @@ -60,6 +64,10 @@ public final class Prefs { String DND_NONE_SELECTED = "DndNoneSelected"; String DND_FAVORITE_ZEN = "DndFavoriteZen"; String TV_PICTURE_IN_PICTURE_ONBOARDING_SHOWN = "TvPictureInPictureOnboardingShown"; String QS_HOTSPOT_ADDED = "QsHotspotAdded"; String QS_DATA_SAVER_ADDED = "QsDataSaverAdded"; String QS_INVERT_COLORS_ADDED = "QsInvertColorsAdded"; String QS_WORK_ADDED = "QsWorkAdded"; } public static boolean getBoolean(Context context, @Key String key, boolean defaultValue) { Loading
packages/SystemUI/src/com/android/systemui/qs/QSTile.java +11 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import android.view.ViewGroup; import com.android.settingslib.RestrictedLockUtils; import com.android.systemui.qs.QSTile.State; import com.android.systemui.qs.external.TileServices; import com.android.systemui.statusbar.phone.ManagedProfileController; import com.android.systemui.statusbar.policy.BatteryController; import com.android.systemui.statusbar.policy.BluetoothController; import com.android.systemui.statusbar.policy.CastController; Loading Loading @@ -114,6 +115,15 @@ public abstract class QSTile<TState extends State> implements Listenable { return null; // optional } /** * Is a startup check whether this device currently supports this tile. * Should not be used to conditionally hide tiles. Only checked on tile * creation or whether should be shown in edit screen. */ public boolean isAvailable() { return true; } public interface DetailAdapter { CharSequence getTitle(); Boolean getToggleState(); Loading Loading @@ -392,6 +402,7 @@ public abstract class QSTile<TState extends State> implements Listenable { TileServices getTileServices(); DisplayController getDisplayController(); void removeTile(String tileSpec); ManagedProfileController getManagedProfileController(); public interface Callback { Loading
packages/SystemUI/src/com/android/systemui/qs/customize/TileQueryHelper.java +2 −2 Original line number Diff line number Diff line Loading @@ -55,14 +55,14 @@ public class TileQueryHelper { private void addSystemTiles(QSTileHost host) { boolean hasColorMod = host.getDisplayController().isEnabled(); String possible = mContext.getString(R.string.quick_settings_tiles_default) + ",hotspot,inversion,saver" + (hasColorMod ? ",colors" : ""); + ",hotspot,inversion,saver,work" + (hasColorMod ? ",colors" : ""); String[] possibleTiles = possible.split(","); final Handler qsHandler = new Handler(host.getLooper()); final Handler mainHandler = new Handler(Looper.getMainLooper()); for (int i = 0; i < possibleTiles.length; i++) { final String spec = possibleTiles[i]; final QSTile<?> tile = host.createTile(spec); if (tile == null) { if (tile == null || !tile.isAvailable()) { continue; } tile.setListening(true); Loading
packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java +3 −2 Original line number Diff line number Diff line Loading @@ -146,8 +146,9 @@ public class BluetoothTile extends QSTile<QSTile.BooleanState> { } } public static boolean isSupported(Host host) { return host.getBluetoothController().isBluetoothSupported(); @Override public boolean isAvailable() { return mController.isBluetoothSupported(); } private final BluetoothController.Callback mCallback = new BluetoothController.Callback() { Loading
packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java +5 −4 Original line number Diff line number Diff line Loading @@ -136,6 +136,11 @@ public class CellularTile extends QSTile<QSTile.SignalState> { return MetricsEvent.QS_CELLULAR; } @Override public boolean isAvailable() { return mController.hasMobileDataFeature(); } // Remove the period from the network name public static String removeTrailingPeriod(String string) { if (string == null) return null; Loading @@ -146,10 +151,6 @@ public class CellularTile extends QSTile<QSTile.SignalState> { return string; } public static boolean isSupported(Host host) { return host.getNetworkController().hasMobileDataFeature(); } private static final class CallbackInfo { boolean enabled; boolean wifiEnabled; Loading