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

Commit a620d340 authored by Soonil Nagarkar's avatar Soonil Nagarkar
Browse files

Switch ServiceWatcher clients to fg thread

Location should run on foreground thread so it is not blocked by other
components making disk reads/db access/etc...

Test: manually
Change-Id: I2a8a37db920f4324cb0115bcde959a9c9a54ada4
parent 260d75ff
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ import android.os.IBinder;
import android.os.RemoteException;
import android.util.Log;

import com.android.internal.os.BackgroundThread;
import com.android.server.FgThread;
import com.android.server.ServiceWatcher;

/**
@@ -84,7 +84,7 @@ public class ActivityRecognitionProxy {
                overlaySwitchResId,
                defaultServicePackageNameResId,
                initialPackageNameResId,
                BackgroundThread.getHandler()) {
                FgThread.getHandler()) {
            @Override
            protected void onBind() {
                runOnBinder(ActivityRecognitionProxy.this::initializeService);
+2 −2
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ import android.location.Address;
import android.location.GeocoderParams;
import android.location.IGeocodeProvider;

import com.android.internal.os.BackgroundThread;
import com.android.server.FgThread;
import com.android.server.ServiceWatcher;

import java.util.List;
@@ -53,7 +53,7 @@ public class GeocoderProxy {
            int initialPackageNamesResId) {
        mServiceWatcher = new ServiceWatcher(context, TAG, SERVICE_ACTION, overlaySwitchResId,
                defaultServicePackageNameResId, initialPackageNamesResId,
                BackgroundThread.getHandler());
                FgThread.getHandler());
    }

    private boolean bind() {
+2 −2
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ import android.os.RemoteException;
import android.os.UserHandle;
import android.util.Log;

import com.android.internal.os.BackgroundThread;
import com.android.server.FgThread;
import com.android.server.ServiceWatcher;

/**
@@ -82,7 +82,7 @@ public final class GeofenceProxy {
        mContext = context;
        mServiceWatcher = new ServiceWatcher(context, TAG, SERVICE_ACTION, overlaySwitchResId,
                defaultServicePackageNameResId, initialPackageNamesResId,
                BackgroundThread.getHandler()) {
                FgThread.getHandler()) {
            @Override
            protected void onBind() {
                runOnBinder(mUpdateGeofenceHardware);
+2 −2
Original line number Diff line number Diff line
@@ -31,8 +31,8 @@ import com.android.internal.location.ILocationProvider;
import com.android.internal.location.ILocationProviderManager;
import com.android.internal.location.ProviderProperties;
import com.android.internal.location.ProviderRequest;
import com.android.internal.os.BackgroundThread;
import com.android.internal.os.TransferPipe;
import com.android.server.FgThread;
import com.android.server.LocationManagerService;
import com.android.server.ServiceWatcher;

@@ -105,7 +105,7 @@ public class LocationProviderProxy extends AbstractLocationProvider {

        mServiceWatcher = new ServiceWatcher(context, TAG, action, overlaySwitchResId,
                defaultServicePackageNameResId, initialPackageNamesResId,
                BackgroundThread.getHandler()) {
                FgThread.getHandler()) {

            @Override
            protected void onBind() {