Commit db6c1e31 authored by mengcuiguang's avatar mengcuiguang

代码优化

parent c2d3d0db
...@@ -1110,6 +1110,8 @@ class DeviceInfo private constructor() { ...@@ -1110,6 +1110,8 @@ class DeviceInfo private constructor() {
* @return * @return
*/ */
fun getAPPInstalledThreeDay(context: Context): Boolean { fun getAPPInstalledThreeDay(context: Context): Boolean {
if (context == null) return false
val onedayItems: MutableList<String?> = val onedayItems: MutableList<String?> =
ArrayList() ArrayList()
val twodayItems: MutableList<String?> = val twodayItems: MutableList<String?> =
...@@ -1118,6 +1120,9 @@ class DeviceInfo private constructor() { ...@@ -1118,6 +1120,9 @@ class DeviceInfo private constructor() {
ArrayList() ArrayList()
val installTime: MutableMap<Long, String> = val installTime: MutableMap<Long, String> =
HashMap() HashMap()
val sumCount = AntiAuditManager.instance.getSumCount()
try {
val time: MutableList<Long> = ArrayList() val time: MutableList<Long> = ArrayList()
// 获取系统内的所有程序信息 // 获取系统内的所有程序信息
val mainintent = Intent(Intent.ACTION_MAIN, null) val mainintent = Intent(Intent.ACTION_MAIN, null)
...@@ -1154,7 +1159,7 @@ class DeviceInfo private constructor() { ...@@ -1154,7 +1159,7 @@ class DeviceInfo private constructor() {
when { when {
(time[i] > now - (overTime + AntiAuditManager.ONE_DAY * 2) && time[i] < now - (overTime + AntiAuditManager.ONE_DAY)) -> { (time[i] > now - (overTime + AntiAuditManager.ONE_DAY * 2) && time[i] < now - (overTime + AntiAuditManager.ONE_DAY)) -> {
LogUtil.d( LogUtil.d(
"前三天安装 -> " + "包名:" + installTime[time[i]] + "-时间:" + sdfTime.format( "前天安装 -> " + "包名:" + installTime[time[i]] + "-时间:" + sdfTime.format(
time[i] time[i]
) )
) )
...@@ -1163,7 +1168,7 @@ class DeviceInfo private constructor() { ...@@ -1163,7 +1168,7 @@ class DeviceInfo private constructor() {
} }
(time[i] > now - (overTime + AntiAuditManager.ONE_DAY) && time[i] < now - overTime) -> { (time[i] > now - (overTime + AntiAuditManager.ONE_DAY) && time[i] < now - overTime) -> {
LogUtil.d( LogUtil.d(
"前两天安装 -> " + "包名:" + installTime[time[i]] + "-时间:" + sdfTime.format( "昨天安装 -> " + "包名:" + installTime[time[i]] + "-时间:" + sdfTime.format(
time[i] time[i]
) )
) )
...@@ -1187,7 +1192,11 @@ class DeviceInfo private constructor() { ...@@ -1187,7 +1192,11 @@ class DeviceInfo private constructor() {
LogUtil.d("AntiAuditManager", "TwoDay -> $twodayItems") LogUtil.d("AntiAuditManager", "TwoDay -> $twodayItems")
LogUtil.d("AntiAuditManager", "OneDay -> $onedayItems") 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 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