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

Commit 65d1a771 authored by Bernardo Rufino's avatar Bernardo Rufino Committed by Android (Google) Code Review
Browse files

Merge "Add null check for full-backup task"

parents da711183 8fe7b59a
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -756,7 +756,9 @@ public class KeyValueBackupTask implements BackupRestoreTask, Runnable {
            BackupObserverUtils.sendBackupFinished(mObserver, BackupManager.ERROR_BACKUP_CANCELLED);
        } else {
            mListener.onFinished(callerLogString);
            if (mFullBackupTask != null) {
                mFullBackupTask.unregisterTask();
            }
            switch (mStatus) {
                case BackupTransport.TRANSPORT_OK:
                case BackupTransport.TRANSPORT_QUOTA_EXCEEDED:
+11 −0
Original line number Diff line number Diff line
@@ -1584,6 +1584,17 @@ public class KeyValueBackupTaskTest {
                new RuntimeException().toString());
    }

    @Test
    public void testRunTask_whenBackupRunning_doesNotThrow() throws Exception {
        TransportMock transportMock = setUpInitializedTransport(mTransport);
        when(mBackupManagerService.isBackupOperationInProgress()).thenReturn(true);
        KeyValueBackupTask task =
                createKeyValueBackupTask(
                        transportMock.transportClient, mTransport.transportDirName);

        runTask(task);
    }

    private void runTask(KeyValueBackupTask task) {
        // Pretend we are not on the main-thread to prevent RemoteCall from complaining
        mShadowMainLooper.setCurrentThread(false);