[core][Android] Add SharedRefs (#24446)# Why A follow up to the: https://github.com/expo/expo/pull/22583 # How Implementing SharedRefs class on Android. # Test Plan - unit tests ✅
[core][Android] Add test for view function first arguments (#24224)# Why Add a test that checks if view functions can accept the first parameter. # Test Plan - bare-expo ✅
[core][Android] Refactor dynamic properties to work well with shared objects (#24206)# Why A follow-up to the https://github.com/expo/expo/pull/20608. Allows shared objects to be passed as a fi
[core][Android] Refactor dynamic properties to work well with shared objects (#24206)# Why A follow-up to the https://github.com/expo/expo/pull/20608. Allows shared objects to be passed as a first argument of the dynamic properties. # Test Plan - tests ✅
show more ...
[core] Move `defineProperty` and `ObjectDeallocator` to common code (#23860)# Why Moves `defineProperty` and `ObjectDeallocator` to common code. # Test Plan - bare-expo ✅ - native-tester
[core] Move `defineProperty` and `ObjectDeallocator` to common code (#23860)# Why Moves `defineProperty` and `ObjectDeallocator` to common code. # Test Plan - bare-expo ✅ - native-tester ✅
[core][Android] Add `CoreModule` defining the `global.expo` object (#23654)# Why This a follow-up to the https://github.com/expo/expo/pull/22567. Closes ENG-8810. # How We want the `globa
[core][Android] Add `CoreModule` defining the `global.expo` object (#23654)# Why This a follow-up to the https://github.com/expo/expo/pull/22567. Closes ENG-8810. # How We want the `global.expo` object to be automatically built and decorated. The best and easiest approach is to introduce the `CoreModule` that will live outside the module registry but will be used to build the object for `global.expo`. # Test Plan - automatic tests ✅ - bare-expo ✅
[core][Android] Improve error handling when working with promises (#23571)# Why Improves error handling when working with promises. # How Previously when a promise was resolved twice, we i
[core][Android] Improve error handling when working with promises (#23571)# Why Improves error handling when working with promises. # How Previously when a promise was resolved twice, we ignored that. However, that leads to undefined behaviors and bugs in the user code. So I've decided to report that as an exception. That information will be piped to the js console in the development, but the app will crash in production. # Test Plan - bare-expo with simple module ✅
[core][Android] Bind `JNIDeallocator` to the context (#22610)# Why Binds the `JNIDeallocator` to the current context. # How I've discovered that making `JNIDeallocator` static wasn't a go
[core][Android] Bind `JNIDeallocator` to the context (#22610)# Why Binds the `JNIDeallocator` to the current context. # How I've discovered that making `JNIDeallocator` static wasn't a good decision. This approach failed to function properly when we migrated to our API in the dev-launcher context. Whenever the user switches between the app and launcher, the app will crash since the dev-launcher remains in memory, but the app context's destruction causes all registered objects inside the `JNIDeallocator` to deallocate. Consequently, we're removing js objects associated with the dev-launcher context, even if it's still valid. # Test Plan - bare-expo with and without dev-client ✅ - unit tests ✅
[expo-modules] Fix failing instrumentation test (#22518)
[Android][core] Class constructors should be able to receive `this` (#22295)# Why The class constructor should be able to receive the js object as `this` even if isn't connected with any shared
[Android][core] Class constructors should be able to receive `this` (#22295)# Why The class constructor should be able to receive the js object as `this` even if isn't connected with any shared object. # Test Plan - workshop project ✅ - unit test ✅
[Android][core] Fixed argument trailing not working correctly when all parameters are optional (#22293)# Why Makes sure that trailing optional arguments works well when parameters are optional.
[Android][core] Fixed argument trailing not working correctly when all parameters are optional (#22293)# Why Makes sure that trailing optional arguments works well when parameters are optional. # Test Plan - unit tests ✅
[core] fix androidTest error (#22243)# Why fix android instrumentation test error: expo-modules-core: https://github.com/expo/expo/actions/runs/4770550299/jobs/8481882792 expo-updates: https:/
[core] fix androidTest error (#22243)# Why fix android instrumentation test error: expo-modules-core: https://github.com/expo/expo/actions/runs/4770550299/jobs/8481882792 expo-updates: https://github.com/expo/expo/actions/runs/4785632925/jobs/8509073622 ### expo-modules-core ``` expo.modules.JavaScriptViewModule > should_export_view_prototype[avd-31(AVD) - 12] FAILED io.mockk.MockKException: no answer found for: AppContext(#1).getBackgroundCoroutineScope() at io.mockk.impl.stub.MockKStub.defaultAnswer(MockKStub.kt:93) expo.modules.JavaScriptViewModule > view_functions_should_be_callable[avd-31(AVD) - 12] FAILED io.mockk.MockKException: no answer found for: AppContext(#2).getBackgroundCoroutineScope() at io.mockk.impl.stub.MockKStub.defaultAnswer(MockKStub.kt:93) ``` ### expo-updates 1. crashes from `mockDelegate.getCheckAutomaticallyConfiguration()` 2. https://github.com/expo/expo/blob/79c05375b8ae9149aa4dff456a3c25641a68f360/packages/expo-updates/android/src/androidTest/java/expo/modules/updates/logging/UpdatesLoggingTest.kt#L106 the line here is two rather than one: # How - [core] answers mocked `getBackgroundCoroutineScope` - [updates] my hypothesis is that mockk cannot [instantiate abstract classes](https://github.com/mockk/mockk/issues/1080). after #22137, the `UpdatesConfiguration.CheckAutomaticallyConfiguration` is now an anonymous class. the workaround here is having a default implementation for `UpdatesConfiguration.CheckAutomaticallyConfiguration.toJSString()`. - [updates] fix `@Before` does not be called in `UpdatesLoggingTest`. in the `@Before` block, the test purges log and will make the test more reliable. # Test Plan ci passed
[core][Android] Add functions converter (#21976)# Why Adds functions converter. # How - Adds a frontend and backend converter for js function type - Adds ability to call those functions
[core][Android] Add functions converter (#21976)# Why Adds functions converter. # How - Adds a frontend and backend converter for js function type - Adds ability to call those functions via Kotlin code # Test Plan - unit tests ✅
[core][Android] Improve memory consumption (#21906)# Why Improves memory consumption. Adds a native destructor to the shared object. # How - Adds a native destructor to the shared objec
[core][Android] Improve memory consumption (#21906)# Why Improves memory consumption. Adds a native destructor to the shared object. # How - Adds a native destructor to the shared object instance. - Patched memory leak caused by unreleased global reference inside of the MethodMetadata class. - Adds a global registry to force deallocation of JNI objects that holds references to jsi values when the app is reloaded. - Adds a memory inspector to check which of JNI objects are still present in the memory. # Test Plan - unit tests ✅ - bare-expo with JSC and Hermes ✅
[core][Android] Introduce shared object (#21855)# Why This's a follow-up to https://github.com/expo/expo/pull/17514. # How - Added a shared object registry - Run a native constructor if
[core][Android] Introduce shared object (#21855)# Why This's a follow-up to https://github.com/expo/expo/pull/17514. # How - Added a shared object registry - Run a native constructor if present when creating a js class - Added a shared object with its js representation to the registry - Added a converter for shared object # TODO - [ ] call native destructor when class is deallocated - [ ] use weak refs to hold js objects in the registry # Test Plan - unit tests ✅
[core][Android] Native functions on native component instances (#21809)# Why This's a follow-up to the https://github.com/expo/expo/pull/21746. Closes ENG-6234. # How - Added async functi
[core][Android] Native functions on native component instances (#21809)# Why This's a follow-up to the https://github.com/expo/expo/pull/21746. Closes ENG-6234. # How - Added async functions definition to the `ViewDefinitionBuiler` - Exported information about those functions to js - Exported `ViewPrototype` from the module object # Test Plan - unit tests ✅ - add a function that clears the content of the image to the `expo-image` (will be added in a separate PR)
[core][Android] Add class component (#21799)# Why Adds class component. This's a follow-up to https://github.com/expo/expo/pull/17412. # How Added a class component similar to the one on i
[core][Android] Add class component (#21799)# Why Adds class component. This's a follow-up to https://github.com/expo/expo/pull/17412. # How Added a class component similar to the one on iOS. It's not finished yet - this's just the first part. # To do - Rename `JavaScriptModuleObject` to something more descriptive. That class is no longer used just to declare modules - Call constructor defined in the class component - Pass `this` to sync/async functions. - Add shared objects # Test Plan - unit tests ✅
[core][Android] Make module initialization lazy (#21774)# Why This approach guarantees that module functions and properties are only initialized upon user request. When the module is required by
[core][Android] Make module initialization lazy (#21774)# Why This approach guarantees that module functions and properties are only initialized upon user request. When the module is required by JavaScript, it does not automatically mean that all of its members will be added at that moment. Instead, they will be added at a later time, as needed. # How Added `LazyObject` abstraction as it was done on iOS. Used an arbitrary js object instead of HostObject to define modules - it'll be handy in the future when I'll be adding shared classes. # Test Plan - unit tests ✅ - bare-expo ✅
[core][Android] Fixed `ReadableNativeMap` cannot be cast to the `Record` (#21773)# Why Fixes https://discordapp.com/channels/695411232856997968/1009056414028812299/1086682558881878036. # How
[core][Android] Fixed `ReadableNativeMap` cannot be cast to the `Record` (#21773)# Why Fixes https://discordapp.com/channels/695411232856997968/1009056414028812299/1086682558881878036. # How The RecordTypeConverter and `EitherTypeConverter` were mistakenly marked as trivial. # Test Plan - unit test ✅ - https://github.com/OsamaAburabie/expo-settings
[core][Android] Returning object definitions from sync functions (#20864)# Why This a follow-up to the https://github.com/expo/expo/pull/20623. # How Adds an ability to return objects from
[core][Android] Returning object definitions from sync functions (#20864)# Why This a follow-up to the https://github.com/expo/expo/pull/20623. # How Adds an ability to return objects from the sync functions. I've reused code responsible for handling modules. It's not the cleanest solution, but I plan to refactor that later. # Test Plan - bare-expo with custom code ✅ - test suite ✅ - I've doubled checked if all objects are deallocated ✅
[core][Android] Add convenient getters to the `JavaScriptValue` (#20791)# Why Adds convenient helpers to the `JavaScriptValue` class. Those methods create a shortcut for getting the `Int`, `Floa
[core][Android] Add convenient getters to the `JavaScriptValue` (#20791)# Why Adds convenient helpers to the `JavaScriptValue` class. Those methods create a shortcut for getting the `Int`, `Float`, or `Long` type from the js value. # Test Plan - Unit tests ✅
[core][Android] Add support for the `Long` type as function parameters (#20787)# Why Adds support for a `Long` type as a function parameter or return type. It could be used in the https://gith
[core][Android] Add support for the `Long` type as function parameters (#20787)# Why Adds support for a `Long` type as a function parameter or return type. It could be used in the https://github.com/expo/expo/pull/20784. # How - Added a CPP frontend converter. - Added new Kotlin converter. - Ensured that react-native can understand Long as a return value. # Test Plan - Unit tests ✅
[core][Android] Allow to skip trailing optional arguments (#20756)# Why This a follow-up to the https://github.com/expo/expo/pull/20234. # How - Added requiredArgumentsCount property to fu
[core][Android] Allow to skip trailing optional arguments (#20756)# Why This a follow-up to the https://github.com/expo/expo/pull/20234. # How - Added requiredArgumentsCount property to functions - Throw InvalidArgsNumberException only when the number is less than the required count or greater than the total count - Improved the exception reason to note how many arguments are required - Added new unit test # Test Plan - Unit tests ✅
[core] Fix NativeEventEmitter warning on Android with JSC (#19920)
[modules][Android] Fix `should_throw_if_js_value_cannot_be_passed` (#19726)# Why Fixes: ``` expo.modules.kotlin.jni.JSIAsyncFunctionsTest > should_throw_if_js_value_cannot_be_passed[avd-31(AVD
[modules][Android] Fix `should_throw_if_js_value_cannot_be_passed` (#19726)# Why Fixes: ``` expo.modules.kotlin.jni.JSIAsyncFunctionsTest > should_throw_if_js_value_cannot_be_passed[avd-31(AVD) - 12] FAILED java.lang.Exception: Unexpected exception, expected<expo.modules.kotlin.exception.JavaScriptEvaluateException> but was<expo.modules.kotlin.jni.PromiseException> at org.junit.internal.runners.statements.ExpectException.evaluate(ExpectException.java:30) Tests on avd-31(AVD) - 12 failed: There was 1 failure(s). ``` # How I can confirm that `PromiseException` is the correct exception here. The underlying code is working correctly - the test code wasn't changed correctly after https://github.com/expo/expo/pull/19611. # Test Plan - run unit tests ✅
[packages] Fix expo-modules-core androidTest (#19559)# Why follow up with #19411 to make expo-modules-core androidTest correctly # How those commented test cases break because we try to ca
[packages] Fix expo-modules-core androidTest (#19559)# Why follow up with #19411 to make expo-modules-core androidTest correctly # How those commented test cases break because we try to catch exceptions across shared library boundaries. there are a couple root causes actually: ## incompatible ndk versions before ndk r23, the unwind library is libgcc, and after r23, the implementation is llvm libunwind. these two unwind implementation is incompatible. [email protected] and prebuilt react-native libs are all built from ndk r21. if we run the androidTest on m1 machine, we will use ndk r24 to build libraries. that's why we cannot catch fbjni exceptions in this situation. the pr tries to re-implement fbjni method calls and throw exceptions inline. that would make jni exceptions catchable. other than that, when targeting prebuilt react-native, we should also use the same ndk r21 to build expo-modules-core. even we are on m1 machines. ## jscexecutor missing `_Unwind_Resume` symbol the case happens when ndk r21 + jsc only, and this is also our ci android instrumented test environment. as [the ndk document](https://android.googlesource.com/platform/ndk/+/master/docs/BuildSystemMaintainers.md#unwinding) mentioned, for ndk r21, we should take care linking order. [this react-native fork patch](https://github.com/expo/react-native/commit/3986a385502df3eb207ca05f0b558171a600166c) addressed the issue. if we test jsc on bare-expo, these test cases will still crash. i don't want to fix it or proposing the fix to upstream in the meantime. the latest react-native with AGP 7.3, the side-by-side ndk is already r23. since these are actually error cases, it's just not crash with correct stacktrace (not from expo-modules-core, but jscexecutor) ## c++_static runtime in expo-modules-core androidTest always uses c++_shared runtime: the c++_static runtime doesn't well support the throw exceptions between shared library boundaries. we used c++_static because we want to fix the `et android-native-unit-tests -t instrumented` failures where the `./gradlew :expo-modules-core:connectedAndroidTest :expo-eas-client:connectedAndroidTest` will have duplicated fbjni.so build errors. this pr also reorganizes `et android-native-unit-tests` to build expo-modules-core androidTest exclusively. # Test Plan android instrumented ci passed
123