|
|
@@ -3,14 +3,12 @@ package com.adealink.weparty
|
|
|
import android.content.Context
|
|
|
import android.content.SharedPreferences
|
|
|
import android.content.res.Configuration
|
|
|
-import android.graphics.Bitmap
|
|
|
import android.os.SystemClock
|
|
|
import androidx.room.Room
|
|
|
import com.adealink.frame.aab.AAB
|
|
|
import com.adealink.frame.aab.util.getCompatString
|
|
|
import com.adealink.frame.apm.initAPMService
|
|
|
import com.adealink.frame.base.AppBaseInfo
|
|
|
-import com.adealink.frame.coroutine.dispatcher.Dispatcher
|
|
|
import com.adealink.frame.crash.installCrashProtector
|
|
|
import com.adealink.frame.data.json.initJsonConfig
|
|
|
import com.adealink.frame.debug.datasource.performanceDataController
|
|
|
@@ -24,7 +22,6 @@ import com.adealink.frame.effect.createEffect
|
|
|
import com.adealink.frame.effect.initEffect
|
|
|
import com.adealink.frame.googleservice.createGoogleService
|
|
|
import com.adealink.frame.image.imageService
|
|
|
-import com.adealink.frame.image.listener.IImageLoadResultListener
|
|
|
import com.adealink.frame.imkit.IMService
|
|
|
import com.adealink.frame.initStorageService
|
|
|
import com.adealink.frame.locale.language.createLanguageManager
|
|
|
@@ -42,8 +39,8 @@ import com.adealink.frame.router.manager.deeplinkRouterManager
|
|
|
import com.adealink.frame.security.createSecurityService
|
|
|
import com.adealink.frame.share.initShareManager
|
|
|
import com.adealink.frame.sound.createSoundPlayer
|
|
|
-import com.adealink.frame.startup.dispatcher.AppStartTaskDispatcher
|
|
|
-import com.adealink.frame.startup.task.AppStartTask
|
|
|
+import com.adealink.frame.startup.dispatcher.StartTaskDispatcher
|
|
|
+import com.adealink.frame.startup.task.StartUpTask
|
|
|
import com.adealink.frame.statistics.report.initStat
|
|
|
import com.adealink.frame.storageService
|
|
|
import com.adealink.frame.tceffect.TCEffectManager
|
|
|
@@ -70,6 +67,7 @@ import com.adealink.weparty.deviceidservice.DeviceIdServiceConfig
|
|
|
import com.adealink.weparty.deviceidservice.TCTuringConfig
|
|
|
import com.adealink.weparty.download.DownloadConfig
|
|
|
import com.adealink.weparty.effect.EffectConfig
|
|
|
+import com.adealink.weparty.effect.SVGA_CONFIG
|
|
|
import com.adealink.weparty.effect.TCEffectConfig
|
|
|
import com.adealink.weparty.googleservice.GoogleServiceConfig
|
|
|
import com.adealink.weparty.hardware.HardwareManager
|
|
|
@@ -116,19 +114,9 @@ import com.gu.toolargetool.DefaultFormatter
|
|
|
import com.gu.toolargetool.Logger
|
|
|
import com.gu.toolargetool.TooLargeTool
|
|
|
import com.opensource.svgaplayer.control.SVGAManager
|
|
|
-import com.opensource.svgaplayer.control.SvgaConfig
|
|
|
-import com.opensource.svgaplayer.disk.DiskCacheParamsSupplier
|
|
|
-import com.opensource.svgaplayer.disk.DiskTrimStrategy
|
|
|
-import com.opensource.svgaplayer.executor.ExecutorsSupplier
|
|
|
-import com.opensource.svgaplayer.remote.ImageFetchCallback
|
|
|
-import com.opensource.svgaplayer.remote.ImageFetcher
|
|
|
-import com.opensource.svgaplayer.utils.ByteConstants
|
|
|
import com.tencent.mars.xlog.Xlog
|
|
|
import io.rong.imlib.model.InitOption
|
|
|
import me.weishu.reflection.Reflection
|
|
|
-import java.io.File
|
|
|
-import java.util.concurrent.Executor
|
|
|
-import java.util.concurrent.TimeUnit
|
|
|
|
|
|
/**
|
|
|
* Created by sunxiaodong on 2021/3/25.
|
|
|
@@ -176,8 +164,49 @@ class App : SplitCompatApplication(), ActivityLifecycleCallbacksExt {
|
|
|
logTime(TAG_TIME_APP_START, "app attachBaseContext end")
|
|
|
}
|
|
|
|
|
|
- abstract inner class MainThreadStartTask : AppStartTask() {
|
|
|
- override val isRunOnMainThread: Boolean = true
|
|
|
+ override fun onCreate() {
|
|
|
+ super.onCreate()
|
|
|
+ val appOnCreateTs = SystemClock.elapsedRealtime()
|
|
|
+ Log.i(TAG_TIME_APP_START, "app onCreate start")
|
|
|
+ //基础任务
|
|
|
+ baseStartTask()
|
|
|
+ //APP并发初始化任务
|
|
|
+ StartTaskDispatcher.create().apply {
|
|
|
+ addAppStartTask(InitNetwork())
|
|
|
+ addAppStartTask(InitPush())
|
|
|
+ addAppStartTask(InitUI())
|
|
|
+ addAppStartTask(InitTCEffect())
|
|
|
+ addAppStartTask(InitSVGA())
|
|
|
+ addAppStartTask(InitImageService())
|
|
|
+ addAppStartTask(InitRouter())
|
|
|
+ addAppStartTask(InitLanguage())
|
|
|
+ addAppStartTask(InitSecurityService())
|
|
|
+ addAppStartTask(InitGoogleService())
|
|
|
+ addAppStartTask(InitStorageService())
|
|
|
+ addAppStartTask(InitShareManager())
|
|
|
+ addAppStartTask(InitOssService())
|
|
|
+ addAppStartTask(InitJSBridgeManager())
|
|
|
+ addAppStartTask(InitWebResourceLoader())
|
|
|
+ addAppStartTask(InitDownloadService())
|
|
|
+ addAppStartTask(InitEffect())
|
|
|
+ addAppStartTask(InitFirebaseAnalytics())
|
|
|
+ addAppStartTask(InitFB())
|
|
|
+ addAppStartTask(InitPayerMax())
|
|
|
+
|
|
|
+ addAppStartTask(InitIM())
|
|
|
+ addAppStartTask(InitCall1())
|
|
|
+ addAppStartTask(InitCall2())
|
|
|
+ addAppStartTask(InitTCTuringManager())
|
|
|
+
|
|
|
+ //其他子任务(不卡主流程)
|
|
|
+ addAppStartTask(InitOther())
|
|
|
+
|
|
|
+ if (!AppBaseInfo.isRelease) {
|
|
|
+ addAppStartTask(InitDebugKit())
|
|
|
+ }
|
|
|
+
|
|
|
+ }.start().await()
|
|
|
+ Log.i(TAG_TIME_APP_START, "app onCreate end, cost:${SystemClock.elapsedRealtime() - appOnCreateTs}")
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -185,112 +214,180 @@ class App : SplitCompatApplication(), ActivityLifecycleCallbacksExt {
|
|
|
* - 日志
|
|
|
* - 组件/模块配置
|
|
|
*/
|
|
|
- inner class BaseStartTask : MainThreadStartTask() {
|
|
|
+ private fun baseStartTask() {
|
|
|
+ val startTs = SystemClock.elapsedRealtime()
|
|
|
+ Log.i(TAG_TIME_APP_START, "baseStartTask start")
|
|
|
+ initXLog()
|
|
|
+ initAPMService(APMConfig())
|
|
|
+ initAPM(this@App)
|
|
|
+ initStat { StatConfig() }
|
|
|
+ installCrashProtector(CrashConfig())
|
|
|
+ initCrash(this@App) //依赖xlog,stat,crash protector
|
|
|
+ AAB.init(AABConfig())
|
|
|
+ initJsonConfig(JsonConfig())
|
|
|
+ Log.i(TAG_TIME_APP_START, "baseStartTask end, cost: ${SystemClock.elapsedRealtime() - startTs}")
|
|
|
+ }
|
|
|
+
|
|
|
+ private fun initXLog() {
|
|
|
+ XLogHelper.initXLog(
|
|
|
+ if (BuildConfig.OFFICIAL || BuildConfig.DEBUG) Xlog.LEVEL_ALL else Xlog.LEVEL_INFO,
|
|
|
+ FilePath.logPath,
|
|
|
+ FilePath.logPath,
|
|
|
+ BuildConfig.DEBUG
|
|
|
+ )
|
|
|
+ Log.setLogConfig(LogConfig())
|
|
|
+ }
|
|
|
|
|
|
+ /**
|
|
|
+ * APP初始化任务(阻塞主线程)
|
|
|
+ */
|
|
|
+ inner class InitPush : MainThreadStartUpTask() {
|
|
|
override fun run() {
|
|
|
- initXLog()
|
|
|
- initAPMService(APMConfig())
|
|
|
- initAPM(this@App)
|
|
|
- initStat { StatConfig() }
|
|
|
- installCrashProtector(CrashConfig())
|
|
|
- initCrash(this@App) //依赖xlog,stat,crash protector
|
|
|
- AAB.init(AABConfig())
|
|
|
+ pushService.init(PushServiceConfig())
|
|
|
+ NotificationUtil.createNotificationChannel(getCompatString(R.string.channel_event))
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- inner class SecondStartTask : MainThreadStartTask() {
|
|
|
+ inner class InitUI : MainThreadStartUpTask() {
|
|
|
override fun run() {
|
|
|
- initJsonConfig(JsonConfig())
|
|
|
- initPush()
|
|
|
//UI初始化
|
|
|
WEUI.init(this@App)
|
|
|
- initTCEffect()
|
|
|
- initSVGA()
|
|
|
- initAutoSize()
|
|
|
- imageService.init(ImageConfig())
|
|
|
- OperationModule.init()
|
|
|
+ ScreenAutoSizeUtil.init(this@App, !AppBaseInfo.isRelease)
|
|
|
+ WindowManagerProxy.init()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ inner class InitImageService : MainThreadStartUpTask() {
|
|
|
+ override fun run() {
|
|
|
+ imageService.init(ImageConfig())
|
|
|
+ }
|
|
|
|
|
|
- abstract inner class SubWaitStartTask : AppStartTask() {
|
|
|
- override val isRunOnMainThread: Boolean = false
|
|
|
+ override val dependsTaskList: List<Class<out StartUpTask>>
|
|
|
+ get() = listOf(InitUI::class.java)
|
|
|
+ }
|
|
|
|
|
|
- override fun needWait(): Boolean {
|
|
|
- return true
|
|
|
+ inner class InitTCEffect : SubWaitStartUpTask() {
|
|
|
+ override fun run() {
|
|
|
+ TCEffectManager.init(TCEffectConfig())
|
|
|
}
|
|
|
|
|
|
- override val dependsTaskList: List<Class<out AppStartTask>>
|
|
|
- get() = listOf(BaseStartTask::class.java)
|
|
|
+ override val dependsTaskList: List<Class<out StartUpTask>>
|
|
|
+ get() = listOf(InitUI::class.java)
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 子启动任务(不需要等待完成)
|
|
|
- */
|
|
|
- abstract inner class SubNoWaitStartTask : AppStartTask() {
|
|
|
- override val isRunOnMainThread: Boolean = false
|
|
|
-
|
|
|
- override fun needWait(): Boolean {
|
|
|
- return false
|
|
|
+ inner class InitSVGA : SubWaitStartUpTask() {
|
|
|
+ override fun run() {
|
|
|
+ SVGAManager.init(this@App, SVGA_CONFIG)
|
|
|
}
|
|
|
|
|
|
- override val dependsTaskList: List<Class<out AppStartTask>>
|
|
|
- get() = listOf(BaseStartTask::class.java)
|
|
|
+ override val dependsTaskList: List<Class<out StartUpTask>>
|
|
|
+ get() = listOf(InitUI::class.java)
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- /**
|
|
|
- * 轻量任务1(每一项任务耗时控制在100ms内)
|
|
|
- * (耗时可通过trace导出)
|
|
|
- */
|
|
|
- inner class LightWaitTask1 : SubWaitStartTask() {
|
|
|
+ inner class InitRouter : SubWaitStartUpTask() {
|
|
|
override fun run() {
|
|
|
Router.config = RouterConfig()
|
|
|
deeplinkRouterManager.init(DeepLinkConfig())
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ inner class InitLanguage : SubWaitStartUpTask() {
|
|
|
+ override fun run() {
|
|
|
languageManager.init()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ inner class InitSecurityService : SubWaitStartUpTask() {
|
|
|
+ override fun run() {
|
|
|
securityService.init()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ inner class InitGoogleService : SubWaitStartUpTask() {
|
|
|
+ override fun run() {
|
|
|
googleService.init()
|
|
|
- registerNetworkReceiver()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ inner class InitStorageService : SubWaitStartUpTask() {
|
|
|
+ override fun run() {
|
|
|
initStorageService(StorageConfig())
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ inner class InitShareManager : SubWaitStartUpTask() {
|
|
|
+ override fun run() {
|
|
|
initShareManager(ShareConfig())
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ inner class InitOssService : SubWaitStartUpTask() {
|
|
|
+ override fun run() {
|
|
|
initOssService { ossService }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ inner class InitJSBridgeManager : SubWaitStartUpTask() {
|
|
|
+ override fun run() {
|
|
|
initJSBridgeManager { jsBridgeManager }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ inner class InitWebResourceLoader : SubWaitStartUpTask() {
|
|
|
+ override fun run() {
|
|
|
initWebResourceLoader(WebResourceConfig())
|
|
|
+ }
|
|
|
+
|
|
|
+ override val dependsTaskList: List<Class<out StartUpTask>>
|
|
|
+ get() = listOf(InitNetwork::class.java)
|
|
|
+ }
|
|
|
+
|
|
|
+ inner class InitDownloadService : SubWaitStartUpTask() {
|
|
|
+ override fun run() {
|
|
|
initDownloadService { downloadService }
|
|
|
+ }
|
|
|
+
|
|
|
+ override val dependsTaskList: List<Class<out StartUpTask>>
|
|
|
+ get() = listOf(InitNetwork::class.java)
|
|
|
+ }
|
|
|
+
|
|
|
+ inner class InitEffect : SubWaitStartUpTask() {
|
|
|
+ override fun run() {
|
|
|
initEffect { effect }
|
|
|
- WindowManagerProxy.init()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- inner class LightWaitTask2 : SubWaitStartTask() {
|
|
|
+ inner class InitFirebaseAnalytics : SubWaitStartUpTask() {
|
|
|
override fun run() {
|
|
|
- initFirebaseAnalytics()
|
|
|
- initFB()
|
|
|
- initPayerMax()
|
|
|
+ val analytics = FirebaseAnalytics.getInstance(applicationContext)
|
|
|
+ analytics.setUserProperty(ALLOW_AD_PERSONALIZATION_SIGNALS, "true")
|
|
|
+ analytics.setAnalyticsCollectionEnabled(true)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- inner class LightNoWaitTask1 : SubNoWaitStartTask() {
|
|
|
+ inner class InitFB : SubWaitStartUpTask() {
|
|
|
override fun run() {
|
|
|
- initAttribution()
|
|
|
- deviceIdService.updateDeviceId()
|
|
|
- networkService.fetchNetAntiBanConfig()
|
|
|
- urlConfigService.init()
|
|
|
- soundPlayer.prepare()
|
|
|
+ if (!AppBaseInfo.isRelease) {
|
|
|
+ FacebookSdk.setIsDebugEnabled(AppBaseInfo.isRelease)
|
|
|
+ FacebookSdk.addLoggingBehavior(LoggingBehavior.APP_EVENTS)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ inner class InitPayerMax : SubWaitStartUpTask() {
|
|
|
+ override fun run() {
|
|
|
+ PayerMaxHelper.init(this@App)
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- /**
|
|
|
- * 重任务(任务耗时>30ms)
|
|
|
- */
|
|
|
- inner class InitNetwork : SubWaitStartTask() {
|
|
|
+ inner class InitNetwork : SubWaitStartUpTask() {
|
|
|
override fun run() {
|
|
|
networkManager.init(this@App)
|
|
|
+ registerNetworkReceiver()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- inner class InitIM : SubWaitStartTask() {
|
|
|
+ inner class InitIM : SubWaitStartUpTask() {
|
|
|
override fun run() {
|
|
|
imService.init(
|
|
|
this@App,
|
|
|
@@ -311,7 +408,7 @@ class App : SplitCompatApplication(), ActivityLifecycleCallbacksExt {
|
|
|
}
|
|
|
|
|
|
//1v1呼叫主线程
|
|
|
- inner class InitCall1 : SubWaitStartTask() {
|
|
|
+ inner class InitCall1 : SubWaitStartUpTask() {
|
|
|
override val isRunOnMainThread: Boolean = true
|
|
|
|
|
|
override fun run() {
|
|
|
@@ -320,194 +417,68 @@ class App : SplitCompatApplication(), ActivityLifecycleCallbacksExt {
|
|
|
}
|
|
|
|
|
|
//1v1呼叫子线程
|
|
|
- inner class InitCall2 : SubWaitStartTask() {
|
|
|
+ inner class InitCall2 : SubWaitStartUpTask() {
|
|
|
override fun run() {
|
|
|
CallModule.appOnCreateSubTask(this@App)
|
|
|
}
|
|
|
|
|
|
- override val dependsTaskList: List<Class<out AppStartTask>>
|
|
|
+ override val dependsTaskList: List<Class<out StartUpTask>>
|
|
|
get() = listOf(
|
|
|
*super.dependsTaskList.toTypedArray(),
|
|
|
InitCall1::class.java
|
|
|
)
|
|
|
}
|
|
|
|
|
|
- inner class InitTCTuringManager : SubWaitStartTask() {
|
|
|
+ inner class InitTCTuringManager : SubWaitStartUpTask() {
|
|
|
override fun run() {
|
|
|
TCTuringManager.init(TCTuringConfig())
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- inner class InitDebugKit : SubWaitStartTask() {
|
|
|
+ inner class InitDebugKit : SubWaitStartUpTask() {
|
|
|
override val isRunOnMainThread: Boolean = true
|
|
|
|
|
|
override fun run() {
|
|
|
- initDebugKit()
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- override fun onCreate() {
|
|
|
- super.onCreate()
|
|
|
- val appOnCreateTs = SystemClock.elapsedRealtime()
|
|
|
- android.util.Log.d(TAG_TIME_APP_START, "app onCreate start")
|
|
|
-
|
|
|
- AppStartTaskDispatcher.create().apply {
|
|
|
- //基础任务(主线程)
|
|
|
- addAppStartTask(BaseStartTask())
|
|
|
- addAppStartTask(SecondStartTask())
|
|
|
-
|
|
|
- //轻量任务(子线程并行, 占用主流程初始化时间)
|
|
|
- addAppStartTask(LightWaitTask1())
|
|
|
- addAppStartTask(LightWaitTask2())
|
|
|
-
|
|
|
- //轻量任务(子线程并行, 占用主流程初始化时间)
|
|
|
- addAppStartTask(InitNetwork())
|
|
|
- addAppStartTask(InitTCTuringManager())
|
|
|
- addAppStartTask(InitIM())
|
|
|
- addAppStartTask(InitCall1())
|
|
|
- addAppStartTask(InitCall2())
|
|
|
-
|
|
|
- //其他子任务(不卡主流程)
|
|
|
- addAppStartTask(LightNoWaitTask1())
|
|
|
- if (!AppBaseInfo.isRelease) {
|
|
|
- addAppStartTask(InitDebugKit())
|
|
|
+ if (AppBaseInfo.isRelease) {
|
|
|
+ return
|
|
|
}
|
|
|
-
|
|
|
- }.start().await()
|
|
|
-
|
|
|
- android.util.Log.d(TAG_TIME_APP_START, "app onCreate end, cost:${SystemClock.elapsedRealtime() - appOnCreateTs}")
|
|
|
- }
|
|
|
-
|
|
|
- private fun initXLog() {
|
|
|
- XLogHelper.initXLog(
|
|
|
- if (BuildConfig.OFFICIAL || BuildConfig.DEBUG) Xlog.LEVEL_ALL else Xlog.LEVEL_INFO,
|
|
|
- FilePath.logPath,
|
|
|
- FilePath.logPath,
|
|
|
- BuildConfig.DEBUG
|
|
|
- )
|
|
|
- Log.setLogConfig(LogConfig())
|
|
|
- }
|
|
|
-
|
|
|
- private fun initTCEffect() {
|
|
|
- TCEffectManager.init(TCEffectConfig())
|
|
|
- }
|
|
|
-
|
|
|
- private fun initSVGA() {
|
|
|
- val config = SvgaConfig(
|
|
|
- diskCacheParamsSupplier = object : DiskCacheParamsSupplier {
|
|
|
- override fun getPath(): File = File(applicationContext.cacheDir, "svga")
|
|
|
-
|
|
|
- override fun getDiskTrimStrategy(): DiskTrimStrategy {
|
|
|
- return object : DiskTrimStrategy {
|
|
|
- override fun maxSize(): Long = ByteConstants.MB * 100L
|
|
|
- override fun timeExpired(): Long = TimeUnit.DAYS.toMillis(10)
|
|
|
+ if (DebugPrefs.showPerformanceFloatView) {
|
|
|
+ floatKitManager.install(this@App, true)
|
|
|
+ floatKitManager.onMainIconDoubleClick = {
|
|
|
+ AppUtil.currentActivity?.let {
|
|
|
+ Router.build(it, Debug.Debug.PATH).start()
|
|
|
}
|
|
|
}
|
|
|
- },
|
|
|
- executorsSupplier = object : ExecutorsSupplier {
|
|
|
-
|
|
|
- override fun getBackgroundExecutor(): Executor {
|
|
|
- return Dispatcher.wenextThreadPoolExecutor
|
|
|
- }
|
|
|
-
|
|
|
- override fun getIOExecutor(): Executor {
|
|
|
- return Dispatcher.wenextThreadPoolExecutor
|
|
|
- }
|
|
|
-
|
|
|
- override fun getNetWorkExecutor(): Executor {
|
|
|
- return Dispatcher.wenextThreadPoolExecutor
|
|
|
+ performanceDataController.start()
|
|
|
+ }
|
|
|
+ TooLargeTool.startLogging(this@App, DefaultFormatter(), object : Logger {
|
|
|
+ override fun log(msg: String) {
|
|
|
+ Log.i(TAG_TOO_LARGE_TOOL, msg)
|
|
|
}
|
|
|
|
|
|
- },
|
|
|
- debuggable = !AppBaseInfo.isRelease,
|
|
|
- imageFetcher = object : ImageFetcher {
|
|
|
-
|
|
|
- override fun fetchDynamicImage(
|
|
|
- url: String,
|
|
|
- forKey: String,
|
|
|
- callback: ImageFetchCallback?
|
|
|
- ) {
|
|
|
- imageService.fetchImage(url, object : IImageLoadResultListener {
|
|
|
- override fun onSuccess(bitmap: Bitmap) {
|
|
|
- super.onSuccess(bitmap)
|
|
|
- callback?.onFetched(bitmap, forKey)
|
|
|
- }
|
|
|
-
|
|
|
- override fun onFailed() {
|
|
|
- super.onFailed()
|
|
|
- callback?.onFailure(Exception("load image failed"), forKey)
|
|
|
- }
|
|
|
-
|
|
|
- override fun onCancel() {
|
|
|
- super.onCancel()
|
|
|
- callback?.onFailure(Exception("load image canceled"), forKey)
|
|
|
- }
|
|
|
- })
|
|
|
+ override fun logException(e: Exception) {
|
|
|
+ Log.e(TAG_TOO_LARGE_TOOL, "logException", e)
|
|
|
}
|
|
|
-
|
|
|
- },
|
|
|
- designWidthPx = 750f,
|
|
|
- enableSvgaChecker = !AppBaseInfo.isRelease && DebugPrefs.enableSvgaChecker,
|
|
|
- enableShowSvgaCheckResult = !AppBaseInfo.isRelease && DebugPrefs.enableSvgaChecker && DebugPrefs.enableShowSvgaCheckResult
|
|
|
- )
|
|
|
- SVGAManager.init(applicationContext, config)
|
|
|
- }
|
|
|
-
|
|
|
- private fun initFirebaseAnalytics() {
|
|
|
- val analytics = FirebaseAnalytics.getInstance(applicationContext)
|
|
|
- analytics.setUserProperty(ALLOW_AD_PERSONALIZATION_SIGNALS, "true")
|
|
|
- analytics.setAnalyticsCollectionEnabled(true)
|
|
|
- }
|
|
|
-
|
|
|
- private fun initAttribution() {
|
|
|
- AttributionModule.initialize()
|
|
|
- AttributionModule.start()
|
|
|
- AttributionModule.reportFirstOpen()
|
|
|
- }
|
|
|
-
|
|
|
- private fun initFB() {
|
|
|
- if (!AppBaseInfo.isRelease) {
|
|
|
- FacebookSdk.setIsDebugEnabled(AppBaseInfo.isRelease)
|
|
|
- FacebookSdk.addLoggingBehavior(LoggingBehavior.APP_EVENTS)
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private fun initPush() {
|
|
|
- pushService.init(PushServiceConfig())
|
|
|
- NotificationUtil.createNotificationChannel(getCompatString(R.string.channel_event))
|
|
|
- }
|
|
|
-
|
|
|
- private fun initPayerMax() {
|
|
|
- PayerMaxHelper.init(this)
|
|
|
- }
|
|
|
+ /**
|
|
|
+ * 其他任务(非阻塞主线程)
|
|
|
+ */
|
|
|
+ inner class InitOther : SubNoWaitStartUpTask() {
|
|
|
+ override fun run() {
|
|
|
+ deviceIdService.updateDeviceId()
|
|
|
+ networkService.fetchNetAntiBanConfig()
|
|
|
+ urlConfigService.init()
|
|
|
+ soundPlayer.prepare()
|
|
|
|
|
|
- private fun initAutoSize() {
|
|
|
- ScreenAutoSizeUtil.init(this, !AppBaseInfo.isRelease)
|
|
|
- }
|
|
|
+ AttributionModule.initialize()
|
|
|
+ AttributionModule.start()
|
|
|
+ AttributionModule.reportFirstOpen()
|
|
|
|
|
|
- private fun initDebugKit() {
|
|
|
- if (AppBaseInfo.isRelease) {
|
|
|
- return
|
|
|
- }
|
|
|
- if (DebugPrefs.showPerformanceFloatView) {
|
|
|
- floatKitManager.install(this, true)
|
|
|
- floatKitManager.onMainIconDoubleClick = {
|
|
|
- AppUtil.currentActivity?.let {
|
|
|
- Router.build(it, Debug.Debug.PATH).start()
|
|
|
- }
|
|
|
- }
|
|
|
- performanceDataController.start()
|
|
|
+ OperationModule.init()
|
|
|
}
|
|
|
- TooLargeTool.startLogging(this, DefaultFormatter(), object : Logger {
|
|
|
- override fun log(msg: String) {
|
|
|
- Log.i(TAG_TOO_LARGE_TOOL, msg)
|
|
|
- }
|
|
|
-
|
|
|
- override fun logException(e: Exception) {
|
|
|
- Log.e(TAG_TOO_LARGE_TOOL, "logException", e)
|
|
|
- }
|
|
|
- })
|
|
|
}
|
|
|
|
|
|
override fun onTerminate() {
|