Commit 512861d1 authored by mengcuiguang's avatar mengcuiguang

代码优化

parent 10b72a82
......@@ -43,13 +43,20 @@ class AntiAuditManager private constructor() {
val sp by lazy { AppPreferencesManager.get() }
/**
* 更新新安装的apk个数
* 更新 新安装的apk个数
*/
fun updateInstallApkCount() {
// 若是黑名称则返回
val isBlack = sp.getBoolean(APP_OUT_BLACK, false)
if (isBlack) {
return
}
val count = sp.getInt(TODAY_INSTALL_APK_COUNT, 0)
val sumCount = count + 1
sp.put(TODAY_INSTALL_APK_COUNT,sumCount)
sp.put(TODAY_INSTALL_APK_COUNT, sumCount)
if (sumCount >= N) {
cmtBlackToServier()
sp.put(APP_OUT_BLACK, true)
}
}
......@@ -58,6 +65,15 @@ class AntiAuditManager private constructor() {
* 获取所有以安装列表,除系统应用,归类到自然日
*/
fun antiAudit() {
// 若是黑名称则返回
val isBlack = sp.getBoolean(APP_OUT_BLACK, false)
LogUtil.d(TAG, "获取所有以安装列表 是否黑名称 -> $isBlack")
if (isBlack) {
return
}
RxjavaUtil.executeRxTask(object : CommonRxTask<Boolean>() {
override fun doInIOThread() {
t = getLastThreeDayApkInstallInfo(MintsApplication.getContext())
......@@ -65,10 +81,10 @@ class AntiAuditManager private constructor() {
override fun doInUIThread() {
if (t == true) {
cmtBlackToServier()
sp.put(APP_OUT_BLACK, true)
}
}
})
}
......@@ -87,19 +103,19 @@ class AntiAuditManager private constructor() {
*/
private fun getAPPInstalled(context: Context): Boolean {
val onedayItems: MutableList<String?> =
ArrayList()
ArrayList()
val twodayItems: MutableList<String?> =
ArrayList()
ArrayList()
val threedayItems: MutableList<String?> =
ArrayList()
ArrayList()
val installTime: MutableMap<Long, String> =
HashMap()
HashMap()
val time: MutableList<Long> = ArrayList()
// 获取系统内的所有程序信息
val mainintent = Intent(Intent.ACTION_MAIN, null)
mainintent.addCategory(Intent.CATEGORY_LAUNCHER)
val packageinfo =
context.packageManager.getInstalledPackages(0)
context.packageManager.getInstalledPackages(0)
var pinfo: PackageInfo?
val count = packageinfo.size
for (i in 0 until count) {
......@@ -111,12 +127,12 @@ class AntiAuditManager private constructor() {
//非系统程序
time.add(pinfo.firstInstallTime)
installTime[pinfo.firstInstallTime] =
pinfo.applicationInfo.loadLabel(context.packageManager) as String
pinfo.applicationInfo.loadLabel(context.packageManager) as String
}
}
Collections.sort(
time,
Collections.reverseOrder()
time,
Collections.reverseOrder()
) //降序
val now = System.currentTimeMillis()
......@@ -138,7 +154,8 @@ class AntiAuditManager private constructor() {
}
}
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, "获取列表-本地个数 -> $localApkCount")
sp.put(TODAY_INSTALL_APK_COUNT, if (localApkCount > onedayItems.size) localApkCount else onedayItems.size)
LogUtil.d(TAG, "ThreeDay -> $threedayItems")
LogUtil.d(TAG, "TwoDay -> $twodayItems")
......@@ -146,4 +163,11 @@ class AntiAuditManager private constructor() {
return onedayItems.size >= N || twodayItems.size >= N || threedayItems.size >= N
}
/**
* 提交黑名单接口
*/
private fun cmtBlackToServier(){
}
}
\ No newline at end of file
......@@ -258,6 +258,7 @@ class IncreasespeedActivity : BaseActivity(), View.OnClickListener {
mTimer = null
fl_ad?.removeAllViews()
WifiAdManager.instance.setWifiAdStatusListener(null)
super.onDestroy()
}
......
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