I got a wireless charger for my Nexus 5 this Christmas - a Nokia DT-900 to be exact - and was pretty excited. I tend to go to sleep a fair bit later than my wife, which means that I end up fumbling around in the dark trying to plug in my phone so it can charge overnight. She typically wakes up without getting too annoyed (thankfully), but the wireless charger seemed like a perfect solution to me. Now I can simply plop my phone down on the charging plate and not worry about fiddling with the port, and it means that I can leave it plugged in all the time without having to worry as much about the family pets chomping on the live end of a charging cable (our cats, like all cats, are pretty nosy).

So I took my new charger and plugged it in after I opened it for a quick test run, and immediately got hit with some unexpected disappointment: every time I place my phone on the charging plate, it plays a notification to let me know it's started charging. A bit of research showed that this was added in Android 4.2.2 and that there was no in-built way to disable it, meaning that I'd be swapping one annoying late-night noise for another. I looked around the Play Store and XDA but couldn't find anything that helped get rid of the notification. Even renaming the sound file didn't work; the system just picked a different one to play instead.

Defeated, but not willing to give up, I decided to take things into my own hands. I knew I could alter the AOSP code myself and re-compile CyanogenMod so that the notification wouldn't be played, but that wouldn't be an option until after the holidays. In the meantime, I decided to see if this was something that the Xposed Framework could help with, and was quite pleased when I found out that it would fit the bill nicely.

The idea behind Xposed is pretty interesting, really. It inserts itself into the Zygote process during Android's boot, and provides a "bridge" for userland applications to connect to. The result is that you can hook into essentially any package - even system ones - and then use standard Java reflection methods to alter them without needing to modify their source code.

In my case, I found that all I had to do was replace the playWirelessChargingSound() method in the Android framework with a new method which didn't actually play the notification sound. I pulled up the Xposed development tutorial and put together a module that replaced the original method with a simple no-op, and once I installed it the sound was gone. Impressed with how easy it was, I decided to tinker a bit further, and ultimately ended up with a module that allowed me to toggle the sound on or off, as well as adding an optional vibration that could be enabled alongside (or instead of) the notification sound.

Thus was Wireless Charging Xposed born. It's simple, no doubt, but I decided to go ahead and throw it up on the Play Store to see if anyone else would find it useful. I'll likely also be putting the source code up on GitHub, but I have a bit too much going on at the moment, so it will probably be sometime after the holidays. All in all, I was pretty impressed with how easy it was to create an Xposed module. For how versatile the bridge is, the API is really very simple, and I'm already starting to imagine some other tweaks I might like to throw into a module. Maybe this will turn into a new hobby in and of itself.