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

Commit 90a788e2 authored by Jason Monk's avatar Jason Monk
Browse files

resolve merge conflicts of d70ed997 to master

Change-Id: I3a8d3708e050b3fb963dd057c0be9d2d249d037a
parents 3f98ea1e d70ed997
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -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
@@ -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,
        };

        /**
+12 −0
Original line number Diff line number Diff line
@@ -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();
    }
}
+7 −1
Original line number Diff line number Diff line
@@ -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) {
+2 −14
Original line number Diff line number Diff line
@@ -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();
            }
        }