libbinder_ndk: pointer equality of AIBinder.

This means that there is always a 1-1 correspondance between any object
(remote or local) and its AIBinder in a given process. Two cases:

1). For local objects created by the libbinder_ndk:

    AIBinder_new is called once. Whenever a binder is sent and then
    later received, ABBinderTag is used to identify and recover the
    object immediately.

2). For local objects created by libbinder and all remote objects
regardless of their origin (this is what this CL fixes):

    ABpBinderTag is used to tag the object. This tag holds a weak
    pointer to ABpBinder which is used to recover the object.

Bug: 111445392
Test: ./ndk/runtests.sh

Change-Id: I0d52ed5e356b26a62cfbc8e822f274c878d1112d
diff --git a/libs/binder/ndk/AIBinder_internal.h b/libs/binder/ndk/AIBinder_internal.h
index f4c3249..30009d2 100644
--- a/libs/binder/ndk/AIBinder_internal.h
+++ b/libs/binder/ndk/AIBinder_internal.h
@@ -81,13 +81,18 @@
     void* mUserData;
 };
 
-// This binder object may be remote or local (even though it is 'Bp'). It is not yet associated with
-// a class.
+// This binder object may be remote or local (even though it is 'Bp'). The implication if it is
+// local is that it is an IBinder object created outside of the domain of libbinder_ndk.
 struct ABpBinder : public AIBinder, public ::android::BpRefBase {
-    static ::android::sp<AIBinder> fromBinder(const ::android::sp<::android::IBinder>& binder);
+    // Looks up to see if this object has or is an existing ABBinder or ABpBinder object, otherwise
+    // it creates an ABpBinder object.
+    static ::android::sp<AIBinder> lookupOrCreateFromBinder(
+            const ::android::sp<::android::IBinder>& binder);
 
     virtual ~ABpBinder();
 
+    void onLastStrongRef(const void* id) override;
+
     ::android::sp<::android::IBinder> getBinder() override { return remote(); }
     ABpBinder* asABpBinder() override { return this; }