Browse Source

1.添加x505f新方法。

20241218TB223FC(测试jar包)
wangwanlei 8 months ago
parent
commit
508a87334b
1 changed files with 165 additions and 11 deletions
  1. 165
    11
      app/src/main/java/com/xhly/manageapp/ManageApplication.kt

+ 165
- 11
app/src/main/java/com/xhly/manageapp/ManageApplication.kt View File

@@ -3,11 +3,13 @@ package com.xhly.manageapp
3 3
 
4 4
 import android.Manifest
5 5
 import android.app.csdk.CSDKManager
6
+import android.content.ComponentName
6 7
 import android.content.pm.PackageManager
7 8
 import android.os.Build
8 9
 import androidx.core.content.ContextCompat
9 10
 import androidx.multidex.MultiDexApplication
10 11
 import com.hjq.toast.Toaster
12
+import com.xhly.corelib.utils.LogShow
11 13
 import com.xhly.corelib.utils.ModelNameUtils
12 14
 import com.xhly.manageapp.service.websocket.AppSocket
13 15
 import com.xhly.manageapp.utils.ZJAPPUtils
@@ -16,7 +18,7 @@ import java.io.File
16 18
 class ManageApplication : MultiDexApplication() {
17 19
     companion object {
18 20
         @JvmStatic
19
-        var instance: ManageApplication?=null
21
+        var instance: ManageApplication? = null
20 22
             private set
21 23
         private var csdkManager: CSDKManager? = null
22 24
 
@@ -102,9 +104,9 @@ class ManageApplication : MultiDexApplication() {
102 104
         fun setPackageEnabled(pkg: String, enableFlag: Boolean) {
103 105
             if (ModelNameUtils.IS_LianxX505f()) {
104 106
                 //TODO 暂不处理系统应用
105
-                if (!pkg.startsWith("com.android.")){
107
+               /* if (!pkg.startsWith("com.android.")) {
106 108
                     csdkManager?.setPackageEnabled(pkg, enableFlag)
107
-                }
109
+                }*/
108 110
             }
109 111
         }
110 112
 
@@ -232,7 +234,7 @@ class ManageApplication : MultiDexApplication() {
232 234
          */
233 235
         fun setCustomOTG(enableFlag: Boolean) {
234 236
             if (ModelNameUtils.IS_LianxX505f()) {
235
-                csdkManager?.customOTG= enableFlag
237
+                csdkManager?.customOTG = enableFlag
236 238
             }
237 239
         }
238 240
 
@@ -253,7 +255,11 @@ class ManageApplication : MultiDexApplication() {
253 255
                 return csdkManager?.getDeviceInfo(type)
254 256
             }
255 257
             try {
256
-                if (instance!=null&&ContextCompat.checkSelfPermission(instance!!.applicationContext,Manifest.permission.READ_PHONE_STATE)== PackageManager.PERMISSION_GRANTED){
258
+                if (instance != null && ContextCompat.checkSelfPermission(
259
+                        instance!!.applicationContext,
260
+                        Manifest.permission.READ_PHONE_STATE
261
+                    ) == PackageManager.PERMISSION_GRANTED
262
+                ) {
257 263
                     val serial = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
258 264
                         Build.getSerial()
259 265
                     } else {
@@ -264,10 +270,10 @@ class ManageApplication : MultiDexApplication() {
264 270
                     } else {
265 271
                         serial
266 272
                     }
267
-                }else{
273
+                } else {
268 274
                     return ""
269 275
                 }
270
-            }catch (e:Exception){
276
+            } catch (e: Exception) {
271 277
                 return ""
272 278
             }
273 279
         }
@@ -305,7 +311,7 @@ class ManageApplication : MultiDexApplication() {
305 311
          */
306 312
         fun enableWifiWhiteList(enable: Boolean) {
307 313
             if (ModelNameUtils.IS_LianxX505f()) {
308
-               //csdkManager?.whitelist
314
+                //csdkManager?.whitelist
309 315
             }
310 316
         }
311 317
 
@@ -323,7 +329,7 @@ class ManageApplication : MultiDexApplication() {
323 329
          */
324 330
         fun enableCaptureScreen(enable: Boolean) {
325 331
             if (ModelNameUtils.IS_LianxX505f()) {
326
-                //csdkManager?.enableCaptureScreen_v3(enable)
332
+                csdkManager?.enableCaptureScreen_v3(enable)
327 333
             }
328 334
         }
329 335
 
@@ -335,11 +341,152 @@ class ManageApplication : MultiDexApplication() {
335 341
                 //csdkManager?.disallowSetAutoRotation(enable)
336 342
             }
337 343
         }
344
+
345
+        /**
346
+         * 隐藏底部返回键
347
+         */
348
+        fun hideBackSoftKey(enableFlag: Boolean) {
349
+            if (ModelNameUtils.IS_LianxX505f()) {
350
+                csdkManager?.hideBackSoftKey(enableFlag)
351
+            }
352
+        }
353
+
354
+        /**
355
+         * 隐藏底部菜单键
356
+         */
357
+        fun hideMenuSoftKey(enableFlag: Boolean) {
358
+            if (ModelNameUtils.IS_LianxX505f()) {
359
+                csdkManager?.hideMenuSoftKey(enableFlag)
360
+            }
361
+        }
362
+
363
+
364
+        /**
365
+         * 隐藏底部home键
366
+         */
367
+        fun hideHomeSoftKey(enableFlag: Boolean) {
368
+            if (ModelNameUtils.IS_LianxX505f()) {
369
+                csdkManager?.hideHomeSoftKey(enableFlag)
370
+            }
371
+        }
372
+
373
+        /**
374
+         * 隐藏电源,音量键int:24, 25, 26(音量上,音量下,电源键) true:启用
375
+         */
376
+        fun requestKeyControl_V3(code: Int, enableFlag: Boolean) {
377
+            if (ModelNameUtils.IS_LianxX505f()) {
378
+                csdkManager?.requestKeyControl_V3(code, enableFlag)
379
+            }
380
+        }
381
+
382
+        /**
383
+         * 禁用 app 中某一个组件  newState:组件新的状态,可以设置三个值,
384
+         * 分别如下:
385
+         * 不可用状态:COMPONENT_ENABLED_STATE_DISABLED
386
+         * 可用状态:COMPONENT_ENABLED_STATE_ENABLED
387
+         * 默认状态:COMPONENT_ENABLED_STATE_DEFAULT
388
+         * flags:
389
+         * 行为标签,值可以是 DONT_KILL_APP 或者 0,0 表
390
+         * 示杀死包含该组件的 app
391
+         */
392
+
393
+        fun setComponentEnabled(componentName: ComponentName, newstate: Int, flag: Int) {
394
+            if (ModelNameUtils.IS_LianxX505f()) {
395
+                csdkManager?.setComponentEnabled(componentName, newstate, flag)
396
+            }
397
+        }
398
+
399
+        /**
400
+         * 设置启动器
401
+         */
402
+        fun setCustomLauncher(pkg: String, activityName: String) {
403
+            if (ModelNameUtils.IS_LianxX505f()) {
404
+                csdkManager?.setCustomLauncher(pkg, activityName)
405
+            }
406
+        }
407
+
408
+        /**
409
+         * 禁止用户操作飞行模式true:不可操作
410
+         * false:可以操作
411
+         */
412
+        fun disallowAirplaneMode_v3(enableFlag: Boolean) {
413
+            if (ModelNameUtils.IS_LianxX505f()) {
414
+                csdkManager?.disallowAirplaneMode_v3(enableFlag)
415
+            }
416
+        }
417
+
418
+
419
+        /**
420
+         * 隐藏状态栏true:隐藏状态栏
421
+         * false:显示状态栏
422
+         */
423
+        fun hideStatusBar(enableFlag: Boolean) {
424
+            if (ModelNameUtils.IS_LianxX505f()) {
425
+                csdkManager?.hideStatusBar(enableFlag)
426
+            }
427
+        }
428
+
429
+        /**
430
+         * 禁止状态栏下拉true:禁止状态栏下拉
431
+         * false:启用状态栏下拉
432
+         */
433
+        fun disableStatusBarPanel(enableFlag: Boolean){
434
+            if (ModelNameUtils.IS_LianxX505f()) {
435
+                csdkManager?.disableStatusBarPanel(enableFlag)
436
+            }
437
+        }
438
+
439
+        /**
440
+         * 打开/关闭 app 的安装未知源权限
441
+         * true:app 未知来源权限开启
442
+         * false:app 未知来源权限关闭
443
+         */
444
+        fun enableAllUnkownsourcesV3(enableFlag: Boolean){
445
+            if (ModelNameUtils.IS_LianxX505f()) {
446
+                csdkManager?.enableAllUnkownsources_v3(enableFlag)
447
+            }
448
+        }
449
+
450
+        /**
451
+         * 将 USB 调试打开或关闭true:打开 USB 调试
452
+         * false:关闭 USB 调试
453
+         */
454
+        fun enableUsbDebugging(enableFlag: Boolean){
455
+            if (ModelNameUtils.IS_LianxX505f()) {
456
+                csdkManager?.enableUsbDebugging(enableFlag)
457
+            }
458
+        }
459
+
460
+        /**
461
+         *设置系统时间
462
+         */
463
+        fun setSysTime(time:Long) {
464
+            if (ModelNameUtils.IS_LianxX505f()) {
465
+                csdkManager?.setSysTime(time)
466
+            }
467
+        }
468
+        /**
469
+         * 添加网络白名单
470
+         */
471
+        fun setUrlWhiteListWrite(list:ArrayList<String>){
472
+            if (ModelNameUtils.IS_LianxX505f()) {
473
+                csdkManager?.SetEnable(true)
474
+                csdkManager?.urlWhiteListWrite(list)
475
+            }
476
+        }
477
+        /**
478
+         * 启动网络白名单true启动,false关闭
479
+         */
480
+        fun  setUrlWhiteListEnable(enableFlag: Boolean){
481
+            if (ModelNameUtils.IS_LianxX505f()) {
482
+                csdkManager?.SetEnable(enableFlag)
483
+            }
484
+        }
338 485
     }
339 486
 
340 487
     override fun onCreate() {
341 488
         super.onCreate()
342
-        instance= this
489
+        instance = this
343 490
         Toaster.init(this)
344 491
         apppSocket = AppSocket()
345 492
         apppSocket?.startSocket(this)
@@ -352,9 +499,16 @@ class ManageApplication : MultiDexApplication() {
352 499
                     "com.xhkjedu.xh_control_appstore"
353 500
                 )
354 501
             )
355
-            // disableInstallation(false)
356 502
             setRuntimePermissions(true)
357 503
             enableAccessibility()
504
+            setUrlWhiteListWrite(arrayListOf("www.baidu.com"))
505
+            setUrlWhiteListEnable(false)
506
+            csdkManager?.urlWhiteListRead()?.forEach {
507
+                LogShow("白名单有"+it.toString())
508
+            }
509
+            csdkManager?.wifiWhiteList?.forEach {
510
+                LogShow("wifi白名单有"+it.toString())
511
+            }
358 512
         }
359 513
     }
360 514
 

Loading…
Cancel
Save