From 1a93107c210aad38243a075924f7905811836c6a Mon Sep 17 00:00:00 2001 From: John Xu Date: Sat, 19 Oct 2024 09:25:41 +0000 Subject: [PATCH] `cobalt_shell_apk` to build dev.cobalt.coat This new target generate CobaltShell.apk that has dev.cobalt.coat as its package name, and include most of Cobalt's java code. App starts from CobaltActivity now. CobaltActivity inherits from ContentShellActivity now instead of GameActivity. Remember to put treat_warnings_as_errors = false in gn args since Chromium treats java warnings as errors and we have many. There are many TODOs left in this CL and this is only to be served as a prototype to unblock SbPlayer and JS injection. b/374191454 --- build/android/gyp/util/resource_utils.py | 2 +- cobalt/BUILD.gn | 2 + cobalt/android/BUILD.gn | 157 ++++ {starboard => cobalt}/android/apk/.gitignore | 0 .../android/apk/apk_sources.gni | 0 .../android/apk/app/.gitignore | 0 .../android/apk/app/CMakeLists.txt | 0 .../android/apk/app/build.gradle | 0 .../android/apk/app/cobalt-ninja.sh | 0 .../android/apk/app/proguard-rules.pro | 0 .../app/src/app/AndroidManifest.xml.jinja2 | 126 ++++ .../apk/app/src/app/assets/not_empty.txt | 0 .../apk/app/src/app/assets/test/not_empty.txt | 0 .../assets/web/cobalt_blue_splash_screen.css | 0 .../assets/web/cobalt_blue_splash_screen.html | 0 .../src/app/assets/web/cobalt_logo_1024.png | Bin .../dev/cobalt/app/CobaltApplication.java | 5 +- .../app/java/dev/cobalt/app/MainActivity.java | 0 .../src/app/res/drawable-xhdpi/app_banner.png | Bin .../app/src/app/res/mipmap-hdpi/ic_app.png | Bin .../app/src/app/res/mipmap-mdpi/ic_app.png | Bin .../app/src/app/res/mipmap-xhdpi/ic_app.png | Bin .../app/src/app/res/mipmap-xxhdpi/ic_app.png | Bin .../apk/app/src/app/res/values/strings.xml | 0 .../java/dev/cobalt/coat/AdvertisingId.java | 0 .../dev/cobalt/coat/ArtworkDownloader.java | 0 .../cobalt/coat/ArtworkDownloaderDefault.java | 0 .../java/dev/cobalt/coat/ArtworkLoader.java | 9 +- .../cobalt/coat/AudioPermissionRequester.java | 0 .../java/dev/cobalt/coat/CaptionSettings.java | 0 .../dev/cobalt/coat/CobaltA11yHelper.java | 209 ++++++ .../java/dev/cobalt/coat/CobaltActivity.java | 56 +- .../dev/cobalt/coat/CobaltHttpHelper.java | 0 .../dev/cobalt/coat/CobaltMediaSession.java | 0 .../java/dev/cobalt/coat/CobaltService.java | 21 +- .../CobaltSystemConfigChangeReceiver.java | 0 .../cobalt/coat/CobaltTextToSpeechHelper.java | 0 .../coat/CrashContextUpdateHandler.java | 0 .../java/dev/cobalt/coat/ErrorDialog.java | 10 +- .../main/java/dev/cobalt/coat/MediaImage.java | 0 .../java/dev/cobalt/coat/NetworkStatus.java | 4 +- .../dev/cobalt/coat/NullCobaltFactory.java | 0 .../java/dev/cobalt/coat/PlatformError.java | 0 .../java/dev/cobalt/coat/ResourceOverlay.java | 0 .../java/dev/cobalt/coat/StarboardBridge.java | 120 +-- .../dev/cobalt/coat/VolumeStateReceiver.java | 0 .../cobalt/libraries/game_activity/README.md | 0 .../game_activity/games-activity-2.0.2.aar | Bin .../services/clientloginfo/ClientLogInfo.java | 0 .../clientloginfo/ClientLogInfoModule.java | 0 .../clientloginfo/client_log_info_demo.html | 0 .../dev/cobalt/media/AudioOutputManager.java | 0 .../dev/cobalt/media/AudioTrackBridge.java | 0 .../src/main/java/dev/cobalt/media/Log.java | 0 .../dev/cobalt/media/MediaCodecBridge.java | 0 .../cobalt/media/MediaCodecBridgeBuilder.java | 0 .../media/MediaCodecCapabilitiesLogger.java | 0 .../dev/cobalt/media/MediaCodecStatus.java | 0 .../java/dev/cobalt/media/MediaCodecUtil.java | 0 .../java/dev/cobalt/media/MediaDrmBridge.java | 0 .../dev/cobalt/media/MediaFormatBuilder.java | 0 .../dev/cobalt/media/VideoDecoderCache.java | 0 .../media/VideoFrameReleaseTimeHelper.java | 0 .../dev/cobalt/media/VideoSurfaceTexture.java | 0 .../dev/cobalt/media/VideoSurfaceView.java | 10 +- .../cobalt/storage/CobaltStorageLoader.java | 0 .../main/java/dev/cobalt/storage/README.md | 0 .../java/dev/cobalt/storage/StorageProto.java | 0 .../java/dev/cobalt/util/DisplayUtil.java | 10 +- .../src/main/java/dev/cobalt/util/Holder.java | 0 .../main/java/dev/cobalt/util/IsEmulator.java | 0 .../src/main/java/dev/cobalt/util/Log.java | 0 .../dev/cobalt/util/SynchronizedHolder.java | 0 .../cobalt/util/SystemPropertiesHelper.java | 0 .../java/dev/cobalt/util/UsedByNative.java | 0 .../src/main/res/layout/coat_error_dialog.xml | 6 +- .../apk/app/src/main/res/values/colors.xml | 0 .../apk/app/src/main/res/values/ids.xml | 0 .../app/src/main/res/values/overlayable.xml | 0 .../app/src/main/res/values/rro_variables.xml | 0 .../apk/app/src/main/res/values/strings.xml | 0 .../apk/app/src/main/res/values/styles.xml | 12 +- .../test/java/dev/cobalt/util/HolderTest.java | 0 .../android/apk/build.gradle | 0 .../android/apk/gradle.properties | 0 .../apk/gradle/wrapper/gradle-wrapper.jar | Bin .../gradle/wrapper/gradle-wrapper.properties | 0 {starboard => cobalt}/android/apk/gradlew | 0 {starboard => cobalt}/android/apk/gradlew.bat | 0 .../android/apk/settings.gradle | 0 .../shell_apk/AndroidManifest.xml.jinja2 | 5 + .../ContentShellActivity.java | 8 +- .../browser/shell_content_browser_client.cc | 12 +- .../apk/app/src/app/AndroidManifest.xml | 81 -- .../web/link_android_splash_screen.html | 691 ------------------ .../dev/cobalt/coat/CobaltA11yHelper.java | 209 ------ 96 files changed, 632 insertions(+), 1133 deletions(-) create mode 100644 cobalt/android/BUILD.gn rename {starboard => cobalt}/android/apk/.gitignore (100%) rename {starboard => cobalt}/android/apk/apk_sources.gni (100%) rename {starboard => cobalt}/android/apk/app/.gitignore (100%) rename {starboard => cobalt}/android/apk/app/CMakeLists.txt (100%) rename {starboard => cobalt}/android/apk/app/build.gradle (100%) rename {starboard => cobalt}/android/apk/app/cobalt-ninja.sh (100%) rename {starboard => cobalt}/android/apk/app/proguard-rules.pro (100%) create mode 100644 cobalt/android/apk/app/src/app/AndroidManifest.xml.jinja2 rename {starboard => cobalt}/android/apk/app/src/app/assets/not_empty.txt (100%) rename {starboard => cobalt}/android/apk/app/src/app/assets/test/not_empty.txt (100%) rename {starboard => cobalt}/android/apk/app/src/app/assets/web/cobalt_blue_splash_screen.css (100%) rename {starboard => cobalt}/android/apk/app/src/app/assets/web/cobalt_blue_splash_screen.html (100%) rename {starboard => cobalt}/android/apk/app/src/app/assets/web/cobalt_logo_1024.png (100%) rename {starboard => cobalt}/android/apk/app/src/app/java/dev/cobalt/app/CobaltApplication.java (83%) rename {starboard => cobalt}/android/apk/app/src/app/java/dev/cobalt/app/MainActivity.java (100%) rename {starboard => cobalt}/android/apk/app/src/app/res/drawable-xhdpi/app_banner.png (100%) rename {starboard => cobalt}/android/apk/app/src/app/res/mipmap-hdpi/ic_app.png (100%) rename {starboard => cobalt}/android/apk/app/src/app/res/mipmap-mdpi/ic_app.png (100%) rename {starboard => cobalt}/android/apk/app/src/app/res/mipmap-xhdpi/ic_app.png (100%) rename {starboard => cobalt}/android/apk/app/src/app/res/mipmap-xxhdpi/ic_app.png (100%) rename {starboard => cobalt}/android/apk/app/src/app/res/values/strings.xml (100%) rename {starboard => cobalt}/android/apk/app/src/main/java/dev/cobalt/coat/AdvertisingId.java (100%) rename {starboard => cobalt}/android/apk/app/src/main/java/dev/cobalt/coat/ArtworkDownloader.java (100%) rename {starboard => cobalt}/android/apk/app/src/main/java/dev/cobalt/coat/ArtworkDownloaderDefault.java (100%) rename {starboard => cobalt}/android/apk/app/src/main/java/dev/cobalt/coat/ArtworkLoader.java (94%) rename {starboard => cobalt}/android/apk/app/src/main/java/dev/cobalt/coat/AudioPermissionRequester.java (100%) rename {starboard => cobalt}/android/apk/app/src/main/java/dev/cobalt/coat/CaptionSettings.java (100%) create mode 100644 cobalt/android/apk/app/src/main/java/dev/cobalt/coat/CobaltA11yHelper.java rename {starboard => cobalt}/android/apk/app/src/main/java/dev/cobalt/coat/CobaltActivity.java (90%) rename {starboard => cobalt}/android/apk/app/src/main/java/dev/cobalt/coat/CobaltHttpHelper.java (100%) rename {starboard => cobalt}/android/apk/app/src/main/java/dev/cobalt/coat/CobaltMediaSession.java (100%) rename {starboard => cobalt}/android/apk/app/src/main/java/dev/cobalt/coat/CobaltService.java (84%) rename {starboard => cobalt}/android/apk/app/src/main/java/dev/cobalt/coat/CobaltSystemConfigChangeReceiver.java (100%) rename {starboard => cobalt}/android/apk/app/src/main/java/dev/cobalt/coat/CobaltTextToSpeechHelper.java (100%) rename {starboard => cobalt}/android/apk/app/src/main/java/dev/cobalt/coat/CrashContextUpdateHandler.java (100%) rename {starboard => cobalt}/android/apk/app/src/main/java/dev/cobalt/coat/ErrorDialog.java (94%) rename {starboard => cobalt}/android/apk/app/src/main/java/dev/cobalt/coat/MediaImage.java (100%) rename {starboard => cobalt}/android/apk/app/src/main/java/dev/cobalt/coat/NetworkStatus.java (97%) rename {starboard => cobalt}/android/apk/app/src/main/java/dev/cobalt/coat/NullCobaltFactory.java (100%) rename {starboard => cobalt}/android/apk/app/src/main/java/dev/cobalt/coat/PlatformError.java (100%) rename {starboard => cobalt}/android/apk/app/src/main/java/dev/cobalt/coat/ResourceOverlay.java (100%) rename {starboard => cobalt}/android/apk/app/src/main/java/dev/cobalt/coat/StarboardBridge.java (90%) rename {starboard => cobalt}/android/apk/app/src/main/java/dev/cobalt/coat/VolumeStateReceiver.java (100%) rename {starboard => cobalt}/android/apk/app/src/main/java/dev/cobalt/libraries/game_activity/README.md (100%) rename {starboard => cobalt}/android/apk/app/src/main/java/dev/cobalt/libraries/game_activity/games-activity-2.0.2.aar (100%) rename {starboard => cobalt}/android/apk/app/src/main/java/dev/cobalt/libraries/services/clientloginfo/ClientLogInfo.java (100%) rename {starboard => cobalt}/android/apk/app/src/main/java/dev/cobalt/libraries/services/clientloginfo/ClientLogInfoModule.java (100%) rename {starboard => cobalt}/android/apk/app/src/main/java/dev/cobalt/libraries/services/clientloginfo/client_log_info_demo.html (100%) rename {starboard => cobalt}/android/apk/app/src/main/java/dev/cobalt/media/AudioOutputManager.java (100%) rename {starboard => cobalt}/android/apk/app/src/main/java/dev/cobalt/media/AudioTrackBridge.java (100%) rename {starboard => cobalt}/android/apk/app/src/main/java/dev/cobalt/media/Log.java (100%) rename {starboard => cobalt}/android/apk/app/src/main/java/dev/cobalt/media/MediaCodecBridge.java (100%) rename {starboard => cobalt}/android/apk/app/src/main/java/dev/cobalt/media/MediaCodecBridgeBuilder.java (100%) rename {starboard => cobalt}/android/apk/app/src/main/java/dev/cobalt/media/MediaCodecCapabilitiesLogger.java (100%) rename {starboard => cobalt}/android/apk/app/src/main/java/dev/cobalt/media/MediaCodecStatus.java (100%) rename {starboard => cobalt}/android/apk/app/src/main/java/dev/cobalt/media/MediaCodecUtil.java (100%) rename {starboard => cobalt}/android/apk/app/src/main/java/dev/cobalt/media/MediaDrmBridge.java (100%) rename {starboard => cobalt}/android/apk/app/src/main/java/dev/cobalt/media/MediaFormatBuilder.java (100%) rename {starboard => cobalt}/android/apk/app/src/main/java/dev/cobalt/media/VideoDecoderCache.java (100%) rename {starboard => cobalt}/android/apk/app/src/main/java/dev/cobalt/media/VideoFrameReleaseTimeHelper.java (100%) rename {starboard => cobalt}/android/apk/app/src/main/java/dev/cobalt/media/VideoSurfaceTexture.java (100%) rename {starboard => cobalt}/android/apk/app/src/main/java/dev/cobalt/media/VideoSurfaceView.java (91%) rename {starboard => cobalt}/android/apk/app/src/main/java/dev/cobalt/storage/CobaltStorageLoader.java (100%) rename {starboard => cobalt}/android/apk/app/src/main/java/dev/cobalt/storage/README.md (100%) rename {starboard => cobalt}/android/apk/app/src/main/java/dev/cobalt/storage/StorageProto.java (100%) rename {starboard => cobalt}/android/apk/app/src/main/java/dev/cobalt/util/DisplayUtil.java (96%) rename {starboard => cobalt}/android/apk/app/src/main/java/dev/cobalt/util/Holder.java (100%) rename {starboard => cobalt}/android/apk/app/src/main/java/dev/cobalt/util/IsEmulator.java (100%) rename {starboard => cobalt}/android/apk/app/src/main/java/dev/cobalt/util/Log.java (100%) rename {starboard => cobalt}/android/apk/app/src/main/java/dev/cobalt/util/SynchronizedHolder.java (100%) rename {starboard => cobalt}/android/apk/app/src/main/java/dev/cobalt/util/SystemPropertiesHelper.java (100%) rename {starboard => cobalt}/android/apk/app/src/main/java/dev/cobalt/util/UsedByNative.java (100%) rename {starboard => cobalt}/android/apk/app/src/main/res/layout/coat_error_dialog.xml (93%) rename {starboard => cobalt}/android/apk/app/src/main/res/values/colors.xml (100%) rename {starboard => cobalt}/android/apk/app/src/main/res/values/ids.xml (100%) rename {starboard => cobalt}/android/apk/app/src/main/res/values/overlayable.xml (100%) rename {starboard => cobalt}/android/apk/app/src/main/res/values/rro_variables.xml (100%) rename {starboard => cobalt}/android/apk/app/src/main/res/values/strings.xml (100%) rename {starboard => cobalt}/android/apk/app/src/main/res/values/styles.xml (79%) rename {starboard => cobalt}/android/apk/app/src/test/java/dev/cobalt/util/HolderTest.java (100%) rename {starboard => cobalt}/android/apk/build.gradle (100%) rename {starboard => cobalt}/android/apk/gradle.properties (100%) rename {starboard => cobalt}/android/apk/gradle/wrapper/gradle-wrapper.jar (100%) rename {starboard => cobalt}/android/apk/gradle/wrapper/gradle-wrapper.properties (100%) rename {starboard => cobalt}/android/apk/gradlew (100%) rename {starboard => cobalt}/android/apk/gradlew.bat (100%) rename {starboard => cobalt}/android/apk/settings.gradle (100%) delete mode 100644 starboard/android/apk/app/src/app/AndroidManifest.xml delete mode 100644 starboard/android/apk/app/src/app/assets/web/link_android_splash_screen.html delete mode 100644 starboard/android/apk/app/src/main/java/dev/cobalt/coat/CobaltA11yHelper.java diff --git a/build/android/gyp/util/resource_utils.py b/build/android/gyp/util/resource_utils.py index dac0ae7588be..2bdd5964fce1 100644 --- a/build/android/gyp/util/resource_utils.py +++ b/build/android/gyp/util/resource_utils.py @@ -46,7 +46,7 @@ 'anim', 'animator', 'array', 'attr', 'bool', 'color', 'dimen', 'drawable', 'font', 'fraction', 'id', 'integer', 'interpolator', 'layout', 'macro', 'menu', 'mipmap', 'plurals', 'raw', 'string', 'style', 'styleable', - 'transition', 'xml' + 'transition', 'xml', 'overlayable' } AAPT_IGNORE_PATTERN = ':'.join([ diff --git a/cobalt/BUILD.gn b/cobalt/BUILD.gn index 4e0e67a158c3..4e471043862e 100644 --- a/cobalt/BUILD.gn +++ b/cobalt/BUILD.gn @@ -19,6 +19,8 @@ group("gn_all") { deps = [ "//starboard($starboard_toolchain)" ] if (!is_android) { deps += [ ":cobalt" ] + } else { + deps += [ "android:cobalt_shell_apk" ] } } diff --git a/cobalt/android/BUILD.gn b/cobalt/android/BUILD.gn new file mode 100644 index 000000000000..9cd74123a451 --- /dev/null +++ b/cobalt/android/BUILD.gn @@ -0,0 +1,157 @@ +import("//build/config/android/config.gni") +import("//build/config/android/rules.gni") +import("//third_party/icu/config.gni") + +cobalt_shell_manifest = + "$target_gen_dir/cobalt_shell_test_manifest/AndroidManifest.xml" + +android_resources("cobalt_shell_java_resources") { + testonly = true + sources = [ + "apk/app/src/app/res/drawable-xhdpi/app_banner.png", + "apk/app/src/app/res/mipmap-hdpi/ic_app.png", + "apk/app/src/app/res/mipmap-mdpi/ic_app.png", + "apk/app/src/app/res/mipmap-xhdpi/ic_app.png", + "apk/app/src/app/res/mipmap-xxhdpi/ic_app.png", + "apk/app/src/app/res/values/strings.xml", + "apk/app/src/main/res/layout/coat_error_dialog.xml", + "apk/app/src/main/res/values/colors.xml", + "apk/app/src/main/res/values/ids.xml", + "apk/app/src/main/res/values/overlayable.xml", + "apk/app/src/main/res/values/rro_variables.xml", + "apk/app/src/main/res/values/strings.xml", + "apk/app/src/main/res/values/styles.xml", + ] + + #TODO(b/375037287): use Widget.Leanback.ErrorMessageStyle + #deps = [ + # "//third_party/androidx:androidx_leanback_leanback_java", + #] +} + +jinja_template("cobalt_shell_manifest") { + testonly = true + input = "apk/app/src/app/AndroidManifest.xml.jinja2" + output = cobalt_shell_manifest + variables = [ "manifest_package=dev.cobalt.coat" ] +} + +android_library("cobalt_shell_apk_java") { + testonly = true + resources_package = "dev.cobalt.coat" + deps = [ + ":cobalt_shell_java_resources", + "//base:base_java", + "//content/shell/android:content_shell_apk_java", + "//third_party/androidx:androidx_annotation_annotation_java", + "//ui/android:ui_no_recycler_view_java", + ] + sources = [ + "apk/app/src/app/java/dev/cobalt/app/CobaltApplication.java", + "apk/app/src/app/java/dev/cobalt/app/MainActivity.java", + "apk/app/src/main/java/dev/cobalt/coat/ArtworkDownloader.java", + "apk/app/src/main/java/dev/cobalt/coat/ArtworkDownloaderDefault.java", + "apk/app/src/main/java/dev/cobalt/coat/ArtworkLoader.java", + "apk/app/src/main/java/dev/cobalt/coat/CaptionSettings.java", + "apk/app/src/main/java/dev/cobalt/coat/CobaltActivity.java", + "apk/app/src/main/java/dev/cobalt/coat/CobaltHttpHelper.java", + + # "apk/app/src/main/java/dev/cobalt/coat/CobaltMediaSession.java", + "apk/app/src/main/java/dev/cobalt/coat/CobaltService.java", + "apk/app/src/main/java/dev/cobalt/coat/CobaltSystemConfigChangeReceiver.java", + "apk/app/src/main/java/dev/cobalt/coat/CobaltTextToSpeechHelper.java", + "apk/app/src/main/java/dev/cobalt/coat/CrashContextUpdateHandler.java", + "apk/app/src/main/java/dev/cobalt/coat/ErrorDialog.java", + "apk/app/src/main/java/dev/cobalt/coat/MediaImage.java", + "apk/app/src/main/java/dev/cobalt/coat/NetworkStatus.java", + "apk/app/src/main/java/dev/cobalt/coat/NullCobaltFactory.java", + "apk/app/src/main/java/dev/cobalt/coat/PlatformError.java", + "apk/app/src/main/java/dev/cobalt/coat/ResourceOverlay.java", + + # "apk/app/src/main/java/dev/cobalt/coat/AdvertisingId.java", + "apk/app/src/main/java/dev/cobalt/coat/StarboardBridge.java", + "apk/app/src/main/java/dev/cobalt/coat/VolumeStateReceiver.java", + "apk/app/src/main/java/dev/cobalt/libraries/services/clientloginfo/ClientLogInfo.java", + "apk/app/src/main/java/dev/cobalt/libraries/services/clientloginfo/ClientLogInfoModule.java", + + # "apk/app/src/main/java/dev/cobalt/media/AudioOutputManager.java", + "apk/app/src/main/java/dev/cobalt/media/AudioTrackBridge.java", + "apk/app/src/main/java/dev/cobalt/media/Log.java", + "apk/app/src/main/java/dev/cobalt/media/MediaCodecBridge.java", + "apk/app/src/main/java/dev/cobalt/media/MediaCodecBridgeBuilder.java", + "apk/app/src/main/java/dev/cobalt/media/MediaCodecCapabilitiesLogger.java", + "apk/app/src/main/java/dev/cobalt/media/MediaCodecStatus.java", + "apk/app/src/main/java/dev/cobalt/media/MediaCodecUtil.java", + "apk/app/src/main/java/dev/cobalt/media/MediaDrmBridge.java", + "apk/app/src/main/java/dev/cobalt/media/MediaFormatBuilder.java", + "apk/app/src/main/java/dev/cobalt/media/VideoDecoderCache.java", + "apk/app/src/main/java/dev/cobalt/media/VideoFrameReleaseTimeHelper.java", + "apk/app/src/main/java/dev/cobalt/media/VideoSurfaceTexture.java", + "apk/app/src/main/java/dev/cobalt/media/VideoSurfaceView.java", + + # "apk/app/src/main/java/dev/cobalt/storage/CobaltStorageLoader.java", + # "apk/app/src/main/java/dev/cobalt/storage/StorageProto.java", + "apk/app/src/main/java/dev/cobalt/util/DisplayUtil.java", + "apk/app/src/main/java/dev/cobalt/util/Holder.java", + "apk/app/src/main/java/dev/cobalt/util/IsEmulator.java", + "apk/app/src/main/java/dev/cobalt/util/Log.java", + "apk/app/src/main/java/dev/cobalt/util/SynchronizedHolder.java", + "apk/app/src/main/java/dev/cobalt/util/SystemPropertiesHelper.java", + "apk/app/src/main/java/dev/cobalt/util/UsedByNative.java", + ] +} + +android_assets("cobalt_shell_assets") { + testonly = true + sources = [ + "apk/app/src/app/assets/not_empty.txt", + "apk/app/src/app/assets/test/not_empty.txt", + "apk/app/src/app/assets/web/cobalt_blue_splash_screen.css", + "apk/app/src/app/assets/web/cobalt_blue_splash_screen.html", + "apk/app/src/app/assets/web/cobalt_logo_1024.png", + "apk/app/src/app/assets/web/link_android_splash_screen.html", + ] + disable_compression = true +} + +template("content_shell_apk_tmpl") { + _target_type = invoker.target_type + target(_target_type, target_name) { + forward_variables_from(invoker, "*") + testonly = true + if (!defined(deps)) { + deps = [] + } + deps += [ + "//base:base_java_test_support", + "//components/crash/android:java", + "//components/crash/core/app:chrome_crashpad_handler_named_as_so", + "//components/metrics:metrics_java", + "//content/public/android:content_java", + "//content/public/test/android:android_test_message_pump_support_java", + "//content/shell/android:content_shell_apk_java", + "//content/shell/android:content_shell_assets", + "//content/shell/android:content_shell_java", + "//media/capture/video/android:capture_java", + "//net/android:net_java", + "//services/shape_detection:shape_detection_java", + "//third_party/mesa_headers", + "//ui/android:ui_java", + ] + loadable_modules = [ "$root_out_dir/libchrome_crashpad_handler.so" ] + } +} + +content_shell_apk_tmpl("cobalt_shell_apk") { + target_type = "android_apk" + apk_name = "CobaltShell" + android_manifest = cobalt_shell_manifest + android_manifest_dep = ":cobalt_shell_manifest" + deps = [ + ":cobalt_shell_apk_java", + ":cobalt_shell_assets", + ":cobalt_shell_java_resources", + ] + shared_libraries = [ "//content/shell/android:libcontent_shell_content_view" ] + command_line_flags_file = "content-shell-command-line" +} diff --git a/starboard/android/apk/.gitignore b/cobalt/android/apk/.gitignore similarity index 100% rename from starboard/android/apk/.gitignore rename to cobalt/android/apk/.gitignore diff --git a/starboard/android/apk/apk_sources.gni b/cobalt/android/apk/apk_sources.gni similarity index 100% rename from starboard/android/apk/apk_sources.gni rename to cobalt/android/apk/apk_sources.gni diff --git a/starboard/android/apk/app/.gitignore b/cobalt/android/apk/app/.gitignore similarity index 100% rename from starboard/android/apk/app/.gitignore rename to cobalt/android/apk/app/.gitignore diff --git a/starboard/android/apk/app/CMakeLists.txt b/cobalt/android/apk/app/CMakeLists.txt similarity index 100% rename from starboard/android/apk/app/CMakeLists.txt rename to cobalt/android/apk/app/CMakeLists.txt diff --git a/starboard/android/apk/app/build.gradle b/cobalt/android/apk/app/build.gradle similarity index 100% rename from starboard/android/apk/app/build.gradle rename to cobalt/android/apk/app/build.gradle diff --git a/starboard/android/apk/app/cobalt-ninja.sh b/cobalt/android/apk/app/cobalt-ninja.sh similarity index 100% rename from starboard/android/apk/app/cobalt-ninja.sh rename to cobalt/android/apk/app/cobalt-ninja.sh diff --git a/starboard/android/apk/app/proguard-rules.pro b/cobalt/android/apk/app/proguard-rules.pro similarity index 100% rename from starboard/android/apk/app/proguard-rules.pro rename to cobalt/android/apk/app/proguard-rules.pro diff --git a/cobalt/android/apk/app/src/app/AndroidManifest.xml.jinja2 b/cobalt/android/apk/app/src/app/AndroidManifest.xml.jinja2 new file mode 100644 index 000000000000..af6fd97b8991 --- /dev/null +++ b/cobalt/android/apk/app/src/app/AndroidManifest.xml.jinja2 @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + {% block extra_uses_permissions %} + {% endblock %} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {% set num_sandboxed_services = 40 %} + + {% for i in range(num_sandboxed_services) %} + + {% endfor %} + + {% set num_privileged_services = 5 %} + + {% for i in range(num_privileged_services) %} + + {% endfor %} + + + + + + {% set num_test_services = 2 %} + + {% for i in range(num_test_services) %} + + {% endfor %} + {% block extra_application_definitions_for_test %} + {% endblock %} + + + {% block extra_root_definitions %} + {% endblock %} + diff --git a/starboard/android/apk/app/src/app/assets/not_empty.txt b/cobalt/android/apk/app/src/app/assets/not_empty.txt similarity index 100% rename from starboard/android/apk/app/src/app/assets/not_empty.txt rename to cobalt/android/apk/app/src/app/assets/not_empty.txt diff --git a/starboard/android/apk/app/src/app/assets/test/not_empty.txt b/cobalt/android/apk/app/src/app/assets/test/not_empty.txt similarity index 100% rename from starboard/android/apk/app/src/app/assets/test/not_empty.txt rename to cobalt/android/apk/app/src/app/assets/test/not_empty.txt diff --git a/starboard/android/apk/app/src/app/assets/web/cobalt_blue_splash_screen.css b/cobalt/android/apk/app/src/app/assets/web/cobalt_blue_splash_screen.css similarity index 100% rename from starboard/android/apk/app/src/app/assets/web/cobalt_blue_splash_screen.css rename to cobalt/android/apk/app/src/app/assets/web/cobalt_blue_splash_screen.css diff --git a/starboard/android/apk/app/src/app/assets/web/cobalt_blue_splash_screen.html b/cobalt/android/apk/app/src/app/assets/web/cobalt_blue_splash_screen.html similarity index 100% rename from starboard/android/apk/app/src/app/assets/web/cobalt_blue_splash_screen.html rename to cobalt/android/apk/app/src/app/assets/web/cobalt_blue_splash_screen.html diff --git a/starboard/android/apk/app/src/app/assets/web/cobalt_logo_1024.png b/cobalt/android/apk/app/src/app/assets/web/cobalt_logo_1024.png similarity index 100% rename from starboard/android/apk/app/src/app/assets/web/cobalt_logo_1024.png rename to cobalt/android/apk/app/src/app/assets/web/cobalt_logo_1024.png diff --git a/starboard/android/apk/app/src/app/java/dev/cobalt/app/CobaltApplication.java b/cobalt/android/apk/app/src/app/java/dev/cobalt/app/CobaltApplication.java similarity index 83% rename from starboard/android/apk/app/src/app/java/dev/cobalt/app/CobaltApplication.java rename to cobalt/android/apk/app/src/app/java/dev/cobalt/app/CobaltApplication.java index 76cd80724bab..7bae30a55a94 100644 --- a/starboard/android/apk/app/src/app/java/dev/cobalt/app/CobaltApplication.java +++ b/cobalt/android/apk/app/src/app/java/dev/cobalt/app/CobaltApplication.java @@ -15,10 +15,13 @@ package dev.cobalt.app; import android.app.Application; +import android.content.Context; import dev.cobalt.coat.StarboardBridge; +import org.chromium.content_shell_apk.ContentShellApplication; + /** Android Application hosting the Starboard application. */ -public class CobaltApplication extends Application implements StarboardBridge.HostApplication { +public class CobaltApplication extends ContentShellApplication implements StarboardBridge.HostApplication { StarboardBridge starboardBridge; @Override diff --git a/starboard/android/apk/app/src/app/java/dev/cobalt/app/MainActivity.java b/cobalt/android/apk/app/src/app/java/dev/cobalt/app/MainActivity.java similarity index 100% rename from starboard/android/apk/app/src/app/java/dev/cobalt/app/MainActivity.java rename to cobalt/android/apk/app/src/app/java/dev/cobalt/app/MainActivity.java diff --git a/starboard/android/apk/app/src/app/res/drawable-xhdpi/app_banner.png b/cobalt/android/apk/app/src/app/res/drawable-xhdpi/app_banner.png similarity index 100% rename from starboard/android/apk/app/src/app/res/drawable-xhdpi/app_banner.png rename to cobalt/android/apk/app/src/app/res/drawable-xhdpi/app_banner.png diff --git a/starboard/android/apk/app/src/app/res/mipmap-hdpi/ic_app.png b/cobalt/android/apk/app/src/app/res/mipmap-hdpi/ic_app.png similarity index 100% rename from starboard/android/apk/app/src/app/res/mipmap-hdpi/ic_app.png rename to cobalt/android/apk/app/src/app/res/mipmap-hdpi/ic_app.png diff --git a/starboard/android/apk/app/src/app/res/mipmap-mdpi/ic_app.png b/cobalt/android/apk/app/src/app/res/mipmap-mdpi/ic_app.png similarity index 100% rename from starboard/android/apk/app/src/app/res/mipmap-mdpi/ic_app.png rename to cobalt/android/apk/app/src/app/res/mipmap-mdpi/ic_app.png diff --git a/starboard/android/apk/app/src/app/res/mipmap-xhdpi/ic_app.png b/cobalt/android/apk/app/src/app/res/mipmap-xhdpi/ic_app.png similarity index 100% rename from starboard/android/apk/app/src/app/res/mipmap-xhdpi/ic_app.png rename to cobalt/android/apk/app/src/app/res/mipmap-xhdpi/ic_app.png diff --git a/starboard/android/apk/app/src/app/res/mipmap-xxhdpi/ic_app.png b/cobalt/android/apk/app/src/app/res/mipmap-xxhdpi/ic_app.png similarity index 100% rename from starboard/android/apk/app/src/app/res/mipmap-xxhdpi/ic_app.png rename to cobalt/android/apk/app/src/app/res/mipmap-xxhdpi/ic_app.png diff --git a/starboard/android/apk/app/src/app/res/values/strings.xml b/cobalt/android/apk/app/src/app/res/values/strings.xml similarity index 100% rename from starboard/android/apk/app/src/app/res/values/strings.xml rename to cobalt/android/apk/app/src/app/res/values/strings.xml diff --git a/starboard/android/apk/app/src/main/java/dev/cobalt/coat/AdvertisingId.java b/cobalt/android/apk/app/src/main/java/dev/cobalt/coat/AdvertisingId.java similarity index 100% rename from starboard/android/apk/app/src/main/java/dev/cobalt/coat/AdvertisingId.java rename to cobalt/android/apk/app/src/main/java/dev/cobalt/coat/AdvertisingId.java diff --git a/starboard/android/apk/app/src/main/java/dev/cobalt/coat/ArtworkDownloader.java b/cobalt/android/apk/app/src/main/java/dev/cobalt/coat/ArtworkDownloader.java similarity index 100% rename from starboard/android/apk/app/src/main/java/dev/cobalt/coat/ArtworkDownloader.java rename to cobalt/android/apk/app/src/main/java/dev/cobalt/coat/ArtworkDownloader.java diff --git a/starboard/android/apk/app/src/main/java/dev/cobalt/coat/ArtworkDownloaderDefault.java b/cobalt/android/apk/app/src/main/java/dev/cobalt/coat/ArtworkDownloaderDefault.java similarity index 100% rename from starboard/android/apk/app/src/main/java/dev/cobalt/coat/ArtworkDownloaderDefault.java rename to cobalt/android/apk/app/src/main/java/dev/cobalt/coat/ArtworkDownloaderDefault.java diff --git a/starboard/android/apk/app/src/main/java/dev/cobalt/coat/ArtworkLoader.java b/cobalt/android/apk/app/src/main/java/dev/cobalt/coat/ArtworkLoader.java similarity index 94% rename from starboard/android/apk/app/src/main/java/dev/cobalt/coat/ArtworkLoader.java rename to cobalt/android/apk/app/src/main/java/dev/cobalt/coat/ArtworkLoader.java index c2c52b9f928f..fcc1c5d3d204 100644 --- a/starboard/android/apk/app/src/main/java/dev/cobalt/coat/ArtworkLoader.java +++ b/cobalt/android/apk/app/src/main/java/dev/cobalt/coat/ArtworkLoader.java @@ -19,7 +19,6 @@ import android.os.Looper; import android.util.Pair; import android.util.Size; -import androidx.annotation.NonNull; import dev.cobalt.util.DisplayUtil; import java.util.Locale; @@ -31,9 +30,9 @@ public interface Callback { void onArtworkLoaded(Bitmap bitmap); } - @NonNull private volatile String requestedArtworkUrl = ""; - @NonNull private volatile String currentArtworkUrl = ""; - private volatile Bitmap currentArtwork = null; + private volatile String requestedArtworkUrl = ""; + private volatile String currentArtworkUrl = ""; + private volatile Bitmap currentArtwork; private final Handler handler = new Handler(Looper.getMainLooper()); private final ArtworkDownloader artworkDownloader; @@ -48,7 +47,7 @@ public ArtworkLoader(Callback callback, ArtworkDownloader artworkDownloader) { * Returns a cached image if available. If not cached, returns null and starts downloading it in * the background, and then when ready the callback will be called with the image. */ - public synchronized Bitmap getOrLoadArtwork(MediaImage[] artwork) { + public Bitmap getOrLoadArtwork(MediaImage[] artwork) { MediaImage image = getBestFitImage(artwork, DisplayUtil.getDisplaySize()); String url = (image == null) ? "" : image.src; diff --git a/starboard/android/apk/app/src/main/java/dev/cobalt/coat/AudioPermissionRequester.java b/cobalt/android/apk/app/src/main/java/dev/cobalt/coat/AudioPermissionRequester.java similarity index 100% rename from starboard/android/apk/app/src/main/java/dev/cobalt/coat/AudioPermissionRequester.java rename to cobalt/android/apk/app/src/main/java/dev/cobalt/coat/AudioPermissionRequester.java diff --git a/starboard/android/apk/app/src/main/java/dev/cobalt/coat/CaptionSettings.java b/cobalt/android/apk/app/src/main/java/dev/cobalt/coat/CaptionSettings.java similarity index 100% rename from starboard/android/apk/app/src/main/java/dev/cobalt/coat/CaptionSettings.java rename to cobalt/android/apk/app/src/main/java/dev/cobalt/coat/CaptionSettings.java diff --git a/cobalt/android/apk/app/src/main/java/dev/cobalt/coat/CobaltA11yHelper.java b/cobalt/android/apk/app/src/main/java/dev/cobalt/coat/CobaltA11yHelper.java new file mode 100644 index 000000000000..258f7dd357e6 --- /dev/null +++ b/cobalt/android/apk/app/src/main/java/dev/cobalt/coat/CobaltA11yHelper.java @@ -0,0 +1,209 @@ +// // Copyright 2017 The Cobalt Authors. All Rights Reserved. +// // +// // Licensed under the Apache License, Version 2.0 (the "License"); +// // you may not use this file except in compliance with the License. +// // You may obtain a copy of the License at +// // +// // http://www.apache.org/licenses/LICENSE-2.0 +// // +// // Unless required by applicable law or agreed to in writing, software +// // distributed under the License is distributed on an "AS IS" BASIS, +// // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// // See the License for the specific language governing permissions and +// // limitations under the License. + +// package dev.cobalt.coat; + +// import android.graphics.Rect; +// import android.os.Bundle; +// import android.os.Handler; +// import android.os.Looper; +// import android.view.View; +// import android.view.accessibility.AccessibilityEvent; +// import androidx.core.view.ViewCompat; +// import androidx.core.view.accessibility.AccessibilityNodeInfoCompat; +// import androidx.customview.widget.ExploreByTouchHelper; +// import java.util.BitSet; +// import java.util.List; + +// /** +// * An ExploreByTouchHelper that create a virtual d-pad grid, so that Cobalt remains functional when +// * the TalkBack screen reader is enabled (which otherwise intercepts d-pad events for most +// * applications). +// */ +// class CobaltA11yHelper extends ExploreByTouchHelper { +// // These are from starboard/key.h +// private static final int SB_KEY_GAMEPAD_DPAD_UP = 0x800C; +// private static final int SB_KEY_GAMEPAD_DPAD_DOWN = 0x800D; +// private static final int SB_KEY_GAMEPAD_DPAD_LEFT = 0x800E; +// private static final int SB_KEY_GAMEPAD_DPAD_RIGHT = 0x800F; + +// // The fake dimensions for the nine virtual views. +// // These values are arbitrary as long as the views stay on the screen. +// private static final int FAKE_VIEW_HEIGHT = 10; +// private static final int FAKE_VIEW_WIDTH = 10; + +// private static final int CENTER_VIEW_ID = 5; +// private static final int UP_VIEW_ID = 2; +// private static final int DOWN_VIEW_ID = 8; +// private static final int LEFT_VIEW_ID = 4; +// private static final int RIGHT_VIEW_ID = 6; + +// private static final int INPUT_FOCUS_CHANGE_DELAY = 1500; // milliseconds + +// // This set tracks whether onPopulateNodeForVirtualView has been +// // called for each virtual view id. +// private final BitSet nodePopulatedSet = new BitSet(9); +// private final Handler handler = new Handler(Looper.getMainLooper()); +// private boolean unhandledInput; +// private boolean hasInitialFocusBeenSet; + +// public CobaltA11yHelper(View view) { +// super(view); +// ViewCompat.setAccessibilityDelegate(view, this); +// } + +// private static native void nativeInjectKeyEvent(int key); + +// @Override +// protected int getVirtualViewAt(float x, float y) { +// // This method is only required for touch or mouse interfaces. +// // Since we don't support either, we simply always return HOST_ID. +// return HOST_ID; +// } + +// @Override +// protected void getVisibleVirtualViews(List virtualViewIds) { +// if (!virtualViewIds.isEmpty()) { +// throw new RuntimeException("Expected empty list"); +// } +// // We always have precisely 9 virtual views. +// for (int i = 1; i <= 9; i++) { +// virtualViewIds.add(i); +// } +// } + +// private void focusOnCenter() { +// // Setting Accessibility focus to CENTER_VIEW_ID will make TalkBack focus +// // on CENTER_VIEW_ID immediately, but the actual mouse focus is either +// // unchanged or return INVALID_ID. +// handler.post( +// new Runnable() { +// @Override +// public void run() { +// sendEventForVirtualView( +// CENTER_VIEW_ID, AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED); +// } +// }); + +// // There is a known Android bug about setting focus too early +// // taking no effect. The impact for Cobalt is that sometimes after +// // we click on a video, TalkBack sees nothing in focus in the watch +// // page if no user input happens. To avoid this bug we have to +// // delay the focus long enough for all the TalkBack movements to settle +// // down. More details here: https://stackoverflow.com/questions/28472985. +// handler.postDelayed( +// new Runnable() { +// @Override +// public void run() { +// sendEventForVirtualView(CENTER_VIEW_ID, AccessibilityEvent.TYPE_VIEW_FOCUSED); +// } +// }, +// INPUT_FOCUS_CHANGE_DELAY); +// } + +// private void maybeInjectEvent(int currentFocusedViewId) { +// if (!unhandledInput) { +// return; +// } +// switch (currentFocusedViewId) { +// case CENTER_VIEW_ID: +// // no move; +// break; +// case UP_VIEW_ID: +// nativeInjectKeyEvent(SB_KEY_GAMEPAD_DPAD_UP); +// break; +// case LEFT_VIEW_ID: +// nativeInjectKeyEvent(SB_KEY_GAMEPAD_DPAD_LEFT); +// break; +// case RIGHT_VIEW_ID: +// nativeInjectKeyEvent(SB_KEY_GAMEPAD_DPAD_RIGHT); +// break; +// case DOWN_VIEW_ID: +// nativeInjectKeyEvent(SB_KEY_GAMEPAD_DPAD_DOWN); +// break; +// default: +// // TODO: Could support diagonal movements, although it's likely +// // not possible to reach this. +// break; +// } +// unhandledInput = false; +// focusOnCenter(); +// } + +// /** +// * +// * +// *
Fake number grid:
+//    *   |+-+-+-+
+//    *   ||1|2|3|
+//    *   |+-+-+-|
+//    *   ||4|5|6|
+//    *   |+-+-+-|
+//    *   ||7|8|9|
+//    *   |+-+-+-+
+//    * 
+// * +// *

The focus always starts from the middle number 5. When user changes focus, the focus is then +// * moved to either 2, 4, 6 or 8 and we can capture the movement this way. The focus is then +// * quickly switched back to the center 5 to be ready for the next movement. +// */ +// @Override +// protected void onPopulateNodeForVirtualView(int virtualViewId, AccessibilityNodeInfoCompat node) { +// int focusedViewId = getAccessibilityFocusedVirtualViewId(); + +// if (focusedViewId < 1 || focusedViewId > 9) { +// // If this is not one of our nine-patch views, it's probably HOST_ID +// // In any case, assume there is no focus change. +// focusedViewId = CENTER_VIEW_ID; +// } + +// // onPopulateNodeForVirtualView() gets called at least once every +// // time the focused view changes. So see if it's changed since the +// // last time we've been called and inject an event if so. +// if (focusedViewId != CENTER_VIEW_ID) { +// maybeInjectEvent(focusedViewId); +// } else { +// unhandledInput = true; +// } + +// int x = (virtualViewId - 1) % 3; +// int y = (virtualViewId - 1) / 3; + +// // Note that the specific bounds here are arbitrary. The importance +// // is the relative bounds to each other. +// node.setBoundsInParent( +// new Rect( +// x * FAKE_VIEW_WIDTH, +// y * FAKE_VIEW_HEIGHT, +// x * FAKE_VIEW_WIDTH + FAKE_VIEW_WIDTH, +// y * FAKE_VIEW_HEIGHT + FAKE_VIEW_HEIGHT)); +// node.setText(""); + +// if (virtualViewId >= 1 || virtualViewId <= 9) { +// nodePopulatedSet.set(virtualViewId - 1); +// } +// if (!hasInitialFocusBeenSet && nodePopulatedSet.cardinality() == 9) { +// // Once the ExploreByTouchHelper knows about all of our virtual views, +// // but not before, ask that the accessibility focus be moved from +// // it's initial position on HOST_ID to the one we want to start with. +// hasInitialFocusBeenSet = true; +// focusOnCenter(); +// } +// } + +// @Override +// protected boolean onPerformActionForVirtualView(int virtualViewId, int action, Bundle arguments) { +// return false; +// } +// } diff --git a/starboard/android/apk/app/src/main/java/dev/cobalt/coat/CobaltActivity.java b/cobalt/android/apk/app/src/main/java/dev/cobalt/coat/CobaltActivity.java similarity index 90% rename from starboard/android/apk/app/src/main/java/dev/cobalt/coat/CobaltActivity.java rename to cobalt/android/apk/app/src/main/java/dev/cobalt/coat/CobaltActivity.java index d566fa98823f..9b2bdee67eee 100644 --- a/starboard/android/apk/app/src/main/java/dev/cobalt/coat/CobaltActivity.java +++ b/cobalt/android/apk/app/src/main/java/dev/cobalt/coat/CobaltActivity.java @@ -29,9 +29,7 @@ import android.view.ViewGroup.LayoutParams; import android.view.ViewParent; import android.widget.FrameLayout; -import androidx.annotation.CallSuper; -import com.google.androidgamesdk.GameActivity; -import dev.cobalt.media.AudioOutputManager; +// import dev.cobalt.media.AudioOutputManager; import dev.cobalt.media.MediaCodecCapabilitiesLogger; import dev.cobalt.media.VideoSurfaceView; import dev.cobalt.util.DisplayUtil; @@ -43,8 +41,10 @@ import java.util.Locale; import java.util.regex.Pattern; +import org.chromium.content_shell_apk.ContentShellActivity; + /** Native activity that has the required JNI methods called by the Starboard implementation. */ -public abstract class CobaltActivity extends GameActivity { +public abstract class CobaltActivity extends ContentShellActivity { // A place to put args while debugging so they're used even when starting from the launcher. // This should always be empty in submitted code. @@ -68,18 +68,15 @@ public abstract class CobaltActivity extends GameActivity { private static final Pattern URL_PARAM_PATTERN = Pattern.compile("^[a-zA-Z0-9_=]*$"); - @SuppressWarnings("unused") - private CobaltA11yHelper a11yHelper; - private VideoSurfaceView videoSurfaceView; private boolean forceCreateNewVideoSurfaceView = false; private long timeInNanoseconds; - private static native void nativeLowMemoryEvent(); + // private static native void nativeLowMemoryEvent(); - protected View mContentView = null; + // protected View mContentView = null; @Override protected void onCreate(Bundle savedInstanceState) { @@ -91,6 +88,7 @@ protected void onCreate(Bundle savedInstanceState) { // STREAM_MUSIC whenever the target activity or fragment is visible. setVolumeControlStream(AudioManager.STREAM_MUSIC); + // TODO(b/374147993): how to handle deeplink in Chrobalt? String startDeepLink = getIntentUrlAsString(getIntent()); if (getStarboardBridge() == null) { // Cold start - Instantiate the singleton StarboardBridge. @@ -101,32 +99,14 @@ protected void onCreate(Bundle savedInstanceState) { getStarboardBridge().handleDeepLink(startDeepLink); } - // super.onCreate() will cause an APP_CMD_START in native code, - // so make sure to initialize any state beforehand that might be touched by - // native code invocations. + super.setStartupUrl("https://www.youtube.com/tv"); super.onCreate(savedInstanceState); videoSurfaceView = new VideoSurfaceView(this); - a11yHelper = new CobaltA11yHelper(videoSurfaceView); addContentView( videoSurfaceView, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); } - /** - * Creates an empty View for the launching activity, and prevent GameActivity from creating the - * default SurfaceView. - */ - @Override - protected void onCreateSurfaceView() { - mSurfaceView = null; - - getWindow().takeSurface(this); - - mContentView = new View(this); - setContentView(mContentView); - mContentView.requestFocus(); - } - /** * Instantiates the StarboardBridge. Apps not supporting sign-in should inject an instance of * NoopUserAuthorizer. Apps may subclass StarboardBridge if they need to override anything. @@ -141,7 +121,7 @@ protected StarboardBridge getStarboardBridge() { @Override protected void onStart() { if (!isReleaseBuild()) { - getStarboardBridge().getAudioOutputManager().dumpAllOutputDevices(); + // getStarboardBridge().getAudioOutputManager().dumpAllOutputDevices(); MediaCodecCapabilitiesLogger.dumpAllDecoders(); } if (forceCreateNewVideoSurfaceView) { @@ -151,7 +131,7 @@ protected void onStart() { DisplayUtil.cacheDefaultDisplay(this); DisplayUtil.addDisplayListener(this); - AudioOutputManager.addAudioDeviceListener(this); + // AudioOutputManager.addAudioDeviceListener(this); getStarboardBridge().onActivityStart(this); super.onStart(); @@ -331,7 +311,6 @@ protected boolean isReleaseBuild() { return StarboardBridge.isReleaseBuild(); } - @CallSuper @Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); @@ -346,12 +325,12 @@ protected String getIntentUrlAsString(Intent intent) { return (intentUri == null) ? null : intentUri.toString(); } - @SuppressLint("MissingSuperCall") - @Override - public void onRequestPermissionsResult( - int requestCode, String[] permissions, int[] grantResults) { - getStarboardBridge().onRequestPermissionsResult(requestCode, permissions, grantResults); - } + // @SuppressLint("MissingSuperCall") + // @Override + // public void onRequestPermissionsResult( + // int requestCode, String[] permissions, int[] grantResults) { + // getStarboardBridge().onRequestPermissionsResult(requestCode, permissions, grantResults); + // } public void resetVideoSurface() { runOnUiThread( @@ -402,7 +381,6 @@ private void createNewSurfaceView() { int index = frameLayout.indexOfChild(videoSurfaceView); frameLayout.removeView(videoSurfaceView); videoSurfaceView = new VideoSurfaceView(this); - a11yHelper = new CobaltA11yHelper(videoSurfaceView); frameLayout.addView( videoSurfaceView, index, @@ -415,7 +393,7 @@ private void createNewSurfaceView() { @Override public void onLowMemory() { super.onLowMemory(); - nativeLowMemoryEvent(); + // nativeLowMemoryEvent(); } public long getAppStartTimestamp() { diff --git a/starboard/android/apk/app/src/main/java/dev/cobalt/coat/CobaltHttpHelper.java b/cobalt/android/apk/app/src/main/java/dev/cobalt/coat/CobaltHttpHelper.java similarity index 100% rename from starboard/android/apk/app/src/main/java/dev/cobalt/coat/CobaltHttpHelper.java rename to cobalt/android/apk/app/src/main/java/dev/cobalt/coat/CobaltHttpHelper.java diff --git a/starboard/android/apk/app/src/main/java/dev/cobalt/coat/CobaltMediaSession.java b/cobalt/android/apk/app/src/main/java/dev/cobalt/coat/CobaltMediaSession.java similarity index 100% rename from starboard/android/apk/app/src/main/java/dev/cobalt/coat/CobaltMediaSession.java rename to cobalt/android/apk/app/src/main/java/dev/cobalt/coat/CobaltMediaSession.java diff --git a/starboard/android/apk/app/src/main/java/dev/cobalt/coat/CobaltService.java b/cobalt/android/apk/app/src/main/java/dev/cobalt/coat/CobaltService.java similarity index 84% rename from starboard/android/apk/app/src/main/java/dev/cobalt/coat/CobaltService.java rename to cobalt/android/apk/app/src/main/java/dev/cobalt/coat/CobaltService.java index 8588be831f82..f63f1e3aa2d2 100644 --- a/starboard/android/apk/app/src/main/java/dev/cobalt/coat/CobaltService.java +++ b/cobalt/android/apk/app/src/main/java/dev/cobalt/coat/CobaltService.java @@ -23,6 +23,7 @@ public abstract class CobaltService { // Indicate is the service opened, and be able to send data to client protected boolean opened = true; + private final Object lock = new Object(); /** Interface that returns an object that extends CobaltService. */ public interface Factory { @@ -76,7 +77,7 @@ public static class ResponseToClient { @SuppressWarnings("unused") @UsedByNative public void onClose() { - synchronized (this) { + synchronized (lock) { opened = false; close(); } @@ -87,22 +88,12 @@ public void onClose() { /** * Send data from the service to the client. * - *

This may be called from a separate thread, do not call nativeSendToClient() once onClose() - * is processed. */ protected void sendToClient(long nativeService, byte[] data) { - synchronized (this) { - if (!opened) { - Log.w( - TAG, - "Platform service did not send data to client, because client already closed the" - + " platform service."); - return; - } - - nativeSendToClient(nativeService, data); - } + // TODO(b/372558900): Implement Javascript Injection } - private native void nativeSendToClient(long nativeService, byte[] data); + private void nativeSendToClient(long nativeService, byte[] data) { + // TODO(b/372558900): Implement Javascript Injection + } } diff --git a/starboard/android/apk/app/src/main/java/dev/cobalt/coat/CobaltSystemConfigChangeReceiver.java b/cobalt/android/apk/app/src/main/java/dev/cobalt/coat/CobaltSystemConfigChangeReceiver.java similarity index 100% rename from starboard/android/apk/app/src/main/java/dev/cobalt/coat/CobaltSystemConfigChangeReceiver.java rename to cobalt/android/apk/app/src/main/java/dev/cobalt/coat/CobaltSystemConfigChangeReceiver.java diff --git a/starboard/android/apk/app/src/main/java/dev/cobalt/coat/CobaltTextToSpeechHelper.java b/cobalt/android/apk/app/src/main/java/dev/cobalt/coat/CobaltTextToSpeechHelper.java similarity index 100% rename from starboard/android/apk/app/src/main/java/dev/cobalt/coat/CobaltTextToSpeechHelper.java rename to cobalt/android/apk/app/src/main/java/dev/cobalt/coat/CobaltTextToSpeechHelper.java diff --git a/starboard/android/apk/app/src/main/java/dev/cobalt/coat/CrashContextUpdateHandler.java b/cobalt/android/apk/app/src/main/java/dev/cobalt/coat/CrashContextUpdateHandler.java similarity index 100% rename from starboard/android/apk/app/src/main/java/dev/cobalt/coat/CrashContextUpdateHandler.java rename to cobalt/android/apk/app/src/main/java/dev/cobalt/coat/CrashContextUpdateHandler.java diff --git a/starboard/android/apk/app/src/main/java/dev/cobalt/coat/ErrorDialog.java b/cobalt/android/apk/app/src/main/java/dev/cobalt/coat/ErrorDialog.java similarity index 94% rename from starboard/android/apk/app/src/main/java/dev/cobalt/coat/ErrorDialog.java rename to cobalt/android/apk/app/src/main/java/dev/cobalt/coat/ErrorDialog.java index 775c493297c4..fe1498183155 100644 --- a/starboard/android/apk/app/src/main/java/dev/cobalt/coat/ErrorDialog.java +++ b/cobalt/android/apk/app/src/main/java/dev/cobalt/coat/ErrorDialog.java @@ -94,11 +94,11 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.coat_error_dialog); ImageView imageView = (ImageView) findViewById(R.id.image); - Drawable drawable = - getContext() - .getResources() - .getDrawable(R.drawable.lb_ic_sad_cloud, getContext().getTheme()); - imageView.setImageDrawable(drawable); + // Drawable drawable = + // getContext() + // .getResources() + // .getDrawable(R.drawable.lb_ic_sad_cloud, getContext().getTheme()); + // imageView.setImageDrawable(drawable); TextView messageView = (TextView) findViewById(R.id.message); messageView.setText(params.messageId); diff --git a/starboard/android/apk/app/src/main/java/dev/cobalt/coat/MediaImage.java b/cobalt/android/apk/app/src/main/java/dev/cobalt/coat/MediaImage.java similarity index 100% rename from starboard/android/apk/app/src/main/java/dev/cobalt/coat/MediaImage.java rename to cobalt/android/apk/app/src/main/java/dev/cobalt/coat/MediaImage.java diff --git a/starboard/android/apk/app/src/main/java/dev/cobalt/coat/NetworkStatus.java b/cobalt/android/apk/app/src/main/java/dev/cobalt/coat/NetworkStatus.java similarity index 97% rename from starboard/android/apk/app/src/main/java/dev/cobalt/coat/NetworkStatus.java rename to cobalt/android/apk/app/src/main/java/dev/cobalt/coat/NetworkStatus.java index 5904910681ec..471c53f80ec4 100644 --- a/starboard/android/apk/app/src/main/java/dev/cobalt/coat/NetworkStatus.java +++ b/cobalt/android/apk/app/src/main/java/dev/cobalt/coat/NetworkStatus.java @@ -65,7 +65,7 @@ public void run() { } private void sendStatusChangeInternal(boolean online) { - nativeOnNetworkStatusChange(online); + // nativeOnNetworkStatusChange(online); } public NetworkStatus(Context appContext) { @@ -109,5 +109,5 @@ public boolean isConnected() { } } - private native void nativeOnNetworkStatusChange(boolean online); + // private native void nativeOnNetworkStatusChange(boolean online); } diff --git a/starboard/android/apk/app/src/main/java/dev/cobalt/coat/NullCobaltFactory.java b/cobalt/android/apk/app/src/main/java/dev/cobalt/coat/NullCobaltFactory.java similarity index 100% rename from starboard/android/apk/app/src/main/java/dev/cobalt/coat/NullCobaltFactory.java rename to cobalt/android/apk/app/src/main/java/dev/cobalt/coat/NullCobaltFactory.java diff --git a/starboard/android/apk/app/src/main/java/dev/cobalt/coat/PlatformError.java b/cobalt/android/apk/app/src/main/java/dev/cobalt/coat/PlatformError.java similarity index 100% rename from starboard/android/apk/app/src/main/java/dev/cobalt/coat/PlatformError.java rename to cobalt/android/apk/app/src/main/java/dev/cobalt/coat/PlatformError.java diff --git a/starboard/android/apk/app/src/main/java/dev/cobalt/coat/ResourceOverlay.java b/cobalt/android/apk/app/src/main/java/dev/cobalt/coat/ResourceOverlay.java similarity index 100% rename from starboard/android/apk/app/src/main/java/dev/cobalt/coat/ResourceOverlay.java rename to cobalt/android/apk/app/src/main/java/dev/cobalt/coat/ResourceOverlay.java diff --git a/starboard/android/apk/app/src/main/java/dev/cobalt/coat/StarboardBridge.java b/cobalt/android/apk/app/src/main/java/dev/cobalt/coat/StarboardBridge.java similarity index 90% rename from starboard/android/apk/app/src/main/java/dev/cobalt/coat/StarboardBridge.java rename to cobalt/android/apk/app/src/main/java/dev/cobalt/coat/StarboardBridge.java index c0b7b209695b..fa57734ddd8f 100644 --- a/starboard/android/apk/app/src/main/java/dev/cobalt/coat/StarboardBridge.java +++ b/cobalt/android/apk/app/src/main/java/dev/cobalt/coat/StarboardBridge.java @@ -38,7 +38,7 @@ import android.view.accessibility.AccessibilityManager; import android.view.accessibility.CaptioningManager; import androidx.annotation.Nullable; -import dev.cobalt.media.AudioOutputManager; +// import dev.cobalt.media.AudioOutputManager; import dev.cobalt.util.DisplayUtil; import dev.cobalt.util.Holder; import dev.cobalt.util.Log; @@ -65,25 +65,15 @@ public interface HostApplication { private CobaltSystemConfigChangeReceiver sysConfigChangeReceiver; private CobaltTextToSpeechHelper ttsHelper; - private AudioOutputManager audioOutputManager; - private CobaltMediaSession cobaltMediaSession; - private AudioPermissionRequester audioPermissionRequester; + // private AudioOutputManager audioOutputManager; + // private CobaltMediaSession cobaltMediaSession; + // private AudioPermissionRequester audioPermissionRequester; private NetworkStatus networkStatus; private ResourceOverlay resourceOverlay; - private AdvertisingId advertisingId; + // private AdvertisingId advertisingId; private VolumeStateReceiver volumeStateReceiver; private CrashContextUpdateHandler crashContextUpdateHandler; - static { - // Even though NativeActivity already loads our library from C++, - // we still have to load it from Java to make JNI calls into it. - - // GameActivity has code to load the libcobalt.so as well. - // It reads the library name from the meta data field "android.app.lib_name" in the - // AndroidManifest.xml - System.loadLibrary("cobalt"); - } - private final Context appContext; private final Holder activityHolder; private final Holder serviceHolder; @@ -97,8 +87,8 @@ public void run() { } }; - private volatile boolean starboardApplicationStopped = false; - private volatile boolean starboardApplicationReady = false; + private volatile boolean starboardApplicationStopped; + private volatile boolean starboardApplicationReady; private final HashMap cobaltServiceFactories = new HashMap<>(); private final HashMap cobaltServices = new HashMap<>(); @@ -121,7 +111,7 @@ public StarboardBridge( // Make sure the JNI stack is properly initialized first as there is // race condition as soon as any of the following objects creates a new thread. - nativeInitialize(); + // nativeInitialize(); this.appContext = appContext; this.activityHolder = activityHolder; @@ -130,20 +120,23 @@ public StarboardBridge( this.startDeepLink = startDeepLink; this.sysConfigChangeReceiver = new CobaltSystemConfigChangeReceiver(appContext, stopRequester); this.ttsHelper = new CobaltTextToSpeechHelper(appContext); - this.audioOutputManager = new AudioOutputManager(appContext); - this.cobaltMediaSession = - new CobaltMediaSession(appContext, activityHolder, audioOutputManager, artworkDownloader); - this.audioPermissionRequester = new AudioPermissionRequester(appContext, activityHolder); + // this.audioOutputManager = new AudioOutputManager(appContext); + // this.cobaltMediaSession = + // new CobaltMediaSession(appContext, activityHolder, audioOutputManager, artworkDownloader); + // this.audioPermissionRequester = new AudioPermissionRequester(appContext, activityHolder); this.networkStatus = new NetworkStatus(appContext); this.resourceOverlay = new ResourceOverlay(appContext); - this.advertisingId = new AdvertisingId(appContext); + // this.advertisingId = new AdvertisingId(appContext); this.volumeStateReceiver = new VolumeStateReceiver(appContext); this.isAmatiDevice = appContext.getPackageManager().hasSystemFeature(AMATI_EXPERIENCE_FEATURE); } - private native boolean nativeInitialize(); + // private boolean nativeInitialize(); - private native long nativeCurrentMonotonicTime(); + private long nativeCurrentMonotonicTime() { + // TODO(b/375058047) + return 0; + } protected void onActivityStart(Activity activity) { activityHolder.set(activity); @@ -183,12 +176,12 @@ protected void beforeStartOrResume() { Log.i(TAG, "Prepare to resume"); // Bring our platform services to life before resuming so that they're ready to deal with // whatever the web app wants to do with them as part of its start/resume logic. - cobaltMediaSession.resume(); + // cobaltMediaSession.resume(); networkStatus.beforeStartOrResume(); for (CobaltService service : cobaltServices.values()) { service.beforeStartOrResume(); } - advertisingId.refresh(); + // advertisingId.refresh(); } @SuppressWarnings("unused") @@ -199,7 +192,7 @@ protected void beforeSuspend() { // We want the MediaSession to be deactivated immediately before suspending so that by the // time, the launcher is visible our "Now Playing" card is already gone. Then Cobalt and // the web app can take their time suspending after that. - cobaltMediaSession.suspend(); + // cobaltMediaSession.suspend(); networkStatus.beforeSuspend(); for (CobaltService service : cobaltServices.values()) { service.beforeSuspend(); @@ -247,11 +240,11 @@ protected void starboardApplicationStopping() { public void requestStop(int errorLevel) { if (starboardApplicationReady) { Log.i(TAG, "Request to stop"); - nativeStopApp(errorLevel); + // nativeStopApp(errorLevel); } } - private native void nativeStopApp(int errorLevel); + // private native void nativeStopApp(int errorLevel); @SuppressWarnings("unused") @UsedByNative @@ -264,13 +257,13 @@ public void requestSuspend() { } public boolean onSearchRequested() { - if (starboardApplicationReady) { - return nativeOnSearchRequested(); - } + // if (starboardApplicationReady) { + // return nativeOnSearchRequested(); + // } return false; } - private native boolean nativeOnSearchRequested(); + // private native boolean nativeOnSearchRequested(); @SuppressWarnings("unused") @UsedByNative @@ -287,10 +280,11 @@ void raisePlatformError(@PlatformError.ErrorType int errorType, long data) { /** Returns true if the native code is compiled for release (i.e. 'gold' build). */ public static boolean isReleaseBuild() { - return nativeIsReleaseBuild(); + // return nativeIsReleaseBuild(); + return false; } - private static native boolean nativeIsReleaseBuild(); + // private static native boolean nativeIsReleaseBuild(); protected Holder getActivityHolder() { return activityHolder; @@ -320,7 +314,9 @@ public void handleDeepLink(String url) { } } - private native void nativeHandleDeepLink(String url); + private void nativeHandleDeepLink(String url) { + // TODO(b/374147993): Implement deep link + } /** * Returns the absolute path to the directory where application specific files should be written. @@ -583,14 +579,14 @@ void updateMediaSession( String album, MediaImage[] artwork, long duration) { - cobaltMediaSession.updateMediaSession( - playbackState, actions, positionMs, speed, title, artist, album, artwork, duration); + // cobaltMediaSession.updateMediaSession( + // playbackState, actions, positionMs, speed, title, artist, album, artwork, duration); } @SuppressWarnings("unused") @UsedByNative public void deactivateMediaSession() { - cobaltMediaSession.deactivateMediaSession(); + // cobaltMediaSession.deactivateMediaSession(); } /** Returns string for kSbSystemPropertyUserAgentAuxField */ @@ -625,32 +621,34 @@ protected String getUserAgentAuxField() { @SuppressWarnings("unused") @UsedByNative protected String getAdvertisingId() { - return this.advertisingId.getId(); + // return this.advertisingId.getId(); + return ""; } /** Returns boolean for kSbSystemPropertyLimitAdTracking */ @SuppressWarnings("unused") @UsedByNative protected boolean getLimitAdTracking() { - return this.advertisingId.isLimitAdTrackingEnabled(); + // return this.advertisingId.isLimitAdTrackingEnabled(); + return false; } - @SuppressWarnings("unused") - @UsedByNative - AudioOutputManager getAudioOutputManager() { - return audioOutputManager; - } + // @SuppressWarnings("unused") + // @UsedByNative + // AudioOutputManager getAudioOutputManager() { + // return audioOutputManager; + // } /** Returns Java layer implementation for AudioPermissionRequester */ - @SuppressWarnings("unused") - @UsedByNative - AudioPermissionRequester getAudioPermissionRequester() { - return audioPermissionRequester; - } + // @SuppressWarnings("unused") + // @UsedByNative + // AudioPermissionRequester getAudioPermissionRequester() { + // return audioPermissionRequester; + // } - void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { - audioPermissionRequester.onRequestPermissionsResult(requestCode, permissions, grantResults); - } + // void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { + // audioPermissionRequester.onRequestPermissionsResult(requestCode, permissions, grantResults); + // } @SuppressWarnings("unused") @UsedByNative @@ -688,9 +686,9 @@ public int[] getSupportedHdrTypes() { } /** Return the CobaltMediaSession. */ - public CobaltMediaSession cobaltMediaSession() { - return cobaltMediaSession; - } + // public CobaltMediaSession cobaltMediaSession() { + // return cobaltMediaSession; + // } public void registerCobaltService(CobaltService.Factory factory) { cobaltServiceFactories.put(factory.getServiceName(), factory); @@ -740,7 +738,8 @@ protected long getIncorrectAppStartTimestamp() { Activity activity = activityHolder.get(); if (activity instanceof CobaltActivity) { long javaStartTimestamp = ((CobaltActivity) activity).getAppStartTimestamp(); - long cppTimestamp = nativeCurrentMonotonicTime(); + // long cppTimestamp = nativeCurrentMonotonicTime(); + long cppTimestamp = System.nanoTime(); long javaStopTimestamp = System.nanoTime(); return cppTimestamp - (javaStartTimestamp - javaStopTimestamp) / timeNanosecondsPerMicrosecond; @@ -755,7 +754,8 @@ protected long getAppStartTimestamp() { Activity activity = activityHolder.get(); if (activity instanceof CobaltActivity) { long javaStartTimestamp = ((CobaltActivity) activity).getAppStartTimestamp(); - long cppTimestamp = nativeCurrentMonotonicTime(); + // long cppTimestamp = nativeCurrentMonotonicTime(); + long cppTimestamp = System.nanoTime(); long javaStopTimestamp = System.nanoTime(); return cppTimestamp - (javaStopTimestamp - javaStartTimestamp) / timeNanosecondsPerMicrosecond; diff --git a/starboard/android/apk/app/src/main/java/dev/cobalt/coat/VolumeStateReceiver.java b/cobalt/android/apk/app/src/main/java/dev/cobalt/coat/VolumeStateReceiver.java similarity index 100% rename from starboard/android/apk/app/src/main/java/dev/cobalt/coat/VolumeStateReceiver.java rename to cobalt/android/apk/app/src/main/java/dev/cobalt/coat/VolumeStateReceiver.java diff --git a/starboard/android/apk/app/src/main/java/dev/cobalt/libraries/game_activity/README.md b/cobalt/android/apk/app/src/main/java/dev/cobalt/libraries/game_activity/README.md similarity index 100% rename from starboard/android/apk/app/src/main/java/dev/cobalt/libraries/game_activity/README.md rename to cobalt/android/apk/app/src/main/java/dev/cobalt/libraries/game_activity/README.md diff --git a/starboard/android/apk/app/src/main/java/dev/cobalt/libraries/game_activity/games-activity-2.0.2.aar b/cobalt/android/apk/app/src/main/java/dev/cobalt/libraries/game_activity/games-activity-2.0.2.aar similarity index 100% rename from starboard/android/apk/app/src/main/java/dev/cobalt/libraries/game_activity/games-activity-2.0.2.aar rename to cobalt/android/apk/app/src/main/java/dev/cobalt/libraries/game_activity/games-activity-2.0.2.aar diff --git a/starboard/android/apk/app/src/main/java/dev/cobalt/libraries/services/clientloginfo/ClientLogInfo.java b/cobalt/android/apk/app/src/main/java/dev/cobalt/libraries/services/clientloginfo/ClientLogInfo.java similarity index 100% rename from starboard/android/apk/app/src/main/java/dev/cobalt/libraries/services/clientloginfo/ClientLogInfo.java rename to cobalt/android/apk/app/src/main/java/dev/cobalt/libraries/services/clientloginfo/ClientLogInfo.java diff --git a/starboard/android/apk/app/src/main/java/dev/cobalt/libraries/services/clientloginfo/ClientLogInfoModule.java b/cobalt/android/apk/app/src/main/java/dev/cobalt/libraries/services/clientloginfo/ClientLogInfoModule.java similarity index 100% rename from starboard/android/apk/app/src/main/java/dev/cobalt/libraries/services/clientloginfo/ClientLogInfoModule.java rename to cobalt/android/apk/app/src/main/java/dev/cobalt/libraries/services/clientloginfo/ClientLogInfoModule.java diff --git a/starboard/android/apk/app/src/main/java/dev/cobalt/libraries/services/clientloginfo/client_log_info_demo.html b/cobalt/android/apk/app/src/main/java/dev/cobalt/libraries/services/clientloginfo/client_log_info_demo.html similarity index 100% rename from starboard/android/apk/app/src/main/java/dev/cobalt/libraries/services/clientloginfo/client_log_info_demo.html rename to cobalt/android/apk/app/src/main/java/dev/cobalt/libraries/services/clientloginfo/client_log_info_demo.html diff --git a/starboard/android/apk/app/src/main/java/dev/cobalt/media/AudioOutputManager.java b/cobalt/android/apk/app/src/main/java/dev/cobalt/media/AudioOutputManager.java similarity index 100% rename from starboard/android/apk/app/src/main/java/dev/cobalt/media/AudioOutputManager.java rename to cobalt/android/apk/app/src/main/java/dev/cobalt/media/AudioOutputManager.java diff --git a/starboard/android/apk/app/src/main/java/dev/cobalt/media/AudioTrackBridge.java b/cobalt/android/apk/app/src/main/java/dev/cobalt/media/AudioTrackBridge.java similarity index 100% rename from starboard/android/apk/app/src/main/java/dev/cobalt/media/AudioTrackBridge.java rename to cobalt/android/apk/app/src/main/java/dev/cobalt/media/AudioTrackBridge.java diff --git a/starboard/android/apk/app/src/main/java/dev/cobalt/media/Log.java b/cobalt/android/apk/app/src/main/java/dev/cobalt/media/Log.java similarity index 100% rename from starboard/android/apk/app/src/main/java/dev/cobalt/media/Log.java rename to cobalt/android/apk/app/src/main/java/dev/cobalt/media/Log.java diff --git a/starboard/android/apk/app/src/main/java/dev/cobalt/media/MediaCodecBridge.java b/cobalt/android/apk/app/src/main/java/dev/cobalt/media/MediaCodecBridge.java similarity index 100% rename from starboard/android/apk/app/src/main/java/dev/cobalt/media/MediaCodecBridge.java rename to cobalt/android/apk/app/src/main/java/dev/cobalt/media/MediaCodecBridge.java diff --git a/starboard/android/apk/app/src/main/java/dev/cobalt/media/MediaCodecBridgeBuilder.java b/cobalt/android/apk/app/src/main/java/dev/cobalt/media/MediaCodecBridgeBuilder.java similarity index 100% rename from starboard/android/apk/app/src/main/java/dev/cobalt/media/MediaCodecBridgeBuilder.java rename to cobalt/android/apk/app/src/main/java/dev/cobalt/media/MediaCodecBridgeBuilder.java diff --git a/starboard/android/apk/app/src/main/java/dev/cobalt/media/MediaCodecCapabilitiesLogger.java b/cobalt/android/apk/app/src/main/java/dev/cobalt/media/MediaCodecCapabilitiesLogger.java similarity index 100% rename from starboard/android/apk/app/src/main/java/dev/cobalt/media/MediaCodecCapabilitiesLogger.java rename to cobalt/android/apk/app/src/main/java/dev/cobalt/media/MediaCodecCapabilitiesLogger.java diff --git a/starboard/android/apk/app/src/main/java/dev/cobalt/media/MediaCodecStatus.java b/cobalt/android/apk/app/src/main/java/dev/cobalt/media/MediaCodecStatus.java similarity index 100% rename from starboard/android/apk/app/src/main/java/dev/cobalt/media/MediaCodecStatus.java rename to cobalt/android/apk/app/src/main/java/dev/cobalt/media/MediaCodecStatus.java diff --git a/starboard/android/apk/app/src/main/java/dev/cobalt/media/MediaCodecUtil.java b/cobalt/android/apk/app/src/main/java/dev/cobalt/media/MediaCodecUtil.java similarity index 100% rename from starboard/android/apk/app/src/main/java/dev/cobalt/media/MediaCodecUtil.java rename to cobalt/android/apk/app/src/main/java/dev/cobalt/media/MediaCodecUtil.java diff --git a/starboard/android/apk/app/src/main/java/dev/cobalt/media/MediaDrmBridge.java b/cobalt/android/apk/app/src/main/java/dev/cobalt/media/MediaDrmBridge.java similarity index 100% rename from starboard/android/apk/app/src/main/java/dev/cobalt/media/MediaDrmBridge.java rename to cobalt/android/apk/app/src/main/java/dev/cobalt/media/MediaDrmBridge.java diff --git a/starboard/android/apk/app/src/main/java/dev/cobalt/media/MediaFormatBuilder.java b/cobalt/android/apk/app/src/main/java/dev/cobalt/media/MediaFormatBuilder.java similarity index 100% rename from starboard/android/apk/app/src/main/java/dev/cobalt/media/MediaFormatBuilder.java rename to cobalt/android/apk/app/src/main/java/dev/cobalt/media/MediaFormatBuilder.java diff --git a/starboard/android/apk/app/src/main/java/dev/cobalt/media/VideoDecoderCache.java b/cobalt/android/apk/app/src/main/java/dev/cobalt/media/VideoDecoderCache.java similarity index 100% rename from starboard/android/apk/app/src/main/java/dev/cobalt/media/VideoDecoderCache.java rename to cobalt/android/apk/app/src/main/java/dev/cobalt/media/VideoDecoderCache.java diff --git a/starboard/android/apk/app/src/main/java/dev/cobalt/media/VideoFrameReleaseTimeHelper.java b/cobalt/android/apk/app/src/main/java/dev/cobalt/media/VideoFrameReleaseTimeHelper.java similarity index 100% rename from starboard/android/apk/app/src/main/java/dev/cobalt/media/VideoFrameReleaseTimeHelper.java rename to cobalt/android/apk/app/src/main/java/dev/cobalt/media/VideoFrameReleaseTimeHelper.java diff --git a/starboard/android/apk/app/src/main/java/dev/cobalt/media/VideoSurfaceTexture.java b/cobalt/android/apk/app/src/main/java/dev/cobalt/media/VideoSurfaceTexture.java similarity index 100% rename from starboard/android/apk/app/src/main/java/dev/cobalt/media/VideoSurfaceTexture.java rename to cobalt/android/apk/app/src/main/java/dev/cobalt/media/VideoSurfaceTexture.java diff --git a/starboard/android/apk/app/src/main/java/dev/cobalt/media/VideoSurfaceView.java b/cobalt/android/apk/app/src/main/java/dev/cobalt/media/VideoSurfaceView.java similarity index 91% rename from starboard/android/apk/app/src/main/java/dev/cobalt/media/VideoSurfaceView.java rename to cobalt/android/apk/app/src/main/java/dev/cobalt/media/VideoSurfaceView.java index a4ef40ea4b1f..86f038d188b0 100644 --- a/starboard/android/apk/app/src/main/java/dev/cobalt/media/VideoSurfaceView.java +++ b/cobalt/android/apk/app/src/main/java/dev/cobalt/media/VideoSurfaceView.java @@ -42,7 +42,7 @@ public class VideoSurfaceView extends SurfaceView { // Reset video surface on nexus player to avoid b/159073388. if (needResetSurfaceList.contains(Build.MODEL)) { - nativeSetNeedResetSurface(); + // nativeSetNeedResetSurface(); } } @@ -75,9 +75,9 @@ private void initialize(Context context) { // punch-out video when the position / size is animated. } - private static native void nativeOnVideoSurfaceChanged(Surface surface); + // private static native void nativeOnVideoSurfaceChanged(Surface surface); - private static native void nativeSetNeedResetSurface(); + // private static native void nativeSetNeedResetSurface(); private class SurfaceHolderCallback implements SurfaceHolder.Callback { @@ -86,7 +86,7 @@ private class SurfaceHolderCallback implements SurfaceHolder.Callback { @Override public void surfaceCreated(SurfaceHolder holder) { currentSurface = holder.getSurface(); - nativeOnVideoSurfaceChanged(currentSurface); + // nativeOnVideoSurfaceChanged(currentSurface); } @Override @@ -101,7 +101,7 @@ public void surfaceChanged(SurfaceHolder holder, int format, int width, int heig @Override public void surfaceDestroyed(SurfaceHolder holder) { currentSurface = null; - nativeOnVideoSurfaceChanged(currentSurface); + // nativeOnVideoSurfaceChanged(currentSurface); } } diff --git a/starboard/android/apk/app/src/main/java/dev/cobalt/storage/CobaltStorageLoader.java b/cobalt/android/apk/app/src/main/java/dev/cobalt/storage/CobaltStorageLoader.java similarity index 100% rename from starboard/android/apk/app/src/main/java/dev/cobalt/storage/CobaltStorageLoader.java rename to cobalt/android/apk/app/src/main/java/dev/cobalt/storage/CobaltStorageLoader.java diff --git a/starboard/android/apk/app/src/main/java/dev/cobalt/storage/README.md b/cobalt/android/apk/app/src/main/java/dev/cobalt/storage/README.md similarity index 100% rename from starboard/android/apk/app/src/main/java/dev/cobalt/storage/README.md rename to cobalt/android/apk/app/src/main/java/dev/cobalt/storage/README.md diff --git a/starboard/android/apk/app/src/main/java/dev/cobalt/storage/StorageProto.java b/cobalt/android/apk/app/src/main/java/dev/cobalt/storage/StorageProto.java similarity index 100% rename from starboard/android/apk/app/src/main/java/dev/cobalt/storage/StorageProto.java rename to cobalt/android/apk/app/src/main/java/dev/cobalt/storage/StorageProto.java diff --git a/starboard/android/apk/app/src/main/java/dev/cobalt/util/DisplayUtil.java b/cobalt/android/apk/app/src/main/java/dev/cobalt/util/DisplayUtil.java similarity index 96% rename from starboard/android/apk/app/src/main/java/dev/cobalt/util/DisplayUtil.java rename to cobalt/android/apk/app/src/main/java/dev/cobalt/util/DisplayUtil.java index 2c0ad78120cf..094d8a1bea76 100644 --- a/starboard/android/apk/app/src/main/java/dev/cobalt/util/DisplayUtil.java +++ b/cobalt/android/apk/app/src/main/java/dev/cobalt/util/DisplayUtil.java @@ -154,17 +154,17 @@ private static DisplayMetrics getDisplayMetrics() { new DisplayListener() { @Override public void onDisplayAdded(int displayId) { - nativeOnDisplayChanged(); + // nativeOnDisplayChanged(); } @Override public void onDisplayChanged(int displayId) { - nativeOnDisplayChanged(); + // nativeOnDisplayChanged(); } @Override public void onDisplayRemoved(int displayId) { - nativeOnDisplayChanged(); + // nativeOnDisplayChanged(); } }; @@ -181,8 +181,8 @@ public static void addDisplayListener(Context context) { // Call nativeOnDisplayChanged() to reload supported hdr types here after a default // Display created. - nativeOnDisplayChanged(); + // nativeOnDisplayChanged(); } - private static native void nativeOnDisplayChanged(); + // private static native void nativeOnDisplayChanged(); } diff --git a/starboard/android/apk/app/src/main/java/dev/cobalt/util/Holder.java b/cobalt/android/apk/app/src/main/java/dev/cobalt/util/Holder.java similarity index 100% rename from starboard/android/apk/app/src/main/java/dev/cobalt/util/Holder.java rename to cobalt/android/apk/app/src/main/java/dev/cobalt/util/Holder.java diff --git a/starboard/android/apk/app/src/main/java/dev/cobalt/util/IsEmulator.java b/cobalt/android/apk/app/src/main/java/dev/cobalt/util/IsEmulator.java similarity index 100% rename from starboard/android/apk/app/src/main/java/dev/cobalt/util/IsEmulator.java rename to cobalt/android/apk/app/src/main/java/dev/cobalt/util/IsEmulator.java diff --git a/starboard/android/apk/app/src/main/java/dev/cobalt/util/Log.java b/cobalt/android/apk/app/src/main/java/dev/cobalt/util/Log.java similarity index 100% rename from starboard/android/apk/app/src/main/java/dev/cobalt/util/Log.java rename to cobalt/android/apk/app/src/main/java/dev/cobalt/util/Log.java diff --git a/starboard/android/apk/app/src/main/java/dev/cobalt/util/SynchronizedHolder.java b/cobalt/android/apk/app/src/main/java/dev/cobalt/util/SynchronizedHolder.java similarity index 100% rename from starboard/android/apk/app/src/main/java/dev/cobalt/util/SynchronizedHolder.java rename to cobalt/android/apk/app/src/main/java/dev/cobalt/util/SynchronizedHolder.java diff --git a/starboard/android/apk/app/src/main/java/dev/cobalt/util/SystemPropertiesHelper.java b/cobalt/android/apk/app/src/main/java/dev/cobalt/util/SystemPropertiesHelper.java similarity index 100% rename from starboard/android/apk/app/src/main/java/dev/cobalt/util/SystemPropertiesHelper.java rename to cobalt/android/apk/app/src/main/java/dev/cobalt/util/SystemPropertiesHelper.java diff --git a/starboard/android/apk/app/src/main/java/dev/cobalt/util/UsedByNative.java b/cobalt/android/apk/app/src/main/java/dev/cobalt/util/UsedByNative.java similarity index 100% rename from starboard/android/apk/app/src/main/java/dev/cobalt/util/UsedByNative.java rename to cobalt/android/apk/app/src/main/java/dev/cobalt/util/UsedByNative.java diff --git a/starboard/android/apk/app/src/main/res/layout/coat_error_dialog.xml b/cobalt/android/apk/app/src/main/res/layout/coat_error_dialog.xml similarity index 93% rename from starboard/android/apk/app/src/main/res/layout/coat_error_dialog.xml rename to cobalt/android/apk/app/src/main/res/layout/coat_error_dialog.xml index c3f639060d84..e3cd1a172fe7 100644 --- a/starboard/android/apk/app/src/main/res/layout/coat_error_dialog.xml +++ b/cobalt/android/apk/app/src/main/res/layout/coat_error_dialog.xml @@ -36,15 +36,15 @@ + android:maxWidth="50dp" + />