Browse Source

1.添加截屏和旋转屏幕设置

master
wangwanlei 11 months ago
parent
commit
e8dc4efd97
1 changed files with 35 additions and 8 deletions
  1. 35
    8
      app/src/main/java/com/xhly/manageapp/ManageApplication.kt

+ 35
- 8
app/src/main/java/com/xhly/manageapp/ManageApplication.kt View File

@@ -38,8 +38,8 @@ class ManageApplication : MultiDexApplication() {
38 38
         /**
39 39
          * 获取应用白名单
40 40
          */
41
-        fun getInstallPackageWhiteList( ):ArrayList<String>{
42
-            if (ModelNameUtils.IS_LianxX505f() ) {
41
+        fun getInstallPackageWhiteList(): ArrayList<String> {
42
+            if (ModelNameUtils.IS_LianxX505f()) {
43 43
                 return csdkManager?.installPackageWhiteList as ArrayList<String>
44 44
             }
45 45
             return arrayListOf()
@@ -228,9 +228,9 @@ class ManageApplication : MultiDexApplication() {
228 228
                 return csdkManager?.getDeviceInfo(type)
229 229
             }
230 230
             val serial = Build.SERIAL
231
-            return if (serial.isNullOrBlank()){
231
+            return if (serial.isNullOrBlank()) {
232 232
                 "0"
233
-            }else{
233
+            } else {
234 234
                 serial
235 235
             }
236 236
         }
@@ -275,11 +275,31 @@ class ManageApplication : MultiDexApplication() {
275 275
         /**
276 276
          * 启用无障碍服务
277 277
          */
278
-         fun enableAccessibility(){
278
+        fun enableAccessibility() {
279
+            if (ModelNameUtils.IS_LianxX505f()) {
280
+                //csdkManager?.enableAccessibility("com.xhly.manageapp","com.xhly.manageapp.service.TestService",true)
281
+            }
282
+        }
283
+
284
+        /**
285
+         * 禁用/启用截屏 true:允许截屏
286
+         */
287
+        fun enableCaptureScreen(enable: Boolean) {
288
+            if (ModelNameUtils.IS_LianxX505f()) {
289
+                csdkManager?.enableCaptureScreenV3(enable)
290
+            }
291
+        }
292
+
293
+        /**
294
+         * 禁止/允许 设置自动旋转屏幕 true:禁止设置自动旋转屏幕
295
+         */
296
+        fun disallowSetAutoRotation(enable: Boolean) {
279 297
             if (ModelNameUtils.IS_LianxX505f()) {
280
-               //csdkManager?.enableAccessibility("com.xhly.manageapp","com.xhly.manageapp.service.TestService",true)
298
+                csdkManager?.disallowSetAutoRotation(enable)
281 299
             }
282
-         }
300
+        }
301
+
302
+
283 303
     }
284 304
 
285 305
     override fun onCreate() {
@@ -290,10 +310,17 @@ class ManageApplication : MultiDexApplication() {
290 310
         if (ModelNameUtils.IS_LianxX505f()) {
291 311
             //是505f则执行
292 312
             csdkManager = CSDKManager(this)
293
-            addInstallPackageWhiteList(arrayListOf("com.xhly.manageapp","com.xhkjedu.xh_control_appstore"))
313
+            addInstallPackageWhiteList(
314
+                arrayListOf(
315
+                    "com.xhly.manageapp",
316
+                    "com.xhkjedu.xh_control_appstore"
317
+                )
318
+            )
294 319
             // disableInstallation(false)
295 320
             setRuntimePermissions(true)
296 321
             enableAccessibility()
322
+            enableCaptureScreen(false)
323
+            disallowSetAutoRotation(true)
297 324
         }
298 325
     }
299 326
 

Loading…
Cancel
Save