Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
anbox
提交
aa23c349
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,发现更多精彩内容 >>
提交
aa23c349
编写于
12月 21, 2016
作者:
S
Simon Fels
提交者:
GitHub
12月 21, 2016
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #19 from morphis/activity-launch-bounds
Allow clients to specify the launch bounds of a new activity
上级
14d8bb23
324407ee
变更
9
显示空白变更内容
内联
并排
Showing
9 changed file
with
43 addition
and
12 deletion
+43
-12
android/service/android_api_skeleton.cpp
android/service/android_api_skeleton.cpp
+13
-2
src/anbox/application_manager.h
src/anbox/application_manager.h
+2
-1
src/anbox/bridge/android_api_stub.cpp
src/anbox/bridge/android_api_stub.cpp
+10
-1
src/anbox/bridge/android_api_stub.h
src/anbox/bridge/android_api_stub.h
+2
-1
src/anbox/dbus/skeleton/application_manager.cpp
src/anbox/dbus/skeleton/application_manager.cpp
+10
-3
src/anbox/dbus/skeleton/application_manager.h
src/anbox/dbus/skeleton/application_manager.h
+1
-1
src/anbox/dbus/stub/application_manager.cpp
src/anbox/dbus/stub/application_manager.cpp
+3
-2
src/anbox/dbus/stub/application_manager.h
src/anbox/dbus/stub/application_manager.h
+1
-1
src/anbox/protobuf/anbox_bridge.proto
src/anbox/protobuf/anbox_bridge.proto
+1
-0
未找到文件。
android/service/android_api_skeleton.cpp
浏览文件 @
aa23c349
...
...
@@ -28,6 +28,7 @@
#include <binder/IServiceManager.h>
#include <string>
#include <sstream>
namespace
{
std
::
map
<
std
::
string
,
std
::
string
>
common_env
=
{
...
...
@@ -48,9 +49,9 @@ void AndroidApiSkeleton::wait_for_process(core::posix::ChildProcess &process,
const
auto
result
=
process
.
wait_for
(
core
::
posix
::
wait
::
Flags
::
untraced
);
if
(
result
.
status
!=
core
::
posix
::
wait
::
Result
::
Status
::
exited
||
result
.
detail
.
if_exited
.
status
!=
core
::
posix
::
exit
::
Status
::
success
)
{
response
->
set_error
(
"Failed to
install application
"
);
response
->
set_error
(
"Failed to
execute process
"
);
// FIXME once we add proper error codes/domains we need to add structured error
// info the response here.
// info t
o t
he response here.
}
}
...
...
@@ -76,6 +77,16 @@ void AndroidApiSkeleton::launch_application(anbox::protobuf::bridge::LaunchAppli
"--stack"
,
"2"
,
};
if
(
request
->
has_launch_bounds
())
{
argv
.
push_back
(
"--launch-bounds"
);
std
::
stringstream
launch_bounds
;
launch_bounds
<<
request
->
launch_bounds
().
left
()
<<
" "
<<
request
->
launch_bounds
().
top
()
<<
" "
<<
request
->
launch_bounds
().
right
()
<<
" "
<<
request
->
launch_bounds
().
bottom
();
argv
.
push_back
(
launch_bounds
.
str
());
}
if
(
intent
.
has_action
())
{
argv
.
push_back
(
"-a"
);
argv
.
push_back
(
intent
.
action
());
...
...
src/anbox/application_manager.h
浏览文件 @
aa23c349
...
...
@@ -19,6 +19,7 @@
#define ANBOX_APPLICATION_MANAGER_H_
#include "anbox/android/intent.h"
#include "anbox/graphics/rect.h"
#include "anbox/do_not_copy_or_move.h"
#include <string>
...
...
@@ -26,7 +27,7 @@
namespace
anbox
{
class
ApplicationManager
:
public
DoNotCopyOrMove
{
public:
virtual
void
launch
(
const
android
::
Intent
&
intent
)
=
0
;
virtual
void
launch
(
const
android
::
Intent
&
intent
,
const
graphics
::
Rect
&
launch_bounds
=
graphics
::
Rect
::
Invalid
)
=
0
;
};
}
// namespace anbox
...
...
src/anbox/bridge/android_api_stub.cpp
浏览文件 @
aa23c349
...
...
@@ -45,7 +45,8 @@ void AndroidApiStub::ensure_rpc_channel() {
if
(
!
channel_
)
throw
std
::
runtime_error
(
"No remote client connected"
);
}
void
AndroidApiStub
::
launch
(
const
android
::
Intent
&
intent
)
{
void
AndroidApiStub
::
launch
(
const
android
::
Intent
&
intent
,
const
graphics
::
Rect
&
launch_bounds
)
{
ensure_rpc_channel
();
auto
c
=
std
::
make_shared
<
Request
<
protobuf
::
rpc
::
Void
>>
();
...
...
@@ -56,6 +57,14 @@ void AndroidApiStub::launch(const android::Intent &intent) {
launch_wait_handle_
.
expect_result
();
}
if
(
launch_bounds
!=
graphics
::
Rect
::
Invalid
)
{
auto
rect
=
message
.
mutable_launch_bounds
();
rect
->
set_left
(
launch_bounds_
.
left
());
rect
->
set_top
(
launch_bounds_
.
top
());
rect
->
set_right
(
launch_bounds_
.
right
());
rect
->
set_bottom
(
launch_bounds_
.
bottom
());
}
auto
launch_intent
=
message
.
mutable_intent
();
if
(
!
intent
.
action
.
empty
())
launch_intent
->
set_action
(
intent
.
action
);
...
...
src/anbox/bridge/android_api_stub.h
浏览文件 @
aa23c349
...
...
@@ -43,7 +43,7 @@ class AndroidApiStub : public anbox::ApplicationManager {
void
set_rpc_channel
(
const
std
::
shared_ptr
<
rpc
::
Channel
>
&
channel
);
void
reset_rpc_channel
();
void
launch
(
const
android
::
Intent
&
intent
)
override
;
void
launch
(
const
android
::
Intent
&
intent
,
const
graphics
::
Rect
&
launch_bounds
=
graphics
::
Rect
::
Invalid
)
override
;
void
set_focused_task
(
const
std
::
int32_t
&
id
);
void
remove_task
(
const
std
::
int32_t
&
id
);
...
...
@@ -71,6 +71,7 @@ class AndroidApiStub : public anbox::ApplicationManager {
common
::
WaitHandle
set_focused_task_handle_
;
common
::
WaitHandle
remove_task_handle_
;
common
::
WaitHandle
resize_task_handle_
;
graphics
::
Rect
launch_bounds_
=
graphics
::
Rect
::
Invalid
;
};
}
// namespace bridge
}
// namespace anbox
...
...
src/anbox/dbus/skeleton/application_manager.cpp
浏览文件 @
aa23c349
...
...
@@ -40,10 +40,17 @@ ApplicationManager::ApplicationManager(
reader
>>
intent
.
package
;
reader
>>
intent
.
component
;
std
::
int32_t
left
,
top
,
right
,
bottom
;
reader
>>
left
;
reader
>>
top
;
reader
>>
right
;
reader
>>
bottom
;
graphics
::
Rect
launch_bounds
{
left
,
top
,
right
,
bottom
};
core
::
dbus
::
Message
::
Ptr
reply
;
try
{
launch
(
intent
);
launch
(
intent
,
launch_bounds
);
reply
=
core
::
dbus
::
Message
::
make_method_return
(
msg
);
}
catch
(
std
::
exception
const
&
err
)
{
reply
=
core
::
dbus
::
Message
::
make_error
(
msg
,
"org.anbox.Error.Failed"
,
...
...
@@ -56,8 +63,8 @@ ApplicationManager::ApplicationManager(
ApplicationManager
::~
ApplicationManager
()
{}
void
ApplicationManager
::
launch
(
const
android
::
Intent
&
intent
)
{
impl_
->
launch
(
intent
);
void
ApplicationManager
::
launch
(
const
android
::
Intent
&
intent
,
const
graphics
::
Rect
&
launch_bounds
)
{
impl_
->
launch
(
intent
,
launch_bounds
);
}
}
// namespace skeleton
}
// namespace dbus
...
...
src/anbox/dbus/skeleton/application_manager.h
浏览文件 @
aa23c349
...
...
@@ -34,7 +34,7 @@ class ApplicationManager : public anbox::ApplicationManager {
const
std
::
shared_ptr
<
anbox
::
ApplicationManager
>
&
impl
);
~
ApplicationManager
();
void
launch
(
const
android
::
Intent
&
intent
)
override
;
void
launch
(
const
android
::
Intent
&
intent
,
const
graphics
::
Rect
&
launch_bounds
=
graphics
::
Rect
::
Invalid
)
override
;
private:
core
::
dbus
::
Bus
::
Ptr
bus_
;
...
...
src/anbox/dbus/stub/application_manager.cpp
浏览文件 @
aa23c349
...
...
@@ -38,12 +38,13 @@ ApplicationManager::ApplicationManager(const core::dbus::Bus::Ptr &bus,
ApplicationManager
::~
ApplicationManager
()
{}
void
ApplicationManager
::
launch
(
const
android
::
Intent
&
intent
)
{
void
ApplicationManager
::
launch
(
const
android
::
Intent
&
intent
,
const
graphics
::
Rect
&
launch_bounds
)
{
auto
result
=
object_
->
invoke_method_synchronously
<
anbox
::
dbus
::
interface
::
ApplicationManager
::
Methods
::
Launch
,
anbox
::
dbus
::
interface
::
ApplicationManager
::
Methods
::
Launch
::
ResultType
>
(
intent
.
action
,
intent
.
uri
,
intent
.
type
,
intent
.
flags
,
intent
.
package
,
intent
.
component
);
intent
.
component
,
launch_bounds
.
left
(),
launch_bounds
.
top
(),
launch_bounds
.
right
(),
launch_bounds
.
bottom
());
if
(
result
.
is_error
())
throw
std
::
runtime_error
(
result
.
error
().
print
());
}
...
...
src/anbox/dbus/stub/application_manager.h
浏览文件 @
aa23c349
...
...
@@ -37,7 +37,7 @@ class ApplicationManager : public anbox::ApplicationManager {
const
core
::
dbus
::
Object
::
Ptr
&
object
);
~
ApplicationManager
();
void
launch
(
const
android
::
Intent
&
intent
)
override
;
void
launch
(
const
android
::
Intent
&
intent
,
const
graphics
::
Rect
&
launch_bounds
=
graphics
::
Rect
::
Invalid
)
override
;
private:
core
::
dbus
::
Bus
::
Ptr
bus_
;
...
...
src/anbox/protobuf/anbox_bridge.proto
浏览文件 @
aa23c349
...
...
@@ -33,6 +33,7 @@ message Notification {
message
LaunchApplication
{
required
Intent
intent
=
1
;
optional
Rect
launch_bounds
=
2
;
}
message
SetFocusedTask
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录