-
-
Notifications
You must be signed in to change notification settings - Fork 87
Feat/android fgs survive task removal #1234
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
Open
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
66fc040
feat: android slopification
michalsek c23911a
Merge branch 'main' into feat/android-fgs-survive-task-removal
mdydek a42c54b
feat: native recording notification controls independent of js runtime
mdydek f77500c
feat: small improvements
mdydek b3f3fc6
Merge branch 'main' into feat/android-fgs-survive-task-removal
mdydek 3c0c60c
feat: small improvements v2
mdydek 361e933
Merge branch 'main' into feat/android-fgs-survive-task-removal
mdydek 1766019
fix: ci
mdydek 8142679
feat: slight improvements
mdydek a16212c
chore: merge
closetcaiman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 5 additions & 1 deletion
6
packages/react-native-audio-api/android/src/main/cpp/audioapi/android/OnLoad.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,13 @@ | ||
| #include <audioapi/android/AudioAPIModule.h> | ||
| #include <audioapi/android/system/NativeRecorderControl.hpp> | ||
|
|
||
| #include <fbjni/fbjni.h> | ||
|
|
||
| using namespace audioapi; | ||
|
|
||
| JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *) { | ||
| return facebook::jni::initialize(vm, [] { AudioAPIModule::registerNatives(); }); | ||
| return facebook::jni::initialize(vm, [] { | ||
| AudioAPIModule::registerNatives(); | ||
| NativeRecorderControl::registerNatives(); | ||
| }); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...t-native-audio-api/android/src/main/cpp/audioapi/android/system/NativeRecorderControl.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| #include <audioapi/android/system/NativeRecorderControl.hpp> | ||
|
|
||
| #include <audioapi/core/inputs/ActiveRecorderHandle.h> | ||
|
|
||
| namespace audioapi { | ||
|
|
||
| void NativeRecorderControl::registerNatives() { | ||
| javaClassStatic()->registerNatives({ | ||
| makeNativeMethod("stopActiveRecording", NativeRecorderControl::stopActiveRecording), | ||
| makeNativeMethod("pauseActiveRecording", NativeRecorderControl::pauseActiveRecording), | ||
| makeNativeMethod("resumeActiveRecording", NativeRecorderControl::resumeActiveRecording), | ||
| makeNativeMethod("isRecordingActive", NativeRecorderControl::isRecordingActive), | ||
| }); | ||
| } | ||
|
|
||
| jboolean NativeRecorderControl::stopActiveRecording(jni::alias_ref<jni::JClass> /*clazz*/) { | ||
| return static_cast<jboolean>(ActiveRecorderHandle::global().stopActiveRecording()); | ||
| } | ||
|
|
||
| jboolean NativeRecorderControl::pauseActiveRecording(jni::alias_ref<jni::JClass> /*clazz*/) { | ||
| return static_cast<jboolean>(ActiveRecorderHandle::global().pauseActiveRecording()); | ||
| } | ||
|
|
||
| jboolean NativeRecorderControl::resumeActiveRecording(jni::alias_ref<jni::JClass> /*clazz*/) { | ||
| return static_cast<jboolean>(ActiveRecorderHandle::global().resumeActiveRecording()); | ||
| } | ||
|
|
||
| jboolean NativeRecorderControl::isRecordingActive(jni::alias_ref<jni::JClass> /*clazz*/) { | ||
| return static_cast<jboolean>(ActiveRecorderHandle::global().isRecordingOngoing()); | ||
| } | ||
|
|
||
| } // namespace audioapi |
24 changes: 24 additions & 0 deletions
24
...t-native-audio-api/android/src/main/cpp/audioapi/android/system/NativeRecorderControl.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| #pragma once | ||
|
|
||
| #include <fbjni/fbjni.h> | ||
|
|
||
| namespace audioapi { | ||
|
|
||
| using namespace facebook; | ||
|
|
||
| /// @brief JNI statics that let Kotlin reach the active recorder without a React | ||
| /// context or JS runtime, e.g. from the recording-notification stop action after | ||
| /// the app task was removed. Backed by ActiveRecorderHandle. | ||
| class NativeRecorderControl : public jni::JavaClass<NativeRecorderControl> { | ||
| public: | ||
| static auto constexpr kJavaDescriptor = "Lcom/swmansion/audioapi/system/NativeRecorderControl;"; | ||
|
|
||
| static void registerNatives(); | ||
|
|
||
| static jboolean stopActiveRecording(jni::alias_ref<jni::JClass>); | ||
| static jboolean pauseActiveRecording(jni::alias_ref<jni::JClass>); | ||
| static jboolean resumeActiveRecording(jni::alias_ref<jni::JClass>); | ||
| static jboolean isRecordingActive(jni::alias_ref<jni::JClass>); | ||
| }; | ||
|
|
||
| } // namespace audioapi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this
androidspecific? Maybe we could add a badge?