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

Commit 62290187 authored by Nextbit's avatar Nextbit Committed by Brint E. Kriebel
Browse files

BackupMangerService: Pass result code in non-interactive calls

Non-interactive calls are made by Nextbit.  Continue to expose
detailed error codes for all failures.

Also:
- avoid overwriting the non-okay result codes; and
- re-enable version mismatches enforcement.

Change-Id: I54983d8f270285942db20eaff1e6de4229ec781e
parent 4277f7dc
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -3714,7 +3714,8 @@ class BackupManagerService extends IBackupManager.Stub {
                        }

                        // The path needs to be canonical
                        if (info.path.contains("..") || info.path.contains("//")) {
                        // but check and overwrite result only if the operation hasn't already failed
                        if (okay && (info.path.contains("..") || info.path.contains("//"))) {
                            if (MORE_DEBUG) {
                                Slog.w(TAG, "Dropping invalid path " + info.path);
                            }
@@ -3903,8 +3904,14 @@ class BackupManagerService extends IBackupManager.Stub {
                result = RESULT_UNKNOWN_ERROR;
            }

            // The result for a single file is significant to non-interactive calls.
            // For all other non-interactive calls, fail open and allow adb to continue restoring.
            if (mNoninteractive) {
                return result;
            } else {
                return (info == null) ? result : CONTINUE_RESTORE;
            }
        }

        void setUpPipes() throws IOException {
            mPipes = ParcelFileDescriptor.createPipe();
@@ -5752,7 +5759,7 @@ class BackupManagerService extends IBackupManager.Stub {
        params.observer = observer;
        params.noninteractive = true;
        params.ignoreEncryptionPasswordCheck = ignoreEncryptionPasswordCheck;
        params.ignoreVersionMismatchCheck = true;
        params.ignoreVersionMismatchCheck = false;
        mWakelock.acquire();
        Message msg = mBackupHandler.obtainMessage(MSG_RUN_FULL_RESTORE, params);
        mBackupHandler.sendMessage(msg);