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..4819e94b3375 100644 --- a/cobalt/BUILD.gn +++ b/cobalt/BUILD.gn @@ -19,6 +19,9 @@ group("gn_all") { deps = [ "//starboard($starboard_toolchain)" ] if (!is_android) { deps += [ ":cobalt" ] + } else { + # TODO(cobalt): reuse build rules below to define Android target. + deps += [ "android:cobalt_apk" ] } } diff --git a/cobalt/android/BUILD.gn b/cobalt/android/BUILD.gn new file mode 100644 index 000000000000..16515c1b20cc --- /dev/null +++ b/cobalt/android/BUILD.gn @@ -0,0 +1,156 @@ +import("//build/config/android/config.gni") +import("//build/config/android/rules.gni") +import("//third_party/icu/config.gni") + +cobalt_manifest = "$target_gen_dir/cobalt_manifest/AndroidManifest.xml" + +# TODO(cobalt, b/375655377): remove testonly tag +android_resources("cobalt_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_manifest") { + testonly = true + input = "apk/app/src/app/AndroidManifest.xml.jinja2" + output = cobalt_manifest + variables = [ "manifest_package=dev.cobalt.coat" ] +} + +# TODO(cobalt): Re-enable or remove disabled java files. +android_library("cobalt_apk_java") { + testonly = true + resources_package = "dev.cobalt.coat" + deps = [ + ":cobalt_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_apk_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", + ] + 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_apk") { + target_type = "android_apk" + apk_name = "Cobalt" + android_manifest = cobalt_manifest + android_manifest_dep = ":cobalt_manifest" + deps = [ + ":cobalt_apk_assets", + ":cobalt_apk_java", + ] + 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..1a741a7f96c2 --- /dev/null +++ b/cobalt/android/apk/app/src/app/AndroidManifest.xml.jinja2 @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {% 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 100% 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 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/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..60467c157d9a 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 @@ -16,7 +16,6 @@ import static dev.cobalt.util.Log.TAG; -import android.annotation.SuppressLint; import android.content.Intent; import android.content.pm.ActivityInfo; import android.content.pm.PackageManager; @@ -29,9 +28,6 @@ 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.MediaCodecCapabilitiesLogger; import dev.cobalt.media.VideoSurfaceView; import dev.cobalt.util.DisplayUtil; @@ -42,9 +38,11 @@ import java.util.List; import java.util.Locale; import java.util.regex.Pattern; +import org.chromium.content_shell_apk.ContentShellActivity; +// import dev.cobalt.media.AudioOutputManager; /** 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 +66,17 @@ 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(); + //TODO(b/375442742): re-enable native code. + // private static native void nativeLowMemoryEvent(); - protected View mContentView = null; + // TODO(cobalt): make WebContent accessible in CobaltActivity or StarboardBridge. + // 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,8 @@ protected StarboardBridge getStarboardBridge() { @Override protected void onStart() { if (!isReleaseBuild()) { - getStarboardBridge().getAudioOutputManager().dumpAllOutputDevices(); + // TODO(cobalt): re-enable Cobalt AudioOutputManager. + // getStarboardBridge().getAudioOutputManager().dumpAllOutputDevices(); MediaCodecCapabilitiesLogger.dumpAllDecoders(); } if (forceCreateNewVideoSurfaceView) { @@ -151,7 +132,7 @@ protected void onStart() { DisplayUtil.cacheDefaultDisplay(this); DisplayUtil.addDisplayListener(this); - AudioOutputManager.addAudioDeviceListener(this); + // AudioOutputManager.addAudioDeviceListener(this); getStarboardBridge().onActivityStart(this); super.onStart(); @@ -331,7 +312,6 @@ protected boolean isReleaseBuild() { return StarboardBridge.isReleaseBuild(); } - @CallSuper @Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); @@ -346,12 +326,13 @@ 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); - } + // TODO(cobalt): re-eanble microphone permission request at startup or remove code. + // @SuppressLint("MissingSuperCall") + // @Override + // public void onRequestPermissionsResult( + // int requestCode, String[] permissions, int[] grantResults) { + // getStarboardBridge().onRequestPermissionsResult(requestCode, permissions, grantResults); + // } public void resetVideoSurface() { runOnUiThread( @@ -402,7 +383,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 +395,8 @@ private void createNewSurfaceView() { @Override public void onLowMemory() { super.onLowMemory(); - nativeLowMemoryEvent(); + // TODO(cobalt): re-enable native low memory event or remove code if unnecessary. + // 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 88% 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..32da61860e26 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,6 @@ import android.view.accessibility.AccessibilityManager; import android.view.accessibility.CaptioningManager; import androidx.annotation.Nullable; -import dev.cobalt.media.AudioOutputManager; import dev.cobalt.util.DisplayUtil; import dev.cobalt.util.Holder; import dev.cobalt.util.Log; @@ -52,6 +51,7 @@ import java.util.HashMap; import java.util.Locale; import java.util.TimeZone; +// import dev.cobalt.media.AudioOutputManager; /** Implementation of the required JNI methods called by the Starboard C++ code. */ public class StarboardBridge { @@ -65,25 +65,17 @@ public interface HostApplication { private CobaltSystemConfigChangeReceiver sysConfigChangeReceiver; private CobaltTextToSpeechHelper ttsHelper; - private AudioOutputManager audioOutputManager; - private CobaltMediaSession cobaltMediaSession; - private AudioPermissionRequester audioPermissionRequester; + // TODO(cobalt): Re-enable these classes or remove if unnecessary. + // private AudioOutputManager audioOutputManager; + // private CobaltMediaSession cobaltMediaSession; + // private AudioPermissionRequester audioPermissionRequester; private NetworkStatus networkStatus; private ResourceOverlay resourceOverlay; - private AdvertisingId advertisingId; + // TODO(cobalt): Re-enable 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 +89,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<>(); @@ -119,9 +111,10 @@ public StarboardBridge( String[] args, String startDeepLink) { + // TODO(cobalt): re-enable native initialization steps or remove. // 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 +123,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): re-enable monotonic time from native side. + return 0; + } protected void onActivityStart(Activity activity) { activityHolder.set(activity); @@ -183,12 +179,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 +195,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 +243,12 @@ protected void starboardApplicationStopping() { public void requestStop(int errorLevel) { if (starboardApplicationReady) { Log.i(TAG, "Request to stop"); - nativeStopApp(errorLevel); + // TODO(cobalt): re-enable native stop signal if needed. + // nativeStopApp(errorLevel); } } - private native void nativeStopApp(int errorLevel); + // private native void nativeStopApp(int errorLevel); @SuppressWarnings("unused") @UsedByNative @@ -264,13 +261,14 @@ public void requestSuspend() { } public boolean onSearchRequested() { - if (starboardApplicationReady) { - return nativeOnSearchRequested(); - } + // TODO(cobalt): re-enable native search request if needed. + // if (starboardApplicationReady) { + // return nativeOnSearchRequested(); + // } return false; } - private native boolean nativeOnSearchRequested(); + // private native boolean nativeOnSearchRequested(); @SuppressWarnings("unused") @UsedByNative @@ -287,10 +285,12 @@ 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(); + // TODO(cobalt): find a way to determine if is release build. + // return nativeIsReleaseBuild(); + return false; } - private static native boolean nativeIsReleaseBuild(); + // private static native boolean nativeIsReleaseBuild(); protected Holder getActivityHolder() { return activityHolder; @@ -320,7 +320,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 +585,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 +627,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 +692,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 +744,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 +760,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" + />