From 70ba0ac09e2afdf5ff0d1de3e8477be0c206f492 Mon Sep 17 00:00:00 2001 From: Ytai Ben-Tsvi Date: Fri, 17 Jan 2020 10:57:53 -0800 Subject: [PATCH] Improve HidlMemory annotation Change-Id: I6f977f52b96a9a2dd1c47b027d5f314ff92f473f Bug: 147287669 --- api/system-current.txt | 2 +- api/test-current.txt | 2 +- core/java/android/os/HidlMemory.java | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/api/system-current.txt b/api/system-current.txt index 451d2ab4a7950..8f4981a34a637 100755 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -7099,7 +7099,7 @@ package android.os { method @Nullable public android.os.NativeHandle getHandle(); method @NonNull public String getName(); method public long getSize(); - method @NonNull public android.os.NativeHandle releaseHandle(); + method @Nullable public android.os.NativeHandle releaseHandle(); } public class HidlSupport { diff --git a/api/test-current.txt b/api/test-current.txt index 28119e3c120be..20b122cf21304 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -1889,7 +1889,7 @@ package android.os { method @Nullable public android.os.NativeHandle getHandle(); method @NonNull public String getName(); method public long getSize(); - method @NonNull public android.os.NativeHandle releaseHandle(); + method @Nullable public android.os.NativeHandle releaseHandle(); } public abstract class HwBinder implements android.os.IHwBinder { diff --git a/core/java/android/os/HidlMemory.java b/core/java/android/os/HidlMemory.java index aeb65892a4251..02d1e0ce91090 100644 --- a/core/java/android/os/HidlMemory.java +++ b/core/java/android/os/HidlMemory.java @@ -85,11 +85,11 @@ public class HidlMemory implements Closeable { } /** - * Disowns the underlying handle and returns it. This object becomes invalid. + * Disowns the underlying handle and returns it. The underlying handle becomes null. * * @return The underlying handle. */ - @NonNull + @Nullable public NativeHandle releaseHandle() { NativeHandle handle = mHandle; mHandle = null;