Merge lp:~vorlon/platform-api/strict-install-rules into lp:platform-api

Proposed by Steve Langasek
Status: Needs review
Proposed branch: lp:~vorlon/platform-api/strict-install-rules
Merge into: lp:platform-api
Diff against target: 14024 lines (+65/-13061)
98 files modified
CMakeLists.txt (+2/-2)
android/default/default_ubuntu_application.cpp (+0/-409)
android/default/default_ubuntu_application_ui.cpp (+0/-465)
android/default/default_ubuntu_ui.cpp (+0/-273)
android/hybris/Android.mk (+2/-184)
android/hybris/application_manager.cpp (+0/-900)
android/hybris/application_manager.h (+0/-412)
android/hybris/default_application_manager.cpp (+0/-1257)
android/hybris/default_application_manager.h (+0/-255)
android/hybris/default_application_manager_input_setup.h (+0/-452)
android/hybris/default_application_manager_test.cpp (+0/-146)
android/hybris/default_application_session.h (+0/-250)
android/hybris/default_shell.h (+0/-46)
android/hybris/lifecycle_helpers.h (+0/-63)
android/hybris/shell.h (+0/-49)
android/hybris/test.cpp (+0/-361)
android/hybris/test_c_api.cpp (+0/-329)
android/hybris/test_osk_visibility.cpp (+0/-38)
android/hybris/test_session_c_api.cpp (+0/-229)
android/hybris/test_trap.cpp (+0/-45)
android/hybris/ubuntu_application_api_for_hybris.cpp (+0/-1132)
android/include/private/application/ui/clipboard.h (+0/-91)
android/include/private/application/ui/form_factor_hint.h (+0/-44)
android/include/private/application/ui/init.h (+0/-35)
android/include/private/application/ui/input/listener.h (+0/-53)
android/include/private/application/ui/physical_display_info.h (+0/-77)
android/include/private/application/ui/session.h (+0/-90)
android/include/private/application/ui/session_credentials.h (+0/-90)
android/include/private/application/ui/session_delegates.h (+0/-45)
android/include/private/application/ui/setup.h (+0/-59)
android/include/private/application/ui/stage_hint.h (+0/-42)
android/include/private/application/ui/surface.h (+0/-76)
android/include/private/application/ui/surface_factory.h (+0/-53)
android/include/private/application/ui/surface_properties.h (+0/-63)
android/include/private/application/ui/surface_role.h (+0/-49)
android/include/private/application/ui/ubuntu_application_ui.h (+0/-375)
android/include/private/application/ui/window_internal.h (+0/-130)
android/include/private/ui/session_enumerator.h (+0/-127)
android/include/private/ui/session_service.h (+0/-82)
android/include/private/ui/session_snapshot.h (+0/-50)
android/include/private/ui/well_known_applications.h (+0/-42)
android/mock/CMakeLists.txt (+0/-13)
android/mock/mock.cpp (+0/-212)
debian/changelog (+6/-0)
debian/control (+30/-30)
debian/libubuntu-application-api-headers.install (+0/-1)
debian/libubuntu-application-api3.install (+1/-1)
debian/libubuntu-application-api3.symbols (+1/-34)
debian/libubuntu-platform-hardware-api3.install (+1/-1)
debian/libubuntu-platform-hardware-api3.symbols (+1/-1)
debian/ubuntu-application-api3-examples.install (+0/-2)
doc/mainpage.md (+1/-6)
examples/CMakeLists.txt (+0/-8)
examples/test_c_api.cpp (+0/-329)
examples/test_multiple_surfaces_event_delivery.cpp (+0/-351)
examples/test_session_c_api.cpp (+0/-229)
include/ubuntu/CMakeLists.txt (+1/-2)
include/ubuntu/application/CMakeLists.txt (+0/-1)
include/ubuntu/application/ui/CMakeLists.txt (+0/-27)
include/ubuntu/application/ui/clipboard.h (+0/-64)
include/ubuntu/application/ui/config.h.in (+0/-27)
include/ubuntu/application/ui/display.h (+0/-57)
include/ubuntu/application/ui/form_factor.h (+0/-35)
include/ubuntu/application/ui/input/CMakeLists.txt (+0/-5)
include/ubuntu/application/ui/input/event.h (+0/-226)
include/ubuntu/application/ui/input/event_deprecated.h (+0/-88)
include/ubuntu/application/ui/options.h (+0/-52)
include/ubuntu/application/ui/session.h (+0/-70)
include/ubuntu/application/ui/stage.h (+0/-38)
include/ubuntu/application/ui/window.h (+0/-125)
include/ubuntu/application/ui/window_orientation.h (+0/-32)
include/ubuntu/application/ui/window_parent.h (+0/-81)
include/ubuntu/application/ui/window_properties.h (+0/-114)
include/ubuntu/application/ui/window_state.h (+0/-37)
include/ubuntu/application/ui/window_type.h (+0/-39)
include/ubuntu/ui/CMakeLists.txt (+0/-4)
include/ubuntu/ui/ubuntu_ui_session_service.h (+0/-139)
src/ubuntu/application/base_module.h (+2/-2)
src/ubuntu/application/common/mirclient/CMakeLists.txt (+0/-2)
src/ubuntu/application/common/mirclient/application_instance_mirclient_priv.h (+0/-16)
src/ubuntu/application/common/mirclient/ubuntu_application_api_mirclient.cpp (+1/-214)
src/ubuntu/application/common/mirclient/window_mirclient.cpp (+0/-233)
src/ubuntu/application/common/mirclient/window_mirclient_priv.h (+0/-107)
src/ubuntu/application/common/mirclient/window_properties_mirclient.cpp (+0/-101)
src/ubuntu/application/common/mirclient/window_properties_mirclient_priv.h (+0/-88)
src/ubuntu/application/common/mircommon/CMakeLists.txt (+0/-2)
src/ubuntu/application/common/mircommon/application_options_mir.cpp (+1/-63)
src/ubuntu/application/common/mircommon/application_options_mir_priv.h (+0/-3)
src/ubuntu/application/common/mircommon/event_helpers_mir.cpp (+0/-174)
src/ubuntu/application/common/mircommon/event_helpers_mir.h (+0/-44)
src/ubuntu/application/common/mircommon/session_mir.cpp (+0/-51)
src/ubuntu/application/common/mirserver/ubuntu_application_api_mirserver.cpp (+0/-155)
src/ubuntu/application/desktop/module_version.h (+2/-2)
src/ubuntu/application/testbackend/module_version.h (+2/-2)
src/ubuntu/application/testbackend/test_stubs.cpp (+5/-162)
src/ubuntu/application/touch/hybris/ubuntu_application_api_hybris.cpp (+0/-136)
src/ubuntu/application/touch/module_version.h (+2/-2)
src/ubuntu/application/ubuntu_application_api.cpp (+4/-51)
To merge this branch: bzr merge lp:~vorlon/platform-api/strict-install-rules
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Ubuntu Phablet Team Pending
Review via email: mp+263551@code.launchpad.net

Commit message

Fix shared library install rules to only match files that have the correct soname

Description of the change

.install files for shared libraries should embed the soname, to avoid any
accidents with mismatches.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Unmerged revisions

316. By Steve Langasek

Fix shared library install rules to only match files that have the correct soname

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2015-03-18 10:03:52 +0000
3+++ CMakeLists.txt 2015-07-01 17:16:40 +0000
4@@ -2,8 +2,8 @@
5
6 project(ubuntu-platform-api)
7
8-set(UBUNTU_PLATFORM_API_VERSION_MAJOR 2)
9-set(UBUNTU_PLATFORM_API_VERSION_MINOR 9)
10+set(UBUNTU_PLATFORM_API_VERSION_MAJOR 3)
11+set(UBUNTU_PLATFORM_API_VERSION_MINOR 0)
12 set(UBUNTU_PLATFORM_API_VERSION_PATCH 0)
13
14 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
15
16=== removed file 'android/default/default_ubuntu_application.cpp'
17--- android/default/default_ubuntu_application.cpp 2013-05-30 01:08:53 +0000
18+++ android/default/default_ubuntu_application.cpp 1970-01-01 00:00:00 +0000
19@@ -1,409 +0,0 @@
20-/*
21- * Copyright © 2013 Canonical Ltd.
22- *
23- * This program is free software: you can redistribute it and/or modify
24- * it under the terms of the GNU Lesser General Public License version 3 as
25- * published by the Free Software Foundation.
26- *
27- * This program is distributed in the hope that it will be useful,
28- * but WITHOUT ANY WARRANTY; without even the implied warranty of
29- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30- * GNU Lesser General Public License for more details.
31- *
32- * You should have received a copy of the GNU Lesser General Public License
33- * along with this program. If not, see <http://www.gnu.org/licenses/>.
34- *
35- * Authored by: Thomas Voß <thomas.voss@canonical.com>
36- * Ricardo Mendoza <ricardo.mendoza@canonical.com>
37- */
38-
39-// Private
40-#include <private/application/ui/init.h>
41-#include <private/application/ui/setup.h>
42-#include <private/application/ui/ubuntu_application_ui.h>
43-
44-// Public C apis
45-#include <ubuntu/application/id.h>
46-#include <ubuntu/application/instance.h>
47-#include <ubuntu/application/lifecycle_delegate.h>
48-#include <ubuntu/application/ui/options.h>
49-
50-// ver2.0 Private
51-
52-#include <private/ui/session_service.h>
53-#include <private/application/application.h>
54-
55-#include <utils/Log.h>
56-
57-// C APIs
58-namespace
59-{
60-struct IUApplicationLifecycleDelegate : public ubuntu::application::LifecycleDelegate
61-{
62- IUApplicationLifecycleDelegate(void *context) :
63- application_resumed_cb(NULL),
64- application_about_to_stop_cb(NULL),
65- context(context),
66- refcount(1)
67- {
68- }
69-
70- void on_application_resumed()
71- {
72- ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__);
73-
74- if (!application_resumed_cb)
75- return;
76-
77- application_resumed_cb(NULL, this->context);
78- }
79-
80- void on_application_about_to_stop()
81- {
82- ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__);
83-
84- if (!application_about_to_stop_cb)
85- return;
86-
87- application_about_to_stop_cb(NULL, this->context);
88- }
89-
90- u_on_application_resumed application_resumed_cb;
91- u_on_application_about_to_stop application_about_to_stop_cb;
92- void *context;
93-
94- unsigned refcount;
95-};
96-
97-template<typename T>
98-struct Holder
99-{
100- Holder(const T&value = T()) : value(value)
101- {
102- }
103-
104- T value;
105-};
106-
107-template<typename T>
108-Holder<T>* make_holder(const T& value)
109-{
110- return new Holder<T>(value);
111-}
112-}
113-
114-/*
115- * Application Lifecycle
116- */
117-
118-UApplicationLifecycleDelegate*
119-u_application_lifecycle_delegate_new()
120-{
121- ALOGI("%s()", __PRETTY_FUNCTION__);
122-
123- ubuntu::application::LifecycleDelegate::Ptr p(new IUApplicationLifecycleDelegate(NULL));
124-
125- return make_holder(p);
126-}
127-
128-void
129-u_application_lifecycle_delegate_destroy(UApplicationLifecycleDelegate *delegate)
130-{
131- ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__);
132-
133- auto s = static_cast<Holder<IUApplicationLifecycleDelegate*>*>(delegate);
134-
135- if (s->value->refcount)
136- return;
137-
138- delete s;
139-}
140-
141-void
142-u_application_lifecycle_delegate_ref(UApplicationLifecycleDelegate *delegate)
143-{
144- ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__);
145-
146- auto s = static_cast<Holder<IUApplicationLifecycleDelegate*>*>(delegate);
147- s->value->refcount++;
148-}
149-
150-void
151-u_application_lifecycle_delegate_unref(UApplicationLifecycleDelegate *delegate)
152-{
153- ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__);
154-
155- auto s = static_cast<Holder<IUApplicationLifecycleDelegate*>*>(delegate);
156- if (s->value->refcount)
157- s->value->refcount--;
158-}
159-
160-void
161-u_application_lifecycle_delegate_set_application_resumed_cb(
162- UApplicationLifecycleDelegate *delegate,
163- u_on_application_resumed cb)
164-{
165- ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__);
166-
167- auto s = static_cast<Holder<IUApplicationLifecycleDelegate*>*>(delegate);
168- s->value->application_resumed_cb = cb;
169-}
170-
171-u_on_application_resumed
172-u_application_lifecycle_delegate_get_application_resumed_cb(
173- UApplicationLifecycleDelegate *delegate)
174-{
175- ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__);
176-
177- auto s = static_cast<Holder<IUApplicationLifecycleDelegate*>*>(delegate);
178- return s->value->application_resumed_cb;
179-}
180-
181-void
182-u_application_lifecycle_delegate_set_application_about_to_stop_cb(
183- UApplicationLifecycleDelegate *delegate,
184- u_on_application_about_to_stop cb)
185-{
186- ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__);
187-
188- auto s = static_cast<Holder<IUApplicationLifecycleDelegate*>*>(delegate);
189- s->value->application_about_to_stop_cb = cb;
190-}
191-
192-u_on_application_about_to_stop
193-u_application_lifecycle_delegate_get_application_about_to_stop_cb(
194- UApplicationLifecycleDelegate *delegate)
195-{
196- ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__);
197-
198- auto s = static_cast<Holder<IUApplicationLifecycleDelegate*>*>(delegate);
199- return s->value->application_about_to_stop_cb;
200-}
201-
202-void
203-u_application_lifecycle_delegate_set_context(
204- UApplicationLifecycleDelegate *delegate,
205- void *context)
206-{
207- ALOGI("%s():%d context=%p", __PRETTY_FUNCTION__, __LINE__, context);
208-
209- auto s = static_cast<Holder<IUApplicationLifecycleDelegate*>*>(delegate);
210- if (s->value->context == NULL)
211- s->value->context = context;
212-}
213-
214-void*
215-u_application_lifecycle_delegate_get_context(
216- UApplicationLifecycleDelegate *delegate,
217- void *context)
218-{
219- ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__);
220-
221- auto s = static_cast<Holder<IUApplicationLifecycleDelegate*>*>(delegate);
222- return s->value->context;
223-}
224-
225-/*
226- * Application Options
227- */
228-
229-UApplicationOptions*
230-u_application_options_new_from_cmd_line(
231- int argc,
232- char** argv)
233-{
234- ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__);
235-
236- ubuntu::application::ui::init(argc, argv);
237-
238- return ubuntu::application::ui::Setup::instance().get();
239-}
240-
241-UAUiFormFactor
242-u_application_options_get_form_factor(
243- UApplicationOptions *options)
244-{
245- ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__);
246-
247- auto setup = static_cast<ubuntu::application::ui::Setup*>(options);
248- return static_cast<UAUiFormFactor>(setup->form_factor_hint());
249-}
250-
251-UAUiStage
252-u_application_options_get_stage(
253- UApplicationOptions *options)
254-{
255- ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__);
256-
257- auto setup = static_cast<ubuntu::application::ui::Setup*>(options);
258- return static_cast<UAUiStage>(setup->stage_hint());
259-}
260-
261-/*
262- * Application Id
263- */
264-
265-UApplicationId*
266-u_application_id_new_from_stringn(
267- const char *string,
268- size_t size)
269-{
270- ubuntu::application::Id::Ptr id(
271- new ubuntu::application::Id(string, size)
272- );
273-
274- return make_holder(id);
275-}
276-
277-void
278-u_application_id_destroy(UApplicationId *id)
279-{
280-
281- auto p = static_cast<Holder<ubuntu::application::Id::Ptr>*>(id);
282-
283- if (p)
284- delete p;
285-}
286-
287-int
288-u_application_id_compare(
289- UApplicationId *lhs,
290- UApplicationId *rhs)
291-{
292- auto ilhs = static_cast<Holder<ubuntu::application::Id::Ptr>*>(lhs);
293- auto irhs = static_cast<Holder<ubuntu::application::Id::Ptr>*>(rhs);
294-
295- if (ilhs->value->size != irhs->value->size)
296- return 1;
297-
298- for (size_t i = 0; i < ilhs->value->size; i++)
299- {
300- if ((char) ilhs->value->string[i] == (char) irhs->value->string[i])
301- continue;
302-
303- return 1;
304- }
305-
306- return 0;
307-}
308-
309-/*
310- * Description
311- */
312-
313-UApplicationDescription*
314-u_application_description_new()
315-{
316- ubuntu::application::Description::Ptr desc(
317- new ubuntu::application::Description()
318- );
319-
320- return make_holder(desc);
321-}
322-
323-void
324-u_application_description_destroy(
325- UApplicationDescription *desc)
326-{
327- auto p = static_cast<Holder<ubuntu::application::Description::Ptr>*>(desc);
328-
329- if (p)
330- delete p;
331-}
332-
333-void
334-u_application_description_set_application_id(
335- UApplicationDescription *desc,
336- UApplicationId *id)
337-{
338- if (id == NULL)
339- return;
340-
341- auto p = static_cast<Holder<ubuntu::application::Description::Ptr>*>(desc);
342- p->value->set_application_id(id);
343-}
344-
345-UApplicationId*
346-u_application_description_get_application_id(
347- UApplicationDescription *desc)
348-{
349- auto p = static_cast<Holder<ubuntu::application::Description::Ptr>*>(desc);
350- return p->value->get_application_id();
351-}
352-
353-void
354-u_application_description_set_application_lifecycle_delegate(
355- UApplicationDescription *desc,
356- UApplicationLifecycleDelegate *delegate)
357-{
358- if (delegate == NULL)
359- return;
360-
361- ALOGI("%s():%d -- delegate=%p", __PRETTY_FUNCTION__, __LINE__, delegate);
362-
363- auto p = static_cast<Holder<ubuntu::application::Description::Ptr>*>(desc);
364- p->value->set_lifecycle_delegate(delegate);
365-}
366-
367-UApplicationLifecycleDelegate*
368-u_application_description_get_application_lifecycle_delegate(
369- UApplicationDescription *desc)
370-{
371- auto p = static_cast<Holder<ubuntu::application::Description::Ptr>*>(desc);
372- return p->value->get_lifecycle_delegate();
373-}
374-
375-/*
376- * Instance
377- */
378-
379-UApplicationInstance*
380-u_application_instance_new_from_description_with_options(
381- UApplicationDescription *desc,
382- UApplicationOptions *options)
383-{
384- if (desc == NULL || options == NULL)
385- return NULL;
386-
387- ubuntu::application::Instance::Ptr instance(
388- new ubuntu::application::Instance(desc, options)
389- );
390-
391- return make_holder(instance);
392-}
393-
394-void
395-u_application_instance_ref(
396- UApplicationInstance *instance)
397-{
398- auto p = static_cast<Holder<ubuntu::application::Instance::Ptr>*>(instance);
399- p->value->ref();
400-}
401-
402-void
403-u_application_instance_unref(
404- UApplicationInstance *instance)
405-{
406- auto p = static_cast<Holder<ubuntu::application::Instance::Ptr>*>(instance);
407- p->value->unref();
408-}
409-
410-void
411-u_application_instance_destroy(
412- UApplicationInstance *instance)
413-{
414- auto p = static_cast<Holder<ubuntu::application::Instance::Ptr>*>(instance);
415-
416- if (p->value->get_refcount() == 0)
417- delete p;
418-}
419-
420-void
421-u_application_instance_run(
422- UApplicationInstance *instance)
423-{
424- auto p = static_cast<Holder<ubuntu::application::Instance::Ptr>*>(instance);
425-
426- if (p)
427- p->value->run();
428-}
429
430=== removed file 'android/default/default_ubuntu_application_ui.cpp'
431--- android/default/default_ubuntu_application_ui.cpp 2014-09-29 19:56:49 +0000
432+++ android/default/default_ubuntu_application_ui.cpp 1970-01-01 00:00:00 +0000
433@@ -1,465 +0,0 @@
434-/*
435- * Copyright © 2013 Canonical Ltd.
436- *
437- * This program is free software: you can redistribute it and/or modify
438- * it under the terms of the GNU Lesser General Public License version 3 as
439- * published by the Free Software Foundation.
440- *
441- * This program is distributed in the hope that it will be useful,
442- * but WITHOUT ANY WARRANTY; without even the implied warranty of
443- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
444- * GNU Lesser General Public License for more details.
445- *
446- * You should have received a copy of the GNU Lesser General Public License
447- * along with this program. If not, see <http://www.gnu.org/licenses/>.
448- *
449- * Authored by: Thomas Voß <thomas.voss@canonical.com>
450- * Ricardo Mendoza <ricardo.mendoza@canonical.com>
451- */
452-
453-// Private
454-#include <private/application/ui/init.h>
455-#include <private/application/ui/session.h>
456-#include <private/application/ui/session_credentials.h>
457-#include <private/application/ui/setup.h>
458-#include <private/application/ui/surface.h>
459-#include <private/application/ui/surface_factory.h>
460-#include <private/application/ui/surface_properties.h>
461-
462-// Public C apis
463-#include <private/application/ui/ubuntu_application_ui.h>
464-#include <ubuntu/application/instance.h>
465-#include <ubuntu/application/lifecycle_delegate.h>
466-#include <ubuntu/application/ui/options.h>
467-#include <ubuntu/application/ui/session.h>
468-#include <ubuntu/application/ui/window.h>
469-#include <ubuntu/application/ui/clipboard.h>
470-#include <ubuntu/application/ui/display.h>
471-
472-// ver2.0 Private
473-#include <private/application/ui/window_internal.h>
474-
475-#include <private/ui/session_service.h>
476-#include <private/application/ui/ubuntu_application_ui.h>
477-#include <private/application/application.h>
478-
479-#include <utils/Log.h>
480-
481-namespace
482-{
483-ubuntu::application::ui::Session::Ptr session;
484-
485-struct CallbackEventListener : public ubuntu::application::ui::input::Listener
486-{
487- CallbackEventListener(input_event_cb cb, void* context) : cb(cb),
488- context(context)
489- {
490- }
491-
492- void on_new_event(const ::Event& e)
493- {
494- if (cb)
495- cb(context, &e);
496- }
497-
498- input_event_cb cb;
499- void* context;
500-};
501-
502-template<typename T>
503-struct Holder
504-{
505- Holder(const T&value = T()) : value(value)
506- {
507- }
508-
509- T value;
510-};
511-
512-template<typename T>
513-Holder<T>* make_holder(const T& value)
514-{
515- return new Holder<T>(value);
516-}
517-}
518-
519-/*
520- * Clipboard
521- */
522-
523-void
524-ua_ui_set_clipboard_content(void* data,
525- size_t size)
526-{
527- static const char mime_type[ubuntu::application::ui::Clipboard::Content::MAX_MIME_TYPE_SIZE] = "none/none";
528-
529- ubuntu::application::ui::Clipboard::Content content(mime_type, data, size);
530-
531- ubuntu::application::ui::Session::clipboard()->set_content(content);
532-}
533-
534-void
535-ua_ui_get_clipboard_content(void** data,
536- size_t* size)
537-{
538- ubuntu::application::ui::Clipboard::Content content(ubuntu::application::ui::Session::clipboard()->get_content());
539-
540- *data = content.data;
541- *size = content.data_size;
542-}
543-
544-/*
545- * Display
546- */
547-
548-UAUiDisplay*
549-ua_ui_display_new_with_index(
550- size_t index)
551-{
552- return make_holder(
553- ubuntu::application::ui::Session::physical_display_info(
554- static_cast<ubuntu::application::ui::PhysicalDisplayIdentifier>(index)));
555-}
556-
557-void
558-ua_ui_display_destroy(
559- UAUiDisplay* display)
560-{
561- auto s = static_cast<Holder<ubuntu::application::ui::PhysicalDisplayInfo::Ptr>*>(display);
562- delete s;
563-}
564-
565-uint32_t
566-ua_ui_display_query_horizontal_res(
567- UAUiDisplay* display)
568-{
569- auto s = static_cast<Holder<ubuntu::application::ui::PhysicalDisplayInfo::Ptr>*>(display);
570- return s->value->horizontal_resolution();
571-}
572-
573-uint32_t
574-ua_ui_display_query_vertical_res(
575- UAUiDisplay* display)
576-{
577- auto s = static_cast<Holder<ubuntu::application::ui::PhysicalDisplayInfo::Ptr>*>(display);
578- return s->value->vertical_resolution();
579-}
580-
581-EGLNativeDisplayType
582-ua_ui_display_get_native_type(
583- UAUiDisplay* display)
584-{
585- // Always EGL_DEFAULT_DISPLAY with android EGL.
586- return EGL_DEFAULT_DISPLAY;
587-}
588-
589-/*
590- * Window Properties
591- */
592-
593-UAUiWindowProperties*
594-ua_ui_window_properties_new_for_normal_window()
595-{
596- ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__);
597-
598- ubuntu::application::ui::WindowProperties::Ptr p(
599- new ubuntu::application::ui::WindowProperties()
600- );
601-
602- return make_holder(p);
603-}
604-
605-void
606-ua_ui_window_properties_destroy(
607- UAUiWindowProperties *properties)
608-{
609- auto p = static_cast<Holder<ubuntu::application::ui::WindowProperties::Ptr>*>(properties);
610-
611- if (p)
612- delete p;
613-}
614-
615-void
616-ua_ui_window_properties_set_titlen(
617- UAUiWindowProperties *properties,
618- const char *title,
619- size_t size)
620-{
621- ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__);
622- auto p = static_cast<Holder<ubuntu::application::ui::WindowProperties::Ptr>*>(properties);
623- p->value->set_titlen(title, size);
624-}
625-
626-const char*
627-ua_ui_window_properties_get_title(
628- UAUiWindowProperties *properties)
629-{
630- ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__);
631- auto p = static_cast<Holder<ubuntu::application::ui::WindowProperties::Ptr>*>(properties);
632- return p->value->get_title();
633-}
634-
635-void
636-ua_ui_window_properties_set_role(
637- UAUiWindowProperties *properties,
638- UAUiWindowRole role)
639-{
640- ALOGI("%s():%d %p %d", __PRETTY_FUNCTION__, __LINE__, properties, role);
641- auto p = static_cast<Holder<ubuntu::application::ui::WindowProperties::Ptr>*>(properties);
642- p->value->set_role(role);
643-}
644-
645-UAUiWindowRole
646-ua_ui_window_properties_get_role(
647- UAUiWindowProperties *properties)
648-{
649- auto p = static_cast<Holder<ubuntu::application::ui::WindowProperties::Ptr>*>(properties);
650- return p->value->get_role();
651-}
652-
653-void
654-ua_ui_window_properties_set_input_cb_and_ctx(
655- UAUiWindowProperties *properties,
656- UAUiWindowInputEventCb cb,
657- void *ctx)
658-{
659- ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__);
660- auto p = static_cast<Holder<ubuntu::application::ui::WindowProperties::Ptr>*>(properties);
661- p->value->set_input_event_cb_and_ctx(cb, ctx);
662-}
663-
664-void
665-ua_ui_window_properties_set_event_cb_and_ctx(UAUiWindowProperties*, UAUiWindowEventCb, void *)
666-{
667-}
668-
669-void
670-ua_ui_window_properties_set_dimensions(
671- UAUiWindowProperties *properties,
672- uint32_t width,
673- uint32_t height)
674-{
675- ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__);
676- (void) width;
677- (void) height;
678-}
679-
680-/*
681- * Session
682- */
683-
684-UAUiSessionProperties*
685-ua_ui_session_properties_new()
686-{
687- ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__);
688-
689- ubuntu::application::ui::SessionProperties::Ptr props(
690- new ubuntu::application::ui::SessionProperties()
691- );
692-
693- return make_holder(props);
694-}
695-
696-void
697-ua_ui_session_properties_set_type(
698- UAUiSessionProperties* properties,
699- UAUiSessionType type)
700-{
701- ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__);
702-
703- auto p = static_cast<Holder<ubuntu::application::ui::SessionProperties::Ptr>*>(properties);
704-
705- if (p)
706- p->value->set_type(static_cast<ubuntu::application::ui::SessionType>(type));
707-}
708-
709-void
710-ua_ui_session_properties_set_remote_pid(
711- UAUiSessionProperties *properties,
712- uint32_t pid)
713-{
714- ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__);
715-
716- auto p = static_cast<Holder<ubuntu::application::ui::SessionProperties::Ptr>*>(properties);
717- p->value->set_remote_pid(pid);
718-}
719-
720-UAUiSession*
721-ua_ui_session_new_with_properties(
722- UAUiSessionProperties *properties)
723-{
724- ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__);
725-
726- if (session != NULL)
727- return session.get();
728-
729- auto p = static_cast<Holder<ubuntu::application::ui::SessionProperties::Ptr>*>(properties);
730-
731- SessionCredentials creds = {
732- static_cast<SessionType>(p->value->get_type()),
733- APPLICATION_SUPPORTS_OVERLAYED_MENUBAR,
734- "QtUbuntu",
735- p->value->get_remote_pid(),
736- NULL
737- };
738-
739- ubuntu::application::ui::SessionCredentials sc(&creds);
740- session = ubuntu::ui::SessionService::instance()->start_a_new_session(sc);
741-
742- return session.get();
743-}
744-
745-/*
746- * Window (Surface)
747- */
748-
749-UAUiWindow*
750-ua_ui_window_new_for_application_with_properties(
751- UApplicationInstance *instance,
752- UAUiWindowProperties *properties)
753-{
754- ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__);
755-
756- if (session == NULL)
757- return NULL;
758-
759- auto p = static_cast<Holder<ubuntu::application::ui::WindowProperties::Ptr>*>(properties);
760-
761- ubuntu::application::ui::SurfaceProperties props =
762- {
763- "test",
764- 0,
765- 0,
766- static_cast<ubuntu::application::ui::SurfaceRole>(p->value->get_role()),
767- 0, //FIXME: Set flags
768- true
769- };
770-
771- ubuntu::application::ui::Surface::Ptr surface =
772- session->create_surface(
773- props,
774- ubuntu::application::ui::input::Listener::Ptr(
775- new CallbackEventListener(p->value->get_input_cb(),
776- p->value->get_ctx())));
777-
778- auto inst = static_cast<Holder<ubuntu::application::Instance::Ptr>*>(instance);
779- auto desc = static_cast<Holder<ubuntu::application::Description::Ptr>*>(inst->value->get_description());
780- auto dele = static_cast<Holder<ubuntu::application::LifecycleDelegate::Ptr>*>(desc->value->get_lifecycle_delegate());
781-
782- session->install_lifecycle_delegate(dele->value);
783-
784- return make_holder(surface);
785-}
786-
787-void
788-ua_ui_window_destroy(
789- UAUiWindow *window)
790-{
791- ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__);
792- //auto p = static_cast<Holder<ubuntu::application::ui::Window::Ptr*>*>(window);
793- auto p = static_cast<Holder<ubuntu::application::ui::Surface::Ptr>*>(window);
794-
795- if (p)
796- delete p;
797-}
798-
799-UAUiWindowId
800-ua_ui_window_get_id(
801- UAUiWindow *window)
802-{
803- //auto p = static_cast<Holder<ubuntu::application::ui::Window::Ptr*>*>(window);
804- auto p = static_cast<Holder<ubuntu::application::ui::Surface::Ptr>*>(window);
805-
806- return p->value->get_id();
807-}
808-
809-UStatus
810-ua_ui_window_move(
811- UAUiWindow *window,
812- uint32_t new_x,
813- uint32_t new_y)
814-{
815- ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__);
816- auto p = static_cast<Holder<ubuntu::application::ui::Surface::Ptr>*>(window);
817- p->value->move_to(new_x, new_y);
818-
819- return U_STATUS_SUCCESS;
820-}
821-
822-UStatus
823-ua_ui_window_resize(
824- UAUiWindow *window,
825- uint32_t new_width,
826- uint32_t new_height)
827-{
828- ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__);
829- //auto p = static_cast<Holder<ubuntu::application::ui::Window::Ptr*>*>(window);
830- auto p = static_cast<Holder<ubuntu::application::ui::Surface::Ptr>*>(window);
831- p->value->resize(new_width, new_height);
832-
833- return U_STATUS_SUCCESS;
834-}
835-
836-UStatus
837-ua_ui_window_hide(
838- UAUiWindow *window)
839-{
840- ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__);
841- //auto p = static_cast<Holder<ubuntu::application::ui::Window::Ptr*>*>(window);
842- auto p = static_cast<Holder<ubuntu::application::ui::Surface::Ptr>*>(window);
843- p->value->set_visible(session->get_session_pid(), false);
844-
845- return U_STATUS_SUCCESS;
846-}
847-
848-UStatus
849-ua_ui_window_show(
850- UAUiWindow *window)
851-{
852- ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__);
853- auto p = static_cast<Holder<ubuntu::application::ui::Surface::Ptr>*>(window);
854- p->value->set_visible(session->get_session_pid(), true);
855-
856- return U_STATUS_SUCCESS;
857-}
858-
859-void
860-ua_ui_window_request_fullscreen(
861- UAUiWindow *window)
862-{
863- ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__);
864- if (session == NULL)
865- return;
866-
867- auto p = static_cast<Holder<ubuntu::application::ui::Surface::Ptr>*>(window);
868- session->toggle_fullscreen_for_surface(p->value);
869-}
870-
871-void
872-ua_ui_window_request_state(
873- UAUiWindow *window, UApplicationUiWindowState state)
874-{
875- ALOGI("ua_ui_window_request_state unimplemented %s:%d", __PRETTY_FUNCTION__, __LINE__);
876- (void) window;
877- (void) state;
878-}
879-
880-EGLNativeWindowType
881-ua_ui_window_get_native_type(
882- UAUiWindow *window)
883-{
884- ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__);
885- auto p = static_cast<Holder<ubuntu::application::ui::Surface::Ptr>*>(window);
886- return p->value->to_native_window_type();
887-}
888-
889-UApplicationUiWindowOrientation
890-ua_ui_window_get_orientation(
891- UAUiWindow *window)
892-{
893- ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__);
894- (void*) window;
895- // Orientation flag not available with android, return default
896- return U_ORIENTATION_NORMAL;
897-}
898-
899
900=== removed file 'android/default/default_ubuntu_ui.cpp'
901--- android/default/default_ubuntu_ui.cpp 2013-06-07 01:08:41 +0000
902+++ android/default/default_ubuntu_ui.cpp 1970-01-01 00:00:00 +0000
903@@ -1,273 +0,0 @@
904-/*
905- * Copyright © 2012 Canonical Ltd.
906- *
907- * This program is free software: you can redistribute it and/or modify
908- * it under the terms of the GNU Lesser General Public License version 3 as
909- * published by the Free Software Foundation.
910- *
911- * This program is distributed in the hope that it will be useful,
912- * but WITHOUT ANY WARRANTY; without even the implied warranty of
913- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
914- * GNU Lesser General Public License for more details.
915- *
916- * You should have received a copy of the GNU Lesser General Public License
917- * along with this program. If not, see <http://www.gnu.org/licenses/>.
918- *
919- * Authored by: Thomas Voß <thomas.voss@canonical.com>
920- */
921-
922-#include <ubuntu/ui/ubuntu_ui_session_service.h>
923-
924-#include <private/ui/session_service.h>
925-#include <private/ui/session_enumerator.h>
926-
927-#include <stdio.h>
928-
929-#include <utils/Log.h>
930-
931-namespace
932-{
933-struct TaskController : public ubuntu::ui::TaskController
934-{
935- TaskController(ubuntu_ui_task_controller* controller) : controller(controller)
936- {
937- }
938-
939- void continue_task(int pid)
940- {
941- if (!controller)
942- return;
943-
944- if (!controller->continue_task)
945- return;
946-
947- controller->continue_task(pid, controller->context);
948- }
949-
950- void suspend_task(int pid)
951- {
952- if (!controller)
953- return;
954-
955- if (!controller->suspend_task)
956- return;
957-
958- controller->suspend_task(pid, controller->context);
959- }
960-
961- ubuntu_ui_task_controller* controller;
962-};
963-
964-struct SessionLifeCycleObserver : public ubuntu::ui::SessionLifeCycleObserver
965-{
966- SessionLifeCycleObserver(ubuntu_ui_session_lifecycle_observer* observer) : observer(observer)
967- {
968- }
969-
970- void on_session_requested(ubuntu::ui::WellKnownApplication app)
971- {
972- if (!observer)
973- return;
974-
975- if (!observer->on_session_requested)
976- return;
977-
978- observer->on_session_requested(static_cast<ubuntu_ui_well_known_application>(app), observer->context);
979- }
980-
981- void on_session_born(const ubuntu::ui::SessionProperties::Ptr& props)
982- {
983- if (!observer)
984- return;
985-
986- if (!observer->on_session_born)
987- return;
988-
989- observer->on_session_born(&props, observer->context);
990- }
991-
992- void on_session_unfocused(const ubuntu::ui::SessionProperties::Ptr& props)
993- {
994- if (!observer)
995- return;
996-
997- if (!observer->on_session_unfocused)
998- return;
999-
1000- observer->on_session_unfocused(&props, observer->context);
1001- }
1002-
1003- void on_session_focused(const ubuntu::ui::SessionProperties::Ptr& props)
1004- {
1005- if (!observer)
1006- return;
1007-
1008- if (!observer->on_session_focused)
1009- return;
1010-
1011- observer->on_session_focused(&props, observer->context);
1012- }
1013-
1014- void on_keyboard_geometry_changed(int x, int y, int width, int height)
1015- {
1016- if (!observer)
1017- return;
1018-
1019- if (!observer->on_keyboard_geometry_changed)
1020- return;
1021-
1022- observer->on_keyboard_geometry_changed(x, y, width, height, observer->context);
1023- }
1024-
1025- void on_session_requested_fullscreen(const ubuntu::ui::SessionProperties::Ptr& props)
1026- {
1027- if (!observer)
1028- return;
1029-
1030- if(!observer->on_session_requested_fullscreen)
1031- return;
1032-
1033- observer->on_session_requested_fullscreen(&props, observer->context);
1034- }
1035-
1036- void on_session_died(const ubuntu::ui::SessionProperties::Ptr& props)
1037- {
1038- if (!observer)
1039- return;
1040-
1041- if (!observer->on_session_died)
1042- return;
1043-
1044- observer->on_session_died(&props, observer->context);
1045- }
1046-
1047- ubuntu_ui_session_lifecycle_observer* observer;
1048-};
1049-
1050-}
1051-
1052-const char* ubuntu_ui_session_properties_get_value_for_key(ubuntu_ui_session_properties props, const char* key)
1053-{
1054- if (!props)
1055- return NULL;
1056-
1057- if (!key)
1058- return NULL;
1059-
1060- const ubuntu::ui::SessionProperties::Ptr* p = static_cast<const ubuntu::ui::SessionProperties::Ptr*>(props);
1061-
1062- return (*p)->value_for_key(key);
1063-}
1064-
1065-int ubuntu_ui_session_properties_get_application_stage_hint(ubuntu_ui_session_properties props)
1066-{
1067- if (!props)
1068- return -1;
1069-
1070- const ubuntu::ui::SessionProperties::Ptr* p = static_cast<const ubuntu::ui::SessionProperties::Ptr*>(props);
1071-
1072- return (*p)->application_stage_hint();
1073-}
1074-
1075-int ubuntu_ui_session_properties_get_application_instance_id(ubuntu_ui_session_properties props)
1076-{
1077- if (!props)
1078- return -1;
1079-
1080- const ubuntu::ui::SessionProperties::Ptr* p = static_cast<const ubuntu::ui::SessionProperties::Ptr*>(props);
1081-
1082- return (*p)->application_instance_id();
1083-}
1084-
1085-const char* ubuntu_ui_session_properties_get_desktop_file_hint(ubuntu_ui_session_properties props)
1086-{
1087- if (!props)
1088- return NULL;
1089-
1090- const ubuntu::ui::SessionProperties::Ptr* p = static_cast<const ubuntu::ui::SessionProperties::Ptr*>(props);
1091-
1092- return (*p)->desktop_file_hint();
1093-}
1094-
1095-bool ubuntu_ui_session_preview_provider_update_session_preview_texture(ubuntu_ui_session_preview_provider pp, int id, GLuint texture, unsigned int* width, unsigned int* height)
1096-{
1097- if (!pp)
1098- return false;
1099-
1100- const ubuntu::ui::SessionPreviewProvider::Ptr* spp =
1101- static_cast<const ubuntu::ui::SessionPreviewProvider::Ptr*>(pp);
1102-
1103- return (*spp)->get_or_update_session_preview(texture, *width, *height);
1104-}
1105-
1106-void ubuntu_ui_session_install_session_lifecycle_observer(ubuntu_ui_session_lifecycle_observer* observer)
1107-{
1108- ubuntu::ui::SessionLifeCycleObserver::Ptr p(new SessionLifeCycleObserver(observer));
1109- ubuntu::ui::SessionService::instance()->install_session_lifecycle_observer(p);
1110-}
1111-
1112-void ubuntu_ui_session_unfocus_running_sessions()
1113-{
1114- ubuntu::ui::SessionService::instance()->unfocus_running_sessions();
1115-}
1116-
1117-void ubuntu_ui_session_focus_running_session_with_id(int id)
1118-{
1119- ubuntu::ui::SessionService::instance()->focus_running_session_with_id(id);
1120-}
1121-
1122-void ubuntu_ui_session_snapshot_running_session_with_id(int id, ubuntu_ui_session_service_snapshot_cb cb, void* context)
1123-{
1124- ubuntu::ui::SessionSnapshot::Ptr ss = ubuntu::ui::SessionService::instance()->snapshot_running_session_with_id(id);
1125-
1126- if (cb)
1127- {
1128- ALOGI("screenshot buffer (%d, %d) geometry (%d, %d, %d, %d)\n", ss->width(), ss->height(), ss->x(), ss->y(), ss->source_width(), ss->source_height());
1129- cb(ss->pixel_data(), ss->width(), ss->height(), ss->x(), ss->y(),
1130- ss->source_width(), ss->source_height(), ss->stride(), context);
1131- }
1132-}
1133-
1134-void ubuntu_ui_session_trigger_switch_to_well_known_application(ubuntu_ui_well_known_application app)
1135-{
1136- ubuntu::ui::SessionService::instance()->trigger_switch_to_well_known_application(
1137- static_cast<ubuntu::ui::WellKnownApplication>(app));
1138-}
1139-
1140-int32_t ubuntu_ui_set_surface_trap(int32_t x, int32_t y, int32_t width, int32_t height)
1141-{
1142- return ubuntu::ui::SessionService::instance()->set_surface_trap(x, y, width, height);
1143-}
1144-
1145-void ubuntu_ui_unset_surface_trap(int32_t handle)
1146-{
1147- ubuntu::ui::SessionService::instance()->unset_surface_trap(handle);
1148-}
1149-
1150-void ubuntu_ui_report_osk_visible(int x, int y, int width, int height)
1151-{
1152- ubuntu::ui::SessionService::instance()->report_osk_visible(x, y, width, height);
1153-}
1154-
1155-void ubuntu_ui_report_osk_invisible()
1156-{
1157- ubuntu::ui::SessionService::instance()->report_osk_invisible();
1158-}
1159-
1160-void ubuntu_ui_report_notification_visible()
1161-{
1162- ubuntu::ui::SessionService::instance()->report_notification_visible();
1163-}
1164-
1165-void ubuntu_ui_report_notification_invisible()
1166-{
1167- ubuntu::ui::SessionService::instance()->report_notification_invisible();
1168-}
1169-
1170-void ubuntu_ui_install_task_controller(ubuntu_ui_task_controller *controller)
1171-{
1172- printf("installing task controller");
1173- ubuntu::ui::TaskController::Ptr p(new TaskController(controller));
1174- ubuntu::ui::SessionService::instance()->install_task_controller(p);
1175-}
1176-
1177
1178=== modified file 'android/hybris/Android.mk'
1179--- android/hybris/Android.mk 2015-03-19 19:56:37 +0000
1180+++ android/hybris/Android.mk 2015-07-01 17:16:40 +0000
1181@@ -22,12 +22,10 @@
1182 $(UPAPI_PATH)/android/include
1183
1184 LOCAL_SRC_FILES := \
1185- ubuntu_application_api_for_hybris.cpp \
1186 ubuntu_application_gps_for_hybris.cpp \
1187 ubuntu_application_sensors_for_hybris.cpp \
1188- ../default/default_ubuntu_application_sensor.cpp \
1189- ../default/default_ubuntu_ui.cpp \
1190- application_manager.cpp
1191+ ../default/default_ubuntu_application_sensor.cpp
1192+
1193
1194 LOCAL_MODULE := libubuntu_application_api
1195 LOCAL_MODULE_TAGS := optional
1196@@ -55,121 +53,6 @@
1197 $(UPAPI_PATH)/android/include
1198
1199 LOCAL_SRC_FILES:= \
1200- test.cpp \
1201-
1202-LOCAL_MODULE:= direct_ubuntu_application_api_for_hybris_test
1203-LOCAL_MODULE_TAGS := optional
1204-
1205-LOCAL_SHARED_LIBRARIES := \
1206- libandroidfw \
1207- libutils \
1208- libEGL \
1209- libGLESv2 \
1210- libubuntu_application_api
1211-
1212-include $(BUILD_EXECUTABLE)
1213-
1214-include $(CLEAR_VARS)
1215-
1216-LOCAL_CFLAGS += -std=gnu++0x
1217-
1218-LOCAL_C_INCLUDES := \
1219- $(UPAPI_PATH)/include \
1220- $(UPAPI_PATH)/android/include
1221-
1222-LOCAL_SRC_FILES:= \
1223- test_c_api.cpp \
1224-
1225-LOCAL_MODULE:= direct_ubuntu_application_c_api_for_hybris_test
1226-LOCAL_MODULE_TAGS := optional
1227-
1228-LOCAL_SHARED_LIBRARIES := \
1229- libandroidfw \
1230- libutils \
1231- libEGL \
1232- libGLESv2 \
1233- libubuntu_application_api
1234-
1235-include $(BUILD_EXECUTABLE)
1236-
1237-include $(CLEAR_VARS)
1238-
1239-LOCAL_CFLAGS += -std=gnu++0x
1240-
1241-LOCAL_C_INCLUDES := \
1242- $(UPAPI_PATH)/include \
1243- $(UPAPI_PATH)/android/include
1244-
1245-LOCAL_SRC_FILES:= \
1246- test_session_c_api.cpp \
1247-
1248-LOCAL_MODULE:= direct_ubuntu_application_session_c_api_for_hybris_test
1249-LOCAL_MODULE_TAGS := optional
1250-
1251-LOCAL_SHARED_LIBRARIES := \
1252- libandroidfw \
1253- libutils \
1254- libEGL \
1255- libGLESv2 \
1256- libubuntu_application_api
1257-
1258-include $(BUILD_EXECUTABLE)
1259-
1260-include $(CLEAR_VARS)
1261-
1262-LOCAL_CFLAGS += -std=gnu++0x
1263-
1264-LOCAL_C_INCLUDES := \
1265- $(UPAPI_PATH)/include \
1266- $(UPAPI_PATH)/android/include
1267-
1268-LOCAL_SRC_FILES:= \
1269- test_trap.cpp \
1270-
1271-LOCAL_MODULE:= direct_set_trap
1272-LOCAL_MODULE_TAGS := optional
1273-
1274-LOCAL_SHARED_LIBRARIES := \
1275- libandroidfw \
1276- libutils \
1277- libEGL \
1278- libGLESv2 \
1279- libubuntu_application_api
1280-
1281-include $(BUILD_EXECUTABLE)
1282-
1283-include $(CLEAR_VARS)
1284-
1285-LOCAL_CFLAGS += -std=gnu++0x
1286-
1287-LOCAL_C_INCLUDES := \
1288- $(UPAPI_PATH)/include \
1289- $(UPAPI_PATH)/android/include
1290-
1291-LOCAL_SRC_FILES:= \
1292- test_osk_visibility.cpp \
1293-
1294-LOCAL_MODULE:= direct_osk_visibility
1295-LOCAL_MODULE_TAGS := optional
1296-
1297-LOCAL_SHARED_LIBRARIES := \
1298- libandroidfw \
1299- libutils \
1300- libEGL \
1301- libGLESv2 \
1302- libubuntu_application_api
1303-
1304-include $(BUILD_EXECUTABLE)
1305-
1306-include $(CLEAR_VARS)
1307-
1308-LOCAL_CFLAGS += -std=gnu++0x
1309-
1310-LOCAL_C_INCLUDES := \
1311- $(UPAPI_PATH)/include \
1312- $(UPAPI_PATH)/android/include
1313-
1314-LOCAL_SRC_FILES:= \
1315 test_sensors_c_api.cpp \
1316
1317 LOCAL_MODULE:= direct_ubuntu_application_sensors_c_api_for_hybris_test
1318@@ -209,71 +92,6 @@
1319
1320 include $(CLEAR_VARS)
1321
1322-LOCAL_CFLAGS += \
1323- -DANDROID_VERSION_MAJOR=$(ANDROID_VERSION_MAJOR) \
1324- -DANDROID_VERSION_MINOR=$(ANDROID_VERSION_MINOR) \
1325- -DANDROID_VERSION_PATCH=$(ANDROID_VERSION_PATCH)
1326-
1327-LOCAL_CFLAGS += -std=gnu++0x
1328-
1329-LOCAL_C_INCLUDES := \
1330- external/skia/include/core \
1331- frameworks/base/services \
1332- $(UPAPI_PATH)/include \
1333- $(UPAPI_PATH)/android/include
1334-
1335-LOCAL_SRC_FILES:= \
1336- application_manager.cpp \
1337- default_application_manager.cpp \
1338-
1339-LOCAL_MODULE:= ubuntuappmanager
1340-LOCAL_MODULE_TAGS := optional
1341-
1342-LOCAL_SHARED_LIBRARIES := \
1343- libbinder \
1344- libinput \
1345- liblog \
1346- libgui \
1347- libskia \
1348- libandroidfw \
1349- libutils \
1350- libEGL \
1351- libGLESv2 \
1352- libubuntu_application_api
1353-
1354-ifeq ($(HAS_LIBINPUTSERVICE),true)
1355-LOCAL_SHARED_LIBRARIES += libinputservice
1356-endif
1357-
1358-include $(BUILD_EXECUTABLE)
1359-
1360-include $(CLEAR_VARS)
1361-
1362-LOCAL_CFLAGS += -std=gnu++0x
1363-
1364-LOCAL_C_INCLUDES := \
1365- $(UPAPI_PATH)/include \
1366- $(UPAPI_PATH)/android/include
1367-
1368-LOCAL_SRC_FILES:= \
1369- application_manager.cpp \
1370- default_application_manager_test.cpp \
1371-
1372-LOCAL_MODULE:= ubuntuappmanager_test
1373-LOCAL_MODULE_TAGS := optional
1374-
1375-LOCAL_SHARED_LIBRARIES := \
1376- libbinder \
1377- libandroidfw \
1378- libutils \
1379- libEGL \
1380- libGLESv2 \
1381- libubuntu_application_api
1382-
1383-include $(BUILD_EXECUTABLE)
1384-
1385-include $(CLEAR_VARS)
1386-
1387 LOCAL_CFLAGS += -std=gnu++0x
1388
1389 LOCAL_C_INCLUDES := \
1390
1391=== removed file 'android/hybris/application_manager.cpp'
1392--- android/hybris/application_manager.cpp 2013-06-07 01:08:41 +0000
1393+++ android/hybris/application_manager.cpp 1970-01-01 00:00:00 +0000
1394@@ -1,900 +0,0 @@
1395-/*
1396- * Copyright © 2012 Canonical Ltd.
1397- *
1398- * This program is free software: you can redistribute it and/or modify
1399- * it under the terms of the GNU General Public License version 3 as
1400- * published by the Free Software Foundation.
1401- *
1402- * This program is distributed in the hope that it will be useful,
1403- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1404- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1405- * GNU General Public License for more details.
1406- *
1407- * You should have received a copy of the GNU General Public License
1408- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1409- *
1410- * Authored by: Thomas Voß <thomas.voss@canonical.com>
1411- */
1412-#include "application_manager.h"
1413-
1414-#include <binder/Parcel.h>
1415-#include <utils/String8.h>
1416-
1417-namespace android
1418-{
1419-IMPLEMENT_META_INTERFACE(ClipboardService, "UbuntuClipboardService");
1420-IMPLEMENT_META_INTERFACE(AMTaskController, "UbuntuApplicationManagerTaskController");
1421-IMPLEMENT_META_INTERFACE(ApplicationManagerObserver, "UbuntuApplicationManagerObserver");
1422-IMPLEMENT_META_INTERFACE(ApplicationManagerSession, "UbuntuApplicationManagerSession");
1423-IMPLEMENT_META_INTERFACE(ApplicationManager, "UbuntuApplicationManager");
1424-
1425-IClipboardService::Content::Content() : data(NULL),
1426- data_size(0)
1427-{
1428-}
1429-
1430-IClipboardService::Content::Content(
1431- const String8& mime_type,
1432- void* _data,
1433- size_t size) : mime_type(mime_type),
1434- data(malloc(size)),
1435- data_size(size)
1436-{
1437- memcpy(this->data, _data, size);
1438-}
1439-
1440-IClipboardService::Content::~Content()
1441-{
1442- if (data != NULL && data_size != 0)
1443- free(data);
1444-}
1445-
1446-IClipboardService::Content::Content(const IClipboardService::Content& content)
1447- : mime_type(content.mime_type),
1448- data(malloc(content.data_size)),
1449- data_size(content.data_size)
1450-{
1451- memcpy(data, content.data, data_size);
1452-}
1453-
1454-IClipboardService::Content& IClipboardService::Content::operator=(const IClipboardService::Content& content)
1455-{
1456- mime_type = content.mime_type;
1457- data_size = content.data_size;
1458- data = realloc(data, data_size);
1459- memcpy(data, content.data, data_size);
1460-
1461- return *this;
1462-}
1463-
1464-status_t BnClipboardService::onTransact(uint32_t code,
1465- const Parcel& data,
1466- Parcel* reply,
1467- uint32_t flags)
1468-{
1469- switch(code)
1470- {
1471- case SET_CLIPBOARD_CONTENT_COMMAND:
1472- {
1473- IClipboardService::Content content;
1474- String8 mime_type = data.readString8();
1475- size_t data_size = data.readInt32();
1476- void* p = malloc(data_size);
1477- data.read(p, data_size);
1478- set_content(Content(mime_type, p, data_size));
1479- free(p);
1480- break;
1481- }
1482- case GET_CLIPBOARD_CONTENT_COMMAND:
1483- {
1484- IClipboardService::Content content;
1485- get_content(content);
1486-
1487- reply->writeString8(String8(content.mime_type));
1488- reply->writeInt32(content.data_size);
1489- reply->write(content.data, content.data_size);
1490- }
1491- break;
1492- }
1493-
1494- return NO_ERROR;
1495-}
1496-
1497-BpClipboardService::BpClipboardService(const sp<IBinder>& impl) : BpInterface<IClipboardService>(impl)
1498-{
1499-}
1500-
1501-void BpClipboardService::set_content(const IClipboardService::Content& content)
1502-{
1503- Parcel in, out;
1504-
1505- in.writeString8(String8(content.mime_type));
1506- in.writeInt32(content.data_size);
1507- in.write(content.data, content.data_size);
1508-
1509- remote()->transact(
1510- SET_CLIPBOARD_CONTENT_COMMAND,
1511- in,
1512- &out);
1513-}
1514-
1515-void BpClipboardService::get_content(IClipboardService::Content& content)
1516-{
1517- Parcel in, out;
1518-
1519- remote()->transact(
1520- GET_CLIPBOARD_CONTENT_COMMAND,
1521- in,
1522- &out);
1523-
1524- content.mime_type = out.readString8();
1525- content.data_size = out.readInt32();
1526- content.data = malloc(content.data_size);
1527- out.read(content.data, content.data_size);
1528-}
1529-
1530-BnApplicationManagerSession::BnApplicationManagerSession()
1531-{
1532-}
1533-
1534-BnApplicationManagerSession::~BnApplicationManagerSession() {}
1535-
1536-status_t BnApplicationManagerSession::onTransact(uint32_t code,
1537- const Parcel& data,
1538- Parcel* reply,
1539- uint32_t flags)
1540-{
1541- switch(code)
1542- {
1543- case RAISE_APPLICATION_SURFACES_TO_LAYER_COMMAND:
1544- {
1545- int32_t layer;
1546- data.readInt32(&layer);
1547-
1548- raise_application_surfaces_to_layer(layer);
1549- }
1550- break;
1551- case RAISE_SURFACE_TO_LAYER_COMMAND:
1552- {
1553- int32_t token, layer;
1554- token = data.readInt32();
1555- layer = data.readInt32();
1556-
1557- raise_surface_to_layer(token, layer);
1558- }
1559- break;
1560- case QUERY_SURFACE_PROPERTIES_FOR_TOKEN_COMMAND:
1561- {
1562- int32_t token = data.readInt32();
1563- IApplicationManagerSession::SurfaceProperties props =
1564- query_surface_properties_for_token(token);
1565- reply->writeInt32(props.layer);
1566- reply->writeInt32(props.left);
1567- reply->writeInt32(props.top);
1568- reply->writeInt32(props.right);
1569- reply->writeInt32(props.bottom);
1570- }
1571- break;
1572- case ON_APPLICATION_STARTED_NOTIFICATION:
1573- {
1574- on_application_resumed();
1575- }
1576- break;
1577- case ON_APPLICATION_ABOUT_TO_STOP_NOTIFICATION:
1578- {
1579- on_application_about_to_stop();
1580- }
1581- break;
1582- }
1583- return NO_ERROR;
1584-}
1585-
1586-BpApplicationManagerSession::BpApplicationManagerSession(const sp<IBinder>& impl)
1587- : BpInterface<IApplicationManagerSession>(impl)
1588-{
1589-}
1590-
1591-BpApplicationManagerSession::~BpApplicationManagerSession()
1592-{
1593-}
1594-
1595-void BpApplicationManagerSession::raise_surface_to_layer(int32_t token, int layer)
1596-{
1597- Parcel in, out;
1598-
1599- in.writeInt32(token);
1600- in.writeInt32(layer);
1601-
1602- remote()->transact(
1603- RAISE_SURFACE_TO_LAYER_COMMAND,
1604- in,
1605- &out);
1606-}
1607-
1608-void BpApplicationManagerSession::raise_application_surfaces_to_layer(int layer)
1609-{
1610- Parcel in, out;
1611- in.writeInt32(layer);
1612-
1613- remote()->transact(
1614- RAISE_APPLICATION_SURFACES_TO_LAYER_COMMAND,
1615- in,
1616- &out);
1617-}
1618-
1619-IApplicationManagerSession::SurfaceProperties BpApplicationManagerSession::query_surface_properties_for_token(int32_t token)
1620-{
1621- Parcel in, out;
1622- in.writeInt32(token);
1623-
1624- remote()->transact(
1625- QUERY_SURFACE_PROPERTIES_FOR_TOKEN_COMMAND,
1626- in,
1627- &out);
1628-
1629- IApplicationManagerSession::SurfaceProperties props;
1630- props.layer = out.readInt32();
1631- props.left = out.readInt32();
1632- props.top = out.readInt32();
1633- props.right = out.readInt32();
1634- props.bottom = out.readInt32();
1635-
1636- return props;
1637-}
1638-
1639-void BpApplicationManagerSession::on_application_resumed()
1640-{
1641- Parcel in, out;
1642-
1643- remote()->transact(
1644- ON_APPLICATION_STARTED_NOTIFICATION,
1645- in,
1646- &out,
1647- android::IBinder::FLAG_ONEWAY);
1648-}
1649-
1650-void BpApplicationManagerSession::on_application_about_to_stop()
1651-{
1652- Parcel in, out;
1653-
1654- remote()->transact(
1655- ON_APPLICATION_ABOUT_TO_STOP_NOTIFICATION,
1656- in,
1657- &out,
1658- android::IBinder::FLAG_ONEWAY);
1659-}
1660-
1661-status_t BnAMTaskController::onTransact(uint32_t code,
1662- const Parcel& data,
1663- Parcel* reply,
1664- uint32_t flags)
1665-{
1666- switch(code)
1667- {
1668- case CONTINUE_TASK_COMMAND:
1669- {
1670- uint32_t pid = data.readInt32();
1671- continue_task(pid);
1672- break;
1673- }
1674- case SUSPEND_TASK_COMMAND:
1675- {
1676- int pid = data.readInt32();
1677- suspend_task(pid);
1678- break;
1679- }
1680- }
1681-
1682- return NO_ERROR;
1683-}
1684-
1685-BpAMTaskController::BpAMTaskController(const sp<IBinder>& impl)
1686- : BpInterface<IAMTaskController>(impl)
1687-{
1688-}
1689-
1690-void BpAMTaskController::continue_task(uint32_t pid)
1691-{
1692- Parcel in, out;
1693- in.writeInt32(pid);
1694-
1695- remote()->transact(
1696- CONTINUE_TASK_COMMAND,
1697- in,
1698- &out,
1699- android::IBinder::FLAG_ONEWAY);
1700-}
1701-
1702-void BpAMTaskController::suspend_task(uint32_t pid)
1703-{
1704- Parcel in, out;
1705- in.writeInt32(pid);
1706-
1707- remote()->transact(
1708- SUSPEND_TASK_COMMAND,
1709- in,
1710- &out,
1711- android::IBinder::FLAG_ONEWAY);
1712-}
1713-
1714-status_t BnApplicationManagerObserver::onTransact(uint32_t code,
1715- const Parcel& data,
1716- Parcel* reply,
1717- uint32_t flags)
1718-{
1719-
1720-
1721- switch(code)
1722- {
1723- case ON_SESSION_REQUESTED_NOTIFICATION:
1724- {
1725- uint32_t app = data.readInt32();
1726- on_session_requested(app);
1727- break;
1728- }
1729- case ON_SESSION_BORN_NOTIFICATION:
1730- {
1731- int id = data.readInt32();
1732- int stage_hint = data.readInt32();
1733- String8 desktop_file = data.readString8();
1734- on_session_born(id, stage_hint, desktop_file);
1735- break;
1736- }
1737- case ON_SESSION_UNFOCUSED_NOTIFICATION:
1738- {
1739- int id = data.readInt32();
1740- int stage_hint = data.readInt32();
1741- String8 desktop_file = data.readString8();
1742- on_session_unfocused(id, stage_hint, desktop_file);
1743- break;
1744- }
1745- case ON_SESSION_FOCUSED_NOTIFICATION:
1746- {
1747- int id = data.readInt32();
1748- int stage_hint = data.readInt32();
1749- String8 desktop_file = data.readString8();
1750- on_session_focused(id, stage_hint, desktop_file);
1751- break;
1752- }
1753- case ON_KEYBOARD_GEOMETRY_CHANGED_NOTIFICATION:
1754- {
1755- int x = data.readInt32();
1756- int y = data.readInt32();
1757- int width = data.readInt32();
1758- int height = data.readInt32();
1759- on_keyboard_geometry_changed(x, y, width, height);
1760- break;
1761- }
1762- case ON_SESSION_REQUESTED_FULLSCREEN_NOTIFICATION:
1763- {
1764- int id = data.readInt32();
1765- int stage_hint = data.readInt32();
1766- String8 desktop_file = data.readString8();
1767- on_session_requested_fullscreen(id, stage_hint, desktop_file);
1768- break;
1769- }
1770- case ON_SESSION_DIED_NOTIFICATION:
1771- {
1772- int id = data.readInt32();
1773- int stage_hint = data.readInt32();
1774- String8 desktop_file = data.readString8();
1775- on_session_died(id, stage_hint, desktop_file);
1776- break;
1777- }
1778- }
1779-
1780- return NO_ERROR;
1781-}
1782-
1783-BpApplicationManagerObserver::BpApplicationManagerObserver(const sp<IBinder>& impl)
1784- : BpInterface<IApplicationManagerObserver>(impl)
1785-{
1786-}
1787-
1788-void BpApplicationManagerObserver::on_session_requested(
1789- uint32_t app)
1790-{
1791- Parcel in, out;
1792- in.writeInt32(app);
1793-
1794- remote()->transact(
1795- ON_SESSION_REQUESTED_NOTIFICATION,
1796- in,
1797- &out,
1798- android::IBinder::FLAG_ONEWAY);
1799-}
1800-
1801-void BpApplicationManagerObserver::on_session_born(int id,
1802- int stage_hint,
1803- const String8& desktop_file_hint)
1804-{
1805- Parcel in, out;
1806- in.writeInt32(id);
1807- in.writeInt32(stage_hint);
1808- in.writeString8(desktop_file_hint);
1809-
1810- remote()->transact(
1811- ON_SESSION_BORN_NOTIFICATION,
1812- in,
1813- &out,
1814- android::IBinder::FLAG_ONEWAY);
1815-}
1816-
1817-void BpApplicationManagerObserver::on_session_unfocused(int id,
1818- int stage_hint,
1819- const String8& desktop_file_hint)
1820-{
1821- Parcel in, out;
1822- in.writeInt32(id);
1823- in.writeInt32(stage_hint);
1824- in.writeString8(desktop_file_hint);
1825-
1826- remote()->transact(
1827- ON_SESSION_UNFOCUSED_NOTIFICATION,
1828- in,
1829- &out,
1830- android::IBinder::FLAG_ONEWAY);
1831-}
1832-
1833-void BpApplicationManagerObserver::on_session_focused(int id,
1834- int stage_hint,
1835- const String8& desktop_file_hint)
1836-{
1837- Parcel in, out;
1838- in.writeInt32(id);
1839- in.writeInt32(stage_hint);
1840- in.writeString8(desktop_file_hint);
1841-
1842- remote()->transact(
1843- ON_SESSION_FOCUSED_NOTIFICATION,
1844- in,
1845- &out,
1846- android::IBinder::FLAG_ONEWAY);
1847-}
1848-
1849-void BpApplicationManagerObserver::on_keyboard_geometry_changed(int x,
1850- int y,
1851- int width,
1852- int height)
1853-{
1854- Parcel in, out;
1855- in.writeInt32(x);
1856- in.writeInt32(y);
1857- in.writeInt32(width);
1858- in.writeInt32(height);
1859-
1860- remote()->transact(
1861- ON_KEYBOARD_GEOMETRY_CHANGED_NOTIFICATION,
1862- in,
1863- &out,
1864- android::IBinder::FLAG_ONEWAY);
1865-}
1866-
1867-void BpApplicationManagerObserver::on_session_requested_fullscreen(int id,
1868- int stage_hint,
1869- const String8& desktop_file_hint)
1870-{
1871- Parcel in, out;
1872- in.writeInt32(id);
1873- in.writeInt32(stage_hint);
1874- in.writeString8(desktop_file_hint);
1875-
1876- remote()->transact(
1877- ON_SESSION_REQUESTED_FULLSCREEN_NOTIFICATION,
1878- in,
1879- &out,
1880- android::IBinder::FLAG_ONEWAY);
1881-}
1882-
1883-void BpApplicationManagerObserver::on_session_died(int id,
1884- int stage_hint,
1885- const String8& desktop_file_hint)
1886-{
1887- Parcel in, out;
1888- in.writeInt32(id);
1889- in.writeInt32(stage_hint);
1890- in.writeString8(desktop_file_hint);
1891-
1892- remote()->transact(
1893- ON_SESSION_DIED_NOTIFICATION,
1894- in,
1895- &out,
1896- android::IBinder::FLAG_ONEWAY);
1897-}
1898-
1899-BnApplicationManager::BnApplicationManager()
1900-{
1901-}
1902-
1903-BnApplicationManager::~BnApplicationManager()
1904-{
1905-}
1906-
1907-status_t BnApplicationManager::onTransact(uint32_t code,
1908- const Parcel& data,
1909- Parcel* reply,
1910- uint32_t flags)
1911-{
1912- switch(code)
1913- {
1914- case START_A_NEW_SESSION_COMMAND:
1915- {
1916- int32_t session_type = data.readInt32();
1917- int32_t stage_hint = data.readInt32();
1918- String8 app_name = data.readString8();
1919- String8 desktop_file = data.readString8();
1920- sp<IBinder> binder = data.readStrongBinder();
1921- sp<BpApplicationManagerSession> session(new BpApplicationManagerSession(binder));
1922- int fd = data.readFileDescriptor();
1923- uint32_t remote_pid = data.readInt32();
1924-
1925- start_a_new_session(session_type, stage_hint, app_name, desktop_file, session, fd, remote_pid);
1926- }
1927- break;
1928- case REGISTER_A_SURFACE_COMMAND:
1929- {
1930- String8 title = data.readString8();
1931- sp<IBinder> binder = data.readStrongBinder();
1932- sp<BpApplicationManagerSession> session(new BpApplicationManagerSession(binder));
1933- int32_t surface_role = data.readInt32();
1934- int32_t surface_token = data.readInt32();
1935- int fd = data.readFileDescriptor();
1936-
1937- register_a_surface(title, session, surface_role, surface_token, fd);
1938- }
1939- break;
1940- case GET_SESSION_PID_COMMAND:
1941- {
1942- sp<IBinder> binder = data.readStrongBinder();
1943- sp<BpApplicationManagerSession> session(new BpApplicationManagerSession(binder));
1944- int pid = get_session_pid(session);
1945- reply->writeInt32(pid);
1946- }
1947- break;
1948- case REQUEST_FULLSCREEN_COMMAND:
1949- {
1950- sp<IBinder> binder = data.readStrongBinder();
1951- sp<BpApplicationManagerSession> session(new BpApplicationManagerSession(binder));
1952- request_fullscreen(session);
1953- }
1954- break;
1955- case REGISTER_AN_OBSERVER_COMMAND:
1956- {
1957- sp<IBinder> binder = data.readStrongBinder();
1958- sp<BpApplicationManagerObserver> observer(new BpApplicationManagerObserver(binder));
1959- register_an_observer(observer);
1960- break;
1961- }
1962- case REGISTER_TASK_CONTROLLER_COMMAND:
1963- {
1964- sp<IBinder> binder = data.readStrongBinder();
1965- sp<BpAMTaskController> controller(new BpAMTaskController(binder));
1966- register_task_controller(controller);
1967- break;
1968- }
1969- case REQUEST_UPDATE_FOR_SESSION_COMMAND:
1970- {
1971- sp<IBinder> binder = data.readStrongBinder();
1972- sp<BpApplicationManagerSession> session(new BpApplicationManagerSession(binder));
1973- request_update_for_session(session);
1974- break;
1975- }
1976- case UNFOCUS_RUNNING_SESSIONS_COMMAND:
1977- {
1978- unfocus_running_sessions();
1979- break;
1980- }
1981- case FOCUS_RUNNING_SESSION_WITH_ID_COMMAND:
1982- {
1983- int32_t id = data.readInt32();
1984- focus_running_session_with_id(id);
1985- break;
1986- }
1987- case QUERY_SNAPSHOT_LAYER_FOR_SESSION_WITH_ID_COMMAND:
1988- {
1989- int32_t id = data.readInt32();
1990- int32_t layer = query_snapshot_layer_for_session_with_id(id);
1991- reply->writeInt32(layer);
1992- break;
1993- }
1994- case QUERY_SURFACE_PROPERTIES_FOR_SESSION_ID_COMMAND:
1995- {
1996- int32_t id = data.readInt32();
1997- IApplicationManagerSession::SurfaceProperties props =
1998- query_surface_properties_for_session_id(id);
1999- reply->writeInt32(props.layer);
2000- reply->writeInt32(props.left);
2001- reply->writeInt32(props.top);
2002- reply->writeInt32(props.right);
2003- reply->writeInt32(props.bottom);
2004- break;
2005- }
2006- case SWITCH_TO_WELL_KNOWN_APPLICATION_COMMAND:
2007- {
2008- int32_t app = data.readInt32();
2009- switch_to_well_known_application(app);
2010- break;
2011- }
2012- case SET_SURFACE_TRAP_COMMAND:
2013- {
2014- int32_t x = data.readInt32();
2015- int32_t y = data.readInt32();
2016- int32_t width = data.readInt32();
2017- int32_t height = data.readInt32();
2018- int32_t handle = set_surface_trap(x, y, width, height);
2019- reply->writeInt32(handle);
2020- break;
2021- }
2022- case UNSET_SURFACE_TRAP_COMMAND:
2023- {
2024- int32_t handle = data.readInt32();
2025- unset_surface_trap(handle);
2026- break;
2027- }
2028- case REPORT_OSK_VISIBLE_COMMAND:
2029- {
2030- int32_t x = data.readInt32();
2031- int32_t y = data.readInt32();
2032- int32_t width = data.readInt32();
2033- int32_t height = data.readInt32();
2034- report_osk_visible(x, y, width, height);
2035- break;
2036- }
2037- case REPORT_OSK_INVISIBLE_COMMAND:
2038- {
2039- report_osk_invisible();
2040- break;
2041- }
2042- case REPORT_NOTIFICATION_VISIBLE_COMMAND:
2043- {
2044- report_notification_visible();
2045- break;
2046- }
2047- case REPORT_NOTIFICATION_INVISIBLE_COMMAND:
2048- {
2049- report_notification_invisible();
2050- break;
2051- }
2052- }
2053- return NO_ERROR;
2054-}
2055-
2056-BpApplicationManager::BpApplicationManager(const sp<IBinder>& impl)
2057- : BpInterface<IApplicationManager>(impl)
2058-{
2059-}
2060-
2061-BpApplicationManager::~BpApplicationManager()
2062-{
2063-}
2064-
2065-void BpApplicationManager::start_a_new_session(
2066- int32_t session_type,
2067- int32_t stage_hint,
2068- const String8& app_name,
2069- const String8& desktop_file,
2070- const sp<IApplicationManagerSession>& session,
2071- int fd,
2072- uint32_t remote_pid)
2073-{
2074- //printf("%s \n", __PRETTY_FUNCTION__);
2075- Parcel in, out;
2076- in.pushAllowFds(true);
2077- in.writeInt32(session_type);
2078- in.writeInt32(stage_hint);
2079- in.writeString8(app_name);
2080- in.writeString8(desktop_file);
2081- in.writeStrongBinder(session->asBinder());
2082- in.writeFileDescriptor(fd);
2083- in.writeInt32(remote_pid);
2084-
2085- remote()->transact(START_A_NEW_SESSION_COMMAND,
2086- in,
2087- &out);
2088-}
2089-
2090-void BpApplicationManager::register_a_surface(
2091- const String8& title,
2092- const sp<IApplicationManagerSession>& session,
2093- int32_t surface_role,
2094- int32_t token,
2095- int fd)
2096-{
2097- //printf("%s \n", __PRETTY_FUNCTION__);
2098- Parcel in, out;
2099- in.pushAllowFds(true);
2100- in.writeString8(title);
2101- in.writeStrongBinder(session->asBinder());
2102- in.writeInt32(surface_role);
2103- in.writeInt32(token);
2104- in.writeFileDescriptor(fd);
2105-
2106- remote()->transact(REGISTER_A_SURFACE_COMMAND,
2107- in,
2108- &out);
2109-}
2110-
2111-int BpApplicationManager::get_session_pid(
2112- const sp<IApplicationManagerSession>& session)
2113-{
2114- Parcel in, out;
2115- in.writeStrongBinder(session->asBinder());
2116-
2117- remote()->transact(GET_SESSION_PID_COMMAND,
2118- in,
2119- &out);
2120-
2121- int32_t pid = out.readInt32();
2122-
2123- return pid;
2124-}
2125-
2126-
2127-void BpApplicationManager::request_fullscreen(
2128- const sp<IApplicationManagerSession>& session)
2129-{
2130- //printf("%s \n", __PRETTY_FUNCTION__);
2131- Parcel in, out;
2132- in.writeStrongBinder(session->asBinder());
2133-
2134- remote()->transact(REQUEST_FULLSCREEN_COMMAND,
2135- in,
2136- &out);
2137-}
2138-
2139-void BpApplicationManager::register_task_controller(const sp<IAMTaskController>& controller)
2140-{
2141- Parcel in, out;
2142- in.writeStrongBinder(controller->asBinder());
2143-
2144- remote()->transact(REGISTER_TASK_CONTROLLER_COMMAND,
2145- in,
2146- &out);
2147-}
2148-
2149-void BpApplicationManager::register_an_observer(const sp<IApplicationManagerObserver>& observer)
2150-{
2151- Parcel in, out;
2152- in.writeStrongBinder(observer->asBinder());
2153-
2154- remote()->transact(REGISTER_AN_OBSERVER_COMMAND,
2155- in,
2156- &out);
2157-}
2158-
2159-void BpApplicationManager::request_update_for_session(const sp<IApplicationManagerSession>& session)
2160-{
2161- Parcel in, out;
2162- in.writeStrongBinder(session->asBinder());
2163- remote()->transact(REQUEST_UPDATE_FOR_SESSION_COMMAND,
2164- in,
2165- &out);
2166-}
2167-
2168-void BpApplicationManager::unfocus_running_sessions()
2169-{
2170- Parcel in, out;
2171-
2172- remote()->transact(UNFOCUS_RUNNING_SESSIONS_COMMAND,
2173- in,
2174- &out);
2175-}
2176-
2177-void BpApplicationManager::focus_running_session_with_id(int id)
2178-{
2179- Parcel in, out;
2180- in.writeInt32(id);
2181-
2182- remote()->transact(FOCUS_RUNNING_SESSION_WITH_ID_COMMAND,
2183- in,
2184- &out);
2185-}
2186-
2187-int32_t BpApplicationManager::query_snapshot_layer_for_session_with_id(int id)
2188-{
2189- Parcel in, out;
2190- in.writeInt32(id);
2191- remote()->transact(QUERY_SNAPSHOT_LAYER_FOR_SESSION_WITH_ID_COMMAND,
2192- in,
2193- &out);
2194-
2195- int32_t layer = out.readInt32();
2196- return layer;
2197-}
2198-
2199-IApplicationManagerSession::SurfaceProperties BpApplicationManager::query_surface_properties_for_session_id(int id)
2200-{
2201- Parcel in, out;
2202- in.writeInt32(id);
2203-
2204- remote()->transact(QUERY_SURFACE_PROPERTIES_FOR_SESSION_ID_COMMAND,
2205- in,
2206- &out);
2207-
2208- IApplicationManagerSession::SurfaceProperties props;
2209- props.layer = out.readInt32();
2210- props.left = out.readInt32();
2211- props.top = out.readInt32();
2212- props.right = out.readInt32();
2213- props.bottom = out.readInt32();
2214-
2215- return props;
2216-}
2217-void BpApplicationManager::switch_to_well_known_application(int32_t app)
2218-{
2219- Parcel in, out;
2220- in.writeInt32(app);
2221-
2222- remote()->transact(SWITCH_TO_WELL_KNOWN_APPLICATION_COMMAND,
2223- in,
2224- &out);
2225-}
2226-
2227-int32_t BpApplicationManager::set_surface_trap(int32_t x, int32_t y, int32_t width, int32_t height)
2228-{
2229- Parcel in, out;
2230- in.writeInt32(x);
2231- in.writeInt32(y);
2232- in.writeInt32(width);
2233- in.writeInt32(height);
2234-
2235- remote()->transact(SET_SURFACE_TRAP_COMMAND,
2236- in,
2237- &out);
2238-
2239- int32_t handle = out.readInt32();
2240-
2241- return handle;
2242-}
2243-
2244-void BpApplicationManager::unset_surface_trap(int32_t handle)
2245-{
2246- Parcel in, out;
2247- in.writeInt32(handle);
2248-
2249- remote()->transact(UNSET_SURFACE_TRAP_COMMAND,
2250- in,
2251- &out);
2252-}
2253-
2254-void BpApplicationManager::report_osk_visible(int32_t x, int32_t y, int32_t width, int32_t height)
2255-{
2256- Parcel in, out;
2257- in.writeInt32(x);
2258- in.writeInt32(y);
2259- in.writeInt32(width);
2260- in.writeInt32(height);
2261-
2262- remote()->transact(REPORT_OSK_VISIBLE_COMMAND,
2263- in,
2264- &out);
2265-}
2266-
2267-void BpApplicationManager::report_osk_invisible()
2268-{
2269- Parcel in, out;
2270-
2271- remote()->transact(REPORT_OSK_INVISIBLE_COMMAND,
2272- in,
2273- &out);
2274-}
2275-
2276-void BpApplicationManager::report_notification_visible()
2277-{
2278- Parcel in, out;
2279-
2280- remote()->transact(REPORT_NOTIFICATION_VISIBLE_COMMAND,
2281- in,
2282- &out);
2283-}
2284-
2285-void BpApplicationManager::report_notification_invisible()
2286-{
2287- Parcel in, out;
2288-
2289- remote()->transact(REPORT_NOTIFICATION_INVISIBLE_COMMAND,
2290- in,
2291- &out);
2292-}
2293-
2294-}
2295
2296=== removed file 'android/hybris/application_manager.h'
2297--- android/hybris/application_manager.h 2013-06-07 01:08:41 +0000
2298+++ android/hybris/application_manager.h 1970-01-01 00:00:00 +0000
2299@@ -1,412 +0,0 @@
2300-/*
2301- * Copyright © 2012 Canonical Ltd.
2302- *
2303- * This program is free software: you can redistribute it and/or modify
2304- * it under the terms of the GNU Lesser General Public License version 3 as
2305- * published by the Free Software Foundation.
2306- *
2307- * This program is distributed in the hope that it will be useful,
2308- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2309- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2310- * GNU Lesser General Public License for more details.
2311- *
2312- * You should have received a copy of the GNU Lesser General Public License
2313- * along with this program. If not, see <http://www.gnu.org/licenses/>.
2314- *
2315- * Authored by: Thomas Voß <thomas.voss@canonical.com>
2316- */
2317-#ifndef HYBRIS_APPLICATION_MANAGER_H_
2318-#define HYBRIS_APPLICATION_MANAGER_H_
2319-
2320-#include <binder/IInterface.h>
2321-#include <utils/String8.h>
2322-
2323-namespace android
2324-{
2325-
2326-class IClipboardService : public IInterface
2327-{
2328-public:
2329- DECLARE_META_INTERFACE(ClipboardService);
2330-
2331- static const char* exported_service_name()
2332- {
2333- return "UbuntuClipboardService";
2334- }
2335-
2336- struct Content
2337- {
2338- Content();
2339- Content(const String8& mime_type, void* data, size_t data_size);
2340- ~Content();
2341- Content(const Content& rhs);
2342- Content& operator=(const Content& rhs);
2343-
2344- String8 mime_type;
2345- void* data;
2346- size_t data_size;
2347- };
2348-
2349- virtual void set_content(const Content& content) = 0;
2350- virtual void get_content(Content& content) = 0;
2351-
2352-protected:
2353- enum
2354- {
2355- SET_CLIPBOARD_CONTENT_COMMAND = IBinder::FIRST_CALL_TRANSACTION,
2356- GET_CLIPBOARD_CONTENT_COMMAND
2357- };
2358-};
2359-
2360-class BnClipboardService : public BnInterface<IClipboardService>
2361-{
2362- public:
2363- status_t onTransact(uint32_t code,
2364- const Parcel& data,
2365- Parcel* reply,
2366- uint32_t flags = 0);
2367-};
2368-
2369-class BpClipboardService : public BpInterface<IClipboardService>
2370-{
2371-public:
2372- BpClipboardService(const sp<IBinder>& impl);
2373-
2374- void set_content(const IClipboardService::Content& content);
2375- void get_content(IClipboardService::Content& content);
2376-
2377-};
2378-
2379-class IApplicationManagerSession : public IInterface
2380-{
2381-public:
2382- DECLARE_META_INTERFACE(ApplicationManagerSession);
2383-
2384- struct SurfaceProperties
2385- {
2386- int32_t layer;
2387- int32_t left;
2388- int32_t top;
2389- int32_t right;
2390- int32_t bottom;
2391- };
2392-
2393- virtual void raise_application_surfaces_to_layer(int layer) = 0;
2394- virtual void raise_surface_to_layer(int32_t token, int layer) = 0;
2395- virtual SurfaceProperties query_surface_properties_for_token(int32_t token) = 0;
2396- virtual void on_application_resumed() = 0;
2397- virtual void on_application_about_to_stop() = 0;
2398-
2399-protected:
2400- enum
2401- {
2402- RAISE_APPLICATION_SURFACES_TO_LAYER_COMMAND = IBinder::FIRST_CALL_TRANSACTION,
2403- RAISE_SURFACE_TO_LAYER_COMMAND,
2404- QUERY_SURFACE_PROPERTIES_FOR_TOKEN_COMMAND,
2405- ON_APPLICATION_STARTED_NOTIFICATION,
2406- ON_APPLICATION_ABOUT_TO_STOP_NOTIFICATION,
2407- };
2408-};
2409-
2410-class BnApplicationManagerSession : public BnInterface<IApplicationManagerSession>
2411-{
2412-public:
2413- BnApplicationManagerSession();
2414- virtual ~BnApplicationManagerSession();
2415-
2416- virtual status_t onTransact(uint32_t code,
2417- const Parcel& data,
2418- Parcel* reply,
2419- uint32_t flags = 0);
2420-};
2421-
2422-class BpApplicationManagerSession : public BpInterface<IApplicationManagerSession>
2423-{
2424-public:
2425- BpApplicationManagerSession(const sp<IBinder>& impl);
2426- ~BpApplicationManagerSession();
2427-
2428- void raise_application_surfaces_to_layer(int layer);
2429- void raise_surface_to_layer(int32_t token, int layer);
2430- IApplicationManagerSession::SurfaceProperties query_surface_properties_for_token(int32_t token);
2431- void on_application_resumed();
2432- void on_application_about_to_stop();
2433-};
2434-
2435-class IAMTaskController : public IInterface
2436-{
2437-public:
2438- DECLARE_META_INTERFACE(AMTaskController);
2439-
2440- virtual void continue_task(uint32_t pid) = 0;
2441-
2442- virtual void suspend_task(uint32_t pid) = 0;
2443-
2444-protected:
2445- enum
2446- {
2447- CONTINUE_TASK_COMMAND = IBinder::FIRST_CALL_TRANSACTION,
2448- SUSPEND_TASK_COMMAND
2449- };
2450-
2451- IAMTaskController(const IAMTaskController&) = delete;
2452- IAMTaskController& operator=(const IAMTaskController&) = delete;
2453-};
2454-
2455-class BnAMTaskController : public BnInterface<IAMTaskController>
2456-{
2457-public:
2458- status_t onTransact(uint32_t code,
2459- const Parcel& data,
2460- Parcel* reply,
2461- uint32_t flags = 0);
2462-};
2463-
2464-class BpAMTaskController : public BpInterface<IAMTaskController>
2465-{
2466-public:
2467- BpAMTaskController(const sp<IBinder>& impl);
2468-
2469- void continue_task(uint32_t pid);
2470-
2471- void suspend_task(uint32_t pid);
2472-};
2473-
2474-class IApplicationManagerObserver : public IInterface
2475-{
2476-public:
2477- DECLARE_META_INTERFACE(ApplicationManagerObserver);
2478-
2479- virtual void on_session_requested(uint32_t app) = 0;
2480-
2481- virtual void on_session_born(int id,
2482- int stage_hint,
2483- const String8& desktop_file) = 0;
2484-
2485- virtual void on_session_unfocused(int id,
2486- int stage_hint,
2487- const String8& desktop_file) = 0;
2488-
2489- virtual void on_session_focused(int id,
2490- int stage_hint,
2491- const String8& desktop_file) = 0;
2492-
2493- virtual void on_session_requested_fullscreen(int id,
2494- int stage_hint,
2495- const String8& desktop_file) = 0;
2496-
2497- virtual void on_keyboard_geometry_changed(int x,
2498- int y,
2499- int width,
2500- int height) = 0;
2501-
2502- virtual void on_session_died(int id,
2503- int stage_hint,
2504- const String8& desktop_file) = 0;
2505-
2506-protected:
2507- enum
2508- {
2509- ON_SESSION_REQUESTED_NOTIFICATION = IBinder::FIRST_CALL_TRANSACTION,
2510- ON_SESSION_BORN_NOTIFICATION,
2511- ON_SESSION_UNFOCUSED_NOTIFICATION,
2512- ON_SESSION_FOCUSED_NOTIFICATION,
2513- ON_KEYBOARD_GEOMETRY_CHANGED_NOTIFICATION,
2514- ON_SESSION_REQUESTED_FULLSCREEN_NOTIFICATION,
2515- ON_SESSION_DIED_NOTIFICATION
2516- };
2517-
2518- IApplicationManagerObserver(const IApplicationManagerObserver&) = delete;
2519- IApplicationManagerObserver& operator=(const IApplicationManagerObserver&) = delete;
2520-};
2521-
2522-class BnApplicationManagerObserver : public BnInterface<IApplicationManagerObserver>
2523-{
2524-public:
2525- status_t onTransact(uint32_t code,
2526- const Parcel& data,
2527- Parcel* reply,
2528- uint32_t flags = 0);
2529-};
2530-
2531-class BpApplicationManagerObserver : public BpInterface<IApplicationManagerObserver>
2532-{
2533-public:
2534- BpApplicationManagerObserver(const sp<IBinder>& impl);
2535-
2536- void on_session_requested(uint32_t app);
2537-
2538- void on_session_born(int id,
2539- int stage_hint,
2540- const String8& desktop_file);
2541-
2542- void on_session_unfocused(int id,
2543- int stage_hint,
2544- const String8& desktop_file);
2545-
2546- void on_session_focused(int id,
2547- int stage_hint,
2548- const String8& desktop_file);
2549-
2550- void on_session_requested_fullscreen(int id,
2551- int stage_hint,
2552- const String8& desktop_file);
2553-
2554- void on_keyboard_geometry_changed(int x,
2555- int y,
2556- int width,
2557- int height);
2558-
2559- void on_session_died(int id,
2560- int stage_hint,
2561- const String8& desktop_file);
2562-};
2563-
2564-class IApplicationManager : public IInterface
2565-{
2566-public:
2567- DECLARE_META_INTERFACE(ApplicationManager);
2568-
2569- static const char* exported_service_name()
2570- {
2571- return "UbuntuApplicationManager";
2572- }
2573-
2574- virtual void start_a_new_session(int32_t session_type,
2575- int32_t stage_hint,
2576- const String8& app_name,
2577- const String8& desktop_file,
2578- const sp<IApplicationManagerSession>& session,
2579- int fd,
2580- uint32_t remote_pid) = 0;
2581-
2582- virtual void register_a_surface(const String8& title,
2583- const sp<IApplicationManagerSession>& session,
2584- int32_t surface_role,
2585- int32_t token,
2586- int fd) = 0;
2587-
2588- virtual int get_session_pid(const sp<IApplicationManagerSession>& session) = 0;
2589-
2590- virtual void request_fullscreen(const sp<IApplicationManagerSession>& session) = 0;
2591-
2592- virtual void request_update_for_session(const sp<IApplicationManagerSession>& session) = 0;
2593-
2594- virtual void register_an_observer(const sp<IApplicationManagerObserver>& observer) = 0;
2595-
2596- virtual void register_task_controller(const sp<IAMTaskController>& controller) = 0;
2597-
2598- virtual void unfocus_running_sessions() = 0;
2599-
2600- virtual void focus_running_session_with_id(int id) = 0;
2601-
2602- virtual int32_t query_snapshot_layer_for_session_with_id(int id) = 0;
2603-
2604- virtual IApplicationManagerSession::SurfaceProperties query_surface_properties_for_session_id(int id) = 0;
2605-
2606- virtual void switch_to_well_known_application(int32_t app) = 0;
2607-
2608- virtual int32_t set_surface_trap(int32_t x, int32_t y, int32_t width, int32_t height) = 0;
2609-
2610- virtual void unset_surface_trap(int32_t handle) = 0;
2611-
2612- virtual void report_osk_visible(int32_t x, int32_t y, int32_t width, int32_t height) = 0;
2613-
2614- virtual void report_osk_invisible() = 0;
2615-
2616- virtual void report_notification_visible() = 0;
2617-
2618- virtual void report_notification_invisible() = 0;
2619-
2620-protected:
2621- enum
2622- {
2623- START_A_NEW_SESSION_COMMAND = IBinder::FIRST_CALL_TRANSACTION,
2624- REGISTER_A_SURFACE_COMMAND,
2625- GET_SESSION_PID_COMMAND,
2626- REQUEST_FULLSCREEN_COMMAND,
2627- REGISTER_AN_OBSERVER_COMMAND,
2628- REGISTER_TASK_CONTROLLER_COMMAND,
2629- REQUEST_UPDATE_FOR_SESSION_COMMAND,
2630- UNFOCUS_RUNNING_SESSIONS_COMMAND,
2631- FOCUS_RUNNING_SESSION_WITH_ID_COMMAND,
2632- QUERY_SNAPSHOT_LAYER_FOR_SESSION_WITH_ID_COMMAND,
2633- QUERY_SURFACE_PROPERTIES_FOR_SESSION_ID_COMMAND,
2634- SWITCH_TO_WELL_KNOWN_APPLICATION_COMMAND,
2635- SET_SURFACE_TRAP_COMMAND,
2636- UNSET_SURFACE_TRAP_COMMAND,
2637- REPORT_OSK_VISIBLE_COMMAND,
2638- REPORT_OSK_INVISIBLE_COMMAND,
2639- REPORT_NOTIFICATION_VISIBLE_COMMAND,
2640- REPORT_NOTIFICATION_INVISIBLE_COMMAND
2641- };
2642-};
2643-
2644-class BnApplicationManager : public BnInterface<IApplicationManager>
2645-{
2646-public:
2647- BnApplicationManager();
2648- virtual ~BnApplicationManager();
2649-
2650- virtual status_t onTransact(uint32_t code,
2651- const Parcel& data,
2652- Parcel* reply,
2653- uint32_t flags = 0);
2654-};
2655-
2656-class BpApplicationManager : public BpInterface<IApplicationManager>
2657-{
2658-public:
2659- BpApplicationManager(const sp<IBinder>& impl);
2660- ~BpApplicationManager();
2661-
2662- void start_a_new_session(int32_t session_type,
2663- int32_t stage_hint,
2664- const String8& app_name,
2665- const String8& desktop_file,
2666- const sp<IApplicationManagerSession>& session,
2667- int fd,
2668- uint32_t remote_pid);
2669-
2670- void register_a_surface(const String8& title,
2671- const android::sp<android::IApplicationManagerSession>& session,
2672- int32_t surface_role,
2673- int32_t token,
2674- int fd);
2675-
2676- int get_session_pid(const android::sp<android::IApplicationManagerSession>& session);
2677-
2678- void request_fullscreen(const android::sp<android::IApplicationManagerSession>& session);
2679-
2680- void request_update_for_session(const sp<IApplicationManagerSession>& session);
2681-
2682- void register_an_observer(const sp<IApplicationManagerObserver>& observer);
2683-
2684- void register_task_controller(const sp<IAMTaskController>& controller);
2685-
2686- void unfocus_running_sessions();
2687-
2688- void focus_running_session_with_id(int id);
2689-
2690- int32_t query_snapshot_layer_for_session_with_id(int id);
2691-
2692- IApplicationManagerSession::SurfaceProperties query_surface_properties_for_session_id(int id);
2693-
2694- void switch_to_well_known_application(int32_t app);
2695-
2696- int32_t set_surface_trap(int32_t x, int32_t y, int32_t width, int32_t height);
2697-
2698- void unset_surface_trap(int handle);
2699-
2700- void report_osk_visible(int32_t x, int32_t y, int32_t width, int32_t height);
2701-
2702- void report_osk_invisible();
2703-
2704- void report_notification_visible();
2705-
2706- void report_notification_invisible();
2707-};
2708-
2709-}
2710-
2711-#endif // HYBRIS_APPLICATION_MANAGER_H_
2712
2713=== removed file 'android/hybris/default_application_manager.cpp'
2714--- android/hybris/default_application_manager.cpp 2014-01-22 05:28:18 +0000
2715+++ android/hybris/default_application_manager.cpp 1970-01-01 00:00:00 +0000
2716@@ -1,1257 +0,0 @@
2717-/*
2718- * Copyright © 2012 Canonical Ltd.
2719- *
2720- * This program is free software: you can redistribute it and/or modify
2721- * it under the terms of the GNU Lesser General Public License version 3 as
2722- * published by the Free Software Foundation.
2723- *
2724- * This program is distributed in the hope that it will be useful,
2725- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2726- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2727- * GNU Lesser General Public License for more details.
2728- *
2729- * You should have received a copy of the GNU Lesser General Public License
2730- * along with this program. If not, see <http://www.gnu.org/licenses/>.
2731- *
2732- * Authored by: Thomas Voß <thomas.voss@canonical.com>
2733- */
2734-#undef LOG_TAG
2735-#define LOG_TAG "ubuntu::detail::ApplicationManager"
2736-
2737-#include "default_application_manager.h"
2738-
2739-#include "default_application_manager_input_setup.h"
2740-#include "default_application_session.h"
2741-#include "default_shell.h"
2742-
2743-#include <binder/IPCThreadState.h>
2744-#include <binder/IServiceManager.h>
2745-#include <binder/ProcessState.h>
2746-
2747-#include <input/InputListener.h>
2748-#include <input/InputReader.h>
2749-#if ANDROID_VERSION_MAJOR==4 && ANDROID_VERSION_MINOR<=2
2750-#include <androidfw/InputTransport.h>
2751-#else
2752-#include <input/InputTransport.h>
2753-#endif
2754-#include <utils/threads.h>
2755-#include <utils/Errors.h>
2756-#include <utils/Timers.h>
2757-
2758-#include <cstdio>
2759-#include <cstdlib>
2760-
2761-#include <sys/types.h>
2762-#include <sys/wait.h>
2763-#include <signal.h>
2764-#include <fcntl.h>
2765-
2766-namespace ubuntu { namespace detail
2767-{
2768-
2769-template<typename T, typename U>
2770-const T& min(const T& lhs, const U& rhs)
2771-{
2772- return lhs < rhs ? lhs : rhs;
2773-}
2774-
2775-/* TODO: Currently we need to map local pids to the ones of the
2776- * container where Ubuntu is running as sessions need to be
2777- * referenced to observers in terms of the said namespace.
2778- */
2779-pid_t pid_to_vpid(int pid)
2780-{
2781- ALOGI("%s(%d)", __PRETTY_FUNCTION__, pid);
2782-
2783- if (pid <= 0)
2784- return -1;
2785-
2786- char proc_name[128], buf[1024];
2787- char *rpid;
2788- char key[] = "Vpid:";
2789-
2790- sprintf(proc_name, "/proc/%d/status", pid);
2791-
2792- int fd;
2793-
2794- fd = open(proc_name, O_RDONLY);
2795- if (fd < 0)
2796- {
2797- ALOGI("%s(): Cannot find %s\n", __PRETTY_FUNCTION__, proc_name);
2798- return -1;
2799- }
2800-
2801- memset(buf, '\0', sizeof(buf));
2802- read(fd, buf, sizeof(buf));
2803- rpid = strstr(buf, key);
2804-
2805- close(fd);
2806-
2807- if (rpid == NULL)
2808- {
2809- ALOGI("%s(): Vpid not supported\n", __PRETTY_FUNCTION__);
2810- return pid;
2811- }
2812-
2813- return atoi(rpid+sizeof(key));
2814-}
2815-
2816-bool is_session_allowed_to_run_in_background(
2817- const android::sp<ubuntu::detail::ApplicationSession>& session)
2818-{
2819- ALOGI("%s: %s", __PRETTY_FUNCTION__, session->desktop_file.string());
2820- static const android::String8 phone_app_desktop_file("/usr/share/applications/phone-app.desktop");
2821- static const android::String8 music_app_desktop_file("/usr/share/applications/music-app.desktop");
2822-
2823- if (session->desktop_file == phone_app_desktop_file ||
2824- session->desktop_file == music_app_desktop_file)
2825- {
2826- return true;
2827- }
2828-
2829- return false;
2830-}
2831-
2832-bool write_proc_file(pid_t pid, const char* filename, const char* value)
2833-{
2834- char proc_name[128];
2835- sprintf(proc_name, "/proc/%d/%s", pid, filename);
2836-
2837- int file;
2838-
2839- if (access(proc_name, F_OK) == 0)
2840- {
2841- file = open(proc_name, O_WRONLY);
2842- write(file, value, sizeof(value));
2843- close(file);
2844- return true;
2845- } else
2846- return false;
2847-}
2848-
2849-void update_oom_values(const android::sp<ubuntu::detail::ApplicationSession>& session)
2850-{
2851- if (session->session_type == ubuntu::application::ui::system_session_type)
2852- {
2853- if (!write_proc_file(session->pid, "oom_score_adj", "-940"))
2854- write_proc_file(session->pid, "oom_adj", "-16");
2855- return;
2856- }
2857-
2858- if (session->running_state == ubuntu::application::ui::process_suspended)
2859- {
2860- if (!write_proc_file(session->pid, "oom_score_adj", "1000"))
2861- write_proc_file(session->pid, "oom_adj", "15");
2862- } else
2863- {
2864- if (!write_proc_file(session->pid, "oom_score_adj", "0"))
2865- write_proc_file(session->pid, "oom_adj", "0");
2866- }
2867-}
2868-
2869-template<int x, int y, int w, int h>
2870-int ApplicationManager::ShellInputSetup::Window<x, y, w, h>::looper_callback(int receiveFd, int events, void* ctxt)
2871-{
2872- // ALOGI("%s", __PRETTY_FUNCTION__);
2873-
2874- bool result = true;
2875- ApplicationManager::ShellInputSetup::Window<x, y, w, h>* window = static_cast<ApplicationManager::ShellInputSetup::Window<x, y, w, h>*>(ctxt);
2876-
2877- //window->input_consumer.receiveDispatchSignal();
2878- uint32_t seq;
2879- android::InputEvent* ev;
2880- static const bool consume_batches = true;
2881- static const nsecs_t frame_time = -1;
2882- switch(window->input_consumer.consume(&window->event_factory, consume_batches, frame_time, &seq, &ev))
2883- {
2884- case android::OK:
2885- result = true;
2886- //printf("We have a client side event for process %d. \n", getpid());
2887- window->input_consumer.sendFinishedSignal(seq, result);
2888- break;
2889- case android::INVALID_OPERATION:
2890- result = true;
2891- break;
2892- case android::NO_MEMORY:
2893- result = true;
2894- break;
2895- }
2896-
2897- return result ? 1 : 0;
2898-}
2899-
2900-template<int x, int y, int w, int h>
2901-ApplicationManager::ShellInputSetup::Window<x, y, w, h>::Window(
2902- ApplicationManager::ShellInputSetup* parent,
2903- int _x,
2904- int _y,
2905- int _w,
2906- int _h) : parent(parent),
2907- input_consumer(client_channel)
2908-{
2909- auto window = new android::InputSetup::DummyApplicationWindow(
2910- parent->shell_application,
2911- _x,
2912- _y,
2913- _w,
2914- _h);
2915-
2916- android::InputChannel::openInputChannelPair(
2917- android::String8("DummyShellInputChannel"),
2918- server_channel,
2919- client_channel);
2920-
2921- window->input_channel = server_channel;
2922- input_window = window;
2923-
2924- parent->input_manager->getDispatcher()->registerInputChannel(
2925- window->input_channel,
2926- input_window,
2927- false);
2928-
2929- input_consumer = android::InputConsumer(client_channel);
2930-
2931- // input_consumer.initialize();
2932- parent->looper->addFd(client_channel->getFd(), //client_channel->getReceivePipeFd(),
2933- 0,
2934- ALOOPER_EVENT_INPUT,
2935- looper_callback,
2936- this);
2937-}
2938-
2939-ApplicationManager::ShellInputSetup::DisplayInfo::DisplayInfo()
2940-{
2941- auto display = android::SurfaceComposerClient::getBuiltInDisplay(
2942- android::ISurfaceComposer::eDisplayIdMain);
2943-
2944- android::SurfaceComposerClient::getDisplayInfo(
2945- display,
2946- &info);
2947-}
2948-
2949-ApplicationManager::ShellInputSetup::ShellInputSetup(const android::sp<android::InputManager>& input_manager)
2950- : shell_has_focus(true),
2951- input_manager(input_manager),
2952- shell_application(new android::InputSetup::DummyApplication()),
2953- looper(new android::Looper(true)),
2954- event_loop(looper),
2955- event_trap_window(this, 0, 0, display_info.info.w, display_info.info.h),
2956- osk_window(this),
2957- notifications_window(this)
2958-{
2959- event_loop.run();
2960-}
2961-
2962-ApplicationManager::InputFilter::InputFilter(ApplicationManager* manager) : manager(manager)
2963-{
2964-}
2965-
2966-bool ApplicationManager::InputFilter::filter_event(const android::InputEvent* event)
2967-{
2968- bool result = true;
2969-
2970- switch (event->getType())
2971- {
2972- case AINPUT_EVENT_TYPE_KEY:
2973- result = handle_key_event(static_cast<const android::KeyEvent*>(event));
2974- break;
2975- }
2976-
2977- return result;
2978-}
2979-
2980-bool ApplicationManager::InputFilter::handle_key_event(const android::KeyEvent* event)
2981-{
2982- bool result = true;
2983-
2984- return result;
2985-}
2986-
2987-ApplicationManager::LockingIterator::LockingIterator(
2988- ApplicationManager* manager,
2989- size_t index) : manager(manager),
2990- it(index)
2991-{
2992-}
2993-
2994-void ApplicationManager::LockingIterator::advance()
2995-{
2996- it += 1;
2997-}
2998-
2999-bool ApplicationManager::LockingIterator::is_valid() const
3000-{
3001- return it < manager->apps.size();
3002-}
3003-
3004-void ApplicationManager::LockingIterator::make_current()
3005-{
3006- //printf("%s \n", __PRETTY_FUNCTION__);
3007-}
3008-
3009-const android::sp<ubuntu::detail::ApplicationSession>& ApplicationManager::LockingIterator::operator*()
3010-{
3011- return manager->apps.valueFor(manager->apps_as_added[it]);
3012-}
3013-
3014-ApplicationManager::LockingIterator::~LockingIterator()
3015-{
3016- manager->unlock();
3017-}
3018-
3019-ApplicationManager::ApplicationManager() : input_filter(new InputFilter(this)),
3020- input_setup(new android::InputSetup(input_filter)),
3021- is_osk_visible(false),
3022- are_notifications_visible(false),
3023- app_manager_task_controller(NULL),
3024- focused_application(0),
3025- side_stage_application(0),
3026- main_stage_application(0)
3027-{
3028- shell_input_setup = new ShellInputSetup(input_setup->input_manager);
3029-
3030- input_setup->input_manager->getDispatcher()->setFocusedApplication(
3031- shell_input_setup->shell_application);
3032-
3033- android::Vector< android::sp<android::InputWindowHandle> > input_windows;
3034- input_windows.push(shell_input_setup->event_trap_window.input_window);
3035- input_setup->input_manager->getDispatcher()->setInputWindows(
3036- input_windows);
3037-
3038- input_setup->start();
3039-}
3040-
3041-void ApplicationManager::update_app_lists()
3042-{
3043- int idx;
3044-
3045- for (idx = apps_as_added.size()-1; idx >= 0; idx--)
3046- {
3047- const android::sp<ubuntu::detail::ApplicationSession>& session =
3048- apps.valueFor(apps_as_added[idx]);
3049-
3050- if (session->session_type == ubuntu::application::ui::system_session_type)
3051- continue;
3052-
3053- if (session->stage_hint == ubuntu::application::ui::side_stage)
3054- {
3055- side_stage_application = idx;
3056- break;
3057- }
3058- }
3059-
3060- if (idx < 0)
3061- side_stage_application = 0;
3062-
3063- for (idx = apps_as_added.size()-1; idx >= 0; idx--)
3064- {
3065- const android::sp<ubuntu::detail::ApplicationSession>& session =
3066- apps.valueFor(apps_as_added[idx]);
3067-
3068- if (session->session_type == ubuntu::application::ui::system_session_type)
3069- continue;
3070-
3071- if (session->stage_hint == ubuntu::application::ui::main_stage)
3072- {
3073- main_stage_application = idx;
3074- break;
3075- }
3076- }
3077-
3078- if (idx < 0)
3079- main_stage_application = 0;
3080-}
3081-
3082-// From DeathRecipient
3083-void ApplicationManager::binderDied(const android::wp<android::IBinder>& who)
3084-{
3085- android::Mutex::Autolock al(guard);
3086- android::sp<android::IBinder> sp = who.promote();
3087-
3088- ALOGI("%s():%d\n", __PRETTY_FUNCTION__, __LINE__);
3089-
3090- const android::sp<ubuntu::detail::ApplicationSession>& dead_session = apps.valueFor(sp);
3091-
3092- ALOGI("%s():%d -- remote_pid=%d desktop_file=%s\n", __PRETTY_FUNCTION__, __LINE__,
3093- dead_session->remote_pid,
3094- dead_session->desktop_file.string());
3095-
3096- notify_observers_about_session_died(dead_session->remote_pid,
3097- dead_session->stage_hint,
3098- dead_session->desktop_file);
3099-
3100- ALOGI("%s():%d\n", __PRETTY_FUNCTION__, __LINE__);
3101- size_t i = 0;
3102- for(i = 0; i < apps_as_added.size(); i++)
3103- if (apps_as_added[i] == sp)
3104- break;
3105-
3106- ALOGI("%s():%d\n", __PRETTY_FUNCTION__, __LINE__);
3107- size_t next_focused_app = 0;
3108- next_focused_app = apps_as_added.removeAt(i);
3109-
3110- ALOGI("%s():%d\n", __PRETTY_FUNCTION__, __LINE__);
3111- next_focused_app = main_stage_application;
3112- update_app_lists();
3113-
3114- ALOGI("%s():%d\n", __PRETTY_FUNCTION__, __LINE__);
3115- if (dead_session->stage_hint == ubuntu::application::ui::side_stage)
3116- next_focused_app = side_stage_application ? side_stage_application : next_focused_app;
3117-
3118- ALOGI("%s():%d\n", __PRETTY_FUNCTION__, __LINE__);
3119- if (dead_session->stage_hint == ubuntu::application::ui::main_stage)
3120- next_focused_app = main_stage_application;
3121-
3122- ALOGI("%s():%d\n", __PRETTY_FUNCTION__, __LINE__);
3123- if (i && i == focused_application &&
3124- shell_input_setup->shell_has_focus == false)
3125- {
3126- switch_focused_application_locked(next_focused_app);
3127- }
3128- else if(focused_application > i)
3129- focused_application--;
3130-
3131- if (i == 0)
3132- {
3133- shell_input_setup->trap_windows.clear();
3134- shell_input_setup->shell_has_focus = true;
3135- }
3136-
3137- ALOGI("%s():%d\n", __PRETTY_FUNCTION__, __LINE__);
3138- apps.removeItem(sp);
3139- ALOGI("%s():%d\n", __PRETTY_FUNCTION__, __LINE__);
3140-}
3141-
3142-void ApplicationManager::lock()
3143-{
3144- guard.lock();
3145-}
3146-
3147-void ApplicationManager::unlock()
3148-{
3149- guard.unlock();
3150-}
3151-
3152-android::sp<ApplicationManager::LockingIterator> ApplicationManager::iterator()
3153-{
3154- lock();
3155- android::sp<ApplicationManager::LockingIterator> it(
3156- new ApplicationManager::LockingIterator(this, 0));
3157-
3158- return it;
3159-}
3160-
3161-void ApplicationManager::session_set_state(const android::sp<ubuntu::detail::ApplicationSession>& as,
3162- int32_t new_state)
3163-{
3164- ALOGI("%s():%d running->running", __PRETTY_FUNCTION__, __LINE__);
3165-
3166- switch (new_state)
3167- {
3168- case ubuntu::application::ui::process_running:
3169- {
3170- if (as->running_state == ubuntu::application::ui::process_running)
3171- {
3172- ALOGI("%s():%d running->running", __PRETTY_FUNCTION__, __LINE__);
3173- /* FIXME:
3174- * Technically invalid, this transition currently is hit because
3175- * of focus being requested on the session before its delagate call
3176- */
3177- } else if (as->running_state == ubuntu::application::ui::process_destroyed)
3178- {
3179- ALOGI("%s():%d destroyed->running", __PRETTY_FUNCTION__, __LINE__);
3180- /* TODO:
3181- * Resume application with a null archive handler
3182- */
3183- } else if (as->running_state == ubuntu::application::ui::process_stopped)
3184- {
3185- ALOGI("%s():%d stopped->running", __PRETTY_FUNCTION__, __LINE__);
3186- /* TODO:
3187- * Support starting the new process and wait for the
3188- * session to be available to call its delegate
3189- */
3190- return;
3191- } else
3192- {
3193- /* suspended->running
3194- * nothing to do, process image still in memory
3195- */
3196- if (app_manager_task_controller != NULL)
3197- app_manager_task_controller->continue_task(as->remote_pid);
3198- else
3199- kill(as->pid, SIGCONT);
3200- }
3201- as->running_state = ubuntu::application::ui::process_running;
3202- as->on_application_resumed();
3203- update_oom_values(as);
3204- }
3205- break;
3206- case ubuntu::application::ui::process_suspended:
3207- {
3208- ALOGI("%s() state->suspended", __PRETTY_FUNCTION__);
3209- /* TODO: create archive */
3210- as->on_application_about_to_stop();
3211- as->running_state = ubuntu::application::ui::process_suspended;
3212- android::sp<android::Thread> deferred_kill(new ubuntu::application::ProcessKiller(as, app_manager_task_controller));
3213- deferred_kill->run();
3214- update_oom_values(as);
3215- }
3216- break;
3217- case ubuntu::application::ui::process_stopped:
3218- {
3219- ALOGI("%s() state->stopped", __PRETTY_FUNCTION__);
3220- /* TODO:
3221- * This transition occurs while SIGSTOP'd. Check we hold a valid archive
3222- * and then destroy the process image. No need to signal via delegates.
3223- */
3224- as->running_state = ubuntu::application::ui::process_stopped;
3225- }
3226- break;
3227- case ubuntu::application::ui::process_destroyed:
3228- {
3229- ALOGI("%s() state->destroyed", __PRETTY_FUNCTION__);
3230- /* TODO:
3231- * Internal transition: Invalidate archive if any, destroy
3232- * process image.
3233- */
3234- as->running_state = ubuntu::application::ui::process_destroyed;
3235- }
3236- break;
3237- }
3238-}
3239-
3240-void ApplicationManager::start_a_new_session(
3241- int32_t session_type,
3242- int32_t stage_hint,
3243- const android::String8& app_name,
3244- const android::String8& desktop_file,
3245- const android::sp<android::IApplicationManagerSession>& session,
3246- int fd,
3247- uint32_t remote_pid)
3248-{
3249- android::Mutex::Autolock al(guard);
3250- (void) session_type;
3251- pid_t pid = android::IPCThreadState::self()->getCallingPid();
3252-
3253- pid_t rpid;
3254- if (!remote_pid)
3255- {
3256- ALOGI("%s() no remote_pid set from client, lookup in proc", __PRETTY_FUNCTION__);
3257- rpid = pid_to_vpid(pid);
3258- }
3259- else
3260- {
3261- ALOGI("%s() remote_pid=%d", __PRETTY_FUNCTION__, remote_pid);
3262- rpid = static_cast<pid_t>(remote_pid);
3263- }
3264-
3265- ALOGI("%s() starting new session pid=%d rpid=%d", __PRETTY_FUNCTION__, pid, rpid);
3266-
3267- android::sp<ubuntu::detail::ApplicationSession> app_session(
3268- new ubuntu::detail::ApplicationSession(
3269- pid,
3270- rpid,
3271- session,
3272- session_type,
3273- stage_hint,
3274- app_name,
3275- desktop_file));
3276-
3277- apps.add(session->asBinder(), app_session);
3278- apps_as_added.push_back(session->asBinder());
3279-
3280- session->asBinder()->linkToDeath(
3281- android::sp<android::IBinder::DeathRecipient>(this));
3282-
3283- switch(session_type)
3284- {
3285- case ubuntu::application::ui::user_session_type:
3286- ALOGI("%s: Invoked for user_session_type \n", __PRETTY_FUNCTION__);
3287- break;
3288- case ubuntu::application::ui::system_session_type:
3289- ALOGI("%s: Invoked for system_session_type \n", __PRETTY_FUNCTION__);
3290- break;
3291- }
3292-
3293- notify_observers_about_session_born(app_session->remote_pid,
3294- app_session->stage_hint,
3295- app_session->desktop_file);
3296-
3297- ALOGI("%s():%d session", __PRETTY_FUNCTION__, __LINE__);
3298-}
3299-
3300-void ApplicationManager::register_a_surface(
3301- const android::String8& title,
3302- const android::sp<android::IApplicationManagerSession>& session,
3303- int32_t surface_role,
3304- int32_t token,
3305- int fd)
3306-{
3307- android::Mutex::Autolock al(guard);
3308- android::sp<android::InputChannel> input_channel(
3309- new android::InputChannel(
3310- title,
3311- dup(fd)));
3312-
3313- android::sp<ubuntu::detail::ApplicationSession::Surface> surface(
3314- new ubuntu::detail::ApplicationSession::Surface(
3315- apps.valueFor(session->asBinder()).get(),
3316- input_channel,
3317- surface_role,
3318- token));
3319-
3320- auto registered_session = apps.valueFor(session->asBinder());
3321-
3322- ALOGI("Registering input channel as observer: %s",
3323- registered_session->session_type == ubuntu::application::ui::system_session_type ? "true" : "false");
3324-
3325- input_setup->input_manager->getDispatcher()->registerInputChannel(
3326- surface->input_channel,
3327- surface->make_input_window_handle(),
3328- registered_session->session_type == ubuntu::application::ui::system_session_type);
3329-
3330- registered_session->register_surface(surface);
3331-
3332- if (registered_session->session_type == ubuntu::application::ui::system_session_type)
3333- {
3334- ALOGI("New surface for system session, adjusting layer now.");
3335- switch(surface_role)
3336- {
3337- case ubuntu::application::ui::dash_actor_role:
3338- registered_session->raise_surface_to_layer(token, default_dash_layer);
3339- break;
3340- case ubuntu::application::ui::indicator_actor_role:
3341- registered_session->raise_surface_to_layer(token, default_indicator_layer);
3342- break;
3343- case ubuntu::application::ui::notifications_actor_role:
3344- registered_session->raise_surface_to_layer(token, default_notifications_layer);
3345- break;
3346- case ubuntu::application::ui::greeter_actor_role:
3347- registered_session->raise_surface_to_layer(token, default_greeter_layer);
3348- break;
3349- case ubuntu::application::ui::launcher_actor_role:
3350- registered_session->raise_surface_to_layer(token, default_launcher_layer);
3351- break;
3352- case ubuntu::application::ui::on_screen_keyboard_actor_role:
3353- registered_session->raise_surface_to_layer(token, default_osk_layer);
3354- break;
3355- case ubuntu::application::ui::shutdown_dialog_actor_role:
3356- registered_session->raise_surface_to_layer(token, default_shutdown_dialog_layer);
3357- break;
3358- }
3359- }
3360-}
3361-
3362-void ApplicationManager::request_fullscreen(const android::sp<android::IApplicationManagerSession>& session)
3363-{
3364- ALOGI("%s", __PRETTY_FUNCTION__);
3365- android::Mutex::Autolock al(guard);
3366-
3367- const android::sp<ubuntu::detail::ApplicationSession>& as =
3368- apps.valueFor(session->asBinder());
3369-
3370- notify_observers_about_session_requested_fullscreen(
3371- as->remote_pid,
3372- as->stage_hint,
3373- as->desktop_file);
3374-}
3375-
3376-int ApplicationManager::get_session_pid(const android::sp<android::IApplicationManagerSession>& session)
3377-{
3378- ALOGI("%s", __PRETTY_FUNCTION__);
3379- android::Mutex::Autolock al(guard);
3380-
3381- if (apps.indexOfKey(session->asBinder()) == android::NAME_NOT_FOUND)
3382- return 0;
3383-
3384- const android::sp<ubuntu::detail::ApplicationSession>& as =
3385- apps.valueFor(session->asBinder());
3386-
3387- return as->remote_pid;
3388-}
3389-
3390-void ApplicationManager::request_update_for_session(const android::sp<android::IApplicationManagerSession>& session)
3391-{
3392- ALOGI("%s", __PRETTY_FUNCTION__);
3393- android::Mutex::Autolock al(guard);
3394-
3395- if (apps_as_added[focused_application] != session->asBinder())
3396- return;
3397-
3398- const android::sp<ubuntu::detail::ApplicationSession>& as =
3399- apps.valueFor(apps_as_added[focused_application]);
3400-
3401- if (as->session_type == ubuntu::application::ui::system_session_type)
3402- {
3403- input_setup->input_manager->getDispatcher()->setFocusedApplication(
3404- shell_input_setup->shell_application);
3405- android::Vector< android::sp<android::InputWindowHandle> > input_windows;
3406- input_windows.push(shell_input_setup->event_trap_window.input_window);
3407- input_setup->input_manager->getDispatcher()->setInputWindows(
3408- input_windows);
3409- } else
3410- {
3411- input_setup->input_manager->getDispatcher()->setFocusedApplication(
3412- as->input_application_handle());
3413-
3414- android::Vector< android::sp<android::InputWindowHandle> > input_windows;
3415-
3416- if (is_osk_visible)
3417- input_windows.push(shell_input_setup->osk_window.input_window);
3418- if (are_notifications_visible)
3419- input_windows.push(shell_input_setup->notifications_window.input_window);
3420-
3421- if (!shell_input_setup->trap_windows.isEmpty())
3422- {
3423- int key = 0;
3424- for (size_t i = 0; i < shell_input_setup->trap_windows.size(); i++)
3425- {
3426- key = shell_input_setup->trap_windows.keyAt(i);
3427- input_windows.push(shell_input_setup->trap_windows.valueFor(key));
3428- }
3429- }
3430-
3431- input_windows.appendVector(as->input_window_handles());
3432-
3433- if (as->stage_hint == ubuntu::application::ui::side_stage)
3434- {
3435- const android::sp<ubuntu::detail::ApplicationSession>& main_session =
3436- apps.valueFor(apps_as_added[main_stage_application]);
3437- input_windows.appendVector(main_session->input_window_handles());
3438- }
3439-
3440- input_setup->input_manager->getDispatcher()->setInputWindows(
3441- input_windows);
3442- }
3443-}
3444-
3445-void ApplicationManager::register_task_controller(
3446- const android::sp<android::IAMTaskController>& controller)
3447-{
3448- ALOGI("%s() registering task controller", __PRETTY_FUNCTION__);
3449-
3450- //TODO: Register the task controller to use it instead of sigkilling
3451- android::Mutex::Autolock al(guard);
3452-
3453- if (app_manager_task_controller != NULL)
3454- return;
3455-
3456- ALOGI("%s() done registering task controller", __PRETTY_FUNCTION__);
3457-
3458- app_manager_task_controller = controller;
3459-}
3460-
3461-void ApplicationManager::register_an_observer(
3462- const android::sp<android::IApplicationManagerObserver>& observer)
3463-{
3464- android::Mutex::Autolock al(observer_guard);
3465- app_manager_observers.push_back(observer);
3466- {
3467- android::Mutex::Autolock al(guard);
3468-
3469- for(unsigned int i = 0; i < apps_as_added.size(); i++)
3470- {
3471- const android::sp<ubuntu::detail::ApplicationSession>& session =
3472- apps.valueFor(apps_as_added[i]);
3473-
3474- observer->on_session_born(session->remote_pid,
3475- session->stage_hint,
3476- session->desktop_file);
3477- }
3478-
3479- if (focused_application < apps_as_added.size())
3480- {
3481- const android::sp<ubuntu::detail::ApplicationSession>& session =
3482- apps.valueFor(apps_as_added[focused_application]);
3483-
3484- observer->on_session_focused(session->remote_pid,
3485- session->stage_hint,
3486- session->desktop_file);
3487- }
3488- }
3489-}
3490-
3491-void ApplicationManager::focus_running_session_with_id(int id)
3492-{
3493- android::Mutex::Autolock al(guard);
3494-
3495- size_t idx = session_id_to_index(id);
3496-
3497- if (idx < apps_as_added.size())
3498- {
3499- switch_focused_application_locked(idx);
3500- }
3501-}
3502-
3503-void ApplicationManager::unfocus_running_sessions()
3504-{
3505- ALOGI("%s", __PRETTY_FUNCTION__);
3506-
3507- android::Mutex::Autolock al(guard);
3508-
3509- if (shell_input_setup->shell_has_focus)
3510- return;
3511-
3512- input_setup->input_manager->getDispatcher()->setFocusedApplication(
3513- shell_input_setup->shell_application);
3514- android::Vector< android::sp<android::InputWindowHandle> > input_windows;
3515- input_windows.push(shell_input_setup->event_trap_window.input_window);
3516- input_setup->input_manager->getDispatcher()->setInputWindows(
3517- input_windows);
3518-
3519- if (focused_application < apps.size())
3520- {
3521- const android::sp<ubuntu::detail::ApplicationSession>& session =
3522- apps.valueFor(apps_as_added[focused_application]);
3523-
3524- if (session->session_type != ubuntu::application::ui::system_session_type)
3525- {
3526- notify_observers_about_session_unfocused(session->remote_pid,
3527- session->stage_hint,
3528- session->desktop_file);
3529-
3530- if (!is_session_allowed_to_run_in_background(session))
3531- session_set_state(session, ubuntu::application::ui::process_suspended);
3532- }
3533- }
3534- shell_input_setup->shell_has_focus = true;
3535-}
3536-
3537-int32_t ApplicationManager::query_snapshot_layer_for_session_with_id(int id)
3538-{
3539- size_t idx = session_id_to_index(id);
3540-
3541- if (idx < apps_as_added.size())
3542- {
3543- return apps.valueFor(apps_as_added[idx])->layer();
3544- }
3545-
3546- return INT_MAX;
3547-}
3548-
3549-android::IApplicationManagerSession::SurfaceProperties ApplicationManager::query_surface_properties_for_session_id(int id)
3550-{
3551- android::Mutex::Autolock al(guard);
3552-
3553- size_t idx = session_id_to_index(id);
3554- android::IApplicationManagerSession::SurfaceProperties props;
3555- int status;
3556-
3557- if (idx < apps_as_added.size())
3558- {
3559- const android::sp<ubuntu::detail::ApplicationSession>& session =
3560- apps.valueFor(apps_as_added[idx]);
3561-
3562- if (session->running_state == ubuntu::application::ui::process_suspended)
3563- {
3564- kill(session->pid, SIGCONT);
3565- props = session->query_properties();
3566- kill(session->pid, SIGSTOP);
3567- } else {
3568- props = session->query_properties();
3569- }
3570-
3571- return props;
3572- }
3573-
3574- return android::IApplicationManagerSession::SurfaceProperties();
3575-}
3576-
3577-void ApplicationManager::switch_to_well_known_application(int32_t app)
3578-{
3579- notify_observers_about_session_requested(app);
3580-}
3581-
3582-int32_t ApplicationManager::set_surface_trap(int x, int y, int width, int height)
3583-{
3584- static int32_t key = 0;
3585-
3586- ApplicationManager::ShellInputSetup::Window<0, 0, 2048, 2048>* w =
3587- new ApplicationManager::ShellInputSetup::Window<0, 0, 2048, 2048>(shell_input_setup.get(), x, y, width, height);
3588-
3589- key++;
3590- shell_input_setup->trap_windows.add(key, w->input_window);
3591-
3592- update_input_setup_locked();
3593-
3594- return key;
3595-}
3596-
3597-void ApplicationManager::unset_surface_trap(int32_t handle)
3598-{
3599- shell_input_setup->trap_windows.removeItem(handle);
3600-
3601- update_input_setup_locked();
3602-}
3603-
3604-void ApplicationManager::report_osk_visible(int32_t x, int32_t y, int32_t width, int32_t height)
3605-{
3606- ALOGI("%s(x=%d, y=%d, width=%d, height=%d)", __PRETTY_FUNCTION__, x, y, width, height);
3607-
3608- shell_input_setup->osk_window.input_window->x = x;
3609- shell_input_setup->osk_window.input_window->y = y;
3610- shell_input_setup->osk_window.input_window->w = width;
3611- shell_input_setup->osk_window.input_window->h = height;
3612-
3613- android::Mutex::Autolock al(guard);
3614- is_osk_visible = true;
3615-
3616- update_input_setup_locked();
3617-
3618- notify_observers_about_keyboard_geometry_changed(x, y, width, height);
3619-}
3620-
3621-void ApplicationManager::report_osk_invisible()
3622-{
3623- ALOGI("%s", __PRETTY_FUNCTION__);
3624- android::Mutex::Autolock al(guard);
3625- is_osk_visible = false;
3626-
3627- update_input_setup_locked();
3628-
3629- notify_observers_about_keyboard_geometry_changed(0, 0, 0, 0);
3630-}
3631-
3632-void ApplicationManager::report_notification_visible()
3633-{
3634- ALOGI("%s", __PRETTY_FUNCTION__);
3635- android::Mutex::Autolock al(guard);
3636- are_notifications_visible = true;
3637-
3638- update_input_setup_locked();
3639-}
3640-
3641-void ApplicationManager::report_notification_invisible()
3642-{
3643- ALOGI("%s", __PRETTY_FUNCTION__);
3644- android::Mutex::Autolock al(guard);
3645- are_notifications_visible = false;
3646-
3647- update_input_setup_locked();
3648-}
3649-
3650-void ApplicationManager::update_input_setup_locked()
3651-{
3652- if (focused_application >= apps.size())
3653- return;
3654-
3655- const android::sp<ubuntu::detail::ApplicationSession>& session =
3656- apps.valueFor(apps_as_added[focused_application]);
3657-
3658- if (shell_input_setup->shell_has_focus)
3659- {
3660- input_setup->input_manager->getDispatcher()->setFocusedApplication(
3661- shell_input_setup->shell_application);
3662-
3663- android::Vector< android::sp<android::InputWindowHandle> > input_windows;
3664- input_windows.push(shell_input_setup->event_trap_window.input_window);
3665-
3666- input_setup->input_manager->getDispatcher()->setInputWindows(
3667- input_windows);
3668- } else
3669- {
3670- ALOGI("Adjusting input setup to account for change in visibility of osk/notifications");
3671-
3672- input_setup->input_manager->getDispatcher()->setFocusedApplication(
3673- session->input_application_handle());
3674-
3675- android::Vector< android::sp<android::InputWindowHandle> > input_windows;
3676- if (is_osk_visible)
3677- input_windows.push(shell_input_setup->osk_window.input_window);
3678- if (are_notifications_visible)
3679- input_windows.push(shell_input_setup->notifications_window.input_window);
3680- if (!shell_input_setup->trap_windows.isEmpty())
3681- {
3682- int key = 0;
3683- for (size_t i = 0; i < shell_input_setup->trap_windows.size(); i++)
3684- {
3685- key = shell_input_setup->trap_windows.keyAt(i);
3686- input_windows.push(shell_input_setup->trap_windows.valueFor(key));
3687- }
3688- }
3689-
3690- android::sp<android::IBinder> sb = apps_as_added[focused_application];
3691-
3692- if (sb->isBinderAlive())
3693- input_windows.appendVector(session->input_window_handles());
3694-
3695- if (session->stage_hint == ubuntu::application::ui::side_stage)
3696- {
3697- const android::sp<ubuntu::detail::ApplicationSession>& main_session =
3698- apps.valueFor(apps_as_added[main_stage_application]);
3699-
3700- android::sp<android::IBinder> msb = apps_as_added[focused_application];
3701- if (msb->isBinderAlive())
3702- {
3703- input_windows.appendVector(main_session->input_window_handles());
3704- }
3705- }
3706-
3707- input_setup->input_manager->getDispatcher()->setInputWindows(
3708- input_windows);
3709- }
3710-}
3711-
3712-void ApplicationManager::switch_focused_application_locked(size_t index_of_next_focused_app)
3713-{
3714- static int focused_layer = 0;
3715- static const int focused_layer_increment = 10;
3716-
3717- if (apps.size() > 1 &&
3718- focused_application < apps.size() &&
3719- focused_application < apps_as_added.size() &&
3720- focused_application != index_of_next_focused_app)
3721- {
3722- ALOGI("Lowering current application now for idx: %d \n", focused_application);
3723- const android::sp<ubuntu::detail::ApplicationSession>& session =
3724- apps.valueFor(apps_as_added[focused_application]);
3725-
3726- const android::sp<ubuntu::detail::ApplicationSession>& next_session =
3727- apps.valueFor(apps_as_added[index_of_next_focused_app]);
3728-
3729- if (next_session->session_type == ubuntu::application::ui::system_session_type)
3730- return;
3731-
3732- if (session->session_type != ubuntu::application::ui::system_session_type)
3733- {
3734- // Stop the session
3735- if (!is_session_allowed_to_run_in_background(session))
3736- {
3737- if ((session->stage_hint == ubuntu::application::ui::main_stage &&
3738- next_session->stage_hint != ubuntu::application::ui::side_stage) ||
3739- (session->stage_hint == ubuntu::application::ui::side_stage &&
3740- next_session->stage_hint != ubuntu::application::ui::main_stage))
3741- {
3742- notify_observers_about_session_unfocused(session->remote_pid,
3743- session->stage_hint,
3744- session->desktop_file);
3745-
3746- session_set_state(session, ubuntu::application::ui::process_suspended);
3747- } else
3748- {
3749- if (session->stage_hint == ubuntu::application::ui::side_stage &&
3750- next_session->stage_hint == ubuntu::application::ui::main_stage &&
3751- main_stage_application < apps.size())
3752- {
3753- const android::sp<ubuntu::detail::ApplicationSession>& main_session =
3754- apps.valueFor(apps_as_added[main_stage_application]);
3755-
3756- if (main_session->session_type != ubuntu::application::ui::system_session_type)
3757- session_set_state(main_session, ubuntu::application::ui::process_suspended);
3758- }
3759- }
3760- }
3761- }
3762- }
3763-
3764- focused_application = index_of_next_focused_app;
3765- is_osk_visible = false;
3766- notify_observers_about_keyboard_geometry_changed(0, 0, 0, 0);
3767-
3768- if (focused_application < apps.size())
3769- {
3770-
3771- focused_layer += focused_layer_increment;
3772-
3773- const android::sp<ubuntu::detail::ApplicationSession>& session =
3774- apps.valueFor(apps_as_added[focused_application]);
3775-
3776- ALOGI("Raising application now for idx: %d (stage_hint: %d)\n", focused_application, session->stage_hint);
3777-
3778- if (session->session_type == ubuntu::application::ui::system_session_type)
3779- {
3780- ALOGI("\t system session - not raising it.");
3781- return;
3782- }
3783-
3784- // Continue the session
3785- if (!is_session_allowed_to_run_in_background(session))
3786- session_set_state(session, ubuntu::application::ui::process_running);
3787-
3788- if (session->stage_hint == ubuntu::application::ui::side_stage)
3789- side_stage_application = focused_application;
3790- else
3791- main_stage_application = focused_application;
3792-
3793- session->raise_application_surfaces_to_layer(focused_layer);
3794- input_setup->input_manager->getDispatcher()->setFocusedApplication(
3795- session->input_application_handle());
3796-
3797- android::Vector< android::sp<android::InputWindowHandle> > input_windows;
3798-
3799- if (are_notifications_visible)
3800- input_windows.push(shell_input_setup->notifications_window.input_window);
3801- if (!shell_input_setup->trap_windows.isEmpty())
3802- {
3803- int key = 0;
3804- for (size_t i = 0; i < shell_input_setup->trap_windows.size(); i++)
3805- {
3806- key = shell_input_setup->trap_windows.keyAt(i);
3807- input_windows.push(shell_input_setup->trap_windows.valueFor(key));
3808- }
3809- }
3810-
3811- input_windows.appendVector(session->input_window_handles());
3812-
3813- if (session->stage_hint == ubuntu::application::ui::side_stage)
3814- {
3815- if (main_stage_application)
3816- {
3817- const android::sp<ubuntu::detail::ApplicationSession>& main_session =
3818- apps.valueFor(apps_as_added[main_stage_application]);
3819- session_set_state(main_session, ubuntu::application::ui::process_running);
3820- input_windows.appendVector(main_session->input_window_handles());
3821- }
3822- }
3823-
3824- input_setup->input_manager->getDispatcher()->setInputWindows(
3825- input_windows);
3826-
3827- notify_observers_about_session_focused(session->remote_pid,
3828- session->stage_hint,
3829- session->desktop_file);
3830-
3831- shell_input_setup->shell_has_focus = false;
3832- }
3833-}
3834-
3835-void ApplicationManager::switch_focus_to_next_application_locked()
3836-{
3837- size_t new_idx = (focused_application + 1) % apps.size();
3838-
3839- ALOGI("current: %d, next: %d \n", focused_application, new_idx);
3840-
3841- switch_focused_application_locked(new_idx);
3842-}
3843-
3844-void ApplicationManager::kill_focused_application_locked()
3845-{
3846- if (focused_application < apps.size())
3847- {
3848- const android::sp<ubuntu::detail::ApplicationSession>& session =
3849- apps.valueFor(apps_as_added[focused_application]);
3850-
3851- kill(session->pid, SIGKILL);
3852- }
3853-}
3854-
3855-size_t ApplicationManager::session_id_to_index(int id)
3856-{
3857- size_t idx = 0;
3858-
3859- for(idx = 0; idx < apps_as_added.size(); idx++)
3860- {
3861- const android::sp<ubuntu::detail::ApplicationSession>& session =
3862- apps.valueFor(apps_as_added[idx]);
3863-
3864- if (session->remote_pid == id)
3865- break;
3866- }
3867-
3868- return idx;
3869-}
3870-
3871-void ApplicationManager::notify_observers_about_session_requested(uint32_t app)
3872-{
3873- android::Mutex::Autolock al(observer_guard);
3874- for(unsigned int i = 0; i < app_manager_observers.size(); i++)
3875- {
3876- app_manager_observers[i]->on_session_requested(app);
3877- }
3878-}
3879-
3880-void ApplicationManager::notify_observers_about_session_born(int id, int stage_hint, const android::String8& desktop_file)
3881-{
3882- android::Mutex::Autolock al(observer_guard);
3883- for(unsigned int i = 0; i < app_manager_observers.size(); i++)
3884- {
3885- app_manager_observers[i]->on_session_born(id, stage_hint, desktop_file);
3886- }
3887-}
3888-
3889-void ApplicationManager::notify_observers_about_session_unfocused(int id, int stage_hint, const android::String8& desktop_file)
3890-{
3891- android::Mutex::Autolock al(observer_guard);
3892- for(unsigned int i = 0; i < app_manager_observers.size(); i++)
3893- {
3894- app_manager_observers[i]->on_session_unfocused(id, stage_hint, desktop_file);
3895- }
3896-}
3897-
3898-void ApplicationManager::notify_observers_about_session_focused(int id, int stage_hint, const android::String8& desktop_file)
3899-{
3900- android::Mutex::Autolock al(observer_guard);
3901- for(unsigned int i = 0; i < app_manager_observers.size(); i++)
3902- {
3903- app_manager_observers[i]->on_session_focused(id, stage_hint, desktop_file);
3904- }
3905-}
3906-
3907-void ApplicationManager::notify_observers_about_keyboard_geometry_changed(int x, int y, int width, int height)
3908-{
3909- android::Mutex::Autolock al(observer_guard);
3910- for(unsigned int i = 0; i < app_manager_observers.size(); i++)
3911- {
3912- app_manager_observers[i]->on_keyboard_geometry_changed(x, y, width, height);
3913- }
3914-}
3915-
3916-void ApplicationManager::notify_observers_about_session_requested_fullscreen(int id, int stage_hint, const android::String8& desktop_file)
3917-{
3918- android::Mutex::Autolock al(observer_guard);
3919- for(unsigned int i = 0; i < app_manager_observers.size(); i++)
3920- {
3921- app_manager_observers[i]->on_session_requested_fullscreen(id, stage_hint, desktop_file);
3922- }
3923-}
3924-
3925-void ApplicationManager::notify_observers_about_session_died(int id, int stage_hint, const android::String8& desktop_file)
3926-{
3927- android::Mutex::Autolock al(observer_guard);
3928- for(unsigned int i = 0; i < app_manager_observers.size(); i++)
3929- {
3930- app_manager_observers[i]->on_session_died(id, stage_hint, desktop_file);
3931- }
3932-}
3933-
3934-struct ClipboardService : public android::BnClipboardService
3935-{
3936- void set_content(const android::IClipboardService::Content& content)
3937- {
3938- this->content = content;
3939- }
3940-
3941- void get_content(android::IClipboardService::Content& content)
3942- {
3943- content = this->content;
3944- }
3945-
3946- android::IClipboardService::Content content;
3947-};
3948-
3949-}
3950-}
3951-int main(int argc, char** argv)
3952-{
3953- android::sp<ubuntu::detail::ApplicationManager> app_manager(new ubuntu::detail::ApplicationManager());
3954- android::sp<ubuntu::detail::ClipboardService> clipboard_service(new ubuntu::detail::ClipboardService());
3955- // Register service
3956- android::sp<android::IServiceManager> service_manager = android::defaultServiceManager();
3957- if (android::NO_ERROR != service_manager->addService(
3958- android::String16(android::IApplicationManager::exported_service_name()),
3959- app_manager))
3960- {
3961- return EXIT_FAILURE;
3962- }
3963-
3964- if (android::NO_ERROR != service_manager->addService(
3965- android::String16(android::IClipboardService::exported_service_name()),
3966- clipboard_service))
3967- {
3968- return EXIT_FAILURE;
3969- }
3970-
3971- android::ProcessState::self()->startThreadPool();
3972- android::IPCThreadState::self()->joinThreadPool();
3973-}
3974
3975=== removed file 'android/hybris/default_application_manager.h'
3976--- android/hybris/default_application_manager.h 2014-01-22 05:28:18 +0000
3977+++ android/hybris/default_application_manager.h 1970-01-01 00:00:00 +0000
3978@@ -1,255 +0,0 @@
3979-/*
3980- * Copyright © 2012 Canonical Ltd.
3981- *
3982- * This program is free software: you can redistribute it and/or modify
3983- * it under the terms of the GNU Lesser General Public License version 3 as
3984- * published by the Free Software Foundation.
3985- *
3986- * This program is distributed in the hope that it will be useful,
3987- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3988- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3989- * GNU Lesser General Public License for more details.
3990- *
3991- * You should have received a copy of the GNU Lesser General Public License
3992- * along with this program. If not, see <http://www.gnu.org/licenses/>.
3993- *
3994- * Authored by: Thomas Voß <thomas.voss@canonical.com>
3995- */
3996-#ifndef DEFAULT_APPLICATION_MANAGER_H_
3997-#define DEFAULT_APPLICATION_MANAGER_H_
3998-
3999-#include "application_manager.h"
4000-#include "default_application_manager_input_setup.h"
4001-#include "default_application_session.h"
4002-#include "event_loop.h"
4003-#include "lifecycle_helpers.h"
4004-
4005-#include <binder/IPCThreadState.h>
4006-#include <binder/IServiceManager.h>
4007-#include <binder/ProcessState.h>
4008-
4009-#include <input/InputListener.h>
4010-#include <input/InputReader.h>
4011-#if ANDROID_VERSION_MAJOR==4 && ANDROID_VERSION_MINOR<=2
4012-#include <androidfw/InputTransport.h>
4013-#else
4014-#include <input/InputTransport.h>
4015-#endif
4016-#include <utils/threads.h>
4017-
4018-namespace ubuntu { namespace detail
4019-{
4020-struct ApplicationManager :
4021- public android::BnApplicationManager,
4022- public android::IBinder::DeathRecipient
4023-{
4024- static const int default_shell_component_layer = 1000000;
4025-
4026- static const int default_dash_layer = default_shell_component_layer + 1;
4027- static const int default_indicator_layer = default_shell_component_layer + 2;
4028- static const int default_notifications_layer = default_shell_component_layer + 3;
4029- static const int default_greeter_layer = default_shell_component_layer + 4;
4030- static const int default_launcher_layer = default_shell_component_layer + 5;
4031- static const int default_osk_layer = default_shell_component_layer + 6;
4032- static const int default_shutdown_dialog_layer = default_shell_component_layer + 7;
4033-
4034- static const int focused_application_base_layer = 100;
4035- static const int wallpaper_layer = 0;
4036- static const int non_focused_application_layer = -1;
4037-
4038- struct ShellInputSetup : public android::RefBase
4039- {
4040- struct DisplayInfo
4041- {
4042- DisplayInfo();
4043-
4044- android::DisplayInfo info;
4045- };
4046-
4047- template<int x, int y, int w, int h>
4048- struct Window : public android::RefBase
4049- {
4050- static int looper_callback(int receiveFd, int events, void* ctxt);
4051-
4052- Window(ShellInputSetup* parent,
4053- int _x = x,
4054- int _y = y,
4055- int _w = w,
4056- int _h = h);
4057-
4058- android::sp<android::InputSetup::DummyApplicationWindow> input_window;
4059-
4060- ShellInputSetup* parent;
4061- android::sp<android::InputChannel> server_channel;
4062- android::sp<android::InputChannel> client_channel;
4063- android::InputConsumer input_consumer;
4064- android::PreallocatedInputEventFactory event_factory;
4065- };
4066-
4067- ShellInputSetup(const android::sp<android::InputManager>& input_manager);
4068-
4069- bool shell_has_focus;
4070-
4071- DisplayInfo display_info;
4072-
4073- android::sp<android::InputManager> input_manager;
4074- android::sp<android::InputApplicationHandle> shell_application;
4075-
4076- android::sp<android::Looper> looper;
4077- ubuntu::application::EventLoop event_loop;
4078-
4079- android::KeyedVector<int32_t, android::sp<android::InputWindowHandle> > trap_windows;
4080-
4081- // TODO(tvoss): Get rid of hard coded values.
4082- Window<0, 0, 720, 1280> event_trap_window;
4083- // TODO(tvoss): This is really hacky, but we need to
4084- // synchronize/reflect state changes across multiple processes
4085- // here, i.e.:
4086- // * maliit-server, which takes care of hiding and showing the osk
4087- // * notify-osd, which takes care of hiding and showing notifications
4088- Window<0, 812, 720, 468> osk_window;
4089- Window<36, 18, 684, 216> notifications_window;
4090- };
4091-
4092- class InputFilter : public android::InputFilter
4093- {
4094- public:
4095- InputFilter(ApplicationManager* manager);
4096-
4097- bool filter_event(const android::InputEvent* event);
4098-
4099- private:
4100- ApplicationManager* manager;
4101-
4102- bool handle_key_event(const android::KeyEvent* event);
4103- };
4104-
4105- class LockingIterator : public android::RefBase
4106- {
4107- public:
4108- void advance() ;
4109-
4110- bool is_valid() const;
4111-
4112- void make_current();
4113-
4114- const android::sp<ubuntu::detail::ApplicationSession>& operator*();
4115-
4116- protected:
4117- friend class ApplicationManager;
4118-
4119- LockingIterator(
4120- ApplicationManager* manager,
4121- size_t index);
4122-
4123- virtual ~LockingIterator();
4124-
4125- private:
4126- ApplicationManager* manager;
4127- size_t it;
4128- };
4129-
4130- ApplicationManager();
4131-
4132- void update_app_lists();
4133-
4134- // From DeathRecipient
4135- void binderDied(const android::wp<android::IBinder>& who);
4136-
4137- void lock();
4138-
4139- void unlock();
4140-
4141- android::sp<LockingIterator> iterator();
4142-
4143- void session_set_state(const android::sp<ubuntu::detail::ApplicationSession>& session,
4144- int32_t new_state);
4145-
4146- void start_a_new_session(
4147- int32_t session_type,
4148- int32_t stage_hint,
4149- const android::String8& app_name,
4150- const android::String8& desktop_file,
4151- const android::sp<android::IApplicationManagerSession>& session,
4152- int fd,
4153- uint32_t remote_pid);
4154-
4155- void register_a_surface(
4156- const android::String8& title,
4157- const android::sp<android::IApplicationManagerSession>& session,
4158- int32_t surface_role,
4159- int32_t token,
4160- int fd);
4161-
4162- void request_fullscreen(const android::sp<android::IApplicationManagerSession>& session);
4163-
4164- void register_an_observer(const android::sp<android::IApplicationManagerObserver>& observer);
4165-
4166- void register_task_controller(const android::sp<android::IAMTaskController>& controller);
4167-
4168- int get_session_pid(const android::sp<android::IApplicationManagerSession>& session);
4169-
4170- void request_update_for_session(const android::sp<android::IApplicationManagerSession>& session);
4171-
4172- void focus_running_session_with_id(int id);
4173-
4174- void unfocus_running_sessions();
4175-
4176- int32_t query_snapshot_layer_for_session_with_id(int id);
4177-
4178- android::IApplicationManagerSession::SurfaceProperties query_surface_properties_for_session_id(int id);
4179-
4180- void switch_to_well_known_application(int32_t app);
4181-
4182- int32_t set_surface_trap(int32_t x, int32_t y, int32_t width, int32_t height);
4183-
4184- void unset_surface_trap(int32_t handle);
4185-
4186- void report_osk_visible(int32_t x, int32_t y, int32_t width, int32_t height);
4187-
4188- void report_osk_invisible();
4189-
4190- void report_notification_visible();
4191-
4192- void report_notification_invisible();
4193-
4194- void switch_focused_application_locked(size_t index_of_next_focused_app);
4195- void switch_focus_to_next_application_locked();
4196-
4197- void kill_focused_application_locked();
4198-
4199- private:
4200- void update_input_setup_locked();
4201-
4202- size_t session_id_to_index(int id);
4203- void notify_observers_about_session_requested(uint32_t app);
4204- void notify_observers_about_session_born(int id, int stage_hint, const android::String8& desktop_file);
4205- void notify_observers_about_session_unfocused(int id, int stage_hint, const android::String8& desktop_file);
4206- void notify_observers_about_session_focused(int id, int stage_hint, const android::String8& desktop_file);
4207- void notify_observers_about_keyboard_geometry_changed(int x, int y, int width, int height);
4208- void notify_observers_about_session_requested_fullscreen(int id, int stage_hint, const android::String8& desktop_file);
4209- void notify_observers_about_session_died(int id, int stage_hint, const android::String8& desktop_file);
4210-
4211- android::sp<android::InputListenerInterface> input_listener;
4212- android::sp<InputFilter> input_filter;
4213- android::sp<android::InputSetup> input_setup;
4214- android::sp<ShellInputSetup> shell_input_setup;
4215- bool is_osk_visible;
4216- bool are_notifications_visible;
4217- android::Condition state_cond;
4218- android::Mutex state_lock;
4219- android::Mutex guard;
4220- android::KeyedVector< android::sp<android::IBinder>, android::sp<ubuntu::detail::ApplicationSession> > apps;
4221- android::Vector< android::sp<android::IBinder> > apps_as_added;
4222- android::Mutex observer_guard;
4223- android::Vector< android::sp<android::IApplicationManagerObserver> > app_manager_observers;
4224- android::sp<android::IAMTaskController> app_manager_task_controller;
4225- size_t focused_application;
4226- size_t side_stage_application;
4227- size_t main_stage_application;
4228-};
4229-
4230-}
4231-}
4232-
4233-#endif // DEFAULT_APPLICATION_MANAGER_H_
4234
4235=== removed file 'android/hybris/default_application_manager_input_setup.h'
4236--- android/hybris/default_application_manager_input_setup.h 2014-01-22 05:28:18 +0000
4237+++ android/hybris/default_application_manager_input_setup.h 1970-01-01 00:00:00 +0000
4238@@ -1,452 +0,0 @@
4239-/*
4240- * Copyright © 2012 Canonical Ltd.
4241- *
4242- * This program is free software: you can redistribute it and/or modify
4243- * it under the terms of the GNU Lesser General Public License version 3 as
4244- * published by the Free Software Foundation.
4245- *
4246- * This program is distributed in the hope that it will be useful,
4247- * but WITHOUT ANY WARRANTY; without even the implied warranty of
4248- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4249- * GNU Lesser General Public License for more details.
4250- *
4251- * You should have received a copy of the GNU Lesser General Public License
4252- * along with this program. If not, see <http://www.gnu.org/licenses/>.
4253- *
4254- * Authored by: Thomas Voß <thomas.voss@canonical.com>
4255- */
4256-#ifndef DEFAULT_APPLICATION_MANAGER_INPUT_SETUP_H_
4257-#define DEFAULT_APPLICATION_MANAGER_INPUT_SETUP_H_
4258-
4259-#include <input/InputDispatcher.h>
4260-#include <input/InputListener.h>
4261-#include <input/InputManager.h>
4262-#include <input/InputReader.h>
4263-#include <input/PointerController.h>
4264-#include <input/SpriteController.h>
4265-#include <gui/ISurfaceComposer.h>
4266-#include <gui/SurfaceComposerClient.h>
4267-
4268-#include <cstdio>
4269-
4270-#define REPORT_FUNCTION_CALL()// printf("%s \n", __PRETTY_FUNCTION__);
4271-
4272-namespace android
4273-{
4274-class DefaultPointerControllerPolicy : public android::PointerControllerPolicyInterface
4275-{
4276-public:
4277-
4278- static const size_t bitmap_width = 64;
4279- static const size_t bitmap_height = 64;
4280-
4281- DefaultPointerControllerPolicy()
4282- {
4283- bitmap.setConfig(
4284- SkBitmap::kARGB_8888_Config,
4285- bitmap_width,
4286- bitmap_height);
4287- bitmap.allocPixels();
4288-
4289- // Icon for spot touches
4290- bitmap.eraseARGB(125, 0, 255, 0);
4291- spotTouchIcon = android::SpriteIcon(
4292- bitmap,
4293- bitmap_width/2,
4294- bitmap_height/2);
4295- // Icon for anchor touches
4296- bitmap.eraseARGB(125, 0, 0, 255);
4297- spotAnchorIcon = android::SpriteIcon(
4298- bitmap,
4299- bitmap_width/2,
4300- bitmap_height/2);
4301- // Icon for hovering touches
4302- bitmap.eraseARGB(125, 255, 0, 0);
4303- spotHoverIcon = android::SpriteIcon(
4304- bitmap,
4305- bitmap_width/2,
4306- bitmap_height/2);
4307- }
4308-
4309- void loadPointerResources(android::PointerResources* outResources)
4310- {
4311- outResources->spotHover = spotHoverIcon.copy();
4312- outResources->spotTouch = spotTouchIcon.copy();
4313- outResources->spotAnchor = spotAnchorIcon.copy();
4314- }
4315-
4316- android::SpriteIcon spotHoverIcon;
4317- android::SpriteIcon spotTouchIcon;
4318- android::SpriteIcon spotAnchorIcon;
4319- SkBitmap bitmap;
4320-};
4321-
4322-class DefaultInputReaderPolicyInterface : public android::InputReaderPolicyInterface
4323-{
4324-public:
4325- static const int32_t internal_display_id = android::ISurfaceComposer::eDisplayIdMain;
4326- static const int32_t external_display_id = android::ISurfaceComposer::eDisplayIdHdmi;
4327-
4328- DefaultInputReaderPolicyInterface(const android::sp<android::Looper>& looper)
4329- : looper(looper),
4330- default_layer_for_touch_point_visualization(INT_MAX)
4331- {
4332- default_configuration.showTouches = false;
4333-
4334- auto display = android::SurfaceComposerClient::getBuiltInDisplay(
4335- android::ISurfaceComposer::eDisplayIdMain);
4336- android::DisplayInfo info;
4337- android::SurfaceComposerClient::getDisplayInfo(
4338- display,
4339- &info);
4340-
4341- android::DisplayViewport viewport;
4342- viewport.setNonDisplayViewport(info.w, info.h);
4343- viewport.displayId = android::ISurfaceComposer::eDisplayIdMain;
4344- default_configuration.setDisplayInfo(
4345- false, /* external */
4346- viewport);
4347-
4348- }
4349-
4350- void getReaderConfiguration(android::InputReaderConfiguration* outConfig)
4351- {
4352- *outConfig = default_configuration;
4353- }
4354-
4355- android::sp<android::PointerControllerInterface> obtainPointerController(int32_t deviceId)
4356- {
4357- (void) deviceId;
4358-
4359- android::sp<android::SpriteController> sprite_controller(
4360- new android::SpriteController(
4361- looper,
4362- default_layer_for_touch_point_visualization));
4363- android::sp<android::PointerController> pointer_controller(
4364- new android::PointerController(
4365- android::sp<DefaultPointerControllerPolicy>(new DefaultPointerControllerPolicy()),
4366- looper,
4367- sprite_controller));
4368- pointer_controller->setPresentation(
4369- android::PointerControllerInterface::PRESENTATION_SPOT);
4370- int32_t w, h, o;
4371- auto display = android::SurfaceComposerClient::getBuiltInDisplay(
4372- android::ISurfaceComposer::eDisplayIdMain);
4373- android::DisplayInfo info;
4374- android::SurfaceComposerClient::getDisplayInfo(
4375- display,
4376- &info);
4377-
4378- pointer_controller->setDisplayViewport(info.w, info.h, info.orientation);
4379- return pointer_controller;
4380- }
4381-
4382- virtual void notifyInputDevicesChanged(const Vector<InputDeviceInfo>& inputDevices) {
4383- mInputDevices = inputDevices;
4384- }
4385-
4386- virtual sp<KeyCharacterMap> getKeyboardLayoutOverlay(const String8& inputDeviceDescriptor) {
4387- return NULL;
4388- }
4389-
4390- virtual String8 getDeviceAlias(const InputDeviceIdentifier& identifier) {
4391- return String8::empty();
4392- }
4393-private:
4394- android::sp<android::Looper> looper;
4395- int default_layer_for_touch_point_visualization;
4396- android::InputReaderConfiguration default_configuration;
4397- Vector<InputDeviceInfo> mInputDevices;
4398-};
4399-
4400-class InputFilter : public android::RefBase
4401-{
4402-public:
4403- virtual bool filter_event(const android::InputEvent* event) = 0;
4404-
4405-protected:
4406- InputFilter() {}
4407- virtual ~InputFilter() {}
4408-
4409- InputFilter(const InputFilter&) = delete;
4410- InputFilter& operator=(const InputFilter&) = delete;
4411-};
4412-
4413-class DefaultInputDispatcherPolicy : public InputDispatcherPolicyInterface
4414-{
4415-public:
4416- DefaultInputDispatcherPolicy(const android::sp<InputFilter>& input_filter)
4417- : input_filter(input_filter)
4418- {
4419- }
4420-
4421- ~DefaultInputDispatcherPolicy()
4422- {
4423- }
4424-
4425- void notifyConfigurationChanged(nsecs_t when)
4426- {
4427- REPORT_FUNCTION_CALL();
4428- (void) when;
4429- }
4430-
4431- nsecs_t notifyANR(const sp<InputApplicationHandle>& inputApplicationHandle,
4432-#if ANDROID_VERSION_MAJOR==4 && ANDROID_VERSION_MINOR<4
4433- const sp<InputWindowHandle>& inputWindowHandle)
4434-#else
4435- const sp<InputWindowHandle>& inputWindowHandle,
4436- const android::String8& reason)
4437-#endif
4438- {
4439- REPORT_FUNCTION_CALL();
4440- (void) inputApplicationHandle;
4441- (void) inputWindowHandle;
4442-#if ANDROID_VERSION_MAJOR==4 && ANDROID_VERSION_MINOR>=4
4443- (void) reason;
4444-#endif
4445-
4446- return 0;
4447- }
4448-
4449- void notifyInputChannelBroken(const sp<InputWindowHandle>& inputWindowHandle)
4450- {
4451- REPORT_FUNCTION_CALL();
4452- (void) inputWindowHandle;
4453- }
4454-
4455- void getDispatcherConfiguration(InputDispatcherConfiguration* outConfig)
4456- {
4457- REPORT_FUNCTION_CALL();
4458- static InputDispatcherConfiguration config;
4459- //config.maxEventsPerSecond = INT_MAX;
4460- *outConfig = config;
4461- }
4462-
4463- bool isKeyRepeatEnabled()
4464- {
4465- REPORT_FUNCTION_CALL();
4466- return true;
4467- }
4468-
4469- bool filterInputEvent(const InputEvent* event, uint32_t policyFlags)
4470- {
4471- REPORT_FUNCTION_CALL();
4472- (void) event;
4473- (void) policyFlags;
4474- return input_filter->filter_event(event);
4475- }
4476-
4477- void interceptKeyBeforeQueueing(const KeyEvent* event, uint32_t& policyFlags)
4478- {
4479- REPORT_FUNCTION_CALL();
4480- (void) event;
4481- policyFlags |= POLICY_FLAG_PASS_TO_USER;
4482- }
4483-
4484- void interceptMotionBeforeQueueing(nsecs_t when, uint32_t& policyFlags)
4485- {
4486- REPORT_FUNCTION_CALL();
4487- (void) when;
4488- (void) policyFlags;
4489- policyFlags |= POLICY_FLAG_PASS_TO_USER;
4490- }
4491-
4492- nsecs_t interceptKeyBeforeDispatching(
4493- const sp<InputWindowHandle>& inputWindowHandle,
4494- const KeyEvent* keyEvent,
4495- uint32_t policyFlags)
4496- {
4497- REPORT_FUNCTION_CALL();
4498- (void) inputWindowHandle;
4499- (void) keyEvent;
4500- (void) policyFlags;
4501-
4502- return 0;
4503- }
4504-
4505- bool dispatchUnhandledKey(
4506- const sp<InputWindowHandle>& inputWindowHandle,
4507- const KeyEvent* keyEvent,
4508- uint32_t policyFlags,
4509- KeyEvent* outFallbackKeyEvent)
4510- {
4511- REPORT_FUNCTION_CALL();
4512- (void) inputWindowHandle;
4513- (void) keyEvent;
4514- (void) policyFlags;
4515- (void) outFallbackKeyEvent;
4516- return false;
4517- }
4518-
4519- virtual void notifySwitch(
4520- nsecs_t when,
4521- uint32_t switchCode,
4522- uint32_t switchValue,
4523- uint32_t policyFlags)
4524- {
4525- REPORT_FUNCTION_CALL();
4526- (void) when;
4527- (void) switchCode;
4528- (void) switchValue;
4529- (void) policyFlags;
4530- }
4531-
4532- void pokeUserActivity(nsecs_t eventTime, int32_t eventType)
4533- {
4534- REPORT_FUNCTION_CALL();
4535- (void) eventTime;
4536- (void) eventType;
4537- }
4538-
4539- bool checkInjectEventsPermissionNonReentrant(
4540- int32_t injectorPid,
4541- int32_t injectorUid)
4542- {
4543- REPORT_FUNCTION_CALL();
4544- (void) injectorPid;
4545- (void) injectorUid;
4546-
4547- return true;
4548- }
4549-
4550- android::sp<InputFilter> input_filter;
4551-};
4552-
4553-class LooperThread : public android::Thread
4554-{
4555-public:
4556- static const int default_poll_timeout_ms = 500;
4557-
4558- LooperThread(const android::sp<android::Looper>& looper) : looper(looper)
4559- {
4560- }
4561-
4562-private:
4563- bool threadLoop()
4564- {
4565- if (ALOOPER_POLL_ERROR == looper->pollAll(default_poll_timeout_ms))
4566- return false;
4567- return true;
4568- }
4569-
4570- android::sp<android::Looper> looper;
4571-};
4572-
4573-struct InputSetup : public android::RefBase
4574-{
4575- struct DummyApplication : public android::InputApplicationHandle
4576- {
4577- bool updateInfo()
4578- {
4579- ALOGI("%s", __PRETTY_FUNCTION__);
4580- if (mInfo == NULL)
4581- {
4582- mInfo = new android::InputApplicationInfo();
4583- mInfo->name = "Shell";
4584- mInfo->dispatchingTimeout = INT_MAX;
4585- }
4586-
4587- return true;
4588- }
4589- };
4590-
4591- struct DummyApplicationWindow : public android::InputWindowHandle
4592- {
4593- DummyApplicationWindow(
4594- const android::sp<android::InputApplicationHandle>& app_handle,
4595- int x = 0,
4596- int y = 0,
4597- int w = 720,
4598- int h = 1280)
4599- : android::InputWindowHandle(app_handle),
4600- x(x),
4601- y(y),
4602- w(w),
4603- h(h)
4604- {
4605- }
4606-
4607- bool updateInfo()
4608- {
4609- ALOGI("%s", __PRETTY_FUNCTION__);
4610- if (mInfo == NULL)
4611- {
4612- mInfo = new android::InputWindowInfo();
4613- SkRegion touchable_region;
4614- touchable_region.setRect(x, y, x+w, y+h);
4615-
4616- mInfo->name = "ShellInputWindow";
4617- mInfo->layoutParamsFlags = android::InputWindowInfo::FLAG_NOT_TOUCH_MODAL | android::InputWindowInfo::FLAG_SPLIT_TOUCH;
4618- mInfo->layoutParamsType = android::InputWindowInfo::TYPE_APPLICATION;
4619- mInfo->touchableRegion = touchable_region;
4620- mInfo->frameLeft = x;
4621- mInfo->frameTop = y;
4622- mInfo->frameRight = x + w;
4623- mInfo->frameBottom = y + h;
4624- mInfo->scaleFactor = 1.f;
4625- mInfo->visible = true;
4626- mInfo->canReceiveKeys = true;
4627- mInfo->hasFocus = true;
4628- mInfo->hasWallpaper = false;
4629- mInfo->paused = false;
4630- mInfo->layer = 0;
4631- mInfo->dispatchingTimeout = INT_MAX;
4632- mInfo->ownerPid = 0;
4633- mInfo->ownerUid = 0;
4634- mInfo->inputFeatures = 0;
4635- mInfo->inputChannel = input_channel;
4636- }
4637-
4638- return true;
4639- }
4640-
4641- android::sp<android::InputChannel> input_channel;
4642- int x;
4643- int y;
4644- int w;
4645- int h;
4646- };
4647-
4648- InputSetup(const android::sp<InputFilter>& input_filter)
4649- : looper(new android::Looper(false)),
4650- looper_thread(new LooperThread(looper)),
4651- event_hub(new android::EventHub()),
4652- input_reader_policy(new DefaultInputReaderPolicyInterface(looper)),
4653- input_dispatcher_policy(new DefaultInputDispatcherPolicy(input_filter)),
4654- input_manager(new InputManager(event_hub, input_reader_policy, input_dispatcher_policy))
4655- {
4656- input_manager->getDispatcher()->setInputFilterEnabled(true);
4657- }
4658-
4659- void start()
4660- {
4661- input_manager->start();
4662- looper_thread->run(__PRETTY_FUNCTION__,
4663- android::PRIORITY_URGENT_DISPLAY);
4664- }
4665-
4666- void stop()
4667- {
4668- input_manager->stop();
4669- looper_thread->requestExitAndWait();
4670- }
4671-
4672- ~InputSetup()
4673- {
4674- stop();
4675- }
4676- android::sp<android::Looper> looper;
4677- android::sp<LooperThread> looper_thread;
4678-
4679- android::sp<android::EventHubInterface> event_hub;
4680- android::sp<android::InputReaderPolicyInterface> input_reader_policy;
4681- android::sp<android::InputDispatcherPolicyInterface> input_dispatcher_policy;
4682- android::sp<android::InputManager> input_manager;
4683-
4684- android::Condition wait_condition;
4685- android::Mutex wait_guard;
4686-};
4687-
4688-}
4689-
4690-#endif // DEFAULT_APPLICATION_MANAGER_INPUT_SETUP_H_
4691
4692=== removed file 'android/hybris/default_application_manager_test.cpp'
4693--- android/hybris/default_application_manager_test.cpp 2013-07-25 19:50:52 +0000
4694+++ android/hybris/default_application_manager_test.cpp 1970-01-01 00:00:00 +0000
4695@@ -1,146 +0,0 @@
4696-/*
4697- * Copyright © 2012 Canonical Ltd.
4698- *
4699- * This program is free software: you can redistribute it and/or modify
4700- * it under the terms of the GNU Lesser General Public License version 3 as
4701- * published by the Free Software Foundation.
4702- *
4703- * This program is distributed in the hope that it will be useful,
4704- * but WITHOUT ANY WARRANTY; without even the implied warranty of
4705- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4706- * GNU Lesser General Public License for more details.
4707- *
4708- * You should have received a copy of the GNU Lesser General Public License
4709- * along with this program. If not, see <http://www.gnu.org/licenses/>.
4710- *
4711- * Authored by: Thomas Voß <thomas.voss@canonical.com>
4712- */
4713-#include "application_manager.h"
4714-
4715-#include <binder/IPCThreadState.h>
4716-#include <binder/IServiceManager.h>
4717-#include <binder/ProcessState.h>
4718-
4719-#include <sys/types.h>
4720-#include <sys/stat.h>
4721-#include <fcntl.h>
4722-
4723-namespace
4724-{
4725-struct ApplicationManagerSession : public android::BnApplicationManagerSession
4726-{
4727- ApplicationManagerSession()
4728- {
4729- }
4730-
4731- void on_application_resumed()
4732- {
4733- printf("%s \n", __PRETTY_FUNCTION__);
4734- }
4735-
4736- void on_application_about_to_stop()
4737- {
4738- printf("%s \n", __PRETTY_FUNCTION__);
4739- }
4740-
4741- void raise_application_surfaces_to_layer(int layer)
4742- {
4743- printf("%s \n", __PRETTY_FUNCTION__);
4744- printf("%d \n", layer);
4745- }
4746-
4747- void raise_surface_to_layer(int32_t token, int layer)
4748- {
4749- printf("%s: %d, %d \n", __PRETTY_FUNCTION__, token, layer);
4750- }
4751-
4752- SurfaceProperties query_surface_properties_for_token(int32_t token)
4753- {
4754- static const int layer = 100;
4755- SurfaceProperties props = { layer, 0, 0, 960, 1280 };
4756- return props;
4757- }
4758-};
4759-
4760-struct ApplicationManagerObserver : public android::BnApplicationManagerObserver
4761-{
4762- void on_session_requested(uint32_t app)
4763- {
4764- printf("%s: %d \n", __PRETTY_FUNCTION__, app);
4765- }
4766-
4767- void on_session_born(int id,
4768- int stage_hint,
4769- const android::String8& desktop_file)
4770- {
4771- printf("%s: %d, %d, %s \n", __PRETTY_FUNCTION__, id, stage_hint, desktop_file.string());
4772- }
4773-
4774- void on_session_unfocused(int id,
4775- int stage_hint,
4776- const android::String8& desktop_file)
4777- {
4778- printf("%s: %d, %d, %s \n", __PRETTY_FUNCTION__, id, stage_hint, desktop_file.string());
4779- }
4780-
4781- void on_session_focused(int id,
4782- int stage_hint,
4783- const android::String8& desktop_file)
4784- {
4785- printf("%s: %d, %d, %s \n", __PRETTY_FUNCTION__, id, stage_hint, desktop_file.string());
4786- }
4787-
4788- void on_keyboard_geometry_changed(int x,
4789- int y,
4790- int width,
4791- int height)
4792- {
4793- printf("%s: %d, %d, %d, %d \n", __PRETTY_FUNCTION__, x, y, width, height);
4794- }
4795-
4796- void on_session_requested_fullscreen(int id,
4797- int stage_hint,
4798- const android::String8& desktop_file)
4799- {
4800- printf("%s: %d, %s \n", __PRETTY_FUNCTION__, id, desktop_file.string());
4801- }
4802-
4803- void on_session_died(int id,
4804- int stage_hint,
4805- const android::String8& desktop_file)
4806- {
4807- printf("%s: %d, %d, %s \n", __PRETTY_FUNCTION__, id, stage_hint, desktop_file.string());
4808- }
4809-};
4810-
4811-}
4812-
4813-int main(int argc, char** argv)
4814-{
4815- android::ProcessState::self()->startThreadPool();
4816-
4817- int test_fd = open("test.file", O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO);
4818-
4819- android::sp<ApplicationManagerObserver> observer(new ApplicationManagerObserver());
4820- android::sp<ApplicationManagerSession> session(new ApplicationManagerSession());
4821- android::sp<android::IServiceManager> service_manager = android::defaultServiceManager();
4822- android::sp<android::IBinder> service = service_manager->getService(
4823- android::String16(android::IApplicationManager::exported_service_name()));
4824- android::BpApplicationManager app_manager(service);
4825-
4826- app_manager.register_an_observer(observer);
4827-
4828- static const int32_t session_type = 0;
4829- static const int32_t stage_hint = 0;
4830-
4831- app_manager.start_a_new_session(
4832- session_type,
4833- stage_hint,
4834- android::String8("default_application_manager_test"),
4835- android::String8("default_application_manager_test"),
4836- session,
4837- test_fd,
4838- 0);
4839-
4840- for(;;) {}
4841-}
4842
4843=== removed file 'android/hybris/default_application_session.h'
4844--- android/hybris/default_application_session.h 2013-05-22 00:38:39 +0000
4845+++ android/hybris/default_application_session.h 1970-01-01 00:00:00 +0000
4846@@ -1,250 +0,0 @@
4847-/*
4848- * Copyright © 2012 Canonical Ltd.
4849- *
4850- * This program is free software: you can redistribute it and/or modify
4851- * it under the terms of the GNU Lesser General Public License version 3 as
4852- * published by the Free Software Foundation.
4853- *
4854- * This program is distributed in the hope that it will be useful,
4855- * but WITHOUT ANY WARRANTY; without even the implied warranty of
4856- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4857- * GNU Lesser General Public License for more details.
4858- *
4859- * You should have received a copy of the GNU Lesser General Public License
4860- * along with this program. If not, see <http://www.gnu.org/licenses/>.
4861- *
4862- * Authored by: Thomas Voß <thomas.voss@canonical.com>
4863- */
4864-#ifndef DEFAULT_APPLICATION_SESSION_H_
4865-#define DEFAULT_APPLICATION_SESSION_H_
4866-
4867-#include "application_manager.h"
4868-
4869-#include "private/application/ui/session_credentials.h"
4870-#include "private/application/ui/surface_role.h"
4871-#include "private/application/ui/stage_hint.h"
4872-
4873-#include <binder/IPCThreadState.h>
4874-#include <binder/IServiceManager.h>
4875-#include <binder/ProcessState.h>
4876-
4877-namespace ubuntu { namespace detail
4878-{
4879-
4880-struct ApplicationSession : public android::RefBase
4881-{
4882- struct Surface : public android::RefBase
4883- {
4884- Surface(ApplicationSession* parent,
4885- const android::sp<android::InputChannel>& input_channel,
4886- int32_t surface_role,
4887- int32_t token)
4888- : parent(parent),
4889- input_channel(input_channel),
4890- role(static_cast<ubuntu::application::ui::SurfaceRole>(surface_role)),
4891- token(token)
4892- {
4893- }
4894-
4895- android::IApplicationManagerSession::SurfaceProperties query_properties()
4896- {
4897- android::IApplicationManagerSession::SurfaceProperties props =
4898- parent->remote_session->query_surface_properties_for_token(token);
4899-
4900- return props;
4901- }
4902-
4903- android::sp<android::InputWindowHandle> make_input_window_handle()
4904- {
4905- return android::sp<android::InputWindowHandle>(new InputWindowHandle(parent, android::sp<Surface>(this)));
4906- }
4907-
4908- ApplicationSession* parent;
4909- android::sp<android::InputChannel> input_channel;
4910- ubuntu::application::ui::SurfaceRole role;
4911- int32_t token;
4912- };
4913-
4914- ApplicationSession(
4915- pid_t pid,
4916- pid_t remote_pid,
4917- android::sp<android::IApplicationManagerSession> remote_session,
4918- int32_t session_type,
4919- int32_t stage_hint,
4920- const android::String8& app_name,
4921- const android::String8& desktop_file)
4922- : running_state(ubuntu::application::ui::process_destroyed),
4923- pid(pid),
4924- remote_pid(remote_pid),
4925- app_layer(0),
4926- remote_session(remote_session),
4927- session_type(static_cast<ubuntu::application::ui::SessionType>(session_type)),
4928- stage_hint(stage_hint),
4929- app_name(app_name),
4930- desktop_file(desktop_file)
4931- {
4932- }
4933-
4934- struct InputApplicationHandle : public android::InputApplicationHandle
4935- {
4936- InputApplicationHandle(ApplicationSession* parent) : parent(parent)
4937- {
4938- updateInfo();
4939- }
4940-
4941- bool updateInfo()
4942- {
4943- if (mInfo == NULL)
4944- {
4945- mInfo = new android::InputApplicationInfo();
4946- mInfo->name = parent->app_name;
4947- mInfo->dispatchingTimeout = INT_MAX;
4948- }
4949-
4950- return true;
4951- }
4952-
4953- ApplicationSession* parent;
4954- };
4955-
4956- struct InputWindowHandle : public android::InputWindowHandle
4957- {
4958- InputWindowHandle(ApplicationSession* parent, const android::sp<Surface>& surface)
4959- : android::InputWindowHandle(
4960- android::sp<InputApplicationHandle>(
4961- new InputApplicationHandle(parent))),
4962- parent(parent),
4963- surface(surface)
4964- {
4965- updateInfo();
4966- }
4967-
4968- bool updateInfo()
4969- {
4970- if (mInfo == NULL)
4971- {
4972- mInfo = new android::InputWindowInfo();
4973- }
4974-
4975- android::IApplicationManagerSession::SurfaceProperties props;
4976- if (parent->running_state == ubuntu::application::ui::process_suspended)
4977- {
4978- kill(parent->pid, SIGCONT);
4979- props = surface->query_properties();
4980- kill(parent->pid, SIGSTOP);
4981- } else
4982- props = surface->query_properties();
4983-
4984- ALOGI("%s: touchable_region = (%d, %d, %d, %d)",
4985- __PRETTY_FUNCTION__,
4986- props.left,
4987- props.top,
4988- props.right,
4989- props.bottom);
4990-
4991- SkRegion touchable_region;
4992- touchable_region.setRect(props.left, props.top, props.right+1, props.bottom+1);
4993-
4994- mInfo->name = parent->app_name;
4995- mInfo->layoutParamsFlags = android::InputWindowInfo::FLAG_NOT_TOUCH_MODAL;
4996- mInfo->layoutParamsType = android::InputWindowInfo::TYPE_APPLICATION;
4997- mInfo->touchableRegion = touchable_region;
4998- mInfo->frameLeft = props.left;
4999- mInfo->frameTop = props.top;
5000- mInfo->frameRight = props.right+1;
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches