Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
anbox
提交
edd89600
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,发现更多精彩内容 >>
提交
edd89600
编写于
6月 07, 2017
作者:
S
Simon Fels
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Ensure that we have an valid intent before we launch it
上级
4a5ce925
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
46 addition
and
0 deletion
+46
-0
src/anbox/android/intent.cpp
src/anbox/android/intent.cpp
+6
-0
src/anbox/android/intent.h
src/anbox/android/intent.h
+2
-0
src/anbox/cmds/launch.cpp
src/anbox/cmds/launch.cpp
+5
-0
tests/anbox/CMakeLists.txt
tests/anbox/CMakeLists.txt
+1
-0
tests/anbox/android/CMakeLists.txt
tests/anbox/android/CMakeLists.txt
+1
-0
tests/anbox/android/intent_tests.cpp
tests/anbox/android/intent_tests.cpp
+31
-0
未找到文件。
src/anbox/android/intent.cpp
浏览文件 @
edd89600
...
...
@@ -21,6 +21,12 @@
namespace
anbox
{
namespace
android
{
bool
Intent
::
valid
()
const
{
// At the moment we only support component+package for intents
// (see android/service/android_api_skeleton.cpp for more details)
return
!
(
component
.
empty
()
&&
package
.
empty
());
}
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
const
Intent
&
intent
)
{
out
<<
"["
;
if
(
!
intent
.
action
.
empty
())
...
...
src/anbox/android/intent.h
浏览文件 @
edd89600
...
...
@@ -31,6 +31,8 @@ struct Intent {
std
::
string
package
;
std
::
string
component
;
std
::
vector
<
std
::
string
>
categories
;
bool
valid
()
const
;
};
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
const
Intent
&
intent
);
...
...
src/anbox/cmds/launch.cpp
浏览文件 @
edd89600
...
...
@@ -79,6 +79,11 @@ anbox::cmds::Launch::Launch()
stack_
));
action
([
this
](
const
cli
::
Command
::
Context
&
)
{
if
(
!
intent_
.
valid
())
{
ERROR
(
"The intent you provided is invalid. Please provide a correct launch intent."
);
return
EXIT_FAILURE
;
}
auto
trap
=
core
::
posix
::
trap_signals_for_process
({
core
::
posix
::
Signal
::
sig_term
,
core
::
posix
::
Signal
::
sig_int
});
trap
->
signal_raised
().
connect
([
trap
](
const
core
::
posix
::
Signal
&
signal
)
{
INFO
(
"Signal %i received. Good night."
,
static_cast
<
int
>
(
signal
));
...
...
tests/anbox/CMakeLists.txt
浏览文件 @
edd89600
add_subdirectory
(
android
)
add_subdirectory
(
support
)
add_subdirectory
(
common
)
add_subdirectory
(
graphics
)
tests/anbox/android/CMakeLists.txt
0 → 100644
浏览文件 @
edd89600
ANBOX_ADD_TEST
(
intent_tests intent_tests.cpp
)
tests/anbox/android/intent_tests.cpp
0 → 100644
浏览文件 @
edd89600
/*
* Copyright (C) 2017 Simon Fels <morphis@gravedo.de>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 3, as published
* by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranties of
* MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "anbox/android/intent.h"
#include <gtest/gtest.h>
TEST
(
Intent
,
IsValid
)
{
anbox
::
android
::
Intent
intent
;
ASSERT_FALSE
(
intent
.
valid
());
intent
.
component
=
"foo"
;
ASSERT_TRUE
(
intent
.
valid
());
intent
.
package
=
"bla"
;
ASSERT_TRUE
(
intent
.
valid
());
intent
.
component
=
""
;
ASSERT_TRUE
(
intent
.
valid
());
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录