[英]Can I intercept audio on a rooted Android?
I understand it is not possible to redirect the audio output from a pre-existing Android app - say Spotify - to a USB sound card or a file for instance. 我了解无法将音频输出从先前存在的Android应用程序(例如Spotify)重定向到USB声卡或文件。 I believe this may have had something to do with privacy and recording telephone calls. 我相信这可能与隐私和录制电话有关。
I do not understand Linux very well but know that it is very flexible and often read about piping the output of one program to the input of another. 我不太了解Linux,但知道它非常灵活,经常阅读有关将一个程序的输出管道到另一个程序的输入的知识。 I also see that in the dev directory of some Androids some “files” with names like “audio”. 我还看到在某些Android的dev目录中,一些“文件”的名称类似于“音频”。
My question is - do any of these correspond to the raw audio output and if the tablet/phone was rooted could the stream be intercepted with some Linux magic? 我的问题是-这些信号是否与原始音频输出相对应,如果平板电脑/手机扎根,则可以使用Linux魔术来拦截流吗?
My motivation is to provide a higher quality audio output than the basic speaker / headphone / bluetooth options. 我的动机是提供比基本扬声器/耳机/蓝牙选项更高质量的音频输出。
Short answer is yes, you might be able to hack something together. 简短的答案是肯定的,您也许可以一起破解某些东西。 But the audio implementation on a particular handset is completely up to the manufacturer so there is no guarantee. 但是特定手机上的音频实现完全取决于制造商,因此无法保证。 It is unlikely to be as simple as you think. 它不可能像您想的那么简单。 There is no one-line command line magic for it. 没有它的单行命令行魔术。
Android doesn't use the usual Linux ALSA user space code so you can not generalize from Linux and say "if I can do it in Linux I can do it on rooted Android". Android不使用常规的Linux ALSA用户空间代码,因此您不能从Linux泛化,而是说“如果可以在Linux中进行操作,则可以在有根的Android上进行操作”。
I think that some Android implementations use TinyALSA but this is not a requirement. 我认为某些Android实现使用TinyALSA,但这不是必需的。 If this is the case you might be able to recompile TinyALSA with your own intercept logic or interpose your device some other way. 如果是这种情况,您也许可以使用自己的拦截逻辑重新编译TinyALSA或以其他方式插入设备。 Similarly if you are running an Android mod built from source you could modify it to intercept the audio at other levels such as in the Audio Flinger or at the interface to the HAL. 同样,如果您运行的是从源代码构建的Android mod,则可以对其进行修改以拦截其他级别的音频,例如Audio Flinger或HAL的接口。 This is less practical if you are just using a rooted device since manufacturers often modify system elements with customization that might make it difficult for you to interpose and intercept (just because you don't know what to substitute if the API has been modified). 如果您仅使用带根目录的设备,则此方法不太实用,因为制造商经常使用自定义功能修改系统元素,这可能使您难以进行插入和拦截(只是因为如果API被修改,您不知道要用什么替代)。
Much of the info in this answer I gleaned from reading the Andraudio mailing list . 我从阅读Andraudio邮件列表中收集了此答案中的许多信息。 You can check the archives to learn more. 您可以查看档案以了解更多信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.