Skip to content
This repository has been archived by the owner on Aug 7, 2024. It is now read-only.

feat: support for recording internal audio in rooted devices #284

Merged
merged 3 commits into from
Apr 11, 2024
Merged

feat: support for recording internal audio in rooted devices #284

merged 3 commits into from
Apr 11, 2024

Conversation

SuhasDissa
Copy link
Member

@SuhasDissa SuhasDissa commented Apr 7, 2024

closes #281

Demo recording

recordyou.mp4

Guide for Root users

For this to work the app needs the android.permission.CAPTURE_AUDIO_OUTPUT permission. This permission is a privileged permission. so the app needs to be installed as a privileged app.

How to manually grant the permission

  1. Install the app as a normal app
  2. use adb root or any other method to move the app's apk from /data/app/<app folder> to /system/priv-app/RecordYou/RecordYou.apk
  3. create a new file priv-app-permission-recordyou.xml (name doesn't matter) with the following content:
<permissions>
	<privapp-permissions package="com.bnyro.recorder">
		<permission name="android.permission.CAPTURE_AUDIO_OUTPUT" />
	</privapp-permissions>
</permissions>
  1. reboot the phone and use the feature

@SuhasDissa

This comment was marked as outdated.

# Conflicts:
#	app/src/main/AndroidManifest.xml
#	app/src/main/java/com/bnyro/recorder/ui/models/RecorderModel.kt
@rajarshikhatua100

This comment was marked as off-topic.

@SuhasDissa SuhasDissa requested a review from Bnyro April 8, 2024 08:35
@rajarshikhatua100
Copy link

I think it's not working on Samsung oneUI. but the magisk module is working fine

@SuhasDissa
Copy link
Member Author

I think it's not working on Samsung oneUI. but the magisk module is working fine

Debug builds won't work

Copy link
Member

@Bnyro Bnyro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a working rooted device to test this at the moment - but the changes look fine (except for some small nitpicks in the comments).

Though I wonder if we shouldn't show a toast or a note when users want to select that option, that they need root and follow some steps to make it work? Because currently, users would just try it without any setup and think it just doesn't work.

@rajarshikhatua100
Copy link

rajarshikhatua100 commented Apr 10, 2024

yes, maybe a additional checkmark for enabling root features, and additional root options can be added later like show taps, enable demo mode when using screen recording, disable all notification while screen recording, disable flag secure etc.

@SuhasDissa
Copy link
Member Author

I don't have a working rooted device to test this at the moment - but the changes look fine (except for some small nitpicks in the comments).

I don't have a rooted device either. I used the AOSP rom in android emulator with magisk installed.

Though I wonder if we shouldn't show a toast or a note when users want to select that option, that they need root and follow some steps to make it work? Because currently, users would just try it without any setup and think it just doesn't work.

I didn't want to support or endorse the use of magisk modules. but the same time, not block anyone from using it.
So that's why I didn't make the instructions obvious.

Nevertheless, I can create a new repo and put the magisk module there with the instructions, if you're ok with it

@rajarshikhatua100
Copy link

yes open sourcing the magisk module would be the right move

@Bnyro
Copy link
Member

Bnyro commented Apr 10, 2024

Nevertheless, I can create a new repo and put the magisk module there with the instructions, if you're ok with it

That's fine with me 👍

@SuhasDissa SuhasDissa merged commit 6663a6e into you-apps:main Apr 11, 2024
1 check passed
@Robbilie
Copy link

Robbilie commented May 5, 2024

@SuhasDissa I tried the github actions apk and built a local release and signed it with the test key. In both cases the apk was installed in /system/system_ext/priv-app, adb dump of the package shows the permission is granted (even without the permissions xml, i added it later though for completeness). I tried several variations (audio only and screen recorder, wav and no wav, different encodings, some crash the app though) but all files are without any audio. i am using an android emulator (x86_64, automotive, should probably not make any difference though) and I play back sound using spotify and vlc (an mp3 file).

any clues as to what i am doing wrong?

@SuhasDissa
Copy link
Member Author

any clues as to what i am doing wrong?

Did you set the audio source as internal audio?

@Robbilie
Copy link

Robbilie commented May 5, 2024

any clues as to what i am doing wrong?

Did you set the audio source as internal audio?

Yes 😄

Addition:
when i select default and m4a it crashes the app aswell, when i select aac it records (and shows the audio curve while recording). while using internal audio with aac does record, there is no audio curve shown at all…

My current assumption is that this is due to android automotive.

@SuhasDissa SuhasDissa deleted the internal-audio branch May 12, 2024 05:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add support for internal audio (ROOT)
4 participants