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

Commit e09067c2 authored by Alex Chau's avatar Alex Chau
Browse files

Allow items to be added alongside smartspace

- Allow icons to be added to first row where search container does not occupy
- On upgrade, clean up first row of screen 0 which may have junk data, as we used to assume first forw of screen 0 is always occupied

Bug: 210127246
Test: manual
Change-Id: I835a321964984e02632c8a70474a6551b5e360f7
parent 9d5962e1
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -2,8 +2,9 @@
  // Note: Comments are not supported in JSON schema, but android parser is lenient.

  // Maximum DB version supported by this schema
  "version" : 30,
  "version" : 31,

  "downgrade_to_30" : [],
  "downgrade_to_29" : [],
  "downgrade_to_28" : [
    "ALTER TABLE favorites RENAME TO temp_favorites;",
+14 −1
Original line number Diff line number Diff line
@@ -97,7 +97,7 @@ public class LauncherProvider extends ContentProvider {
     * Represents the schema of the database. Changes in scheme need not be backwards compatible.
     * When increasing the scheme version, ensure that downgrade_schema.json is updated
     */
    public static final int SCHEMA_VERSION = 30;
    public static final int SCHEMA_VERSION = 31;

    public static final String AUTHORITY = BuildConfig.APPLICATION_ID + ".settings";
    public static final String KEY_LAYOUT_PROVIDER_AUTHORITY = "KEY_LAYOUT_PROVIDER_AUTHORITY";
@@ -864,6 +864,19 @@ public class LauncherProvider extends ContentProvider {
                            Favorites.SCREEN, IntArray.wrap(-777, -778)), null);
                }
                case 30: {
                    if (FeatureFlags.QSB_ON_FIRST_SCREEN) {
                        // Clean up first row in screen 0 as it might contain junk data.
                        Log.d(TAG, "Cleaning up first row");
                        db.delete(Favorites.TABLE_NAME,
                                String.format(Locale.ENGLISH,
                                        "%1$s = %2$d AND %3$s = %4$d AND %5$s = %6$d",
                                        Favorites.SCREEN, 0,
                                        Favorites.CONTAINER, Favorites.CONTAINER_DESKTOP,
                                        Favorites.CELLY, 0), null);
                    }
                    return;
                }
                case 31: {
                    // DB Upgraded successfully
                    return;
                }
+6 −4
Original line number Diff line number Diff line
@@ -457,11 +457,13 @@ public class LoaderCursor extends CursorWrapper {

        if (!occupied.containsKey(item.screenId)) {
            GridOccupancy screen = new GridOccupancy(countX + 1, countY + 1);
            if (item.screenId == Workspace.FIRST_SCREEN_ID) {
                // Mark the first row as occupied (if the feature is enabled)
                // in order to account for the QSB.
            if (item.screenId == Workspace.FIRST_SCREEN_ID && FeatureFlags.QSB_ON_FIRST_SCREEN) {
                // Mark the first X columns (X is width of the search container) in the first row as
                // occupied (if the feature is enabled) in order to account for the search
                // container.
                int spanX = mIDP.numSearchContainerColumns;
                int spanY = FeatureFlags.EXPANDED_SMARTSPACE.get() ? 2 : 1;
                screen.markCells(0, 0, countX + 1, spanY, FeatureFlags.QSB_ON_FIRST_SCREEN);
                screen.markCells(0, 0, spanX, spanY, true);
            }
            occupied.put(item.screenId, screen);
        }