Merge "Add logs for QS tiles" into udc-dev am: 34a00ec646
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23750846 Change-Id: Icda21e4634f1d99de1324d7e86568deb887d1b8e Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -38,6 +38,7 @@ import android.provider.Settings;
|
|||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.ArraySet;
|
import android.util.ArraySet;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import com.android.internal.annotations.VisibleForTesting;
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
import com.android.internal.app.LocalePicker;
|
import com.android.internal.app.LocalePicker;
|
||||||
@@ -238,6 +239,7 @@ public class SettingsHelper {
|
|||||||
// If we fail to apply the setting, by definition nothing happened
|
// If we fail to apply the setting, by definition nothing happened
|
||||||
sendBroadcast = false;
|
sendBroadcast = false;
|
||||||
sendBroadcastSystemUI = false;
|
sendBroadcastSystemUI = false;
|
||||||
|
Log.e(TAG, "Failed to restore setting name: " + name + " + value: " + value, e);
|
||||||
} finally {
|
} finally {
|
||||||
// If this was an element of interest, send the "we just restored it"
|
// If this was an element of interest, send the "we just restored it"
|
||||||
// broadcast with the historical value now that the new value has
|
// broadcast with the historical value now that the new value has
|
||||||
|
|||||||
@@ -120,6 +120,7 @@ class AutoAddTracker @VisibleForTesting constructor(
|
|||||||
|
|
||||||
val tilesToRemove = restoredAutoAdded.filter { it !in restoredTiles }
|
val tilesToRemove = restoredAutoAdded.filter { it !in restoredTiles }
|
||||||
if (tilesToRemove.isNotEmpty()) {
|
if (tilesToRemove.isNotEmpty()) {
|
||||||
|
Log.d(TAG, "Removing tiles: $tilesToRemove")
|
||||||
qsHost.removeTiles(tilesToRemove)
|
qsHost.removeTiles(tilesToRemove)
|
||||||
}
|
}
|
||||||
val tiles = synchronized(autoAdded) {
|
val tiles = synchronized(autoAdded) {
|
||||||
@@ -255,6 +256,7 @@ class AutoAddTracker @VisibleForTesting constructor(
|
|||||||
|
|
||||||
override fun dump(pw: PrintWriter, args: Array<out String>) {
|
override fun dump(pw: PrintWriter, args: Array<out String>) {
|
||||||
pw.println("Current user: $userId")
|
pw.println("Current user: $userId")
|
||||||
|
pw.println("Restored tiles: $restoredTiles")
|
||||||
pw.println("Added tiles: $autoAdded")
|
pw.println("Added tiles: $autoAdded")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -302,7 +302,7 @@ public class QSTileHost implements QSHost, Tunable, PluginListener<QSFactory>, P
|
|||||||
if (tile != null && (!(tile instanceof CustomTile)
|
if (tile != null && (!(tile instanceof CustomTile)
|
||||||
|| ((CustomTile) tile).getUser() == currentUser)) {
|
|| ((CustomTile) tile).getUser() == currentUser)) {
|
||||||
if (tile.isAvailable()) {
|
if (tile.isAvailable()) {
|
||||||
if (DEBUG) Log.d(TAG, "Adding " + tile);
|
Log.d(TAG, "Adding " + tile);
|
||||||
tile.removeCallbacks();
|
tile.removeCallbacks();
|
||||||
if (!(tile instanceof CustomTile) && mCurrentUser != currentUser) {
|
if (!(tile instanceof CustomTile) && mCurrentUser != currentUser) {
|
||||||
tile.userSwitch(currentUser);
|
tile.userSwitch(currentUser);
|
||||||
@@ -421,6 +421,7 @@ public class QSTileHost implements QSHost, Tunable, PluginListener<QSFactory>, P
|
|||||||
// When calling this, you may want to modify mTilesListDirty accordingly.
|
// When calling this, you may want to modify mTilesListDirty accordingly.
|
||||||
@MainThread
|
@MainThread
|
||||||
private void saveTilesToSettings(List<String> tileSpecs) {
|
private void saveTilesToSettings(List<String> tileSpecs) {
|
||||||
|
Log.d(TAG, "Saving tiles: " + tileSpecs + " for user: " + mCurrentUser);
|
||||||
mSecureSettings.putStringForUser(TILES_SETTING, TextUtils.join(",", tileSpecs),
|
mSecureSettings.putStringForUser(TILES_SETTING, TextUtils.join(",", tileSpecs),
|
||||||
null /* tag */, false /* default */, mCurrentUser,
|
null /* tag */, false /* default */, mCurrentUser,
|
||||||
true /* overrideable by restore */);
|
true /* overrideable by restore */);
|
||||||
@@ -494,7 +495,7 @@ public class QSTileHost implements QSHost, Tunable, PluginListener<QSFactory>, P
|
|||||||
lifecycleManager.flushMessagesAndUnbind();
|
lifecycleManager.flushMessagesAndUnbind();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (DEBUG) Log.d(TAG, "saveCurrentTiles " + newTiles);
|
Log.d(TAG, "saveCurrentTiles " + newTiles);
|
||||||
mTilesListDirty = true;
|
mTilesListDirty = true;
|
||||||
saveTilesToSettings(newTiles);
|
saveTilesToSettings(newTiles);
|
||||||
}
|
}
|
||||||
@@ -565,9 +566,9 @@ public class QSTileHost implements QSHost, Tunable, PluginListener<QSFactory>, P
|
|||||||
|
|
||||||
if (TextUtils.isEmpty(tileList)) {
|
if (TextUtils.isEmpty(tileList)) {
|
||||||
tileList = res.getString(R.string.quick_settings_tiles);
|
tileList = res.getString(R.string.quick_settings_tiles);
|
||||||
if (DEBUG) Log.d(TAG, "Loaded tile specs from default config: " + tileList);
|
Log.d(TAG, "Loaded tile specs from default config: " + tileList);
|
||||||
} else {
|
} else {
|
||||||
if (DEBUG) Log.d(TAG, "Loaded tile specs from setting: " + tileList);
|
Log.d(TAG, "Loaded tile specs from setting: " + tileList);
|
||||||
}
|
}
|
||||||
final ArrayList<String> tiles = new ArrayList<String>();
|
final ArrayList<String> tiles = new ArrayList<String>();
|
||||||
boolean addedDefault = false;
|
boolean addedDefault = false;
|
||||||
@@ -613,6 +614,10 @@ public class QSTileHost implements QSHost, Tunable, PluginListener<QSFactory>, P
|
|||||||
@Override
|
@Override
|
||||||
public void dump(PrintWriter pw, String[] args) {
|
public void dump(PrintWriter pw, String[] args) {
|
||||||
pw.println("QSTileHost:");
|
pw.println("QSTileHost:");
|
||||||
|
pw.println("tile specs: " + mTileSpecs);
|
||||||
|
pw.println("current user: " + mCurrentUser);
|
||||||
|
pw.println("is dirty: " + mTilesListDirty);
|
||||||
|
pw.println("tiles:");
|
||||||
mTiles.values().stream().filter(obj -> obj instanceof Dumpable)
|
mTiles.values().stream().filter(obj -> obj instanceof Dumpable)
|
||||||
.forEach(o -> ((Dumpable) o).dump(pw, args));
|
.forEach(o -> ((Dumpable) o).dump(pw, args));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -297,11 +297,20 @@ public class QSTileHostTest extends SysuiTestCase {
|
|||||||
StringWriter w = new StringWriter();
|
StringWriter w = new StringWriter();
|
||||||
PrintWriter pw = new PrintWriter(w);
|
PrintWriter pw = new PrintWriter(w);
|
||||||
mQSTileHost.dump(pw, new String[]{});
|
mQSTileHost.dump(pw, new String[]{});
|
||||||
String output = "QSTileHost:\n"
|
|
||||||
+ TestTile1.class.getSimpleName() + ":\n"
|
String output = "QSTileHost:" + "\n"
|
||||||
+ " " + MOCK_STATE_STRING + "\n"
|
+ "tile specs: [spec1, spec2]" + "\n"
|
||||||
+ TestTile2.class.getSimpleName() + ":\n"
|
+ "current user: 0" + "\n"
|
||||||
+ " " + MOCK_STATE_STRING + "\n";
|
+ "is dirty: false" + "\n"
|
||||||
|
+ "tiles:" + "\n"
|
||||||
|
+ "TestTile1:" + "\n"
|
||||||
|
+ " MockState" + "\n"
|
||||||
|
+ "TestTile2:" + "\n"
|
||||||
|
+ " MockState" + "\n";
|
||||||
|
|
||||||
|
System.out.println(output);
|
||||||
|
System.out.println(w.getBuffer().toString());
|
||||||
|
|
||||||
assertEquals(output, w.getBuffer().toString());
|
assertEquals(output, w.getBuffer().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user