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

Commit 1e59a5f3 authored by Soonil Nagarkar's avatar Soonil Nagarkar
Browse files

Add ignoreLocationSettings to WifiScanner

Give WifiScanner an API to ignore location settings while wifi scanning
for certain requests.

Bug: 119140584
Test: manually
Change-Id: I9bc4cf38c3ea720193dcc87f2c8494afd89a36ec
parent 67d97b4b
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -3812,6 +3812,7 @@ package android.net.wifi {
    ctor public WifiScanner.ScanSettings();
    ctor public WifiScanner.ScanSettings();
    field public int band;
    field public int band;
    field public android.net.wifi.WifiScanner.ChannelSpec[] channels;
    field public android.net.wifi.WifiScanner.ChannelSpec[] channels;
    field public boolean ignoreLocationSettings;
    field public int maxPeriodInMs;
    field public int maxPeriodInMs;
    field public int maxScansToCache;
    field public int maxScansToCache;
    field public int numBssidsPerScan;
    field public int numBssidsPerScan;
+10 −0
Original line number Original line Diff line number Diff line
@@ -250,6 +250,14 @@ public class WifiScanner {
         */
         */
        @RequiresPermission(android.Manifest.permission.NETWORK_STACK)
        @RequiresPermission(android.Manifest.permission.NETWORK_STACK)
        public int type = TYPE_LOW_LATENCY;
        public int type = TYPE_LOW_LATENCY;
        /**
         * This scan request may ignore location settings while receiving scans. This should only
         * be used in emergency situations.
         * {@hide}
         */
        @SystemApi
        @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE)
        public boolean ignoreLocationSettings;


        /** Implement the Parcelable interface {@hide} */
        /** Implement the Parcelable interface {@hide} */
        public int describeContents() {
        public int describeContents() {
@@ -267,6 +275,7 @@ public class WifiScanner {
            dest.writeInt(stepCount);
            dest.writeInt(stepCount);
            dest.writeInt(isPnoScan ? 1 : 0);
            dest.writeInt(isPnoScan ? 1 : 0);
            dest.writeInt(type);
            dest.writeInt(type);
            dest.writeInt(ignoreLocationSettings ? 1 : 0);
            if (channels != null) {
            if (channels != null) {
                dest.writeInt(channels.length);
                dest.writeInt(channels.length);
                for (int i = 0; i < channels.length; i++) {
                for (int i = 0; i < channels.length; i++) {
@@ -301,6 +310,7 @@ public class WifiScanner {
                        settings.stepCount = in.readInt();
                        settings.stepCount = in.readInt();
                        settings.isPnoScan = in.readInt() == 1;
                        settings.isPnoScan = in.readInt() == 1;
                        settings.type = in.readInt();
                        settings.type = in.readInt();
                        settings.ignoreLocationSettings = in.readInt() == 1;
                        int num_channels = in.readInt();
                        int num_channels = in.readInt();
                        settings.channels = new ChannelSpec[num_channels];
                        settings.channels = new ChannelSpec[num_channels];
                        for (int i = 0; i < num_channels; i++) {
                        for (int i = 0; i < num_channels; i++) {