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

Commit c38e2af0 authored by Michal Karpinski's avatar Michal Karpinski Committed by Android (Google) Code Review
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
parents 5df218c5 b81243f5
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 -----