Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(391)

Side by Side Diff: components/arc/common/arc_bridge.mojom

Issue 1523643002: arc-bridge: Move most methods to Mojo interfaces (Closed) Base URL: https://chromium.googlesource.com/a/chromium/src.git@master
Patch Set: Rebased to ToT Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/arc/common/app.mojom ('k') | components/arc/common/input.mojom » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 module arc; 5 module arc;
6 6
7 // Describes the boot phase of the ARC instance, as defined by AOSP in 7 import "app.mojom";
8 // com.android.server.SystemService 8 import "input.mojom";
9 enum InstanceBootPhase { 9 import "notifications.mojom";
10 // Boot phase indicating that the instance is not running 10 import "power.mojom";
11 NOT_RUNNING = 0, 11 import "process.mojom";
12 import "settings.mojom";
12 13
13 // After receiving this boot phase the ARC bridge is ready to receive 14 interface ArcBridgeHost {
14 // IPC messages. This phase is ARC-specific. 15 // Keep the entries alphabetical. In order to do so without breaking
15 BRIDGE_READY, 16 // compatibility with the ARC instance, explicitly assign each interface a
17 // unique ordinal.
16 18
17 // After receiving this boot phase, services can safely call into core 19 // Notifies Chrome that the AppInstance interface is ready.
18 // system services such as the PowerManager or PackageManager. 20 OnAppInstanceReady@100(AppInstance instance_ptr);
19 SYSTEM_SERVICES_READY,
20 21
21 // After receiving this boot phase, services can broadcast Intents. 22 // Notifies Chrome that the InputInstnace interface is ready.
22 ACTIVITY_MANAGER_READY, 23 OnInputInstanceReady@101(InputInstance instance_ptr);
23 24
24 // After receiving this boot phase, services can start/bind to third party 25 // Notifies Chrome that the NotificationsInstance interface is ready.
25 // apps. Apps will be able to make Binder calls into services at this point. 26 OnNotificationsInstanceReady@102(NotificationsInstance instance_ptr);
26 THIRD_PARTY_APPS_CAN_START,
27 27
28 // After receiving this boot phase, services can allow user interaction 28 // Notifies Chrome that the PowerInstance interface is ready.
29 // with the device. This phase occurs when boot has completed and the home 29 OnPowerInstanceReady@103(PowerInstance instance_ptr);
30 // application has started.
31 BOOT_COMPLETED
32 };
33 30
34 // Duplicates ui::ScaleFactor enum in order to be accessible on Android side. 31 // Notifies Chrome that the ProcessInstance interface is ready.
35 enum ScaleFactor { 32 OnProcessInstanceReady@104(ProcessInstance instance_ptr);
36 SCALE_FACTOR_NONE = 0,
37 SCALE_FACTOR_100P,
38 SCALE_FACTOR_125P,
39 SCALE_FACTOR_133P,
40 SCALE_FACTOR_140P,
41 SCALE_FACTOR_150P,
42 SCALE_FACTOR_180P,
43 SCALE_FACTOR_200P,
44 SCALE_FACTOR_250P,
45 SCALE_FACTOR_300P,
46 33
47 NUM_SCALE_FACTORS 34 // Notifies Chrome that the SettingsInstance interface is ready.
48 }; 35 OnSettingsInstanceReady@105(SettingsInstance instance_ptr);
49
50 // Describes ARC app.
51 struct AppInfo {
52 string name;
53 string package;
54 string activity;
55 };
56
57 // These values must be matched with the NOTIFICATION_EVENT_* constants in
58 // com.android.server.ArcNotificationListenerService.
59 enum ArcNotificationEvent {
60 BODY_CLICKED = 0,
61 CLOSED = 1,
62 // Five buttons at maximum (message_center::kNotificationMaximumItems = 5).
63 BUTTON1_CLICKED = 2,
64 BUTTON2_CLICKED = 3,
65 BUTTON3_CLICKED = 4,
66 BUTTON4_CLICKED = 5,
67 BUTTON5_CLICKED = 6,
68 };
69
70 // These values must be matched with the NOTIFICATION_TYPE_* constants in
71 // com.android.server.ArcNotificationListenerService.
72 enum ArcNotificationType {
73 BASIC = 0,
74 IMAGE = 1,
75 PROGRESS = 2,
76 };
77
78 // Enumerates the types of wake lock the ARC instance can request from the
79 // host.
80 enum DisplayWakeLockType {
81 // Does not allow the screen to dim, turn off, or lock; prevents
82 // idle suspend.
83 BRIGHT = 0,
84
85 // Allows dimming the screen, but prevents it from turning off or locking.
86 // Also prevents idle suspend.
87 DIM = 1
88 };
89
90 // Describes the current process state, as defined by AOSP in
91 // android.app.ActivityManager.
92 enum ProcessState {
93 // Process does not exist.
94 NONEXISTENT = -1,
95
96 // Process is a persistent system process.
97 PERSISTENT = 0,
98
99 // Process is a persistent system process and is doing UI.
100 PERSISTENT_UI = 1,
101
102 // Process is hosting the current top activities. Note that this covers
103 // all activities that are visible to the user.
104 TOP = 2,
105
106 // Process is hosting a foreground service due to a system binding.
107 BOUND_FOREGROUND_SERVICE = 3,
108
109 // Process is hosting a foreground service.
110 FOREGROUND_SERVICE = 4,
111
112 // Same as PROCESS_STATE_TOP but while device is sleeping.
113 TOP_SLEEPING = 5,
114
115 // Process is important to the user, and something they are aware of.
116 IMPORTANT_FOREGROUND = 6,
117
118 // Process is important to the user, but not something they are aware of.
119 IMPORTANT_BACKGROUND = 7,
120
121 // Process is in the background running a backup/restore operation.
122 BACKUP = 8,
123
124 // Process is in the background, but it can't restore its state so we want
125 // to try to avoid killing it.
126 HEAVY_WEIGHT = 9,
127
128 // Process is in the background running a service. Unlike oom_adj, this level
129 // is used for both the normal running in background state and the executing
130 // operations state.
131 SERVICE = 10,
132
133 // Process is in the background running a receiver. Note that from the
134 // perspective of oom_adj receivers run at a higher foreground level, but for
135 // our prioritization here that is not necessary and putting them below
136 // services means many fewer changes in some process states as they receive
137 // broadcasts.
138 RECEIVER = 11,
139
140 // Process is in the background but hosts the home activity.
141 HOME = 12,
142
143 // Process is in the background but hosts the last shown activity.
144 LAST_ACTIVITY = 13,
145
146 // Process is being cached for later use and contains activities.
147 CACHED_ACTIVITY = 14,
148
149 // Process is being cached for later use and is a client of another cached
150 // process that contains activities.
151 CACHED_ACTIVITY_CLIENT = 15,
152
153 // Process is being cached for later use and is empty.
154 CACHED_EMPTY = 16,
155 };
156
157 struct ArcNotificationData {
158 // Identifier of notification
159 string key;
160 // Type of notification
161 ArcNotificationType type;
162 // Body message of notification
163 string message;
164 // Title of notification
165 string title;
166 // Mimetype of |icon_data|
167 string icon_mimetype;
168 // Binary data of the icon
169 array<uint8> icon_data;
170 // Priority of notification, must be [2,-2]
171 int32 priority;
172 // Timestamp related to the notification
173 int64 time;
174 // The current value of progress, must be [0, progress_max].
175 int32 progress_current;
176 // The maximum value of progress.
177 int32 progress_max;
178 };
179
180 // Describes a running ARC process.
181 // This struct is a subset of android.app.ActivityManager.RunningAppProcessInfo.
182 struct RunningAppProcessInfo {
183 // Name of the process.
184 string process_name;
185
186 // PID (within ARC's PID namespace) of the process.
187 uint32 pid;
188
189 // Current process state.
190 ProcessState process_state;
191 };
192
193 // TODO(lhchavez): Migrate all request/response messages to Mojo.
194 interface ArcBridgeHost {
195 OnInstanceBootPhase(InstanceBootPhase phase);
196
197 // Sends a list of available ARC apps to Chrome. Members of AppInfo must
198 // contain non-empty string. This message is sent in response to
199 // ArcInstanceMsg_RefreshApps message from Chrome to ARC and when ARC
200 // receives boot completed notification.
201 OnAppListRefreshed(array<AppInfo> apps);
202
203 // Sends an icon of required |scale_factor| for specific ARC app. The app is
204 // defined by |package| and |activity|. The icon content cannot be empty and
205 // must match to |scale_factor| assuming 48x48 for SCALE_FACTOR_100P.
206 // |scale_factor| is an enum defined at ui/base/layout.h. This message is
207 // sent in response to ArcInstanceMsg_RequestIcon from Chrome to ARC.
208 OnAppIcon(string package, string activity, ScaleFactor scale_factor,
209 array<uint8> icon_png_data);
210
211 // Tells the Chrome that a notification is posted (created or updated) on
212 // Android.
213 // |notification_data| is the data of notification (id, texts, icon and ...).
214 OnNotificationPosted(ArcNotificationData notification_data);
215
216 // Notifies that a notification is removed on Android.
217 // |key| is the identifier of the notification.
218 OnNotificationRemoved(string key);
219
220 // Acquire and release wake locks on the host side.
221 OnAcquireDisplayWakeLock(DisplayWakeLockType type);
222 OnReleaseDisplayWakeLock(DisplayWakeLockType type);
223
224 // Notifies Chrome that the ARC process list has been updated.
225 OnUpdateProcessList(array<RunningAppProcessInfo> processes);
226 }; 36 };
227 37
228 interface ArcBridgeInstance { 38 interface ArcBridgeInstance {
229 // Establishes full-duplex communication with the host. 39 // Establishes full-duplex communication with the host.
230 // |pipe| is the MessagePipe endpoint that is bound to the ArcBridgeHostPtr 40 // |host_ptr| is the MessagePipe endpoint that is bound to the
231 // binding. 41 // ArcBridgeHostPtr binding.
232 Init(ArcBridgeHost host_ptr); 42 Init@0(ArcBridgeHost host_ptr);
233
234 // Registers a virtual input device on the container side.
235 // |name| is the device name, like "Chrome OS Keyboard".
236 // |device_type| is the device type, like "keyboard".
237 // The virtual device will be reading 'struct input_event's from |fd|. The
238 // ownership of |fd| will be transferred to the receiver, so the sender must
239 // not close it.
240 RegisterInputDevice(string name,
241 string device_type,
242 handle fd);
243
244 // Sends a request to ARC to refresh a list of ARC apps.
245 // OnRefreshAppsList is expected in response to this message. However,
246 // response may not be sent if ARC is not ready yet (boot completed event is
247 // not received).
248 RefreshAppList();
249
250 // Sends a request to ARC to launch an ARC app defined by |package| and
251 // |activity|, which cannot be empty.
252 LaunchApp(string package, string activity);
253
254 // Sends a request to ARC for the ARC app icon of a required scale factor.
255 // Scale factor is an enum defined at ui/base/layout.h. App is defined by
256 // package and activity, which cannot be empty.
257 RequestAppIcon(string package, string activity,
258 ScaleFactor scale_factor);
259
260 // Sends an event from Chrome notification UI to Android.
261 // |event| is a type of occured event.
262 SendNotificationEventToAndroid(string key, ArcNotificationEvent event);
263
264 // Requests ARC instance to return the current process list.
265 RequestProcessList();
266
267 // Send an Android broadcast message to the Android package and class
268 // specified. Data can be sent as extras by including a JSON map string which
269 // will be automatically converted to a bundle accessible by the receiver.
270 //
271 // Note: Broadcasts can only be sent to whitelisted packages. Packages can be
272 // added to the whitelist in ArcBridgeService.java in the Android source.
273 SendBroadcast(string action,
274 string package,
275 string cls,
276 string extras);
277 }; 43 };
OLDNEW
« no previous file with comments | « components/arc/common/app.mojom ('k') | components/arc/common/input.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698