summaryrefslogtreecommitdiffstats
path: root/android/src
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2011-06-04 19:17:51 +0000
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2011-06-04 19:17:51 +0000
commitd25a61f01c21978d0c9e229fd72852e99da1414a (patch)
treea3334620eae5b1818d0afea69e686ddc0a610905 /android/src
parent6c22be4a3db4ad72acf67f99059872e92d1931b4 (diff)
downloadrockbox-d25a61f01c21978d0c9e229fd72852e99da1414a.tar.gz
rockbox-d25a61f01c21978d0c9e229fd72852e99da1414a.tar.bz2
rockbox-d25a61f01c21978d0c9e229fd72852e99da1414a.zip
Android: listen to ACTION_AUDIO_BECOMING_NOISY for headphone (FS#12097).
This event is sent before the audio is routed back to the speaker so we get the information about the unplugged headphone notably earlier. Decrease the debouncing of the headphone status from 1s to 0.5s to work around audio still getting played back via the speaker due to the pause delay by debouncing. On Android we shouldn't need the debouncing at all. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29957 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'android/src')
-rw-r--r--android/src/org/rockbox/RockboxService.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/android/src/org/rockbox/RockboxService.java b/android/src/org/rockbox/RockboxService.java
index 71b133edc8..3182b73b1c 100644
--- a/android/src/org/rockbox/RockboxService.java
+++ b/android/src/org/rockbox/RockboxService.java
@@ -67,11 +67,13 @@ public class RockboxService extends Service
private IntentFilter ifh;
private BroadcastReceiver batt_monitor;
private BroadcastReceiver headphone_monitor;
+ private BroadcastReceiver noisy_monitor;
private RunForegroundManager fg_runner;
private MediaButtonReceiver mMediaButtonReceiver;
private int battery_level;
private int headphone_state;
private ResultReceiver resultReceiver;
+ private RockboxService rbservice;
public static final int RESULT_INVOKING_MAIN = 0;
public static final int RESULT_LIB_LOAD_PROGRESS = 1;
@@ -357,6 +359,20 @@ public class RockboxService extends Service
}
};
registerReceiver(headphone_monitor, ifh);
+ noisy_monitor = new BroadcastReceiver()
+ {
+ @Override
+ public void onReceive(Context context, Intent intent)
+ {
+ LOG("audio becoming noisy");
+ headphone_state = 0;
+ }
+ };
+ rbservice = RockboxService.get_instance();
+ /* We're relying on internal API's here,
+ this can break in the future! */
+ rbservice.registerReceiver(noisy_monitor,
+ new IntentFilter("android.media.AUDIO_BECOMING_NOISY"));
}