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

Commit 970525ef authored by Michal Karpinski's avatar Michal Karpinski Committed by android-build-merger
Browse files

Merge "Offload the mRunningFullBackupTask.handleCancel() call from the main...

Merge "Offload the mRunningFullBackupTask.handleCancel() call from the main thread to another thread" into oc-dev
am: c38e2af0

Change-Id: I60cc10f8c1e734c5c701cf461ed1f18c3c1d10fa
parents 92502878 c38e2af0
Loading
Loading
Loading
Loading
+16 −6
Original line number Diff line number Diff line
@@ -5641,14 +5641,24 @@ public class BackupManagerService {
    // The job scheduler says our constraints don't hold any more,
    // so tear down any ongoing backup task right away.
    void endFullBackup() {
        // offload the mRunningFullBackupTask.handleCancel() call to another thread,
        // as we might have to wait for mCancelLock
        Runnable endFullBackupRunnable = new Runnable() {
            @Override
            public void run() {
                PerformFullTransportBackupTask pftbt = null;
                synchronized (mQueueLock) {
                    if (mRunningFullBackupTask != null) {
                        if (DEBUG_SCHEDULING) {
                            Slog.i(TAG, "Telling running backup to stop");
                        }
                mRunningFullBackupTask.handleCancel(true);
                        pftbt = mRunningFullBackupTask;
                    }
                }
                pftbt.handleCancel(true);
            }
        };
        new Thread(endFullBackupRunnable, "end-full-backup").start();
    }
    // ----- Restore infrastructure -----