LocationManager cleanups to make CTS tests easier

addTestProvider and removeTestProvider will now always succeed.

Test: n/a
Bug: 141887245
Change-Id: Ifcc687ffad0a803e5126285ba88bb8c97305b8a9
This commit is contained in:
Soonil Nagarkar
2019-10-08 14:32:07 -07:00
parent 1e6528639d
commit 0000e8acea
3 changed files with 41 additions and 73 deletions

View File

@@ -53,28 +53,10 @@ public class LocationProvider {
@Deprecated
public static final int AVAILABLE = 2;
/**
* A regular expression matching characters that may not appear
* in the name of a LocationProvider
* @hide
*/
public static final String BAD_CHARS_REGEX = "[^a-zA-Z0-9]";
private final String mName;
private final ProviderProperties mProperties;
/**
* Constructs a LocationProvider with the given name. Provider names must
* consist only of the characters [a-zA-Z0-9].
*
* @throws IllegalArgumentException if name contains an illegal character
*
* @hide
*/
public LocationProvider(String name, ProviderProperties properties) {
if (name.matches(BAD_CHARS_REGEX)) {
throw new IllegalArgumentException("provider name contains illegal character: " + name);
}
LocationProvider(String name, ProviderProperties properties) {
mName = name;
mProperties = properties;
}