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

Commit 0a3928ae authored by Soonil Nagarkar's avatar Soonil Nagarkar Committed by Automerger Merge Worker
Browse files

Don't hold wakelocks for passive requests am: eca0b750 am: 97e1cd37

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16265552

Change-Id: Iaeed7edd6629c7e1616947499851d1cb64912fb2
parents 1e468bd5 97e1cd37
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -911,6 +911,9 @@ public class LocationProviderManager extends
                @Override
                public void onPreExecute() {
                    mUseWakeLock = false;

                    // don't acquire a wakelock for passive requests or for mock locations
                    if (getRequest().getIntervalMillis() != LocationRequest.PASSIVE_INTERVAL) {
                        final int size = locationResult.size();
                        for (int i = 0; i < size; ++i) {
                            if (!locationResult.get(i).isMock()) {
@@ -918,11 +921,11 @@ public class LocationProviderManager extends
                                break;
                            }
                        }
                    }

                    // update last delivered location
                    setLastDeliveredLocation(locationResult.getLastLocation());

                    // don't acquire a wakelock for mock locations to prevent abuse
                    if (mUseWakeLock) {
                        mWakeLock.acquire(WAKELOCK_TIMEOUT_MS);
                    }