1 /* 2 * Copyright (C) 2013 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.location.provider; 18 19 import android.hardware.location.IFusedLocationHardware; 20 import android.location.IFusedProvider; 21 import android.os.IBinder; 22 23 /** 24 * Base class for Fused providers implemented as unbundled services. 25 * 26 * <p>Fused providers can be implemented as services and return the result of 27 * {@link com.android.location.provider.FusedProvider#getBinder()} in its getBinder() method. 28 * 29 * <p>IMPORTANT: This class is effectively a public API for unbundled applications, and must remain 30 * API stable. See README.txt in the root of this package for more information. 31 */ 32 public abstract class FusedProvider { 33 private IFusedProvider.Stub mProvider = new IFusedProvider.Stub() { 34 @Override 35 public void onFusedLocationHardwareChange(IFusedLocationHardware instance) { 36 setFusedLocationHardware(new FusedLocationHardware(instance)); 37 } 38 }; 39 40 /** 41 * Gets the Binder associated with the provider. 42 * This is intended to be used for the onBind() method of a service that implements a fused 43 * service. 44 * 45 * @return The IBinder instance associated with the provider. 46 */ 47 public IBinder getBinder() { 48 return mProvider; 49 } 50 51 /** 52 * Sets the FusedLocationHardware instance in the provider.. 53 * @param value The instance to set. This can be null in cases where the service connection 54 * is disconnected. 55 */ 56 public abstract void setFusedLocationHardware(FusedLocationHardware value); 57 } 58