porkcharsui/supersonic — pull request #8 by DBendit (2012-02-17 04:45:25+00:00)
Title: Add Audio Focus functionality to Android app

Summary of changes:

- Audio focus is now respected

When other apps grab Audio Focus (e.g. Phone.apk receives a call), playback pauses. When the interrupting app releases Audio Focus, playback resumes. Apps that support ducking (e.g. Navigation) lower volume to 10% while they have focus, then restore volume to 100% when they're done. See for details.

- Minimum Android version increased

One of the downsides of using Audio Focus is that the minimum supporting version of Android is 2.2 (SDK version 8). According to , this excludes roughly 9.2% of Android users. However, this is the only way to support audio ducking in ICS. As such, I think this is an acceptable concession to make. (For the record, I have an ICS phone and no pre-2.2 phones, so I'm biased)

- Event listener cleanup

Now that we're raising the minimum platform version, we can stop using reflection to access Audio Manager functionality. On top of that, Audio Focus has supplanted listening to phone events as the appropriate way to handle calls. This means that we no longer need to listen for calls to start and stop, and can also remove a permission from the app.