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