Skip to content

Commit

Permalink
Fix split installs
Browse files Browse the repository at this point in the history
  • Loading branch information
fynngodau committed Sep 22, 2024
1 parent 1887759 commit 85bd1c9
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions vending-app/src/main/java/org/microg/vending/delivery/Delivery.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,19 @@ suspend fun HttpClient.requestDownloadUrls(
}
Log.d(TAG, "requestDownloadUrls languages: $languages")

val headers = buildRequestHeaders(
auth = auth.authToken,
// TODO: understand behavior. Using proper Android ID doesn't work when downloading split APKs
androidId = if (requestSplitPackages != null) 1 else auth.gsfId.toLong(16),
languages
).minus(
// TODO: understand behavior. According to tests, these headers break split install queries but may be needed for normal ones
(if (requestSplitPackages != null) listOf("X-DFE-Encoded-Targets", "X-DFE-Phenotype", "X-DFE-Device-Id", "X-DFE-Client-Id") else emptyList()).toSet()
)

val response = get(
url = requestUrl.toString(),
headers = buildRequestHeaders(auth.authToken, auth.gsfId.toLong(16), languages),
headers = headers,
adapter = GoogleApiResponse.ADAPTER
)
Log.d(TAG, "requestDownloadUrls end response -> $response")
Expand All @@ -71,7 +81,11 @@ suspend fun HttpClient.requestDownloadUrls(
}
}

val components = (listOf(basePackage) + splitComponents).filterNotNull()
val components = if (requestSplitPackages != null) {
splitComponents
} else {
listOf(basePackage) + splitComponents
}.filterNotNull()

Log.d(TAG, "requestDownloadUrls end -> $components")

Expand Down

0 comments on commit 85bd1c9

Please sign in to comment.