Update install failures become visible: blocked, aborted, failed (D-155)
The PackageInstaller session's final status now reaches UpdateRepository: InstallResultReceiver hands it by session id to the waiting AndroidApkInstaller call (ApkInstaller.install returns a PendingInstall). installOutcome() maps STATUS_FAILURE_BLOCKED to UpdateFailure.Blocked, STATUS_FAILURE_ABORTED back to Available without an error, and every other failure to UpdateFailure.Install with the installer's EXTRA_STATUS_MESSAGE. The cached APK is deleted once the installer answers, so "Try again" downloads again. UpdateBanner's Failed variant shows the reason on S-4 and S-22; two core:design strings (en/sv) with their docs/ux/strings.csv rows. Unit tests for the mapping, the repository outcomes and the receiver; goldens: update_banner re-recorded, S-17-install-blocked, S-17-install-failed and s22_about_install_blocked new. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TQd3pEP9UeN2uifbHknQ7B
This commit is contained in:
@@ -18,6 +18,7 @@ import se.hagstedt.kvitt.model.SettlementId
|
||||
import se.hagstedt.kvitt.model.Share
|
||||
import se.hagstedt.kvitt.model.SplitMode
|
||||
import se.hagstedt.kvitt.model.SyncRejectionReason
|
||||
import se.hagstedt.kvitt.model.UpdateFailure
|
||||
import se.hagstedt.kvitt.model.UpdateInfo
|
||||
import se.hagstedt.kvitt.model.UpdateState
|
||||
import se.hagstedt.kvitt.model.UserId
|
||||
@@ -178,6 +179,9 @@ object HomeScenarios {
|
||||
|
||||
val update = UpdateInfo(versionCode = 2, versionName = "1.2", sizeBytes = 8_400_000)
|
||||
|
||||
/** A real `EXTRA_STATUS_MESSAGE` of a signature mismatch (an APK signed with another key). */
|
||||
const val INSTALLER_MESSAGE = "INSTALL_FAILED_UPDATE_INCOMPATIBLE: Existing package se.hagstedt.kvitt signatures do not match newer version; ignoring!"
|
||||
|
||||
/** [household] with version 1.2 available. */
|
||||
val updateAvailable: FakeScenario = household.copy(update = UpdateState.Available(update))
|
||||
|
||||
@@ -190,6 +194,12 @@ object HomeScenarios {
|
||||
/** [household] after a failed download. */
|
||||
val updateFailed: FakeScenario = household.copy(update = UpdateState.Failed(update))
|
||||
|
||||
/** [household] after the phone's security settings blocked the install (D-155). */
|
||||
val updateBlocked: FakeScenario = household.copy(update = UpdateState.Failed(update, UpdateFailure.Blocked))
|
||||
|
||||
/** [household] after another install failure, with the installer's own message (D-155). */
|
||||
val updateInstallFailed: FakeScenario = household.copy(update = UpdateState.Failed(update, UpdateFailure.Install(INSTALLER_MESSAGE)))
|
||||
|
||||
/** Offline with two changes waiting and version 1.2 available (S-4-home-offline). */
|
||||
val offline: FakeScenario = pending.copy(online = false, update = UpdateState.Available(update))
|
||||
|
||||
|
||||
+4
@@ -23,6 +23,7 @@ import se.hagstedt.kvitt.model.SessionState
|
||||
import se.hagstedt.kvitt.model.Share
|
||||
import se.hagstedt.kvitt.model.SplitMode
|
||||
import se.hagstedt.kvitt.model.TemplateId
|
||||
import se.hagstedt.kvitt.model.UpdateFailure
|
||||
import se.hagstedt.kvitt.model.UpdateInfo
|
||||
import se.hagstedt.kvitt.model.UpdateState
|
||||
import se.hagstedt.kvitt.model.User
|
||||
@@ -158,6 +159,9 @@ object SettingsScenarios {
|
||||
/** The update is downloading (S-22). */
|
||||
val updateDownloading: FakeScenario = loaded.copy(update = UpdateState.Downloading(update, 0.64f))
|
||||
|
||||
/** The phone's security settings blocked the install (S-22, D-155). */
|
||||
val updateBlocked: FakeScenario = loaded.copy(update = UpdateState.Failed(update, UpdateFailure.Blocked))
|
||||
|
||||
private val longMe = jacob.copy(displayName = "Jacob Hagstedt-Lindqvist")
|
||||
private val longPartner = anna.copy(displayName = "Anna-Karin Lindqvist-Östergren")
|
||||
private val longAccount = huset.copy(name = "Sommarstugan på Gotland med brygga")
|
||||
|
||||
Reference in New Issue
Block a user