summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Monk <jmonk@google.com>2014-05-16 17:37:34 -0400
committerJason Monk <jmonk@google.com>2014-05-16 18:02:21 -0400
commitbbe1e24c5ff470a695510d23d67bcb6f2ad88d0e (patch)
tree8dd54dcadcac96794b782f288fd6a0d3d8c15453 /src
parentdbc46f5e05d035524eff7fb1ea3ac8681b6b673a (diff)
downloadandroid_packages_apps_Trebuchet-bbe1e24c5ff470a695510d23d67bcb6f2ad88d0e.tar.gz
android_packages_apps_Trebuchet-bbe1e24c5ff470a695510d23d67bcb6f2ad88d0e.tar.bz2
android_packages_apps_Trebuchet-bbe1e24c5ff470a695510d23d67bcb6f2ad88d0e.zip
Fix issue where always trying to migrate
Rather than check if the ContentProviderClient is null (which fails in when using the Redirector), check the PackageManager directly for the authority we are looking for. Bug: 14466459 Change-Id: I7420352a15dcea5037196670f18705e7a34f0672
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher3/LauncherModel.java17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java
index 4b5e68b72..cc87281fc 100644
--- a/src/com/android/launcher3/LauncherModel.java
+++ b/src/com/android/launcher3/LauncherModel.java
@@ -25,6 +25,7 @@ import android.content.pm.ActivityInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
+import android.content.pm.ProviderInfo;
import android.content.pm.ResolveInfo;
import android.content.res.Configuration;
import android.content.res.Resources;
@@ -103,6 +104,7 @@ public class LauncherModel extends BroadcastReceiver
private static final int MAIN_THREAD_NORMAL_RUNNABLE = 0;
private static final int MAIN_THREAD_BINDING_RUNNABLE = 1;
+ private static final String MIGRATE_AUTHORITY = "com.android.launcher2.settings";
private static final HandlerThread sWorkerThread = new HandlerThread("launcher-loader");
static {
@@ -197,15 +199,19 @@ public class LauncherModel extends BroadcastReceiver
LauncherModel(LauncherAppState app, IconCache iconCache, AppFilter appFilter) {
Context context = app.getContext();
- ContentResolver contentResolver = context.getContentResolver();
mAppsCanBeOnRemoveableStorage = Environment.isExternalStorageRemovable();
String oldProvider = context.getString(R.string.old_launcher_provider_uri);
- ContentProviderClient client = contentResolver.acquireContentProviderClient(
- Uri.parse(context.getString(R.string.old_launcher_provider_uri)));
+ // This may be the same as MIGRATE_AUTHORITY, or it may be replaced by a different
+ // resource string.
+ String redirectAuthority = Uri.parse(oldProvider).getAuthority();
+ ProviderInfo providerInfo =
+ context.getPackageManager().resolveContentProvider(MIGRATE_AUTHORITY, 0);
+ ProviderInfo redirectProvider =
+ context.getPackageManager().resolveContentProvider(redirectAuthority, 0);
Log.d(TAG, "Old launcher provider: " + oldProvider);
- mOldContentProviderExists = (client != null);
+ mOldContentProviderExists = (providerInfo != null) && (redirectProvider != null);
if (mOldContentProviderExists) {
Log.d(TAG, "Old launcher provider exists.");
@@ -213,9 +219,6 @@ public class LauncherModel extends BroadcastReceiver
Log.d(TAG, "Old launcher provider does not exist.");
}
- if (client != null) {
- client.release();
- }
mApp = app;
mBgAllAppsList = new AllAppsList(iconCache, appFilter);
mIconCache = iconCache;