feat: 32位云存档兼容
This commit is contained in:
@ -21,6 +21,7 @@ import static com.gh.gamecenter.common.constant.EntranceConsts.HOST_QQ_GAME;
|
||||
import static com.gh.gamecenter.common.constant.EntranceConsts.HOST_QQ_GROUP;
|
||||
import static com.gh.gamecenter.common.constant.EntranceConsts.HOST_QQ_QUN;
|
||||
import static com.gh.gamecenter.common.constant.EntranceConsts.HOST_QUESTION;
|
||||
import static com.gh.gamecenter.common.constant.EntranceConsts.HOST_RESTART_GAME;
|
||||
import static com.gh.gamecenter.common.constant.EntranceConsts.HOST_SUGGESTION;
|
||||
import static com.gh.gamecenter.common.constant.EntranceConsts.HOST_TOOLBOX;
|
||||
import static com.gh.gamecenter.common.constant.EntranceConsts.HOST_UPLOAD_VIDEO;
|
||||
@ -441,6 +442,10 @@ public class SkipActivity extends BaseActivity {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case HOST_RESTART_GAME:
|
||||
String restartGamePkg = uri.getQueryParameter(EntranceConsts.KEY_GAME_PKG);
|
||||
VHelper.launch(this, restartGamePkg, false, true);
|
||||
break;
|
||||
default:
|
||||
EntranceUtils.jumpActivity(this, new Bundle()); // 跳转至首页
|
||||
return;
|
||||
|
||||
@ -3,6 +3,7 @@ package com.gh.vspace
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.database.sqlite.SQLiteDiskIOException
|
||||
import android.os.*
|
||||
import androidx.annotation.WorkerThread
|
||||
import com.blankj.utilcode.util.LogUtils
|
||||
import com.gh.download.simple.DownloadMessageHandler
|
||||
@ -23,6 +24,7 @@ import com.lg.download.DownloadStatus
|
||||
import com.lg.download.httpclient.DefaultHttpClient
|
||||
import com.lg.ndownload.DownloadConfigBuilder
|
||||
import com.lg.vspace.VirtualAppManager
|
||||
import com.lg.vspace.archive.data.Const
|
||||
import com.lg.vspace.archive.ui.ArchiveManager
|
||||
import com.lg.vspace.archive.ui.interfaces.ArchiveProgressPageListener
|
||||
import com.lightgame.utils.Utils
|
||||
@ -46,6 +48,23 @@ object VArchiveHelper {
|
||||
// 本地存档存放的位置
|
||||
val archivePath by lazy { HaloApp.getInstance().filesDir.absolutePath + File.separator }
|
||||
|
||||
private var messenger: Messenger? = null
|
||||
private val handler = object : Handler(Looper.getMainLooper()) {
|
||||
override fun handleMessage(msg: Message) {
|
||||
when (msg.what) {
|
||||
Const.MSG_USE_ARCHIVE -> {
|
||||
msg.data?.let {
|
||||
onApplyGameArchiveFinished(
|
||||
packageName = it.getString(Const.EXTRA_PACKAGE_NAME, ""),
|
||||
isSuccess = it.getBoolean(Const.EXTRA_IS_SUCCESS, false)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
messenger = null
|
||||
}
|
||||
}
|
||||
|
||||
fun init() {
|
||||
DownloadMessageHandler.registerGlobalStatusChangedListener { simpleDownloadEntity, downloadStatus ->
|
||||
when (downloadStatus) {
|
||||
@ -198,19 +217,35 @@ object VArchiveHelper {
|
||||
val intent = VirtualAppManager.getUseArchiveIntent(context, packageName, config, archiveFile)
|
||||
context.startActivity(intent)
|
||||
} else {
|
||||
ArchiveManager.useArchive(context, packageName, config, archiveFile,
|
||||
object : ArchiveProgressPageListener {
|
||||
override fun onCancel() {
|
||||
}
|
||||
TODO()
|
||||
mApplyArchiveListener = applyArchiveListener
|
||||
val intent = VirtualAppManager.getUseArchiveIntent(context, packageName, config, archiveFile)
|
||||
intent.setClassName(
|
||||
com.lg.vspace.BuildConfig.EXT_PACKAGE_NAME,
|
||||
"com.lg.vspace.addon.launcher.RemoteGuideActivity"
|
||||
)
|
||||
intent.putExtra("callback", Bundle().also {
|
||||
messenger = Messenger(handler)
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
|
||||
it.putBinder("messenger", messenger!!.binder)
|
||||
}
|
||||
})
|
||||
context.startActivity(intent)
|
||||
|
||||
override fun completed(isSuccess: Boolean) {
|
||||
LogUtils.d("存档使用 completed : $isSuccess")
|
||||
if (applyArchiveListener != null) {
|
||||
applyArchiveListener(packageName, isSuccess)
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
// ArchiveManager.useArchive(context, packageName,archiveFile, config,
|
||||
// object : ArchiveProgressPageListener {
|
||||
// override fun onCancel() {
|
||||
// }
|
||||
//
|
||||
// override fun completed(isSuccess: Boolean) {
|
||||
// LogUtils.d("存档使用 completed : $isSuccess")
|
||||
// if (applyArchiveListener != null) {
|
||||
// applyArchiveListener(packageName, isSuccess)
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// })
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1476,26 +1476,36 @@ object VHelper {
|
||||
fun cleanGameData(packageName: String?) {
|
||||
Utils.log(LOG_TAG, "清除游戏数据 $packageName")
|
||||
if (packageName.isNullOrBlank()) return
|
||||
val cleanGameDataClosure: () -> Unit = {
|
||||
try {
|
||||
val result = VirtualAppManager.get().cleanGameData(packageName)
|
||||
if (result) {
|
||||
updateInstalledList()
|
||||
if(isLegacyInstalled(packageName)) {
|
||||
val cleanGameDataClosure: () -> Unit = {
|
||||
try {
|
||||
val result = VirtualAppManager.get().cleanGameData(packageName)
|
||||
if (result) {
|
||||
updateInstalledList()
|
||||
}
|
||||
Utils.log(LOG_TAG, "清除游戏数据结果 -> $result")
|
||||
} catch (e: Exception) {
|
||||
ToastUtils.toast(e.localizedMessage ?: "")
|
||||
}
|
||||
}
|
||||
if (mDelegateManager.isConnectAidlInterface) {
|
||||
cleanGameDataClosure.invoke()
|
||||
} else {
|
||||
connectService(
|
||||
shouldCheckUpdate = false,
|
||||
shouldConnectSilently = false,
|
||||
callbackClosure = cleanGameDataClosure
|
||||
)
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
val result = VaApp.get().appManager.cleanGameData(packageName)
|
||||
Utils.log(LOG_TAG, "清除游戏数据结果 -> $result")
|
||||
} catch (e: Exception) {
|
||||
ToastUtils.toast(e.localizedMessage ?: "")
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
if (mDelegateManager.isConnectAidlInterface) {
|
||||
cleanGameDataClosure.invoke()
|
||||
} else {
|
||||
connectService(
|
||||
shouldCheckUpdate = false,
|
||||
shouldConnectSilently = false,
|
||||
callbackClosure = cleanGameDataClosure
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user