Browse Source

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

2.添加解除管控的存储常量
20241218TB223FC(测试jar包)
wangwanlei 1 year ago
parent
commit
2872456135

+ 0
- 11
app/src/main/java/com/xhly/manageapp/ui/ManageActivity.kt View File

@@ -51,21 +51,10 @@ class ManageActivity : BaseActivity<BaseViewModel, ActivityManageBinding>() {
51 51
     override fun initData() {
52 52
         //同意运行时权限
53 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 57
     override fun initView() {
66
-        mBinding.closemanageBtn.setOnClickListener {
67
-            showEditDialog()
68
-        }
69 58
         mBinding.adbopenBtn.setOnClickListener {
70 59
             Toast("设置" + ManageApplication.enableUsbDebugging(true))
71 60
         }

+ 2
- 1
app/src/main/java/com/xhly/manageapp/ui/login/activity/LoginActivity.kt View File

@@ -258,7 +258,8 @@ class LoginActivity : BaseActivity<LoginViewModel, ActivityLoginBinding>() {
258 258
 
259 259
             Const.CODE2007.toString() -> {
260 260
                 postLogPush(7)
261
-                StrategyUtils.releaseControl()
261
+                currentSpUtils.setParam(Const.EXIT_CONTROL,true)
262
+                StrategyUtils.releaseControl(this)
262 263
             }
263 264
 
264 265
             Const.SDINSTALL -> {

+ 2
- 1
app/src/main/java/com/xhly/manageapp/ui/main/activity/MainActivity.kt View File

@@ -618,7 +618,8 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>() {
618 618
 
619 619
             Const.CODE2007.toString() -> {
620 620
                 postLogPush(7)
621
-                StrategyUtils.releaseControl()
621
+                currentSpUtils.setParam(Const.EXIT_CONTROL,true)
622
+                StrategyUtils.releaseControl(this)
622 623
             }
623 624
 
624 625
             Const.LOGAPPSTART -> {

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

@@ -338,7 +338,7 @@ object StrategyUtils {
338 338
     /**
339 339
      * 解除管控
340 340
      */
341
-    public fun releaseControl(){
341
+    public fun releaseControl(context: Context){
342 342
           try {
343 343
               //允许截屏
344 344
               ManageApplication.enableCaptureScreen(true)
@@ -363,20 +363,23 @@ object StrategyUtils {
363 363
               //关闭网络白名单
364 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 384
           }catch (e:Exception){
382 385
 

Loading…
Cancel
Save