From a694524047fda0a51dede4eefb1201a598d2d3a7 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Wed, 8 Jan 2014 14:04:34 -0800 Subject: Adding migration Clings. (Bug 11973614) - Refactoring Launcher cling code out to LauncherClings. Change-Id: Iff4f84f5b8bfeb69b1be0b4802022c3eb20b6f2c --- src/com/android/launcher3/LauncherModel.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/com/android/launcher3/LauncherModel.java') diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java index b2cfb2456..498d91a38 100644 --- a/src/com/android/launcher3/LauncherModel.java +++ b/src/com/android/launcher3/LauncherModel.java @@ -77,7 +77,9 @@ public class LauncherModel extends BroadcastReceiver { private static final int ITEMS_CHUNK = 6; // batch size for the workspace icons private static final long INVALID_SCREEN_ID = -1L; + private final boolean mAppsCanBeOnRemoveableStorage; + private final boolean mOldContentProviderExists; private final LauncherAppState mApp; private final Object mLock = new Object(); @@ -181,9 +183,12 @@ public class LauncherModel extends BroadcastReceiver { } LauncherModel(LauncherAppState app, IconCache iconCache, AppFilter appFilter) { - final Context context = app.getContext(); + Context context = app.getContext(); + ContentResolver contentResolver = context.getContentResolver(); mAppsCanBeOnRemoveableStorage = Environment.isExternalStorageRemovable(); + mOldContentProviderExists = (contentResolver.acquireContentProviderClient( + LauncherSettings.Favorites.OLD_CONTENT_URI) != null); mApp = app; mBgAllAppsList = new AllAppsList(iconCache, appFilter); mIconCache = iconCache; @@ -218,6 +223,10 @@ public class LauncherModel extends BroadcastReceiver { } } + boolean canMigrateFromOldLauncherDb() { + return mOldContentProviderExists; + } + static boolean findNextAvailableIconSpaceInScreen(ArrayList items, int[] xy, long screen) { LauncherAppState app = LauncherAppState.getInstance(); @@ -1651,7 +1660,7 @@ public class LauncherModel extends BroadcastReceiver { } } - /** Returns whether this is an upgradge path */ + /** Returns whether this is an upgrade path */ private boolean loadWorkspace() { // Log to disk Launcher.addDumpLog(TAG, "11683562 - loadWorkspace()", true); -- cgit v1.2.3