summaryrefslogtreecommitdiffstats
path: root/jni/com_android_bluetooth_avrcp.cpp
diff options
context:
space:
mode:
authorJohn Du <johnldu@google.com>2013-06-27 18:39:42 -0700
committerJohn Du <johnldu@google.com>2013-08-15 18:52:29 +0000
commitace834feb02adabd61f628c4471147aea02d939c (patch)
treeebd083e1abb02412b582db000c53e3ad91f6b920 /jni/com_android_bluetooth_avrcp.cpp
parent8c85057a003441674807e2991092735011c72b26 (diff)
downloadandroid_packages_apps_Bluetooth-ace834feb02adabd61f628c4471147aea02d939c.tar.gz
android_packages_apps_Bluetooth-ace834feb02adabd61f628c4471147aea02d939c.tar.bz2
android_packages_apps_Bluetooth-ace834feb02adabd61f628c4471147aea02d939c.zip
Add support for ff/rew
Change-Id: I7ec60d94313b9ba5e4e8e62c82f19ae332b6fdd3 (cherry picked from commit 55123eff985f4d15ec198569a5db895ea086447a)
Diffstat (limited to 'jni/com_android_bluetooth_avrcp.cpp')
-rw-r--r--jni/com_android_bluetooth_avrcp.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/jni/com_android_bluetooth_avrcp.cpp b/jni/com_android_bluetooth_avrcp.cpp
index 6ff5cfa84..7406fcd05 100644
--- a/jni/com_android_bluetooth_avrcp.cpp
+++ b/jni/com_android_bluetooth_avrcp.cpp
@@ -29,6 +29,7 @@ namespace android {
static jmethodID method_getPlayStatus;
static jmethodID method_getElementAttr;
static jmethodID method_registerNotification;
+static jmethodID method_handlePassthroughCmd;
static const btrc_interface_t *sBluetoothAvrcpInterface = NULL;
static jobject mCallbacksObj = NULL;
@@ -92,6 +93,19 @@ static void btavrcp_register_notification_callback(btrc_event_id_t event_id, uin
checkAndClearExceptionFromCallback(sCallbackEnv, __FUNCTION__);
}
+static void btavrcp_passthrough_command_callback(int id, int pressed) {
+ ALOGI("%s", __FUNCTION__);
+
+ if (!checkCallbackThread()) {
+ ALOGE("Callback: '%s' is not called on the correct thread", __FUNCTION__);
+ return;
+ }
+
+ sCallbackEnv->CallVoidMethod(mCallbacksObj, method_handlePassthroughCmd, (jint)id,
+ (jint)pressed);
+ checkAndClearExceptionFromCallback(sCallbackEnv, __FUNCTION__);
+}
+
static btrc_callbacks_t sBluetoothAvrcpCallbacks = {
sizeof(sBluetoothAvrcpCallbacks),
btavrcp_get_play_status_callback,
@@ -102,7 +116,8 @@ static btrc_callbacks_t sBluetoothAvrcpCallbacks = {
NULL,
NULL,
btavrcp_get_element_attr_callback,
- btavrcp_register_notification_callback
+ btavrcp_register_notification_callback,
+ btavrcp_passthrough_command_callback
};
static void classInitNative(JNIEnv* env, jclass clazz) {
@@ -115,6 +130,9 @@ static void classInitNative(JNIEnv* env, jclass clazz) {
method_registerNotification =
env->GetMethodID(clazz, "registerNotification", "(II)V");
+ method_handlePassthroughCmd =
+ env->GetMethodID(clazz, "handlePassthroughCmd", "(II)V");
+
ALOGI("%s: succeeds", __FUNCTION__);
}