diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml
index 61b1e30845b36..c4ea2e91dc312 100644
--- a/packages/SystemUI/AndroidManifest.xml
+++ b/packages/SystemUI/AndroidManifest.xml
@@ -259,6 +259,9 @@
+
+
+
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSTileHost.java b/packages/SystemUI/src/com/android/systemui/qs/QSTileHost.java
index 54a928d78a892..4008918e267c6 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSTileHost.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSTileHost.java
@@ -339,13 +339,18 @@ public class QSTileHost implements QSHost, Tunable, PluginListener, D
changeTileSpecs(tileSpecs-> !tileSpecs.contains(spec) && tileSpecs.add(spec));
}
+ private void saveTilesToSettings(List tileSpecs) {
+ Settings.Secure.putStringForUser(mContext.getContentResolver(), TILES_SETTING,
+ TextUtils.join(",", tileSpecs), null /* tag */,
+ false /* default */, mCurrentUser, true /* overrideable by restore */);
+ }
+
private void changeTileSpecs(Predicate> changeFunction) {
final String setting = Settings.Secure.getStringForUser(mContext.getContentResolver(),
- TILES_SETTING, ActivityManager.getCurrentUser());
+ TILES_SETTING, mCurrentUser);
final List tileSpecs = loadTileSpecs(mContext, setting);
if (changeFunction.test(tileSpecs)) {
- Settings.Secure.putStringForUser(mContext.getContentResolver(), TILES_SETTING,
- TextUtils.join(",", tileSpecs), ActivityManager.getCurrentUser());
+ saveTilesToSettings(tileSpecs);
}
}
@@ -375,7 +380,7 @@ public class QSTileHost implements QSHost, Tunable, PluginListener, D
Intent intent = new Intent().setComponent(component);
TileLifecycleManager lifecycleManager = new TileLifecycleManager(new Handler(),
mContext, mServices, new Tile(), intent,
- new UserHandle(ActivityManager.getCurrentUser()),
+ new UserHandle(mCurrentUser),
mBroadcastDispatcher);
lifecycleManager.onStopListening();
lifecycleManager.onTileRemoved();
@@ -384,8 +389,7 @@ public class QSTileHost implements QSHost, Tunable, PluginListener, D
}
}
if (DEBUG) Log.d(TAG, "saveCurrentTiles " + newTiles);
- Secure.putStringForUser(getContext().getContentResolver(), QSTileHost.TILES_SETTING,
- TextUtils.join(",", newTiles), ActivityManager.getCurrentUser());
+ saveTilesToSettings(newTiles);
}
public QSTile createTile(String tileSpec) {