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

Commit 23e000f9 authored by Fabian Kozynski's avatar Fabian Kozynski
Browse files

Added logging in QsTileHost#onTuningChanged

Removed guards for most of the logging. Still guarded for tiles that are
added, as it goes through all the tiles every time something changes and
it's pretty verbose.

Also added log for destroyed tiles due to not being available.

These logs are not too frequent, happening only when a user is started
on the device and when the tiles are customized.

Test: adb logcat
Bug: 138848764
Change-Id: Ica203a6611d54ce22c9d426b0413e8b543ba41b3
parent 755f7268
Loading
Loading
Loading
Loading
+6 −4
Original line number Original line Diff line number Diff line
@@ -222,7 +222,7 @@ public class QSTileHost implements QSHost, Tunable, PluginListener<QSFactory>, D
        if (!TILES_SETTING.equals(key)) {
        if (!TILES_SETTING.equals(key)) {
            return;
            return;
        }
        }
        if (DEBUG) Log.d(TAG, "Recreating tiles");
        Log.d(TAG, "Recreating tiles");
        if (newValue == null && UserManager.isDeviceInDemoMode(mContext)) {
        if (newValue == null && UserManager.isDeviceInDemoMode(mContext)) {
            newValue = mContext.getResources().getString(R.string.quick_settings_tiles_retail_mode);
            newValue = mContext.getResources().getString(R.string.quick_settings_tiles_retail_mode);
        }
        }
@@ -231,7 +231,7 @@ public class QSTileHost implements QSHost, Tunable, PluginListener<QSFactory>, D
        if (tileSpecs.equals(mTileSpecs) && currentUser == mCurrentUser) return;
        if (tileSpecs.equals(mTileSpecs) && currentUser == mCurrentUser) return;
        mTiles.entrySet().stream().filter(tile -> !tileSpecs.contains(tile.getKey())).forEach(
        mTiles.entrySet().stream().filter(tile -> !tileSpecs.contains(tile.getKey())).forEach(
                tile -> {
                tile -> {
                    if (DEBUG) Log.d(TAG, "Destroying tile: " + tile.getKey());
                    Log.d(TAG, "Destroying tile: " + tile.getKey());
                    tile.getValue().destroy();
                    tile.getValue().destroy();
                });
                });
        final LinkedHashMap<String, QSTile> newTiles = new LinkedHashMap<>();
        final LinkedHashMap<String, QSTile> newTiles = new LinkedHashMap<>();
@@ -248,9 +248,10 @@ public class QSTileHost implements QSHost, Tunable, PluginListener<QSFactory>, D
                    newTiles.put(tileSpec, tile);
                    newTiles.put(tileSpec, tile);
                } else {
                } else {
                    tile.destroy();
                    tile.destroy();
                    Log.d(TAG, "Destroying not available tile: " + tileSpec);
                }
                }
            } else {
            } else {
                if (DEBUG) Log.d(TAG, "Creating tile: " + tileSpec);
                Log.d(TAG, "Creating tile: " + tileSpec);
                try {
                try {
                    tile = createTile(tileSpec);
                    tile = createTile(tileSpec);
                    if (tile != null) {
                    if (tile != null) {
@@ -259,6 +260,7 @@ public class QSTileHost implements QSHost, Tunable, PluginListener<QSFactory>, D
                            newTiles.put(tileSpec, tile);
                            newTiles.put(tileSpec, tile);
                        } else {
                        } else {
                            tile.destroy();
                            tile.destroy();
                            Log.d(TAG, "Destroying not available tile: " + tileSpec);
                        }
                        }
                    }
                    }
                } catch (Throwable t) {
                } catch (Throwable t) {
@@ -274,7 +276,7 @@ public class QSTileHost implements QSHost, Tunable, PluginListener<QSFactory>, D
        mTiles.putAll(newTiles);
        mTiles.putAll(newTiles);
        if (newTiles.isEmpty() && !tileSpecs.isEmpty()) {
        if (newTiles.isEmpty() && !tileSpecs.isEmpty()) {
            // If we didn't manage to create any tiles, set it to empty (default)
            // If we didn't manage to create any tiles, set it to empty (default)
            if (DEBUG) Log.d(TAG, "No valid tiles on tuning changed. Setting to default.");
            Log.d(TAG, "No valid tiles on tuning changed. Setting to default.");
            changeTiles(currentSpecs, loadTileSpecs(mContext, ""));
            changeTiles(currentSpecs, loadTileSpecs(mContext, ""));
        } else {
        } else {
            for (int i = 0; i < mCallbacks.size(); i++) {
            for (int i = 0; i < mCallbacks.size(); i++) {