Update calls to IInterface::asBinder()

to use the new static version.

Change-Id: I89a5988a0ac694ffc04d88cf939e8455bf925d4c
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp
index 889be74..4229538 100644
--- a/services/camera/libcameraservice/CameraService.cpp
+++ b/services/camera/libcameraservice/CameraService.cpp
@@ -755,7 +755,7 @@
         Mutex::Autolock lock(mServiceLock);
         sp<BasicClient> clientTmp;
         if (!canConnectUnsafe(cameraId, clientPackageName,
-                              cameraClient->asBinder(),
+                              IInterface::asBinder(cameraClient),
                               /*out*/clientTmp)) {
             return -EBUSY;
         } else if (client.get() != NULL) {
@@ -818,7 +818,7 @@
         Mutex::Autolock lock(mServiceLock);
         sp<BasicClient> clientTmp;
         if (!canConnectUnsafe(cameraId, clientPackageName,
-                              cameraClient->asBinder(),
+                              IInterface::asBinder(cameraClient),
                               /*out*/clientTmp)) {
             return -EBUSY;
         } else if (client.get() != NULL) {
@@ -888,7 +888,7 @@
         {
             sp<BasicClient> client;
             if (!canConnectUnsafe(cameraId, clientPackageName,
-                                  cameraCb->asBinder(),
+                                  IInterface::asBinder(cameraCb),
                                   /*out*/client)) {
                 return -EBUSY;
             }
@@ -961,7 +961,7 @@
         {
             sp<BasicClient> client;
             if (!canConnectUnsafe(cameraId, clientPackageName,
-                                  cameraCb->asBinder(),
+                                  IInterface::asBinder(cameraCb),
                                   /*out*/client)) {
                 return -EBUSY;
             }
@@ -1023,7 +1023,7 @@
 
     Vector<sp<ICameraServiceListener> >::iterator it, end;
     for (it = mListenerList.begin(); it != mListenerList.end(); ++it) {
-        if ((*it)->asBinder() == listener->asBinder()) {
+        if (IInterface::asBinder(*it) == IInterface::asBinder(listener)) {
             ALOGW("%s: Tried to add listener %p which was already subscribed",
                   __FUNCTION__, listener.get());
             return ALREADY_EXISTS;
@@ -1056,7 +1056,7 @@
 
     Vector<sp<ICameraServiceListener> >::iterator it;
     for (it = mListenerList.begin(); it != mListenerList.end(); ++it) {
-        if ((*it)->asBinder() == listener->asBinder()) {
+        if (IInterface::asBinder(*it) == IInterface::asBinder(listener)) {
             mListenerList.erase(it);
             return OK;
         }
@@ -1169,7 +1169,7 @@
             // Found our camera, clear and leave.
             LOG1("removeClient: clear pro %p", clientPro.get());
 
-            clientPro->getRemoteCallback()->asBinder()->unlinkToDeath(this);
+            IInterface::asBinder(clientPro->getRemoteCallback())->unlinkToDeath(this);
         }
     }
 
@@ -1364,7 +1364,7 @@
         int clientPid, uid_t clientUid,
         int servicePid) :
         CameraService::BasicClient(cameraService,
-                cameraClient != NULL ? cameraClient->asBinder() : NULL,
+                IInterface::asBinder(cameraClient),
                 clientPackageName,
                 cameraId, cameraFacing,
                 clientPid, clientUid,
@@ -1575,7 +1575,7 @@
         int clientPid,
         uid_t clientUid,
         int servicePid)
-        : CameraService::BasicClient(cameraService, remoteCallback->asBinder(),
+        : CameraService::BasicClient(cameraService, IInterface::asBinder(remoteCallback),
                 clientPackageName, cameraId, cameraFacing,
                 clientPid,  clientUid, servicePid)
 {
diff --git a/services/camera/libcameraservice/CameraService.h b/services/camera/libcameraservice/CameraService.h
index a7328cf..126d8d9 100644
--- a/services/camera/libcameraservice/CameraService.h
+++ b/services/camera/libcameraservice/CameraService.h
@@ -273,7 +273,7 @@
         }
 
         virtual sp<IBinder> asBinderWrapper() {
-            return asBinder();
+            return asBinder(this);
         }
 
     protected:
diff --git a/services/camera/libcameraservice/api1/Camera2Client.cpp b/services/camera/libcameraservice/api1/Camera2Client.cpp
index 8e40534..3bdeab2 100644
--- a/services/camera/libcameraservice/api1/Camera2Client.cpp
+++ b/services/camera/libcameraservice/api1/Camera2Client.cpp
@@ -166,7 +166,7 @@
     result.appendFormat("Client2[%d] (%p) Client: %s PID: %d, dump:\n",
             mCameraId,
             (getRemoteCallback() != NULL ?
-                    getRemoteCallback()->asBinder().get() : NULL),
+                    (IInterface::asBinder(getRemoteCallback()).get()) : NULL),
             String8(mClientPackageName).string(),
             mClientPid);
     result.append("  State: ");
@@ -532,7 +532,7 @@
     sp<IBinder> binder;
     sp<ANativeWindow> window;
     if (bufferProducer != 0) {
-        binder = bufferProducer->asBinder();
+        binder = IInterface::asBinder(bufferProducer);
         // Using controlledByApp flag to ensure that the buffer queue remains in
         // async mode for the old camera API, where many applications depend
         // on that behavior.
diff --git a/services/camera/libcameraservice/api1/CameraClient.cpp b/services/camera/libcameraservice/api1/CameraClient.cpp
index 2b17028..bbb2fe0 100644
--- a/services/camera/libcameraservice/api1/CameraClient.cpp
+++ b/services/camera/libcameraservice/api1/CameraClient.cpp
@@ -119,7 +119,7 @@
     size_t len = snprintf(buffer, SIZE, "Client[%d] (%p) PID: %d\n",
             mCameraId,
             (getRemoteCallback() != NULL ?
-                    getRemoteCallback()->asBinder().get() : NULL),
+                    IInterface::asBinder(getRemoteCallback()).get() : NULL),
             mClientPid);
     len = (len > SIZE - 1) ? SIZE - 1 : len;
     write(fd, buffer, len);
@@ -206,7 +206,7 @@
     }
 
     if (mRemoteCallback != 0 &&
-        (client->asBinder() == mRemoteCallback->asBinder())) {
+        (IInterface::asBinder(client) == IInterface::asBinder(mRemoteCallback))) {
         LOG1("Connect to the same client");
         return NO_ERROR;
     }
@@ -329,7 +329,7 @@
     sp<IBinder> binder;
     sp<ANativeWindow> window;
     if (bufferProducer != 0) {
-        binder = bufferProducer->asBinder();
+        binder = IInterface::asBinder(bufferProducer);
         // Using controlledByApp flag to ensure that the buffer queue remains in
         // async mode for the old camera API, where many applications depend
         // on that behavior.
diff --git a/services/camera/libcameraservice/api2/CameraDeviceClient.cpp b/services/camera/libcameraservice/api2/CameraDeviceClient.cpp
index c6d62e7..920adf6 100644
--- a/services/camera/libcameraservice/api2/CameraDeviceClient.cpp
+++ b/services/camera/libcameraservice/api2/CameraDeviceClient.cpp
@@ -43,7 +43,7 @@
         uid_t clientUid,
         int servicePid) :
     BasicClient(cameraService,
-            remoteCallback != NULL ? remoteCallback->asBinder() : NULL,
+            IInterface::asBinder(remoteCallback),
             clientPackageName,
             cameraId,
             cameraFacing,
@@ -163,7 +163,7 @@
             if (surface == 0) continue;
 
             sp<IGraphicBufferProducer> gbp = surface->getIGraphicBufferProducer();
-            int idx = mStreamMap.indexOfKey(gbp->asBinder());
+            int idx = mStreamMap.indexOfKey(IInterface::asBinder(gbp));
 
             // Trying to submit request with surface that wasn't created
             if (idx == NAME_NOT_FOUND) {
@@ -333,7 +333,7 @@
 
     // Don't create multiple streams for the same target surface
     {
-        ssize_t index = mStreamMap.indexOfKey(bufferProducer->asBinder());
+        ssize_t index = mStreamMap.indexOfKey(IInterface::asBinder(bufferProducer));
         if (index != NAME_NOT_FOUND) {
             ALOGW("%s: Camera %d: Buffer producer already has a stream for it "
                   "(ID %zd)",
@@ -359,7 +359,7 @@
         useAsync = true;
     }
 
-    sp<IBinder> binder = bufferProducer->asBinder();
+    sp<IBinder> binder = IInterface::asBinder(bufferProducer);
     sp<ANativeWindow> anw = new Surface(bufferProducer, useAsync);
 
     // TODO: remove w,h,f since we are ignoring them
@@ -517,7 +517,7 @@
     result.appendFormat("CameraDeviceClient[%d] (%p) dump:\n",
             mCameraId,
             (getRemoteCallback() != NULL ?
-                    getRemoteCallback()->asBinder().get() : NULL) );
+                    IInterface::asBinder(getRemoteCallback()).get() : NULL) );
     result.appendFormat("  Current client: %s (PID %d, UID %u)\n",
             String8(mClientPackageName).string(),
             mClientPid, mClientUid);
diff --git a/services/camera/libcameraservice/api_pro/ProCamera2Client.cpp b/services/camera/libcameraservice/api_pro/ProCamera2Client.cpp
index 9c8f0f4..59e5083 100644
--- a/services/camera/libcameraservice/api_pro/ProCamera2Client.cpp
+++ b/services/camera/libcameraservice/api_pro/ProCamera2Client.cpp
@@ -276,7 +276,7 @@
     sp<IBinder> binder;
     sp<ANativeWindow> window;
     if (bufferProducer != 0) {
-        binder = bufferProducer->asBinder();
+        binder = IInterface::asBinder(bufferProducer);
         window = new Surface(bufferProducer);
     }
 
@@ -335,7 +335,7 @@
     result.appendFormat("ProCamera2Client[%d] (%p) PID: %d, dump:\n",
             mCameraId,
             (getRemoteCallback() != NULL ?
-                    getRemoteCallback()->asBinder().get() : NULL),
+                    IInterface::asBinder(getRemoteCallback()).get() : NULL),
             mClientPid);
     result.append("  State:\n");
     write(fd, result.string(), result.size());
diff --git a/services/camera/libcameraservice/common/Camera2ClientBase.cpp b/services/camera/libcameraservice/common/Camera2ClientBase.cpp
index eb91bd4..453c8bd 100644
--- a/services/camera/libcameraservice/common/Camera2ClientBase.cpp
+++ b/services/camera/libcameraservice/common/Camera2ClientBase.cpp
@@ -129,7 +129,7 @@
     result.appendFormat("Camera2ClientBase[%d] (%p) PID: %d, dump:\n",
             TClientBase::mCameraId,
             (TClientBase::getRemoteCallback() != NULL ?
-                    TClientBase::getRemoteCallback()->asBinder().get() : NULL),
+                    IInterface::asBinder(TClientBase::getRemoteCallback()).get() : NULL),
             TClientBase::mClientPid);
     result.append("  State: ");
 
diff --git a/services/camera/libcameraservice/common/Camera2ClientBase.h b/services/camera/libcameraservice/common/Camera2ClientBase.h
index d198e4e..e09c1b5 100644
--- a/services/camera/libcameraservice/common/Camera2ClientBase.h
+++ b/services/camera/libcameraservice/common/Camera2ClientBase.h
@@ -111,7 +111,7 @@
     pid_t mInitialClientPid;
 
     virtual sp<IBinder> asBinderWrapper() {
-        return IInterface::asBinder();
+        return IInterface::asBinder(this);
     }
 
     virtual status_t      dumpDevice(int fd, const Vector<String16>& args);