summaryrefslogtreecommitdiff
path: root/location
diff options
context:
space:
mode:
authorSoonil Nagarkar <sooniln@google.com>2021-05-20 18:28:55 -0700
committerSoonil Nagarkar <sooniln@google.com>2021-05-21 09:25:47 -0700
commit1ea818347e052f1ca0600013153e54a60db05bff (patch)
treeade3a609f3b8f77459bac94b6968609e03bc55fd /location
parentf0ec6471cc7459cb31a394da902eb3ddc93395b7 (diff)
Update location bypass allowlist
Create a new DeviceConfig entry to replace the prior Settings entry on which the location ignore settings allowlist is based. This allows us to allowlist based on attribution tag, and eliminate holes for large applications. Test: manual + CTS + GTS Bug: 187421886 Change-Id: I31e61db79b93e202bd8c66efae1bb5aaf0c88ff5
Diffstat (limited to 'location')
-rw-r--r--location/java/android/location/ILocationManager.aidl3
-rw-r--r--location/java/android/location/LocationDeviceConfig.java56
-rw-r--r--location/java/android/location/LocationManager.java14
3 files changed, 71 insertions, 2 deletions
diff --git a/location/java/android/location/ILocationManager.aidl b/location/java/android/location/ILocationManager.aidl
index 6fa6536997c4..c9e4e0a9cb92 100644
--- a/location/java/android/location/ILocationManager.aidl
+++ b/location/java/android/location/ILocationManager.aidl
@@ -41,6 +41,7 @@ import android.location.provider.IProviderRequestListener;
import android.location.provider.ProviderProperties;
import android.os.Bundle;
import android.os.ICancellationSignal;
+import android.os.PackageTagsList;
/**
* System private API for talking with the location service.
@@ -133,5 +134,5 @@ interface ILocationManager
// used by gts tests to verify whitelists
String[] getBackgroundThrottlingWhitelist();
- String[] getIgnoreSettingsWhitelist();
+ PackageTagsList getIgnoreSettingsAllowlist();
}
diff --git a/location/java/android/location/LocationDeviceConfig.java b/location/java/android/location/LocationDeviceConfig.java
new file mode 100644
index 000000000000..92845745828b
--- /dev/null
+++ b/location/java/android/location/LocationDeviceConfig.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.location;
+
+import android.annotation.SystemApi;
+import android.annotation.TestApi;
+
+/**
+ * DeviceConfig keys within the location namespace.
+ *
+ * @hide
+ */
+@SystemApi
+@TestApi
+public final class LocationDeviceConfig {
+
+ /**
+ * Package/tag combinations that are allowedlisted for ignoring location settings (may retrieve
+ * location even when user location settings are off, and may ignore throttling, etc), for
+ * emergency purposes only.
+ *
+ * <p>Package/tag combinations are separated by commas (","), and with in each combination is a
+ * package name followed by 0 or more attribution tags, separated by semicolons (";"). If a
+ * package is followed by 0 attribution tags, this is interpreted the same as the wildcard
+ * value. There are two special interpreted values for attribution tags, the wildcard value
+ * ("*") which represents all attribution tags, and the null value ("null"), which is converted
+ * to the null string (since attribution tags may be null). This format implies that attribution
+ * tags which should be on this list may not contain semicolons.
+ *
+ * <p>Examples of valid entries:
+ *
+ * <ul>
+ * <li>android</li>
+ * <li>android;*</li>
+ * <li>android;*,com.example.app;null;my_attr</li>
+ * <li>android;*,com.example.app;null;my_attr,com.example.otherapp;my_attr</li>
+ * </ul>
+ */
+ public static final String IGNORE_SETTINGS_ALLOWLIST = "ignore_settings_allowlist";
+
+ private LocationDeviceConfig() {}
+}
diff --git a/location/java/android/location/LocationManager.java b/location/java/android/location/LocationManager.java
index 7c2f5408fffb..f83dc407d870 100644
--- a/location/java/android/location/LocationManager.java
+++ b/location/java/android/location/LocationManager.java
@@ -58,6 +58,7 @@ import android.os.HandlerExecutor;
import android.os.ICancellationSignal;
import android.os.IRemoteCallback;
import android.os.Looper;
+import android.os.PackageTagsList;
import android.os.Process;
import android.os.RemoteException;
import android.os.ServiceManager;
@@ -447,12 +448,23 @@ public class LocationManager {
}
/**
+ * @deprecated Do not use.
* @hide
*/
+ @Deprecated
@TestApi
public @NonNull String[] getIgnoreSettingsWhitelist() {
+ return new String[0];
+ }
+
+ /**
+ * For testing purposes only.
+ * @hide
+ */
+ @TestApi
+ public @NonNull PackageTagsList getIgnoreSettingsAllowlist() {
try {
- return mService.getIgnoreSettingsWhitelist();
+ return mService.getIgnoreSettingsAllowlist();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}