public final class UsageStats extends Object implements Parcelable
Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>
Modifier and Type | Field and Description |
---|---|
static Parcelable.Creator<UsageStats> |
CREATOR |
long |
mBeginTimeStamp |
long |
mEndTimeStamp |
int |
mLastEvent |
long |
mLastTimeUsed
Last time used by the user with an explicit action (notification, activity launch).
|
int |
mLaunchCount |
String |
mPackageName |
long |
mTotalTimeInForeground |
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_ELIDE_DUPLICATES, PARCELABLE_WRITE_RETURN_VALUE
Constructor and Description |
---|
UsageStats() |
UsageStats(UsageStats stats) |
Modifier and Type | Method and Description |
---|---|
void |
add(UsageStats right)
Add the statistics from the right
UsageStats to the left. |
int |
describeContents()
Describe the kinds of special objects contained in this Parcelable
instance's marshaled representation.
|
long |
getFirstTimeStamp()
Get the beginning of the time range this
UsageStats represents,
measured in milliseconds since the epoch. |
long |
getLastTimeStamp()
Get the end of the time range this
UsageStats represents,
measured in milliseconds since the epoch. |
long |
getLastTimeUsed()
Get the last time this package was used, measured in milliseconds since the epoch.
|
String |
getPackageName() |
long |
getTotalTimeInForeground()
Get the total time this package spent in the foreground, measured in milliseconds.
|
void |
writeToParcel(Parcel dest,
int flags)
Flatten this object in to a Parcel.
|
public String mPackageName
public long mBeginTimeStamp
public long mEndTimeStamp
public long mLastTimeUsed
public long mTotalTimeInForeground
public int mLaunchCount
public int mLastEvent
public static final Parcelable.Creator<UsageStats> CREATOR
public UsageStats()
public UsageStats(UsageStats stats)
public String getPackageName()
public long getFirstTimeStamp()
UsageStats
represents,
measured in milliseconds since the epoch.
See System.currentTimeMillis()
.public long getLastTimeStamp()
UsageStats
represents,
measured in milliseconds since the epoch.
See System.currentTimeMillis()
.public long getLastTimeUsed()
System.currentTimeMillis()
.public long getTotalTimeInForeground()
public void add(UsageStats right)
UsageStats
to the left. The package name for
both UsageStats
objects must be the same.right
- The UsageStats
object to merge into this one.IllegalArgumentException
- if the package names of the two
UsageStats
objects are different.public int describeContents()
Parcelable
Parcelable.writeToParcel(Parcel, int)
,
the return value of this method must include the
Parcelable.CONTENTS_FILE_DESCRIPTOR
bit.describeContents
in interface Parcelable
Parcelable.CONTENTS_FILE_DESCRIPTOR
public void writeToParcel(Parcel dest, int flags)
Parcelable
writeToParcel
in interface Parcelable
dest
- The Parcel in which the object should be written.flags
- Additional flags about how the object should be written.
May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE
.