Merge branch 'fix/sentry-va' into 'dev'
fix: sentry 捕获的异常 https://sentry.shanqu.cc/organizations/lightgame/issues/398398/?project=22 See merge request halo/android/assistant-android!2005
This commit is contained in:
@ -263,8 +263,7 @@ public class Config {
|
||||
public void onSuccess(VSetting data) {
|
||||
mVSetting = data;
|
||||
SPUtils.setString(Constants.SP_V_SETTINGS, GsonUtils.toJson(data));
|
||||
|
||||
VHelper.init(HaloApp.getInstance());
|
||||
VHelper.checkVspaceUpdate(HaloApp.getInstance());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -37,6 +37,7 @@ object VArchiveHelper {
|
||||
|
||||
val vArchiveDao by lazy { VGameDatabase.instance.vArchiveDao() }
|
||||
|
||||
private var isInitialized = false
|
||||
private var mLatestArchiveFile: File? = null // 最近一个用于保存的存档文件
|
||||
private var mSaveArchiveListener: ((VArchiveEntity) -> Unit)? = null
|
||||
private var mApplyArchiveListener: ((String, Boolean) -> Unit)? = null
|
||||
@ -75,6 +76,8 @@ object VArchiveHelper {
|
||||
}
|
||||
|
||||
fun init() {
|
||||
if(isInitialized) return
|
||||
isInitialized = true
|
||||
DownloadMessageHandler.registerGlobalStatusChangedListener { simpleDownloadEntity, downloadStatus ->
|
||||
when (downloadStatus) {
|
||||
DownloadStatus.COMPLETED -> {
|
||||
|
||||
@ -10,13 +10,15 @@ import android.database.sqlite.SQLiteFullException
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.text.TextUtils
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import androidx.annotation.WorkerThread
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.lifecycle.*
|
||||
import androidx.lifecycle.DefaultLifecycleObserver
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ProcessLifecycleOwner
|
||||
import com.gh.ad.AdDelegateHelper
|
||||
import com.gh.common.constant.Config
|
||||
import com.gh.common.exposure.ExposureUtils
|
||||
@ -29,7 +31,6 @@ import com.gh.download.simple.DownloadListener
|
||||
import com.gh.download.simple.DownloadMessageHandler
|
||||
import com.gh.download.simple.SimpleDownloadManager
|
||||
import com.gh.gamecenter.*
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.category2.CategoryV2Activity
|
||||
import com.gh.gamecenter.common.base.GlobalActivityManager
|
||||
import com.gh.gamecenter.common.constant.Constants
|
||||
@ -95,6 +96,7 @@ import java.io.File
|
||||
import java.util.*
|
||||
import java.util.concurrent.CopyOnWriteArrayList
|
||||
import java.util.regex.Pattern
|
||||
import kotlin.collections.set
|
||||
|
||||
|
||||
object VHelper {
|
||||
@ -133,13 +135,14 @@ object VHelper {
|
||||
|
||||
val vGameDao by lazy { VGameDatabase.instance.vGameDao() }
|
||||
|
||||
@Volatile
|
||||
private var mVGameSnapshotList = arrayListOf<VGameEntity>()
|
||||
|
||||
private var m64UpdateEntity: AppEntity? = null
|
||||
private var m32UpdateEntity: AppEntity? = null
|
||||
|
||||
private var mIsInitialized = false // 是否已初始化
|
||||
private var mMustInitialized = false // 是否已必须初始化
|
||||
|
||||
private var mIsServiceConnected = false // AIDL 服务是否成功连接,不可作为 AIDL 仍然可用的依据
|
||||
private var mShouldLaunchGameAfterInstallation = true // 是否需要在安装完成后启动游戏的开关
|
||||
|
||||
@ -252,23 +255,16 @@ object VHelper {
|
||||
*/
|
||||
@SuppressLint("CheckResult")
|
||||
@JvmStatic
|
||||
fun init(context: Context) {
|
||||
Completable.fromAction {
|
||||
fun init() {
|
||||
VArchiveHelper.init()
|
||||
onInit()
|
||||
AppExecutor.ioExecutor.execute {
|
||||
refreshVGameSnapshot()
|
||||
updateInnerInstalledAppList()
|
||||
}.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe {
|
||||
onInit(context)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun onInit(context: Context) {
|
||||
if (!mMustInitialized) {
|
||||
mMustInitialized = true
|
||||
VArchiveHelper.init()
|
||||
}
|
||||
|
||||
private fun onInit() {
|
||||
if (isVGameOn()) {
|
||||
if (!mIsInitialized) {
|
||||
mIsInitialized = true
|
||||
@ -299,12 +295,14 @@ object VHelper {
|
||||
}
|
||||
})
|
||||
}
|
||||
checkVspaceUpdate(context)
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun checkVspaceUpdate(context: Context) {
|
||||
|
||||
if (!isVGameOn()) return
|
||||
|
||||
private fun checkVspaceUpdate(context: Context) {
|
||||
val config = Config.getVSettingEntity()?.va
|
||||
|
||||
if (config?.arch64 != null
|
||||
@ -508,7 +506,9 @@ object VHelper {
|
||||
gameVersion = it.downloadEntity.versionName
|
||||
packageName = it.packageName
|
||||
installTime = mInstalledInfoList.find { info ->
|
||||
info.packageName == it.packageName }?.firstInstallTime ?: 0L }
|
||||
info.packageName == it.packageName
|
||||
}?.firstInstallTime ?: 0L
|
||||
}
|
||||
}.toArrayList()
|
||||
|
||||
/**
|
||||
@ -1476,7 +1476,7 @@ object VHelper {
|
||||
// 最近在玩
|
||||
from = PAGE_SOURCE_RECENTLY_PLAYING
|
||||
launchLocation = null
|
||||
} else if(launchLocation == LAUNCH_LOCATION_INSTALLED_LAUNCH_DIALOG) {
|
||||
} else if (launchLocation == LAUNCH_LOCATION_INSTALLED_LAUNCH_DIALOG) {
|
||||
from = PAGE_SOURCE_INSTALLED_LAUNCH_DIALOG
|
||||
launchLocation = null
|
||||
} else {
|
||||
@ -2327,17 +2327,23 @@ object VHelper {
|
||||
LOG_TAG,
|
||||
"登录成功,插入用户信息:token=${token},userName=${userName}, uri=${va.getUriAuthorizationString()}"
|
||||
)
|
||||
HaloApp.getInstance().contentResolver.insert(
|
||||
Uri.parse(va.getUriAuthorizationString()),
|
||||
va.getAuthContentValue(token, userName, userAvatar)
|
||||
)
|
||||
try {
|
||||
HaloApp.getInstance().contentResolver.insert(
|
||||
Uri.parse(va.getUriAuthorizationString()),
|
||||
va.getAuthContentValue(token, userName, userAvatar)
|
||||
)
|
||||
} catch (_: Exception) {
|
||||
}
|
||||
} else {
|
||||
Utils.log(LOG_TAG, "登出,删除用户信息")
|
||||
HaloApp.getInstance().contentResolver.delete(
|
||||
Uri.parse(va.getUriAuthorizationString()),
|
||||
null,
|
||||
null
|
||||
)
|
||||
try {
|
||||
HaloApp.getInstance().contentResolver.delete(
|
||||
Uri.parse(va.getUriAuthorizationString()),
|
||||
null,
|
||||
null
|
||||
)
|
||||
} catch (_: Exception) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -409,7 +409,7 @@ public class HaloApp extends MultiDexApplication {
|
||||
ProcessLifecycleOwner.get().getLifecycle().addObserver(new ProcessorLifeCycleOwner());
|
||||
|
||||
// 初始化畅玩相关数据
|
||||
retrieveVGameInfoIfNeeded();
|
||||
VHelper.init();
|
||||
|
||||
// 开发环境不要强制捕获相关异常,这些异常通常是需要处理的
|
||||
if (!BuildConfig.DEBUG) {
|
||||
@ -598,10 +598,6 @@ public class HaloApp extends MultiDexApplication {
|
||||
}
|
||||
}
|
||||
|
||||
private void retrieveVGameInfoIfNeeded() {
|
||||
VHelper.init(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除已安装但还在本地数据库中的包
|
||||
*/
|
||||
|
||||
@ -35,6 +35,9 @@ import com.va.host.HostUtils
|
||||
import com.walkud.rom.checker.RomIdentifier
|
||||
import java.io.File
|
||||
|
||||
/**
|
||||
* 调用方负责异常
|
||||
*/
|
||||
@com.therouter.inject.ServiceProvider
|
||||
class Va : IVa {
|
||||
override fun isFakeVa(): Boolean = false
|
||||
@ -97,9 +100,17 @@ class Va : IVa {
|
||||
return fsAvailableSize
|
||||
}
|
||||
|
||||
override fun isAppInstalled(packageName: String): Boolean = VirtualCore.get().isAppInstalled(packageName)
|
||||
override fun isAppInstalled(packageName: String): Boolean = try {
|
||||
VirtualCore.get().isAppInstalled(packageName)
|
||||
} catch (_: Exception) {
|
||||
false
|
||||
}
|
||||
|
||||
override fun launchApp(packageName: String): Boolean = VActivityManager.get().launchApp(0, packageName)
|
||||
override fun launchApp(packageName: String): Boolean = try {
|
||||
VActivityManager.get().launchApp(0, packageName)
|
||||
} catch (_: Exception) {
|
||||
false
|
||||
}
|
||||
|
||||
|
||||
override fun cleanPackageData(packageName: String): Boolean = try {
|
||||
|
||||
2
vasdk
2
vasdk
Submodule vasdk updated: d17d591dbd...419448d845
Reference in New Issue
Block a user