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

Commit 5c1469e5 authored by Wei Wang's avatar Wei Wang Committed by android-build-merger
Browse files

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

am: afd8d9e2

Change-Id: I92ca90c34a9fadeabf324a84ec41772dcdebc57f
parents a02972ed afd8d9e2
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
@@ -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();