|
@@ -15,13 +15,11 @@ import com.xhly.corelib.eventbus.UIEvent
|
15
|
15
|
import com.xhly.corelib.utils.LogShow
|
16
|
16
|
import com.xhly.manageapp.ManageApplication
|
17
|
17
|
import com.xhly.manageapp.databinding.ActivityManageBinding
|
18
|
|
-import com.xhly.manageapp.utils.ZJAPPUtils
|
19
|
18
|
import java.io.File
|
20
|
19
|
|
21
|
20
|
|
22
|
21
|
//安装白名单为添加机制,不在白名单时需要去移除
|
23
|
22
|
class ManageActivity : BaseActivity<CommonBaseViewModel, ActivityManageBinding>() {
|
24
|
|
- private lateinit var csdkManager: CSDKManager
|
25
|
23
|
private var type = 1
|
26
|
24
|
private var type1 = 0
|
27
|
25
|
private var type2 = 0
|
|
@@ -35,21 +33,17 @@ class ManageActivity : BaseActivity<CommonBaseViewModel, ActivityManageBinding>(
|
35
|
33
|
override fun getBinding() = ActivityManageBinding.inflate(layoutInflater)
|
36
|
34
|
|
37
|
35
|
override fun initData() {
|
38
|
|
- csdkManager = CSDKManager(this)
|
39
|
36
|
//同意运行时权限
|
40
|
|
- csdkManager.setRuntimePermissions(true)
|
41
|
|
- //未知来源权限
|
42
|
|
- /* csdkManager.enableAllUnkownsourcesV3(true)*/
|
|
37
|
+ ManageApplication.setRuntimePermissions(true)
|
43
|
38
|
}
|
44
|
39
|
|
45
|
40
|
|
46
|
41
|
override fun initView() {
|
47
|
|
-/*
|
48
|
42
|
mBinding.adbopenBtn.setOnClickListener {
|
49
|
|
- Toast("设置" + csdkManager.enableUsbDebugging(true))
|
|
43
|
+ Toast("设置" + ManageApplication.enableUsbDebugging(true))
|
50
|
44
|
}
|
51
|
45
|
mBinding.adbcloseBtn.setOnClickListener {
|
52
|
|
- Toast("设置" + csdkManager.enableUsbDebugging(false))
|
|
46
|
+ Toast("设置" + ManageApplication.enableUsbDebugging(false))
|
53
|
47
|
}
|
54
|
48
|
mBinding.cameraBtn.setOnClickListener {
|
55
|
49
|
if (type == 0) {
|
|
@@ -57,7 +51,9 @@ class ManageActivity : BaseActivity<CommonBaseViewModel, ActivityManageBinding>(
|
57
|
51
|
} else {
|
58
|
52
|
type = 0
|
59
|
53
|
}
|
60
|
|
- Toast("设置" + csdkManager.disableCamera((type == 0)))
|
|
54
|
+ val b = type == 0
|
|
55
|
+ Toast("设置 $b")
|
|
56
|
+ ManageApplication.disableCamera(b)
|
61
|
57
|
}
|
62
|
58
|
mBinding.bluBtn.setOnClickListener {
|
63
|
59
|
type1 = if (type1 == 0) {
|
|
@@ -65,8 +61,9 @@ class ManageActivity : BaseActivity<CommonBaseViewModel, ActivityManageBinding>(
|
65
|
61
|
} else {
|
66
|
62
|
0
|
67
|
63
|
}
|
68
|
|
- Toast("设置" + csdkManager.enableBluetoothV3(type1 == 0))
|
69
|
|
- startActivity(Intent(Settings.ACTION_BLUETOOTH_SETTINGS))
|
|
64
|
+ var b = type1 == 0
|
|
65
|
+ Toast("设置" + b)
|
|
66
|
+ ManageApplication.enableBluetooth(b)
|
70
|
67
|
}
|
71
|
68
|
mBinding.netBtn.setOnClickListener {
|
72
|
69
|
type5 = if (type5 == 0) {
|
|
@@ -74,7 +71,9 @@ class ManageActivity : BaseActivity<CommonBaseViewModel, ActivityManageBinding>(
|
74
|
71
|
} else {
|
75
|
72
|
0
|
76
|
73
|
}
|
77
|
|
- csdkManager.enableDataV3(type5 == 0)
|
|
74
|
+ var b = type5 == 0
|
|
75
|
+ Toast("设置" + b)
|
|
76
|
+ ManageApplication.enableData(b)
|
78
|
77
|
startActivity(Intent(Settings.ACTION_NETWORK_OPERATOR_SETTINGS))
|
79
|
78
|
}
|
80
|
79
|
|
|
@@ -84,8 +83,8 @@ class ManageActivity : BaseActivity<CommonBaseViewModel, ActivityManageBinding>(
|
84
|
83
|
} else {
|
85
|
84
|
0
|
86
|
85
|
}
|
87
|
|
- Toast("设置" + csdkManager.enableLocationV3(type3 == 0))
|
88
|
|
- startActivity(Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS))
|
|
86
|
+ Toast("设置" + (type3 == 0))
|
|
87
|
+ ManageApplication.enableLocation((type3 == 0))
|
89
|
88
|
}
|
90
|
89
|
mBinding.wifiBtn.setOnClickListener {
|
91
|
90
|
type2 = if (type2 == 0) {
|
|
@@ -93,95 +92,77 @@ class ManageActivity : BaseActivity<CommonBaseViewModel, ActivityManageBinding>(
|
93
|
92
|
} else {
|
94
|
93
|
0
|
95
|
94
|
}
|
96
|
|
- Toast("设置" + csdkManager.enableWifiV3(type2 == 0))
|
97
|
|
- startActivity(Intent(Settings.ACTION_WIFI_SETTINGS))
|
|
95
|
+ Toast("设置" +(type2 == 0))
|
|
96
|
+ ManageApplication.enableWifi(type2==0)
|
98
|
97
|
}
|
99
|
98
|
|
100
|
99
|
mBinding.wifiHighBtn.setOnClickListener {
|
101
|
100
|
type6 = getType(type6)
|
102
|
|
- //csdkManager.disallowWifiV3(false)
|
103
|
|
- csdkManager.disallowWifiAdvanceSettingsV3(type6==0)
|
|
101
|
+ //csdkManager.disallowWifi_v3(false)
|
|
102
|
+ ManageApplication.disallowWifiAdvanceSettings(type6==0)
|
|
103
|
+ Toast("设置" +(type6 == 0))
|
104
|
104
|
startActivity(Intent(Settings.ACTION_WIFI_SETTINGS))
|
105
|
105
|
}
|
106
|
106
|
|
107
|
107
|
mBinding.wifiHighBtn2.setOnClickListener {
|
108
|
108
|
type6 = getType(type6)
|
109
|
|
- //csdkManager.disallowWifiV3(false)
|
110
|
|
- csdkManager.disallowWifiAdvanceSettingsV3(type6==0)
|
111
|
|
- startActivity(Intent(Settings.ACTION_WIFI_SETTINGS))
|
|
109
|
+ //csdkManager.disallowWifi_v3(false)
|
|
110
|
+ ManageApplication.disallowWifiAdvanceSettings(type6==0)
|
|
111
|
+ Toast("设置" +(type6 == 0))
|
|
112
|
+ startActivity(Intent(Settings.ACTION_WIFI_SETTINGS))
|
112
|
113
|
}
|
113
|
114
|
|
114
|
115
|
mBinding.usbBtn.setOnClickListener {
|
115
|
|
- type4 = if (type4 == 0) {
|
116
|
|
- 1
|
117
|
|
- } else {
|
118
|
|
- 0
|
119
|
|
- }
|
120
|
|
- var s = if (type4 == 0) {
|
121
|
|
- "禁用"
|
122
|
|
- } else {
|
123
|
|
- "启用"
|
124
|
|
- }
|
125
|
|
- Toast("$s,设置" + csdkManager.requestKeyControl_V3(26, type4 == 0))
|
|
116
|
+ type4 = getType(type4 )
|
|
117
|
+ Toast("设置" + (type4 == 0))
|
|
118
|
+ ManageApplication.requestKeyControl_V3(26,type4 == 0)
|
126
|
119
|
}
|
127
|
120
|
var type7 = 0
|
128
|
121
|
mBinding.sdBtn.setOnClickListener {
|
129
|
|
- type7 = if (type7 == 0) {
|
130
|
|
- 1
|
131
|
|
- } else {
|
132
|
|
- 0
|
133
|
|
- }
|
134
|
|
- Toast("设置" + csdkManager.enableMassStorage(type7 == 0))
|
|
122
|
+ type7 = getType(type7 )
|
|
123
|
+ Toast("设置" +(type7 == 0))
|
|
124
|
+ ManageApplication.enableMassStorage(type7 == 0)
|
135
|
125
|
}
|
136
|
126
|
var type8 = 0
|
137
|
127
|
mBinding.otgBtn.setOnClickListener {
|
138
|
|
- type8 = if (type8 == 0) {
|
139
|
|
- 1
|
140
|
|
- } else {
|
141
|
|
- 0
|
142
|
|
- }
|
143
|
|
- csdkManager.isCustomOtg=(type8 == 0)
|
144
|
|
- Toast("设置")
|
|
128
|
+ type8 = getType(type8)
|
|
129
|
+ ManageApplication.setCustomOTG((type8 == 0))
|
|
130
|
+ Toast("设置"+(type8 == 0))
|
145
|
131
|
}
|
146
|
132
|
var type9 = 0
|
147
|
133
|
mBinding.banBtn.setOnClickListener {
|
148
|
134
|
type9 = getType(type9)
|
149
|
|
- */
|
150
|
|
-/*appList.forEach {
|
151
|
|
- csdkManager.setPackageEnabled(it, type9 == 0)
|
152
|
|
- }*//*
|
153
|
|
-
|
154
|
|
- csdkManager.setPackageEnabled("com.coolapk.market", type9 == 0)
|
|
135
|
+ ManageApplication.setPackageEnabled("com.coolapk.market", type9 == 0)
|
|
136
|
+ }
|
|
137
|
+ mBinding.settimeBtn.setOnClickListener {
|
|
138
|
+ // ManageApplication.setSysTime(0)
|
155
|
139
|
}
|
156
|
140
|
mBinding.uninstallBtn.setOnClickListener {
|
157
|
141
|
//csdkManager.removeInstallPackageWhiteList(arrayListOf("com.baidu.searchbox"))
|
158
|
|
- csdkManager.uninstallPackage("com.coolapk.market", true)
|
|
142
|
+ ManageApplication.uninstallPackage("com.coolapk.market")
|
159
|
143
|
}
|
160
|
144
|
mBinding.installBtn.setOnClickListener {
|
161
|
145
|
var file = Environment.getExternalStoragePublicDirectory(DIRECTORY_DOWNLOADS)
|
162
|
146
|
var name = file.toString()
|
163
|
147
|
var sb = StringBuffer()
|
164
|
|
- csdkManager.installPackageWhiteList?.forEach {
|
|
148
|
+ ManageApplication.getInstallPackageWhiteList().forEach {
|
165
|
149
|
sb.append("$it,")
|
166
|
150
|
}
|
167
|
151
|
Toast("路径$name")
|
168
|
152
|
LogShow("白名单" + sb.toString())
|
169
|
|
- */
|
170
|
|
-/* csdkManager.addInstallPackageWhiteList(
|
171
|
|
- arrayListOf(
|
172
|
|
- "com.xhly.manageapp", "com.coolapk.market"
|
173
|
|
- )
|
174
|
|
- )*//*
|
|
153
|
+ ManageApplication.addInstallPackageWhiteList(
|
|
154
|
+ arrayListOf(
|
|
155
|
+ "com.xhly.manageapp", "com.coolapk.market"
|
|
156
|
+ )
|
|
157
|
+ )
|
175
|
158
|
|
176
|
159
|
|
177
|
|
- */
|
178
|
|
-/* csdkManager.disableInstallation(false)*//*
|
|
160
|
+ ManageApplication.disableInstallation(false)
|
179
|
161
|
|
180
|
|
- */
|
181
|
|
-/* ManageApplication.addInstallPackageWhiteList(arrayListOf( "com.coolapk.market"))*//*
|
|
162
|
+ ManageApplication.addInstallPackageWhiteList(arrayListOf("com.coolapk.market"))
|
182
|
163
|
|
183
|
|
- ManageApplication.removeInstallPackageWhiteList(arrayListOf( "com.coolapk.market"))
|
184
|
|
- csdkManager.installPackage(File(name,"test.apk").toString())
|
|
164
|
+ ManageApplication.removeInstallPackageWhiteList(arrayListOf("com.coolapk.market"))
|
|
165
|
+ ManageApplication.installPackage(File(name, "test.apk").toString())
|
185
|
166
|
//ZJAPPUtils.installApk(this, File(name, "test.apk"))
|
186
|
167
|
}
|
187
|
168
|
var type10 = 0
|
|
@@ -198,7 +179,7 @@ class ManageActivity : BaseActivity<CommonBaseViewModel, ActivityManageBinding>(
|
198
|
179
|
Toast("关闭功能")
|
199
|
180
|
COMPONENT_ENABLED_STATE_DISABLED
|
200
|
181
|
}
|
201
|
|
- csdkManager.setComponentEnabled(
|
|
182
|
+ ManageApplication.setComponentEnabled(
|
202
|
183
|
componentName,
|
203
|
184
|
state,
|
204
|
185
|
DONT_KILL_APP
|
|
@@ -210,7 +191,7 @@ class ManageActivity : BaseActivity<CommonBaseViewModel, ActivityManageBinding>(
|
210
|
191
|
arrayListOf("设备Mac地址", "设备SN号", "获取设备型号信息", "获取设备IMEI信息")
|
211
|
192
|
array.forEach {
|
212
|
193
|
var indexOf = array.indexOf(it)
|
213
|
|
- var deviceInfo = csdkManager.getDeviceInfo(indexOf + 1)
|
|
194
|
+ var deviceInfo = ManageApplication.getDeviceInfo(indexOf + 1)
|
214
|
195
|
LogShow("$it==$deviceInfo")
|
215
|
196
|
}
|
216
|
197
|
}
|
|
@@ -219,13 +200,13 @@ class ManageActivity : BaseActivity<CommonBaseViewModel, ActivityManageBinding>(
|
219
|
200
|
num++
|
220
|
201
|
Toast("还有${5 - num}次,恢复出厂")
|
221
|
202
|
if (num == 5) {
|
222
|
|
- var launchFactoryReset = csdkManager.launchFactoryReset()
|
|
203
|
+ var launchFactoryReset = ManageApplication.launchFactoryReset()
|
223
|
204
|
Toast("恢复出厂成功=" + launchFactoryReset)
|
224
|
205
|
}
|
225
|
206
|
}
|
226
|
207
|
mBinding.launcherBtn.setOnClickListener {
|
227
|
208
|
//Toast("设置成功"+csdkManager.setLauncher("com.xhly.manageapp"))
|
228
|
|
- csdkManager.setCustomLauncher(
|
|
209
|
+ ManageApplication.setCustomLauncher(
|
229
|
210
|
"com.xhly.manageapp",
|
230
|
211
|
"com.xhly.manageapp.ui.ManageActivity"
|
231
|
212
|
)
|
|
@@ -233,26 +214,29 @@ class ManageActivity : BaseActivity<CommonBaseViewModel, ActivityManageBinding>(
|
233
|
214
|
var type12 = 0
|
234
|
215
|
mBinding.airbtnBtn.setOnClickListener {
|
235
|
216
|
type12 = getType(type12)
|
236
|
|
- Toast("禁止操作" + csdkManager.disallowAirplaneModeV3(type12==0 ))
|
|
217
|
+ Toast("禁止操作" +(type12 == 0))
|
|
218
|
+ ManageApplication.disallowAirplaneMode_v3(type12 == 0)
|
237
|
219
|
}
|
238
|
220
|
var type13 = 0
|
239
|
221
|
mBinding.statusBtn.setOnClickListener {
|
240
|
222
|
type13 = getType(type13)
|
241
|
|
- Toast("禁止操作" + csdkManager.hideStatusBar(type13 == 0))
|
|
223
|
+ Toast("禁止操作"+(type13 == 0))
|
|
224
|
+ ManageApplication.hideStatusBar(type13 == 0)
|
242
|
225
|
}
|
243
|
226
|
var type14 = 0
|
244
|
227
|
mBinding.statuspanelBtn.setOnClickListener {
|
245
|
228
|
type14 = getType(type14)
|
246
|
|
- Toast("禁止操作" + csdkManager.disableStatusBarPanel(type14 == 0))
|
|
229
|
+ Toast("禁止操作" +(type14 == 0))
|
|
230
|
+ ManageApplication.disableStatusBarPanel(type14 == 0)
|
247
|
231
|
}
|
248
|
232
|
var type15 = 0
|
249
|
233
|
mBinding.hidekeyBtn.setOnClickListener {
|
250
|
234
|
type15 = getType(type15)
|
251
|
|
- csdkManager.hideBackSoftKey(type15 == 0)
|
252
|
|
- csdkManager.hideMenuSoftKey(type15 == 0)
|
253
|
|
- csdkManager.hideHomeSoftKey(type15 == 0)
|
|
235
|
+ var b = (type15 == 0)
|
|
236
|
+ ManageApplication.hideBackSoftKey(b)
|
|
237
|
+ ManageApplication.hideMenuSoftKey(b)
|
|
238
|
+ ManageApplication.hideHomeSoftKey(b)
|
254
|
239
|
}
|
255
|
|
-*/
|
256
|
240
|
}
|
257
|
241
|
|
258
|
242
|
override fun finish() {
|