Compare commits
5 Commits
v5.35.0-de
...
v5.35.0-de
| Author | SHA1 | Date | |
|---|---|---|---|
| 8dc9921be8 | |||
| c3b32bae03 | |||
| 48f945f192 | |||
| 615bb834e0 | |||
| df5480e0a3 |
@ -39,7 +39,8 @@ class ExternalGameUsage : ITestCase {
|
||||
it.root.setOnClickListener {
|
||||
VHelper.connectService {
|
||||
context.startActivity(
|
||||
InstallExternalGameActivity.getIntent(context).apply { flags = flags or Intent.FLAG_ACTIVITY_NEW_TASK })
|
||||
InstallExternalGameActivity.getIntent(context)
|
||||
.apply { flags = flags or Intent.FLAG_ACTIVITY_NEW_TASK })
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -52,7 +53,8 @@ class ExternalGameUsage : ITestCase {
|
||||
val file = File("/data/local/tmp/gh-plugins/artifacts.zip")
|
||||
if (file.exists()) {
|
||||
Utils.log(VHelper.LOG_TAG, "有本地更新文件: 64位插件")
|
||||
PluginHelper.getInstance().updatePlugin(file, VHelper.getCwBaseLogParams())
|
||||
// TODO: 补充debug插件更新
|
||||
ToastUtils.showToast("暂未实现debug功能")
|
||||
} else {
|
||||
ToastUtils.showToast("data/local/tmp没有push文件")
|
||||
}
|
||||
@ -66,16 +68,8 @@ class ExternalGameUsage : ITestCase {
|
||||
it.root.setOnClickListener {
|
||||
val file = File("/data/local/tmp/gh-plugins/artifacts32.zip")
|
||||
if (file.exists()) {
|
||||
Utils.log(VHelper.LOG_TAG, "有本地更新文件: 32位插件")
|
||||
VirtualCore.get().updatePlugin(file.absolutePath, "artifacts32.zip",
|
||||
VHelper.getCwBaseLogParams().let {
|
||||
val bundle = Bundle()
|
||||
for ((key, value) in it) {
|
||||
bundle.putString(key, value)
|
||||
}
|
||||
bundle
|
||||
})
|
||||
|
||||
// TODO: 补充debug插件更新
|
||||
ToastUtils.showToast("暂未实现debug功能")
|
||||
} else {
|
||||
ToastUtils.showToast("data/local/tmp没有push文件")
|
||||
}
|
||||
|
||||
@ -10,13 +10,11 @@ import android.database.sqlite.SQLiteDiskIOException
|
||||
import android.database.sqlite.SQLiteFullException
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.view.View
|
||||
import androidx.annotation.WorkerThread
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.lifecycle.*
|
||||
import com.g00fy2.versioncompare.Version
|
||||
import com.gh.ad.AdDelegateHelper
|
||||
import com.gh.common.constant.Config
|
||||
import com.gh.common.exposure.ExposureUtils
|
||||
@ -48,8 +46,8 @@ import com.gh.gamecenter.eventbus.EBPackage
|
||||
import com.gh.gamecenter.feature.entity.ApkEntity
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.entity.InstallGameEntity
|
||||
import com.gh.gamecenter.login.user.UserManager
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.login.user.UserManager
|
||||
import com.gh.gamecenter.manager.PackagesManager
|
||||
import com.gh.gamecenter.packagehelper.PackageRepository
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager
|
||||
@ -73,6 +71,7 @@ import com.lg.vspace.remote.listener.RemoteConnectListener
|
||||
import com.lg.vspace.remote.model.AppInstallerInfo
|
||||
import com.lg.vspace.remote.model.VGameInstallerParams
|
||||
import com.lg.vspace.remote.model.VGameInstallerResult
|
||||
import com.lg.vspace.remote.model.VGameInstallerResult.STATUS_SUCCESS
|
||||
import com.lightgame.download.DownloadEntity
|
||||
import com.lightgame.utils.AppManager
|
||||
import com.lightgame.utils.Utils
|
||||
@ -88,8 +87,10 @@ import java.io.File
|
||||
import java.util.*
|
||||
import java.util.concurrent.CopyOnWriteArrayList
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
import com.lg.vspace.log.NewFlatLogUtils as CwLogUtils
|
||||
|
||||
|
||||
object VHelper {
|
||||
|
||||
// 畅玩游戏是否已被使用过
|
||||
@ -99,6 +100,9 @@ object VHelper {
|
||||
private const val KEY_LAST_ALERT_32_UPDATE_URL = "last_alert_32_update_url"
|
||||
private const val KEY_TOTAL_PLAYED_TIME = "total_played_time"
|
||||
|
||||
// 新增畅玩启动次数
|
||||
private const val KEY_LAUNCH_COUNT = "launch_count"
|
||||
|
||||
private const val G_GMS_PACKAGE_NAME = "com.google.android.gms"
|
||||
private const val G_VENDING_PACKAGE_NAME = "com.android.vending"
|
||||
private const val G_GSF_PACKAGE_NAME = "com.google.android.gsf"
|
||||
@ -913,12 +917,47 @@ object VHelper {
|
||||
}
|
||||
} else {
|
||||
runOnIoThread {
|
||||
val cwBaseLogParams = getCwBaseLogParams()
|
||||
val start = System.currentTimeMillis()
|
||||
// 开始安装游戏
|
||||
CwLogUtils.logBeforeGameLaunch(mutableMapOf<String, String>().apply {
|
||||
put(CwLogUtils.KEY_EVENT, "game_install_began")
|
||||
put(CwLogUtils.KEY_GAME_ID, downloadEntity.gameId)
|
||||
put(CwLogUtils.KEY_PACKAGE_NAME, downloadEntity.packageName)
|
||||
putAll(cwBaseLogParams)
|
||||
})
|
||||
val installResult = VaApp.get().appManager.installGame(
|
||||
path,
|
||||
VGameInstallerParams(VGameInstallerParams.FLAG_INSTALL_OVERRIDE_NO_CHECK)
|
||||
)
|
||||
val timeCost = (System.currentTimeMillis() - start) / 1000L
|
||||
if (installResult.status == STATUS_SUCCESS) {
|
||||
// 安装游戏完成
|
||||
CwLogUtils.logBeforeGameLaunch(mutableMapOf<String, String>().apply {
|
||||
put(CwLogUtils.KEY_EVENT, "game_install_complete")
|
||||
put(CwLogUtils.KEY_GAME_ID, downloadEntity.gameId)
|
||||
put(CwLogUtils.KEY_PACKAGE_NAME, downloadEntity.packageName)
|
||||
put("install_time", "$timeCost")
|
||||
putAll(cwBaseLogParams)
|
||||
})
|
||||
} else {
|
||||
// 安装游戏失败
|
||||
CwLogUtils.logBeforeGameLaunch(mutableMapOf<String, String>().apply {
|
||||
put(CwLogUtils.KEY_EVENT, "game_install_fail")
|
||||
put(CwLogUtils.KEY_GAME_ID, downloadEntity.gameId)
|
||||
put(CwLogUtils.KEY_PACKAGE_NAME, downloadEntity.packageName)
|
||||
put(
|
||||
"crash_message", when (installResult.status) {
|
||||
VGameInstallerResult.STATUS_RETURN_NULL_OBJECT -> "server进程远程调用崩溃"
|
||||
else -> "错误码:${installResult.status}"
|
||||
}
|
||||
)
|
||||
putAll(cwBaseLogParams)
|
||||
})
|
||||
}
|
||||
onInstallFinished(
|
||||
downloadEntity.packageName,
|
||||
VaApp.get().appManager.installGame(
|
||||
path,
|
||||
VGameInstallerParams(VGameInstallerParams.FLAG_INSTALL_OVERRIDE_NO_CHECK)
|
||||
)
|
||||
installResult
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -1039,6 +1078,7 @@ object VHelper {
|
||||
mInstallingVaPathSet.remove(downloadEntity.path)
|
||||
|
||||
try {
|
||||
downloadEntity.addMetaExtra(KEY_LAUNCH_COUNT, "0")
|
||||
vGameDao.insert(VGameEntity.from(downloadEntity))
|
||||
refreshVGameSnapshot()
|
||||
} catch (e: SQLiteFullException) {
|
||||
@ -1300,6 +1340,14 @@ object VHelper {
|
||||
VirtualAppManager.AIDL_SERVER_REMOTE_GUIDE_ACTIVITY
|
||||
)
|
||||
)
|
||||
Config.getVNewSettingEntity()?.vaPlugin?.let {
|
||||
intent.putExtra("pluginId", it.id)
|
||||
intent.putExtra("pluginVersionName", it.versionName)
|
||||
}
|
||||
|
||||
downloadEntity?.getMetaExtra(KEY_LAUNCH_COUNT)?.toIntOrNull()?.let { count ->
|
||||
intent.putExtra(KEY_LAUNCH_COUNT, count)
|
||||
}
|
||||
}
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
context.startActivity(intent)
|
||||
@ -1527,6 +1575,9 @@ object VHelper {
|
||||
getVGameSnapshot(null, packageName)?.let {
|
||||
it.downloadEntity.addMetaExtra(KEY_LAST_PLAYED_TIME, lastPlayedTime.toString())
|
||||
it.downloadEntity.addMetaExtra(KEY_TOTAL_PLAYED_TIME, totalPlayedTime.toString())
|
||||
it.downloadEntity.getMetaExtra(KEY_LAUNCH_COUNT)?.toIntOrNull()?.let { count ->
|
||||
it.downloadEntity.addMetaExtra(KEY_LAUNCH_COUNT, "${count + 1}")
|
||||
}
|
||||
try {
|
||||
vGameDao.insert(it)
|
||||
refreshVGameSnapshot()
|
||||
@ -2006,54 +2057,25 @@ object VHelper {
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
fun preparePluginUpdate() {
|
||||
if (com.gh.gamecenter.BuildConfig.DEBUG) {
|
||||
Utils.log(LOG_TAG, "开发者需要插件更新功能,请push文件到手机,或者【修改插件打包的配置为debug版本,然后上传,推送】")
|
||||
return
|
||||
}
|
||||
Config.vNewSettingSubject.debounce(2, TimeUnit.SECONDS).doOnNext {
|
||||
it?.vaPlugin?.let { vaPlugin ->
|
||||
if (!vaPlugin.id.isNullOrEmpty()) {
|
||||
if (!vaPlugin.url64.isNullOrEmpty()) {
|
||||
val installedPluginVersion = HostUtils.getPluginVersion()
|
||||
if (installedPluginVersion?.isNotEmpty() == true
|
||||
&& !Version(vaPlugin.versionName).isEqual(installedPluginVersion)
|
||||
) {
|
||||
downloadPlugin(id = "${vaPlugin.id}64", url = vaPlugin.url64) {
|
||||
PluginHelper.getInstance().updatePlugin(it, getCwBaseLogParams())
|
||||
}
|
||||
}
|
||||
downloadPlugin(id = "${vaPlugin.id}64", url = vaPlugin.url64)
|
||||
}
|
||||
|
||||
if (!vaPlugin.url32.isNullOrEmpty()) {
|
||||
val installedPluginVersion = VaApp.get().appManager.extPluginVersion
|
||||
if (installedPluginVersion?.isNotEmpty() == true
|
||||
&& !Version(vaPlugin.versionName).isEqual(installedPluginVersion)
|
||||
) {
|
||||
downloadPlugin(id = "${vaPlugin.id}32", url = vaPlugin.url32) {
|
||||
|
||||
VirtualCore.get().updatePlugin(it.absolutePath, "${vaPlugin.id}32.zip",
|
||||
getCwBaseLogParams().let {
|
||||
val bundle = Bundle()
|
||||
for ((key, value) in it) {
|
||||
bundle.putString(key, value)
|
||||
}
|
||||
bundle
|
||||
})
|
||||
}
|
||||
}
|
||||
downloadPlugin(id = "${vaPlugin.id}32", url = vaPlugin.url32)
|
||||
}
|
||||
}
|
||||
}
|
||||
}.subscribeOn(Schedulers.io()).subscribe({}, {})
|
||||
}
|
||||
|
||||
private fun downloadPlugin(id: String, url: String, fn: (File) -> Unit) {
|
||||
val pluginFileName = "${id}.zip"
|
||||
private fun downloadPlugin(id: String, url: String) {
|
||||
val pluginFileName = PluginHelper.getInstance().getPluginUpdateFileName(id)
|
||||
val currentPluginFile = File(HaloApp.getInstance().cacheDir, pluginFileName)
|
||||
if (currentPluginFile.exists() && PluginFileUtils.isZipFile(currentPluginFile)) {
|
||||
// 已经下载好了
|
||||
Utils.log(LOG_TAG, "id:${id} file exists.")
|
||||
fn(currentPluginFile)
|
||||
return
|
||||
} else {
|
||||
val currentDownloadEntity = DownloadMessageHandler.findEntity(id)
|
||||
if (currentDownloadEntity != null) {
|
||||
@ -2083,8 +2105,6 @@ object VHelper {
|
||||
|
||||
override fun onStatusChanged(status: DownloadStatus) {
|
||||
if (status == DownloadStatus.COMPLETED) {
|
||||
Utils.log(LOG_TAG, "id:${id} file download complete.")
|
||||
fn(currentPluginFile)
|
||||
DownloadMessageHandler.unregisterListener(id, this)
|
||||
}
|
||||
}
|
||||
@ -2125,6 +2145,7 @@ object VHelper {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun getCwBaseLogParams() = mapOf(
|
||||
CwLogUtils.KEY_ANDROID_VERSION to Build.VERSION.RELEASE,
|
||||
CwLogUtils.KEY_APP_64_VERSION to com.lg.core.BuildConfig.VERSION_NAME,
|
||||
|
||||
Submodule ndownload updated: 66413fae1f...b61908863c
@ -4,24 +4,24 @@ include "va-lib"
|
||||
project(":va-lib").projectDir = file("vasdk/lib")
|
||||
include "va-lib-res"
|
||||
project(":va-lib-res").projectDir = file("vasdk/lib-res")
|
||||
//include "va-ext"
|
||||
//project(":va-ext").projectDir = file("vasdk/app-ext")
|
||||
//include "va-ext-lib"
|
||||
//project(":va-ext-lib").projectDir = file("vasdk/lib-ext")
|
||||
include "va-ext"
|
||||
project(":va-ext").projectDir = file("vasdk/app-ext")
|
||||
include "va-ext-lib"
|
||||
project(":va-ext-lib").projectDir = file("vasdk/lib-ext")
|
||||
|
||||
include "va-sandhook"
|
||||
project(":va-sandhook").projectDir = file("vasdk/sandhook")
|
||||
include "va-library-commons"
|
||||
project(":va-library-commons").projectDir = file("vasdk/commons")
|
||||
//include "va-feature-realname"
|
||||
//project(":va-feature-realname").projectDir = file("vasdk/feature/realname-window")
|
||||
include "va-feature-realname"
|
||||
project(":va-feature-realname").projectDir = file("vasdk/feature/realname-window")
|
||||
include ":ndownload"
|
||||
//include "va-feature-cloud"
|
||||
//project(":va-feature-cloud").projectDir = file("vasdk/feature/cloud")
|
||||
//include "va-feature-ads"
|
||||
//project(":va-feature-ads").projectDir = file("vasdk/feature/ads")
|
||||
//include "va-feature-floatingwindow"
|
||||
//project(":va-feature-floatingwindow").projectDir = file("vasdk/feature/floating-window")
|
||||
include "va-feature-cloud"
|
||||
project(":va-feature-cloud").projectDir = file("vasdk/feature/cloud")
|
||||
include "va-feature-ads"
|
||||
project(":va-feature-ads").projectDir = file("vasdk/feature/ads")
|
||||
include "va-feature-floatingwindow"
|
||||
project(":va-feature-floatingwindow").projectDir = file("vasdk/feature/floating-window")
|
||||
include "va-core"
|
||||
project(":va-core").projectDir = file("vasdk/core")
|
||||
include "va-common"
|
||||
@ -33,25 +33,25 @@ include "va-archive"
|
||||
project(":va-archive").projectDir = file("vasdk/archive")
|
||||
include "va-library-network"
|
||||
project(":va-library-network").projectDir = file("vasdk/library/network")
|
||||
//include "aar-beizi_ad_sdk"
|
||||
//project(":aar-beizi_ad_sdk").projectDir = file("vasdk/aar/beizi_ad_sdk")
|
||||
//include "aar-beizi_fusion_sdk"
|
||||
//project(":aar-beizi_fusion_sdk").projectDir = file("vasdk/aar/beizi_fusion_sdk")
|
||||
include "aar-beizi_ad_sdk"
|
||||
project(":aar-beizi_ad_sdk").projectDir = file("vasdk/aar/beizi_ad_sdk")
|
||||
include "aar-beizi_fusion_sdk"
|
||||
project(":aar-beizi_fusion_sdk").projectDir = file("vasdk/aar/beizi_fusion_sdk")
|
||||
include "va-plugin-host-lib"
|
||||
project(":va-plugin-host-lib").projectDir = file("vasdk/plugin/host-lib")
|
||||
//include "va-plugin-floating"
|
||||
//project(":va-plugin-floating").projectDir = file("vasdk/plugin/floating")
|
||||
//include "va-plugin-manager"
|
||||
//project(":va-plugin-manager").projectDir = file("vasdk/plugin/manager")
|
||||
include "va-plugin-floating"
|
||||
project(":va-plugin-floating").projectDir = file("vasdk/plugin/floating")
|
||||
include "va-plugin-manager"
|
||||
project(":va-plugin-manager").projectDir = file("vasdk/plugin/manager")
|
||||
include "va-plugin-constant"
|
||||
project(":va-plugin-constant").projectDir = file("vasdk/plugin/constant")
|
||||
//include "va-plugin-runtime"
|
||||
//project(":va-plugin-runtime").projectDir = file("vasdk/plugin/runtime")
|
||||
//include "va-plugin-loader"
|
||||
//project(":va-plugin-loader").projectDir = file("vasdk/plugin/loader")
|
||||
include "va-plugin-runtime"
|
||||
project(":va-plugin-runtime").projectDir = file("vasdk/plugin/runtime")
|
||||
include "va-plugin-loader"
|
||||
project(":va-plugin-loader").projectDir = file("vasdk/plugin/loader")
|
||||
include "va-plugin-host"
|
||||
project(":va-plugin-host").projectDir = file("vasdk/host")
|
||||
//include "va-plugin-base"
|
||||
//project(":va-plugin-base").projectDir = file("vasdk/plugin/base")
|
||||
//include "va-plugin-library-easyfloat"
|
||||
//project(":va-plugin-library-easyfloat").projectDir = file("vasdk/plugin/library/easyfloat")
|
||||
include "va-plugin-base"
|
||||
project(":va-plugin-base").projectDir = file("vasdk/plugin/base")
|
||||
include "va-plugin-library-easyfloat"
|
||||
project(":va-plugin-library-easyfloat").projectDir = file("vasdk/plugin/library/easyfloat")
|
||||
2
vasdk
2
vasdk
Submodule vasdk updated: e65e18a99d...9f1f97e9c4
Submodule vspace-bridge updated: d7502f8023...398a6c0872
Reference in New Issue
Block a user