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

Commit e08a5c21 authored by Makoto Onuki's avatar Makoto Onuki
Browse files

Use dedicated thread for sync manager

We get WTF indicating that a message posted onto the BG handler thread wasn't
processed in 10 minutes...

It's either there's some race in SyncJobService, or sometimes the BG thread
is actually very crowded and a message won't be delivered in 10 minutes.

Both are hard to think but let's assign a different thread to exclude the
later hypothesis.

Bug: 78590632
Test: boot and make sure various syncs run.
Change-Id: If63d03885ba0d126a5aac196d3b8a2bc7bd2525d
parent 5d8dfe17
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -68,6 +68,7 @@ import android.os.Binder;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
@@ -454,6 +455,7 @@ public class SyncManager {
        }
    };

    private final HandlerThread mThread;
    private final SyncHandler mSyncHandler;
    private final SyncManagerConstants mConstants;

@@ -604,7 +606,9 @@ public class SyncManager {

        mSyncAdapters = new SyncAdaptersCache(mContext);

        mSyncHandler = new SyncHandler(BackgroundThread.get().getLooper());
        mThread = new HandlerThread("SyncManager", android.os.Process.THREAD_PRIORITY_BACKGROUND);
        mThread.start();
        mSyncHandler = new SyncHandler(mThread.getLooper());

        mSyncAdapters.setListener(new RegisteredServicesCacheListener<SyncAdapterType>() {
            @Override