Event
class Event
kotlin.Any | |
↳ | android.app.usage.UsageEvents.Event |
An event representing a state change for a component.
Summary
Constants | |
---|---|
static Int |
An event type denoting that an |
static Int |
An event type denoting that an |
static Int |
An activity becomes invisible on the UI, corresponding to |
static Int |
An event type denoting that the device configuration has changed. |
static Int |
An event type denoting that the Android runtime underwent a shutdown process. |
static Int |
An event type denoting that the Android runtime started up. |
static Int |
An event type denoting start of a foreground service. |
static Int |
An event type denoting stop of a foreground service. |
static Int |
An event type denoting that the screen's keyguard has been hidden. |
static Int |
An event type denoting that the screen's keyguard has been shown, whether or not the screen is off. |
static Int | |
static Int | |
static Int |
No event type. |
static Int |
An event type denoting that the screen has gone in to an interactive state (turned on for full user interaction, not ambient display or other non-interactive state). |
static Int |
An event type denoting that the screen has gone in to a non-interactive state (completely turned off or turned on only in a non-interactive state like ambient display). |
static Int |
An event type denoting that an action equivalent to a ShortcutInfo is taken by the user. |
static Int |
An event type denoting a change in App Standby Bucket. |
static Int |
An event type denoting that a package was interacted with in some way by the user. |
Public constructors | |
---|---|
Event() |
Public methods | |
---|---|
Int |
Returns the standby bucket of the app, if the event is of type |
String! |
The class name of the source of this event. |
Configuration! |
Returns a |
Int |
The event type. |
PersistableBundle |
Retrieves a map of extended data from the event if the event is of type |
String! |
The package name of the source of this event. |
String! |
Returns the ID of a |
Long |
The time at which this event occurred, measured in milliseconds since the epoch. |
Constants
ACTIVITY_PAUSED
static val ACTIVITY_PAUSED: Int
An event type denoting that an android.app.Activity
moved to the background. This event has a package name and class name associated with it and can be retrieved using getPackageName()
and getClassName()
. If a package has multiple activities, this event is reported for each activity that moves to background. This event is corresponding to android.app.Activity#onPause()
of the activity's lifecycle.
Value: 2
ACTIVITY_RESUMED
static val ACTIVITY_RESUMED: Int
An event type denoting that an android.app.Activity
moved to the foreground. This event has a package name and class name associated with it and can be retrieved using getPackageName()
and getClassName()
. If a package has multiple activities, this event is reported for each activity that moves to foreground. This event is corresponding to android.app.Activity#onResume()
of the activity's lifecycle.
Value: 1
ACTIVITY_STOPPED
static val ACTIVITY_STOPPED: Int
An activity becomes invisible on the UI, corresponding to android.app.Activity#onStop()
of the activity's lifecycle.
Value: 23
CONFIGURATION_CHANGE
static val CONFIGURATION_CHANGE: Int
An event type denoting that the device configuration has changed.
Value: 5
DEVICE_SHUTDOWN
static val DEVICE_SHUTDOWN: Int
An event type denoting that the Android runtime underwent a shutdown process. A DEVICE_SHUTDOWN event should be treated as if all started activities and foreground services are now stopped and no explicit ACTIVITY_STOPPED
and FOREGROUND_SERVICE_STOP
events will be generated for them.
The DEVICE_SHUTDOWN timestamp is actually the last time UsageStats database is persisted before the actual shutdown. Events (if there are any) between this timestamp and the actual shutdown is not persisted in the database. So any open events without matching close events between DEVICE_SHUTDOWN and DEVICE_STARTUP
should be ignored because the closing time is unknown.
Value: 26
DEVICE_STARTUP
static val DEVICE_STARTUP: Int
An event type denoting that the Android runtime started up. This could be after a shutdown or a runtime restart. Any open events without matching close events between DEVICE_SHUTDOWN
and DEVICE_STARTUP should be ignored because the closing time is unknown.
Value: 27
FOREGROUND_SERVICE_START
static val FOREGROUND_SERVICE_START: Int
An event type denoting start of a foreground service. This event has a package name and class name associated with it and can be retrieved using getPackageName()
and getClassName()
. If a package has multiple foreground services, this event is reported for each service that is started.
Value: 19
FOREGROUND_SERVICE_STOP
static val FOREGROUND_SERVICE_STOP: Int
An event type denoting stop of a foreground service. This event has a package name and class name associated with it and can be retrieved using getPackageName()
and getClassName()
. If a package has multiple foreground services, this event is reported for each service that is stopped.
Value: 20
KEYGUARD_HIDDEN
static val KEYGUARD_HIDDEN: Int
An event type denoting that the screen's keyguard has been hidden. This typically happens when the user unlocks their phone after turning it on.
Value: 18
KEYGUARD_SHOWN
static val KEYGUARD_SHOWN: Int
An event type denoting that the screen's keyguard has been shown, whether or not the screen is off.
Value: 17
SCREEN_INTERACTIVE
static val SCREEN_INTERACTIVE: Int
An event type denoting that the screen has gone in to an interactive state (turned on for full user interaction, not ambient display or other non-interactive state).
Value: 15
SCREEN_NON_INTERACTIVE
static val SCREEN_NON_INTERACTIVE: Int
An event type denoting that the screen has gone in to a non-interactive state (completely turned off or turned on only in a non-interactive state like ambient display).
Value: 16
SHORTCUT_INVOCATION
static val SHORTCUT_INVOCATION: Int
An event type denoting that an action equivalent to a ShortcutInfo is taken by the user.
Value: 8
STANDBY_BUCKET_CHANGED
static val STANDBY_BUCKET_CHANGED: Int
An event type denoting a change in App Standby Bucket. The new bucket can be retrieved by calling getAppStandbyBucket()
.
Value: 11
USER_INTERACTION
static val USER_INTERACTION: Int
An event type denoting that a package was interacted with in some way by the user.
Value: 7
Public constructors
Public methods
getAppStandbyBucket
fun getAppStandbyBucket(): Int
Returns the standby bucket of the app, if the event is of type STANDBY_BUCKET_CHANGED
, otherwise returns 0.
Return | |
---|---|
Int |
the standby bucket associated with the event. |
getClassName
fun getClassName(): String!
The class name of the source of this event. This may be null for certain events.
getConfiguration
fun getConfiguration(): Configuration!
Returns a Configuration
for this event if the event is of type CONFIGURATION_CHANGE
, otherwise it returns null.
getExtras
fun getExtras(): PersistableBundle
Retrieves a map of extended data from the event if the event is of type USER_INTERACTION
.
Return | |
---|---|
PersistableBundle |
the map of all extras that associated with the reported user interaction event. The returned PersistableBundle will contain the extras UsageStatsManager.EXTRA_EVENT_CATEGORY and UsageStatsManager.EXTRA_EVENT_ACTION . PersistableBundle.EMPTY will be returned if the details are not available. This value cannot be null . |
getPackageName
fun getPackageName(): String!
The package name of the source of this event.
getShortcutId
fun getShortcutId(): String!
Returns the ID of a android.content.pm.ShortcutInfo
for this event if the event is of type SHORTCUT_INVOCATION
, otherwise it returns null.
getTimeStamp
fun getTimeStamp(): Long
The time at which this event occurred, measured in milliseconds since the epoch.
SeeSystem.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. |