diff options
author | Kenny Guy <kennyguy@google.com> | 2014-04-30 17:38:10 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-04-30 17:38:10 +0000 |
commit | 7e5264ced758107d83da88d6e476d16028b3cc71 (patch) | |
tree | f77cbf8f94c4c97b850653d84a45ea79759711c9 /core/java/android/content | |
parent | fad6fa7a04e9227f621dfea9e90f6b867c40af86 (diff) | |
parent | 53fa4ec7f466e70fe3e33d15c4abfc9bb557eb10 (diff) | |
download | frameworks_base-7e5264ced758107d83da88d6e476d16028b3cc71.zip frameworks_base-7e5264ced758107d83da88d6e476d16028b3cc71.tar.gz frameworks_base-7e5264ced758107d83da88d6e476d16028b3cc71.tar.bz2 |
Merge "Extend LauncherApps service to expose enabled state."
Diffstat (limited to 'core/java/android/content')
-rw-r--r-- | core/java/android/content/pm/ILauncherApps.aidl | 2 | ||||
-rw-r--r-- | core/java/android/content/pm/LauncherApps.java | 33 |
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. |