diff options
| author | 2021-10-08 16:26:41 +0000 | |
|---|---|---|
| committer | 2021-10-08 16:26:41 +0000 | |
| commit | 7cb452002e46fd725c638b562365602defd0daec (patch) | |
| tree | 265b28f15f3fe3cc37bc0abf027841609c3c8b9d | |
| parent | 373ed0127e73fc9d78a077078333704893a77b81 (diff) | |
| parent | 67884d6edd603c12864e85dc348fc39e3bbe0f70 (diff) | |
Merge "Revert changes to StationaryThrottlingLocationProvider" into sc-qpr1-dev
| -rw-r--r-- | services/core/java/com/android/server/location/provider/StationaryThrottlingLocationProvider.java | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/services/core/java/com/android/server/location/provider/StationaryThrottlingLocationProvider.java b/services/core/java/com/android/server/location/provider/StationaryThrottlingLocationProvider.java index cc51cea05160..22a675ad39ab 100644 --- a/services/core/java/com/android/server/location/provider/StationaryThrottlingLocationProvider.java +++ b/services/core/java/com/android/server/location/provider/StationaryThrottlingLocationProvider.java @@ -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); - } + 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; } |