Merge branch 'dev-5.30.0' into feature/GHZS-2912
# Conflicts: # app/src/main/java/com/gh/gamecenter/fragment/HomeSearchToolWrapperFragment.kt
This commit is contained in:
@ -341,7 +341,7 @@ object DirectUtils {
|
||||
|
||||
"feedback" -> directToFeedback(context, linkEntity.name, linkEntity.text, false, "", entrance)
|
||||
|
||||
"qa", "Q&A" -> directToQa(context, linkEntity.text ?: "", linkEntity.link ?: "")
|
||||
"qa", "qa_content", "Q&A" -> directToQa(context, linkEntity.text ?: "", linkEntity.link ?: "")
|
||||
|
||||
"qa_collection", "Q&A合集" -> directToQaCollection(
|
||||
context, linkEntity.text
|
||||
|
||||
@ -4,12 +4,9 @@ import android.app.Activity
|
||||
import android.app.PendingIntent
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.pm.PackageInstaller.SessionCallback
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.content.FileProvider
|
||||
import com.gh.common.dialog.InstallPermissionDialogFragment
|
||||
@ -21,7 +18,6 @@ import com.gh.gamecenter.common.constant.Constants
|
||||
import com.gh.gamecenter.common.utils.DialogHelper
|
||||
import com.gh.gamecenter.common.utils.getExtension
|
||||
import com.gh.gamecenter.common.utils.getMetaExtra
|
||||
import com.gh.gamecenter.core.AppExecutor
|
||||
import com.gh.gamecenter.core.utils.CurrentActivityHolder
|
||||
import com.gh.gamecenter.core.utils.MD5Utils
|
||||
import com.gh.gamecenter.core.utils.ToastUtils
|
||||
|
||||
@ -2,13 +2,15 @@ package com.gh.common.xapk
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import android.provider.Settings
|
||||
import com.gh.common.constant.Config
|
||||
import com.gh.common.util.*
|
||||
import com.gh.download.DownloadDataHelper
|
||||
import com.gh.download.DownloadManager
|
||||
import com.gh.gamecenter.common.utils.debugOnly
|
||||
import com.gh.gamecenter.common.utils.getExtension
|
||||
import com.gh.gamecenter.common.utils.throwExceptionInDebug
|
||||
import com.gh.gamecenter.common.constant.Constants
|
||||
import com.gh.gamecenter.common.utils.*
|
||||
import com.gh.gamecenter.core.AppExecutor
|
||||
import com.gh.gamecenter.core.utils.SentryHelper
|
||||
import com.gh.gamecenter.xapk.XApkUnZipper
|
||||
@ -51,6 +53,9 @@ object XapkInstaller : XApkUnZipCallback, XApkUnZipOutputFactory {
|
||||
const val XAPK_DATA_EXTENSION_NAME = "obb"
|
||||
const val PACKAGE_EXTENSION_NAME = "apk"
|
||||
|
||||
private const val GUIDE_TYPE_MIUI_OPTIMIZATION = "miui_optimization"
|
||||
private const val MIUI_OPTIMIZATION_WARNING_DIALOG_ENTRANCE = "MIUI优化关闭提示弹窗"
|
||||
|
||||
private var mContext = HaloApp.getInstance().application.applicationContext
|
||||
|
||||
private val mXApkUnZipper = XApkUnZipper(this)
|
||||
@ -69,6 +74,30 @@ object XapkInstaller : XApkUnZipCallback, XApkUnZipOutputFactory {
|
||||
|
||||
val filePath = downloadEntity.path
|
||||
if (XAPK_EXTENSION_NAME == filePath.getExtension()) {
|
||||
if (MiuiUtils.isMiui() && !MiuiUtils.isMiuiOptimizationDisabled() && downloadEntity.format == Constants.XAPK_APKS_FORMAT) {// 小米手机开启miui以后,需要引导用户关闭miui优化
|
||||
DialogHelper.showMiuiOptimizationWarning(
|
||||
context,
|
||||
onHintClick = {
|
||||
val guides = Config.getNewApiSettingsEntity()?.install
|
||||
val miuiOptimizationGuide = guides?.guides?.findLast {
|
||||
it.type == GUIDE_TYPE_MIUI_OPTIMIZATION
|
||||
}
|
||||
if (miuiOptimizationGuide != null) {
|
||||
DirectUtils.directToLinkPage(
|
||||
context,
|
||||
miuiOptimizationGuide.link,
|
||||
MIUI_OPTIMIZATION_WARNING_DIALOG_ENTRANCE,
|
||||
""
|
||||
)
|
||||
}
|
||||
},
|
||||
onConfirmClick = {
|
||||
context.startActivity(Intent(Settings.ACTION_APPLICATION_DEVELOPMENT_SETTINGS))
|
||||
}
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
unzipXapkFile(downloadEntity)
|
||||
if (showUnzipToast) {
|
||||
Utils.toast(mContext, "解压过程请勿退出光环助手!")
|
||||
@ -227,7 +256,9 @@ object XapkInstaller : XApkUnZipCallback, XApkUnZipOutputFactory {
|
||||
if (sessionId != -1) {
|
||||
val sessionInfo = installer.getSessionInfo(sessionId)
|
||||
// 表示用户点击了安装弹窗外部区域
|
||||
if (sessionInfo != null && sessionInfo.progress <= 0.8F) {
|
||||
if (sessionInfo == null) {
|
||||
pendingSessionInfo.updateStatus(XapkPendingSessionInfo.STATUS_INSTALL_CANCELED)
|
||||
} else if (sessionInfo.progress <= 0.8F) {
|
||||
AppExecutor.ioExecutor.execute {
|
||||
installer.abandonSession(sessionInfo.sessionId)
|
||||
}
|
||||
@ -278,12 +309,13 @@ object XapkInstaller : XApkUnZipCallback, XApkUnZipOutputFactory {
|
||||
) : IPackageInstaller {
|
||||
|
||||
override fun install(context: Context) {
|
||||
val downloadEntity = mDownloadEntityMap[xApkFile.file.path] ?: return
|
||||
val applicationContext = context.applicationContext
|
||||
val downloadEntity = mDownloadEntityMap[xApkFile.file.path] ?: return
|
||||
|
||||
mPendingSessionInfoMap[downloadEntity.path] = XapkPendingSessionInfo(downloadEntity.path, sessionId)
|
||||
AppExecutor.ioExecutor.execute {// 有可能卡顿造成anr
|
||||
NDataChanger.notifyDataChanged(downloadEntity)
|
||||
PackageInstaller.installMultiple(applicationContext, downloadEntity.path, sessionId)
|
||||
NDataChanger.notifyDataChanged(downloadEntity)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -309,7 +341,6 @@ enum class XapkUnzipStatus(status: String) {
|
||||
UNZIPPING("unzipping"),
|
||||
SUCCESS("success"),
|
||||
CANCEL("cancel"),
|
||||
INSTALLING("installing"),
|
||||
INSTALLED("installed"),
|
||||
FAILURE("failure");
|
||||
}
|
||||
@ -198,7 +198,6 @@ public class MainActivity extends BaseActivity {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
showAd = getIntent().getBooleanExtra(SHOW_AD, false) && savedInstanceState == null;
|
||||
|
||||
HaloApp.getInstance().initFresco();
|
||||
HaloApp.getInstance().isAlreadyUpAndRunning = true;
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
@ -297,19 +297,7 @@ class SplashScreenActivity : BaseActivity() {
|
||||
private fun doFlavorInit() {
|
||||
HaloApp.getInstance().flavorProvider.init(HaloApp.getInstance(), this, PkgHelper.getActivateRatio())
|
||||
|
||||
val whiteListChannel = arrayListOf(
|
||||
"GH_206",
|
||||
"KS-GHZS-KY1",
|
||||
"KS-GHZS-MC1",
|
||||
"GDT_GHZS_MC1",
|
||||
"T11-GH-APPDY-ZC01",
|
||||
"T7-GH-APPDY-KY03",
|
||||
"T8-GH-APPUX-KY04",
|
||||
"T1-GHZS-MC01",
|
||||
"T4-GHZS-MC03"
|
||||
)
|
||||
|
||||
if (whiteListChannel.contains(HaloApp.getInstance().channel) || PackageFlavorHelper.IS_TEST_FLAVOR) {
|
||||
if (HaloApp.getInstance().channel == "GH_206" || PackageFlavorHelper.IS_TEST_FLAVOR) {
|
||||
SensorsBridge.init(HaloApp.getInstance(), HaloApp.getInstance().channel)
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.gh.gamecenter.entity
|
||||
|
||||
import com.gh.gamecenter.common.entity.LinkEntity
|
||||
import com.gh.gamecenter.feature.entity.SimulatorEntity
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
@ -29,7 +30,9 @@ class NewApiSettingsEntity(
|
||||
// VPN 配置
|
||||
class Install(
|
||||
@SerializedName("vpn_required")
|
||||
val vpnRequired: VpnSetting? = null
|
||||
val vpnRequired: VpnSetting? = null,
|
||||
@SerializedName("guides")
|
||||
val guides: List<Guide>? = null
|
||||
)
|
||||
|
||||
class VpnSetting(
|
||||
@ -38,4 +41,9 @@ class NewApiSettingsEntity(
|
||||
@SerializedName("packages")
|
||||
val vpnMatchedPackagesName: HashSet<String>
|
||||
)
|
||||
|
||||
class Guide(
|
||||
val type: String,
|
||||
val link: LinkEntity
|
||||
)
|
||||
}
|
||||
@ -534,8 +534,7 @@ class SearchGameIndexAdapter(
|
||||
if (key.contains(download.packageName) && key.contains(download.gameId)) {
|
||||
val position = positionAndPackageMap[key]
|
||||
if (position != null && mEntityList != null && position < mEntityList.size && mEntityList[position].game != null) {
|
||||
mEntityList[position].game!!.getEntryMap()[download.platform] = download
|
||||
notifyItemChanged(position)
|
||||
DownloadItemUtils.processDate(mEntityList[position].game!!, download, this, position)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -102,6 +102,7 @@ class GameServerTestV2ListFragment :
|
||||
}
|
||||
|
||||
override fun initSkeletonScreen() {
|
||||
if (mBinding?.skeleton == null) return
|
||||
mSkeletonScreen = Skeleton.bind(mBinding?.skeleton)
|
||||
.shimmer(true)
|
||||
.angle(Constants.SHIMMER_ANGLE)
|
||||
|
||||
@ -150,7 +150,7 @@ object VArchiveHelper {
|
||||
if (isSuccess) {
|
||||
val vGameEntity = VHelper.getVGameSnapshot(packageName = packageName)
|
||||
runOnIoThread {
|
||||
val fileMd5 = MD5Utils.calculateMD5(mLatestArchiveFile)
|
||||
val fileMd5 = MD5Utils.calculateMD5(mLatestArchiveFile) ?: return@runOnIoThread
|
||||
val vArchiveEntity = VArchiveEntity(
|
||||
id = fileMd5,
|
||||
gameId = vGameEntity?.downloadEntity?.gameId ?: "",
|
||||
|
||||
@ -959,11 +959,21 @@ object VHelper {
|
||||
location: String? = null) {
|
||||
Utils.log(LOG_TAG, "检测是需要安装还是启动 ${downloadEntity.gameId}")
|
||||
|
||||
if (downloadEntity.name.isNullOrEmpty()) {
|
||||
SentryHelper.onEvent(
|
||||
"V_GAME_DOWNLOAD_ENTITY_NAME_EMPTY",
|
||||
"game_id",
|
||||
downloadEntity.gameId,
|
||||
"location",
|
||||
location
|
||||
)
|
||||
}
|
||||
|
||||
installOrLaunch(
|
||||
context,
|
||||
downloadEntity.packageName,
|
||||
downloadEntity.gameId,
|
||||
downloadEntity.name,
|
||||
downloadEntity.name ?: "",
|
||||
downloadEntity.getGameCategory(),
|
||||
downloadEntity.getMetaExtra(KEY_BIT),
|
||||
location
|
||||
|
||||
@ -46,6 +46,7 @@ class VSpace32DialogFragment : BaseDraggableDialogFragment() {
|
||||
private val mBinding by lazy { DialogVspace32Binding.inflate(layoutInflater) }
|
||||
private var mIsLogInstallShow = false
|
||||
private var mIsLogAutoInstallClick = false
|
||||
private var mIsClickDownloadThisTime = false // 是否本次弹出Dialog点击的下载按钮
|
||||
private val mDataWatcher = object : DataWatcher() {
|
||||
override fun onDataChanged(downloadEntity: DownloadEntity) {
|
||||
if (downloadEntity.url == mDownloadUrl && isAdded) {
|
||||
@ -146,6 +147,8 @@ class VSpace32DialogFragment : BaseDraggableDialogFragment() {
|
||||
downloadType
|
||||
).toJson()
|
||||
|
||||
mIsClickDownloadThisTime = true
|
||||
|
||||
AppExecutor.uiExecutor.executeWithDelay({
|
||||
DownloadManager.getInstance().cancel(mDownloadUrl)
|
||||
DownloadManager.getInstance().add(downloadEntity)
|
||||
@ -221,7 +224,7 @@ class VSpace32DialogFragment : BaseDraggableDialogFragment() {
|
||||
val isVSpace32DownloadOnly =
|
||||
downloadEntity.getMetaExtra(Constants.EXTRA_DOWNLOAD_TYPE) == Constants.VSPACE_32_DOWNLOAD_ONLY
|
||||
val isAutoInstall = SPUtils.getBoolean(Constants.SP_AUTO_INSTALL, true)
|
||||
if (!isVSpace32DownloadOnly && isAutoInstall && !mIsLogAutoInstallClick) {
|
||||
if (!isVSpace32DownloadOnly && isAutoInstall && !mIsLogAutoInstallClick && mIsClickDownloadThisTime) {
|
||||
NewFlatLogUtils.logHaloFunEvent("halo_fun_32_install_tip_dialog_click")
|
||||
SensorsBridge.trackEvent("HaloFunExpandInstallButtonClick")
|
||||
mIsLogAutoInstallClick = true
|
||||
|
||||
@ -59,6 +59,7 @@ class VSpaceDialogFragment : BaseDraggableDialogFragment() {
|
||||
private val mBinding by lazy { DialogVspaceBinding.inflate(layoutInflater) }
|
||||
private var mIsLogInstallShow = false
|
||||
private var mIsLogAutoInstallClick = false
|
||||
private var mIsClickDownloadThisTime = false // 是否本次弹出Dialog点击的下载按钮
|
||||
private val mDataWatcher = object : DataWatcher() {
|
||||
override fun onDataChanged(downloadEntity: DownloadEntity) {
|
||||
if (((mAppEntity64 != null && downloadEntity.url == mDownloadUrl64) || (mAppEntity64 == null && downloadEntity.url == mDownloadUrl32)) && isAdded) {
|
||||
@ -159,6 +160,7 @@ class VSpaceDialogFragment : BaseDraggableDialogFragment() {
|
||||
DataCollectionUtils.uploadDownload(HaloApp.getInstance(), downloadEntity32, "开始")
|
||||
}
|
||||
|
||||
mIsClickDownloadThisTime = true
|
||||
AppExecutor.uiExecutor.executeWithDelay({
|
||||
if (downloadEntity64 != null) {
|
||||
DownloadManager.getInstance().cancel(mDownloadUrl64)
|
||||
@ -238,7 +240,7 @@ class VSpaceDialogFragment : BaseDraggableDialogFragment() {
|
||||
|
||||
// 需要下载的 32 位组件是否与已安装的 32 位组件版本一致
|
||||
val is32BitVersionMatched =
|
||||
mAppEntity32 == null
|
||||
(mAppEntity32 == null || mBit != "32")
|
||||
|| mAppEntity32?.version == PackageUtils.getVersionNameByPackageName(VHelper.VSPACE_32BIT_PACKAGENAME)
|
||||
|
||||
if (is64BitVersionMatched && is32BitVersionMatched) {
|
||||
@ -318,8 +320,14 @@ class VSpaceDialogFragment : BaseDraggableDialogFragment() {
|
||||
mIsLogInstallShow = true
|
||||
}
|
||||
|
||||
if (SPUtils.getBoolean(Constants.SP_AUTO_INSTALL, true) && !mIsLogAutoInstallClick) {
|
||||
SensorsBridge.trackEvent("HaloFunInstallButtonClick", "space_schema_type", vSpaceType)
|
||||
if (SPUtils.getBoolean(
|
||||
Constants.SP_AUTO_INSTALL,
|
||||
true
|
||||
) && !mIsLogAutoInstallClick && mIsClickDownloadThisTime
|
||||
) {
|
||||
downloadBtn.postDelayed({
|
||||
SensorsBridge.trackEvent("HaloFunInstallButtonClick", "space_schema_type", vSpaceType)
|
||||
}, SENSORS_LOG_DELAY)
|
||||
mIsLogAutoInstallClick = true
|
||||
}
|
||||
|
||||
@ -359,6 +367,8 @@ class VSpaceDialogFragment : BaseDraggableDialogFragment() {
|
||||
const val KEY_AUTO_DOWNLOAD = "auto_download"
|
||||
const val KEY_IS_UPDATE = "is_update"
|
||||
|
||||
const val SENSORS_LOG_DELAY = 1000L
|
||||
|
||||
@JvmStatic
|
||||
fun showDownloadDialog(
|
||||
context: Context?,
|
||||
|
||||
@ -227,12 +227,12 @@ public class HaloApp extends MultiDexApplication {
|
||||
PlayerFactory.setPlayManager(Exo2PlayerManager.class);
|
||||
CacheFactory.setCacheManager(ExoPlayerCacheManager.class);
|
||||
|
||||
initFresco();
|
||||
|
||||
AppExecutor.getIoExecutor().execute(() -> {
|
||||
initDataHelper();
|
||||
ExtensionsKt.doOnMainProcessOnly(this, () -> Tracker.init(this));
|
||||
|
||||
initFresco();
|
||||
|
||||
deviceRamSize = DeviceUtils.getTotalRamSizeOfDevice(this);
|
||||
mChannel = mFlavorProvider.getChannelStr(this);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user