Additional location logging
Bug: 210934408 Test: presubmits Change-Id: I6b5f837810af636c66af73510f67813c54148393
This commit is contained in:
@@ -31,6 +31,7 @@ import static android.os.PowerManager.LOCATION_MODE_ALL_DISABLED_WHEN_SCREEN_OFF
|
||||
import static android.os.PowerManager.LOCATION_MODE_FOREGROUND_ONLY;
|
||||
import static android.os.PowerManager.LOCATION_MODE_GPS_DISABLED_WHEN_SCREEN_OFF;
|
||||
import static android.os.PowerManager.LOCATION_MODE_THROTTLE_REQUESTS_WHEN_SCREEN_OFF;
|
||||
import static android.os.UserHandle.USER_CURRENT;
|
||||
|
||||
import static com.android.server.location.LocationManagerService.D;
|
||||
import static com.android.server.location.LocationManagerService.TAG;
|
||||
@@ -872,6 +873,10 @@ public class LocationProviderManager extends
|
||||
MAX_FASTEST_INTERVAL_JITTER_MS);
|
||||
if (deltaMs
|
||||
< getRequest().getMinUpdateIntervalMillis() - maxJitterMs) {
|
||||
if (D) {
|
||||
Log.v(TAG, mName + " provider registration " + getIdentity()
|
||||
+ " dropped delivery - too fast");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -881,6 +886,10 @@ public class LocationProviderManager extends
|
||||
if (smallestDisplacementM > 0.0 && location.distanceTo(
|
||||
mPreviousLocation)
|
||||
<= smallestDisplacementM) {
|
||||
if (D) {
|
||||
Log.v(TAG, mName + " provider registration " + getIdentity()
|
||||
+ " dropped delivery - too close");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -898,7 +907,8 @@ public class LocationProviderManager extends
|
||||
if (!mAppOpsHelper.noteOpNoThrow(LocationPermissions.asAppOp(getPermissionLevel()),
|
||||
getIdentity())) {
|
||||
if (D) {
|
||||
Log.w(TAG, "noteOp denied for " + getIdentity());
|
||||
Log.w(TAG,
|
||||
mName + " provider registration " + getIdentity() + " noteOp denied");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -1482,7 +1492,7 @@ public class LocationProviderManager extends
|
||||
public boolean isEnabled(int userId) {
|
||||
if (userId == UserHandle.USER_NULL) {
|
||||
return false;
|
||||
} else if (userId == UserHandle.USER_CURRENT) {
|
||||
} else if (userId == USER_CURRENT) {
|
||||
return isEnabled(mUserHelper.getCurrentUserId());
|
||||
}
|
||||
|
||||
@@ -1655,7 +1665,7 @@ public class LocationProviderManager extends
|
||||
}
|
||||
}
|
||||
return lastLocation;
|
||||
} else if (userId == UserHandle.USER_CURRENT) {
|
||||
} else if (userId == USER_CURRENT) {
|
||||
return getLastLocationUnsafe(mUserHelper.getCurrentUserId(), permissionLevel,
|
||||
isBypass, maximumAgeMs);
|
||||
}
|
||||
@@ -1700,7 +1710,7 @@ public class LocationProviderManager extends
|
||||
setLastLocation(location, runningUserIds[i]);
|
||||
}
|
||||
return;
|
||||
} else if (userId == UserHandle.USER_CURRENT) {
|
||||
} else if (userId == USER_CURRENT) {
|
||||
setLastLocation(location, mUserHelper.getCurrentUserId());
|
||||
return;
|
||||
}
|
||||
@@ -2383,13 +2393,13 @@ public class LocationProviderManager extends
|
||||
filtered = locationResult.filter(location -> {
|
||||
if (!location.isMock()) {
|
||||
if (location.getLatitude() == 0 && location.getLongitude() == 0) {
|
||||
Log.w(TAG, "blocking 0,0 location from " + mName + " provider");
|
||||
Log.e(TAG, "blocking 0,0 location from " + mName + " provider");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!location.isComplete()) {
|
||||
Log.w(TAG, "blocking incomplete location from " + mName + " provider");
|
||||
Log.e(TAG, "blocking incomplete location from " + mName + " provider");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2407,6 +2417,12 @@ public class LocationProviderManager extends
|
||||
filtered = locationResult;
|
||||
}
|
||||
|
||||
Location last = getLastLocationUnsafe(USER_CURRENT, PERMISSION_FINE, true, Long.MAX_VALUE);
|
||||
if (last != null && locationResult.get(0).getElapsedRealtimeNanos()
|
||||
< last.getElapsedRealtimeNanos()) {
|
||||
Log.e(TAG, "non-monotonic location received from " + mName + " provider");
|
||||
}
|
||||
|
||||
// update last location
|
||||
setLastLocation(filtered.getLastLocation(), UserHandle.USER_ALL);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user