Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f65611ef authored by Ying Xu's avatar Ying Xu Committed by Android (Google) Code Review
Browse files

Merge "Make sure the correct QS tiles are used for Provider Model" into sc-dev

parents b8f4c0e6 ee6f1132
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -99,7 +99,7 @@

    <!-- The default tiles to display in QuickSettings -->
    <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>

    <!-- 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" -->
    <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>

    <!-- The tiles to display in QuickSettings -->
+18 −11
Original line number Diff line number Diff line
@@ -474,22 +474,21 @@ public class QSTileHost implements QSHost, Tunable, PluginListener<QSFactory>, D
        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");
                        // Replace the WiFi with Internet, and remove the Cell
                        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");
                    }
                if (tiles.contains("cell")) {
                } else {
                    tiles.remove("wifi");
                    tiles.remove("cell");
                }
            } else {
                if (tiles.contains("internet")) {
                    tiles.remove("internet");
                }
                if (!tiles.contains("wifi")) {
                    tiles.add("wifi");
                }
                if (!tiles.contains("cell")) {
                    tiles.set(tiles.indexOf("internet"), "wifi");
                    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) {
            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;
    }

+6 −27
Original line number Diff line number Diff line
@@ -115,34 +115,13 @@ public class TileQueryHelper {

        final ArrayList<QSTile> tilesToAdd = new ArrayList<>();
        // 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 (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");
                }
            possibleTiles.remove("wifi");
        } 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) {
            // Only add current and stock tiles that can be created from QSFactoryImpl.
            // Do not include CustomTile. Those will be created by `addPackageTiles`.