Browse Source

1.添加ManageActivity页面布局,以及相关素材。

master
wangwanlei 9 months ago
parent
commit
94a9e6ed40

BIN
app/libs/csdk_5.0.jar View File


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

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

+ 204
- 0
app/src/main/res/layout/activity_manage.xml View File

@@ -0,0 +1,204 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
+    android:layout_width="match_parent"
4
+    android:layout_height="match_parent"
5
+    android:orientation="vertical">
6
+
7
+    <androidx.core.widget.NestedScrollView
8
+        android:layout_width="match_parent"
9
+        android:layout_height="match_parent">
10
+
11
+        <androidx.appcompat.widget.LinearLayoutCompat
12
+            android:layout_width="match_parent"
13
+            android:layout_height="wrap_content"
14
+            android:orientation="vertical">
15
+
16
+            <androidx.appcompat.widget.LinearLayoutCompat
17
+                android:layout_width="match_parent"
18
+                android:layout_height="wrap_content"
19
+                android:gravity="center_vertical">
20
+
21
+                <androidx.appcompat.widget.AppCompatButton
22
+                    android:id="@+id/adbopenBtn"
23
+                    android:layout_width="0dp"
24
+                    android:layout_height="80dp"
25
+                    android:layout_weight="1"
26
+                    android:text="打开usb调试" />
27
+
28
+
29
+                <androidx.appcompat.widget.AppCompatButton
30
+                    android:id="@+id/adbclose_btn"
31
+                    android:layout_width="0dp"
32
+                    android:layout_height="80dp"
33
+                    android:layout_weight="1"
34
+                    android:text="关闭usb调试" />
35
+
36
+                <androidx.appcompat.widget.AppCompatButton
37
+                    android:id="@+id/camera_btn"
38
+                    android:layout_width="0dp"
39
+                    android:layout_height="80dp"
40
+                    android:layout_weight="1"
41
+                    android:text="摄像头权限" />
42
+
43
+
44
+                <androidx.appcompat.widget.AppCompatButton
45
+                    android:id="@+id/blu_btn"
46
+                    android:layout_width="0dp"
47
+                    android:layout_height="80dp"
48
+                    android:layout_weight="1"
49
+                    android:text="蓝牙开关" />
50
+
51
+                <androidx.appcompat.widget.AppCompatButton
52
+                    android:id="@+id/net_btn"
53
+                    android:layout_width="0dp"
54
+                    android:layout_height="80dp"
55
+                    android:layout_weight="1"
56
+                    android:text="数据开关" />
57
+
58
+                <androidx.appcompat.widget.AppCompatButton
59
+                    android:id="@+id/location_btn"
60
+                    android:layout_width="0dp"
61
+                    android:layout_height="80dp"
62
+                    android:layout_weight="1"
63
+                    android:text="定位开关" />
64
+
65
+                <androidx.appcompat.widget.AppCompatButton
66
+                    android:id="@+id/wifi_btn"
67
+                    android:layout_width="0dp"
68
+                    android:layout_height="80dp"
69
+                    android:layout_weight="1"
70
+                    android:text="wifi开关" />
71
+            </androidx.appcompat.widget.LinearLayoutCompat>
72
+
73
+            <androidx.appcompat.widget.LinearLayoutCompat
74
+                android:layout_width="match_parent"
75
+                android:layout_height="wrap_content"
76
+                android:gravity="center_vertical">
77
+
78
+                <androidx.appcompat.widget.AppCompatButton
79
+                    android:id="@+id/wifi_high_btn"
80
+                    android:layout_width="0dp"
81
+                    android:layout_height="80dp"
82
+                    android:layout_weight="1"
83
+                    android:text="wifi高级设置开关" />
84
+
85
+                <androidx.appcompat.widget.AppCompatButton
86
+                    android:id="@+id/usb_btn"
87
+                    android:layout_width="0dp"
88
+                    android:layout_height="80dp"
89
+                    android:layout_weight="1"
90
+                    android:text="按键开关" />
91
+
92
+                <androidx.appcompat.widget.AppCompatButton
93
+                    android:id="@+id/sd_btn"
94
+                    android:layout_width="0dp"
95
+                    android:layout_height="80dp"
96
+                    android:layout_weight="1"
97
+                    android:text="SD卡是否启用" />
98
+
99
+                <androidx.appcompat.widget.AppCompatButton
100
+                    android:id="@+id/otg_btn"
101
+                    android:layout_width="0dp"
102
+                    android:layout_height="80dp"
103
+                    android:layout_weight="1"
104
+                    android:text="OTG是否启用" />
105
+
106
+                <androidx.appcompat.widget.AppCompatButton
107
+                    android:id="@+id/ban_btn"
108
+                    android:layout_width="0dp"
109
+                    android:layout_height="80dp"
110
+                    android:layout_weight="1"
111
+                    android:text="冻结星火云鸽" />
112
+
113
+                <androidx.appcompat.widget.AppCompatButton
114
+                    android:id="@+id/uninstall_btn"
115
+                    android:layout_width="0dp"
116
+                    android:layout_height="80dp"
117
+                    android:layout_weight="1"
118
+                    android:text="卸载酷安" />
119
+
120
+                <androidx.appcompat.widget.AppCompatButton
121
+                    android:id="@+id/install_btn"
122
+                    android:layout_width="0dp"
123
+                    android:layout_height="80dp"
124
+                    android:layout_weight="1"
125
+                    android:text="安装酷安" />
126
+
127
+                <androidx.appcompat.widget.AppCompatButton
128
+                    android:id="@+id/banmodle_btn"
129
+                    android:layout_width="0dp"
130
+                    android:layout_height="80dp"
131
+                    android:layout_weight="1"
132
+                    android:text="禁止酷安应用管理页面" />
133
+
134
+                <androidx.appcompat.widget.AppCompatButton
135
+                    android:id="@+id/getsn_btn"
136
+                    android:layout_width="0dp"
137
+                    android:layout_height="80dp"
138
+                    android:layout_weight="1"
139
+                    android:text="获取设备信息" />
140
+
141
+                <androidx.appcompat.widget.AppCompatButton
142
+                    android:id="@+id/reset_btn"
143
+                    android:layout_width="0dp"
144
+                    android:layout_height="80dp"
145
+                    android:layout_weight="1"
146
+                    android:text="恢复出厂" />
147
+
148
+                <androidx.appcompat.widget.AppCompatButton
149
+                    android:id="@+id/launcher_btn"
150
+                    android:layout_width="0dp"
151
+                    android:layout_height="80dp"
152
+                    android:layout_weight="1"
153
+                    android:text="设置桌面" />
154
+
155
+                <androidx.appcompat.widget.AppCompatButton
156
+                    android:id="@+id/settime_btn"
157
+                    android:layout_width="0dp"
158
+                    android:layout_height="80dp"
159
+                    android:layout_weight="1"
160
+                    android:text="设置时间" />
161
+            </androidx.appcompat.widget.LinearLayoutCompat>
162
+
163
+            <LinearLayout
164
+                android:layout_width="match_parent"
165
+                android:layout_height="wrap_content">
166
+
167
+                <androidx.appcompat.widget.AppCompatButton
168
+                    android:id="@+id/airbtn_btn"
169
+                    android:layout_width="0dp"
170
+                    android:layout_height="80dp"
171
+                    android:layout_weight="1"
172
+                    android:text="限制飞行模式" />
173
+                <androidx.appcompat.widget.AppCompatButton
174
+                    android:id="@+id/status_btn"
175
+                    android:layout_width="0dp"
176
+                    android:layout_height="80dp"
177
+                    android:layout_weight="1"
178
+                    android:text="打开关闭状态栏" />
179
+
180
+                <androidx.appcompat.widget.AppCompatButton
181
+                    android:id="@+id/statuspanel_btn"
182
+                    android:layout_width="0dp"
183
+                    android:layout_height="80dp"
184
+                    android:layout_weight="1"
185
+                    android:text="打开关闭下拉" />
186
+
187
+                <androidx.appcompat.widget.AppCompatButton
188
+                    android:id="@+id/hidekey_btn"
189
+                    android:layout_width="0dp"
190
+                    android:layout_height="80dp"
191
+                    android:layout_weight="1"
192
+                    android:text="隐藏底部按键" />
193
+
194
+
195
+                <EditText
196
+                    android:layout_width="0dp"
197
+                    android:layout_height="80dp"
198
+                    android:layout_weight="1"
199
+                    android:hint="输入"
200
+                    android:inputType="text" />
201
+            </LinearLayout>
202
+        </androidx.appcompat.widget.LinearLayoutCompat>
203
+    </androidx.core.widget.NestedScrollView>
204
+</LinearLayout>

Loading…
Cancel
Save