summaryrefslogtreecommitdiff
path: root/core/java/android/os/IBinder.java
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2017-07-31 17:38:53 -0700
committerDianne Hackborn <hackbod@google.com>2017-07-31 17:39:17 -0700
commit4cd650c0085e6dd20d3f46c5b668e54537f887cf (patch)
tree6c58e8924a401651230eec4e15f7e133b64d0fb8 /core/java/android/os/IBinder.java
parent3072aa76c9ee475bdc76d16987855a7b7feffff6 (diff)
Fix issue #64224738: Document return value of IBinder.transact()
Also add appropriate @NonNull and @Nullable annotations. Test: built Change-Id: I22de48105ef685baf594cfc004dd3e27e2ba09e9
Diffstat (limited to 'core/java/android/os/IBinder.java')
-rw-r--r--core/java/android/os/IBinder.java29
1 files changed, 19 insertions, 10 deletions
diff --git a/core/java/android/os/IBinder.java b/core/java/android/os/IBinder.java
index f762a052cb41..20d8276c895e 100644
--- a/core/java/android/os/IBinder.java
+++ b/core/java/android/os/IBinder.java
@@ -16,6 +16,9 @@
package android.os;
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+
import java.io.FileDescriptor;
/**
@@ -166,7 +169,7 @@ public interface IBinder {
/**
* Get the canonical name of the interface supported by this binder.
*/
- public String getInterfaceDescriptor() throws RemoteException;
+ public @Nullable String getInterfaceDescriptor() throws RemoteException;
/**
* Check to see if the object still exists.
@@ -192,7 +195,7 @@ public interface IBinder {
* to instantiate a proxy class to marshall calls through
* the transact() method.
*/
- public IInterface queryLocalInterface(String descriptor);
+ public @Nullable IInterface queryLocalInterface(@NonNull String descriptor);
/**
* Print the object's state into the given stream.
@@ -200,7 +203,7 @@ public interface IBinder {
* @param fd The raw file descriptor that the dump is being sent to.
* @param args additional arguments to the dump request.
*/
- public void dump(FileDescriptor fd, String[] args) throws RemoteException;
+ public void dump(@NonNull FileDescriptor fd, @Nullable String[] args) throws RemoteException;
/**
* Like {@link #dump(FileDescriptor, String[])} but always executes
@@ -210,7 +213,8 @@ public interface IBinder {
* @param fd The raw file descriptor that the dump is being sent to.
* @param args additional arguments to the dump request.
*/
- public void dumpAsync(FileDescriptor fd, String[] args) throws RemoteException;
+ public void dumpAsync(@NonNull FileDescriptor fd, @Nullable String[] args)
+ throws RemoteException;
/**
* Execute a shell command on this object. This may be performed asynchrously from the caller;
@@ -224,9 +228,10 @@ public interface IBinder {
* @param resultReceiver Called when the command has finished executing, with the result code.
* @hide
*/
- public void shellCommand(FileDescriptor in, FileDescriptor out, FileDescriptor err,
- String[] args, ShellCallback shellCallback,
- ResultReceiver resultReceiver) throws RemoteException;
+ public void shellCommand(@Nullable FileDescriptor in, @Nullable FileDescriptor out,
+ @Nullable FileDescriptor err,
+ @NonNull String[] args, @Nullable ShellCallback shellCallback,
+ @NonNull ResultReceiver resultReceiver) throws RemoteException;
/**
* Perform a generic operation with the object.
@@ -241,8 +246,12 @@ public interface IBinder {
* null if you are not interested in the return value.
* @param flags Additional operation flags. Either 0 for a normal
* RPC, or {@link #FLAG_ONEWAY} for a one-way RPC.
+ *
+ * @return Returns the result from {@link Binder#onTransact}. A successful call
+ * generally returns true; false generally means the transaction code was not
+ * understood.
*/
- public boolean transact(int code, Parcel data, Parcel reply, int flags)
+ public boolean transact(int code, @NonNull Parcel data, @Nullable Parcel reply, int flags)
throws RemoteException;
/**
@@ -271,7 +280,7 @@ public interface IBinder {
*
* @see #unlinkToDeath
*/
- public void linkToDeath(DeathRecipient recipient, int flags)
+ public void linkToDeath(@NonNull DeathRecipient recipient, int flags)
throws RemoteException;
/**
@@ -292,5 +301,5 @@ public interface IBinder {
* exception will <em>not</em> be thrown, and you will receive a false
* return value instead.
*/
- public boolean unlinkToDeath(DeathRecipient recipient, int flags);
+ public boolean unlinkToDeath(@NonNull DeathRecipient recipient, int flags);
}