private ComponentName mComponentName;
private ResolveInfo mResolveInfo;
private UserHandle mUser;
- private long mFirstInstallTime;
/**
* Create a launchable activity object for a given ResolveInfo and user.
* @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,
- long firstInstallTime) {
+ LauncherActivityInfo(Context context, ResolveInfo info, UserHandle user) {
this(context);
mResolveInfo = info;
mActivityInfo = info.activityInfo;
mComponentName = LauncherApps.getComponentName(info);
mUser = user;
- mFirstInstallTime = firstInstallTime;
}
LauncherActivityInfo(Context context) {
/**
* Returns the drawable for this activity, without any badging for the profile.
- * @param resource id of the drawable.
+ * @param iconRes id of the drawable.
* @param density The preferred density of the icon, zero for default density. Use
* density DPI values from {@link DisplayMetrics}.
* @see DisplayMetrics
* @return The time of installation of the package, in milliseconds.
*/
public long getFirstInstallTime() {
- return mFirstInstallTime;
+ try {
+ return mPm.getPackageInfo(mActivityInfo.packageName,
+ PackageManager.GET_UNINSTALLED_PACKAGES).firstInstallTime;
+ } catch (NameNotFoundException nnfe) {
+ // Sorry, can't find package
+ return 0;
+ }
}
/**
final int count = activities.size();
for (int i = 0; i < count; i++) {
ResolveInfo ri = activities.get(i);
- 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);
+ LauncherActivityInfo lai = new LauncherActivityInfo(mContext, ri, user);
if (DEBUG) {
Log.v(TAG, "Returning activity for profile " + user + " : "
+ lai.getComponentName());
try {
ResolveInfo ri = mService.resolveActivity(intent, user);
if (ri != null) {
- 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);
+ LauncherActivityInfo info = new LauncherActivityInfo(mContext, ri, user);
return info;
}
} catch (RemoteException re) {