aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/github/daneren2005/dsub/util
diff options
context:
space:
mode:
authorGlenn Guy <glennguy83@gmail.com>2018-10-11 23:38:40 +1100
committerGlenn Guy <glennguy83@gmail.com>2018-10-11 23:38:40 +1100
commit73f5e04e0ddd23a8477ee0c9c4b3364817addede (patch)
tree81a2a5cb0a4b5668c20bec9c4efee3efa2b5747c /app/src/main/java/github/daneren2005/dsub/util
parent90f6cd02b7968bd3f10d3a4ddd6f2a32cce3ca46 (diff)
downloaddsub-73f5e04e0ddd23a8477ee0c9c4b3364817addede.tar.gz
dsub-73f5e04e0ddd23a8477ee0c9c4b3364817addede.tar.bz2
dsub-73f5e04e0ddd23a8477ee0c9c4b3364817addede.zip
Remove registerMediaButtonEventReceiver for API >= 21
Finally figured out that this was causing an extra controller to be registered with the AVRCP module. With DSub as the only media app running the log would show `V/NewAvrcpMediaPlayerList: onActiveSessionsChanged: number of controllers: 0` on entry into the app and would increase to 2 shortly after. On Android Pie this causes problems as the new AVRCP module's logic is causing the metadata to be sent through to the wrong controller. I'm not sure if you think I've gone about it in the correct way but I've removed the setting for media buttons as well for Lollipop onwards, considering that this setting has no effect anyway on >= 21.
Diffstat (limited to 'app/src/main/java/github/daneren2005/dsub/util')
-rw-r--r--app/src/main/java/github/daneren2005/dsub/util/Util.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/util/Util.java b/app/src/main/java/github/daneren2005/dsub/util/Util.java
index 5699cdf9..a02e7ded 100644
--- a/app/src/main/java/github/daneren2005/dsub/util/Util.java
+++ b/app/src/main/java/github/daneren2005/dsub/util/Util.java
@@ -1294,11 +1294,11 @@ public final class Util {
public static void registerMediaButtonEventReceiver(Context context) {
- // Only do it if enabled in the settings.
+ // Only do it if enabled in the settings and api < 21
SharedPreferences prefs = getPreferences(context);
boolean enabled = prefs.getBoolean(Constants.PREFERENCES_KEY_MEDIA_BUTTONS, true);
- if (enabled) {
+ if (enabled && Build.VERSION.SDK_INT < 21) {
// AudioManager.registerMediaButtonEventReceiver() was introduced in Android 2.2.
// Use reflection to maintain compatibility with 1.5.