Update GeofenceHardwareRequestParcelable to match parcel/unparcel format.

Test: manual
Bug: 216631962

Change-Id: I3d6d1be9d6c312fe0bf98f600ff8fc9c617f8ec3
This commit is contained in:
David Christie
2022-03-11 01:13:31 +00:00
parent 1adea76f46
commit 3e1ffdb294

View File

@@ -16,9 +16,9 @@
package android.hardware.location; package android.hardware.location;
import android.os.BadParcelableException;
import android.os.Parcel; import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;
import android.util.Log;
/** /**
* Geofence Hardware Request used for internal location services communication. * Geofence Hardware Request used for internal location services communication.
@@ -139,11 +139,8 @@ public final class GeofenceHardwareRequestParcelable implements Parcelable {
@Override @Override
public GeofenceHardwareRequestParcelable createFromParcel(Parcel parcel) { public GeofenceHardwareRequestParcelable createFromParcel(Parcel parcel) {
int geofenceType = parcel.readInt(); int geofenceType = parcel.readInt();
if(geofenceType != GeofenceHardwareRequest.GEOFENCE_TYPE_CIRCLE) { if (geofenceType != GeofenceHardwareRequest.GEOFENCE_TYPE_CIRCLE) {
Log.e( throw new BadParcelableException("Invalid Geofence type: " + geofenceType);
"GeofenceHardwareRequest",
String.format("Invalid Geofence type: %d", geofenceType));
return null;
} }
GeofenceHardwareRequest request = GeofenceHardwareRequest.createCircularGeofence( GeofenceHardwareRequest request = GeofenceHardwareRequest.createCircularGeofence(