Fix the QS Tile issue
Bug: 182430245 Test: Manual tests Change-Id: I4188007aeed70a5a2d4ba6ac1fdc79203cf955e3
This commit is contained in:
@@ -445,11 +445,6 @@ public class QSTileHost implements QSHost, Tunable, PluginListener<QSFactory>, D
|
||||
final ArrayList<String> tiles = new ArrayList<String>();
|
||||
boolean addedDefault = false;
|
||||
Set<String> addedSpecs = new ArraySet<>();
|
||||
// TODO(b/174753536): Move it into the config file.
|
||||
if (FeatureFlagUtils.isEnabled(context, FeatureFlagUtils.SETTINGS_PROVIDER_MODEL)) {
|
||||
tiles.add("internet");
|
||||
addedSpecs.add("internet");
|
||||
}
|
||||
for (String tile : tileList.split(",")) {
|
||||
tile = tile.trim();
|
||||
if (tile.isEmpty()) continue;
|
||||
@@ -457,17 +452,6 @@ public class QSTileHost implements QSHost, Tunable, PluginListener<QSFactory>, D
|
||||
if (!addedDefault) {
|
||||
List<String> defaultSpecs = getDefaultSpecs(context);
|
||||
for (String spec : defaultSpecs) {
|
||||
// TODO(b/174753536): Move it into the config file.
|
||||
if (FeatureFlagUtils.isEnabled(
|
||||
context, FeatureFlagUtils.SETTINGS_PROVIDER_MODEL)) {
|
||||
if (spec.equals("wifi") || spec.equals("cell")) {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
if (spec.equals("internet")) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (!addedSpecs.contains(spec)) {
|
||||
tiles.add(spec);
|
||||
addedSpecs.add(spec);
|
||||
@@ -476,18 +460,40 @@ public class QSTileHost implements QSHost, Tunable, PluginListener<QSFactory>, D
|
||||
addedDefault = true;
|
||||
}
|
||||
} else {
|
||||
// TODO(b/174753536): Move it into the config file.
|
||||
if (FeatureFlagUtils.isEnabled(context, FeatureFlagUtils.SETTINGS_PROVIDER_MODEL)) {
|
||||
if (tile.equals("wifi") || tile.equals("cell")) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (!addedSpecs.contains(tile)) {
|
||||
tiles.add(tile);
|
||||
addedSpecs.add(tile);
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO(b/174753536): Move it into the config file.
|
||||
// Only do the below hacking when at least one of the below tiles exist
|
||||
// --InternetTile
|
||||
// --WiFiTile
|
||||
// --CellularTIle
|
||||
if (tiles.contains("internet") || tiles.contains("wifi") || tiles.contains("cell")) {
|
||||
if (FeatureFlagUtils.isEnabled(context, FeatureFlagUtils.SETTINGS_PROVIDER_MODEL)) {
|
||||
if (!tiles.contains("internet")) {
|
||||
tiles.add("internet");
|
||||
}
|
||||
if (tiles.contains("wifi")) {
|
||||
tiles.remove("wifi");
|
||||
}
|
||||
if (tiles.contains("cell")) {
|
||||
tiles.remove("cell");
|
||||
}
|
||||
} else {
|
||||
if (tiles.contains("internet")) {
|
||||
tiles.remove("internet");
|
||||
}
|
||||
if (!tiles.contains("wifi")) {
|
||||
tiles.add("wifi");
|
||||
}
|
||||
if (!tiles.contains("cell")) {
|
||||
tiles.add("cell");
|
||||
}
|
||||
}
|
||||
}
|
||||
return tiles;
|
||||
}
|
||||
|
||||
|
||||
@@ -115,9 +115,32 @@ public class TileQueryHelper {
|
||||
|
||||
final ArrayList<QSTile> tilesToAdd = new ArrayList<>();
|
||||
// TODO(b/174753536): Move it into the config file.
|
||||
if (FeatureFlagUtils.isEnabled(mContext, FeatureFlagUtils.SETTINGS_PROVIDER_MODEL)) {
|
||||
if (!possibleTiles.contains("internet")) {
|
||||
possibleTiles.add("internet");
|
||||
// Only do the below hacking when at least one of the below tiles exist
|
||||
// --InternetTile
|
||||
// --WiFiTile
|
||||
// --CellularTIle
|
||||
if (possibleTiles.contains("internet") || possibleTiles.contains("wifi")
|
||||
|| 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) {
|
||||
@@ -125,15 +148,6 @@ public class TileQueryHelper {
|
||||
// Do not include CustomTile. Those will be created by `addPackageTiles`.
|
||||
if (spec.startsWith(CustomTile.PREFIX)) continue;
|
||||
// TODO(b/174753536): Move it into the config file.
|
||||
if (FeatureFlagUtils.isEnabled(mContext, FeatureFlagUtils.SETTINGS_PROVIDER_MODEL)) {
|
||||
if (spec.equals("wifi") || spec.equals("cell")) {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
if (spec.equals("internet")) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
final QSTile tile = host.createTile(spec);
|
||||
if (tile == null) {
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user