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

Commit daf215cf authored by Vinit Deshpande's avatar Vinit Deshpande
Browse files

Support scanning using band specification instead of channels

This change enables scanning with band specification instead of channels,
this should ease app development.

Also includes a bug fix for parcel serialization/deserialization.

Change-Id: Idbffce4805b403bf8fe1efae999cb828e09c2420
parent e344cb22
Loading
Loading
Loading
Loading
+41 −23
Original line number Diff line number Diff line
@@ -153,6 +153,8 @@ public class WifiScanner {
            dest.writeInt(band);
            dest.writeInt(periodInMs);
            dest.writeInt(reportEvents);

            if (channels != null) {
                dest.writeInt(channels.length);

                for (int i = 0; i < channels.length; i++) {
@@ -160,6 +162,9 @@ public class WifiScanner {
                    dest.writeInt(channels[i].dwellTimeMS);
                    dest.writeInt(channels[i].passive ? 1 : 0);
                }
            } else {
                dest.writeInt(0);
            }
        }

        /** Implement the Parcelable interface {@hide} */
@@ -211,11 +216,15 @@ public class WifiScanner {

        /** Implement the Parcelable interface {@hide} */
        public void writeToParcel(Parcel dest, int flags) {
            if (mResults != null) {
                dest.writeInt(mResults.length);
                for (int i = 0; i < mResults.length; i++) {
                    ScanResult result = mResults[i];
                    result.writeToParcel(dest, flags);
                }
            } else {
                dest.writeInt(0);
            }
        }

        /** Implement the Parcelable interface {@hide} */
@@ -324,6 +333,7 @@ public class WifiScanner {
            dest.writeInt(unchangedSampleSize);
            dest.writeInt(minApsBreachingThreshold);
            dest.writeInt(periodInMs);
            if (hotspotInfos != null) {
                dest.writeInt(hotspotInfos.length);
                for (int i = 0; i < hotspotInfos.length; i++) {
                    HotspotInfo info = hotspotInfos[i];
@@ -332,6 +342,9 @@ public class WifiScanner {
                    dest.writeInt(info.high);
                    dest.writeInt(info.frequencyHint);
                }
            } else {
                dest.writeInt(0);
            }
        }

        /** Implement the Parcelable interface {@hide} */
@@ -456,6 +469,8 @@ public class WifiScanner {
        /** Implement the Parcelable interface {@hide} */
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeInt(apLostThreshold);

            if (hotspotInfos != null) {
                dest.writeInt(hotspotInfos.length);
                for (int i = 0; i < hotspotInfos.length; i++) {
                    HotspotInfo info = hotspotInfos[i];
@@ -464,6 +479,9 @@ public class WifiScanner {
                    dest.writeInt(info.high);
                    dest.writeInt(info.frequencyHint);
                }
            } else {
                dest.writeInt(0);
            }
        }

        /** Implement the Parcelable interface {@hide} */