From ff0a3642e4d1e50e26642352e8c796444237cd30 Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Thu, 25 Jan 2018 10:24:07 -0800 Subject: [PATCH] Add remaining missing HIDL SystemApi methods. A couple methods of Java classes which became SystemApis but were used are still @hide. Bug: 72480743 Test: hidl_test_java Change-Id: I0cb82384932ab1758fa7576b2125825c48a4a6c9 Merged-In: I0cb82384932ab1758fa7576b2125825c48a4a6c9 (cherry picked from commit adcb896fd6e476f277d6f1d20e2e50b8e81c4369) --- api/system-current.txt | 7 +++++++ core/java/android/os/HidlSupport.java | 3 ++- core/java/android/os/HwBinder.java | 21 +++++++++++++++++++-- core/java/android/os/IHwBinder.java | 14 ++++++++++++-- 4 files changed, 40 insertions(+), 5 deletions(-) diff --git a/api/system-current.txt b/api/system-current.txt index 148ea70f87d04..2420dfb7ec014 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -3164,12 +3164,17 @@ package android.os { public class HidlSupport { method public static boolean deepEquals(java.lang.Object, java.lang.Object); method public static int deepHashCode(java.lang.Object); + method public static int getPidIfSharable(); method public static boolean interfacesEqual(android.os.IHwInterface, java.lang.Object); } public abstract class HwBinder implements android.os.IHwBinder { method public static final void configureRpcThreadpool(long, boolean); + method public static void enableInstrumentation(); + method public static final android.os.IHwBinder getService(java.lang.String, java.lang.String) throws java.util.NoSuchElementException, android.os.RemoteException; + method public static final android.os.IHwBinder getService(java.lang.String, java.lang.String, boolean) throws java.util.NoSuchElementException, android.os.RemoteException; method public static final void joinRpcThreadpool(); + method public final void transact(int, android.os.HwParcel, android.os.HwParcel, int) throws android.os.RemoteException; } public class HwBlob { @@ -3269,6 +3274,8 @@ package android.os { public abstract interface IHwBinder { method public abstract boolean linkToDeath(android.os.IHwBinder.DeathRecipient, long); + method public abstract android.os.IHwInterface queryLocalInterface(java.lang.String); + method public abstract void transact(int, android.os.HwParcel, android.os.HwParcel, int) throws android.os.RemoteException; method public abstract boolean unlinkToDeath(android.os.IHwBinder.DeathRecipient); } diff --git a/core/java/android/os/HidlSupport.java b/core/java/android/os/HidlSupport.java index 335bf9d86fc74..91b796aba6550 100644 --- a/core/java/android/os/HidlSupport.java +++ b/core/java/android/os/HidlSupport.java @@ -212,9 +212,10 @@ public class HidlSupport { } /** - * Return PID of process if sharable to clients. + * Return PID of process only if on a non-user build. For debugging purposes. * @hide */ + @SystemApi public static native int getPidIfSharable(); /** @hide */ diff --git a/core/java/android/os/HwBinder.java b/core/java/android/os/HwBinder.java index 389a79b5cbe64..2a088a659b0fb 100644 --- a/core/java/android/os/HwBinder.java +++ b/core/java/android/os/HwBinder.java @@ -53,14 +53,30 @@ public abstract class HwBinder implements IHwBinder { public native final void registerService(String serviceName) throws RemoteException; - /** @hide */ + /** + * Returns the specified service from the hwservicemanager. Does not retry. + * + * @param iface fully-qualified interface name for example foo.bar@1.3::IBaz + * @param serviceName the instance name of the service for example default. + * @throws NoSuchElementException when the service is unavailable + * @hide + */ + @SystemApi public static final IHwBinder getService( String iface, String serviceName) throws RemoteException, NoSuchElementException { return getService(iface, serviceName, false /* retry */); } - /** @hide */ + /** + * Returns the specified service from the hwservicemanager. + * @param iface fully-qualified interface name for example foo.bar@1.3::IBaz + * @param serviceName the instance name of the service for example default. + * @param retry whether to wait for the service to start if it's not already started + * @throws NoSuchElementException when the service is unavailable + * @hide + */ + @SystemApi public static native final IHwBinder getService( String iface, String serviceName, @@ -111,6 +127,7 @@ public abstract class HwBinder implements IHwBinder { * Enable instrumentation if available. * @hide */ + @SystemApi public static void enableInstrumentation() { native_report_sysprop_change(); } diff --git a/core/java/android/os/IHwBinder.java b/core/java/android/os/IHwBinder.java index ce9f6c1654c26..0c592e1f04b8a 100644 --- a/core/java/android/os/IHwBinder.java +++ b/core/java/android/os/IHwBinder.java @@ -27,12 +27,22 @@ public interface IHwBinder { /** @hide */ public static final int FLAG_ONEWAY = 1; - /** @hide */ + /** + * Process a hwbinder transaction. + * + * @hide + */ + @SystemApi public void transact( int code, HwParcel request, HwParcel reply, int flags) throws RemoteException; - /** @hide */ + /** + * Return as IHwInterface instance only if this implements descriptor. + * @param descriptor for example foo.bar@1.0::IBaz + * @hide + */ + @SystemApi public IHwInterface queryLocalInterface(String descriptor); /**