From fc900aa0e5cf86887fa85ffc12af6311879de99f Mon Sep 17 00:00:00 2001 From: Roshan Pius Date: Tue, 19 Feb 2019 13:37:35 -0800 Subject: [PATCH] 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 --- api/system-current.txt | 3 ++- wifi/java/android/net/wifi/WifiScanner.java | 13 ++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/api/system-current.txt b/api/system-current.txt index 86a13bb13429f..f283820a90a2e 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -4849,7 +4849,8 @@ package android.net.wifi { 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 acc0518dbca40..b73551fc62e08 100644 --- a/wifi/java/android/net/wifi/WifiScanner.java +++ b/wifi/java/android/net/wifi/WifiScanner.java @@ -259,8 +259,17 @@ public class WifiScanner { * {@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 @@ public class WifiScanner { 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 @@ public class WifiScanner { 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++) {