aboutsummaryrefslogtreecommitdiff
path: root/framework/java/android/bluetooth/BluetoothServerSocket.java
Commit message (Collapse)AuthorAgeFilesLines
* Add more log for Bluetooth socketUgo Yu2023-02-151-1/+1
| | | | | | | | | | | | | - Enable framework logs - Add Bluetooth socket event log into dumpsys Bug: 263323082 Bug: 248162762 Test: atest BluetoothInstrumentationTests Change-Id: I0cbb18f1c221eaa7353b3867629affc09f1eb0a8 (cherry picked from commit 63c3fa677e15f1224e43dda1aee9d0d262aaab69) (cherry picked from commit b6dc15a708a03a5095523161911fc6a4f68772d9) Merged-In: I0cbb18f1c221eaa7353b3867629affc09f1eb0a8
* More Bluetooth API annotation updates.Jeff Sharkey2021-04-161-0/+2
| | | | | | | | | | | | | | | | | | This change adds a "BluetoothPermissionChecker" that ensures that all Bluetooth permission annotations are consistent. In addition, it verifies that all Bluetooth public APIs have been audited to be permission protected where relevant. We've currently standardized on saying that APIs that return device or Bluetooth state information (without sharing details about any particular remote Bluetooth device) do not need to be permission protected. This change is only annotations and has no behavior changes. Bug: 183626724 Test: ./build/soong/soong_ui.bash --make-mode Bluetooth RUN_ERROR_PRONE=true Change-Id: Ie80b15b058359bf1e9a6ee881b89cb3e5b584ca1
* Update Bluetooth API annotations.Jeff Sharkey2021-04-141-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Recent work has introduced a new "Nearby devices" runtime permission which protects all existing Bluetooth APIs; we've done this by defining a <split-permission> to convert the old BLUETOOTH and BLUETOOTH_ADMIN permissions into one of three new permissions: * BLUETOOTH_ADVERTISE: Required to be able to advertise to nearby Bluetooth devices. * BLUETOOTH_CONNECT: Allows applications to connect to paired bluetooth devices. * BLUETOOTH_SCAN: Required to be able to discover and pair nearby Bluetooth devices. At its core, this change begins updating the Bluetooth APIs to have correct @RequiresPermission indicating which permission is actually enforced internally. To ensure alignment across Binder, the newly added "RequiresPermissionChecker" Error Prone checker was used to discover any inconsistencies, ensuring correctness from server-side enforcement up through to the public APIs. In addition, since developers will continue building apps for both modern and legacy platforms, this change introduces new auto-doc annotations which will emit helpful consistent documentation describing the behavior of older devices that are still using the old permission model. Bug: 183626724 Test: ./build/soong/soong_ui.bash --make-mode Bluetooth RUN_ERROR_PRONE=true Change-Id: I02aa127e8e07f239561f4f2a3bbdfc6fccb82f7f
* Update language to comply with Android's inclusive language guidanceJeff Sharkey2020-09-141-1/+1
| | | | | | | | | See https://source.android.com/setup/contribute/respectful-code for reference Test: none Bug: 168334533 Exempt-From-Owner-Approval: docs updates Change-Id: I245b8d9cac722da76ea67983738a3cbb9deb68df
* Use new UnsupportedAppUsage annotation.Artur Satayev2020-01-091-1/+1
| | | | | | | | | Existing annotations in libcore/ and frameworks/ will deleted after the migration. This also means that any java library that compiles @UnsupportedAppUsage requires a direct dependency on "unsupportedappusage" java_library. Bug: 145132366 Test: m && diff unsupportedappusage_index.csv Change-Id: I6ab53570aca580fbee1fcc927871caa09780f58f Merged-In: I6ab53570aca580fbee1fcc927871caa09780f58f
* Document public alternatives to greylisted APIsAndrei Onea2019-06-171-1/+2
| | | | | | | | | Add known public alternatives or recommendations for greylisted APIs in Bluetooth. Bug: 135171386 Test: m Change-Id: I86e708be37eb7d1b0fafa2d64283b7f81bc02e51
* Add more documentation for LE CoCStanley Tng2019-04-191-14/+21
| | | | | | | | | | Added more information into Android SDK for LE Connection-oriented Channels (CoC) so that it matches the corresponding RFComm documentation. Bug: 70683224 Test: Compile Change-Id: I40abde70a7ca6bcd194ee75bd8367c0ed9e97d05
* DO NOT MERGE - Merge pi-platform-release (PPRL.190205.001) intoXin Li2019-02-141-2/+2
|\ | | | | | | | | | | | | stage-aosp-master Bug: 124234733 Change-Id: Ic4f67fde0835da0b1c363906cccef0d244e38393
| * docs: Replacing {#link with {@linkAndrew Solovay2018-10-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Several java files had the typo {#link (for cross-references to other Javadocs) instead of the proper {@link format. This was confusing the new doc publish tool (Mivi) since that's the format used for {# Django comments #}. Fixed a couple of links that had other errors (which prevented building once the {# -> {@ was done) and other typos. Replaced throughout the frameworks/base project; I'll need a separate CL for the AndroidX fixes. Staged to: go/dac-stage/reference/android/app/Instrumentation.html go/dac-stage/reference/android/bluetooth/BluetoothAdapter.html go/dac-stage/reference/android/bluetooth/BluetoothDevice.html go/dac-stage/reference/android/bluetooth/BluetoothServerSocket.html go/dac-stage/reference/android/inputmethodservice/InputMethodService.html go/dac-stage/reference/android/view/KeyCharacterMap.html go/dac-stage/reference/android/view/KeyEvent.html go/dac-stage/reference/android/media/AudioManager.html go/dac-stage/reference/android/net/wifi/WifiConfiguration.html (Other files were not in the public Javadocs.) Bug: 111925950 Test: make ds-docs Exempt-From-Owner-Approval: Docs-only change Change-Id: Ia06e1fffd814671289a1caebd5962aedc18a28d7 Merged-In: Ia06e1fffd814671289a1caebd5962aedc18a28d7
* | Unhide the LE CoC APIsStanley Tng2018-09-131-3/+2
| | | | | | | | | | | | | | | | Expose the LE Connection-oriented Channels APIs for applications to use. Test: Run the SL4A ACTS test: BleCocTest Bug: 70683224 Change-Id: I68128bc7154966ec065091c973351f8892da9b4d
* | Add @UnsupportedAppUsage annotationsMathew Inwood2018-08-011-0/+2
|/ | | | | | | | | | | | | | | | | | For packages: android.bluetooth.le android.bluetooth This is an automatically generated CL. See go/UnsupportedAppUsage for more details. Exempted-From-Owner-Approval: Mechanical changes to the codebase which have been approved by Android API council and announced on android-eng@ Bug: 110868826 Test: m Change-Id: Ifcf24c0617acd7facc0e03f30a95c3a6b09b205c Merged-In: I88a1311e27c5f9a5f9d1035db76034f86f650efc
* Added APIs for Connection-oriented channelsStanley Tng2018-01-121-0/+20
| | | | | | | | | Experimental and hidden APIs are defined for the Connection-oriented Channel (CoC) features. The APIs using PSM are implemented. Test: Can compile Bug: 70683224 Change-Id: Icdb5fa190b0e21881a60437fa48cd575371ee1e4
* Fix checkstyle errors (2/2)Jack He2017-08-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | * Manual style corrections with IDE assistance * Variable name refactors are done through IDE * Corrected general style errors such as: - "final private var" -> "private final var" - "&&", "+", "||" should not be at the end of line - Non-static private variable should be like "mVar" - Private static variable should be like "sVar" - Code file should always end with newline - Inherited methods should be annotated with @Override and no @hide tags - Public methods should always have a JavaDoc entry - "int[] array" is preferred over "int array[]" - private methods should be accessed without "this." when there is no name collisions. - "boolean ? true : false" -> boolean - "boolean ? false : true" -> !boolean - "boolean == true" OR "boolean != false" -> boolean - "boolean != true" OR "boolean == false" -> !boolean Bug: 63596319 Test: make checkbuild, no functional changes Change-Id: Iabdc2be912a32dd63a53213d175cf1bfef268ccd
* Fix checkstyle errors (1/2)Jack He2017-08-241-33/+36
| | | | | | | | * Automatic style corrections through IDE Bug: 63596319 Test: make checkbuild, no manual changes, no functional changes Change-Id: I2397d55abc34c9b7a9b748bec6137778df3421a7
* Fix links to Bluetooth GuideMarie Janssen2016-06-201-1/+1
| | | | Change-Id: I5798c3d71c7cc9c509e0f7b04fa140168b0fdc11
* SAP: Make it possible to enforce a 16-digit pin code (4/5)Casper Bonde2015-06-091-2/+4
| | | | | | | | | | This change enable the posibility to enforce using a 16-digit pin or MITM for a RFCOMM or L2CAP connection. This is needed for the SIM access profile. Change-Id: I3205013f9e758c353381442a86845dab467780f8 Signed-off-by: Casper Bonde <c.bonde@samsung.com>
* Add support for MITM for BluetoothSockets (1/4)Casper Bonde2015-06-031-0/+20
| | | | | | | | | This change adds an option to enforce Man-in-the-middle protection for the authentication process. This feature is needed for the Sim Access Profile. Change-Id: Ia3ef0caeb750f88608c9fa6bf6367d1c77de4cf3 Signed-off-by: Casper Bonde <c.bonde@samsung.com>
* OBEX Over L2CAP + SDP search API for BT profilesCasper Bonde2015-04-111-1/+51
| | | | | | | | | | | | | | | - Updated OBEX to support SRM - Added support for OBEX over l2cap and SRM. - Minor bugfixes, and reduce CPU load ALOT - Added support to send responses without body data. - Extend BluetoothSocket to support L2CAP - Added functionality to get the channel number needed to be able to create an SDP record with the channel number. - Added interface to get socket type and max packet sizes. - Added interface to perform SDP search and get the resulting SDP record data. Change-Id: I9d37a00ce73dfffc0e3ce03eab5511ba3a86e5b8
* Remove unused imports from frameworks/base.John Spurlock2013-11-201-1/+0
| | | | Change-Id: Ia1f99bd2c1105b0b0f70aa614f1f4a67b2840906
* Added new rfcomm multi accept codezzy2012-07-161-1/+21
|
* docs: Add developer guide cross-references, Project ACRE, round 4Joe Fernandez2011-12-221-0/+6
| | | | Change-Id: I1b43414aaec8ea217b39a0d780c80a25409d0991
* Get server's listening channelBen Dodson2011-07-081-0/+10
| | | | Change-Id: Ia1cb3486a4ba502185efdcf6d7bcf0f37bb55261
* Typo fixes in comments and minor code cleanups.Jake Hamby2010-09-301-3/+3
| | | | | | | | | * Fix some typos in Javadoc and log messages. * Remove redundant initializer in BluetoothAdapter.readOutOfBandData() * Use canonical "UTF-8" charset name instead of "UTF8" in BluetoothDevice.convertPinToBytes() Change-Id: I58cd5dc48a7ad0053d204c5f590b4b3d438d8672
* docs for ESR: add docs to bluetooth explainin that discovery shouldScott Main2009-11-191-1/+7
| | | | | | be cancelled before connecting to a device bug: 2160782,2198463
* docs: add more documentation for the bluetooth apis.Scott Main2009-11-091-18/+20
| | | | | | more descriptions for some of the classes and a new overview and pseudo-code example for using BT APIs in the package summary.
* Encourage developers to connect RFCOMM by UUID instead of Channel.Nick Pelly2009-10-071-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | Hide createRfcommSocket(int channel) Add createRfcommSocketWithServiceRecord(UUID uuid) Rename listenUsingRfcomm(String,UUID) -> listenUsingRfcommWithServiceRecord(..) Now we have a complete API for developers to make peer-peer RFCOMM connections with hard-coding the limited (30) RFCOMM channels, instead using SDP lookup of an UUID. This commit addresses two serious bugs: - Do not throw IOException on accepting an incoming RFCOMM connection with BluetoothSocket. This was a regression from commit ee1402d8d697be3a - Workaround failure of bluez to update SDP cache when channel changes by trying to use the same RFCOMM channel on the server every time, instead of picking server channels randomly. This is a pretty ugly workaround, and we are still trying to fix the caching issue - but with this workaround we are at least shippable and apps will work at least until they start colliding on the 30 RFCOMM channels. DrNo: eastham Bug: 2158900 Joke: What did the digital watch say to his mom? "Look mom no hands." Change-Id: Ia4879943b83afac06b6f1a3f2391cf1628afce7d
* Fix docs builds.Nick Pelly2009-10-061-1/+1
|
* Provide an API for apps to use a dynamic RFCOMM channel and SDP record.Nick Pelly2009-10-061-0/+14
| | | | | | | | | | | | | | | | | | | | | | Hide listenUsingRfcommOn(int channel) Add listenUsingRfcomm(String name, ParcelUuid uuid) The new API automatically finds a free RFCOMM channel and registers an SDP record with the given uuid and name. The SDP record is automatically removed when the socket is closed, or if the application dies. Apps are prevented from registering SDP records with the uuid of system Bluetooth profiles, such as A2DP, HFP and OPP. Apps are prevented from removing SDP records that they did not create. This is tracked by pid. TODO: Provide an API for the connecting app to look up an SDP record. Bug: 2158900 DrNo: eastham Joke: "What did the dog say to the tree? bark." Change-Id: Ia92f51c34615a7270a403255ad2b8faa98c4a3f5
* Add javadoc to explain which permissions are required for Public BT API's.Nick Pelly2009-09-081-0/+3
|
* Immediately destroy BluetoothSocket's on close().Nick Pelly2009-09-021-2/+3
| | | | | | | | | | | | | | | Unfortunatley, shutdown() on the underlying fd does not actually stop a listening socket from listening. You need to call close() on the fd to do this. There is no way around it. So this means the Java BluetoothSocket code has to call destroyNative() during BluetoothSocket.close(). Since native methods cannot be called after destroyNative(), add a ReadWrite lock and mClosed field to protect access to native methods. This fixes the "resource busy" error when Bluetooth OPP and Bluetooth PBAP tried to resume listening after turning BT off and then on.
* API CHANGENick Pelly2009-08-191-20/+37
| | | | | | | Javadoc, and unhide the first pieces of the Bluetooth API. With this commit there is enough public API to connect and use an RFCOMM connection between Bluetooth devices.
* Bluetooth: API change.Nick Pelly2009-08-181-67/+2
| | | | | | | | | | | | | | | Split BluetoothDevice into BluetoothDevice and BluetoothAdapter. BluetoothAdapter: Represents the local BT adapter. Operations on the local adapter (start a scan, etc). BluetoothDevice: Represents a remote BT device. Operations on remote devices (pair, connect, etc). IBluetoothDevice.aidl -> Bluetooth.aidl BluetoothDeviceService.java -> BluetoothDeviceService.java TODO: Javadoc
* Implement and expose SCO socket support in BluetoothSocket.java.Nick Pelly2009-06-021-9/+35
| | | | | | Implement L2CAP socket support, but do not expose it (untested). NEXT: Switch to Builder style constructor instead of factory method.
* New BluetoothSocket API.Nick Pelly2009-05-261-0/+124
Modeled on blocking java.net.Socket and java.net.ServerSocket library. Public interface is: public final class BluetoothSocket implements Closeable { public static BluetoothSocket createRfcommSocket(String address, int port) throws IOException; public static BluetoothSocket createInsecureRfcommSocket(String address, int port) throws IOException; public void connect() throws IOException; public void close() throws IOException; public String getAddress(); public InputStream getInputStream() throws IOException; public OutputStream getOutputStream() throws IOException; } public final class BluetoothServerSocket implements Closeable { public static BluetoothServerSocket listenUsingRfcommOn(int port) throws IOException; public static BluetoothServerSocket listenUsingUnsecureRfcommOn(int port) throws IOException; public BluetoothSocket accept() throws IOException; public BluetoothSocket accept(int timeout) throws IOException; public void close() throws IOException; }