Browse Source

1.应用第一次启动添加白名单时需要获取之前的白名单。

20241218TB223FC(测试jar包)
wangwanlei 6 months ago
parent
commit
f013439d81

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

581
         fun setDefaultUrlWhiteListWrite(list: ArrayList<String>) {
581
         fun setDefaultUrlWhiteListWrite(list: ArrayList<String>) {
582
             if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
582
             if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
583
                 setUrlWhiteListEnable(true)
583
                 setUrlWhiteListEnable(true)
584
-                //不清除直接添加
584
+                val urlWhiteListRead = urlWhiteListRead()
585
+                LogShow("之前的白名单有"+urlWhiteListRead.size)
586
+                //添加之前的白名单
587
+                list.addAll(urlWhiteListRead)
585
                 list.add(Const.BASEURL)
588
                 list.add(Const.BASEURL)
586
                 list.addAll(Const.whiteList)
589
                 list.addAll(Const.whiteList)
587
                 csdkManager?.urlWhiteListWrite(list)
590
                 csdkManager?.urlWhiteListWrite(list)

+ 8
- 6
app/src/main/java/com/xhly/manageapp/utils/StrategyUtils.kt View File

316
      */
316
      */
317
     public fun setNetWhiteList(data:ArrayList<String>){
317
     public fun setNetWhiteList(data:ArrayList<String>){
318
         ManageApplication.setUrlWhiteListWrite(data)
318
         ManageApplication.setUrlWhiteListWrite(data)
319
+        ManageApplication.urlWhiteListRead().forEach {
320
+            LogShow("新设置白名单有$it")
321
+        }
319
     }
322
     }
320
     /**
323
     /**
321
      * 清理其他app进程
324
      * 清理其他app进程
426
     }
429
     }
427
 
430
 
428
     //初始化管控的默认规则
431
     //初始化管控的默认规则
429
-    public fun initControlStrategy(isFirst:Boolean=false){
432
+    public fun initControlStrategy(loginSucess:Boolean=false){
430
         if (ModelNameUtils.IS_LianxX505f()||ModelNameUtils.IS_LianxX6e6f()) {
433
         if (ModelNameUtils.IS_LianxX505f()||ModelNameUtils.IS_LianxX6e6f()) {
431
             //是505f则执行
434
             //是505f则执行
432
-            //启用白名单
433
-            ManageApplication.setUrlWhiteListEnable(true)
435
+            //启用网络白名单,需要处理,不能每次都清除之前的白名单所以默认只添加不移除,请求接口时才移除。
436
+            ManageApplication.setDefaultUrlWhiteListWrite(arrayListOf())
437
+            //启用安装白名单
434
             ManageApplication.addInstallPackageWhiteList(
438
             ManageApplication.addInstallPackageWhiteList(
435
                 arrayListOf(
439
                 arrayListOf(
436
                     Const.CURRENTAPPPKG,
440
                     Const.CURRENTAPPPKG,
440
             )
444
             )
441
             ManageApplication.setSleepTimeoutV3()
445
             ManageApplication.setSleepTimeoutV3()
442
             //给自己加入网络白名单
446
             //给自己加入网络白名单
443
-            ManageApplication.addAppWhiteRule(arrayListOf(Const.CURRENTAPPPKG))
447
+            ManageApplication.addAppWhiteRule(arrayListOf(Const.CURRENTAPPPKG, "com.lenovo.mia.setupwizard"))
444
             //默认打开wifi禁止用户关闭
448
             //默认打开wifi禁止用户关闭
445
            // ManageApplication.disallowWifi(true)
449
            // ManageApplication.disallowWifi(true)
446
             ManageApplication.enableWifi(true)
450
             ManageApplication.enableWifi(true)
455
                 Const.CURRENTAPPPKG,
459
                 Const.CURRENTAPPPKG,
456
                 Const.CURRENTAPPPKG + ".ui.ManageActivity"
460
                 Const.CURRENTAPPPKG + ".ui.ManageActivity"
457
             )
461
             )
458
-            //需要处理,不能每次都清除之前的白名单所以默认只添加不移除,请求接口时才移除。
459
-            ManageApplication.setDefaultUrlWhiteListWrite(arrayListOf())
460
 
462
 
461
             ManageApplication.urlWhiteListRead().forEach {
463
             ManageApplication.urlWhiteListRead().forEach {
462
                 LogShow("白名单有$it")
464
                 LogShow("白名单有$it")

Loading…
Cancel
Save