Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a8b0cbd3 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 12748980 from c558b3e2 to 25Q1-release

Change-Id: I61976d7240f76c233ac5d4b98cbeff6bb78176a3
parents 0086fbc8 c558b3e2
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -338,4 +338,10 @@ interface IBluetooth

    @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED)")
    oneway void killBluetoothProcess();

    @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED)")
    boolean isLeCocSocketOffloadSupported(in AttributionSource source);

    @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED)")
    boolean isRfcommSocketOffloadSupported(in AttributionSource source);
}
+4 −0
Original line number Diff line number Diff line
@@ -29,8 +29,12 @@ interface IBluetoothSocketManager
{
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)")
    @nullable ParcelFileDescriptor connectSocket(in BluetoothDevice device, int type, in @nullable ParcelUuid uuid, int port, int flag);
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})")
    @nullable ParcelFileDescriptor connectSocketwithOffload(in BluetoothDevice device, int type, in @nullable ParcelUuid uuid, int port, int flag, int dataPath, in String socketName, long hubId, long endpointId, int maximumPacketSize);
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)")
    @nullable ParcelFileDescriptor createSocketChannel(int type, in @nullable String serviceName, in @nullable ParcelUuid uuid, int port, int flag);
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})")
    @nullable ParcelFileDescriptor createSocketChannelWithOffload(int type, in @nullable String serviceName, in @nullable ParcelUuid uuid, int port, int flag, int dataPath, in String socketName, long hubId, long endpointId, int maximumPacketSize);
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)")
    void requestMaximumTxDataLength(in BluetoothDevice device);
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})")
+28 −7
Original line number Diff line number Diff line
@@ -1782,11 +1782,14 @@ static jboolean setBufferLengthMillisNative(JNIEnv* /* env */, jobject /* obj */
}

static jint connectSocketNative(JNIEnv* env, jobject /* obj */, jbyteArray address, jint type,
                                jbyteArray uuid, jint port, jint flag, jint callingUid) {
                                jbyteArray uuid, jint port, jint flag, jint callingUid,
                                jint dataPath, jstring socketName, jlong hubId, jlong endPointId,
                                jint maxRxPacketSize) {
  int socket_fd = INVALID_FD;
  jbyte* addr = nullptr;
  jbyte* uuidBytes = nullptr;
  Uuid btUuid;
  const char* nativeSocketName = nullptr;

  if (!sBluetoothSocketInterface) {
    goto done;
@@ -1799,9 +1802,13 @@ static jint connectSocketNative(JNIEnv* env, jobject /* obj */, jbyteArray addre
  }

  btUuid = Uuid::From128BitBE(reinterpret_cast<uint8_t*>(uuidBytes));
  if (socketName != nullptr) {
    nativeSocketName = env->GetStringUTFChars(socketName, nullptr);
  }
  if (sBluetoothSocketInterface->connect(reinterpret_cast<RawAddress*>(addr), (btsock_type_t)type,
                                         &btUuid, port, &socket_fd, flag,
                                         callingUid) != BT_STATUS_SUCCESS) {
                                         &btUuid, port, &socket_fd, flag, callingUid,
                                         (btsock_data_path_t)dataPath, nativeSocketName, hubId,
                                         endPointId, maxRxPacketSize) != BT_STATUS_SUCCESS) {
    socket_fd = INVALID_FD;
  }

@@ -1812,16 +1819,21 @@ done:
  if (uuidBytes) {
    env->ReleaseByteArrayElements(uuid, uuidBytes, 0);
  }
  if (nativeSocketName) {
    env->ReleaseStringUTFChars(socketName, nativeSocketName);
  }
  return socket_fd;
}

static jint createSocketChannelNative(JNIEnv* env, jobject /* obj */, jint type,
                                      jstring serviceName, jbyteArray uuid, jint port, jint flag,
                                      jint callingUid) {
                                      jint callingUid, jint dataPath, jstring socketName,
                                      jlong hubId, jlong endPointId, jint maxRxPacketSize) {
  int socket_fd = INVALID_FD;
  jbyte* uuidBytes = nullptr;
  Uuid btUuid;
  const char* nativeServiceName = nullptr;
  const char* nativeSocketName = nullptr;

  if (!sBluetoothSocketInterface) {
    goto done;
@@ -1835,9 +1847,14 @@ static jint createSocketChannelNative(JNIEnv* env, jobject /* obj */, jint type,
    goto done;
  }
  btUuid = Uuid::From128BitBE(reinterpret_cast<uint8_t*>(uuidBytes));
  if (socketName != nullptr) {
    nativeSocketName = env->GetStringUTFChars(socketName, nullptr);
  }

  if (sBluetoothSocketInterface->listen((btsock_type_t)type, nativeServiceName, &btUuid, port,
                                        &socket_fd, flag, callingUid) != BT_STATUS_SUCCESS) {
                                        &socket_fd, flag, callingUid, (btsock_data_path_t)dataPath,
                                        nativeSocketName, hubId, endPointId,
                                        maxRxPacketSize) != BT_STATUS_SUCCESS) {
    socket_fd = INVALID_FD;
  }

@@ -1848,6 +1865,9 @@ done:
  if (nativeServiceName) {
    env->ReleaseStringUTFChars(serviceName, nativeServiceName);
  }
  if (nativeSocketName) {
    env->ReleaseStringUTFChars(socketName, nativeSocketName);
  }
  return socket_fd;
}

@@ -2267,8 +2287,9 @@ int register_com_android_bluetooth_btservice_AdapterService(JNIEnv* env) {
          {"setBufferLengthMillisNative", "(II)Z",
           reinterpret_cast<void*>(setBufferLengthMillisNative)},
          {"getMetricIdNative", "([B)I", reinterpret_cast<void*>(getMetricIdNative)},
          {"connectSocketNative", "([BI[BIII)I", reinterpret_cast<void*>(connectSocketNative)},
          {"createSocketChannelNative", "(ILjava/lang/String;[BIII)I",
          {"connectSocketNative", "([BI[BIIIILjava/lang/String;JJI)I",
           reinterpret_cast<void*>(connectSocketNative)},
          {"createSocketChannelNative", "(ILjava/lang/String;[BIIIILjava/lang/String;JJI)I",
           reinterpret_cast<void*>(createSocketChannelNative)},
          {"requestMaximumTxDataLengthNative", "([B)V",
           reinterpret_cast<void*>(requestMaximumTxDataLengthNative)},
+1 −0
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ public final class AbstractionLayer {
    static final int BT_PROPERTY_REMOTE_ASHA_CAPABILITY = 0X15;
    static final int BT_PROPERTY_REMOTE_ASHA_TRUNCATED_HISYNCID = 0X16;
    static final int BT_PROPERTY_REMOTE_MODEL_NUM = 0x17;
    static final int BT_PROPERTY_LPP_OFFLOAD_FEATURES = 0x1B;

    public static final int BT_DEVICE_TYPE_BREDR = 0x01;
    public static final int BT_DEVICE_TYPE_BLE = 0x02;
+69 −6
Original line number Diff line number Diff line
@@ -195,13 +195,56 @@ public class AdapterNativeInterface {
        return getMetricIdNative(address);
    }

    int connectSocket(byte[] address, int type, byte[] uuid, int port, int flag, int callingUid) {
        return connectSocketNative(address, type, uuid, port, flag, callingUid);
    int connectSocket(
            byte[] address,
            int type,
            byte[] uuid,
            int port,
            int flag,
            int callingUid,
            int dataPath,
            String socketName,
            long hubId,
            long endpointId,
            int maximumPacketSize) {
        return connectSocketNative(
                address,
                type,
                uuid,
                port,
                flag,
                callingUid,
                dataPath,
                socketName,
                hubId,
                endpointId,
                maximumPacketSize);
    }

    int createSocketChannel(
            int type, String serviceName, byte[] uuid, int port, int flag, int callingUid) {
        return createSocketChannelNative(type, serviceName, uuid, port, flag, callingUid);
            int type,
            String serviceName,
            byte[] uuid,
            int port,
            int flag,
            int callingUid,
            int dataPath,
            String socketName,
            long hubId,
            long endpointId,
            int maximumPacketSize) {
        return createSocketChannelNative(
                type,
                serviceName,
                uuid,
                port,
                flag,
                callingUid,
                dataPath,
                socketName,
                hubId,
                endpointId,
                maximumPacketSize);
    }

    void requestMaximumTxDataLength(byte[] address) {
@@ -359,10 +402,30 @@ public class AdapterNativeInterface {
    private native int getMetricIdNative(byte[] address);

    private native int connectSocketNative(
            byte[] address, int type, byte[] uuid, int port, int flag, int callingUid);
            byte[] address,
            int type,
            byte[] uuid,
            int port,
            int flag,
            int callingUid,
            int dataPath,
            String socketName,
            long hubId,
            long endpointId,
            int maximumPacketSize);

    private native int createSocketChannelNative(
            int type, String serviceName, byte[] uuid, int port, int flag, int callingUid);
            int type,
            String serviceName,
            byte[] uuid,
            int port,
            int flag,
            int callingUid,
            int dataPath,
            String socketName,
            long hubId,
            long endpointId,
            int maximumPacketSize);

    private native void requestMaximumTxDataLengthNative(byte[] address);

Loading