Merge lp:~robertcarr/mir/client-input-report into lp:mir
- client-input-report
- Merge into development-branch
Status: | Merged |
---|---|
Approved by: | Alan Griffiths |
Approved revision: | no longer in the source branch. |
Merged at revision: | 1204 |
Proposed branch: | lp:~robertcarr/mir/client-input-report |
Merge into: | lp:mir |
Diff against target: |
654 lines (+351/-18) 15 files modified
doc/component_reports.md (+1/-0) include/shared/mir/input/input_platform.h (+3/-1) include/shared/mir/input/input_receiver_report.h (+48/-0) include/shared/mir/input/null_input_receiver_report.h (+46/-0) src/client/CMakeLists.txt (+1/-0) src/client/default_connection_configuration.cpp (+20/-2) src/client/default_connection_configuration.h (+9/-0) src/client/logging/input_receiver_report.cpp (+125/-0) src/client/logging/input_receiver_report.h (+54/-0) src/shared/input/android/android_input_platform.cpp (+11/-3) src/shared/input/android/android_input_platform.h (+4/-1) src/shared/input/android/android_input_receiver.cpp (+9/-2) src/shared/input/android/android_input_receiver.h (+7/-2) tests/unit-tests/client/input/test_android_input_receiver.cpp (+8/-5) tests/unit-tests/client/input/test_android_input_receiver_thread.cpp (+5/-2) |
To merge this branch: | bzr merge lp:~robertcarr/mir/client-input-report |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alan Griffiths | Approve | ||
PS Jenkins bot (community) | continuous-integration | Approve | |
Review via email: mp+194028@code.launchpad.net |
Commit message
Add a client input receiver report.
Description of the change
Useful for debugging. You can try it out by running the input acceptance tests with MIR_CLIENT_
PS Jenkins bot (ps-jenkins) wrote : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:1203
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Alan Griffiths (alan-griffiths) wrote : | # |
I'm not entirely convinced by the log formatting. But I've not tried using this and you probably have.
It is at least a step forward
Preview Diff
1 | === modified file 'doc/component_reports.md' |
2 | --- doc/component_reports.md 2013-10-24 11:41:30 +0000 |
3 | +++ doc/component_reports.md 2013-11-06 00:09:36 +0000 |
4 | @@ -40,6 +40,7 @@ |
5 | Report | Handlers |
6 | ------------------- | -------- |
7 | rpc-report | log,lttng |
8 | +input-receiver | log |
9 | |
10 | For example, to enable the logging RPC report, one should set the |
11 | `MIR_CLIENT_RPC_REPORT=log` environment variable. |
12 | |
13 | === modified file 'include/shared/mir/input/input_platform.h' |
14 | --- include/shared/mir/input/input_platform.h 2013-05-13 23:20:52 +0000 |
15 | +++ include/shared/mir/input/input_platform.h 2013-11-06 00:09:36 +0000 |
16 | @@ -31,6 +31,7 @@ |
17 | namespace receiver |
18 | { |
19 | class InputReceiverThread; |
20 | +class InputReceiverReport; |
21 | |
22 | // Interface for MirSurface to construct input dispatcher threads. |
23 | class InputPlatform |
24 | @@ -39,8 +40,9 @@ |
25 | virtual ~InputPlatform() {}; |
26 | |
27 | virtual std::shared_ptr<InputReceiverThread> create_input_thread(int fd, std::function<void(MirEvent *)> const& callback) = 0; |
28 | - |
29 | + |
30 | static std::shared_ptr<InputPlatform> create(); |
31 | + static std::shared_ptr<InputPlatform> create(std::shared_ptr<InputReceiverReport> const& report); |
32 | |
33 | protected: |
34 | InputPlatform() = default; |
35 | |
36 | === added file 'include/shared/mir/input/input_receiver_report.h' |
37 | --- include/shared/mir/input/input_receiver_report.h 1970-01-01 00:00:00 +0000 |
38 | +++ include/shared/mir/input/input_receiver_report.h 2013-11-06 00:09:36 +0000 |
39 | @@ -0,0 +1,48 @@ |
40 | +/* |
41 | + * Copyright © 2013 Canonical Ltd. |
42 | + * |
43 | + * This program is free software: you can redistribute it and/or modify |
44 | + * it under the terms of the GNU Lesser General Public License version 3 as |
45 | + * published by the Free Software Foundation. |
46 | + * |
47 | + * This program is distributed in the hope that it will be useful, |
48 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
49 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
50 | + * GNU Lesser General Public License for more details. |
51 | + * |
52 | + * You should have received a copy of the GNU Lesser General Public License |
53 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
54 | + * |
55 | + * Authored by: Robert Carr <robert.carr@canonical.com> |
56 | + */ |
57 | + |
58 | +#ifndef MIR_CLIENT_INPUT_RECEIVER_REPORT_H_ |
59 | +#define MIR_CLIENT_INPUT_RECEIVER_REPORT_H_ |
60 | + |
61 | +#include <mir_toolkit/event.h> |
62 | + |
63 | +namespace mir |
64 | +{ |
65 | +namespace input |
66 | +{ |
67 | +namespace receiver |
68 | +{ |
69 | + |
70 | +class InputReceiverReport |
71 | +{ |
72 | +public: |
73 | + virtual ~InputReceiverReport() = default; |
74 | + |
75 | + virtual void received_event(MirEvent const& event) = 0; |
76 | + |
77 | +protected: |
78 | + InputReceiverReport() = default; |
79 | + InputReceiverReport(InputReceiverReport const&) = delete; |
80 | + InputReceiverReport& operator=(InputReceiverReport const&) = delete; |
81 | +}; |
82 | + |
83 | +} |
84 | +} |
85 | +} |
86 | + |
87 | +#endif /* MIR_CLIENT_INPUT_RECEIVER_REPORT_H_ */ |
88 | |
89 | === added file 'include/shared/mir/input/null_input_receiver_report.h' |
90 | --- include/shared/mir/input/null_input_receiver_report.h 1970-01-01 00:00:00 +0000 |
91 | +++ include/shared/mir/input/null_input_receiver_report.h 2013-11-06 00:09:36 +0000 |
92 | @@ -0,0 +1,46 @@ |
93 | +/* |
94 | + * Copyright © 2013 Canonical Ltd. |
95 | + * |
96 | + * This program is free software: you can redistribute it and/or modify |
97 | + * it under the terms of the GNU Lesser General Public License version 3 as |
98 | + * published by the Free Software Foundation. |
99 | + * |
100 | + * This program is distributed in the hope that it will be useful, |
101 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
102 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
103 | + * GNU Lesser General Public License for more details. |
104 | + * |
105 | + * You should have received a copy of the GNU Lesser General Public License |
106 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
107 | + * |
108 | + * Authored by: Robert Carr <robert.carr@canonical.com> |
109 | + */ |
110 | + |
111 | +#ifndef MIR_CLIENT_NULL_INPUT_RECEIVER_REPORT_H_ |
112 | +#define MIR_CLIENT_NULL_INPUT_RECEIVER_REPORT_H_ |
113 | + |
114 | +#include "mir/input/input_receiver_report.h" |
115 | + |
116 | +#include <mir_toolkit/event.h> |
117 | + |
118 | +namespace mir |
119 | +{ |
120 | +namespace input |
121 | +{ |
122 | +namespace receiver |
123 | +{ |
124 | + |
125 | +class NullInputReceiverReport : public InputReceiverReport |
126 | +{ |
127 | +public: |
128 | + NullInputReceiverReport() = default; |
129 | + virtual ~NullInputReceiverReport() = default; |
130 | + |
131 | + void received_event(MirEvent const& /* event */) {} |
132 | +}; |
133 | + |
134 | +} |
135 | +} |
136 | +} |
137 | + |
138 | +#endif /* MIR_CLIENT_NULL_INPUT_RECEIVER_REPORT_H_ */ |
139 | |
140 | === modified file 'src/client/CMakeLists.txt' |
141 | --- src/client/CMakeLists.txt 2013-10-21 16:02:28 +0000 |
142 | +++ src/client/CMakeLists.txt 2013-11-06 00:09:36 +0000 |
143 | @@ -29,6 +29,7 @@ |
144 | mir_wait_handle.cpp |
145 | mir_surface.cpp |
146 | logging/rpc_report.cpp |
147 | + logging/input_receiver_report.cpp |
148 | default_connection_configuration.cpp |
149 | surface_map.cpp |
150 | lifecycle_control.cpp |
151 | |
152 | === modified file 'src/client/default_connection_configuration.cpp' |
153 | --- src/client/default_connection_configuration.cpp 2013-08-28 03:41:48 +0000 |
154 | +++ src/client/default_connection_configuration.cpp 2013-11-06 00:09:36 +0000 |
155 | @@ -24,7 +24,9 @@ |
156 | #include "mir/logging/dumb_console_logger.h" |
157 | #include "native_client_platform_factory.h" |
158 | #include "mir/input/input_platform.h" |
159 | +#include "mir/input/null_input_receiver_report.h" |
160 | #include "logging/rpc_report.h" |
161 | +#include "logging/input_receiver_report.h" |
162 | #include "lttng/rpc_report.h" |
163 | #include "connection_surface_map.h" |
164 | #include "lifecycle_control.h" |
165 | @@ -88,9 +90,9 @@ |
166 | mcl::DefaultConnectionConfiguration::the_input_platform() |
167 | { |
168 | return input_platform( |
169 | - [] |
170 | + [this] |
171 | { |
172 | - return mir::input::receiver::InputPlatform::create(); |
173 | + return mir::input::receiver::InputPlatform::create(the_input_receiver_report()); |
174 | }); |
175 | } |
176 | |
177 | @@ -118,6 +120,22 @@ |
178 | }); |
179 | } |
180 | |
181 | +std::shared_ptr<mir::input::receiver::InputReceiverReport> |
182 | +mcl::DefaultConnectionConfiguration::the_input_receiver_report() |
183 | +{ |
184 | + return input_receiver_report( |
185 | + [this] () -> std::shared_ptr<mir::input::receiver::InputReceiverReport> |
186 | + { |
187 | + auto val_raw = getenv("MIR_CLIENT_INPUT_RECEIVER_REPORT"); |
188 | + std::string const val{val_raw ? val_raw : off_opt_val}; |
189 | + |
190 | + if (val == log_opt_val) |
191 | + return std::make_shared<mcl::logging::InputReceiverReport>(the_logger()); |
192 | + else |
193 | + return std::make_shared<mir::input::receiver::NullInputReceiverReport>(); |
194 | + }); |
195 | +} |
196 | + |
197 | std::shared_ptr<mcl::DisplayConfiguration> mcl::DefaultConnectionConfiguration::the_display_configuration() |
198 | { |
199 | return display_configuration( |
200 | |
201 | === modified file 'src/client/default_connection_configuration.h' |
202 | --- src/client/default_connection_configuration.h 2013-08-28 03:41:48 +0000 |
203 | +++ src/client/default_connection_configuration.h 2013-11-06 00:09:36 +0000 |
204 | @@ -27,6 +27,13 @@ |
205 | |
206 | namespace mir |
207 | { |
208 | +namespace input |
209 | +{ |
210 | +namespace receiver |
211 | +{ |
212 | +class InputReceiverReport; |
213 | +} |
214 | +} |
215 | namespace client |
216 | { |
217 | |
218 | @@ -50,6 +57,7 @@ |
219 | |
220 | virtual std::string the_socket_file(); |
221 | virtual std::shared_ptr<rpc::RpcReport> the_rpc_report(); |
222 | + virtual std::shared_ptr<input::receiver::InputReceiverReport> the_input_receiver_report(); |
223 | |
224 | protected: |
225 | CachedPtr<rpc::MirBasicRpcChannel> rpc_channel; |
226 | @@ -61,6 +69,7 @@ |
227 | CachedPtr<LifecycleControl> lifecycle_control; |
228 | |
229 | CachedPtr<rpc::RpcReport> rpc_report; |
230 | + CachedPtr<input::receiver::InputReceiverReport> input_receiver_report; |
231 | |
232 | private: |
233 | std::string const socket_file; |
234 | |
235 | === added file 'src/client/logging/input_receiver_report.cpp' |
236 | --- src/client/logging/input_receiver_report.cpp 1970-01-01 00:00:00 +0000 |
237 | +++ src/client/logging/input_receiver_report.cpp 2013-11-06 00:09:36 +0000 |
238 | @@ -0,0 +1,125 @@ |
239 | +/* |
240 | + * Copyright © 2013 Canonical Ltd. |
241 | + * |
242 | + * This program is free software: you can redistribute it and/or modify |
243 | + * it under the terms of the GNU Lesser General Public License version 3 as |
244 | + * published by the Free Software Foundation. |
245 | + * |
246 | + * This program is distributed in the hope that it will be useful, |
247 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
248 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
249 | + * GNU Lesser General Public License for more details. |
250 | + * |
251 | + * You should have received a copy of the GNU Lesser General Public License |
252 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
253 | + * |
254 | + * Authored by: Robert Carr <robert.carr@canonical.com> |
255 | + */ |
256 | + |
257 | +#include "input_receiver_report.h" |
258 | + |
259 | +#include "mir/logging/logger.h" |
260 | + |
261 | +#include <boost/throw_exception.hpp> |
262 | + |
263 | +#include <sstream> |
264 | +#include <stdexcept> |
265 | + |
266 | +namespace ml = mir::logging; |
267 | +namespace mcll = mir::client::logging; |
268 | + |
269 | +namespace |
270 | +{ |
271 | +std::string const component{"input-receiver"}; |
272 | +} |
273 | + |
274 | +mcll::InputReceiverReport::InputReceiverReport(std::shared_ptr<ml::Logger> const& logger) |
275 | + : logger{logger} |
276 | +{ |
277 | +} |
278 | + |
279 | +namespace |
280 | +{ |
281 | + |
282 | +static void format_key_event(std::stringstream &ss, MirKeyEvent const& ev) |
283 | +{ |
284 | + ss << "MirKeyEvent {" << std::endl; |
285 | + ss << " device_id: " << ev.device_id << std::endl; |
286 | + ss << " source_id: " << ev.source_id << std::endl; |
287 | + ss << " action: " << ev.action << std::endl; |
288 | + ss << " flags: " << ev.flags << std::endl; |
289 | + ss << " modifiers: " << ev.modifiers << std::endl; |
290 | + ss << " key_code: " << ev.key_code << std::endl; |
291 | + ss << " scan_code: " << ev.scan_code << std::endl; |
292 | + ss << " repeat_count: " << ev.repeat_count << std::endl; |
293 | + ss << " down_time: " << ev.down_time << std::endl; |
294 | + ss << " event_time: " << ev.event_time << std::endl; |
295 | + ss << " is_system_key: " << ev.is_system_key << std::endl; |
296 | + ss << "}"; |
297 | +} |
298 | +static void format_motion_event(std::stringstream &ss, MirMotionEvent const& ev) |
299 | +{ |
300 | + ss << "MirMotionEvent{" << std::endl; |
301 | + ss << " type: motion" << std::endl; |
302 | + ss << " device_id: " << ev.device_id << std::endl; |
303 | + ss << " source_id: " << ev.source_id << std::endl; |
304 | + ss << " action: " << ev.action << std::endl; |
305 | + ss << " flags: " << ev.flags << std::endl; |
306 | + ss << " modifiers: " << ev.modifiers << std::endl; |
307 | + ss << " edge_flags: " << ev.edge_flags << std::endl; |
308 | + ss << " button_state: " << ev.button_state << std::endl; |
309 | + ss << " x_offset: " << ev.x_offset << std::endl; |
310 | + ss << " y_offset: " << ev.y_offset << std::endl; |
311 | + ss << " x_precision: " << ev.x_precision << std::endl; |
312 | + ss << " y_precision: " << ev.y_precision << std::endl; |
313 | + ss << " down_time: " << ev.down_time << std::endl; |
314 | + ss << " event_time: " << ev.event_time << std::endl; |
315 | + ss << " pointer_count: " << ev.pointer_count << std::endl; |
316 | + for (unsigned int i = 0; i < ev.pointer_count; i++) |
317 | + { |
318 | + ss << " pointer[" << i << "]{" << std::endl; |
319 | + ss << " id: " << ev.pointer_coordinates[i].id << std::endl; |
320 | + ss << " x: " << ev.pointer_coordinates[i].x << std::endl; |
321 | + ss << " raw_x: " << ev.pointer_coordinates[i].raw_x << std::endl; |
322 | + ss << " y: " << ev.pointer_coordinates[i].y << std::endl; |
323 | + ss << " raw_y: " << ev.pointer_coordinates[i].raw_y << std::endl; |
324 | + ss << " touch_major: " << ev.pointer_coordinates[i].touch_major << std::endl; |
325 | + ss << " touch_minor: " << ev.pointer_coordinates[i].touch_minor << std::endl; |
326 | + ss << " size: " << ev.pointer_coordinates[i].size << std::endl; |
327 | + ss << " pressure: " << ev.pointer_coordinates[i].pressure << std::endl; |
328 | + ss << " orientation: " << ev.pointer_coordinates[i].orientation << std::endl; |
329 | + ss << " vscroll: " << ev.pointer_coordinates[i].vscroll << std::endl; |
330 | + ss << " hscroll: " << ev.pointer_coordinates[i].hscroll << std::endl; |
331 | + ss << " }" << std::endl; |
332 | + } |
333 | + ss << "}"; |
334 | +} |
335 | + |
336 | +static void format_event(std::stringstream &ss, MirEvent const& ev) |
337 | +{ |
338 | + switch (ev.type) |
339 | + { |
340 | + case mir_event_type_key: |
341 | + format_key_event(ss, ev.key); |
342 | + break; |
343 | + case mir_event_type_motion: |
344 | + format_motion_event(ss, ev.motion); |
345 | + break; |
346 | + default: |
347 | + BOOST_THROW_EXCEPTION(std::runtime_error("Unexpected event type")); |
348 | + } |
349 | +} |
350 | + |
351 | +} |
352 | + |
353 | +void mcll::InputReceiverReport::received_event( |
354 | + MirEvent const& event) |
355 | +{ |
356 | + std::stringstream ss; |
357 | + |
358 | + ss << "Received event:" << std::endl; |
359 | + |
360 | + format_event(ss, event); |
361 | + |
362 | + logger->log<ml::Logger::debug>(ss.str(), component); |
363 | +} |
364 | |
365 | === added file 'src/client/logging/input_receiver_report.h' |
366 | --- src/client/logging/input_receiver_report.h 1970-01-01 00:00:00 +0000 |
367 | +++ src/client/logging/input_receiver_report.h 2013-11-06 00:09:36 +0000 |
368 | @@ -0,0 +1,54 @@ |
369 | +/* |
370 | + * Copyright © 2013 Canonical Ltd. |
371 | + * |
372 | + * This program is free software: you can redistribute it and/or modify |
373 | + * it under the terms of the GNU Lesser General Public License version 3 as |
374 | + * published by the Free Software Foundation. |
375 | + * |
376 | + * This program is distributed in the hope that it will be useful, |
377 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
378 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
379 | + * GNU Lesser General Public License for more details. |
380 | + * |
381 | + * You should have received a copy of the GNU Lesser General Public License |
382 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
383 | + * |
384 | + * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com> |
385 | + */ |
386 | + |
387 | +#ifndef MIR_CLIENT_LOGGING_INPUT_RECEIVER_REPORT_H_ |
388 | +#define MIR_CLIENT_LOGGING_INPUT_RECEIVER_REPORT_H_ |
389 | + |
390 | +#include "mir/input/input_receiver_report.h" |
391 | + |
392 | +#include <memory> |
393 | + |
394 | +namespace mir |
395 | +{ |
396 | + |
397 | +namespace logging |
398 | +{ |
399 | +class Logger; |
400 | +} |
401 | + |
402 | +namespace client |
403 | +{ |
404 | +namespace logging |
405 | +{ |
406 | + |
407 | +class InputReceiverReport : public input::receiver::InputReceiverReport |
408 | +{ |
409 | +public: |
410 | + InputReceiverReport(std::shared_ptr<mir::logging::Logger> const& logger); |
411 | + |
412 | + void received_event(MirEvent const& event) override; |
413 | + |
414 | +private: |
415 | + std::shared_ptr<mir::logging::Logger> const logger; |
416 | +}; |
417 | + |
418 | +} |
419 | +} |
420 | +} |
421 | + |
422 | +#endif /* MIR_CLIENT_LOGGING_INPUT_RECEIVER_REPORT_H_ */ |
423 | |
424 | === modified file 'src/shared/input/android/android_input_platform.cpp' |
425 | --- src/shared/input/android/android_input_platform.cpp 2013-05-13 23:20:52 +0000 |
426 | +++ src/shared/input/android/android_input_platform.cpp 2013-11-06 00:09:36 +0000 |
427 | @@ -20,10 +20,13 @@ |
428 | #include "android_input_receiver.h" |
429 | #include "android_input_receiver_thread.h" |
430 | |
431 | +#include "mir/input/null_input_receiver_report.h" |
432 | + |
433 | namespace mircv = mir::input::receiver; |
434 | namespace mircva = mircv::android; |
435 | |
436 | -mircva::AndroidInputPlatform::AndroidInputPlatform() |
437 | +mircva::AndroidInputPlatform::AndroidInputPlatform(std::shared_ptr<mircv::InputReceiverReport> const& report) |
438 | + : report(report) |
439 | { |
440 | } |
441 | |
442 | @@ -34,11 +37,16 @@ |
443 | std::shared_ptr<mircv::InputReceiverThread> mircva::AndroidInputPlatform::create_input_thread( |
444 | int fd, std::function<void(MirEvent*)> const& callback) |
445 | { |
446 | - auto receiver = std::make_shared<mircva::InputReceiver>(fd); |
447 | + auto receiver = std::make_shared<mircva::InputReceiver>(fd, report); |
448 | return std::make_shared<mircva::InputReceiverThread>(receiver, callback); |
449 | } |
450 | |
451 | std::shared_ptr<mircv::InputPlatform> mircv::InputPlatform::create() |
452 | { |
453 | - return std::make_shared<mircva::AndroidInputPlatform>(); |
454 | + return create(std::make_shared<mircv::NullInputReceiverReport>()); |
455 | +} |
456 | + |
457 | +std::shared_ptr<mircv::InputPlatform> mircv::InputPlatform::create(std::shared_ptr<mircv::InputReceiverReport> const& report) |
458 | +{ |
459 | + return std::make_shared<mircva::AndroidInputPlatform>(report); |
460 | } |
461 | |
462 | === modified file 'src/shared/input/android/android_input_platform.h' |
463 | --- src/shared/input/android/android_input_platform.h 2013-05-13 23:20:52 +0000 |
464 | +++ src/shared/input/android/android_input_platform.h 2013-11-06 00:09:36 +0000 |
465 | @@ -34,7 +34,7 @@ |
466 | class AndroidInputPlatform : public InputPlatform |
467 | { |
468 | public: |
469 | - AndroidInputPlatform(); |
470 | + AndroidInputPlatform(std::shared_ptr<InputReceiverReport> const& report); |
471 | virtual ~AndroidInputPlatform(); |
472 | |
473 | std::shared_ptr<InputReceiverThread> create_input_thread(int fd, std::function<void(MirEvent *)> const& callback); |
474 | @@ -42,6 +42,9 @@ |
475 | protected: |
476 | AndroidInputPlatform(const AndroidInputPlatform&) = delete; |
477 | AndroidInputPlatform& operator=(const AndroidInputPlatform&) = delete; |
478 | + |
479 | +private: |
480 | + std::shared_ptr<InputReceiverReport> const report; |
481 | }; |
482 | |
483 | } |
484 | |
485 | === modified file 'src/shared/input/android/android_input_receiver.cpp' |
486 | --- src/shared/input/android/android_input_receiver.cpp 2013-05-24 18:20:37 +0000 |
487 | +++ src/shared/input/android/android_input_receiver.cpp 2013-11-06 00:09:36 +0000 |
488 | @@ -19,6 +19,7 @@ |
489 | #include "android_input_receiver.h" |
490 | |
491 | #include "mir/input/xkb_mapper.h" |
492 | +#include "mir/input/input_receiver_report.h" |
493 | #include "mir/input/android/android_input_lexicon.h" |
494 | |
495 | #include <androidfw/InputTransport.h> |
496 | @@ -29,8 +30,10 @@ |
497 | |
498 | namespace mia = mir::input::android; |
499 | |
500 | -mircva::InputReceiver::InputReceiver(droidinput::sp<droidinput::InputChannel> const& input_channel) |
501 | +mircva::InputReceiver::InputReceiver(droidinput::sp<droidinput::InputChannel> const& input_channel, |
502 | + std::shared_ptr<mircv::InputReceiverReport> const& report) |
503 | : input_channel(input_channel), |
504 | + report(report), |
505 | input_consumer(std::make_shared<droidinput::InputConsumer>(input_channel)), |
506 | looper(new droidinput::Looper(true)), |
507 | fd_added(false), |
508 | @@ -38,8 +41,10 @@ |
509 | { |
510 | } |
511 | |
512 | -mircva::InputReceiver::InputReceiver(int fd) |
513 | +mircva::InputReceiver::InputReceiver(int fd, |
514 | + std::shared_ptr<mircv::InputReceiverReport> const& report) |
515 | : input_channel(new droidinput::InputChannel(droidinput::String8(""), fd)), |
516 | + report(report), |
517 | input_consumer(std::make_shared<droidinput::InputConsumer>(input_channel)), |
518 | looper(new droidinput::Looper(true)), |
519 | fd_added(false), |
520 | @@ -84,6 +89,8 @@ |
521 | map_key_event(xkb_mapper, ev); |
522 | |
523 | input_consumer->sendFinishedSignal(event_sequence_id, true); |
524 | + |
525 | + report->received_event(ev); |
526 | |
527 | return true; |
528 | } |
529 | |
530 | === modified file 'src/shared/input/android/android_input_receiver.h' |
531 | --- src/shared/input/android/android_input_receiver.h 2013-05-24 18:20:37 +0000 |
532 | +++ src/shared/input/android/android_input_receiver.h 2013-11-06 00:09:36 +0000 |
533 | @@ -43,6 +43,7 @@ |
534 | namespace receiver |
535 | { |
536 | class XKBMapper; |
537 | +class InputReceiverReport; |
538 | |
539 | namespace android |
540 | { |
541 | @@ -51,8 +52,10 @@ |
542 | class InputReceiver |
543 | { |
544 | public: |
545 | - InputReceiver(droidinput::sp<droidinput::InputChannel> const& input_channel); |
546 | - InputReceiver(int fd); |
547 | + InputReceiver(droidinput::sp<droidinput::InputChannel> const& input_channel, |
548 | + std::shared_ptr<InputReceiverReport> const& report); |
549 | + InputReceiver(int fd, |
550 | + std::shared_ptr<InputReceiverReport> const& report); |
551 | |
552 | virtual ~InputReceiver(); |
553 | int fd() const; |
554 | @@ -71,6 +74,8 @@ |
555 | |
556 | private: |
557 | droidinput::sp<droidinput::InputChannel> input_channel; |
558 | + std::shared_ptr<InputReceiverReport> const report; |
559 | + |
560 | std::shared_ptr<droidinput::InputConsumer> input_consumer; |
561 | droidinput::PreallocatedInputEventFactory event_factory; |
562 | droidinput::sp<droidinput::Looper> looper; |
563 | |
564 | === modified file 'tests/unit-tests/client/input/test_android_input_receiver.cpp' |
565 | --- tests/unit-tests/client/input/test_android_input_receiver.cpp 2013-05-31 16:06:07 +0000 |
566 | +++ tests/unit-tests/client/input/test_android_input_receiver.cpp 2013-11-06 00:09:36 +0000 |
567 | @@ -17,8 +17,10 @@ |
568 | */ |
569 | |
570 | #include "src/shared/input/android/android_input_receiver.h" |
571 | +#include "mir/input/null_input_receiver_report.h" |
572 | #include "mir_toolkit/event.h" |
573 | |
574 | + |
575 | #include <androidfw/InputTransport.h> |
576 | |
577 | #include <gmock/gmock.h> |
578 | @@ -27,7 +29,8 @@ |
579 | #include <unistd.h> |
580 | #include <memory> |
581 | |
582 | -namespace mircva = mir::input::receiver::android; |
583 | +namespace mircv = mir::input::receiver; |
584 | +namespace mircva = mircv::android; |
585 | |
586 | namespace droidinput = android; |
587 | |
588 | @@ -142,14 +145,14 @@ |
589 | |
590 | TEST_F(AndroidInputReceiverSetup, receiever_takes_channel_fd) |
591 | { |
592 | - mircva::InputReceiver receiver(client_fd); |
593 | + mircva::InputReceiver receiver(client_fd, std::make_shared<mircv::NullInputReceiverReport>()); |
594 | |
595 | EXPECT_EQ(client_fd, receiver.fd()); |
596 | } |
597 | |
598 | TEST_F(AndroidInputReceiverSetup, receiver_receives_key_events) |
599 | { |
600 | - mircva::InputReceiver receiver(client_fd); |
601 | + mircva::InputReceiver receiver(client_fd, std::make_shared<mircv::NullInputReceiverReport>()); |
602 | TestingInputProducer producer(server_fd); |
603 | |
604 | producer.produce_a_key_event(); |
605 | @@ -165,7 +168,7 @@ |
606 | |
607 | TEST_F(AndroidInputReceiverSetup, receiver_handles_events) |
608 | { |
609 | - mircva::InputReceiver receiver(client_fd); |
610 | + mircva::InputReceiver receiver(client_fd, std::make_shared<mircv::NullInputReceiverReport>()); |
611 | TestingInputProducer producer(server_fd); |
612 | |
613 | producer.produce_a_key_event(); |
614 | @@ -181,7 +184,7 @@ |
615 | |
616 | TEST_F(AndroidInputReceiverSetup, receiver_consumes_batched_motion_events) |
617 | { |
618 | - mircva::InputReceiver receiver(client_fd); |
619 | + mircva::InputReceiver receiver(client_fd, std::make_shared<mircv::NullInputReceiverReport>()); |
620 | TestingInputProducer producer(server_fd); |
621 | |
622 | // Produce 3 motion events before client handles any. |
623 | |
624 | === modified file 'tests/unit-tests/client/input/test_android_input_receiver_thread.cpp' |
625 | --- tests/unit-tests/client/input/test_android_input_receiver_thread.cpp 2013-05-13 23:20:52 +0000 |
626 | +++ tests/unit-tests/client/input/test_android_input_receiver_thread.cpp 2013-11-06 00:09:36 +0000 |
627 | @@ -19,6 +19,8 @@ |
628 | #include "src/shared/input/android/android_input_receiver_thread.h" |
629 | #include "src/shared/input/android/android_input_receiver.h" |
630 | |
631 | +#include "mir/input/null_input_receiver_report.h" |
632 | + |
633 | #include "mir_toolkit/mir_client_library.h" |
634 | |
635 | #include <gtest/gtest.h> |
636 | @@ -30,7 +32,8 @@ |
637 | |
638 | #include <fcntl.h> |
639 | |
640 | -namespace mircva = mir::input::receiver::android; |
641 | +namespace mircv = mir::input::receiver; |
642 | +namespace mircva = mircv::android; |
643 | |
644 | namespace |
645 | { |
646 | @@ -43,7 +46,7 @@ |
647 | struct MockInputReceiver : public mircva::InputReceiver |
648 | { |
649 | MockInputReceiver(int fd) |
650 | - : InputReceiver(fd) |
651 | + : InputReceiver(fd, std::make_shared<mircv::NullInputReceiverReport>()) |
652 | { |
653 | } |
654 | MOCK_METHOD1(next_event, bool(MirEvent &)); |
FAILED: Continuous integration, rev:1202 jenkins. qa.ubuntu. com/job/ mir-team- mir-development -branch- ci/343/ jenkins. qa.ubuntu. com/job/ mir-android- trusty- i386-build/ 131/console jenkins. qa.ubuntu. com/job/ mir-clang- trusty- amd64-build/ 128/console jenkins. qa.ubuntu. com/job/ mir-team- mir-development -branch- trusty- amd64-ci/ 72/console jenkins. qa.ubuntu. com/job/ mir-team- mir-development -branch- trusty- armhf-ci/ 72/console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: 10.97.0. 26:8080/ job/mir- team-mir- development- branch- ci/343/ rebuild
http://