diff options
Diffstat (limited to 'location')
-rw-r--r-- | location/java/com/android/internal/location/ProviderRequest.java | 12 | ||||
-rw-r--r-- | location/lib/java/com/android/location/provider/ProviderRequestUnbundled.java | 3 |
2 files changed, 9 insertions, 6 deletions
diff --git a/location/java/com/android/internal/location/ProviderRequest.java b/location/java/com/android/internal/location/ProviderRequest.java index 25c51f5..26243e7 100644 --- a/location/java/com/android/internal/location/ProviderRequest.java +++ b/location/java/com/android/internal/location/ProviderRequest.java @@ -39,10 +39,9 @@ public final class ProviderRequest implements Parcelable { * is a high power slow interval request and a * low power fast interval request. */ - public List<LocationRequest> locationRequests = null; + public List<LocationRequest> locationRequests = new ArrayList<LocationRequest>(); - public ProviderRequest() { - } + public ProviderRequest() { } public static final Parcelable.Creator<ProviderRequest> CREATOR = new Parcelable.Creator<ProviderRequest>() { @@ -52,7 +51,6 @@ public final class ProviderRequest implements Parcelable { request.reportLocation = in.readInt() == 1; request.interval = in.readLong(); int count = in.readInt(); - request.locationRequests = new ArrayList<LocationRequest>(count); for (int i = 0; i < count; i++) { request.locationRequests.add(LocationRequest.CREATOR.createFromParcel(in)); } @@ -73,8 +71,10 @@ public final class ProviderRequest implements Parcelable { public void writeToParcel(Parcel parcel, int flags) { parcel.writeInt(reportLocation ? 1 : 0); parcel.writeLong(interval); - parcel.writeParcelableArray(locationRequests.toArray( - new LocationRequest[locationRequests.size()]), 0); + parcel.writeInt(locationRequests.size()); + for (LocationRequest request : locationRequests) { + request.writeToParcel(parcel, flags); + } } @Override diff --git a/location/lib/java/com/android/location/provider/ProviderRequestUnbundled.java b/location/lib/java/com/android/location/provider/ProviderRequestUnbundled.java index 7487a56..3ff19ca 100644 --- a/location/lib/java/com/android/location/provider/ProviderRequestUnbundled.java +++ b/location/lib/java/com/android/location/provider/ProviderRequestUnbundled.java @@ -42,6 +42,9 @@ public final class ProviderRequestUnbundled { return mRequest.interval; } + /** + * Never null. + */ public List<LocationRequest> getLocationRequests() { return mRequest.locationRequests; } |