@@ -5,6 +5,7 @@ import android.content.pm.ApplicationInfo
5
5
import android.content.pm.PackageInfo
6
6
import android.content.pm.PackageManager
7
7
import android.text.TextUtils
8
+ import cn.tongdun.mobrisk.core.tools.executeSafe
8
9
9
10
/* *
10
11
* @description: App List
@@ -23,23 +24,24 @@ class AppListCollector(packageManager: PackageManager) : AppListDataInterface {
23
24
private val systemAppList: MutableList <String ?> = ArrayList ()
24
25
25
26
init {
26
- packageManager.getInstalledPackages(PackageManager .GET_ACTIVITIES )
27
- .filter {
28
- isSystemApp(it)
29
- }.map {
30
- appList.add(it.packageName)
27
+ executeSafe {
28
+ packageManager.getInstalledPackages(PackageManager .GET_ACTIVITIES )
29
+ .filter {
30
+ isSystemApp(it)
31
+ }.map {
32
+ appList.add(it.packageName)
33
+ }
34
+ packageManager.getInstalledPackages(PackageManager .GET_META_DATA ).fold(
35
+ Pair (systemAppList, appList)
36
+ ) { (systemList, appList), packageInfo ->
37
+ if (isSystemApp(packageInfo)) {
38
+ systemList.add(packageInfo.packageName)
39
+ } else {
40
+ appList.add(packageInfo.packageName)
41
+ }
42
+ Pair (systemList, appList)
31
43
}
32
- packageManager.getInstalledPackages(PackageManager .GET_META_DATA ).fold(
33
- Pair (systemAppList, appList)
34
- ) { (systemList, appList), packageInfo ->
35
- if (isSystemApp(packageInfo)) {
36
- systemList.add(packageInfo.packageName)
37
- } else {
38
- appList.add(packageInfo.packageName)
39
- }
40
- Pair (systemList, appList)
41
44
}
42
-
43
45
}
44
46
45
47
@SuppressLint(" QueryPermissionsNeeded" )
0 commit comments