Compare commits

..

9 Commits

Author SHA1 Message Date
da3948228f chore: 版本更新至 5.27.2 2023-06-21 11:39:33 +08:00
2a496b680b Merge branch 'hotfix/v5.27.1-891/emulator_oaid_crash' into 'release'
fix: 修复模拟器上 OAID SDK 闪退的问题,在所有 postInit 操作前初始化 sentry

See merge request halo/android/assistant-android!1152
2023-06-21 11:26:36 +08:00
db535cf281 fix: 修复模拟器上 OAID SDK 闪退的问题,在所有 postInit 操作前初始化 sentry 2023-06-21 11:20:25 +08:00
c199582efc Merge branch 'hotfix/v5.27.1-891/emulator_oaid_crash' into 'release'
fix: 修复模拟器上 OAID SDK 闪退的问题

See merge request halo/android/assistant-android!1151
2023-06-21 11:02:06 +08:00
b53677a118 fix: 修复模拟器上 OAID SDK 闪退的问题 2023-06-21 10:56:24 +08:00
68006dda38 Merge branch 'feature-GHZS-2754' into 'release'
fix:尝试修复部分线上闪退 https://jira.shanqu.cc/browse/GHZS-2754

See merge request halo/android/assistant-android!1149
2023-06-20 17:24:57 +08:00
b5cab193be fix:尝试修复部分线上闪退 https://jira.shanqu.cc/browse/GHZS-2754 2023-06-20 17:24:57 +08:00
bb81d91fd5 Merge branch 'release' of git.shanqu.cc:halo/android/assistant-android into release 2023-06-20 10:32:53 +08:00
eb5c55f046 ci: 处理特殊打包的编译问题 2023-06-19 16:32:29 +08:00
6 changed files with 72 additions and 26 deletions

View File

@ -57,8 +57,7 @@ public class DataUtils {
return;
}
// 初始化 Sentry 约占用 90ms这里切换到子线程初始化
AppExecutor.getIoExecutor().execute(() -> initSentry(context, channel));
initSentry(context, channel);
}
private static void initSentry(Context context, String channel) {

View File

@ -83,7 +83,7 @@ class ForumArticleAskListFragment : LazyListFragment<AnswerEntity, ForumArticleA
mListRv.setBackgroundColor(R.color.background_white.toColor(requireContext()))
mScrollCalculatorHelper = ForumScrollCalculatorHelper(R.id.horizontalVideoView, R.id.verticalVideoView, 0)
requireView().setBackgroundColor(R.color.background_white.toColor(requireContext()))
view?.setBackgroundColor(R.color.background_white.toColor(requireContext()))
mSkeletonScreen = Skeleton.bind(mBinding.listSkeleton)
.shimmer(true)
@ -142,13 +142,16 @@ class ForumArticleAskListFragment : LazyListFragment<AnswerEntity, ForumArticleA
override fun onLoadRefresh() {
super.onLoadRefresh()
requireView().setBackgroundColor(R.color.background_white.toColor(requireContext()))
// Fixhttps://sentry.shanqu.cc/organizations/lightgame/issues/288994/?project=22&query=LazyListFragment&statsPeriod=14d
// Fragment在内存泄露的情况下调用requireView()会触发崩溃这里替换为getView()方法
// TODO 解决Fragment内存泄露的问题
view?.setBackgroundColor(R.color.background_white.toColor(requireContext()))
}
override fun onLoadDone() {
super.onLoadDone()
requireView().setBackgroundColor(Color.TRANSPARENT)
AppExecutor.uiExecutor.executeWithDelay(Runnable {
view?.setBackgroundColor(Color.TRANSPARENT)
mBaseHandler.postDelayed(Runnable {
tryCatchInRelease {
scroll()
mScrollCalculatorHelper?.onScrollStateChanged(mListRv, RecyclerView.SCROLL_STATE_IDLE)
@ -158,12 +161,12 @@ class ForumArticleAskListFragment : LazyListFragment<AnswerEntity, ForumArticleA
override fun onLoadError() {
super.onLoadError()
requireView().setBackgroundColor(Color.TRANSPARENT)
view?.setBackgroundColor(Color.TRANSPARENT)
}
override fun onLoadEmpty() {
super.onLoadEmpty()
requireView().setBackgroundColor(Color.TRANSPARENT)
view?.setBackgroundColor(Color.TRANSPARENT)
}
override fun hideRefreshingLayout() {

View File

@ -289,6 +289,9 @@ public class HaloApp extends MultiDexApplication {
}
private void postInit(long delay) {
// 初始化 sentry
DataUtils.init(this, mChannel);
// 获取/更新 GID 和 读 SP 的操作不需要 delay
DataUtils.getGid();
@ -313,8 +316,6 @@ public class HaloApp extends MultiDexApplication {
MainWrapperRepository.Companion.getInstance().getHomeNavBar();
AppExecutor.getUiExecutor().executeWithDelay(() -> {
initThirdPartySdk();
FixedRateJobHelper.begin();
RegionSettingHelper.getRegionSetting();
@ -382,10 +383,6 @@ public class HaloApp extends MultiDexApplication {
});
}
private void initThirdPartySdk() {
DataUtils.init(this, mChannel);
}
private void initDataHelper() {
VideoRecordUtils.init(this, AppExecutor.getLogExecutor());
}

View File

@ -7,8 +7,8 @@ ext {
targetSdkVersion = 28
// application info (每个大版本之间的 versionCode 增加 20)
versionCode = 891
versionName = "5.27.1"
versionCode = 892
versionName = "5.27.2"
applicationId = "com.gh.gamecenter"
// AndroidX

View File

@ -33,7 +33,14 @@ class OAIDProviderImpl : IOAIDProvider {
if (cachedCert.isNotEmpty()) {
Utils.log(TAG, "使用缓存的证书来初始化 $cachedCert")
val result = MdidSdkHelper.InitCert(context, cachedCert)
var result = false
try {
result = MdidSdkHelper.InitCert(context, cachedCert)
} catch (e: Throwable) {
e.printStackTrace()
Utils.log(TAG, "初始化证书异常 ${e.localizedMessage}")
}
Utils.log(TAG, "初始化证书结果 $result")
@ -52,7 +59,15 @@ class OAIDProviderImpl : IOAIDProvider {
override fun onSuccess(data: CertEntity) {
Utils.log(TAG, "获取到的证书为 ${data.cert}")
val result = MdidSdkHelper.InitCert(context, data.cert)
var result = false
try {
result = MdidSdkHelper.InitCert(context, data.cert)
} catch (e: Throwable) {
e.printStackTrace()
Utils.log(TAG, "初始化证书异常 ${e.localizedMessage}")
}
SPUtils.setString(SP_OAID_CERT, data.cert)
Utils.log(TAG, "初始化证书结果 $result")
@ -68,17 +83,22 @@ class OAIDProviderImpl : IOAIDProvider {
}
private fun getOAIDForReal(context: Context, fromCached: Boolean, callback: (String) -> Unit) {
val code = MdidSdkHelper.InitSdk(context, false, true, false, false) { p0 ->
p0?.oaid?.let {
callback.invoke(it)
try {
val code = MdidSdkHelper.InitSdk(context, false, true, false, false) { p0 ->
p0?.oaid?.let {
callback.invoke(it)
}
}
}
Utils.log(TAG, "获取 OAID 的返回值为 $code")
Utils.log(TAG, "获取 OAID 的返回值为 $code")
// 缓存的证书失效了,访问接口重新获取
if (fromCached && code == 1008616) {
getCertFromServerThenGetOAID(context, callback)
// 缓存的证书失效了,访问接口重新获取
if (fromCached && code == 1008616) {
getCertFromServerThenGetOAID(context, callback)
}
} catch (t: Throwable) {
t.printStackTrace()
Utils.log(TAG, "初始化 OAID 异常")
}
}

View File

@ -45,6 +45,33 @@ android {
buildConfigField "String", "DEV_SA_SERVER_URL", "\"${SA_SERVER_URL}\""
buildConfigField "String", "SA_SERVER_URL", "\"${SA_SERVER_URL}\""
}
tea {
dimension "env"
manifestPlaceholders.put("SENSORS_SCHEME" , "saf547873a")
buildConfigField "String", "DEV_SA_SERVER_URL", "\"${SA_SERVER_URL}\""
buildConfigField "String", "SA_SERVER_URL", "\"${SA_SERVER_URL}\""
}
kuaishou {
dimension "env"
manifestPlaceholders.put("SENSORS_SCHEME" , "saf547873a")
buildConfigField "String", "DEV_SA_SERVER_URL", "\"${SA_SERVER_URL}\""
buildConfigField "String", "SA_SERVER_URL", "\"${SA_SERVER_URL}\""
}
gdt {
dimension "env"
manifestPlaceholders.put("SENSORS_SCHEME" , "saf547873a")
buildConfigField "String", "DEV_SA_SERVER_URL", "\"${SA_SERVER_URL}\""
buildConfigField "String", "SA_SERVER_URL", "\"${SA_SERVER_URL}\""
}
}
compileOptions {