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

Application crash #562

Closed
xigxmmbc opened this issue Jun 26, 2024 · 2 comments
Closed

Application crash #562

xigxmmbc opened this issue Jun 26, 2024 · 2 comments
Assignees
Labels
bug/limitation elsewhere Bug/limitation in the ROM or another project

Comments

@xigxmmbc
Copy link

xigxmmbc commented Jun 26, 2024

What's going on and how to solve it?

Generated by AppErrorsTracking 1.3(6)
Project URL: https://github.com/KitsunePie/AppErrorsTracking

[Device Model]: MI 9 SE
[Display]: PKQ1.181121.001
[Android Version]: 9
[Android API Level]: 28
[System Locale]: zh_CN
[Process ID]: 6499
[User ID]: 0
[CPU ABI]: none
[Package Name]: com.chiller3.bcr
[Version Name]: 1.65
[Version Code]: 82176
[Target SDK]: 34
[Min SDK]: 28
[Error Type]: JVM
[Crash Time]: 2024-06-26T10:35:37.035
[Stack Trace]:
java.lang.ExceptionInInitializerError
at com.chiller3.bcr.settings.SettingsFragment.refreshOutputFormat(Unknown Source:0)
at com.chiller3.bcr.settings.SettingsFragment.onCreatePreferences(Unknown Source:108)
at androidx.preference.PreferenceFragmentCompat.onCreate(Unknown Source:67)
at androidx.fragment.app.FragmentStateManager.create(Unknown Source:70)
at androidx.fragment.app.FragmentStateManager.moveToExpectedState(Unknown Source:151)
at androidx.fragment.app.FragmentManagerImpl.executeOpsTogether(Unknown Source:1156)
at androidx.fragment.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(Unknown Source:81)
at androidx.fragment.app.FragmentManagerImpl.execPendingActions(Unknown Source:77)
at androidx.fragment.app.FragmentManagerImpl.dispatchStateChange(Unknown Source:66)
at androidx.appcompat.app.AppCompatActivity.onStart$androidx$fragment$app$FragmentActivity(Unknown Source:33)
at androidx.appcompat.app.AppCompatActivity.onStart(Unknown Source:0)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1392)
at android.app.Activity.performStart(Activity.java:7252)
at android.app.ActivityThread.handleStartActivity(ActivityThread.java:2971)
at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:180)
at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:165)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:142)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1832)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:201)
at android.app.ActivityThread.main(ActivityThread.java:6826)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
Caused by: java.lang.NullPointerException: Attempt to get length of null array
at android.media.MediaCodecInfo$AudioCapabilities.getSupportedSampleRates(MediaCodecInfo.java:973)
at androidx.tracing.Trace.fromCodec-Qn1smSk(Unknown Source:55)
at com.chiller3.bcr.format.FlacFormat.(Unknown Source:31)
at com.chiller3.bcr.format.Format$Companion$all$2$3.invoke(Unknown Source:2)
at com.chiller3.bcr.format.Format$Companion$all$2.invoke(Unknown Source:50)
at kotlin.SynchronizedLazyImpl.getValue(Unknown Source:20)
at com.chiller3.bcr.format.Format.(Unknown Source:8)
... 25 more

@xigxmmbc
Copy link
Author

xigxmmbc commented Jun 26, 2024

After making the following modifications, I can now open it
// val rates = audioCapabilities.supportedSampleRates
// if (rates != null && rates.isNotEmpty()) {

// val ratesUnsigned = rates.toUIntArray()
// val default = DiscreteSampleRateInfo.toNearest(ratesUnsigned, tryDefault)!!
//
// return DiscreteSampleRateInfo(ratesUnsigned, default)

@SuppressLint("SoonBlockedPrivateApi")
val SAMPLE_RATE_HZ_MIN_COMPAT: Int = 4000

@SuppressLint("SoonBlockedPrivateApi")
val SAMPLE_RATE_HZ_MAX_COMPAT: Int = 48000

Where are the codes to start and end recording? I want to use it to record WeChat calls. Is this feasible?

@chenxiaolong chenxiaolong self-assigned this Jun 26, 2024
@chenxiaolong chenxiaolong added the bug/limitation elsewhere Bug/limitation in the ROM or another project label Jun 26, 2024
@chenxiaolong
Copy link
Owner

Caused by: java.lang.NullPointerException: Attempt to get length of null array
at android.media.MediaCodecInfo$AudioCapabilities.getSupportedSampleRates(MediaCodecInfo.java:973)

That's unfortunate. Seems like a bug in MIUI if it's crashing within the Android framework.

Where are the codes to start and end recording? I want to use it to record WeChat calls. Is this feasible?

The recording process for a single call is handled by RecorderThread. When the thread starts, the recording starts. When the thread is cancelled, the recording stops.

The thread is created from RecorderInCallService. It registers a callback with Android's telephony framework so that it is notified when the call state changes (onCallAdded()/onCallRemoved()/onStateChanged()/onDetailsChanged()).

If you want to modify the code to record third party apps, it'll likely take a significant amount of work. At the very least, RecorderInCallService would have to be replaced with custom call detection logic because Android doesn't really have an API to detect VOIP calls in third party apps. I'm guessing you'd probably need to use the accessibility API to determine when WeChat's calls begin and end.

RecorderThread would probably also need to be updated to point to whichever audio stream WeChat uses (phone calls use MediaRecorder.AudioSource.VOICE_CALL, but third party VOIP calls likely use something different).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/limitation elsewhere Bug/limitation in the ROM or another project
Projects
None yet
Development

No branches or pull requests

2 participants