Home | History | Annotate | Download | only in provider
      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     public ProviderRequestUnbundled(ProviderRequest request) {
     37         mRequest = request;
     38     }
     39 
     40     public boolean getReportLocation() {
     41         return mRequest.reportLocation;
     42     }
     43 
     44     public long getInterval() {
     45         return mRequest.interval;
     46     }
     47 
     48     /**
     49      * Never null.
     50      */
     51     public List<LocationRequestUnbundled> getLocationRequests() {
     52         List<LocationRequestUnbundled> result = new ArrayList<LocationRequestUnbundled>(
     53                 mRequest.locationRequests.size());
     54         for (LocationRequest r : mRequest.locationRequests) {
     55           result.add(new LocationRequestUnbundled(r));
     56         }
     57         return result;
     58     }
     59 
     60     @Override
     61     public String toString() {
     62         return mRequest.toString();
     63     }
     64 }
     65