fix(xbox): say to sign in again when Microsoft rejects the download's licenses

This commit is contained in:
maxjivi05 authored and MaxsTechReview committed 2026-10-24 09:07:13 -04:00
1 parent a66d7d74a4
commit 6855dd4467
36 files changed
+62 -2

No files matched your search

@@ -44,7 +44,12 @@ internal class XboxInstaller(private val app: Context, private val item: Catalog
Xodus.start(app, listOf("streaming", source, guestFolder, "--market", market,
"--progress-json", "--control-stdin") + selection).use { process ->
child = process
val diagnostics = Xodus.diagnostics(process)
val rejected = AtomicBoolean(false)
val rejectedLine = Regex(Xodus.SIGN_IN_REJECTED)
val diagnostics = Xodus.diagnostics(process) { line ->
StoresState.logLine("Xbox: $line")
if (line.matches(rejectedLine)) rejected.set(true)
}
if (cancelled.get()) process.process.destroy()
process.process.inputStream.bufferedReader().useLines { lines -> lines.forEach { line ->
if (line.startsWith("NEXUS_PROGRESS ")) {
@@ -63,6 +68,7 @@ internal class XboxInstaller(private val app: Context, private val item: Catalog
check(process.process.waitFor(15, TimeUnit.SECONDS)) { "Xbox installer did not exit." }
diagnostics.join(2000)
if (cancelled.get()) return null
check(!rejected.get()) { app.getString(com.droiddeck.launcher.R.string.stores_xbox_sign_in_again) }
check(process.process.exitValue() == 0 && complete) { "Xbox download did not complete. Resume to retry with fresh licenses." }
}
if (content) {
@@ -150,11 +150,13 @@ internal object Xodus {
}
}
const val SIGN_IN_REJECTED = "Microsoft content licensing rejected sign-in \\(HTTP [0-9]{3}\\)\\. Sign in again in Settings\\."
/** Passes the backend's known stderr diagnostics to [report]; other stderr text never leaves the process. */
fun diagnostics(child: Child, report: (String) -> Unit = { com.droiddeck.launcher.stores.StoresState.logLine("Xbox: $it") }): Thread = Thread({
runCatching {
child.process.errorStream.bufferedReader().useLines { lines -> lines.forEach { line ->
if (line.matches(Regex("NEXUS_CREDENTIAL_ERROR_V1 [a-z-]{1,48}|NEXUS_LIBRARY_DIAGNOSTIC_V1 [a-z-]{1,48} [0-9]{1,3} [0-9]{1,6}|NEXUS_SESSION_DIAGNOSTIC_V1 [a-z-]{1,64}|Account library unavailable \\([a-z-]{1,64}\\); credentials and installed games are unchanged\\.|Account library timed out; installed games are unchanged\\.|Xbox profile is temporarily unavailable \\([a-z-]{1,48}\\); stored account is unchanged\\.|Xbox profile request timed out; stored account is unchanged\\.")))
if (line.matches(Regex("NEXUS_CREDENTIAL_ERROR_V1 [a-z-]{1,48}|NEXUS_LIBRARY_DIAGNOSTIC_V1 [a-z-]{1,48} [0-9]{1,3} [0-9]{1,6}|NEXUS_SESSION_DIAGNOSTIC_V1 [a-z-]{1,64}|Account library unavailable \\([a-z-]{1,64}\\); credentials and installed games are unchanged\\.|Account library timed out; installed games are unchanged\\.|Xbox profile is temporarily unavailable \\([a-z-]{1,48}\\); stored account is unchanged\\.|Xbox profile request timed out; stored account is unchanged\\.|NEXUS_CONTENT_LICENSE_DIAGNOSTIC_V1 [a-z-]{1,48} [0-9]{3}|$SIGN_IN_REJECTED")))
report(line)
} }
}