summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAdam Cohen <adamcohen@google.com>2011-11-07 14:17:13 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-11-07 14:17:13 -0800
commit2632ca01e1127a33845f832b60be3df24d73b0f4 (patch)
treef28d900ba0444ebaef0926b70713d9e85eaf3c3b /src
parenta0654a3523cecfaa0800086753b8738ce3bc1d35 (diff)
parent00fcb49a4cf68b973ac488520f3ed20444c02f8d (diff)
downloadandroid_packages_apps_Trebuchet-2632ca01e1127a33845f832b60be3df24d73b0f4.tar.gz
android_packages_apps_Trebuchet-2632ca01e1127a33845f832b60be3df24d73b0f4.tar.bz2
android_packages_apps_Trebuchet-2632ca01e1127a33845f832b60be3df24d73b0f4.zip
Merge "Ensuring disabled apps don't appear in workspace (issue: 5557311)" into ics-mr1
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher2/LauncherModel.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/com/android/launcher2/LauncherModel.java b/src/com/android/launcher2/LauncherModel.java
index c06bc0c31..1755903ec 100644
--- a/src/com/android/launcher2/LauncherModel.java
+++ b/src/com/android/launcher2/LauncherModel.java
@@ -28,7 +28,9 @@ import android.content.Context;
import android.content.Intent;
import android.content.Intent.ShortcutIconResource;
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.ResolveInfo;
import android.content.res.Configuration;
import android.content.res.Resources;
@@ -1629,6 +1631,17 @@ public class LauncherModel extends BroadcastReceiver {
return null;
}
+ try {
+ PackageInfo pi = manager.getPackageInfo(componentName.getPackageName(), 0);
+ if (!pi.applicationInfo.enabled) {
+ // If we return null here, the corresponding item will be removed from the launcher
+ // db and will not appear in the workspace.
+ return null;
+ }
+ } catch (NameNotFoundException e) {
+ Log.d(TAG, "getPackInfo failed for package " + componentName.getPackageName());
+ }
+
// TODO: See if the PackageManager knows about this case. If it doesn't
// then return null & delete this.