Merge "Revert changes to StationaryThrottlingLocationProvider" into sc-qpr1-dev am: 7cb452002e
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16008807 Change-Id: I78d66dbfb98d0bd8f5db7df46185cfe48a83279b
This commit is contained in:
@@ -105,15 +105,20 @@ public final class StationaryThrottlingLocationProvider extends DelegateLocation
|
|||||||
|
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
mDeviceIdleHelper.addListener(this);
|
mDeviceIdleHelper.addListener(this);
|
||||||
onDeviceIdleChanged(mDeviceIdleHelper.isDeviceIdle());
|
mDeviceIdle = mDeviceIdleHelper.isDeviceIdle();
|
||||||
|
mDeviceStationaryHelper.addListener(this);
|
||||||
|
mDeviceStationary = false;
|
||||||
|
mDeviceStationaryRealtimeMs = Long.MIN_VALUE;
|
||||||
|
|
||||||
|
onThrottlingChangedLocked(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop() {
|
protected void onStop() {
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
|
mDeviceStationaryHelper.removeListener(this);
|
||||||
mDeviceIdleHelper.removeListener(this);
|
mDeviceIdleHelper.removeListener(this);
|
||||||
onDeviceIdleChanged(false);
|
|
||||||
|
|
||||||
mIncomingRequest = ProviderRequest.EMPTY_REQUEST;
|
mIncomingRequest = ProviderRequest.EMPTY_REQUEST;
|
||||||
mOutgoingRequest = ProviderRequest.EMPTY_REQUEST;
|
mOutgoingRequest = ProviderRequest.EMPTY_REQUEST;
|
||||||
@@ -146,27 +151,13 @@ public final class StationaryThrottlingLocationProvider extends DelegateLocation
|
|||||||
}
|
}
|
||||||
|
|
||||||
mDeviceIdle = deviceIdle;
|
mDeviceIdle = deviceIdle;
|
||||||
|
onThrottlingChangedLocked(false);
|
||||||
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
|
@Override
|
||||||
public void onDeviceStationaryChanged(boolean deviceStationary) {
|
public void onDeviceStationaryChanged(boolean deviceStationary) {
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
if (!mDeviceIdle) {
|
|
||||||
// stationary detection is only registered while idle - ignore late notifications
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mDeviceStationary == deviceStationary) {
|
if (mDeviceStationary == deviceStationary) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user