Compare commits
17 Commits
pack/test-
...
pack/v5.35
| Author | SHA1 | Date | |
|---|---|---|---|
| be4f4689c5 | |||
| d7934835eb | |||
| a92a2bf924 | |||
| 8dbfbdde05 | |||
| 8f48dfd347 | |||
| bc811a2882 | |||
| bfd986fdfd | |||
| a2bd5e01e0 | |||
| 844d227f19 | |||
| 8b1f92e9c4 | |||
| f5834d440b | |||
| f982bf6478 | |||
| 33d7afec71 | |||
| 37ef50f323 | |||
| 4c6acdee3a | |||
| 6beb060e63 | |||
| d11ccba0b7 |
@ -71,7 +71,7 @@ android_build:
|
||||
exit_codes: 137
|
||||
only:
|
||||
- dev
|
||||
- release
|
||||
- pack/v5.35.0-1050/privacy_policy
|
||||
|
||||
# 代码检查
|
||||
sonarqube_analysis:
|
||||
@ -152,4 +152,4 @@ oss-upload&send-email:
|
||||
- /usr/local/bin/python /ci-android-mail-jira-comment.py
|
||||
only:
|
||||
- dev
|
||||
- release
|
||||
- pack/v5.35.0-1050/privacy_policy
|
||||
@ -401,7 +401,7 @@ dependencies {
|
||||
implementation(project(':feature:pkg'))
|
||||
implementation(project(':feature:oaid'))
|
||||
implementation(project(':feature:floating-window'))
|
||||
implementation(project(':feature:csj_ad'))
|
||||
// implementation(project(':feature:csj_ad'))
|
||||
// implementation(project(':feature:beizi_startup_ad'))
|
||||
implementation(project(':feature:xapk-installer'))
|
||||
implementation(project(':feature:qq_game')) {
|
||||
@ -409,12 +409,13 @@ dependencies {
|
||||
}
|
||||
internalImplementation(project(':module_internal_test'))
|
||||
|
||||
// 根据BUILD_PUSH_TYPE决定使用哪个推送SDK,目前默认使用阿里云推送
|
||||
def pushProject = findProperty('BUILD_PUSH_TYPE') == 'jg'
|
||||
? project(':feature:jg_push') : project(':feature:acloud_push')
|
||||
implementation(pushProject) {
|
||||
exclude group: 'androidx.swiperefreshlayout'
|
||||
}
|
||||
// def pushProperty = findProperty('BUILD_PUSH_TYPE')
|
||||
// // 根据BUILD_PUSH_TYPE决定使用哪个推送SDK,目前默认使用极光推送
|
||||
// def pushProject = (pushProperty == null || pushProperty == 'jg')
|
||||
// ? project(':feature:jg_push') : project(':feature:acloud_push')
|
||||
// implementation(pushProject) {
|
||||
// exclude group: 'androidx.swiperefreshlayout'
|
||||
// }
|
||||
}
|
||||
|
||||
File propFile = file('sign.properties')
|
||||
|
||||
@ -45,6 +45,14 @@ class GlobalActivityLifecycleObserver : Application.ActivityLifecycleCallbacks {
|
||||
}
|
||||
isFromBackgroundToForeground = false
|
||||
}
|
||||
|
||||
if (activityCount == 1) {
|
||||
// 清除桌面角标
|
||||
if (activity !is SplashScreenActivity && activity !is AuthorizationActivity) {
|
||||
val pushProvider = ARouter.getInstance().build(RouteConsts.provider.push).navigation() as? IPushProvider
|
||||
pushProvider?.cleanBadgeNumber(activity.applicationContext)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onActivityResumed(activity: Activity) {
|
||||
@ -84,10 +92,6 @@ class GlobalActivityLifecycleObserver : Application.ActivityLifecycleCallbacks {
|
||||
}
|
||||
|
||||
XapkInstaller.updateCurrentInstallStatus()
|
||||
|
||||
// 清除桌面角标
|
||||
val pushProvider = ARouter.getInstance().build(RouteConsts.provider.push).navigation() as? IPushProvider
|
||||
pushProvider?.cleanBadgeNumber(activity.applicationContext)
|
||||
}
|
||||
|
||||
override fun onActivityPaused(activity: Activity) {
|
||||
|
||||
122
app/src/main/java/com/gh/common/util/PackageChangeHelper.kt
Normal file
122
app/src/main/java/com/gh/common/util/PackageChangeHelper.kt
Normal file
@ -0,0 +1,122 @@
|
||||
package com.gh.common.util
|
||||
|
||||
import androidx.lifecycle.DefaultLifecycleObserver
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import com.gh.download.DownloadManager
|
||||
import com.gh.download.PackageObserver
|
||||
import com.gh.gamecenter.common.utils.NewFlatLogUtils
|
||||
import com.gh.gamecenter.common.utils.SensorsBridge
|
||||
import com.gh.gamecenter.eventbus.EBPackage
|
||||
import com.gh.gamecenter.manager.PackagesManager
|
||||
import com.gh.gamecenter.packagehelper.PackageRepository
|
||||
import com.lightgame.utils.Utils
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
|
||||
object PackageChangeHelper : DefaultLifecycleObserver {
|
||||
|
||||
private const val TAG = "PackageChangeHelper"
|
||||
|
||||
private const val INSTALL_PENDING = 1
|
||||
private const val UNINSTALL_PENDING = 2
|
||||
private const val UPDATE_PENDING = 3
|
||||
|
||||
// <包名,pending 类型,应用版本> Triple
|
||||
private var pendingPackagePair: Triple<String, Int, String>? = null
|
||||
|
||||
/**
|
||||
* 添加一个等待中,待确定是否已成功安装的应用
|
||||
*/
|
||||
fun addInstallPendingPackage(packageName: String) {
|
||||
val installData = PackagesManager.getInstalledData(packageName)
|
||||
if (installData == null) {
|
||||
Utils.log(TAG, "添加了: $packageName 包名等待安装成功")
|
||||
pendingPackagePair = Triple(packageName, INSTALL_PENDING, "")
|
||||
} else {
|
||||
Utils.log(TAG, "添加了: $packageName 包名等待安装更新成功")
|
||||
pendingPackagePair = Triple(packageName, UPDATE_PENDING, installData.version)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加一个等待中,待确定是否已成功卸载的应用
|
||||
*/
|
||||
fun addUninstallPendingPackage(packageName: String) {
|
||||
Utils.log(TAG, "添加了: $packageName 包名等待卸载成功")
|
||||
pendingPackagePair = Triple(packageName, UNINSTALL_PENDING, "")
|
||||
}
|
||||
|
||||
override fun onResume(owner: LifecycleOwner) {
|
||||
super.onResume(owner)
|
||||
|
||||
if (pendingPackagePair != null) {
|
||||
val packageName = pendingPackagePair?.first ?: return
|
||||
val isInstallPending = pendingPackagePair?.second == INSTALL_PENDING
|
||||
val isUninstallPending = pendingPackagePair?.second == UNINSTALL_PENDING
|
||||
val isUpdatePending = pendingPackagePair?.second == UPDATE_PENDING
|
||||
|
||||
val pendingVersion = pendingPackagePair?.third ?: ""
|
||||
|
||||
val installedVersionName = PackageUtils.getVersionNameByPackageName(packageName)
|
||||
val isInstalled = installedVersionName != null
|
||||
|
||||
if (isInstallPending && isInstalled) {
|
||||
pendingPackagePair = null
|
||||
|
||||
PackageRepository.addInstalledGame(packageName)
|
||||
|
||||
performInstallSuccessAction(packageName)
|
||||
} else if (isUninstallPending && !isInstalled) {
|
||||
pendingPackagePair = null
|
||||
|
||||
performUninstallSuccessAction(packageName)
|
||||
} else if (isUpdatePending
|
||||
&& installedVersionName != pendingVersion) {
|
||||
pendingPackagePair = null
|
||||
|
||||
performInstallSuccessAction(packageName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 对应包名安装成功后的操作,继承至 InstallAndUninstallReceiver
|
||||
*/
|
||||
private fun performInstallSuccessAction(packageName: String) {
|
||||
Utils.log(TAG, "安装了: $packageName 包名的程序")
|
||||
val downloadEntity = DownloadManager.getInstance().getDownloadEntitySnapshotByPackageName(packageName)
|
||||
val gameId = if (downloadEntity != null && downloadEntity.gameId != null) downloadEntity.gameId else ""
|
||||
val gameName = if (downloadEntity != null && downloadEntity.name != null) downloadEntity.name else ""
|
||||
|
||||
NewFlatLogUtils.logGameInstallComplete(gameId, gameName)
|
||||
SensorsBridge.trackInstallGameFinish(gameId, gameName)
|
||||
|
||||
InstallUtils.getInstance().removeInstall(packageName)
|
||||
PackageHelper.refreshLocalPackageList()
|
||||
|
||||
val versionName = PackageUtils.getVersionNameByPackageName(packageName)
|
||||
val installEb = EBPackage(EBPackage.TYPE_INSTALLED, packageName, versionName)
|
||||
|
||||
PackageObserver.onPackageChanged(installEb)
|
||||
EventBus.getDefault().post(installEb)
|
||||
}
|
||||
|
||||
/**
|
||||
* 对应包名卸载成功后的操作,继承至 InstallAndUninstallReceiver
|
||||
*/
|
||||
private fun performUninstallSuccessAction(packageName: String) {
|
||||
Utils.log(TAG, "卸载了: $packageName 包名的程序")
|
||||
val install = PackagesManager.getInstalledData(packageName)
|
||||
val gameId = if (install?.id != null) install.id else ""
|
||||
val gameName = if (install?.name != null) install.name else ""
|
||||
NewFlatLogUtils.logGameUninstallComplete(gameId!!, gameName!!)
|
||||
SensorsBridge.trackUnloadGameFinish(gameId, gameName)
|
||||
|
||||
InstallUtils.getInstance().removeUninstall(packageName)
|
||||
PackageHelper.refreshLocalPackageList()
|
||||
|
||||
val uninstallEb = EBPackage(EBPackage.TYPE_UNINSTALLED, packageName, "")
|
||||
PackageObserver.onPackageChanged(uninstallEb)
|
||||
EventBus.getDefault().post(uninstallEb)
|
||||
}
|
||||
|
||||
}
|
||||
@ -108,6 +108,9 @@ object PackageInstaller {
|
||||
return
|
||||
}
|
||||
|
||||
val packageName = downloadEntity?.packageName ?: PackageUtils.getPackageNameByPath(context, pkgPath)
|
||||
PackageChangeHelper.addInstallPendingPackage(packageName)
|
||||
|
||||
try {
|
||||
// 判断是否需要使用浏览器来进行安装
|
||||
if (BrowserInstallHelper.isUseBrowserToInstallEnabled()
|
||||
@ -250,6 +253,8 @@ object PackageInstaller {
|
||||
fun uninstallForPackageName(context: Context, pkn: String?) {
|
||||
if (pkn.isNullOrEmpty()) return
|
||||
|
||||
PackageChangeHelper.addUninstallPendingPackage(pkn)
|
||||
|
||||
val uninstallIntent = Intent()
|
||||
uninstallIntent.action = Intent.ACTION_DELETE
|
||||
uninstallIntent.addCategory(Intent.CATEGORY_DEFAULT)
|
||||
|
||||
@ -556,7 +556,10 @@ public class MainActivity extends BaseActivity {
|
||||
} else {
|
||||
TextView jumpBtn = findViewById(R.id.jumpBtn);
|
||||
jumpBtn.setText(String.format(Locale.CHINA, "跳过 %d", COUNTDOWN_MAX_COUNT - mCountdownCount));
|
||||
mBaseHandler.sendEmptyMessageDelayed(COUNTDOWN_AD, 1000);
|
||||
Message newMsg = Message.obtain();
|
||||
newMsg.what = COUNTDOWN_AD;
|
||||
newMsg.obj = msg.obj;
|
||||
mBaseHandler.sendMessageDelayed(newMsg, 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,11 +17,9 @@ import androidx.fragment.app.Fragment
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.viewpager.widget.ViewPager
|
||||
import com.gh.common.browse.BrowseTimer
|
||||
import com.gh.common.browse.withLifecycle
|
||||
import com.gh.common.util.NewFlatLogUtils
|
||||
import com.gh.common.util.DirectUtils
|
||||
import com.gh.common.util.NewFlatLogUtils
|
||||
import com.gh.common.util.NewLogUtils
|
||||
import com.gh.common.util.ViewPagerFragmentHelper
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.base.TrackableDialog
|
||||
import com.gh.gamecenter.common.base.adapter.FragmentAdapter
|
||||
@ -74,7 +72,6 @@ class CommunityHomeFragment : LazyFragment() {
|
||||
private var mBottomTabId = ""
|
||||
|
||||
private val browseTimer = BrowseTimer()
|
||||
.withLifecycle(this)
|
||||
.withResult {
|
||||
SensorsBridge.trackCommunityBrowsingDuration(it / 1000.0)
|
||||
}
|
||||
@ -202,13 +199,14 @@ class CommunityHomeFragment : LazyFragment() {
|
||||
mBottomTabId = arguments?.getString(EntranceConsts.KEY_BOTTOM_TAB_ID, "") ?: ""
|
||||
}
|
||||
|
||||
override fun setUserVisibleHint(isVisibleToUser: Boolean) {
|
||||
super.setUserVisibleHint(isVisibleToUser)
|
||||
if (isVisibleToUser) {
|
||||
browseTimer.start()
|
||||
} else {
|
||||
browseTimer.stop()
|
||||
}
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
browseTimer.start()
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
browseTimer.stop()
|
||||
}
|
||||
|
||||
override fun onSaveInstanceState(outState: Bundle) {
|
||||
|
||||
@ -168,10 +168,8 @@ class CustomHomeItemGameTestV2ViewHolder(
|
||||
} else {
|
||||
RIGHT_TEXT_MORE
|
||||
}
|
||||
if (tvRight.text.isBlank()) {
|
||||
tvRight.text = rightText
|
||||
}
|
||||
|
||||
tvRight.text = rightText
|
||||
tvRight.setOnClickListener {
|
||||
if (data.rightTop.text == ALL) {
|
||||
NewFlatLogUtils.logGameTestV2MoreClick(rightText, "自定义页面")
|
||||
|
||||
@ -39,10 +39,12 @@ import com.gh.common.util.DownloadNotificationHelper;
|
||||
import com.gh.common.util.DownloadObserver;
|
||||
import com.gh.common.util.LogUtils;
|
||||
import com.gh.common.util.LunchType;
|
||||
import com.gh.common.util.PackageChangeHelper;
|
||||
import com.gh.common.util.PackageHelper;
|
||||
import com.gh.common.util.PackageUtils;
|
||||
import com.gh.common.util.SignatureRepository;
|
||||
import com.gh.common.videolog.VideoRecordUtils;
|
||||
import com.gh.download.DownloadManager;
|
||||
import com.gh.download.simple.DownloadMessageHandler;
|
||||
import com.gh.download.simple.SimpleDownloadDatabase;
|
||||
import com.gh.gamecenter.BuildConfig;
|
||||
@ -81,6 +83,8 @@ import com.gh.vspace.VHelper;
|
||||
import com.github.piasy.biv.BigImageViewer;
|
||||
import com.github.piasy.biv.loader.fresco.FrescoImageLoader;
|
||||
import com.lg.ndownload.DownloadCore;
|
||||
import com.lightgame.download.DownloadEntity;
|
||||
import com.lightgame.download.DownloadStatus;
|
||||
import com.lightgame.utils.Utils;
|
||||
import com.llew.huawei.verifier.LoadedApkHuaWei;
|
||||
import com.shuyu.gsyvideoplayer.cache.CacheFactory;
|
||||
@ -367,6 +371,9 @@ public class HaloApp extends MultiDexApplication {
|
||||
// 初始化畅玩相关数据
|
||||
retrieveVGameInfoIfNeeded();
|
||||
|
||||
// 移除已安装但还在本地数据库中的包(避免因为没有监听到安装结果导致安装包没有删除的问题)
|
||||
removeInstalledButRemainedPackages();
|
||||
|
||||
// 开发环境不要强制捕获相关异常,这些异常通常是需要处理的
|
||||
if (!BuildConfig.DEBUG) {
|
||||
RxJavaPlugins.setErrorHandler(throwable -> {
|
||||
@ -497,13 +504,7 @@ public class HaloApp extends MultiDexApplication {
|
||||
}
|
||||
|
||||
private void initPackageChangesReceiver() {
|
||||
InstallAndUninstallReceiver receiver = new InstallAndUninstallReceiver();
|
||||
IntentFilter intentFilter = new IntentFilter();
|
||||
intentFilter.addAction(Intent.ACTION_PACKAGE_ADDED);
|
||||
intentFilter.addAction(Intent.ACTION_PACKAGE_REPLACED);
|
||||
intentFilter.addAction(Intent.ACTION_PACKAGE_REMOVED);
|
||||
intentFilter.addDataScheme("package");
|
||||
this.registerReceiver(receiver, intentFilter);
|
||||
ProcessLifecycleOwner.get().getLifecycle().addObserver(PackageChangeHelper.INSTANCE);
|
||||
}
|
||||
|
||||
private void initConnectivityChangesReceiver() {
|
||||
@ -575,6 +576,26 @@ public class HaloApp extends MultiDexApplication {
|
||||
VHelper.init(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除已安装但还在本地数据库中的包
|
||||
*/
|
||||
private void removeInstalledButRemainedPackages() {
|
||||
AppExecutor.getIoExecutor().execute(() -> {
|
||||
for (DownloadEntity downloadEntity : DownloadManager.getInstance().getAllDownloadEntity()) {
|
||||
if (downloadEntity.getStatus() != DownloadStatus.done) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String versionName = downloadEntity.getVersionName();
|
||||
String packageName = downloadEntity.getPackageName();
|
||||
// 这里暴力删除会影响畅玩游戏快速安装功能,但先不管了
|
||||
if (versionName.equals(PackageUtils.getVersionNameByPackageName(packageName))) {
|
||||
DownloadManager.getInstance().cancel(downloadEntity.getUrl());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public boolean isReinstallTheSameVersion() {
|
||||
return mIsReinstallTheSameVersion;
|
||||
}
|
||||
|
||||
@ -129,7 +129,7 @@ ext {
|
||||
|
||||
documentfile = "1.0.1"
|
||||
|
||||
csjVersion = "5.6.2.0"
|
||||
csjVersion = "5.8.0.4.0"
|
||||
|
||||
qGameVersion = "1.57.14"
|
||||
qGameAdVersion = "4.520.1390"
|
||||
|
||||
@ -72,18 +72,19 @@ object CsjAdHelper {
|
||||
*/
|
||||
override fun getDevOaid(): String = oaid
|
||||
})
|
||||
.build(),
|
||||
object : TTVfSdk.InitCallback {
|
||||
override fun success() {
|
||||
Utils.log(TAG, "穿山甲初始化成功")
|
||||
mIsInitialed = true
|
||||
}
|
||||
.build())
|
||||
|
||||
override fun fail(p0: Int, p1: String?) {
|
||||
Utils.log(TAG, "穿山甲初始化失败, $p0 $p1")
|
||||
mIsInitialed = false
|
||||
}
|
||||
})
|
||||
TTVfSdk.start(object : TTVfSdk.Callback {
|
||||
override fun success() {
|
||||
Utils.log(TAG, "穿山甲初始化成功")
|
||||
mIsInitialed = true
|
||||
}
|
||||
|
||||
override fun fail(p0: Int, p1: String?) {
|
||||
Utils.log(TAG, "穿山甲初始化失败, $p0 $p1")
|
||||
mIsInitialed = false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun updateThemeStatus(isDarkMode: Boolean) {
|
||||
@ -124,8 +125,8 @@ object CsjAdHelper {
|
||||
}
|
||||
|
||||
mTTVfNative.loadSphVs(adSlot, object : TTVfNative.CSJSplashAdListener {
|
||||
override fun onSplashLoadSuccess() {
|
||||
Utils.log(TAG, "开屏广告加载成功")
|
||||
override fun onSplashLoadSuccess(p0: CSJSplashAd?) {
|
||||
Utils.log(TAG, "开屏广告加载成功 $p0")
|
||||
}
|
||||
|
||||
override fun onSplashLoadFail(p0: CSJAdError?) {
|
||||
@ -199,7 +200,7 @@ object CsjAdHelper {
|
||||
.setCodeId(slotId) // 广告位id
|
||||
.setSupportDeepLink(true)
|
||||
.setAdCount(1) // 请求广告数量为1到3条
|
||||
.setExpressViewAcceptedSize(expressViewAcceptedSize, 96F) // 期望模板广告view的size,宽度最低为375,单位dp
|
||||
.setExpressViewAcceptedSize(expressViewAcceptedSize, 0F) // 期望模板广告view的size,宽度最低为375,单位dp
|
||||
.setAdLoadType(TTAdLoadType.LOAD) // 推荐使用,用于标注此次的广告请求用途为预加载(当做缓存)还是实时加载,方便后续为开发者优化相关策略
|
||||
.build()
|
||||
|
||||
|
||||
@ -32,6 +32,12 @@
|
||||
</intent-filter>
|
||||
</service>
|
||||
|
||||
<provider
|
||||
android:name="cn.jpush.android.service.InitProvider"
|
||||
android:authorities="${applicationId}.jiguang.InitProvider"
|
||||
android:exported="false"
|
||||
tools:node="remove" />
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
Reference in New Issue
Block a user