kaputnikGo / PilferShushJammer

Light Android AOSP application to test microphone jamming techniques to combat Cross-Device Tracking (XDT)
216 stars 25 forks source link

Detect microphone blockers. Turn on passive jammer if it is detected. #18

Closed davidhedlund closed 4 years ago

davidhedlund commented 4 years ago

Please read this first: Microphone blockers

Suggestion

Run PilferShushJammer as a background service that detects if a physical microphone blocker is connected:

kaputnikGo commented 4 years ago

Interesting idea. However, I'm not keen on giving the Passive Jammer the ability to record any audio to file at all.

Currently the jammer works by creating a valid AudioRecord object that has its audio input source set to DEFAULT. The physical microphone that DEFAULT points to is determined by the OS. Tests on a device running LineageOS AOSP shows that the moment a headset is plugged in the DEFAULT input source is internally switched to the headset mic, as is expected. Tests also show that the jammer will block which ever input is routed at the time of starting the passive jamming.

And this is a problem because hotplugging a headset in or out after the passive jammer is running will currently not auto switch the hardware buffer and therefore not block that new input source. A manual Passive restart is required.

An AudioManager method was used in earlier versions of the jammer app but the method(s) have been deprecated and proved unreliable across the 1700 device types currently listed as being supported on Google Play. Quote the Android API docs: "This is not a valid indication that audio playback is actually over the wired headset as audio routing depends on other conditions."

Presently the minimum API for this app is 18 and the newer methods are targeting API 21+ but the better class is only in 23+ (AudioDeviceInfo) which will return an int for what seems like every audio device type (including USB).

I will be looking into this including the min API bump.

kaputnikGo commented 4 years ago

included a headphone listener to restart jammer if audio routing changed.

davidhedlund commented 4 years ago

included a headphone listener to restart jammer if audio routing changed.

Thanks a lot! Can you please add the commit here?

kaputnikGo commented 4 years ago

5 march added headset receiver. warning i have had mixed results with this API... https://github.com/kaputnikGo/PilferShushJammer/commit/90038f1871557830e85ce41ce953f0c60cf39ccc#diff-c91bf661cf17875bfb846d2f278414f9