Browse Source

1.退出管控时删除本地信息

2.修改下载后的安装调用
3.不再添加默认的应用商店由接口控制。
20241218TB223FC(测试jar包)
wangwanlei 10 months ago
parent
commit
ba74c619bd

+ 3
- 0
app/src/main/java/com/xhly/manageapp/AppAdapter.kt View File

3
 import android.content.ComponentName
3
 import android.content.ComponentName
4
 import android.content.Context
4
 import android.content.Context
5
 import android.content.Intent
5
 import android.content.Intent
6
+import android.provider.Settings
6
 import android.view.LayoutInflater
7
 import android.view.LayoutInflater
7
 import android.view.ViewGroup
8
 import android.view.ViewGroup
8
 import androidx.recyclerview.widget.RecyclerView
9
 import androidx.recyclerview.widget.RecyclerView
59
                 }
60
                 }
60
             }else if (appInfo.packageName.equals(Const.UPDATESTRATEGYPKGNAME)){
61
             }else if (appInfo.packageName.equals(Const.UPDATESTRATEGYPKGNAME)){
61
                 UIEvent(Const.CODE2004.toString()).post()
62
                 UIEvent(Const.CODE2004.toString()).post()
63
+            }else if (appInfo.packageName.equals(Const.WIFISEETTINGPKG)){
64
+                context.startActivity(Intent(Settings.ACTION_WIFI_SETTINGS))
62
             }else if (appInfo.packageName.equals(Const.STOREAPPPKG)){
65
             }else if (appInfo.packageName.equals(Const.STOREAPPPKG)){
63
                 //跳转应用商店
66
                 //跳转应用商店
64
                 try {
67
                 try {

+ 15
- 3
app/src/main/java/com/xhly/manageapp/ManageApplication.kt View File

577
                 csdkManager?.AddAppWhiteRule(Const.STOREAPPPKG)
577
                 csdkManager?.AddAppWhiteRule(Const.STOREAPPPKG)
578
             }
578
             }
579
         }
579
         }
580
+
581
+        /**
582
+         * 设置系统熄屏时间  设 置 的 系 统 熄 屏 时 间 的 值 ( 范 围 [10,
583
+         * 2147483647],单位毫秒)
584
+         */
585
+        fun setSleepTimeoutV3(time: Int=1000*60*60){
586
+            if (ModelNameUtils.IS_LianxX505f()){
587
+                csdkManager?.setSleepTimeout_V3(time)
588
+            }
589
+        }
580
     }
590
     }
581
 
591
 
582
     override fun onCreate() {
592
     override fun onCreate() {
604
         }catch (e:Exception){
614
         }catch (e:Exception){
605
 
615
 
606
         }
616
         }
617
+        //允许运行时权限
618
+        setRuntimePermissions(true)
607
         if (!exitControlFlag){
619
         if (!exitControlFlag){
608
             if (ModelNameUtils.IS_LianxX505f()) {
620
             if (ModelNameUtils.IS_LianxX505f()) {
609
                 //是505f则执行
621
                 //是505f则执行
616
                         Const.STOREAPPPKG
628
                         Const.STOREAPPPKG
617
                     )
629
                     )
618
                 )
630
                 )
631
+                setSleepTimeoutV3()
619
                 //给自己加入网络白名单
632
                 //给自己加入网络白名单
620
                 addAppWhiteRule(arrayListOf(Const.CURRENTAPPPKG))
633
                 addAppWhiteRule(arrayListOf(Const.CURRENTAPPPKG))
621
-                //允许运行时权限,禁止状态栏下拉,屏蔽底部虚拟键。
622
-                setRuntimePermissions(true)
623
-                disableStatusBarPanel(false)
634
+                //禁止状态栏下拉,屏蔽底部虚拟键。
635
+                disableStatusBarPanel(true)
624
                 hideHomeSoftKey(true)
636
                 hideHomeSoftKey(true)
625
                 hideMenuSoftKey(true)
637
                 hideMenuSoftKey(true)
626
                 enableAccessibility()
638
                 enableAccessibility()

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

936
     private fun postLogPush(pushType: Int) {
936
     private fun postLogPush(pushType: Int) {
937
         val pushBean = LogPushBean()
937
         val pushBean = LogPushBean()
938
         pushBean.pushType = pushType
938
         pushBean.pushType = pushType
939
-        pushBean.sn = ManageApplication.getDeviceInfo() ?: ""
939
+        ManageApplication.getDeviceInfo()?.let {
940
+            pushBean.sn =it
941
+        }
940
         viewModel.postLogPushAdd(pushBean)
942
         viewModel.postLogPushAdd(pushBean)
941
     }
943
     }
942
 
944
 
988
 
990
 
989
             }
991
             }
990
             //如果包含应用商店也移除,因为会在自定义app中添加
992
             //如果包含应用商店也移除,因为会在自定义app中添加
991
-            appList.filter { it.packageName == Const.STOREAPPPKG }.forEach {
993
+ /*           appList.filter { it.packageName == Const.STOREAPPPKG }.forEach {
992
                 removeList.add(it)
994
                 removeList.add(it)
993
-            }
994
-
995
+            }*/
995
             //移除应用列表隐藏的应用
996
             //移除应用列表隐藏的应用
996
-           /* storeRemoveList.forEach {pkg->
997
+            storeRemoveList.forEach {pkg->
997
                 appList.removeIf { it.packageName==pkg }
998
                 appList.removeIf { it.packageName==pkg }
998
-            }*/
999
+            }
999
             //移除学校控制之外预装应用
1000
             //移除学校控制之外预装应用
1000
             appList.removeAll(removeList)
1001
             appList.removeAll(removeList)
1001
 
1002
 

+ 2
- 1
app/src/main/java/com/xhly/manageapp/utils/AppDownLoadUtils.kt View File

50
                         successful = execute.isSuccessful()
50
                         successful = execute.isSuccessful()
51
                         LogShow("下载结果" + successful)
51
                         LogShow("下载结果" + successful)
52
                         if (successful) {
52
                         if (successful) {
53
-                            UIEvent(Const.INSTALL_FORCEAPP).setMessage(File(name, "$appName.apk").toString()).post()
53
+                           /* UIEvent(Const.INSTALL_FORCEAPP).setMessage(File(name, "$appName.apk").toString()).post()*/
54
+                            ManageApplication.installPackage(File(name, "$appName.apk").toString())
54
                         } else {
55
                         } else {
55
                             currentRetry++
56
                             currentRetry++
56
                         }
57
                         }

+ 5
- 0
app/src/main/java/com/xhly/manageapp/utils/CustomAppUtils.kt View File

41
             Const.UPDATESTRATEGYPKGNAME,
41
             Const.UPDATESTRATEGYPKGNAME,
42
             AppCompatResources.getDrawable(context,R.drawable.icon_updatestrategy)!!
42
             AppCompatResources.getDrawable(context,R.drawable.icon_updatestrategy)!!
43
         ))
43
         ))
44
+        appList.add(getCusomAppBean(
45
+            context.getString(R.string.netset),
46
+            Const.WIFISEETTINGPKG,
47
+            AppCompatResources.getDrawable(context,R.drawable.icon_updatestrategy)!!
48
+        ))
44
         return appList
49
         return appList
45
     }
50
     }
46
 
51
 

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

4
 import android.content.ComponentName
4
 import android.content.ComponentName
5
 import android.content.Context
5
 import android.content.Context
6
 import android.content.Intent
6
 import android.content.Intent
7
+import androidx.work.WorkManager
7
 import com.google.gson.reflect.TypeToken
8
 import com.google.gson.reflect.TypeToken
8
 import com.hjq.toast.Toaster
9
 import com.hjq.toast.Toaster
9
 import com.xhly.corelib.Const
10
 import com.xhly.corelib.Const
17
 import com.xhly.manageapp.bean.school.SchoolDeviceSetBean
18
 import com.xhly.manageapp.bean.school.SchoolDeviceSetBean
18
 import com.xhly.manageapp.bean.strategy.AppTimeManageBean
19
 import com.xhly.manageapp.bean.strategy.AppTimeManageBean
19
 import com.xhly.manageapp.bean.strategy.StrategyBean
20
 import com.xhly.manageapp.bean.strategy.StrategyBean
21
+import com.xhly.manageapp.service.websocket.AppSocket
20
 import java.util.Calendar
22
 import java.util.Calendar
21
 import kotlin.system.exitProcess
23
 import kotlin.system.exitProcess
22
 
24
 
372
               ManageApplication.setCustomOTG(true)
374
               ManageApplication.setCustomOTG(true)
373
               //关闭网络白名单
375
               //关闭网络白名单
374
               ManageApplication.setUrlWhiteListEnable(false)
376
               ManageApplication.setUrlWhiteListEnable(false)
377
+
378
+              //清除数据
379
+              WorkManager.getInstance(context).cancelAllWork()
380
+              context.deleteSharedPreferences(SharedPreferencesUtils.SP_FILE_NAME)
381
+              Const.USERID = null
382
+              Const.USERNAME = ""
383
+              AppSocket.onDestroy()
384
+
375
               //设置默认启动器
385
               //设置默认启动器
376
               if (ModelNameUtils.IS_LianxX505f()){
386
               if (ModelNameUtils.IS_LianxX505f()){
377
                   //505f的桌面名称
387
                   //505f的桌面名称

+ 1
- 1
app/src/main/res/values/strings.xml View File

1
 <resources>
1
 <resources>
2
-    <string name="app_name">XhlyManageApp</string>
2
+    <string name="app_name">星火管控桌面</string>
3
     <string name="stoptips">已被禁用,无法操作</string>
3
     <string name="stoptips">已被禁用,无法操作</string>
4
     <string name="apptimestoptips">应用不在可用时间!</string>
4
     <string name="apptimestoptips">应用不在可用时间!</string>
5
     <string name="padtimestoptips">平板不在可用时间!</string>
5
     <string name="padtimestoptips">平板不在可用时间!</string>

+ 7
- 0
corelib/src/main/java/com/xhly/corelib/Const.kt View File

25
     const val UPDATESTRATEGYPKGNAME = "UPDATESTRATEGYPKGNAME"
25
     const val UPDATESTRATEGYPKGNAME = "UPDATESTRATEGYPKGNAME"
26
 
26
 
27
 
27
 
28
+
29
+    /**
30
+     * 进入网络设置
31
+     */
32
+    const val WIFISEETTINGPKG = "WIFISEETTINGPKG"
33
+
34
+
28
     /**
35
     /**
29
      * 存储管控是否已解除的key
36
      * 存储管控是否已解除的key
30
      */
37
      */

Loading…
Cancel
Save