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

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19799651

Change-Id: I36a71fede0ed21ec570c888e19cb1bb42cf76cb8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Grace Cheng
2022-09-15 18:21:18 +00:00
committed by Automerger Merge Worker
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 com.android.internal.annotations.Immutable;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
@@ -140,6 +141,17 @@ public final class PackageTagsList implements Parcelable {
return true; 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 = public static final @NonNull Parcelable.Creator<PackageTagsList> CREATOR =
new Parcelable.Creator<PackageTagsList>() { new Parcelable.Creator<PackageTagsList>() {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@@ -217,7 +229,7 @@ public final class PackageTagsList implements Parcelable {
if (j > 0) { if (j > 0) {
pw.print(", "); pw.print(", ");
} }
if (attributionTag.startsWith(packageName)) { if (attributionTag != null && attributionTag.startsWith(packageName)) {
pw.print(attributionTag.substring(packageName.length())); pw.print(attributionTag.substring(packageName.length()));
} else { } else {
pw.print(attributionTag); pw.print(attributionTag);

View File

@@ -141,4 +141,5 @@ interface ILocationManager
// used by gts tests to verify whitelists // used by gts tests to verify whitelists
String[] getBackgroundThrottlingWhitelist(); String[] getBackgroundThrottlingWhitelist();
PackageTagsList getIgnoreSettingsAllowlist(); 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. * 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(); return mInjector.getSettingsHelper().getIgnoreSettingsAllowlist();
} }
@Override
public PackageTagsList getAdasAllowlist() {
return mInjector.getSettingsHelper().getAdasAllowlist();
}
@Nullable @Nullable
@Override @Override
public ICancellationSignal getCurrentLocation(String provider, LocationRequest request, public ICancellationSignal getCurrentLocation(String provider, LocationRequest request,