| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package android.hardware.location; |
| 18 |
|
| 19 |
import android.annotation.NonNull; |
| 20 |
import android.annotation.SystemApi; |
| 21 |
import android.location.Location; |
| 22 |
import android.os.Parcel; |
| 23 |
import android.os.Parcelable; |
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
@SystemApi |
| 31 |
public class GeofenceHardwareMonitorEvent implements Parcelable { |
| 32 |
private final int mMonitoringType; |
| 33 |
private final int mMonitoringStatus; |
| 34 |
private final int mSourceTechnologies; |
| 35 |
private final Location mLocation; |
| 36 |
|
| 37 |
public GeofenceHardwareMonitorEvent( |
| 38 |
int monitoringType, |
| 39 |
int monitoringStatus, |
| 40 |
int sourceTechnologies, |
| 41 |
Location location) { |
| 42 |
mMonitoringType = monitoringType; |
| 43 |
mMonitoringStatus = monitoringStatus; |
| 44 |
mSourceTechnologies = sourceTechnologies; |
| 45 |
mLocation = location; |
| 46 |
} |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
public int getMonitoringType() { |
| 52 |
return mMonitoringType; |
| 53 |
} |
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
public int getMonitoringStatus() { |
| 59 |
return mMonitoringStatus; |
| 60 |
} |
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
public int getSourceTechnologies() { |
| 66 |
return mSourceTechnologies; |
| 67 |
} |
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
public Location getLocation() { |
| 73 |
return mLocation; |
| 74 |
} |
| 75 |
|
| 76 |
public static final @NonNull Creator<GeofenceHardwareMonitorEvent> CREATOR = |
| 77 |
new Creator<GeofenceHardwareMonitorEvent>() { |
| 78 |
@Override |
| 79 |
public GeofenceHardwareMonitorEvent createFromParcel(Parcel source) { |
| 80 |
ClassLoader classLoader = GeofenceHardwareMonitorEvent.class.getClassLoader(); |
| 81 |
int monitoringType = source.readInt(); |
| 82 |
int monitoringStatus = source.readInt(); |
| 83 |
int sourceTechnologies = source.readInt(); |
| 84 |
Location location = source.readParcelable(classLoader, android.location.Location.class); |
| 85 |
|
| 86 |
return new GeofenceHardwareMonitorEvent( |
| 87 |
monitoringType, |
| 88 |
monitoringStatus, |
| 89 |
sourceTechnologies, |
| 90 |
location); |
| 91 |
} |
| 92 |
|
| 93 |
@Override |
| 94 |
public GeofenceHardwareMonitorEvent[] newArray(int size) { |
| 95 |
return new GeofenceHardwareMonitorEvent[size]; |
| 96 |
} |
| 97 |
}; |
| 98 |
|
| 99 |
@Override |
| 100 |
public int describeContents() { |
| 101 |
return 0; |
| 102 |
} |
| 103 |
|
| 104 |
@Override |
| 105 |
public void writeToParcel(Parcel parcel, int flags) { |
| 106 |
parcel.writeInt(mMonitoringType); |
| 107 |
parcel.writeInt(mMonitoringStatus); |
| 108 |
parcel.writeInt(mSourceTechnologies); |
| 109 |
parcel.writeParcelable(mLocation, flags); |
| 110 |
} |
| 111 |
|
| 112 |
@NonNull |
| 113 |
@Override |
| 114 |
public String toString() { |
| 115 |
return String.format( |
| 116 |
"GeofenceHardwareMonitorEvent: type=%d, status=%d, sources=%d, location=%s", |
| 117 |
mMonitoringType, |
| 118 |
mMonitoringStatus, |
| 119 |
mSourceTechnologies, |
| 120 |
mLocation); |
| 121 |
} |
| 122 |
} |