summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/LauncherModel.java
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2016-06-10 12:22:04 -0700
committerSunny Goyal <sunnygoyal@google.com>2016-06-15 10:03:12 -0700
commita9e2f5abb3c21d9721939c625ffb0caabb34e8d9 (patch)
treed9ac34c73a79fd9d59b782ba42b96f84edd9882a /src/com/android/launcher3/LauncherModel.java
parentb25b2c41c2fa277e16d708ad827e283efcb86452 (diff)
downloadandroid_packages_apps_Trebuchet-a9e2f5abb3c21d9721939c625ffb0caabb34e8d9.tar.gz
android_packages_apps_Trebuchet-a9e2f5abb3c21d9721939c625ffb0caabb34e8d9.tar.bz2
android_packages_apps_Trebuchet-a9e2f5abb3c21d9721939c625ffb0caabb34e8d9.zip
Adding a DB update path to handle the QSB position change
> Renamed the id of 1st screen to 0 and making space for the QSB by running the grid migration task. > Added a feature flag to easily disable the QSB-in-workspace behavior Change-Id: Ie3369f0d4433d916e9d6215d414770d4333f3e26
Diffstat (limited to 'src/com/android/launcher3/LauncherModel.java')
-rw-r--r--src/com/android/launcher3/LauncherModel.java25
1 files changed, 7 insertions, 18 deletions
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java
index 557a91a42..4c80ccf69 100644
--- a/src/com/android/launcher3/LauncherModel.java
+++ b/src/com/android/launcher3/LauncherModel.java
@@ -50,6 +50,7 @@ import com.android.launcher3.compat.PackageInstallerCompat;
import com.android.launcher3.compat.PackageInstallerCompat.PackageInstallInfo;
import com.android.launcher3.compat.UserHandleCompat;
import com.android.launcher3.compat.UserManagerCompat;
+import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.config.ProviderConfig;
import com.android.launcher3.dynamicui.ExtractionUtils;
import com.android.launcher3.folder.Folder;
@@ -57,6 +58,7 @@ import com.android.launcher3.folder.FolderIcon;
import com.android.launcher3.logging.FileLog;
import com.android.launcher3.model.GridSizeMigrationTask;
import com.android.launcher3.model.WidgetsModel;
+import com.android.launcher3.provider.LauncherDbUtils;
import com.android.launcher3.util.ComponentKey;
import com.android.launcher3.util.CursorIconInfo;
import com.android.launcher3.util.FlagOp;
@@ -1246,22 +1248,8 @@ public class LauncherModel extends BroadcastReceiver
final Uri screensUri = LauncherSettings.WorkspaceScreens.CONTENT_URI;
// Get screens ordered by rank.
- final Cursor sc = contentResolver.query(screensUri, null, null, null,
- LauncherSettings.WorkspaceScreens.SCREEN_RANK);
- ArrayList<Long> screenIds = new ArrayList<Long>();
- try {
- final int idIndex = sc.getColumnIndexOrThrow(LauncherSettings.WorkspaceScreens._ID);
- while (sc.moveToNext()) {
- try {
- screenIds.add(sc.getLong(idIndex));
- } catch (Exception e) {
- FileLog.d(TAG, "Invalid screen id", e);
- }
- }
- } finally {
- sc.close();
- }
- return screenIds;
+ return LauncherDbUtils.getScreenIdsFromCursor(contentResolver.query(
+ screensUri, null, null, null, LauncherSettings.WorkspaceScreens.SCREEN_RANK));
}
/**
@@ -1522,8 +1510,9 @@ public class LauncherModel extends BroadcastReceiver
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 in order to account for the QSB.
- screen.markCells(0, 0, countX + 1, 1, true);
+ // Mark the first row as occupied (if the feature is enabled)
+ // in order to account for the QSB.
+ screen.markCells(0, 0, countX + 1, 1, FeatureFlags.QSB_ON_FIRST_SCREEN);
}
occupied.put(item.screenId, screen);
}