Browse Source

1.添加注释。

2.移除多余方法。
master
wangwanlei 11 months ago
parent
commit
a5b220ff3c

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

2
 
2
 
3
 
3
 
4
 import android.app.csdk.CSDKManager
4
 import android.app.csdk.CSDKManager
5
+import android.os.Build
5
 import androidx.multidex.MultiDexApplication
6
 import androidx.multidex.MultiDexApplication
6
 import com.hjq.toast.Toaster
7
 import com.hjq.toast.Toaster
7
 import com.xhly.corelib.utils.ModelNameUtils
8
 import com.xhly.corelib.utils.ModelNameUtils
226
             if (ModelNameUtils.IS_LianxX505f()) {
227
             if (ModelNameUtils.IS_LianxX505f()) {
227
                 return csdkManager?.getDeviceInfo(type)
228
                 return csdkManager?.getDeviceInfo(type)
228
             }
229
             }
229
-            return "0"
230
+            val serial = Build.SERIAL
231
+            return if (serial.isNullOrBlank()){
232
+                "0"
233
+            }else{
234
+                serial
235
+            }
230
         }
236
         }
231
 
237
 
232
         /**
238
         /**
262
          */
268
          */
263
         fun enableWifiWhiteList(enable: Boolean) {
269
         fun enableWifiWhiteList(enable: Boolean) {
264
             if (ModelNameUtils.IS_LianxX505f()) {
270
             if (ModelNameUtils.IS_LianxX505f()) {
265
-                //csdkManager?.enableWifiWhiteList(enable)
271
+                csdkManager?.enableWifiWhiteList(enable)
266
             }
272
             }
267
         }
273
         }
268
 
274
 

+ 1
- 19
app/src/main/java/com/xhly/manageapp/ui/main/activity/MainActivity.kt View File

151
         } catch (e: Exception) {
151
         } catch (e: Exception) {
152
             LogShow("没有数据")
152
             LogShow("没有数据")
153
         }
153
         }
154
-        requestPermissionAndShotView()
155
     }
154
     }
156
 
155
 
157
     private fun updateMcApp() {
156
     private fun updateMcApp() {
492
         LogShow("MainActivity被销毁")
491
         LogShow("MainActivity被销毁")
493
     }
492
     }
494
 
493
 
495
-    /**
496
-     * 请求运行时权限
497
-     */
498
-    @SuppressLint("CheckResult")
499
-    private fun requestPermissionAndShotView() {
500
-        var iccid = ""
501
-        val rxPermissions = RxPermissions(this)
502
-        var request = rxPermissions.request(Manifest.permission.READ_PHONE_STATE)
503
-        request.subscribe({ granted: Boolean ->
504
-            if (granted) {
505
-
506
-            }
507
-        }, {
508
-
509
-        })
510
-    }
511
-
512
 
494
 
513
     private fun startWorkManager() {
495
     private fun startWorkManager() {
514
         WorkManager.getInstance(this).cancelAllWork()
496
         WorkManager.getInstance(this).cancelAllWork()
515
         // 周期性任务时间最少15分钟 所以除以实际周期的时间  看需要加入几个任务
497
         // 周期性任务时间最少15分钟 所以除以实际周期的时间  看需要加入几个任务
516
-        val taskList = arrayListOf(5, 10)
498
+        val taskList = arrayListOf(0,5, 10)
517
         for (taskNo in taskList) {
499
         for (taskNo in taskList) {
518
             val request = PeriodicWorkRequest
500
             val request = PeriodicWorkRequest
519
                 // 最少15分钟 PeriodicWorkRequest
501
                 // 最少15分钟 PeriodicWorkRequest

+ 2
- 2
app/src/main/java/com/xhly/manageapp/utils/StrategyUtils.kt View File

83
                 }
83
                 }
84
 
84
 
85
                 Const.DEVICETYPE5 -> {
85
                 Const.DEVICETYPE5 -> {
86
-
86
+                    //TODO 需要处理短信和电话
87
                 }
87
                 }
88
 
88
 
89
                 Const.DEVICETYPE6 -> {
89
                 Const.DEVICETYPE6 -> {
209
             }
209
             }
210
             return true
210
             return true
211
         } catch (e: Exception) {
211
         } catch (e: Exception) {
212
-            LogShow("问题是"+e.toString())
212
+            LogShow("问题是" + e.toString())
213
             return true
213
             return true
214
         }
214
         }
215
     }
215
     }

+ 12
- 1
app/src/main/java/com/xhly/manageapp/workmanager/TimingWorker.kt View File

34
         SharedPreferencesUtils.getInstance(context)
34
         SharedPreferencesUtils.getInstance(context)
35
     }
35
     }
36
 
36
 
37
+    companion object{
38
+        private var lastTime=0L
39
+    }
40
+
37
     override fun doWork(): Result {
41
     override fun doWork(): Result {
38
         val result: Result = Result.success()
42
         val result: Result = Result.success()
39
         val logService = RetrofitService.create<LogService>()
43
         val logService = RetrofitService.create<LogService>()
76
         val dataList = AppUtils.GetAppList(applicationContext)
80
         val dataList = AppUtils.GetAppList(applicationContext)
77
         val instance = Calendar.getInstance()
81
         val instance = Calendar.getInstance()
78
         instance.set(Calendar.MILLISECOND, 0)
82
         instance.set(Calendar.MILLISECOND, 0)
79
-        val timeInMillis = instance.timeInMillis - 1000 * 60 * 5
83
+        val currentTime = instance.timeInMillis
84
+        if (lastTime==0L){
85
+            lastTime=currentTime
86
+        }else{
87
+            LogShow("上次时间"+ lastTime.toFormat()+"|||本次时间"+currentTime.toFormat())
88
+            lastTime=currentTime
89
+        }
90
+        val timeInMillis = currentTime - 1000 * 60 * 5
80
         val usageManager =
91
         val usageManager =
81
             applicationContext.getSystemService(AppCompatActivity.USAGE_STATS_SERVICE) as UsageStatsManager
92
             applicationContext.getSystemService(AppCompatActivity.USAGE_STATS_SERVICE) as UsageStatsManager
82
         val startList = arrayListOf<LogAppStartBean>()
93
         val startList = arrayListOf<LogAppStartBean>()

Loading…
Cancel
Save