summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/Utils.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/settings/Utils.java')
-rw-r--r--src/com/android/settings/Utils.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java
index 0834c8d..4e945ef 100644
--- a/src/com/android/settings/Utils.java
+++ b/src/com/android/settings/Utils.java
@@ -760,6 +760,25 @@ public final class Utils {
return (deviceKeys & ButtonSettings.KEY_MASK_VOLUME) != 0;
}
+ public static boolean isPackageInstalled(Context context, String pkg, boolean ignoreState) {
+ if (pkg != null) {
+ try {
+ PackageInfo pi = context.getPackageManager().getPackageInfo(pkg, 0);
+ if (!pi.applicationInfo.enabled && !ignoreState) {
+ return false;
+ }
+ } catch (NameNotFoundException e) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public static boolean isPackageInstalled(Context context, String pkg) {
+ return isPackageInstalled(context, pkg, true);
+ }
+
/**
* Start a new instance of the activity, showing only the given fragment.
* When launched in this mode, the given preference fragment will be instantiated and fill the