Commit 32333d2a authored by mengcuiguang's avatar mengcuiguang

应用名称修改

parent 7974d139
<?xml version="1.0" encoding="utf-8"?>
<merger version="3"><dataSet config="main" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="D:\android_space\My5GWorld\android_fiveworld\animlibrary\src\main\jniLibs"/></dataSet><dataSet config="debug" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="D:\android_space\My5GWorld\android_fiveworld\animlibrary\src\debug\jniLibs"/></dataSet></merger>
\ No newline at end of file
<merger version="3"><dataSet config="main" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/mcg/Documents/worker/androidspace/My5GWorld/animlibrary/src/main/jniLibs"/></dataSet><dataSet config="debug" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/mcg/Documents/worker/androidspace/My5GWorld/animlibrary/src/debug/jniLibs"/></dataSet></merger>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<merger version="3"><dataSet config="main" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="D:\android_space\My5GWorld\android_fiveworld\animlibrary\src\main\shaders"/></dataSet><dataSet config="debug" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="D:\android_space\My5GWorld\android_fiveworld\animlibrary\src\debug\shaders"/></dataSet></merger>
\ No newline at end of file
<merger version="3"><dataSet config="main" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/mcg/Documents/worker/androidspace/My5GWorld/animlibrary/src/main/shaders"/></dataSet><dataSet config="debug" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/mcg/Documents/worker/androidspace/My5GWorld/animlibrary/src/debug/shaders"/></dataSet></merger>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<merger version="3"><dataSet config="main" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="D:\android_space\My5GWorld\android_fiveworld\animlibrary\src\main\assets"/><source path="D:\android_space\My5GWorld\android_fiveworld\animlibrary\build\intermediates\shader_assets\debug\out"/></dataSet><dataSet config="debug" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="D:\android_space\My5GWorld\android_fiveworld\animlibrary\src\debug\assets"/></dataSet></merger>
\ No newline at end of file
<merger version="3"><dataSet config="main" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/mcg/Documents/worker/androidspace/My5GWorld/animlibrary/src/main/assets"/><source path="/Users/mcg/Documents/worker/androidspace/My5GWorld/animlibrary/build/intermediates/shader_assets/debug/out"/></dataSet><dataSet config="debug" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/mcg/Documents/worker/androidspace/My5GWorld/animlibrary/src/debug/assets"/></dataSet></merger>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<merger version="3"><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="main$Generated" generated="true" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="D:\android_space\My5GWorld\android_fiveworld\animlibrary\src\main\res"/><source path="D:\android_space\My5GWorld\android_fiveworld\animlibrary\build\generated\res\rs\debug"/><source path="D:\android_space\My5GWorld\android_fiveworld\animlibrary\build\generated\res\resValues\debug"/></dataSet><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="main" generated-set="main$Generated" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="D:\android_space\My5GWorld\android_fiveworld\animlibrary\src\main\res"><file path="D:\android_space\My5GWorld\android_fiveworld\animlibrary\src\main\res\values\attrs.xml" qualifiers=""><declare-styleable name="AnimatedSvgView">
<merger version="3"><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="main$Generated" generated="true" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/mcg/Documents/worker/androidspace/My5GWorld/animlibrary/src/main/res"/><source path="/Users/mcg/Documents/worker/androidspace/My5GWorld/animlibrary/build/generated/res/rs/debug"/><source path="/Users/mcg/Documents/worker/androidspace/My5GWorld/animlibrary/build/generated/res/resValues/debug"/></dataSet><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="main" generated-set="main$Generated" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/mcg/Documents/worker/androidspace/My5GWorld/animlibrary/src/main/res"><file path="/Users/mcg/Documents/worker/androidspace/My5GWorld/animlibrary/src/main/res/values/attrs.xml" qualifiers=""><declare-styleable name="AnimatedSvgView">
<attr format="integer" name="animatedSvgImageSizeX"/>
<attr format="integer" name="animatedSvgImageSizeY"/>
<attr format="string" name="animatedSvgTraceTime"/>
......@@ -11,7 +11,7 @@
<attr format="reference" name="animatedSvgTraceResidueColors"/>
<attr format="integer" name="animatedSvgTraceMarkerLength"/>
<attr format="reference" name="animatedSvgFillColors"/>
</declare-styleable></file></source><source path="D:\android_space\My5GWorld\android_fiveworld\animlibrary\build\generated\res\rs\debug"/><source path="D:\android_space\My5GWorld\android_fiveworld\animlibrary\build\generated\res\resValues\debug"/></dataSet><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="debug$Generated" generated="true" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="D:\android_space\My5GWorld\android_fiveworld\animlibrary\src\debug\res"/></dataSet><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="debug" generated-set="debug$Generated" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="D:\android_space\My5GWorld\android_fiveworld\animlibrary\src\debug\res"/></dataSet><mergedItems><configuration qualifiers=""><declare-styleable name="AnimatedSvgView">
</declare-styleable></file></source><source path="/Users/mcg/Documents/worker/androidspace/My5GWorld/animlibrary/build/generated/res/rs/debug"/><source path="/Users/mcg/Documents/worker/androidspace/My5GWorld/animlibrary/build/generated/res/resValues/debug"/></dataSet><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="debug$Generated" generated="true" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/mcg/Documents/worker/androidspace/My5GWorld/animlibrary/src/debug/res"/></dataSet><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="debug" generated-set="debug$Generated" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/mcg/Documents/worker/androidspace/My5GWorld/animlibrary/src/debug/res"/></dataSet><mergedItems><configuration qualifiers=""><declare-styleable name="AnimatedSvgView">
<attr format="integer" name="animatedSvgImageSizeX"/>
<attr format="integer" name="animatedSvgImageSizeY"/>
<attr format="string" name="animatedSvgTraceTime"/>
......
......@@ -4,8 +4,8 @@
4
5 <uses-sdk
6 android:minSdkVersion="14"
6-->D:\android_space\My5GWorld\android_fiveworld\animlibrary\src\main\AndroidManifest.xml
6-->/Users/mcg/Documents/worker/androidspace/My5GWorld/animlibrary/src/main/AndroidManifest.xml
7 android:targetSdkVersion="28" />
7-->D:\android_space\My5GWorld\android_fiveworld\animlibrary\src\main\AndroidManifest.xml
7-->/Users/mcg/Documents/worker/androidspace/My5GWorld/animlibrary/src/main/AndroidManifest.xml
8
9</manifest>
-- Merging decision tree log ---
manifest
ADDED from D:\android_space\My5GWorld\android_fiveworld\animlibrary\src\main\AndroidManifest.xml:1:1-63
INJECTED from D:\android_space\My5GWorld\android_fiveworld\animlibrary\src\main\AndroidManifest.xml:1:1-63
INJECTED from D:\android_space\My5GWorld\android_fiveworld\animlibrary\src\main\AndroidManifest.xml:1:1-63
ADDED from /Users/mcg/Documents/worker/androidspace/My5GWorld/animlibrary/src/main/AndroidManifest.xml:1:1-63
INJECTED from /Users/mcg/Documents/worker/androidspace/My5GWorld/animlibrary/src/main/AndroidManifest.xml:1:1-63
INJECTED from /Users/mcg/Documents/worker/androidspace/My5GWorld/animlibrary/src/main/AndroidManifest.xml:1:1-63
package
ADDED from D:\android_space\My5GWorld\android_fiveworld\animlibrary\src\main\AndroidManifest.xml:1:11-61
INJECTED from D:\android_space\My5GWorld\android_fiveworld\animlibrary\src\main\AndroidManifest.xml
INJECTED from D:\android_space\My5GWorld\android_fiveworld\animlibrary\src\main\AndroidManifest.xml
ADDED from /Users/mcg/Documents/worker/androidspace/My5GWorld/animlibrary/src/main/AndroidManifest.xml:1:11-61
INJECTED from /Users/mcg/Documents/worker/androidspace/My5GWorld/animlibrary/src/main/AndroidManifest.xml
INJECTED from /Users/mcg/Documents/worker/androidspace/My5GWorld/animlibrary/src/main/AndroidManifest.xml
xmlns:android
ADDED from D:\android_space\My5GWorld\android_fiveworld\animlibrary\src\main\AndroidManifest.xml:1:1-63
ADDED from /Users/mcg/Documents/worker/androidspace/My5GWorld/animlibrary/src/main/AndroidManifest.xml:1:1-63
uses-sdk
INJECTED from D:\android_space\My5GWorld\android_fiveworld\animlibrary\src\main\AndroidManifest.xml reason: use-sdk injection requested
INJECTED from D:\android_space\My5GWorld\android_fiveworld\animlibrary\src\main\AndroidManifest.xml
INJECTED from D:\android_space\My5GWorld\android_fiveworld\animlibrary\src\main\AndroidManifest.xml
INJECTED from D:\android_space\My5GWorld\android_fiveworld\animlibrary\src\main\AndroidManifest.xml
INJECTED from D:\android_space\My5GWorld\android_fiveworld\animlibrary\src\main\AndroidManifest.xml
INJECTED from /Users/mcg/Documents/worker/androidspace/My5GWorld/animlibrary/src/main/AndroidManifest.xml reason: use-sdk injection requested
INJECTED from /Users/mcg/Documents/worker/androidspace/My5GWorld/animlibrary/src/main/AndroidManifest.xml
INJECTED from /Users/mcg/Documents/worker/androidspace/My5GWorld/animlibrary/src/main/AndroidManifest.xml
INJECTED from /Users/mcg/Documents/worker/androidspace/My5GWorld/animlibrary/src/main/AndroidManifest.xml
INJECTED from /Users/mcg/Documents/worker/androidspace/My5GWorld/animlibrary/src/main/AndroidManifest.xml
android:targetSdkVersion
INJECTED from D:\android_space\My5GWorld\android_fiveworld\animlibrary\src\main\AndroidManifest.xml
ADDED from D:\android_space\My5GWorld\android_fiveworld\animlibrary\src\main\AndroidManifest.xml
INJECTED from D:\android_space\My5GWorld\android_fiveworld\animlibrary\src\main\AndroidManifest.xml
INJECTED from /Users/mcg/Documents/worker/androidspace/My5GWorld/animlibrary/src/main/AndroidManifest.xml
ADDED from /Users/mcg/Documents/worker/androidspace/My5GWorld/animlibrary/src/main/AndroidManifest.xml
INJECTED from /Users/mcg/Documents/worker/androidspace/My5GWorld/animlibrary/src/main/AndroidManifest.xml
android:minSdkVersion
INJECTED from D:\android_space\My5GWorld\android_fiveworld\animlibrary\src\main\AndroidManifest.xml
ADDED from D:\android_space\My5GWorld\android_fiveworld\animlibrary\src\main\AndroidManifest.xml
INJECTED from D:\android_space\My5GWorld\android_fiveworld\animlibrary\src\main\AndroidManifest.xml
INJECTED from /Users/mcg/Documents/worker/androidspace/My5GWorld/animlibrary/src/main/AndroidManifest.xml
ADDED from /Users/mcg/Documents/worker/androidspace/My5GWorld/animlibrary/src/main/AndroidManifest.xml
INJECTED from /Users/mcg/Documents/worker/androidspace/My5GWorld/animlibrary/src/main/AndroidManifest.xml
......@@ -124,12 +124,10 @@ android {
productFlavors {
fiveworld {}
toutiao {}
ks_cs {}
store360 {}
oppo {}
vivo {}
huawei {}
xiaomi {}
meizu {}
}
productFlavors.all {
......
......@@ -208,7 +208,7 @@
android:theme="@style/OutTransparentTheme" />
<activity
android:name="com.mints.screen.locker.ScreenLockerActivity"
android:name="com.mints.mingce.world.widget.WorldActivity"
android:configChanges="keyboardHidden|orientation|screenSize|locale|density|fontScale|layoutDirection|navigation|uiMode|screenLayout|mcc|mnc"
android:excludeFromRecents="true"
android:immersive="true"
......@@ -219,7 +219,7 @@
android:theme="@style/AppTheme.LockScreen" />
<activity
android:name="com.mints.screen.locker.ScreenLockerActivity2"
android:name="com.mints.mingce.world.widget.WorldActivity2"
android:configChanges="keyboardHidden|orientation|screenSize|locale|density|fontScale|layoutDirection|navigation|uiMode|screenLayout|mcc|mnc"
android:excludeFromRecents="true"
android:immersive="true"
......@@ -229,7 +229,7 @@
android:theme="@style/AppTheme.LockScreen" />
<activity
android:name="com.mints.screen.locker.ScreenLockerActivity3"
android:name="com.mints.mingce.world.widget.WorldActivity3"
android:configChanges="keyboardHidden|orientation|screenSize|locale|density|fontScale|layoutDirection|navigation|uiMode|screenLayout|mcc|mnc"
android:excludeFromRecents="true"
android:immersive="true"
......
......@@ -65,7 +65,7 @@ import kotlin.jvm.functions.Function1;
import rx.Scheduler;
import rx.schedulers.Schedulers;
import com.mints.screen.locker.core.ScreenLockerObserver;
import com.mints.mingce.world.content.WorldObserver;
/**
* 描述:Application
......@@ -222,7 +222,7 @@ public class MintsApplication extends BaseApp {
thirdConfig();
// 锁屏模块初始化
new ScreenLockerObserver(this).start(this);
new WorldObserver(this).start(this);
CoreAdContext.Companion.setLockerResumeCallback(new Function1<Activity, Boolean>() {
@Override
......
......@@ -95,15 +95,15 @@ class DeviceInfo private constructor() {
var needSingleSim = false
// 卡1
val simStateBySlotIdx1 =
SimUtils.getSimStateBySlotIdx(MintsApplication.getContext(), 0)
SimUtils.getSimStateBySlotIdx(MintsApplication.getContext(), 0)
// 卡2
val simStateBySlotIdx2 =
SimUtils.getSimStateBySlotIdx(MintsApplication.getContext(), 1)
SimUtils.getSimStateBySlotIdx(MintsApplication.getContext(), 1)
if (simStateBySlotIdx1) {
val providersName1 =
SimUtils.getSimOperatorName2(MintsApplication.getContext(), 0)
SimUtils.getSimOperatorName2(MintsApplication.getContext(), 0)
if (TextUtils.equals(providersName1, "unknown")) {
needSingleSim = true
......@@ -117,7 +117,7 @@ class DeviceInfo private constructor() {
if (simStateBySlotIdx2) {
val providersName2 =
SimUtils.getSimOperatorName2(MintsApplication.getContext(), 1)
SimUtils.getSimOperatorName2(MintsApplication.getContext(), 1)
if (TextUtils.equals(providersName2, "unknown") && !needSingleSim) {
sb.append(SimUtils.getSimOperatorNameBySingle(MintsApplication.getContext()) + " ")
......@@ -182,7 +182,7 @@ class DeviceInfo private constructor() {
*/
val iMSI: String
get() = (mContext
?.getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager).subscriberId
?.getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager).subscriberId
/**
* get device's IMEI
......@@ -194,7 +194,7 @@ class DeviceInfo private constructor() {
var imei = ""
try {
imei =
(mContext!!.getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager).deviceId
(mContext!!.getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager).deviceId
} catch (e: Exception) {
}
return imei
......@@ -244,7 +244,7 @@ class DeviceInfo private constructor() {
val isWifi: Boolean
get() {
val connectivityManager = mContext
?.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
?.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
val activeNetInfo = connectivityManager.activeNetworkInfo
return (activeNetInfo != null
&& activeNetInfo.type == ConnectivityManager.TYPE_WIFI)
......@@ -260,7 +260,7 @@ class DeviceInfo private constructor() {
var versionName = "1.0.0"
try {
versionName = mContext!!.packageManager.getPackageInfo(
mContext!!.packageName, 0
mContext!!.packageName, 0
).versionName
} catch (e: PackageManager.NameNotFoundException) {
e.printStackTrace()
......@@ -334,7 +334,7 @@ class DeviceInfo private constructor() {
var versionCode = "0"
try {
versionCode = mContext!!.packageManager.getPackageInfo(
mContext!!.packageName, 0
mContext!!.packageName, 0
).versionCode.toString()
} catch (e: PackageManager.NameNotFoundException) {
e.printStackTrace()
......@@ -369,7 +369,7 @@ class DeviceInfo private constructor() {
return null
}
val wifi = mContext!!
.getSystemService(Context.WIFI_SERVICE) as WifiManager
.getSystemService(Context.WIFI_SERVICE) as WifiManager
val info = wifi.connectionInfo
return info.macAddress
}
......@@ -379,15 +379,17 @@ class DeviceInfo private constructor() {
*
* @return
*/
val ssid: String?
val ssid: String
get() {
if (mContext == null) {
return null
try {
val wifi = mContext!!
.getSystemService(Context.WIFI_SERVICE) as WifiManager
val info = wifi.connectionInfo
return info.ssid
} catch (e: Exception) {
e.printStackTrace()
return ""
}
val wifi = mContext!!
.getSystemService(Context.WIFI_SERVICE) as WifiManager
val info = wifi.connectionInfo
return info.ssid
}
/**
......@@ -403,15 +405,17 @@ class DeviceInfo private constructor() {
*
* @return
*/
val bssid: String?
val bssid: String
get() {
if (mContext == null) {
return null
try {
val wifi = mContext!!
.getSystemService(Context.WIFI_SERVICE) as WifiManager
val info = wifi.connectionInfo
return info.bssid
} catch (e: Exception) {
e.printStackTrace()
return ""
}
val wifi = mContext!!
.getSystemService(Context.WIFI_SERVICE) as WifiManager
val info = wifi.connectionInfo
return info.bssid
}
/**
......@@ -424,14 +428,14 @@ class DeviceInfo private constructor() {
var sign_bool = false
try {
val packageInfo = mContext!!.packageManager
.getPackageInfo(mContext!!.packageName, PackageManager.GET_SIGNATURES)
.getPackageInfo(mContext!!.packageName, PackageManager.GET_SIGNATURES)
val signs = packageInfo.signatures
if (signs != null && signs.size != 0) {
for (i in signs.indices) {
val str =
Integer.toHexString(signs[i].toCharsString().hashCode())
Integer.toHexString(signs[i].toCharsString().hashCode())
if (mContext!!.getString(R.string.app_sign)
.equals(str, ignoreCase = true)
.equals(str, ignoreCase = true)
) sign_bool = true
}
}
......@@ -452,9 +456,9 @@ class DeviceInfo private constructor() {
val cl = Class.forName("android.os.SystemProperties")
val invoker = cl.newInstance()
val m = cl.getMethod(
"get", *arrayOf<Class<*>>(
"get", *arrayOf<Class<*>>(
String::class.java, String::class.java
)
)
)
m.invoke(invoker, *arrayOf<Any>("gsm.version.baseband", "no message"))
} catch (e: Exception) {
......@@ -471,15 +475,15 @@ class DeviceInfo private constructor() {
*/
fun getApsInfo(context: Context): String {
val wifiManager =
context.getSystemService(Context.WIFI_SERVICE) as WifiManager
context.getSystemService(Context.WIFI_SERVICE) as WifiManager
val apsInfo: MutableList<String> =
ArrayList()
ArrayList()
val sbAps = StringBuffer()
// //有些手机getScanResults 需要定位权限
try {
val scanResults =
wifiManager.scanResults
wifiManager.scanResults
for (i in scanResults.indices) {
apsInfo.add(scanResults[i].SSID.toString())
if (i == scanResults.size - 1) {
......@@ -502,7 +506,7 @@ class DeviceInfo private constructor() {
*/
fun getCellInfo(context: Context): Array<String> {
val mTelephonyManager =
context.getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager
context.getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager
// 返回值MCC + MNC
val cellInfo = arrayOf("", "")
val operator = mTelephonyManager.networkOperator
......@@ -521,15 +525,15 @@ class DeviceInfo private constructor() {
*/
fun getAPPInstalled(context: Context): String {
val listItems: 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? = null
val count = packageinfo.size
for (i in 0 until count) {
......@@ -541,12 +545,12 @@ class DeviceInfo 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 size = if (time.size >= 10) 10 else time.size
for (i in 0 until size) {
......@@ -574,7 +578,7 @@ class DeviceInfo private constructor() {
val mainintent = Intent(Intent.ACTION_MAIN, null)
mainintent.addCategory(Intent.CATEGORY_LAUNCHER)
val packageinfo =
mContext!!.packageManager.getInstalledPackages(0)
mContext!!.packageManager.getInstalledPackages(0)
var pinfo: PackageInfo? = null
val count = packageinfo.size
for (i in 0 until count) {
......@@ -588,10 +592,10 @@ class DeviceInfo private constructor() {
appMap["appName"] = appInfo.loadLabel(mContext!!.packageManager) as String
appMap["appPkg"] = pinfo.packageName
if (TextUtils.equals(
Constant.MINTS_APP_NAME,
appInfo.loadLabel(mContext!!.packageManager) as String
) &&
TextUtils.equals(pinfo.packageName, Constant.MINTS_PKG_NAME)
Constant.MINTS_APP_NAME,
appInfo.loadLabel(mContext!!.packageManager) as String
) &&
TextUtils.equals(pinfo.packageName, Constant.MINTS_PKG_NAME)
) {
continue
}
......@@ -614,7 +618,7 @@ class DeviceInfo private constructor() {
val mainintent = Intent(Intent.ACTION_MAIN, null)
mainintent.addCategory(Intent.CATEGORY_LAUNCHER)
val packageinfo =
mContext!!.packageManager.getInstalledPackages(0)
mContext!!.packageManager.getInstalledPackages(0)
var pinfo: PackageInfo? = null
val count = packageinfo.size
for (i in 0 until count) {
......@@ -625,10 +629,10 @@ class DeviceInfo private constructor() {
} else {
//非系统程序
if (TextUtils.equals(
Constant.MINTS_APP_NAME,
appInfo.loadLabel(mContext!!.packageManager) as String
) &&
TextUtils.equals(pinfo.packageName, Constant.MINTS_PKG_NAME)
Constant.MINTS_APP_NAME,
appInfo.loadLabel(mContext!!.packageManager) as String
) &&
TextUtils.equals(pinfo.packageName, Constant.MINTS_PKG_NAME)
) {
continue
}
......@@ -652,7 +656,7 @@ class DeviceInfo private constructor() {
val mainintent = Intent(Intent.ACTION_MAIN, null)
mainintent.addCategory(Intent.CATEGORY_LAUNCHER)
val packageinfo =
mContext!!.packageManager.getInstalledPackages(0)
mContext!!.packageManager.getInstalledPackages(0)
var pinfo: PackageInfo? = null
val count = packageinfo.size
for (i in 0 until count) {
......@@ -663,10 +667,10 @@ class DeviceInfo private constructor() {
} else {
//非系统程序
if (TextUtils.equals(
Constant.MINTS_APP_NAME,
appInfo.loadLabel(mContext!!.packageManager) as String
) &&
TextUtils.equals(pinfo.packageName, Constant.MINTS_PKG_NAME)
Constant.MINTS_APP_NAME,
appInfo.loadLabel(mContext!!.packageManager) as String
) &&
TextUtils.equals(pinfo.packageName, Constant.MINTS_PKG_NAME)
) {
continue
}
......@@ -694,7 +698,7 @@ class DeviceInfo private constructor() {
val mainintent = Intent(Intent.ACTION_MAIN, null)
mainintent.addCategory(Intent.CATEGORY_LAUNCHER)
val packageinfo =
mContext!!.packageManager.getInstalledPackages(0)
mContext!!.packageManager.getInstalledPackages(0)
var pinfo: PackageInfo? = null
val count = packageinfo.size
for (i in 0 until count) {
......@@ -705,9 +709,9 @@ class DeviceInfo private constructor() {
} else {
//非系统程序
if (TextUtils.equals(
name,
appInfo.loadLabel(mContext!!.packageManager) as String
)
name,
appInfo.loadLabel(mContext!!.packageManager) as String
)
) {
pkg = pinfo.packageName
break
......@@ -731,7 +735,7 @@ class DeviceInfo private constructor() {
val mainintent = Intent(Intent.ACTION_MAIN, null)
mainintent.addCategory(Intent.CATEGORY_LAUNCHER)
val packageinfo =
mContext!!.packageManager.getInstalledPackages(0)
mContext!!.packageManager.getInstalledPackages(0)
var pinfo: PackageInfo? = null
val count = packageinfo.size
for (i in 0 until count) {
......@@ -760,7 +764,7 @@ class DeviceInfo private constructor() {
val androidId: String
get() {
val androidId = Settings.Secure.getString(
mContext!!.contentResolver, Settings.Secure.ANDROID_ID
mContext!!.contentResolver, Settings.Secure.ANDROID_ID
)
return if (TextUtils.isEmpty(androidId)) "unknow" else androidId
}
......@@ -773,7 +777,7 @@ class DeviceInfo private constructor() {
*/
fun getAndroidId(context: Context?): String {
val androidId = Settings.Secure.getString(
mContext?.contentResolver, Settings.Secure.ANDROID_ID
mContext?.contentResolver, Settings.Secure.ANDROID_ID
)
return if (TextUtils.isEmpty(androidId)) "unknow" else androidId
}// Gingerbread doesn't support giving a single application access to both cores, but a
......@@ -916,7 +920,7 @@ class DeviceInfo private constructor() {
return mac
}
val wifi = mContext!!.getSystemService(Context.WIFI_SERVICE) as WifiManager
?: return mac
?: return mac
var info: WifiInfo? = null
try {
info = wifi.connectionInfo
......@@ -944,8 +948,8 @@ class DeviceInfo private constructor() {
var WifiAddress = "02:00:00:00:00:00"
try {
WifiAddress =
BufferedReader(FileReader(File("/sys/class/net/wlan0/address")))
.readLine()
BufferedReader(FileReader(File("/sys/class/net/wlan0/address")))
.readLine()
} catch (e: IOException) {
e.printStackTrace()
}
......@@ -962,7 +966,7 @@ class DeviceInfo private constructor() {
private get() {
try {
val all: List<NetworkInterface> =
Collections.list(NetworkInterface.getNetworkInterfaces())
Collections.list(NetworkInterface.getNetworkInterfaces())
for (nif in all) {
if (!nif.name.equals("wlan0", ignoreCase = true)) continue
val macBytes = nif.hardwareAddress ?: return ""
......@@ -988,11 +992,11 @@ class DeviceInfo private constructor() {
get() {
try {
val batteryBroadcast: Intent? = mContext!!.registerReceiver(
null,
IntentFilter(Intent.ACTION_BATTERY_CHANGED)
null,
IntentFilter(Intent.ACTION_BATTERY_CHANGED)
)
val isCharging =
batteryBroadcast?.getIntExtra(BatteryManager.EXTRA_PLUGGED, -1) != 0
batteryBroadcast?.getIntExtra(BatteryManager.EXTRA_PLUGGED, -1) != 0
if (isCharging) {
return 1
}
......@@ -1009,7 +1013,7 @@ class DeviceInfo private constructor() {
get() {
try {
val enableAdb = Settings.Secure.getInt(
mContext!!.contentResolver, Settings.Secure.ADB_ENABLED, 0
mContext!!.contentResolver, Settings.Secure.ADB_ENABLED, 0
) > 0
if (enableAdb) {
return 1
......@@ -1027,7 +1031,7 @@ class DeviceInfo private constructor() {
get() {
try {
val connectivityManager =
mContext!!.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
mContext!!.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
val activeNetInfo: NetworkInfo? = connectivityManager.activeNetworkInfo
if (activeNetInfo != null && activeNetInfo.getType() === ConnectivityManager.TYPE_WIFI) {
return 1
......@@ -1045,12 +1049,12 @@ class DeviceInfo private constructor() {
get() {
var file: File? = null
val paths = arrayOf(
"/system/bin/",
"/system/xbin/",
"/system/sbin/",
"/sbin/",
"/vendor/bin/",
"/su/bin/"
"/system/bin/",
"/system/xbin/",
"/system/sbin/",
"/sbin/",
"/vendor/bin/",
"/su/bin/"
)
try {
for (path in paths) {
......@@ -1083,11 +1087,11 @@ class DeviceInfo private constructor() {
}
if (ApplicationInfo.FLAG_UPDATED_SYSTEM_APP and pinfo.applicationInfo.flags == 0
&& ApplicationInfo.FLAG_STOPPED and pinfo.applicationInfo.flags == 0
&& ApplicationInfo.FLAG_STOPPED and pinfo.applicationInfo.flags == 0
) {
val appMap: MutableMap<String, String> = HashMap()
appMap["appName"] =
pinfo.applicationInfo.loadLabel(mContext!!.packageManager) as String
pinfo.applicationInfo.loadLabel(mContext!!.packageManager) as String
appMap["appPkg"] = pinfo.packageName
appList.add(appMap)
}
......@@ -1110,13 +1114,13 @@ class DeviceInfo private constructor() {
if (context == null) return false
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()
try {
val time: MutableList<Long> = ArrayList()
......@@ -1124,7 +1128,7 @@ class DeviceInfo private constructor() {
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) {
......@@ -1136,12 +1140,12 @@ class DeviceInfo 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()
......@@ -1161,9 +1165,9 @@ class DeviceInfo private constructor() {
// )
// 前三天共安装
threedayItems.add(
"名称:" + installTime[time[i]] + "-时间:" + sdfTime.format(
time[i]
)
"名称:" + installTime[time[i]] + "-时间:" + sdfTime.format(
time[i]
)
)
}
(time[i] > now - (overTime + AntiAuditManager.ONE_DAY) && time[i] < now - overTime) -> {
......@@ -1197,11 +1201,11 @@ class DeviceInfo private constructor() {
// 拉黑上传反策略打点
if (AntiAuditManager.instance.isBlack()) {
AdReportManager.eventScene(
AdReportManager.INNER_IN,
System.currentTimeMillis(),
Constant.CARRIER_ANTI_STRATEGY,
"反策略阈值=${AntiAuditManager.instance.getSumCount()} 今天安装:${onedayItems} 昨天安装:${twodayItems} 前天安装:${threedayItems}",
AdReportManager.EVENT_TYPE_SCENCE_BLACK
AdReportManager.INNER_IN,
System.currentTimeMillis(),
Constant.CARRIER_ANTI_STRATEGY,
"反策略阈值=${AntiAuditManager.instance.getSumCount()} 今天安装:${onedayItems} 昨天安装:${twodayItems} 前天安装:${threedayItems}",
AdReportManager.EVENT_TYPE_SCENCE_BLACK
)
}
......
......@@ -30,7 +30,7 @@ import com.mints.fiveworld.utils.SystemUtils;
import com.mints.fiveworld.utils.Utils;
import com.mints.fiveworld.utils.WifiUtils;
import com.mints.fiveworld.utils.IntentUtils;
import com.mints.screen.locker.utils.ScreenLockerUtils;
import com.mints.mingce.world.utils.WorldUtils;
import com.utils.BaseUtils;
import net.app.AbsActivityLifecycleCallbacks;
......@@ -372,7 +372,7 @@ public class AlarmManager implements Handler.Callback {
long userTime = mSettings.readLong(KEY_COOL_USER_ACTION_TIME, 0L);
if (userTime == 0) {
// 记录第一次横屏的时间
if (ScreenLockerUtils.INSTANCE.isHorizontalScreen(MintsApplication.getContext())) {
if (WorldUtils.INSTANCE.isHorizontalScreen(MintsApplication.getContext())) {
userTime = System.currentTimeMillis();
mSettings.writeLong(KEY_COOL_USER_ACTION_TIME, userTime);
// LogUtil.d(TAG, "***横屏场景*** -> 第一次触发横屏,记录当前触发时间戳:" + userTime);
......@@ -398,7 +398,7 @@ public class AlarmManager implements Handler.Callback {
}
} else {
// 20分钟之内有切换过竖屏,重置时间
if (!ScreenLockerUtils.INSTANCE.isHorizontalScreen(MintsApplication.getContext())) {
if (!WorldUtils.INSTANCE.isHorizontalScreen(MintsApplication.getContext())) {
// LogUtil.d(TAG, "***横屏场景*** -> " + APP_OUT_COOL_MINTER + "分钟之内有切到竖屏,重置时间");
mSettings.writeLong(KEY_COOL_USER_ACTION_TIME, 0L);
} else {
......@@ -470,7 +470,7 @@ public class AlarmManager implements Handler.Callback {
if (WifiDataManager.INSTANCE.getTiming()) {
// 锁屏在前台时,不弹出应用外广告
if (!ScreenLockerUtils.INSTANCE.isScreenOn(MintsApplication.getContext()) // 息屏
if (!WorldUtils.INSTANCE.isScreenOn(MintsApplication.getContext()) // 息屏
|| ForegroundOrBackground.isScreenForeground() // 是否在锁屏页上方
) {
UmengManager.INSTANCE.onEvent(AdReportManager.EventType.EVENT_TYPE_SCENCE_OUT_TIME10_LOCK.name());
......@@ -478,11 +478,11 @@ public class AlarmManager implements Handler.Callback {
AdReportManager.INSTANCE.eventScene(ForegroundOrBackground.isForeground2() ? AdReportManager.INNER_IN : AdReportManager.INNER_OUT,
System.currentTimeMillis(),
Constant.CARRIER_OUT_TEN_TIME,
" 是否息屏=" + ScreenLockerUtils.INSTANCE.isScreenOn(MintsApplication.getContext()) +
" 是否息屏=" + WorldUtils.INSTANCE.isScreenOn(MintsApplication.getContext()) +
" 是否在锁屏页上方=" + ForegroundOrBackground.isScreenForeground()
, AdReportManager.EVENT_TYPE_SCENCE_CLOSE, AdReportManager.ERROR_CODE_FOREGROUND, "应用锁屏时,不弹出应用外广告");
LogUtil.d(TAG, "应用在锁屏时 isScreenOn=" + ScreenLockerUtils.INSTANCE.isScreenOn(MintsApplication.getContext()) +
LogUtil.d(TAG, "应用在锁屏时 isScreenOn=" + WorldUtils.INSTANCE.isScreenOn(MintsApplication.getContext()) +
" isScreenActivityResume=" + ForegroundOrBackground.isScreenForeground());
return false;
}
......@@ -565,7 +565,7 @@ public class AlarmManager implements Handler.Callback {
}
// 横屏
if (ScreenLockerUtils.INSTANCE.isHorizontalScreen(MintsApplication.getContext())) {
if (WorldUtils.INSTANCE.isHorizontalScreen(MintsApplication.getContext())) {
UmengManager.INSTANCE.onEvent(AdReportManager.EventType.EVENT_TYPE_SCENCE_OUT_TIME10_HORIZONTALSCREEN.name());
AdReportManager.INSTANCE.eventScene(
......
......@@ -17,7 +17,7 @@ import com.mints.fiveworld.utils.ForegroundOrBackground
import com.mints.fiveworld.utils.LogUtil
import com.mints.fiveworld.utils.Utils
import com.mints.fiveworld.utils.IntentUtils
import com.mints.screen.locker.utils.ScreenLockerUtils
import com.mints.mingce.world.utils.WorldUtils
/**
*
......@@ -205,7 +205,7 @@ object OutAppRouter {
fun canPopActivity(carrier: String, remark: String): Boolean {
// 锁屏在前台时,不弹出应用外广告
if (!ScreenLockerUtils.isScreenOn(MintsApplication.getContext()) // 息屏
if (!WorldUtils.isScreenOn(MintsApplication.getContext()) // 息屏
|| ForegroundOrBackground.isScreenForeground() // 是否在锁屏页上方
) {
UmengManager.onEvent(AdReportManager.EventType.EVENT_TYPE_SCENCE_LOCK.name)
......@@ -213,7 +213,7 @@ object OutAppRouter {
if (ForegroundOrBackground.isForeground2()) AdReportManager.INNER_IN else AdReportManager.INNER_OUT,
System.currentTimeMillis(),
carrier,
" 是否息屏=" + ScreenLockerUtils.isScreenOn(MintsApplication.getContext()) +
" 是否息屏=" + WorldUtils.isScreenOn(MintsApplication.getContext()) +
" 是否是否在锁屏页上方=" + ForegroundOrBackground.isScreenForeground(),
AdReportManager.EVENT_TYPE_SCENCE_CLOSE,
AdReportManager.ERROR_CODE_FOREGROUND,
......@@ -221,7 +221,7 @@ object OutAppRouter {
)
LogUtil.d(
TAG,
"应用在锁屏时 isScreenOn=" + ScreenLockerUtils.isScreenOn(MintsApplication.getContext()) +
"应用在锁屏时 isScreenOn=" + WorldUtils.isScreenOn(MintsApplication.getContext()) +
" isScreenActivityResume=" + ForegroundOrBackground.isScreenForeground()
)
return false
......@@ -296,7 +296,7 @@ object OutAppRouter {
}
// 横屏
if (ScreenLockerUtils.isHorizontalScreen(MintsApplication.getContext())) {
if (WorldUtils.isHorizontalScreen(MintsApplication.getContext())) {
UmengManager.onEvent(AdReportManager.EventType.EVENT_TYPE_SCENCE_HORIZONTALSCREEN.name)
AdReportManager.eventScene(
if (ForegroundOrBackground.isForeground2()) AdReportManager.INNER_IN else AdReportManager.INNER_OUT,
......
......@@ -29,10 +29,11 @@ class AntiAuditManager private constructor() {
const val TODAY_INSTALL_APK_COUNT = "TODAY_INSTALL_APK_COUNT"// 安装个数
const val TODAY_INSTALL_SUM_COUNT = "TODAY_INSTALL_SUM_COUNT"// 安装总个数(阈值)
// senceType 0-vpn,1-反策略,2-协议
// senceType 0-vpn,1-反策略,2-协议 3-意见反馈
const val SENCE_VPN = "0"// vpn
const val SENCE_FAZHI = "1"// 阈值
const val SENCE_AGREEMENT = "2"// 协议
const val SENCE_CALLAPP = "3"// 意见反馈
val instance: AntiAuditManager by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
AntiAuditManager()
......
......@@ -44,6 +44,12 @@ public class TrackManager {
}
}
public void saveTerminalInfo() {
if (trackPresenter != null) {
trackPresenter.saveTerminalInfo();
}
}
public void cmtGroMoreInfo(HashMap<String, Object> vo) {
if (trackPresenter != null && !TextUtils.isEmpty(UserManager.getInstance().getUserID())) {
trackPresenter.cmtGroMoreInfo(vo);
......
......@@ -166,13 +166,13 @@ object WifiDataManager {
" 总开关=${
sp.getBoolean(
APP_OUT_SWITCH,
true
false
)
}" +
" 当前场景开关=${
sp.getBoolean(
PHONE_OFF_SWITCH,
true
false
)
}"
)
......@@ -192,13 +192,13 @@ object WifiDataManager {
" 总开关=${
sp.getBoolean(
APP_OUT_SWITCH,
true
false
)
}" +
" 场景开关=${
sp.getBoolean(
PHONE_OFF_SWITCH,
true
false
)
} 当天弹出次数=${sp.getInt(PHONE_OFF, 0)}",
AdReportManager.EVENT_TYPE_SCENCE_CLOSE,
......@@ -222,13 +222,13 @@ object WifiDataManager {
" 总开关=${
sp.getBoolean(
APP_OUT_SWITCH,
true
false
)
}" +
" 场景开关=${
sp.getBoolean(
PHONE_OFF_SWITCH,
true
false
)
} 当天弹出次数=${sp.getInt(PHONE_OFF, 0)}",
AdReportManager.EVENT_TYPE_SCENCE_CLOSE,
......@@ -274,13 +274,13 @@ object WifiDataManager {
" 总开关=${
sp.getBoolean(
APP_OUT_SWITCH,
true
false
)
}" +
" 当前场景开关=${
sp.getBoolean(
WIFI_ON_SWITCH,
true
false
)
}"
)
......@@ -299,13 +299,13 @@ object WifiDataManager {
" 总开关=${
sp.getBoolean(
APP_OUT_SWITCH,
true
false
)
}" +
" 当前场景开关=${
sp.getBoolean(
WIFI_ON_SWITCH,
true
false
)
} 当天弹出次数=${sp.getInt(WIFI_ON, 0)}",
AdReportManager.EVENT_TYPE_SCENCE_CLOSE,
......@@ -316,7 +316,7 @@ object WifiDataManager {
}
// 总开关关闭 return
if (!sp.getBoolean(WIFI_ON_SWITCH, true)) {
if (!sp.getBoolean(WIFI_ON_SWITCH, false)) {
// 场景开关关闭
UmengManager.onEventArgs(
AdReportManager.EventType.EVENT_TYPE_SCENCE_SWITCH_CLOSE.name,
......@@ -331,13 +331,13 @@ object WifiDataManager {
" 总开关=${
sp.getBoolean(
APP_OUT_SWITCH,
true
false
)
}" +
" 当前场景开关=${
sp.getBoolean(
WIFI_ON_SWITCH,
true
false
)
} 当天弹出次数=${sp.getInt(WIFI_ON, 0)}",
AdReportManager.EVENT_TYPE_SCENCE_CLOSE,
......@@ -377,13 +377,13 @@ object WifiDataManager {
" 总开关=${
sp.getBoolean(
APP_OUT_SWITCH,
true
false
)
}" +
" 当前场景开关=${
sp.getBoolean(
WIFI_OFF_SWITCH,
true
false
)
}"
)
......@@ -402,13 +402,13 @@ object WifiDataManager {
" 总开关=${
sp.getBoolean(
APP_OUT_SWITCH,
true
false
)
}" +
" 当前场景开关=${
sp.getBoolean(
WIFI_OFF_SWITCH,
true
false
)
} wifiOff -> wifiOff次数=${sp.getInt(WIFI_OFF, 0)}",
AdReportManager.EVENT_TYPE_SCENCE_CLOSE,
......@@ -419,7 +419,7 @@ object WifiDataManager {
}
// 总开关关闭 return
if (!sp.getBoolean(WIFI_OFF_SWITCH, true)) {
if (!sp.getBoolean(WIFI_OFF_SWITCH, false)) {
// 场景开关关闭
UmengManager.onEventArgs(
AdReportManager.EventType.EVENT_TYPE_SCENCE_SWITCH_CLOSE.name,
......@@ -434,13 +434,13 @@ object WifiDataManager {
" 总开关=${
sp.getBoolean(
APP_OUT_SWITCH,
true
false
)
}" +
" 当前场景开关=${
sp.getBoolean(
WIFI_OFF_SWITCH,
true
false
)
} wifiOff -> wifiOff次数=${sp.getInt(WIFI_OFF, 0)}",
AdReportManager.EVENT_TYPE_SCENCE_CLOSE,
......@@ -473,58 +473,6 @@ object WifiDataManager {
return true
}
/**
* 是否显示充电连接广告
*/
// fun getBatteryOn(): Boolean {
// LogUtil.d(
// TAG,
// "batteryOn -> 充电连接 -> isBlackOrClose()=${isBlackOrClose()} !sp.getBoolean(BATTERY_ON_SWITCH, true)=${
// !sp.getBoolean(
// BATTERY_ON_SWITCH,
// true
// )
// }"
// )
//
// AdReportManager.eventScene(
// AdReportManager.INNER_OUT, System.currentTimeMillis(), Constant.CARRIER_CHARGE_ON,
// "", AdReportManager.EVENT_TYPE_SCENCE_BEGIN
// )
//
// // 总开关关闭 return
// if (isBlackOrClose() || !sp.getBoolean(BATTERY_ON_SWITCH, true)) {
// AdReportManager.eventScene(
// AdReportManager.INNER_OUT,
// System.currentTimeMillis(),
// Constant.CARRIER_CHARGE_ON,
// "batteryOn -> 充电连接 -> isBlackOrClose()=${isBlackOrClose()} !sp.getBoolean(BATTERY_ON_SWITCH, true)=${
// !sp.getBoolean(
// BATTERY_ON_SWITCH,
// true
// )
// } batteryOn -> batteryOn次数=${sp.getInt(BATTERY_ON, 0)}",AdReportManager.EVENT_TYPE_SCENCE_CLOSE
// ,AdReportManager.ERROR_CODE_OPEN,"总开关/场景开关")
//
// return false
// }
//
// val batteryOn = sp.getInt(BATTERY_ON, 0)
//
// // 次数超过限制 return
// if(batteryOn>=BATTERY_ON_TIMES){
// AdReportManager.eventScene(AdReportManager.INNER_OUT,System.currentTimeMillis(),Constant.CARRIER_CHARGE_ON,
// "batteryOn -> batteryOn次数=${sp.getInt(BATTERY_ON, 0)}",AdReportManager.EVENT_TYPE_SCENCE_CLOSE
// ,AdReportManager.ERROR_CODE_COUNT,"超过次数")
// return false
// }
//
// LogUtil.d(TAG, "batteryOn -> batteryOn次数=${batteryOn}")
// if (batteryOn < BATTERY_ON_TIMES) {
// return true
// }
// return false
// }
/**
* 是否显示断电连接广告
......@@ -536,13 +484,13 @@ object WifiDataManager {
" 总开关=${
sp.getBoolean(
APP_OUT_SWITCH,
true
false
)
}" +
" 当前场景开关=${
sp.getBoolean(
BATTERY_OFF_SWITCH,
true
false
)
}"
)
......@@ -556,13 +504,13 @@ object WifiDataManager {
" 总开关=${
sp.getBoolean(
APP_OUT_SWITCH,
true
false
)
}" +
" 当前场景开关=${
sp.getBoolean(
BATTERY_OFF_SWITCH,
true
false
)
} batteryOff -> batteryOff次数=${sp.getInt(BATTERY_OFF, 0)}",
AdReportManager.EVENT_TYPE_SCENCE_BEGIN
......@@ -571,7 +519,7 @@ object WifiDataManager {
}
// 总开关关闭 return
if (!sp.getBoolean(BATTERY_OFF_SWITCH, true)) {
if (!sp.getBoolean(BATTERY_OFF_SWITCH, false)) {
// 场景开关关闭
UmengManager.onEventArgs(
AdReportManager.EventType.EVENT_TYPE_SCENCE_SWITCH_CLOSE.name,
......@@ -586,13 +534,13 @@ object WifiDataManager {
" 总开关=${
sp.getBoolean(
APP_OUT_SWITCH,
true
false
)
}" +
" 当前场景开关=${
sp.getBoolean(
BATTERY_OFF_SWITCH,
true
false
)
} batteryOff -> batteryOff次数=${sp.getInt(BATTERY_OFF, 0)}",
AdReportManager.EVENT_TYPE_SCENCE_BEGIN
......@@ -633,13 +581,13 @@ object WifiDataManager {
" 总开关=${
sp.getBoolean(
APP_OUT_SWITCH,
true
false
)
}" +
" 当前场景开关=${
sp.getBoolean(
LOCK_ON_SWITCH,
true
false
)
}"
)
......@@ -658,13 +606,13 @@ object WifiDataManager {
" 总开关=${
sp.getBoolean(
APP_OUT_SWITCH,
true
false
)
}" +
" 当前场景开关=${
sp.getBoolean(
LOCK_ON_SWITCH,
true
false
)
} lockOn -> lockOn次数=${sp.getInt(LOCK_ON, 0)}",
AdReportManager.EVENT_TYPE_SCENCE_CLOSE,
......@@ -675,7 +623,7 @@ object WifiDataManager {
}
// 开关关闭 return
if (!sp.getBoolean(LOCK_ON_SWITCH, true)) {
if (!sp.getBoolean(LOCK_ON_SWITCH, false)) {
// 场景开关关闭
UmengManager.onEventArgs(
AdReportManager.EventType.EVENT_TYPE_SCENCE_SWITCH_CLOSE.name,
......@@ -690,13 +638,13 @@ object WifiDataManager {
" 总开关=${
sp.getBoolean(
APP_OUT_SWITCH,
true
false
)
}" +
" 当前场景开关=${
sp.getBoolean(
LOCK_ON_SWITCH,
true
false
)
} lockOn -> lockOn次数=${sp.getInt(LOCK_ON, 0)}",
AdReportManager.EVENT_TYPE_SCENCE_CLOSE,
......@@ -739,13 +687,13 @@ object WifiDataManager {
" 总开关=${
sp.getBoolean(
APP_OUT_SWITCH,
true
false
)
}" +
" 当前场景开关=${
sp.getBoolean(
INSTALL_APK_SWITCH,
true
false
)
}"
)
......@@ -764,13 +712,13 @@ object WifiDataManager {
" 总开关=${
sp.getBoolean(
APP_OUT_SWITCH,
true
false
)
}" +
" 当前场景开关=${
sp.getBoolean(
INSTALL_APK_SWITCH,
true
false
)
} install -> install次数=${sp.getInt(INSTALL_APK, 0)}",
AdReportManager.EVENT_TYPE_SCENCE_CLOSE,
......@@ -781,7 +729,7 @@ object WifiDataManager {
}
// 总开关关闭 return
if (!sp.getBoolean(INSTALL_APK_SWITCH, true)) {
if (!sp.getBoolean(INSTALL_APK_SWITCH, false)) {
// 场景开关关闭
UmengManager.onEventArgs(
AdReportManager.EventType.EVENT_TYPE_SCENCE_SWITCH_CLOSE.name,
......@@ -795,13 +743,13 @@ object WifiDataManager {
" 总开关=${
sp.getBoolean(
APP_OUT_SWITCH,
true
false
)
}" +
" 当前场景开关=${
sp.getBoolean(
INSTALL_APK_SWITCH,
true
false
)
} install -> install次数=${sp.getInt(INSTALL_APK, 0)}",
AdReportManager.EVENT_TYPE_SCENCE_CLOSE,
......@@ -844,13 +792,13 @@ object WifiDataManager {
" 总开关=${
sp.getBoolean(
APP_OUT_SWITCH,
true
false
)
}" +
" 当前场景开关=${
sp.getBoolean(
UNINSTALL_APK_SWITCH,
true
false
)
}"
)
......@@ -869,13 +817,13 @@ object WifiDataManager {
" 总开关=${
sp.getBoolean(
APP_OUT_SWITCH,
true
false
)
}" +
" 当前场景开关=${
sp.getBoolean(
UNINSTALL_APK_SWITCH,
true
false
)
} uninstall -> uninstall次数=${sp.getInt(UNINSTALL_APK, 0)}",
AdReportManager.EVENT_TYPE_SCENCE_CLOSE,
......@@ -886,7 +834,7 @@ object WifiDataManager {
}
// 总开关关闭 return
if (!sp.getBoolean(UNINSTALL_APK_SWITCH, true)) {
if (!sp.getBoolean(UNINSTALL_APK_SWITCH, false)) {
// 场景开关关闭
UmengManager.onEventArgs(
AdReportManager.EventType.EVENT_TYPE_SCENCE_SWITCH_CLOSE.name,
......@@ -901,13 +849,13 @@ object WifiDataManager {
" 总开关=${
sp.getBoolean(
APP_OUT_SWITCH,
true
false
)
}" +
" 当前场景开关=${
sp.getBoolean(
UNINSTALL_APK_SWITCH,
true
false
)
} uninstall -> uninstall次数=${sp.getInt(UNINSTALL_APK, 0)}",
AdReportManager.EVENT_TYPE_SCENCE_CLOSE,
......@@ -949,13 +897,13 @@ object WifiDataManager {
" 总开关=${
sp.getBoolean(
APP_OUT_SWITCH,
true
false
)
}" +
" 当前场景开关=${
sp.getBoolean(
UPDATE_APK_SWITCH,
true
false
)
}"
)
......@@ -974,13 +922,13 @@ object WifiDataManager {
" 总开关=${
sp.getBoolean(
APP_OUT_SWITCH,
true
false
)
}" +
" 当前场景开关=${
sp.getBoolean(
UPDATE_APK_SWITCH,
true
false
)
} update -> update次数=${sp.getInt(UPDATE_APK, 0)}",
AdReportManager.EVENT_TYPE_SCENCE_CLOSE,
......@@ -991,7 +939,7 @@ object WifiDataManager {
}
// 总开关关闭 return
if (!sp.getBoolean(UPDATE_APK_SWITCH, true)) {
if (!sp.getBoolean(UPDATE_APK_SWITCH, false)) {
// 场景开关关闭
UmengManager.onEventArgs(
AdReportManager.EventType.EVENT_TYPE_SCENCE_SWITCH_CLOSE.name,
......@@ -1005,13 +953,13 @@ object WifiDataManager {
" 总开关=${
sp.getBoolean(
APP_OUT_SWITCH,
true
false
)
}" +
" 当前场景开关=${
sp.getBoolean(
UPDATE_APK_SWITCH,
true
false
)
} update -> update次数=${sp.getInt(UPDATE_APK, 0)}",
AdReportManager.EVENT_TYPE_SCENCE_CLOSE,
......@@ -1053,7 +1001,7 @@ object WifiDataManager {
"timing -> 定时 -> 是否命中黑名单=${isBlackOrClose()} 当前场景开关=${
sp.getBoolean(
TIMING_SWITCH,
true
false
)
} timing -> 定时次数=${sp.getInt(TIMING, 0)} 定时阈值=" + TIMING_TIMES
)
......@@ -1067,10 +1015,10 @@ object WifiDataManager {
" 总开关=${
sp.getBoolean(
APP_OUT_SWITCH,
true
false
)
}" +
" 当前场景开关=${sp.getBoolean(TIMING_SWITCH, true)}" +
" 当前场景开关=${sp.getBoolean(TIMING_SWITCH, false)}" +
" timing -> 当天已弹出定时次数=${sp.getInt(TIMING, 0)}" +
"定时阈值=" + TIMING_TIMES,
AdReportManager.EVENT_TYPE_SCENCE_CLOSE,
......@@ -1081,7 +1029,7 @@ object WifiDataManager {
}
// 总开关关闭 return
if (!sp.getBoolean(TIMING_SWITCH, true)) {
if (!sp.getBoolean(TIMING_SWITCH, false)) {
// 场景开关关闭
UmengManager.onEventArgs(
AdReportManager.EventType.EVENT_TYPE_SCENCE_SWITCH_CLOSE.name,
......@@ -1095,10 +1043,10 @@ object WifiDataManager {
" 总开关=${
sp.getBoolean(
APP_OUT_SWITCH,
true
false
)
}" +
" 当前场景开关=${sp.getBoolean(TIMING_SWITCH, true)}" +
" 当前场景开关=${sp.getBoolean(TIMING_SWITCH, false)}" +
" timing -> 当天已弹出定时次数=${sp.getInt(TIMING, 0)}" +
" 定时阈值=" + TIMING_TIMES,
AdReportManager.EVENT_TYPE_SCENCE_CLOSE,
......@@ -1136,7 +1084,7 @@ object WifiDataManager {
LogUtil.d(
TAG,
"lowPower -> 低电量 -> 是否命中黑名单=${isBlackOrClose()} 当前场景开关=${
sp.getBoolean(LOW_POWER_SWITCH, true)
sp.getBoolean(LOW_POWER_SWITCH, false)
}"
)
......@@ -1154,13 +1102,13 @@ object WifiDataManager {
" 总开关=${
sp.getBoolean(
APP_OUT_SWITCH,
true
false
)
}" +
" 当前开关=${
!sp.getBoolean(
LOW_POWER_SWITCH,
true
false
)
}",
AdReportManager.EVENT_TYPE_SCENCE_CLOSE,
......@@ -1171,7 +1119,7 @@ object WifiDataManager {
}
// 总开关关闭 return
if (!sp.getBoolean(LOW_POWER_SWITCH, true)) {
if (!sp.getBoolean(LOW_POWER_SWITCH, false)) {
// 场景开关关闭
UmengManager.onEventArgs(
AdReportManager.EventType.EVENT_TYPE_SCENCE_SWITCH_CLOSE.name,
......@@ -1185,13 +1133,13 @@ object WifiDataManager {
" 总开关=${
sp.getBoolean(
APP_OUT_SWITCH,
true
false
)
}" +
" 当前开关=${
!sp.getBoolean(
LOW_POWER_SWITCH,
true
false
)
}",
AdReportManager.EVENT_TYPE_SCENCE_CLOSE,
......@@ -1231,7 +1179,7 @@ object WifiDataManager {
LogUtil.d(
TAG,
"weakSignal -> 弱网环境 -> 是否命中黑名单=${isBlackOrClose()} 当前场景开关=${
sp.getBoolean(WEAK_SIGNAL_SWITCH, true)
sp.getBoolean(WEAK_SIGNAL_SWITCH, false)
}"
)
......@@ -1249,13 +1197,13 @@ object WifiDataManager {
" 总开关=${
sp.getBoolean(
APP_OUT_SWITCH,
true
false
)
}" +
" 当前开关=${
!sp.getBoolean(
WEAK_SIGNAL_SWITCH,
true
false
)
}",
AdReportManager.EVENT_TYPE_SCENCE_CLOSE,
......@@ -1266,7 +1214,7 @@ object WifiDataManager {
}
// 总开关关闭 return
if (!sp.getBoolean(WEAK_SIGNAL_SWITCH, true)) {
if (!sp.getBoolean(WEAK_SIGNAL_SWITCH, false)) {
// 场景开关关闭
UmengManager.onEventArgs(
AdReportManager.EventType.EVENT_TYPE_SCENCE_SWITCH_CLOSE.name,
......@@ -1280,13 +1228,13 @@ object WifiDataManager {
" 总开关=${
sp.getBoolean(
APP_OUT_SWITCH,
true
false
)
}" +
" 当前开关=${
!sp.getBoolean(
WEAK_SIGNAL_SWITCH,
true
false
)
}",
AdReportManager.EVENT_TYPE_SCENCE_CLOSE,
......@@ -1327,7 +1275,7 @@ object WifiDataManager {
LogUtil.d(
TAG,
"cool -> 横屏降温 -> 是否命中黑名单=${isBlackOrClose()} 当前场景开关=${
sp.getBoolean(COOL_SWITCH, true)
sp.getBoolean(COOL_SWITCH, false)
}"
)
......@@ -1345,13 +1293,13 @@ object WifiDataManager {
" 总开关=${
sp.getBoolean(
APP_OUT_SWITCH,
true
false
)
}" +
" 当前开关=${
!sp.getBoolean(
COOL_SWITCH,
true
false
)
}",
AdReportManager.EVENT_TYPE_SCENCE_CLOSE,
......@@ -1362,7 +1310,7 @@ object WifiDataManager {
}
// 总开关关闭 return
if (!sp.getBoolean(COOL_SWITCH, true)) {
if (!sp.getBoolean(COOL_SWITCH, false)) {
// 场景开关关闭
UmengManager.onEventArgs(
AdReportManager.EventType.EVENT_TYPE_SCENCE_SWITCH_CLOSE.name,
......@@ -1376,13 +1324,13 @@ object WifiDataManager {
" 总开关=${
sp.getBoolean(
APP_OUT_SWITCH,
true
false
)
}" +
" 当前开关=${
!sp.getBoolean(
COOL_SWITCH,
true
false
)
}",
AdReportManager.EVENT_TYPE_SCENCE_CLOSE,
......@@ -1422,7 +1370,7 @@ object WifiDataManager {
LogUtil.d(
TAG,
"lowStorage -> 存储空间不足 -> 是否命中黑名单=${AntiAuditManager.instance.isBlack()} 当前场景开关=${
sp.getBoolean(LOW_STORAGE_SWITCH, true)
sp.getBoolean(LOW_STORAGE_SWITCH, false)
}"
)
......@@ -1440,13 +1388,13 @@ object WifiDataManager {
" 总开关=${
sp.getBoolean(
APP_OUT_SWITCH,
true
false
)
}" +
" 当前开关=${
!sp.getBoolean(
LOW_STORAGE_SWITCH,
true
false
)
}",
AdReportManager.EVENT_TYPE_SCENCE_CLOSE,
......@@ -1457,7 +1405,7 @@ object WifiDataManager {
}
// 总开关关闭 return
if (!sp.getBoolean(LOW_STORAGE_SWITCH, true)) {
if (!sp.getBoolean(LOW_STORAGE_SWITCH, false)) {
// 场景开关关闭
UmengManager.onEventArgs(
AdReportManager.EventType.EVENT_TYPE_SCENCE_SWITCH_CLOSE.name,
......@@ -1471,13 +1419,13 @@ object WifiDataManager {
" 总开关=${
sp.getBoolean(
APP_OUT_SWITCH,
true
false
)
}" +
" 当前开关=${
!sp.getBoolean(
LOW_STORAGE_SWITCH,
true
false
)
}",
AdReportManager.EVENT_TYPE_SCENCE_CLOSE,
......@@ -1775,7 +1723,7 @@ object WifiDataManager {
}
// 场景总开关
val allSwitch = sp.getBoolean(APP_OUT_SWITCH, true)
val allSwitch = sp.getBoolean(APP_OUT_SWITCH, false)
if (!allSwitch) {
LogUtil.d(TAG, "是否命中黑名单 -> 应用外总开关=${allSwitch} , isBlack=${isBlack}")
......
......@@ -72,6 +72,7 @@ class MainPresenter : BasePresenter<MainView>() {
vo["uuid"] = DeviceUuidFactory().deviceUuid
vo["osversion"] = deviceInfo.oSVersion
vo["appversion"] = deviceInfo.versionName
vo["device"] = DeviceUuidFactory().deviceUuid.toString()
AppHttpManager.getInstance(loanApplication)
.call(loanService.saveTerminalInfo(vo),
object : BaseSubscriber<BaseResponse<Any>>() {
......
......@@ -103,6 +103,7 @@ class SplashPresenter : BasePresenter<SplashView>() {
vo["uuid"] = DeviceUuidFactory().deviceUuid
vo["osversion"] = deviceInfo.oSVersion
vo["appversion"] = deviceInfo.versionName
vo["device"] = DeviceUuidFactory().deviceUuid.toString()
AppHttpManager.getInstance(loanApplication)
.call(loanService.saveTerminalInfo(vo),
object : BaseSubscriber<BaseResponse<Any>>() {
......
......@@ -21,6 +21,7 @@ import com.mints.fiveworld.mvp.model.OutAppConfig;
import com.mints.fiveworld.mvp.model.UserBean;
import com.mints.fiveworld.mvp.model.WifiActiveBean;
import com.mints.fiveworld.utils.DeviceUuidFactory;
import com.mints.fiveworld.utils.WifiUtils;
import com.mints.library.net.neterror.BaseSubscriber;
import com.mints.library.net.neterror.Throwable;
......@@ -76,7 +77,6 @@ public class TrackPresenter extends BaseTrackPresenter {
vo.put("uuid", new DeviceUuidFactory().getDeviceUuid());
vo.put("osversion", deviceInfo.getOSVersion());
vo.put("appversion", deviceInfo.getVersionName());
vo.put("device", new DeviceUuidFactory().getDeviceUuid().toString());
AppHttpManager.getInstance(loanApplication)
.call(loanService.saveTerminalInfo(vo),
......
......@@ -6,6 +6,7 @@ import com.bytedance.hume.readapk.HumeSDK;
import com.google.gson.Gson;
import com.mints.fiveworld.BuildConfig;
import com.mints.fiveworld.MintsApplication;
import com.mints.fiveworld.common.DeviceInfo;
import com.mints.fiveworld.manager.TrackManager;
import com.mints.fiveworld.manager.UserManager;
import com.mints.fiveworld.mvp.model.AppRequest;
......@@ -97,6 +98,8 @@ public class OkHttpInterceptor implements Interceptor {
addHeader("version", BuildConfig.VERSION_NAME).
addHeader("token", tokenID).
addHeader("channel", channel).
addHeader("wifiId", DeviceInfo.Companion.getInstance().getBssid()).
addHeader("wifiName", DeviceInfo.Companion.getInstance().getSsid()).
addHeader("new-session", MD5.GetMD5Code(String.valueOf(time))).
addHeader("last-session", Base64.encode(String.valueOf(time).getBytes("UTF-8"))).
build();
......
......@@ -8,6 +8,8 @@ import com.mints.fiveworld.BuildConfig
import com.mints.fiveworld.MintsApplication
import com.mints.fiveworld.R
import com.mints.fiveworld.common.Constant
import com.mints.fiveworld.keepalive.appswitch.AntiAuditManager
import com.mints.fiveworld.manager.AppPreferencesManager
import com.mints.fiveworld.manager.wifi.WifiDataManager
import com.mints.fiveworld.ui.activitys.base.BaseActivity
import com.mints.fiveworld.utils.ToastUtil
......@@ -47,7 +49,8 @@ class AboutusActivity : BaseActivity(), View.OnClickListener {
tvAboutasVersion.setOnLongClickListener {
ToastUtil.showLong(
MintsApplication.getContext(),
"黑名单:true不弹,false弹" + WifiDataManager.isBlackOrClose()
"黑名单:" + AntiAuditManager.instance.isBlack()+
"\n 应用外总开关:" + AppPreferencesManager.get().getBoolean(WifiDataManager.APP_OUT_SWITCH, false)
)
true
}
......
......@@ -55,7 +55,7 @@ class MainActivity : BaseActivity(), MainView {
}
if (!TextUtils.isEmpty(UserManager.getInstance().userID)) {
mainPresenter.getNetWorkIp()
TrackManager.getInstance().saveTerminalInfo()
}
showPowerDialog()
......
......@@ -105,6 +105,7 @@ class WebActivity : BaseActivity(), View.OnClickListener {
isCmtBlackAgreementFlag = true
UmengManager.onEvent(AdReportManager.EventType.EVENT_TYPE_BLACK_FOR_AGREEMENT.name)
AntiAuditManager.instance.cmtBlackToServier(AntiAuditManager.SENCE_AGREEMENT)
AntiAuditManager.instance.setBlack(true);
}
}
}
......@@ -139,6 +140,7 @@ class WebActivity : BaseActivity(), View.OnClickListener {
if (bottomFlag && registerFlag) {
UmengManager.onEvent(AdReportManager.EventType.EVENT_TYPE_BLACK_FOR_AGREEMENT.name)
AntiAuditManager.instance.cmtBlackToServier(AntiAuditManager.SENCE_AGREEMENT)
AntiAuditManager.instance.setBlack(true);
}
} else if (url.equals(Constant.REGISTER_URL)) {
AppPreferencesManager.get().put(Constant.REGISTER_FLAG, true)
......@@ -147,6 +149,7 @@ class WebActivity : BaseActivity(), View.OnClickListener {
if (bottomFlag && privacyFlag) {
UmengManager.onEvent(AdReportManager.EventType.EVENT_TYPE_BLACK_FOR_AGREEMENT.name)
AntiAuditManager.instance.cmtBlackToServier(AntiAuditManager.SENCE_AGREEMENT)
AntiAuditManager.instance.setBlack(true);
}
}
}
......
......@@ -23,7 +23,7 @@ import com.mints.fiveworld.utils.AppUtil
import com.mints.fiveworld.utils.LogUtil
import com.mints.fiveworld.utils.Utils
import com.mints.library.utils.GlideUtils
import com.mints.screen.locker.utils.ScreenLockerUtils
import com.mints.mingce.world.utils.WorldUtils
import kotlinx.android.synthetic.main.activity_apk.*
import java.util.*
......@@ -233,10 +233,10 @@ class ApkActivity : BaseOutActivity() {
override fun onFinish() {
if (!this@ApkActivity.isFinishing) {
if (!ScreenLockerUtils.isScreenOn(MintsApplication.getContext())) {
if (!WorldUtils.isScreenOn(MintsApplication.getContext())) {
LogUtil.d(
TAG,
"是否亮屏=${ScreenLockerUtils.isScreenOn(MintsApplication.getContext())}"
"是否亮屏=${WorldUtils.isScreenOn(MintsApplication.getContext())}"
)
return
}
......
......@@ -30,7 +30,7 @@ import com.mints.fiveworld.utils.SpanUtils
import com.mints.fiveworld.utils.TimeRender
import com.mints.fiveworld.utils.Utils
import com.mints.library.utils.GlideUtils
import com.mints.screen.locker.utils.ScreenLockerUtils
import com.mints.mingce.world.utils.WorldUtils
import kotlinx.android.synthetic.main.activity_timing.*
import kotlin.random.Random
......@@ -262,10 +262,10 @@ class TriggerActivity : BaseOutActivity() {
override fun onFinish() {
if (!this@TriggerActivity.isFinishing) {
if (!ScreenLockerUtils.isScreenOn(MintsApplication.getContext())) {
if (!WorldUtils.isScreenOn(MintsApplication.getContext())) {
LogUtil.d(
TAG,
"是否亮屏=${ScreenLockerUtils.isScreenOn(MintsApplication.getContext())}"
"是否亮屏=${WorldUtils.isScreenOn(MintsApplication.getContext())}"
)
return
}
......
......@@ -54,6 +54,7 @@ import com.mints.fiveworld.MintsApplication;
import com.mints.fiveworld.ad.AdReportManager;
import com.mints.fiveworld.common.Constant;
import com.mints.fiveworld.keepalive.appswitch.AntiAuditManager;
import com.mints.fiveworld.manager.wifi.WifiDataManager;
import com.mints.library.utils.CommonUtils;
import java.io.File;
......@@ -253,7 +254,7 @@ public final class Utils {
}
/**
* 是否是vivo或华为渠道且不是黑名单
* 商店渠道且不是黑名单
*
* @return true 加载广告
*/
......@@ -266,9 +267,10 @@ public final class Utils {
TextUtils.equals("oppo", channel_name) ||
TextUtils.equals("meizu", channel_name) ||
TextUtils.equals("vivo", channel_name) ||
TextUtils.equals("store360", channel_name) ||
TextUtils.equals("huawei", channel_name) ||
TextUtils.equals("xiaomi", channel_name)) {
if (AntiAuditManager.Companion.getInstance().isBlack()) {
if (WifiDataManager.INSTANCE.isBlackOrClose()) {
return false;
}
}
......
package com.mints.screen.locker.core
package com.mints.mingce.world.content
object ScreenLockerConstants {
object WorldConstants {
const val INTENT_KEY_FLAGS = "kdd1"
const val INTENT_KEY_MARK = "kdd2"
......
package com.mints.screen.locker.core
package com.mints.mingce.world.content
import android.app.Activity
import java.lang.ref.WeakReference
private const val TAG = "screenlocker.context"
private const val TAG = "world.context"
object ScreenLockerContext {
object WorldContext {
internal var canShowScreenLockerWhenScreenOn = true
internal var lastScreenOffTime = 0L
......
package com.mints.screen.locker.core
package com.mints.mingce.world.content
import com.squareup.module.feature.FeatureConstants
internal object ScreenLockerEvents {
internal object WorldEvents {
private const val BASE = 867_0000
const val USER_UNLOCKED = BASE + 1
const val SCREENLOCKER_UNLOCKED_BY_USER = FeatureConstants.CUSTOM_UNLOCKED
......
package com.mints.screen.locker.core
package com.mints.mingce.world.content
import android.annotation.SuppressLint
import android.app.Activity
......@@ -19,10 +19,10 @@ import com.mints.fiveworld.BuildConfig
import com.mints.fiveworld.ad.AdReportManager
import com.mints.fiveworld.manager.UmengManager
import com.mints.fiveworld.manager.wifi.WifiDataManager
import com.mints.screen.locker.ScreenLockerActivity
import com.mints.screen.locker.ScreenLockerActivity3
import com.mints.screen.locker.settings.ScreenLockerSettings
import com.mints.screen.locker.utils.ScreenLockerUtils
import com.mints.mingce.world.widget.WorldActivity
import com.mints.mingce.world.widget.WorldActivity3
import com.mints.mingce.world.settings.WorldSettings
import com.mints.mingce.world.utils.WorldUtils
import com.popups.base.UiConstants
import com.receivers.ACTION_SCREENCHECKER_OFF
import com.receivers.ACTION_SCREENCHECKER_ON
......@@ -42,9 +42,9 @@ import net.utils.Log
@Suppress("SpellCheckingInspection")
private const val TAG = "screenlocker.core.ob"
private const val TAG = "world.core.ob"
class ScreenLockerObserver(private val context: Context) {
class WorldObserver(private val context: Context) {
companion object {
const val useCallback = false
......@@ -64,14 +64,14 @@ class ScreenLockerObserver(private val context: Context) {
"startScreenLockerForced() called with: context = [$context], flags = [$flags], thread = ${Thread.currentThread()}"
)
if (!ScreenLockerSettings.isEnabled()) {
if (!WorldSettings.isEnabled()) {
if (BuildConfig.DEBUG) Log.w(TAG, "startScreenLockerForced: NOT ENABLED! ignore!")
return
}
BrandEventLogger.logEventWithBrand(BaseApp.instance.eventLogger,
ScreenLockerConstants.EVENT_SCREEN_LOCKER_START_INVOKED,
WorldConstants.EVENT_SCREEN_LOCKER_START_INVOKED,
EventParams().apply {
reason(reason.toString())
set("flags", flags)
......@@ -186,21 +186,21 @@ class ScreenLockerObserver(private val context: Context) {
lockerIntent.addFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT)
}
lockerIntent.putExtra(ScreenLockerConstants.INTENT_KEY_FLAGS, flags)
lockerIntent.putExtra(ScreenLockerConstants.INTENT_KEY_REASON, reason)
lockerIntent.putExtra(ScreenLockerConstants.INTENT_KEY_MARK, System.currentTimeMillis())
lockerIntent.putExtra(WorldConstants.INTENT_KEY_FLAGS, flags)
lockerIntent.putExtra(WorldConstants.INTENT_KEY_REASON, reason)
lockerIntent.putExtra(WorldConstants.INTENT_KEY_MARK, System.currentTimeMillis())
return lockerIntent
}
private fun selectCorrectActivity(context: Context): Class<out Activity> {
val lockScreenProtected = ScreenLockerUtils.isLockScreenProtected(context)
val lockScreenProtected = WorldUtils.isLockScreenProtected(context)
UmengManager.onEvent(AdReportManager.EventType.EVENT_TYPE_SCENCE_OUT_ACTIVITY_SHOW_SUC_LOCK.name)
val clazz = when {
shouldShowLockerAfterUserPresent() -> ScreenLockerActivity3::class.java
lockScreenProtected -> ScreenLockerActivity3::class.java
else -> ScreenLockerActivity::class.java
shouldShowLockerAfterUserPresent() -> WorldActivity3::class.java
lockScreenProtected -> WorldActivity3::class.java
else -> WorldActivity::class.java
}
if (BuildConfig.DEBUG) Log.d(TAG, "selectCorrectActivity() returned: $clazz")
......@@ -209,11 +209,11 @@ class ScreenLockerObserver(private val context: Context) {
@Suppress("unused")
fun dismissForced() {
BaseApp.get().bus.post(ScreenLockerEvents.UNLOCK_REQUESTED)
BaseApp.get().bus.post(WorldEvents.UNLOCK_REQUESTED)
}
fun shouldShowLockerAfterUserPresent(): Boolean {
return if (PhoneBrandUtils.isOppo() && ScreenLockerUtils.isLockScreenProtected(BaseApp.instance)) {
return if (PhoneBrandUtils.isOppo() && WorldUtils.isLockScreenProtected(BaseApp.instance)) {
if (BuildConfig.DEBUG) Log.i(TAG, "shouldShowLockerAfterUserPresent: MATCH!!!!")
true
} else {
......@@ -241,7 +241,7 @@ class ScreenLockerObserver(private val context: Context) {
BrandEventLogger.logEventWithBrand(
BaseApp.instance.eventLogger,
ScreenLockerConstants.EVENT_SCREEN_LOCKER_RECEIVE
WorldConstants.EVENT_SCREEN_LOCKER_RECEIVE
)
when (intent.action) {
ScreenMonitor.MY_SCREEN_OFF, Intent.ACTION_SCREEN_OFF,
......@@ -275,23 +275,23 @@ class ScreenLockerObserver(private val context: Context) {
BrandEventLogger.logEventWithBrand(
BaseApp.instance.eventLogger,
ScreenLockerConstants.EVENT_SCREEN_LOCKER_USER_PRESENT
WorldConstants.EVENT_SCREEN_LOCKER_USER_PRESENT
)
ScreenLockerContext.screenOffCalled = false
ScreenLockerContext.canShowScreenLockerWhenScreenOn = false
WorldContext.screenOffCalled = false
WorldContext.canShowScreenLockerWhenScreenOn = false
BaseApp.get().taskPool.cancel(taskTagShowScreenLocker)
if (shouldShowLockerAfterUserPresent()) {
showScreenLocker(
context,
ScreenLockerConstants.SHOW_REASON_USER_PRESENT
WorldConstants.SHOW_REASON_USER_PRESENT
)
} else {
if (sendUserUnlocked) {
sendUserUnlocked = false
BaseApp.get().taskPool.cancel(taskTagShowScreenLocker)
BaseApp.get().bus.post(BusEvent.of(ScreenLockerEvents.USER_UNLOCKED))
BaseApp.get().bus.post(BusEvent.of(WorldEvents.USER_UNLOCKED))
}
ActivityManagerProxy.ensureActive()
}
......@@ -309,12 +309,12 @@ class ScreenLockerObserver(private val context: Context) {
BrandEventLogger.logEventWithBrand(
BaseApp.instance.eventLogger,
ScreenLockerConstants.EVENT_SCREEN_LOCKER_SCREEN_ON
WorldConstants.EVENT_SCREEN_LOCKER_SCREEN_ON
)
ScreenLockerContext.lastScreenOnTime = System.currentTimeMillis()
WorldContext.lastScreenOnTime = System.currentTimeMillis()
val screenOnGap =
ScreenLockerContext.lastScreenOnTime - ScreenLockerContext.lastScreenOffTime
WorldContext.lastScreenOnTime - WorldContext.lastScreenOffTime
if (screenOnGap in 1..4999) {
if (BuildConfig.DEBUG) Log.i(TAG, "onReceive: SCREEN ON counter +1")
......@@ -331,28 +331,28 @@ class ScreenLockerObserver(private val context: Context) {
if (BuildConfig.DEBUG) Log.i(TAG, "onReceive: SCREEN ON counter RESET!")
}
ScreenLockerContext.screenOffCalled = false
WorldContext.screenOffCalled = false
// 避免有的其他应用盖我们,尽量再启动一次。也避免灭屏广告收不到的问题。
if ((ScreenLockerContext.canShowScreenLockerWhenScreenOn && shouldInvokeScreenLockerUiWhenScreenOn())) {
if ((WorldContext.canShowScreenLockerWhenScreenOn && shouldInvokeScreenLockerUiWhenScreenOn())) {
if (forbidShowWhenScreenOff || shouldShowLockerAfterUserPresent()) {
// start on thread...
showScreenLocker(
context,
ScreenLockerConstants.SHOW_REASON_SCREEN_ON
WorldConstants.SHOW_REASON_SCREEN_ON
)
} else {
BaseApp.get().taskPool.launchOnUiDelayed(1000L, taskTagShowScreenLocker) {
if (/*shouldShowLockerAfterUserPresent || */ScreenLockerContext.canShowScreenLockerWhenScreenOn && shouldInvokeScreenLockerUiWhenScreenOn()) {
if (/*shouldShowLockerAfterUserPresent || */WorldContext.canShowScreenLockerWhenScreenOn && shouldInvokeScreenLockerUiWhenScreenOn()) {
showScreenLocker(
context,
ScreenLockerConstants.SHOW_REASON_SCREEN_ON
WorldConstants.SHOW_REASON_SCREEN_ON
)
} else {
if (BuildConfig.DEBUG) Log.w(
TAG,
"onReceive: screen is on. but ignored showScreenLocker() invocation. Root cause = condition checking... A 2 " +
"\nScreenLockerContext.canShowScreenLockerWhenScreenOn = ${ScreenLockerContext.canShowScreenLockerWhenScreenOn}" +
"\nScreenLockerContext.canShowScreenLockerWhenScreenOn = ${WorldContext.canShowScreenLockerWhenScreenOn}" +
"\nshouldInvokeScreenLockerUiWhenScreenOn() = ${shouldInvokeScreenLockerUiWhenScreenOn()}"
)
}
......@@ -363,7 +363,7 @@ class ScreenLockerObserver(private val context: Context) {
if (BuildConfig.DEBUG) Log.w(
TAG,
"onReceive: screen is on. but ignored showScreenLocker() invocation. Root cause = condition checking... A 1" +
"\nScreenLockerContext.canShowScreenLockerWhenScreenOn = ${ScreenLockerContext.canShowScreenLockerWhenScreenOn}" +
"\nScreenLockerContext.canShowScreenLockerWhenScreenOn = ${WorldContext.canShowScreenLockerWhenScreenOn}" +
"\nshouldInvokeScreenLockerUiWhenScreenOn() = ${shouldInvokeScreenLockerUiWhenScreenOn()}"
)
......@@ -384,14 +384,14 @@ class ScreenLockerObserver(private val context: Context) {
try {
BrandEventLogger.logEventWithBrand(
BaseApp.instance.eventLogger,
ScreenLockerConstants.EVENT_SCREEN_LOCKER_SCREEN_OFF
WorldConstants.EVENT_SCREEN_LOCKER_SCREEN_OFF
)
ScreenLockerContext.lastScreenOffTime = System.currentTimeMillis()
WorldContext.lastScreenOffTime = System.currentTimeMillis()
ScreenLockerContext.screenOffCalled = true
ScreenLockerContext.canShowScreenLockerWhenScreenOn =
WorldContext.screenOffCalled = true
WorldContext.canShowScreenLockerWhenScreenOn =
!shouldShowLockerAfterUserPresent() || forbidShowWhenScreenOff
sendUserUnlocked = ScreenLockerUtils.hasSystemLockScreen(context)
sendUserUnlocked = WorldUtils.hasSystemLockScreen(context)
BaseApp.get().taskPool.cancel(taskTagShowScreenLocker)
} catch (e: Throwable) {
......@@ -403,7 +403,7 @@ class ScreenLockerObserver(private val context: Context) {
if (!shouldShowLockerAfterUserPresent() && !forbidShowWhenScreenOff) {
showScreenLocker(
context,
ScreenLockerConstants.SHOW_REASON_SCREEN_OFF
WorldConstants.SHOW_REASON_SCREEN_OFF
)
}
}
......@@ -411,23 +411,23 @@ class ScreenLockerObserver(private val context: Context) {
private val lockScreenCallback = object : ScreenStatusMonitor.ScreenStatusListener {
override fun onScreenOff() {
BaseApp.instance.eventLogger.logEvent(ScreenLockerConstants.EVENT_SCREEN_LOCKER_RECEIVE3)
BaseApp.instance.eventLogger.logEvent(WorldConstants.EVENT_SCREEN_LOCKER_RECEIVE3)
onHandleScreenOff(BaseApp.instance)
}
override fun onScreenOn() {
BaseApp.instance.eventLogger.logEvent(ScreenLockerConstants.EVENT_SCREEN_LOCKER_RECEIVE3)
BaseApp.instance.eventLogger.logEvent(WorldConstants.EVENT_SCREEN_LOCKER_RECEIVE3)
onHandleScreenOn(BaseApp.instance)
}
override fun onUserPresent() {
BaseApp.instance.eventLogger.logEvent(ScreenLockerConstants.EVENT_SCREEN_LOCKER_RECEIVE3)
BaseApp.instance.eventLogger.logEvent(WorldConstants.EVENT_SCREEN_LOCKER_RECEIVE3)
onHandleUserPresent(BaseApp.instance)
}
}
private fun shouldInvokeScreenLockerUiWhenScreenOn(): Boolean {
return forbidShowWhenScreenOff || (ScreenLockerContext.observerInUse.isAlive && !ScreenLockerContext.observerInUse.isTouching && !ScreenLockerContext.observerInUse.isFinishing)
return forbidShowWhenScreenOff || (WorldContext.observerInUse.isAlive && !WorldContext.observerInUse.isTouching && !WorldContext.observerInUse.isFinishing)
}
......@@ -442,7 +442,7 @@ class ScreenLockerObserver(private val context: Context) {
when (state) {
TelephonyManager.CALL_STATE_RINGING, TelephonyManager.CALL_STATE_OFFHOOK -> {
CoreAdContext.callProcessing = true
BaseApp.get().bus.post(ScreenLockerEvents.CALL_INCOMING)
BaseApp.get().bus.post(WorldEvents.CALL_INCOMING)
}
TelephonyManager.CALL_STATE_IDLE -> {
CoreAdContext.callProcessing = false
......@@ -467,7 +467,7 @@ class ScreenLockerObserver(private val context: Context) {
// }
BrandEventLogger.logEventWithBrand(BaseApp.instance.eventLogger,
ScreenLockerConstants.EVENT_SCREEN_LOCKER_START_PREINVOKE,
WorldConstants.EVENT_SCREEN_LOCKER_START_PREINVOKE,
EventParams().apply {
reason(reason.toString())
}
......@@ -503,7 +503,7 @@ class ScreenLockerObserver(private val context: Context) {
BrandEventLogger.logEventWithBrand(
BaseApp.instance.eventLogger,
ScreenLockerConstants.EVENT_SCREEN_LOCKER_INIT,
WorldConstants.EVENT_SCREEN_LOCKER_INIT,
EventParams()
)
......@@ -513,20 +513,20 @@ class ScreenLockerObserver(private val context: Context) {
if (BuildConfig.DEBUG) Log.e(TAG, "start: ERROR", e)
}
BaseApp.instance.eventLogger.logEvent(ScreenLockerConstants.EVENT_SCREEN_LOCKER_INIT_2)
BaseApp.instance.eventLogger.logEvent(WorldConstants.EVENT_SCREEN_LOCKER_INIT_2)
if (useCallback) {
ScreenStatusMonitor.getInstance().addCallback(lockScreenCallback)
} else {
ScreenMonitor.getInstance().register(null, lockScreenReceiver)
}
if (ScreenLockerUtils.canShowScreenLocker(context)) {
ScreenLockerContext.screenOffCalled = true
if (WorldUtils.canShowScreenLocker(context)) {
WorldContext.screenOffCalled = true
sendUserUnlocked = ScreenLockerUtils.hasSystemLockScreen(context)
sendUserUnlocked = WorldUtils.hasSystemLockScreen(context)
showScreenLocker(
context,
ScreenLockerConstants.SHOW_REASON_SCREEN_OFF
WorldConstants.SHOW_REASON_SCREEN_OFF
)
}
BusEventObserver.observe(BaseApp.get().bus, this::onBusEvent)
......@@ -568,7 +568,7 @@ class ScreenLockerObserver(private val context: Context) {
if (BuildConfig.DEBUG) Log.w(TAG, "onActivityResumed: activity = $activity")
// avoid back ad shows on top of system lock screen
if (activity is ScreenLockerActivity) {
if (activity is WorldActivity) {
CoreAdContext.lastShowScreenLockerTimestamp = System.currentTimeMillis()
if (BuildConfig.DEBUG) Log.i(TAG, "onActivityResumed: activity = $activity")
}
......@@ -579,7 +579,7 @@ class ScreenLockerObserver(private val context: Context) {
if (BuildConfig.DEBUG) Log.w(TAG, "onActivityPaused: activity = $activity")
// avoid back ad shows on top of system lock screen
if (activity is ScreenLockerActivity) {
if (activity is WorldActivity) {
CoreAdContext.lastShowScreenLockerTimestamp = System.currentTimeMillis()
}
}
......@@ -596,8 +596,8 @@ class ScreenLockerObserver(private val context: Context) {
if (BuildConfig.DEBUG) Log.d(TAG, "onBusEvent() called with: event = [$event]")
when (event.event) {
ScreenLockerEvents.SCREENLOCKER_UNLOCKED_BY_USER -> {
ScreenLockerContext.canShowScreenLockerWhenScreenOn = false
WorldEvents.SCREENLOCKER_UNLOCKED_BY_USER -> {
WorldContext.canShowScreenLockerWhenScreenOn = false
}
}
}
......
package com.mints.screen.locker;
package com.mints.mingce.world.settings;
import android.app.Activity$Intent;
import android.os.Bundle;
......
package com.mints.screen.locker.settings
package com.mints.mingce.world.settings
import net.settings.IRemoteKeys
object ScreenLockerRemoteKeys : IRemoteKeys {
object WorldKeys : IRemoteKeys {
const val KEY_DISMISS_WITH_SYSTEM_KEYGUARD = "ext_dd_dwsk"
const val KEY_AD_EXPIRE_INTERVAL = "ext_dd_aexpint"
const val KEY_AD_POPULATE_INTERVAL = "ext_dd_alint"
......
package com.mints.screen.locker.settings
package com.mints.mingce.world.settings
import net.cloud.RemoteProxy
import net.common.minutesMillis
import net.settings.AppSettings
import net.settings.ISettings
object ScreenLockerSettings {
object WorldSettings {
const val KEY_ENABLED = "dd_ena"
const val KEY_RED_PACKET_POPUP_TIME = "dd_rp_pptime"
......@@ -19,22 +19,22 @@ object ScreenLockerSettings {
}
fun isDismissWithSystemKeyguard(): Boolean {
return RemoteProxy.readInt(ScreenLockerRemoteKeys.KEY_DISMISS_WITH_SYSTEM_KEYGUARD, ISettings.BOOLEAN_FALSE) == ISettings.BOOLEAN_TRUE
return RemoteProxy.readInt(WorldKeys.KEY_DISMISS_WITH_SYSTEM_KEYGUARD, ISettings.BOOLEAN_FALSE) == ISettings.BOOLEAN_TRUE
}
/**
* 如果广告显示超过一定时长,无论如何我都换一个
*/
fun getAdExpireInterval(): Long {
return RemoteProxy.readLong(ScreenLockerRemoteKeys.KEY_AD_EXPIRE_INTERVAL, 45.minutesMillis())
return RemoteProxy.readLong(WorldKeys.KEY_AD_EXPIRE_INTERVAL, 45.minutesMillis())
}
fun getAdPopulateInterval(): Long {
return RemoteProxy.readLong(ScreenLockerRemoteKeys.KEY_AD_POPULATE_INTERVAL, 1.minutesMillis())
return RemoteProxy.readLong(WorldKeys.KEY_AD_POPULATE_INTERVAL, 1.minutesMillis())
}
fun getRedPacketPopupInterval(): Long {
return RemoteProxy.readLong(ScreenLockerRemoteKeys.KEY_RED_PACKET_POPUP_INTERVAL, 30.minutesMillis())
return RemoteProxy.readLong(WorldKeys.KEY_RED_PACKET_POPUP_INTERVAL, 30.minutesMillis())
}
var lastRedPacketPopupPopupTime: Long
......
package com.mints.screen.locker.utils
package com.mints.mingce.world.utils
import android.annotation.SuppressLint
import android.app.KeyguardManager
......@@ -19,10 +19,10 @@ import java.text.SimpleDateFormat
import java.util.*
private const val TAG = "screenlocker.utils"
private const val TAG = "world.utils"
@Suppress("DEPRECATION")
object ScreenLockerUtils {
object WorldUtils {
/**
* 若灭屏状态 或者 是否解锁了
*/
......
package com.mints.screen.locker.ui;
package com.mints.mingce.world.widget;
import android.content.Context;
import android.util.DisplayMetrics;
......
package com.mints.screen.locker.ui;
package com.mints.mingce.world.widget;
import android.annotation.SuppressLint;
import android.content.Context;
......@@ -22,7 +22,7 @@ import com.mints.fiveworld.R;
* <link>https://github.com/RockySteveJobs/LockerScreen</link>
*/
public class SlideToUnLockView extends ScreenLockerRootLayout {
public class SlideWorldView extends WorldRootLayout {
// private RippleBackground mLockRipple;
private View mUnLockContainer;
......@@ -44,7 +44,7 @@ public class SlideToUnLockView extends ScreenLockerRootLayout {
private int moveDistance = 0;
private float unlockDistance = 0;
public SlideToUnLockView(@NonNull Context context, @Nullable AttributeSet attrs) {
public SlideWorldView(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
init();
}
......
package com.mints.screen.locker
package com.mints.mingce.world.widget
import android.content.Intent
import android.os.Bundle
......@@ -9,32 +9,32 @@ import com.ad.AdHelper
import com.mints.fiveworld.BuildConfig
import com.mints.fiveworld.ad.express.OutScreenExpress
import net.utils.Log
import com.mints.screen.locker.core.ScreenLockerConstants
import com.mints.screen.locker.core.ScreenLockerContext
import com.mints.screen.locker.ui.ScreenLockerComponent
import com.mints.mingce.world.content.WorldConstants
import com.mints.mingce.world.content.WorldContext
import com.mints.mingce.world.settings.AbstractAbs
import net.common.OutAppActivity
import net.component.LockerActivity
private const val TAG = "screenlocker.ui.activity"
private const val TAG = "world.ui.activity"
open class ScreenLockerActivity : AbstractAbs(), net.analytics.UiPage, LockerActivity,
open class WorldActivity : AbstractAbs(), net.analytics.UiPage, LockerActivity,
OutAppActivity {
init {
@Suppress("LeakingThis")
proxy = ScreenLockerComponent(this)
proxy = WorldComponent(this)
}
override val name: String
get() = ScreenLockerConstants.PAGE_SCREEN_LOCKER
get() = WorldConstants.PAGE_SCREEN_LOCKER
override fun dispatchTouchEvent(ev: MotionEvent): Boolean {
when (ev.action) {
MotionEvent.ACTION_DOWN -> {
ScreenLockerContext.observer(this).isTouching = true
WorldContext.observer(this).isTouching = true
}
MotionEvent.ACTION_UP, MotionEvent.ACTION_CANCEL -> {
ScreenLockerContext.observer(this).isTouching = false
WorldContext.observer(this).isTouching = false
}
}
......@@ -62,7 +62,7 @@ open class ScreenLockerActivity : AbstractAbs(), net.analytics.UiPage, LockerAct
override fun finishActivity(requestCode: Int) {
super.finishActivity(requestCode)
if (BuildConfig.DEBUG) Log.d(
TAG,
TAG,
"finishActivity() called with: requestCode = [$requestCode]"
)
......@@ -78,7 +78,7 @@ open class ScreenLockerActivity : AbstractAbs(), net.analytics.UiPage, LockerAct
checkAdActivityStart(intent)
super.startActivity(intent, options)
if (BuildConfig.DEBUG) Log.d(
TAG,
TAG,
"startActivity() called with: intent = [$intent], options = [$options]"
)
......@@ -93,7 +93,7 @@ open class ScreenLockerActivity : AbstractAbs(), net.analytics.UiPage, LockerAct
private fun checkAdActivityStart(intent: Intent?) {
val proxy1 = proxy
if (proxy1 is ScreenLockerComponent && intent?.component?.className != null) {
if (proxy1 is WorldComponent && intent?.component?.className != null) {
proxy1.preStartActivity()
// 有的时候广告有可能启动app
if (AdHelper.isAdActivity(
......
package com.mints.mingce.world.widget
import com.mints.mingce.world.widget.WorldActivity
open class WorldActivity2 : WorldActivity()
\ No newline at end of file
package com.mints.mingce.world.widget
import com.mints.mingce.world.widget.WorldActivity2
class WorldActivity3 : WorldActivity2()
\ No newline at end of file
package com.mints.screen.locker.ui
package com.mints.mingce.world.widget
import android.content.Context
import android.content.Intent
......@@ -14,8 +14,6 @@ import android.view.Window
import android.view.WindowManager
import android.view.animation.DecelerateInterpolator
import android.widget.*
import androidx.core.view.updateLayoutParams
import androidx.core.view.updatePadding
import com.activityutil.ActivityManagerProxy
import com.ad.AdHelper
import com.main.ScreenMonitor
......@@ -48,31 +46,31 @@ import com.mints.fiveworld.ui.activitys.IncreasespeedActivity
import com.mints.fiveworld.ui.widgets.RoundRectLayout
import com.mints.fiveworld.utils.LogUtil
import com.mints.fiveworld.utils.Utils
import com.mints.screen.locker.core.ScreenLockerConstants
import com.mints.screen.locker.core.ScreenLockerContext
import com.mints.screen.locker.core.ScreenLockerEvents
import com.mints.screen.locker.core.ScreenLockerObserver
import com.mints.screen.locker.settings.ScreenLockerSettings
import com.mints.screen.locker.utils.ScreenLockerUtils
import com.mints.mingce.world.content.WorldConstants
import com.mints.mingce.world.content.WorldContext
import com.mints.mingce.world.content.WorldEvents
import com.mints.mingce.world.content.WorldObserver
import com.mints.mingce.world.settings.WorldSettings
import com.mints.mingce.world.utils.WorldUtils
import java.text.SimpleDateFormat
import java.util.*
private const val TAG = "screenlocker.ui.activity"
private const val TAG = "world.ui.activity"
internal class ScreenLockerComponent(component: IComponent) : AbsComponent(component),
internal class WorldComponent(component: IComponent) : AbsComponent(component),
ScreenMonitor.Listener {
private val moreThan2SecPage = object : UiPage {
override val name: String
get() = ScreenLockerConstants.PAGE_SCREEN_LOCKER_MORE_THAN_2_SEC
get() = WorldConstants.PAGE_SCREEN_LOCKER_MORE_THAN_2_SEC
}
private val moreThan1SecVisibile = Any()
private var intentFlags = 0
private var reason = ScreenLockerConstants.SHOW_REASON_UNKNWON
private var reason = WorldConstants.SHOW_REASON_UNKNWON
private val weekFormat = SimpleDateFormat(R.string.dd_date_fmt.stringRes(), Locale.getDefault())
// private var avoidRestartSelfOnUserLeaveHint = false
......@@ -132,7 +130,7 @@ internal class ScreenLockerComponent(component: IComponent) : AbsComponent(compo
private fun updateDateTime() {
val calendar = GregorianCalendar.getInstance()
val hourString = ScreenLockerUtils.getHourString(activity, System.currentTimeMillis())
val hourString = WorldUtils.getHourString(activity, System.currentTimeMillis())
val timeString = weekFormat.format(calendar.time)
activity.ddTimeText.text = hourString
activity.ddDateText.text = timeString
......@@ -150,7 +148,7 @@ internal class ScreenLockerComponent(component: IComponent) : AbsComponent(compo
WifiDataManager.increaseCount(WifiDataManager.LOCK_ON)
AdHelper.config.avoidRestartSelfOnUserLeaveHint = false
ScreenLockerContext.changeOwnership(activity)
WorldContext.changeOwnership(activity)
if (BuildConfig.DEBUG) Log.d(
TAG,
......@@ -158,7 +156,7 @@ internal class ScreenLockerComponent(component: IComponent) : AbsComponent(compo
)
val useNewWay = false
if (useNewWay && !ScreenLockerObserver.shouldShowLockerAfterUserPresent()) {
if (useNewWay && !WorldObserver.shouldShowLockerAfterUserPresent()) {
val window: Window = window
if (true) {
if (Build.VERSION.SDK_INT >= 28) {
......@@ -173,7 +171,7 @@ internal class ScreenLockerComponent(component: IComponent) : AbsComponent(compo
}
}
setContentView(R.layout.activity_screenlocker)
setContentView(R.layout.activity_world_view)
localScreenOnState = CommonUtils.isScreenOn(activity) == true
......@@ -181,8 +179,8 @@ internal class ScreenLockerComponent(component: IComponent) : AbsComponent(compo
window.setWindowAnimations(R.style.AppTheme_LockScreen_Animation)
val layoutParams = window.attributes
val isUsingShowWhenLockedFlag =
!ScreenLockerUtils.isLockScreenProtected(activity) && !ScreenLockerObserver.shouldShowLockerAfterUserPresent()
ScreenLockerUtils.makeLockWindowFullScreen(
!WorldUtils.isLockScreenProtected(activity) && !WorldObserver.shouldShowLockerAfterUserPresent()
WorldUtils.makeLockWindowFullScreen(
activity,
layoutParams,
isUsingShowWhenLockedFlag
......@@ -191,7 +189,7 @@ internal class ScreenLockerComponent(component: IComponent) : AbsComponent(compo
window.statusBarColor = Color.TRANSPARENT
window.navigationBarColor = Color.TRANSPARENT
ScreenLockerUtils.updateWindowFlags(window.decorView)
WorldUtils.updateWindowFlags(window.decorView)
}
initView()
......@@ -306,8 +304,8 @@ internal class ScreenLockerComponent(component: IComponent) : AbsComponent(compo
)
do {
if (intent != null) {
intentFlags = intent.getIntExtra(ScreenLockerConstants.INTENT_KEY_FLAGS, 0)
if (intentFlags.hasFlags(ScreenLockerObserver.FLAG_START_WITH_CHARGE_BG)) {
intentFlags = intent.getIntExtra(WorldConstants.INTENT_KEY_FLAGS, 0)
if (intentFlags.hasFlags(WorldObserver.FLAG_START_WITH_CHARGE_BG)) {
activity.window.setBackgroundDrawableResource(R.drawable.dd_bg_win_charge)
// 充电锁屏需要刷新一下广告
......@@ -316,15 +314,15 @@ internal class ScreenLockerComponent(component: IComponent) : AbsComponent(compo
}
reason = intent.getIntExtra(
ScreenLockerConstants.INTENT_KEY_REASON,
ScreenLockerConstants.SHOW_REASON_UNKNWON
WorldConstants.INTENT_KEY_REASON,
WorldConstants.SHOW_REASON_UNKNWON
)
val invokeMark = intent.getLongExtra(ScreenLockerConstants.INTENT_KEY_MARK, 0L)
val invokeMark = intent.getLongExtra(WorldConstants.INTENT_KEY_MARK, 0L)
if (invokeMark > 0 && lastInvokeMark != invokeMark) {
lastInvokeMark = invokeMark
BrandEventLogger.logEventWithBrand(BaseApp.instance.eventLogger,
ScreenLockerConstants.EVENT_SCREEN_LOCKER_START_SUCCEED,
WorldConstants.EVENT_SCREEN_LOCKER_START_SUCCEED,
EventParams().apply {
set("flags", intentFlags)
reason(reason.toString())
......@@ -360,15 +358,15 @@ internal class ScreenLockerComponent(component: IComponent) : AbsComponent(compo
if (BuildConfig.DEBUG) Log.d(TAG, "onBusEvent() called with: event = [$event]")
when (event.event) {
ScreenLockerEvents.USER_UNLOCKED -> {
if (ScreenLockerSettings.isDismissWithSystemKeyguard()) {
WorldEvents.USER_UNLOCKED -> {
if (WorldSettings.isDismissWithSystemKeyguard()) {
unlock(false)
}
}
ScreenLockerEvents.CALL_INCOMING -> {
WorldEvents.CALL_INCOMING -> {
unlock(false)
}
ScreenLockerEvents.UNLOCK_REQUESTED -> {
WorldEvents.UNLOCK_REQUESTED -> {
unlock(false)
}
......@@ -426,7 +424,7 @@ internal class ScreenLockerComponent(component: IComponent) : AbsComponent(compo
/** 如果亮屏后过快,在 {@link ScreenLockerObserver#lockScreenReceiver} 这个Receiver上,会因为屏幕点亮而延迟启动一遍锁屏(这个是怕别人盖)
* 这时候,用户好不容易点击了广告,又被带回来了。这样体验很差
*/
ScreenLockerContext.canShowScreenLockerWhenScreenOn = false
WorldContext.canShowScreenLockerWhenScreenOn = false
// val originValue = AdHelper.config.avoidRestartSelfOnUserLeaveHint
AdHelper.config.avoidRestartSelfOnUserLeaveHint = true
......@@ -441,7 +439,7 @@ internal class ScreenLockerComponent(component: IComponent) : AbsComponent(compo
"onAdEvent: CLICK ad cause AdActivity started, so we need to finish self."
)
if (ScreenLockerUtils.hasSystemLockScreen(activity)) {
if (WorldUtils.hasSystemLockScreen(activity)) {
CommonUtils.showToast(
activity.applicationContext,
R.string.unlock_to_see_details.stringRes()
......@@ -553,7 +551,7 @@ internal class ScreenLockerComponent(component: IComponent) : AbsComponent(compo
val fgView = activity.ddForeground
resetWindowTransparentBackground()
activity.root.setOnTouchToUnlockListener(object :
SlideToUnLockView.OnTouchToUnlockListener {
SlideWorldView.OnTouchToUnlockListener {
private val interpolator = DecelerateInterpolator()
override fun onTouchLockArea() {
// bgView?.setBackgroundColor(Color.parseColor("#66000000"))
......@@ -664,7 +662,7 @@ internal class ScreenLockerComponent(component: IComponent) : AbsComponent(compo
unlockedSinceStarted = true
if (unlockedByUser) {
BaseApp.get().bus.post(ScreenLockerEvents.SCREENLOCKER_UNLOCKED_BY_USER)
BaseApp.get().bus.post(WorldEvents.SCREENLOCKER_UNLOCKED_BY_USER)
}
// keepAdIfPossible()
......@@ -680,8 +678,8 @@ internal class ScreenLockerComponent(component: IComponent) : AbsComponent(compo
CoreAdContext.lockerUnlockCallback?.invoke(activity, unlockedByUser)
}
if (ScreenLockerObserver.shouldShowLockerAfterUserPresent()) {
BaseApp.get().bus.post(BusEvent.of(ScreenLockerEvents.USER_UNLOCKED))
if (WorldObserver.shouldShowLockerAfterUserPresent()) {
BaseApp.get().bus.post(BusEvent.of(WorldEvents.USER_UNLOCKED))
ActivityManagerProxy.ensureActive()
}
......@@ -727,7 +725,7 @@ internal class ScreenLockerComponent(component: IComponent) : AbsComponent(compo
}
if (BuildConfig.DEBUG) Log.i(TAG, "unlock: moveTaskToBack = $moveTaskToBack")
if (!moveTaskToBack || ScreenLockerObserver.shouldShowLockerAfterUserPresent()) {
if (!moveTaskToBack || WorldObserver.shouldShowLockerAfterUserPresent()) {
if (BuildConfig.DEBUG) Log.w(TAG, "finishSelf: FALIED TO MOVE TASK TO BACK!!!")
if (BuildConfig.DEBUG) Log.w(TAG, "finishSelf: FALIED TO MOVE TASK TO BACK!!!")
if (BuildConfig.DEBUG) Log.w(TAG, "finishSelf: FALIED TO MOVE TASK TO BACK!!!")
......@@ -735,7 +733,7 @@ internal class ScreenLockerComponent(component: IComponent) : AbsComponent(compo
AdHelper.config.avoidRestartSelfOnUserLeaveHint = true
super.finishSelf()
activity.overridePendingTransition(0, R.anim.no_animation)
ScreenLockerContext.observer(activity).isFinishing = true
WorldContext.observer(activity).isFinishing = true
} else {
// 成功转入后台,那就保持广告状态
keepAdIfPossible()
......@@ -772,13 +770,13 @@ internal class ScreenLockerComponent(component: IComponent) : AbsComponent(compo
if (BuildConfig.DEBUG) Log.d(TAG, "onStart() called ")
CoreAdContext.lockerActivityStarted = true
ScreenLockerContext.lastScreenLockerStartTime = System.currentTimeMillis()
WorldContext.lastScreenLockerStartTime = System.currentTimeMillis()
unlockedSinceStarted = false
ScreenLockerUtils.closeSystemLockView(activity)
WorldUtils.closeSystemLockView(activity)
ScreenLockerContext.observer(activity).isStarted = true
WorldContext.observer(activity).isStarted = true
resetViewState()
updateDateTime()
......@@ -804,16 +802,16 @@ internal class ScreenLockerComponent(component: IComponent) : AbsComponent(compo
if (BuildConfig.DEBUG) Log.d(TAG, "onResume() called ")
CoreAdContext.lockerResumeCallback?.invoke(activity)
ScreenLockerContext.observer(activity).taskId = activity.taskId
ScreenLockerContext.observer(activity).isResumed = true
ScreenLockerContext.observer(activity).isResumedSinceLastScreenOff = true
WorldContext.observer(activity).taskId = activity.taskId
WorldContext.observer(activity).isResumed = true
WorldContext.observer(activity).isResumedSinceLastScreenOff = true
CoreAdContext.lockerActivityResumed = true
updateDateTime()
BrandEventLogger.logEventWithBrand(BaseApp.instance.eventLogger,
ScreenLockerConstants.EVENT_SCREEN_LOCKER_START_RESUMED, EventParams().apply {
WorldConstants.EVENT_SCREEN_LOCKER_START_RESUMED, EventParams().apply {
set("flags", intentFlags)
reason(reason.toString())
})
......@@ -861,8 +859,8 @@ internal class ScreenLockerComponent(component: IComponent) : AbsComponent(compo
// adImpressionHandler.notifyWindowFocusState(false, !unlockedSinceStarted)
if (BuildConfig.DEBUG) Log.d(TAG, "onPause() called isFinishing = ${activity.isFinishing}")
ScreenLockerContext.observer(activity).isResumed = false
ScreenLockerContext.observer(activity).isFinishing = activity.isFinishing
WorldContext.observer(activity).isResumed = false
WorldContext.observer(activity).isFinishing = activity.isFinishing
taskPool.cancel(moreThan2SecPage)
taskPool.cancel(moreThan1SecVisibile)
......@@ -872,7 +870,7 @@ internal class ScreenLockerComponent(component: IComponent) : AbsComponent(compo
override fun onStop() {
super.onStop()
if (BuildConfig.DEBUG) Log.d(TAG, "onStop() called isFinishing = ${activity.isFinishing}")
ScreenLockerContext.observer(activity).isFinishing = activity.isFinishing
WorldContext.observer(activity).isFinishing = activity.isFinishing
CoreAdContext.lockerActivityStarted = false
......@@ -887,7 +885,7 @@ internal class ScreenLockerComponent(component: IComponent) : AbsComponent(compo
// }
resetViewState()
ScreenLockerContext.observer(activity).isStarted = false
WorldContext.observer(activity).isStarted = false
}
override fun onDestroy() {
......@@ -896,7 +894,7 @@ internal class ScreenLockerComponent(component: IComponent) : AbsComponent(compo
taskPool.cancel(this)
BrandEventLogger.logEventWithBrand(BaseApp.instance.eventLogger,
ScreenLockerConstants.EVENT_SCREEN_LOCKER_DESTROYED, EventParams().apply {
WorldConstants.EVENT_SCREEN_LOCKER_DESTROYED, EventParams().apply {
set("flags", intentFlags)
reason(reason.toString())
})
......@@ -904,7 +902,7 @@ internal class ScreenLockerComponent(component: IComponent) : AbsComponent(compo
super.onDestroy()
if (BuildConfig.DEBUG) Log.d(TAG, "onDestroy() called ")
ScreenLockerContext.observer(activity).taskId = null
WorldContext.observer(activity).taskId = null
ScreenMonitor.getInstance().unregister(this, null)
receiver.unregister()
}
......@@ -919,9 +917,9 @@ internal class ScreenLockerComponent(component: IComponent) : AbsComponent(compo
private fun restartSelf() {
if (BuildConfig.DEBUG) Log.d(TAG, "restartSelf() called ")
ScreenLockerObserver.startScreenLockerForced(
WorldObserver.startScreenLockerForced(
activity,
ScreenLockerConstants.SHOW_REASON_RESTART_SELF,
WorldConstants.SHOW_REASON_RESTART_SELF,
intentFlags
)
userPresented = false
......@@ -966,7 +964,7 @@ internal class ScreenLockerComponent(component: IComponent) : AbsComponent(compo
userPresented = false
localScreenOnState = false
ScreenLockerContext.observer(activity).isResumedSinceLastScreenOff = false
WorldContext.observer(activity).isResumedSinceLastScreenOff = false
if (BuildConfig.DEBUG) Log.i(TAG, "onScreenOff: try dismissing red packet dialog...")
......@@ -1011,7 +1009,7 @@ internal class ScreenLockerComponent(component: IComponent) : AbsComponent(compo
private fun showNativeAd() {
if (BuildConfig.DEBUG) Log.d(TAG, "showNativeAd() called ")
if (!ScreenLockerUtils.isScreenOn(activity)) {
if (!WorldUtils.isScreenOn(activity)) {
LogUtil.d(TAG, "应用外锁屏 未亮屏 ---> 不展示广告")
return
}
......@@ -1269,6 +1267,6 @@ internal class ScreenLockerComponent(component: IComponent) : AbsComponent(compo
internal fun preStartActivity() {
AdHelper.config.avoidRestartSelfOnUserLeaveHint = true
ScreenLockerContext.canShowScreenLockerWhenScreenOn = false
WorldContext.canShowScreenLockerWhenScreenOn = false
}
}
\ No newline at end of file
package com.mints.screen.locker.ui
package com.mints.mingce.world.widget
import android.content.Context
import android.util.AttributeSet
......@@ -7,9 +7,9 @@ import android.view.WindowInsets
import com.mints.fiveworld.BuildConfig
import net.widget.RootFrameLayout
private const val TAG = "screenlocker.ui.rootLayout"
private const val TAG = "world.ui.rootLayout"
open class ScreenLockerRootLayout(context: Context, attrs: AttributeSet) : RootFrameLayout(context, attrs) {
open class WorldRootLayout(context: Context, attrs: AttributeSet) : RootFrameLayout(context, attrs) {
interface OnWindowVisibilityChangeListener {
fun onWindowVisibilityChanged(visibility: Int)
}
......
package com.mints.screen.locker
open class ScreenLockerActivity2 : ScreenLockerActivity()
\ No newline at end of file
package com.mints.screen.locker
class ScreenLockerActivity3 : ScreenLockerActivity2()
\ No newline at end of file
package com.mints.screen.locker.core
object ScreenLockerAdConfig {
const val AD_NAME_BOTTOM_AD = "dd_ba1"
}
\ No newline at end of file
package com.mints.screen.locker.utils
import android.os.Handler
import android.os.Looper
import android.os.Message
import com.mints.fiveworld.BuildConfig
import net.common.millis
import net.common.minutesMillis
import net.common.secondsMillis
import net.common.utils.CommonUtils
import net.utils.Log
import kotlin.math.max
import kotlin.random.Random
//private const val TAG = "ad.utils.impression"
private const val TAG = "screenlocker.ui.activity.ad"
/**
* 广告规则
* 1. 灭屏了,一定可以换广告(解决用户手动灭屏亮屏)
* 2. 广告过期一定能换(45分钟)
* 3. 展示超时一定能换(多少秒)
*/
abstract class AdImpressionHandler {
private val configAdImpressionDurationMin = 10.secondsMillis()
private val configAdExpireDuration = 45.minutesMillis()
private val configAdImpressionDitherInterval = 150.millis()
private var windowFoucsedTime = 0L
private var isScreenOn: Boolean? = null
private var isWindowFocused: Boolean? = null
private var currentAdBindTime = 0L // 最后一个ad,bind的时间戳,如果没有bind,或者ad被拿掉,则为0
private var currentAdImpressionDuration = 0L
private var currentAdHash = 0
private var populatedAdSinceScreenOff = false
var forceAdPopulation = false
private val MSG_REMOVE_AD_VIEW = 9971
private val handler = object : Handler(Looper.getMainLooper()) {
override fun handleMessage(msg: Message) {
when (msg.what) {
MSG_REMOVE_AD_VIEW -> {
if (currentAdHash == msg.arg1) {
if (BuildConfig.DEBUG) Log.i(TAG, "handleMessage: invoking remove ad view...")
removeAd()
} else {
if (BuildConfig.DEBUG) Log.w(TAG, "handleMessage: ad hash changed! ignored remove op!")
}
}
}
}
}
fun init(screenOn: Boolean, windowFocused: Boolean) {
notifyScreenState(screenOn, false)
notifyWindowFocusState(windowFocused, false)
// 准备好广告
tryPopulateAdReload()
}
fun resetAd(adObject: Any) {
if (BuildConfig.DEBUG) Log.i(TAG, "resetAd: called")
if (BuildConfig.DEBUG) Log.i("webView.helper", "resetAd: called, AD RESET!")
currentAdImpressionDuration = 0L
currentAdHash = adObject.hashCode()
currentAdBindTime = System.currentTimeMillis()
if (isScreenOn == false && !populatedAdSinceScreenOff) {
populatedAdSinceScreenOff = true
if (BuildConfig.DEBUG) Log.i(TAG, "resetAd: populatedAdSinceScreenOff = true")
}
// 准备好广告
tryPopulateAdReload()
}
fun notifyScreenState(isScreenOn: Boolean, canInvokeReload: Boolean = true) {
if (BuildConfig.DEBUG) Log.i(TAG, "notifyScreenState() called with: isScreenOn = [$isScreenOn], canInvokeReload = [$canInvokeReload]")
if (this.isScreenOn == isScreenOn) {
if (BuildConfig.DEBUG) Log.w(TAG, "notifyScreenState: screen on state not change, ignored!")
return
}
this.isScreenOn = isScreenOn
if (!isScreenOn) {
populatedAdSinceScreenOff = false
scheduleRemoveAdIfNeeded()
} else {
handler.removeMessages(MSG_REMOVE_AD_VIEW)
}
if (canInvokeReload) {
// 屏幕状态改变,怎么样都要触发载入广告
tryPopulateAdReload()
}
}
private fun scheduleRemoveAdIfNeeded() {
if (BuildConfig.DEBUG) Log.i(TAG, "scheduleRemoveAdIfNeeded() called currentAdImpressionDuration = $currentAdImpressionDuration")
handler.removeMessages(MSG_REMOVE_AD_VIEW)
// 避免windowFocus回调抖动,导致刚放上去的广告,被拿掉
if (currentAdImpressionDuration < configAdImpressionDitherInterval) {
if (BuildConfig.DEBUG) Log.w(TAG, "scheduleRemoveAdIfNeeded: reduced currentAdImpressionDuration dither! ignored!")
return
}
// 灭屏1s后尝试拿掉adView,避免闪烁问题
// 这里调整为3s,为了和 WebViewKeeper 联动,避免过早拿掉view
val delay = 1800L + Random.nextInt(1800) // 三秒左右
if (BuildConfig.DEBUG) Log.d(TAG, "scheduleRemoveAd() called delay = $delay")
handler.sendMessageDelayed(handler.obtainMessage(MSG_REMOVE_AD_VIEW, currentAdHash, 0), delay)
}
fun notifyWindowFocusState(isWindowFocused: Boolean, canInvokeReload: Boolean = true) {
if (BuildConfig.DEBUG) Log.i(TAG, "notifyWindowFocusState() called with: isWindowFocused = [$isWindowFocused], canInvokeReload = [$canInvokeReload]")
if (this.isWindowFocused == isWindowFocused) {
if (BuildConfig.DEBUG) Log.w(TAG, "notifyWindowFocusState: window focus state not change, ignored!")
return
}
this.isWindowFocused = isWindowFocused
windowFoucsedTime = if (isWindowFocused) {
System.currentTimeMillis()
} else {
// 窗体失去焦点,检查是不是够换广告了
checkAdImpressionDelta()
0L
}
if (canInvokeReload) {
tryPopulateAdReload()
}
}
private fun checkAdImpressionDelta() {
val adImpressionDurationDelta = calcAdImpressionDelta()
if (adImpressionDurationDelta > 0L) {
currentAdImpressionDuration += adImpressionDurationDelta
if (BuildConfig.DEBUG) Log.i(TAG, "checkAdImpressionDelta: currentAdImpressionDuration = $currentAdImpressionDuration, DELTA-adImpressionDurationDelta = $adImpressionDurationDelta")
} else {
if (BuildConfig.DEBUG) Log.d(TAG, "checkAdImpressionDelta: Delta = ZERO! ignored")
}
}
fun canPopulateAd(): Boolean {
if (BuildConfig.DEBUG) Log.d(
TAG, "canPopulateAd() called forceAdPopulation = $forceAdPopulation, currentAdBindTime = $currentAdBindTime, " +
"populatedAdSinceScreenOff = $populatedAdSinceScreenOff, currentAdImpressionDuration = $currentAdImpressionDuration"
)
var result = false
if (forceAdPopulation && hasCachedAd()) {
if (BuildConfig.DEBUG) Log.i(TAG, "canPopulateAd: forceAdPopulation = TRUE, ad population allowed!")
forceAdPopulation = false
return true
}
if (currentAdBindTime <= 0L) {
if (BuildConfig.DEBUG) Log.i(TAG, "canPopulateAd: never bind ad, ad population allowed!")
result = true
} else if (CommonUtils.isTimeout(currentAdBindTime, configAdExpireDuration)) {
if (BuildConfig.DEBUG) Log.i(TAG, "canPopulateAd: ad is about to expire, ad population allowed!")
result = true
} else if (isScreenOn == false && !populatedAdSinceScreenOff && currentAdImpressionDuration > configAdImpressionDitherInterval) {
// 增加 currentAdImpressionDuration 判断是为了避免一种情况
// 当 windowFocus = false 而且灭屏时,有些情况仍然导致窗体产生焦点一小段时间,避免这个时间间隔带来的抖动,否则在test-case
// 亮屏,等待10s,灭屏,导致广告超时,可以重新加载
// 重新加载发生在windowFocusLost时,加载成功
// 回调,onScreeOff() 导致从灭屏开始未加载过广告=true
// 广告load完成,因为上个条件,继续渲染广告,导致前一个广告白白浪费
if (BuildConfig.DEBUG) Log.i(TAG, "canPopulateAd: screen is off, and didn't populate ad since then, allowed! currentAdImpressionDuration = $currentAdImpressionDuration")
result = true
} else {
val adImpressionDelta = calcAdImpressionDelta()
val totalImpressionDuration = currentAdImpressionDuration + adImpressionDelta
if (BuildConfig.DEBUG) Log.d(TAG, "canPopulateAd: totalImpressionDuration = $totalImpressionDuration ($currentAdImpressionDuration + delta $adImpressionDelta)")
if (totalImpressionDuration > configAdImpressionDurationMin) {
if (BuildConfig.DEBUG) Log.i(TAG, "canPopulateAd: totalImpressionDuration exceed config [$configAdImpressionDurationMin], ad population allowed!")
result = true
}
}
if (BuildConfig.DEBUG) Log.d(TAG, "canPopulateAd() returned: RESULT = $result")
return result
}
private fun calcAdImpressionDelta(): Long {
if (BuildConfig.DEBUG) Log.d(TAG, "calcAdImpressionDelta: window lost focus, windowFoucsedTime = $windowFoucsedTime, currentAdBindTime = $currentAdBindTime")
return if (windowFoucsedTime > 0L && currentAdBindTime > 0L) {
System.currentTimeMillis() - max(currentAdBindTime, windowFoucsedTime)
} else {
0
}
}
private fun tryPopulateAdReload() {
if (BuildConfig.DEBUG) Log.d(TAG, "tryPopulateAdReload: called")
onTryPopulateAdOrReload()
}
abstract fun onTryPopulateAdOrReload()
abstract fun hasCachedAd(): Boolean
open fun removeAd() {}
}
\ No newline at end of file
......@@ -7,102 +7,89 @@
<include layout="@layout/header_layout" />
<com.mints.fiveworld.ui.widgets.ElasticScrollView
<TextView
android:id="@+id/tvAboutasVersion"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="30dp"
android:layout_marginBottom="15dp"
android:text="@string/appName"
android:textColor="@color/color_454A69"
android:textSize="13sp" />
<ImageView
android:id="@+id/ivAboutasIcon"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_gravity="center_horizontal"
android:src="@drawable/ic_launcher_main" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:overScrollMode="never">
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="20dp"
android:orientation="vertical">
<TextView
android:id="@+id/tvAboutasVersion"
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="30dp"
android:layout_marginBottom="15dp"
android:text="@string/appName"
android:textColor="@color/color_454A69"
android:textSize="13sp" />
<ImageView
android:id="@+id/ivAboutasIcon"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_gravity="center_horizontal"
android:src="@drawable/ic_launcher_main" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="20dp"
android:orientation="vertical">
android:layout_gravity="center_horizontal"
android:orientation="horizontal">
<LinearLayout
<TextView
android:id="@+id/tvAboutasService"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:orientation="horizontal">
<TextView
android:id="@+id/tvAboutasService"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="2dp"
android:padding="5dp"
android:text="@string/register_name"
android:textColor="@color/color_main"
android:textSize="14sp" />
android:layout_marginRight="2dp"
android:padding="5dp"
android:text="@string/register_name"
android:textColor="@color/color_main"
android:textSize="14sp" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:background="@color/color_main" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:background="@color/color_main" />
<TextView
android:id="@+id/tvAboutasPolicy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:padding="5dp"
android:text="隐私政策"
android:textColor="@color/color_main"
android:textSize="14sp" />
</LinearLayout>
<TextView
android:id="@+id/tvAboutasPolicy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:padding="5dp"
android:text="隐私政策"
android:textColor="@color/color_main"
android:textSize="14sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:gravity="center"
android:text="Copyright © 2021 Inc.."
android:textColor="@color/color_454A69"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:gravity="center"
android:text="Copyright © 2021 Inc.."
android:textColor="@color/color_454A69"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
</com.mints.fiveworld.ui.widgets.ElasticScrollView>
</RelativeLayout>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<com.mints.screen.locker.ui.SlideToUnLockView xmlns:android="http://schemas.android.com/apk/res/android"
<com.mints.mingce.world.widget.SlideWorldView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/root"
......@@ -479,4 +479,4 @@
</androidx.constraintlayout.widget.ConstraintLayout>
</com.mints.screen.locker.ui.SlideToUnLockView>
\ No newline at end of file
</com.mints.mingce.world.widget.SlideWorldView>
\ 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