Merge "Minor eventlog and LocationProviderBase cleanups" into sc-dev am: a33024568e
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14926611 Change-Id: I1b19ba7d9d23ee253d96798bb5dca4d016fa2390
This commit is contained in:
@@ -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
|
* <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.
|
* 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
|
* @hide
|
||||||
*/
|
*/
|
||||||
@SystemApi
|
@SystemApi
|
||||||
@@ -95,14 +99,14 @@ public abstract class LocationProviderBase {
|
|||||||
public static final String ACTION_FUSED_PROVIDER =
|
public static final String ACTION_FUSED_PROVIDER =
|
||||||
"com.android.location.service.FusedLocationProvider";
|
"com.android.location.service.FusedLocationProvider";
|
||||||
|
|
||||||
private final String mTag;
|
final String mTag;
|
||||||
private final @Nullable String mAttributionTag;
|
final @Nullable String mAttributionTag;
|
||||||
private final IBinder mBinder;
|
final IBinder mBinder;
|
||||||
|
|
||||||
// write locked on mBinder, read lock is optional depending on atomicity requirements
|
// write locked on mBinder, read lock is optional depending on atomicity requirements
|
||||||
private @Nullable volatile ILocationProviderManager mManager;
|
volatile @Nullable ILocationProviderManager mManager;
|
||||||
private volatile ProviderProperties mProperties;
|
volatile ProviderProperties mProperties;
|
||||||
private volatile boolean mAllowed;
|
volatile boolean mAllowed;
|
||||||
|
|
||||||
public LocationProviderBase(@NonNull Context context, @NonNull String tag,
|
public LocationProviderBase(@NonNull Context context, @NonNull String tag,
|
||||||
@NonNull ProviderProperties properties) {
|
@NonNull ProviderProperties properties) {
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ import android.annotation.Nullable;
|
|||||||
import android.location.LocationRequest;
|
import android.location.LocationRequest;
|
||||||
import android.location.provider.ProviderRequest;
|
import android.location.provider.ProviderRequest;
|
||||||
import android.location.util.identity.CallerIdentity;
|
import android.location.util.identity.CallerIdentity;
|
||||||
import android.os.Build;
|
|
||||||
import android.os.PowerManager.LocationPowerSaveMode;
|
import android.os.PowerManager.LocationPowerSaveMode;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.util.ArrayMap;
|
import android.util.ArrayMap;
|
||||||
@@ -47,8 +46,8 @@ public class LocationEventLog extends LocalEventLog {
|
|||||||
public static final LocationEventLog EVENT_LOG = new LocationEventLog();
|
public static final LocationEventLog EVENT_LOG = new LocationEventLog();
|
||||||
|
|
||||||
private static int getLogSize() {
|
private static int getLogSize() {
|
||||||
if (Build.IS_DEBUGGABLE || D) {
|
if (D) {
|
||||||
return 500;
|
return 600;
|
||||||
} else {
|
} else {
|
||||||
return 200;
|
return 200;
|
||||||
}
|
}
|
||||||
@@ -152,7 +151,7 @@ public class LocationEventLog extends LocalEventLog {
|
|||||||
|
|
||||||
/** Logs a client for a location provider entering the foreground state. */
|
/** Logs a client for a location provider entering the foreground state. */
|
||||||
public void logProviderClientForeground(String provider, CallerIdentity identity) {
|
public void logProviderClientForeground(String provider, CallerIdentity identity) {
|
||||||
if (Build.IS_DEBUGGABLE || D) {
|
if (D) {
|
||||||
addLogEvent(EVENT_PROVIDER_CLIENT_FOREGROUND, provider, identity);
|
addLogEvent(EVENT_PROVIDER_CLIENT_FOREGROUND, provider, identity);
|
||||||
}
|
}
|
||||||
getAggregateStats(provider, identity).markRequestForeground();
|
getAggregateStats(provider, identity).markRequestForeground();
|
||||||
@@ -160,7 +159,7 @@ public class LocationEventLog extends LocalEventLog {
|
|||||||
|
|
||||||
/** Logs a client for a location provider leaving the foreground state. */
|
/** Logs a client for a location provider leaving the foreground state. */
|
||||||
public void logProviderClientBackground(String provider, CallerIdentity identity) {
|
public void logProviderClientBackground(String provider, CallerIdentity identity) {
|
||||||
if (Build.IS_DEBUGGABLE || D) {
|
if (D) {
|
||||||
addLogEvent(EVENT_PROVIDER_CLIENT_BACKGROUND, provider, identity);
|
addLogEvent(EVENT_PROVIDER_CLIENT_BACKGROUND, provider, identity);
|
||||||
}
|
}
|
||||||
getAggregateStats(provider, identity).markRequestBackground();
|
getAggregateStats(provider, identity).markRequestBackground();
|
||||||
@@ -168,14 +167,14 @@ public class LocationEventLog extends LocalEventLog {
|
|||||||
|
|
||||||
/** Logs a client for a location provider entering the permitted state. */
|
/** Logs a client for a location provider entering the permitted state. */
|
||||||
public void logProviderClientPermitted(String provider, CallerIdentity identity) {
|
public void logProviderClientPermitted(String provider, CallerIdentity identity) {
|
||||||
if (Build.IS_DEBUGGABLE || D) {
|
if (D) {
|
||||||
addLogEvent(EVENT_PROVIDER_CLIENT_PERMITTED, provider, identity);
|
addLogEvent(EVENT_PROVIDER_CLIENT_PERMITTED, provider, identity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Logs a client for a location provider leaving the permitted state. */
|
/** Logs a client for a location provider leaving the permitted state. */
|
||||||
public void logProviderClientUnpermitted(String provider, CallerIdentity identity) {
|
public void logProviderClientUnpermitted(String provider, CallerIdentity identity) {
|
||||||
if (Build.IS_DEBUGGABLE || D) {
|
if (D) {
|
||||||
addLogEvent(EVENT_PROVIDER_CLIENT_UNPERMITTED, provider, identity);
|
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. */
|
/** Logs a new incoming location for a location provider. */
|
||||||
public void logProviderReceivedLocations(String provider, int numLocations) {
|
public void logProviderReceivedLocations(String provider, int numLocations) {
|
||||||
if (Build.IS_DEBUGGABLE || D) {
|
if (D) {
|
||||||
addLogEvent(EVENT_PROVIDER_RECEIVE_LOCATION, provider, numLocations);
|
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. */
|
/** Logs a location deliver for a client of a location provider. */
|
||||||
public void logProviderDeliveredLocations(String provider, int numLocations,
|
public void logProviderDeliveredLocations(String provider, int numLocations,
|
||||||
CallerIdentity identity) {
|
CallerIdentity identity) {
|
||||||
if (Build.IS_DEBUGGABLE || D) {
|
if (D) {
|
||||||
addLogEvent(EVENT_PROVIDER_DELIVER_LOCATION, provider, numLocations, identity);
|
addLogEvent(EVENT_PROVIDER_DELIVER_LOCATION, provider, numLocations, identity);
|
||||||
}
|
}
|
||||||
getAggregateStats(provider, identity).markLocationDelivered();
|
getAggregateStats(provider, identity).markLocationDelivered();
|
||||||
|
|||||||
Reference in New Issue
Block a user