Browse Source

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

master
wangwanlei 9 months ago
parent
commit
15d2a3dc92

+ 20
- 1
app/src/main/java/com/xhly/manageapp/ManageApplication.kt View File

194
             }
194
             }
195
             return "0"
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
     override fun onCreate() {
218
     override fun onCreate() {
203
             //是505f则执行
222
             //是505f则执行
204
             csdkManager = CSDKManager(this)
223
             csdkManager = CSDKManager(this)
205
             addInstallPackageWhiteList(arrayListOf("com.xhly.manageapp"))
224
             addInstallPackageWhiteList(arrayListOf("com.xhly.manageapp"))
206
-            disableInstallation(false)
225
+            // disableInstallation(false)
207
             setRuntimePermissions(true)
226
             setRuntimePermissions(true)
208
         }
227
         }
209
     }
228
     }

+ 7
- 11
app/src/main/java/com/xhly/manageapp/service/websocket/AppSocketService.kt View File

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

+ 4
- 1
websocket/src/main/java/com/xhly/websocket/utils/SocketPushUtils.kt View File

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

Loading…
Cancel
Save