FusedProvider.java revision 1af4b0280af406cfc7eb46810f6b76e57b983e11
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 17package com.android.location.provider; 18 19import android.hardware.location.IFusedLocationHardware; 20import android.location.IFusedProvider; 21import 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 * @hide 33 */ 34public abstract class FusedProvider { 35 private IFusedProvider.Stub mProvider = new IFusedProvider.Stub() { 36 @Override 37 public void onFusedLocationHardwareChange(IFusedLocationHardware instance) { 38 setFusedLocationHardware(new FusedLocationHardware(instance)); 39 } 40 }; 41 42 /** 43 * Gets the Binder associated with the provider. 44 * This is intended to be used for the onBind() method of a service that implements a fused 45 * service. 46 * 47 * @return The IBinder instance associated with the provider. 48 */ 49 public IBinder getBinder() { 50 return mProvider; 51 } 52 53 /** 54 * Sets the FusedLocationHardware instance in the provider.. 55 * @param value The instance to set. This can be null in cases where the service connection 56 * is disconnected. 57 */ 58 public abstract void setFusedLocationHardware(FusedLocationHardware value); 59} 60