UserHandle user = new UserHandle(manager.getSerialNumberForUser(profile), profile); for (LauncherActivityInfo activityInfo : launcher.getActivityList(null, profile)) { ApplicationInfo appInfo = activityInfo.getApplicationInfo();
public ApplicationInfo getApplicationInfo() { return mLauncherActivityInfo.getApplicationInfo(); }
public ApplicationInfo getApplicationInfo() { return mLauncherActivityInfo.getApplicationInfo(); }
public ApplicationInfo getApplicationInfo() { return mLauncherActivityInfo.getApplicationInfo(); }
public ApplicationInfo getApplicationInfo() { return mLauncherActivityInfo.getApplicationInfo(); }
LauncherApps launcher = (LauncherApps) context.getSystemService(Context.LAUNCHER_APPS_SERVICE); LauncherActivityInfo info = launcher.getActivityList(this.appPojo.packageName, this.appPojo.userHandle.getRealHandle()).get(0); ai = info.getApplicationInfo();
public Drawable getResetIconDrawable(Context context, LauncherActivityInfo app, ItemInfo info) { final Drawable icon = new BitmapDrawable(context.getResources(), getDrawableIconForPackage(info.getTargetComponent())); return new BitmapDrawable(context.getResources(), LauncherIcons.createBadgedIconBitmap(icon, info.user, context, app.getApplicationInfo().targetSdkVersion)); }
public Bitmap getAppliedIconBitmap(Context context, IconCache iconCache, LauncherActivityInfo app, ItemInfo info) { Drawable defaultIcon = new BitmapDrawable(context.getResources(), iconCache.getNonNullIcon(iconCache.getCacheEntry(app), info.user)); return LauncherIcons.createBadgedIconBitmap(defaultIcon, info.user, context, app.getApplicationInfo().targetSdkVersion); } }
@Override public ApplicationInfo getApplicationInfo(String packageName, int flags, UserHandle user) { final boolean isPrimaryUser = Process.myUserHandle().equals(user); if (!isPrimaryUser && (flags == 0)) { // We are looking for an installed app on a secondary profile. Prior to O, the only // entry point for work profiles is through the LauncherActivity. List<LauncherActivityInfo> activityList = mLauncherApps.getActivityList(packageName, user); return activityList.size() > 0 ? activityList.get(0).getApplicationInfo() : null; } try { ApplicationInfo info = mContext.getPackageManager().getApplicationInfo(packageName, flags); // There is no way to check if the app is installed for managed profile. But for // primary profile, we can still have this check. if (isPrimaryUser && ((info.flags & ApplicationInfo.FLAG_INSTALLED) == 0) || !info.enabled) { return null; } return info; } catch (PackageManager.NameNotFoundException e) { // Package not found return null; } }
public AppInfo(LauncherActivityInfo info, UserHandle user, boolean quietModeEnabled) { this.componentName = info.getComponentName(); this.container = ItemInfo.NO_ID; this.user = user; if (PackageManagerHelper.isAppSuspended(info.getApplicationInfo())) { isDisabled |= ShortcutInfo.FLAG_DISABLED_SUSPENDED; } if (quietModeEnabled) { isDisabled |= ShortcutInfo.FLAG_DISABLED_QUIET_USER; } intent = makeLaunchIntent(info); }
(List<LauncherActivityInfo>) m.invoke(mLauncherApps, packageName, user); for (LauncherActivityInfo activityInfo : activities) { if (ignoreTargetSdk || activityInfo.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.O) { result.add(new ShortcutConfigActivityInfoVO(activityInfo));
/** * @return the component name that should be uninstalled or null. */ private static ComponentName getUninstallTarget(Context context, Object item) { Intent intent = null; UserHandle user = null; if (item instanceof AppInfo) { AppInfo info = (AppInfo) item; intent = info.intent; user = info.user; } else if (item instanceof ShortcutInfo) { ShortcutInfo info = (ShortcutInfo) item; if (info.itemType == LauncherSettings.BaseLauncherColumns.ITEM_TYPE_APPLICATION) { // Do not use restore/target intent here as we cannot uninstall an app which is // being installed/restored. intent = info.intent; user = info.user; } } if (intent != null) { LauncherActivityInfo info = LauncherAppsCompat.getInstance(context) .resolveActivity(intent, user); if (info != null && (info.getApplicationInfo().flags & ApplicationInfo.FLAG_SYSTEM) == 0) { return info.getComponentName(); } } return null; }
iconStyle = getRoundIcon(mContext, info.getApplicationInfo().packageName, iconDpi); break; case ROUND_COLORFUL: String packageName = info.getApplicationInfo().packageName;
if (lai != null && PackageManagerHelper.isAppSuspended(lai.getApplicationInfo())) { info.isDisabled = ShortcutInfo.FLAG_DISABLED_SUSPENDED;
/** * Adds an entry into the DB and the in-memory cache. * @param replaceExisting if true, it will recreate the bitmap even if it already exists in * the memory. This is useful then the previous bitmap was created using * old data. */ @Thunk private synchronized void addIconToDBAndMemCache(LauncherActivityInfo app, PackageInfo info, long userSerial, boolean replaceExisting) { final ComponentKey key = new ComponentKey(app.getComponentName(), app.getUser()); CacheEntry entry = null; if (!replaceExisting) { entry = mCache.get(key); // We can't reuse the entry if the high-res icon is not present. if (entry == null || entry.isLowResIcon || entry.icon == null) { entry = null; } } if (entry == null) { entry = new CacheEntry(); entry.icon = LauncherIcons.createBadgedIconBitmap(getFullResIcon(app), app.getUser(), mContext, app.getApplicationInfo().targetSdkVersion); } entry.title = app.getLabel(); entry.contentDescription = mUserManager.getBadgedLabelForUser(entry.title, app.getUser()); mCache.put(key, entry); Bitmap lowResIcon = generateLowResIcon(entry.icon, mActivityBgColor); ContentValues values = newContentValues(entry.icon, lowResIcon, entry.title.toString(), app.getApplicationInfo().packageName); addIconToDB(values, app.getComponentName(), info, userSerial); }
public void addCustomInfoToDataBase(Drawable icon, ItemInfo info, CharSequence title) { LauncherActivityInfo app = mLauncherApps.resolveActivity(info.getIntent(), info.user); final ComponentKey key = new ComponentKey(app.getComponentName(), app.getUser()); CacheEntry entry = mCache.get(key); PackageInfo packageInfo = null; try { packageInfo = mPackageManager.getPackageInfo( app.getComponentName().getPackageName(), 0); } catch (NameNotFoundException e) { e.printStackTrace(); } // We can't reuse the entry if the high-res icon is not present. if (entry == null || entry.isLowResIcon || entry.icon == null) { entry = new CacheEntry(); } entry.icon = LauncherIcons.createIconBitmap(icon, mContext); entry.title = title != null ? title : app.getLabel(); entry.contentDescription = mUserManager.getBadgedLabelForUser(entry.title, app.getUser()); mCache.put(key, entry); Bitmap lowResIcon = generateLowResIcon(entry.icon, mActivityBgColor); ContentValues values = newContentValues(entry.icon, lowResIcon, entry.title.toString(), app.getApplicationInfo().packageName); if (packageInfo != null) { addIconToDB(values, app.getComponentName(), packageInfo, mUserManager.getSerialNumberForUser(app.getUser())); } }
entry.icon = LauncherIcons.createBadgedIconBitmap( getFullResIcon(info), info.getUser(), mContext, infoProvider.get().getApplicationInfo().targetSdkVersion); } else { if (usePackageIcon) {