UsageStats
class UsageStats : Parcelable
| kotlin.Any | |
| ↳ | android.app.usage.UsageStats |
Contains usage statistics for an app package for a specific time range.
Summary
Inherited constants |
|
|---|---|
Public constructors |
|
|---|---|
<init>(stats: UsageStats!) |
|
Public methods |
|
|---|---|
| Unit |
add(right: UsageStats!)Add the statistics from the right |
| Int | |
| Long |
Get the beginning of the time range this |
| Long |
Get the last time this package's foreground service was used, measured in milliseconds since the epoch. |
| Long |
Get the end of the time range this |
| Long |
Get the last time this package's activity was used, measured in milliseconds since the epoch. |
| Long |
Get the last time this package's activity is visible in the UI, measured in milliseconds since the epoch. |
| String! | |
| Long |
Get the total time this package's foreground services are started, measured in milliseconds. |
| Long |
Get the total time this package spent in the foreground, measured in milliseconds. |
| Long |
Get the total time this package's activity is visible in the UI, measured in milliseconds. |
| Unit |
writeToParcel(dest: Parcel!, flags: Int) |
Properties |
|
|---|---|
| static Parcelable.Creator<UsageStats!> | |
Public constructors
Public methods
add
fun add(right: UsageStats!): Unit
Add the statistics from the right UsageStats to the left. The package name for both UsageStats objects must be the same.
| Parameters | |
|---|---|
right |
UsageStats!: The UsageStats object to merge into this one. |
| Exceptions | |
|---|---|
java.lang.IllegalArgumentException |
if the package names of the two UsageStats objects are different. |
describeContents
fun describeContents(): Int
| Return | |
|---|---|
Int |
a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR |
getFirstTimeStamp
fun getFirstTimeStamp(): Long
Get the beginning of the time range this android.app.usage.UsageStats represents, measured in milliseconds since the epoch.
System#currentTimeMillis().getLastTimeForegroundServiceUsed
fun getLastTimeForegroundServiceUsed(): Long
Get the last time this package's foreground service was used, measured in milliseconds since the epoch.
SeeSystem#currentTimeMillis().getLastTimeStamp
fun getLastTimeStamp(): Long
Get the end of the time range this android.app.usage.UsageStats represents, measured in milliseconds since the epoch.
System#currentTimeMillis().getLastTimeUsed
fun getLastTimeUsed(): Long
Get the last time this package's activity was used, measured in milliseconds since the epoch.
SeeSystem#currentTimeMillis().getLastTimeVisible
fun getLastTimeVisible(): Long
Get the last time this package's activity is visible in the UI, measured in milliseconds since the epoch.
getTotalTimeForegroundServiceUsed
fun getTotalTimeForegroundServiceUsed(): Long
Get the total time this package's foreground services are started, measured in milliseconds.
getTotalTimeInForeground
fun getTotalTimeInForeground(): Long
Get the total time this package spent in the foreground, measured in milliseconds.
getTotalTimeVisible
fun getTotalTimeVisible(): Long
Get the total time this package's activity is visible in the UI, measured in milliseconds.
writeToParcel
fun writeToParcel(
dest: Parcel!,
flags: Int
): Unit
| Parameters | |
|---|---|
dest |
Parcel!: The Parcel in which the object should be written. |
flags |
Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES |