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

Commit 092d4c0e authored by Varun Shah's avatar Varun Shah
Browse files

Catch NoSuchElementException in SyncManager.

There is a possibility that the sync adapter active context
was never registered with the IBinder - catch the exception
and log a wtf when this occurs.

Change-Id: I7b5f552c82df336a7ea481cb6db1b99d33c736b4
Fixes: 322389817
Test: builds/flashes
parent 220ea939
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -138,6 +138,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Objects;
import java.util.Random;
import java.util.Set;
@@ -3870,8 +3871,12 @@ public class SyncManager {
            final SyncStorageEngine.EndPoint info = syncOperation.target;

            if (activeSyncContext.mIsLinkedToDeath) {
                try {
                    activeSyncContext.mSyncAdapter.asBinder().unlinkToDeath(activeSyncContext, 0);
                    activeSyncContext.mIsLinkedToDeath = false;
                } catch (NoSuchElementException e) {
                    Slog.wtf(TAG, "Failed to unlink active sync adapter to death", e);
                }
            }
            final long elapsedTime = SystemClock.elapsedRealtime() - activeSyncContext.mStartTime;
            String historyMessage;