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

Commit ee635e30 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Revert changes to StationaryThrottlingLocationProvider" into...

Merge "Revert changes to StationaryThrottlingLocationProvider" into sc-qpr1-dev am: 7cb45200 am: 06d206da am: eb8fc32d

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

Change-Id: I8891dabf679b779f323fe07f24e762bb1a5f2d2a
parents a10a8181 eb8fc32d
Loading
Loading
Loading
Loading
+8 −17
Original line number Diff line number Diff line
@@ -105,15 +105,20 @@ public final class StationaryThrottlingLocationProvider extends DelegateLocation

        synchronized (mLock) {
            mDeviceIdleHelper.addListener(this);
            onDeviceIdleChanged(mDeviceIdleHelper.isDeviceIdle());
            mDeviceIdle = mDeviceIdleHelper.isDeviceIdle();
            mDeviceStationaryHelper.addListener(this);
            mDeviceStationary = false;
            mDeviceStationaryRealtimeMs = Long.MIN_VALUE;

            onThrottlingChangedLocked(false);
        }
    }

    @Override
    protected void onStop() {
        synchronized (mLock) {
            mDeviceStationaryHelper.removeListener(this);
            mDeviceIdleHelper.removeListener(this);
            onDeviceIdleChanged(false);

            mIncomingRequest = ProviderRequest.EMPTY_REQUEST;
            mOutgoingRequest = ProviderRequest.EMPTY_REQUEST;
@@ -146,27 +151,13 @@ public final class StationaryThrottlingLocationProvider extends DelegateLocation
            }

            mDeviceIdle = deviceIdle;

            if (deviceIdle) {
                // device stationary helper will deliver an immediate listener update
                mDeviceStationaryHelper.addListener(this);
            } else {
                mDeviceStationaryHelper.removeListener(this);
                mDeviceStationary = false;
                mDeviceStationaryRealtimeMs = Long.MIN_VALUE;
            onThrottlingChangedLocked(false);
        }
    }
    }

    @Override
    public void onDeviceStationaryChanged(boolean deviceStationary) {
        synchronized (mLock) {
            if (!mDeviceIdle) {
                // stationary detection is only registered while idle - ignore late notifications
                return;
            }

            if (mDeviceStationary == deviceStationary) {
                return;
            }