Browse Source

1.组件禁用方法添加trycatch。

20241218TB223FC(测试jar包)
wangwanlei 4 months ago
parent
commit
47caf9e7a2
2 changed files with 10 additions and 6 deletions
  1. 2
    2
      app/build.gradle.kts
  2. 8
    4
      app/src/main/java/com/xhly/manageapp/ManageApplication.kt

+ 2
- 2
app/build.gradle.kts View File

@@ -17,8 +17,8 @@ android {
17 17
         applicationId = "com.xhkjedu.manageapp"
18 18
         minSdk = 24
19 19
         targetSdk = 30
20
-        versionCode = 19
21
-        versionName = "1.0.18"
20
+        versionCode = 20
21
+        versionName = "1.0.19"
22 22
 
23 23
         testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
24 24
         vectorDrawables {

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

@@ -497,20 +497,24 @@ class ManageApplication : MultiDexApplication() {
497 497
             }
498 498
         }
499 499
 
500
-        /**
500
+        /**解除管控后需要取消禁用
501 501
          * 禁用 app 中某一个组件  newState:组件新的状态,可以设置三个值,
502 502
          * 分别如下:
503 503
          * 不可用状态:COMPONENT_ENABLED_STATE_DISABLED
504 504
          * 可用状态:COMPONENT_ENABLED_STATE_ENABLED
505 505
          * 默认状态:COMPONENT_ENABLED_STATE_DEFAULT
506 506
          * flags:
507
-         * 行为标签,值可以是 DONT_KILL_APP 或者 0,0 表
508
-         * 示杀死包含该组件的 app
507
+         * 行为标签,值可以是 DONT_KILL_APP 或者 0
508
+         * 0表示杀死包含该组件的 app
509 509
          */
510 510
 
511 511
         fun setComponentEnabled(componentName: ComponentName, newstate: Int, flag: Int) {
512 512
             if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
513
-                csdkManager?.setComponentEnabled(componentName, newstate, flag)
513
+               try {
514
+                   csdkManager?.setComponentEnabled(componentName, newstate, flag)
515
+               }catch (e:Exception){
516
+                   Log.d("setComponentEnabled", "问题是$e")
517
+               }
514 518
             }
515 519
         }
516 520
 

Loading…
Cancel
Save