浏览代码

1.添加设备重启和恢复出场设置方法

master
wangwanlei 9 个月前
父节点
当前提交
15d2a3dc92

+ 20
- 1
app/src/main/java/com/xhly/manageapp/ManageApplication.kt 查看文件

@@ -194,6 +194,25 @@ class ManageApplication : MultiDexApplication() {
194 194
             }
195 195
             return "0"
196 196
         }
197
+
198
+        /**
199
+         * 恢复出场设置
200
+         */
201
+        fun launchFactoryReset() {
202
+            if (ModelNameUtils.IS_LianxX505f()) {
203
+                csdkManager?.launchFactoryReset()
204
+            }
205
+        }
206
+
207
+        /**
208
+         *重启设备
209
+         */
210
+
211
+        fun rebootDevice() {
212
+            if (ModelNameUtils.IS_LianxX505f()) {
213
+                csdkManager?.rebootDevice()
214
+            }
215
+        }
197 216
     }
198 217
 
199 218
     override fun onCreate() {
@@ -203,7 +222,7 @@ class ManageApplication : MultiDexApplication() {
203 222
             //是505f则执行
204 223
             csdkManager = CSDKManager(this)
205 224
             addInstallPackageWhiteList(arrayListOf("com.xhly.manageapp"))
206
-            disableInstallation(false)
225
+            // disableInstallation(false)
207 226
             setRuntimePermissions(true)
208 227
         }
209 228
     }

+ 7
- 11
app/src/main/java/com/xhly/manageapp/service/websocket/AppSocketService.kt 查看文件

@@ -62,7 +62,6 @@ open class AppSocketService : LongConnService() {
62 62
         super.onCreate()
63 63
         EventBus.getDefault().register(this)
64 64
         connectUrl = Const.WSURL
65
-        /*   csdkManager = CSDKManager(this)*/
66 65
         /* startNotification()*/
67 66
         LogShow("已经创建")
68 67
         appList = AppUtils.GetAppList(this) as ArrayList<AppInfo>
@@ -91,9 +90,6 @@ open class AppSocketService : LongConnService() {
91 90
 
92 91
     @Subscribe(threadMode = ThreadMode.MAIN)
93 92
     fun onUiEvent(uiEvent: UIEvent) {
94
-        /* if (csdkManager == null) {
95
-             csdkManager = CSDKManager(this)
96
-         }*/
97 93
         when (uiEvent.event) {
98 94
             Const.CODE2001.toString() -> {
99 95
                 Toast.makeText(this, "这就是新消息", Toast.LENGTH_LONG).show()
@@ -106,11 +102,11 @@ open class AppSocketService : LongConnService() {
106 102
             }
107 103
 
108 104
             Const.CODE2005.toString() -> {
109
-                //csdkManager?.rebootDevice()
105
+                ManageApplication.rebootDevice()
110 106
             }
111 107
 
112 108
             Const.CODE2006.toString() -> {
113
-                //csdkManager?.launchFactoryReset()
109
+                ManageApplication.launchFactoryReset()
114 110
             }
115 111
 
116 112
             Const.LOGAPPSTART -> {
@@ -138,7 +134,7 @@ open class AppSocketService : LongConnService() {
138 134
                     ManageApplication.getDeviceInfo()?.let {
139 135
                         data.sn = it
140 136
                     }
141
-                    data.appPackage=message
137
+                    data.appPackage = message
142 138
                     data.doEvent = EventLog.STARTAPPEVENT
143 139
                     eventLog(data)
144 140
                 }
@@ -150,8 +146,8 @@ open class AppSocketService : LongConnService() {
150 146
                 ManageApplication.getDeviceInfo()?.let {
151 147
                     data.sn = it
152 148
                 }
153
-                data.appPackage=message
154
-                data.comm="应用安装"
149
+                data.appPackage = message
150
+                data.comm = "应用安装"
155 151
                 data.doEvent = EventLog.APPINSTALLEVENT
156 152
                 eventLog(data)
157 153
             }
@@ -162,8 +158,8 @@ open class AppSocketService : LongConnService() {
162 158
                 ManageApplication.getDeviceInfo()?.let {
163 159
                     data.sn = it
164 160
                 }
165
-                data.appPackage=message
166
-                data.comm="应用卸载"
161
+                data.appPackage = message
162
+                data.comm = "应用卸载"
167 163
                 data.doEvent = EventLog.APPUNINSTALLEVENT
168 164
                 eventLog(data)
169 165
             }

+ 4
- 1
websocket/src/main/java/com/xhly/websocket/utils/SocketPushUtils.kt 查看文件

@@ -25,19 +25,22 @@ object SocketPushUtils {
25 25
 
26 26
                     Const.CODE2002 -> {
27 27
                         //限制使用
28
+                        UIEvent(Const.CODE2002.toString()).post()
28 29
                     }
29 30
 
30 31
                     Const.CODE2003 -> {
31 32
                         //解除限制
32
-
33
+                        UIEvent(Const.CODE2003.toString()).post()
33 34
                     }
34 35
 
35 36
                     Const.CODE2004 -> {
36 37
                         //更新策略
38
+                        UIEvent(Const.CODE2004.toString()).post()
37 39
                     }
38 40
 
39 41
                     Const.CODE2005 -> {
40 42
                         //重启设备
43
+                        UIEvent(Const.CODE2005.toString()).post()
41 44
                     }
42 45
 
43 46
                     Const.CODE2006 -> {

正在加载...
取消
保存