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 java.util.ArrayList; 20 import java.util.List; 21 22 import android.location.LocationRequest; 23 24 import com.android.internal.location.ProviderRequest; 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 */ 37 public ProviderRequestUnbundled(ProviderRequest request) { 38 mRequest = request; 39 } 40 41 public boolean getReportLocation() { 42 return mRequest.reportLocation; 43 } 44 45 public long getInterval() { 46 return mRequest.interval; 47 } 48 49 /** 50 * Never null. 51 */ 52 public List<LocationRequestUnbundled> getLocationRequests() { 53 List<LocationRequestUnbundled> result = new ArrayList<LocationRequestUnbundled>( 54 mRequest.locationRequests.size()); 55 for (LocationRequest r : mRequest.locationRequests) { 56 result.add(new LocationRequestUnbundled(r)); 57 } 58 return result; 59 } 60 61 @Override 62 public String toString() { 63 return mRequest.toString(); 64 } 65 } 66