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

Commit 11e23956 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Do not hold mLock when calling GNSS HAL"

parents 4c90ca37 1b112642
Loading
Loading
Loading
Loading
+11 −4
Original line number Diff line number Diff line
@@ -256,7 +256,7 @@ public class LocationManagerService extends ILocationManager.Stub {

    private final GeofenceManager mGeofenceManager;

    @Nullable private GnssManagerService mGnssManagerService = null;
    @Nullable private volatile GnssManagerService mGnssManagerService = null;

    private final PassiveLocationProviderManager mPassiveManager;

@@ -405,6 +405,10 @@ public class LocationManagerService extends ILocationManager.Stub {
            // prepare providers
            initializeProvidersLocked();
        }

        // initialize gnss last because it has no awareness of boot phases and blindly assumes that
        // all other location providers are loaded at initialization
        initializeGnss();
    }

    private void onAppOpChanged(String packageName) {
@@ -626,16 +630,19 @@ public class LocationManagerService extends ILocationManager.Stub {
            }
            manager.setMockProvider(new MockProvider(properties));
        }
    }

        // initialize gnss last because it has no awareness of boot phases and blindly assumes that
        // all other location providers are loaded at initialization
    private void initializeGnss() {
        // Do not hold mLock when calling GnssManagerService#isGnssSupported() which calls into HAL.
        if (GnssManagerService.isGnssSupported()) {
            mGnssManagerService = new GnssManagerService(mContext, mUserInfoHelper, mSettingsHelper,
                    mAppOpsHelper, mAppForegroundHelper, mLocationUsageLogger);
            mGnssManagerService.onSystemReady();

            LocationProviderManager gnssManager = new LocationProviderManager(GPS_PROVIDER);
            synchronized (mLock) {
                mProviderManagers.add(gnssManager);
            }
            gnssManager.setRealProvider(mGnssManagerService.getGnssLocationProvider());

            // bind to geofence proxy