16fa9ad4afcd762aea519ff61811386c23d18ddb2Nick Pelly/* 26fa9ad4afcd762aea519ff61811386c23d18ddb2Nick Pelly * Copyright (C) 2012 The Android Open Source Project 36fa9ad4afcd762aea519ff61811386c23d18ddb2Nick Pelly * 46fa9ad4afcd762aea519ff61811386c23d18ddb2Nick Pelly * Licensed under the Apache License, Version 2.0 (the "License"); 56fa9ad4afcd762aea519ff61811386c23d18ddb2Nick Pelly * you may not use this file except in compliance with the License. 66fa9ad4afcd762aea519ff61811386c23d18ddb2Nick Pelly * You may obtain a copy of the License at 76fa9ad4afcd762aea519ff61811386c23d18ddb2Nick Pelly * 86fa9ad4afcd762aea519ff61811386c23d18ddb2Nick Pelly * http://www.apache.org/licenses/LICENSE-2.0 96fa9ad4afcd762aea519ff61811386c23d18ddb2Nick Pelly * 106fa9ad4afcd762aea519ff61811386c23d18ddb2Nick Pelly * Unless required by applicable law or agreed to in writing, software 116fa9ad4afcd762aea519ff61811386c23d18ddb2Nick Pelly * distributed under the License is distributed on an "AS IS" BASIS, 126fa9ad4afcd762aea519ff61811386c23d18ddb2Nick Pelly * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 136fa9ad4afcd762aea519ff61811386c23d18ddb2Nick Pelly * See the License for the specific language governing permissions and 146fa9ad4afcd762aea519ff61811386c23d18ddb2Nick Pelly * limitations under the License. 156fa9ad4afcd762aea519ff61811386c23d18ddb2Nick Pelly */ 166fa9ad4afcd762aea519ff61811386c23d18ddb2Nick Pelly 176fa9ad4afcd762aea519ff61811386c23d18ddb2Nick Pellypackage com.android.location.provider; 186fa9ad4afcd762aea519ff61811386c23d18ddb2Nick Pelly 197ab7f538924371a9dd4be7a27a6ae3b4c04b301cLaurent Tuimport java.util.ArrayList; 206fa9ad4afcd762aea519ff61811386c23d18ddb2Nick Pellyimport java.util.List; 216fa9ad4afcd762aea519ff61811386c23d18ddb2Nick Pelly 226fa9ad4afcd762aea519ff61811386c23d18ddb2Nick Pellyimport android.location.LocationRequest; 236fa9ad4afcd762aea519ff61811386c23d18ddb2Nick Pelly 246fa9ad4afcd762aea519ff61811386c23d18ddb2Nick Pellyimport com.android.internal.location.ProviderRequest; 256fa9ad4afcd762aea519ff61811386c23d18ddb2Nick Pelly 266fa9ad4afcd762aea519ff61811386c23d18ddb2Nick Pelly/** 27b03c8c508dcbbef364e624ad5bc0ab6fa6733dc7Nick Pelly * This class is an interface to Provider Requests for unbundled applications. 28b03c8c508dcbbef364e624ad5bc0ab6fa6733dc7Nick Pelly * 29b03c8c508dcbbef364e624ad5bc0ab6fa6733dc7Nick Pelly * <p>IMPORTANT: This class is effectively a public API for unbundled 30b03c8c508dcbbef364e624ad5bc0ab6fa6733dc7Nick Pelly * applications, and must remain API stable. See README.txt in the root 31b03c8c508dcbbef364e624ad5bc0ab6fa6733dc7Nick Pelly * of this package for more information. 326fa9ad4afcd762aea519ff61811386c23d18ddb2Nick Pelly */ 336fa9ad4afcd762aea519ff61811386c23d18ddb2Nick Pellypublic final class ProviderRequestUnbundled { 346fa9ad4afcd762aea519ff61811386c23d18ddb2Nick Pelly private final ProviderRequest mRequest; 356fa9ad4afcd762aea519ff61811386c23d18ddb2Nick Pelly 366fa9ad4afcd762aea519ff61811386c23d18ddb2Nick Pelly public ProviderRequestUnbundled(ProviderRequest request) { 376fa9ad4afcd762aea519ff61811386c23d18ddb2Nick Pelly mRequest = request; 386fa9ad4afcd762aea519ff61811386c23d18ddb2Nick Pelly } 396fa9ad4afcd762aea519ff61811386c23d18ddb2Nick Pelly 406fa9ad4afcd762aea519ff61811386c23d18ddb2Nick Pelly public boolean getReportLocation() { 416fa9ad4afcd762aea519ff61811386c23d18ddb2Nick Pelly return mRequest.reportLocation; 426fa9ad4afcd762aea519ff61811386c23d18ddb2Nick Pelly } 436fa9ad4afcd762aea519ff61811386c23d18ddb2Nick Pelly 446fa9ad4afcd762aea519ff61811386c23d18ddb2Nick Pelly public long getInterval() { 456fa9ad4afcd762aea519ff61811386c23d18ddb2Nick Pelly return mRequest.interval; 466fa9ad4afcd762aea519ff61811386c23d18ddb2Nick Pelly } 476fa9ad4afcd762aea519ff61811386c23d18ddb2Nick Pelly 4808ca1046fe4f1890f91241f8d082a024ef6cfd93Nick Pelly /** 4908ca1046fe4f1890f91241f8d082a024ef6cfd93Nick Pelly * Never null. 5008ca1046fe4f1890f91241f8d082a024ef6cfd93Nick Pelly */ 517ab7f538924371a9dd4be7a27a6ae3b4c04b301cLaurent Tu public List<LocationRequestUnbundled> getLocationRequests() { 527ab7f538924371a9dd4be7a27a6ae3b4c04b301cLaurent Tu List<LocationRequestUnbundled> result = new ArrayList<LocationRequestUnbundled>( 537ab7f538924371a9dd4be7a27a6ae3b4c04b301cLaurent Tu mRequest.locationRequests.size()); 547ab7f538924371a9dd4be7a27a6ae3b4c04b301cLaurent Tu for (LocationRequest r : mRequest.locationRequests) { 557ab7f538924371a9dd4be7a27a6ae3b4c04b301cLaurent Tu result.add(new LocationRequestUnbundled(r)); 567ab7f538924371a9dd4be7a27a6ae3b4c04b301cLaurent Tu } 577ab7f538924371a9dd4be7a27a6ae3b4c04b301cLaurent Tu return result; 586fa9ad4afcd762aea519ff61811386c23d18ddb2Nick Pelly } 596fa9ad4afcd762aea519ff61811386c23d18ddb2Nick Pelly 606fa9ad4afcd762aea519ff61811386c23d18ddb2Nick Pelly @Override 616fa9ad4afcd762aea519ff61811386c23d18ddb2Nick Pelly public String toString() { 626fa9ad4afcd762aea519ff61811386c23d18ddb2Nick Pelly return mRequest.toString(); 636fa9ad4afcd762aea519ff61811386c23d18ddb2Nick Pelly } 646fa9ad4afcd762aea519ff61811386c23d18ddb2Nick Pelly} 65