瀏覽代碼

1.删除平板端的解除管控

2.添加解除管控的存储常量
20241218TB223FC(测试jar包)
wangwanlei 1 年之前
父節點
當前提交
2872456135

+ 0
- 11
app/src/main/java/com/xhly/manageapp/ui/ManageActivity.kt 查看文件

51
     override fun initData() {
51
     override fun initData() {
52
         //同意运行时权限
52
         //同意运行时权限
53
         ManageApplication.setRuntimePermissions(true)
53
         ManageApplication.setRuntimePermissions(true)
54
-        viewModel.controlResultData.observe(this){
55
-            if(it){
56
-                currentSpUtils.saveJson(Const.EXIT_CONTROL,type)
57
-                StrategyUtils.releaseControl()
58
-            }else{
59
-                Toast(getString(R.string.codeerror))
60
-            }
61
-        }
62
     }
54
     }
63
 
55
 
64
 
56
 
65
     override fun initView() {
57
     override fun initView() {
66
-        mBinding.closemanageBtn.setOnClickListener {
67
-            showEditDialog()
68
-        }
69
         mBinding.adbopenBtn.setOnClickListener {
58
         mBinding.adbopenBtn.setOnClickListener {
70
             Toast("设置" + ManageApplication.enableUsbDebugging(true))
59
             Toast("设置" + ManageApplication.enableUsbDebugging(true))
71
         }
60
         }

+ 2
- 1
app/src/main/java/com/xhly/manageapp/ui/login/activity/LoginActivity.kt 查看文件

258
 
258
 
259
             Const.CODE2007.toString() -> {
259
             Const.CODE2007.toString() -> {
260
                 postLogPush(7)
260
                 postLogPush(7)
261
-                StrategyUtils.releaseControl()
261
+                currentSpUtils.setParam(Const.EXIT_CONTROL,true)
262
+                StrategyUtils.releaseControl(this)
262
             }
263
             }
263
 
264
 
264
             Const.SDINSTALL -> {
265
             Const.SDINSTALL -> {

+ 2
- 1
app/src/main/java/com/xhly/manageapp/ui/main/activity/MainActivity.kt 查看文件

618
 
618
 
619
             Const.CODE2007.toString() -> {
619
             Const.CODE2007.toString() -> {
620
                 postLogPush(7)
620
                 postLogPush(7)
621
-                StrategyUtils.releaseControl()
621
+                currentSpUtils.setParam(Const.EXIT_CONTROL,true)
622
+                StrategyUtils.releaseControl(this)
622
             }
623
             }
623
 
624
 
624
             Const.LOGAPPSTART -> {
625
             Const.LOGAPPSTART -> {

+ 17
- 14
app/src/main/java/com/xhly/manageapp/utils/StrategyUtils.kt 查看文件

338
     /**
338
     /**
339
      * 解除管控
339
      * 解除管控
340
      */
340
      */
341
-    public fun releaseControl(){
341
+    public fun releaseControl(context: Context){
342
           try {
342
           try {
343
               //允许截屏
343
               //允许截屏
344
               ManageApplication.enableCaptureScreen(true)
344
               ManageApplication.enableCaptureScreen(true)
363
               //关闭网络白名单
363
               //关闭网络白名单
364
               ManageApplication.setUrlWhiteListEnable(false)
364
               ManageApplication.setUrlWhiteListEnable(false)
365
               //设置默认启动器
365
               //设置默认启动器
366
-              ManageApplication.setCustomLauncher("com.tblenovo.launcher","com.android.iotlauncher.IotLauncher")
367
-              try {
368
-                  val launchIntent = Intent()
369
-                  launchIntent.setComponent(
370
-                      ComponentName(
371
-                          "com.tblenovo.launcher",
372
-                          "com.android.iotlauncher.IotLauncher"
366
+              if (ModelNameUtils.IS_LianxX505f()){
367
+                  //505f的桌面名称
368
+                  ManageApplication.setCustomLauncher("com.tblenovo.launcher","com.android.iotlauncher.IotLauncher")
369
+                  try {
370
+                      val launchIntent = Intent()
371
+                      launchIntent.setComponent(
372
+                          ComponentName(
373
+                              "com.tblenovo.launcher",
374
+                              "com.android.iotlauncher.IotLauncher"
375
+                          )
373
                       )
376
                       )
374
-                  )
375
-                  launchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
376
-                  ManageApplication.instance?.startActivity(launchIntent)
377
-                  exitProcess(0)
378
-              }catch (e:Exception){
379
-                  Toaster.showLong("失败原因"+e.toString())
377
+                      launchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
378
+                      context.startActivity(launchIntent)
379
+                      exitProcess(0)
380
+                  }catch (e:Exception){
381
+                      Toaster.showLong("失败原因"+e.toString())
382
+                  }
380
               }
383
               }
381
           }catch (e:Exception){
384
           }catch (e:Exception){
382
 
385
 

Loading…
取消
儲存