From 2c9d40a06e261553bd9c0c9c6313475653a2c912 Mon Sep 17 00:00:00 2001 From: Neil Fuller Date: Tue, 24 Nov 2015 18:19:06 +0000 Subject: Add thread safety documentation 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 (cherry-picked from commit bf0dc0fba790cf95f76870c37469703f8f20a57c) Change-Id: I328b96328e89950b90d537bf0a6a704242de4993 --- core/java/android/bluetooth/BluetoothAdapter.java | 4 +++- core/java/android/net/LocalSocket.java | 3 ++- core/java/android/net/http/HttpResponseCache.java | 3 ++- core/java/android/util/EventLog.java | 2 +- media/java/android/media/MediaMetadataEditor.java | 3 ++- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/core/java/android/bluetooth/BluetoothAdapter.java b/core/java/android/bluetooth/BluetoothAdapter.java index 1f3ff5148716..6b3e7ab4eeef 100644 --- a/core/java/android/bluetooth/BluetoothAdapter.java +++ b/core/java/android/bluetooth/BluetoothAdapter.java @@ -76,6 +76,8 @@ import java.util.UUID; * {@link #listenUsingRfcommWithServiceRecord(String,UUID)}; or start a scan for * Bluetooth LE devices with {@link #startLeScan(LeScanCallback callback)}. * + *

This class is thread safe. + * *

Note: * Most methods require the {@link android.Manifest.permission#BLUETOOTH} * permission and some also require the @@ -84,7 +86,7 @@ import java.util.UUID; *

*

Developer Guides

*

For more information about using Bluetooth, read the - * Bluetooth developer guide.

+ * Bluetooth developer guide. *
* * {@see BluetoothDevice} diff --git a/core/java/android/net/LocalSocket.java b/core/java/android/net/LocalSocket.java index a374a869d13b..e14facb1abb5 100644 --- a/core/java/android/net/LocalSocket.java +++ b/core/java/android/net/LocalSocket.java @@ -25,7 +25,8 @@ import java.net.SocketOptions; /** * Creates a (non-server) socket in the UNIX-domain namespace. The interface - * here is not entirely unlike that of java.net.Socket + * here is not entirely unlike that of java.net.Socket. This class and the streams + * returned from it may be used from multiple threads. */ public class LocalSocket implements Closeable { diff --git a/core/java/android/net/http/HttpResponseCache.java b/core/java/android/net/http/HttpResponseCache.java index 188287f5b5db..729aff0ce278 100644 --- a/core/java/android/net/http/HttpResponseCache.java +++ b/core/java/android/net/http/HttpResponseCache.java @@ -36,7 +36,8 @@ import java.util.Map; * saving time and bandwidth. This class supports {@link * java.net.HttpURLConnection} and {@link javax.net.ssl.HttpsURLConnection}; * there is no platform-provided cache for {@code DefaultHttpClient} or - * {@code AndroidHttpClient}. + * {@code AndroidHttpClient}. Installation and instances are thread + * safe. * *

Installing an HTTP response cache

* Enable caching of all of your application's HTTP requests by installing the diff --git a/core/java/android/util/EventLog.java b/core/java/android/util/EventLog.java index 558b8f558236..6bda83d2b315 100644 --- a/core/java/android/util/EventLog.java +++ b/core/java/android/util/EventLog.java @@ -52,7 +52,7 @@ public class EventLog { private static HashMap sTagCodes = null; private static HashMap sTagNames = null; - /** A previously logged event read from the logs. */ + /** A previously logged event read from the logs. Instances are thread safe. */ public static final class Event { private final ByteBuffer mBuffer; diff --git a/media/java/android/media/MediaMetadataEditor.java b/media/java/android/media/MediaMetadataEditor.java index 566b93f7c2e9..877c8729543e 100644 --- a/media/java/android/media/MediaMetadataEditor.java +++ b/media/java/android/media/MediaMetadataEditor.java @@ -73,7 +73,8 @@ import android.util.SparseIntArray; /** * Applies all of the metadata changes that have been set since the MediaMetadataEditor instance - * was created or since {@link #clear()} was called. + * was created or since {@link #clear()} was called. Subclasses should synchronize on + * {@code this} for thread safety. */ public abstract void apply(); -- cgit v1.2.3-59-g8ed1b