mirror of
https://github.com/microg/android_packages_apps_GmsCore
synced 2026-08-06 14:26:05 -04:00
Vending: Handle absent derived APK IDs in acquire requests
This commit is contained in:
parent
9a206ae115
commit
0a829c0dae
2 changed files with 25 additions and 15 deletions
|
|
@ -263,13 +263,19 @@ message ClientInfo {
|
|||
string oldSkuPurchaseId = 17;
|
||||
}
|
||||
optional int32 versionCode1 = 18;
|
||||
optional UnKnownMessage21 unKnownMessage21 = 21;
|
||||
oneof DerivedApkInfo {
|
||||
DerivedApkId derivedApkId = 21;
|
||||
DerivedApkIdAbsent derivedApkIdAbsent = 22;
|
||||
}
|
||||
optional string skuPackageSignatureSha256 = 23;
|
||||
optional AccountNameMessage secondaryAccount = 24;
|
||||
}
|
||||
|
||||
message UnKnownMessage21 {
|
||||
optional int32 unknown1 = 1;
|
||||
message DerivedApkId {
|
||||
optional int32 derivedId = 1;
|
||||
}
|
||||
|
||||
message DerivedApkIdAbsent {
|
||||
}
|
||||
|
||||
message UnkMessage1 {
|
||||
|
|
@ -1457,4 +1463,4 @@ enum SessionRestoreOption {
|
|||
SESSION_RESTORE_OPTION_REQUIRE = 2;
|
||||
SESSION_RESTORE_OPTION_TRY = 3;
|
||||
SESSION_RESTORE_OPTION_STORE = 4;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -146,6 +146,13 @@ class IAPCore(
|
|||
|
||||
val skuPackageName = params.buyFlowParams.skuParams["skuPackageName"] ?: clientInfo.pkgName
|
||||
val extendedPackageInfo = ExtendedPackageInfo(context, skuPackageName as String)
|
||||
val derivedApkId = runCatching {
|
||||
context.packageManager
|
||||
.getApplicationInfo(skuPackageName, PackageManager.GET_META_DATA)
|
||||
.metaData
|
||||
?.getInt("com.android.vending.derived.apk.id", 0)
|
||||
?.takeIf { it != 0 }
|
||||
}.getOrNull()
|
||||
val docId = if (params.buyFlowParams.skuSerializedDockIdList?.isNotEmpty() == true) {
|
||||
val sDocIdBytes = Base64.decode(params.buyFlowParams.skuSerializedDockIdList[0], Base64.URL_SAFE + Base64.NO_WRAP)
|
||||
DocId.ADAPTER.decode(sDocIdBytes)
|
||||
|
|
@ -193,16 +200,13 @@ class IAPCore(
|
|||
this.oldSkuPurchaseToken = null
|
||||
this.oldSkuPurchaseId = params.buyFlowParams.oldSkuPurchaseId
|
||||
}
|
||||
unKnownMessage21 = UnKnownMessage21.Builder().apply {
|
||||
val pkg = skuPackageName as? String ?: return@apply
|
||||
this.unknown1 = runCatching {
|
||||
context.packageManager
|
||||
.getApplicationInfo(pkg, PackageManager.GET_META_DATA)
|
||||
.metaData
|
||||
?.getInt("com.android.vending.derived.apk.id", 0)
|
||||
?.takeIf { it != 0 }
|
||||
}.getOrNull()
|
||||
}.build()
|
||||
if (derivedApkId != null) {
|
||||
this.derivedApkId = DerivedApkId.Builder().apply {
|
||||
this.derivedId = derivedApkId
|
||||
}.build()
|
||||
} else {
|
||||
this.derivedApkIdAbsent = DerivedApkIdAbsent.Builder().build()
|
||||
}
|
||||
this.skuPackageSignatureSha256 = extendedPackageInfo.firstCertificateSha256?.toBase64(11)
|
||||
this.secondaryAccount = AccountNameMessage.Builder().apply {
|
||||
this.accountName = params.buyFlowParams.accountName
|
||||
|
|
@ -395,4 +399,4 @@ class IAPCore(
|
|||
throw RuntimeException("Network request failed. message=${e.message}")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue