Bladeren bron

1.添加TB223FC机型判断和网络白名单设置代码。

2025_1_17_tb223fc
wangwanlei 1 maand geleden
bovenliggende
commit
52b1bbba6a

+ 1
- 1
app/src/main/java/com/xhly/manageapp/AppAdapter.kt Bestand weergeven

@@ -69,7 +69,7 @@ class AppAdapter(var context: Context, var data: ArrayList<AppInfo>) :
69 69
                 val rotationAllowed = SystemUtil.isRotationAllowed(context)
70 70
                 if (ModelNameUtils.IS_LianxX505f()){
71 71
                     ManageApplication.disallowSetAutoRotation(rotationAllowed)
72
-                }else  if (ModelNameUtils.IS_LianxX6e6f()){
72
+                }else  if (ModelNameUtils.IS_LianxX6e6f()||ModelNameUtils.IS_LianxTB223FC()){
73 73
                     ManageApplication.disallowSetAutoRotation(!rotationAllowed)
74 74
                 }
75 75
                 val tips=if (SystemUtil.isRotationAllowed(context)){

+ 122
- 95
app/src/main/java/com/xhly/manageapp/ManageApplication.kt Bestand weergeven

@@ -15,6 +15,7 @@ import com.hjq.toast.Toaster
15 15
 import com.kongzue.dialogx.DialogX
16 16
 import com.tencent.bugly.crashreport.CrashReport
17 17
 import com.xhly.corelib.Const
18
+import com.xhly.corelib.utils.AppUtils
18 19
 import com.xhly.corelib.utils.LogShow
19 20
 import com.xhly.corelib.utils.LogUtils
20 21
 import com.xhly.corelib.utils.ModelNameUtils
@@ -22,6 +23,7 @@ import com.xhly.corelib.utils.SharedPreferencesUtils
22 23
 import com.xhly.corelib.utils.SystemUtil
23 24
 import com.xhly.manageapp.bean.user.UserBean
24 25
 import com.xhly.manageapp.service.websocket.AppSocket
26
+import com.xhly.manageapp.utils.AfwUtils
25 27
 import com.xhly.manageapp.utils.CurrentAppSharedPreferencesUtils
26 28
 import com.xhly.manageapp.utils.StrategyUtils
27 29
 import com.xhly.manageapp.utils.ZJAPPUtils
@@ -39,7 +41,7 @@ class ManageApplication : MultiDexApplication() {
39 41
          * 加入可安装应用白名单
40 42
          */
41 43
         fun addInstallPackageWhiteList(pkgList: ArrayList<String>) {
42
-            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
44
+            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
43 45
                 //先移除,再添加。
44 46
                 removeInstallPackageWhiteList(getInstallPackageWhiteList())
45 47
                 pkgList.add(Const.CURRENTAPPPKG)
@@ -54,7 +56,7 @@ class ManageApplication : MultiDexApplication() {
54 56
          * 移除可安装应用白名单
55 57
          */
56 58
         fun removeInstallPackageWhiteList(pkgList: ArrayList<String>) {
57
-            if ((ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) && pkgList.size > 0) {
59
+            if ((ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f() ||ModelNameUtils.IS_LianxTB223FC()) && pkgList.size > 0) {
58 60
                 pkgList.remove(Const.CURRENTAPPPKG)
59 61
                 pkgList.remove("com.xhkjedu.pinyin")
60 62
                 csdkManager?.removeInstallPackageWhiteList(pkgList)
@@ -67,7 +69,7 @@ class ManageApplication : MultiDexApplication() {
67 69
          */
68 70
         fun getInstallPackageWhiteList(): ArrayList<String> {
69 71
             try {
70
-                if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
72
+                if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
71 73
                     return csdkManager?.installPackageWhiteList as ArrayList<String>
72 74
                 }
73 75
             } catch (e: Exception) {
@@ -82,7 +84,7 @@ class ManageApplication : MultiDexApplication() {
82 84
 
83 85
         fun installPackage(string: String) {
84 86
             enableAllUnkownsourcesV3(true)
85
-            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
87
+            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
86 88
                 LogShow("开始安装$string" + File(string).exists())
87 89
                 csdkManager?.installPackage(string)
88 90
             } else {
@@ -97,7 +99,7 @@ class ManageApplication : MultiDexApplication() {
97 99
          */
98 100
 
99 101
         fun uninstallPackage(pkg: String) {
100
-            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
102
+            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
101 103
                 if (pkg == Const.CURRENTAPPPKG || pkg == Const.STOREAPPPKG || pkg == Const.INPUTMETHODPKG) {
102 104
                     //不卸载管控和商店以及输入法
103 105
                     return
@@ -110,7 +112,7 @@ class ManageApplication : MultiDexApplication() {
110 112
          * 禁止安装app,true:禁止安装应用 false:取消禁止安装应用,禁止时静默安装只能安装白名单内的应用,不禁止时静默安装可以安装白名单外的应用
111 113
          */
112 114
         fun disableInstallation(isInstall: Boolean) {
113
-            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
115
+            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
114 116
                 csdkManager?.disableInstallation(isInstall)
115 117
             }
116 118
         }
@@ -123,7 +125,7 @@ class ManageApplication : MultiDexApplication() {
123 125
         fun disableApplicationManage(enable: Boolean) {
124 126
             if (ModelNameUtils.IS_LianxX505f()) {
125 127
                 csdkManager?.disableApplicationManage_v3(enable)
126
-            } else if (ModelNameUtils.IS_LianxX6e6f()) {
128
+            } else if (ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
127 129
                 csdkManager?.disableApplicationManageV3(enable)
128 130
             }
129 131
         }
@@ -133,7 +135,7 @@ class ManageApplication : MultiDexApplication() {
133 135
          */
134 136
         fun setPackageEnabled(pkg: String, enableFlag: Boolean) {
135 137
             try {
136
-                if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
138
+                if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
137 139
                     csdkManager?.setPackageEnabled(pkg, enableFlag)
138 140
                 }
139 141
             }catch (e:Exception){
@@ -147,7 +149,7 @@ class ManageApplication : MultiDexApplication() {
147 149
         fun setDisplayBlacklist(pkgList: ArrayList<String>) {
148 150
             if (ModelNameUtils.IS_LianxX505f()) {
149 151
                 csdkManager?.displayBlacklist_v3 = pkgList
150
-            } else if (ModelNameUtils.IS_LianxX6e6f()) {
152
+            } else if (ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
151 153
                 csdkManager?.displayBlacklistV3 = pkgList
152 154
             }
153 155
         }
@@ -156,7 +158,7 @@ class ManageApplication : MultiDexApplication() {
156 158
          * 杀进程
157 159
          */
158 160
         fun killApplicationProcess(pkg: String) {
159
-            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
161
+            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
160 162
                 csdkManager?.killApplicationProcess(pkg)
161 163
             }
162 164
         }
@@ -166,7 +168,7 @@ class ManageApplication : MultiDexApplication() {
166 168
          * false:启用相机
167 169
          */
168 170
         fun disableCamera(enableFlag: Boolean) {
169
-            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
171
+            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
170 172
                 csdkManager?.disableCamera(enableFlag)
171 173
             }
172 174
         }
@@ -178,7 +180,7 @@ class ManageApplication : MultiDexApplication() {
178 180
         fun enableBluetooth(enableFlag: Boolean) {
179 181
             if (ModelNameUtils.IS_LianxX505f()) {
180 182
                 csdkManager?.enableBluetooth_v3(enableFlag)
181
-            } else if (ModelNameUtils.IS_LianxX6e6f()) {
183
+            } else if (ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
182 184
                 csdkManager?.enableBluetoothV3(enableFlag)
183 185
             }
184 186
         }
@@ -189,7 +191,7 @@ class ManageApplication : MultiDexApplication() {
189 191
         fun disallowUsbDebugging(enableFlag: Boolean) {
190 192
             if (ModelNameUtils.IS_LianxX505f()) {
191 193
                 csdkManager?.disallowUsbDebugging_v3(enableFlag)
192
-            } else if (ModelNameUtils.IS_LianxX6e6f()) {
194
+            } else if (ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
193 195
                 csdkManager?.disallowUsbDebuggingV3(enableFlag)
194 196
             }
195 197
         }
@@ -200,7 +202,7 @@ class ManageApplication : MultiDexApplication() {
200 202
         fun disallowWifi(enableFlag: Boolean) {
201 203
             if (ModelNameUtils.IS_LianxX505f()) {
202 204
                 csdkManager?.disallowWifi_v3(enableFlag)
203
-            } else if (ModelNameUtils.IS_LianxX6e6f()) {
205
+            } else if (ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
204 206
                 csdkManager?.disallowWifiV3(enableFlag)
205 207
             }
206 208
         }
@@ -211,7 +213,7 @@ class ManageApplication : MultiDexApplication() {
211 213
         fun enableWifi(enableFlag: Boolean) {
212 214
             if (ModelNameUtils.IS_LianxX505f()) {
213 215
                 csdkManager?.enableWifi_v3(enableFlag)
214
-            } else if (ModelNameUtils.IS_LianxX6e6f()) {
216
+            } else if (ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
215 217
                 csdkManager?.enableWifiV3(enableFlag)
216 218
             }
217 219
         }
@@ -222,7 +224,7 @@ class ManageApplication : MultiDexApplication() {
222 224
         fun disallowData(enableFlag: Boolean) {
223 225
             if (ModelNameUtils.IS_LianxX505f()) {
224 226
                 csdkManager?.disallowData_v3(enableFlag)
225
-            } else if (ModelNameUtils.IS_LianxX6e6f()) {
227
+            } else if (ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
226 228
                 csdkManager?.disallowDataV3(enableFlag)
227 229
             }
228 230
         }
@@ -233,7 +235,7 @@ class ManageApplication : MultiDexApplication() {
233 235
         fun enableData(enableFlag: Boolean) {
234 236
             if (ModelNameUtils.IS_LianxX505f()) {
235 237
                 csdkManager?.enableData_v3(enableFlag)
236
-            } else if (ModelNameUtils.IS_LianxX6e6f()) {
238
+            } else if (ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
237 239
                 csdkManager?.enableDataV3(enableFlag)
238 240
             }
239 241
         }
@@ -244,7 +246,7 @@ class ManageApplication : MultiDexApplication() {
244 246
         fun disallowLocation(enableFlag: Boolean) {
245 247
             if (ModelNameUtils.IS_LianxX505f()) {
246 248
                 csdkManager?.disallowLocation_v3(enableFlag)
247
-            } else if (ModelNameUtils.IS_LianxX6e6f()) {
249
+            } else if (ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
248 250
                 csdkManager?.disallowLocationV3(enableFlag)
249 251
             }
250 252
         }
@@ -255,7 +257,7 @@ class ManageApplication : MultiDexApplication() {
255 257
         fun enableLocation(enableFlag: Boolean) {
256 258
             if (ModelNameUtils.IS_LianxX505f()) {
257 259
                 csdkManager?.enableLocation_v3(enableFlag)
258
-            } else if (ModelNameUtils.IS_LianxX6e6f()) {
260
+            } else if (ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
259 261
                 csdkManager?.enableLocationV3(enableFlag)
260 262
             }
261 263
         }
@@ -266,7 +268,7 @@ class ManageApplication : MultiDexApplication() {
266 268
         fun disallowWifiAdvanceSettings(enableFlag: Boolean) {
267 269
             if (ModelNameUtils.IS_LianxX505f()) {
268 270
                 csdkManager?.disallowWifiadvancesettings_v3(enableFlag)
269
-            } else if (ModelNameUtils.IS_LianxX6e6f()) {
271
+            } else if (ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
270 272
                 csdkManager?.disallowWifiAdvanceSettingsV3(enableFlag)
271 273
             }
272 274
         }
@@ -275,7 +277,7 @@ class ManageApplication : MultiDexApplication() {
275 277
          *禁用/启用SD卡 true:允许连接外部存储设备
276 278
          */
277 279
         fun enableMassStorage(enableFlag: Boolean) {
278
-            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
280
+            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
279 281
                 csdkManager?.enableMassStorage(enableFlag)
280 282
             }
281 283
         }
@@ -284,7 +286,7 @@ class ManageApplication : MultiDexApplication() {
284 286
          *禁用/启用OTG true:允许连接外部OTG
285 287
          */
286 288
         fun setCustomOTG(enableFlag: Boolean) {
287
-            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
289
+            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
288 290
                 csdkManager?.customOTG = enableFlag
289 291
             }
290 292
         }
@@ -296,7 +298,7 @@ class ManageApplication : MultiDexApplication() {
296 298
         fun disallowSwitchLauncher_v3(enableFlag: Boolean) {
297 299
             if (ModelNameUtils.IS_LianxX505f()) {
298 300
                 csdkManager?.disallowSwitchLauncher_v3(enableFlag)
299
-            } else if (ModelNameUtils.IS_LianxX6e6f()) {
301
+            } else if (ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
300 302
                 csdkManager?.disallowSwitchLauncherV3(enableFlag)
301 303
             }
302 304
         }
@@ -305,7 +307,7 @@ class ManageApplication : MultiDexApplication() {
305 307
          * 设置运行时权限
306 308
          */
307 309
         fun setRuntimePermissions(enableFlag: Boolean) {
308
-            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
310
+            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
309 311
                 csdkManager?.setRuntimePermissions(enableFlag)
310 312
             }
311 313
         }
@@ -314,7 +316,7 @@ class ManageApplication : MultiDexApplication() {
314 316
          * "设备Mac地址", "设备SN号", "获取设备型号信息", "获取设备IMEI信息" 1,2,3,4
315 317
          */
316 318
         fun getDeviceInfo(type: Int = 2): String? {
317
-            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
319
+            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
318 320
                 return csdkManager?.getDeviceInfo(type)
319 321
             }
320 322
             try {
@@ -345,7 +347,7 @@ class ManageApplication : MultiDexApplication() {
345 347
          * 恢复出场设置
346 348
          */
347 349
         fun launchFactoryReset() {
348
-            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
350
+            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
349 351
                 csdkManager?.launchFactoryReset()
350 352
             }
351 353
         }
@@ -355,7 +357,7 @@ class ManageApplication : MultiDexApplication() {
355 357
          */
356 358
 
357 359
         fun rebootDevice() {
358
-            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
360
+            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
359 361
                 csdkManager?.rebootDevice()
360 362
             }
361 363
         }
@@ -364,8 +366,7 @@ class ManageApplication : MultiDexApplication() {
364 366
          * 增加wifi白名单
365 367
          */
366 368
         fun addWifiWhiteList(list: List<String>) {
367
-            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
368
-                //csdkManager?.addWifiWhiteList(list)
369
+            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
369 370
                 setWifiWhiteList(list)
370 371
             }
371 372
         }
@@ -386,7 +387,7 @@ class ManageApplication : MultiDexApplication() {
386 387
                 } catch (e: Exception) {
387 388
                     csdkManager?.wifiWhiteList = list
388 389
                 }
389
-            } else if (ModelNameUtils.IS_LianxX6e6f()) {
390
+            } else if (ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
390 391
                 enableWifiWhiteList(true)
391 392
                 csdkManager?.addWifiWhiteList(list)
392 393
             }
@@ -397,8 +398,8 @@ class ManageApplication : MultiDexApplication() {
397 398
          */
398 399
         fun enableWifiWhiteList(enable: Boolean) {
399 400
             if (ModelNameUtils.IS_LianxX505f()) {
400
-                //csdkManager?.whitelist
401
-            } else if (ModelNameUtils.IS_LianxX6e6f()) {
401
+               //移除就是启用所以505不调用方法
402
+            } else if (ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
402 403
                 csdkManager?.enableWifiWhiteList(enable)
403 404
             }
404 405
         }
@@ -407,7 +408,7 @@ class ManageApplication : MultiDexApplication() {
407 408
          * 移除wifi白名单
408 409
          */
409 410
         fun removeWifiWhiteList(list: List<String>) {
410
-            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
411
+            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
411 412
                 csdkManager?.removeWifiWhiteList(list)
412 413
             }
413 414
         }
@@ -416,7 +417,7 @@ class ManageApplication : MultiDexApplication() {
416 417
          * 获得wifi白名单
417 418
          */
418 419
         fun getWifiWhiteList(): List<String> {
419
-            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
420
+            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
420 421
                 val wifiWhiteList = csdkManager?.wifiWhiteList
421 422
                 if (wifiWhiteList != null) {
422 423
                     return wifiWhiteList
@@ -432,7 +433,7 @@ class ManageApplication : MultiDexApplication() {
432 433
         fun enableCaptureScreen(enable: Boolean) {
433 434
             if (ModelNameUtils.IS_LianxX505f()) {
434 435
                 csdkManager?.enableCaptureScreen_v3(enable)
435
-            } else if (ModelNameUtils.IS_LianxX6e6f()) {
436
+            } else if (ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
436 437
                 csdkManager?.enableCaptureScreenV3(enable)
437 438
             }
438 439
         }
@@ -444,7 +445,7 @@ class ManageApplication : MultiDexApplication() {
444 445
             if (ModelNameUtils.IS_LianxX505f()) {
445 446
                 //true关闭 flase开启 6e6f可能不一样
446 447
                 csdkManager?.setAutoRotate(enable)
447
-            } else if (ModelNameUtils.IS_LianxX6e6f()) {
448
+            } else if (ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
448 449
                 //true开启  flase关闭
449 450
                 csdkManager?.enableAutoRotation(enable)
450 451
             }
@@ -454,7 +455,7 @@ class ManageApplication : MultiDexApplication() {
454 455
          * 隐藏底部返回键
455 456
          */
456 457
         fun hideBackSoftKey(enableFlag: Boolean) {
457
-            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
458
+            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
458 459
                 csdkManager?.hideBackSoftKey(enableFlag)
459 460
             }
460 461
         }
@@ -463,7 +464,7 @@ class ManageApplication : MultiDexApplication() {
463 464
          * 隐藏底部菜单键
464 465
          */
465 466
         fun hideMenuSoftKey(enableFlag: Boolean) {
466
-            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
467
+            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
467 468
                 csdkManager?.hideMenuSoftKey(enableFlag)
468 469
             }
469 470
         }
@@ -473,7 +474,7 @@ class ManageApplication : MultiDexApplication() {
473 474
          * 隐藏底部home键
474 475
          */
475 476
         fun hideHomeSoftKey(enableFlag: Boolean) {
476
-            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
477
+            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
477 478
                 csdkManager?.hideHomeSoftKey(enableFlag)
478 479
             }
479 480
         }
@@ -482,7 +483,7 @@ class ManageApplication : MultiDexApplication() {
482 483
          * 隐藏电源,音量键int:24, 25, 26(音量上,音量下,电源键) true:启用
483 484
          */
484 485
         fun requestKeyControl_V3(code: Int, enableFlag: Boolean) {
485
-            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
486
+            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
486 487
                 csdkManager?.requestKeyControl_V3(code, enableFlag)
487 488
             }
488 489
         }
@@ -499,7 +500,7 @@ class ManageApplication : MultiDexApplication() {
499 500
          */
500 501
 
501 502
         fun setComponentEnabled(componentName: ComponentName, newstate: Int, flag: Int) {
502
-            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
503
+            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
503 504
                try {
504 505
                    csdkManager?.setComponentEnabled(componentName, newstate, flag)
505 506
                }catch (e:Exception){
@@ -512,7 +513,7 @@ class ManageApplication : MultiDexApplication() {
512 513
          * 设置启动器
513 514
          */
514 515
         fun setCustomLauncher(pkg: String, activityName: String) {
515
-            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
516
+            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
516 517
                 csdkManager?.setCustomLauncher(pkg, activityName)
517 518
             }
518 519
         }
@@ -524,7 +525,7 @@ class ManageApplication : MultiDexApplication() {
524 525
         fun disallowAirplaneMode_v3(enableFlag: Boolean) {
525 526
             if (ModelNameUtils.IS_LianxX505f()) {
526 527
                 csdkManager?.disallowAirplaneMode_v3(enableFlag)
527
-            } else if (ModelNameUtils.IS_LianxX6e6f()) {
528
+            } else if (ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
528 529
                 csdkManager?.disallowAirplaneModeV3(enableFlag)
529 530
             }
530 531
         }
@@ -535,7 +536,7 @@ class ManageApplication : MultiDexApplication() {
535 536
          * false:显示状态栏
536 537
          */
537 538
         fun hideStatusBar(enableFlag: Boolean) {
538
-            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
539
+            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
539 540
                 csdkManager?.hideStatusBar(enableFlag)
540 541
             }
541 542
         }
@@ -545,7 +546,7 @@ class ManageApplication : MultiDexApplication() {
545 546
          * false:启用状态栏下拉
546 547
          */
547 548
         fun disableStatusBarPanel(enableFlag: Boolean) {
548
-            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
549
+            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
549 550
                 csdkManager?.disableStatusBarPanel(enableFlag)
550 551
             }
551 552
         }
@@ -558,7 +559,7 @@ class ManageApplication : MultiDexApplication() {
558 559
         fun enableAllUnkownsourcesV3(enableFlag: Boolean) {
559 560
             if (ModelNameUtils.IS_LianxX505f()) {
560 561
                 csdkManager?.enableAllUnkownsources_v3(enableFlag)
561
-            } else if (ModelNameUtils.IS_LianxX6e6f()) {
562
+            } else if (ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
562 563
                 csdkManager?.enableAllUnkownsourcesV3(enableFlag)
563 564
             }
564 565
         }
@@ -570,7 +571,7 @@ class ManageApplication : MultiDexApplication() {
570 571
         fun enableUnkownsources(pkg: String, enableFlag: Boolean) {
571 572
             if (ModelNameUtils.IS_LianxX505f()) {
572 573
                 csdkManager?.enableUnkownsources_v3(pkg, enableFlag)
573
-            } else if (ModelNameUtils.IS_LianxX6e6f()) {
574
+            } else if (ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
574 575
                 csdkManager?.enableUnkownsourcesV3(pkg, enableFlag)
575 576
             }
576 577
         }
@@ -580,7 +581,7 @@ class ManageApplication : MultiDexApplication() {
580 581
          * false:关闭 USB 调试
581 582
          */
582 583
         fun enableUsbDebugging(enableFlag: Boolean) {
583
-            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
584
+            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
584 585
                 csdkManager?.enableUsbDebugging(true)
585 586
                 if (ModelNameUtils.IS_LianxX505f()) {
586 587
                     //关闭usb调试时设置为充电模式
@@ -608,7 +609,7 @@ class ManageApplication : MultiDexApplication() {
608 609
          *设置系统时间
609 610
          */
610 611
         fun setSysTime(time: Long) {
611
-            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
612
+            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
612 613
                 csdkManager?.setSysTime(time)
613 614
             }
614 615
         }
@@ -617,14 +618,19 @@ class ManageApplication : MultiDexApplication() {
617 618
          * 添加网络白名单
618 619
          */
619 620
         fun setUrlWhiteListWrite(list: ArrayList<String>) {
620
-            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
621
+            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
621 622
                 setUrlWhiteListEnable(true)
622 623
                 //先清除再添加
623 624
                 ClearIpHostRules()
624 625
                 list.add(Const.BASEURL)
625 626
                 list.addAll(Const.whiteList)
626
-                csdkManager?.urlWhiteListWrite(list)
627
-                csdkManager?.urlBlackListWrite(arrayListOf("*"))
627
+                if (ModelNameUtils.IS_LianxTB223FC()){
628
+                  AfwUtils.addUrLWhiteList(list)
629
+                  AfwUtils.addUrLBlackList(arrayListOf("*"))
630
+                }else{
631
+                    csdkManager?.urlWhiteListWrite(list)
632
+                    csdkManager?.urlBlackListWrite(arrayListOf("*"))
633
+                }
628 634
             }
629 635
         }
630 636
 
@@ -633,7 +639,7 @@ class ManageApplication : MultiDexApplication() {
633 639
          * 添加默认网络白名单
634 640
          */
635 641
         fun setDefaultUrlWhiteListWrite(list: ArrayList<String>) {
636
-            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
642
+            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
637 643
                 setUrlWhiteListEnable(true)
638 644
                 val urlWhiteListRead = urlWhiteListRead()
639 645
                 LogShow("之前的白名单有" + urlWhiteListRead.size)
@@ -650,8 +656,12 @@ class ManageApplication : MultiDexApplication() {
650 656
          * 启动网络白名单true启动,false关闭
651 657
          */
652 658
         fun setUrlWhiteListEnable(enableFlag: Boolean) {
653
-            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
654
-                csdkManager?.SetEnable(enableFlag)
659
+            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
660
+                if (ModelNameUtils.IS_LianxTB223FC()){
661
+                    AfwUtils.setEnable(enableFlag)
662
+                }else{
663
+                    csdkManager?.SetEnable(enableFlag)
664
+                }
655 665
             }
656 666
         }
657 667
 
@@ -659,10 +669,14 @@ class ManageApplication : MultiDexApplication() {
659 669
          * 移除网络白名单505f使用这个
660 670
          */
661 671
         fun ClearIpHostRules(): Boolean {
662
-            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
663
-                val clearIpHostRules = csdkManager?.ClearIpHostRules()
664
-                clearIpHostRules?.let {
665
-                    return it
672
+            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
673
+                if (ModelNameUtils.IS_LianxTB223FC()){
674
+                    AfwUtils.clearIpHostRules()
675
+                }else{
676
+                    val clearIpHostRules = csdkManager?.ClearIpHostRules()
677
+                    clearIpHostRules?.let {
678
+                        return it
679
+                    }
666 680
                 }
667 681
             }
668 682
             return false
@@ -676,7 +690,7 @@ class ManageApplication : MultiDexApplication() {
676 690
 
677 691
         fun  setSafeModeDisabled(boolean: Boolean=true){
678 692
            try {
679
-               if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
693
+               if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
680 694
                    csdkManager?.setSafeModeDisabled(boolean)
681 695
                }
682 696
            }catch (e:Exception){
@@ -693,7 +707,7 @@ class ManageApplication : MultiDexApplication() {
693 707
                 pkgList.forEach {
694 708
                     csdkManager?.clearAppData(it)
695 709
                 }
696
-            }else if (ModelNameUtils.IS_LianxX6e6f()){
710
+            }else if (ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()){
697 711
                 pkgList.forEach {
698 712
                     csdkManager?.clearAppData(it)
699 713
                 }
@@ -707,9 +721,19 @@ class ManageApplication : MultiDexApplication() {
707 721
             if (removeFlag) {
708 722
                 clearAppWhiteRule()
709 723
             }
710
-            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
711
-                pkgList.forEach {
712
-                    csdkManager?.AddAppWhiteRule(it)
724
+            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
725
+                if (ModelNameUtils.IS_LianxTB223FC()){
726
+                  try {
727
+                      pkgList.forEach {
728
+                          AfwUtils.jurisdiction(1,AfwUtils.getUUid(instance!!,it).toInt())
729
+                      }
730
+                  }catch (e:Exception){
731
+
732
+                  }
733
+                }else{
734
+                    pkgList.forEach {
735
+                        csdkManager?.AddAppWhiteRule(it)
736
+                    }
713 737
                 }
714 738
             }
715 739
         }
@@ -718,12 +742,16 @@ class ManageApplication : MultiDexApplication() {
718 742
          * 移除网络应用白名单
719 743
          */
720 744
         fun clearAppWhiteRule() {
721
-            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
722
-                csdkManager?.ClearAppRules()
723
-                //不移除自己和商店
724
-                csdkManager?.AddAppWhiteRule(Const.CURRENTAPPPKG)
725
-                csdkManager?.AddAppWhiteRule(Const.STOREAPPPKG)
726
-                csdkManager?.AddAppWhiteRule("com.lenovo.mia.setupwizard")
745
+            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
746
+                if (ModelNameUtils.IS_LianxTB223FC()){
747
+                    AfwUtils.clearAppRules()
748
+                }else{
749
+                    csdkManager?.ClearAppRules()
750
+                    //不移除自己和商店
751
+                    csdkManager?.AddAppWhiteRule(Const.CURRENTAPPPKG)
752
+                    csdkManager?.AddAppWhiteRule(Const.STOREAPPPKG)
753
+                    csdkManager?.AddAppWhiteRule("com.lenovo.mia.setupwizard")
754
+                }
727 755
             }
728 756
         }
729 757
 
@@ -732,10 +760,14 @@ class ManageApplication : MultiDexApplication() {
732 760
          */
733 761
         fun GetAppWhiteRules(): ArrayList<String> {
734 762
             val appList = arrayListOf<String>()
735
-            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
736
-                var appWhiteRules = csdkManager?.appWhiteRules
737
-                appWhiteRules?.let {
738
-                    appList.addAll(it)
763
+            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
764
+                if (ModelNameUtils.IS_LianxTB223FC()){
765
+                    AfwUtils.getNetAppWhiteList()
766
+                }else{
767
+                    val appWhiteRules = csdkManager?.appWhiteRules
768
+                    appWhiteRules?.let {
769
+                        appList.addAll(it)
770
+                    }
739 771
                 }
740 772
             }
741 773
             return appList
@@ -748,7 +780,7 @@ class ManageApplication : MultiDexApplication() {
748 780
         fun setSleepTimeoutV3(time: Int = 1000 * 60 * 60) {
749 781
             if (ModelNameUtils.IS_LianxX505f()) {
750 782
                 csdkManager?.setSleepTimeout_V3(time)
751
-            } else if (ModelNameUtils.IS_LianxX6e6f()) {
783
+            } else if (ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
752 784
                 csdkManager?.setSleepTimeoutV3(time)
753 785
             }
754 786
         }
@@ -757,30 +789,24 @@ class ManageApplication : MultiDexApplication() {
757 789
          * 获得网址白名单
758 790
          */
759 791
         fun urlWhiteListRead(): List<String> {
760
-            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
761
-                csdkManager?.urlWhiteListRead()?.let {
762
-                    return it
792
+            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
793
+                if (ModelNameUtils.IS_LianxTB223FC()){
794
+                    AfwUtils.getNetAppWhiteList()
795
+                }else{
796
+                    csdkManager?.urlWhiteListRead()?.let {
797
+                        return it
798
+                    }
763 799
                 }
764 800
             }
765 801
             return arrayListOf()
766 802
         }
767 803
 
768
-        /**
769
-         * 允许悬浮窗packageName: 应用的包名
770
-         * true:打开在其它应用的上层
771
-         * false:关闭在其它应用的上层
772
-         */
773
-        fun enableOverlayWindow(pkg: String = Const.CURRENTAPPPKG, enableFlag: Boolean = true) {
774
-            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
775
-                csdkManager?.enableOverlayWindow(pkg, enableFlag)
776
-            }
777
-        }
778 804
 
779 805
         /**
780 806
          * 设置锁屏模式 0:取消解锁模式 1:滑动解锁
781 807
          */
782 808
         fun setLockScreenMode(enableFlag: Int = 0) {
783
-            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
809
+            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
784 810
                 csdkManager?.setLockScreenMode(enableFlag)
785 811
             }
786 812
         }
@@ -791,14 +817,14 @@ class ManageApplication : MultiDexApplication() {
791 817
         fun setEnabledEyeMode(enableFlag: Boolean) {
792 818
             if (ModelNameUtils.IS_LianxX505f()) {
793 819
                 csdkManager?.setEnabledEyeMode(enableFlag)
794
-            }else if (ModelNameUtils.IS_LianxX6e6f()){
820
+            }else if (ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()){
795 821
                 csdkManager?.setEnabledEyeMode(enableFlag)
796 822
             }
797 823
         }
798 824
 
799 825
         //设置默认输入法
800 826
         fun setDefaultInputMethod(pkg: String="com.xhkjedu.pinyin/.PinyinIME"){
801
-            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()){
827
+            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()){
802 828
                 try {
803 829
                     var defaultInputMethod = csdkManager?.setDefaultInputMethod(pkg)
804 830
                     //Log.d("设置输入法","设置结果"+defaultInputMethod)
@@ -816,7 +842,7 @@ class ManageApplication : MultiDexApplication() {
816 842
              try {
817 843
                  if (ModelNameUtils.IS_LianxX505f()){
818 844
                      csdkManager?.customRecovery_v3=b
819
-                 }else if (ModelNameUtils.IS_LianxX6e6f()){
845
+                 }else if (ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()){
820 846
                      csdkManager?.isCustomRecoveryV3=b
821 847
                  }
822 848
              }catch (e:Exception){
@@ -831,7 +857,7 @@ class ManageApplication : MultiDexApplication() {
831 857
             try {
832 858
                 if (ModelNameUtils.IS_LianxX505f()){
833 859
                     csdkManager?.disallowSetInputMethod_v3(pkgName,b)
834
-                }else if (ModelNameUtils.IS_LianxX6e6f()){
860
+                }else if (ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()){
835 861
                     csdkManager?.disallowSetInputMethodV3(pkgName,b)
836 862
                 }
837 863
             }catch (e:Exception){
@@ -844,6 +870,7 @@ class ManageApplication : MultiDexApplication() {
844 870
          * false:允许设备使用蓝牙分享
845 871
          */
846 872
         fun disableBluetoothShare(b:Boolean=true){
873
+            //TB223FC禁用蓝牙分享,会导致蓝牙无法打开,所以不限制
847 874
             try {
848 875
                 if (ModelNameUtils.IS_LianxX505f()){
849 876
                     csdkManager?.disallowBluetoothShare_v3(b)
@@ -863,7 +890,7 @@ class ManageApplication : MultiDexApplication() {
863 890
             try {
864 891
                 if (ModelNameUtils.IS_LianxX505f()){
865 892
                     csdkManager?.disableStatusBarNotification(b)
866
-                }else if (ModelNameUtils.IS_LianxX6e6f()){
893
+                }else if (ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()){
867 894
                     csdkManager?.disallowStatusBarNotification(b)
868 895
                 }
869 896
             }catch (e:Exception){
@@ -887,7 +914,7 @@ class ManageApplication : MultiDexApplication() {
887 914
             val exitControlFlag =false
888 915
             Toaster.init(this)
889 916
             DialogX.init(this)
890
-            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
917
+            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
891 918
                 csdkManager = CSDKManager(this)
892 919
                 //允许运行时权限
893 920
                 setDefaultInputMethod()

+ 1
- 1
app/src/main/java/com/xhly/manageapp/ui/main/activity/MainActivity.kt Bestand weergeven

@@ -403,7 +403,7 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(), Downloa
403 403
                         val rxPermissions = RxPermissions(this@MainActivity)
404 404
                         rxPermissions.request(Manifest.permission.REQUEST_INSTALL_PACKAGES)
405 405
                             .subscribe { granted ->
406
-                                if (granted || ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
406
+                                if (granted || ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
407 407
                                     // 权限已授予,执行安装操作
408 408
                                     val appList = AppUtils.GetAppList(this@MainActivity)
409 409
                                     getExternalFilesDir(null)?.let {

+ 121
- 18
app/src/main/java/com/xhly/manageapp/utils/AfwUtils.kt Bestand weergeven

@@ -53,20 +53,28 @@ object AfwUtils {
53 53
         intent.putExtras(bundle)
54 54
         context.bindService(intent, mServiceConnection, Context.BIND_AUTO_CREATE)
55 55
     }
56
-    //添加黑白名单
57
-    @Throws(java.lang.Exception::class)
58
-     fun jurisdiction(type: String, appUid: Int) {
59
-        if (type == "黑名单") {
60
-            if (iafwService != null) {
61
-                val afwRes = iafwService!!.addAppBlackRule(appUid.toString() + "")
62
-                Log.i(TAG, "addAppBlackRule result=" + afwRes.operationResult)
63
-            }
64
-        } else if (type == "白名单") {
65
-            if (iafwService != null) {
66
-                val afwRes = iafwService!!.addAppWhiteRule(appUid.toString() + "")
67
-                Log.i(TAG, "addAppWhiteRule result=" + afwRes.operationResult)
68
-            }
69
-        }
56
+
57
+    /**
58
+     * 添加黑白名单 0为黑名单,1为白名单
59
+     */
60
+     fun jurisdiction(type: Int=0, appUid: Int) {
61
+       try {
62
+           if (type == 0) {
63
+               //黑名单
64
+               if (iafwService != null) {
65
+                   val afwRes = iafwService!!.addAppBlackRule(appUid.toString() + "")
66
+                   Log.i(TAG, "addAppBlackRule result=" + afwRes.operationResult)
67
+               }
68
+           } else if (type == 1) {
69
+               //白名单
70
+               if (iafwService != null) {
71
+                   val afwRes = iafwService!!.addAppWhiteRule(appUid.toString() + "")
72
+                   Log.i(TAG, "addAppWhiteRule result=" + afwRes.operationResult)
73
+               }
74
+           }
75
+       }catch (e:Exception){
76
+
77
+       }
70 78
     }
71 79
     fun getNetAppBlockList():String{
72 80
         val sb=StringBuffer()
@@ -113,10 +121,51 @@ object AfwUtils {
113 121
         return sb.toString()
114 122
     }
115 123
 
116
-    fun addUrLWhiteList(url:String){
124
+    /**
125
+     * 添加网址白名单
126
+     */
127
+    fun addUrLWhiteList(urlList:List<String>){
128
+        try {
129
+            if (iafwService != null) {
130
+                urlList.forEach {url->
131
+                    val afwRes = iafwService!!.addWhiteRule(url)
132
+                    Log.i(TAG, "setEnable=" + afwRes.operationResult)
133
+                }
134
+            } else {
135
+                Log.i(TAG, "iafwService=null")
136
+            }
137
+        } catch (e: java.lang.Exception) {
138
+            e.printStackTrace()
139
+            Log.e(TAG, e.toString())
140
+        }
141
+    }
142
+
143
+    /**
144
+     * 添加网址黑名单
145
+     */
146
+    fun addUrLBlackList(urlList:List<String>){
147
+        try {
148
+            if (iafwService != null) {
149
+               urlList.forEach {url->
150
+                   val afwRes = iafwService!!.addBlackRule(url)
151
+                   Log.i(TAG, "setEnable=" + afwRes.operationResult)
152
+               }
153
+            } else {
154
+                Log.i(TAG, "iafwService=null")
155
+            }
156
+        } catch (e: java.lang.Exception) {
157
+            e.printStackTrace()
158
+            Log.e(TAG, e.toString())
159
+        }
160
+    }
161
+
162
+    /**
163
+     * 清除APP网络规则
164
+     */
165
+    fun clearAppRules(){
117 166
         try {
118 167
             if (iafwService != null) {
119
-                val afwRes = iafwService!!.addWhiteRule(url)
168
+                val afwRes = iafwService!!.clearAppRules()
120 169
                 Log.i(TAG, "setEnable=" + afwRes.operationResult)
121 170
             } else {
122 171
                 Log.i(TAG, "iafwService=null")
@@ -127,10 +176,47 @@ object AfwUtils {
127 176
         }
128 177
     }
129 178
 
130
-    fun addUrLBlackList(url:String){
179
+    /**
180
+     * 清除IP和网址规则
181
+     */
182
+    fun clearIpHostRules(){
131 183
         try {
132 184
             if (iafwService != null) {
133
-                val afwRes = iafwService!!.addBlackRule(url)
185
+                val afwRes = iafwService!!.clearIpHostRules()
186
+                Log.i(TAG, "clearIpHostRules=" + afwRes.operationResult)
187
+            } else {
188
+                Log.i(TAG, "iafwService=null")
189
+            }
190
+        } catch (e: java.lang.Exception) {
191
+            e.printStackTrace()
192
+            Log.e(TAG, e.toString())
193
+        }
194
+    }
195
+
196
+    /**
197
+     * 清除所有规则
198
+     */
199
+    fun clearRules(){
200
+        try {
201
+            if (iafwService != null) {
202
+                val afwRes = iafwService!!.clearRules()
203
+                Log.i(TAG, "clearRules=" + afwRes.operationResult)
204
+            } else {
205
+                Log.i(TAG, "iafwService=null")
206
+            }
207
+        } catch (e: java.lang.Exception) {
208
+            e.printStackTrace()
209
+            Log.e(TAG, e.toString())
210
+        }
211
+    }
212
+
213
+    /**
214
+     * 打开防火墙开关
215
+     */
216
+    fun setEnable(enable: Boolean) {
217
+        try {
218
+            if (iafwService != null) {
219
+                val afwRes = iafwService!!.setEnable(enable)
134 220
                 Log.i(TAG, "setEnable=" + afwRes.operationResult)
135 221
             } else {
136 222
                 Log.i(TAG, "iafwService=null")
@@ -141,6 +227,23 @@ object AfwUtils {
141 227
         }
142 228
     }
143 229
 
230
+    /**
231
+     * 固化规则,将规则固化到系统,下次启动应用生效
232
+     */
233
+    fun writeToFile(){
234
+        try {
235
+            if (iafwService != null) {
236
+                val afwRes = iafwService!!.writeToFile()
237
+                Log.i(TAG, "WriteToFile=" + afwRes.operationResult)
238
+            } else {
239
+                Log.i(TAG, "iafwService=null")
240
+            }
241
+        } catch (e: java.lang.Exception) {
242
+            e.printStackTrace()
243
+            Log.e(TAG, e.toString())
244
+        }
245
+    }
246
+
144 247
     fun getUUid(context: Context,pkgName:String): String {
145 248
         return try {
146 249
             val packageManager: PackageManager = context.packageManager

+ 2
- 2
app/src/main/java/com/xhly/manageapp/utils/StrategyUtils.kt Bestand weergeven

@@ -244,7 +244,7 @@ object StrategyUtils {
244 244
     public fun setSchoolSetDevice(schoolDeviceSetBean: SchoolDeviceSetBean, appList: List<AppInfo>):ArrayList<AppInfo> {
245 245
         val dataList = arrayListOf<AppInfo>()
246 246
         appList.forEach { appinfo ->
247
-            if (ModelNameUtils.IS_LianxX505f()||ModelNameUtils.IS_LianxX6e6f()){
247
+            if (ModelNameUtils.IS_LianxX505f()||ModelNameUtils.IS_LianxX6e6f()||ModelNameUtils.IS_LianxTB223FC()){
248 248
                 //启用电话短信:1是0否
249 249
                 if (schoolDeviceSetBean.simcard == 0 && (appinfo.packageName.equals(Const.ANDROIDPHONE) || appinfo.packageName.equals(Const.ANDROIDMMS))) {
250 250
                     return@forEach
@@ -470,7 +470,7 @@ object StrategyUtils {
470 470
 
471 471
     //初始化管控的默认规则 (x505f设置运行时权限默认打开,即使没有禁止安装应用也会导致应用无法安装)
472 472
     public fun initControlStrategy(loginSucess:Boolean=true){
473
-        if (ModelNameUtils.IS_LianxX505f()||ModelNameUtils.IS_LianxX6e6f()) {
473
+        if (ModelNameUtils.IS_LianxX505f()||ModelNameUtils.IS_LianxX6e6f()||ModelNameUtils.IS_LianxTB223FC()) {
474 474
             //是505f则执行
475 475
             //启用网络白名单,需要处理,不能每次都清除之前的白名单所以默认只添加不移除,请求接口时才移除。目前登录成功才控制
476 476
             if (loginSucess){

+ 1
- 1
corelib/src/main/java/com/xhly/corelib/utils/ModelNameUtils.kt Bestand weergeven

@@ -9,7 +9,7 @@ class ModelNameUtils {
9 9
 
10 10
         fun IS_LianxX6e6f(): Boolean{
11 11
             val systemModel: String = SystemUtil.getSystemModel()
12
-            return "Lenovo TB-X6E6F" == systemModel || IS_LianxTB223FC()
12
+            return "Lenovo TB-X6E6F" == systemModel
13 13
         }
14 14
         fun IS_LianxTB223FC(): Boolean{
15 15
             val systemModel: String = SystemUtil.getSystemModel()

Laden…
Annuleren
Opslaan