Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
anbox
提交
e04dd4bc
A
anbox
项目概览
openeuler
/
anbox
通知
24
Star
1
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
anbox
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e04dd4bc
编写于
5月 15, 2017
作者:
S
Simon Fels
提交者:
GitHub
5月 15, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #241 from lag-linaro/master
cmds: session_manager: Provide an option to use any container
上级
52f4a7e8
e492cd1a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
34 addition
and
11 deletion
+34
-11
src/anbox/cmds/session_manager.cpp
src/anbox/cmds/session_manager.cpp
+28
-11
src/anbox/cmds/session_manager.h
src/anbox/cmds/session_manager.h
+6
-0
未找到文件。
src/anbox/cmds/session_manager.cpp
浏览文件 @
e04dd4bc
...
...
@@ -106,6 +106,12 @@ anbox::cmds::SessionManager::SessionManager(const BusFactory &bus_factory)
flag
(
cli
::
make_flag
(
cli
::
Name
{
"window-size"
},
cli
::
Description
{
"Size of the window in single window mode, e.g. --window-size=1024,768"
},
window_size_
));
flag
(
cli
::
make_flag
(
cli
::
Name
{
"standalone"
},
cli
::
Description
{
"Prevents the Container Manager from starting the default container (Experimental)"
},
standalone_
));
flag
(
cli
::
make_flag
(
cli
::
Name
{
"experimental"
},
cli
::
Description
{
"Allows users to use experimental features"
},
experimental_
));
action
([
this
](
const
cli
::
Command
::
Context
&
)
{
auto
trap
=
core
::
posix
::
trap_signals_for_process
(
...
...
@@ -115,6 +121,11 @@ anbox::cmds::SessionManager::SessionManager(const BusFactory &bus_factory)
trap
->
stop
();
});
if
(
standalone_
&&
!
experimental_
)
{
ERROR
(
"Experimental features selected, but --experimental flag not set"
);
return
EXIT_FAILURE
;
}
if
(
!
fs
::
exists
(
"/dev/binder"
)
||
!
fs
::
exists
(
"/dev/ashmem"
))
{
ERROR
(
"Failed to start as either binder or ashmem kernel drivers are not loaded"
);
return
EXIT_FAILURE
;
...
...
@@ -135,11 +146,13 @@ anbox::cmds::SessionManager::SessionManager(const BusFactory &bus_factory)
auto
rt
=
Runtime
::
create
();
auto
dispatcher
=
anbox
::
common
::
create_dispatcher_for_runtime
(
rt
);
container
::
Client
container
(
rt
);
container
.
register_terminate_handler
([
&
]()
{
WARNING
(
"Lost connection to container manager, terminating."
);
trap
->
stop
();
});
if
(
!
standalone_
)
{
container_
=
std
::
make_shared
<
container
::
Client
>
(
rt
);
container_
->
register_terminate_handler
([
&
]()
{
WARNING
(
"Lost connection to container manager, terminating."
);
trap
->
stop
();
});
}
auto
input_manager
=
std
::
make_shared
<
input
::
Manager
>
(
rt
);
...
...
@@ -213,7 +226,8 @@ anbox::cmds::SessionManager::SessionManager(const BusFactory &bus_factory)
}));
container
::
Configuration
container_configuration
;
container_configuration
.
bind_mounts
=
{
if
(
!
standalone_
)
{
container_configuration
.
bind_mounts
=
{
{
qemu_pipe_connector
->
socket_file
(),
"/dev/qemu_pipe"
},
{
bridge_connector
->
socket_file
(),
"/dev/anbox_bridge"
},
{
audio_server
->
socket_file
(),
"/dev/anbox_audio"
},
...
...
@@ -221,9 +235,10 @@ anbox::cmds::SessionManager::SessionManager(const BusFactory &bus_factory)
{
"/dev/binder"
,
"/dev/binder"
},
{
"/dev/ashmem"
,
"/dev/ashmem"
},
{
"/dev/fuse"
,
"/dev/fuse"
},
};
};
dispatcher
->
dispatch
([
&
]()
{
container
.
start
(
container_configuration
);
});
dispatcher
->
dispatch
([
&
]()
{
container_
->
start
(
container_configuration
);
});
}
auto
bus
=
bus_factory_
();
bus
->
install_executor
(
core
::
dbus
::
asio
::
make_executor
(
bus
,
rt
->
service
()));
...
...
@@ -233,9 +248,11 @@ anbox::cmds::SessionManager::SessionManager(const BusFactory &bus_factory)
rt
->
start
();
trap
->
run
();
// Stop the container which should close all open connections we have on
// our side and should terminate all services.
container
.
stop
();
if
(
!
standalone_
)
{
// Stop the container which should close all open connections we have on
// our side and should terminate all services.
container_
->
stop
();
}
rt
->
stop
();
...
...
src/anbox/cmds/session_manager.h
浏览文件 @
e04dd4bc
...
...
@@ -30,6 +30,9 @@
#include "anbox/graphics/rect.h"
namespace
anbox
{
namespace
container
{
class
Client
;
}
// namespace container
namespace
cmds
{
class
SessionManager
:
public
cli
::
CommandWithFlagsAndAction
{
public:
...
...
@@ -40,11 +43,14 @@ class SessionManager : public cli::CommandWithFlagsAndAction {
SessionManager
(
const
BusFactory
&
bus_factory
=
session_bus_factory
());
private:
std
::
shared_ptr
<
container
::
Client
>
container_
;
BusFactory
bus_factory_
;
std
::
string
desktop_file_hint_
;
graphics
::
GLRendererServer
::
Config
::
Driver
gles_driver_
;
bool
single_window_
=
false
;
graphics
::
Rect
window_size_
;
bool
standalone_
=
false
;
bool
experimental_
=
false
;
};
}
// namespace cmds
}
// namespace anbox
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录