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

Commit 87f1209a authored by Henry Liu's avatar Henry Liu
Browse files

Fix [kv-4] PerformBackupTask possible NPE/Wrong package report.

mCurrentPackage is null when package doesn't exist, which lead test
failed with NPE
Use request.packageName for case BackupTransport.AGENT_UNKNOWN instead

Bug: 77272500

Test: m -j RunFrameworksServicesRoboTests ROBOTEST_FILTER=PerformBackupTaskTest
Change-Id: I27be85f0c3f95e36edd92d0d552189fbcf6952dd
parent cf18c86c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -528,7 +528,7 @@ public class PerformBackupTask implements BackupRestoreTask {
                    // we're otherwise fine.  Just drop it and go on to the next as usual.
                    mStatus = BackupTransport.TRANSPORT_OK;
                    BackupObserverUtils
                            .sendBackupOnPackageResult(mObserver, mCurrentPackage.packageName,
                            .sendBackupOnPackageResult(mObserver, request.packageName,
                                    BackupManager.ERROR_PACKAGE_NOT_FOUND);
                } else {
                    // Transport-level failure means we reenqueue everything
+0 −3
Original line number Diff line number Diff line
@@ -468,9 +468,6 @@ public class PerformBackupTaskTest {
        verify(agentMock.agent).onQuotaExceeded(anyLong(), anyLong());
    }

    // TODO: Giving NPE at PerformBackupTask:524 because mCurrentPackage is null (PackageManager
    // rightfully threw NameNotFoundException). Remove @Ignore when fixed.
    @Ignore
    @Test
    public void testRunTask_whenAgentUnknown() throws Exception {
        // Not calling setUpAgent()