summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/model
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2016-08-24 23:02:08 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-08-24 23:02:08 +0000
commitd56b157004c32becdc73ea69625b98c959a34745 (patch)
treebface743c93d5bcaad7f828f20bb2cda3ccf42b1 /src/com/android/launcher3/model
parentb68f959992481e38620011e1a5b2e08d7e9477e3 (diff)
parentd70ef242332e766b2c23e3b8bb537dc2d584e9ec (diff)
downloadandroid_packages_apps_Trebuchet-d56b157004c32becdc73ea69625b98c959a34745.tar.gz
android_packages_apps_Trebuchet-d56b157004c32becdc73ea69625b98c959a34745.tar.bz2
android_packages_apps_Trebuchet-d56b157004c32becdc73ea69625b98c959a34745.zip
Fixing the hotseat import logic
am: d70ef24233 Change-Id: I1be426419d7a7f044dfd81207c3ee3b1df43b404
Diffstat (limited to 'src/com/android/launcher3/model')
-rw-r--r--src/com/android/launcher3/model/GridSizeMigrationTask.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/com/android/launcher3/model/GridSizeMigrationTask.java b/src/com/android/launcher3/model/GridSizeMigrationTask.java
index 600768e5d..fd647c79a 100644
--- a/src/com/android/launcher3/model/GridSizeMigrationTask.java
+++ b/src/com/android/launcher3/model/GridSizeMigrationTask.java
@@ -974,6 +974,26 @@ public class GridSizeMigrationTask {
}
/**
+ * Removes any broken item from the hotseat.
+ * @return a map with occupied hotseat position set to non-null value.
+ */
+ public static LongArrayMap<Object> removeBrokenHotseatItems(Context context) throws Exception {
+ GridSizeMigrationTask task = new GridSizeMigrationTask(context,
+ LauncherAppState.getInstance().getInvariantDeviceProfile(),
+ getValidPackages(context), Integer.MAX_VALUE, Integer.MAX_VALUE);
+
+ // Load all the valid entries
+ ArrayList<DbEntry> items = task.loadHotseatEntries();
+ // Delete any entry marked for deletion by above load.
+ task.applyOperations();
+ LongArrayMap<Object> positions = new LongArrayMap<>();
+ for (DbEntry item : items) {
+ positions.put(item.screenId, item);
+ }
+ return positions;
+ }
+
+ /**
* Task to run grid migration in multiple steps when the size difference is more than 1.
*/
protected static class MultiStepMigrationTask {