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

GeofenceProxy

public final class GeofenceProxy extends Object
hide

Fields Summary
private static final String
TAG
private static final String
SERVICE_ACTION
private final com.android.server.ServiceWatcher
mServiceWatcher
private final android.content.Context
mContext
private final android.location.IGpsGeofenceHardware
mGpsGeofenceHardware
private final android.location.IFusedGeofenceHardware
mFusedGeofenceHardware
private final Object
mLock
private android.hardware.location.IGeofenceHardware
mGeofenceHardware
private static final int
GEOFENCE_PROVIDER_CONNECTED
private static final int
GEOFENCE_HARDWARE_CONNECTED
private static final int
GEOFENCE_HARDWARE_DISCONNECTED
private static final int
GEOFENCE_GPS_HARDWARE_CONNECTED
private static final int
GEOFENCE_GPS_HARDWARE_DISCONNECTED
private Runnable
mRunnable
private android.content.ServiceConnection
mServiceConnection
private android.os.Handler
mHandler
Constructors Summary
private GeofenceProxy(android.content.Context context, int overlaySwitchResId, int defaultServicePackageNameResId, int initialPackageNamesResId, android.os.Handler handler, android.location.IGpsGeofenceHardware gpsGeofence, android.location.IFusedGeofenceHardware fusedGeofenceHardware)

        mContext = context;
        mServiceWatcher = new ServiceWatcher(context, TAG, SERVICE_ACTION, overlaySwitchResId,
            defaultServicePackageNameResId, initialPackageNamesResId, mRunnable, handler);
        mGpsGeofenceHardware = gpsGeofence;
        mFusedGeofenceHardware = fusedGeofenceHardware;
        bindHardwareGeofence();
    
Methods Summary
private booleanbindGeofenceProvider()

        return mServiceWatcher.start();
    
private voidbindHardwareGeofence()

        mContext.bindServiceAsUser(new Intent(mContext, GeofenceHardwareService.class),
                mServiceConnection, Context.BIND_AUTO_CREATE, UserHandle.OWNER);
    
public static com.android.server.location.GeofenceProxycreateAndBind(android.content.Context context, int overlaySwitchResId, int defaultServicePackageNameResId, int initialPackageNamesResId, android.os.Handler handler, android.location.IGpsGeofenceHardware gpsGeofence, android.location.IFusedGeofenceHardware fusedGeofenceHardware)


        
               
                 
              
        GeofenceProxy proxy = new GeofenceProxy(context, overlaySwitchResId,
            defaultServicePackageNameResId, initialPackageNamesResId, handler, gpsGeofence,
            fusedGeofenceHardware);
        if (proxy.bindGeofenceProvider()) {
            return proxy;
        } else {
            return null;
        }
    
private voidsetFusedGeofenceLocked()

        try {
            mGeofenceHardware.setFusedGeofenceHardware(mFusedGeofenceHardware);
        } catch(RemoteException e) {
            Log.e(TAG, "Error while connecting to GeofenceHardwareService");
        }
    
private voidsetGeofenceHardwareInProviderLocked()


       
        try {
            IGeofenceProvider provider = IGeofenceProvider.Stub.asInterface(
                      mServiceWatcher.getBinder());
            if (provider != null) {
                provider.setGeofenceHardware(mGeofenceHardware);
            }
        } catch (RemoteException e) {
            Log.e(TAG, "Remote Exception: setGeofenceHardwareInProviderLocked: " + e);
        }
    
private voidsetGpsGeofenceLocked()

        try {
            mGeofenceHardware.setGpsGeofenceHardware(mGpsGeofenceHardware);
        } catch (RemoteException e) {
            Log.e(TAG, "Error while connecting to GeofenceHardwareService");
        }