UsageEventsQuery.Builder
public
static
final
class
UsageEventsQuery.Builder
extends Object
Builder for UsageEventsQuery.
Summary
Public constructors |
Builder(long beginTimeMillis, long endTimeMillis)
Constructor that specifies the period for which to return events.
|
Inherited methods |
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this object.
|
boolean
|
equals(Object obj)
Indicates whether some other object is "equal to" this one.
|
void
|
finalize()
Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
|
final
Class<?>
|
getClass()
Returns the runtime class of this Object .
|
int
|
hashCode()
Returns a hash code value for the object.
|
final
void
|
notify()
Wakes up a single thread that is waiting on this object's
monitor.
|
final
void
|
notifyAll()
Wakes up all threads that are waiting on this object's monitor.
|
String
|
toString()
Returns a string representation of the object.
|
final
void
|
wait(long timeoutMillis, int nanos)
Causes the current thread to wait until it is awakened, typically
by being notified or interrupted, or until a
certain amount of real time has elapsed.
|
final
void
|
wait(long timeoutMillis)
Causes the current thread to wait until it is awakened, typically
by being notified or interrupted, or until a
certain amount of real time has elapsed.
|
final
void
|
wait()
Causes the current thread to wait until it is awakened, typically
by being notified or interrupted.
|
|
Public constructors
Builder
public Builder (long beginTimeMillis,
long endTimeMillis)
Constructor that specifies the period for which to return events.
Parameters |
beginTimeMillis |
long : Inclusive beginning timestamp, as per
System.currentTimeMillis()
Value is a non-negative timestamp measured as the number of
milliseconds since 1970-01-01T00:00:00Z. |
endTimeMillis |
long : Exclusive ending timestamp, as per
System.currentTimeMillis()
Value is a non-negative timestamp measured as the number of
milliseconds since 1970-01-01T00:00:00Z. |
Public methods
build
public UsageEventsQuery build ()
Builds a read-only UsageEventsQuery object.
setEventTypes
public UsageEventsQuery.Builder setEventTypes (int... eventTypes)
Sets the list of usage event types to be included in the query.
Note:
An empty array will be returned by
UsageEventsQuery.getEventTypes()
without calling this method, which indicates
querying for all event types. Apps are encouraged to provide a list of event types.
Only the matching types supplied will be used to query.
Parameters |
eventTypes |
int : the array of the usage event types. See UsageEvents.Event .
This value cannot be null .
Value is UsageEvents.Event.NONE , UsageEvents.Event.ACTIVITY_RESUMED , UsageEvents.Event.ACTIVITY_PAUSED , android.app.usage.UsageEvents.Event.END_OF_DAY, android.app.usage.UsageEvents.Event.CONTINUE_PREVIOUS_DAY, UsageEvents.Event.CONFIGURATION_CHANGE , android.app.usage.UsageEvents.Event.SYSTEM_INTERACTION, UsageEvents.Event.USER_INTERACTION , UsageEvents.Event.SHORTCUT_INVOCATION , android.app.usage.UsageEvents.Event.CHOOSER_ACTION, android.app.usage.UsageEvents.Event.NOTIFICATION_SEEN, 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, UsageEvents.Event.SCREEN_INTERACTIVE , UsageEvents.Event.SCREEN_NON_INTERACTIVE , UsageEvents.Event.KEYGUARD_SHOWN , UsageEvents.Event.KEYGUARD_HIDDEN , UsageEvents.Event.FOREGROUND_SERVICE_START , UsageEvents.Event.FOREGROUND_SERVICE_STOP , android.app.usage.UsageEvents.Event.CONTINUING_FOREGROUND_SERVICE, android.app.usage.UsageEvents.Event.ROLLOVER_FOREGROUND_SERVICE, UsageEvents.Event.ACTIVITY_STOPPED , android.app.usage.UsageEvents.Event.ACTIVITY_DESTROYED, android.app.usage.UsageEvents.Event.FLUSH_TO_DISK, UsageEvents.Event.DEVICE_SHUTDOWN , 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 |
setPackageNames
public UsageEventsQuery.Builder setPackageNames (String... pkgNames)
Sets the list of package names to be included in the query.
Note:
An empty
Set
will be returned by
UsageEventsQuery.getPackageNames()
without calling this method, which indicates
querying usage events for all packages. Apps are encouraged to provide a list of package
names. Only the matching names supplied will be used to query.
Parameters |
pkgNames |
String : the array of the package names, each package name should be a non-empty
string, null or empty string("") is omitted. |