Loading core/java/android/provider/Settings.java +8 −1 Original line number Diff line number Diff line Loading @@ -6385,6 +6385,12 @@ public final class Settings { public static final String AUTOMATIC_STORAGE_MANAGER_DOWNLOADS_DAYS_TO_RETAIN = "automatic_storage_manager_downloads_days_to_retain"; /** * 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 Loading Loading @@ -6472,7 +6478,8 @@ public final class Settings { SYNC_PARENT_SOUNDS, CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED, CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED, SYSTEM_NAVIGATION_KEYS_ENABLED SYSTEM_NAVIGATION_KEYS_ENABLED, QS_TILES, }; /** Loading packages/SystemUI/src/com/android/systemui/qs/external/TileLifecycleManager.java +12 −0 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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(); } } packages/SystemUI/src/com/android/systemui/qs/external/TileServiceManager.java +7 −1 Original line number Diff line number Diff line Loading @@ -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) { Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java +2 −14 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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(); } } Loading Loading
core/java/android/provider/Settings.java +8 −1 Original line number Diff line number Diff line Loading @@ -6385,6 +6385,12 @@ public final class Settings { public static final String AUTOMATIC_STORAGE_MANAGER_DOWNLOADS_DAYS_TO_RETAIN = "automatic_storage_manager_downloads_days_to_retain"; /** * 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 Loading Loading @@ -6472,7 +6478,8 @@ public final class Settings { SYNC_PARENT_SOUNDS, CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED, CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED, SYSTEM_NAVIGATION_KEYS_ENABLED SYSTEM_NAVIGATION_KEYS_ENABLED, QS_TILES, }; /** Loading
packages/SystemUI/src/com/android/systemui/qs/external/TileLifecycleManager.java +12 −0 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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(); } }
packages/SystemUI/src/com/android/systemui/qs/external/TileServiceManager.java +7 −1 Original line number Diff line number Diff line Loading @@ -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) { Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java +2 −14 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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(); } } Loading