Merge "Make sure the correct QS tiles are used for Provider Model" into sc-dev
This commit is contained in:
@@ -99,7 +99,7 @@
|
|||||||
|
|
||||||
<!-- The default tiles to display in QuickSettings -->
|
<!-- The default tiles to display in QuickSettings -->
|
||||||
<string name="quick_settings_tiles_default" translatable="false">
|
<string name="quick_settings_tiles_default" translatable="false">
|
||||||
wifi,bt,dnd,flashlight,rotation,battery,cell,airplane,cast,screenrecord
|
internet,wifi,bt,dnd,flashlight,rotation,battery,cell,airplane,cast,screenrecord
|
||||||
</string>
|
</string>
|
||||||
|
|
||||||
<!-- The minimum number of tiles to display in QuickSettings -->
|
<!-- The minimum number of tiles to display in QuickSettings -->
|
||||||
@@ -107,7 +107,7 @@
|
|||||||
|
|
||||||
<!-- Tiles native to System UI. Order should match "quick_settings_tiles_default" -->
|
<!-- Tiles native to System UI. Order should match "quick_settings_tiles_default" -->
|
||||||
<string name="quick_settings_tiles_stock" translatable="false">
|
<string name="quick_settings_tiles_stock" translatable="false">
|
||||||
wifi,cell,battery,dnd,flashlight,rotation,bt,airplane,location,hotspot,inversion,saver,dark,work,cast,night,screenrecord,reverse,reduce_brightness,cameratoggle,mictoggle,controls,alarm,wallet
|
internet,wifi,cell,battery,dnd,flashlight,rotation,bt,airplane,location,hotspot,inversion,saver,dark,work,cast,night,screenrecord,reverse,reduce_brightness,cameratoggle,mictoggle,controls,alarm,wallet
|
||||||
</string>
|
</string>
|
||||||
|
|
||||||
<!-- The tiles to display in QuickSettings -->
|
<!-- The tiles to display in QuickSettings -->
|
||||||
|
|||||||
@@ -474,22 +474,21 @@ public class QSTileHost implements QSHost, Tunable, PluginListener<QSFactory>, D
|
|||||||
if (tiles.contains("internet") || tiles.contains("wifi") || tiles.contains("cell")) {
|
if (tiles.contains("internet") || tiles.contains("wifi") || tiles.contains("cell")) {
|
||||||
if (FeatureFlagUtils.isEnabled(context, FeatureFlagUtils.SETTINGS_PROVIDER_MODEL)) {
|
if (FeatureFlagUtils.isEnabled(context, FeatureFlagUtils.SETTINGS_PROVIDER_MODEL)) {
|
||||||
if (!tiles.contains("internet")) {
|
if (!tiles.contains("internet")) {
|
||||||
tiles.add("internet");
|
if (tiles.contains("wifi")) {
|
||||||
}
|
// Replace the WiFi with Internet, and remove the Cell
|
||||||
if (tiles.contains("wifi")) {
|
tiles.set(tiles.indexOf("wifi"), "internet");
|
||||||
|
tiles.remove("cell");
|
||||||
|
} else if (tiles.contains("cell")) {
|
||||||
|
// Replace the Cell with Internet
|
||||||
|
tiles.set(tiles.indexOf("cell"), "internet");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
tiles.remove("wifi");
|
tiles.remove("wifi");
|
||||||
}
|
|
||||||
if (tiles.contains("cell")) {
|
|
||||||
tiles.remove("cell");
|
tiles.remove("cell");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (tiles.contains("internet")) {
|
if (tiles.contains("internet")) {
|
||||||
tiles.remove("internet");
|
tiles.set(tiles.indexOf("internet"), "wifi");
|
||||||
}
|
|
||||||
if (!tiles.contains("wifi")) {
|
|
||||||
tiles.add("wifi");
|
|
||||||
}
|
|
||||||
if (!tiles.contains("cell")) {
|
|
||||||
tiles.add("cell");
|
tiles.add("cell");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -513,6 +512,14 @@ public class QSTileHost implements QSHost, Tunable, PluginListener<QSFactory>, D
|
|||||||
&& GarbageMonitor.ADD_MEMORY_TILE_TO_DEFAULT_ON_DEBUGGABLE_BUILDS) {
|
&& GarbageMonitor.ADD_MEMORY_TILE_TO_DEFAULT_ON_DEBUGGABLE_BUILDS) {
|
||||||
tiles.add(GarbageMonitor.MemoryTile.TILE_SPEC);
|
tiles.add(GarbageMonitor.MemoryTile.TILE_SPEC);
|
||||||
}
|
}
|
||||||
|
// TODO(b/174753536): Change the config file directly.
|
||||||
|
// Filter out unused tiles from the default QS config.
|
||||||
|
if (FeatureFlagUtils.isEnabled(context, FeatureFlagUtils.SETTINGS_PROVIDER_MODEL)) {
|
||||||
|
tiles.remove("cell");
|
||||||
|
tiles.remove("wifi");
|
||||||
|
} else {
|
||||||
|
tiles.remove("internet");
|
||||||
|
}
|
||||||
return tiles;
|
return tiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -115,34 +115,13 @@ public class TileQueryHelper {
|
|||||||
|
|
||||||
final ArrayList<QSTile> tilesToAdd = new ArrayList<>();
|
final ArrayList<QSTile> tilesToAdd = new ArrayList<>();
|
||||||
// TODO(b/174753536): Move it into the config file.
|
// TODO(b/174753536): Move it into the config file.
|
||||||
// Only do the below hacking when at least one of the below tiles exist
|
if (FeatureFlagUtils.isEnabled(mContext, FeatureFlagUtils.SETTINGS_PROVIDER_MODEL)) {
|
||||||
// --InternetTile
|
possibleTiles.remove("cell");
|
||||||
// --WiFiTile
|
possibleTiles.remove("wifi");
|
||||||
// --CellularTIle
|
} else {
|
||||||
if (possibleTiles.contains("internet") || possibleTiles.contains("wifi")
|
possibleTiles.remove("internet");
|
||||||
|| possibleTiles.contains("cell")) {
|
|
||||||
if (FeatureFlagUtils.isEnabled(mContext, FeatureFlagUtils.SETTINGS_PROVIDER_MODEL)) {
|
|
||||||
if (!possibleTiles.contains("internet")) {
|
|
||||||
possibleTiles.add("internet");
|
|
||||||
}
|
|
||||||
if (possibleTiles.contains("wifi")) {
|
|
||||||
possibleTiles.remove("wifi");
|
|
||||||
}
|
|
||||||
if (possibleTiles.contains("cell")) {
|
|
||||||
possibleTiles.remove("cell");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (possibleTiles.contains("internet")) {
|
|
||||||
possibleTiles.remove("internet");
|
|
||||||
}
|
|
||||||
if (!possibleTiles.contains("wifi")) {
|
|
||||||
possibleTiles.add("wifi");
|
|
||||||
}
|
|
||||||
if (!possibleTiles.contains("cell")) {
|
|
||||||
possibleTiles.add("cell");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String spec : possibleTiles) {
|
for (String spec : possibleTiles) {
|
||||||
// Only add current and stock tiles that can be created from QSFactoryImpl.
|
// Only add current and stock tiles that can be created from QSFactoryImpl.
|
||||||
// Do not include CustomTile. Those will be created by `addPackageTiles`.
|
// Do not include CustomTile. Those will be created by `addPackageTiles`.
|
||||||
|
|||||||
Reference in New Issue
Block a user