Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create StarboardBridge native class with jni_generator (#4606) #4635

Conversation

niranjanyardi
Copy link
Contributor

b/372559388

This PR configures jni_generator for cobalt_apk_java.
It creates the corresponding native class StarboardBridge for
cobalt/android/apk/app/src/main/java/dev/cobalt/coat/StarboardBridge.java,
adhering to Chromium's JNI standards.
The StarboardBridge native class is implemented as a singleton and is
initialized with the same JNIEnv and jobject used when calling the
Starboard custom JniEnvExt::Initialize function.
Additionally, it updates the JNI function calls in
starboard/android/shared/application_android.cc to align with Chromium's
modern JNI standards.

This PR amends the reverted PR
#4545

There was an issue in the reverted PR that there are old annotations
@UsedByNative embeded in the inner function calls in getResourceOverlay,
somehow making the app not able to launch..
Culprit ->

https://github.com/youtube/cobalt/pull/4545/files#diff-22285847addbd15025f71dadd357129f86573e042655067048f94fae301fb1d3R480.

We can not blindly replace @UsedByNative with @CalledByNative, when
switching to @CalledByNative, we should make sure to replace all
occurrence of @UserByNative inside, and implement the new JNI template
functions. I don't get why compiler didn't complain about the
getResourceOverlay issue tho.

@niranjanyardi niranjanyardi merged commit 8e7db49 into youtube:experimental/build_hermetically Jan 3, 2025
57 checks passed
@niranjanyardi niranjanyardi force-pushed the experimental/build_hermetically branch from db15a8d to 8e7db49 Compare January 3, 2025 00:01
@niranjanyardi niranjanyardi deleted the experimental/build_hermetically branch January 3, 2025 00:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant