summaryrefslogtreecommitdiffstats
path: root/core/java/android/content/pm
diff options
context:
space:
mode:
authorKenny Guy <kennyguy@google.com>2014-04-29 14:24:18 +0100
committerKenny Guy <kennyguy@google.com>2014-04-29 19:28:31 +0100
commit53fa4ec7f466e70fe3e33d15c4abfc9bb557eb10 (patch)
treed0b0b6961f0cd29b70e75ef4d30823cb7bdfaacb /core/java/android/content/pm
parentb039603867176c01c84ec1cbae681cb9868a4525 (diff)
downloadframeworks_base-53fa4ec7f466e70fe3e33d15c4abfc9bb557eb10.zip
frameworks_base-53fa4ec7f466e70fe3e33d15c4abfc9bb557eb10.tar.gz
frameworks_base-53fa4ec7f466e70fe3e33d15c4abfc9bb557eb10.tar.bz2
Extend LauncherApps service to expose enabled state.
Provide methods for checking if a package or activity is enabled for a given profile. Change-Id: If9cb15dc9398a709e60e7b689b664c24c49fcc16
Diffstat (limited to 'core/java/android/content/pm')
-rw-r--r--core/java/android/content/pm/ILauncherApps.aidl2
-rw-r--r--core/java/android/content/pm/LauncherApps.java33
2 files changed, 35 insertions, 0 deletions
diff --git a/core/java/android/content/pm/ILauncherApps.aidl b/core/java/android/content/pm/ILauncherApps.aidl
index 796b113..0acf043 100644
--- a/core/java/android/content/pm/ILauncherApps.aidl
+++ b/core/java/android/content/pm/ILauncherApps.aidl
@@ -35,4 +35,6 @@ interface ILauncherApps {
ResolveInfo resolveActivity(in Intent intent, in UserHandle user);
void startActivityAsUser(in ComponentName component, in Rect sourceBounds,
in Bundle opts, in UserHandle user);
+ boolean isPackageEnabled(String packageName, in UserHandle user);
+ boolean isActivityEnabled(in ComponentName component, in UserHandle user);
}
diff --git a/core/java/android/content/pm/LauncherApps.java b/core/java/android/content/pm/LauncherApps.java
index 5187181..8025b60 100644
--- a/core/java/android/content/pm/LauncherApps.java
+++ b/core/java/android/content/pm/LauncherApps.java
@@ -187,6 +187,39 @@ public class LauncherApps {
}
/**
+ * Checks if the package is installed and enabled for a profile.
+ *
+ * @param packageName The package to check.
+ * @param user The UserHandle of the profile.
+ *
+ * @return true if the package exists and is enabled.
+ */
+ public boolean isPackageEnabledForProfile(String packageName, UserHandle user) {
+ try {
+ return mService.isPackageEnabled(packageName, user);
+ } catch (RemoteException re) {
+ return false;
+ }
+ }
+
+ /**
+ * Checks if the activity exists and it enabled for a profile.
+ *
+ * @param component The activity to check.
+ * @param user The UserHandle of the profile.
+ *
+ * @return true if the activity exists and is enabled.
+ */
+ public boolean isActivityEnabledForProfile(ComponentName component, UserHandle user) {
+ try {
+ return mService.isActivityEnabled(component, user);
+ } catch (RemoteException re) {
+ return false;
+ }
+ }
+
+
+ /**
* Adds a listener for changes to packages in current and managed profiles.
*
* @param listener The listener to add.