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

Commit eff323bf authored by Steve Kondik's avatar Steve Kondik Committed by Gerrit Code Review
Browse files

backup: Fix a system server crash

 * If we get into a state where the backup data is null, system server
   will go down in flames. Abort and kill any active agents if this
   happens.

java.lang.NullPointerException: Attempt to invoke virtual method 'java.io.FileDescriptor android.os.ParcelFileDescriptor.getFileDescriptor()' on a null object reference
        at com.android.server.backup.BackupManagerService$PerformBackupTask.operationComplete(BackupManagerService.java:2820)
        at com.android.server.backup.BackupManagerService$BackupHandler.handleMessage(BackupManagerService.java:778)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:135)
        at android.os.HandlerThread.run(HandlerThread.java:61)

Change-Id: I65cb3c7d75a417373e8a59b9150a61b5eb1939af
parent e5cddac3
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -2817,6 +2817,12 @@ public class BackupManagerService {
            // Okay, the agent successfully reported back to us!
            final String pkgName = mCurrentPackage.packageName;
            final long filepos = mBackupDataName.length();
            if (mBackupDataName == null) {
                failAgent(mAgentBinder, "Backup data was null: " + mBackupDataName);
                addBackupTrace("backup data was null: " + mBackupDataName);
                agentErrorCleanup();
                return;
            }
            FileDescriptor fd = mBackupData.getFileDescriptor();
            try {
                // If it's a 3rd party app, see whether they wrote any protected keys