From d3d065dc426633e7d235cf160db4f25309a79631 Mon Sep 17 00:00:00 2001 From: Olivier Gaillard Date: Thu, 5 Jul 2018 15:07:35 +0100 Subject: [PATCH] Add a getTransactionName method to Binder. This method transforms a binder call code to a human readable name. AIDL generator will have the ability to override this method. Test: n/a Bug: 111200705 Change-Id: Ic1d82e9b403ab40c8b625ca977a819ccd521dd97 --- core/java/android/os/Binder.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/core/java/android/os/Binder.java b/core/java/android/os/Binder.java index 5652d6dec8a5d..a81d16a6c5629 100644 --- a/core/java/android/os/Binder.java +++ b/core/java/android/os/Binder.java @@ -535,6 +535,20 @@ public class Binder implements IBinder { return false; } + /** + * Resolves a transaction code to a human readable name. + * + *

Default implementation is a stub that returns null. + *

AIDL generated code will return the original method name. + * + * @param transactionCode The code to resolve. + * @return A human readable name. + * @hide + */ + public @Nullable String getTransactionName(int transactionCode) { + return null; + } + /** * Implemented to call the more convenient version * {@link #dump(FileDescriptor, PrintWriter, String[])}. @@ -592,7 +606,7 @@ public class Binder implements IBinder { /** * Print the object's state into the given stream. - * + * * @param fd The raw file descriptor that the dump is being sent to. * @param fout The file to which you should dump your state. This will be * closed for you after you return.