Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_flowbox
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
android
android_flowbox
Commits
6a25763a
Commit
6a25763a
authored
Jul 22, 2021
by
mengcuiguang2
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改反策略方式
parent
d1855fd2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
12 deletions
+18
-12
AntiAuditManager.kt
...com/mints/flowbox/keepalive/appswitch/AntiAuditManager.kt
+18
-12
No files found.
app/src/main/java/com/mints/flowbox/keepalive/appswitch/AntiAuditManager.kt
View file @
6a25763a
...
...
@@ -4,8 +4,11 @@ import android.content.Context
import
android.content.Intent
import
android.content.pm.ApplicationInfo
import
android.content.pm.PackageInfo
import
android.text.format.DateUtils
import
com.mints.flowbox.MintsApplication
import
com.mints.flowbox.manager.AppPreferencesManager
import
com.mints.flowbox.manager.TrackManager
import
com.mints.flowbox.manager.wifi.WifiDataManager
import
com.mints.flowbox.utils.LogUtil
import
com.mints.flowbox.utils.rxutil.CommonRxTask
import
com.mints.flowbox.utils.rxutil.RxjavaUtil
...
...
@@ -24,32 +27,36 @@ class AntiAuditManager private constructor() {
companion
object
{
private
const
val
ONE_DAY
=
60
*
1000
*
60
*
24
private
const
val
ONE_DAY
=
60
*
1000
*
60
*
24
// 一天
private
const
val
N
=
12
// (阈值)
const
val
APP_OUT_BLACK
=
"APP_OUT_BLACK"
const
val
TODAY_INSTALL_APK_COUNT
=
"TODAY_INSTALL_APK_COUNT"
const
val
APP_OUT_BLACK
=
"APP_OUT_BLACK"
// 是否永久黑名单
const
val
TODAY_INSTALL_APK_COUNT
=
"TODAY_INSTALL_APK_COUNT"
// 安装个数
val
instance
:
AntiAuditManager
by
lazy
(
mode
=
LazyThreadSafetyMode
.
SYNCHRONIZED
)
{
AntiAuditManager
()
}
private
var
todayInstallApkCount
=
-
1
}
val
sp
by
lazy
{
AppPreferencesManager
.
get
()
}
/**
* 更新新安装的apk个数
*/
fun
updateInstallApkCount
()
{
if
(
todayInstallApkCount
==
-
1
)
{
todayInstallApkCount
=
sp
.
getInt
(
TODAY_INSTALL_APK_COUNT
,
0
)
}
todayInstallApkCount
++
if
(
todayInstallApkCount
>=
N
)
{
val
count
=
sp
.
getInt
(
TODAY_INSTALL_APK_COUNT
,
0
)
val
sumCount
=
count
+
1
sp
.
put
(
TODAY_INSTALL_APK_COUNT
,
sumCount
)
if
(
sumCount
>=
N
)
{
sp
.
put
(
APP_OUT_BLACK
,
true
)
}
}
/**
* 获取所有以安装列表,除系统应用,归类到自然日
*/
fun
antiAudit
()
{
RxjavaUtil
.
executeRxTask
(
object
:
CommonRxTask
<
Boolean
>()
{
override
fun
doInIOThread
()
{
...
...
@@ -130,8 +137,8 @@ class AntiAuditManager private constructor() {
}
}
}
sp
.
put
(
TODAY_INSTALL_APK_COUNT
,
onedayItems
.
size
)
val
localApkCount
=
sp
.
getInt
(
TODAY_INSTALL_APK_COUNT
,
0
)
sp
.
put
(
TODAY_INSTALL_APK_COUNT
,
if
(
localApkCount
>
onedayItems
.
size
)
localApkCount
else
onedayItems
.
size
)
LogUtil
.
d
(
TAG
,
"ThreeDay -> $threedayItems"
)
LogUtil
.
d
(
TAG
,
"TwoDay -> $twodayItems"
)
...
...
@@ -139,5 +146,4 @@ class AntiAuditManager private constructor() {
return
onedayItems
.
size
>=
N
&&
twodayItems
.
size
>=
N
&&
threedayItems
.
size
>=
N
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment