Loading core/res/res/values/config.xml +15 −0 Original line number Diff line number Diff line Loading @@ -807,6 +807,21 @@ <item>com.android.location.fused</item> </string-array> <!-- This string array can be overriden to enable test location providers initially. --> <!-- Array of "[locationProviderName],[requiresNetwork], [requiresSatellite],[requiresCell],[hasMonetaryCost], [supportAltitute],[supportsSpeed],[supportsBearing], [powerRequirement],[accuracy]" --> <!-- powerRequirement is defined in android.location.Criteria 0 = NO_REQUIREMENT / 1 = POWER_LOW / 2 = POWER_MEDIUM / 3 = POWER_HIGH --> <!-- accuracy is defined in anroid.location.Criteria 1 = ACCURACY_FINE / 2 = ACCURACY_COARSE --> <string-array name="config_testLocationProviders" translatable="false"> <!-- Example test network location provider <item>network,false,false,false,false,true,true,true,1,2</item> --> </string-array> <!-- Boolean indicating if current platform supports bluetooth SCO for off call use cases --> <bool name="config_bluetooth_sco_off_call">true</bool> Loading core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -1442,6 +1442,7 @@ <java-symbol type="array" name="radioAttributes" /> <java-symbol type="array" name="config_oemUsbModeOverride" /> <java-symbol type="array" name="config_locationProviderPackageNames" /> <java-symbol type="array" name="config_testLocationProviders" /> <java-symbol type="array" name="config_defaultNotificationVibePattern" /> <java-symbol type="array" name="config_notificationFallbackVibePattern" /> <java-symbol type="array" name="config_onlySingleDcAllowed" /> Loading services/core/java/com/android/server/LocationManagerService.java +33 −8 Original line number Diff line number Diff line Loading @@ -450,6 +450,27 @@ public class LocationManagerService extends ILocationManager.Stub { if (provider == null) { Slog.e(TAG, "no geofence provider found"); } String[] testProviderStrings = resources.getStringArray( com.android.internal.R.array.config_testLocationProviders); for (String testProviderString : testProviderStrings) { String fragments[] = testProviderString.split(","); String name = fragments[0].trim(); if (mProvidersByName.get(name) != null) { throw new IllegalArgumentException("Provider \"" + name + "\" already exists"); } ProviderProperties properties = new ProviderProperties( Boolean.parseBoolean(fragments[1]) /* requiresNetwork */, Boolean.parseBoolean(fragments[2]) /* requiresSatellite */, Boolean.parseBoolean(fragments[3]) /* requiresCell */, Boolean.parseBoolean(fragments[4]) /* hasMonetaryCost */, Boolean.parseBoolean(fragments[5]) /* supportsAltitude */, Boolean.parseBoolean(fragments[6]) /* supportsSpeed */, Boolean.parseBoolean(fragments[7]) /* supportsBearing */, Integer.parseInt(fragments[8]) /* powerRequirement */, Integer.parseInt(fragments[9]) /* accuracy */); addTestProviderLocked(name, properties); } } /** Loading Loading @@ -2204,7 +2225,6 @@ public class LocationManagerService extends ILocationManager.Stub { long identity = Binder.clearCallingIdentity(); synchronized (mLock) { MockProvider provider = new MockProvider(name, this, properties); // remove the real provider if we are replacing GPS or network provider if (LocationManager.GPS_PROVIDER.equals(name) || LocationManager.NETWORK_PROVIDER.equals(name) Loading @@ -2214,16 +2234,21 @@ public class LocationManagerService extends ILocationManager.Stub { removeProviderLocked(p); } } addTestProviderLocked(name, properties); updateProvidersLocked(); } Binder.restoreCallingIdentity(identity); } private void addTestProviderLocked(String name, ProviderProperties properties) { if (mProvidersByName.get(name) != null) { throw new IllegalArgumentException("Provider \"" + name + "\" already exists"); } MockProvider provider = new MockProvider(name, this, properties); addProviderLocked(provider); mMockProviders.put(name, provider); mLastLocation.put(name, null); mLastLocationCoarseInterval.put(name, null); updateProvidersLocked(); } Binder.restoreCallingIdentity(identity); } @Override Loading Loading
core/res/res/values/config.xml +15 −0 Original line number Diff line number Diff line Loading @@ -807,6 +807,21 @@ <item>com.android.location.fused</item> </string-array> <!-- This string array can be overriden to enable test location providers initially. --> <!-- Array of "[locationProviderName],[requiresNetwork], [requiresSatellite],[requiresCell],[hasMonetaryCost], [supportAltitute],[supportsSpeed],[supportsBearing], [powerRequirement],[accuracy]" --> <!-- powerRequirement is defined in android.location.Criteria 0 = NO_REQUIREMENT / 1 = POWER_LOW / 2 = POWER_MEDIUM / 3 = POWER_HIGH --> <!-- accuracy is defined in anroid.location.Criteria 1 = ACCURACY_FINE / 2 = ACCURACY_COARSE --> <string-array name="config_testLocationProviders" translatable="false"> <!-- Example test network location provider <item>network,false,false,false,false,true,true,true,1,2</item> --> </string-array> <!-- Boolean indicating if current platform supports bluetooth SCO for off call use cases --> <bool name="config_bluetooth_sco_off_call">true</bool> Loading
core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -1442,6 +1442,7 @@ <java-symbol type="array" name="radioAttributes" /> <java-symbol type="array" name="config_oemUsbModeOverride" /> <java-symbol type="array" name="config_locationProviderPackageNames" /> <java-symbol type="array" name="config_testLocationProviders" /> <java-symbol type="array" name="config_defaultNotificationVibePattern" /> <java-symbol type="array" name="config_notificationFallbackVibePattern" /> <java-symbol type="array" name="config_onlySingleDcAllowed" /> Loading
services/core/java/com/android/server/LocationManagerService.java +33 −8 Original line number Diff line number Diff line Loading @@ -450,6 +450,27 @@ public class LocationManagerService extends ILocationManager.Stub { if (provider == null) { Slog.e(TAG, "no geofence provider found"); } String[] testProviderStrings = resources.getStringArray( com.android.internal.R.array.config_testLocationProviders); for (String testProviderString : testProviderStrings) { String fragments[] = testProviderString.split(","); String name = fragments[0].trim(); if (mProvidersByName.get(name) != null) { throw new IllegalArgumentException("Provider \"" + name + "\" already exists"); } ProviderProperties properties = new ProviderProperties( Boolean.parseBoolean(fragments[1]) /* requiresNetwork */, Boolean.parseBoolean(fragments[2]) /* requiresSatellite */, Boolean.parseBoolean(fragments[3]) /* requiresCell */, Boolean.parseBoolean(fragments[4]) /* hasMonetaryCost */, Boolean.parseBoolean(fragments[5]) /* supportsAltitude */, Boolean.parseBoolean(fragments[6]) /* supportsSpeed */, Boolean.parseBoolean(fragments[7]) /* supportsBearing */, Integer.parseInt(fragments[8]) /* powerRequirement */, Integer.parseInt(fragments[9]) /* accuracy */); addTestProviderLocked(name, properties); } } /** Loading Loading @@ -2204,7 +2225,6 @@ public class LocationManagerService extends ILocationManager.Stub { long identity = Binder.clearCallingIdentity(); synchronized (mLock) { MockProvider provider = new MockProvider(name, this, properties); // remove the real provider if we are replacing GPS or network provider if (LocationManager.GPS_PROVIDER.equals(name) || LocationManager.NETWORK_PROVIDER.equals(name) Loading @@ -2214,16 +2234,21 @@ public class LocationManagerService extends ILocationManager.Stub { removeProviderLocked(p); } } addTestProviderLocked(name, properties); updateProvidersLocked(); } Binder.restoreCallingIdentity(identity); } private void addTestProviderLocked(String name, ProviderProperties properties) { if (mProvidersByName.get(name) != null) { throw new IllegalArgumentException("Provider \"" + name + "\" already exists"); } MockProvider provider = new MockProvider(name, this, properties); addProviderLocked(provider); mMockProviders.put(name, provider); mLastLocation.put(name, null); mLastLocationCoarseInterval.put(name, null); updateProvidersLocked(); } Binder.restoreCallingIdentity(identity); } @Override Loading