Use SystemConfig to control background location throttling whitelist.

Test: manual

Change-Id: I51285f9a463381855f2bb3fa9af34af1930b8ebd
This commit is contained in:
Soonil Nagarkar
2017-02-14 13:33:23 -08:00
parent 7776844d77
commit 2b565df367
2 changed files with 47 additions and 18 deletions

View File

@@ -109,6 +109,10 @@ public class SystemConfig {
// background while in data-usage save mode, as read from the configuration files.
final ArraySet<String> mAllowInDataUsageSave = new ArraySet<>();
// These are the packages that are white-listed to be able to run background location
// without throttling, as read from the configuration files.
final ArraySet<String> mAllowUnthrottledLocation = new ArraySet<>();
// These are the action strings of broadcasts which are whitelisted to
// be delivered anonymously even to apps which target O+.
final ArraySet<String> mAllowImplicitBroadcasts = new ArraySet<>();
@@ -182,6 +186,10 @@ public class SystemConfig {
return mAllowInDataUsageSave;
}
public ArraySet<String> getAllowUnthrottledLocation() {
return mAllowUnthrottledLocation;
}
public ArraySet<String> getLinkedApps() {
return mLinkedApps;
}
@@ -446,6 +454,17 @@ public class SystemConfig {
XmlUtils.skipCurrentTag(parser);
continue;
} else if ("allow-unthrottled-location".equals(name) && allowAll) {
String pkgname = parser.getAttributeValue(null, "package");
if (pkgname == null) {
Slog.w(TAG, "<allow-unthrottled-location> without package in "
+ permFile + " at " + parser.getPositionDescription());
} else {
mAllowUnthrottledLocation.add(pkgname);
}
XmlUtils.skipCurrentTag(parser);
continue;
} else if ("allow-implicit-broadcast".equals(name) && allowAll) {
String action = parser.getAttributeValue(null, "action");
if (action == null) {