Browse Source

1.将应用app网络白名单放到登录之后再执行。

2.修改设置自动旋转的方法提示。
20241218TB223FC(测试jar包)
wangwanlei 5 months ago
parent
commit
bef605475a

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

59
                 }
59
                 }
60
             }else if (appInfo.packageName.equals(Const.CUSTOMROTATIONAPP)){
60
             }else if (appInfo.packageName.equals(Const.CUSTOMROTATIONAPP)){
61
                 val rotationAllowed = SystemUtil.isRotationAllowed(context)
61
                 val rotationAllowed = SystemUtil.isRotationAllowed(context)
62
-                ManageApplication.disallowSetAutoRotation(!rotationAllowed)
63
-                val tips=if (!rotationAllowed){
64
-                    context.getString(R.string.openrotation)
65
-                }else{
62
+                ManageApplication.disallowSetAutoRotation(rotationAllowed)
63
+                val tips=if (SystemUtil.isRotationAllowed(context)){
66
                     context.getString(R.string.closerotation)
64
                     context.getString(R.string.closerotation)
65
+                }else{
66
+                    context.getString(R.string.openrotation)
67
                 }
67
                 }
68
                 Toaster.showLong(tips)
68
                 Toaster.showLong(tips)
69
             }else if (appInfo.packageName.equals(Const.CUSTOMCHANGEPSD)){
69
             }else if (appInfo.packageName.equals(Const.CUSTOMCHANGEPSD)){

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

7
 import android.content.Context
7
 import android.content.Context
8
 import android.content.pm.PackageManager
8
 import android.content.pm.PackageManager
9
 import android.os.Build
9
 import android.os.Build
10
+import android.util.Log
10
 import androidx.core.content.ContextCompat
11
 import androidx.core.content.ContextCompat
11
 import androidx.multidex.BuildConfig
12
 import androidx.multidex.BuildConfig
12
 import androidx.multidex.MultiDex
13
 import androidx.multidex.MultiDex
435
          */
436
          */
436
         fun disallowSetAutoRotation(enable: Boolean) {
437
         fun disallowSetAutoRotation(enable: Boolean) {
437
             if (ModelNameUtils.IS_LianxX505f()) {
438
             if (ModelNameUtils.IS_LianxX505f()) {
438
-                //true:允许自动旋转屏幕
439
+                //true关闭 flase开启 6e6f可能不一样
439
                 csdkManager?.setAutoRotate(enable)
440
                 csdkManager?.setAutoRotate(enable)
440
             } else if (ModelNameUtils.IS_LianxX6e6f()) {
441
             } else if (ModelNameUtils.IS_LianxX6e6f()) {
441
                 //csdkManager?.disallowSetAutoRotation(enable)
442
                 //csdkManager?.disallowSetAutoRotation(enable)
666
         /**
667
         /**
667
          * 添加网络应用白名单
668
          * 添加网络应用白名单
668
          */
669
          */
669
-        fun addAppWhiteRule(pkgList: ArrayList<String>) {
670
-            clearAppWhiteRule()
670
+        fun addAppWhiteRule(pkgList: ArrayList<String>,removeFlag:Boolean=true) {
671
+            if (removeFlag){
672
+                clearAppWhiteRule()
673
+            }
671
             if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
674
             if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
672
                 pkgList.forEach {
675
                 pkgList.forEach {
673
                     csdkManager?.AddAppWhiteRule(it)
676
                     csdkManager?.AddAppWhiteRule(it)

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

435
             //启用网络白名单,需要处理,不能每次都清除之前的白名单所以默认只添加不移除,请求接口时才移除。目前登录成功才控制
435
             //启用网络白名单,需要处理,不能每次都清除之前的白名单所以默认只添加不移除,请求接口时才移除。目前登录成功才控制
436
             if (loginSucess){
436
             if (loginSucess){
437
                 ManageApplication.setDefaultUrlWhiteListWrite(arrayListOf())
437
                 ManageApplication.setDefaultUrlWhiteListWrite(arrayListOf())
438
+                //给自己以及联想sn验证加入网络白名单
439
+                ManageApplication.addAppWhiteRule(arrayListOf(Const.CURRENTAPPPKG, "com.lenovo.mia.setupwizard"),false)
438
             }
440
             }
439
-            val urlWhiteListRead = ManageApplication.urlWhiteListRead()
440
-            LogShow("之前的白名单有"+urlWhiteListRead.size)
441
             //启用安装白名单
441
             //启用安装白名单
442
             ManageApplication.addInstallPackageWhiteList(arrayListOf(Const.CURRENTAPPPKG, Const.STOREAPPPKG))
442
             ManageApplication.addInstallPackageWhiteList(arrayListOf(Const.CURRENTAPPPKG, Const.STOREAPPPKG))
443
             ManageApplication.setSleepTimeoutV3()
443
             ManageApplication.setSleepTimeoutV3()
444
-            //给自己以及联想sn验证加入网络白名单
445
-            ManageApplication.addAppWhiteRule(arrayListOf(Const.CURRENTAPPPKG, "com.lenovo.mia.setupwizard"))
446
             //默认打开wifi禁止用户关闭
444
             //默认打开wifi禁止用户关闭
447
            // ManageApplication.disallowWifi(true)
445
            // ManageApplication.disallowWifi(true)
448
             ManageApplication.enableWifi(true)
446
             ManageApplication.enableWifi(true)

Loading…
Cancel
Save