summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSoonil Nagarkar <sooniln@google.com>2021-06-09 17:29:11 -0700
committerSoonil Nagarkar <sooniln@google.com>2021-06-09 17:29:11 -0700
commit08cb5412af388d0bbe57df3f07f05faeff8816ca (patch)
treed99b334275fb0ad06194bd67d8414bf8ef58c8d0
parentcdbc555a0b5a4aa061da7dcda5786ddc43eefeb6 (diff)
Minor eventlog and LocationProviderBase cleanups
Change eventlog behavior solely based on logging properties, not the debug build. This allows for reduced logging even on debug builds. Minor updates to LocationProviderBase. Bug: 190609486 Test: manual Change-Id: I1efb28663de7ddd4224b01afe195baf3ff78ddb0
-rw-r--r--location/java/android/location/provider/LocationProviderBase.java16
-rw-r--r--services/core/java/com/android/server/location/eventlog/LocationEventLog.java17
2 files changed, 18 insertions, 15 deletions
diff --git a/location/java/android/location/provider/LocationProviderBase.java b/location/java/android/location/provider/LocationProviderBase.java
index eada22cd94dc..88a24794411c 100644
--- a/location/java/android/location/provider/LocationProviderBase.java
+++ b/location/java/android/location/provider/LocationProviderBase.java
@@ -62,6 +62,10 @@ import java.util.Objects;
* <p>The service should have an intent filter in place for the location provider it wishes to
* implements. Defaults for some providers are specified as constants in this class.
*
+ * <p>Location providers are identified by their UID / package name / attribution tag. Based on this
+ * identity, location providers may be given some special privileges (such as making special
+ * requests to other location providers).
+ *
* @hide
*/
@SystemApi
@@ -95,14 +99,14 @@ public abstract class LocationProviderBase {
public static final String ACTION_FUSED_PROVIDER =
"com.android.location.service.FusedLocationProvider";
- private final String mTag;
- private final @Nullable String mAttributionTag;
- private final IBinder mBinder;
+ final String mTag;
+ final @Nullable String mAttributionTag;
+ final IBinder mBinder;
// write locked on mBinder, read lock is optional depending on atomicity requirements
- private @Nullable volatile ILocationProviderManager mManager;
- private volatile ProviderProperties mProperties;
- private volatile boolean mAllowed;
+ volatile @Nullable ILocationProviderManager mManager;
+ volatile ProviderProperties mProperties;
+ volatile boolean mAllowed;
public LocationProviderBase(@NonNull Context context, @NonNull String tag,
@NonNull ProviderProperties properties) {
diff --git a/services/core/java/com/android/server/location/eventlog/LocationEventLog.java b/services/core/java/com/android/server/location/eventlog/LocationEventLog.java
index 66b23c4d7377..e6d25ece93ef 100644
--- a/services/core/java/com/android/server/location/eventlog/LocationEventLog.java
+++ b/services/core/java/com/android/server/location/eventlog/LocationEventLog.java
@@ -33,7 +33,6 @@ import android.annotation.Nullable;
import android.location.LocationRequest;
import android.location.provider.ProviderRequest;
import android.location.util.identity.CallerIdentity;
-import android.os.Build;
import android.os.PowerManager.LocationPowerSaveMode;
import android.os.SystemClock;
import android.util.ArrayMap;
@@ -47,8 +46,8 @@ public class LocationEventLog extends LocalEventLog {
public static final LocationEventLog EVENT_LOG = new LocationEventLog();
private static int getLogSize() {
- if (Build.IS_DEBUGGABLE || D) {
- return 500;
+ if (D) {
+ return 600;
} else {
return 200;
}
@@ -152,7 +151,7 @@ public class LocationEventLog extends LocalEventLog {
/** Logs a client for a location provider entering the foreground state. */
public void logProviderClientForeground(String provider, CallerIdentity identity) {
- if (Build.IS_DEBUGGABLE || D) {
+ if (D) {
addLogEvent(EVENT_PROVIDER_CLIENT_FOREGROUND, provider, identity);
}
getAggregateStats(provider, identity).markRequestForeground();
@@ -160,7 +159,7 @@ public class LocationEventLog extends LocalEventLog {
/** Logs a client for a location provider leaving the foreground state. */
public void logProviderClientBackground(String provider, CallerIdentity identity) {
- if (Build.IS_DEBUGGABLE || D) {
+ if (D) {
addLogEvent(EVENT_PROVIDER_CLIENT_BACKGROUND, provider, identity);
}
getAggregateStats(provider, identity).markRequestBackground();
@@ -168,14 +167,14 @@ public class LocationEventLog extends LocalEventLog {
/** Logs a client for a location provider entering the permitted state. */
public void logProviderClientPermitted(String provider, CallerIdentity identity) {
- if (Build.IS_DEBUGGABLE || D) {
+ if (D) {
addLogEvent(EVENT_PROVIDER_CLIENT_PERMITTED, provider, identity);
}
}
/** Logs a client for a location provider leaving the permitted state. */
public void logProviderClientUnpermitted(String provider, CallerIdentity identity) {
- if (Build.IS_DEBUGGABLE || D) {
+ if (D) {
addLogEvent(EVENT_PROVIDER_CLIENT_UNPERMITTED, provider, identity);
}
}
@@ -187,7 +186,7 @@ public class LocationEventLog extends LocalEventLog {
/** Logs a new incoming location for a location provider. */
public void logProviderReceivedLocations(String provider, int numLocations) {
- if (Build.IS_DEBUGGABLE || D) {
+ if (D) {
addLogEvent(EVENT_PROVIDER_RECEIVE_LOCATION, provider, numLocations);
}
}
@@ -195,7 +194,7 @@ public class LocationEventLog extends LocalEventLog {
/** Logs a location deliver for a client of a location provider. */
public void logProviderDeliveredLocations(String provider, int numLocations,
CallerIdentity identity) {
- if (Build.IS_DEBUGGABLE || D) {
+ if (D) {
addLogEvent(EVENT_PROVIDER_DELIVER_LOCATION, provider, numLocations, identity);
}
getAggregateStats(provider, identity).markLocationDelivered();