diff options
-rw-r--r-- | android/src/org/rockbox/RockboxService.java | 16 | ||||
-rw-r--r-- | firmware/drivers/button.c | 2 |
2 files changed, 17 insertions, 1 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 | |||
67 | private IntentFilter ifh; | 67 | private IntentFilter ifh; |
68 | private BroadcastReceiver batt_monitor; | 68 | private BroadcastReceiver batt_monitor; |
69 | private BroadcastReceiver headphone_monitor; | 69 | private BroadcastReceiver headphone_monitor; |
70 | private BroadcastReceiver noisy_monitor; | ||
70 | private RunForegroundManager fg_runner; | 71 | private RunForegroundManager fg_runner; |
71 | private MediaButtonReceiver mMediaButtonReceiver; | 72 | private MediaButtonReceiver mMediaButtonReceiver; |
72 | private int battery_level; | 73 | private int battery_level; |
73 | private int headphone_state; | 74 | private int headphone_state; |
74 | private ResultReceiver resultReceiver; | 75 | private ResultReceiver resultReceiver; |
76 | private RockboxService rbservice; | ||
75 | 77 | ||
76 | public static final int RESULT_INVOKING_MAIN = 0; | 78 | public static final int RESULT_INVOKING_MAIN = 0; |
77 | public static final int RESULT_LIB_LOAD_PROGRESS = 1; | 79 | public static final int RESULT_LIB_LOAD_PROGRESS = 1; |
@@ -357,6 +359,20 @@ public class RockboxService extends Service | |||
357 | } | 359 | } |
358 | }; | 360 | }; |
359 | registerReceiver(headphone_monitor, ifh); | 361 | registerReceiver(headphone_monitor, ifh); |
362 | noisy_monitor = new BroadcastReceiver() | ||
363 | { | ||
364 | @Override | ||
365 | public void onReceive(Context context, Intent intent) | ||
366 | { | ||
367 | LOG("audio becoming noisy"); | ||
368 | headphone_state = 0; | ||
369 | } | ||
370 | }; | ||
371 | rbservice = RockboxService.get_instance(); | ||
372 | /* We're relying on internal API's here, | ||
373 | this can break in the future! */ | ||
374 | rbservice.registerReceiver(noisy_monitor, | ||
375 | new IntentFilter("android.media.AUDIO_BECOMING_NOISY")); | ||
360 | } | 376 | } |
361 | 377 | ||
362 | 378 | ||
diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c index f8e4a35b47..3ee5e7c2f4 100644 --- a/firmware/drivers/button.c +++ b/firmware/drivers/button.c | |||
@@ -177,7 +177,7 @@ static void button_tick(void) | |||
177 | /* Use the autoresetting oneshot to debounce the detection signal */ | 177 | /* Use the autoresetting oneshot to debounce the detection signal */ |
178 | phones_present = !phones_present; | 178 | phones_present = !phones_present; |
179 | timeout_register(&hp_detect_timeout, btn_detect_callback, | 179 | timeout_register(&hp_detect_timeout, btn_detect_callback, |
180 | HZ, phones_present); | 180 | HZ/2, phones_present); |
181 | } | 181 | } |
182 | #endif | 182 | #endif |
183 | 183 | ||