This fixes a problem where applications could ask the location manager to do very heavy-weight things (like... say... update location every minute), which would get accounted against the system instead of the application because ultimately it is the system making the heavy calls (wake locks, etc). To solve this, we introduce a new class WorkSource representing the source of some work. Wake locks and Wifi locks allow you to set the source to use (but only if you are system code and thus can get the permission to do so), which is what will be reported to the battery stats until the actual caller. For the initial implementation, the location manager keeps track of all clients requesting periodic updates, and tells its providers about them as a WorkSource param when setting their min update time. The network location provider uses this to set the source on the wake and wifi locks it acquires, when doing work because of the update period. This should also be used elsewhere, such as in the GPS provider, but this is a good start. Change-Id: I2b6ffafad9e90ecf15d7c502e2db675fd52ae3cf
54 lines
1.7 KiB
Plaintext
54 lines
1.7 KiB
Plaintext
/*
|
|
* Copyright (C) 2009 The Android Open Source Project
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
package android.location;
|
|
|
|
import android.location.Criteria;
|
|
import android.location.Location;
|
|
import android.net.NetworkInfo;
|
|
import android.os.Bundle;
|
|
import android.os.WorkSource;
|
|
|
|
/**
|
|
* Binder interface for services that implement location providers.
|
|
*
|
|
* {@hide}
|
|
*/
|
|
interface ILocationProvider {
|
|
boolean requiresNetwork();
|
|
boolean requiresSatellite();
|
|
boolean requiresCell();
|
|
boolean hasMonetaryCost();
|
|
boolean supportsAltitude();
|
|
boolean supportsSpeed();
|
|
boolean supportsBearing();
|
|
int getPowerRequirement();
|
|
boolean meetsCriteria(in Criteria criteria);
|
|
int getAccuracy();
|
|
void enable();
|
|
void disable();
|
|
int getStatus(out Bundle extras);
|
|
long getStatusUpdateTime();
|
|
String getInternalState();
|
|
void enableLocationTracking(boolean enable);
|
|
void setMinTime(long minTime, in WorkSource ws);
|
|
void updateNetworkState(int state, in NetworkInfo info);
|
|
void updateLocation(in Location location);
|
|
boolean sendExtraCommand(String command, inout Bundle extras);
|
|
void addListener(int uid);
|
|
void removeListener(int uid);
|
|
}
|