| 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.os.Parcel; |
| 20 |
import android.os.Parcelable; |
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
public class ActivityRecognitionEvent implements Parcelable { |
| 28 |
private final String mActivity; |
| 29 |
private final int mEventType; |
| 30 |
private final long mTimestampNs; |
| 31 |
|
| 32 |
public ActivityRecognitionEvent(String activity, int eventType, long timestampNs) { |
| 33 |
mActivity = activity; |
| 34 |
mEventType = eventType; |
| 35 |
mTimestampNs = timestampNs; |
| 36 |
} |
| 37 |
|
| 38 |
public String getActivity() { |
| 39 |
return mActivity; |
| 40 |
} |
| 41 |
|
| 42 |
public int getEventType() { |
| 43 |
return mEventType; |
| 44 |
} |
| 45 |
|
| 46 |
public long getTimestampNs() { |
| 47 |
return mTimestampNs; |
| 48 |
} |
| 49 |
|
| 50 |
public static final @android.annotation.NonNull Creator<ActivityRecognitionEvent> CREATOR = |
| 51 |
new Creator<ActivityRecognitionEvent>() { |
| 52 |
@Override |
| 53 |
public ActivityRecognitionEvent createFromParcel(Parcel source) { |
| 54 |
String activity = source.readString(); |
| 55 |
int eventType = source.readInt(); |
| 56 |
long timestampNs = source.readLong(); |
| 57 |
|
| 58 |
return new ActivityRecognitionEvent(activity, eventType, timestampNs); |
| 59 |
} |
| 60 |
|
| 61 |
@Override |
| 62 |
public ActivityRecognitionEvent[] newArray(int size) { |
| 63 |
return new ActivityRecognitionEvent[size]; |
| 64 |
} |
| 65 |
}; |
| 66 |
|
| 67 |
@Override |
| 68 |
public int describeContents() { |
| 69 |
return 0; |
| 70 |
} |
| 71 |
|
| 72 |
@Override |
| 73 |
public void writeToParcel(Parcel parcel, int flags) { |
| 74 |
parcel.writeString(mActivity); |
| 75 |
parcel.writeInt(mEventType); |
| 76 |
parcel.writeLong(mTimestampNs); |
| 77 |
} |
| 78 |
|
| 79 |
@Override |
| 80 |
public String toString() { |
| 81 |
return String.format( |
| 82 |
"Activity='%s', EventType=%s, TimestampNs=%s", |
| 83 |
mActivity, |
| 84 |
mEventType, |
| 85 |
mTimestampNs); |
| 86 |
} |
| 87 |
} |