Loading api/current.txt +9 −9 Original line number Diff line number Diff line Loading @@ -8196,7 +8196,7 @@ package android.content.pm { } public class LauncherActivityInfo { method public int getApplicationFlags(); method public android.content.pm.ApplicationInfo getApplicationInfo(); method public android.graphics.drawable.Drawable getBadgedIcon(int); method public android.content.ComponentName getComponentName(); method public long getFirstInstallTime(); Loading @@ -8207,21 +8207,21 @@ package android.content.pm { } public class LauncherApps { method public synchronized void addOnAppsChangedListener(android.content.pm.LauncherApps.OnAppsChangedListener); method public void addOnAppsChangedListener(android.content.pm.LauncherApps.OnAppsChangedListener); method public java.util.List<android.content.pm.LauncherActivityInfo> getActivityList(java.lang.String, android.os.UserHandle); method public boolean isActivityEnabledForProfile(android.content.ComponentName, android.os.UserHandle); method public boolean isPackageEnabledForProfile(java.lang.String, android.os.UserHandle); method public synchronized void removeOnAppsChangedListener(android.content.pm.LauncherApps.OnAppsChangedListener); method public void removeOnAppsChangedListener(android.content.pm.LauncherApps.OnAppsChangedListener); method public android.content.pm.LauncherActivityInfo resolveActivity(android.content.Intent, android.os.UserHandle); method public void startActivityForProfile(android.content.ComponentName, android.graphics.Rect, android.os.Bundle, android.os.UserHandle); method public void startActivityForProfile(android.content.ComponentName, android.os.UserHandle, android.graphics.Rect, android.os.Bundle); } public static abstract interface LauncherApps.OnAppsChangedListener { method public abstract void onPackageAdded(android.os.UserHandle, java.lang.String); method public abstract void onPackageChanged(android.os.UserHandle, java.lang.String); method public abstract void onPackageRemoved(android.os.UserHandle, java.lang.String); method public abstract void onPackagesAvailable(android.os.UserHandle, java.lang.String[], boolean); method public abstract void onPackagesUnavailable(android.os.UserHandle, java.lang.String[], boolean); method public abstract void onPackageAdded(java.lang.String, android.os.UserHandle); method public abstract void onPackageChanged(java.lang.String, android.os.UserHandle); method public abstract void onPackageRemoved(java.lang.String, android.os.UserHandle); method public abstract void onPackagesAvailable(java.lang.String[], android.os.UserHandle, boolean); method public abstract void onPackagesUnavailable(java.lang.String[], android.os.UserHandle, boolean); } public class PackageInfo implements android.os.Parcelable { core/java/android/content/pm/LauncherActivityInfo.java +33 −11 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.os.Bundle; import android.os.RemoteException; import android.os.UserHandle; import android.os.UserManager; import android.util.DisplayMetrics; import android.util.Log; /** Loading @@ -47,7 +48,6 @@ public class LauncherActivityInfo { private ActivityInfo mActivityInfo; private ComponentName mComponentName; private UserHandle mUser; // TODO: Fetch this value from PM private long mFirstInstallTime; /** Loading @@ -57,11 +57,13 @@ public class LauncherActivityInfo { * @param info ResolveInfo from which to create the LauncherActivityInfo. * @param user The UserHandle of the profile to which this activity belongs. */ LauncherActivityInfo(Context context, ResolveInfo info, UserHandle user) { LauncherActivityInfo(Context context, ResolveInfo info, UserHandle user, long firstInstallTime) { this(context); this.mActivityInfo = info.activityInfo; this.mComponentName = LauncherApps.getComponentName(info); this.mUser = user; mActivityInfo = info.activityInfo; mComponentName = LauncherApps.getComponentName(info); mUser = user; mFirstInstallTime = firstInstallTime; } LauncherActivityInfo(Context context) { Loading @@ -79,7 +81,13 @@ public class LauncherActivityInfo { } /** * Returns the user handle of the user profile that this activity belongs to. * Returns the user handle of the user profile that this activity belongs to. In order to * persist the identity of the profile, do not store the UserHandle. Instead retrieve its * serial number from UserManager. You can convert the serial number back to a UserHandle * for later use. * * @see UserManager#getSerialNumberForUser(UserHandle) * @see UserManager#getUserForSerialNumber(long) * * @return The UserHandle of the profile. */ Loading @@ -98,8 +106,10 @@ public class LauncherActivityInfo { /** * Returns the icon for this activity, without any badging for the profile. * @param density The preferred density of the icon, zero for default density. * @param density The preferred density of the icon, zero for default density. Use * density DPI values from {@link DisplayMetrics}. * @see #getBadgedIcon(int) * @see DisplayMetrics * @return The drawable associated with the activity */ public Drawable getIcon(int density) { Loading @@ -111,13 +121,23 @@ public class LauncherActivityInfo { * Returns the application flags from the ApplicationInfo of the activity. * * @return Application flags * @hide remove before shipping */ public int getApplicationFlags() { return mActivityInfo.applicationInfo.flags; } /** * Returns the application info for the appliction this activity belongs to. * @return */ public ApplicationInfo getApplicationInfo() { return mActivityInfo.applicationInfo; } /** * Returns the time at which the package was first installed. * * @return The time of installation of the package, in milliseconds. */ public long getFirstInstallTime() { Loading @@ -134,7 +154,9 @@ public class LauncherActivityInfo { /** * Returns the activity icon with badging appropriate for the profile. * @param density Optional density for the icon, or 0 to use the default density. * @param density Optional density for the icon, or 0 to use the default density. Use * {@link DisplayMetrics} for DPI values. * @see DisplayMetrics * @return A badged icon for the activity. */ public Drawable getBadgedIcon(int density) { Loading core/java/android/content/pm/LauncherApps.java +126 −21 Original line number Diff line number Diff line Loading @@ -16,15 +16,18 @@ package android.content.pm; import android.app.AppGlobals; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.pm.ILauncherApps; import android.content.pm.IOnAppsChangedListener; import android.content.pm.PackageManager.NameNotFoundException; import android.graphics.Rect; import android.os.Bundle; import android.os.RemoteException; import android.os.UserHandle; import android.os.UserManager; import android.util.Log; import java.util.ArrayList; Loading @@ -36,6 +39,12 @@ import java.util.List; * managed profiles. This is mainly for use by launchers. Apps can be queried for each user profile. * Since the PackageManager will not deliver package broadcasts for other profiles, you can register * for package changes here. * <p> * To watch for managed profiles being added or removed, register for the following broadcasts: * {@link Intent#ACTION_MANAGED_PROFILE_ADDED} and {@link Intent#ACTION_MANAGED_PROFILE_REMOVED}. * <p> * You can retrieve the list of profiles associated with this user with * {@link UserManager#getUserProfiles()}. */ public class LauncherApps { Loading @@ -44,12 +53,13 @@ public class LauncherApps { private Context mContext; private ILauncherApps mService; private PackageManager mPm; private List<OnAppsChangedListener> mListeners = new ArrayList<OnAppsChangedListener>(); /** * Callbacks for changes to this and related managed profiles. * Callbacks for package changes to this and related managed profiles. */ public interface OnAppsChangedListener { /** Loading @@ -57,6 +67,7 @@ public class LauncherApps { * * @param user The UserHandle of the profile that generated the change. * @param packageName The name of the package that was removed. * @hide remove before ship */ void onPackageRemoved(UserHandle user, String packageName); Loading @@ -65,6 +76,7 @@ public class LauncherApps { * * @param user The UserHandle of the profile that generated the change. * @param packageName The name of the package that was added. * @hide remove before ship */ void onPackageAdded(UserHandle user, String packageName); Loading @@ -73,6 +85,7 @@ public class LauncherApps { * * @param user The UserHandle of the profile that generated the change. * @param packageName The name of the package that has changed. * @hide remove before ship */ void onPackageChanged(UserHandle user, String packageName); Loading @@ -86,6 +99,7 @@ public class LauncherApps { * available. * @param replacing Indicates whether these packages are replacing * existing ones. * @hide remove before ship */ void onPackagesAvailable(UserHandle user, String[] packageNames, boolean replacing); Loading @@ -99,14 +113,66 @@ public class LauncherApps { * unavailable. * @param replacing Indicates whether the packages are about to be * replaced with new versions. * @hide remove before ship */ void onPackagesUnavailable(UserHandle user, String[] packageNames, boolean replacing); /** * Indicates that a package was removed from the specified profile. * * @param packageName The name of the package that was removed. * @param user The UserHandle of the profile that generated the change. */ void onPackageRemoved(String packageName, UserHandle user); /** * Indicates that a package was added to the specified profile. * * @param packageName The name of the package that was added. * @param user The UserHandle of the profile that generated the change. */ void onPackageAdded(String packageName, UserHandle user); /** * Indicates that a package was modified in the specified profile. * * @param packageName The name of the package that has changed. * @param user The UserHandle of the profile that generated the change. */ void onPackageChanged(String packageName, UserHandle user); /** * Indicates that one or more packages have become available. For * example, this can happen when a removable storage card has * reappeared. * * @param packageNames The names of the packages that have become * available. * @param user The UserHandle of the profile that generated the change. * @param replacing Indicates whether these packages are replacing * existing ones. */ void onPackagesAvailable(String [] packageNames, UserHandle user, boolean replacing); /** * Indicates that one or more packages have become unavailable. For * example, this can happen when a removable storage card has been * removed. * * @param packageNames The names of the packages that have become * unavailable. * @param user The UserHandle of the profile that generated the change. * @param replacing Indicates whether the packages are about to be * replaced with new versions. */ void onPackagesUnavailable(String[] packageNames, UserHandle user, boolean replacing); } /** @hide */ public LauncherApps(Context context, ILauncherApps service) { mContext = context; mService = service; mPm = context.getPackageManager(); } /** Loading @@ -131,7 +197,15 @@ public class LauncherApps { final int count = activities.size(); for (int i = 0; i < count; i++) { ResolveInfo ri = activities.get(i); LauncherActivityInfo lai = new LauncherActivityInfo(mContext, ri, user); long firstInstallTime = 0; try { firstInstallTime = mPm.getPackageInfo(ri.activityInfo.packageName, PackageManager.GET_UNINSTALLED_PACKAGES).firstInstallTime; } catch (NameNotFoundException nnfe) { // Sorry, can't find package } LauncherActivityInfo lai = new LauncherActivityInfo(mContext, ri, user, firstInstallTime); if (DEBUG) { Log.v(TAG, "Returning activity for profile " + user + " : " + lai.getComponentName()); Loading @@ -157,7 +231,15 @@ public class LauncherApps { try { ResolveInfo ri = mService.resolveActivity(intent, user); if (ri != null) { LauncherActivityInfo info = new LauncherActivityInfo(mContext, ri, user); long firstInstallTime = 0; try { firstInstallTime = mPm.getPackageInfo(ri.activityInfo.packageName, PackageManager.GET_UNINSTALLED_PACKAGES).firstInstallTime; } catch (NameNotFoundException nnfe) { // Sorry, can't find package } LauncherActivityInfo info = new LauncherActivityInfo(mContext, ri, user, firstInstallTime); return info; } } catch (RemoteException re) { Loading @@ -173,9 +255,23 @@ public class LauncherApps { * @param sourceBounds The Rect containing the source bounds of the clicked icon * @param opts Options to pass to startActivity * @param user The UserHandle of the profile * @hide remove before ship */ public void startActivityForProfile(ComponentName component, Rect sourceBounds, Bundle opts, UserHandle user) { startActivityForProfile(component, user, sourceBounds, opts); } /** * Starts an activity in the specified profile. * * @param component The ComponentName of the activity to launch * @param user The UserHandle of the profile * @param sourceBounds The Rect containing the source bounds of the clicked icon * @param opts Options to pass to startActivity */ public void startActivityForProfile(ComponentName component, UserHandle user, Rect sourceBounds, Bundle opts) { if (DEBUG) { Log.i(TAG, "StartActivityForProfile " + component + " " + user.getIdentifier()); } Loading Loading @@ -224,7 +320,8 @@ public class LauncherApps { * * @param listener The listener to add. */ public synchronized void addOnAppsChangedListener(OnAppsChangedListener listener) { public void addOnAppsChangedListener(OnAppsChangedListener listener) { synchronized (this) { if (listener != null && !mListeners.contains(listener)) { mListeners.add(listener); if (mListeners.size() == 1) { Loading @@ -235,6 +332,7 @@ public class LauncherApps { } } } } /** * Removes a listener that was previously added. Loading @@ -242,7 +340,8 @@ public class LauncherApps { * @param listener The listener to remove. * @see #addOnAppsChangedListener(OnAppsChangedListener) */ public synchronized void removeOnAppsChangedListener(OnAppsChangedListener listener) { public void removeOnAppsChangedListener(OnAppsChangedListener listener) { synchronized (this) { mListeners.remove(listener); if (mListeners.size() == 0) { try { Loading @@ -251,6 +350,7 @@ public class LauncherApps { } } } } private IOnAppsChangedListener.Stub mAppsChangedListener = new IOnAppsChangedListener.Stub() { Loading @@ -261,7 +361,8 @@ public class LauncherApps { } synchronized (LauncherApps.this) { for (OnAppsChangedListener listener : mListeners) { listener.onPackageRemoved(user, packageName); listener.onPackageRemoved(user, packageName); // TODO: Remove before ship listener.onPackageRemoved(packageName, user); } } } Loading @@ -273,7 +374,8 @@ public class LauncherApps { } synchronized (LauncherApps.this) { for (OnAppsChangedListener listener : mListeners) { listener.onPackageChanged(user, packageName); listener.onPackageChanged(user, packageName); // TODO: Remove before ship listener.onPackageChanged(packageName, user); } } } Loading @@ -285,7 +387,8 @@ public class LauncherApps { } synchronized (LauncherApps.this) { for (OnAppsChangedListener listener : mListeners) { listener.onPackageAdded(user, packageName); listener.onPackageAdded(user, packageName); // TODO: Remove before ship listener.onPackageAdded(packageName, user); } } } Loading @@ -298,7 +401,8 @@ public class LauncherApps { } synchronized (LauncherApps.this) { for (OnAppsChangedListener listener : mListeners) { listener.onPackagesAvailable(user, packageNames, replacing); listener.onPackagesAvailable(user, packageNames, replacing); // TODO: Remove listener.onPackagesAvailable(packageNames, user, replacing); } } } Loading @@ -311,7 +415,8 @@ public class LauncherApps { } synchronized (LauncherApps.this) { for (OnAppsChangedListener listener : mListeners) { listener.onPackagesUnavailable(user, packageNames, replacing); listener.onPackagesUnavailable(user, packageNames, replacing); // TODO: Remove listener.onPackagesUnavailable(packageNames, user, replacing); } } } Loading Loading
api/current.txt +9 −9 Original line number Diff line number Diff line Loading @@ -8196,7 +8196,7 @@ package android.content.pm { } public class LauncherActivityInfo { method public int getApplicationFlags(); method public android.content.pm.ApplicationInfo getApplicationInfo(); method public android.graphics.drawable.Drawable getBadgedIcon(int); method public android.content.ComponentName getComponentName(); method public long getFirstInstallTime(); Loading @@ -8207,21 +8207,21 @@ package android.content.pm { } public class LauncherApps { method public synchronized void addOnAppsChangedListener(android.content.pm.LauncherApps.OnAppsChangedListener); method public void addOnAppsChangedListener(android.content.pm.LauncherApps.OnAppsChangedListener); method public java.util.List<android.content.pm.LauncherActivityInfo> getActivityList(java.lang.String, android.os.UserHandle); method public boolean isActivityEnabledForProfile(android.content.ComponentName, android.os.UserHandle); method public boolean isPackageEnabledForProfile(java.lang.String, android.os.UserHandle); method public synchronized void removeOnAppsChangedListener(android.content.pm.LauncherApps.OnAppsChangedListener); method public void removeOnAppsChangedListener(android.content.pm.LauncherApps.OnAppsChangedListener); method public android.content.pm.LauncherActivityInfo resolveActivity(android.content.Intent, android.os.UserHandle); method public void startActivityForProfile(android.content.ComponentName, android.graphics.Rect, android.os.Bundle, android.os.UserHandle); method public void startActivityForProfile(android.content.ComponentName, android.os.UserHandle, android.graphics.Rect, android.os.Bundle); } public static abstract interface LauncherApps.OnAppsChangedListener { method public abstract void onPackageAdded(android.os.UserHandle, java.lang.String); method public abstract void onPackageChanged(android.os.UserHandle, java.lang.String); method public abstract void onPackageRemoved(android.os.UserHandle, java.lang.String); method public abstract void onPackagesAvailable(android.os.UserHandle, java.lang.String[], boolean); method public abstract void onPackagesUnavailable(android.os.UserHandle, java.lang.String[], boolean); method public abstract void onPackageAdded(java.lang.String, android.os.UserHandle); method public abstract void onPackageChanged(java.lang.String, android.os.UserHandle); method public abstract void onPackageRemoved(java.lang.String, android.os.UserHandle); method public abstract void onPackagesAvailable(java.lang.String[], android.os.UserHandle, boolean); method public abstract void onPackagesUnavailable(java.lang.String[], android.os.UserHandle, boolean); } public class PackageInfo implements android.os.Parcelable {
core/java/android/content/pm/LauncherActivityInfo.java +33 −11 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.os.Bundle; import android.os.RemoteException; import android.os.UserHandle; import android.os.UserManager; import android.util.DisplayMetrics; import android.util.Log; /** Loading @@ -47,7 +48,6 @@ public class LauncherActivityInfo { private ActivityInfo mActivityInfo; private ComponentName mComponentName; private UserHandle mUser; // TODO: Fetch this value from PM private long mFirstInstallTime; /** Loading @@ -57,11 +57,13 @@ public class LauncherActivityInfo { * @param info ResolveInfo from which to create the LauncherActivityInfo. * @param user The UserHandle of the profile to which this activity belongs. */ LauncherActivityInfo(Context context, ResolveInfo info, UserHandle user) { LauncherActivityInfo(Context context, ResolveInfo info, UserHandle user, long firstInstallTime) { this(context); this.mActivityInfo = info.activityInfo; this.mComponentName = LauncherApps.getComponentName(info); this.mUser = user; mActivityInfo = info.activityInfo; mComponentName = LauncherApps.getComponentName(info); mUser = user; mFirstInstallTime = firstInstallTime; } LauncherActivityInfo(Context context) { Loading @@ -79,7 +81,13 @@ public class LauncherActivityInfo { } /** * Returns the user handle of the user profile that this activity belongs to. * Returns the user handle of the user profile that this activity belongs to. In order to * persist the identity of the profile, do not store the UserHandle. Instead retrieve its * serial number from UserManager. You can convert the serial number back to a UserHandle * for later use. * * @see UserManager#getSerialNumberForUser(UserHandle) * @see UserManager#getUserForSerialNumber(long) * * @return The UserHandle of the profile. */ Loading @@ -98,8 +106,10 @@ public class LauncherActivityInfo { /** * Returns the icon for this activity, without any badging for the profile. * @param density The preferred density of the icon, zero for default density. * @param density The preferred density of the icon, zero for default density. Use * density DPI values from {@link DisplayMetrics}. * @see #getBadgedIcon(int) * @see DisplayMetrics * @return The drawable associated with the activity */ public Drawable getIcon(int density) { Loading @@ -111,13 +121,23 @@ public class LauncherActivityInfo { * Returns the application flags from the ApplicationInfo of the activity. * * @return Application flags * @hide remove before shipping */ public int getApplicationFlags() { return mActivityInfo.applicationInfo.flags; } /** * Returns the application info for the appliction this activity belongs to. * @return */ public ApplicationInfo getApplicationInfo() { return mActivityInfo.applicationInfo; } /** * Returns the time at which the package was first installed. * * @return The time of installation of the package, in milliseconds. */ public long getFirstInstallTime() { Loading @@ -134,7 +154,9 @@ public class LauncherActivityInfo { /** * Returns the activity icon with badging appropriate for the profile. * @param density Optional density for the icon, or 0 to use the default density. * @param density Optional density for the icon, or 0 to use the default density. Use * {@link DisplayMetrics} for DPI values. * @see DisplayMetrics * @return A badged icon for the activity. */ public Drawable getBadgedIcon(int density) { Loading
core/java/android/content/pm/LauncherApps.java +126 −21 Original line number Diff line number Diff line Loading @@ -16,15 +16,18 @@ package android.content.pm; import android.app.AppGlobals; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.pm.ILauncherApps; import android.content.pm.IOnAppsChangedListener; import android.content.pm.PackageManager.NameNotFoundException; import android.graphics.Rect; import android.os.Bundle; import android.os.RemoteException; import android.os.UserHandle; import android.os.UserManager; import android.util.Log; import java.util.ArrayList; Loading @@ -36,6 +39,12 @@ import java.util.List; * managed profiles. This is mainly for use by launchers. Apps can be queried for each user profile. * Since the PackageManager will not deliver package broadcasts for other profiles, you can register * for package changes here. * <p> * To watch for managed profiles being added or removed, register for the following broadcasts: * {@link Intent#ACTION_MANAGED_PROFILE_ADDED} and {@link Intent#ACTION_MANAGED_PROFILE_REMOVED}. * <p> * You can retrieve the list of profiles associated with this user with * {@link UserManager#getUserProfiles()}. */ public class LauncherApps { Loading @@ -44,12 +53,13 @@ public class LauncherApps { private Context mContext; private ILauncherApps mService; private PackageManager mPm; private List<OnAppsChangedListener> mListeners = new ArrayList<OnAppsChangedListener>(); /** * Callbacks for changes to this and related managed profiles. * Callbacks for package changes to this and related managed profiles. */ public interface OnAppsChangedListener { /** Loading @@ -57,6 +67,7 @@ public class LauncherApps { * * @param user The UserHandle of the profile that generated the change. * @param packageName The name of the package that was removed. * @hide remove before ship */ void onPackageRemoved(UserHandle user, String packageName); Loading @@ -65,6 +76,7 @@ public class LauncherApps { * * @param user The UserHandle of the profile that generated the change. * @param packageName The name of the package that was added. * @hide remove before ship */ void onPackageAdded(UserHandle user, String packageName); Loading @@ -73,6 +85,7 @@ public class LauncherApps { * * @param user The UserHandle of the profile that generated the change. * @param packageName The name of the package that has changed. * @hide remove before ship */ void onPackageChanged(UserHandle user, String packageName); Loading @@ -86,6 +99,7 @@ public class LauncherApps { * available. * @param replacing Indicates whether these packages are replacing * existing ones. * @hide remove before ship */ void onPackagesAvailable(UserHandle user, String[] packageNames, boolean replacing); Loading @@ -99,14 +113,66 @@ public class LauncherApps { * unavailable. * @param replacing Indicates whether the packages are about to be * replaced with new versions. * @hide remove before ship */ void onPackagesUnavailable(UserHandle user, String[] packageNames, boolean replacing); /** * Indicates that a package was removed from the specified profile. * * @param packageName The name of the package that was removed. * @param user The UserHandle of the profile that generated the change. */ void onPackageRemoved(String packageName, UserHandle user); /** * Indicates that a package was added to the specified profile. * * @param packageName The name of the package that was added. * @param user The UserHandle of the profile that generated the change. */ void onPackageAdded(String packageName, UserHandle user); /** * Indicates that a package was modified in the specified profile. * * @param packageName The name of the package that has changed. * @param user The UserHandle of the profile that generated the change. */ void onPackageChanged(String packageName, UserHandle user); /** * Indicates that one or more packages have become available. For * example, this can happen when a removable storage card has * reappeared. * * @param packageNames The names of the packages that have become * available. * @param user The UserHandle of the profile that generated the change. * @param replacing Indicates whether these packages are replacing * existing ones. */ void onPackagesAvailable(String [] packageNames, UserHandle user, boolean replacing); /** * Indicates that one or more packages have become unavailable. For * example, this can happen when a removable storage card has been * removed. * * @param packageNames The names of the packages that have become * unavailable. * @param user The UserHandle of the profile that generated the change. * @param replacing Indicates whether the packages are about to be * replaced with new versions. */ void onPackagesUnavailable(String[] packageNames, UserHandle user, boolean replacing); } /** @hide */ public LauncherApps(Context context, ILauncherApps service) { mContext = context; mService = service; mPm = context.getPackageManager(); } /** Loading @@ -131,7 +197,15 @@ public class LauncherApps { final int count = activities.size(); for (int i = 0; i < count; i++) { ResolveInfo ri = activities.get(i); LauncherActivityInfo lai = new LauncherActivityInfo(mContext, ri, user); long firstInstallTime = 0; try { firstInstallTime = mPm.getPackageInfo(ri.activityInfo.packageName, PackageManager.GET_UNINSTALLED_PACKAGES).firstInstallTime; } catch (NameNotFoundException nnfe) { // Sorry, can't find package } LauncherActivityInfo lai = new LauncherActivityInfo(mContext, ri, user, firstInstallTime); if (DEBUG) { Log.v(TAG, "Returning activity for profile " + user + " : " + lai.getComponentName()); Loading @@ -157,7 +231,15 @@ public class LauncherApps { try { ResolveInfo ri = mService.resolveActivity(intent, user); if (ri != null) { LauncherActivityInfo info = new LauncherActivityInfo(mContext, ri, user); long firstInstallTime = 0; try { firstInstallTime = mPm.getPackageInfo(ri.activityInfo.packageName, PackageManager.GET_UNINSTALLED_PACKAGES).firstInstallTime; } catch (NameNotFoundException nnfe) { // Sorry, can't find package } LauncherActivityInfo info = new LauncherActivityInfo(mContext, ri, user, firstInstallTime); return info; } } catch (RemoteException re) { Loading @@ -173,9 +255,23 @@ public class LauncherApps { * @param sourceBounds The Rect containing the source bounds of the clicked icon * @param opts Options to pass to startActivity * @param user The UserHandle of the profile * @hide remove before ship */ public void startActivityForProfile(ComponentName component, Rect sourceBounds, Bundle opts, UserHandle user) { startActivityForProfile(component, user, sourceBounds, opts); } /** * Starts an activity in the specified profile. * * @param component The ComponentName of the activity to launch * @param user The UserHandle of the profile * @param sourceBounds The Rect containing the source bounds of the clicked icon * @param opts Options to pass to startActivity */ public void startActivityForProfile(ComponentName component, UserHandle user, Rect sourceBounds, Bundle opts) { if (DEBUG) { Log.i(TAG, "StartActivityForProfile " + component + " " + user.getIdentifier()); } Loading Loading @@ -224,7 +320,8 @@ public class LauncherApps { * * @param listener The listener to add. */ public synchronized void addOnAppsChangedListener(OnAppsChangedListener listener) { public void addOnAppsChangedListener(OnAppsChangedListener listener) { synchronized (this) { if (listener != null && !mListeners.contains(listener)) { mListeners.add(listener); if (mListeners.size() == 1) { Loading @@ -235,6 +332,7 @@ public class LauncherApps { } } } } /** * Removes a listener that was previously added. Loading @@ -242,7 +340,8 @@ public class LauncherApps { * @param listener The listener to remove. * @see #addOnAppsChangedListener(OnAppsChangedListener) */ public synchronized void removeOnAppsChangedListener(OnAppsChangedListener listener) { public void removeOnAppsChangedListener(OnAppsChangedListener listener) { synchronized (this) { mListeners.remove(listener); if (mListeners.size() == 0) { try { Loading @@ -251,6 +350,7 @@ public class LauncherApps { } } } } private IOnAppsChangedListener.Stub mAppsChangedListener = new IOnAppsChangedListener.Stub() { Loading @@ -261,7 +361,8 @@ public class LauncherApps { } synchronized (LauncherApps.this) { for (OnAppsChangedListener listener : mListeners) { listener.onPackageRemoved(user, packageName); listener.onPackageRemoved(user, packageName); // TODO: Remove before ship listener.onPackageRemoved(packageName, user); } } } Loading @@ -273,7 +374,8 @@ public class LauncherApps { } synchronized (LauncherApps.this) { for (OnAppsChangedListener listener : mListeners) { listener.onPackageChanged(user, packageName); listener.onPackageChanged(user, packageName); // TODO: Remove before ship listener.onPackageChanged(packageName, user); } } } Loading @@ -285,7 +387,8 @@ public class LauncherApps { } synchronized (LauncherApps.this) { for (OnAppsChangedListener listener : mListeners) { listener.onPackageAdded(user, packageName); listener.onPackageAdded(user, packageName); // TODO: Remove before ship listener.onPackageAdded(packageName, user); } } } Loading @@ -298,7 +401,8 @@ public class LauncherApps { } synchronized (LauncherApps.this) { for (OnAppsChangedListener listener : mListeners) { listener.onPackagesAvailable(user, packageNames, replacing); listener.onPackagesAvailable(user, packageNames, replacing); // TODO: Remove listener.onPackagesAvailable(packageNames, user, replacing); } } } Loading @@ -311,7 +415,8 @@ public class LauncherApps { } synchronized (LauncherApps.this) { for (OnAppsChangedListener listener : mListeners) { listener.onPackagesUnavailable(user, packageNames, replacing); listener.onPackagesUnavailable(user, packageNames, replacing); // TODO: Remove listener.onPackagesUnavailable(packageNames, user, replacing); } } } Loading