Ver código fonte

1.修改EventBus事件触发位置。

master
wangwanlei 11 meses atrás
pai
commit
22527b587f

+ 0
- 49
app/src/main/java/com/xhly/manageapp/service/websocket/AppSocket.kt Ver arquivo

@@ -116,55 +116,6 @@ class AppSocket : SocketClient() {
116 116
                 ManageApplication.launchFactoryReset()
117 117
             }
118 118
 
119
-            Const.LOGAPPSTART -> {
120
-                val message = uiEvent.message
121
-                if (lastPkgName == message) {
122
-                    return
123
-                }
124
-                val filter = appList.filter { it.packageName == message }
125
-                if (filter.isNotEmpty()) {
126
-                    lastPkgName = message
127
-                    val data = LogdOperateBean()
128
-                    ManageApplication.getDeviceInfo()?.let {
129
-                        data.sn = it
130
-                    }
131
-                    data.appPackage = message
132
-                    data.doEvent = EventLog.STARTAPPEVENT
133
-                    eventLog(data)
134
-                }
135
-            }
136
-
137
-            Const.APPINSTALL -> {
138
-                val message = uiEvent.message
139
-                val data = LogdOperateBean()
140
-                ManageApplication.getDeviceInfo()?.let {
141
-                    data.sn = it
142
-                }
143
-                data.appPackage = message
144
-                data.comm = "应用安装"
145
-                data.doEvent = EventLog.APPINSTALLEVENT
146
-                eventLog(data)
147
-            }
148
-
149
-            Const.APPUNINSTALL -> {
150
-                val message = uiEvent.message
151
-                val data = LogdOperateBean()
152
-                ManageApplication.getDeviceInfo()?.let {
153
-                    data.sn = it
154
-                }
155
-                data.appPackage = message
156
-                data.comm = "应用卸载"
157
-                data.doEvent = EventLog.APPUNINSTALLEVENT
158
-                eventLog(data)
159
-            }
160
-
161
-            "10086" -> {
162
-                serviceScope.launch {
163
-                    logService.postLogdoperateAdd(LogdOperateBean())
164
-                }
165
-                Toast.makeText(context, "违规操作,安装未知应用", Toast.LENGTH_LONG).show()
166
-                goMainActivity()
167
-            }
168 119
         }
169 120
     }
170 121
 

+ 19
- 0
app/src/main/java/com/xhly/manageapp/ui/main/activity/MainActivity.kt Ver arquivo

@@ -41,6 +41,7 @@ import com.xhly.manageapp.bean.user.UserBean
41 41
 import com.xhly.manageapp.broadcastreceiver.AppInstallReceiver
42 42
 import com.xhly.manageapp.databinding.ActivityMainBinding
43 43
 import com.xhly.manageapp.service.ManageAccessibilityService
44
+import com.xhly.manageapp.service.websocket.AppSocket
44 45
 import com.xhly.manageapp.service.websocket.AppSocketService
45 46
 import com.xhly.manageapp.ui.ManageActivity
46 47
 import com.xhly.manageapp.ui.login.activity.LoginActivity
@@ -301,6 +302,24 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>() {
301 302
                 }
302 303
             }
303 304
 
305
+            Const.LOGAPPSTART -> {
306
+                val message = uiEvent.message
307
+                if (AppSocket.lastPkgName == message) {
308
+                    return
309
+                }
310
+                val filter = dataList.filter { it.packageName == message }
311
+                if (filter.isNotEmpty()) {
312
+                    AppSocket.lastPkgName = message
313
+                    val data = LogdOperateBean()
314
+                    ManageApplication.getDeviceInfo()?.let {
315
+                        data.sn = it
316
+                    }
317
+                    data.appPackage = message
318
+                    data.doEvent = EventLog.STARTAPPEVENT
319
+                    viewModel.eventLog(data)
320
+                }
321
+            }
322
+
304 323
             Const.APPINSTALL -> {
305 324
                 try {
306 325
                     dataList.clear()

+ 1
- 0
app/src/main/java/com/xhly/manageapp/utils/StrategyUtils.kt Ver arquivo

@@ -30,6 +30,7 @@ object StrategyUtils {
30 30
         }
31 31
         //是否开启应用策略
32 32
         if (strategyBean.hasapp == 1) {
33
+            //TODO 应用策略可能需要应用下载安装以及卸载
33 34
             //开启
34 35
             strategyBean.padApps?.let { appArray ->
35 36
                 val list = arrayListOf<String>()

Carregando…
Cancelar
Salvar