• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2012 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.location.LocationRequest;
20 
21 import com.android.internal.location.ProviderRequest;
22 
23 import java.util.ArrayList;
24 import java.util.List;
25 
26 /**
27  * This class is an interface to Provider Requests for unbundled applications.
28  *
29  * <p>IMPORTANT: This class is effectively a public API for unbundled
30  * applications, and must remain API stable. See README.txt in the root
31  * of this package for more information.
32  */
33 public final class ProviderRequestUnbundled {
34     private final ProviderRequest mRequest;
35 
36     /** @hide */
ProviderRequestUnbundled(ProviderRequest request)37     public ProviderRequestUnbundled(ProviderRequest request) {
38         mRequest = request;
39     }
40 
getReportLocation()41     public boolean getReportLocation() {
42         return mRequest.reportLocation;
43     }
44 
getInterval()45     public long getInterval() {
46         return mRequest.interval;
47     }
48 
isLocationSettingsIgnored()49     public boolean isLocationSettingsIgnored() {
50         return mRequest.locationSettingsIgnored;
51     }
52 
53     /**
54      * Never null.
55      */
getLocationRequests()56     public List<LocationRequestUnbundled> getLocationRequests() {
57         List<LocationRequestUnbundled> result = new ArrayList<>(
58                 mRequest.locationRequests.size());
59         for (LocationRequest r : mRequest.locationRequests) {
60           result.add(new LocationRequestUnbundled(r));
61         }
62         return result;
63     }
64 
65     @Override
toString()66     public String toString() {
67         return mRequest.toString();
68     }
69 }
70