summaryrefslogtreecommitdiffstats
path: root/binder/com/google/android/startop/iorap/IIorap.aidl
blob: 05faefe7b274a2417195b63c378170e4fae57e8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/*
 * Copyright (C) 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.android.startop.iorap;

import com.google.android.startop.iorap.ITaskListener;

import com.google.android.startop.iorap.AppIntentEvent;
import com.google.android.startop.iorap.AppLaunchEvent;
import com.google.android.startop.iorap.DexOptEvent;
import com.google.android.startop.iorap.JobScheduledEvent;
import com.google.android.startop.iorap.PackageEvent;
import com.google.android.startop.iorap.RequestId;
import com.google.android.startop.iorap.SystemServiceEvent;
import com.google.android.startop.iorap.SystemServiceUserEvent;

/**
* IIOrap is a client interface to the input/output readahead and pin daemon (iorapd).
*
* The aim is to speed-up the cold start-up time of certain use-cases like application startup
* by utilizing trace-based pinning or readahead.
*
* Programatically, the behavior of iorapd should be treated like a black box. There is no
* "correctness", but only performance. By sending the right events at the appropriate time,
* we can squeeze more performance out of the system.
*
* If some events are not appropriately wired up, system performance may (temporarily) degrade.
*
* {@hide} */
oneway interface IIorap {
   /**
    * Set an ITaskListener which will be used to deliver notifications of in-progress/completition
    * for the onXEvent method calls below this.<br /><br />
    *
    * iorapd does all the work asynchronously and may deliver one or more onProgress events after
    * the event begins to be processed. It will always send back one onComplete that is considered
    * terminal.<br /><br />
    *
    * onProgress/onComplete are matched to the original event by the requestId. Once an onComplete
    * occurs for any given requestId, no further callbacks with the same requestId will occur.
    * It is illegal for the caller to reuse the same requestId on different invocations of IIorap.
    * <br /><br />
    *
    * onXEvent(id1) must be well-ordered w.r.t. onXEvent(id2), the assumption is that later
    * calls happen-after earlier calls and that id2 > id1. Decreasing request IDs will
    * immediately get rejected.
    * <br /><br />
    *
    * Sequence diagram of stereotypical successful event delivery and response notification:
    *
    * <pre>
    *
    *           ┌─────────────┐                ┌──────┐
    *           │system_server│                │iorapd│
    *           └──────┬──────┘                └──┬───┘
    *                  Request [01]: onSomeEvent ┌┴┐
    *                  │────────────────────────>│ │
    *                  │                         │ │
    *                  │                         │ │  ╔════════════════════════╗
    *                  │                         │ │  ║start processing event ░║
    *                  │                         │ │  ╚════════════════════════╝
    *                  │                         │ │
    * ╔═══════╤════════╪═════════════════════════╪═╪══════════════════════════════╗
    * ║ LOOP  │  1 or more times                 │ │                              ║
    * ╟───────┘        │                         │ │                              ║
    * ║                │Request [01]: onProgress │ │                              ║
    * ║                │<────────────────────────│ │                              ║
    * ║                │                         │ │                              ║
    * ║                │                         │ │────┐                         ║
    * ║                │                         │ │    │ workload in progress    ║
    * ║                │                         │ │<───┘                         ║
    * ╚════════════════╪═════════════════════════╪═╪══════════════════════════════╝
    *                  │                         └┬┘
    *                  .                          .
    *                  .                          .
    *                  .                          .
    *                  .                          .
    *                  .                          .
    *                  │                         ┌┴┐  ╔═════════════════════════╗
    *                  │                         │ │  ║finish processing event ░║
    *                  │                         │ │  ╚═════════════════════════╝
    *                  │Request [01]: onComplete │ │
    *                  │<────────────────────────│ │
    *           ┌──────┴──────┐                ┌─└┬┘──┐
    *           │system_server│                │iorapd│
    *           └─────────────┘                └──────┘
    *
    * </pre> <!-- system/iorap/docs/binder/IIorap_setTaskListener.plantuml -->
    */
    void setTaskListener(ITaskListener listener);

    // All callbacks will be done via the ITaskListener.
    // The RequestId passed in is the same RequestId sent back via the ITaskListener.
    // See above for more details.

    // Note: For each ${Type}Event, see the ${Type}Event.java for more documentation
    // in frameworks/base/startop/src/com/google/android/startop/iorap/${Type}Event.java

    // void onActivityHintEvent(in RequestId request, in ActivityHintEvent event);
    void onAppLaunchEvent(in RequestId request, in AppLaunchEvent event);
    void onDexOptEvent(in RequestId request, in DexOptEvent event);
    void onJobScheduledEvent(in RequestId request, in JobScheduledEvent event);
    void onPackageEvent(in RequestId request, in PackageEvent event);
    void onAppIntentEvent(in RequestId request, in AppIntentEvent event);
    void onSystemServiceEvent(in RequestId request, in SystemServiceEvent event);
    void onSystemServiceUserEvent(in RequestId request, in SystemServiceUserEvent event);
}