DO NOT MERGE Expose gscan exponential backoff API
Will be ignored until scan scheduling supports it
Cherry-picked from 2564d9a4efb2f3a44dac5ae1e5e437e5355d19cf
Change-Id: I9d392080e6ec8dfa9a998f6c04ec37f9c6dad0b2
diff --git a/api/system-current.txt b/api/system-current.txt
index f21c1ee..29b436e 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -21275,10 +21275,13 @@
method public void writeToParcel(android.os.Parcel, int);
field public int band;
field public android.net.wifi.WifiScanner.ChannelSpec[] channels;
+ field public int exponent;
+ field public int maxPeriodInMs;
field public int maxScansToCache;
field public int numBssidsPerScan;
field public int periodInMs;
field public int reportEvents;
+ field public int stepCount;
}
public static abstract interface WifiScanner.WifiChangeListener implements android.net.wifi.WifiScanner.ActionListener {
diff --git a/wifi/java/android/net/wifi/WifiScanner.java b/wifi/java/android/net/wifi/WifiScanner.java
index c26ca6e..5534cad 100644
--- a/wifi/java/android/net/wifi/WifiScanner.java
+++ b/wifi/java/android/net/wifi/WifiScanner.java
@@ -168,6 +168,22 @@
* to wake up at fixed interval
*/
public int maxScansToCache;
+ /**
+ * if maxPeriodInMs is non zero or different than period, then this bucket is
+ * an exponential backoff bucket and the scan period will grow exponentially
+ * as per formula: actual_period(N) = period ^ (N/(step_count+1))
+ * to a maximum period of max_period.
+ */
+ public int maxPeriodInMs;
+ /**
+ * for exponential back off bucket: multiplier: new_period=old_period*exponent
+ */
+ public int exponent;
+ /**
+ * for exponential back off bucket, number of scans performed at a given
+ * period and until the exponent is applied
+ */
+ public int stepCount;
/** Implement the Parcelable interface {@hide} */
public int describeContents() {
@@ -181,6 +197,9 @@
dest.writeInt(reportEvents);
dest.writeInt(numBssidsPerScan);
dest.writeInt(maxScansToCache);
+ dest.writeInt(maxPeriodInMs);
+ dest.writeInt(exponent);
+ dest.writeInt(stepCount);
if (channels != null) {
dest.writeInt(channels.length);
@@ -206,6 +225,9 @@
settings.reportEvents = in.readInt();
settings.numBssidsPerScan = in.readInt();
settings.maxScansToCache = in.readInt();
+ settings.maxPeriodInMs = in.readInt();
+ settings.exponent = in.readInt();
+ settings.stepCount = in.readInt();
int num_channels = in.readInt();
settings.channels = new ChannelSpec[num_channels];
for (int i = 0; i < num_channels; i++) {