diff --git a/app/build.gradle b/app/build.gradle index 320c98b588..849a75b92f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -160,6 +160,9 @@ android { flavorDimensions("env") sourceSets { + main { + assets.srcDirs = ["${rootProject.buildDir}/plugin"] + } publish { java.srcDirs = ['src/main/java', "src/default/java"] } @@ -327,7 +330,7 @@ dependencies { implementation project(':ndownload') implementation project(':vspace-bridge') - implementation (project(':module_common')) { + implementation(project(':module_common')) { exclude group: 'androidx.swiperefreshlayout' } implementation(project(':module_login')) { @@ -368,6 +371,8 @@ dependencies { implementation(project(':va-main')) { exclude group: 'androidx.swiperefreshlayout' } + debugImplementation "com.bytedance.tools.codelocator:codelocator-core:2.0.3" + compileOnly project(":va-core") } File propFile = file('sign.properties') @@ -609,4 +614,14 @@ project.afterEvaluate { } } } +} +def copyArtifacts = tasks.create("copyArtifacts", Copy) { + from new File(rootProject.buildDir, "artifacts.zip") + into new File(rootProject.buildDir, "plugin") +}.dependsOn(":va-plugin-floating:generateDebugArtifacts") + +tasks.whenTaskAdded { Task task -> + if (task.name == "preInternalDebugBuild" || task.name == "prePublishDebugBuild") { + task.dependsOn(copyArtifacts) + } } \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 288570ece6..e3a99a8786 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -105,6 +105,8 @@ com.va.host, com.lg.vspace.plugin.host, com.lg.plugin.constant, + com.bytedance.tools.codelocator, + org.chickenhook.restrictionbypass, com.lody.virtual.sandhook" /> diff --git a/app/src/main/java/com/gh/base/GlobalActivityLifecycleObserver.kt b/app/src/main/java/com/gh/base/GlobalActivityLifecycleObserver.kt index 5d3d2e0752..58d036aeb7 100644 --- a/app/src/main/java/com/gh/base/GlobalActivityLifecycleObserver.kt +++ b/app/src/main/java/com/gh/base/GlobalActivityLifecycleObserver.kt @@ -13,8 +13,10 @@ import com.gh.gamecenter.SplashScreenActivity import com.gh.gamecenter.authorization.AuthorizationActivity import com.gh.gamecenter.common.base.GlobalActivityManager import com.gh.gamecenter.common.utils.PackageFlavorHelper +import com.gh.gamecenter.login.view.LoginActivity import com.gh.vspace.VHelper import com.halo.assistant.HaloApp +import com.lg.vspace.ui.launcher.LaunchActivity // TODO:移动到对应的模块 class GlobalActivityLifecycleObserver : Application.ActivityLifecycleCallbacks { @@ -56,6 +58,8 @@ class GlobalActivityLifecycleObserver : Application.ActivityLifecycleCallbacks { } if (activity is AppCompatActivity + && activity !is LaunchActivity + && activity !is LoginActivity && activity !is SplashScreenActivity && activity !is SkipActivity && activity !is AuthorizationActivity diff --git a/app/src/main/java/com/gh/gamecenter/MainActivity.java b/app/src/main/java/com/gh/gamecenter/MainActivity.java index 14c775190d..c23904864c 100644 --- a/app/src/main/java/com/gh/gamecenter/MainActivity.java +++ b/app/src/main/java/com/gh/gamecenter/MainActivity.java @@ -142,6 +142,8 @@ import io.reactivex.SingleSource; import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.functions.Function; import io.reactivex.schedulers.Schedulers; +import kotlin.Unit; +import kotlin.jvm.functions.Function0; import kotlin.jvm.functions.Function1; import okhttp3.RequestBody; import okhttp3.ResponseBody; @@ -730,14 +732,11 @@ public class MainActivity extends BaseActivity { ToastUtils.showToast("游戏启动中,请稍后~"); handler.postDelayed(() -> { - VHelper.postOnInitialized(() -> { - if (VHelper.isInstalled(gamePackageName)) { - VHelper.launch(this, gamePackageName, false, true); - } else { - ToastUtils.showToast("应用已被卸载!"); - } - return null; - }); + if (VHelper.isLegacyGame(gamePackageName)) { + VHelper.postOnInitialized(launchGame(gamePackageName)); + } else { + launchGame(gamePackageName).invoke(); + } }, 500); break; case KEY_MARKET_DETAILS: @@ -755,6 +754,18 @@ public class MainActivity extends BaseActivity { }, 500); } + @NonNull + private Function0 launchGame(String gamePackageName) { + return () -> { + if (!VHelper.isInnerInstalled(gamePackageName) && !VHelper.isInstalled(gamePackageName)) { + ToastUtils.showToast("应用已被卸载!"); + } else { + VHelper.launch(this, gamePackageName, false, true); + } + return null; + }; + } + /** * 应用跳转 */ diff --git a/app/src/main/java/com/gh/gamecenter/authorization/AuthorizationActivity.kt b/app/src/main/java/com/gh/gamecenter/authorization/AuthorizationActivity.kt index a77c8f524e..65bb9abaaf 100644 --- a/app/src/main/java/com/gh/gamecenter/authorization/AuthorizationActivity.kt +++ b/app/src/main/java/com/gh/gamecenter/authorization/AuthorizationActivity.kt @@ -193,7 +193,7 @@ class AuthorizationActivity : ToolBarActivity() { val userAvatar = UserManager.getInstance().userInfoEntity?.icon //授权成功,发送广播, 返回token val intent = Intent() - intent.setClassName(remotePkgName, "$remotePkgName.AuthorizationReceiver") + intent.setClassName(remotePkgName, "com.va.host.receiver.AuthorizationReceiver") intent.setPackage(remotePkgName) intent.putExtra(EntranceConsts.KEY_TOKEN, token) intent.putExtra(EntranceConsts.KEY_USER_ID, userId) diff --git a/app/src/main/java/com/gh/vspace/VHelper.kt b/app/src/main/java/com/gh/vspace/VHelper.kt index 26274e9bc3..78ef66b741 100644 --- a/app/src/main/java/com/gh/vspace/VHelper.kt +++ b/app/src/main/java/com/gh/vspace/VHelper.kt @@ -1,6 +1,7 @@ package com.gh.vspace import android.annotation.SuppressLint +import android.content.ComponentName import android.content.ContentValues import android.content.Context import android.content.Intent @@ -44,10 +45,13 @@ import com.gh.vspace.db.VGameDatabase import com.gh.vspace.db.VGameEntity import com.gh.vspace.gapps.GAppsDownloadDialogFragment import com.halo.assistant.HaloApp +import com.lg.vspace.VaApp import com.lg.vspace.VirtualAppManager +import com.lg.vspace.bridge.BuildConfig import com.lg.vspace.remote.BinderPool 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.lightgame.download.DownloadEntity import com.lightgame.utils.AppManager @@ -58,6 +62,7 @@ import org.greenrobot.eventbus.EventBus import java.io.File import java.util.* import java.util.concurrent.CopyOnWriteArrayList +import kotlin.collections.ArrayList object VHelper { @@ -286,7 +291,14 @@ object VHelper { callbackClosure: (() -> Unit)? = null ) { Utils.log(LOG_TAG, "尝试连接 V 服务") - + val isOldCwInstalled = PackageUtils.isInstalledFromAllPackage( + HaloApp.getInstance().applicationContext, + BuildConfig.AIDL_SERVER_PACKAGE_NAME + ) + if (!isOldCwInstalled) { + Utils.log(LOG_TAG, "包名[${BuildConfig.AIDL_SERVER_PACKAGE_NAME}]应用没有安装") + return + } if (!shouldConnectSilently) { toastIfServiceConnectTimeout() } @@ -442,7 +454,7 @@ object VHelper { } /** - * 是否已安装此包名的畅玩游戏 + * 旧版畅玩组件是否已安装此包名的畅玩游戏 */ @JvmStatic fun isInstalled(packageName: String?): Boolean { @@ -466,6 +478,10 @@ object VHelper { return isInstalled } + @JvmStatic + fun isInnerInstalled(packageName: String?) = + VaApp.get().appManager.installedGamesInfo.any { it.packageName == packageName } + /** * 启动成功,五秒内退出才显示反馈弹框 */ @@ -491,11 +507,15 @@ object VHelper { * 获取游戏占用的空间 */ fun getAppOccupiedSpace(packageName: String): Long { - return try { - mDelegateManager.getAppOccupiedSpace(packageName) - } catch (e: Exception) { - e.printStackTrace() - 0 + return if (isLegacyGame(packageName)) { + try { + mDelegateManager.getAppOccupiedSpace(packageName) + } catch (e: Exception) { + e.printStackTrace() + 0 + } + } else { + VaApp.get().appManager.getAppOccupiedSpace(packageName) } } @@ -503,6 +523,16 @@ object VHelper { * 在执行 callback 前先检查组件是否已安装,是否可下载 */ fun validateVSpaceBeforeAction(context: Context, gameEntity: GameEntity?, callback: () -> Unit) { + if (isInstalled(gameEntity?.getUniquePackageName())) { + oldCwValidateVSpaceBeforeAction(context, gameEntity, callback) + } else { + //TODO: check new cw 32 va component + + callback.invoke() + } + } + + private fun oldCwValidateVSpaceBeforeAction(context: Context, gameEntity: GameEntity?, callback: () -> Unit) { if (showDialogIfVSpaceIsNeeded( context, gameEntity?.id ?: "", @@ -654,6 +684,26 @@ object VHelper { return ArrayList(list) } + @JvmStatic + fun isLegacyGame(packageName: String) = isInstalled(packageName) + + private fun gotoVspaceLoading( + context: Context, + downloadEntity: DownloadEntity, + shouldLaunchGameAfterInstallation: Boolean + ) { + if (shouldLaunchGameAfterInstallation) { + runOnUiThread { + val gameEntity = toGameEntity(downloadEntity) + try { + context.startActivity(VSpaceLoadingActivity.getIntent(context, gameEntity, true)) + } catch (e: Exception) { + ToastUtils.toast(e.localizedMessage ?: "启动游戏异常,请稍候再试") + } + } + } + } + /** * 安装新游戏 * 正常的游戏使用这个方法来安装,内部有重试处理 @@ -664,74 +714,85 @@ object VHelper { isManualInstall: Boolean = false ) { Utils.log(LOG_TAG, "尝试安装新游戏 ${downloadEntity.path}") - - if (showDialogIfVSpaceIsNeeded( - context, - downloadEntity.gameId, - downloadEntity.name, - downloadEntity.getMetaExtra(Constants.GAME_CATEGORY_IN_CHINESE), - downloadEntity.getMetaExtra(KEY_BIT) - ) - ) return - + // 如果一个游戏存在旧版畅玩助手内,此次安装就是游戏更新 + val isLegacyGame = isLegacyGame(downloadEntity.packageName) // 更新此包名对应的 gameId Map mTempPackageNameAndGameIdMap[downloadEntity.packageName] = downloadEntity.gameId // 当且仅当 // 1. 全局安装完成启动游戏开关打开 - // 2. 服务连接不成功或是手动触发的安装 + // 2. 手动触发的安装 // 3. 不需要谷歌框架或者已经安装好谷歌框架 // 才启用安装完成后自动启动游戏 - val shouldLaunchGameAfterInstallation = - mShouldLaunchGameAfterInstallation - && (!mIsServiceConnected || isManualInstall) - && (!isGAppsRequired(downloadEntity) || isGAppsInstalled()) - + val shouldLaunchGameAfterInstallation: Boolean + if (isLegacyGame) { + shouldLaunchGameAfterInstallation = + mShouldLaunchGameAfterInstallation + && (!mIsServiceConnected || isManualInstall) + && (!isGAppsRequired(downloadEntity) || isGAppsInstalledInCwLegacy()) + } else { + shouldLaunchGameAfterInstallation = + mShouldLaunchGameAfterInstallation + && isManualInstall + && (!isGAppsRequired(downloadEntity) || isGAppsInstalled()) + } // 恢复安装完启动游戏开关 mShouldLaunchGameAfterInstallation = true - connectService { - val installClosure: () -> Unit = { - if (shouldLaunchGameAfterInstallation) { - runOnUiThread { - val gameEntity = toGameEntity(downloadEntity) - try { - context.startActivity(VSpaceLoadingActivity.getIntent(context, gameEntity, true)) - } catch (e: Exception) { - ToastUtils.toast(e.localizedMessage ?: "启动游戏异常,请稍候再试") - } - } - } + val installClosure: () -> Unit = { + gotoVspaceLoading(context, downloadEntity, shouldLaunchGameAfterInstallation) - val path = downloadEntity.path - // 正在安装中,忽略重复调用 (手动安装时强行再安装,避免安装结果没有回调时永远卡住,无法安装) - if (!mInstallingVaPathSet.contains(path)) { - try { - mInstallingVaPathSet.add(path) + val path = downloadEntity.path + // 正在安装中,忽略重复调用 (手动安装时强行再安装,避免安装结果没有回调时永远卡住,无法安装) + if (!mInstallingVaPathSet.contains(path)) { + try { + mInstallingVaPathSet.add(path) + if (isLegacyGame) { runOnUiThread { val intent = VirtualAppManager.getInstallIntent(context, path, downloadEntity.packageName) Utils.log(LOG_TAG, "正在安装 ${downloadEntity.packageName}") context.startActivity(intent) } - } catch (e: Exception) { - ToastUtils.toast(e.localizedMessage ?: "") + } else { + runOnIoThread { + val bit = downloadEntity.getMetaExtra(KEY_BIT) + val installParams = + VGameInstallerParams(VGameInstallerParams.FLAG_INSTALL_OVERRIDE_NO_CHECK) + if (bit == "32") { + installParams.cpuAbiOverride = "armeabi-v7a" + } else { + installParams.cpuAbiOverride = "arm64-v8a" + } + val installGameResult = VaApp.get().appManager.installGame(path, installParams) + onInstallFinished(downloadEntity.packageName, installGameResult) + } } + + + } catch (e: Exception) { + ToastUtils.toast(e.localizedMessage ?: "") + } + } else { + Utils.log(LOG_TAG, "$path 正在安装中,此次安装调用无效") + } + } + + if (isLegacyGame) { + connectService { + if (mDelegateManager.isConnectAidlInterface) { + installClosure.invoke() } else { - Utils.log(LOG_TAG, "$path 正在安装中,此次安装调用无效") + connectService( + shouldCheckUpdate = false, + shouldConnectSilently = false, + callbackClosure = installClosure + ) } } - - if (mDelegateManager.isConnectAidlInterface) { - installClosure.invoke() - } else { - connectService( - shouldCheckUpdate = false, - shouldConnectSilently = false, - callbackClosure = installClosure - ) - } + } else { + installClosure.invoke() } } @@ -758,43 +819,32 @@ object VHelper { * 安装新应用 * 不会作为游戏存储,目前仅应用于谷歌框架 * 因为是静默安装,所以不检查其它限制条件 + * + * 不再安装到旧版畅玩助手 */ private fun install(context: Context, file: File) { Utils.log(LOG_TAG, "尝试安装新应用 ${file.name}") - val packageName = file.nameWithoutExtension - - val installClosure: () -> Unit = { - val path = file.path - if (!mInstallingVaPathSet.contains(path)) { - try { - runOnUiThread { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q - && !PackageUtils.isAppOnForeground(context) - ) { - mBatchInstallListener?.invoke(false, true) - Utils.log(LOG_TAG, "应用切换至后台,批量安装被打断") - return@runOnUiThread - } - - mInstallingVaPathSet.add(path) - - val intent = VirtualAppManager.getInstallIntent(context, path, packageName) - - Utils.log(LOG_TAG, "正在安装 $packageName") - context.startActivity(intent) - } - } catch (e: Exception) { - Utils.log(LOG_TAG, "安装异常,${e.localizedMessage}") + val path = file.path + if (!mInstallingVaPathSet.contains(path)) { + try { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q + && !PackageUtils.isAppOnForeground(context) + ) { + mBatchInstallListener?.invoke(false, true) + Utils.log(LOG_TAG, "应用切换至后台,批量安装被打断") + return } + mInstallingVaPathSet.add(path) + runOnIoThread { + val installParams = VGameInstallerParams(VGameInstallerParams.FLAG_INSTALL_OVERRIDE_NO_CHECK) + val installGameResult = VaApp.get().appManager.installGame(path, installParams) + onInstallFinished(packageName, installGameResult) + } + } catch (e: Exception) { + Utils.log(LOG_TAG, "安装异常,${e.localizedMessage}") } } - - if (mDelegateManager.isConnectAidlInterface) { - installClosure.invoke() - } else { - connectService(shouldCheckUpdate = false, shouldConnectSilently = false, callbackClosure = installClosure) - } } /** @@ -813,7 +863,7 @@ object VHelper { * 安装完成回调 */ fun onInstallFinished(packageName: String, result: VGameInstallerResult) { - if(PackageFlavorHelper.IS_TEST_FLAVOR) { + if (PackageFlavorHelper.IS_TEST_FLAVOR) { callSite.onNext(callSiteOnInstallComplet) } runOnIoThread { @@ -837,7 +887,10 @@ object VHelper { } if (result.status == 0) { - updateInstalledList() + if (isInstalled(packageName)) { + // 存在旧版畅玩组件的游戏更新时才更新安装列表了,不再会有新的包安装到旧版的畅玩空间了 + updateInstalledList() + } PackageObserver.onPackageChanged( EBPackage(EBPackage.TYPE_INSTALLED, result.packageName, "unknown").also { it.gameId = downloadEntity.gameId @@ -858,7 +911,9 @@ object VHelper { } else { // downloadEntity 为空,可能是框架类的安装 (走另外一个下载管理) if (result.status == 0) { - updateInstalledList() + if (mIsServiceConnected) { + updateInstalledList() + } } else { ToastUtils.toast("安装出现异常, ${result.status}") } @@ -946,9 +1001,11 @@ object VHelper { values.put("meta", GsonUtils.toJson(downloadEntity.meta)) val type = if (PackageFlavorHelper.IS_TEST_FLAVOR) "test_flavor" else "" values.put("type", type) - val uri = Uri.parse("content://com.lg.core.provider/download_game") + val uri = + Uri.parse("content://${com.lg.vspace.BuildConfig.VA_AUTHORITY_PREFIX}.provider.download_game/download_game") HaloApp.getInstance().contentResolver.insert(uri, values) } catch (e: Throwable) { + Utils.log("TEST", "::insertInstalledGameToProvider, e: ${e.toString()}") if (!fromRetry) { insertInstalledGameToProvider(downloadEntity, true) } else { @@ -963,7 +1020,7 @@ object VHelper { downloadEntity: DownloadEntity, location: String? = null ) { - Utils.log(LOG_TAG, "检测是需要安装还是启动 ${downloadEntity.gameId}") + Utils.log(LOG_TAG, "检测是需要安装还是启动(DownloadEntity) ${downloadEntity.gameId}") if (downloadEntity.name.isNullOrEmpty()) { SentryHelper.onEvent( @@ -992,7 +1049,7 @@ object VHelper { gameEntity: GameEntity, location: String? = null ) { - Utils.log(LOG_TAG, "检测是需要安装还是启动 ${gameEntity.id}") + Utils.log(LOG_TAG, "检测是需要安装还是启动(GameEntity) ${gameEntity.id}") installOrLaunch( context, @@ -1030,29 +1087,24 @@ object VHelper { category = gameType setApk(arrayListOf(ApkEntity(packageName = packageName, bit = bit))) }) { - if (isInstalled(packageName)) { + if (isLegacyGame(packageName) || isInnerInstalled(packageName)) { launch(context, packageName) - } else { - // 这里重新检查一遍是否已安装,因为有可能因为上一次更新列表失败而出现重新下载的情况 - if (isInstalled(packageName)) { - launch(context, packageName) - return@validateVSpaceBeforeAction - } + return@validateVSpaceBeforeAction + } - // 检查下载管理是否有下载实体,有实体表明未安装成功 - val downloadEntity = getVDownloadEntity(gameId = gameId, packageName = packageName) + // 检查下载管理是否有下载实体,有实体表明未安装成功 + val downloadEntity = getVDownloadEntity(gameId = gameId, packageName = packageName) - if (downloadEntity != null) { - val downloadedFile = File(downloadEntity.path) - if (downloadedFile.exists() && downloadedFile.length() == downloadEntity.size) { - install(context, downloadEntity, true) - } else { - // 重新下载 - updateOrReDownload(downloadEntity, null) - } + if (downloadEntity != null) { + val downloadedFile = File(downloadEntity.path) + if (downloadedFile.exists() && downloadedFile.length() == downloadEntity.size) { + install(context, downloadEntity, true) } else { - ToastUtils.toast("该游戏已损坏,请重新下载") + // 重新下载 + updateOrReDownload(downloadEntity, null) } + } else { + ToastUtils.toast("该游戏已损坏,请重新下载") } } } @@ -1069,7 +1121,7 @@ object VHelper { showLoading: Boolean = true ) { Utils.log(LOG_TAG, "尝试打开应用 $packageName") - + val isLegacyGame = isLegacyGame(packageName) // 置空下载挂起回调(能 launch 游戏说明畅玩组件已安装) mPendingDownloadCallback = null @@ -1078,9 +1130,13 @@ object VHelper { val gameId = downloadEntity?.gameId ?: "unknown" val gameName = downloadEntity?.name ?: "unknown" val gameIcon = downloadEntity?.icon ?: "unknown" - // 若需要安装谷歌框架,弹谷歌框架安装弹窗 - if (!ignoreGApps && isGAppsRequired(downloadEntity) && !isGAppsInstalled()) { + if (!ignoreGApps && isGAppsRequired(downloadEntity) && if (isLegacyGame) { + !isGAppsInstalledInCwLegacy() + } else { + !isGAppsInstalled() + } + ) { // show dialog val currentActivity = CurrentActivityHolder.getCurrentActivity() as? AppCompatActivity ?: return GAppsDownloadDialogFragment @@ -1106,10 +1162,23 @@ object VHelper { thirdPartyAd?.slotId, thirdPartyAd?.displaySize ) + // 覆盖字段 + if (!isLegacyGame) { + intent.setComponent( + ComponentName( + com.gh.gamecenter.BuildConfig.APPLICATION_ID, + VirtualAppManager.AIDL_SERVER_REMOTE_GUIDE_ACTIVITY + ) + ) + } intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) context.startActivity(intent) } else { - VirtualAppManager.get().launchGame(packageName) + if (isLegacyGame(packageName)) { + VirtualAppManager.get().launchGame(packageName) + } else { + VaApp.get().appManager.launchGame(packageName) + } } mLastSuccessfullyLaunchedGame = Pair(System.currentTimeMillis(), packageName) @@ -1215,7 +1284,7 @@ object VHelper { // 卸载的时候移除已安装的包名历史 mPackageInstalledLiveData.postValue("") } - if(PackageFlavorHelper.IS_TEST_FLAVOR) { + if (PackageFlavorHelper.IS_TEST_FLAVOR) { callSite.onNext(callSiteUninstall) } Utils.log(LOG_TAG, "卸载应用结果 -> $result") @@ -1678,9 +1747,15 @@ object VHelper { } /** - * 是否已经成功安装了 GApps + * 畅玩是否已经成功安装了 GApps */ - fun isGAppsInstalled(): Boolean { + private fun isGAppsInstalled() = isInnerInstalled(G_GMS_PACKAGE_NAME) && isInnerInstalled(G_GSF_PACKAGE_NAME) + && isInnerInstalled(G_VENDING_PACKAGE_NAME) + + /** + * 旧版畅玩是否已经成功安装了 GApps + */ + private fun isGAppsInstalledInCwLegacy(): Boolean { return isInstalled(G_GMS_PACKAGE_NAME) && isInstalled(G_GSF_PACKAGE_NAME) && isInstalled(G_VENDING_PACKAGE_NAME) diff --git a/app/src/main/java/com/gh/vspace/shortcut/ShortcutManager.kt b/app/src/main/java/com/gh/vspace/shortcut/ShortcutManager.kt index 5612bbddbe..ab2bfe589e 100644 --- a/app/src/main/java/com/gh/vspace/shortcut/ShortcutManager.kt +++ b/app/src/main/java/com/gh/vspace/shortcut/ShortcutManager.kt @@ -89,8 +89,8 @@ class ShortcutManager private constructor() { * 知道游戏id和包名,创建桌面图标 */ fun tryCreateShortCut(context: Context, gameId: String, gamePkg: String, result: OnCreateShortcutResult) { - VHelper.postOnInitialized { - val downloadEntity = VHelper.getVDownloadEntitySnapshot(gameId, gamePkg) + val downloadEntity = VHelper.getVDownloadEntitySnapshot(gameId, gamePkg) + val createShortcutLambda = { runOnUiThread { if (downloadEntity == null) { result.failed() @@ -100,6 +100,11 @@ class ShortcutManager private constructor() { } } } + if (VHelper.isLegacyGame(gamePkg)) { + VHelper.postOnInitialized(createShortcutLambda) + } else { + createShortcutLambda.invoke() + } } diff --git a/app/src/main/java/com/halo/assistant/HaloApp.java b/app/src/main/java/com/halo/assistant/HaloApp.java index 7c5053b41e..a9dd4bea2e 100644 --- a/app/src/main/java/com/halo/assistant/HaloApp.java +++ b/app/src/main/java/com/halo/assistant/HaloApp.java @@ -360,6 +360,7 @@ public class HaloApp extends MultiDexApplication { }); } }, delay); + VaApp.get().startSensorLogService(); } private void initArouter() { diff --git a/build.gradle b/build.gradle index 4743ed1cba..d47fc8e51c 100644 --- a/build.gradle +++ b/build.gradle @@ -49,11 +49,13 @@ allprojects { maven { url 'https://artifact.bytedance.com/repository/pangle' } } } - +task clean(type: Delete) { + delete rootProject.buildDir +} subprojects { subproject -> afterEvaluate { - if (!project.name.startsWith("va-") && (subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) { + if (subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library')) { if (!android.compileSdkVersion) { android { compileSdkVersion rootProject.ext.compileSdkVersion @@ -80,70 +82,5 @@ subprojects { } } - if (project.name.startsWith("va-")) { - android { - compileSdkVersion rootProject.ext.compileSdkVersion - defaultConfig { - minSdkVersion rootProject.ext.pluginMinSdkVersion - targetSdkVersion rootProject.ext.targetSdkVersion - } - if (project.name.startsWith("va-plugin")) { - versionCode = rootProject.ext.PLUGIN_VERSION_CODE - versionName = rootProject.ext.PLUGIN_VERSION - } else { - versionCode = rootProject.ext.VA_VERSION_CODE - versionName = rootProject.ext.VA_VERSION - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - if (new File(projectDir, "src/main/cpp/CMakeLists.txt").exists()) { - externalNativeBuild { - cmake { - path "src/main/cpp/CMakeLists.txt" - version "3.10.2" - } - } - } - lintOptions { - checkReleaseBuilds false - abortOnError false - } - } - - if (subproject.plugins.hasPlugin('android')) { - android { - signingConfigs { - va { - storeFile file(rootProject.ext.signing_storeFile) - storePassword rootProject.ext.signing_storePassword - keyAlias rootProject.ext.signing_keyAlias - keyPassword rootProject.ext.signing_keyPassword - } - } - - buildTypes { - release { - signingConfig signingConfigs.va - // 记录:部落冲突-RL 开启 debugable 会加载失败。 - debuggable false - minifyEnabled true - shrinkResources true - zipAlignEnabled true - - proguardFiles getDefaultProguardFile('proguard-android.txt'), rootProject.ext.va_proguard_rules, "${project.projectDir}/proguard-rules.pro" - } - - debug { - signingConfig release.signingConfig - crunchPngs false //关闭crunchPng优化 - minifyEnabled false - } - } - } - } - } } } \ No newline at end of file diff --git a/dependencies_vasdk.gradle b/dependencies_vasdk.gradle index 37246e93df..28ac2139c9 100644 --- a/dependencies_vasdk.gradle +++ b/dependencies_vasdk.gradle @@ -1,16 +1,18 @@ ext { - pluginMinSdkVersion = 21 + vaCompileSdkVersion = 33 + vaMinSdkVersion = 21 + vaTargetSdkVersion = 28 } ext { PACKAGE_NAME = "com.gh.gamecenter" - EXT_PACKAGE_NAME = PACKAGE_NAME + ".addon" + EXT_PACKAGE_NAME = "com.gh.gamecenter.addon" VA_MAIN_PACKAGE_32BIT = false - VA_ACCESS_PERMISSION_NAME = PACKAGE_NAME + ".permission.SAFE_ACCESS" - VA_AUTHORITY_PREFIX = PACKAGE_NAME - VA_EXT_AUTHORITY_PREFIX = PACKAGE_NAME + ".ext" - INSTALL_EXT_AUTHORITY_PREFIX = PACKAGE_NAME + ".install_external_app" // 在va环境内安装外部应用authority属性 + VA_ACCESS_PERMISSION_NAME = "com.gh.gamecenter.permission.SAFE_ACCESS" + VA_AUTHORITY_PREFIX = "com.gh.gamecenter" + VA_EXT_AUTHORITY_PREFIX = "com.gh.gamecenter.ext" + INSTALL_EXT_AUTHORITY_PREFIX = "com.gh.gamecenter.install_external_app" // 在va环境内安装外部应用authority属性 // version test VA_VERSION = '1.6.5' VA_VERSION_CODE = 100605 @@ -29,11 +31,11 @@ ext { // 是否启用媒体存储重定向,开启必须使用共享UID模式!!! VA_ENABLE_MEDIA_REDIRECT = false // 媒体存储重定向的插件包名 - MEDIA_PACKAGE_NAME = "io.busniess.va.media.module" + MEDIA_PACKAGE_NAME = "com.gh.gamecenter.media.module" PLUGIN_VERSION = '1.0.0' PLUGIN_VERSION_CODE = 1_00_00 - PLUGIN_APPLICATION_ID = "com.lg.vspace" + PLUGIN_APPLICATION_ID = "com.gh.gamecenter" PLUGIN_APK_PATH_PREFIX = "vasdk/"