├── .trivyignore ├── .base_version ├── js ├── tests │ ├── unit │ │ ├── .gitignore │ │ ├── .babelrc.json │ │ ├── package.json │ │ ├── eslint.config.mjs │ │ └── run-tests.sh │ ├── e2e │ │ ├── .prettierignore │ │ ├── tests │ │ │ ├── visual.spec.js-snapshots │ │ │ │ ├── long-press-home.png │ │ │ │ ├── status-bar-swipe.png │ │ │ │ └── app-drawer-settings.png │ │ │ ├── join.spec.js │ │ │ ├── shared.js │ │ │ └── visual.spec.js │ │ ├── .gitignore │ │ ├── run-tests.sh │ │ ├── eslint.config.mjs │ │ ├── fixtures │ │ │ ├── anbox-test.js │ │ │ ├── constants.cjs │ │ │ └── coverage.js │ │ ├── package.json │ │ ├── global-teardown.js │ │ ├── index.html │ │ ├── playwright.config.js │ │ └── global-setup.js │ └── combined-coverage-report.sh ├── run-tests.sh └── README.md ├── .gitignore ├── CODEOWNERS ├── android └── anbox_streaming_sdk │ ├── consumer-rules.pro │ ├── src │ └── main │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── com │ │ └── canonical │ │ └── anbox │ │ └── streaming_sdk │ │ ├── IMEJSInterface.java │ │ └── IMEService.java │ ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties │ ├── .gitignore │ ├── proguard-rules.pro │ ├── README.md │ ├── gradle.properties │ ├── build.gradle │ └── gradlew.bat ├── examples ├── android │ ├── out_of_band_v2 │ │ ├── app │ │ │ ├── .gitignore │ │ │ ├── src │ │ │ │ └── main │ │ │ │ │ ├── res │ │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ │ │ ├── ic_launcher.xml │ │ │ │ │ │ └── ic_launcher_round.xml │ │ │ │ │ ├── values │ │ │ │ │ │ ├── strings.xml │ │ │ │ │ │ ├── colors.xml │ │ │ │ │ │ └── themes.xml │ │ │ │ │ ├── values-night │ │ │ │ │ │ └── themes.xml │ │ │ │ │ ├── drawable-v24 │ │ │ │ │ │ └── ic_launcher_foreground.xml │ │ │ │ │ └── layout │ │ │ │ │ │ └── activity_main.xml │ │ │ │ │ ├── AndroidManifest.xml │ │ │ │ │ └── java │ │ │ │ │ └── com │ │ │ │ │ └── canonical │ │ │ │ │ └── anboxcloud │ │ │ │ │ └── outofbandappv2 │ │ │ │ │ └── DataReadTask.java │ │ │ ├── proguard-rules.pro │ │ │ └── build.gradle │ │ ├── settings.gradle │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ ├── gradle-wrapper.jar │ │ │ │ └── gradle-wrapper.properties │ │ ├── build.gradle │ │ ├── README.md │ │ ├── gradle.properties │ │ ├── gradlew.bat │ │ └── gradlew │ ├── webview_streaming │ │ ├── app │ │ │ ├── .gitignore │ │ │ ├── src │ │ │ │ └── main │ │ │ │ │ ├── assets │ │ │ │ │ ├── css │ │ │ │ │ │ └── style.css │ │ │ │ │ └── index.html │ │ │ │ │ ├── res │ │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ │ ├── values │ │ │ │ │ │ ├── colors.xml │ │ │ │ │ │ ├── strings.xml │ │ │ │ │ │ └── styles.xml │ │ │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ │ │ ├── ic_launcher.xml │ │ │ │ │ │ └── ic_launcher_round.xml │ │ │ │ │ ├── layout │ │ │ │ │ │ ├── activity_stream.xml │ │ │ │ │ │ └── activity_main.xml │ │ │ │ │ └── drawable-v24 │ │ │ │ │ │ └── ic_launcher_foreground.xml │ │ │ │ │ ├── AndroidManifest.xml │ │ │ │ │ └── java │ │ │ │ │ └── com │ │ │ │ │ └── canonical │ │ │ │ │ └── anbox │ │ │ │ │ └── streaming │ │ │ │ │ └── sdk │ │ │ │ │ └── webview_example │ │ │ │ │ └── MainActivity.java │ │ │ ├── proguard-rules.pro │ │ │ └── build.gradle │ │ ├── settings.gradle │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ ├── gradle-wrapper.jar │ │ │ │ └── gradle-wrapper.properties │ │ ├── .gitignore │ │ ├── build.gradle │ │ ├── gradle.properties │ │ ├── gradlew.bat │ │ └── gradlew │ └── enhanced_webview_streaming │ │ ├── app │ │ ├── .gitignore │ │ ├── src │ │ │ └── main │ │ │ │ ├── assets │ │ │ │ ├── css │ │ │ │ │ └── style.css │ │ │ │ └── index.html │ │ │ │ ├── res │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── values │ │ │ │ │ ├── colors.xml │ │ │ │ │ ├── strings.xml │ │ │ │ │ └── styles.xml │ │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ │ ├── ic_launcher.xml │ │ │ │ │ └── ic_launcher_round.xml │ │ │ │ ├── layout │ │ │ │ │ ├── activity_stream.xml │ │ │ │ │ └── activity_main.xml │ │ │ │ └── drawable-v24 │ │ │ │ │ └── ic_launcher_foreground.xml │ │ │ │ ├── AndroidManifest.xml │ │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── canonical │ │ │ │ └── anbox │ │ │ │ └── streaming_sdk │ │ │ │ └── enhanced_webview_example │ │ │ │ └── MainActivity.java │ │ ├── proguard-rules.pro │ │ └── build.gradle │ │ ├── settings.gradle │ │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ │ ├── .gitignore │ │ ├── build.gradle │ │ ├── gradle.properties │ │ ├── gradlew.bat │ │ └── README.md └── js │ ├── Dockerfile │ ├── README.md │ ├── run.sh │ ├── serve.py │ └── example.html ├── trivy.yaml ├── .github ├── CODEOWNERS ├── pull_request_template.md ├── workflows │ ├── cla_check.yaml │ ├── trivy-update.yaml │ ├── security-scan.yaml │ ├── release.yaml │ ├── cache-images.yaml │ ├── branch.yaml │ ├── tics.yaml │ └── pr.yaml ├── renovate.json └── actions │ └── setup-trivy │ └── action.yaml ├── scripts ├── run-tests.sh ├── setup-gh-ssh.sh ├── compare_kev_vulnerabilities.sh ├── gen-version.sh ├── clean-build.sh ├── validate.sh ├── build.sh └── build-with-docker.sh ├── SECURITY.md └── README.md /.trivyignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.base_version: -------------------------------------------------------------------------------- 1 | 1.29 2 | -------------------------------------------------------------------------------- /js/tests/unit/.gitignore: -------------------------------------------------------------------------------- 1 | coverage 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .npm 2 | node_modules 3 | .idea -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @canonical/anbox -------------------------------------------------------------------------------- /js/tests/e2e/.prettierignore: -------------------------------------------------------------------------------- 1 | **/node_modules -------------------------------------------------------------------------------- /android/anbox_streaming_sdk/consumer-rules.pro: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/android/out_of_band_v2/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /examples/android/webview_streaming/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /examples/android/enhanced_webview_streaming/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /examples/android/out_of_band_v2/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | rootProject.name = "Out of Band Data v2" 3 | -------------------------------------------------------------------------------- /examples/android/webview_streaming/app/src/main/assets/css/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-color:#000000 3 | } -------------------------------------------------------------------------------- /examples/android/webview_streaming/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name='WebViewStreaming' 2 | include ':app' 3 | -------------------------------------------------------------------------------- /examples/android/enhanced_webview_streaming/app/src/main/assets/css/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-color:#000000 3 | } -------------------------------------------------------------------------------- /examples/android/enhanced_webview_streaming/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name='EnhanceWebViewStreaming' 2 | include ':app' 3 | -------------------------------------------------------------------------------- /android/anbox_streaming_sdk/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /trivy.yaml: -------------------------------------------------------------------------------- 1 | format: table 2 | exit-code: 1 3 | severity: 4 | - MEDIUM 5 | - HIGH 6 | - CRITICAL 7 | scan: 8 | scanners: 9 | - vuln 10 | - secret 11 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # The Anbox team owns all for now 2 | * @canonical/anbox 3 | 4 | # The UI team should be included for all JS changes 5 | /js @canonical/anbox-ui 6 | 7 | -------------------------------------------------------------------------------- /android/anbox_streaming_sdk/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/canonical/anbox-streaming-sdk/main/android/anbox_streaming_sdk/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /js/tests/e2e/tests/visual.spec.js-snapshots/long-press-home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/canonical/anbox-streaming-sdk/main/js/tests/e2e/tests/visual.spec.js-snapshots/long-press-home.png -------------------------------------------------------------------------------- /js/tests/e2e/tests/visual.spec.js-snapshots/status-bar-swipe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/canonical/anbox-streaming-sdk/main/js/tests/e2e/tests/visual.spec.js-snapshots/status-bar-swipe.png -------------------------------------------------------------------------------- /examples/android/out_of_band_v2/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/canonical/anbox-streaming-sdk/main/examples/android/out_of_band_v2/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /examples/android/webview_streaming/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/canonical/anbox-streaming-sdk/main/examples/android/webview_streaming/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /js/tests/e2e/tests/visual.spec.js-snapshots/app-drawer-settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/canonical/anbox-streaming-sdk/main/js/tests/e2e/tests/visual.spec.js-snapshots/app-drawer-settings.png -------------------------------------------------------------------------------- /examples/android/out_of_band_v2/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/canonical/anbox-streaming-sdk/main/examples/android/out_of_band_v2/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /examples/android/out_of_band_v2/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/canonical/anbox-streaming-sdk/main/examples/android/out_of_band_v2/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /examples/android/enhanced_webview_streaming/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/canonical/anbox-streaming-sdk/main/examples/android/enhanced_webview_streaming/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /examples/android/out_of_band_v2/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/canonical/anbox-streaming-sdk/main/examples/android/out_of_band_v2/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /examples/android/out_of_band_v2/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/canonical/anbox-streaming-sdk/main/examples/android/out_of_band_v2/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /examples/android/out_of_band_v2/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/canonical/anbox-streaming-sdk/main/examples/android/out_of_band_v2/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /examples/android/webview_streaming/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/canonical/anbox-streaming-sdk/main/examples/android/webview_streaming/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /examples/android/webview_streaming/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/canonical/anbox-streaming-sdk/main/examples/android/webview_streaming/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /examples/android/webview_streaming/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/canonical/anbox-streaming-sdk/main/examples/android/webview_streaming/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /examples/android/webview_streaming/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/canonical/anbox-streaming-sdk/main/examples/android/webview_streaming/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /js/tests/e2e/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | /test-results/ 3 | /playwright-report/ 4 | /blob-report/ 5 | /playwright/.cache/ 6 | .cache/ 7 | coverage/ 8 | 9 | .env.local 10 | anbox-cloud.crt 11 | anbox-cloud.key 12 | -------------------------------------------------------------------------------- /examples/android/out_of_band_v2/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/canonical/anbox-streaming-sdk/main/examples/android/out_of_band_v2/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /examples/android/out_of_band_v2/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/canonical/anbox-streaming-sdk/main/examples/android/out_of_band_v2/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /examples/android/out_of_band_v2/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/canonical/anbox-streaming-sdk/main/examples/android/out_of_band_v2/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /examples/android/out_of_band_v2/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/canonical/anbox-streaming-sdk/main/examples/android/out_of_band_v2/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /examples/android/webview_streaming/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/canonical/anbox-streaming-sdk/main/examples/android/webview_streaming/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /examples/android/out_of_band_v2/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/canonical/anbox-streaming-sdk/main/examples/android/out_of_band_v2/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /examples/android/webview_streaming/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/canonical/anbox-streaming-sdk/main/examples/android/webview_streaming/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /examples/android/webview_streaming/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/canonical/anbox-streaming-sdk/main/examples/android/webview_streaming/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /examples/android/webview_streaming/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/canonical/anbox-streaming-sdk/main/examples/android/webview_streaming/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /examples/android/enhanced_webview_streaming/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/canonical/anbox-streaming-sdk/main/examples/android/enhanced_webview_streaming/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /examples/android/enhanced_webview_streaming/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/canonical/anbox-streaming-sdk/main/examples/android/enhanced_webview_streaming/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /examples/android/enhanced_webview_streaming/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/canonical/anbox-streaming-sdk/main/examples/android/enhanced_webview_streaming/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /examples/android/webview_streaming/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/canonical/anbox-streaming-sdk/main/examples/android/webview_streaming/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /examples/android/webview_streaming/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/canonical/anbox-streaming-sdk/main/examples/android/webview_streaming/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /examples/android/enhanced_webview_streaming/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/canonical/anbox-streaming-sdk/main/examples/android/enhanced_webview_streaming/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /examples/android/enhanced_webview_streaming/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/canonical/anbox-streaming-sdk/main/examples/android/enhanced_webview_streaming/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /examples/android/enhanced_webview_streaming/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/canonical/anbox-streaming-sdk/main/examples/android/enhanced_webview_streaming/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /examples/android/enhanced_webview_streaming/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/canonical/anbox-streaming-sdk/main/examples/android/enhanced_webview_streaming/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /examples/android/enhanced_webview_streaming/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/canonical/anbox-streaming-sdk/main/examples/android/enhanced_webview_streaming/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /examples/android/enhanced_webview_streaming/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/canonical/anbox-streaming-sdk/main/examples/android/enhanced_webview_streaming/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /examples/android/enhanced_webview_streaming/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/canonical/anbox-streaming-sdk/main/examples/android/enhanced_webview_streaming/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /js/tests/unit/.babelrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | [ 4 | "@babel/preset-env",{ 5 | "targets":{ 6 | "node":"current" 7 | } 8 | } 9 | ] 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /examples/android/webview_streaming/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #6200EE 4 | #3700B3 5 | #03DAC5 6 | 7 | -------------------------------------------------------------------------------- /android/anbox_streaming_sdk/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | local.properties 4 | .idea/caches 5 | .idea/libraries 6 | .idea/modules.xml 7 | .idea/workspace.xml 8 | .idea/navEditor.xml 9 | .idea/assetWizardSettings.xml 10 | .DS_Store 11 | build 12 | captures 13 | .externalNativeBuild 14 | .cxx 15 | -------------------------------------------------------------------------------- /examples/android/enhanced_webview_streaming/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #6200EE 4 | #3700B3 5 | #03DAC5 6 | 7 | -------------------------------------------------------------------------------- /examples/android/enhanced_webview_streaming/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | local.properties 4 | .idea/caches 5 | .idea/libraries 6 | .idea/modules.xml 7 | .idea/workspace.xml 8 | .idea/navEditor.xml 9 | .idea/assetWizardSettings.xml 10 | .DS_Store 11 | build 12 | captures 13 | .externalNativeBuild 14 | .cxx 15 | -------------------------------------------------------------------------------- /examples/android/webview_streaming/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | .cxx 15 | -------------------------------------------------------------------------------- /examples/android/out_of_band_v2/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jul 09 12:37:45 SBT 2021 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip 7 | -------------------------------------------------------------------------------- /examples/android/webview_streaming/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Jun 22 18:40:28 CST 2020 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip 7 | -------------------------------------------------------------------------------- /examples/android/enhanced_webview_streaming/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Jun 22 18:40:28 CST 2020 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip 7 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | ## Done 2 | 3 | [Summary of work items] 4 | 5 | ## QA 6 | 7 | [Steps for how to test the changes] 8 | 9 | ## JIRA / Launchpad bug 10 | 11 | Fixes # 12 | 13 | ## Documentation 14 | 15 | Does this impact the team's internal or public documentation? If yes, has the relevant documentation been updated? -------------------------------------------------------------------------------- /android/anbox_streaming_sdk/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-all.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /examples/android/out_of_band_v2/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /examples/android/webview_streaming/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /examples/android/out_of_band_v2/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /examples/js/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:18.04 2 | 3 | RUN apt update && apt upgrade -y && apt install -y python3 4 | 5 | RUN mkdir -p /app/demos 6 | 7 | COPY example.html /app/demos 8 | COPY sgsr.html /app/demos 9 | COPY anime4K.html /app/demos 10 | COPY anbox-stream-sdk.js /app 11 | COPY serve.py /app 12 | 13 | EXPOSE 8000 14 | CMD cd /app && python3 ./serve.py 15 | -------------------------------------------------------------------------------- /examples/android/enhanced_webview_streaming/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /examples/android/webview_streaming/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /examples/android/enhanced_webview_streaming/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /.github/workflows/cla_check.yaml: -------------------------------------------------------------------------------- 1 | name: CLA check 2 | 3 | on: 4 | pull_request: 5 | branches: [master] 6 | 7 | jobs: 8 | cla-check: 9 | runs-on: ubuntu-24.04 10 | steps: 11 | - name: Check if Canonical's Contributor License Agreement has been signed 12 | uses: canonical/has-signed-canonical-cla@1c20438ad54b4d37105e777000545881d2293ba4 # 2.2.0 13 | -------------------------------------------------------------------------------- /examples/android/out_of_band_v2/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Out of band v2 3 | Connect 4 | Send 5 | Channel name 6 | Received data 7 | Text to be sent 8 | 9 | -------------------------------------------------------------------------------- /examples/android/out_of_band_v2/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFBB86FC 4 | #FF6200EE 5 | #FF3700B3 6 | #FF03DAC5 7 | #FF018786 8 | #FF000000 9 | #FFFFFFFF 10 | -------------------------------------------------------------------------------- /examples/android/webview_streaming/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | WebViewStreaming 3 | StreamActivity 4 | URL of the gateway 5 | Gateway API token 6 | Stream 7 | Name of the application to stream 8 | 9 | -------------------------------------------------------------------------------- /examples/android/enhanced_webview_streaming/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | EnhancedWebViewStreaming 3 | StreamActivity 4 | URL of the gateway 5 | Gateway API token 6 | Stream 7 | Name of the application to stream 8 | 9 | -------------------------------------------------------------------------------- /examples/js/README.md: -------------------------------------------------------------------------------- 1 | # Anbox Streaming SDK Example 2 | 3 | This directory contains the bare minimum to start a stream on the Anbox Streaming Stack. 4 | 5 | ## Prerequisites 6 | For this example you'll need the following: 7 | 8 | - An Anbox Streaming Stack deployment 9 | - A Stream Gateway API token 10 | - At least one registered application on AMS 11 | 12 | ## Running the example 13 | You'll need a webserver serving the content for the example. A simple server can be created 14 | with the following command in the example directory: 15 | 16 | python3 -m http.server 8080 17 | 18 | And open your web browser to `127.0.0.1:8080`. 19 | 20 | 21 | -------------------------------------------------------------------------------- /examples/android/out_of_band_v2/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | buildscript { 3 | repositories { 4 | google() 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:8.7.2' 9 | 10 | // NOTE: Do not place your application dependencies here; they belong 11 | // in the individual module build.gradle files 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | google() 18 | jcenter() 19 | } 20 | } 21 | 22 | task clean(type: Delete) { 23 | delete rootProject.buildDir 24 | } 25 | -------------------------------------------------------------------------------- /examples/android/webview_streaming/app/src/main/res/layout/activity_stream.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 13 | 14 | -------------------------------------------------------------------------------- /.github/renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json", 3 | "extends": [ 4 | "config:recommended", 5 | ":disableDependencyDashboard", 6 | "schedule:earlyMondays", 7 | ":combinePatchMinorReleases", 8 | ":ignoreUnstable", 9 | "helpers:pinGitHubActionDigestsToSemver", 10 | "group:allNonMajor", 11 | "group:allDigest" 12 | ], 13 | "packageRules": [ 14 | { 15 | "groupName": "GitHub actions", 16 | "matchManagers": [ 17 | "github-actions" 18 | ], 19 | "matchUpdateTypes": [ 20 | "digest", 21 | "patch", 22 | "minor", 23 | "major" 24 | ] 25 | } 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /examples/android/webview_streaming/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | 5 | repositories { 6 | google() 7 | jcenter() 8 | 9 | } 10 | dependencies { 11 | classpath 'com.android.tools.build:gradle:8.7.2' 12 | // NOTE: Do not place your application dependencies here; they belong 13 | // in the individual module build.gradle files 14 | } 15 | } 16 | 17 | allprojects { 18 | repositories { 19 | google() 20 | jcenter() 21 | 22 | } 23 | } 24 | 25 | task clean(type: Delete) { 26 | delete rootProject.buildDir 27 | } 28 | -------------------------------------------------------------------------------- /js/run-tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | # 3 | # Copyright 2021 Canonical Ltd. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | cd tests/unit 18 | $PWD/run-tests.sh $@ 19 | -------------------------------------------------------------------------------- /examples/android/enhanced_webview_streaming/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | 5 | repositories { 6 | google() 7 | jcenter() 8 | 9 | } 10 | dependencies { 11 | classpath 'com.android.tools.build:gradle:8.7.2' 12 | // NOTE: Do not place your application dependencies here; they belong 13 | // in the individual module build.gradle files 14 | } 15 | } 16 | 17 | allprojects { 18 | repositories { 19 | google() 20 | jcenter() 21 | 22 | } 23 | } 24 | 25 | task clean(type: Delete) { 26 | delete rootProject.buildDir 27 | } 28 | -------------------------------------------------------------------------------- /.github/workflows/trivy-update.yaml: -------------------------------------------------------------------------------- 1 | name: Update Trivy cache 2 | on: 3 | workflow_dispatch: 4 | # Run daily after midnight UTC 5 | schedule: 6 | - cron: '0 1 * * *' 7 | 8 | jobs: 9 | trivy-update: 10 | strategy: 11 | fail-fast: false 12 | matrix: 13 | arch: [arm64, amd64] 14 | runs-on: [self-hosted, linux, "${{ matrix.arch == 'amd64' && 'X64' || 'ARM64' }}", jammy, large] 15 | steps: 16 | - name: Check out repository 17 | uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 18 | with: 19 | fetch-depth: 0 20 | - name: Setup Trivy to warm up the cache 21 | uses: ./.github/actions/setup-trivy 22 | with: 23 | arch: ${{ matrix.arch }} 24 | -------------------------------------------------------------------------------- /examples/android/enhanced_webview_streaming/app/src/main/res/layout/activity_stream.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /scripts/run-tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -ex 2 | # 3 | # Copyright 2020 Canonical Ltd. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | for component in js ; do 18 | ( cd "$component"; ./run-tests.sh $@ ) 19 | done 20 | -------------------------------------------------------------------------------- /scripts/setup-gh-ssh.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -ex 2 | # Copyright 2024 Canonical Ltd. All rights reserved. 3 | 4 | # The key is provided through a secret and we need to write it to 5 | # disk in order to load it into the SSH agent 6 | mkdir -p "$HOME"/.ssh 7 | echo "$ANBOX_CLOUD_CI_BOT_SSH_KEY" > "$HOME"/.ssh/id_bot 8 | chmod 0600 "$HOME"/.ssh/id_bot 9 | 10 | # Setup a host alias we can use with git push 11 | cat << EOF > "$HOME"/.ssh/config 12 | Host github-anbox-streaming-sdk 13 | Hostname github.com 14 | IdentityFile=$HOME/.ssh/id_bot 15 | EOF 16 | 17 | # We need to trust the SSH host key from GitHub 18 | ssh-keyscan github.com > "$HOME"/.ssh/known_hosts 19 | 20 | # And now we can finally start the agent and load our key 21 | eval "$(ssh-agent -s)" 22 | ssh-add "$HOME"/.ssh/id_bot 23 | -------------------------------------------------------------------------------- /js/tests/combined-coverage-report.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -ex 2 | # 3 | # Copyright 2024 Canonical Ltd. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | cd unit && sh run-tests.sh && cd ../e2e && sh run-tests.sh && mkdir -p coverage/combined-report && npm run test-report-coverage 18 | -------------------------------------------------------------------------------- /examples/android/out_of_band_v2/README.md: -------------------------------------------------------------------------------- 1 | # Anbox Cloud - Out of Band Data v2 2 | 3 | An Android application that demonstrates how to use [out of band data v2](https://documentation.ubuntu.com/anbox-cloud/en/latest/howto/stream/exchange-oob-data/#version-2) feature to exchange data between an Android application running within an Android container and a WebRTC client. 4 | 5 | **NOTE**: After building the application, the resulting APK must be installed and running as a system app in the Android container to communicate with [org.anbox.webrtc.IDataProxyService](https://documentation.ubuntu.com/anbox-cloud/en/latest/howto/stream/exchange-oob-data/#anbox-webrtc-data-proxy) system service for data exchange. See the guide on [how to install an APK as a system app](https://documentation.ubuntu.com/anbox-cloud/en/latest/howto/port/install-apk-system-app) for more information. 6 | -------------------------------------------------------------------------------- /android/anbox_streaming_sdk/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /examples/android/out_of_band_v2/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /examples/android/webview_streaming/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /js/tests/unit/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "anbox-stream-sdk-unit-tests", 3 | "version": "1.13.0", 4 | "description": "unit testing for anbox stream sdk (JS only)", 5 | "scripts": { 6 | "test": "jest", 7 | "test:coverage": "jest --coverage --coverageDirectory=coverage --coverageProvider=v8" 8 | }, 9 | "author": "indore-team@launchpad.net", 10 | "license": "Proprietary", 11 | "jest": { 12 | "testEnvironment": "jsdom" 13 | }, 14 | "devDependencies": { 15 | "@babel/core": "^7.26.0", 16 | "@babel/preset-env": "^7.26.0", 17 | "@eslint/js": "9.17.0", 18 | "@eslint/eslintrc": "3.2.0", 19 | "eslint": "^9.17.0", 20 | "eslint-config-prettier": "^9.1.0", 21 | "eslint-plugin-prettier": "^5.2.1", 22 | "globals": "15.14.0", 23 | "jest": "^29.7.0", 24 | "jest-environment-jsdom": "^29.7.0", 25 | "prettier": "3.4.2" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /examples/android/enhanced_webview_streaming/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /js/tests/unit/eslint.config.mjs: -------------------------------------------------------------------------------- 1 | import globals from "globals"; 2 | import path from "node:path"; 3 | import { fileURLToPath } from "node:url"; 4 | import js from "@eslint/js"; 5 | import { FlatCompat } from "@eslint/eslintrc"; 6 | 7 | const __filename = fileURLToPath(import.meta.url); 8 | const __dirname = path.dirname(__filename); 9 | const compat = new FlatCompat({ 10 | baseDirectory: __dirname, 11 | recommendedConfig: js.configs.recommended, 12 | allConfig: js.configs.all, 13 | }); 14 | 15 | export default [ 16 | ...compat.extends("eslint:recommended", "plugin:prettier/recommended"), 17 | { 18 | languageOptions: { 19 | globals: { 20 | ...globals.browser, 21 | ...globals.node, 22 | ...globals.jest, 23 | ...globals.jasmine, 24 | }, 25 | 26 | ecmaVersion: "latest", 27 | sourceType: "module", 28 | }, 29 | }, 30 | ]; 31 | -------------------------------------------------------------------------------- /examples/android/out_of_band_v2/app/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | -------------------------------------------------------------------------------- /examples/android/out_of_band_v2/app/src/main/res/values-night/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | -------------------------------------------------------------------------------- /.github/workflows/security-scan.yaml: -------------------------------------------------------------------------------- 1 | name: Run security scan 2 | on: 3 | push: 4 | branches: 5 | - main 6 | - stable-* 7 | pull_request: 8 | 9 | concurrency: 10 | group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} 11 | cancel-in-progress: true 12 | 13 | jobs: 14 | build: 15 | name: Run Trivy security scan 16 | runs-on: [self-hosted, linux, X64, jammy, large] 17 | steps: 18 | - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 19 | - name: Setup Trivy 20 | uses: ./.github/actions/setup-trivy 21 | - name: Run Trivy vulnerability scanner 22 | run: | 23 | trivy repository "$GITHUB_WORKSPACE" \ 24 | -c trivy.yaml \ 25 | --ignorefile .trivyignore \ 26 | --show-suppressed \ 27 | --cache-dir="$GITHUB_WORKSPACE"/.cache/trivy 28 | - name: Compare Trivy results with KEV list 29 | run: bash ./scripts/compare_kev_vulnerabilities.sh 30 | -------------------------------------------------------------------------------- /js/tests/e2e/tests/join.spec.js: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of Anbox Cloud Streaming SDK 3 | * 4 | * Copyright 2024 Canonical Ltd. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | import { test } from "../fixtures/anbox-test"; 20 | import { joinSession, disconnectStream } from "./shared"; 21 | 22 | test("join session and disconnect stream", async ({ page }) => { 23 | await joinSession(page, process.env.AOSP_SESSION_ID); 24 | await disconnectStream(page); 25 | }); 26 | -------------------------------------------------------------------------------- /examples/android/webview_streaming/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 17 | 18 | 22 | 23 | -------------------------------------------------------------------------------- /examples/android/enhanced_webview_streaming/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 17 | 18 | 22 | 23 | -------------------------------------------------------------------------------- /js/tests/e2e/run-tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -ex 2 | # 3 | # Copyright 2024 Canonical Ltd. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | ANBOX_STREAMING_SDK_DIR="$PWD/../../" 18 | 19 | docker run --rm \ 20 | -v "$ANBOX_STREAMING_SDK_DIR:/anbox-streaming-sdk-js" \ 21 | node:22 \ 22 | bash -c "cd /anbox-streaming-sdk-js/tests/e2e && \ 23 | npm ci && \ 24 | npx playwright install --with-deps && \ 25 | npm run test:coverage && \ 26 | chown -R $(id -u ${USER}):$(id -g ${USER}) coverage" 27 | -------------------------------------------------------------------------------- /android/anbox_streaming_sdk/README.md: -------------------------------------------------------------------------------- 1 | # Anbox Streaming SDK 2 | 3 | The Anbox Streaming SDK enables developers to build a hybrid mobile application 4 | that can integrate the features that Anbox Cloud provides. It comes with an 5 | Android library that offers easy-to-use native components like AnboxWebView, 6 | which extends the AOSP WebView. It provides better handling of text input for 7 | the hybrid application that loads the Anbox Streaming JavaScript SDK with an 8 | embedded WebView for video streaming. 9 | 10 | ## Build the AAR library 11 | 12 | 1. Import the project into Android studio 13 | 2. Go to menu bar and click `Build` -> `Make Module 'anbox_streaming_sdk'` 14 | 15 | After the compilation is done, you'll get a piece of an aar file for all build 16 | flavors in the build/outputs/aar/ directory of the project. 17 | 18 | ## Integrate the AAR library into your project 19 | 20 | See the [development documentation](https://documentation.ubuntu.com/anbox-cloud/en/latest/howto/stream/integrate-virtual-keyboard/) 21 | for how to integrate the AAR library into your project. 22 | -------------------------------------------------------------------------------- /js/tests/e2e/eslint.config.mjs: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of Anbox Cloud Streaming SDK 3 | * 4 | * Copyright 2024 Canonical Ltd. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | import globals from "globals"; 20 | import pluginJs from "@eslint/js"; 21 | import eslintConfigPrettier from "eslint-config-prettier"; 22 | 23 | export default [ 24 | { languageOptions: { globals: { ...globals.browser, ...globals.node } } }, 25 | { ignores: [".cache/"] }, 26 | pluginJs.configs.recommended, 27 | eslintConfigPrettier, 28 | ]; 29 | -------------------------------------------------------------------------------- /android/anbox_streaming_sdk/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx1536m 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app's APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Automatically convert third-party libraries to use AndroidX 19 | android.enableJetifier=true 20 | 21 | -------------------------------------------------------------------------------- /examples/js/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -ex 2 | # 3 | # This file is part of Anbox Cloud Streaming SDK 4 | # 5 | # Copyright 2021 Canonical Ltd. 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | 19 | if [ -e .last_docker_id ]; then 20 | id=$(cat .last_docker_id) 21 | docker stop $id || true 22 | rm .last_docker_id 23 | fi 24 | 25 | echo "INFO: Building container image ..." 26 | docker build . -t anbox-stream-sdk-example:latest 27 | id=$(docker run -d --rm -p 8000:8000 anbox-stream-sdk-example:latest) 28 | echo "$id" > .last_docker_id 29 | 30 | echo "INFO: Container up and running, open http://localhost:8000/demos in your browser ..." 31 | -------------------------------------------------------------------------------- /examples/android/webview_streaming/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx1536m 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app's APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Automatically convert third-party libraries to use AndroidX 19 | android.enableJetifier=true 20 | 21 | -------------------------------------------------------------------------------- /examples/android/out_of_band_v2/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app"s APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Automatically convert third-party libraries to use AndroidX 19 | android.enableJetifier=true -------------------------------------------------------------------------------- /examples/android/enhanced_webview_streaming/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx1536m 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app's APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Automatically convert third-party libraries to use AndroidX 19 | android.enableJetifier=true 20 | 21 | -------------------------------------------------------------------------------- /examples/android/webview_streaming/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | namespace "com.canonical.anbox.streaming.sdk.webview_example" 5 | compileSdkVersion 30 6 | 7 | defaultConfig { 8 | applicationId "com.canonical.anbox.streaming.sdk.webview_example" 9 | minSdkVersion 26 10 | targetSdkVersion 30 11 | versionCode 1 12 | versionName "1.0" 13 | 14 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 15 | } 16 | 17 | buildTypes { 18 | release { 19 | minifyEnabled false 20 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 21 | } 22 | } 23 | 24 | } 25 | 26 | dependencies { 27 | implementation fileTree(dir: 'libs', include: ['*.jar']) 28 | 29 | implementation 'androidx.appcompat:appcompat:1.1.0' 30 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 31 | implementation 'androidx.webkit:webkit:1.2.0' 32 | testImplementation 'junit:junit:4.12' 33 | androidTestImplementation 'androidx.test.ext:junit:1.1.1' 34 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' 35 | } 36 | -------------------------------------------------------------------------------- /examples/android/webview_streaming/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /scripts/compare_kev_vulnerabilities.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -ex 2 | # 3 | # Copyright 2025 Canonical Ltd. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | trivy fs "$GITHUB_WORKSPACE" --format json --output trivy-full-report.json 18 | 19 | kev_cves="$(jq -r '.vulnerabilities[].cveID' kev.json | sort -u)" 20 | 21 | found_cves="$(jq -r '.Results[] | select(.Vulnerabilities != null) | .Vulnerabilities[].VulnerabilityID' trivy-full-report.json | sort -u)" 22 | 23 | matches="$(echo "$found_cves" | grep -F -f <(echo "$kev_cves") || true)" 24 | 25 | if [ -n "$matches" ]; then 26 | echo "KEV listed vulnerabilities found." 27 | echo "$matches" 28 | exit 1 29 | fi 30 | 31 | echo "No KEV listed vulnerabilities found." 32 | -------------------------------------------------------------------------------- /examples/js/serve.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # encoding: utf-8 3 | # 4 | # This file is part of Anbox Cloud Streaming SDK 5 | # 6 | # Copyright 2021 Canonical Ltd. 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | 20 | from http.server import HTTPServer, SimpleHTTPRequestHandler 21 | 22 | class CORSRequestHandler(SimpleHTTPRequestHandler): 23 | def end_headers(self): 24 | self.send_header('Access-Control-Allow-Origin', '*') 25 | self.send_header('Access-Control-Allow-Methods', 'GET') 26 | self.send_header('Cache-Control', 'no-store, no-cache, must-revalidate') 27 | return super(CORSRequestHandler, self).end_headers() 28 | 29 | httpd = HTTPServer(('', 8000), CORSRequestHandler) 30 | httpd.serve_forever() 31 | -------------------------------------------------------------------------------- /examples/android/out_of_band_v2/app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.android.application' 3 | } 4 | 5 | android { 6 | namespace "com.canonical.anboxcloud.outofbandappv2" 7 | compileSdkVersion 30 8 | 9 | defaultConfig { 10 | applicationId "com.canonical.anboxcloud.outofbandappv2" 11 | minSdkVersion 16 12 | targetSdkVersion 30 13 | versionCode 1 14 | versionName "1.0" 15 | 16 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 17 | } 18 | 19 | buildTypes { 20 | release { 21 | minifyEnabled false 22 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 23 | } 24 | } 25 | compileOptions { 26 | sourceCompatibility JavaVersion.VERSION_1_8 27 | targetCompatibility JavaVersion.VERSION_1_8 28 | } 29 | } 30 | 31 | dependencies { 32 | 33 | implementation 'androidx.appcompat:appcompat:1.2.0' 34 | implementation 'com.google.android.material:material:1.1.0' 35 | implementation 'androidx.constraintlayout:constraintlayout:2.0.4' 36 | testImplementation 'junit:junit:4.+' 37 | androidTestImplementation 'androidx.test.ext:junit:1.1.2' 38 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' 39 | } 40 | -------------------------------------------------------------------------------- /examples/android/enhanced_webview_streaming/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | namespace "com.canonical.anbox.streaming_sdk.enhanced_webview_example" 5 | compileSdkVersion 30 6 | 7 | defaultConfig { 8 | applicationId "com.canonical.anbox.streaming_sdk.enhanced_webview_example" 9 | minSdkVersion 26 10 | targetSdkVersion 30 11 | versionCode 1 12 | versionName "1.0" 13 | 14 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 15 | } 16 | 17 | buildTypes { 18 | release { 19 | minifyEnabled false 20 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 21 | } 22 | } 23 | 24 | } 25 | 26 | dependencies { 27 | implementation fileTree(dir: 'libs', include: ['*.jar']) 28 | implementation fileTree(dir: 'libs', include: ['*.aar']) 29 | 30 | implementation 'androidx.appcompat:appcompat:1.1.0' 31 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 32 | implementation 'androidx.webkit:webkit:1.2.0' 33 | testImplementation 'junit:junit:4.12' 34 | androidTestImplementation 'androidx.test.ext:junit:1.1.1' 35 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' 36 | } 37 | -------------------------------------------------------------------------------- /js/tests/e2e/fixtures/anbox-test.js: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of Anbox Cloud Streaming SDK 3 | * 4 | * Copyright 2024 Canonical Ltd. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | import { test as base } from "@playwright/test"; 20 | import { finishCoverage, startCoverage } from "./coverage.js"; 21 | 22 | export const test = base.extend({ 23 | runCoverage: [ 24 | async ({ page, browserName }, use) => { 25 | const supportsCoverage = browserName === "chromium"; 26 | if (supportsCoverage) { 27 | await startCoverage(page); 28 | } 29 | await use(page); 30 | if (supportsCoverage) { 31 | await finishCoverage(page); 32 | } 33 | }, 34 | { auto: true }, 35 | ], 36 | }); 37 | 38 | export const expect = test.expect; 39 | -------------------------------------------------------------------------------- /android/anbox_streaming_sdk/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | jcenter() 4 | google() 5 | } 6 | dependencies { 7 | classpath 'com.android.tools.build:gradle:8.7.3' 8 | } 9 | } 10 | 11 | allprojects { 12 | repositories { 13 | google() 14 | jcenter() 15 | } 16 | } 17 | 18 | apply plugin: 'com.android.library' 19 | 20 | android { 21 | namespace 'com.canonical.anbox.streaming_sdk' 22 | compileSdkVersion 30 23 | 24 | defaultConfig { 25 | minSdkVersion 23 26 | targetSdkVersion 30 27 | versionCode 1 28 | versionName "1.0" 29 | 30 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 31 | consumerProguardFiles "consumer-rules.pro" 32 | } 33 | 34 | buildTypes { 35 | release { 36 | minifyEnabled false 37 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 38 | } 39 | } 40 | } 41 | 42 | dependencies { 43 | implementation fileTree(dir: "libs", include: ["*.jar"]) 44 | implementation 'androidx.appcompat:appcompat:1.7.0' 45 | testImplementation 'junit:junit:4.13.2' 46 | androidTestImplementation 'androidx.test.ext:junit:1.2.1' 47 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1' 48 | 49 | } 50 | -------------------------------------------------------------------------------- /js/tests/e2e/fixtures/constants.cjs: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of Anbox Cloud Streaming SDK 3 | * 4 | * Copyright 2024 Canonical Ltd. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | const AOSP_APP_NAME = "streaming-sdk-e2e-tests_AOSP"; 20 | const AAOS_APP_NAME = "streaming-sdk-e2e-tests_AAOS"; 21 | const DEFAULT_ARCH = "amd64"; 22 | const SERVER_PORT = 2999; 23 | const BASE_URL = `http://127.0.0.1:${SERVER_PORT}`; 24 | 25 | const SHARED_BROWSER_OPTIONS = { 26 | hasTouch: true, 27 | viewport: { width: 1280, height: 720 }, 28 | }; 29 | 30 | exports.AOSP_APP_NAME = AOSP_APP_NAME; 31 | exports.AAOS_APP_NAME = AAOS_APP_NAME; 32 | exports.DEFAULT_ARCH = DEFAULT_ARCH; 33 | exports.SERVER_PORT = SERVER_PORT; 34 | exports.BASE_URL = BASE_URL; 35 | exports.SHARED_BROWSER_OPTIONS = SHARED_BROWSER_OPTIONS; 36 | -------------------------------------------------------------------------------- /js/tests/e2e/tests/shared.js: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of Anbox Cloud Streaming SDK 3 | * 4 | * Copyright 2024 Canonical Ltd. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | import { expect } from "../fixtures/anbox-test"; 20 | 21 | export const joinSession = async (page, sessionId) => { 22 | await page.goto(`/?sessionId=${sessionId}`); 23 | 24 | await expect(page.locator("#anbox-stream").locator("video")).toHaveCount(1); 25 | await expect(page.locator("#anbox-stream").locator("audio")).toHaveCount(1); 26 | await page.waitForFunction(() => globalThis.isReady !== undefined, null, { 27 | timeout: 20_000, 28 | }); 29 | }; 30 | 31 | export const disconnectStream = async (page) => { 32 | await page.evaluate(() => globalThis.stream.disconnect()); 33 | await page.waitForFunction(() => globalThis.isClosed !== undefined, null, { 34 | timeout: 20_000, 35 | }); 36 | }; 37 | -------------------------------------------------------------------------------- /.github/workflows/release.yaml: -------------------------------------------------------------------------------- 1 | name: Release 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | tag_name: 7 | description: 'Tag name for the release' 8 | required: true 9 | target_commitish: 10 | description: | 11 | Target commitish (see GH API) for tag creation. 12 | Can be empty - it will default to the head of the branch it is run from. 13 | required: false 14 | 15 | # To publish assets to on GitHub release pages 16 | permissions: 17 | contents: write 18 | 19 | jobs: 20 | build: 21 | runs-on: ubuntu-latest 22 | environment: stable 23 | 24 | steps: 25 | - name: Checkout repository 26 | uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 27 | with: 28 | fetch-depth: 0 29 | 30 | - name: Build 31 | run: | 32 | ./scripts/build.sh --create-tarball --version=${{ inputs.tag_name }} 33 | 34 | - name: Run tests 35 | run: | 36 | ./scripts/run-tests.sh 37 | 38 | - name: Release 39 | env: 40 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 41 | run: | 42 | gh release create "${{ inputs.tag_name }}" \ 43 | anbox-streaming-sdk_${{ inputs.tag_name }}.zip \ 44 | --target "${{ inputs.target_commitish || github.ref }}" \ 45 | --title "${{ inputs.tag_name }}" \ 46 | --notes "See https://documentation.ubuntu.com/anbox-cloud/reference/release-notes/${{ inputs.tag_name }}/ for more information." 47 | -------------------------------------------------------------------------------- /.github/workflows/cache-images.yaml: -------------------------------------------------------------------------------- 1 | name: Cache Anbox images 2 | 3 | on: 4 | workflow_dispatch: 5 | schedule: 6 | - cron: '0 10 * * *' 7 | 8 | jobs: 9 | cache-images: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 13 | - name: Download images 14 | env: 15 | IMAGE_SERVER_BUCKET: nightly 16 | run: | 17 | base_version="$(cat .base_version)" 18 | channel="$base_version"/edge 19 | image_server_url=https://"${{ secrets.IMAGE_SERVER_AUTH }}"@images.anbox-cloud.io/"$IMAGE_SERVER_BUCKET"/"$channel" 20 | item_type=image 21 | 22 | mkdir images 23 | for product in android14 aaos15 ; do 24 | image_name=jammy:"$product":amd64 25 | image_path="$(curl -s "$image_server_url"/streams/v1/images.json | \ 26 | jq -r "last(.products.\"$image_name\".versions[] | select(.items.\"${item_type}\" != null)).items.\"${item_type}\".path")" 27 | image_url="$image_server_url"/"$image_path" 28 | curl -s "$image_url" -o images/"$product"_amd64.tar.xz 29 | done 30 | - name: Generate cache key 31 | id: cache-key 32 | run: | 33 | echo "value=anbox-images-amd64-$(/bin/date -u "+%Y%m%d")" >> $GITHUB_OUTPUT 34 | shell: bash 35 | - name: Cache all images 36 | uses: actions/cache/save@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 37 | with: 38 | path: images 39 | key: ${{ steps.cache-key.outputs.value }} 40 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Anbox Cloud security policy 2 | 3 | Learn about our [release and support policy](https://documentation.ubuntu.com/anbox-cloud/en/latest/reference/release-notes/release-notes/#release-and-support-policy) for the nature of our releases and versions. 4 | 5 | ## Reporting a vulnerability 6 | 7 | If you discover a security vulnerability, follow the steps outlined below to report it: 8 | 9 | 1. Do not publicly disclose the vulnerability before discussing it with us. 10 | 2. Report a bug at https://bugs.launchpad.net/anbox-cloud 11 | 12 | **Important**: Remember to set the information type to *Private Security*. You will see a field with the text *This bug contains information that is:* 13 | 3. Provide detailed information about the vulnerability, including: 14 | - A description of the vulnerability 15 | - Steps to reproduce the issue 16 | - Potential impact and affected versions 17 | - Suggested mitigation, if possible 18 | 19 | The [Ubuntu Security disclosure and embargo policy](https://ubuntu.com/security/disclosure-policy) contains more information about what you can expect when you contact us and what we expect from you. 20 | 21 | The Anbox Cloud team will be notified of the issue and review the vulnerability. We may reach out to you for further information or clarification if needed. 22 | If the issue is confirmed as a valid security vulnerability, we will assign a CVE and coordinate the release of the fix. We also document them as [security notices](https://documentation.ubuntu.com/anbox-cloud/en/latest/reference/security-notices/). 23 | -------------------------------------------------------------------------------- /examples/android/out_of_band_v2/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 14 | 15 | 22 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /js/tests/e2e/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "anbox-stream-sdk-e2e-tests", 3 | "version": "1.22.0", 4 | "description": "e2e tests for anbox stream sdk", 5 | "scripts": { 6 | "start": "node server.js", 7 | "test:coverage": "rm -rf coverage ; PW_TEST_HTML_REPORT_OPEN='never' npx playwright test", 8 | "test-report-coverage": "cp ../unit/coverage/coverage-final.json coverage/ && sed -i 's|/anbox-streaming-sdk-unit-test/||g' coverage/coverage-final.json && cd ../.. && BASE_PATH=$(pwd) && sed -i \"s|anbox-stream-sdk.js|$BASE_PATH/anbox-stream-sdk.js|g\" tests/e2e/coverage/*.json && nyc report --reporter html --reporter cobertura --reporter text-summary --temp-dir $BASE_PATH/tests/e2e/coverage --report-dir $BASE_PATH/tests/e2e/coverage/combined-report/js ; mv tests/e2e/coverage/combined-report/js/cobertura-coverage.xml tests/e2e/coverage/combined-report/cobertura-coverage-js.xml" 9 | }, 10 | "author": "indore-team@launchpad.net", 11 | "license": "Proprietary", 12 | "devDependencies": { 13 | "@eslint/js": "9.17.0", 14 | "@playwright/test": "1.49.1", 15 | "@types/convert-source-map": "2.0.3", 16 | "@types/node": "22.10.5", 17 | "convert-source-map": "2.0.0", 18 | "eslint": "9.37.0", 19 | "eslint-config-prettier": "9.1.0", 20 | "eslint-plugin-prettier": "5.2.1", 21 | "globals": "15.14.0", 22 | "nyc": "17.1.0", 23 | "prettier": "3.4.2", 24 | "v8-to-istanbul": "9.3.0" 25 | }, 26 | "dependencies": { 27 | "axios": "1.12.2", 28 | "compressing": "1.10.1", 29 | "dotenv": "16.4.7", 30 | "express": "4.21.2", 31 | "express-rate-limit": "7.5.0", 32 | "yaml": "2.7.0" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /examples/android/enhanced_webview_streaming/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 19 | 21 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /scripts/gen-version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | # 3 | # Copyright 2020 Canonical Ltd. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | if [ -z "$BUILD_ID" ]; then 18 | BUILD_ID=0 19 | fi 20 | 21 | # We follow https://semver.org/; this will generate us the next patch version (we don't 22 | # take any assumption if the next release will be a minor or major version) and append 23 | # a pre-release qualifier to always sort lower than the final released version. To 24 | # have incrementing pre-release version we take the build id from Jenkins. 25 | # Example: 1.5.0 (old) -> 1.5.1-alpha.43 26 | current_version=$(git describe --tags `git rev-list --tags --max-count=1`) 27 | version_age=$(git log --oneline $(git describe --tags --abbrev=0 @)..@ | wc -l) 28 | if [ "$version_age" != 0 ]; then 29 | gitr=$(git rev-parse --short HEAD) 30 | base_version="$(cat .base_version)" 31 | mmp=$(echo "$current_version" | cut -d'-' -f1) 32 | if echo "$mmp" | grep -q "$base_version" ; then 33 | base_version="${mmp%.*}.$((${mmp##*.}+1))" 34 | else 35 | base_version="$base_version".0 36 | fi 37 | version="$base_version"-alpha."$BUILD_ID"+git"$gitr" 38 | else 39 | # When the current commit is having the tag we can just use the current version 40 | version="$current_version" 41 | fi 42 | 43 | echo "$version" 44 | -------------------------------------------------------------------------------- /examples/android/out_of_band_v2/app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 15 | 18 | 21 | 22 | 23 | 24 | 30 | -------------------------------------------------------------------------------- /examples/android/webview_streaming/app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 15 | 18 | 21 | 22 | 23 | 24 | 30 | -------------------------------------------------------------------------------- /examples/android/enhanced_webview_streaming/app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 15 | 18 | 21 | 22 | 23 | 24 | 30 | -------------------------------------------------------------------------------- /js/tests/e2e/global-teardown.js: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of Anbox Cloud Streaming SDK 3 | * 4 | * Copyright 2024 Canonical Ltd. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | import { expect } from "./fixtures/anbox-test"; 20 | import { 21 | AOSP_APP_NAME, 22 | AAOS_APP_NAME, 23 | BASE_URL, 24 | } from "./fixtures/constants.cjs"; 25 | require("dotenv").config({ path: ".env.local" }); 26 | 27 | const deleteTestInstance = async (sessionId) => { 28 | if (!sessionId) { 29 | return; 30 | } 31 | const deleteInstanceResponse = await fetch( 32 | `${BASE_URL}/instance?sessionId=${sessionId}`, 33 | { 34 | method: "DELETE", 35 | }, 36 | ); 37 | expect(deleteInstanceResponse.status).toBe(200); 38 | }; 39 | 40 | const deleteTestApplication = async (appName) => { 41 | const deleteAppResponse = await fetch( 42 | `${BASE_URL}/application?name=${appName}`, 43 | { 44 | method: "DELETE", 45 | }, 46 | ); 47 | expect(deleteAppResponse.status).toBe(200); 48 | }; 49 | 50 | async function globalTeardown() { 51 | await deleteTestInstance(process.env.AOSP_SESSION_ID); 52 | await deleteTestApplication(AOSP_APP_NAME); 53 | await deleteTestInstance(process.env.AAOS_SESSION_ID); 54 | await deleteTestApplication(AAOS_APP_NAME); 55 | } 56 | 57 | export default globalTeardown; 58 | -------------------------------------------------------------------------------- /android/anbox_streaming_sdk/src/main/java/com/canonical/anbox/streaming_sdk/IMEJSInterface.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of Anbox Cloud Streaming SDK 3 | * 4 | * Copyright 2022 Canonical Ltd. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package com.canonical.anbox.streaming_sdk; 20 | 21 | import android.webkit.JavascriptInterface; 22 | 23 | /** 24 | * IMEInterface is a bridge that provides access from JavaScript to the Android Java 25 | * layer specifically for ime related messages. 26 | * */ 27 | public class IMEJSInterface { 28 | public interface ActionListener { 29 | void onOpenVirtualKeyboard(); 30 | void onHideVirtualKeyboard(); 31 | } 32 | private IMEJSInterface.ActionListener mActionListener; 33 | 34 | IMEJSInterface(ActionListener listener) { 35 | mActionListener = listener; 36 | } 37 | 38 | /** Show virtual keyboard after receiving the message from Anbox */ 39 | @JavascriptInterface 40 | public void openVirtualKeyboard() { 41 | if (mActionListener != null) { 42 | mActionListener.onOpenVirtualKeyboard(); 43 | } 44 | } 45 | 46 | /** Hide virtual keyboard after receiving the message from Anbox */ 47 | @JavascriptInterface 48 | public void hideVirtualKeyboard() { 49 | if (mActionListener != null) { 50 | mActionListener.onHideVirtualKeyboard(); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /scripts/clean-build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -ex 2 | # 3 | # Copyright 2020 Canonical Ltd. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | VERSION=unknown 18 | 19 | for p in "$@" 20 | do 21 | case $p in 22 | --version=*) 23 | VERSION=${p#*=} 24 | ;; 25 | esac 26 | done 27 | 28 | sudo apt-get update -qq 29 | sudo apt-get clean 30 | cd /work/src/examples 31 | 32 | # For Anbox Streaming SDK library(AAR) 33 | ( 34 | cd android/anbox_streaming_sdk 35 | cat << EOF >> local.properties 36 | sdk.dir="$ANDROID_HOME" 37 | EOF 38 | ./gradlew assembleDebug 39 | find ./ -name *.aar -exec mv {} /work/com.canonical.anbox.streaming_sdk.aar \; 40 | ) 41 | 42 | # For enhanced webview streaming example 43 | ( 44 | # Use the aar file just built out from the above step 45 | mkdir -p android/enhanced_webview_streaming/app/libs 46 | cp /work/com.canonical.anbox.streaming_sdk.aar android/enhanced_webview_streaming/app/libs/ 47 | 48 | cd android/enhanced_webview_streaming 49 | cat << EOF >> local.properties 50 | sdk.dir="$ANDROID_HOME" 51 | EOF 52 | ./gradlew assembleDebug 53 | find ./ -name *.apk -exec mv {} /work/com.canonical.anbox.streaming_sdk.enhanced_webview_example_"$VERSION".apk \; 54 | ) 55 | 56 | # For android out of band v2 example 57 | ( 58 | cd android/out_of_band_v2 59 | cat << EOF >> local.properties 60 | sdk.dir="$ANDROID_HOME" 61 | anbox-stream-sdk.dir=/work/src/sdk 62 | EOF 63 | ./gradlew assembleDebug 64 | find ./ -name *.apk -exec mv {} /work/com.canonical.anboxcloud.outofbandappv2_"$VERSION".apk \; 65 | ) 66 | -------------------------------------------------------------------------------- /examples/android/webview_streaming/app/src/main/assets/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Anbox Streaming SDK Example 7 | 8 | 9 | 10 | 11 | 56 |
57 | 58 | -------------------------------------------------------------------------------- /examples/js/example.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Anbox Streaming SDK Example 7 | 8 | 9 | 10 | 58 |

Anbox Streaming Stack example

59 | 60 |
61 | 62 | 63 | -------------------------------------------------------------------------------- /js/tests/unit/run-tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -ex 2 | # 3 | # Copyright 2021 Canonical Ltd. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | ANBOX_STREAMING_SDK_DIR=$PWD/../../ 18 | ESLINT_ARGS= 19 | FIX_MODE=false 20 | while [ -n "$1" ]; do 21 | case "$1" in 22 | --anbox-streaming-sdk-dir=*) 23 | ANBOX_STREAMING_SDK_DIR=${1#*=} 24 | shift 25 | ;; 26 | --fix) 27 | ESLINT_ARGS="$ESLINT_ARGS --fix" 28 | FIX_MODE=true 29 | shift 30 | ;; 31 | *) 32 | shift 33 | ;; 34 | esac 35 | done 36 | 37 | if [ -z "$ANBOX_STREAMING_SDK_DIR" ]; then 38 | echo "--anbox-streaming-sdk-dir is missing" 39 | exit 1 40 | fi 41 | 42 | # Copy the JS SDK to the root dir of jtest so that 43 | # unit tests can be executed properly. 44 | cp $ANBOX_STREAMING_SDK_DIR/*.js ./ 45 | 46 | cleanup() { 47 | if [ "$FIX_MODE" = true ]; then 48 | # In fix mode, copy the fixed sdk js files back to the original directory 49 | cp anbox-stream-sdk.js "$ANBOX_STREAMING_SDK_DIR"/ 50 | fi 51 | # Always remove the copied files from test directory 52 | rm -f anbox-stream-sdk.js 53 | } 54 | trap cleanup EXIT INT TERM 55 | 56 | extra_args= 57 | if ! docker -v | grep -q podman ; then 58 | # If we're running with podman passing in user mappings is not 59 | # going to work 60 | extra_args="-u $(id -u ${USER}):$(id -g ${USER})" 61 | fi 62 | 63 | # 1. Run ESLint for the sanity checks and static analysis' 64 | # 2. Run unit test 65 | docker run --rm \ 66 | -v $PWD:/anbox-streaming-sdk-unit-test \ 67 | -e HOME=/anbox-streaming-sdk-unit-test \ 68 | $extra_args \ 69 | node:22 \ 70 | bash -c "cd /anbox-streaming-sdk-unit-test && \ 71 | npm install --include=dev && \ 72 | ./node_modules/.bin/eslint $ESLINT_ARGS *.js && \ 73 | npm run test:coverage" 74 | -------------------------------------------------------------------------------- /js/tests/e2e/fixtures/coverage.js: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of Anbox Cloud Streaming SDK 3 | * 4 | * Copyright 2024 Canonical Ltd. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | import fs from "fs"; 20 | import crypto from "crypto"; 21 | import { fromSource, removeMapFileComments } from "convert-source-map"; 22 | import v8ToIstanbul from "v8-to-istanbul"; 23 | 24 | export const startCoverage = async (page) => { 25 | await page.coverage.startJSCoverage({ 26 | reportAnonymousScripts: true, 27 | resetOnNavigation: false, 28 | }); 29 | }; 30 | 31 | export const finishCoverage = async (page) => { 32 | const coverage = await page.coverage.stopJSCoverage(); 33 | for (const entry of coverage) { 34 | const fileMatcher = entry.url.match(/http(s)*:\/\/.*:2999\/(?.*)/); 35 | if ( 36 | !fileMatcher?.groups || 37 | fileMatcher.groups.file !== "anbox-stream-sdk.js" 38 | ) { 39 | continue; 40 | } 41 | const source = removeMapFileComments(entry.source ?? ""); 42 | const sourceMap = fromSource(entry.source ?? ""); 43 | 44 | const converter = v8ToIstanbul(fileMatcher.groups.file, 0, { 45 | source, 46 | sourceMap, 47 | }); 48 | await converter.load(); 49 | converter.applyCoverage(entry.functions); 50 | const istanbulCoverage = converter.toIstanbul(); 51 | 52 | // a unique name for this report 53 | const uuid = crypto.randomBytes(16).toString("hex"); 54 | 55 | // _coverageSchema is mandatory for nyc to parse the report 56 | Object.entries(istanbulCoverage).forEach(([key]) => { 57 | istanbulCoverage[key]["_coverageSchema"] = uuid; 58 | }); 59 | 60 | const outDir = "coverage"; 61 | if (!fs.existsSync(outDir)) { 62 | fs.mkdirSync(outDir, { recursive: true }); 63 | } 64 | fs.writeFileSync( 65 | `${outDir}/playwright_coverage_${uuid}.json`, 66 | JSON.stringify(istanbulCoverage), 67 | ); 68 | } 69 | }; 70 | -------------------------------------------------------------------------------- /.github/workflows/branch.yaml: -------------------------------------------------------------------------------- 1 | name: Branch for stable series 2 | on: 3 | workflow_dispatch: 4 | inputs: 5 | ref: 6 | description: | 7 | Commit hash or other reference to use when branching. If not given 8 | defaults to 'main'. 9 | required: false 10 | default: 'main' 11 | 12 | permissions: 13 | contents: write 14 | pull-requests: write 15 | 16 | jobs: 17 | branch: 18 | runs-on: ubuntu-latest 19 | if: ${{ github.repository_owner == 'canonical' }} 20 | environment: stable 21 | steps: 22 | - name: Checkout 23 | uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 24 | with: 25 | ref: ${{ inputs.ref }} 26 | fetch-depth: 0 27 | - name: Create branch and bump version 28 | env: 29 | AUTHOR_NAME: "Anbox Bot" 30 | AUTHOR_EMAIL: "anbox-bot@canonical.com" 31 | ANBOX_CLOUD_CI_BOT_SSH_KEY: ${{ secrets.ANBOX_CLOUD_CI_BOT_SSH_KEY }} 32 | GH_TOKEN: ${{ github.token }} 33 | run: | 34 | # Setup SSH key based access so we can write a branch 35 | . "$GITHUB_WORKSPACE"/scripts/setup-gh-ssh.sh 36 | 37 | git config --global user.name "$AUTHOR_NAME" 38 | git config --global user.email "$AUTHOR_EMAIL" 39 | 40 | # First we create the new stable branch 41 | series="$(cat .base_version | cut -d. -f1,2)" 42 | minor="$(echo "$series" | cut -d. -f2)" 43 | next_minor=$((minor+1)) 44 | next_version="1.$next_minor" 45 | branch_name=stable-"$series" 46 | git checkout -b "$branch_name" 47 | git push git@github-anbox-streaming-sdk:canonical/anbox-streaming-sdk "$branch_name" 48 | 49 | # Next we have to update main to include the new version number 50 | branch=bump-version-to-"$next_version" 51 | # If we already have a branch and PR we can stop here 52 | if git branch -a | grep -q "$branch" ; then 53 | exit 0 54 | fi 55 | git checkout -b "$branch" 56 | sed "s/${series}/${next_version}/g" -i .base_version js/anbox-stream-sdk.js 57 | git add .base_version js/anbox-stream-sdk.js 58 | git commit -m "chore: bump version to $next_version" 59 | git push git@github-anbox-streaming-sdk:canonical/anbox-streaming-sdk "$branch" 60 | gh pr create -B main -H "$branch" \ 61 | --title "Bump version to $next_version" \ 62 | --body "Automatically requested by workflow. Please close and reopen this PR to trigger workflows!" 63 | -------------------------------------------------------------------------------- /examples/android/out_of_band_v2/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /examples/android/webview_streaming/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /examples/android/enhanced_webview_streaming/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /examples/android/enhanced_webview_streaming/app/src/main/assets/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Anbox Streaming SDK Example 7 | 8 | 9 | 10 | 11 | 61 | 78 |
79 | 80 | -------------------------------------------------------------------------------- /examples/android/webview_streaming/app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 19 | 20 | 25 | 26 | 35 | 36 | 37 | 38 | 46 | 47 | 55 | 56 | 57 | 58 |