Added in API level 35

UsageEventsQuery


class UsageEventsQuery : Parcelable
kotlin.Any
   ↳ android.app.usage.UsageEventsQuery

An Object-Oriented representation for a UsageEvents query. Used by UsageStatsManager#queryEvents(UsageEventsQuery) call.

Summary

Nested classes

Builder for UsageEventsQuery.

Inherited constants
Public methods
Int

Long

Returns the inclusive timestamp to indicate the beginning of the range of events.

Long

Returns the exclusive timpstamp to indicate the end of the range of events.

IntArray

Retrieves the usage event types for the query.

MutableSet<String!>

Retrieves a Set of package names for the query.

Unit
writeToParcel(dest: Parcel, flags: Int)

Flatten this object in to a Parcel.

Properties
static Parcelable.Creator<UsageEventsQuery!>

Public methods

describeContents

Added in API level 35
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

getBeginTimeMillis

Added in API level 35
fun getBeginTimeMillis(): Long

Returns the inclusive timestamp to indicate the beginning of the range of events. Defined in terms of "Unix time", see java.lang.System#currentTimeMillis.
Value is a non-negative timestamp measured as the number of milliseconds since 1970-01-01T00:00:00Z.

Return
Long Value is a non-negative timestamp measured as the number of milliseconds since 1970-01-01T00:00:00Z.

getEndTimeMillis

Added in API level 35
fun getEndTimeMillis(): Long

Returns the exclusive timpstamp to indicate the end of the range of events. Defined in terms of "Unix time", see java.lang.System#currentTimeMillis.
Value is a non-negative timestamp measured as the number of milliseconds since 1970-01-01T00:00:00Z.

Return
Long Value is a non-negative timestamp measured as the number of milliseconds since 1970-01-01T00:00:00Z.

getEventTypes

Added in API level 35
fun getEventTypes(): IntArray

Retrieves the usage event types for the query.

Note that an empty array indicates querying all usage event types, and it may cause additional system overhead when calling UsageStatsManager#queryEvents(UsageEventsQuery). Apps are encouraged to provide a list of event types via Builder#setEventTypes(int...)

Return
IntArray an array contains the usage event types that was previously set using Builder#setEventTypes(int...) or an empty array if no value has been set. This value cannot be null. Value is android.app.usage.UsageEvents.Event#NONE, android.app.usage.UsageEvents.Event#ACTIVITY_RESUMED, android.app.usage.UsageEvents.Event#ACTIVITY_PAUSED, android.app.usage.UsageEvents.Event.END_OF_DAY, android.app.usage.UsageEvents.Event.CONTINUE_PREVIOUS_DAY, android.app.usage.UsageEvents.Event#CONFIGURATION_CHANGE, android.app.usage.UsageEvents.Event.SYSTEM_INTERACTION, android.app.usage.UsageEvents.Event#USER_INTERACTION, android.app.usage.UsageEvents.Event#SHORTCUT_INVOCATION, android.app.usage.UsageEvents.Event.CHOOSER_ACTION, android.app.usage.UsageEvents.Event.NOTIFICATION_SEEN, android.app.usage.UsageEvents.Event#STANDBY_BUCKET_CHANGED, android.app.usage.UsageEvents.Event.NOTIFICATION_INTERRUPTION, android.app.usage.UsageEvents.Event.SLICE_PINNED_PRIV, android.app.usage.UsageEvents.Event.SLICE_PINNED, android.app.usage.UsageEvents.Event#SCREEN_INTERACTIVE, android.app.usage.UsageEvents.Event#SCREEN_NON_INTERACTIVE, android.app.usage.UsageEvents.Event#KEYGUARD_SHOWN, android.app.usage.UsageEvents.Event#KEYGUARD_HIDDEN, android.app.usage.UsageEvents.Event#FOREGROUND_SERVICE_START, android.app.usage.UsageEvents.Event#FOREGROUND_SERVICE_STOP, android.app.usage.UsageEvents.Event.CONTINUING_FOREGROUND_SERVICE, android.app.usage.UsageEvents.Event.ROLLOVER_FOREGROUND_SERVICE, android.app.usage.UsageEvents.Event#ACTIVITY_STOPPED, android.app.usage.UsageEvents.Event.ACTIVITY_DESTROYED, android.app.usage.UsageEvents.Event.FLUSH_TO_DISK, android.app.usage.UsageEvents.Event#DEVICE_SHUTDOWN, android.app.usage.UsageEvents.Event#DEVICE_STARTUP, android.app.usage.UsageEvents.Event.USER_UNLOCKED, android.app.usage.UsageEvents.Event.USER_STOPPED, android.app.usage.UsageEvents.Event.LOCUS_ID_SET, or android.app.usage.UsageEvents.Event.APP_COMPONENT_USED

getPackageNames

Added in API level 35
fun getPackageNames(): MutableSet<String!>

Retrieves a Set of package names for the query.

Note that an empty set indicates querying usage events for all packages, and it may cause additional system overhead when calling UsageStatsManager#queryEvents(UsageEventsQuery). Apps are encouraged to provide a list of package names via Builder#setPackageNames(String...)

Return
MutableSet<String!> a Set contains the package names that was previously set through Builder#setPackageNames(String...) or an empty set if no value has been set. This value cannot be null.

writeToParcel

Added in API level 35
fun writeToParcel(
    dest: Parcel,
    flags: Int
): Unit

Flatten this object in to a Parcel.

Parameters
dest Parcel: This value cannot be null.
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

Properties

CREATOR

Added in API level 35
static val CREATOR: Parcelable.Creator<UsageEventsQuery!>