summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author David Su <dysu@google.com> 2019-12-18 18:19:58 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2019-12-18 18:19:58 +0000
commit7381525076e81166f33e16ea74d16a88c95be2a3 (patch)
treecc34132ef3aaedd72851b242e878dba888509b84
parent1385dca8f6f8e582d867c817432447286df54e2e (diff)
parent0def143e45ca4d3a436bfc3e3d6d5696dfccb01d (diff)
Merge "Fix android.util.CloseGuard sample usage"
-rw-r--r--core/java/android/util/CloseGuard.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/core/java/android/util/CloseGuard.java b/core/java/android/util/CloseGuard.java
index c39a6c9aac93..6ac769623bff 100644
--- a/core/java/android/util/CloseGuard.java
+++ b/core/java/android/util/CloseGuard.java
@@ -38,6 +38,11 @@ import android.annotation.NonNull;
* public void cleanup() {
* guard.close();
* ...;
+ * if (Build.VERSION.SDK_INT >= 28) {
+ * Reference.reachabilityFence(this);
+ * }
+ * // For full correctness in the absence of a close() call, other methods may also need
+ * // reachabilityFence() calls.
* }
*
* protected void finalize() throws Throwable {
@@ -75,7 +80,9 @@ import android.annotation.NonNull;
* public void cleanup() {
* guard.close();
* ...;
- * Reference.reachabilityFence(this);
+ * if (Build.VERSION.SDK_INT >= 28) {
+ * Reference.reachabilityFence(this);
+ * }
* // For full correctness in the absence of a close() call, other methods may also need
* // reachabilityFence() calls.
* }