FusedProxypublic final class FusedProxy extends Object Proxy that helps bind GCore FusedProvider implementations to the Fused Hardware instances. |
Fields Summary |
---|
private final String | TAG | private final com.android.server.ServiceWatcher | mServiceWatcher | private final FusedLocationHardwareSecure | mLocationHardware |
Constructors Summary |
---|
private FusedProxy(android.content.Context context, android.os.Handler handler, android.hardware.location.IFusedLocationHardware locationHardware, int overlaySwitchResId, int defaultServicePackageNameResId, int initialPackageNameResId)Constructor of the class.
This is private as the class follows a factory pattern for construction.
mLocationHardware = new FusedLocationHardwareSecure(
locationHardware,
context,
Manifest.permission.LOCATION_HARDWARE);
Runnable newServiceWork = new Runnable() {
@Override
public void run() {
bindProvider(mLocationHardware);
}
};
// prepare the connection to the provider
mServiceWatcher = new ServiceWatcher(
context,
TAG,
"com.android.location.service.FusedProvider",
overlaySwitchResId,
defaultServicePackageNameResId,
initialPackageNameResId,
newServiceWork,
handler);
|
Methods Summary |
---|
private void | bindProvider(android.hardware.location.IFusedLocationHardware locationHardware)Helper function to bind the FusedLocationHardware to the appropriate FusedProvider instance.
IFusedProvider provider = IFusedProvider.Stub.asInterface(mServiceWatcher.getBinder());
if (provider == null) {
Log.e(TAG, "No instance of FusedProvider found on FusedLocationHardware connected.");
return;
}
try {
provider.onFusedLocationHardwareChange(locationHardware);
} catch (RemoteException e) {
Log.e(TAG, e.toString());
}
| public static com.android.server.location.FusedProxy | createAndBind(android.content.Context context, android.os.Handler handler, android.hardware.location.IFusedLocationHardware locationHardware, int overlaySwitchResId, int defaultServicePackageNameResId, int initialPackageNameResId)Creates an instance of the proxy and binds it to the appropriate FusedProvider.
FusedProxy fusedProxy = new FusedProxy(
context,
handler,
locationHardware,
overlaySwitchResId,
defaultServicePackageNameResId,
initialPackageNameResId);
// try to bind the Fused provider
if (!fusedProxy.mServiceWatcher.start()) {
return null;
}
return fusedProxy;
|
|