diff options
-rw-r--r-- | src/com/android/launcher2/LauncherModel.java | 13 |
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. |