1 /*
2  * Copyright (C) 2021 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.annotation.SystemApi;
20 import android.location.Location;
21 
22 /**
23  * Base class for sinks to interact with FusedLocationHardware.
24  *
25  * <p>Default implementations allow new methods to be added without crashing
26  * clients compiled against an old library version.
27  *
28  * @deprecated This class may no longer be used from Android P and onwards.
29  * @hide
30  */
31 @Deprecated
32 @SystemApi
33 public class FusedLocationHardwareSink {
34     /**
35      * Called when one or more locations are available from the FLP
36      * HAL.
37      */
onLocationAvailable(Location[] locations)38     public void onLocationAvailable(Location[] locations) {
39         // default do nothing
40     }
41 
42     /**
43      * Called when diagnostic data is available from the FLP HAL.
44      */
onDiagnosticDataAvailable(String data)45     public void onDiagnosticDataAvailable(String data) {
46         // default do nothing
47     }
48 
49     /**
50      * Called when capabilities are available from the FLP HAL.
51      * Should be called once right after initialization.
52      *
53      * @param capabilities A bitmask of capabilities defined in
54      *                     fused_location.h.
55      */
onCapabilities(int capabilities)56     public void onCapabilities(int capabilities) {
57         // default do nothing
58     }
59 
60     /**
61      * Called when the status changes in the underlying FLP HAL
62      * implementation (the ability to compute location).  This
63      * callback will only be made on version 2 or later
64      * (see {@link FusedLocationHardware#getVersion()}).
65      *
66      * @param status One of FLP_STATUS_LOCATION_AVAILABLE or
67      *               FLP_STATUS_LOCATION_UNAVAILABLE as defined in
68      *               fused_location.h.
69      */
onStatusChanged(int status)70     public void onStatusChanged(int status) {
71         // default do nothing
72     }
73 }
74