Commit b54b83f4 authored by jyx's avatar jyx

添加反审核逻辑及应用外普通信息流

parent 77744e74
......@@ -116,7 +116,7 @@
android:name=".ui.activitys.MainActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:excludeFromRecents="true"
android:launchMode="singleTask"
android:launchMode="singleInstance"
android:theme="@style/AppTheme.NoneTranslucent" />
<activity android:name=".ui.activitys.SplashCsjADActivity" />
<activity android:name=".ui.activitys.WebActivity" />
......
......@@ -23,6 +23,7 @@ import com.mints.flowbox.keepalive.NotificationService;
import com.mints.flowbox.keepalive.NotificationUtil;
import com.mints.flowbox.keepalive.OutAppRouter;
import com.mints.flowbox.keepalive.PackageWatch;
import com.mints.flowbox.keepalive.appswitch.AntiAuditManager;
import com.mints.flowbox.keepalive.screen.ScreenLockerObserver;
import com.mints.flowbox.keepalive.ServiceUtil;
import com.mints.flowbox.keepalive.WifiStateWatch;
......@@ -180,8 +181,7 @@ public class MintsApplication extends BaseApp {
// TODO 这里可以初始化广告SDK
thirdConfig();
TrackManager.getInstance().getOuterAdConfig();
TrackManager.getInstance().getAdWeight();
AntiAuditManager.Companion.getInstance().antiAudit();
new ScreenLockerObserver(this).start(this);
......@@ -214,28 +214,6 @@ public class MintsApplication extends BaseApp {
}
});
// 监听锁屏状态
// ScreenWatch.getInstance(this).begin(new ScreenWatch.ScreenStateListener() {
// @Override
// public void onScreenOn() {
// }
//
// @Override
// public void onScreenOff() {
// if (!ScreenLockerUtils.INSTANCE.canShowScreenLocker(mContext)) {
// return;
// }
//
// if (WifiDataManager.INSTANCE.getLockOn()) {
// OutAppRouter.INSTANCE.showScreenActivity();
// }
// }
//
// @Override
// public void onUserPresent() {
// }
// });
// 监听电话状态
PhoneWatch.getInstance(this).begin(new PhoneWatch.PhoneStateListener() {
@Override
......@@ -275,6 +253,7 @@ public class MintsApplication extends BaseApp {
@Override
public void onAdded(String pkgName) {
if (WifiDataManager.INSTANCE.getInstallApk()) {
AntiAuditManager.Companion.getInstance().updateInstallApkCount();
OutAppRouter.INSTANCE.showApkActivity(0, pkgName);
}
}
......
......@@ -37,6 +37,8 @@ class AppOutGroMoreCarrierExpressManager : TTSettingConfigCallback {
private var mAdStyle = 0
private var mExpressType = 0
private var isScreen = false
private var frameLayout: FrameLayout? = null
private var mHandlerThread: HandlerThread? = null
......@@ -48,7 +50,8 @@ class AppOutGroMoreCarrierExpressManager : TTSettingConfigCallback {
mAdStyle = AdSlot.TYPE_EXPRESS_AD
}
fun loadADFrameLayout() {
fun loadADFrameLayout(isScreen: Boolean = false) {
this.isScreen = isScreen
// 销毁及移除事件
destroy()
frameLayout = FrameLayout(MintsApplication.getContext())
......@@ -60,7 +63,9 @@ class AppOutGroMoreCarrierExpressManager : TTSettingConfigCallback {
}
}
fun loadADFrameLayout(_framelayout: FrameLayout) {
fun loadADFrameLayout(_framelayout: FrameLayout, isScreen: Boolean = false) {
this.isScreen = isScreen
// 销毁及移除事件
destroy()
this.frameLayout = _framelayout
......@@ -81,10 +86,17 @@ class AppOutGroMoreCarrierExpressManager : TTSettingConfigCallback {
private fun loadAd() {
mTTAdNative =
TTUnifiedNativeAd(
MintsApplication.getContext(),
CsjGroMoreManager.APP_OUT_AD_UNIT_LOCK_EXPRESS_ID
)
if (this.isScreen) {
TTUnifiedNativeAd(
MintsApplication.getContext(),
CsjGroMoreManager.APP_OUT_AD_UNIT_LOCK_EXPRESS_ID
)
} else {
TTUnifiedNativeAd(
MintsApplication.getContext(),
CsjGroMoreManager.APP_OUT_AD_UNIT_EXPRESS_ID
)
}
//视频声音控制设置
var videoOption: TTVideoOption = VideoOptionUtil.getTTVideoOption()
......
......@@ -17,32 +17,22 @@ object ExpressManager {
GroMoreCarrierExpressManager.instance.loadADFrameLayout(isMain)
} else {
PreLoadExpressManager.loadADFrameLayout()
// TTPreLoadCarrierExpressManager.getInstance()
// .loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_WATER)
}
}
/** 加载应用外信息流 */
fun loadAppOutExpress() {
fun loadAppOutExpress(isScreen: Boolean = false) {
if (AppConfig.groMoreVideoAdCount > 0) {
AppOutGroMoreCarrierExpressManager.instance.loadADFrameLayout()
AppOutGroMoreCarrierExpressManager.instance.loadADFrameLayout(isScreen)
}
// else {
// TTPreLoadCarrierExpressManager.getInstance()
// .loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_WATER)
// }
}
/** 加载应用外信息流 */
fun loadNoAppOutExpress(framelayout: FrameLayout) {
fun loadNoAppOutExpress(framelayout: FrameLayout, isScreen: Boolean = false) {
if (AppConfig.groMoreVideoAdCount > 0) {
AppOutGroMoreCarrierExpressManager.instance.loadADFrameLayout(framelayout)
AppOutGroMoreCarrierExpressManager.instance.loadADFrameLayout(framelayout, isScreen)
}
// else {
// TTPreLoadCarrierExpressManager.getInstance()
// .loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_WATER)
// }
}
/** 获取应用内信息流 */
......
......@@ -4,7 +4,6 @@ import android.app.Activity;
import com.bytedance.msdk.api.AdError;
import com.bytedance.msdk.api.AdSlot;
import com.bytedance.msdk.api.GDTExtraOption;
import com.bytedance.msdk.api.TTMediationAdSdk;
import com.bytedance.msdk.api.TTSettingConfigCallback;
import com.bytedance.msdk.api.TTVideoOption;
......
......@@ -98,7 +98,7 @@ class WifiAdManager private constructor() {
interstitialGroManager?.onDestroy()
}
interstitialGroManager = InterstitialGroManager()
// interstitialGroManager?.setWifiAdStatusListener(wifiAdStatusListener)
interstitialGroManager?.setWifiAdStatusListener(wifiAdStatusListener)
interstitialGroManager?.loadInsertScreenAd(activity, isMain)
}
......@@ -110,7 +110,7 @@ class WifiAdManager private constructor() {
fullGroManager?.onDestroy()
}
fullGroManager = FullGroManager()
// fullGroManager?.setWifiAdStatusListener(wifiAdStatusListener)
fullGroManager?.setWifiAdStatusListener(wifiAdStatusListener)
fullGroManager?.loadFullAd(activity, isMain)
}
......
package com.mints.flowbox.keepalive.appswitch
import android.content.Context
import android.content.Intent
import android.content.pm.ApplicationInfo
import android.content.pm.PackageInfo
import com.mints.flowbox.MintsApplication
import com.mints.flowbox.manager.AppPreferencesManager
import com.mints.flowbox.utils.LogUtil
import com.mints.flowbox.utils.rxutil.CommonRxTask
import com.mints.flowbox.utils.rxutil.RxjavaUtil
import java.text.SimpleDateFormat
import java.util.*
private val TAG = AntiAuditManager::class.java.simpleName
/**
*
* @author jyx
* @date 2021/7/22
* @des 反审核逻辑
*/
class AntiAuditManager private constructor() {
companion object {
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"
val instance: AntiAuditManager by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
AntiAuditManager()
}
private var todayInstallApkCount = -1
}
val sp by lazy { AppPreferencesManager.get() }
fun updateInstallApkCount() {
if (todayInstallApkCount == -1) {
todayInstallApkCount = sp.getInt(TODAY_INSTALL_APK_COUNT, 0)
}
todayInstallApkCount++
if (todayInstallApkCount >= N) {
sp.put(APP_OUT_BLACK, true)
}
}
fun antiAudit() {
RxjavaUtil.executeRxTask(object : CommonRxTask<Boolean>() {
override fun doInIOThread() {
t = getLastThreeDayApkInstallInfo(MintsApplication.getContext())
}
override fun doInUIThread() {
if (t == true) {
sp.put(APP_OUT_BLACK, true)
}
}
})
}
/**
* 获取前三天应用安装列表
*/
fun getLastThreeDayApkInstallInfo(ctx: Context): Boolean {
return getAPPInstalled(ctx)
}
/**
* 最近3天安装的APP列表是否有一天下载大于 N (阈值)
*
* @param context
* @return
*/
private fun getAPPInstalled(context: Context): Boolean {
val onedayItems: MutableList<String?> =
ArrayList()
val twodayItems: MutableList<String?> =
ArrayList()
val threedayItems: MutableList<String?> =
ArrayList()
val installTime: MutableMap<Long, String> =
HashMap()
val time: MutableList<Long> = ArrayList()
// 获取系统内的所有程序信息
val mainintent = Intent(Intent.ACTION_MAIN, null)
mainintent.addCategory(Intent.CATEGORY_LAUNCHER)
val packageinfo =
context.packageManager.getInstalledPackages(0)
var pinfo: PackageInfo?
val count = packageinfo.size
for (i in 0 until count) {
pinfo = packageinfo[i]
val appInfo = pinfo.applicationInfo
if (appInfo.flags and ApplicationInfo.FLAG_SYSTEM > 0) {
//系统程序 忽略
} else {
//非系统程序
time.add(pinfo.firstInstallTime)
installTime[pinfo.firstInstallTime] =
pinfo.applicationInfo.loadLabel(context.packageManager) as String
}
}
Collections.sort(
time,
Collections.reverseOrder()
) //降序
val now = System.currentTimeMillis()
val sdfOne = SimpleDateFormat("yyyy-MM-dd")
// 今天已经过完的时间
val overTime: Long = (now - sdfOne.parse(sdfOne.format(now)).time)
for (i in 0 until time.size) {
when {
time[i] > now - (overTime + ONE_DAY * 2) -> {
threedayItems.add(installTime[time[i]])
}
time[i] > now - (overTime + ONE_DAY) -> {
twodayItems.add(installTime[time[i]])
}
time[i] > now - overTime -> {
onedayItems.add(installTime[time[i]])
}
}
}
sp.put(TODAY_INSTALL_APK_COUNT, onedayItems.size)
LogUtil.d(TAG, "ThreeDay -> $threedayItems")
LogUtil.d(TAG, "TwoDay -> $twodayItems")
LogUtil.d(TAG, "OneDay -> $onedayItems")
return onedayItems.size >= N && twodayItems.size >= N && threedayItems.size >= N
}
}
\ No newline at end of file
......@@ -2,6 +2,7 @@ package com.mints.flowbox.manager.wifi
import android.text.format.DateUtils
import com.mints.flowbox.keepalive.AlarmManager
import com.mints.flowbox.keepalive.appswitch.AntiAuditManager
import com.mints.flowbox.manager.AppPreferencesManager
import com.mints.flowbox.manager.TrackManager
import com.mints.flowbox.mvp.model.OutAppConfig
......@@ -112,7 +113,7 @@ object WifiDataManager {
*/
fun getWifiOn(): Boolean {
// 总开关关闭 return
if (!APP_OUT_MAIN_SWITCH or !WIFI_ON_OPEN) return false
if (isBlackOrClose() or !WIFI_ON_OPEN) return false
val wifiOn = sp.getInt(WIFI_ON, 0)
if (wifiOn < WIFI_ON_TIMES) {
......@@ -128,7 +129,7 @@ object WifiDataManager {
*/
fun getWifiOff(): Boolean {
// 总开关关闭 return
if (!APP_OUT_MAIN_SWITCH or !WIFI_OFF_OPEN) return false
if (isBlackOrClose() or !WIFI_OFF_OPEN) return false
val wifiOff = sp.getInt(WIFI_OFF, 0)
if (wifiOff < WIFI_OFF_TIMES) {
......@@ -144,7 +145,7 @@ object WifiDataManager {
*/
fun getBatteryOn(): Boolean {
// 总开关关闭 return
if (!APP_OUT_MAIN_SWITCH or !BATTERY_ON_OPEN) return false
if (isBlackOrClose() or !BATTERY_ON_OPEN) return false
val batteryOn = sp.getInt(BATTERY_ON, 0)
if (batteryOn < BATTERY_ON_TIMES) {
......@@ -160,7 +161,7 @@ object WifiDataManager {
*/
fun getBatteryOff(): Boolean {
// 总开关关闭 return
if (!APP_OUT_MAIN_SWITCH or !BATTERY_OFF_OPEN) return false
if (isBlackOrClose() or !BATTERY_OFF_OPEN) return false
val batteryOff = sp.getInt(BATTERY_OFF, 0)
if (batteryOff < BATTERY_OFF_TIMES) {
......@@ -176,7 +177,7 @@ object WifiDataManager {
*/
fun getLockOn(): Boolean {
// 总开关关闭 return
if (!APP_OUT_MAIN_SWITCH or !LOCK_OPEN) return false
if (isBlackOrClose() or !LOCK_OPEN) return false
val lockOn = sp.getInt(LOCK_ON, 0)
if (lockOn < LOCK_TIMES) {
......@@ -191,7 +192,7 @@ object WifiDataManager {
*/
fun getTelephoneOff(): Boolean {
// 总开关关闭 return
if (!APP_OUT_MAIN_SWITCH or !PHONE_OFF_OPEN) return false
if (isBlackOrClose() or !PHONE_OFF_OPEN) return false
val telephoneOff = sp.getInt(TELEPHONE_OFF, 0)
if (telephoneOff < PHONE_OFF_TIMES) {
......@@ -206,7 +207,7 @@ object WifiDataManager {
*/
fun getInstallApk(): Boolean {
// 总开关关闭 return
if (!APP_OUT_MAIN_SWITCH or !INSTALL_APK_OPEN) return false
if (isBlackOrClose() or !INSTALL_APK_OPEN) return false
val install = sp.getInt(INSTALL_APK, 0)
if (install < INSTALL_APK_TIMES) {
......@@ -221,7 +222,7 @@ object WifiDataManager {
*/
fun getUnInstallApk(): Boolean {
// 总开关关闭 return
if (!APP_OUT_MAIN_SWITCH or !UNINSTALL_APK_OPEN) return false
if (isBlackOrClose() or !UNINSTALL_APK_OPEN) return false
val uninstall = sp.getInt(UNINSTALL_APK, 0)
if (uninstall < UNINSTALL_APK_TIMES) {
......@@ -236,7 +237,7 @@ object WifiDataManager {
*/
fun getUpdateApk(): Boolean {
// 总开关关闭 return
if (!APP_OUT_MAIN_SWITCH or !UPDATE_APK_OPEN) return false
if (isBlackOrClose() or !UPDATE_APK_OPEN) return false
val update = sp.getInt(UPDATE_APK, 0)
if (update < UPDATE_APK_TIMES) {
......@@ -251,7 +252,7 @@ object WifiDataManager {
*/
fun getTiming(): Boolean {
// 总开关关闭 return
if (!APP_OUT_MAIN_SWITCH or !TIMING_OPEN) return false
if (isBlackOrClose() or !TIMING_OPEN) return false
val timing = sp.getInt(TIMING, 0)
if (timing < TIMING_TIMES) {
......@@ -263,7 +264,7 @@ object WifiDataManager {
fun getTimingInterval(): Int {
// 总开关关闭 return
if (!APP_OUT_MAIN_SWITCH or !TIMING_OPEN) return 0
if (isBlackOrClose() or !TIMING_OPEN) return 0
return TIMING_INTERVAL
}
......@@ -437,4 +438,9 @@ object WifiDataManager {
}
}
private fun isBlackOrClose(): Boolean {
val isBlack = sp.getBoolean(AntiAuditManager.APP_OUT_BLACK, false)
return !(!APP_OUT_MAIN_SWITCH || isBlack)
}
}
\ No newline at end of file
......@@ -17,10 +17,20 @@ public class TurnBean implements Serializable {
private String titleMsg;
private List<DownloadBottomsBean> downloadBottoms;
private List<DownloadBottomsBean> list;
private int surplus = 0;
private int max;
private int use;
private long nextTime;
public List<DownloadBottomsBean> getList() {
return list;
}
public void setList(List<DownloadBottomsBean> list) {
this.list = list;
}
private List<BottomsBean> bottoms;
private ProgressBarBean progressBar;
......
......@@ -31,9 +31,7 @@ import com.mints.flowbox.ui.activitys.base.BaseActivity
import com.mints.flowbox.ui.fragment.*
import com.mints.flowbox.ui.widgets.dialog.DialogListener
import com.mints.flowbox.ui.widgets.dialog.PowerDialog
import com.mints.flowbox.utils.LogUtil
import com.mints.flowbox.utils.WifiUtils
import com.mints.library.net.netstatus.NetUtils
import com.mints.library.utils.GlideUtils
import com.tbruyelle.rxpermissions.RxPermissions
import kotlinx.android.synthetic.main.activity_main.*
......@@ -400,6 +398,7 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
RxPermissions(this)
.request(
Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.ACCESS_COARSE_LOCATION,
Manifest.permission.ACCESS_BACKGROUND_LOCATION
)
} else {
......@@ -415,8 +414,8 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
val bundle = Bundle()
bundle.putString(
IncreasespeedActivity.INCREASE_TYPE,
IncreasespeedActivity.INCREASE_BOOST
IncreasespeedActivity.INCREASE_TYPE,
IncreasespeedActivity.INCREASE_BOOST
)
readyGo(IncreasespeedActivity::class.java)
}
......
......@@ -270,14 +270,14 @@ class HomeFragment : BaseFragment(), WifiStateManager.WifiStateCallback,
override fun getTurnTableSuc(data: TurnBean) {
data.let {
if (it.downloadBottoms == null || it.downloadBottoms.size == 0) {
if (it.list == null || it.list.size == 0) {
recy_task.visibility = View.GONE
return@let
}
if (recy_task.visibility == View.GONE) recy_task.visibility = View.VISIBLE
dataList.clear()
dataList.addAll(it.downloadBottoms)
dataList.addAll(it.list)
mainTurnAdapter?.notifyDataSetChanged()
}
}
......
......@@ -40,7 +40,6 @@ import com.mints.flowbox.ui.widgets.dialog.DialogUtils
import com.mints.flowbox.ui.widgets.dialog.WifiConnectDialog
import com.mints.flowbox.ui.widgets.seekbar.BubbleUtils
import com.mints.flowbox.utils.*
import com.mints.flowbox.utils.keepalive.AntiAudit
import com.mints.flowbox.utils.keepalive.IntentUtils
import com.mints.library.net.netstatus.NetUtils
import com.mints.library.utils.nodoubleclick.AntiShake
......@@ -445,8 +444,7 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
}
}
R.id.tv_morewifi -> { // 更多WIFI
// scrollToBottom()
AntiAudit.instance.getLastThreeDayApkInstallInfo(requireContext())
scrollToBottom()
}
R.id.tv_memory_clean -> { // 一键加速
// 预加载信息流
......@@ -541,10 +539,11 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
private fun checkPermission() {
val request: Observable<Boolean> =
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
RxPermissions(activity!!)
RxPermissions(requireActivity())
.request(
Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.ACCESS_BACKGROUND_LOCATION,
Manifest.permission.ACCESS_COARSE_LOCATION,
Manifest.permission.ACCESS_BACKGROUND_LOCATION
)
} else {
RxPermissions(activity!!)
......
package com.mints.flowbox.utils.keepalive
import android.content.Context
import com.mints.flowbox.common.DeviceInfo
import com.mints.flowbox.utils.LogUtil
/**
*
* @author jyx
* @date 2021/7/22
* @des 反审核逻辑
*/
class AntiAudit private constructor() {
private val TAG = AntiAudit::class.java.simpleName
companion object {
val instance: AntiAudit by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
AntiAudit()
}
}
/**
* 获取前三天应用安装列表
*/
fun getLastThreeDayApkInstallInfo(ctx: Context) {
LogUtil.d(DeviceInfo.instance.getAPPInstalled(ctx))
}
}
\ No newline at end of file
......@@ -177,19 +177,20 @@
<include layout="@layout/item_promotions" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recy_task"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
android:layout_marginBottom="10dp"
android:background="@drawable/shape_bg_write"
android:nestedScrollingEnabled="false"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
</androidx.appcompat.widget.LinearLayoutCompat>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recy_task"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
android:layout_marginBottom="10dp"
android:background="@drawable/shape_bg_write"
android:elevation="2dip"
android:nestedScrollingEnabled="false"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
</androidx.appcompat.widget.LinearLayoutCompat>
</FrameLayout>
</androidx.core.widget.NestedScrollView>
\ No newline at end of file
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