无法检测日志中的CustomizedTextParser错误爬行的来源

时间:2018-04-03 14:36:38

标签: android

04-03 19:46:46.921 10152-10412/ D/CustomizedTextParser: 
Initialzed
 04-03 19:46:46.921 10152-10412/ E/CustomizedTextParser: 
getCustomizedText Rule is empty. mRuleMap={}
04-03 19:46:50.921 10152-10412/ E/CustomizedTextParser: 
getCustomizedText Rule is empty. mRuleMap={}

我的日志显示此错误,显然需要大约4秒钟。如何追踪此错误的来源?

日志出现时执行的代码

Collections.sort(packages, new 
ApplicationInfo.DisplayNameComparator(mPackageManager));

它基本上采用设备上已安装软件包的列表,并按照字母顺序对应用程序名称进行排序

1 个答案:

答案 0 :(得分:0)

我通过替换加载已安装软件包的方法来纠正这个问题。对于任何有相同问题的人,旧方法和新方法是:

旧方法

List<ApplicationInfo> packages = 
mPackageManager.getInstalledApplications(PackageManager.GET_META_DATA);

// Sorts the list in alphabetical order of app name
Collections.sort(packages, new ApplicationInfo.DisplayNameComparator(mPackageManager));

新方法

Intent intent = new Intent(Intent.ACTION_MAIN, null);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
List<ResolveInfo> activities = mPackageManager.queryIntentActivities(intent, 0);
Collections.sort(activities, new ResolveInfo.DisplayNameComparator(mPackageManager));