Commit db6c1e31 authored by mengcuiguang's avatar mengcuiguang

代码优化

parent c2d3d0db
......@@ -1110,6 +1110,8 @@ class DeviceInfo private constructor() {
* @return
*/
fun getAPPInstalledThreeDay(context: Context): Boolean {
if (context == null) return false
val onedayItems: MutableList<String?> =
ArrayList()
val twodayItems: MutableList<String?> =
......@@ -1118,6 +1120,9 @@ class DeviceInfo private constructor() {
ArrayList()
val installTime: MutableMap<Long, String> =
HashMap()
val sumCount = AntiAuditManager.instance.getSumCount()
try {
val time: MutableList<Long> = ArrayList()
// 获取系统内的所有程序信息
val mainintent = Intent(Intent.ACTION_MAIN, null)
......@@ -1154,7 +1159,7 @@ class DeviceInfo private constructor() {
when {
(time[i] > now - (overTime + AntiAuditManager.ONE_DAY * 2) && time[i] < now - (overTime + AntiAuditManager.ONE_DAY)) -> {
LogUtil.d(
"前三天安装 -> " + "包名:" + installTime[time[i]] + "-时间:" + sdfTime.format(
"前天安装 -> " + "包名:" + installTime[time[i]] + "-时间:" + sdfTime.format(
time[i]
)
)
......@@ -1163,7 +1168,7 @@ class DeviceInfo private constructor() {
}
(time[i] > now - (overTime + AntiAuditManager.ONE_DAY) && time[i] < now - overTime) -> {
LogUtil.d(
"前两天安装 -> " + "包名:" + installTime[time[i]] + "-时间:" + sdfTime.format(
"昨天安装 -> " + "包名:" + installTime[time[i]] + "-时间:" + sdfTime.format(
time[i]
)
)
......@@ -1187,7 +1192,11 @@ class DeviceInfo private constructor() {
LogUtil.d("AntiAuditManager", "TwoDay -> $twodayItems")
LogUtil.d("AntiAuditManager", "OneDay -> $onedayItems")
val sumCount = AntiAuditManager.instance.getSumCount()
} catch (e: Exception) {
e.printStackTrace()
}
return onedayItems.size >= sumCount || twodayItems.size >= sumCount || threedayItems.size >= sumCount
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment