Mir

Merge lp:~brandontschaefer/mir/no-android-input-channel-v2 into lp:mir

Proposed by Brandon Schaefer
Status: Merged
Approved by: Kevin DuBois
Approved revision: no longer in the source branch.
Merged at revision: 3445
Proposed branch: lp:~brandontschaefer/mir/no-android-input-channel-v2
Merge into: lp:mir
Diff against target: 657 lines (+113/-157)
16 files modified
3rd_party/android-input/android/frameworks/base/include/androidfw/InputTransport.h (+0/-6)
3rd_party/android-input/android/frameworks/base/services/input/InputTransport.cpp (+0/-29)
src/server/input/CMakeLists.txt (+2/-0)
src/server/input/android/CMakeLists.txt (+0/-2)
src/server/input/channel.cpp (+45/-30)
src/server/input/channel.h (+14/-25)
src/server/input/channel_factory.cpp (+5/-6)
src/server/input/channel_factory.h (+10/-12)
src/server/input/default_configuration.cpp (+2/-2)
tests/unit-tests/client/input/test_android_input_receiver.cpp (+19/-28)
tests/unit-tests/input/CMakeLists.txt (+1/-0)
tests/unit-tests/input/android/CMakeLists.txt (+0/-1)
tests/unit-tests/input/android/test_android_communication_package.cpp (+4/-5)
tests/unit-tests/input/android/test_android_input_sender.cpp (+2/-3)
tests/unit-tests/input/android/test_input_consumer.cpp (+3/-2)
tests/unit-tests/input/test_input_channel_factory.cpp (+6/-6)
To merge this branch: bzr merge lp:~brandontschaefer/mir/no-android-input-channel-v2
Reviewer Review Type Date Requested Status
Kevin DuBois (community) Approve
Cemil Azizoglu (community) Approve
Andreas Pokorny (community) Approve
Mir CI Bot continuous-integration Approve
Review via email: mp+291051@code.launchpad.net

Commit message

Remove the usage of android input channel. Slowly removing all usage of the android input sender/receiver as well as the input channel.

Description of the change

Remove the usage of android input channel. Slowly removing all usage of the android input sender/receiver as well as the input channel.

To post a comment you must log in.
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:3440
https://mir-jenkins.ubuntu.com/job/mir-ci/760/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/743
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/780
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/771
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/771
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/752
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/752/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/752
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/752/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/752
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/752/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/752
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/752/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/752
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/752/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/760/rebuild

review: Approve (continuous-integration)
Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote :

hmm not sure why you need that change - I would have guessed that you will InputChannel in the end. But the change looks fine.

nit:
156 newline before opening the block

review: Approve
Revision history for this message
Cemil Azizoglu (cemil-azizoglu) wrote :

Ok

review: Approve
Revision history for this message
Kevin DuBois (kdub) wrote :

lgtm

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '3rd_party/android-input/android/frameworks/base/include/androidfw/InputTransport.h'
2--- 3rd_party/android-input/android/frameworks/base/include/androidfw/InputTransport.h 2016-01-29 08:18:22 +0000
3+++ 3rd_party/android-input/android/frameworks/base/include/androidfw/InputTransport.h 2016-04-05 21:21:50 +0000
4@@ -141,12 +141,6 @@
5 public:
6 InputChannel(const String8& name, int fd);
7
8- /* Creates a pair of input channels.
9- *
10- * Returns OK on success.
11- */
12- static status_t openInputFdPair(int& server_fd, int& client_fd);
13-
14 inline String8 getName() const { return mName; }
15 inline int getFd() const { return mFd; }
16
17
18=== modified file '3rd_party/android-input/android/frameworks/base/services/input/InputTransport.cpp'
19--- 3rd_party/android-input/android/frameworks/base/services/input/InputTransport.cpp 2016-03-23 06:39:56 +0000
20+++ 3rd_party/android-input/android/frameworks/base/services/input/InputTransport.cpp 2016-04-05 21:21:50 +0000
21@@ -32,12 +32,6 @@
22
23 namespace android {
24
25-// Socket buffer size. The default is typically about 128KB, which is much larger than
26-// we really need. So we make it smaller. It just needs to be big enough to hold
27-// a few dozen large multi-finger motion events in the case where an application gets
28-// behind processing touches.
29-static const size_t SOCKET_BUFFER_SIZE = 32 * 1024;
30-
31 // Nanoseconds per milliseconds.
32 static constexpr const std::chrono::nanoseconds NANOS_PER_MS = std::chrono::nanoseconds(1000000);
33
34@@ -117,29 +111,6 @@
35 #endif
36 }
37
38-status_t InputChannel::openInputFdPair(int& server_fd, int& client_fd) {
39- int sockets[2];
40- if (socketpair(AF_UNIX, SOCK_SEQPACKET, 0, sockets)) {
41- status_t result = -errno;
42- ALOGE("InputChannel ~ Could not create socket pair. errno=%d",
43- errno);
44- server_fd = client_fd = 0;
45-
46- return result;
47- }
48-
49- int bufferSize = SOCKET_BUFFER_SIZE;
50- setsockopt(sockets[0], SOL_SOCKET, SO_SNDBUF, &bufferSize, sizeof(bufferSize));
51- setsockopt(sockets[0], SOL_SOCKET, SO_RCVBUF, &bufferSize, sizeof(bufferSize));
52- setsockopt(sockets[1], SOL_SOCKET, SO_SNDBUF, &bufferSize, sizeof(bufferSize));
53- setsockopt(sockets[1], SOL_SOCKET, SO_RCVBUF, &bufferSize, sizeof(bufferSize));
54-
55- server_fd = sockets[0];
56- client_fd = sockets[1];
57-
58- return OK;
59-}
60-
61 status_t InputChannel::sendMessage(const InputMessage* msg) {
62 size_t msgLength = msg->size();
63 ssize_t nWrite;
64
65=== modified file 'src/server/input/CMakeLists.txt'
66--- src/server/input/CMakeLists.txt 2016-03-23 06:39:56 +0000
67+++ src/server/input/CMakeLists.txt 2016-04-05 21:21:50 +0000
68@@ -6,6 +6,8 @@
69
70 basic_seat.cpp
71 builtin_cursor_images.cpp
72+ channel.cpp
73+ channel_factory.cpp
74 cursor_controller.cpp
75 default_configuration.cpp
76 default_device.cpp
77
78=== modified file 'src/server/input/android/CMakeLists.txt'
79--- src/server/input/android/CMakeLists.txt 2016-01-29 08:18:22 +0000
80+++ src/server/input/android/CMakeLists.txt 2016-04-05 21:21:50 +0000
81@@ -1,7 +1,5 @@
82 list(
83 APPEND INPUT_SOURCES
84- ${CMAKE_CURRENT_SOURCE_DIR}/android_input_channel.cpp
85- ${CMAKE_CURRENT_SOURCE_DIR}/input_channel_factory.cpp
86 ${CMAKE_CURRENT_SOURCE_DIR}/input_sender.cpp
87 )
88
89
90=== renamed file 'src/server/input/android/android_input_channel.cpp' => 'src/server/input/channel.cpp'
91--- src/server/input/android/android_input_channel.cpp 2014-03-06 06:05:17 +0000
92+++ src/server/input/channel.cpp 2016-04-05 21:21:50 +0000
93@@ -1,5 +1,5 @@
94 /*
95- * Copyright © 2013 Canonical Ltd.
96+ * Copyright © 2013,2016 Canonical Ltd.
97 *
98 * This program is free software: you can redistribute it and/or modify it
99 * under the terms of the GNU General Public License version 3,
100@@ -14,35 +14,50 @@
101 * along with this program. If not, see <http://www.gnu.org/licenses/>.
102 *
103 * Authored by: Robert Carr <robert.carr@canonical.com>
104+ * Brandon Schaefer <brandon.schaefer@canonical.com>
105 */
106
107-#include "android_input_channel.h"
108-
109-#include <androidfw/InputTransport.h>
110-
111-#include <unistd.h>
112-
113-namespace mia = mir::input::android;
114-namespace droidinput = android;
115-
116-mia::AndroidInputChannel::AndroidInputChannel()
117-{
118-
119- droidinput::InputChannel::openInputFdPair(s_fd, c_fd);
120-}
121-
122-mia::AndroidInputChannel::~AndroidInputChannel()
123-{
124- close(s_fd);
125- close(c_fd);
126-}
127-
128-int mia::AndroidInputChannel::client_fd() const
129-{
130- return c_fd;
131-}
132-
133-int mia::AndroidInputChannel::server_fd() const
134-{
135- return s_fd;
136+#include <system_error>
137+#include <sys/types.h>
138+#include <sys/socket.h>
139+
140+#include "channel.h"
141+
142+#include <boost/throw_exception.hpp>
143+
144+namespace mi = mir::input;
145+
146+namespace
147+{
148+// Default is 128KB which is larger then we need. Use a smaller size.
149+int const buffer_size{32 * 1024};
150+}
151+
152+mi::Channel::Channel()
153+{
154+ int sockets[2];
155+ if (socketpair(AF_UNIX, SOCK_SEQPACKET, 0, sockets)) {
156+ BOOST_THROW_EXCEPTION(std::system_error(
157+ errno,
158+ std::system_category(),
159+ "Could not create socket pair."));
160+ }
161+ server_fd_ = mir::Fd(sockets[0]);
162+ client_fd_ = mir::Fd(sockets[1]);
163+
164+ int size = buffer_size;
165+ setsockopt(server_fd_, SOL_SOCKET, SO_SNDBUF, &size, sizeof(size));
166+ setsockopt(server_fd_, SOL_SOCKET, SO_RCVBUF, &size, sizeof(size));
167+ setsockopt(client_fd_, SOL_SOCKET, SO_SNDBUF, &size, sizeof(size));
168+ setsockopt(client_fd_, SOL_SOCKET, SO_RCVBUF, &size, sizeof(size));
169+}
170+
171+int mi::Channel::server_fd() const
172+{
173+ return server_fd_;
174+}
175+
176+int mi::Channel::client_fd() const
177+{
178+ return client_fd_;
179 }
180
181=== renamed file 'src/server/input/android/android_input_channel.h' => 'src/server/input/channel.h'
182--- src/server/input/android/android_input_channel.h 2015-02-22 07:46:25 +0000
183+++ src/server/input/channel.h 2016-04-05 21:21:50 +0000
184@@ -1,5 +1,5 @@
185 /*
186- * Copyright © 2013 Canonical Ltd.
187+ * Copyright © 2013,2016 Canonical Ltd.
188 *
189 * This program is free software: you can redistribute it and/or modify it
190 * under the terms of the GNU General Public License version 3,
191@@ -14,46 +14,35 @@
192 * along with this program. If not, see <http://www.gnu.org/licenses/>.
193 *
194 * Authored by: Robert Carr <robert.carr@canonical.com>
195+ * Brandon Schaefer <brandon.schaefer@canonical.com>
196 */
197
198-#ifndef MIR_INPUT_ANDROID_INPUT_CHANNEL_H_
199-#define MIR_INPUT_ANDROID_INPUT_CHANNEL_H_
200+#ifndef MIR_INPUT_CHANNEL_H_
201+#define MIR_INPUT_CHANNEL_H_
202
203+#include "mir/fd.h"
204 #include "mir/input/input_channel.h"
205
206-namespace android
207-{
208-class InputChannel;
209-}
210-
211-namespace droidinput = android;
212-
213 namespace mir
214 {
215 namespace input
216 {
217-namespace android
218-{
219
220-class AndroidInputChannel : public InputChannel
221+class Channel : public InputChannel
222 {
223 public:
224- explicit AndroidInputChannel();
225- virtual ~AndroidInputChannel();
226-
227- int client_fd() const;
228- int server_fd() const;
229-
230-protected:
231- AndroidInputChannel(AndroidInputChannel const&) = delete;
232- AndroidInputChannel& operator=(AndroidInputChannel const&) = delete;
233+ Channel();
234+ virtual ~Channel() override = default;
235+
236+ int client_fd() const override;
237+ int server_fd() const override;
238
239 private:
240- int s_fd, c_fd;
241+ Fd server_fd_;
242+ Fd client_fd_;
243 };
244
245 }
246 }
247-} // namespace mir
248
249-#endif // MIR_INPUT_ANDROID_INPUT_CHANNEL_H_
250+#endif /* MIR_INPUT_CHANNEL_H_ */
251
252=== renamed file 'src/server/input/android/input_channel_factory.cpp' => 'src/server/input/channel_factory.cpp'
253--- src/server/input/android/input_channel_factory.cpp 2014-04-10 12:59:14 +0000
254+++ src/server/input/channel_factory.cpp 2016-04-05 21:21:50 +0000
255@@ -1,5 +1,5 @@
256 /*
257- * Copyright © 2014 Canonical Ltd.
258+ * Copyright © 2014,2016 Canonical Ltd.
259 *
260 * This program is free software: you can redistribute it and/or modify it
261 * under the terms of the GNU General Public License version 3,
262@@ -16,13 +16,12 @@
263 * Authored by: Andreas Pokorny <andreas.pokorny@canonical.com>
264 */
265
266-#include "input_channel_factory.h"
267-#include "android_input_channel.h"
268+#include "channel.h"
269+#include "channel_factory.h"
270
271 namespace mi = mir::input;
272-namespace mia = mi::android;
273
274-std::shared_ptr<mi::InputChannel> mia::InputChannelFactory::make_input_channel()
275+std::shared_ptr<mi::InputChannel> mi::ChannelFactory::make_input_channel()
276 {
277- return std::make_shared<mia::AndroidInputChannel>();
278+ return std::make_shared<mi::Channel>();
279 }
280
281=== renamed file 'src/server/input/android/input_channel_factory.h' => 'src/server/input/channel_factory.h'
282--- src/server/input/android/input_channel_factory.h 2014-04-10 12:59:14 +0000
283+++ src/server/input/channel_factory.h 2016-04-05 21:21:50 +0000
284@@ -1,5 +1,5 @@
285 /*
286- * Copyright © 2014 Canonical Ltd.
287+ * Copyright © 2014,2016 Canonical Ltd.
288 *
289 * This program is free software: you can redistribute it and/or modify it
290 * under the terms of the GNU General Public License version 3,
291@@ -16,8 +16,8 @@
292 * Authored by: Andreas Pokorny <andreas.pokorny@canonical.com>
293 */
294
295-#ifndef MIR_INPUT_ANDROID_INPUT_CHANNEL_FACTORY_H_
296-#define MIR_INPUT_ANDROID_INPUT_CHANNEL_FACTORY_H_
297+#ifndef MIR_INPUT_CHANNEL_FACTORY_H_
298+#define MIR_INPUT_CHANNEL_FACTORY_H_
299
300 #include "mir/input/input_channel_factory.h"
301
302@@ -25,20 +25,18 @@
303 {
304 namespace input
305 {
306-namespace android
307-{
308-class InputChannelFactory : public mir::input::InputChannelFactory
309+
310+class ChannelFactory : public InputChannelFactory
311 {
312 public:
313- std::shared_ptr<mir::input::InputChannel> make_input_channel() override;
314+ virtual std::shared_ptr<InputChannel> make_input_channel() override;
315
316- InputChannelFactory() = default;
317- InputChannelFactory(InputChannelFactory const&) = delete;
318- InputChannelFactory& operator=(InputChannelFactory const&) = delete;
319+ ChannelFactory() = default;
320+ ChannelFactory(ChannelFactory const&) = delete;
321+ ChannelFactory& operator=(ChannelFactory const&) = delete;
322 };
323
324 }
325 }
326-} // namespace mir
327
328-#endif
329+#endif /* MIR_INPUT_CHANNEL_FACTORY_H_ */
330
331=== modified file 'src/server/input/default_configuration.cpp'
332--- src/server/input/default_configuration.cpp 2016-03-23 06:39:56 +0000
333+++ src/server/input/default_configuration.cpp 2016-04-05 21:21:50 +0000
334@@ -19,10 +19,10 @@
335 #include "mir/default_server_configuration.h"
336
337 #include "android/input_sender.h"
338-#include "android/input_channel_factory.h"
339 #include "key_repeat_dispatcher.h"
340 #include "display_input_region.h"
341 #include "event_filter_chain_dispatcher.h"
342+#include "channel_factory.h"
343 #include "cursor_controller.h"
344 #include "touchspot_controller.h"
345 #include "null_input_manager.h"
346@@ -161,7 +161,7 @@
347 if (!options->get<bool>(options::enable_input_opt))
348 return std::make_shared<mi::NullInputChannelFactory>();
349 else
350- return std::make_shared<mia::InputChannelFactory>();
351+ return std::make_shared<mi::ChannelFactory>();
352 }
353
354 std::shared_ptr<mi::CursorListener>
355
356=== modified file 'tests/unit-tests/client/input/test_android_input_receiver.cpp'
357--- tests/unit-tests/client/input/test_android_input_receiver.cpp 2016-03-29 03:41:45 +0000
358+++ tests/unit-tests/client/input/test_android_input_receiver.cpp 2016-04-05 21:21:50 +0000
359@@ -17,6 +17,7 @@
360 */
361
362 #include "src/client/input/android/android_input_receiver.h"
363+#include "src/server/input/channel.h"
364 #include "mir/input/null_input_receiver_report.h"
365 #include "mir/input/xkb_mapper.h"
366 #include "mir/events/event_private.h"
367@@ -40,6 +41,7 @@
368 namespace mircva = mircv::android;
369 namespace md = mir::dispatch;
370 namespace mt = mir::test;
371+namespace mi = mir::input;
372
373 namespace droidinput = android;
374
375@@ -130,24 +132,13 @@
376 class AndroidInputReceiverSetup : public testing::Test
377 {
378 public:
379- AndroidInputReceiverSetup()
380- {
381- auto status = droidinput::InputChannel::openInputFdPair(server_fd, client_fd);
382- EXPECT_EQ(droidinput::OK, status);
383- }
384- ~AndroidInputReceiverSetup()
385- {
386- close(server_fd);
387- close(client_fd);
388- }
389-
390 void flush_channels()
391 {
392- fsync(server_fd);
393- fsync(client_fd);
394+ fsync(channel.server_fd());
395+ fsync(channel.client_fd());
396 }
397
398- int server_fd, client_fd;
399+ mi::Channel channel;
400
401 static std::chrono::milliseconds const next_event_timeout;
402 std::function<void(MirEvent*)> event_handler{[](MirEvent*){}};
403@@ -159,7 +150,7 @@
404 TEST_F(AndroidInputReceiverSetup, receiver_receives_key_events)
405 {
406 MirKeyboardEvent last_event;
407- mircva::InputReceiver receiver{client_fd,
408+ mircva::InputReceiver receiver{channel.client_fd(),
409 std::make_shared<mircv::XKBMapper>(),
410 [&last_event](MirEvent* ev)
411 {
412@@ -169,7 +160,7 @@
413 }
414 },
415 std::make_shared<mircv::NullInputReceiverReport>()};
416- TestingInputProducer producer{server_fd};
417+ TestingInputProducer producer{channel.server_fd()};
418
419 producer.produce_a_key_event();
420
421@@ -184,11 +175,11 @@
422
423 TEST_F(AndroidInputReceiverSetup, receiver_handles_events)
424 {
425- mircva::InputReceiver receiver{client_fd,
426+ mircva::InputReceiver receiver{channel.client_fd(),
427 std::make_shared<mircv::XKBMapper>(),
428 event_handler,
429 std::make_shared<mircv::NullInputReceiverReport>()};
430- TestingInputProducer producer(server_fd);
431+ TestingInputProducer producer(channel.server_fd());
432
433 producer.produce_a_key_event();
434 flush_channels();
435@@ -203,12 +194,12 @@
436
437 TEST_F(AndroidInputReceiverSetup, receiver_consumes_batched_motion_events)
438 {
439- mircva::InputReceiver receiver{client_fd,
440+ mircva::InputReceiver receiver{channel.client_fd(),
441 std::make_shared<mircv::XKBMapper>(),
442 event_handler,
443 std::make_shared<mircv::NullInputReceiverReport>()};
444
445- TestingInputProducer producer(server_fd);
446+ TestingInputProducer producer(channel.server_fd());
447
448 // Produce 3 motion events before client handles any.
449 producer.produce_a_pointer_event(0, 0, std::chrono::nanoseconds(0));
450@@ -235,7 +226,7 @@
451 std::unique_ptr<MirEvent> ev;
452 bool handler_called{false};
453
454- mircva::InputReceiver receiver{client_fd,
455+ mircva::InputReceiver receiver{channel.client_fd(),
456 std::make_shared<mircv::XKBMapper>(),
457 [&ev, &handler_called](MirEvent* event)
458 {
459@@ -247,7 +238,7 @@
460 {
461 return t;
462 }};
463- TestingInputProducer producer(server_fd);
464+ TestingInputProducer producer(channel.server_fd());
465
466 nanoseconds const one_frame = duration_cast<nanoseconds>(1s) / 60;
467
468@@ -293,9 +284,9 @@
469 {
470 bool handler_called = false;
471
472- TestingInputProducer producer(server_fd);
473+ TestingInputProducer producer(channel.server_fd());
474 mircva::InputReceiver receiver{
475- client_fd,
476+ channel.client_fd(),
477 std::make_shared<mircv::XKBMapper>(),
478 [&handler_called, &producer](MirEvent*)
479 {
480@@ -322,7 +313,7 @@
481
482 int frames_triggered = 0;
483
484- mircva::InputReceiver receiver{client_fd,
485+ mircva::InputReceiver receiver{channel.client_fd(),
486 std::make_shared<mircv::XKBMapper>(),
487 [&frames_triggered](MirEvent*)
488 {
489@@ -333,7 +324,7 @@
490 {
491 return t;
492 }};
493- TestingInputProducer producer(server_fd);
494+ TestingInputProducer producer(channel.server_fd());
495
496 std::chrono::nanoseconds const device_sample_interval = duration_cast<nanoseconds>(1s) / 250;
497 std::chrono::nanoseconds const frame_interval = duration_cast<nanoseconds>(1s) / 60;
498@@ -375,12 +366,12 @@
499 std::chrono::nanoseconds t;
500
501 mircva::InputReceiver receiver{
502- client_fd,
503+ channel.client_fd(),
504 std::make_shared<mircv::XKBMapper>(),
505 event_handler,
506 std::make_shared<mircv::NullInputReceiverReport>(),
507 };
508- TestingInputProducer producer(server_fd);
509+ TestingInputProducer producer(channel.server_fd());
510
511 std::chrono::nanoseconds const one_millisecond = std::chrono::nanoseconds(1000000ULL);
512 std::chrono::nanoseconds const one_second = 1000 * one_millisecond;
513
514=== modified file 'tests/unit-tests/input/CMakeLists.txt'
515--- tests/unit-tests/input/CMakeLists.txt 2016-03-23 06:39:56 +0000
516+++ tests/unit-tests/input/CMakeLists.txt 2016-04-05 21:21:50 +0000
517@@ -7,6 +7,7 @@
518 ${CMAKE_CURRENT_SOURCE_DIR}/test_cursor_controller.cpp
519 ${CMAKE_CURRENT_SOURCE_DIR}/test_xcursor_loader.cpp
520 ${CMAKE_CURRENT_SOURCE_DIR}/test_touchspot_controller.cpp
521+ ${CMAKE_CURRENT_SOURCE_DIR}/test_input_channel_factory.cpp
522 ${CMAKE_CURRENT_SOURCE_DIR}/test_input_event.cpp
523 ${CMAKE_CURRENT_SOURCE_DIR}/test_event_builders.cpp
524 ${CMAKE_CURRENT_SOURCE_DIR}/test_default_device.cpp
525
526=== modified file 'tests/unit-tests/input/android/CMakeLists.txt'
527--- tests/unit-tests/input/android/CMakeLists.txt 2016-03-23 06:39:56 +0000
528+++ tests/unit-tests/input/android/CMakeLists.txt 2016-04-05 21:21:50 +0000
529@@ -1,6 +1,5 @@
530 list(APPEND UNIT_TEST_SOURCES
531 ${CMAKE_CURRENT_SOURCE_DIR}/test_android_input_lexicon.cpp
532- ${CMAKE_CURRENT_SOURCE_DIR}/test_android_input_channel_factory.cpp
533 ${CMAKE_CURRENT_SOURCE_DIR}/test_android_communication_package.cpp
534 ${CMAKE_CURRENT_SOURCE_DIR}/test_android_input_sender.cpp
535 ${CMAKE_CURRENT_SOURCE_DIR}/test_input_consumer.cpp
536
537=== modified file 'tests/unit-tests/input/android/test_android_communication_package.cpp'
538--- tests/unit-tests/input/android/test_android_communication_package.cpp 2014-03-06 06:05:17 +0000
539+++ tests/unit-tests/input/android/test_android_communication_package.cpp 2016-04-05 21:21:50 +0000
540@@ -16,7 +16,7 @@
541 * Authored by: Robert Carr <robert.carr@canonical.com>
542 */
543
544-#include "src/server/input/android/android_input_channel.h"
545+#include "src/server/input/channel.h"
546
547 #include <gtest/gtest.h>
548 #include <gmock/gmock.h>
549@@ -24,14 +24,13 @@
550 #include <unistd.h>
551 #include <fcntl.h>
552
553-namespace droidinput = android;
554-namespace mia = mir::input::android;
555+namespace mi = mir::input;
556
557-TEST(AndroidInputChannel, packages_own_valid_fds)
558+TEST(InputChannel, packages_own_valid_fds)
559 {
560 int server_fd, client_fd;
561 {
562- mia::AndroidInputChannel package;
563+ mi::Channel package;
564
565 server_fd = package.server_fd();
566 client_fd = package.client_fd();
567
568=== modified file 'tests/unit-tests/input/android/test_android_input_sender.cpp'
569--- tests/unit-tests/input/android/test_android_input_sender.cpp 2016-03-23 06:39:56 +0000
570+++ tests/unit-tests/input/android/test_android_input_sender.cpp 2016-04-05 21:21:50 +0000
571@@ -18,7 +18,7 @@
572
573 #include "mir/events/event_private.h"
574
575-#include "src/server/input/android/android_input_channel.h"
576+#include "src/server/input/channel.h"
577 #include "src/server/input/android/input_sender.h"
578 #include "src/server/input/default_event_builder.h"
579 #include "src/server/report/null_report_factory.h"
580@@ -44,7 +44,6 @@
581
582 #include <boost/exception/all.hpp>
583
584-//#include <algorithm>
585 #include <cstring>
586
587 namespace mi = mir::input;
588@@ -140,7 +139,7 @@
589 fake_scene.observer->surface_removed(&stub_surface);
590 }
591
592- std::shared_ptr<mi::InputChannel> channel = std::make_shared<mia::AndroidInputChannel>();
593+ std::shared_ptr<mi::InputChannel> channel = std::make_shared<mi::Channel>();
594 mtd::StubSceneSurface stub_surface{channel->server_fd()};
595 droidinput::sp<droidinput::InputChannel> client_channel{new droidinput::InputChannel(droidinput::String8("test"), channel->client_fd())};
596 droidinput::InputConsumer consumer{client_channel};
597
598=== modified file 'tests/unit-tests/input/android/test_input_consumer.cpp'
599--- tests/unit-tests/input/android/test_input_consumer.cpp 2016-03-23 06:39:56 +0000
600+++ tests/unit-tests/input/android/test_input_consumer.cpp 2016-04-05 21:21:50 +0000
601@@ -18,7 +18,7 @@
602
603 #include "androidfw/Input.h"
604 #include "androidfw/InputTransport.h"
605-#include "src/server/input/android/android_input_channel.h"
606+#include "src/server/input/channel.h"
607 #include "mir/input/android/event_conversion_helpers.h"
608 #include "mir/input/android/android_input_lexicon.h"
609 #include "mir/geometry/displacement.h"
610@@ -32,6 +32,7 @@
611
612 using namespace std::literals::chrono_literals;
613 namespace mia = mir::input::android;
614+namespace mi = mir::input;
615 namespace geom = mir::geometry;
616
617 namespace
618@@ -58,7 +59,7 @@
619 mir::cookie::Blob default_cookie;
620 EventFactory events;
621 std::chrono::milliseconds current_frame_time = 0ms;
622- mia::AndroidInputChannel channel;
623+ mi::Channel channel;
624 geom::Displacement no_move{0,0};
625 geom::Displacement no_scroll{0,0};
626 geom::Point origin{0,0};
627
628=== renamed file 'tests/unit-tests/input/android/test_android_input_channel_factory.cpp' => 'tests/unit-tests/input/test_input_channel_factory.cpp'
629--- tests/unit-tests/input/android/test_android_input_channel_factory.cpp 2015-06-17 05:20:42 +0000
630+++ tests/unit-tests/input/test_input_channel_factory.cpp 2016-04-05 21:21:50 +0000
631@@ -16,20 +16,20 @@
632 * Authored by: Robert Carr <robert.carr@canonical.com>
633 */
634
635-#include "src/server/input/android/android_input_channel.h"
636-#include "src/server/input/android/input_channel_factory.h"
637+#include "src/server/input/channel.h"
638+#include "src/server/input/channel_factory.h"
639
640 #include <gtest/gtest.h>
641 #include <gmock/gmock.h>
642
643 #include <initializer_list>
644
645-namespace mia = mir::input::android;
646+namespace mi = mir::input;
647
648-TEST(AndroidInputChannelFactory, channel_factory_returns_input_channel_with_fds)
649+TEST(InputChannelFactory, channel_factory_returns_input_channel_with_fds)
650 {
651- mia::InputChannelFactory factory;
652+ mi::ChannelFactory factory;
653
654 auto package = factory.make_input_channel();
655- EXPECT_NE(nullptr, std::dynamic_pointer_cast<mia::AndroidInputChannel>(package));
656+ EXPECT_NE(nullptr, std::dynamic_pointer_cast<mi::Channel>(package));
657 }

Subscribers

People subscribed via source and target branches