mirror of
https://github.com/screentinker/screentinker.git
synced 2026-06-21 05:32:34 -06:00
fix(player): OTA install silently fails on Android 14+ (explicit PendingIntent)
UpdateChecker.tryPackageInstaller built the INSTALL_COMPLETE status PendingIntent with FLAG_MUTABLE and an implicit intent. On Android 14+ (target SDK 34) that combination is disallowed - getBroadcast() throws, the inner catch swallows it, and the PackageInstaller session is never committed. Result: every OTA silently fails to install on a 14+ device (download succeeds, version never changes). Make the intent explicit via setPackage(), keeping FLAG_MUTABLE so PackageInstaller can still write EXTRA_STATUS back. Emulator-proven on Android 16 (API 36): "Package installer session committed" and the update applies. Distinct from the relaunch bug - this is install-on-14+. Part of #96. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
8d03741713
commit
5bcaca7c51
|
|
@ -221,9 +221,15 @@ class UpdateChecker(private val context: Context) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// #96 (install bug): the status PendingIntent must stay FLAG_MUTABLE so
|
||||||
|
// PackageInstaller can write EXTRA_STATUS back into it - but on Android 14+
|
||||||
|
// (target SDK 34+) a FLAG_MUTABLE PendingIntent with an *implicit* intent is
|
||||||
|
// disallowed and getBroadcast() throws, silently aborting every OTA on 14+.
|
||||||
|
// Make the intent explicit (setPackage) so mutable is allowed; it also keeps
|
||||||
|
// the broadcast to our own RECEIVER_NOT_EXPORTED receiver.
|
||||||
val pendingIntent = android.app.PendingIntent.getBroadcast(
|
val pendingIntent = android.app.PendingIntent.getBroadcast(
|
||||||
context, sessionId,
|
context, sessionId,
|
||||||
Intent("com.remotedisplay.player.INSTALL_COMPLETE"),
|
Intent("com.remotedisplay.player.INSTALL_COMPLETE").setPackage(context.packageName),
|
||||||
android.app.PendingIntent.FLAG_MUTABLE
|
android.app.PendingIntent.FLAG_MUTABLE
|
||||||
)
|
)
|
||||||
session.commit(pendingIntent.intentSender)
|
session.commit(pendingIntent.intentSender)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue