|
@@ -29,7 +29,7 @@ public class AppModel{
|
|
// 查询所有已经安装的应用程序
|
|
// 查询所有已经安装的应用程序
|
|
List<ApplicationInfo> listAppcations = pm.getInstalledApplications(PackageManager.GET_UNINSTALLED_PACKAGES);
|
|
List<ApplicationInfo> listAppcations = pm.getInstalledApplications(PackageManager.GET_UNINSTALLED_PACKAGES);
|
|
Collections.sort(listAppcations, new ApplicationInfo.DisplayNameComparator(pm));// 排序
|
|
Collections.sort(listAppcations, new ApplicationInfo.DisplayNameComparator(pm));// 排序
|
|
- List<AppInfo> appInfos = new ArrayList<AppInfo>(); // 保存过滤查到的AppInfo
|
|
|
|
|
|
+ List<AppInfo> appInfos = new ArrayList<>(); // 保存过滤查到的AppInfo
|
|
// 根据条件来过滤
|
|
// 根据条件来过滤
|
|
switch (filter) {
|
|
switch (filter) {
|
|
case FILTER_ALL_APP: // 所有应用程序
|
|
case FILTER_ALL_APP: // 所有应用程序
|
|
@@ -89,7 +89,7 @@ public class AppModel{
|
|
resolveIntent.addCategory(Intent.CATEGORY_LAUNCHER);//android.intent.category.LAUNCHER
|
|
resolveIntent.addCategory(Intent.CATEGORY_LAUNCHER);//android.intent.category.LAUNCHER
|
|
resolveIntent.setPackage(packageName);
|
|
resolveIntent.setPackage(packageName);
|
|
List<ResolveInfo> resolveinfoList = context.getPackageManager().queryIntentActivities(resolveIntent, 0);
|
|
List<ResolveInfo> resolveinfoList = context.getPackageManager().queryIntentActivities(resolveIntent, 0);
|
|
- if (resolveinfoList != null && resolveinfoList.size() > 0) {
|
|
|
|
|
|
+ if (resolveinfoList.size() > 0) {
|
|
ResolveInfo resolveinfo = resolveinfoList.iterator().next();
|
|
ResolveInfo resolveinfo = resolveinfoList.iterator().next();
|
|
if (resolveinfo != null) {
|
|
if (resolveinfo != null) {
|
|
className = resolveinfo.activityInfo.name;
|
|
className = resolveinfo.activityInfo.name;
|