Browse Source

1.应用第一次启动直接添加默认地址,只有通过接口请求地址时才删除.

2.添加联想默认地址和app白名单.
20241218TB223FC(测试jar包)
wangwanlei 6 months ago
parent
commit
af91b0cab4

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

568
                 //先清除再添加
568
                 //先清除再添加
569
                 ClearIpHostRules()
569
                 ClearIpHostRules()
570
                 list.add(Const.BASEURL)
570
                 list.add(Const.BASEURL)
571
+                list.addAll(Const.whiteList)
572
+                csdkManager?.urlWhiteListWrite(list)
573
+                csdkManager?.urlBlackListWrite(arrayListOf("*"))
574
+            }
575
+        }
576
+
577
+
578
+        /**
579
+         * 添加默认网络白名单
580
+         */
581
+        fun setDefaultUrlWhiteListWrite(list: ArrayList<String>) {
582
+            if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
583
+                setUrlWhiteListEnable(true)
584
+                //不清除直接添加
585
+                list.add(Const.BASEURL)
586
+                list.addAll(Const.whiteList)
571
                 csdkManager?.urlWhiteListWrite(list)
587
                 csdkManager?.urlWhiteListWrite(list)
572
                 csdkManager?.urlBlackListWrite(arrayListOf("*"))
588
                 csdkManager?.urlBlackListWrite(arrayListOf("*"))
573
             }
589
             }
638
                 //不移除自己和商店
654
                 //不移除自己和商店
639
                 csdkManager?.AddAppWhiteRule(Const.CURRENTAPPPKG)
655
                 csdkManager?.AddAppWhiteRule(Const.CURRENTAPPPKG)
640
                 csdkManager?.AddAppWhiteRule(Const.STOREAPPPKG)
656
                 csdkManager?.AddAppWhiteRule(Const.STOREAPPPKG)
657
+                csdkManager?.AddAppWhiteRule("com.lenovo.mia.setupwizard")
641
             }
658
             }
642
         }
659
         }
643
 
660
 

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

426
     }
426
     }
427
 
427
 
428
     //初始化管控的默认规则
428
     //初始化管控的默认规则
429
-    public fun initControlStrategy(){
429
+    public fun initControlStrategy(isFirst:Boolean=false){
430
         if (ModelNameUtils.IS_LianxX505f()||ModelNameUtils.IS_LianxX6e6f()) {
430
         if (ModelNameUtils.IS_LianxX505f()||ModelNameUtils.IS_LianxX6e6f()) {
431
             //是505f则执行
431
             //是505f则执行
432
             //启用白名单
432
             //启用白名单
434
             ManageApplication.addInstallPackageWhiteList(
434
             ManageApplication.addInstallPackageWhiteList(
435
                 arrayListOf(
435
                 arrayListOf(
436
                     Const.CURRENTAPPPKG,
436
                     Const.CURRENTAPPPKG,
437
-                    Const.STOREAPPPKG
437
+                    Const.STOREAPPPKG,
438
+                    "com.lenovo.mia.setupwizard"
438
                 )
439
                 )
439
             )
440
             )
440
             ManageApplication.setSleepTimeoutV3()
441
             ManageApplication.setSleepTimeoutV3()
454
                 Const.CURRENTAPPPKG,
455
                 Const.CURRENTAPPPKG,
455
                 Const.CURRENTAPPPKG + ".ui.ManageActivity"
456
                 Const.CURRENTAPPPKG + ".ui.ManageActivity"
456
             )
457
             )
457
-            ManageApplication.setUrlWhiteListWrite(arrayListOf())
458
+            //需要处理,不能每次都清除之前的白名单所以默认只添加不移除,请求接口时才移除。
459
+            ManageApplication.setDefaultUrlWhiteListWrite(arrayListOf())
460
+
458
             ManageApplication.urlWhiteListRead().forEach {
461
             ManageApplication.urlWhiteListRead().forEach {
459
                 LogShow("白名单有$it")
462
                 LogShow("白名单有$it")
460
             }
463
             }

+ 1
- 0
corelib/src/main/java/com/xhly/corelib/Const.kt View File

18
     //接口地址
18
     //接口地址
19
     var  WSURL: String = "wss://$WSBASEURL/ws"
19
     var  WSURL: String = "wss://$WSBASEURL/ws"
20
 
20
 
21
+    val whiteList= arrayListOf("mdmconsole.smartedu.lenovo.com/apiserver","mdmconsole.smartedu.lenovo.com")
21
     public fun setBaseUrl(isDebug:Boolean=false){
22
     public fun setBaseUrl(isDebug:Boolean=false){
22
         //接口地址 正式地址mcapi.xhkjedu.com测试地址
23
         //接口地址 正式地址mcapi.xhkjedu.com测试地址
23
        BASEURL=if (isDebug){
24
        BASEURL=if (isDebug){

Loading…
Cancel
Save