|
@@ -7,9 +7,7 @@ import android.content.ComponentName
|
7
|
7
|
import android.content.Context
|
8
|
8
|
import android.content.pm.PackageManager
|
9
|
9
|
import android.os.Build
|
10
|
|
-import android.util.Log
|
11
|
10
|
import androidx.core.content.ContextCompat
|
12
|
|
-import androidx.multidex.BuildConfig
|
13
|
11
|
import androidx.multidex.MultiDex
|
14
|
12
|
import androidx.multidex.MultiDexApplication
|
15
|
13
|
import com.hjq.toast.Toaster
|
|
@@ -44,10 +42,12 @@ class ManageApplication : MultiDexApplication() {
|
44
|
42
|
//先移除,再添加。
|
45
|
43
|
removeInstallPackageWhiteList(getInstallPackageWhiteList())
|
46
|
44
|
pkgList.add(Const.CURRENTAPPPKG)
|
|
45
|
+ pkgList.add(Const.CURRENTAPPPKG)
|
47
|
46
|
csdkManager?.addInstallPackageWhiteList(pkgList)
|
48
|
47
|
}
|
49
|
48
|
}
|
50
|
49
|
|
|
50
|
+
|
51
|
51
|
/**
|
52
|
52
|
* 移除可安装应用白名单
|
53
|
53
|
*/
|
|
@@ -112,6 +112,19 @@ class ManageApplication : MultiDexApplication() {
|
112
|
112
|
}
|
113
|
113
|
}
|
114
|
114
|
|
|
115
|
+ /*
|
|
116
|
+ * 管控是否可以进入应用详情页
|
|
117
|
+ * true:启用应用管理管控
|
|
118
|
+ false:取消应用管理管控
|
|
119
|
+ * */
|
|
120
|
+ fun disableApplicationManage(enable: Boolean) {
|
|
121
|
+ if (ModelNameUtils.IS_LianxX505f()) {
|
|
122
|
+ csdkManager?.disableApplicationManage_v3(enable)
|
|
123
|
+ } else if (ModelNameUtils.IS_LianxX6e6f()) {
|
|
124
|
+ csdkManager?.disableApplicationManageV3(enable)
|
|
125
|
+ }
|
|
126
|
+ }
|
|
127
|
+
|
115
|
128
|
/**
|
116
|
129
|
* 冻结应用true:显示应用可以使用; false:隐藏应用不可用
|
117
|
130
|
*/
|
|
@@ -190,9 +203,9 @@ class ManageApplication : MultiDexApplication() {
|
190
|
203
|
*/
|
191
|
204
|
fun enableWifi(enableFlag: Boolean) {
|
192
|
205
|
if (ModelNameUtils.IS_LianxX505f()) {
|
193
|
|
- csdkManager?.enableWifi_v3(enableFlag)
|
|
206
|
+ csdkManager?.enableWifi_v3(enableFlag)
|
194
|
207
|
} else if (ModelNameUtils.IS_LianxX6e6f()) {
|
195
|
|
- csdkManager?.enableWifiV3(enableFlag)
|
|
208
|
+ csdkManager?.enableWifiV3(enableFlag)
|
196
|
209
|
}
|
197
|
210
|
}
|
198
|
211
|
|
|
@@ -358,12 +371,12 @@ class ManageApplication : MultiDexApplication() {
|
358
|
371
|
try {
|
359
|
372
|
val sorted = getWifiWhiteList().sorted()
|
360
|
373
|
LogShow("wifi白名单有$sorted")
|
361
|
|
- if (sorted.equals(list.sorted())){
|
|
374
|
+ if (sorted.equals(list.sorted())) {
|
362
|
375
|
return
|
363
|
|
- }else{
|
|
376
|
+ } else {
|
364
|
377
|
csdkManager?.wifiWhiteList = list
|
365
|
378
|
}
|
366
|
|
- }catch (e:Exception){
|
|
379
|
+ } catch (e: Exception) {
|
367
|
380
|
csdkManager?.wifiWhiteList = list
|
368
|
381
|
}
|
369
|
382
|
} else if (ModelNameUtils.IS_LianxX6e6f()) {
|
|
@@ -524,7 +537,7 @@ class ManageApplication : MultiDexApplication() {
|
524
|
537
|
* false:显示状态栏
|
525
|
538
|
*/
|
526
|
539
|
fun hideStatusBar(enableFlag: Boolean) {
|
527
|
|
- if (ModelNameUtils.IS_LianxX505f()||ModelNameUtils.IS_LianxX6e6f()) {
|
|
540
|
+ if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
|
528
|
541
|
csdkManager?.hideStatusBar(enableFlag)
|
529
|
542
|
}
|
530
|
543
|
}
|
|
@@ -534,7 +547,7 @@ class ManageApplication : MultiDexApplication() {
|
534
|
547
|
* false:启用状态栏下拉
|
535
|
548
|
*/
|
536
|
549
|
fun disableStatusBarPanel(enableFlag: Boolean) {
|
537
|
|
- if (ModelNameUtils.IS_LianxX505f()||ModelNameUtils.IS_LianxX6e6f()) {
|
|
550
|
+ if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
|
538
|
551
|
csdkManager?.disableStatusBarPanel(enableFlag)
|
539
|
552
|
}
|
540
|
553
|
}
|
|
@@ -551,15 +564,16 @@ class ManageApplication : MultiDexApplication() {
|
551
|
564
|
csdkManager?.enableAllUnkownsourcesV3(enableFlag)
|
552
|
565
|
}
|
553
|
566
|
}
|
|
567
|
+
|
554
|
568
|
/* 打开/关闭 指定app 的安装未知源权限
|
555
|
569
|
* true:app 未知来源权限开启
|
556
|
570
|
false:app 未知来源权限关闭
|
557
|
571
|
* */
|
558
|
|
- fun enableUnkownsources(pkg: String,enableFlag: Boolean){
|
|
572
|
+ fun enableUnkownsources(pkg: String, enableFlag: Boolean) {
|
559
|
573
|
if (ModelNameUtils.IS_LianxX505f()) {
|
560
|
|
- csdkManager?.enableUnkownsources_v3(pkg,enableFlag)
|
|
574
|
+ csdkManager?.enableUnkownsources_v3(pkg, enableFlag)
|
561
|
575
|
} else if (ModelNameUtils.IS_LianxX6e6f()) {
|
562
|
|
- csdkManager?.enableUnkownsourcesV3(pkg,enableFlag)
|
|
576
|
+ csdkManager?.enableUnkownsourcesV3(pkg, enableFlag)
|
563
|
577
|
}
|
564
|
578
|
}
|
565
|
579
|
|
|
@@ -570,10 +584,10 @@ class ManageApplication : MultiDexApplication() {
|
570
|
584
|
fun enableUsbDebugging(enableFlag: Boolean) {
|
571
|
585
|
if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
|
572
|
586
|
csdkManager?.enableUsbDebugging(enableFlag)
|
573
|
|
- if (ModelNameUtils.IS_LianxX505f()){
|
|
587
|
+ if (ModelNameUtils.IS_LianxX505f()) {
|
574
|
588
|
//关闭usb调试时设置为充电模式
|
575
|
|
- if (!enableFlag){
|
576
|
|
- setCurrentUsbMode(0)
|
|
589
|
+ if (!enableFlag) {
|
|
590
|
+ setCurrentUsbMode(0)
|
577
|
591
|
}
|
578
|
592
|
}
|
579
|
593
|
}
|
|
@@ -582,8 +596,8 @@ class ManageApplication : MultiDexApplication() {
|
582
|
596
|
/**
|
583
|
597
|
* 将 设置USB模式 0 充电
|
584
|
598
|
*/
|
585
|
|
- fun setCurrentUsbMode(type:Int=0){
|
586
|
|
- if (ModelNameUtils.IS_LianxX505f()){
|
|
599
|
+ fun setCurrentUsbMode(type: Int = 0) {
|
|
600
|
+ if (ModelNameUtils.IS_LianxX505f()) {
|
587
|
601
|
//关闭usb调试时设置为充电模式
|
588
|
602
|
csdkManager?.setCurrentUsbMode(type)
|
589
|
603
|
}
|
|
@@ -621,7 +635,7 @@ class ManageApplication : MultiDexApplication() {
|
621
|
635
|
if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
|
622
|
636
|
setUrlWhiteListEnable(true)
|
623
|
637
|
val urlWhiteListRead = urlWhiteListRead()
|
624
|
|
- LogShow("之前的白名单有"+urlWhiteListRead.size)
|
|
638
|
+ LogShow("之前的白名单有" + urlWhiteListRead.size)
|
625
|
639
|
//添加之前的白名单
|
626
|
640
|
list.addAll(urlWhiteListRead)
|
627
|
641
|
list.add(Const.BASEURL)
|
|
@@ -678,8 +692,8 @@ class ManageApplication : MultiDexApplication() {
|
678
|
692
|
/**
|
679
|
693
|
* 添加网络应用白名单
|
680
|
694
|
*/
|
681
|
|
- fun addAppWhiteRule(pkgList: ArrayList<String>,removeFlag:Boolean=true) {
|
682
|
|
- if (removeFlag){
|
|
695
|
+ fun addAppWhiteRule(pkgList: ArrayList<String>, removeFlag: Boolean = true) {
|
|
696
|
+ if (removeFlag) {
|
683
|
697
|
clearAppWhiteRule()
|
684
|
698
|
}
|
685
|
699
|
if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
|
|
@@ -705,8 +719,8 @@ class ManageApplication : MultiDexApplication() {
|
705
|
719
|
/**
|
706
|
720
|
* 获得App网络白名单
|
707
|
721
|
*/
|
708
|
|
- fun GetAppWhiteRules():ArrayList<String>{
|
709
|
|
- val appList= arrayListOf<String>()
|
|
722
|
+ fun GetAppWhiteRules(): ArrayList<String> {
|
|
723
|
+ val appList = arrayListOf<String>()
|
710
|
724
|
if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
|
711
|
725
|
var appWhiteRules = csdkManager?.appWhiteRules
|
712
|
726
|
appWhiteRules?.let {
|
|
@@ -745,17 +759,17 @@ class ManageApplication : MultiDexApplication() {
|
745
|
759
|
* true:打开在其它应用的上层
|
746
|
760
|
* false:关闭在其它应用的上层
|
747
|
761
|
*/
|
748
|
|
- fun enableOverlayWindow(pkg:String=Const.CURRENTAPPPKG,enableFlag: Boolean=true){
|
|
762
|
+ fun enableOverlayWindow(pkg: String = Const.CURRENTAPPPKG, enableFlag: Boolean = true) {
|
749
|
763
|
if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
|
750
|
|
- csdkManager?.enableOverlayWindow(pkg,enableFlag)
|
|
764
|
+ csdkManager?.enableOverlayWindow(pkg, enableFlag)
|
751
|
765
|
}
|
752
|
766
|
}
|
753
|
767
|
|
754
|
768
|
/**
|
755
|
769
|
* 设置锁屏模式 0:取消解锁模式 1:滑动解锁
|
756
|
770
|
*/
|
757
|
|
- fun setLockScreenMode(enableFlag: Int=0){
|
758
|
|
- if (ModelNameUtils.IS_LianxX505f()||ModelNameUtils.IS_LianxX6e6f()) {
|
|
771
|
+ fun setLockScreenMode(enableFlag: Int = 0) {
|
|
772
|
+ if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
|
759
|
773
|
csdkManager?.setLockScreenMode(enableFlag)
|
760
|
774
|
}
|
761
|
775
|
}
|
|
@@ -763,8 +777,8 @@ class ManageApplication : MultiDexApplication() {
|
763
|
777
|
/**
|
764
|
778
|
* 505f设置护眼模式
|
765
|
779
|
*/
|
766
|
|
- fun setEnabledEyeMode(enableFlag: Boolean){
|
767
|
|
- if (ModelNameUtils.IS_LianxX505f()||ModelNameUtils.IS_LianxX6e6f()) {
|
|
780
|
+ fun setEnabledEyeMode(enableFlag: Boolean) {
|
|
781
|
+ if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
|
768
|
782
|
csdkManager?.setEnabledEyeMode(enableFlag)
|
769
|
783
|
}
|
770
|
784
|
}
|
|
@@ -775,7 +789,7 @@ class ManageApplication : MultiDexApplication() {
|
775
|
789
|
super.onCreate()
|
776
|
790
|
val processName = SystemUtil.getProcessName(this, android.os.Process.myPid())
|
777
|
791
|
if (processName != null && processName.equals(packageName)) {
|
778
|
|
- LogUtils.DEBUG=com.xhkjedu.manageapp.BuildConfig.IS_DEBUG
|
|
792
|
+ LogUtils.DEBUG = com.xhkjedu.manageapp.BuildConfig.IS_DEBUG
|
779
|
793
|
Const.setBaseUrl(com.xhkjedu.manageapp.BuildConfig.IS_DEBUG)
|
780
|
794
|
CrashReport.initCrashReport(applicationContext, "37c72ff74c", false)
|
781
|
795
|
instance = this
|
|
@@ -785,7 +799,7 @@ class ManageApplication : MultiDexApplication() {
|
785
|
799
|
val exitControlFlag = currentSpUtils.getParam(Const.EXIT_CONTROL, false) as Boolean
|
786
|
800
|
Toaster.init(this)
|
787
|
801
|
DialogX.init(this)
|
788
|
|
- if (ModelNameUtils.IS_LianxX505f()||ModelNameUtils.IS_LianxX6e6f()) {
|
|
802
|
+ if (ModelNameUtils.IS_LianxX505f() || ModelNameUtils.IS_LianxX6e6f()) {
|
789
|
803
|
csdkManager = CSDKManager(this)
|
790
|
804
|
//允许运行时权限
|
791
|
805
|
setRuntimePermissions(true)
|