diff options
| author | David Su <dysu@google.com> | 2019-12-18 10:26:02 -0800 |
|---|---|---|
| committer | android-build-merger <android-build-merger@google.com> | 2019-12-18 10:26:02 -0800 |
| commit | 66b0e7d15028ca3d9ef96630aa7307040a8ac6cc (patch) | |
| tree | 097325bed4512863af4452dded2dede96fe1d8b5 /core/java/android | |
| parent | 068a9faf3df085468c301443ed5c5d7e828c58ab (diff) | |
| parent | 7381525076e81166f33e16ea74d16a88c95be2a3 (diff) | |
Merge "Fix android.util.CloseGuard sample usage"
am: 7381525076
Change-Id: I4e69d9638ca69be5896bfeb0c3d950d340294cb5
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/util/CloseGuard.java | 9 |
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. * } |
