FileDocCategorySizeDatePackage
LocationRequestStatistics.javaAPI DocAndroid 5.1 API7209Thu Mar 12 22:22:42 GMT 2015com.android.server.location

LocationRequestStatistics

public class LocationRequestStatistics extends Object
Holds statistics for location requests (active requests by provider).

Must be externally synchronized.

Fields Summary
private static final String
TAG
public final HashMap
statistics
Constructors Summary
Methods Summary
public voidstartRequesting(java.lang.String packageName, java.lang.String providerName, long intervalMs)
Signals that a package has started requesting locations.

param
packageName Name of package that has requested locations.
param
providerName Name of provider that is requested (e.g. "gps").
param
intervalMs The interval that is requested in ms.


                                             
            
        PackageProviderKey key = new PackageProviderKey(packageName, providerName);
        PackageStatistics stats = statistics.get(key);
        if (stats == null) {
            stats = new PackageStatistics();
            statistics.put(key, stats);
        }
        stats.startRequesting(intervalMs);
    
public voidstopRequesting(java.lang.String packageName, java.lang.String providerName)
Signals that a package has stopped requesting locations.

param
packageName Name of package that has stopped requesting locations.
param
providerName Provider that is no longer being requested.

        PackageProviderKey key = new PackageProviderKey(packageName, providerName);
        PackageStatistics stats = statistics.get(key);
        if (stats != null) {
            stats.stopRequesting();
        } else {
            // This shouldn't be a possible code path.
            Log.e(TAG, "Couldn't find package statistics when removing location request.");
        }