summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--android/src/org/rockbox/RockboxService.java16
-rw-r--r--firmware/drivers/button.c2
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
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"));
}
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)
/* Use the autoresetting oneshot to debounce the detection signal */
phones_present = !phones_present;
timeout_register(&hp_detect_timeout, btn_detect_callback,
- HZ, phones_present);
+ HZ/2, phones_present);
}
#endif