Merge "Throttle wifi scan requests from background apps (1/2)." into oc-dev

am: afd8d9e2b2

Change-Id: I92ca90c34a9fadeabf324a84ec41772dcdebc57f
This commit is contained in:
Wei Wang
2017-04-28 01:01:55 +00:00
committed by android-build-merger
3 changed files with 20 additions and 9 deletions

View File

@@ -7717,7 +7717,22 @@ public final class Settings {
public static final String LOCATION_BACKGROUND_THROTTLE_PACKAGE_WHITELIST =
"location_background_throttle_package_whitelist";
/**
/**
* The interval in milliseconds at which wifi scan requests will be throttled when they are
* coming from the background.
* @hide
*/
public static final String WIFI_SCAN_BACKGROUND_THROTTLE_INTERVAL_MS =
"wifi_scan_background_throttle_interval_ms";
/**
* Packages that are whitelisted to be exempt for wifi background throttling.
* @hide
*/
public static final String WIFI_SCAN_BACKGROUND_THROTTLE_PACKAGE_WHITELIST =
"wifi_scan_background_throttle_package_whitelist";
/**
* Whether TV will switch to MHL port when a mobile device is plugged in.
* (0 = false, 1 = true)
* @hide

View File

@@ -81,7 +81,7 @@ interface IWifiManager
boolean disableNetwork(int netId);
void startScan(in ScanSettings requested, in WorkSource ws);
void startScan(in ScanSettings requested, in WorkSource ws, in String packageName);
List<ScanResult> getScanResults(String callingPackage);

View File

@@ -1457,19 +1457,15 @@ public class WifiManager {
* @return {@code true} if the operation succeeded, i.e., the scan was initiated
*/
public boolean startScan() {
try {
mService.startScan(null, null);
return true;
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
return startScan(null);
}
/** @hide */
@SystemApi
public boolean startScan(WorkSource workSource) {
try {
mService.startScan(null, workSource);
String packageName = mContext.getOpPackageName();
mService.startScan(null, workSource, packageName);
return true;
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();