Browse Source

1.应用白名单和初始应用以外的应用直接卸载。

20241218TB223FC(测试jar包)
wangwanlei 9 months ago
parent
commit
26ff932fa3

+ 4
- 0
app/src/main/java/com/xhly/manageapp/ManageApplication.kt View File

@@ -87,6 +87,10 @@ class ManageApplication : MultiDexApplication() {
87 87
 
88 88
         fun uninstallPackage(pkg: String) {
89 89
             if (ModelNameUtils.IS_LianxX505f()) {
90
+                if (pkg == Const.CURRENTAPPPKG || pkg == Const.STOREAPPPKG){
91
+                    //不卸载管控和商店
92
+                    return
93
+                }
90 94
                 csdkManager?.uninstallPackage(pkg, false)
91 95
             }
92 96
         }

+ 3
- 2
app/src/main/java/com/xhly/manageapp/ui/main/activity/MainActivity.kt View File

@@ -132,10 +132,11 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>() {
132 132
             appList.forEach { app ->
133 133
                 val filter = modelList.filter { it.appPackage.equals(app.packageName) }
134 134
                 val appInfos = firstAppList.filter { app.packageName.equals(it) }
135
-                //接口列表以及初始化列表中不存在则将应用冻结或者卸载,目前是冻结
135
+                //接口列表以及初始化列表中不存在则将应用冻结或者卸载,目前是卸载
136 136
                 LogShow("${app.name},被冻结" + (filter.isEmpty() && appInfos.isEmpty()))
137 137
                 if (filter.isEmpty() && appInfos.isEmpty()) {
138
-                    ManageApplication.setPackageEnabled(app.packageName, (filter.isNotEmpty()))
138
+                    //ManageApplication.setPackageEnabled(app.packageName, (filter.isNotEmpty()))
139
+                     ManageApplication.uninstallPackage(app.packageName)
139 140
                 }
140 141
             }
141 142
         }

Loading…
Cancel
Save