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
This commit is contained in:
Roshan Pius
2019-02-19 13:37:35 -08:00
parent ede298f966
commit fc900aa0e5
2 changed files with 14 additions and 2 deletions

View File

@@ -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;

View File

@@ -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++) {