GeofenceProxypublic final class GeofenceProxy extends Object
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 boolean | bindGeofenceProvider()
return mServiceWatcher.start();
| private void | bindHardwareGeofence()
mContext.bindServiceAsUser(new Intent(mContext, GeofenceHardwareService.class),
mServiceConnection, Context.BIND_AUTO_CREATE, UserHandle.OWNER);
| public static com.android.server.location.GeofenceProxy | createAndBind(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 void | setFusedGeofenceLocked()
try {
mGeofenceHardware.setFusedGeofenceHardware(mFusedGeofenceHardware);
} catch(RemoteException e) {
Log.e(TAG, "Error while connecting to GeofenceHardwareService");
}
| private void | setGeofenceHardwareInProviderLocked()
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 void | setGpsGeofenceLocked()
try {
mGeofenceHardware.setGpsGeofenceHardware(mGpsGeofenceHardware);
} catch (RemoteException e) {
Log.e(TAG, "Error while connecting to GeofenceHardwareService");
}
|
|