Parcourir la source

1.添加防火墙调用方法。

2025_1_17_tb223fc
wangwanlei il y a 1 mois
Parent
révision
6ed86942f6

+ 16
- 4
app/src/main/java/com/xhly/manageapp/ManageApplication.kt Voir le fichier

@@ -178,6 +178,10 @@ class ManageApplication : MultiDexApplication() {
178 178
          * false:关闭蓝牙
179 179
          */
180 180
         fun enableBluetooth(enableFlag: Boolean) {
181
+            if (enableFlag&&ModelNameUtils.IS_LianxTB223FC()) {
182
+                //223FC需要处理蓝牙分享才能打开开关
183
+                disableBluetoothShare(!enableFlag)
184
+            }
181 185
             if (ModelNameUtils.IS_LianxX505f()) {
182 186
                 csdkManager?.enableBluetooth_v3(enableFlag)
183 187
             } else if (ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
@@ -287,7 +291,7 @@ class ManageApplication : MultiDexApplication() {
287 291
          */
288 292
         fun setCustomOTG(enableFlag: Boolean) {
289 293
             if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
290
-                csdkManager?.customOTG = enableFlag
294
+                //csdkManager?.customOTG = enableFlag
291 295
             }
292 296
         }
293 297
 
@@ -647,8 +651,13 @@ class ManageApplication : MultiDexApplication() {
647 651
                 list.addAll(urlWhiteListRead)
648 652
                 list.add(Const.BASEURL)
649 653
                 list.addAll(Const.whiteList)
650
-                csdkManager?.urlWhiteListWrite(list)
651
-                csdkManager?.urlBlackListWrite(arrayListOf("*"))
654
+                if (ModelNameUtils.IS_LianxTB223FC()){
655
+                    AfwUtils.addUrLWhiteList(list)
656
+                    AfwUtils.addUrLBlackList(arrayListOf("*"))
657
+                }else{
658
+                    csdkManager?.urlWhiteListWrite(list)
659
+                    csdkManager?.urlBlackListWrite(arrayListOf("*"))
660
+                }
652 661
             }
653 662
         }
654 663
 
@@ -876,7 +885,7 @@ class ManageApplication : MultiDexApplication() {
876 885
             try {
877 886
                 if (ModelNameUtils.IS_LianxX505f()){
878 887
                     csdkManager?.disallowBluetoothShare_v3(b)
879
-                }else if (ModelNameUtils.IS_LianxX6e6f()){
888
+                }else if (ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()){
880 889
                     csdkManager?.disallowBluetoothV3(b)
881 890
                 }
882 891
             }catch (e:Exception){
@@ -916,6 +925,9 @@ class ManageApplication : MultiDexApplication() {
916 925
             val exitControlFlag =false
917 926
             Toaster.init(this)
918 927
             DialogX.init(this)
928
+            if (ModelNameUtils.IS_LianxTB223FC()){
929
+                AfwUtils.startBindService(this)
930
+            }
919 931
             if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()) {
920 932
                 csdkManager = CSDKManager(this)
921 933
                 //允许运行时权限

+ 43
- 4
app/src/main/java/com/xhly/manageapp/ui/main/activity/MainActivity.kt Voir le fichier

@@ -113,6 +113,7 @@ import java.util.Calendar
113 113
 import java.util.Timer
114 114
 import java.util.TimerTask
115 115
 import java.util.concurrent.TimeUnit
116
+import kotlin.system.exitProcess
116 117
 
117 118
 
118 119
 class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(), DownloadCallback {
@@ -546,7 +547,7 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(), Downloa
546 547
                 it?.let {
547 548
                     spUtils.saveJson(Const.SCHOOLSETDEVICE, it)
548 549
                     initSchoolSet(it)
549
-                    mBinding.rv.visibility = View.VISIBLE
550
+                    //mBinding.rv.visibility = View.VISIBLE
550 551
                     updateAppRv()
551 552
                     if (it.fromNetWorkType == 1) {
552 553
                         if (quitFlag) {
@@ -635,9 +636,11 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(), Downloa
635 636
             viewModel.autoAppData.collect {
636 637
                 lifecycleScope.launch {
637 638
                     withContext(Dispatchers.IO){
638
-                        delay(15000)
639
+                        delay(3000)
639 640
                     }
640
-                    mBinding.flayoutRoot.visibility = View.GONE
641
+                    /*mBinding.flayoutRoot.visibility = View.GONE*/
642
+                    mBinding.userinfoLlayout.visibility=View.VISIBLE
643
+                    mBinding.rv.visibility = View.VISIBLE
641 644
                 }
642 645
                 it?.let {
643 646
                     if (!netAutoAppFlag || isDestroyFlag) {
@@ -931,6 +934,42 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(), Downloa
931 934
                     StrategyUtils.clearMemory(context, data)
932 935
                     Toaster.show(context.getString(R.string.speedend))
933 936
                 }
937
+/*
938
+                if (ModelNameUtils.IS_LianxX505f()|| ModelNameUtils.IS_LianxX6e6f()|| ModelNameUtils.IS_LianxTB223FC()){
939
+                    ManageApplication.setPackageEnabled("com.tblenovo.launcher",true)
940
+                    //505f的桌面名称
941
+                    if (ModelNameUtils.IS_LianxTB223FC()){
942
+                        ManageApplication.setCustomLauncher("com.tblenovo.launcher","com.android.searchlauncher.SearchLauncher")
943
+                    }else{
944
+                        ManageApplication.setCustomLauncher("com.tblenovo.launcher","com.android.iotlauncher.IotLauncher")
945
+                    }
946
+                    try {
947
+                        //解除管控后,禁止切换启动器
948
+                        ManageApplication.disallowSwitchLauncher_v3(true)
949
+                        val launchIntent = Intent()
950
+                        if (ModelNameUtils.IS_LianxTB223FC()){
951
+                            launchIntent.setComponent(
952
+                                ComponentName(
953
+                                    "com.tblenovo.launcher",
954
+                                    "com.android.searchlauncher.SearchLauncher"
955
+                                )
956
+                            )
957
+                        }else{
958
+                            launchIntent.setComponent(
959
+                                ComponentName(
960
+                                    "com.tblenovo.launcher",
961
+                                    "com.android.iotlauncher.IotLauncher"
962
+                                )
963
+                            )
964
+                        }
965
+                        launchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
966
+                        startActivity(launchIntent)
967
+                    }catch (e:Exception){
968
+                        Toaster.showLong("失败原因"+e.toString())
969
+                    }
970
+                }
971
+*/
972
+
934 973
             }
935 974
 
936 975
             override fun clearAppData(context: Context) {
@@ -2096,7 +2135,7 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(), Downloa
2096 2135
                     AppCompatResources.getDrawable(this, R.drawable.icon_updatestrategy)!!
2097 2136
                 )
2098 2137
             )
2099
-            mBinding.rv.visibility = View.VISIBLE
2138
+            //mBinding.rv.visibility = View.VISIBLE
2100 2139
             if (adapter == null) {
2101 2140
                 adapter = AppAdapter(this, dataList)
2102 2141
                 adapter?.changePwdListener = getChangeCodeListener()

+ 4
- 3
app/src/main/java/com/xhly/manageapp/utils/AfwUtils.kt Voir le fichier

@@ -166,7 +166,7 @@ object AfwUtils {
166 166
             if (iafwService != null) {
167 167
                 urlList.forEach {url->
168 168
                     val afwRes = iafwService!!.addWhiteRule(url)
169
-                    Log.i(TAG, "setEnable=" + afwRes.operationResult)
169
+                    Log.i(TAG, "urlsetEnable=" + afwRes.operationResult+"|||"+url)
170 170
                 }
171 171
             } else {
172 172
                 Log.i(TAG, "iafwService=null")
@@ -203,7 +203,7 @@ object AfwUtils {
203 203
         try {
204 204
             if (iafwService != null) {
205 205
                 val afwRes = iafwService!!.clearAppRules()
206
-                Log.i(TAG, "setEnable=" + afwRes.operationResult)
206
+                Log.i(TAG, "清除APP规则setEnable=" + afwRes.operationResult)
207 207
             } else {
208 208
                 Log.i(TAG, "iafwService=null")
209 209
             }
@@ -254,7 +254,8 @@ object AfwUtils {
254 254
         try {
255 255
             if (iafwService != null) {
256 256
                 val afwRes = iafwService!!.setEnable(enable)
257
-                Log.i(TAG, "setEnable=" + afwRes.operationResult)
257
+                addUrLBlackList(arrayListOf("*"))
258
+                Log.i(TAG, "开启网络setEnable=" + afwRes.operationResult)
258 259
             } else {
259 260
                 Log.i(TAG, "iafwService=null")
260 261
             }

+ 1
- 3
app/src/main/java/com/xhly/manageapp/utils/StrategyUtils.kt Voir le fichier

@@ -496,9 +496,7 @@ object StrategyUtils {
496 496
             ManageApplication.hideMenuSoftKey(true)
497 497
             ManageApplication.setLockScreenMode()
498 498
             //禁用蓝牙分享
499
-            if (!ModelNameUtils.IS_LianxTB223FC()){
500
-                ManageApplication.disableBluetoothShare()
501
-            }
499
+            ManageApplication.disableBluetoothShare()
502 500
             //禁用Recovery模式
503 501
             ManageApplication.setCustomRecovery_v3()
504 502
             //冻结默认启动器

+ 3
- 0
app/src/main/res/layout/activity_main.xml Voir le fichier

@@ -26,6 +26,8 @@
26 26
 
27 27
 
28 28
             <LinearLayout
29
+                android:id="@+id/userinfo_llayout"
30
+                android:visibility="invisible"
29 31
                 android:layout_width="match_parent"
30 32
                 android:layout_height="wrap_content"
31 33
                 android:layout_marginLeft="21dp"
@@ -180,6 +182,7 @@
180 182
                 android:textSize="8sp" />
181 183
         </LinearLayout>
182 184
         <LinearLayout
185
+            android:visibility="gone"
183 186
             android:id="@+id/flayout_root"
184 187
             android:layout_width="match_parent"
185 188
             android:layout_height="match_parent"

Chargement…
Annuler
Enregistrer