Skip to content

Commit d0c90c5

Browse files
committed
APL-Viewhost: June 2022 Release of APL 2022.1 compliant Viewhost (2022.1)
1 parent 630767b commit d0c90c5

File tree

645 files changed

+9590
-6831
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

645 files changed

+9590
-6831
lines changed

Config

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*-perl-*-
22

33
package.APLViewhostAndroid = {
4-
interfaces = (1.9);
4+
interfaces = (1.10);
55

66
deploy = {
77
generic = true;
@@ -14,27 +14,27 @@ package.APLViewhostAndroid = {
1414

1515
build-system = custom-build;
1616
build-tools = {
17-
1.9 = {
17+
1.10 = {
1818
BrazilPath = 1.1;
1919
ContainerBuild = 1.2;
2020
ContainerBuildServerAPLKeys = 1.0;
2121
};
2222
};
2323

2424
dependencies = {
25-
1.9 = {
26-
APLCoreEngine = 1.9;
25+
1.10 = {
26+
APLCoreEngine = 1.10;
2727
};
2828
};
2929

3030
test-dependencies = {
31-
1.9 = {
31+
1.10 = {
3232
# build-tools defined here will be mapped to /opt/build-tools/PackageName inside the build container and added to PATH
3333
};
3434
};
3535

3636
runtime-dependencies = {
37-
1.9 = {
37+
1.10 = {
3838
};
3939
};
4040

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Alexa Presentation Language (APL) ViewHost Android version 1.9
1+
# Alexa Presentation Language (APL) ViewHost Android version 1.10
22

33
APLViewHostAndroid is a view host implementation for the Android Platform. It consists of
44
a thin JNI layer that interacts with APL Core Engine for component inflation and command

apl/CMakeLists.txt

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,22 @@ set(APL_DEPENDENCIES_DIR "${APL_CORE_DIR}/thirdparty")
1919
include(${APL_DEPENDENCIES_DIR}/thirdparty.cmake)
2020

2121
# tools
22+
set(EXTENSIONS_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/build-extensions)
23+
set(APL_CORE_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/build)
24+
include(${APL_CORE_DIR}/options.cmake)
25+
include(${APL_CORE_DIR}/tools.cmake)
26+
2227
include_directories(${APL_CORE_DIR}/aplcore)
2328
include_directories(${APL_CORE_BUILD_DIR/aplcore/include})
2429

2530
# Extensions framework
2631
include_directories(${APL_CORE_DIR}/extensions/alexaext/include)
2732

28-
set(APL_CORE_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/build)
29-
include(${APL_CORE_DIR}/options.cmake)
30-
include(${APL_CORE_DIR}/tools.cmake)
33+
# build folder
34+
add_subdirectory(${APL_CORE_DIR}/extensions ${EXTENSIONS_BUILD_DIR})
35+
36+
target_compile_definitions(alexaext PUBLIC ALEXAEXTENSIONS)
37+
add_dependencies(alexaext rapidjson-build)
3138

3239
# build folder
3340
file(MAKE_DIRECTORY ${APL_CORE_DIR}/aplcore/build)
@@ -54,6 +61,7 @@ add_library(
5461
src/main/cpp/jniextensionmediator.cpp
5562
src/main/cpp/jnirootcontext.cpp
5663
src/main/cpp/jnirootconfig.cpp
64+
src/main/cpp/jnisession.cpp
5765
src/main/cpp/jnicomponent.cpp
5866
src/main/cpp/jnicomplexproperty.cpp
5967
src/main/cpp/jnievent.cpp
@@ -92,7 +100,7 @@ target_link_libraries(
92100
${log-lib})
93101

94102

95-
target_link_libraries(apl-jni apl)
103+
target_link_libraries(apl-jni apl alexaext)
96104

97105
# APL Core include and dependencies
98106
include_directories(${APL_CORE_DIR}/aplcore/include)
@@ -204,4 +212,4 @@ find_program(CCACHE_FOUND ccache)
204212
if(CCACHE_FOUND)
205213
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
206214
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
207-
endif(CCACHE_FOUND)
215+
endif(CCACHE_FOUND)

apl/checkstyle/checkstyle.xml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE module PUBLIC
3+
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
4+
"https://checkstyle.org/dtds/configuration_1_3.dtd">
5+
6+
<module name="Checker">
7+
<module name="RegexpHeader">
8+
<property name="severity" value="error" />
9+
<property name="header" value="\n/\*\n *Copyright( \([cC]\))?( \d{4})? Amazon\.com, Inc\. or its affiliates\. All Rights Reserved\." />
10+
<property name="multiLines" value="1" />
11+
<property name="fileExtensions" value="java,c,h,cc,hh,cpp,hpp" />
12+
</module>
13+
<module name="RegexpSingleline">
14+
<property name="message" value="device codename referenced" />
15+
<property name="severity" value="error" />
16+
<property name="format" value="(?i)\b(knight|rook|bishop|checkers|crown|cronos|theia|athena|hoya|vega|rhea)" />
17+
</module>
18+
<module name="RegexpSingleline">
19+
<property name="message" value="device build model referenced" />
20+
<property name="severity" value="error" />
21+
<property name="format" value="(?i)aeo(kn|rk|bp|ch|cw|cn|ta|at|hy)" />
22+
</module>
23+
<module name="RegexpSingleline">
24+
<property name="message" value="internal system referenced" />
25+
<property name="severity" value="error" />
26+
<property name="format" value="(?i)\b(brazil|apollo|elon|jira|labcollab|codebuild|gitfarm|isengard|conduit|quip)" />
27+
</module>
28+
<module name="RegexpSingleline">
29+
<property name="message" value="possible JIRA tag" />
30+
<property name="severity" value="error" />
31+
<property name="format" value="\b([A-Z]{1,10}-\d{2,10})(?&lt;!BCP-47|UTF-8|UTF-16)" />
32+
</module>
33+
<module name="RegexpSingleline">
34+
<property name="message" value="internal package referenced" />
35+
<property name="severity" value="error" />
36+
<property name="format" value="(?i)\b(aria|ariaruntime|ariaruntimelibrary)" />
37+
</module>
38+
<module name="RegexpSingleline">
39+
<property name="message" value="internal link referenced" />
40+
<property name="severity" value="error" />
41+
<property name="format" value="(?i)amazon\.dev|aws\.dev|a2z\.com|\b(corp|issues|w)\.amazon\.com|dev-dsk|arn:aws" />
42+
</module>
43+
<module name="RegexpSingleline">
44+
<property name="message" value="possible internal link" />
45+
<property name="severity" value="warning" />
46+
<property name="format" value="(?&lt;!www|aws|developer)\.amazon\.com" />
47+
</module>
48+
<module name="RegexpSingleline">
49+
<property name="message" value="internal email" />
50+
<property name="format" value="(?i)@amazon\.com" />
51+
</module>
52+
<module name="RegexpSingleline">
53+
<property name="severity" value="warning" />
54+
<property name="message" value="possible employee login name" />
55+
<property name="format" value="(?i)\w{1,8}@" />
56+
</module>
57+
<module name="RegexpSingleline">
58+
<property name="severity" value="error" />
59+
<property name="message" value="non-inclusive language" />
60+
<property name="format" value="(?i)slave|(black|white) ?list" />
61+
</module>
62+
</module>

apl/src/androidTest/java/com/amazon/apl/android/ExtensionMediatorTest.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ public class ExtensionMediatorTest extends APLViewhostTest {
7777
@Mock
7878
private IExtensionProvider mExtensionProvider;
7979

80+
@Mock
81+
private Session mSession;
82+
8083
@Before
8184
public void setup() {
8285
MockitoAnnotations.initMocks(this);
@@ -108,7 +111,7 @@ public void testLoadExtensions_calls_onExtensionsLoadedCallback_only_once() thro
108111

109112
@Test
110113
public void testInitializeExtensions_specific_grantedExtensions_loads_only_those_extensions() throws InterruptedException {
111-
Content content = Content.create(mTestDoc, mOptions, mContentCallbackV2);
114+
Content content = Content.create(mTestDoc, mOptions, mContentCallbackV2, mSession);
112115
RootConfig rootConfig = RootConfig.create();
113116
ExtensionRegistrar extensionRegistrar = new ExtensionRegistrar().addProvider(mExtensionProvider);
114117
ExtensionMediator mediator = ExtensionMediator.create(extensionRegistrar);
@@ -167,7 +170,7 @@ public void testOnDocumentDisplayed() throws InterruptedException {
167170
public void testExecutor() throws InterruptedException {
168171
// given
169172
RootConfig rootConfig = RootConfig.create();
170-
Content content = Content.create(mTestDoc, mOptions, mContentCallbackV2);
173+
Content content = Content.create(mTestDoc, mOptions, mContentCallbackV2, mSession);
171174
TestLiveDataLocalExtension extension = spy(new TestLiveDataLocalExtension());
172175
LegacyLocalExtensionProxy legacyLocalExtensionProxy = new LegacyLocalExtensionProxy(extension);
173176
ExtensionRegistrar extensionRegistrar = new ExtensionRegistrar().addProvider(mExtensionProvider);
@@ -186,7 +189,7 @@ public void testExecutor() throws InterruptedException {
186189
}
187190

188191
private ExtensionMediator loadExtensions() {
189-
Content content = Content.create(mTestDoc, mOptions, mContentCallbackV2);
192+
Content content = Content.create(mTestDoc, mOptions, mContentCallbackV2, mSession);
190193
RootConfig rootConfig = RootConfig.create();
191194
ExtensionMediator mediator = ExtensionMediator.create(mExtensionRegistrar);
192195
mediator.initializeExtensions(rootConfig, content, null);

apl/src/androidTest/java/com/amazon/apl/android/component/EditTextTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public void doBefore() {
4747
" \"selectOnFocus\": true," +
4848
" \"size\": 10," +
4949
" \"submitKeyType\": \"send\"," +
50-
" \"text\": \"This is a text\"," +
50+
" \"text\": \"19896 Text\"," +
5151
" \"validCharacters\": \"0-9\"";
5252
}
5353

@@ -125,7 +125,7 @@ void testProperties_optionalExplicitValues(EditText component) {
125125
assertEquals(true, proxy.isSelectOnFocus());
126126
assertEquals(10, proxy.getSize()); // Viewhost enforces size on the text
127127
assertEquals(SubmitKeyType.kSubmitKeyTypeSend, proxy.getSubmitKeyType());
128-
assertEquals("This is a text", proxy.getText());
128+
assertEquals("19896", proxy.getText());
129129
assertEquals("0-9", proxy.getValidCharacters()); // Viewhost enforces restriction of characters on the text
130130
}
131131

apl/src/androidTest/java/com/amazon/apl/android/component/VideoTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ public void testMedia_Source() {
200200
assertEquals(sources.size(), 1);
201201

202202
assertEquals(sources.at(0).url(), "URL1");
203+
assertFalse(((Video) child).shouldMute());
203204
}
204205
}
205206

apl/src/androidTest/java/com/amazon/apl/android/document/AbstractDocViewTest.java

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,24 @@ private class InflateAPLViewAction implements ViewAction {
101101
private final String mData;
102102
private final APLOptions mOptions;
103103
private final RootConfig mRootConfig;
104+
private final String mDocument;
104105

105-
public InflateAPLViewAction(String componentProps, String documentProps, String payloadId, String data, APLOptions options, RootConfig rootConfig) {
106+
InflateAPLViewAction(String document, String componentProps, String documentProps, String payloadId, String data, APLOptions options, RootConfig rootConfig) {
106107
mComponentProps = componentProps;
107108
mDocumentProps = documentProps;
108109
mPayloadId = payloadId;
109110
mData = data;
110111
mOptions = options;
111112
mRootConfig = rootConfig;
113+
mDocument = document;
114+
}
115+
116+
InflateAPLViewAction(String componentProps, String documentProps, String payloadId, String data, APLOptions options, RootConfig rootConfig) {
117+
this(BASE_DOC, componentProps, documentProps, payloadId, data, options, rootConfig);
118+
}
119+
120+
InflateAPLViewAction(String document, String payloadId, String data, APLOptions options, RootConfig rootConfig) {
121+
this(document, "", "", payloadId, data, options, rootConfig);
112122
}
113123

114124
@Override
@@ -125,15 +135,15 @@ public String getDescription() {
125135
@Override
126136
public void perform(UiController uiController, View view) {
127137
mTestContext = new APLTestContext()
128-
.setDocument(BASE_DOC, mPayloadId, mComponentProps, mDocumentProps)
138+
.setDocument(mDocument, mPayloadId, mComponentProps, mDocumentProps)
129139
.setDocumentPayload(mPayloadId, mData)
130140
.setAplOptions(mOptions)
131141
.buildRootContextDependencies();
132142

133143
if (mRootConfig != null) {
134144
mTestContext.setRootConfig(mRootConfig);
135145
}
136-
146+
137147
APLLayout aplLayout = activityRule.getActivity().findViewById(com.amazon.apl.android.test.R.id.apl);
138148
try {
139149
mAplController = APLController.renderDocument(mTestContext.getContent(), mTestContext.getAplOptions(), mTestContext.getRootConfig(), aplLayout.getPresenter());
@@ -165,6 +175,10 @@ public ViewAction inflate(String componentProps, String documentProps) {
165175
return inflateWithOptions(componentProps, documentProps, null);
166176
}
167177

178+
public ViewAction inflateWithOptions(String document, APLOptions options) {
179+
return actionWithAssertions(new InflateAPLViewAction(document, "payload", "{}", options, null));
180+
}
181+
168182
public ViewAction inflateWithOptions(String componentProps, String documentProps, APLOptions options) {
169183
return inflate(componentProps, documentProps, "payload", "{}", options);
170184
}

0 commit comments

Comments
 (0)