Skip to content

Commit 82b9464

Browse files
jhamAndroid (Google) Code Review
authored andcommitted
Merge "Changes to support updating location providers." into jb-mr1-dev
2 parents 0cdbd07 + c19efc2 commit 82b9464

File tree

6 files changed

+14
-21
lines changed

6 files changed

+14
-21
lines changed

core/res/res/values/config.xml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -636,19 +636,12 @@
636636
of new location providers at run-time. The new package does not
637637
have to be explicitly listed here, however it must have a signature
638638
that matches the signature of at least one package on this list.
639-
Platforms should overlay additional packages in
640-
config_overlay_locationProviderPackageNames, instead of overlaying
641-
this config, if they only want to append packages and not replace
642-
the entire array.
643639
-->
644640
<string-array name="config_locationProviderPackageNames" translatable="false">
641+
<!-- The standard AOSP fused location provider -->
645642
<item>com.android.location.fused</item>
646643
</string-array>
647644

648-
<!-- Pacakge name(s) supplied by overlay, and appended to
649-
config_locationProviderPackageNames. -->
650-
<string-array name="config_overlay_locationProviderPackageNames" translatable="false" />
651-
652645
<!-- Boolean indicating if current platform supports bluetooth SCO for off call
653646
use cases -->
654647
<bool name="config_bluetooth_sco_off_call">true</bool>

core/res/res/values/symbols.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1467,7 +1467,6 @@
14671467
<java-symbol type="array" name="radioAttributes" />
14681468
<java-symbol type="array" name="config_oemUsbModeOverride" />
14691469
<java-symbol type="array" name="config_locationProviderPackageNames" />
1470-
<java-symbol type="array" name="config_overlay_locationProviderPackageNames" />
14711470
<java-symbol type="bool" name="config_animateScreenLights" />
14721471
<java-symbol type="bool" name="config_automatic_brightness_available" />
14731472
<java-symbol type="bool" name="config_sf_limitedAlpha" />

packages/FusedLocation/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
<intent-filter>
4040
<action android:name="com.android.location.service.FusedLocationProvider" />
4141
</intent-filter>
42-
<meta-data android:name="version" android:value="1" />
42+
<meta-data android:name="serviceVersion" android:value="1" />
4343
</service>
4444
</application>
4545
</manifest>

packages/FusedLocation/src/com/android/location/fused/FusionEngine.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ private void updateFusedLocation() {
247247
mNetworkWeight /= totalWeight;
248248
mGpsWeight /= totalWeight;
249249

250-
Location fused = new Location(LocationManager.FUSED_PROVIDER);
250+
Location fused = new Location(/* LocationManager.FUSED_PROVIDER */ "fused");
251251
// fuse lat/long
252252
// assumes the two locations are close enough that earth curvature doesn't matter
253253
fused.setLatitude(weigh(mGpsLocation.getLatitude(), mNetworkLocation.getLatitude()));
@@ -303,7 +303,12 @@ private void updateFusedLocation() {
303303
}
304304

305305
if (mNetworkLocation != null) {
306-
fused.setExtraLocation(Location.EXTRA_NO_GPS_LOCATION, mNetworkLocation);
306+
// Manually set the extras for the "no gps" location, pointing at the NLP
307+
Bundle extras = new Bundle();
308+
extras.putParcelable("noGPSLocation", mNetworkLocation);
309+
fused.setExtras(extras);
310+
// Done inline above to compile against SDK 17
311+
//fused.setExtraLocation(Location.EXTRA_NO_GPS_LOCATION, mNetworkLocation);
307312
}
308313

309314
mFusedLocation = fused;

services/java/com/android/server/LocationManagerService.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -275,14 +275,10 @@ Load package name(s) containing location provider support.
275275
*/
276276
Resources resources = mContext.getResources();
277277
ArrayList<String> providerPackageNames = new ArrayList<String>();
278-
String[] pkgs1 = resources.getStringArray(
278+
String[] pkgs = resources.getStringArray(
279279
com.android.internal.R.array.config_locationProviderPackageNames);
280-
String[] pkgs2 = resources.getStringArray(
281-
com.android.internal.R.array.config_overlay_locationProviderPackageNames);
282-
if (D) Log.d(TAG, "built-in location providers: " + Arrays.toString(pkgs1));
283-
if (D) Log.d(TAG, "overlay location providers: " + Arrays.toString(pkgs2));
284-
if (pkgs1 != null) providerPackageNames.addAll(Arrays.asList(pkgs1));
285-
if (pkgs2 != null) providerPackageNames.addAll(Arrays.asList(pkgs2));
280+
if (D) Log.d(TAG, "built-in location providers: " + Arrays.toString(pkgs));
281+
if (pkgs != null) providerPackageNames.addAll(Arrays.asList(pkgs));
286282

287283
// bind to network provider
288284
LocationProviderProxy networkProvider = LocationProviderProxy.createAndBind(

services/java/com/android/server/ServiceWatcher.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
*/
4343
public class ServiceWatcher implements ServiceConnection {
4444
private static final boolean D = false;
45-
private static final String EXTRA_VERSION = "version";
45+
private static final String EXTRA_SERVICE_VERSION = "serviceVersion";
4646

4747
private final String mTag;
4848
private final Context mContext;
@@ -127,7 +127,7 @@ private boolean bindBestPackage(String justCheckThisPackage) {
127127
// check version
128128
int version = 0;
129129
if (rInfo.serviceInfo.metaData != null) {
130-
version = rInfo.serviceInfo.metaData.getInt(EXTRA_VERSION, 0);
130+
version = rInfo.serviceInfo.metaData.getInt(EXTRA_SERVICE_VERSION, 0);
131131
}
132132
if (version > mVersion) {
133133
bestVersion = version;

0 commit comments

Comments
 (0)