Skip to content

Commit

Permalink
APL-Viewhost: June 2022 Release of APL 2022.1 compliant Viewhost (202…
Browse files Browse the repository at this point in the history
…2.1)
  • Loading branch information
pranavsu1997 committed Jun 8, 2022
1 parent 630767b commit d0c90c5
Show file tree
Hide file tree
Showing 645 changed files with 9,590 additions and 6,831 deletions.
12 changes: 6 additions & 6 deletions Config
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*-perl-*-

package.APLViewhostAndroid = {
interfaces = (1.9);
interfaces = (1.10);

deploy = {
generic = true;
Expand All @@ -14,27 +14,27 @@ package.APLViewhostAndroid = {

build-system = custom-build;
build-tools = {
1.9 = {
1.10 = {
BrazilPath = 1.1;
ContainerBuild = 1.2;
ContainerBuildServerAPLKeys = 1.0;
};
};

dependencies = {
1.9 = {
APLCoreEngine = 1.9;
1.10 = {
APLCoreEngine = 1.10;
};
};

test-dependencies = {
1.9 = {
1.10 = {
# build-tools defined here will be mapped to /opt/build-tools/PackageName inside the build container and added to PATH
};
};

runtime-dependencies = {
1.9 = {
1.10 = {
};
};

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Alexa Presentation Language (APL) ViewHost Android version 1.9
# Alexa Presentation Language (APL) ViewHost Android version 1.10

APLViewHostAndroid is a view host implementation for the Android Platform. It consists of
a thin JNI layer that interacts with APL Core Engine for component inflation and command
Expand Down
18 changes: 13 additions & 5 deletions apl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,22 @@ set(APL_DEPENDENCIES_DIR "${APL_CORE_DIR}/thirdparty")
include(${APL_DEPENDENCIES_DIR}/thirdparty.cmake)

# tools
set(EXTENSIONS_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/build-extensions)
set(APL_CORE_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/build)
include(${APL_CORE_DIR}/options.cmake)
include(${APL_CORE_DIR}/tools.cmake)

include_directories(${APL_CORE_DIR}/aplcore)
include_directories(${APL_CORE_BUILD_DIR/aplcore/include})

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

set(APL_CORE_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/build)
include(${APL_CORE_DIR}/options.cmake)
include(${APL_CORE_DIR}/tools.cmake)
# build folder
add_subdirectory(${APL_CORE_DIR}/extensions ${EXTENSIONS_BUILD_DIR})

target_compile_definitions(alexaext PUBLIC ALEXAEXTENSIONS)
add_dependencies(alexaext rapidjson-build)

# build folder
file(MAKE_DIRECTORY ${APL_CORE_DIR}/aplcore/build)
Expand All @@ -54,6 +61,7 @@ add_library(
src/main/cpp/jniextensionmediator.cpp
src/main/cpp/jnirootcontext.cpp
src/main/cpp/jnirootconfig.cpp
src/main/cpp/jnisession.cpp
src/main/cpp/jnicomponent.cpp
src/main/cpp/jnicomplexproperty.cpp
src/main/cpp/jnievent.cpp
Expand Down Expand Up @@ -92,7 +100,7 @@ target_link_libraries(
${log-lib})


target_link_libraries(apl-jni apl)
target_link_libraries(apl-jni apl alexaext)

# APL Core include and dependencies
include_directories(${APL_CORE_DIR}/aplcore/include)
Expand Down Expand Up @@ -204,4 +212,4 @@ find_program(CCACHE_FOUND ccache)
if(CCACHE_FOUND)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
endif(CCACHE_FOUND)
endif(CCACHE_FOUND)
62 changes: 62 additions & 0 deletions apl/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">

<module name="Checker">
<module name="RegexpHeader">
<property name="severity" value="error" />
<property name="header" value="\n/\*\n *Copyright( \([cC]\))?( \d{4})? Amazon\.com, Inc\. or its affiliates\. All Rights Reserved\." />
<property name="multiLines" value="1" />
<property name="fileExtensions" value="java,c,h,cc,hh,cpp,hpp" />
</module>
<module name="RegexpSingleline">
<property name="message" value="device codename referenced" />
<property name="severity" value="error" />
<property name="format" value="(?i)\b(knight|rook|bishop|checkers|crown|cronos|theia|athena|hoya|vega|rhea)" />
</module>
<module name="RegexpSingleline">
<property name="message" value="device build model referenced" />
<property name="severity" value="error" />
<property name="format" value="(?i)aeo(kn|rk|bp|ch|cw|cn|ta|at|hy)" />
</module>
<module name="RegexpSingleline">
<property name="message" value="internal system referenced" />
<property name="severity" value="error" />
<property name="format" value="(?i)\b(brazil|apollo|elon|jira|labcollab|codebuild|gitfarm|isengard|conduit|quip)" />
</module>
<module name="RegexpSingleline">
<property name="message" value="possible JIRA tag" />
<property name="severity" value="error" />
<property name="format" value="\b([A-Z]{1,10}-\d{2,10})(?&lt;!BCP-47|UTF-8|UTF-16)" />
</module>
<module name="RegexpSingleline">
<property name="message" value="internal package referenced" />
<property name="severity" value="error" />
<property name="format" value="(?i)\b(aria|ariaruntime|ariaruntimelibrary)" />
</module>
<module name="RegexpSingleline">
<property name="message" value="internal link referenced" />
<property name="severity" value="error" />
<property name="format" value="(?i)amazon\.dev|aws\.dev|a2z\.com|\b(corp|issues|w)\.amazon\.com|dev-dsk|arn:aws" />
</module>
<module name="RegexpSingleline">
<property name="message" value="possible internal link" />
<property name="severity" value="warning" />
<property name="format" value="(?&lt;!www|aws|developer)\.amazon\.com" />
</module>
<module name="RegexpSingleline">
<property name="message" value="internal email" />
<property name="format" value="(?i)@amazon\.com" />
</module>
<module name="RegexpSingleline">
<property name="severity" value="warning" />
<property name="message" value="possible employee login name" />
<property name="format" value="(?i)\w{1,8}@" />
</module>
<module name="RegexpSingleline">
<property name="severity" value="error" />
<property name="message" value="non-inclusive language" />
<property name="format" value="(?i)slave|(black|white) ?list" />
</module>
</module>
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ public class ExtensionMediatorTest extends APLViewhostTest {
@Mock
private IExtensionProvider mExtensionProvider;

@Mock
private Session mSession;

@Before
public void setup() {
MockitoAnnotations.initMocks(this);
Expand Down Expand Up @@ -108,7 +111,7 @@ public void testLoadExtensions_calls_onExtensionsLoadedCallback_only_once() thro

@Test
public void testInitializeExtensions_specific_grantedExtensions_loads_only_those_extensions() throws InterruptedException {
Content content = Content.create(mTestDoc, mOptions, mContentCallbackV2);
Content content = Content.create(mTestDoc, mOptions, mContentCallbackV2, mSession);
RootConfig rootConfig = RootConfig.create();
ExtensionRegistrar extensionRegistrar = new ExtensionRegistrar().addProvider(mExtensionProvider);
ExtensionMediator mediator = ExtensionMediator.create(extensionRegistrar);
Expand Down Expand Up @@ -167,7 +170,7 @@ public void testOnDocumentDisplayed() throws InterruptedException {
public void testExecutor() throws InterruptedException {
// given
RootConfig rootConfig = RootConfig.create();
Content content = Content.create(mTestDoc, mOptions, mContentCallbackV2);
Content content = Content.create(mTestDoc, mOptions, mContentCallbackV2, mSession);
TestLiveDataLocalExtension extension = spy(new TestLiveDataLocalExtension());
LegacyLocalExtensionProxy legacyLocalExtensionProxy = new LegacyLocalExtensionProxy(extension);
ExtensionRegistrar extensionRegistrar = new ExtensionRegistrar().addProvider(mExtensionProvider);
Expand All @@ -186,7 +189,7 @@ public void testExecutor() throws InterruptedException {
}

private ExtensionMediator loadExtensions() {
Content content = Content.create(mTestDoc, mOptions, mContentCallbackV2);
Content content = Content.create(mTestDoc, mOptions, mContentCallbackV2, mSession);
RootConfig rootConfig = RootConfig.create();
ExtensionMediator mediator = ExtensionMediator.create(mExtensionRegistrar);
mediator.initializeExtensions(rootConfig, content, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void doBefore() {
" \"selectOnFocus\": true," +
" \"size\": 10," +
" \"submitKeyType\": \"send\"," +
" \"text\": \"This is a text\"," +
" \"text\": \"19896 Text\"," +
" \"validCharacters\": \"0-9\"";
}

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ public void testMedia_Source() {
assertEquals(sources.size(), 1);

assertEquals(sources.at(0).url(), "URL1");
assertFalse(((Video) child).shouldMute());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,24 @@ private class InflateAPLViewAction implements ViewAction {
private final String mData;
private final APLOptions mOptions;
private final RootConfig mRootConfig;
private final String mDocument;

public InflateAPLViewAction(String componentProps, String documentProps, String payloadId, String data, APLOptions options, RootConfig rootConfig) {
InflateAPLViewAction(String document, String componentProps, String documentProps, String payloadId, String data, APLOptions options, RootConfig rootConfig) {
mComponentProps = componentProps;
mDocumentProps = documentProps;
mPayloadId = payloadId;
mData = data;
mOptions = options;
mRootConfig = rootConfig;
mDocument = document;
}

InflateAPLViewAction(String componentProps, String documentProps, String payloadId, String data, APLOptions options, RootConfig rootConfig) {
this(BASE_DOC, componentProps, documentProps, payloadId, data, options, rootConfig);
}

InflateAPLViewAction(String document, String payloadId, String data, APLOptions options, RootConfig rootConfig) {
this(document, "", "", payloadId, data, options, rootConfig);
}

@Override
Expand All @@ -125,15 +135,15 @@ public String getDescription() {
@Override
public void perform(UiController uiController, View view) {
mTestContext = new APLTestContext()
.setDocument(BASE_DOC, mPayloadId, mComponentProps, mDocumentProps)
.setDocument(mDocument, mPayloadId, mComponentProps, mDocumentProps)
.setDocumentPayload(mPayloadId, mData)
.setAplOptions(mOptions)
.buildRootContextDependencies();

if (mRootConfig != null) {
mTestContext.setRootConfig(mRootConfig);
}

APLLayout aplLayout = activityRule.getActivity().findViewById(com.amazon.apl.android.test.R.id.apl);
try {
mAplController = APLController.renderDocument(mTestContext.getContent(), mTestContext.getAplOptions(), mTestContext.getRootConfig(), aplLayout.getPresenter());
Expand Down Expand Up @@ -165,6 +175,10 @@ public ViewAction inflate(String componentProps, String documentProps) {
return inflateWithOptions(componentProps, documentProps, null);
}

public ViewAction inflateWithOptions(String document, APLOptions options) {
return actionWithAssertions(new InflateAPLViewAction(document, "payload", "{}", options, null));
}

public ViewAction inflateWithOptions(String componentProps, String documentProps, APLOptions options) {
return inflate(componentProps, documentProps, "payload", "{}", options);
}
Expand Down

0 comments on commit d0c90c5

Please sign in to comment.