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

Commit 259d6e29 authored by Soonil Nagarkar's avatar Soonil Nagarkar
Browse files

Fix NPE in LocationProviderManager

Bug: 187449017
Test: presubmits
Change-Id: Ieb722a2247f2db2a13c7f526c0de5f6e503fa246
parent ff09af37
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -461,6 +461,12 @@ public class LocationProviderManager extends
            return LocationProviderManager.this;
        }

        @GuardedBy("mLock")
        final boolean onProviderPropertiesChanged() {
            onHighPowerUsageChanged();
            return false;
        }

        @GuardedBy("mLock")
        private void onHighPowerUsageChanged() {
            boolean isUsingHighPower = isUsingHighPower();
@@ -485,9 +491,14 @@ public class LocationProviderManager extends
                Preconditions.checkState(Thread.holdsLock(mLock));
            }

            ProviderProperties properties = getProperties();
            if (properties == null) {
                return false;
            }

            return isActive()
                    && getRequest().getIntervalMillis() < MAX_HIGH_POWER_INTERVAL_MS
                    && getProperties().getPowerUsage() == ProviderProperties.POWER_USAGE_HIGH;
                    && properties.getPowerUsage() == ProviderProperties.POWER_USAGE_HIGH;
        }

        @GuardedBy("mLock")
@@ -2270,6 +2281,10 @@ public class LocationProviderManager extends
            onEnabledChanged(UserHandle.USER_ALL);
        }

        if (!Objects.equals(oldState.properties, newState.properties)) {
            updateRegistrations(Registration::onProviderPropertiesChanged);
        }

        if (mOnLocationTagsChangeListener != null) {
            if (!oldState.extraAttributionTags.equals(newState.extraAttributionTags)
                    || !Objects.equals(oldState.identity, newState.identity)) {