diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2016-08-24 23:02:08 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2016-08-24 23:02:08 +0000 |
commit | d56b157004c32becdc73ea69625b98c959a34745 (patch) | |
tree | bface743c93d5bcaad7f828f20bb2cda3ccf42b1 /src/com/android/launcher3/model | |
parent | b68f959992481e38620011e1a5b2e08d7e9477e3 (diff) | |
parent | d70ef242332e766b2c23e3b8bb537dc2d584e9ec (diff) | |
download | android_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.java | 20 |
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 { |