1 package com.android.eventlib;
2 
3 /**
4  * Service exposed to allow other packages to query logged events in this package.
5  */
6 interface IQueryService {
7     /**
8      * Initialise a new query.
9      *
10      * <p>This method must be called before any other interaction with this service.
11      *
12      * <p>The {@code data} must contain a {@code QUERIER} key which contains a serialized instance
13      * of {@code EventQuerier}.
14      */
init(long id, in Bundle data)15     void init(long id, in Bundle data);
16 
17     /**
18      * Remote equivalent of {@code EventQuerier#get}.
19      *
20      * <p>The {@code data} must contain a {@code EARLIEST_LOG_TIME} key which contains a serialized
21      * instance of {@code Instant}.
22      *
23      * <p>The return {@code Bundle} will contain a {@code EVENT} key with a serialized instance of
24      * {@code Event}.
25      */
get(long id, in Bundle data)26     Bundle get(long id, in Bundle data);
27 
28     /**
29      * Remote equivalent of {@code EventQuerier#get} which increments the count of skipped
30      * results for calls to {@link #get}.
31      *
32      * <p>This should be used when the result from {@link #get} does not pass additional filters.
33      *
34      * <p>The {@code data} must contain a {@code EARLIEST_LOG_TIME} key which contains a serialized
35      * instance of {@code Instant}.
36      *
37      * <p>The return {@code Bundle} will contain a {@code EVENT} key with a serialized instance of
38      * {@code Event}.
39      */
getNext(long id, in Bundle data)40     Bundle getNext(long id, in Bundle data);
41 
42     /**
43      * Remote equivalent of {@code EventQuerier#next}.
44      *
45      * <p>The {@code data} must contain a {@code EARLIEST_LOG_TIME} key which contains a serialized
46      * instance of {@code Instant}.
47      *
48      * <p>The return {@code Bundle} will contain a {@code EVENT} key with a serialized instance of
49      * {@code Event}.
50      */
next(long id, in Bundle data)51     Bundle next(long id, in Bundle data);
52 
53     /**
54      * Remote equivalent of {@code EventQuerier#poll}.
55      *
56      * <p>The {@code data} must contain a {@code EARLIEST_LOG_TIME} key which contains a serialized
57      * instance of {@code Instant}, and a {@code TIMEOUT} key which contains a serialized instance
58      * of {@code Duration}.
59      *
60      * <p>The return {@code Bundle} will contain a {@code EVENT} key with a serialized instance of
61      * {@code Event}.
62      */
poll(long id, in Bundle data)63     Bundle poll(long id, in Bundle data);
64 }