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

MockProvider

public class MockProvider extends Object implements LocationProviderInterface
A mock location provider used by LocationManagerService to implement test providers. {@hide}

Fields Summary
private final String
mName
private final com.android.internal.location.ProviderProperties
mProperties
private final android.location.ILocationManager
mLocationManager
private final android.location.Location
mLocation
private final android.os.Bundle
mExtras
private int
mStatus
private long
mStatusUpdateTime
private boolean
mHasLocation
private boolean
mHasStatus
private boolean
mEnabled
private static final String
TAG
Constructors Summary
public MockProvider(String name, android.location.ILocationManager locationManager, com.android.internal.location.ProviderProperties properties)


        
              
        if (properties == null) throw new NullPointerException("properties is null");

        mName = name;
        mLocationManager = locationManager;
        mProperties = properties;
        mLocation = new Location(name);
    
Methods Summary
public voidclearLocation()

        mHasLocation = false;
    
public voidclearStatus()

        mHasStatus = false;
        mStatusUpdateTime = 0;
    
public voiddisable()

        mEnabled = false;
    
public voiddump(java.io.FileDescriptor fd, java.io.PrintWriter pw, java.lang.String[] args)

        dump(pw, "");
    
public voiddump(java.io.PrintWriter pw, java.lang.String prefix)

        pw.println(prefix + mName);
        pw.println(prefix + "mHasLocation=" + mHasLocation);
        pw.println(prefix + "mLocation:");
        mLocation.dump(new PrintWriterPrinter(pw), prefix + "  ");
        pw.println(prefix + "mHasStatus=" + mHasStatus);
        pw.println(prefix + "mStatus=" + mStatus);
        pw.println(prefix + "mStatusUpdateTime=" + mStatusUpdateTime);
        pw.println(prefix + "mExtras=" + mExtras);
    
public voidenable()

        mEnabled = true;
    
public java.lang.StringgetName()

        return mName;
    
public com.android.internal.location.ProviderPropertiesgetProperties()

        return mProperties;
    
public intgetStatus(android.os.Bundle extras)

        if (mHasStatus) {
            extras.clear();
            extras.putAll(mExtras);
            return mStatus;
        } else {
            return LocationProvider.AVAILABLE;
        }
    
public longgetStatusUpdateTime()

        return mStatusUpdateTime;
    
public booleanisEnabled()

        return mEnabled;
    
public booleansendExtraCommand(java.lang.String command, android.os.Bundle extras)

        return false;
    
public voidsetLocation(android.location.Location l)

        mLocation.set(l);
        mHasLocation = true;
        if (mEnabled) {
            try {
                mLocationManager.reportLocation(mLocation, false);
            } catch (RemoteException e) {
                Log.e(TAG, "RemoteException calling reportLocation");
            }
        }
    
public voidsetRequest(com.android.internal.location.ProviderRequest request, android.os.WorkSource source)

 
public voidsetStatus(int status, android.os.Bundle extras, long updateTime)

        mStatus = status;
        mStatusUpdateTime = updateTime;
        mExtras.clear();
        if (extras != null) {
            mExtras.putAll(extras);
        }
        mHasStatus = true;