-
-
Notifications
You must be signed in to change notification settings - Fork 249
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
Fixed crashes with AudioFocusRequestManager on Android 7.1 #4341
Conversation
Signed-off-by: rapterjet2004 <[email protected]>
Unfortunately, this does not fix the issue, and it seems to me that on versions before android O, the audio focus request got removed. On my fork, I created a commit that fixes this issue, but didn't have the time to submit a pr. https://github.com/MmAaXx500/talk-android/tree/api25-audiofocus |
Signed-off-by: rapterjet2004 <[email protected]>
APK file: https://www.kaminsky.me/nc-dev/android-artifacts/4341-talk.apk |
Now there is no crashing, If you have no specific reason to remove the Edit2: now it's working, there was an error on my side. My question about removal of |
@MmAaXx500 - thank you for testing and mentioning that there is no crash. I could not test this PR because I don't have a device that runs on android 7.1 or below. I referred android documentation, https://developer.android.com/media/optimize/audio-focus#audio-focus-7-1, I see that it's okay to use requestFocus() and abandonFocus(). What is the error that you are getting? One more suggestion always use safe call with let '?.let' whenever possible instead of '!!' to avoid unnecessary crashes. Instead of audioManager.requestAudioFocus(focusRequest!!) we can use focusRequest?.let { request -> |
Sorry all, I should have looked directly when the issue came up. For 7.0 it is 0,3% We have the rule to ditch android version lower than 0,5%. So instead to introduce more logic here, we should create a PR that removes support for these versions and bump the minSdkVersion to 26 (Android 8.0) which currently has an install base of 0,7%. Sorry if this is disappointing if you're a user with android version lower than 8, but we are not able to support endless scenarios with the cost of complexity. |
#4338 (comment)
🏁 Checklist
/backport to stable-xx.x