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

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

Merge "DO NOT MERGE: Do not hold mLock when calling GNSS HAL" into rvc-dev

parents 18bb8d11 5a0a1d95
Loading
Loading
Loading
Loading
+11 −4
Original line number Diff line number Diff line
@@ -231,7 +231,7 @@ public class LocationManagerService extends ILocationManager.Stub {
    private final AppForegroundHelper mAppForegroundHelper;
    private final LocationUsageLogger mLocationUsageLogger;

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

    private final PassiveLocationProviderManager mPassiveManager;

@@ -381,6 +381,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) {
@@ -602,16 +606,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, mAppOpsHelper, mSettingsHelper,
                    mAppForegroundHelper, mLocationUsageLogger);
            mGnssManagerService.onSystemReady();

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

            // bind to geofence proxy