summaryrefslogtreecommitdiff
path: root/core/java/android/net/LocalSocket.java
Commit message (Collapse)AuthorAgeFilesLines
* Delete LocalSocket#createConnectedLocalSocket.Lorenzo Colitti2022-01-251-13/+0
| | | | | | | | | The only caller of this method was BluetoothSocket, and that is being removed in this topic. Test: m Bug: 200200870 Change-Id: Ic211448bc805c6f74852a8813317444bfb33c9dd
* Add a module-lib API for constructing a LocalSocket from an fd.Lorenzo Colitti2022-01-251-13/+40
| | | | | | | | | | | | | | | | This allows constructing a LocalSocket from a FileDescriptor referring to an already-connected socket. The LocalSocket can then be used to exchange ancillary filedescriptors and fetch peer socket credentials for the existing FD. The fd is not dup'd or closed by the API, and the caller is responsible for closing it. This is consistent with the constructor of the related LocalServerSocket class, which also takes an fd and does not manage its lifecycle. Bug: 200200870 Test: atest CoreTests:android.net.LocalSocketTest CtsNetTestCases:android.net.cts.LocalSocketTest Change-Id: I86448ba80475c4563194a4a2d9a0c0bbd0b76444
* Use new UnsupportedAppUsage annotation.Artur Satayev2020-01-081-1/+2
| | | | | | | | | 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: I0c336de56bc4a041dc97ff9b7927f62f0b44b457 Merged-In: I0c336de56bc4a041dc97ff9b7927f62f0b44b457
* Add @UnsupportedAppUsage annotationsMathew Inwood2018-08-141-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For packages: android.net.wimax android.net.wifi.p2p.nsd android.net.wifi.p2p android.net.wifi.hotspot2.pps android.net.wifi.hotspot2.omadm android.net.wifi.hotspot2 android.net.wifi.aware android.net.wifi android.net.util android.net.sip android.net.rtp android.net.nsd android.net.metrics android.net.lowpan android.net.http android.net.captiveportal android.net 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: Ie25423113ee1a8071cd5039382c00de6ce0af7fd Merged-In: I520be7a4c79e68310c12e4f55bf66acaa94145a1
* Refactor RFCOMM / BluetoothSocket usage of LocalSocketNeil Fuller2017-01-061-14/+20
| | | | | | | | | | | | | | | | | | | | LocalSocket is used by BluetoothSocket. BluetoothSocket passes a pre-created file descriptor to LocalSocket that is then given to the LocalSocketImpl. Commit b08c7bc0bdc48ae95be2697ca27ea89a9dd92c3e broke the behavior. Commit 7a8c36aa4e6a1b5e48f0ee5a787f10bcfece7587 put in a minimal fix. This change tidies up LocalSocket and associated classes and replaces a specialist constructor with a factory method to highlight the special case. While there an unnecessary exception has been removed. Bug: 34111534 Test: Boot device Test: vogar --mode app_process tests/tests/net/src/android/net/cts/LocalSocketTest.java Change-Id: I4ba2f2d9ea361a950ff8bc8d64fc800d998c3210
* Prevent LocalSocket from creating an fd if fd is already thereAjay Panicker2017-01-051-5/+6
| | | | | | | | | | | Any LocalSocket created with a FileDescriptor will throw IOExceptions when performing most opperations due to the fact that the LocalSocket tries to create an implementation but fails since there is a FileDescriptor already set. Bug: 34095140 Test: Setup using tap&go Change-Id: Ie8f50def6156c16617697d939d6c0ab570281642
* Set isConnected, isBound, implCreated on server-side LocalSocketsNeil Fuller2017-01-041-5/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously LocalServerSocket.accept() would return a LocalSocket instance with isConnected, isBound and implCreated set to false. [implCreated determines whether impl.create() needs to called]. A socket created via accept() in this way is implicitly bound and connected. impl.create() does not need to be called because impl.accept(LocalSocketImpl s) is called instead and has the same effect (s.fd and s.mFdCreatedInternally set correctly). This change modifies the behavior so that the flags are now all set to true in this case and isBound() and isConnected() will now return the correct answer. Attempts to call bind() and connect() will still throw IOException as before, but with a different exception message. Correctly setting implCreated in LocalSocket means that LocalSocketImpl.create() will no longer be called for accept() created sockets and no longer needs to treat the "fd != null" case as a no-op: we can now assert that there must be no fd set when create() is called as we will no longer call it with sockets created using accept(). Bug: https://code.google.com/p/android/issues/detail?id=35942 Test: Device boot Test: vogar --mode app_process cts/tests/tests/net/src/android/net/cts/LocalServerSocketTest.java Test: vogar --mode app_process cts/tests/tests/net/src/android/net/cts/LocalSocketTest.java Change-Id: I3ac55439412e84501ae7c5ae6c9976e03b2d6fc5
* Add thread safety documentationNeil Fuller2015-11-261-1/+2
| | | | | | | | | An upcoming change will remove "synchronized" from the API docs. This change documents those cases where the guarantees can be determined from code inspection. Bug: 25767152 Change-Id: I75083ce01513ed315222304fe3f34190d40748cb
* Make a field final.Ian Rogers2014-08-271-1/+1
| | | | | | Make a field that can be final, final. Change-Id: I597ef43bad5045a63e7e9fe6eedd8e0f0a637ca4
* LocalSocket: Add support for SOCK_DGRAM and SOCK_SEQPACKETMike Lockwood2013-07-161-4/+26
| | | | | | Also replaced some JNI code with libcore IO support Change-Id: I091e2b6b8dd1fec554936c1ffab29e50f0979e4a
* Make LocalSocket Closeable.Jeff Sharkey2012-08-051-1/+3
| | | | | | Enables usage of IoUtils.closeQuietly(). Change-Id: I91126297c1f235ae9da09f82d8f4f22db46558eb
* Added new rfcomm multi accept codezzy2012-07-161-0/+9
|
* Fix double-checked locking bug in LocalSocket.Jesse Wilson2010-09-211-2/+5
| | | | | | | This code uses a try/finally to maintain the old behavior of setting implCreated even if creation fails. Change-Id: Ieac05568477db4908cd4087714cf00a9addd1d20
* auto import from //depot/cupcake/@135843The Android Open Source Project2009-03-031-0/+288
|
* auto import from //depot/cupcake/@135843The Android Open Source Project2009-03-031-288/+0
|
* Initial ContributionThe Android Open Source Project2008-10-211-0/+288