Backup system QS tiles am: baade7573f
am: 9813cb61dd
Change-Id: Ia0ba996f6b0a889ba7469a2272a6fe0c235b15d5
This commit is contained in:
@@ -6319,6 +6319,12 @@ public final class Settings {
|
||||
public static final String SYSTEM_NAVIGATION_KEYS_ENABLED =
|
||||
"system_navigation_keys_enabled";
|
||||
|
||||
/**
|
||||
* Holds comma separated list of ordering of QS tiles.
|
||||
* @hide
|
||||
*/
|
||||
public static final String QS_TILES = "sysui_qs_tiles";
|
||||
|
||||
/**
|
||||
* Whether preloaded APKs have been installed for the user.
|
||||
* @hide
|
||||
@@ -6405,7 +6411,8 @@ public final class Settings {
|
||||
NIGHT_DISPLAY_ACTIVATED,
|
||||
CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED,
|
||||
CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED,
|
||||
SYSTEM_NAVIGATION_KEYS_ENABLED
|
||||
SYSTEM_NAVIGATION_KEYS_ENABLED,
|
||||
QS_TILES,
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -65,6 +65,9 @@ public class TileLifecycleManager extends BroadcastReceiver implements
|
||||
private static final int MAX_BIND_RETRIES = 5;
|
||||
private static final int BIND_RETRY_DELAY = 1000;
|
||||
|
||||
// Shared prefs that hold tile lifecycle info.
|
||||
private static final String TILES = "tiles_prefs";
|
||||
|
||||
private final Context mContext;
|
||||
private final Handler mHandler;
|
||||
private final Intent mIntent;
|
||||
@@ -406,4 +409,13 @@ public class TileLifecycleManager extends BroadcastReceiver implements
|
||||
public interface TileChangeListener {
|
||||
void onTileChanged(ComponentName tile);
|
||||
}
|
||||
|
||||
public static boolean isTileAdded(Context context, ComponentName component) {
|
||||
return context.getSharedPreferences(TILES, 0).getBoolean(component.flattenToString(), false);
|
||||
}
|
||||
|
||||
public static void setTileAdded(Context context, ComponentName component, boolean added) {
|
||||
context.getSharedPreferences(TILES, 0).edit().putBoolean(component.flattenToString(),
|
||||
added).commit();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,8 +88,14 @@ public class TileServiceManager {
|
||||
IntentFilter filter = new IntentFilter();
|
||||
filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
|
||||
filter.addDataScheme("package");
|
||||
mServices.getContext().registerReceiverAsUser(mUninstallReceiver,
|
||||
Context context = mServices.getContext();
|
||||
context.registerReceiverAsUser(mUninstallReceiver,
|
||||
new UserHandle(ActivityManager.getCurrentUser()), filter, null, mHandler);
|
||||
ComponentName component = tileLifecycleManager.getComponent();
|
||||
if (!TileLifecycleManager.isTileAdded(context, component)) {
|
||||
TileLifecycleManager.setTileAdded(context, component, true);
|
||||
mStateManager.onTileAdded();
|
||||
}
|
||||
}
|
||||
|
||||
public void setTileChangeListener(TileChangeListener changeListener) {
|
||||
|
||||
@@ -86,7 +86,7 @@ public class QSTileHost implements QSTile.Host, Tunable {
|
||||
private static final String TAG = "QSTileHost";
|
||||
private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
|
||||
|
||||
public static final String TILES_SETTING = "sysui_qs_tiles";
|
||||
public static final String TILES_SETTING = Secure.QS_TILES;
|
||||
|
||||
private final Context mContext;
|
||||
private final PhoneStatusBar mStatusBar;
|
||||
@@ -407,19 +407,7 @@ public class QSTileHost implements QSTile.Host, Tunable {
|
||||
new UserHandle(ActivityManager.getCurrentUser()));
|
||||
lifecycleManager.onStopListening();
|
||||
lifecycleManager.onTileRemoved();
|
||||
lifecycleManager.flushMessagesAndUnbind();
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < NA; i++) {
|
||||
String tileSpec = newTiles.get(i);
|
||||
if (!tileSpec.startsWith(CustomTile.PREFIX)) continue;
|
||||
if (!previousTiles.contains(tileSpec)) {
|
||||
ComponentName component = CustomTile.getComponentFromSpec(tileSpec);
|
||||
Intent intent = new Intent().setComponent(component);
|
||||
TileLifecycleManager lifecycleManager = new TileLifecycleManager(new Handler(),
|
||||
mContext, mServices, new Tile(), intent,
|
||||
new UserHandle(ActivityManager.getCurrentUser()));
|
||||
lifecycleManager.onTileAdded();
|
||||
TileLifecycleManager.setTileAdded(mContext, component, false);
|
||||
lifecycleManager.flushMessagesAndUnbind();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user