Merge "Adds a function in LM for fetching ADAS allowlist" into tm-qpr-dev

This commit is contained in:
Grace Cheng
2022-09-15 17:54:32 +00:00
committed by Android (Google) Code Review
4 changed files with 32 additions and 1 deletions

View File

@@ -26,6 +26,7 @@ import android.util.ArraySet;
import com.android.internal.annotations.Immutable;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Map;
import java.util.Objects;
@@ -140,6 +141,17 @@ public final class PackageTagsList implements Parcelable {
return true;
}
/**
* Returns a list of packages.
*
* @deprecated Do not use.
* @hide
*/
@Deprecated
public @NonNull Collection<String> getPackages() {
return new ArrayList<>(mPackageTags.keySet());
}
public static final @NonNull Parcelable.Creator<PackageTagsList> CREATOR =
new Parcelable.Creator<PackageTagsList>() {
@SuppressWarnings("unchecked")
@@ -217,7 +229,7 @@ public final class PackageTagsList implements Parcelable {
if (j > 0) {
pw.print(", ");
}
if (attributionTag.startsWith(packageName)) {
if (attributionTag != null && attributionTag.startsWith(packageName)) {
pw.print(attributionTag.substring(packageName.length()));
} else {
pw.print(attributionTag);

View File

@@ -141,4 +141,5 @@ interface ILocationManager
// used by gts tests to verify whitelists
String[] getBackgroundThrottlingWhitelist();
PackageTagsList getIgnoreSettingsAllowlist();
PackageTagsList getAdasAllowlist();
}

View File

@@ -503,6 +503,19 @@ public class LocationManager {
}
}
/**
* Returns ADAS packages and their associated attribution tags.
*
* @hide
*/
public @NonNull PackageTagsList getAdasAllowlist() {
try {
return mService.getAdasAllowlist();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
}
/**
* Returns the extra location controller package on the device.
*

View File

@@ -675,6 +675,11 @@ public class LocationManagerService extends ILocationManager.Stub implements
return mInjector.getSettingsHelper().getIgnoreSettingsAllowlist();
}
@Override
public PackageTagsList getAdasAllowlist() {
return mInjector.getSettingsHelper().getAdasAllowlist();
}
@Nullable
@Override
public ICancellationSignal getCurrentLocation(String provider, LocationRequest request,