diff --git a/src/com/google/android/gms/common/api/AccountInfo.java b/src/com/google/android/gms/common/api/AccountInfo.java new file mode 100644 index 00000000..e482b9fd --- /dev/null +++ b/src/com/google/android/gms/common/api/AccountInfo.java @@ -0,0 +1,7 @@ +package com.google.android.gms.common.api; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class AccountInfo extends AutoSafeParcelable { + public static final Creator CREATOR = new AutoCreator<>(AccountInfo.class); +} diff --git a/src/com/google/android/gms/common/api/Scope.java b/src/com/google/android/gms/common/api/Scope.java index 21ad3321..ab9a05a1 100644 --- a/src/com/google/android/gms/common/api/Scope.java +++ b/src/com/google/android/gms/common/api/Scope.java @@ -1,15 +1,16 @@ package com.google.android.gms.common.api; -import android.os.Parcel; -import org.microg.safeparcel.SafeParcelUtil; -import org.microg.safeparcel.SafeParcelable; +import org.microg.safeparcel.AutoSafeParcelable; +import org.microg.safeparcel.SafeParceled; /** - * Describes an OAuth 2.0 scope to request. This has security implications for the user, and + * Describes an OAuth 2.0 scope to request. This has security implications for the user, and * requesting additional scopes will result in authorization dialogs. */ -public class Scope implements SafeParcelable { +public class Scope extends AutoSafeParcelable { + @SafeParceled(1) private final int versionCode; + @SafeParceled(2) private final String scopeUri; private Scope() { @@ -17,11 +18,6 @@ public class Scope implements SafeParcelable { scopeUri = null; } - private Scope(Parcel in) { - this(); - SafeParcelUtil.readObject(this, in); - } - /** * Creates a new scope with the given URI. */ @@ -30,11 +26,6 @@ public class Scope implements SafeParcelable { this.scopeUri = scopeUri; } - @Override - public int describeContents() { - return 0; - } - @Override public boolean equals(Object o) { return this == o || o instanceof Scope && scopeUri.equals(((Scope) o).scopeUri); @@ -54,20 +45,5 @@ public class Scope implements SafeParcelable { return scopeUri; } - @Override - public void writeToParcel(Parcel out, int flags) { - SafeParcelUtil.writeObject(this, out, flags); - } - - public static final Creator CREATOR = new Creator() { - @Override - public Scope createFromParcel(Parcel parcel) { - return new Scope(parcel); - } - - @Override - public Scope[] newArray(int i) { - return new Scope[i]; - } - }; + public static final Creator CREATOR = new AutoCreator<>(Scope.class); } diff --git a/src/com/google/android/gms/common/data/DataHolder.java b/src/com/google/android/gms/common/data/DataHolder.java index 2cb2885c..ef5d89ef 100644 --- a/src/com/google/android/gms/common/data/DataHolder.java +++ b/src/com/google/android/gms/common/data/DataHolder.java @@ -1,36 +1,11 @@ package com.google.android.gms.common.data; -import android.os.Parcel; -import org.microg.safeparcel.SafeParcelUtil; -import org.microg.safeparcel.SafeParcelable; +import org.microg.safeparcel.AutoSafeParcelable; /** * TODO: usage */ -public class DataHolder implements SafeParcelable { - private DataHolder(Parcel in) { - SafeParcelUtil.readObject(this, in); - } +public class DataHolder extends AutoSafeParcelable { - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel out, int flags) { - SafeParcelUtil.writeObject(this, out, flags); - } - - public static final Creator CREATOR = new Creator() { - @Override - public DataHolder createFromParcel(Parcel parcel) { - return new DataHolder(parcel); - } - - @Override - public DataHolder[] newArray(int i) { - return new DataHolder[i]; - } - }; + public static final Creator CREATOR = new AutoCreator<>(DataHolder.class); } diff --git a/src/com/google/android/gms/location/Geofence.java b/src/com/google/android/gms/location/Geofence.java index 0c65cfa5..c47a90d8 100644 --- a/src/com/google/android/gms/location/Geofence.java +++ b/src/com/google/android/gms/location/Geofence.java @@ -16,33 +16,9 @@ package com.google.android.gms.location; -import android.os.Parcel; -import org.microg.safeparcel.SafeParcelUtil; -import org.microg.safeparcel.SafeParcelable; +import org.microg.safeparcel.AutoSafeParcelable; -public class Geofence implements SafeParcelable { +public class Geofence extends AutoSafeParcelable { - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel dest, int flags) { - SafeParcelUtil.writeObject(this, dest, flags); - } - - - public static Creator CREATOR = new Creator() { - @Override - public Geofence createFromParcel(Parcel source) { - return new Geofence(); - } - - @Override - public Geofence[] newArray(int size) { - return new Geofence[size]; - } - }; + public static Creator CREATOR = new AutoCreator<>(Geofence.class); } diff --git a/src/com/google/android/gms/location/GeofencingRequest.java b/src/com/google/android/gms/location/GeofencingRequest.java index f8167e78..a36d29e6 100644 --- a/src/com/google/android/gms/location/GeofencingRequest.java +++ b/src/com/google/android/gms/location/GeofencingRequest.java @@ -1,38 +1,12 @@ package com.google.android.gms.location; -import android.os.Parcel; -import android.os.Parcelable; -import org.microg.safeparcel.SafeParcelUtil; -import org.microg.safeparcel.SafeParcelable; +import org.microg.safeparcel.AutoSafeParcelable; /** * TODO: usage */ -public class GeofencingRequest implements SafeParcelable { +public class GeofencingRequest extends AutoSafeParcelable { - private GeofencingRequest(Parcel in) { - SafeParcelUtil.readObject(this, in); - } - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel out, int flags) { - SafeParcelUtil.writeObject(this, out, flags); - } - - public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { - @Override - public GeofencingRequest createFromParcel(Parcel parcel) { - return new GeofencingRequest(parcel); - } - - @Override - public GeofencingRequest[] newArray(int i) { - return new GeofencingRequest[i]; - } - }; + public static final Creator CREATOR = new AutoCreator<>( + GeofencingRequest.class); } diff --git a/src/com/google/android/gms/location/LocationRequest.java b/src/com/google/android/gms/location/LocationRequest.java index dfc46811..a1105821 100644 --- a/src/com/google/android/gms/location/LocationRequest.java +++ b/src/com/google/android/gms/location/LocationRequest.java @@ -1,9 +1,7 @@ package com.google.android.gms.location; -import android.os.Parcel; import android.os.SystemClock; -import org.microg.safeparcel.SafeParcelUtil; -import org.microg.safeparcel.SafeParcelable; +import org.microg.safeparcel.AutoSafeParcelable; import org.microg.safeparcel.SafeParceled; import java.util.Arrays; @@ -55,10 +53,8 @@ import java.util.Arrays; *

* All location requests are considered hints, and you may receive locations that are more/less * accurate, and faster/slower than requested. - *

- * TODO: Works on wire, but methods not yet implemented. */ -public class LocationRequest implements SafeParcelable { +public class LocationRequest extends AutoSafeParcelable { /** * Used with {@link #setPriority(int)} to request "block" level accuracy. @@ -120,11 +116,6 @@ public class LocationRequest implements SafeParcelable { this.maxWaitTime = 0; } - public LocationRequest(Parcel in) { - this(); - SafeParcelUtil.readObject(this, in); - } - /** * Create a location request with default parameters. *

@@ -137,11 +128,6 @@ public class LocationRequest implements SafeParcelable { return new LocationRequest(); } - @Override - public int describeContents() { - return 0; - } - /** * Get the request expiration time, in milliseconds since boot. *

@@ -426,20 +412,5 @@ public class LocationRequest implements SafeParcelable { return super.toString(); } - @Override - public void writeToParcel(Parcel out, int flags) { - SafeParcelUtil.writeObject(this, out, flags); - } - - public static final Creator CREATOR = new Creator() { - @Override - public LocationRequest createFromParcel(Parcel parcel) { - return new LocationRequest(parcel); - } - - @Override - public LocationRequest[] newArray(int i) { - return new LocationRequest[i]; - } - }; + public static final Creator CREATOR = new AutoCreator<>(LocationRequest.class); } diff --git a/src/com/google/android/gms/location/LocationStatus.java b/src/com/google/android/gms/location/LocationStatus.java index 4009e57f..e60c531f 100644 --- a/src/com/google/android/gms/location/LocationStatus.java +++ b/src/com/google/android/gms/location/LocationStatus.java @@ -1,13 +1,11 @@ package com.google.android.gms.location; -import android.os.Parcel; -import org.microg.safeparcel.SafeParcelUtil; -import org.microg.safeparcel.SafeParcelable; +import org.microg.safeparcel.AutoSafeParcelable; import org.microg.safeparcel.SafeParceled; import java.util.Arrays; -public class LocationStatus implements SafeParcelable { +public class LocationStatus extends AutoSafeParcelable { public static final int STATUS_SUCCESSFUL = 0; public static final int STATUS_UNKNOWN = 1; public static final int STATUS_TIMED_OUT_ON_SCAN = 2; @@ -26,14 +24,8 @@ public class LocationStatus implements SafeParcelable { @SafeParceled(3) long elapsedRealtimeNanos; - private LocationStatus(Parcel in) { + private LocationStatus() { versionCode = 1; - SafeParcelUtil.readObject(this, in); - } - - @Override - public int describeContents() { - return 0; } @Override @@ -84,20 +76,5 @@ public class LocationStatus implements SafeParcelable { } } - @Override - public void writeToParcel(Parcel out, int flags) { - SafeParcelUtil.writeObject(this, out, flags); - } - - public static final Creator CREATOR = new Creator() { - @Override - public LocationStatus createFromParcel(Parcel parcel) { - return new LocationStatus(parcel); - } - - @Override - public LocationStatus[] newArray(int i) { - return new LocationStatus[i]; - } - }; + public static final Creator CREATOR = new AutoCreator<>(LocationStatus.class); } diff --git a/src/com/google/android/gms/location/internal/LocationRequestInternal.java b/src/com/google/android/gms/location/internal/LocationRequestInternal.java index 8ae27697..3ab5568d 100644 --- a/src/com/google/android/gms/location/internal/LocationRequestInternal.java +++ b/src/com/google/android/gms/location/internal/LocationRequestInternal.java @@ -1,37 +1,12 @@ package com.google.android.gms.location.internal; -import android.os.Parcel; -import android.os.Parcelable; -import org.microg.safeparcel.SafeParcelUtil; -import org.microg.safeparcel.SafeParcelable; +import org.microg.safeparcel.AutoSafeParcelable; /** * TODO: usage */ -public class LocationRequestInternal implements SafeParcelable { - private LocationRequestInternal(Parcel in) { - SafeParcelUtil.readObject(this, in); - } +public class LocationRequestInternal extends AutoSafeParcelable { - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel out, int flags) { - SafeParcelUtil.writeObject(this, out, flags); - } - - public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { - @Override - public LocationRequestInternal createFromParcel(Parcel parcel) { - return new LocationRequestInternal(parcel); - } - - @Override - public LocationRequestInternal[] newArray(int i) { - return new LocationRequestInternal[i]; - } - }; + public static final Creator CREATOR = new AutoCreator<>( + LocationRequestInternal.class); } diff --git a/src/com/google/android/gms/location/places/AutocompleteFilter.java b/src/com/google/android/gms/location/places/AutocompleteFilter.java index 86847d4e..23ffa4d4 100644 --- a/src/com/google/android/gms/location/places/AutocompleteFilter.java +++ b/src/com/google/android/gms/location/places/AutocompleteFilter.java @@ -1,15 +1,13 @@ package com.google.android.gms.location.places; -import android.os.Parcel; -import org.microg.safeparcel.SafeParcelUtil; -import org.microg.safeparcel.SafeParcelable; +import org.microg.safeparcel.AutoSafeParcelable; import org.microg.safeparcel.SafeParceled; /** * TODO usage */ -public class AutocompleteFilter implements SafeParcelable { - +public class AutocompleteFilter extends AutoSafeParcelable { + @SafeParceled(1000) private final int versionCode; @@ -17,30 +15,6 @@ public class AutocompleteFilter implements SafeParcelable { this.versionCode = 1; } - private AutocompleteFilter(Parcel in) { - this(); - SafeParcelUtil.readObject(this, in); - } - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel out, int flags) { - SafeParcelUtil.writeObject(this, out, flags); - } - - public static final Creator CREATOR = new Creator() { - @Override - public AutocompleteFilter createFromParcel(Parcel parcel) { - return new AutocompleteFilter(parcel); - } - - @Override - public AutocompleteFilter[] newArray(int i) { - return new AutocompleteFilter[i]; - } - }; + public static final Creator CREATOR = new AutoCreator<>( + AutocompleteFilter.class); } diff --git a/src/com/google/android/gms/location/places/NearbyAlertRequest.java b/src/com/google/android/gms/location/places/NearbyAlertRequest.java index 0650e462..94c415a5 100644 --- a/src/com/google/android/gms/location/places/NearbyAlertRequest.java +++ b/src/com/google/android/gms/location/places/NearbyAlertRequest.java @@ -1,36 +1,12 @@ package com.google.android.gms.location.places; -import android.os.Parcel; -import org.microg.safeparcel.SafeParcelUtil; -import org.microg.safeparcel.SafeParcelable; +import org.microg.safeparcel.AutoSafeParcelable; /** * TODO: usage */ -public class NearbyAlertRequest implements SafeParcelable { - private NearbyAlertRequest(Parcel in) { - SafeParcelUtil.readObject(this, in); - } +public class NearbyAlertRequest extends AutoSafeParcelable { - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel out, int flags) { - SafeParcelUtil.writeObject(this, out, flags); - } - - public static final Creator CREATOR = new Creator() { - @Override - public NearbyAlertRequest createFromParcel(Parcel parcel) { - return new NearbyAlertRequest(parcel); - } - - @Override - public NearbyAlertRequest[] newArray(int i) { - return new NearbyAlertRequest[i]; - } - }; + public static final Creator CREATOR = new AutoCreator<>( + NearbyAlertRequest.class); } diff --git a/src/com/google/android/gms/location/places/PlaceFilter.java b/src/com/google/android/gms/location/places/PlaceFilter.java index d13849b8..2bbc41f6 100644 --- a/src/com/google/android/gms/location/places/PlaceFilter.java +++ b/src/com/google/android/gms/location/places/PlaceFilter.java @@ -1,37 +1,11 @@ package com.google.android.gms.location.places; -import android.os.Parcel; -import org.microg.safeparcel.SafeParcelUtil; -import org.microg.safeparcel.SafeParcelable; +import org.microg.safeparcel.AutoSafeParcelable; /** * TODO: usage */ -public class PlaceFilter implements SafeParcelable { +public class PlaceFilter extends AutoSafeParcelable { - private PlaceFilter(Parcel in) { - SafeParcelUtil.readObject(this, in); - } - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel out, int flags) { - SafeParcelUtil.writeObject(this, out, flags); - } - - public static final Creator CREATOR = new Creator() { - @Override - public PlaceFilter createFromParcel(Parcel parcel) { - return new PlaceFilter(parcel); - } - - @Override - public PlaceFilter[] newArray(int i) { - return new PlaceFilter[i]; - } - }; + public static final Creator CREATOR = new AutoCreator<>(PlaceFilter.class); } diff --git a/src/com/google/android/gms/location/places/PlaceReport.java b/src/com/google/android/gms/location/places/PlaceReport.java index 8fd57f86..38d39007 100644 --- a/src/com/google/android/gms/location/places/PlaceReport.java +++ b/src/com/google/android/gms/location/places/PlaceReport.java @@ -1,38 +1,10 @@ package com.google.android.gms.location.places; -import android.os.Parcel; -import android.os.Parcelable; -import org.microg.safeparcel.SafeParcelUtil; -import org.microg.safeparcel.SafeParcelable; +import org.microg.safeparcel.AutoSafeParcelable; /** * TODO: usage */ -public class PlaceReport implements SafeParcelable { - - private PlaceReport(Parcel in) { - SafeParcelUtil.readObject(this, in); - } - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel out, int flags) { - SafeParcelUtil.writeObject(this, out, flags); - } - - public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { - @Override - public PlaceReport createFromParcel(Parcel parcel) { - return new PlaceReport(parcel); - } - - @Override - public PlaceReport[] newArray(int i) { - return new PlaceReport[i]; - } - }; +public class PlaceReport extends AutoSafeParcelable { + public static final Creator CREATOR = new AutoCreator<>(PlaceReport.class); } diff --git a/src/com/google/android/gms/location/places/PlaceRequest.java b/src/com/google/android/gms/location/places/PlaceRequest.java index 0960bdcb..ad46244e 100644 --- a/src/com/google/android/gms/location/places/PlaceRequest.java +++ b/src/com/google/android/gms/location/places/PlaceRequest.java @@ -1,36 +1,10 @@ package com.google.android.gms.location.places; -import android.os.Parcel; -import org.microg.safeparcel.SafeParcelUtil; -import org.microg.safeparcel.SafeParcelable; +import org.microg.safeparcel.AutoSafeParcelable; /** * TODO: usage */ -public class PlaceRequest implements SafeParcelable { - private PlaceRequest(Parcel in) { - SafeParcelUtil.readObject(this, in); - } - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel out, int flags) { - SafeParcelUtil.writeObject(this, out, flags); - } - - public static final Creator CREATOR = new Creator() { - @Override - public PlaceRequest createFromParcel(Parcel parcel) { - return new PlaceRequest(parcel); - } - - @Override - public PlaceRequest[] newArray(int i) { - return new PlaceRequest[i]; - } - }; +public class PlaceRequest extends AutoSafeParcelable { + public static final Creator CREATOR = new AutoCreator<>(PlaceRequest.class); } diff --git a/src/com/google/android/gms/location/places/UserAddedPlace.java b/src/com/google/android/gms/location/places/UserAddedPlace.java index 5f83f528..534dac3e 100644 --- a/src/com/google/android/gms/location/places/UserAddedPlace.java +++ b/src/com/google/android/gms/location/places/UserAddedPlace.java @@ -1,46 +1,19 @@ package com.google.android.gms.location.places; -import android.os.Parcel; -import org.microg.safeparcel.SafeParcelUtil; -import org.microg.safeparcel.SafeParcelable; +import org.microg.safeparcel.AutoSafeParcelable; import org.microg.safeparcel.SafeParceled; /** * TODO: usage */ -public class UserAddedPlace implements SafeParcelable { - +public class UserAddedPlace extends AutoSafeParcelable { + @SafeParceled(1000) private final int versionCode; - + private UserAddedPlace() { - versionCode = -1; + versionCode = 1; } - private UserAddedPlace(Parcel in) { - this(); - SafeParcelUtil.readObject(this, in); - } - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel out, int flags) { - SafeParcelUtil.writeObject(this, out, flags); - } - - public static final Creator CREATOR = new Creator() { - @Override - public UserAddedPlace createFromParcel(Parcel parcel) { - return new UserAddedPlace(parcel); - } - - @Override - public UserAddedPlace[] newArray(int i) { - return new UserAddedPlace[i]; - } - }; + public static final Creator CREATOR = new AutoCreator<>(UserAddedPlace.class); } diff --git a/src/com/google/android/gms/location/places/UserDataType.java b/src/com/google/android/gms/location/places/UserDataType.java index 858d3f0c..7ac8579a 100644 --- a/src/com/google/android/gms/location/places/UserDataType.java +++ b/src/com/google/android/gms/location/places/UserDataType.java @@ -1,36 +1,11 @@ package com.google.android.gms.location.places; -import android.os.Parcel; -import org.microg.safeparcel.SafeParcelUtil; -import org.microg.safeparcel.SafeParcelable; +import org.microg.safeparcel.AutoSafeParcelable; /** * TODO: usage */ -public class UserDataType implements SafeParcelable { - private UserDataType(Parcel in) { - SafeParcelUtil.readObject(this, in); - } +public class UserDataType extends AutoSafeParcelable { - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel out, int flags) { - SafeParcelUtil.writeObject(this, out, flags); - } - - public static final Creator CREATOR = new Creator() { - @Override - public UserDataType createFromParcel(Parcel parcel) { - return new UserDataType(parcel); - } - - @Override - public UserDataType[] newArray(int i) { - return new UserDataType[i]; - } - }; + public static final Creator CREATOR = new AutoCreator<>(UserDataType.class); } diff --git a/src/com/google/android/gms/location/places/internal/PlacesParams.java b/src/com/google/android/gms/location/places/internal/PlacesParams.java index 956c99da..ad739c40 100644 --- a/src/com/google/android/gms/location/places/internal/PlacesParams.java +++ b/src/com/google/android/gms/location/places/internal/PlacesParams.java @@ -1,11 +1,9 @@ package com.google.android.gms.location.places.internal; -import android.os.Parcel; -import org.microg.safeparcel.SafeParcelUtil; -import org.microg.safeparcel.SafeParcelable; +import org.microg.safeparcel.AutoSafeParcelable; import org.microg.safeparcel.SafeParceled; -public class PlacesParams implements SafeParcelable { +public class PlacesParams extends AutoSafeParcelable { @SafeParceled(1000) private final int versionCode; @@ -19,34 +17,9 @@ public class PlacesParams implements SafeParcelable { public final String gCoreClientName; private PlacesParams() { - versionCode = -1; + versionCode = 1; clientPackageName = locale = accountName = gCoreClientName = null; } - private PlacesParams(Parcel in) { - this(); - SafeParcelUtil.readObject(this, in); - } - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel out, int flags) { - SafeParcelUtil.writeObject(this, out, flags); - } - - public static final Creator CREATOR = new Creator() { - @Override - public PlacesParams createFromParcel(Parcel parcel) { - return new PlacesParams(parcel); - } - - @Override - public PlacesParams[] newArray(int i) { - return new PlacesParams[i]; - } - }; + public static final Creator CREATOR = new AutoCreator<>(PlacesParams.class); } diff --git a/src/com/google/android/gms/maps/GoogleMapOptions.java b/src/com/google/android/gms/maps/GoogleMapOptions.java index 8219b155..19e62bba 100644 --- a/src/com/google/android/gms/maps/GoogleMapOptions.java +++ b/src/com/google/android/gms/maps/GoogleMapOptions.java @@ -16,13 +16,11 @@ package com.google.android.gms.maps; -import android.os.Parcel; import com.google.android.gms.maps.model.CameraPosition; -import org.microg.safeparcel.SafeParcelUtil; -import org.microg.safeparcel.SafeParcelable; +import org.microg.safeparcel.AutoSafeParcelable; import org.microg.safeparcel.SafeParceled; -public final class GoogleMapOptions implements SafeParcelable { +public final class GoogleMapOptions extends AutoSafeParcelable { @SafeParceled(1) private int versionCode; @SafeParceled(2) @@ -46,23 +44,9 @@ public final class GoogleMapOptions implements SafeParcelable { @SafeParceled(11) private boolean rotateGesturesEnabled; - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel dest, int flags) { - SafeParcelUtil.writeObject(this, dest, flags); - } - public GoogleMapOptions() { } - private GoogleMapOptions(Parcel in) { - SafeParcelUtil.readObject(this, in); - } - public int getMapType() { return mapType; } @@ -95,13 +79,5 @@ public final class GoogleMapOptions implements SafeParcelable { return rotateGesturesEnabled; } - public static Creator CREATOR = new Creator() { - public GoogleMapOptions createFromParcel(Parcel source) { - return new GoogleMapOptions(source); - } - - public GoogleMapOptions[] newArray(int size) { - return new GoogleMapOptions[size]; - } - }; + public static Creator CREATOR = new AutoCreator<>(GoogleMapOptions.class); } diff --git a/src/com/google/android/gms/maps/model/CameraPosition.java b/src/com/google/android/gms/maps/model/CameraPosition.java index f9bb0bed..c989ed47 100644 --- a/src/com/google/android/gms/maps/model/CameraPosition.java +++ b/src/com/google/android/gms/maps/model/CameraPosition.java @@ -17,10 +17,8 @@ package com.google.android.gms.maps.model; import android.content.Context; -import android.os.Parcel; import android.util.AttributeSet; -import org.microg.safeparcel.SafeParcelUtil; -import org.microg.safeparcel.SafeParcelable; +import org.microg.safeparcel.AutoSafeParcelable; import org.microg.safeparcel.SafeParceled; import java.util.Arrays; @@ -28,7 +26,7 @@ import java.util.Arrays; /** * An immutable class that aggregates all camera position parameters. */ -public final class CameraPosition implements SafeParcelable { +public final class CameraPosition extends AutoSafeParcelable { @SafeParceled(1) private final int versionCode; /** @@ -60,17 +58,10 @@ public final class CameraPosition implements SafeParcelable { */ private CameraPosition() { target = null; - versionCode = -1; + versionCode = 1; zoom = tilt = bearing = 0; } - private CameraPosition(Parcel in) { - this(); - SafeParcelUtil.readObject(this, in); - if (target == null) - throw new NullPointerException("Target must not be null"); - } - /** * Constructs a CameraPosition. * @@ -126,11 +117,6 @@ public final class CameraPosition implements SafeParcelable { return null; // TODO } - @Override - public int describeContents() { - return 0; - } - @Override public boolean equals(Object o) { if (this == o) @@ -181,20 +167,7 @@ public final class CameraPosition implements SafeParcelable { '}'; } - @Override - public void writeToParcel(Parcel out, int flags) { - SafeParcelUtil.writeObject(this, out, flags); - } - - public static Creator CREATOR = new Creator() { - public CameraPosition createFromParcel(Parcel source) { - return new CameraPosition(source); - } - - public CameraPosition[] newArray(int size) { - return new CameraPosition[size]; - } - }; + public static Creator CREATOR = new AutoCreator<>(CameraPosition.class); /** * Builds camera position. diff --git a/src/com/google/android/gms/maps/model/CircleOptions.java b/src/com/google/android/gms/maps/model/CircleOptions.java index 82f2af58..4002c6b7 100644 --- a/src/com/google/android/gms/maps/model/CircleOptions.java +++ b/src/com/google/android/gms/maps/model/CircleOptions.java @@ -17,15 +17,13 @@ package com.google.android.gms.maps.model; import android.graphics.Color; -import android.os.Parcel; -import org.microg.safeparcel.SafeParcelUtil; -import org.microg.safeparcel.SafeParcelable; +import org.microg.safeparcel.AutoSafeParcelable; import org.microg.safeparcel.SafeParceled; /** * Defines options for a Circle. */ -public class CircleOptions implements SafeParcelable { +public class CircleOptions extends AutoSafeParcelable { @SafeParceled(1) private int versionCode; @SafeParceled(2) @@ -49,15 +47,6 @@ public class CircleOptions implements SafeParcelable { public CircleOptions() { } - private CircleOptions(Parcel in) { - SafeParcelUtil.readObject(this, in); - } - - @Override - public int describeContents() { - return 0; - } - /** * Sets the center using a {@link LatLng}. *

@@ -210,11 +199,6 @@ public class CircleOptions implements SafeParcelable { return this; } - @Override - public void writeToParcel(Parcel out, int flags) { - SafeParcelUtil.writeObject(this, out, flags); - } - /** * Sets the zIndex. *

@@ -230,13 +214,5 @@ public class CircleOptions implements SafeParcelable { return this; } - public static Creator CREATOR = new Creator() { - public CircleOptions createFromParcel(Parcel source) { - return new CircleOptions(source); - } - - public CircleOptions[] newArray(int size) { - return new CircleOptions[size]; - } - }; + public static Creator CREATOR = new AutoCreator<>(CircleOptions.class); } diff --git a/src/com/google/android/gms/maps/model/GroundOverlayOptions.java b/src/com/google/android/gms/maps/model/GroundOverlayOptions.java index 3cf9cfb4..12ede558 100644 --- a/src/com/google/android/gms/maps/model/GroundOverlayOptions.java +++ b/src/com/google/android/gms/maps/model/GroundOverlayOptions.java @@ -17,16 +17,14 @@ package com.google.android.gms.maps.model; import android.os.IBinder; -import android.os.Parcel; import com.google.android.gms.dynamic.ObjectWrapper; -import org.microg.safeparcel.SafeParcelUtil; -import org.microg.safeparcel.SafeParcelable; +import org.microg.safeparcel.AutoSafeParcelable; import org.microg.safeparcel.SafeParceled; /** * Defines options for a ground overlay. */ -public class GroundOverlayOptions implements SafeParcelable { +public class GroundOverlayOptions extends AutoSafeParcelable { /** * Flag for when no dimension is specified for the height. */ @@ -64,10 +62,6 @@ public class GroundOverlayOptions implements SafeParcelable { public GroundOverlayOptions() { } - private GroundOverlayOptions(Parcel in) { - SafeParcelUtil.readObject(this, in); - } - /** * Specifies the anchor to be at a particular point in the image. *

@@ -104,11 +98,6 @@ public class GroundOverlayOptions implements SafeParcelable { return this; } - @Override - public int describeContents() { - return 0; - } - /** * Horizontal distance, normalized to [0, 1], of the anchor from the left edge. * @@ -333,11 +322,6 @@ public class GroundOverlayOptions implements SafeParcelable { return this; } - @Override - public void writeToParcel(Parcel out, int flags) { - SafeParcelUtil.writeObject(this, out, flags); - } - /** * Specifies the ground overlay's zIndex, i.e., the order in which it will be drawn. See the * documentation at the top of this class for more information about zIndex. @@ -349,13 +333,6 @@ public class GroundOverlayOptions implements SafeParcelable { return this; } - public static Creator CREATOR = new Creator() { - public GroundOverlayOptions createFromParcel(Parcel source) { - return new GroundOverlayOptions(source); - } - - public GroundOverlayOptions[] newArray(int size) { - return new GroundOverlayOptions[size]; - } - }; + public static Creator CREATOR = new AutoCreator<>( + GroundOverlayOptions.class); } diff --git a/src/com/google/android/gms/maps/model/LatLng.java b/src/com/google/android/gms/maps/model/LatLng.java index 94a25340..2606b533 100644 --- a/src/com/google/android/gms/maps/model/LatLng.java +++ b/src/com/google/android/gms/maps/model/LatLng.java @@ -16,15 +16,13 @@ package com.google.android.gms.maps.model; -import android.os.Parcel; -import org.microg.safeparcel.SafeParcelUtil; -import org.microg.safeparcel.SafeParcelable; +import org.microg.safeparcel.AutoSafeParcelable; import org.microg.safeparcel.SafeParceled; /** * An immutable class representing a pair of latitude and longitude coordinates, stored as degrees. */ -public final class LatLng implements SafeParcelable { +public final class LatLng extends AutoSafeParcelable { @SafeParceled(1) private final int versionCode; /** @@ -43,15 +41,10 @@ public final class LatLng implements SafeParcelable { * In fact, those are replaced by their real values later using SafeParcelUtil. */ private LatLng() { - versionCode = -1; + versionCode = 1; latitude = longitude = 0; } - private LatLng(Parcel in) { - this(); - SafeParcelUtil.readObject(this, in); - } - /** * Constructs a LatLng with the given latitude and longitude, measured in degrees. * @@ -106,24 +99,6 @@ public final class LatLng implements SafeParcelable { public String toString() { return "lat/lng: (" + latitude + "," + longitude + ")"; } - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel out, int flags) { - SafeParcelUtil.writeObject(this, out, flags); - } - - public static Creator CREATOR = new Creator() { - public LatLng createFromParcel(Parcel source) { - return new LatLng(source); - } - - public LatLng[] newArray(int size) { - return new LatLng[size]; - } - }; + + public static Creator CREATOR = new AutoCreator<>(LatLng.class); } diff --git a/src/com/google/android/gms/maps/model/LatLngBounds.java b/src/com/google/android/gms/maps/model/LatLngBounds.java index ac849e37..5a6653f5 100644 --- a/src/com/google/android/gms/maps/model/LatLngBounds.java +++ b/src/com/google/android/gms/maps/model/LatLngBounds.java @@ -16,9 +16,7 @@ package com.google.android.gms.maps.model; -import android.os.Parcel; -import org.microg.safeparcel.SafeParcelUtil; -import org.microg.safeparcel.SafeParcelable; +import org.microg.safeparcel.AutoSafeParcelable; import org.microg.safeparcel.SafeParceled; import java.util.Arrays; @@ -26,7 +24,7 @@ import java.util.Arrays; /** * An immutable class representing a latitude/longitude aligned rectangle. */ -public final class LatLngBounds implements SafeParcelable { +public final class LatLngBounds extends AutoSafeParcelable { @SafeParceled(1) private final int versionCode; /** @@ -45,15 +43,10 @@ public final class LatLngBounds implements SafeParcelable { * In fact, those are replaced by their real values later using SafeParcelUtil. */ private LatLngBounds() { - this.versionCode = -1; + this.versionCode = 1; southwest = northeast = null; } - private LatLngBounds(Parcel in) { - this(); - SafeParcelUtil.readObject(this, in); - } - /** * Creates a new bounds based on a southwest and a northeast corner. *

@@ -110,11 +103,6 @@ public final class LatLngBounds implements SafeParcelable { ); } - @Override - public int describeContents() { - return 0; - } - @Override public boolean equals(Object o) { if (this == o) @@ -190,20 +178,7 @@ public final class LatLngBounds implements SafeParcelable { '}'; } - @Override - public void writeToParcel(Parcel out, int flags) { - SafeParcelUtil.writeObject(this, out, flags); - } - - public static Creator CREATOR = new Creator() { - public LatLngBounds createFromParcel(Parcel source) { - return new LatLngBounds(source); - } - - public LatLngBounds[] newArray(int size) { - return new LatLngBounds[size]; - } - }; + public static Creator CREATOR = new AutoCreator<>(LatLngBounds.class); /** * This is a builder that is able to create a minimum bound based on a set of LatLng points. diff --git a/src/com/google/android/gms/maps/model/MarkerOptions.java b/src/com/google/android/gms/maps/model/MarkerOptions.java index b2683731..4a076ac0 100644 --- a/src/com/google/android/gms/maps/model/MarkerOptions.java +++ b/src/com/google/android/gms/maps/model/MarkerOptions.java @@ -17,13 +17,11 @@ package com.google.android.gms.maps.model; import android.os.IBinder; -import android.os.Parcel; import com.google.android.gms.dynamic.ObjectWrapper; -import org.microg.safeparcel.SafeParcelUtil; -import org.microg.safeparcel.SafeParcelable; +import org.microg.safeparcel.AutoSafeParcelable; import org.microg.safeparcel.SafeParceled; -public class MarkerOptions implements SafeParcelable { +public class MarkerOptions extends AutoSafeParcelable { @SafeParceled(1) private int versionCode = 1; @@ -64,15 +62,6 @@ public class MarkerOptions implements SafeParcelable { public MarkerOptions() { } - private MarkerOptions(Parcel in) { - SafeParcelUtil.readObject(this, in); - } - - @Override - public int describeContents() { - return 0; - } - /** * Sets the alpha (opacity) of the marker. This is a value from 0 to 1, where 0 means the * marker is completely transparent and 1 means the marker is completely opaque. @@ -334,18 +323,5 @@ public class MarkerOptions implements SafeParcelable { return this; } - @Override - public void writeToParcel(Parcel dest, int flags) { - SafeParcelUtil.writeObject(this, dest, flags); - } - - public static Creator CREATOR = new Creator() { - public MarkerOptions createFromParcel(Parcel source) { - return new MarkerOptions(source); - } - - public MarkerOptions[] newArray(int size) { - return new MarkerOptions[size]; - } - }; + public static Creator CREATOR = new AutoCreator<>(MarkerOptions.class); } diff --git a/src/com/google/android/gms/maps/model/PolygonOptions.java b/src/com/google/android/gms/maps/model/PolygonOptions.java index 8898f11e..b74d2ea0 100644 --- a/src/com/google/android/gms/maps/model/PolygonOptions.java +++ b/src/com/google/android/gms/maps/model/PolygonOptions.java @@ -16,39 +16,15 @@ package com.google.android.gms.maps.model; -import android.os.Parcel; -import org.microg.safeparcel.SafeParcelUtil; -import org.microg.safeparcel.SafeParcelable; +import org.microg.safeparcel.AutoSafeParcelable; /** * Defines options for a polygon. * TODO */ -public class PolygonOptions implements SafeParcelable { - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel dest, int flags) { - SafeParcelUtil.writeObject(this, dest, flags); - } - +public class PolygonOptions extends AutoSafeParcelable { public PolygonOptions() { } - private PolygonOptions(Parcel in) { - SafeParcelUtil.readObject(this, in); - } - - public static Creator CREATOR = new Creator() { - public PolygonOptions createFromParcel(Parcel source) { - return new PolygonOptions(source); - } - - public PolygonOptions[] newArray(int size) { - return new PolygonOptions[size]; - } - }; + public static Creator CREATOR = new AutoCreator<>(PolygonOptions.class); } diff --git a/src/com/google/android/gms/maps/model/PolylineOptions.java b/src/com/google/android/gms/maps/model/PolylineOptions.java index 5e861b7e..2a06e96a 100644 --- a/src/com/google/android/gms/maps/model/PolylineOptions.java +++ b/src/com/google/android/gms/maps/model/PolylineOptions.java @@ -16,9 +16,7 @@ package com.google.android.gms.maps.model; -import android.os.Parcel; -import org.microg.safeparcel.SafeParcelUtil; -import org.microg.safeparcel.SafeParcelable; +import org.microg.safeparcel.AutoSafeParcelable; import org.microg.safeparcel.SafeParceled; import java.util.List; @@ -27,7 +25,7 @@ import java.util.List; * Defines options for a polyline. * TODO */ -public class PolylineOptions implements SafeParcelable { +public class PolylineOptions extends AutoSafeParcelable { @SafeParceled(1) private int versionCode; // TODO @@ -41,27 +39,5 @@ public class PolylineOptions implements SafeParcelable { public PolylineOptions() { } - private PolylineOptions(Parcel in) { - SafeParcelUtil.readObject(this, in); - } - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel dest, int flags) { - SafeParcelUtil.writeObject(this, dest, flags); - } - - public static Creator CREATOR = new Creator() { - public PolylineOptions createFromParcel(Parcel source) { - return new PolylineOptions(source); - } - - public PolylineOptions[] newArray(int size) { - return new PolylineOptions[size]; - } - }; + public static Creator CREATOR = new AutoCreator<>(PolylineOptions.class); } diff --git a/src/com/google/android/gms/maps/model/Tile.java b/src/com/google/android/gms/maps/model/Tile.java index 9ba8b612..a3062e5f 100644 --- a/src/com/google/android/gms/maps/model/Tile.java +++ b/src/com/google/android/gms/maps/model/Tile.java @@ -1,15 +1,13 @@ package com.google.android.gms.maps.model; -import android.os.Parcel; -import org.microg.safeparcel.SafeParcelUtil; -import org.microg.safeparcel.SafeParcelable; +import org.microg.safeparcel.AutoSafeParcelable; import org.microg.safeparcel.SafeParceled; /** * Contains information about a Tile that is returned by a {@link TileProvider}. * TODO SafeParceled */ -public class Tile implements SafeParcelable { +public class Tile extends AutoSafeParcelable { @SafeParceled(1) private final int versionCode; /** @@ -30,16 +28,11 @@ public class Tile implements SafeParcelable { public final byte[] data; private Tile() { - versionCode = -1; + versionCode = 1; width = height = 0; data = null; } - private Tile(Parcel in) { - this(); - SafeParcelUtil.readObject(this, in); - } - /** * Constructs a {@link Tile}. * @@ -56,23 +49,5 @@ public class Tile implements SafeParcelable { this.data = data; } - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel out, int flags) { - SafeParcelUtil.writeObject(this, out, flags); - } - - public static Creator CREATOR = new Creator() { - public Tile createFromParcel(Parcel source) { - return new Tile(source); - } - - public Tile[] newArray(int size) { - return new Tile[size]; - } - }; + public static Creator CREATOR = new AutoCreator<>(Tile.class); } diff --git a/src/com/google/android/gms/maps/model/TileOverlayOptions.java b/src/com/google/android/gms/maps/model/TileOverlayOptions.java index b38a5dce..15523837 100644 --- a/src/com/google/android/gms/maps/model/TileOverlayOptions.java +++ b/src/com/google/android/gms/maps/model/TileOverlayOptions.java @@ -17,17 +17,15 @@ package com.google.android.gms.maps.model; import android.os.IBinder; -import android.os.Parcel; import android.os.RemoteException; import com.google.android.gms.maps.model.internal.ITileProviderDelegate; -import org.microg.safeparcel.SafeParcelUtil; -import org.microg.safeparcel.SafeParcelable; +import org.microg.safeparcel.AutoSafeParcelable; import org.microg.safeparcel.SafeParceled; /** * Defines options for a TileOverlay. */ -public class TileOverlayOptions implements SafeParcelable { +public class TileOverlayOptions extends AutoSafeParcelable { @SafeParceled(1) private final int versionCode = 1; @@ -50,15 +48,6 @@ public class TileOverlayOptions implements SafeParcelable { public TileOverlayOptions() { } - private TileOverlayOptions(Parcel in) { - SafeParcelUtil.readObject(this, in); - } - - @Override - public int describeContents() { - return 0; - } - /** * Specifies whether the tiles should fade in. The default is {@code true}. * @@ -132,11 +121,6 @@ public class TileOverlayOptions implements SafeParcelable { return this; } - @Override - public void writeToParcel(Parcel dest, int flags) { - SafeParcelUtil.writeObject(this, dest, flags); - } - /** * Specifies the tile overlay's zIndex, i.e., the order in which it will be drawn where * overlays with larger values are drawn above those with lower values. See the documentation @@ -149,13 +133,5 @@ public class TileOverlayOptions implements SafeParcelable { return this; } - public static Creator CREATOR = new Creator() { - public TileOverlayOptions createFromParcel(Parcel source) { - return new TileOverlayOptions(source); - } - - public TileOverlayOptions[] newArray(int size) { - return new TileOverlayOptions[size]; - } - }; + public static Creator CREATOR = new AutoCreator<>(TileOverlayOptions.class); } diff --git a/src/com/google/android/gms/maps/model/VisibleRegion.java b/src/com/google/android/gms/maps/model/VisibleRegion.java index 7f96402f..43f161db 100644 --- a/src/com/google/android/gms/maps/model/VisibleRegion.java +++ b/src/com/google/android/gms/maps/model/VisibleRegion.java @@ -16,12 +16,10 @@ package com.google.android.gms.maps.model; -import android.os.Parcel; -import org.microg.safeparcel.SafeParcelUtil; -import org.microg.safeparcel.SafeParcelable; +import org.microg.safeparcel.AutoSafeParcelable; import org.microg.safeparcel.SafeParceled; -public class VisibleRegion implements SafeParcelable { +public class VisibleRegion extends AutoSafeParcelable { @SafeParceled(1) private int versionCode; @SafeParceled(2) @@ -35,6 +33,9 @@ public class VisibleRegion implements SafeParcelable { @SafeParceled(6) private LatLngBounds bounds; + private VisibleRegion() { + } + public VisibleRegion(int versionCode, LatLng nearLeft, LatLng nearRight, LatLng farLeft, LatLng farRight, LatLngBounds bounds) { this.versionCode = versionCode; @@ -60,27 +61,5 @@ public class VisibleRegion implements SafeParcelable { bounds); } - public VisibleRegion(Parcel in) { - SafeParcelUtil.readObject(this, in); - } - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel dest, int flags) { - SafeParcelUtil.writeObject(this, dest, flags); - } - - public static Creator CREATOR = new Creator() { - public VisibleRegion createFromParcel(Parcel source) { - return new VisibleRegion(source); - } - - public VisibleRegion[] newArray(int size) { - return new VisibleRegion[size]; - } - }; + public static Creator CREATOR = new AutoCreator<>(VisibleRegion.class); } diff --git a/src/org/microg/gms/Constants.java b/src/org/microg/gms/Constants.java index 9ff2f907..a855bbc5 100644 --- a/src/org/microg/gms/Constants.java +++ b/src/org/microg/gms/Constants.java @@ -8,6 +8,7 @@ public class Constants { public static final int MAX_REFERENCE_VERSION = 6599436; public static final String ACTION_GMS_LOCATION_MANAGER_SERVICE_START = "com.google.android.location.internal.GoogleLocationManagerService.START"; public static final String KEY_MOCK_LOCATION = "mockLocation"; + public static final String DEFAULT_ACCOUNT = "<>"; /** * No base map tiles.