Commit 4c7c4645 authored by mengcuiguang's avatar mengcuiguang

修改代码名称

parent fc1acc15
...@@ -23,7 +23,7 @@ import com.mints.flowbox.keepalive.NotificationService; ...@@ -23,7 +23,7 @@ import com.mints.flowbox.keepalive.NotificationService;
import com.mints.flowbox.keepalive.NotificationUtil; import com.mints.flowbox.keepalive.NotificationUtil;
import com.mints.flowbox.keepalive.OutAppRouter; import com.mints.flowbox.keepalive.OutAppRouter;
import com.mints.flowbox.keepalive.PackageWatch; import com.mints.flowbox.keepalive.PackageWatch;
import com.mints.flowbox.screen.ScreenLockerObserver; import com.mints.flowbox.keepalive.screen.ScreenLockerObserver;
import com.mints.flowbox.keepalive.ServiceUtil; import com.mints.flowbox.keepalive.ServiceUtil;
import com.mints.flowbox.keepalive.WifiStateWatch; import com.mints.flowbox.keepalive.WifiStateWatch;
import com.mints.flowbox.manager.CsjGroMoreManager; import com.mints.flowbox.manager.CsjGroMoreManager;
......
package com.mints.flowbox.screen package com.mints.flowbox.keepalive.screen
object ScreenLockerConstants { object ScreenConstant {
const val INTENT_KEY_FLAGS = "kdd1" const val INTENT_KEY_FLAGS = "kdd1"
const val INTENT_KEY_MARK = "kdd2" const val INTENT_KEY_MARK = "kdd2"
const val INTENT_KEY_REASON = "kdd3" const val INTENT_KEY_REASON = "kdd3"
const val PAGE_SCREEN_LOCKER = "pg_screenlocker"
const val PAGE_SCREEN_LOCKER_MORE_THAN_2_SEC = "pg_screenlocker2"
const val EVENT_SCREEN_LOCKER_RECEIVE = "ev_dd_rcv" const val EVENT_SCREEN_LOCKER_RECEIVE = "ev_dd_rcv"
const val EVENT_SCREEN_LOCKER_RECEIVE3 = "ev_dd_rcv3" const val EVENT_SCREEN_LOCKER_RECEIVE3 = "ev_dd_rcv3"
const val EVENT_SCREEN_LOCKER_SCREEN_OFF = "ev_dd_scroff" const val EVENT_SCREEN_LOCKER_SCREEN_OFF = "ev_dd_scroff"
const val EVENT_SCREEN_LOCKER_POWER_CONNECT = "ev_dd_pwrcon"
const val EVENT_SCREEN_LOCKER_SCREEN_ON = "ev_dd_scron" const val EVENT_SCREEN_LOCKER_SCREEN_ON = "ev_dd_scron"
const val EVENT_SCREEN_LOCKER_USER_PRESENT = "ev_dd_usrpre" const val EVENT_SCREEN_LOCKER_USER_PRESENT = "ev_dd_usrpre"
const val EVENT_SCREEN_LOCKER_START_PREINVOKE = "ev_dd_actst_preinv" const val EVENT_SCREEN_LOCKER_START_PREINVOKE = "ev_dd_actst_preinv"
const val EVENT_SCREEN_LOCKER_START_INVOKED = "ev_dd_actst_inv" const val EVENT_SCREEN_LOCKER_START_INVOKED = "ev_dd_actst_inv"
const val EVENT_SCREEN_LOCKER_START_SUCCEED = "ev_dd_actst_sec"
const val EVENT_SCREEN_LOCKER_START_RESUMED = "ev_dd_actst_rsm"
const val EVENT_SCREEN_LOCKER_DESTROYED = "ev_dd_actdst"
const val EVENT_SCREEN_LOCKER_INIT = "ev_dd_init" const val EVENT_SCREEN_LOCKER_INIT = "ev_dd_init"
const val EVENT_SCREEN_LOCKER_INIT_2 = "ev_dd_init_2" const val EVENT_SCREEN_LOCKER_INIT_2 = "ev_dd_init_2"
const val SHOW_REASON_UNKNWON = 0
const val SHOW_REASON_SCREEN_OFF = 1 const val SHOW_REASON_SCREEN_OFF = 1
const val SHOW_REASON_RESTART_SELF = 2
const val SHOW_REASON_SCREEN_ON = 3 const val SHOW_REASON_SCREEN_ON = 3
const val SHOW_REASON_USER_PRESENT = 4 const val SHOW_REASON_USER_PRESENT = 4
const val SHOW_REASON_CALL_IDLE = 5
const val SHOW_REASON_CHARGE = 6
const val SHOW_REASON_DIRECT_CALL = 7
} }
\ No newline at end of file
package com.mints.flowbox.screen package com.mints.flowbox.keepalive.screen
import android.app.Activity import android.app.Activity
import java.lang.ref.WeakReference import java.lang.ref.WeakReference
...@@ -14,29 +14,6 @@ object ScreenLockerContext { ...@@ -14,29 +14,6 @@ object ScreenLockerContext {
internal var screenOffCalled = false internal var screenOffCalled = false
// fun createBottomAd(@Suppress("UNUSED_PARAMETER") context: Context): AdModule {
// if (context !is Activity) {
// throw IllegalArgumentException()
// }
//
// val hasSystemLockScreen = ScreenLockerUtils.hasSystemLockScreen(context)
// if (BuildConfig.DEBUG) Log.d(TAG, "bottomAd() called with: hasSystemLockScreen = $hasSystemLockScreen, context = [$context]")
//
// val adModule = AdUtils.initAdModuleArray(
// context,
// ScreenLockerAdConfig.AD_NAME_BOTTOM_AD,
// R.array.dd_ad_unit__bottom_ad/*,
// supportDeepLink = !hasSystemLockScreen
// */
// )
//
// adModule.updateConfig {
// it.nativeAdTemplate = R.layout.dd_layout_ad_template
// }
//
// return adModule
// }
private var activityRef: WeakReference<Activity>? = null private var activityRef: WeakReference<Activity>? = null
fun changeOwnership(activity: Activity) { fun changeOwnership(activity: Activity) {
......
package com.mints.flowbox.screen package com.mints.flowbox.keepalive.screen
//import com.squareup.module.feature.FeatureConstants internal object ScreenEvents {
internal object ScreenLockerEvents {
private const val BASE = 867_0000 private const val BASE = 867_0000
const val USER_UNLOCKED = BASE + 1 const val USER_UNLOCKED = BASE + 1
// const val SCREENLOCKER_UNLOCKED_BY_USER = FeatureConstants.CUSTOM_UNLOCKED
const val SCREENLOCKER_UNLOCKED_BY_USER = 0x00000232 const val SCREENLOCKER_UNLOCKED_BY_USER = 0x00000232
const val CALL_INCOMING = BASE + 3 const val CALL_INCOMING = BASE + 3
const val UNLOCK_REQUESTED = BASE + 4 const val UNLOCK_REQUESTED = BASE + 4
......
package com.mints.flowbox.screen package com.mints.flowbox.keepalive.screen
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.app.Activity import android.app.Activity
...@@ -18,7 +18,6 @@ import com.activityutil.ContextLike ...@@ -18,7 +18,6 @@ import com.activityutil.ContextLike
import com.external.OutAppActivity import com.external.OutAppActivity
import com.main.ScreenMonitor import com.main.ScreenMonitor
import com.mints.flowbox.BuildConfig import com.mints.flowbox.BuildConfig
import com.mints.flowbox.screen.settings.ScreenLockerSettings
import com.mints.flowbox.ui.activitys.keepalive.ScreenActivity import com.mints.flowbox.ui.activitys.keepalive.ScreenActivity
import com.mints.flowbox.utils.keepalive.ScreenLockerUtils import com.mints.flowbox.utils.keepalive.ScreenLockerUtils
import com.module.account.daemon.ScreenStatusMonitor import com.module.account.daemon.ScreenStatusMonitor
...@@ -38,7 +37,7 @@ import net.utils.Log ...@@ -38,7 +37,7 @@ import net.utils.Log
@Suppress("SpellCheckingInspection") @Suppress("SpellCheckingInspection")
private const val TAG = "screenlocker.core.ob" private const val TAG = "ScreenLockerObserver"
class ScreenLockerObserver(private val context: Context) { class ScreenLockerObserver(private val context: Context) {
...@@ -47,27 +46,18 @@ class ScreenLockerObserver(private val context: Context) { ...@@ -47,27 +46,18 @@ class ScreenLockerObserver(private val context: Context) {
const val FLAG_START_WITH_CHARGE_BG = 0x1 const val FLAG_START_WITH_CHARGE_BG = 0x1
@Suppress("SpellCheckingInspection") @Suppress("SpellCheckingInspection")
// private const val PHONE_MODEL_OPPO_A5 = "PBAM00"
// private const val PHONE_MODEL_OPPO_Ax = "PBEM00"
fun startScreenLockerForced( fun startScreenLockerForced(
context: Context, context: Context,
@Suppress("UNUSED_PARAMETER") reason: Int, @Suppress("UNUSED_PARAMETER") reason: Int,
flags: Flags = 0 flags: Flags = 0
) { ) {
if (BuildConfig.DEBUG) Log.d( if (!ScreenSettings.isEnabledFlag()) {
TAG,
"startScreenLockerForced() called with: context = [$context], flags = [$flags], thread = ${Thread.currentThread()}"
)
if (!ScreenLockerSettings.isEnabled()) {
if (BuildConfig.DEBUG) Log.w(TAG, "startScreenLockerForced: NOT ENABLED! ignore!")
return return
} }
BrandEventLogger.logEventWithBrand(BaseApp.instance.eventLogger, BrandEventLogger.logEventWithBrand(BaseApp.instance.eventLogger,
ScreenLockerConstants.EVENT_SCREEN_LOCKER_START_INVOKED, ScreenConstant.EVENT_SCREEN_LOCKER_START_INVOKED,
EventParams().apply { EventParams().apply {
reason(reason.toString()) reason(reason.toString())
set("flags", flags) set("flags", flags)
...@@ -78,10 +68,6 @@ class ScreenLockerObserver(private val context: Context) { ...@@ -78,10 +68,6 @@ class ScreenLockerObserver(private val context: Context) {
if (shouldShowLockerAfterUserPresent()) { if (shouldShowLockerAfterUserPresent()) {
ActivityManagerProxy.bringToFront(object : BringToFrontListener { ActivityManagerProxy.bringToFront(object : BringToFrontListener {
override fun onCall(context: ContextLike) { override fun onCall(context: ContextLike) {
if (BuildConfig.DEBUG) Log.i(
TAG,
"startScreenLockerForced::onCall() called with: context = [$context]"
)
context.startActivity( context.startActivity(
createIntent( createIntent(
...@@ -95,10 +81,6 @@ class ScreenLockerObserver(private val context: Context) { ...@@ -95,10 +81,6 @@ class ScreenLockerObserver(private val context: Context) {
} }
override fun onResult(succeed: Boolean) { override fun onResult(succeed: Boolean) {
if (BuildConfig.DEBUG) Log.d(
TAG,
"onResult() called with: succeed = [$succeed]"
)
} }
}, null) }, null)
...@@ -134,9 +116,9 @@ class ScreenLockerObserver(private val context: Context) { ...@@ -134,9 +116,9 @@ class ScreenLockerObserver(private val context: Context) {
lockerIntent.addFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) lockerIntent.addFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT)
} }
lockerIntent.putExtra(ScreenLockerConstants.INTENT_KEY_FLAGS, flags) lockerIntent.putExtra(ScreenConstant.INTENT_KEY_FLAGS, flags)
lockerIntent.putExtra(ScreenLockerConstants.INTENT_KEY_REASON, reason) lockerIntent.putExtra(ScreenConstant.INTENT_KEY_REASON, reason)
lockerIntent.putExtra(ScreenLockerConstants.INTENT_KEY_MARK, System.currentTimeMillis()) lockerIntent.putExtra(ScreenConstant.INTENT_KEY_MARK, System.currentTimeMillis())
return lockerIntent return lockerIntent
} }
...@@ -148,14 +130,13 @@ class ScreenLockerObserver(private val context: Context) { ...@@ -148,14 +130,13 @@ class ScreenLockerObserver(private val context: Context) {
lockScreenProtected -> ScreenActivity::class.java lockScreenProtected -> ScreenActivity::class.java
else -> ScreenActivity::class.java else -> ScreenActivity::class.java
} }
if (BuildConfig.DEBUG) Log.d(TAG, "selectCorrectActivity() returned: $clazz")
return clazz return clazz
} }
@Suppress("unused") @Suppress("unused")
fun dismissForced() { fun dismissForced() {
BaseApp.get().bus.post(ScreenLockerEvents.UNLOCK_REQUESTED) BaseApp.get().bus.post(ScreenEvents.UNLOCK_REQUESTED)
} }
fun shouldShowLockerAfterUserPresent(): Boolean { fun shouldShowLockerAfterUserPresent(): Boolean {
...@@ -180,17 +161,9 @@ class ScreenLockerObserver(private val context: Context) { ...@@ -180,17 +161,9 @@ class ScreenLockerObserver(private val context: Context) {
override fun onReceive(context: Context, intent: Intent?) { override fun onReceive(context: Context, intent: Intent?) {
if (BuildConfig.DEBUG) Log.d(
TAG,
"onReceive() called with: intent = [$intent], extra = ${
intent?.getStringExtra(
"reason"
)
}"
)
BrandEventLogger.logEventWithBrand( BrandEventLogger.logEventWithBrand(
BaseApp.instance.eventLogger, BaseApp.instance.eventLogger,
ScreenLockerConstants.EVENT_SCREEN_LOCKER_RECEIVE ScreenConstant.EVENT_SCREEN_LOCKER_RECEIVE
) )
when (intent?.action) { when (intent?.action) {
ScreenMonitor.MY_SCREEN_OFF, Intent.ACTION_SCREEN_OFF, ScreenMonitor.MY_SCREEN_OFF, Intent.ACTION_SCREEN_OFF,
...@@ -213,14 +186,9 @@ class ScreenLockerObserver(private val context: Context) { ...@@ -213,14 +186,9 @@ class ScreenLockerObserver(private val context: Context) {
}) })
private fun onHandleUserPresent(context: Context) { private fun onHandleUserPresent(context: Context) {
if (BuildConfig.DEBUG) Log.i(
TAG,
"onHandleUserPresent() called with: thread = [${Thread.currentThread()}]"
)
BrandEventLogger.logEventWithBrand( BrandEventLogger.logEventWithBrand(
BaseApp.instance.eventLogger, BaseApp.instance.eventLogger,
ScreenLockerConstants.EVENT_SCREEN_LOCKER_USER_PRESENT ScreenConstant.EVENT_SCREEN_LOCKER_USER_PRESENT
) )
ScreenLockerContext.screenOffCalled = false ScreenLockerContext.screenOffCalled = false
...@@ -230,27 +198,22 @@ class ScreenLockerObserver(private val context: Context) { ...@@ -230,27 +198,22 @@ class ScreenLockerObserver(private val context: Context) {
if (shouldShowLockerAfterUserPresent()) { if (shouldShowLockerAfterUserPresent()) {
showScreenLocker( showScreenLocker(
context, context,
ScreenLockerConstants.SHOW_REASON_USER_PRESENT ScreenConstant.SHOW_REASON_USER_PRESENT
) )
} else { } else {
if (sendUserUnlocked) { if (sendUserUnlocked) {
sendUserUnlocked = false sendUserUnlocked = false
BaseApp.get().taskPool.cancel(taskTagShowScreenLocker) BaseApp.get().taskPool.cancel(taskTagShowScreenLocker)
BaseApp.get().bus.post(BusEvent.of(ScreenLockerEvents.USER_UNLOCKED)) BaseApp.get().bus.post(BusEvent.of(ScreenEvents.USER_UNLOCKED))
} }
ActivityManagerProxy.ensureActive() ActivityManagerProxy.ensureActive()
} }
} }
private fun onHandleScreenOn(context: Context) { private fun onHandleScreenOn(context: Context) {
if (BuildConfig.DEBUG) Log.i(
TAG,
"onHandleScreenOn() called with: thread = [${Thread.currentThread()}]"
)
BrandEventLogger.logEventWithBrand( BrandEventLogger.logEventWithBrand(
BaseApp.instance.eventLogger, BaseApp.instance.eventLogger,
ScreenLockerConstants.EVENT_SCREEN_LOCKER_SCREEN_ON ScreenConstant.EVENT_SCREEN_LOCKER_SCREEN_ON
) )
ScreenLockerContext.lastScreenOnTime = System.currentTimeMillis() ScreenLockerContext.lastScreenOnTime = System.currentTimeMillis()
...@@ -261,12 +224,6 @@ class ScreenLockerObserver(private val context: Context) { ...@@ -261,12 +224,6 @@ class ScreenLockerObserver(private val context: Context) {
screenOnRepeatCounter++ screenOnRepeatCounter++
// if (screenOnRepeatCounter == 8) {
// BaseApp.get().eventLogger.logEvent(
// UiConstants.EVENT_BUG_SCREEN_ON_REPEAT,
// EventParams().manufacturer(Build.MANUFACTURER).model(Build.MODEL)
// )
// }
} else { } else {
screenOnRepeatCounter = 0 screenOnRepeatCounter = 0
if (BuildConfig.DEBUG) Log.i(TAG, "onReceive: SCREEN ON counter RESET!") if (BuildConfig.DEBUG) Log.i(TAG, "onReceive: SCREEN ON counter RESET!")
...@@ -280,47 +237,27 @@ class ScreenLockerObserver(private val context: Context) { ...@@ -280,47 +237,27 @@ class ScreenLockerObserver(private val context: Context) {
// start on thread... // start on thread...
showScreenLocker( showScreenLocker(
context, context,
ScreenLockerConstants.SHOW_REASON_SCREEN_ON ScreenConstant.SHOW_REASON_SCREEN_ON
) )
} else { } else {
BaseApp.get().taskPool.launchOnUiDelayed(1000L, taskTagShowScreenLocker) { BaseApp.get().taskPool.launchOnUiDelayed(1000L, taskTagShowScreenLocker) {
if (/*shouldShowLockerAfterUserPresent || */ScreenLockerContext.canShowScreenLockerWhenScreenOn && shouldInvokeScreenLockerUiWhenScreenOn()) { if (/*shouldShowLockerAfterUserPresent || */ScreenLockerContext.canShowScreenLockerWhenScreenOn && shouldInvokeScreenLockerUiWhenScreenOn()) {
showScreenLocker( showScreenLocker(
context, context,
ScreenLockerConstants.SHOW_REASON_SCREEN_ON ScreenConstant.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}" +
"\nshouldInvokeScreenLockerUiWhenScreenOn() = ${shouldInvokeScreenLockerUiWhenScreenOn()}"
) )
} }
} }
} }
} else {
if (BuildConfig.DEBUG) Log.w(
TAG,
"onReceive: screen is on. but ignored showScreenLocker() invocation. Root cause = condition checking... A 1" +
"\nScreenLockerContext.canShowScreenLockerWhenScreenOn = ${ScreenLockerContext.canShowScreenLockerWhenScreenOn}" +
"\nshouldInvokeScreenLockerUiWhenScreenOn() = ${shouldInvokeScreenLockerUiWhenScreenOn()}"
)
} }
} }
private fun onHandleScreenOff(context: Context, isPowerDisconnected: Boolean = false) { private fun onHandleScreenOff(context: Context, isPowerDisconnected: Boolean = false) {
if (BuildConfig.DEBUG) Log.i(
TAG,
"onHandleScreenOff() called with: thread = [${Thread.currentThread()}], isPowerDisconnected = [$isPowerDisconnected]"
)
try { try {
BrandEventLogger.logEventWithBrand( BrandEventLogger.logEventWithBrand(
BaseApp.instance.eventLogger, BaseApp.instance.eventLogger,
ScreenLockerConstants.EVENT_SCREEN_LOCKER_SCREEN_OFF ScreenConstant.EVENT_SCREEN_LOCKER_SCREEN_OFF
) )
ScreenLockerContext.lastScreenOffTime = System.currentTimeMillis() ScreenLockerContext.lastScreenOffTime = System.currentTimeMillis()
...@@ -339,7 +276,7 @@ class ScreenLockerObserver(private val context: Context) { ...@@ -339,7 +276,7 @@ class ScreenLockerObserver(private val context: Context) {
if (!shouldShowLockerAfterUserPresent() && !forbidShowWhenScreenOff) { if (!shouldShowLockerAfterUserPresent() && !forbidShowWhenScreenOff) {
showScreenLocker( showScreenLocker(
context, context,
ScreenLockerConstants.SHOW_REASON_SCREEN_OFF ScreenConstant.SHOW_REASON_SCREEN_OFF
) )
} }
} }
...@@ -347,17 +284,17 @@ class ScreenLockerObserver(private val context: Context) { ...@@ -347,17 +284,17 @@ class ScreenLockerObserver(private val context: Context) {
private val lockScreenCallback = object : ScreenStatusMonitor.ScreenStatusListener { private val lockScreenCallback = object : ScreenStatusMonitor.ScreenStatusListener {
override fun onScreenOff() { override fun onScreenOff() {
BaseApp.instance.eventLogger.logEvent(ScreenLockerConstants.EVENT_SCREEN_LOCKER_RECEIVE3) BaseApp.instance.eventLogger.logEvent(ScreenConstant.EVENT_SCREEN_LOCKER_RECEIVE3)
onHandleScreenOff(BaseApp.instance) onHandleScreenOff(BaseApp.instance)
} }
override fun onScreenOn() { override fun onScreenOn() {
BaseApp.instance.eventLogger.logEvent(ScreenLockerConstants.EVENT_SCREEN_LOCKER_RECEIVE3) BaseApp.instance.eventLogger.logEvent(ScreenConstant.EVENT_SCREEN_LOCKER_RECEIVE3)
onHandleScreenOn(BaseApp.instance) onHandleScreenOn(BaseApp.instance)
} }
override fun onUserPresent() { override fun onUserPresent() {
BaseApp.instance.eventLogger.logEvent(ScreenLockerConstants.EVENT_SCREEN_LOCKER_RECEIVE3) BaseApp.instance.eventLogger.logEvent(ScreenConstant.EVENT_SCREEN_LOCKER_RECEIVE3)
onHandleUserPresent(BaseApp.instance) onHandleUserPresent(BaseApp.instance)
} }
} }
...@@ -370,15 +307,10 @@ class ScreenLockerObserver(private val context: Context) { ...@@ -370,15 +307,10 @@ class ScreenLockerObserver(private val context: Context) {
private val phoneStateListener: PhoneStateListener = object : PhoneStateListener() { private val phoneStateListener: PhoneStateListener = object : PhoneStateListener() {
override fun onCallStateChanged(state: Int, incomingNumber: String?) { override fun onCallStateChanged(state: Int, incomingNumber: String?) {
if (BuildConfig.DEBUG) Log.d(
TAG,
"onCallStateChanged() called with: state = [$state], incomingNumber = [$incomingNumber]"
)
when (state) { when (state) {
TelephonyManager.CALL_STATE_RINGING, TelephonyManager.CALL_STATE_OFFHOOK -> { TelephonyManager.CALL_STATE_RINGING, TelephonyManager.CALL_STATE_OFFHOOK -> {
CoreAdContext.callProcessing = true CoreAdContext.callProcessing = true
BaseApp.get().bus.post(ScreenLockerEvents.CALL_INCOMING) BaseApp.get().bus.post(ScreenEvents.CALL_INCOMING)
} }
TelephonyManager.CALL_STATE_IDLE -> { TelephonyManager.CALL_STATE_IDLE -> {
CoreAdContext.callProcessing = false CoreAdContext.callProcessing = false
...@@ -403,17 +335,13 @@ class ScreenLockerObserver(private val context: Context) { ...@@ -403,17 +335,13 @@ class ScreenLockerObserver(private val context: Context) {
// } // }
BrandEventLogger.logEventWithBrand(BaseApp.instance.eventLogger, BrandEventLogger.logEventWithBrand(BaseApp.instance.eventLogger,
ScreenLockerConstants.EVENT_SCREEN_LOCKER_START_PREINVOKE, ScreenConstant.EVENT_SCREEN_LOCKER_START_PREINVOKE,
EventParams().apply { EventParams().apply {
reason(reason.toString()) reason(reason.toString())
} }
) )
if (CoreAdContext.highPriorityEventBlockedPopup || CoreAdContext.callProcessing) { if (CoreAdContext.highPriorityEventBlockedPopup || CoreAdContext.callProcessing) {
if (BuildConfig.DEBUG) Log.w(
TAG,
"showScreenLocker: highPriorityEventBlockedPopup = ${CoreAdContext.highPriorityEventBlockedPopup}, callProcessing = ${CoreAdContext.callProcessing}"
)
return return
} }
...@@ -426,7 +354,6 @@ class ScreenLockerObserver(private val context: Context) { ...@@ -426,7 +354,6 @@ class ScreenLockerObserver(private val context: Context) {
@SuppressLint("CheckResult") @SuppressLint("CheckResult")
fun start(app: Application) { fun start(app: Application) {
if (BuildConfig.DEBUG) Log.d(TAG, "start() called started = $started")
if (!started) { if (!started) {
started = true started = true
...@@ -439,7 +366,7 @@ class ScreenLockerObserver(private val context: Context) { ...@@ -439,7 +366,7 @@ class ScreenLockerObserver(private val context: Context) {
BrandEventLogger.logEventWithBrand( BrandEventLogger.logEventWithBrand(
BaseApp.instance.eventLogger, BaseApp.instance.eventLogger,
ScreenLockerConstants.EVENT_SCREEN_LOCKER_INIT, ScreenConstant.EVENT_SCREEN_LOCKER_INIT,
EventParams() EventParams()
) )
...@@ -449,7 +376,7 @@ class ScreenLockerObserver(private val context: Context) { ...@@ -449,7 +376,7 @@ class ScreenLockerObserver(private val context: Context) {
if (BuildConfig.DEBUG) Log.e(TAG, "start: ERROR", e) if (BuildConfig.DEBUG) Log.e(TAG, "start: ERROR", e)
} }
BaseApp.instance.eventLogger.logEvent(ScreenLockerConstants.EVENT_SCREEN_LOCKER_INIT_2) BaseApp.instance.eventLogger.logEvent(ScreenConstant.EVENT_SCREEN_LOCKER_INIT_2)
if (useCallback) { if (useCallback) {
ScreenStatusMonitor.getInstance().addCallback(lockScreenCallback) ScreenStatusMonitor.getInstance().addCallback(lockScreenCallback)
} else { } else {
...@@ -462,7 +389,7 @@ class ScreenLockerObserver(private val context: Context) { ...@@ -462,7 +389,7 @@ class ScreenLockerObserver(private val context: Context) {
sendUserUnlocked = ScreenLockerUtils.hasSystemLockScreen(context) sendUserUnlocked = ScreenLockerUtils.hasSystemLockScreen(context)
showScreenLocker( showScreenLocker(
context, context,
ScreenLockerConstants.SHOW_REASON_SCREEN_OFF ScreenConstant.SHOW_REASON_SCREEN_OFF
) )
} }
BusEventObserver.observe(BaseApp.get().bus, this::onBusEvent) BusEventObserver.observe(BaseApp.get().bus, this::onBusEvent)
...@@ -489,11 +416,6 @@ class ScreenLockerObserver(private val context: Context) { ...@@ -489,11 +416,6 @@ class ScreenLockerObserver(private val context: Context) {
// some activities may launched from screen locker activity even when device is still locked. // some activities may launched from screen locker activity even when device is still locked.
if (activity !is OutAppActivity) { if (activity !is OutAppActivity) {
if (BuildConfig.DEBUG) Log.i(
TAG,
"onActivityCreated: Adding SHOW_WHEN_LOCKED = true... activity = $activity"
)
@Suppress("DEPRECATION") @Suppress("DEPRECATION")
activity.window.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED) activity.window.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED)
} }
...@@ -512,8 +434,6 @@ class ScreenLockerObserver(private val context: Context) { ...@@ -512,8 +434,6 @@ class ScreenLockerObserver(private val context: Context) {
override fun onActivityPaused(activity: Activity) { override fun onActivityPaused(activity: Activity) {
super.onActivityPaused(activity) super.onActivityPaused(activity)
if (BuildConfig.DEBUG) Log.w(TAG, "onActivityPaused: activity = $activity")
// avoid back ad shows on top of system lock screen // avoid back ad shows on top of system lock screen
if (activity is ScreenActivity) { if (activity is ScreenActivity) {
// CoreAdContext.lastShowScreenLockerTimestamp = System.currentTimeMillis() // CoreAdContext.lastShowScreenLockerTimestamp = System.currentTimeMillis()
...@@ -522,17 +442,14 @@ class ScreenLockerObserver(private val context: Context) { ...@@ -522,17 +442,14 @@ class ScreenLockerObserver(private val context: Context) {
override fun onActivityDestroyed(activity: Activity) { override fun onActivityDestroyed(activity: Activity) {
super.onActivityDestroyed(activity) super.onActivityDestroyed(activity)
if (BuildConfig.DEBUG) Log.w(TAG, "onActivityDestroyed: activity = $activity")
} }
}) })
} }
private fun onBusEvent(event: BusEvent) { private fun onBusEvent(event: BusEvent) {
if (BuildConfig.DEBUG) Log.d(TAG, "onBusEvent() called with: event = [$event]")
when (event.event) { when (event.event) {
ScreenLockerEvents.SCREENLOCKER_UNLOCKED_BY_USER -> { ScreenEvents.SCREENLOCKER_UNLOCKED_BY_USER -> {
ScreenLockerContext.canShowScreenLockerWhenScreenOn = false ScreenLockerContext.canShowScreenLockerWhenScreenOn = false
} }
} }
...@@ -540,8 +457,6 @@ class ScreenLockerObserver(private val context: Context) { ...@@ -540,8 +457,6 @@ class ScreenLockerObserver(private val context: Context) {
@Suppress("unused") @Suppress("unused")
fun stop() { fun stop() {
if (BuildConfig.DEBUG) Log.d(TAG, "stop() called started = $started")
if (started) { if (started) {
started = false started = false
try { try {
...@@ -567,30 +482,6 @@ class ScreenLockerObserver(private val context: Context) { ...@@ -567,30 +482,6 @@ class ScreenLockerObserver(private val context: Context) {
} }
private fun tryShowChargeReportDialog(@Suppress("UNUSED_PARAMETER") context: Context): Boolean { private fun tryShowChargeReportDialog(@Suppress("UNUSED_PARAMETER") context: Context): Boolean {
// var handled = false
// if (BuildConfig.DEBUG) Log.d(
// TAG,
// "tryShowChargeReportDialog() currentTimeMillis: " + System.currentTimeMillis() + ", ChargeStartTime: " + ChargeReport.getChargeStartTime()
// )
// if (ChargeReport.isChargeReportOpened(context) && ChargeReport.getChargeStartTime() > 0 && System.currentTimeMillis() - ChargeReport.getChargeStartTime() >= 2 * 60 * 1000) {
//// Intent chargeReportIntent = new Intent(context, ActivityChargeReport.class);
// val chargeReportIntent = Intent(context, ActivityChargeReportDg::class.java)
// chargeReportIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
// try {
// AdHelper.config.avoidRestartSelfOnUserLeaveHint = true
// context.startActivity(chargeReportIntent)
// ActionTime.setTimeBySPKey(context, ActionTime.SP_Pop_Last_Time)
// handled = true
// } catch (e: ActivityNotFoundException) {
// if (BuildConfig.DEBUG) Log.d(TAG, "tryShowChargeReportDialog() exception: $e")
// AnalyticsLogger.logException(e)
// }
// } else {
// if (BuildConfig.DEBUG) Log.d(TAG, "tryShowChargeReportDialog() condition false")
// Thread { ChargeReport.reset(context) }.start()
// }
// return handled
return false return false
} }
} }
package com.mints.flowbox.keepalive.screen
import net.settings.AppSettings
import net.settings.ISettings
object ScreenSettings {
const val KEY_ENABLED = "dd_ena"
const val ENABLED_DEFAULT = ISettings.BOOLEAN_TRUE
fun isEnabledFlag(): Boolean {
return AppSettings.global.readInt(
KEY_ENABLED,
ENABLED_DEFAULT
) == ISettings.BOOLEAN_TRUE
}
}
\ No newline at end of file
package com.mints.flowbox.screen.settings
import net.settings.IRemoteKeys
object ScreenLockerRemoteKeys : 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"
const val KEY_RED_PACKET_POPUP_INTERVAL = "ext_dd_rp_ppint"
}
\ No newline at end of file
package com.mints.flowbox.screen.settings
import net.cloud.RemoteProxy
import net.common.minutesMillis
import net.settings.AppSettings
import net.settings.ISettings
object ScreenLockerSettings {
const val KEY_ENABLED = "dd_ena"
const val KEY_RED_PACKET_POPUP_TIME = "dd_rp_pptime"
const val ENABLED_DEFAULT = ISettings.BOOLEAN_TRUE
fun isEnabled(): Boolean {
return AppSettings.global.readInt(
KEY_ENABLED,
ENABLED_DEFAULT
) == ISettings.BOOLEAN_TRUE
}
fun isDismissWithSystemKeyguard(): Boolean {
return RemoteProxy.readInt(ScreenLockerRemoteKeys.KEY_DISMISS_WITH_SYSTEM_KEYGUARD, ISettings.BOOLEAN_FALSE) == ISettings.BOOLEAN_TRUE
}
/**
* 如果广告显示超过一定时长,无论如何我都换一个
*/
fun getAdExpireInterval(): Long {
return RemoteProxy.readLong(ScreenLockerRemoteKeys.KEY_AD_EXPIRE_INTERVAL, 45.minutesMillis())
}
fun getAdPopulateInterval(): Long {
return RemoteProxy.readLong(ScreenLockerRemoteKeys.KEY_AD_POPULATE_INTERVAL, 1.minutesMillis())
}
fun getRedPacketPopupInterval(): Long {
return RemoteProxy.readLong(ScreenLockerRemoteKeys.KEY_RED_PACKET_POPUP_INTERVAL, 30.minutesMillis())
}
var lastRedPacketPopupPopupTime: Long
get() = AppSettings.app.readLong(KEY_RED_PACKET_POPUP_TIME, 0L)
set(value) = AppSettings.app.writeLong(KEY_RED_PACKET_POPUP_TIME, value)
}
\ No newline at end of file
...@@ -35,7 +35,7 @@ class AboutusActivity : BaseActivity(), View.OnClickListener { ...@@ -35,7 +35,7 @@ class AboutusActivity : BaseActivity(), View.OnClickListener {
iv_left_icon.visibility = View.VISIBLE iv_left_icon.visibility = View.VISIBLE
iv_left_icon.setImageResource(R.mipmap.ic_arrow_back) iv_left_icon.setImageResource(R.mipmap.ic_arrow_back)
showLoading("加载中...") // showLoading("加载中...")
ivAboutasIcon.setOnLongClickListener { ivAboutasIcon.setOnLongClickListener {
ToastUtil.showLong( ToastUtil.showLong(
......
...@@ -13,8 +13,8 @@ import android.view.WindowManager ...@@ -13,8 +13,8 @@ import android.view.WindowManager
import androidx.core.app.ActivityCompat import androidx.core.app.ActivityCompat
import com.main.ScreenMonitor import com.main.ScreenMonitor
import com.mints.flowbox.R import com.mints.flowbox.R
import com.mints.flowbox.screen.ScreenLockerContext import com.mints.flowbox.keepalive.screen.ScreenLockerContext
import com.mints.flowbox.screen.ScreenLockerObserver import com.mints.flowbox.keepalive.screen.ScreenLockerObserver
import com.mints.flowbox.utils.keepalive.ScreenLockerUtils import com.mints.flowbox.utils.keepalive.ScreenLockerUtils
import com.mints.library.base.BaseSwipeBackCompatActivity import com.mints.library.base.BaseSwipeBackCompatActivity
import com.mints.library.net.netstatus.NetUtils import com.mints.library.net.netstatus.NetUtils
......
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