ALOGV("%s: status:%d packet_count:%d ", __FUNCTION__, status, packet_count);
}
-static void energy_info_recv_callback(bt_activity_energy_info *p_energy_info)
+static void energy_info_recv_callback(bt_activity_energy_info *p_energy_info,
+ bt_uid_traffic_t* /* uid_data */)
{
if (!checkCallbackThread()) {
ALOGE("Callback: '%s' is not called on the correct thread", __FUNCTION__);
}
static int connectSocketNative(JNIEnv *env, jobject object, jbyteArray address, jint type,
- jbyteArray uuidObj, jint channel, jint flag) {
+ jbyteArray uuidObj, jint channel, jint flag, jint callingUid) {
jbyte *addr = NULL, *uuid = NULL;
int socket_fd;
bt_status_t status;
}
if ( (status = sBluetoothSocketInterface->connect((bt_bdaddr_t *) addr, (btsock_type_t) type,
- (const uint8_t*) uuid, channel, &socket_fd, flag)) != BT_STATUS_SUCCESS) {
+ (const uint8_t*) uuid, channel, &socket_fd, flag, callingUid))
+ != BT_STATUS_SUCCESS) {
ALOGE("Socket connection failed: %d", status);
goto Fail;
}
static int createSocketChannelNative(JNIEnv *env, jobject object, jint type,
jstring name_str, jbyteArray uuidObj,
- jint channel, jint flag) {
+ jint channel, jint flag, jint callingUid) {
const char *service_name = NULL;
jbyte *uuid = NULL;
int socket_fd;
}
}
if ( (status = sBluetoothSocketInterface->listen((btsock_type_t) type, service_name,
- (const uint8_t*) uuid, channel, &socket_fd, flag)) != BT_STATUS_SUCCESS) {
+ (const uint8_t*) uuid, channel, &socket_fd, flag, callingUid))
+ != BT_STATUS_SUCCESS) {
ALOGE("Socket listen failed: %d", status);
goto Fail;
}
{"pinReplyNative", "([BZI[B)Z", (void*) pinReplyNative},
{"sspReplyNative", "([BIZI)Z", (void*) sspReplyNative},
{"getRemoteServicesNative", "([B)Z", (void*) getRemoteServicesNative},
- {"connectSocketNative", "([BI[BII)I", (void*) connectSocketNative},
- {"createSocketChannelNative", "(ILjava/lang/String;[BII)I",
+ {"connectSocketNative", "([BI[BIII)I", (void*) connectSocketNative},
+ {"createSocketChannelNative", "(ILjava/lang/String;[BIII)I",
(void*) createSocketChannelNative},
{"configHciSnoopLogNative", "(Z)Z", (void*) configHciSnoopLogNative},
{"alarmFiredNative", "()V", (void *) alarmFiredNative},
ParcelUuid uuid, int port, int flag) {
enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
int fd = connectSocketNative(Utils.getBytesFromAddress(device.getAddress()),
- type, Utils.uuidToByteArray(uuid), port, flag);
+ type, Utils.uuidToByteArray(uuid), port, flag, Binder.getCallingUid());
if (fd < 0) {
errorLog("Failed to connect socket");
return null;
ParcelUuid uuid, int port, int flag) {
enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
int fd = createSocketChannelNative(type, serviceName,
- Utils.uuidToByteArray(uuid), port, flag);
+ Utils.uuidToByteArray(uuid), port, flag, Binder.getCallingUid());
if (fd < 0) {
errorLog("Failed to create socket channel");
return null;
private native int readEnergyInfo();
// TODO(BT) move this to ../btsock dir
private native int connectSocketNative(byte[] address, int type,
- byte[] uuid, int port, int flag);
+ byte[] uuid, int port, int flag, int callingUid);
private native int createSocketChannelNative(int type, String serviceName,
- byte[] uuid, int port, int flag);
+ byte[] uuid, int port, int flag, int callingUid);
/*package*/ native boolean configHciSnoopLogNative(boolean enable);
/*package*/ native boolean factoryResetNative();