Merge "HwBinder.setTrebleTestingOverride" am: 3804ae082c am: 8b6e909cbf am: cd5a2a3037

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1358164

Change-Id: I8c06adefb681d1e00dde180221c96edd96778581
diff --git a/core/java/android/os/HwBinder.java b/core/java/android/os/HwBinder.java
index 7c42c36..64ab1d7 100644
--- a/core/java/android/os/HwBinder.java
+++ b/core/java/android/os/HwBinder.java
@@ -96,6 +96,15 @@
         throws RemoteException, NoSuchElementException;
 
     /**
+     * This allows getService to bypass the VINTF manifest for testing only.
+     *
+     * Disabled on user builds.
+     * @hide
+     */
+    public static native final void setTrebleTestingOverride(
+            boolean testingOverride);
+
+    /**
      * Configures how many threads the process-wide hwbinder threadpool
      * has to process incoming requests.
      *
diff --git a/core/jni/android_os_HwBinder.cpp b/core/jni/android_os_HwBinder.cpp
index b6427c9a..48f33a6 100644
--- a/core/jni/android_os_HwBinder.cpp
+++ b/core/jni/android_os_HwBinder.cpp
@@ -339,6 +339,10 @@
     return JHwRemoteBinder::NewObject(env, service);
 }
 
+void JHwBinder_native_setTrebleTestingOverride(JNIEnv*, jclass, jboolean testingOverride) {
+    hardware::details::setTrebleTestingOverride(testingOverride);
+}
+
 void JHwBinder_native_configureRpcThreadpool(JNIEnv *, jclass,
         jlong maxThreads, jboolean callerWillJoin) {
     CHECK(maxThreads > 0);
@@ -368,6 +372,9 @@
     { "getService", "(Ljava/lang/String;Ljava/lang/String;Z)L" PACKAGE_PATH "/IHwBinder;",
         (void *)JHwBinder_native_getService },
 
+    { "setTrebleTestingOverride", "(Z)V",
+        (void *)JHwBinder_native_setTrebleTestingOverride },
+
     { "configureRpcThreadpool", "(JZ)V",
         (void *)JHwBinder_native_configureRpcThreadpool },