libbinder_ndk: test Bp destruction

When sending a binder to another process, there are two things that
delay the destruction:
- there is a separate queue, flushed with 'flushCommands' that must be
emptied in the remote process
- the client thread must process the refcount loss asynchronously

This CL works around both of these problems by explicitly flushing
commands and waiting for the thread to process the refcount.

Bug: 148287051
Test: libbinder_ndk_unit_test
Change-Id: I2687b429faae659d80406f0b418c96a1eb40e9bd
diff --git a/libs/binder/ndk/test/Android.bp b/libs/binder/ndk/test/Android.bp
index e598eec..513d8c2 100644
--- a/libs/binder/ndk/test/Android.bp
+++ b/libs/binder/ndk/test/Android.bp
@@ -59,6 +59,9 @@
     name: "libbinder_ndk_unit_test",
     defaults: ["test_libbinder_ndk_test_defaults"],
     srcs: ["libbinder_ndk_unit_test.cpp"],
+    static_libs: [
+        "IBinderNdkUnitTest-ndk_platform",
+    ],
     test_suites: ["general-tests"],
     require_root: true,
 
@@ -93,3 +96,11 @@
         "IBinderVendorDoubleLoadTest.aidl",
     ],
 }
+
+aidl_interface {
+    name: "IBinderNdkUnitTest",
+    srcs: [
+        "IBinderNdkUnitTest.aidl",
+        "IEmpty.aidl",
+    ],
+}