diff options
author | Kenny Guy <kennyguy@google.com> | 2014-04-29 14:24:18 +0100 |
---|---|---|
committer | Kenny Guy <kennyguy@google.com> | 2014-04-29 19:28:31 +0100 |
commit | 53fa4ec7f466e70fe3e33d15c4abfc9bb557eb10 (patch) | |
tree | d0b0b6961f0cd29b70e75ef4d30823cb7bdfaacb /core/java/android/content/pm | |
parent | b039603867176c01c84ec1cbae681cb9868a4525 (diff) | |
download | frameworks_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.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. |