Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit afd8d9e2 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

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

parents 2b6bf2f2 cdbffa98
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -7717,6 +7717,21 @@ 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)
+1 −1
Original line number Diff line number Diff line
@@ -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);

+3 −7
Original line number Diff line number Diff line
@@ -1429,19 +1429,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();