From af3a017be782f21896c101264b31af55a5cf0314 Mon Sep 17 00:00:00 2001 From: Bhakthavatsala Raghavendra Date: Fri, 18 Oct 2024 21:33:33 +0000 Subject: Add socket settings interface Add socket interface which allows users to control the various security requirements for the sockets. This also helps in extending socket for offload socket related parameters Bug: 366639787 Bug: 374358112 Test: mmm packages/module/Bluetooth Change-Id: If09796368e76b8375b879b1e3cc7a1c365b67799 --- framework/api/current.txt | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'framework/api') diff --git a/framework/api/current.txt b/framework/api/current.txt index 4347504e24..6f27962380 100644 --- a/framework/api/current.txt +++ b/framework/api/current.txt @@ -52,6 +52,7 @@ package android.bluetooth { method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public android.bluetooth.BluetoothServerSocket listenUsingInsecureRfcommWithServiceRecord(String, java.util.UUID) throws java.io.IOException; method @NonNull @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public android.bluetooth.BluetoothServerSocket listenUsingL2capChannel() throws java.io.IOException; method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public android.bluetooth.BluetoothServerSocket listenUsingRfcommWithServiceRecord(String, java.util.UUID) throws java.io.IOException; + method @FlaggedApi("com.android.bluetooth.flags.socket_settings_api") @NonNull @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public android.bluetooth.BluetoothServerSocket listenUsingSocketSettings(@NonNull android.bluetooth.BluetoothSocketSettings) throws java.io.IOException; method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean setName(String); method @RequiresPermission(android.Manifest.permission.BLUETOOTH_SCAN) public boolean startDiscovery(); method @Deprecated @RequiresPermission(android.Manifest.permission.BLUETOOTH_SCAN) public boolean startLeScan(android.bluetooth.BluetoothAdapter.LeScanCallback); @@ -531,6 +532,7 @@ package android.bluetooth { method public android.bluetooth.BluetoothSocket createInsecureRfcommSocketToServiceRecord(java.util.UUID) throws java.io.IOException; method @NonNull public android.bluetooth.BluetoothSocket createL2capChannel(int) throws java.io.IOException; method public android.bluetooth.BluetoothSocket createRfcommSocketToServiceRecord(java.util.UUID) throws java.io.IOException; + method @FlaggedApi("com.android.bluetooth.flags.socket_settings_api") @NonNull public android.bluetooth.BluetoothSocket createUsingSocketSettings(@NonNull android.bluetooth.BluetoothSocketSettings) throws java.io.IOException; method public int describeContents(); method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean fetchUuidsWithSdp(); method public String getAddress(); @@ -1080,6 +1082,7 @@ package android.bluetooth { method public android.bluetooth.BluetoothDevice getRemoteDevice(); method public boolean isConnected(); field public static final int TYPE_L2CAP = 3; // 0x3 + field @FlaggedApi("com.android.bluetooth.flags.socket_settings_api") public static final int TYPE_LE = 4; // 0x4 field public static final int TYPE_RFCOMM = 1; // 0x1 field public static final int TYPE_SCO = 2; // 0x2 } @@ -1112,6 +1115,26 @@ package android.bluetooth { field public static final int UNSPECIFIED = 0; // 0x0 } + @FlaggedApi("com.android.bluetooth.flags.socket_settings_api") public final class BluetoothSocketSettings { + method @IntRange(from=128, to=255) public int getL2capPsm(); + method @Nullable public String getRfcommServiceName(); + method @Nullable public java.util.UUID getRfcommUuid(); + method public int getSocketType(); + method public boolean isAuthenticationRequired(); + method public boolean isEncryptionRequired(); + } + + @FlaggedApi("com.android.bluetooth.flags.socket_settings_api") public static final class BluetoothSocketSettings.Builder { + ctor public BluetoothSocketSettings.Builder(); + method @NonNull public android.bluetooth.BluetoothSocketSettings build(); + method @NonNull public android.bluetooth.BluetoothSocketSettings.Builder setAuthenticationRequired(boolean); + method @NonNull public android.bluetooth.BluetoothSocketSettings.Builder setEncryptionRequired(boolean); + method @NonNull public android.bluetooth.BluetoothSocketSettings.Builder setL2capPsm(@IntRange(from=128, to=255) int); + method @NonNull public android.bluetooth.BluetoothSocketSettings.Builder setRfcommServiceName(@NonNull String); + method @NonNull public android.bluetooth.BluetoothSocketSettings.Builder setRfcommUuid(@NonNull java.util.UUID); + method @NonNull public android.bluetooth.BluetoothSocketSettings.Builder setSocketType(int); + } + public final class BluetoothStatusCodes { field public static final int ERROR_BLUETOOTH_NOT_ALLOWED = 2; // 0x2 field public static final int ERROR_BLUETOOTH_NOT_ENABLED = 1; // 0x1 -- cgit v1.2.3-59-g8ed1b