• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2020 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.server.location.provider;
18 
19 import android.annotation.Nullable;
20 import android.location.provider.ProviderRequest;
21 import android.os.Bundle;
22 
23 import com.android.server.location.provider.AbstractLocationProvider.Listener;
24 import com.android.server.location.provider.AbstractLocationProvider.State;
25 
26 /**
27  * Interface for controlling location providers.
28  */
29 interface LocationProviderController {
30 
31     /**
32      * Sets the listener and returns the state at the moment the listener was set. The listener can
33      * expect to receive all state updates from after this point. May be invoked at any time.
34      */
setListener(@ullable Listener listener)35     State setListener(@Nullable Listener listener);
36 
37     /**
38      * Returns true if in the started state.
39      */
isStarted()40     boolean isStarted();
41 
42     /**
43      * Starts the location provider. Must be invoked before any other method (except
44      * {@link #setListener(Listener)}).
45      */
start()46     void start();
47 
48     /**
49      * Stops the location provider. No other methods may be invoked after this method (except
50      * {@link #setListener(Listener)}), until {@link #start()} is called again.
51      */
stop()52     void stop();
53 
54     /**
55      * Sets a new request and worksource for the provider.
56      */
setRequest(ProviderRequest request)57     void setRequest(ProviderRequest request);
58 
59     /**
60      * Requests that any batched locations are flushed.
61      */
flush(Runnable listener)62     void flush(Runnable listener);
63 
64     /**
65      * Sends an extra command to the provider for it to interpret as it likes.
66      */
sendExtraCommand(int uid, int pid, String command, Bundle extras)67     void sendExtraCommand(int uid, int pid, String command, Bundle extras);
68 }
69