chenxiaolong / BCR

A Basic Call Recorder for rooted Android devices
GNU General Public License v3.0
1.67k stars 109 forks source link

BCR as LSPosed module #594

Closed Mino260806 closed 2 weeks ago

Mino260806 commented 3 weeks ago

I am always cautious with installing magisk modules because they may bootloop the phone and are very hard to debug.

So I prefer doing it with LSPosed because everything is possible with it.

I don't know if we can make the existing BCR app compatible with LSPosed too, so can you answer these few questions for me :

By hooking a system app like Calling App, we can make use of each privileges without having to make BCR a system app.

If you think it's better we made a seperate apk for BCR LSPosed module, can you still tell me where the call interception occurs exactly and what code parts I can reuse (example encoding and saving audio etc) ?

chenxiaolong commented 3 weeks ago

If you were to rewrite this as an LSPosed module, you'd have to hook into some system app that has the CONTROL_INCALL_EXPERIENCE and CAPTURE_AUDIO_OUTPUT permissions. These are the only things that require system app permissions. Root permissions are not used during runtime.

CONTROL_INCALL_EXPERIENCE is implicitly used by Android to invoke BCR's RecorderInCallService. InCallService is the API that smartwatch apps, Android Auto, etc. detect phone calls, but the permission allows it to work without an associated companion device.

CAPTURE_AUDIO_OUTPUT is used by the normal AudioRecord API to allow access to the VOICE_CALL audio source. This is used in RecorderThread.


If your only goal is to avoid bootloops, I'd recommend just deleting service.sh and post-fs-data.sh hooks from BCR's module. They're used for 2 reasons:

Without those, the only thing left in the module is mounting BCR's /system/priv-app/ and /system/etc/ files, which have an extremely low chance of causing a bootloop.