We're all happy to see Android 4.3 finally make its appearance, especially as it brings some pretty important and positive low-level improvements like Bluetooth Low Energy and TRIM support. Unfortunately, new versions often introduce new bugs that slip by even the most diligent testers. Jelly Bean 4.2 had its fair share of issues, including an almost comically bad oversight: the total annihilation of December in the stock Contacts app. This is why each major release is often followed by a couple of bug fix OTAs in the following weeks. We're going to start a running series to examine some of the bigger and more user-facing issues.
We're kicking things off with an obnoxious bug in ClipboardManager, a nicely segregated little service with the sole responsibility of holding on to the bits of information users copy from one place and eventually paste into another. Don't worry, the bug isn't affecting any of the core functionality, so copy/paste will keep working as normal. However, things go wrong once you have an app installed that requests to be notified of changes to the clipboard through a call to addPrimaryClipChangedListener. The sneaky part about this bug is that nothing bad happens when the call is made, and nothing bad even happens to the app that made the call - rather, when something is copied in a completely different app, it is that app that crashes.
If, for some reason, you would like to reproduce the bug on your own device (running Android 4.3), you can do so by following these steps:
- Install and run our sample application here (I built it, so I know it's safe). Edit: Here's the source code.
- Start any app that has a text field or anything else with text to copy (messenger apps, browsers, calculators).
- Copy some text and watch that app crash.
Just reboot your device to get the clipboard back to normal.
There aren't very many apps with a need to monitor the clipboard, so you may not have stumbled onto this yourself. Still, you will probably find this behavior in clipboard managers (they keep a history of your copied text), language translators, dictionaries, and a handful of others. If you've suffered at the hands of this bug due to one of your favorite apps, resist the urge to leave negative feedback in the Play Store. The developers aren't at fault for this issue and many might not even know about it yet.
The good news: this bug has already been tracked down and fixed by Dianne Hackborn, one of our favorite lead engineers on the Android team. The patch hasn't gone public yet, so we'll be waiting a bit longer, but it will probably roll out soon.