Merge lp:~brandontschaefer/mir/no-android-input-channel into lp:mir
- no-android-input-channel
- Merge into development-branch
Status: | Rejected |
---|---|
Rejected by: | Brandon Schaefer |
Proposed branch: | lp:~brandontschaefer/mir/no-android-input-channel |
Merge into: | lp:mir |
Diff against target: |
818 lines (+222/-263) 20 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/android/android_input_channel.cpp (+0/-48) src/server/input/android/android_input_channel.h (+0/-59) src/server/input/android/input_channel_factory.cpp (+0/-28) src/server/input/android/input_channel_factory.h (+0/-44) src/server/input/channel.cpp (+64/-0) src/server/input/channel.h (+48/-0) src/server/input/channel_factory.cpp (+28/-0) src/server/input/channel_factory.h (+43/-0) 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 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mir CI Bot | continuous-integration | Approve | |
Kevin DuBois (community) | Approve | ||
Cemil Azizoglu (community) | Needs Fixing | ||
Review via email: mp+290942@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.
- 3440. By Brandon Schaefer
-
* Should have just bzr mv'ed those files... but fix copyright headers
Mir CI Bot (mir-ci-bot) wrote : | # |
- 3441. By Brandon Schaefer
-
* Not sure why i used auto
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3440
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3441
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Cemil Azizoglu (cemil-azizoglu) wrote : | # |
Now that this code is out of the Android realm and is in the Mir realm, we should use Mir facilities, i.e. use 'mir::fd' instead of 'int'.
Cemil Azizoglu (cemil-azizoglu) wrote : | # |
Rather, 'mir::Fd'
- 3442. By Brandon Schaefer
-
* Use mir::Fd
Kevin DuBois (kdub) wrote : | # |
nit:
+ mir::Fd server_fd_;
no need for mir::, already in correct namespace
Diff size would be much reduced with bzr mv. If its not too much trouble, it could still be done.
The rest looks alright to me.
nb:
+mi::Channel:
Although I don't think I see an opportunity for an exception to be thrown between the socketpair and setting mir::Fd (only C functions are used), in general the fd's should be put in the RAII wrapper right after the resource is acquired for exception safety.
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3442
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Brandon Schaefer (brandontschaefer) wrote : | # |
Used bzr mv in this branch vs delete/touch:
https:/
Unmerged revisions
- 3442. By Brandon Schaefer
-
* Use mir::Fd
- 3441. By Brandon Schaefer
-
* Not sure why i used auto
- 3440. By Brandon Schaefer
-
* Should have just bzr mv'ed those files... but fix copyright headers
- 3439. By Brandon Schaefer
-
* Remove the dependency on the android input channel and just create our own.
* The start of slowly removing all the android input sender/receiver!
Preview Diff
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 19:30:54 +0000 | |||
4 | @@ -141,12 +141,6 @@ | |||
5 | 141 | public: | 141 | public: |
6 | 142 | InputChannel(const String8& name, int fd); | 142 | InputChannel(const String8& name, int fd); |
7 | 143 | 143 | ||
8 | 144 | /* Creates a pair of input channels. | ||
9 | 145 | * | ||
10 | 146 | * Returns OK on success. | ||
11 | 147 | */ | ||
12 | 148 | static status_t openInputFdPair(int& server_fd, int& client_fd); | ||
13 | 149 | |||
14 | 150 | inline String8 getName() const { return mName; } | 144 | inline String8 getName() const { return mName; } |
15 | 151 | inline int getFd() const { return mFd; } | 145 | inline int getFd() const { return mFd; } |
16 | 152 | 146 | ||
17 | 153 | 147 | ||
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 19:30:54 +0000 | |||
21 | @@ -32,12 +32,6 @@ | |||
22 | 32 | 32 | ||
23 | 33 | namespace android { | 33 | namespace android { |
24 | 34 | 34 | ||
25 | 35 | // Socket buffer size. The default is typically about 128KB, which is much larger than | ||
26 | 36 | // we really need. So we make it smaller. It just needs to be big enough to hold | ||
27 | 37 | // a few dozen large multi-finger motion events in the case where an application gets | ||
28 | 38 | // behind processing touches. | ||
29 | 39 | static const size_t SOCKET_BUFFER_SIZE = 32 * 1024; | ||
30 | 40 | |||
31 | 41 | // Nanoseconds per milliseconds. | 35 | // Nanoseconds per milliseconds. |
32 | 42 | static constexpr const std::chrono::nanoseconds NANOS_PER_MS = std::chrono::nanoseconds(1000000); | 36 | static constexpr const std::chrono::nanoseconds NANOS_PER_MS = std::chrono::nanoseconds(1000000); |
33 | 43 | 37 | ||
34 | @@ -117,29 +111,6 @@ | |||
35 | 117 | #endif | 111 | #endif |
36 | 118 | } | 112 | } |
37 | 119 | 113 | ||
38 | 120 | status_t InputChannel::openInputFdPair(int& server_fd, int& client_fd) { | ||
39 | 121 | int sockets[2]; | ||
40 | 122 | if (socketpair(AF_UNIX, SOCK_SEQPACKET, 0, sockets)) { | ||
41 | 123 | status_t result = -errno; | ||
42 | 124 | ALOGE("InputChannel ~ Could not create socket pair. errno=%d", | ||
43 | 125 | errno); | ||
44 | 126 | server_fd = client_fd = 0; | ||
45 | 127 | |||
46 | 128 | return result; | ||
47 | 129 | } | ||
48 | 130 | |||
49 | 131 | int bufferSize = SOCKET_BUFFER_SIZE; | ||
50 | 132 | setsockopt(sockets[0], SOL_SOCKET, SO_SNDBUF, &bufferSize, sizeof(bufferSize)); | ||
51 | 133 | setsockopt(sockets[0], SOL_SOCKET, SO_RCVBUF, &bufferSize, sizeof(bufferSize)); | ||
52 | 134 | setsockopt(sockets[1], SOL_SOCKET, SO_SNDBUF, &bufferSize, sizeof(bufferSize)); | ||
53 | 135 | setsockopt(sockets[1], SOL_SOCKET, SO_RCVBUF, &bufferSize, sizeof(bufferSize)); | ||
54 | 136 | |||
55 | 137 | server_fd = sockets[0]; | ||
56 | 138 | client_fd = sockets[1]; | ||
57 | 139 | |||
58 | 140 | return OK; | ||
59 | 141 | } | ||
60 | 142 | |||
61 | 143 | status_t InputChannel::sendMessage(const InputMessage* msg) { | 114 | status_t InputChannel::sendMessage(const InputMessage* msg) { |
62 | 144 | size_t msgLength = msg->size(); | 115 | size_t msgLength = msg->size(); |
63 | 145 | ssize_t nWrite; | 116 | ssize_t nWrite; |
64 | 146 | 117 | ||
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 19:30:54 +0000 | |||
68 | @@ -6,6 +6,8 @@ | |||
69 | 6 | 6 | ||
70 | 7 | basic_seat.cpp | 7 | basic_seat.cpp |
71 | 8 | builtin_cursor_images.cpp | 8 | builtin_cursor_images.cpp |
72 | 9 | channel.cpp | ||
73 | 10 | channel_factory.cpp | ||
74 | 9 | cursor_controller.cpp | 11 | cursor_controller.cpp |
75 | 10 | default_configuration.cpp | 12 | default_configuration.cpp |
76 | 11 | default_device.cpp | 13 | default_device.cpp |
77 | 12 | 14 | ||
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 19:30:54 +0000 | |||
81 | @@ -1,7 +1,5 @@ | |||
82 | 1 | list( | 1 | list( |
83 | 2 | APPEND INPUT_SOURCES | 2 | APPEND INPUT_SOURCES |
84 | 3 | ${CMAKE_CURRENT_SOURCE_DIR}/android_input_channel.cpp | ||
85 | 4 | ${CMAKE_CURRENT_SOURCE_DIR}/input_channel_factory.cpp | ||
86 | 5 | ${CMAKE_CURRENT_SOURCE_DIR}/input_sender.cpp | 3 | ${CMAKE_CURRENT_SOURCE_DIR}/input_sender.cpp |
87 | 6 | ) | 4 | ) |
88 | 7 | 5 | ||
89 | 8 | 6 | ||
90 | === removed file 'src/server/input/android/android_input_channel.cpp' | |||
91 | --- src/server/input/android/android_input_channel.cpp 2014-03-06 06:05:17 +0000 | |||
92 | +++ src/server/input/android/android_input_channel.cpp 1970-01-01 00:00:00 +0000 | |||
93 | @@ -1,48 +0,0 @@ | |||
94 | 1 | /* | ||
95 | 2 | * Copyright © 2013 Canonical Ltd. | ||
96 | 3 | * | ||
97 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
98 | 5 | * under the terms of the GNU General Public License version 3, | ||
99 | 6 | * as published by the Free Software Foundation. | ||
100 | 7 | * | ||
101 | 8 | * This program is distributed in the hope that it will be useful, | ||
102 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
103 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
104 | 11 | * GNU General Public License for more details. | ||
105 | 12 | * | ||
106 | 13 | * You should have received a copy of the GNU General Public License | ||
107 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
108 | 15 | * | ||
109 | 16 | * Authored by: Robert Carr <robert.carr@canonical.com> | ||
110 | 17 | */ | ||
111 | 18 | |||
112 | 19 | #include "android_input_channel.h" | ||
113 | 20 | |||
114 | 21 | #include <androidfw/InputTransport.h> | ||
115 | 22 | |||
116 | 23 | #include <unistd.h> | ||
117 | 24 | |||
118 | 25 | namespace mia = mir::input::android; | ||
119 | 26 | namespace droidinput = android; | ||
120 | 27 | |||
121 | 28 | mia::AndroidInputChannel::AndroidInputChannel() | ||
122 | 29 | { | ||
123 | 30 | |||
124 | 31 | droidinput::InputChannel::openInputFdPair(s_fd, c_fd); | ||
125 | 32 | } | ||
126 | 33 | |||
127 | 34 | mia::AndroidInputChannel::~AndroidInputChannel() | ||
128 | 35 | { | ||
129 | 36 | close(s_fd); | ||
130 | 37 | close(c_fd); | ||
131 | 38 | } | ||
132 | 39 | |||
133 | 40 | int mia::AndroidInputChannel::client_fd() const | ||
134 | 41 | { | ||
135 | 42 | return c_fd; | ||
136 | 43 | } | ||
137 | 44 | |||
138 | 45 | int mia::AndroidInputChannel::server_fd() const | ||
139 | 46 | { | ||
140 | 47 | return s_fd; | ||
141 | 48 | } | ||
142 | 49 | 0 | ||
143 | === removed file 'src/server/input/android/android_input_channel.h' | |||
144 | --- src/server/input/android/android_input_channel.h 2015-02-22 07:46:25 +0000 | |||
145 | +++ src/server/input/android/android_input_channel.h 1970-01-01 00:00:00 +0000 | |||
146 | @@ -1,59 +0,0 @@ | |||
147 | 1 | /* | ||
148 | 2 | * Copyright © 2013 Canonical Ltd. | ||
149 | 3 | * | ||
150 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
151 | 5 | * under the terms of the GNU General Public License version 3, | ||
152 | 6 | * as published by the Free Software Foundation. | ||
153 | 7 | * | ||
154 | 8 | * This program is distributed in the hope that it will be useful, | ||
155 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
156 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
157 | 11 | * GNU General Public License for more details. | ||
158 | 12 | * | ||
159 | 13 | * You should have received a copy of the GNU General Public License | ||
160 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
161 | 15 | * | ||
162 | 16 | * Authored by: Robert Carr <robert.carr@canonical.com> | ||
163 | 17 | */ | ||
164 | 18 | |||
165 | 19 | #ifndef MIR_INPUT_ANDROID_INPUT_CHANNEL_H_ | ||
166 | 20 | #define MIR_INPUT_ANDROID_INPUT_CHANNEL_H_ | ||
167 | 21 | |||
168 | 22 | #include "mir/input/input_channel.h" | ||
169 | 23 | |||
170 | 24 | namespace android | ||
171 | 25 | { | ||
172 | 26 | class InputChannel; | ||
173 | 27 | } | ||
174 | 28 | |||
175 | 29 | namespace droidinput = android; | ||
176 | 30 | |||
177 | 31 | namespace mir | ||
178 | 32 | { | ||
179 | 33 | namespace input | ||
180 | 34 | { | ||
181 | 35 | namespace android | ||
182 | 36 | { | ||
183 | 37 | |||
184 | 38 | class AndroidInputChannel : public InputChannel | ||
185 | 39 | { | ||
186 | 40 | public: | ||
187 | 41 | explicit AndroidInputChannel(); | ||
188 | 42 | virtual ~AndroidInputChannel(); | ||
189 | 43 | |||
190 | 44 | int client_fd() const; | ||
191 | 45 | int server_fd() const; | ||
192 | 46 | |||
193 | 47 | protected: | ||
194 | 48 | AndroidInputChannel(AndroidInputChannel const&) = delete; | ||
195 | 49 | AndroidInputChannel& operator=(AndroidInputChannel const&) = delete; | ||
196 | 50 | |||
197 | 51 | private: | ||
198 | 52 | int s_fd, c_fd; | ||
199 | 53 | }; | ||
200 | 54 | |||
201 | 55 | } | ||
202 | 56 | } | ||
203 | 57 | } // namespace mir | ||
204 | 58 | |||
205 | 59 | #endif // MIR_INPUT_ANDROID_INPUT_CHANNEL_H_ | ||
206 | 60 | 0 | ||
207 | === removed file 'src/server/input/android/input_channel_factory.cpp' | |||
208 | --- src/server/input/android/input_channel_factory.cpp 2014-04-10 12:59:14 +0000 | |||
209 | +++ src/server/input/android/input_channel_factory.cpp 1970-01-01 00:00:00 +0000 | |||
210 | @@ -1,28 +0,0 @@ | |||
211 | 1 | /* | ||
212 | 2 | * Copyright © 2014 Canonical Ltd. | ||
213 | 3 | * | ||
214 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
215 | 5 | * under the terms of the GNU General Public License version 3, | ||
216 | 6 | * as published by the Free Software Foundation. | ||
217 | 7 | * | ||
218 | 8 | * This program is distributed in the hope that it will be useful, | ||
219 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
220 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
221 | 11 | * GNU General Public License for more details. | ||
222 | 12 | * | ||
223 | 13 | * You should have received a copy of the GNU General Public License | ||
224 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
225 | 15 | * | ||
226 | 16 | * Authored by: Andreas Pokorny <andreas.pokorny@canonical.com> | ||
227 | 17 | */ | ||
228 | 18 | |||
229 | 19 | #include "input_channel_factory.h" | ||
230 | 20 | #include "android_input_channel.h" | ||
231 | 21 | |||
232 | 22 | namespace mi = mir::input; | ||
233 | 23 | namespace mia = mi::android; | ||
234 | 24 | |||
235 | 25 | std::shared_ptr<mi::InputChannel> mia::InputChannelFactory::make_input_channel() | ||
236 | 26 | { | ||
237 | 27 | return std::make_shared<mia::AndroidInputChannel>(); | ||
238 | 28 | } | ||
239 | 29 | 0 | ||
240 | === removed file 'src/server/input/android/input_channel_factory.h' | |||
241 | --- src/server/input/android/input_channel_factory.h 2014-04-10 12:59:14 +0000 | |||
242 | +++ src/server/input/android/input_channel_factory.h 1970-01-01 00:00:00 +0000 | |||
243 | @@ -1,44 +0,0 @@ | |||
244 | 1 | /* | ||
245 | 2 | * Copyright © 2014 Canonical Ltd. | ||
246 | 3 | * | ||
247 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
248 | 5 | * under the terms of the GNU General Public License version 3, | ||
249 | 6 | * as published by the Free Software Foundation. | ||
250 | 7 | * | ||
251 | 8 | * This program is distributed in the hope that it will be useful, | ||
252 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
253 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
254 | 11 | * GNU General Public License for more details. | ||
255 | 12 | * | ||
256 | 13 | * You should have received a copy of the GNU General Public License | ||
257 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
258 | 15 | * | ||
259 | 16 | * Authored by: Andreas Pokorny <andreas.pokorny@canonical.com> | ||
260 | 17 | */ | ||
261 | 18 | |||
262 | 19 | #ifndef MIR_INPUT_ANDROID_INPUT_CHANNEL_FACTORY_H_ | ||
263 | 20 | #define MIR_INPUT_ANDROID_INPUT_CHANNEL_FACTORY_H_ | ||
264 | 21 | |||
265 | 22 | #include "mir/input/input_channel_factory.h" | ||
266 | 23 | |||
267 | 24 | namespace mir | ||
268 | 25 | { | ||
269 | 26 | namespace input | ||
270 | 27 | { | ||
271 | 28 | namespace android | ||
272 | 29 | { | ||
273 | 30 | class InputChannelFactory : public mir::input::InputChannelFactory | ||
274 | 31 | { | ||
275 | 32 | public: | ||
276 | 33 | std::shared_ptr<mir::input::InputChannel> make_input_channel() override; | ||
277 | 34 | |||
278 | 35 | InputChannelFactory() = default; | ||
279 | 36 | InputChannelFactory(InputChannelFactory const&) = delete; | ||
280 | 37 | InputChannelFactory& operator=(InputChannelFactory const&) = delete; | ||
281 | 38 | }; | ||
282 | 39 | |||
283 | 40 | } | ||
284 | 41 | } | ||
285 | 42 | } // namespace mir | ||
286 | 43 | |||
287 | 44 | #endif | ||
288 | 45 | 0 | ||
289 | === added file 'src/server/input/channel.cpp' | |||
290 | --- src/server/input/channel.cpp 1970-01-01 00:00:00 +0000 | |||
291 | +++ src/server/input/channel.cpp 2016-04-05 19:30:54 +0000 | |||
292 | @@ -0,0 +1,64 @@ | |||
293 | 1 | /* | ||
294 | 2 | * Copyright © 2013-2016 Canonical Ltd. | ||
295 | 3 | * | ||
296 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
297 | 5 | * under the terms of the GNU General Public License version 3, | ||
298 | 6 | * as published by the Free Software Foundation. | ||
299 | 7 | * | ||
300 | 8 | * This program is distributed in the hope that it will be useful, | ||
301 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
302 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
303 | 11 | * GNU General Public License for more details. | ||
304 | 12 | * | ||
305 | 13 | * You should have received a copy of the GNU General Public License | ||
306 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
307 | 15 | * | ||
308 | 16 | * Authored by: Robert Carr <robert.carr@canonical.com> | ||
309 | 17 | * Brandon Schaefer <brandon.schaefer@canonical.com> | ||
310 | 18 | */ | ||
311 | 19 | |||
312 | 20 | #include <system_error> | ||
313 | 21 | #include <sys/types.h> | ||
314 | 22 | #include <sys/socket.h> | ||
315 | 23 | |||
316 | 24 | #include "channel.h" | ||
317 | 25 | |||
318 | 26 | #include <boost/throw_exception.hpp> | ||
319 | 27 | |||
320 | 28 | namespace mi = mir::input; | ||
321 | 29 | |||
322 | 30 | namespace | ||
323 | 31 | { | ||
324 | 32 | // Default is 128KB which is larger then we need. Use a smaller size. | ||
325 | 33 | int const buffer_size{32 * 1024}; | ||
326 | 34 | } | ||
327 | 35 | |||
328 | 36 | mi::Channel::Channel() | ||
329 | 37 | { | ||
330 | 38 | int sockets[2]; | ||
331 | 39 | if (socketpair(AF_UNIX, SOCK_SEQPACKET, 0, sockets)) { | ||
332 | 40 | BOOST_THROW_EXCEPTION(std::system_error( | ||
333 | 41 | errno, | ||
334 | 42 | std::system_category(), | ||
335 | 43 | "Could not create socket pair.")); | ||
336 | 44 | } | ||
337 | 45 | |||
338 | 46 | int size = buffer_size; | ||
339 | 47 | setsockopt(sockets[0], SOL_SOCKET, SO_SNDBUF, &size, sizeof(size)); | ||
340 | 48 | setsockopt(sockets[0], SOL_SOCKET, SO_RCVBUF, &size, sizeof(size)); | ||
341 | 49 | setsockopt(sockets[1], SOL_SOCKET, SO_SNDBUF, &size, sizeof(size)); | ||
342 | 50 | setsockopt(sockets[1], SOL_SOCKET, SO_RCVBUF, &size, sizeof(size)); | ||
343 | 51 | |||
344 | 52 | server_fd_ = mir::Fd(sockets[0]); | ||
345 | 53 | client_fd_ = mir::Fd(sockets[1]); | ||
346 | 54 | } | ||
347 | 55 | |||
348 | 56 | int mi::Channel::server_fd() const | ||
349 | 57 | { | ||
350 | 58 | return server_fd_; | ||
351 | 59 | } | ||
352 | 60 | |||
353 | 61 | int mi::Channel::client_fd() const | ||
354 | 62 | { | ||
355 | 63 | return client_fd_; | ||
356 | 64 | } | ||
357 | 0 | 65 | ||
358 | === added file 'src/server/input/channel.h' | |||
359 | --- src/server/input/channel.h 1970-01-01 00:00:00 +0000 | |||
360 | +++ src/server/input/channel.h 2016-04-05 19:30:54 +0000 | |||
361 | @@ -0,0 +1,48 @@ | |||
362 | 1 | /* | ||
363 | 2 | * Copyright © 2013-2016 Canonical Ltd. | ||
364 | 3 | * | ||
365 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
366 | 5 | * under the terms of the GNU General Public License version 3, | ||
367 | 6 | * as published by the Free Software Foundation. | ||
368 | 7 | * | ||
369 | 8 | * This program is distributed in the hope that it will be useful, | ||
370 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
371 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
372 | 11 | * GNU General Public License for more details. | ||
373 | 12 | * | ||
374 | 13 | * You should have received a copy of the GNU General Public License | ||
375 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
376 | 15 | * | ||
377 | 16 | * Authored by: Robert Carr <robert.carr@canonical.com> | ||
378 | 17 | * Brandon Schaefer <brandon.schaefer@canonical.com> | ||
379 | 18 | */ | ||
380 | 19 | |||
381 | 20 | #ifndef MIR_INPUT_CHANNEL_H_ | ||
382 | 21 | #define MIR_INPUT_CHANNEL_H_ | ||
383 | 22 | |||
384 | 23 | #include "mir/fd.h" | ||
385 | 24 | #include "mir/input/input_channel.h" | ||
386 | 25 | |||
387 | 26 | namespace mir | ||
388 | 27 | { | ||
389 | 28 | namespace input | ||
390 | 29 | { | ||
391 | 30 | |||
392 | 31 | class Channel : public InputChannel | ||
393 | 32 | { | ||
394 | 33 | public: | ||
395 | 34 | Channel(); | ||
396 | 35 | virtual ~Channel() override = default; | ||
397 | 36 | |||
398 | 37 | int client_fd() const override; | ||
399 | 38 | int server_fd() const override; | ||
400 | 39 | |||
401 | 40 | private: | ||
402 | 41 | mir::Fd server_fd_; | ||
403 | 42 | mir::Fd client_fd_; | ||
404 | 43 | }; | ||
405 | 44 | |||
406 | 45 | } | ||
407 | 46 | } | ||
408 | 47 | |||
409 | 48 | #endif /* MIR_INPUT_CHANNEL_H_ */ | ||
410 | 0 | 49 | ||
411 | === added file 'src/server/input/channel_factory.cpp' | |||
412 | --- src/server/input/channel_factory.cpp 1970-01-01 00:00:00 +0000 | |||
413 | +++ src/server/input/channel_factory.cpp 2016-04-05 19:30:54 +0000 | |||
414 | @@ -0,0 +1,28 @@ | |||
415 | 1 | /* | ||
416 | 2 | * Copyright © 2014-2016 Canonical Ltd. | ||
417 | 3 | * | ||
418 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
419 | 5 | * under the terms of the GNU General Public License version 3, | ||
420 | 6 | * as published by the Free Software Foundation. | ||
421 | 7 | * | ||
422 | 8 | * This program is distributed in the hope that it will be useful, | ||
423 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
424 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
425 | 11 | * GNU General Public License for more details. | ||
426 | 12 | * | ||
427 | 13 | * You should have received a copy of the GNU General Public License | ||
428 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
429 | 15 | * | ||
430 | 16 | * Authored by: Andreas Pokorny <andreas.pokorny@canonical.com> | ||
431 | 17 | * | ||
432 | 18 | */ | ||
433 | 19 | |||
434 | 20 | #include "channel.h" | ||
435 | 21 | #include "channel_factory.h" | ||
436 | 22 | |||
437 | 23 | namespace mi = mir::input; | ||
438 | 24 | |||
439 | 25 | std::shared_ptr<mi::InputChannel> mi::ChannelFactory::make_input_channel() | ||
440 | 26 | { | ||
441 | 27 | return std::make_shared<mi::Channel>(); | ||
442 | 28 | } | ||
443 | 0 | 29 | ||
444 | === added file 'src/server/input/channel_factory.h' | |||
445 | --- src/server/input/channel_factory.h 1970-01-01 00:00:00 +0000 | |||
446 | +++ src/server/input/channel_factory.h 2016-04-05 19:30:54 +0000 | |||
447 | @@ -0,0 +1,43 @@ | |||
448 | 1 | /* | ||
449 | 2 | * Copyright © 2014-2016 Canonical Ltd. | ||
450 | 3 | * | ||
451 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
452 | 5 | * under the terms of the GNU General Public License version 3, | ||
453 | 6 | * as published by the Free Software Foundation. | ||
454 | 7 | * | ||
455 | 8 | * This program is distributed in the hope that it will be useful, | ||
456 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
457 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
458 | 11 | * GNU General Public License for more details. | ||
459 | 12 | * | ||
460 | 13 | * You should have received a copy of the GNU General Public License | ||
461 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
462 | 15 | * | ||
463 | 16 | * Authored by: Andreas Pokorny <andreas.pokorny@canonical.com> | ||
464 | 17 | * | ||
465 | 18 | */ | ||
466 | 19 | |||
467 | 20 | #ifndef MIR_INPUT_CHANNEL_FACTORY_H_ | ||
468 | 21 | #define MIR_INPUT_CHANNEL_FACTORY_H_ | ||
469 | 22 | |||
470 | 23 | #include "mir/input/input_channel_factory.h" | ||
471 | 24 | |||
472 | 25 | namespace mir | ||
473 | 26 | { | ||
474 | 27 | namespace input | ||
475 | 28 | { | ||
476 | 29 | |||
477 | 30 | class ChannelFactory : public InputChannelFactory | ||
478 | 31 | { | ||
479 | 32 | public: | ||
480 | 33 | virtual std::shared_ptr<InputChannel> make_input_channel() override; | ||
481 | 34 | |||
482 | 35 | ChannelFactory() = default; | ||
483 | 36 | ChannelFactory(ChannelFactory const&) = delete; | ||
484 | 37 | ChannelFactory& operator=(ChannelFactory const&) = delete; | ||
485 | 38 | }; | ||
486 | 39 | |||
487 | 40 | } | ||
488 | 41 | } | ||
489 | 42 | |||
490 | 43 | #endif /* MIR_INPUT_CHANNEL_FACTORY_H_ */ | ||
491 | 0 | 44 | ||
492 | === modified file 'src/server/input/default_configuration.cpp' | |||
493 | --- src/server/input/default_configuration.cpp 2016-03-23 06:39:56 +0000 | |||
494 | +++ src/server/input/default_configuration.cpp 2016-04-05 19:30:54 +0000 | |||
495 | @@ -19,10 +19,10 @@ | |||
496 | 19 | #include "mir/default_server_configuration.h" | 19 | #include "mir/default_server_configuration.h" |
497 | 20 | 20 | ||
498 | 21 | #include "android/input_sender.h" | 21 | #include "android/input_sender.h" |
499 | 22 | #include "android/input_channel_factory.h" | ||
500 | 23 | #include "key_repeat_dispatcher.h" | 22 | #include "key_repeat_dispatcher.h" |
501 | 24 | #include "display_input_region.h" | 23 | #include "display_input_region.h" |
502 | 25 | #include "event_filter_chain_dispatcher.h" | 24 | #include "event_filter_chain_dispatcher.h" |
503 | 25 | #include "channel_factory.h" | ||
504 | 26 | #include "cursor_controller.h" | 26 | #include "cursor_controller.h" |
505 | 27 | #include "touchspot_controller.h" | 27 | #include "touchspot_controller.h" |
506 | 28 | #include "null_input_manager.h" | 28 | #include "null_input_manager.h" |
507 | @@ -161,7 +161,7 @@ | |||
508 | 161 | if (!options->get<bool>(options::enable_input_opt)) | 161 | if (!options->get<bool>(options::enable_input_opt)) |
509 | 162 | return std::make_shared<mi::NullInputChannelFactory>(); | 162 | return std::make_shared<mi::NullInputChannelFactory>(); |
510 | 163 | else | 163 | else |
512 | 164 | return std::make_shared<mia::InputChannelFactory>(); | 164 | return std::make_shared<mi::ChannelFactory>(); |
513 | 165 | } | 165 | } |
514 | 166 | 166 | ||
515 | 167 | std::shared_ptr<mi::CursorListener> | 167 | std::shared_ptr<mi::CursorListener> |
516 | 168 | 168 | ||
517 | === modified file 'tests/unit-tests/client/input/test_android_input_receiver.cpp' | |||
518 | --- tests/unit-tests/client/input/test_android_input_receiver.cpp 2016-03-29 03:41:45 +0000 | |||
519 | +++ tests/unit-tests/client/input/test_android_input_receiver.cpp 2016-04-05 19:30:54 +0000 | |||
520 | @@ -17,6 +17,7 @@ | |||
521 | 17 | */ | 17 | */ |
522 | 18 | 18 | ||
523 | 19 | #include "src/client/input/android/android_input_receiver.h" | 19 | #include "src/client/input/android/android_input_receiver.h" |
524 | 20 | #include "src/server/input/channel.h" | ||
525 | 20 | #include "mir/input/null_input_receiver_report.h" | 21 | #include "mir/input/null_input_receiver_report.h" |
526 | 21 | #include "mir/input/xkb_mapper.h" | 22 | #include "mir/input/xkb_mapper.h" |
527 | 22 | #include "mir/events/event_private.h" | 23 | #include "mir/events/event_private.h" |
528 | @@ -40,6 +41,7 @@ | |||
529 | 40 | namespace mircva = mircv::android; | 41 | namespace mircva = mircv::android; |
530 | 41 | namespace md = mir::dispatch; | 42 | namespace md = mir::dispatch; |
531 | 42 | namespace mt = mir::test; | 43 | namespace mt = mir::test; |
532 | 44 | namespace mi = mir::input; | ||
533 | 43 | 45 | ||
534 | 44 | namespace droidinput = android; | 46 | namespace droidinput = android; |
535 | 45 | 47 | ||
536 | @@ -130,24 +132,13 @@ | |||
537 | 130 | class AndroidInputReceiverSetup : public testing::Test | 132 | class AndroidInputReceiverSetup : public testing::Test |
538 | 131 | { | 133 | { |
539 | 132 | public: | 134 | public: |
540 | 133 | AndroidInputReceiverSetup() | ||
541 | 134 | { | ||
542 | 135 | auto status = droidinput::InputChannel::openInputFdPair(server_fd, client_fd); | ||
543 | 136 | EXPECT_EQ(droidinput::OK, status); | ||
544 | 137 | } | ||
545 | 138 | ~AndroidInputReceiverSetup() | ||
546 | 139 | { | ||
547 | 140 | close(server_fd); | ||
548 | 141 | close(client_fd); | ||
549 | 142 | } | ||
550 | 143 | |||
551 | 144 | void flush_channels() | 135 | void flush_channels() |
552 | 145 | { | 136 | { |
555 | 146 | fsync(server_fd); | 137 | fsync(channel.server_fd()); |
556 | 147 | fsync(client_fd); | 138 | fsync(channel.client_fd()); |
557 | 148 | } | 139 | } |
558 | 149 | 140 | ||
560 | 150 | int server_fd, client_fd; | 141 | mi::Channel channel; |
561 | 151 | 142 | ||
562 | 152 | static std::chrono::milliseconds const next_event_timeout; | 143 | static std::chrono::milliseconds const next_event_timeout; |
563 | 153 | std::function<void(MirEvent*)> event_handler{[](MirEvent*){}}; | 144 | std::function<void(MirEvent*)> event_handler{[](MirEvent*){}}; |
564 | @@ -159,7 +150,7 @@ | |||
565 | 159 | TEST_F(AndroidInputReceiverSetup, receiver_receives_key_events) | 150 | TEST_F(AndroidInputReceiverSetup, receiver_receives_key_events) |
566 | 160 | { | 151 | { |
567 | 161 | MirKeyboardEvent last_event; | 152 | MirKeyboardEvent last_event; |
569 | 162 | mircva::InputReceiver receiver{client_fd, | 153 | mircva::InputReceiver receiver{channel.client_fd(), |
570 | 163 | std::make_shared<mircv::XKBMapper>(), | 154 | std::make_shared<mircv::XKBMapper>(), |
571 | 164 | [&last_event](MirEvent* ev) | 155 | [&last_event](MirEvent* ev) |
572 | 165 | { | 156 | { |
573 | @@ -169,7 +160,7 @@ | |||
574 | 169 | } | 160 | } |
575 | 170 | }, | 161 | }, |
576 | 171 | std::make_shared<mircv::NullInputReceiverReport>()}; | 162 | std::make_shared<mircv::NullInputReceiverReport>()}; |
578 | 172 | TestingInputProducer producer{server_fd}; | 163 | TestingInputProducer producer{channel.server_fd()}; |
579 | 173 | 164 | ||
580 | 174 | producer.produce_a_key_event(); | 165 | producer.produce_a_key_event(); |
581 | 175 | 166 | ||
582 | @@ -184,11 +175,11 @@ | |||
583 | 184 | 175 | ||
584 | 185 | TEST_F(AndroidInputReceiverSetup, receiver_handles_events) | 176 | TEST_F(AndroidInputReceiverSetup, receiver_handles_events) |
585 | 186 | { | 177 | { |
587 | 187 | mircva::InputReceiver receiver{client_fd, | 178 | mircva::InputReceiver receiver{channel.client_fd(), |
588 | 188 | std::make_shared<mircv::XKBMapper>(), | 179 | std::make_shared<mircv::XKBMapper>(), |
589 | 189 | event_handler, | 180 | event_handler, |
590 | 190 | std::make_shared<mircv::NullInputReceiverReport>()}; | 181 | std::make_shared<mircv::NullInputReceiverReport>()}; |
592 | 191 | TestingInputProducer producer(server_fd); | 182 | TestingInputProducer producer(channel.server_fd()); |
593 | 192 | 183 | ||
594 | 193 | producer.produce_a_key_event(); | 184 | producer.produce_a_key_event(); |
595 | 194 | flush_channels(); | 185 | flush_channels(); |
596 | @@ -203,12 +194,12 @@ | |||
597 | 203 | 194 | ||
598 | 204 | TEST_F(AndroidInputReceiverSetup, receiver_consumes_batched_motion_events) | 195 | TEST_F(AndroidInputReceiverSetup, receiver_consumes_batched_motion_events) |
599 | 205 | { | 196 | { |
601 | 206 | mircva::InputReceiver receiver{client_fd, | 197 | mircva::InputReceiver receiver{channel.client_fd(), |
602 | 207 | std::make_shared<mircv::XKBMapper>(), | 198 | std::make_shared<mircv::XKBMapper>(), |
603 | 208 | event_handler, | 199 | event_handler, |
604 | 209 | std::make_shared<mircv::NullInputReceiverReport>()}; | 200 | std::make_shared<mircv::NullInputReceiverReport>()}; |
605 | 210 | 201 | ||
607 | 211 | TestingInputProducer producer(server_fd); | 202 | TestingInputProducer producer(channel.server_fd()); |
608 | 212 | 203 | ||
609 | 213 | // Produce 3 motion events before client handles any. | 204 | // Produce 3 motion events before client handles any. |
610 | 214 | producer.produce_a_pointer_event(0, 0, std::chrono::nanoseconds(0)); | 205 | producer.produce_a_pointer_event(0, 0, std::chrono::nanoseconds(0)); |
611 | @@ -235,7 +226,7 @@ | |||
612 | 235 | std::unique_ptr<MirEvent> ev; | 226 | std::unique_ptr<MirEvent> ev; |
613 | 236 | bool handler_called{false}; | 227 | bool handler_called{false}; |
614 | 237 | 228 | ||
616 | 238 | mircva::InputReceiver receiver{client_fd, | 229 | mircva::InputReceiver receiver{channel.client_fd(), |
617 | 239 | std::make_shared<mircv::XKBMapper>(), | 230 | std::make_shared<mircv::XKBMapper>(), |
618 | 240 | [&ev, &handler_called](MirEvent* event) | 231 | [&ev, &handler_called](MirEvent* event) |
619 | 241 | { | 232 | { |
620 | @@ -247,7 +238,7 @@ | |||
621 | 247 | { | 238 | { |
622 | 248 | return t; | 239 | return t; |
623 | 249 | }}; | 240 | }}; |
625 | 250 | TestingInputProducer producer(server_fd); | 241 | TestingInputProducer producer(channel.server_fd()); |
626 | 251 | 242 | ||
627 | 252 | nanoseconds const one_frame = duration_cast<nanoseconds>(1s) / 60; | 243 | nanoseconds const one_frame = duration_cast<nanoseconds>(1s) / 60; |
628 | 253 | 244 | ||
629 | @@ -293,9 +284,9 @@ | |||
630 | 293 | { | 284 | { |
631 | 294 | bool handler_called = false; | 285 | bool handler_called = false; |
632 | 295 | 286 | ||
634 | 296 | TestingInputProducer producer(server_fd); | 287 | TestingInputProducer producer(channel.server_fd()); |
635 | 297 | mircva::InputReceiver receiver{ | 288 | mircva::InputReceiver receiver{ |
637 | 298 | client_fd, | 289 | channel.client_fd(), |
638 | 299 | std::make_shared<mircv::XKBMapper>(), | 290 | std::make_shared<mircv::XKBMapper>(), |
639 | 300 | [&handler_called, &producer](MirEvent*) | 291 | [&handler_called, &producer](MirEvent*) |
640 | 301 | { | 292 | { |
641 | @@ -322,7 +313,7 @@ | |||
642 | 322 | 313 | ||
643 | 323 | int frames_triggered = 0; | 314 | int frames_triggered = 0; |
644 | 324 | 315 | ||
646 | 325 | mircva::InputReceiver receiver{client_fd, | 316 | mircva::InputReceiver receiver{channel.client_fd(), |
647 | 326 | std::make_shared<mircv::XKBMapper>(), | 317 | std::make_shared<mircv::XKBMapper>(), |
648 | 327 | [&frames_triggered](MirEvent*) | 318 | [&frames_triggered](MirEvent*) |
649 | 328 | { | 319 | { |
650 | @@ -333,7 +324,7 @@ | |||
651 | 333 | { | 324 | { |
652 | 334 | return t; | 325 | return t; |
653 | 335 | }}; | 326 | }}; |
655 | 336 | TestingInputProducer producer(server_fd); | 327 | TestingInputProducer producer(channel.server_fd()); |
656 | 337 | 328 | ||
657 | 338 | std::chrono::nanoseconds const device_sample_interval = duration_cast<nanoseconds>(1s) / 250; | 329 | std::chrono::nanoseconds const device_sample_interval = duration_cast<nanoseconds>(1s) / 250; |
658 | 339 | std::chrono::nanoseconds const frame_interval = duration_cast<nanoseconds>(1s) / 60; | 330 | std::chrono::nanoseconds const frame_interval = duration_cast<nanoseconds>(1s) / 60; |
659 | @@ -375,12 +366,12 @@ | |||
660 | 375 | std::chrono::nanoseconds t; | 366 | std::chrono::nanoseconds t; |
661 | 376 | 367 | ||
662 | 377 | mircva::InputReceiver receiver{ | 368 | mircva::InputReceiver receiver{ |
664 | 378 | client_fd, | 369 | channel.client_fd(), |
665 | 379 | std::make_shared<mircv::XKBMapper>(), | 370 | std::make_shared<mircv::XKBMapper>(), |
666 | 380 | event_handler, | 371 | event_handler, |
667 | 381 | std::make_shared<mircv::NullInputReceiverReport>(), | 372 | std::make_shared<mircv::NullInputReceiverReport>(), |
668 | 382 | }; | 373 | }; |
670 | 383 | TestingInputProducer producer(server_fd); | 374 | TestingInputProducer producer(channel.server_fd()); |
671 | 384 | 375 | ||
672 | 385 | std::chrono::nanoseconds const one_millisecond = std::chrono::nanoseconds(1000000ULL); | 376 | std::chrono::nanoseconds const one_millisecond = std::chrono::nanoseconds(1000000ULL); |
673 | 386 | std::chrono::nanoseconds const one_second = 1000 * one_millisecond; | 377 | std::chrono::nanoseconds const one_second = 1000 * one_millisecond; |
674 | 387 | 378 | ||
675 | === modified file 'tests/unit-tests/input/CMakeLists.txt' | |||
676 | --- tests/unit-tests/input/CMakeLists.txt 2016-03-23 06:39:56 +0000 | |||
677 | +++ tests/unit-tests/input/CMakeLists.txt 2016-04-05 19:30:54 +0000 | |||
678 | @@ -7,6 +7,7 @@ | |||
679 | 7 | ${CMAKE_CURRENT_SOURCE_DIR}/test_cursor_controller.cpp | 7 | ${CMAKE_CURRENT_SOURCE_DIR}/test_cursor_controller.cpp |
680 | 8 | ${CMAKE_CURRENT_SOURCE_DIR}/test_xcursor_loader.cpp | 8 | ${CMAKE_CURRENT_SOURCE_DIR}/test_xcursor_loader.cpp |
681 | 9 | ${CMAKE_CURRENT_SOURCE_DIR}/test_touchspot_controller.cpp | 9 | ${CMAKE_CURRENT_SOURCE_DIR}/test_touchspot_controller.cpp |
682 | 10 | ${CMAKE_CURRENT_SOURCE_DIR}/test_input_channel_factory.cpp | ||
683 | 10 | ${CMAKE_CURRENT_SOURCE_DIR}/test_input_event.cpp | 11 | ${CMAKE_CURRENT_SOURCE_DIR}/test_input_event.cpp |
684 | 11 | ${CMAKE_CURRENT_SOURCE_DIR}/test_event_builders.cpp | 12 | ${CMAKE_CURRENT_SOURCE_DIR}/test_event_builders.cpp |
685 | 12 | ${CMAKE_CURRENT_SOURCE_DIR}/test_default_device.cpp | 13 | ${CMAKE_CURRENT_SOURCE_DIR}/test_default_device.cpp |
686 | 13 | 14 | ||
687 | === modified file 'tests/unit-tests/input/android/CMakeLists.txt' | |||
688 | --- tests/unit-tests/input/android/CMakeLists.txt 2016-03-23 06:39:56 +0000 | |||
689 | +++ tests/unit-tests/input/android/CMakeLists.txt 2016-04-05 19:30:54 +0000 | |||
690 | @@ -1,6 +1,5 @@ | |||
691 | 1 | list(APPEND UNIT_TEST_SOURCES | 1 | list(APPEND UNIT_TEST_SOURCES |
692 | 2 | ${CMAKE_CURRENT_SOURCE_DIR}/test_android_input_lexicon.cpp | 2 | ${CMAKE_CURRENT_SOURCE_DIR}/test_android_input_lexicon.cpp |
693 | 3 | ${CMAKE_CURRENT_SOURCE_DIR}/test_android_input_channel_factory.cpp | ||
694 | 4 | ${CMAKE_CURRENT_SOURCE_DIR}/test_android_communication_package.cpp | 3 | ${CMAKE_CURRENT_SOURCE_DIR}/test_android_communication_package.cpp |
695 | 5 | ${CMAKE_CURRENT_SOURCE_DIR}/test_android_input_sender.cpp | 4 | ${CMAKE_CURRENT_SOURCE_DIR}/test_android_input_sender.cpp |
696 | 6 | ${CMAKE_CURRENT_SOURCE_DIR}/test_input_consumer.cpp | 5 | ${CMAKE_CURRENT_SOURCE_DIR}/test_input_consumer.cpp |
697 | 7 | 6 | ||
698 | === modified file 'tests/unit-tests/input/android/test_android_communication_package.cpp' | |||
699 | --- tests/unit-tests/input/android/test_android_communication_package.cpp 2014-03-06 06:05:17 +0000 | |||
700 | +++ tests/unit-tests/input/android/test_android_communication_package.cpp 2016-04-05 19:30:54 +0000 | |||
701 | @@ -16,7 +16,7 @@ | |||
702 | 16 | * Authored by: Robert Carr <robert.carr@canonical.com> | 16 | * Authored by: Robert Carr <robert.carr@canonical.com> |
703 | 17 | */ | 17 | */ |
704 | 18 | 18 | ||
706 | 19 | #include "src/server/input/android/android_input_channel.h" | 19 | #include "src/server/input/channel.h" |
707 | 20 | 20 | ||
708 | 21 | #include <gtest/gtest.h> | 21 | #include <gtest/gtest.h> |
709 | 22 | #include <gmock/gmock.h> | 22 | #include <gmock/gmock.h> |
710 | @@ -24,14 +24,13 @@ | |||
711 | 24 | #include <unistd.h> | 24 | #include <unistd.h> |
712 | 25 | #include <fcntl.h> | 25 | #include <fcntl.h> |
713 | 26 | 26 | ||
716 | 27 | namespace droidinput = android; | 27 | namespace mi = mir::input; |
715 | 28 | namespace mia = mir::input::android; | ||
717 | 29 | 28 | ||
719 | 30 | TEST(AndroidInputChannel, packages_own_valid_fds) | 29 | TEST(InputChannel, packages_own_valid_fds) |
720 | 31 | { | 30 | { |
721 | 32 | int server_fd, client_fd; | 31 | int server_fd, client_fd; |
722 | 33 | { | 32 | { |
724 | 34 | mia::AndroidInputChannel package; | 33 | mi::Channel package; |
725 | 35 | 34 | ||
726 | 36 | server_fd = package.server_fd(); | 35 | server_fd = package.server_fd(); |
727 | 37 | client_fd = package.client_fd(); | 36 | client_fd = package.client_fd(); |
728 | 38 | 37 | ||
729 | === modified file 'tests/unit-tests/input/android/test_android_input_sender.cpp' | |||
730 | --- tests/unit-tests/input/android/test_android_input_sender.cpp 2016-03-23 06:39:56 +0000 | |||
731 | +++ tests/unit-tests/input/android/test_android_input_sender.cpp 2016-04-05 19:30:54 +0000 | |||
732 | @@ -18,7 +18,7 @@ | |||
733 | 18 | 18 | ||
734 | 19 | #include "mir/events/event_private.h" | 19 | #include "mir/events/event_private.h" |
735 | 20 | 20 | ||
737 | 21 | #include "src/server/input/android/android_input_channel.h" | 21 | #include "src/server/input/channel.h" |
738 | 22 | #include "src/server/input/android/input_sender.h" | 22 | #include "src/server/input/android/input_sender.h" |
739 | 23 | #include "src/server/input/default_event_builder.h" | 23 | #include "src/server/input/default_event_builder.h" |
740 | 24 | #include "src/server/report/null_report_factory.h" | 24 | #include "src/server/report/null_report_factory.h" |
741 | @@ -44,7 +44,6 @@ | |||
742 | 44 | 44 | ||
743 | 45 | #include <boost/exception/all.hpp> | 45 | #include <boost/exception/all.hpp> |
744 | 46 | 46 | ||
745 | 47 | //#include <algorithm> | ||
746 | 48 | #include <cstring> | 47 | #include <cstring> |
747 | 49 | 48 | ||
748 | 50 | namespace mi = mir::input; | 49 | namespace mi = mir::input; |
749 | @@ -140,7 +139,7 @@ | |||
750 | 140 | fake_scene.observer->surface_removed(&stub_surface); | 139 | fake_scene.observer->surface_removed(&stub_surface); |
751 | 141 | } | 140 | } |
752 | 142 | 141 | ||
754 | 143 | std::shared_ptr<mi::InputChannel> channel = std::make_shared<mia::AndroidInputChannel>(); | 142 | std::shared_ptr<mi::InputChannel> channel = std::make_shared<mi::Channel>(); |
755 | 144 | mtd::StubSceneSurface stub_surface{channel->server_fd()}; | 143 | mtd::StubSceneSurface stub_surface{channel->server_fd()}; |
756 | 145 | droidinput::sp<droidinput::InputChannel> client_channel{new droidinput::InputChannel(droidinput::String8("test"), channel->client_fd())}; | 144 | droidinput::sp<droidinput::InputChannel> client_channel{new droidinput::InputChannel(droidinput::String8("test"), channel->client_fd())}; |
757 | 146 | droidinput::InputConsumer consumer{client_channel}; | 145 | droidinput::InputConsumer consumer{client_channel}; |
758 | 147 | 146 | ||
759 | === modified file 'tests/unit-tests/input/android/test_input_consumer.cpp' | |||
760 | --- tests/unit-tests/input/android/test_input_consumer.cpp 2016-03-23 06:39:56 +0000 | |||
761 | +++ tests/unit-tests/input/android/test_input_consumer.cpp 2016-04-05 19:30:54 +0000 | |||
762 | @@ -18,7 +18,7 @@ | |||
763 | 18 | 18 | ||
764 | 19 | #include "androidfw/Input.h" | 19 | #include "androidfw/Input.h" |
765 | 20 | #include "androidfw/InputTransport.h" | 20 | #include "androidfw/InputTransport.h" |
767 | 21 | #include "src/server/input/android/android_input_channel.h" | 21 | #include "src/server/input/channel.h" |
768 | 22 | #include "mir/input/android/event_conversion_helpers.h" | 22 | #include "mir/input/android/event_conversion_helpers.h" |
769 | 23 | #include "mir/input/android/android_input_lexicon.h" | 23 | #include "mir/input/android/android_input_lexicon.h" |
770 | 24 | #include "mir/geometry/displacement.h" | 24 | #include "mir/geometry/displacement.h" |
771 | @@ -32,6 +32,7 @@ | |||
772 | 32 | 32 | ||
773 | 33 | using namespace std::literals::chrono_literals; | 33 | using namespace std::literals::chrono_literals; |
774 | 34 | namespace mia = mir::input::android; | 34 | namespace mia = mir::input::android; |
775 | 35 | namespace mi = mir::input; | ||
776 | 35 | namespace geom = mir::geometry; | 36 | namespace geom = mir::geometry; |
777 | 36 | 37 | ||
778 | 37 | namespace | 38 | namespace |
779 | @@ -58,7 +59,7 @@ | |||
780 | 58 | mir::cookie::Blob default_cookie; | 59 | mir::cookie::Blob default_cookie; |
781 | 59 | EventFactory events; | 60 | EventFactory events; |
782 | 60 | std::chrono::milliseconds current_frame_time = 0ms; | 61 | std::chrono::milliseconds current_frame_time = 0ms; |
784 | 61 | mia::AndroidInputChannel channel; | 62 | mi::Channel channel; |
785 | 62 | geom::Displacement no_move{0,0}; | 63 | geom::Displacement no_move{0,0}; |
786 | 63 | geom::Displacement no_scroll{0,0}; | 64 | geom::Displacement no_scroll{0,0}; |
787 | 64 | geom::Point origin{0,0}; | 65 | geom::Point origin{0,0}; |
788 | 65 | 66 | ||
789 | === renamed file 'tests/unit-tests/input/android/test_android_input_channel_factory.cpp' => 'tests/unit-tests/input/test_input_channel_factory.cpp' | |||
790 | --- tests/unit-tests/input/android/test_android_input_channel_factory.cpp 2015-06-17 05:20:42 +0000 | |||
791 | +++ tests/unit-tests/input/test_input_channel_factory.cpp 2016-04-05 19:30:54 +0000 | |||
792 | @@ -16,20 +16,20 @@ | |||
793 | 16 | * Authored by: Robert Carr <robert.carr@canonical.com> | 16 | * Authored by: Robert Carr <robert.carr@canonical.com> |
794 | 17 | */ | 17 | */ |
795 | 18 | 18 | ||
798 | 19 | #include "src/server/input/android/android_input_channel.h" | 19 | #include "src/server/input/channel.h" |
799 | 20 | #include "src/server/input/android/input_channel_factory.h" | 20 | #include "src/server/input/channel_factory.h" |
800 | 21 | 21 | ||
801 | 22 | #include <gtest/gtest.h> | 22 | #include <gtest/gtest.h> |
802 | 23 | #include <gmock/gmock.h> | 23 | #include <gmock/gmock.h> |
803 | 24 | 24 | ||
804 | 25 | #include <initializer_list> | 25 | #include <initializer_list> |
805 | 26 | 26 | ||
807 | 27 | namespace mia = mir::input::android; | 27 | namespace mi = mir::input; |
808 | 28 | 28 | ||
810 | 29 | TEST(AndroidInputChannelFactory, channel_factory_returns_input_channel_with_fds) | 29 | TEST(InputChannelFactory, channel_factory_returns_input_channel_with_fds) |
811 | 30 | { | 30 | { |
813 | 31 | mia::InputChannelFactory factory; | 31 | mi::ChannelFactory factory; |
814 | 32 | 32 | ||
815 | 33 | auto package = factory.make_input_channel(); | 33 | auto package = factory.make_input_channel(); |
817 | 34 | EXPECT_NE(nullptr, std::dynamic_pointer_cast<mia::AndroidInputChannel>(package)); | 34 | EXPECT_NE(nullptr, std::dynamic_pointer_cast<mi::Channel>(package)); |
818 | 35 | } | 35 | } |
FAILED: Continuous integration, rev:3439 /mir-jenkins. ubuntu. com/job/ mir-ci/ 747/ /mir-jenkins. ubuntu. com/job/ build-mir/ 723/console /mir-jenkins. ubuntu. com/job/ build-0- fetch/760 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= vivid+overlay/ 751 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= xenial/ 751 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= clang,platform= mesa,release= vivid+overlay/ 732/console /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= xenial/ 732 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= xenial/ 732/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= cross-armhf, compiler= gcc,platform= android, release= vivid+overlay/ 732/console /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= android, release= vivid+overlay/ 732/console /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= mesa,release= xenial/ 732 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= mesa,release= xenial/ 732/artifact/ output/ *zip*/output. zip
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild: /mir-jenkins. ubuntu. com/job/ mir-ci/ 747/rebuild
https:/