Merge branch 'fix/sqlite_full_crash' into 'dev'

fix: 处理存储空间满了后的闪退问题 https://sentry.shanqu.cc/organizations/lightgame/issues/197777/?project=22&query=assigned%3Ame+status%3Aunresolved&sort=user&statsPeriod=14d

See merge request halo/android/assistant-android!1147
This commit is contained in:
陈君陶
2023-06-20 17:16:25 +08:00
2 changed files with 11 additions and 4 deletions

View File

@ -815,10 +815,19 @@ object VHelper {
val downloadEntity = getVDownloadEntity(gameId = gameId, packageName = packageName)
if (downloadEntity != null) {
// 去掉更新标记
downloadEntity.isUpdate = false
mVGameDao.insert(VGameEntity.from(downloadEntity))
mInstallingVaPathSet.remove(downloadEntity.path)
try {
mVGameDao.insert(VGameEntity.from(downloadEntity))
} catch (e: SQLiteFullException) {
ToastUtils.toast("存储空间不足,安装失败")
return@runOnIoThread
}
if (result.status == 0) {
updateInstalledList()
@ -836,8 +845,6 @@ object VHelper {
ToastUtils.toast("安装出现异常, ${result.status}")
}
mInstallingVaPathSet.remove(downloadEntity.path)
mPackageInstalledLiveData.postValue(result.packageName)
VBackupHelper.backupDBToExternalStorage(HaloApp.getInstance())