Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit aa74ed12 authored by Joël Stemmer's avatar Joël Stemmer
Browse files

Set `mStatus` when `dispatchNextRestore` encounters a transport error

`PerformUnifiedRestoreTask` is a state-machine that is responsible for
restoring the backups a given set of packages. At every point in this
process it's possible for a transport error to occur. This is treated as
a fatal error, immediately moving the state machine into the `FINAL`
state.

The `mStatus` variable is used to indicate the result in the
`RestoreObserver.restoreFinished` callback. A non-zero value for
`mStatus` indicates something failed during restore.

`dispatchNextRestore` is the only place in this state machine where a
transport error does not set `mStatus` to `TRANSPORT_ERROR`, even though
the state is set to `FINAL`. As a result, the `RestoreObserver` listener
is likely to wrongly assume that the restore succeeded in this
particular case.

Bug: 283932000
Test: atest services/tests/mockingservicestests/src/com/android/server/backup
Test: Manual testing with custom build that returns an error in `dispatchNextRestore`.
Change-Id: I769e8200ad4ac12b58dbb8c8181b21ff9933453a
parent 8bbff97a
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -732,6 +732,7 @@ public class PerformUnifiedRestoreTask implements BackupRestoreTask {
                    BackupManagerMonitor.LOG_EVENT_CATEGORY_BACKUP_MANAGER_POLICY,
                    monitoringExtras);
            EventLog.writeEvent(EventLogTags.RESTORE_TRANSPORT_FAILURE);
            mStatus = BackupTransport.TRANSPORT_ERROR;
            nextState = UnifiedRestoreState.FINAL;
        } finally {
            executeNextState(nextState);