WifiScanner: Add a flag to hide request from app-ops
This flag is intended to be used by the NLP/FLP package on the device to
hide their request from app-ops logging. NLP/FLP module will be
responsible to blame (note in app-ops) their external clients who
eventually get the location computed using these raw results.
Also, removed a redundant permission tag in the previously added
|ignoreLocationSettings| flag. This entire surface is useable by apps
holding LOCATION_HARDWARE permission. So, there is no need to explicitly
call this out for that field.
Bug: 119833663
Test: Compiles
Change-Id: Idba70fe4a15e611d4485d05b771d71f2d707d0b5
diff --git a/api/system-current.txt b/api/system-current.txt
index 86a13bb..f283820 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -4849,7 +4849,8 @@
ctor public WifiScanner.ScanSettings();
field public int band;
field public android.net.wifi.WifiScanner.ChannelSpec[] channels;
- field @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public boolean ignoreLocationSettings;
+ field public boolean hideFromAppOps;
+ field public boolean ignoreLocationSettings;
field public int maxPeriodInMs;
field public int maxScansToCache;
field public int numBssidsPerScan;
diff --git a/wifi/java/android/net/wifi/WifiScanner.java b/wifi/java/android/net/wifi/WifiScanner.java
index acc0518..b73551f 100644
--- a/wifi/java/android/net/wifi/WifiScanner.java
+++ b/wifi/java/android/net/wifi/WifiScanner.java
@@ -259,8 +259,17 @@
* {@hide}
*/
@SystemApi
- @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE)
public boolean ignoreLocationSettings;
+ /**
+ * This scan request will be hidden from app-ops noting for location information. This
+ * should only be used by FLP/NLP module on the device which is using the scan results to
+ * compute results for behalf on their clients. FLP/NLP module using this flag should ensure
+ * that they note in app-ops the eventual delivery of location information computed using
+ * these results to their client .
+ * {@hide}
+ */
+ @SystemApi
+ public boolean hideFromAppOps;
/** Implement the Parcelable interface {@hide} */
public int describeContents() {
@@ -279,6 +288,7 @@
dest.writeInt(isPnoScan ? 1 : 0);
dest.writeInt(type);
dest.writeInt(ignoreLocationSettings ? 1 : 0);
+ dest.writeInt(hideFromAppOps ? 1 : 0);
if (channels != null) {
dest.writeInt(channels.length);
for (int i = 0; i < channels.length; i++) {
@@ -314,6 +324,7 @@
settings.isPnoScan = in.readInt() == 1;
settings.type = in.readInt();
settings.ignoreLocationSettings = in.readInt() == 1;
+ settings.hideFromAppOps = in.readInt() == 1;
int num_channels = in.readInt();
settings.channels = new ChannelSpec[num_channels];
for (int i = 0; i < num_channels; i++) {