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

Commit 015df962 authored by Michal Karpinski's avatar Michal Karpinski
Browse files

Eliminate a race condition that could lead to calling PBT#finalizeBackup() twice

Calling finalizeBackup() the second time will most probably lead to underholding
the wakelock and system crash.

Bug: 63156509
Test: manual
Change-Id: Ic995ba4a65d749b80bf1f1d226d35a279a0d1b25
parent cf694ade
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -2822,11 +2822,11 @@ public class BackupManagerService implements BackupManagerServiceInterface {
                        break;
                    case FINAL:
                        if (!mFinished) finalizeBackup();
                        else {
                            Slog.e(TAG, "Duplicate finish");
                        if (!mFinished) {
                            finalizeBackup();
                        } else {
                            Slog.e(TAG, "Duplicate finish of K/V pass");
                        }
                        mFinished = true;
                        break;
                }
            }
@@ -3180,6 +3180,7 @@ public class BackupManagerService implements BackupManagerServiceInterface {
                        break;
                }
            }
            mFinished = true;
            Slog.i(BackupManagerService.TAG, "K/V backup pass finished.");
            // Only once we're entirely finished do we release the wakelock for k/v backup.
            mWakelock.release();