From 06b46062d2f8bc82ca3061a23d197734ae51918b Mon Sep 17 00:00:00 2001 From: Marco Nelissen Date: Fri, 14 Nov 2014 07:58:25 -0800 Subject: Update calls to IInterface::asBinder() to use the new static version. Change-Id: I89a5988a0ac694ffc04d88cf939e8455bf925d4c --- camera/Camera.cpp | 4 ++-- camera/CameraBase.cpp | 4 ++-- camera/ICamera.cpp | 8 +++---- camera/ICameraClient.cpp | 4 ++-- camera/ICameraRecordingProxy.cpp | 4 ++-- camera/ICameraRecordingProxyListener.cpp | 2 +- camera/ICameraService.cpp | 20 ++++++++-------- camera/IProCameraUser.cpp | 4 ++-- camera/camera2/CaptureRequest.cpp | 2 +- camera/camera2/ICameraDeviceUser.cpp | 2 +- drm/common/IDrmManagerService.cpp | 3 +-- drm/libdrmframework/DrmManagerClientImpl.cpp | 2 +- media/common_time/ICommonClock.cpp | 4 ++-- media/libmedia/AudioEffect.cpp | 4 ++-- media/libmedia/AudioRecord.cpp | 6 ++--- media/libmedia/AudioTrack.cpp | 6 ++--- media/libmedia/IAudioFlinger.cpp | 18 +++++++------- media/libmedia/IAudioPolicyService.cpp | 2 +- media/libmedia/IAudioTrack.cpp | 6 ++--- media/libmedia/IDrm.cpp | 2 +- media/libmedia/IEffect.cpp | 2 +- media/libmedia/IHDCP.cpp | 2 +- media/libmedia/IMediaDeathNotifier.cpp | 2 +- media/libmedia/IMediaLogService.cpp | 4 ++-- media/libmedia/IMediaMetadataRetriever.cpp | 6 ++--- media/libmedia/IMediaPlayer.cpp | 8 +++---- media/libmedia/IMediaPlayerService.cpp | 28 +++++++++++----------- media/libmedia/IMediaRecorder.cpp | 10 ++++---- media/libmedia/IOMX.cpp | 8 +++---- media/libmedia/IRemoteDisplayClient.cpp | 2 +- media/libmedia/IStreamSource.cpp | 4 ++-- media/libmedia/mediametadataretriever.cpp | 2 +- media/libmediaplayerservice/Drm.cpp | 4 ++-- media/libmediaplayerservice/MediaPlayerService.cpp | 3 +-- media/libstagefright/ACodec.cpp | 4 ++-- media/libstagefright/CameraSource.cpp | 6 ++--- media/libstagefright/OMXClient.cpp | 2 +- media/libstagefright/TimedEventQueue.cpp | 2 +- media/libstagefright/omx/OMX.cpp | 8 +++---- services/audioflinger/AudioFlinger.cpp | 2 +- services/audioflinger/Threads.cpp | 2 +- services/audiopolicy/AudioPolicyService.cpp | 2 +- services/camera/libcameraservice/CameraService.cpp | 18 +++++++------- services/camera/libcameraservice/CameraService.h | 2 +- .../camera/libcameraservice/api1/Camera2Client.cpp | 4 ++-- .../camera/libcameraservice/api1/CameraClient.cpp | 6 ++--- .../libcameraservice/api2/CameraDeviceClient.cpp | 10 ++++---- .../libcameraservice/api_pro/ProCamera2Client.cpp | 4 ++-- .../libcameraservice/common/Camera2ClientBase.cpp | 2 +- .../libcameraservice/common/Camera2ClientBase.h | 2 +- services/soundtrigger/SoundTriggerHwService.cpp | 4 ++-- soundtrigger/ISoundTrigger.cpp | 4 ++-- soundtrigger/ISoundTriggerClient.cpp | 6 ++--- soundtrigger/ISoundTriggerHwService.cpp | 4 ++-- soundtrigger/SoundTrigger.cpp | 4 ++-- 55 files changed, 143 insertions(+), 147 deletions(-) diff --git a/camera/Camera.cpp b/camera/Camera.cpp index 85f44f0..3a9fb4c 100644 --- a/camera/Camera.cpp +++ b/camera/Camera.cpp @@ -55,7 +55,7 @@ sp Camera::create(const sp& camera) if (camera->connect(c) == NO_ERROR) { c->mStatus = NO_ERROR; c->mCamera = camera; - camera->asBinder()->linkToDeath(c); + IInterface::asBinder(camera)->linkToDeath(c); return c; } return 0; @@ -93,7 +93,7 @@ status_t Camera::connectLegacy(int cameraId, int halVersion, clientUid, /*out*/c->mCamera); } if (status == OK && c->mCamera != 0) { - c->mCamera->asBinder()->linkToDeath(c); + IInterface::asBinder(c->mCamera)->linkToDeath(c); c->mStatus = NO_ERROR; camera = c; } else { diff --git a/camera/CameraBase.cpp b/camera/CameraBase.cpp index 04694cd..65a1a47 100644 --- a/camera/CameraBase.cpp +++ b/camera/CameraBase.cpp @@ -107,7 +107,7 @@ sp CameraBase::connect(int cameraId, /*out*/ c->mCamera); } if (status == OK && c->mCamera != 0) { - c->mCamera->asBinder()->linkToDeath(c); + IInterface::asBinder(c->mCamera)->linkToDeath(c); c->mStatus = NO_ERROR; } else { ALOGW("An error occurred while connecting to camera: %d", cameraId); @@ -122,7 +122,7 @@ void CameraBase::disconnect() ALOGV("%s: disconnect", __FUNCTION__); if (mCamera != 0) { mCamera->disconnect(); - mCamera->asBinder()->unlinkToDeath(this); + IInterface::asBinder(mCamera)->unlinkToDeath(this); mCamera = 0; } ALOGV("%s: disconnect (done)", __FUNCTION__); diff --git a/camera/ICamera.cpp b/camera/ICamera.cpp index ca31c65..9943be6 100644 --- a/camera/ICamera.cpp +++ b/camera/ICamera.cpp @@ -75,7 +75,7 @@ public: ALOGV("setPreviewTarget"); Parcel data, reply; data.writeInterfaceToken(ICamera::getInterfaceDescriptor()); - sp b(bufferProducer != NULL ? bufferProducer->asBinder() : NULL); + sp b(IInterface::asBinder(bufferProducer)); data.writeStrongBinder(b); remote()->transact(SET_PREVIEW_TARGET, data, &reply); return reply.readInt32(); @@ -98,7 +98,7 @@ public: ALOGV("setPreviewCallbackTarget"); Parcel data, reply; data.writeInterfaceToken(ICamera::getInterfaceDescriptor()); - sp b(callbackProducer->asBinder()); + sp b(IInterface::asBinder(callbackProducer)); data.writeStrongBinder(b); remote()->transact(SET_PREVIEW_CALLBACK_TARGET, data, &reply); return reply.readInt32(); @@ -147,7 +147,7 @@ public: ALOGV("releaseRecordingFrame"); Parcel data, reply; data.writeInterfaceToken(ICamera::getInterfaceDescriptor()); - data.writeStrongBinder(mem->asBinder()); + data.writeStrongBinder(IInterface::asBinder(mem)); remote()->transact(RELEASE_RECORDING_FRAME, data, &reply); } @@ -250,7 +250,7 @@ public: { Parcel data, reply; data.writeInterfaceToken(ICamera::getInterfaceDescriptor()); - data.writeStrongBinder(cameraClient->asBinder()); + data.writeStrongBinder(IInterface::asBinder(cameraClient)); remote()->transact(CONNECT, data, &reply); return reply.readInt32(); } diff --git a/camera/ICameraClient.cpp b/camera/ICameraClient.cpp index 205c8ba..179a341 100644 --- a/camera/ICameraClient.cpp +++ b/camera/ICameraClient.cpp @@ -58,7 +58,7 @@ public: Parcel data, reply; data.writeInterfaceToken(ICameraClient::getInterfaceDescriptor()); data.writeInt32(msgType); - data.writeStrongBinder(imageData->asBinder()); + data.writeStrongBinder(IInterface::asBinder(imageData)); if (metadata) { data.writeInt32(metadata->number_of_faces); data.write(metadata->faces, sizeof(camera_face_t) * metadata->number_of_faces); @@ -74,7 +74,7 @@ public: data.writeInterfaceToken(ICameraClient::getInterfaceDescriptor()); data.writeInt64(timestamp); data.writeInt32(msgType); - data.writeStrongBinder(imageData->asBinder()); + data.writeStrongBinder(IInterface::asBinder(imageData)); remote()->transact(DATA_CALLBACK_TIMESTAMP, data, &reply, IBinder::FLAG_ONEWAY); } }; diff --git a/camera/ICameraRecordingProxy.cpp b/camera/ICameraRecordingProxy.cpp index 7223b6d..3dc0ffb 100644 --- a/camera/ICameraRecordingProxy.cpp +++ b/camera/ICameraRecordingProxy.cpp @@ -45,7 +45,7 @@ public: ALOGV("startRecording"); Parcel data, reply; data.writeInterfaceToken(ICameraRecordingProxy::getInterfaceDescriptor()); - data.writeStrongBinder(listener->asBinder()); + data.writeStrongBinder(IInterface::asBinder(listener)); remote()->transact(START_RECORDING, data, &reply); return reply.readInt32(); } @@ -63,7 +63,7 @@ public: ALOGV("releaseRecordingFrame"); Parcel data, reply; data.writeInterfaceToken(ICameraRecordingProxy::getInterfaceDescriptor()); - data.writeStrongBinder(mem->asBinder()); + data.writeStrongBinder(IInterface::asBinder(mem)); remote()->transact(RELEASE_RECORDING_FRAME, data, &reply); } }; diff --git a/camera/ICameraRecordingProxyListener.cpp b/camera/ICameraRecordingProxyListener.cpp index cb17f19..cf848fc 100644 --- a/camera/ICameraRecordingProxyListener.cpp +++ b/camera/ICameraRecordingProxyListener.cpp @@ -42,7 +42,7 @@ public: data.writeInterfaceToken(ICameraRecordingProxyListener::getInterfaceDescriptor()); data.writeInt64(timestamp); data.writeInt32(msgType); - data.writeStrongBinder(imageData->asBinder()); + data.writeStrongBinder(IInterface::asBinder(imageData)); remote()->transact(DATA_CALLBACK_TIMESTAMP, data, &reply, IBinder::FLAG_ONEWAY); } }; diff --git a/camera/ICameraService.cpp b/camera/ICameraService.cpp index 5485205..fc3e437 100644 --- a/camera/ICameraService.cpp +++ b/camera/ICameraService.cpp @@ -172,7 +172,7 @@ public: { Parcel data, reply; data.writeInterfaceToken(ICameraService::getInterfaceDescriptor()); - data.writeStrongBinder(cameraClient->asBinder()); + data.writeStrongBinder(IInterface::asBinder(cameraClient)); data.writeInt32(cameraId); data.writeString16(clientPackageName); data.writeInt32(clientUid); @@ -194,7 +194,7 @@ public: { Parcel data, reply; data.writeInterfaceToken(ICameraService::getInterfaceDescriptor()); - data.writeStrongBinder(cameraClient->asBinder()); + data.writeStrongBinder(IInterface::asBinder(cameraClient)); data.writeInt32(cameraId); data.writeInt32(halVersion); data.writeString16(clientPackageName); @@ -217,7 +217,7 @@ public: { Parcel data, reply; data.writeInterfaceToken(ICameraService::getInterfaceDescriptor()); - data.writeStrongBinder(cameraCb->asBinder()); + data.writeStrongBinder(IInterface::asBinder(cameraCb)); data.writeInt32(cameraId); data.writeString16(clientPackageName); data.writeInt32(clientUid); @@ -242,7 +242,7 @@ public: { Parcel data, reply; data.writeInterfaceToken(ICameraService::getInterfaceDescriptor()); - data.writeStrongBinder(cameraCb->asBinder()); + data.writeStrongBinder(IInterface::asBinder(cameraCb)); data.writeInt32(cameraId); data.writeString16(clientPackageName); data.writeInt32(clientUid); @@ -260,7 +260,7 @@ public: { Parcel data, reply; data.writeInterfaceToken(ICameraService::getInterfaceDescriptor()); - data.writeStrongBinder(listener->asBinder()); + data.writeStrongBinder(IInterface::asBinder(listener)); remote()->transact(BnCameraService::ADD_LISTENER, data, &reply); if (readExceptionCode(reply)) return -EPROTO; @@ -271,7 +271,7 @@ public: { Parcel data, reply; data.writeInterfaceToken(ICameraService::getInterfaceDescriptor()); - data.writeStrongBinder(listener->asBinder()); + data.writeStrongBinder(IInterface::asBinder(listener)); remote()->transact(BnCameraService::REMOVE_LISTENER, data, &reply); if (readExceptionCode(reply)) return -EPROTO; @@ -384,7 +384,7 @@ status_t BnCameraService::onTransact( reply->writeInt32(status); if (camera != NULL) { reply->writeInt32(1); - reply->writeStrongBinder(camera->asBinder()); + reply->writeStrongBinder(IInterface::asBinder(camera)); } else { reply->writeInt32(0); } @@ -404,7 +404,7 @@ status_t BnCameraService::onTransact( reply->writeInt32(status); if (camera != NULL) { reply->writeInt32(1); - reply->writeStrongBinder(camera->asBinder()); + reply->writeStrongBinder(IInterface::asBinder(camera)); } else { reply->writeInt32(0); } @@ -424,7 +424,7 @@ status_t BnCameraService::onTransact( reply->writeInt32(status); if (camera != NULL) { reply->writeInt32(1); - reply->writeStrongBinder(camera->asBinder()); + reply->writeStrongBinder(IInterface::asBinder(camera)); } else { reply->writeInt32(0); } @@ -484,7 +484,7 @@ status_t BnCameraService::onTransact( reply->writeInt32(status); if (camera != NULL) { reply->writeInt32(1); - reply->writeStrongBinder(camera->asBinder()); + reply->writeStrongBinder(IInterface::asBinder(camera)); } else { reply->writeInt32(0); } diff --git a/camera/IProCameraUser.cpp b/camera/IProCameraUser.cpp index 8f22124..9bd7597 100644 --- a/camera/IProCameraUser.cpp +++ b/camera/IProCameraUser.cpp @@ -65,7 +65,7 @@ public: { Parcel data, reply; data.writeInterfaceToken(IProCameraUser::getInterfaceDescriptor()); - data.writeStrongBinder(cameraClient->asBinder()); + data.writeStrongBinder(IInterface::asBinder(cameraClient)); remote()->transact(CONNECT, data, &reply); return reply.readInt32(); } @@ -150,7 +150,7 @@ public: data.writeInt32(height); data.writeInt32(format); - sp b(bufferProducer->asBinder()); + sp b(IInterface::asBinder(bufferProducer)); data.writeStrongBinder(b); remote()->transact(CREATE_STREAM, data, &reply); diff --git a/camera/camera2/CaptureRequest.cpp b/camera/camera2/CaptureRequest.cpp index 57e5319..d5e1c5b 100644 --- a/camera/camera2/CaptureRequest.cpp +++ b/camera/camera2/CaptureRequest.cpp @@ -106,7 +106,7 @@ status_t CaptureRequest::writeToParcel(Parcel* parcel) const { sp binder; if (surface != 0) { - binder = surface->getIGraphicBufferProducer()->asBinder(); + binder = IInterface::asBinder(surface->getIGraphicBufferProducer()); } // not sure if readParcelableArray does this, hard to tell from source diff --git a/camera/camera2/ICameraDeviceUser.cpp b/camera/camera2/ICameraDeviceUser.cpp index ff4a0c2..35345d2 100644 --- a/camera/camera2/ICameraDeviceUser.cpp +++ b/camera/camera2/ICameraDeviceUser.cpp @@ -219,7 +219,7 @@ public: data.writeInt32(1); // marker that bufferProducer is not null data.writeString16(String16("unknown_name")); // name of surface - sp b(bufferProducer->asBinder()); + sp b(IInterface::asBinder(bufferProducer)); data.writeStrongBinder(b); remote()->transact(CREATE_STREAM, data, &reply); diff --git a/drm/common/IDrmManagerService.cpp b/drm/common/IDrmManagerService.cpp index 36cb612..3f62ed7 100644 --- a/drm/common/IDrmManagerService.cpp +++ b/drm/common/IDrmManagerService.cpp @@ -148,8 +148,7 @@ status_t BpDrmManagerService::setDrmServiceListener( data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor()); data.writeInt32(uniqueId); - data.writeStrongBinder( - drmServiceListener != NULL ? drmServiceListener->asBinder() : NULL); + data.writeStrongBinder(IInterface::asBinder(drmServiceListener)); remote()->transact(SET_DRM_SERVICE_LISTENER, data, &reply); return reply.readInt32(); } diff --git a/drm/libdrmframework/DrmManagerClientImpl.cpp b/drm/libdrmframework/DrmManagerClientImpl.cpp index 2d2c90e..9457bb6 100644 --- a/drm/libdrmframework/DrmManagerClientImpl.cpp +++ b/drm/libdrmframework/DrmManagerClientImpl.cpp @@ -346,7 +346,7 @@ status_t DrmManagerClientImpl::notify(const DrmInfoEvent& event) { DrmManagerClientImpl::DeathNotifier::~DeathNotifier() { Mutex::Autolock lock(sMutex); if (NULL != sDrmManagerService.get()) { - sDrmManagerService->asBinder()->unlinkToDeath(this); + IInterface::asBinder(sDrmManagerService)->unlinkToDeath(this); } } diff --git a/media/common_time/ICommonClock.cpp b/media/common_time/ICommonClock.cpp index 25ae69e..19b7d6e 100644 --- a/media/common_time/ICommonClock.cpp +++ b/media/common_time/ICommonClock.cpp @@ -206,7 +206,7 @@ class BpCommonClock : public BpInterface const sp& listener) { Parcel data, reply; data.writeInterfaceToken(ICommonClock::getInterfaceDescriptor()); - data.writeStrongBinder(listener->asBinder()); + data.writeStrongBinder(IInterface::asBinder(listener)); status_t status = remote()->transact(REGISTER_LISTENER, data, &reply); @@ -221,7 +221,7 @@ class BpCommonClock : public BpInterface const sp& listener) { Parcel data, reply; data.writeInterfaceToken(ICommonClock::getInterfaceDescriptor()); - data.writeStrongBinder(listener->asBinder()); + data.writeStrongBinder(IInterface::asBinder(listener)); status_t status = remote()->transact(UNREGISTER_LISTENER, data, &reply); if (status == OK) { diff --git a/media/libmedia/AudioEffect.cpp b/media/libmedia/AudioEffect.cpp index 0d5d7e4..af103c1 100644 --- a/media/libmedia/AudioEffect.cpp +++ b/media/libmedia/AudioEffect.cpp @@ -150,7 +150,7 @@ status_t AudioEffect::set(const effect_uuid_t *type, int bufOffset = ((sizeof(effect_param_cblk_t) - 1) / sizeof(int) + 1) * sizeof(int); mCblk->buffer = (uint8_t *)mCblk + bufOffset; - iEffect->asBinder()->linkToDeath(mIEffectClient); + IInterface::asBinder(iEffect)->linkToDeath(mIEffectClient); mClientPid = IPCThreadState::self()->getCallingPid(); ALOGV("set() %p OK effect: %s id: %d status %d enabled %d pid %d", this, mDescriptor.name, mId, mStatus, mEnabled, mClientPid); @@ -173,7 +173,7 @@ AudioEffect::~AudioEffect() } if (mIEffect != NULL) { mIEffect->disconnect(); - mIEffect->asBinder()->unlinkToDeath(mIEffectClient); + IInterface::asBinder(mIEffect)->unlinkToDeath(mIEffectClient); } IPCThreadState::self()->flushCommands(); } diff --git a/media/libmedia/AudioRecord.cpp b/media/libmedia/AudioRecord.cpp index 9e7ba88..9d92cfe 100644 --- a/media/libmedia/AudioRecord.cpp +++ b/media/libmedia/AudioRecord.cpp @@ -105,7 +105,7 @@ AudioRecord::~AudioRecord() mAudioRecordThread->requestExitAndWait(); mAudioRecordThread.clear(); } - mAudioRecord->asBinder()->unlinkToDeath(mDeathNotifier, this); + IInterface::asBinder(mAudioRecord)->unlinkToDeath(mDeathNotifier, this); mAudioRecord.clear(); mCblkMemory.clear(); mBufferMemory.clear(); @@ -516,7 +516,7 @@ status_t AudioRecord::openRecord_l(size_t epoch) // invariant that mAudioRecord != 0 is true only after set() returns successfully if (mAudioRecord != 0) { - mAudioRecord->asBinder()->unlinkToDeath(mDeathNotifier, this); + IInterface::asBinder(mAudioRecord)->unlinkToDeath(mDeathNotifier, this); mDeathNotifier.clear(); } mAudioRecord = record; @@ -566,7 +566,7 @@ status_t AudioRecord::openRecord_l(size_t epoch) mProxy->setMinimum(mNotificationFramesAct); mDeathNotifier = new DeathNotifier(this); - mAudioRecord->asBinder()->linkToDeath(mDeathNotifier, this); + IInterface::asBinder(mAudioRecord)->linkToDeath(mDeathNotifier, this); return NO_ERROR; } diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp index 2f57b9d..b45a420 100644 --- a/media/libmedia/AudioTrack.cpp +++ b/media/libmedia/AudioTrack.cpp @@ -193,7 +193,7 @@ AudioTrack::~AudioTrack() mAudioTrackThread->requestExitAndWait(); mAudioTrackThread.clear(); } - mAudioTrack->asBinder()->unlinkToDeath(mDeathNotifier, this); + IInterface::asBinder(mAudioTrack)->unlinkToDeath(mDeathNotifier, this); mAudioTrack.clear(); mCblkMemory.clear(); mSharedBuffer.clear(); @@ -1123,7 +1123,7 @@ status_t AudioTrack::createTrack_l() } // invariant that mAudioTrack != 0 is true only after set() returns successfully if (mAudioTrack != 0) { - mAudioTrack->asBinder()->unlinkToDeath(mDeathNotifier, this); + IInterface::asBinder(mAudioTrack)->unlinkToDeath(mDeathNotifier, this); mDeathNotifier.clear(); } mAudioTrack = track; @@ -1226,7 +1226,7 @@ status_t AudioTrack::createTrack_l() mProxy->setMinimum(mNotificationFramesAct); mDeathNotifier = new DeathNotifier(this); - mAudioTrack->asBinder()->linkToDeath(mDeathNotifier, this); + IInterface::asBinder(mAudioTrack)->linkToDeath(mDeathNotifier, this); return NO_ERROR; } diff --git a/media/libmedia/IAudioFlinger.cpp b/media/libmedia/IAudioFlinger.cpp index 6099a05..8e3b633 100644 --- a/media/libmedia/IAudioFlinger.cpp +++ b/media/libmedia/IAudioFlinger.cpp @@ -119,7 +119,7 @@ public: // haveSharedBuffer if (sharedBuffer != 0) { data.writeInt32(true); - data.writeStrongBinder(sharedBuffer->asBinder()); + data.writeStrongBinder(IInterface::asBinder(sharedBuffer)); } else { data.writeInt32(false); } @@ -419,7 +419,7 @@ public: { Parcel data, reply; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); - data.writeStrongBinder(client->asBinder()); + data.writeStrongBinder(IInterface::asBinder(client)); remote()->transact(REGISTER_CLIENT, data, &reply); } @@ -716,7 +716,7 @@ public: data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); data.write(pDesc, sizeof(effect_descriptor_t)); - data.writeStrongBinder(client->asBinder()); + data.writeStrongBinder(IInterface::asBinder(client)); data.writeInt32(priority); data.writeInt32((int32_t) output); data.writeInt32(sessionId); @@ -939,7 +939,7 @@ status_t BnAudioFlinger::onTransact( reply->writeInt32(flags); reply->writeInt32(sessionId); reply->writeInt32(status); - reply->writeStrongBinder(track->asBinder()); + reply->writeStrongBinder(IInterface::asBinder(track)); return NO_ERROR; } break; case OPEN_RECORD: { @@ -966,11 +966,9 @@ status_t BnAudioFlinger::onTransact( reply->writeInt32(sessionId); reply->writeInt64(notificationFrames); reply->writeInt32(status); - reply->writeStrongBinder(record != NULL ? record->asBinder() - : NULL); - reply->writeStrongBinder(cblk != NULL ? cblk->asBinder() : NULL); - reply->writeStrongBinder(buffers != NULL ? buffers->asBinder() - : NULL); + reply->writeStrongBinder(IInterface::asBinder(record)); + reply->writeStrongBinder(IInterface::asBinder(cblk)); + reply->writeStrongBinder(IInterface::asBinder(buffers)); return NO_ERROR; } break; case SAMPLE_RATE: { @@ -1256,7 +1254,7 @@ status_t BnAudioFlinger::onTransact( reply->writeInt32(status); reply->writeInt32(id); reply->writeInt32(enabled); - reply->writeStrongBinder(effect->asBinder()); + reply->writeStrongBinder(IInterface::asBinder(effect)); reply->write(&desc, sizeof(effect_descriptor_t)); return NO_ERROR; } break; diff --git a/media/libmedia/IAudioPolicyService.cpp b/media/libmedia/IAudioPolicyService.cpp index 89178f1..9349662 100644 --- a/media/libmedia/IAudioPolicyService.cpp +++ b/media/libmedia/IAudioPolicyService.cpp @@ -572,7 +572,7 @@ public: { Parcel data, reply; data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); - data.writeStrongBinder(client->asBinder()); + data.writeStrongBinder(IInterface::asBinder(client)); remote()->transact(REGISTER_CLIENT, data, &reply); } diff --git a/media/libmedia/IAudioTrack.cpp b/media/libmedia/IAudioTrack.cpp index 265bb1b..df209fd 100644 --- a/media/libmedia/IAudioTrack.cpp +++ b/media/libmedia/IAudioTrack.cpp @@ -137,7 +137,7 @@ public: int64_t pts) { Parcel data, reply; data.writeInterfaceToken(IAudioTrack::getInterfaceDescriptor()); - data.writeStrongBinder(buffer->asBinder()); + data.writeStrongBinder(IInterface::asBinder(buffer)); data.writeInt64(pts); status_t status = remote()->transact(QUEUE_TIMED_BUFFER, data, &reply); @@ -207,7 +207,7 @@ status_t BnAudioTrack::onTransact( switch (code) { case GET_CBLK: { CHECK_INTERFACE(IAudioTrack, data, reply); - reply->writeStrongBinder(getCblk()->asBinder()); + reply->writeStrongBinder(IInterface::asBinder(getCblk())); return NO_ERROR; } break; case START: { @@ -241,7 +241,7 @@ status_t BnAudioTrack::onTransact( status_t status = allocateTimedBuffer(data.readInt64(), &buffer); reply->writeInt32(status); if (status == NO_ERROR) { - reply->writeStrongBinder(buffer->asBinder()); + reply->writeStrongBinder(IInterface::asBinder(buffer)); } return NO_ERROR; } break; diff --git a/media/libmedia/IDrm.cpp b/media/libmedia/IDrm.cpp index 7e74de9..b08fa82 100644 --- a/media/libmedia/IDrm.cpp +++ b/media/libmedia/IDrm.cpp @@ -450,7 +450,7 @@ struct BpDrm : public BpInterface { virtual status_t setListener(const sp& listener) { Parcel data, reply; data.writeInterfaceToken(IDrm::getInterfaceDescriptor()); - data.writeStrongBinder(listener->asBinder()); + data.writeStrongBinder(IInterface::asBinder(listener)); remote()->transact(SET_LISTENER, data, &reply); return reply.readInt32(); } diff --git a/media/libmedia/IEffect.cpp b/media/libmedia/IEffect.cpp index b94012a..c2fff78 100644 --- a/media/libmedia/IEffect.cpp +++ b/media/libmedia/IEffect.cpp @@ -190,7 +190,7 @@ status_t BnEffect::onTransact( case GET_CBLK: { CHECK_INTERFACE(IEffect, data, reply); - reply->writeStrongBinder(getCblk()->asBinder()); + reply->writeStrongBinder(IInterface::asBinder(getCblk())); return NO_ERROR; } break; diff --git a/media/libmedia/IHDCP.cpp b/media/libmedia/IHDCP.cpp index 1cf987a..9122f75 100644 --- a/media/libmedia/IHDCP.cpp +++ b/media/libmedia/IHDCP.cpp @@ -65,7 +65,7 @@ struct BpHDCP : public BpInterface { virtual status_t setObserver(const sp &observer) { Parcel data, reply; data.writeInterfaceToken(IHDCP::getInterfaceDescriptor()); - data.writeStrongBinder(observer->asBinder()); + data.writeStrongBinder(IInterface::asBinder(observer)); remote()->transact(HDCP_SET_OBSERVER, data, &reply); return reply.readInt32(); } diff --git a/media/libmedia/IMediaDeathNotifier.cpp b/media/libmedia/IMediaDeathNotifier.cpp index 10b4934..38e9ca0 100644 --- a/media/libmedia/IMediaDeathNotifier.cpp +++ b/media/libmedia/IMediaDeathNotifier.cpp @@ -104,7 +104,7 @@ IMediaDeathNotifier::DeathNotifier::~DeathNotifier() Mutex::Autolock _l(sServiceLock); sObitRecipients.clear(); if (sMediaPlayerService != 0) { - sMediaPlayerService->asBinder()->unlinkToDeath(this); + IInterface::asBinder(sMediaPlayerService)->unlinkToDeath(this); } } diff --git a/media/libmedia/IMediaLogService.cpp b/media/libmedia/IMediaLogService.cpp index 8a66c7c..a4af7b7 100644 --- a/media/libmedia/IMediaLogService.cpp +++ b/media/libmedia/IMediaLogService.cpp @@ -42,7 +42,7 @@ public: virtual void registerWriter(const sp& shared, size_t size, const char *name) { Parcel data, reply; data.writeInterfaceToken(IMediaLogService::getInterfaceDescriptor()); - data.writeStrongBinder(shared->asBinder()); + data.writeStrongBinder(IInterface::asBinder(shared)); data.writeInt64((int64_t) size); data.writeCString(name); status_t status = remote()->transact(REGISTER_WRITER, data, &reply); @@ -52,7 +52,7 @@ public: virtual void unregisterWriter(const sp& shared) { Parcel data, reply; data.writeInterfaceToken(IMediaLogService::getInterfaceDescriptor()); - data.writeStrongBinder(shared->asBinder()); + data.writeStrongBinder(IInterface::asBinder(shared)); status_t status = remote()->transact(UNREGISTER_WRITER, data, &reply); // FIXME ignores status } diff --git a/media/libmedia/IMediaMetadataRetriever.cpp b/media/libmedia/IMediaMetadataRetriever.cpp index 38f717c..aa2665a 100644 --- a/media/libmedia/IMediaMetadataRetriever.cpp +++ b/media/libmedia/IMediaMetadataRetriever.cpp @@ -95,7 +95,7 @@ public: data.writeInterfaceToken(IMediaMetadataRetriever::getInterfaceDescriptor()); data.writeInt32(httpService != NULL); if (httpService != NULL) { - data.writeStrongBinder(httpService->asBinder()); + data.writeStrongBinder(IInterface::asBinder(httpService)); } data.writeCString(srcUrl); @@ -246,7 +246,7 @@ status_t BnMediaMetadataRetriever::onTransact( sp bitmap = getFrameAtTime(timeUs, option); if (bitmap != 0) { // Don't send NULL across the binder interface reply->writeInt32(NO_ERROR); - reply->writeStrongBinder(bitmap->asBinder()); + reply->writeStrongBinder(IInterface::asBinder(bitmap)); } else { reply->writeInt32(UNKNOWN_ERROR); } @@ -263,7 +263,7 @@ status_t BnMediaMetadataRetriever::onTransact( sp albumArt = extractAlbumArt(); if (albumArt != 0) { // Don't send NULL across the binder interface reply->writeInt32(NO_ERROR); - reply->writeStrongBinder(albumArt->asBinder()); + reply->writeStrongBinder(IInterface::asBinder(albumArt)); } else { reply->writeInt32(UNKNOWN_ERROR); } diff --git a/media/libmedia/IMediaPlayer.cpp b/media/libmedia/IMediaPlayer.cpp index 6e0ec83..7f3e5cc 100644 --- a/media/libmedia/IMediaPlayer.cpp +++ b/media/libmedia/IMediaPlayer.cpp @@ -85,7 +85,7 @@ public: data.writeInterfaceToken(IMediaPlayer::getInterfaceDescriptor()); data.writeInt32(httpService != NULL); if (httpService != NULL) { - data.writeStrongBinder(httpService->asBinder()); + data.writeStrongBinder(IInterface::asBinder(httpService)); } data.writeCString(url); if (headers == NULL) { @@ -115,7 +115,7 @@ public: status_t setDataSource(const sp &source) { Parcel data, reply; data.writeInterfaceToken(IMediaPlayer::getInterfaceDescriptor()); - data.writeStrongBinder(source == NULL ? NULL : source->asBinder()); + data.writeStrongBinder(IInterface::asBinder(source)); remote()->transact(SET_DATA_SOURCE_STREAM, data, &reply); return reply.readInt32(); } @@ -125,7 +125,7 @@ public: { Parcel data, reply; data.writeInterfaceToken(IMediaPlayer::getInterfaceDescriptor()); - sp b(bufferProducer == NULL ? NULL : bufferProducer->asBinder()); + sp b(IInterface::asBinder(bufferProducer)); data.writeStrongBinder(b); remote()->transact(SET_VIDEO_SURFACETEXTURE, data, &reply); return reply.readInt32(); @@ -323,7 +323,7 @@ public: status_t setNextPlayer(const sp& player) { Parcel data, reply; data.writeInterfaceToken(IMediaPlayer::getInterfaceDescriptor()); - sp b(player == NULL ? NULL : player->asBinder()); + sp b(IInterface::asBinder(player)); data.writeStrongBinder(b); remote()->transact(SET_NEXT_PLAYER, data, &reply); return reply.readInt32(); diff --git a/media/libmedia/IMediaPlayerService.cpp b/media/libmedia/IMediaPlayerService.cpp index 2e02d17..a7568b9 100644 --- a/media/libmedia/IMediaPlayerService.cpp +++ b/media/libmedia/IMediaPlayerService.cpp @@ -73,7 +73,7 @@ public: const sp& client, int audioSessionId) { Parcel data, reply; data.writeInterfaceToken(IMediaPlayerService::getInterfaceDescriptor()); - data.writeStrongBinder(client->asBinder()); + data.writeStrongBinder(IInterface::asBinder(client)); data.writeInt32(audioSessionId); remote()->transact(CREATE, data, &reply); @@ -101,10 +101,10 @@ public: data.writeInterfaceToken(IMediaPlayerService::getInterfaceDescriptor()); data.writeInt32(httpService != NULL); if (httpService != NULL) { - data.writeStrongBinder(httpService->asBinder()); + data.writeStrongBinder(IInterface::asBinder(httpService)); } data.writeCString(url); - data.writeStrongBinder(heap->asBinder()); + data.writeStrongBinder(IInterface::asBinder(heap)); status_t status = remote()->transact(DECODE_URL, data, &reply); if (status == NO_ERROR) { status = (status_t)reply.readInt32(); @@ -127,7 +127,7 @@ public: data.writeFileDescriptor(fd); data.writeInt64(offset); data.writeInt64(length); - data.writeStrongBinder(heap->asBinder()); + data.writeStrongBinder(IInterface::asBinder(heap)); status_t status = remote()->transact(DECODE_FD, data, &reply); if (status == NO_ERROR) { status = (status_t)reply.readInt32(); @@ -188,7 +188,7 @@ public: { Parcel data, reply; data.writeInterfaceToken(IMediaPlayerService::getInterfaceDescriptor()); - data.writeStrongBinder(client->asBinder()); + data.writeStrongBinder(IInterface::asBinder(client)); data.writeString8(iface); remote()->transact(LISTEN_FOR_REMOTE_DISPLAY, data, &reply); return interface_cast(reply.readStrongBinder()); @@ -216,7 +216,7 @@ status_t BnMediaPlayerService::onTransact( interface_cast(data.readStrongBinder()); int audioSessionId = data.readInt32(); sp player = create(client, audioSessionId); - reply->writeStrongBinder(player->asBinder()); + reply->writeStrongBinder(IInterface::asBinder(player)); return NO_ERROR; } break; case DECODE_URL: { @@ -273,38 +273,38 @@ status_t BnMediaPlayerService::onTransact( case CREATE_MEDIA_RECORDER: { CHECK_INTERFACE(IMediaPlayerService, data, reply); sp recorder = createMediaRecorder(); - reply->writeStrongBinder(recorder->asBinder()); + reply->writeStrongBinder(IInterface::asBinder(recorder)); return NO_ERROR; } break; case CREATE_METADATA_RETRIEVER: { CHECK_INTERFACE(IMediaPlayerService, data, reply); sp retriever = createMetadataRetriever(); - reply->writeStrongBinder(retriever->asBinder()); + reply->writeStrongBinder(IInterface::asBinder(retriever)); return NO_ERROR; } break; case GET_OMX: { CHECK_INTERFACE(IMediaPlayerService, data, reply); sp omx = getOMX(); - reply->writeStrongBinder(omx->asBinder()); + reply->writeStrongBinder(IInterface::asBinder(omx)); return NO_ERROR; } break; case MAKE_CRYPTO: { CHECK_INTERFACE(IMediaPlayerService, data, reply); sp crypto = makeCrypto(); - reply->writeStrongBinder(crypto->asBinder()); + reply->writeStrongBinder(IInterface::asBinder(crypto)); return NO_ERROR; } break; case MAKE_DRM: { CHECK_INTERFACE(IMediaPlayerService, data, reply); sp drm = makeDrm(); - reply->writeStrongBinder(drm->asBinder()); + reply->writeStrongBinder(IInterface::asBinder(drm)); return NO_ERROR; } break; case MAKE_HDCP: { CHECK_INTERFACE(IMediaPlayerService, data, reply); bool createEncryptionModule = data.readInt32(); sp hdcp = makeHDCP(createEncryptionModule); - reply->writeStrongBinder(hdcp->asBinder()); + reply->writeStrongBinder(IInterface::asBinder(hdcp)); return NO_ERROR; } break; case ADD_BATTERY_DATA: { @@ -324,13 +324,13 @@ status_t BnMediaPlayerService::onTransact( interface_cast(data.readStrongBinder())); String8 iface(data.readString8()); sp display(listenForRemoteDisplay(client, iface)); - reply->writeStrongBinder(display->asBinder()); + reply->writeStrongBinder(IInterface::asBinder(display)); return NO_ERROR; } break; case GET_CODEC_LIST: { CHECK_INTERFACE(IMediaPlayerService, data, reply); sp mcl = getCodecList(); - reply->writeStrongBinder(mcl->asBinder()); + reply->writeStrongBinder(IInterface::asBinder(mcl)); return NO_ERROR; } break; default: diff --git a/media/libmedia/IMediaRecorder.cpp b/media/libmedia/IMediaRecorder.cpp index 95af006..a733b68 100644 --- a/media/libmedia/IMediaRecorder.cpp +++ b/media/libmedia/IMediaRecorder.cpp @@ -70,8 +70,8 @@ public: ALOGV("setCamera(%p,%p)", camera.get(), proxy.get()); Parcel data, reply; data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor()); - data.writeStrongBinder(camera->asBinder()); - data.writeStrongBinder(proxy->asBinder()); + data.writeStrongBinder(IInterface::asBinder(camera)); + data.writeStrongBinder(IInterface::asBinder(proxy)); remote()->transact(SET_CAMERA, data, &reply); return reply.readInt32(); } @@ -94,7 +94,7 @@ public: ALOGV("setPreviewSurface(%p)", surface.get()); Parcel data, reply; data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor()); - data.writeStrongBinder(surface->asBinder()); + data.writeStrongBinder(IInterface::asBinder(surface)); remote()->transact(SET_PREVIEW_SURFACE, data, &reply); return reply.readInt32(); } @@ -215,7 +215,7 @@ public: ALOGV("setListener(%p)", listener.get()); Parcel data, reply; data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor()); - data.writeStrongBinder(listener->asBinder()); + data.writeStrongBinder(IInterface::asBinder(listener)); remote()->transact(SET_LISTENER, data, &reply); return reply.readInt32(); } @@ -468,7 +468,7 @@ status_t BnMediaRecorder::onTransact( int returnedNull= (surfaceMediaSource == NULL) ? 1 : 0 ; reply->writeInt32(returnedNull); if (!returnedNull) { - reply->writeStrongBinder(surfaceMediaSource->asBinder()); + reply->writeStrongBinder(IInterface::asBinder(surfaceMediaSource)); } return NO_ERROR; } break; diff --git a/media/libmedia/IOMX.cpp b/media/libmedia/IOMX.cpp index c583d32..e208df9 100644 --- a/media/libmedia/IOMX.cpp +++ b/media/libmedia/IOMX.cpp @@ -100,7 +100,7 @@ public: Parcel data, reply; data.writeInterfaceToken(IOMX::getInterfaceDescriptor()); data.writeCString(name); - data.writeStrongBinder(observer->asBinder()); + data.writeStrongBinder(IInterface::asBinder(observer)); remote()->transact(ALLOCATE_NODE, data, &reply); status_t err = reply.readInt32(); @@ -248,7 +248,7 @@ public: data.writeInterfaceToken(IOMX::getInterfaceDescriptor()); data.writeInt32((int32_t)node); data.writeInt32(port_index); - data.writeStrongBinder(params->asBinder()); + data.writeStrongBinder(IInterface::asBinder(params)); remote()->transact(USE_BUFFER, data, &reply); status_t err = reply.readInt32(); @@ -418,7 +418,7 @@ public: data.writeInterfaceToken(IOMX::getInterfaceDescriptor()); data.writeInt32((int32_t)node); data.writeInt32(port_index); - data.writeStrongBinder(params->asBinder()); + data.writeStrongBinder(IInterface::asBinder(params)); remote()->transact(ALLOC_BUFFER_WITH_BACKUP, data, &reply); status_t err = reply.readInt32(); @@ -775,7 +775,7 @@ status_t BnOMX::onTransact( reply->writeInt32(err); if (err == OK) { - reply->writeStrongBinder(bufferProducer->asBinder()); + reply->writeStrongBinder(IInterface::asBinder(bufferProducer)); } return NO_ERROR; diff --git a/media/libmedia/IRemoteDisplayClient.cpp b/media/libmedia/IRemoteDisplayClient.cpp index 7190879..9d63bc9 100644 --- a/media/libmedia/IRemoteDisplayClient.cpp +++ b/media/libmedia/IRemoteDisplayClient.cpp @@ -42,7 +42,7 @@ public: { Parcel data, reply; data.writeInterfaceToken(IRemoteDisplayClient::getInterfaceDescriptor()); - data.writeStrongBinder(bufferProducer->asBinder()); + data.writeStrongBinder(IInterface::asBinder(bufferProducer)); data.writeInt32(width); data.writeInt32(height); data.writeInt32(flags); diff --git a/media/libmedia/IStreamSource.cpp b/media/libmedia/IStreamSource.cpp index fe2cc61..d480aef 100644 --- a/media/libmedia/IStreamSource.cpp +++ b/media/libmedia/IStreamSource.cpp @@ -55,7 +55,7 @@ struct BpStreamSource : public BpInterface { virtual void setListener(const sp &listener) { Parcel data, reply; data.writeInterfaceToken(IStreamSource::getInterfaceDescriptor()); - data.writeStrongBinder(listener->asBinder()); + data.writeStrongBinder(IInterface::asBinder(listener)); remote()->transact(SET_LISTENER, data, &reply); } @@ -64,7 +64,7 @@ struct BpStreamSource : public BpInterface { data.writeInterfaceToken(IStreamSource::getInterfaceDescriptor()); data.writeInt64(static_cast(buffers.size())); for (size_t i = 0; i < buffers.size(); ++i) { - data.writeStrongBinder(buffers.itemAt(i)->asBinder()); + data.writeStrongBinder(IInterface::asBinder(buffers.itemAt(i))); } remote()->transact(SET_BUFFERS, data, &reply); } diff --git a/media/libmedia/mediametadataretriever.cpp b/media/libmedia/mediametadataretriever.cpp index 39a239d..8e8a1ed 100644 --- a/media/libmedia/mediametadataretriever.cpp +++ b/media/libmedia/mediametadataretriever.cpp @@ -172,7 +172,7 @@ MediaMetadataRetriever::DeathNotifier::~DeathNotifier() { Mutex::Autolock lock(sServiceLock); if (sService != 0) { - sService->asBinder()->unlinkToDeath(this); + IInterface::asBinder(sService)->unlinkToDeath(this); } } diff --git a/media/libmediaplayerservice/Drm.cpp b/media/libmediaplayerservice/Drm.cpp index 2a8b2c6..0e59e4b 100644 --- a/media/libmediaplayerservice/Drm.cpp +++ b/media/libmediaplayerservice/Drm.cpp @@ -84,10 +84,10 @@ status_t Drm::setListener(const sp& listener) { Mutex::Autolock lock(mEventLock); if (mListener != NULL){ - mListener->asBinder()->unlinkToDeath(this); + IInterface::asBinder(mListener)->unlinkToDeath(this); } if (listener != NULL) { - listener->asBinder()->linkToDeath(this); + IInterface::asBinder(listener)->linkToDeath(this); } mListener = listener; return NO_ERROR; diff --git a/media/libmediaplayerservice/MediaPlayerService.cpp b/media/libmediaplayerservice/MediaPlayerService.cpp index c120898..cd5478a 100644 --- a/media/libmediaplayerservice/MediaPlayerService.cpp +++ b/media/libmediaplayerservice/MediaPlayerService.cpp @@ -817,8 +817,7 @@ status_t MediaPlayerService::Client::setVideoSurfaceTexture( sp p = getPlayer(); if (p == 0) return UNKNOWN_ERROR; - sp binder(bufferProducer == NULL ? NULL : - bufferProducer->asBinder()); + sp binder(IInterface::asBinder(bufferProducer)); if (mConnectedWindowBinder == binder) { return OK; } diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp index 4c8a199..26284e9 100644 --- a/media/libstagefright/ACodec.cpp +++ b/media/libstagefright/ACodec.cpp @@ -4419,7 +4419,7 @@ void ACodec::UninitializedState::stateEntered() { ALOGV("Now uninitialized"); if (mDeathNotifier != NULL) { - mCodec->mOMX->asBinder()->unlinkToDeath(mDeathNotifier); + IInterface::asBinder(mCodec->mOMX)->unlinkToDeath(mDeathNotifier); mDeathNotifier.clear(); } @@ -4512,7 +4512,7 @@ bool ACodec::UninitializedState::onAllocateComponent(const sp &msg) { sp notify = new AMessage(kWhatOMXDied, mCodec->id()); mDeathNotifier = new DeathNotifier(notify); - if (omx->asBinder()->linkToDeath(mDeathNotifier) != OK) { + if (IInterface::asBinder(omx)->linkToDeath(mDeathNotifier) != OK) { // This was a local binder, if it dies so do we, we won't care // about any notifications in the afterlife. mDeathNotifier.clear(); diff --git a/media/libstagefright/CameraSource.cpp b/media/libstagefright/CameraSource.cpp index c3a940a..ad12bdd 100644 --- a/media/libstagefright/CameraSource.cpp +++ b/media/libstagefright/CameraSource.cpp @@ -219,7 +219,7 @@ status_t CameraSource::isCameraAvailable( mCameraFlags |= FLAGS_HOT_CAMERA; mDeathNotifier = new DeathNotifier(); // isBinderAlive needs linkToDeath to work. - mCameraRecordingProxy->asBinder()->linkToDeath(mDeathNotifier); + IInterface::asBinder(mCameraRecordingProxy)->linkToDeath(mDeathNotifier); } mCamera->lock(); @@ -702,7 +702,7 @@ void CameraSource::releaseCamera() { { Mutex::Autolock autoLock(mLock); if (mCameraRecordingProxy != 0) { - mCameraRecordingProxy->asBinder()->unlinkToDeath(mDeathNotifier); + IInterface::asBinder(mCameraRecordingProxy)->unlinkToDeath(mDeathNotifier); mCameraRecordingProxy.clear(); } mCameraFlags = 0; @@ -825,7 +825,7 @@ status_t CameraSource::read( mFrameAvailableCondition.waitRelative(mLock, mTimeBetweenFrameCaptureUs * 1000LL + CAMERA_SOURCE_TIMEOUT_NS)) { if (mCameraRecordingProxy != 0 && - !mCameraRecordingProxy->asBinder()->isBinderAlive()) { + !IInterface::asBinder(mCameraRecordingProxy)->isBinderAlive()) { ALOGW("camera recording proxy is gone"); return ERROR_END_OF_STREAM; } diff --git a/media/libstagefright/OMXClient.cpp b/media/libstagefright/OMXClient.cpp index ca031aa..230c1f7 100644 --- a/media/libstagefright/OMXClient.cpp +++ b/media/libstagefright/OMXClient.cpp @@ -37,7 +37,7 @@ struct MuxOMX : public IOMX { MuxOMX(const sp &remoteOMX); virtual ~MuxOMX(); - virtual IBinder *onAsBinder() { return mRemoteOMX->asBinder().get(); } + virtual IBinder *onAsBinder() { return IInterface::asBinder(mRemoteOMX).get(); } virtual bool livesLocally(node_id node, pid_t pid); diff --git a/media/libstagefright/TimedEventQueue.cpp b/media/libstagefright/TimedEventQueue.cpp index 1fdb244..7d15220 100644 --- a/media/libstagefright/TimedEventQueue.cpp +++ b/media/libstagefright/TimedEventQueue.cpp @@ -52,7 +52,7 @@ TimedEventQueue::TimedEventQueue() TimedEventQueue::~TimedEventQueue() { stop(); if (mPowerManager != 0) { - sp binder = mPowerManager->asBinder(); + sp binder = IInterface::asBinder(mPowerManager); binder->unlinkToDeath(mDeathRecipient); } } diff --git a/media/libstagefright/omx/OMX.cpp b/media/libstagefright/omx/OMX.cpp index 6d46eee..f8d38ff 100644 --- a/media/libstagefright/omx/OMX.cpp +++ b/media/libstagefright/omx/OMX.cpp @@ -245,8 +245,8 @@ status_t OMX::allocateNode( instance->setHandle(*node, handle); - mLiveNodes.add(observer->asBinder(), instance); - observer->asBinder()->linkToDeath(this); + mLiveNodes.add(IInterface::asBinder(observer), instance); + IInterface::asBinder(observer)->linkToDeath(this); return OK; } @@ -256,7 +256,7 @@ status_t OMX::freeNode(node_id node) { { Mutex::Autolock autoLock(mLock); - ssize_t index = mLiveNodes.indexOfKey(instance->observer()->asBinder()); + ssize_t index = mLiveNodes.indexOfKey(IInterface::asBinder(instance->observer())); if (index < 0) { // This could conceivably happen if the observer dies at roughly the // same time that a client attempts to free the node explicitly. @@ -265,7 +265,7 @@ status_t OMX::freeNode(node_id node) { mLiveNodes.removeItemsAt(index); } - instance->observer()->asBinder()->unlinkToDeath(this); + IInterface::asBinder(instance->observer())->unlinkToDeath(this); status_t err = instance->freeNode(mMaster); diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp index 115b60c..a17a49e 100644 --- a/services/audioflinger/AudioFlinger.cpp +++ b/services/audioflinger/AudioFlinger.cpp @@ -1191,7 +1191,7 @@ void AudioFlinger::registerClient(const sp& client) mNotificationClients.add(pid, notificationClient); - sp binder = client->asBinder(); + sp binder = IInterface::asBinder(client); binder->linkToDeath(notificationClient); clientAdded = true; } diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp index e24832f..aef1844 100644 --- a/services/audioflinger/Threads.cpp +++ b/services/audioflinger/Threads.cpp @@ -396,7 +396,7 @@ AudioFlinger::ThreadBase::~ThreadBase() // do not lock the mutex in destructor releaseWakeLock_l(); if (mPowerManager != 0) { - sp binder = mPowerManager->asBinder(); + sp binder = IInterface::asBinder(mPowerManager); binder->unlinkToDeath(mDeathRecipient); } } diff --git a/services/audiopolicy/AudioPolicyService.cpp b/services/audiopolicy/AudioPolicyService.cpp index dd4067f..1880644 100644 --- a/services/audiopolicy/AudioPolicyService.cpp +++ b/services/audiopolicy/AudioPolicyService.cpp @@ -160,7 +160,7 @@ void AudioPolicyService::registerClient(const sp& cli mNotificationClients.add(uid, notificationClient); - sp binder = client->asBinder(); + sp binder = IInterface::asBinder(client); binder->linkToDeath(notificationClient); } } 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 @@ status_t CameraService::connect( Mutex::Autolock lock(mServiceLock); sp clientTmp; if (!canConnectUnsafe(cameraId, clientPackageName, - cameraClient->asBinder(), + IInterface::asBinder(cameraClient), /*out*/clientTmp)) { return -EBUSY; } else if (client.get() != NULL) { @@ -818,7 +818,7 @@ status_t CameraService::connectLegacy( Mutex::Autolock lock(mServiceLock); sp clientTmp; if (!canConnectUnsafe(cameraId, clientPackageName, - cameraClient->asBinder(), + IInterface::asBinder(cameraClient), /*out*/clientTmp)) { return -EBUSY; } else if (client.get() != NULL) { @@ -888,7 +888,7 @@ status_t CameraService::connectPro( { sp client; if (!canConnectUnsafe(cameraId, clientPackageName, - cameraCb->asBinder(), + IInterface::asBinder(cameraCb), /*out*/client)) { return -EBUSY; } @@ -961,7 +961,7 @@ status_t CameraService::connectDevice( { sp client; if (!canConnectUnsafe(cameraId, clientPackageName, - cameraCb->asBinder(), + IInterface::asBinder(cameraCb), /*out*/client)) { return -EBUSY; } @@ -1023,7 +1023,7 @@ status_t CameraService::addListener( Vector >::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 @@ status_t CameraService::removeListener( Vector >::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 @@ void CameraService::removeClientByRemote(const wp& remoteBinder) { // 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 @@ CameraService::Client::Client(const sp& cameraService, 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 @@ CameraService::ProClient::ProClient(const sp& cameraService, 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 @@ public: } virtual sp 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 @@ status_t Camera2Client::dump(int fd, const Vector& args) { 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 @@ status_t Camera2Client::setPreviewTarget( sp binder; sp 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 @@ status_t CameraClient::dump(int fd, const Vector& args) { 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 @@ status_t CameraClient::connect(const sp& client) { } 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 @@ status_t CameraClient::setPreviewTarget( sp binder; sp 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 @@ CameraDeviceClientBase::CameraDeviceClientBase( uid_t clientUid, int servicePid) : BasicClient(cameraService, - remoteCallback != NULL ? remoteCallback->asBinder() : NULL, + IInterface::asBinder(remoteCallback), clientPackageName, cameraId, cameraFacing, @@ -163,7 +163,7 @@ status_t CameraDeviceClient::submitRequestList(List > request if (surface == 0) continue; sp 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 @@ status_t CameraDeviceClient::createStream(int width, int height, int format, // 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 @@ status_t CameraDeviceClient::createStream(int width, int height, int format, useAsync = true; } - sp binder = bufferProducer->asBinder(); + sp binder = IInterface::asBinder(bufferProducer); sp anw = new Surface(bufferProducer, useAsync); // TODO: remove w,h,f since we are ignoring them @@ -517,7 +517,7 @@ status_t CameraDeviceClient::dump(int fd, const Vector& args) { 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 @@ status_t ProCamera2Client::createStream(int width, int height, int format, sp binder; sp window; if (bufferProducer != 0) { - binder = bufferProducer->asBinder(); + binder = IInterface::asBinder(bufferProducer); window = new Surface(bufferProducer); } @@ -335,7 +335,7 @@ status_t ProCamera2Client::dump(int fd, const Vector& args) { 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 @@ status_t Camera2ClientBase::dump(int fd, 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 @@ protected: pid_t mInitialClientPid; virtual sp asBinderWrapper() { - return IInterface::asBinder(); + return IInterface::asBinder(this); } virtual status_t dumpDevice(int fd, const Vector& args); diff --git a/services/soundtrigger/SoundTriggerHwService.cpp b/services/soundtrigger/SoundTriggerHwService.cpp index b5aaee3..b625b01 100644 --- a/services/soundtrigger/SoundTriggerHwService.cpp +++ b/services/soundtrigger/SoundTriggerHwService.cpp @@ -143,7 +143,7 @@ status_t SoundTriggerHwService::attach(const sound_trigger_module_handle_t handl sp module = mModules.valueAt(index); module->setClient(client); - client->asBinder()->linkToDeath(module); + IInterface::asBinder(client)->linkToDeath(module); moduleInterface = module; module->setCaptureState_l(mCaptureState); @@ -510,7 +510,7 @@ void SoundTriggerHwService::Module::detach() { mModels.clear(); } if (mClient != 0) { - mClient->asBinder()->unlinkToDeath(this); + IInterface::asBinder(mClient)->unlinkToDeath(this); } sp service = mService.promote(); if (service == 0) { diff --git a/soundtrigger/ISoundTrigger.cpp b/soundtrigger/ISoundTrigger.cpp index 42280d1..eecc1ea 100644 --- a/soundtrigger/ISoundTrigger.cpp +++ b/soundtrigger/ISoundTrigger.cpp @@ -58,7 +58,7 @@ public: } Parcel data, reply; data.writeInterfaceToken(ISoundTrigger::getInterfaceDescriptor()); - data.writeStrongBinder(modelMemory->asBinder()); + data.writeStrongBinder(IInterface::asBinder(modelMemory)); status_t status = remote()->transact(LOAD_SOUND_MODEL, data, &reply); if (status != NO_ERROR || (status = (status_t)reply.readInt32()) != NO_ERROR) { @@ -91,7 +91,7 @@ public: } else { data.writeInt32(dataMemory->size()); } - data.writeStrongBinder(dataMemory->asBinder()); + data.writeStrongBinder(IInterface::asBinder(dataMemory)); status_t status = remote()->transact(START_RECOGNITION, data, &reply); if (status != NO_ERROR) { status = (status_t)reply.readInt32(); diff --git a/soundtrigger/ISoundTriggerClient.cpp b/soundtrigger/ISoundTriggerClient.cpp index b0b4428..e0d3add 100644 --- a/soundtrigger/ISoundTriggerClient.cpp +++ b/soundtrigger/ISoundTriggerClient.cpp @@ -44,7 +44,7 @@ public: { Parcel data, reply; data.writeInterfaceToken(ISoundTriggerClient::getInterfaceDescriptor()); - data.writeStrongBinder(eventMemory->asBinder()); + data.writeStrongBinder(IInterface::asBinder(eventMemory)); remote()->transact(ON_RECOGNITION_EVENT, data, &reply); @@ -54,7 +54,7 @@ public: { Parcel data, reply; data.writeInterfaceToken(ISoundTriggerClient::getInterfaceDescriptor()); - data.writeStrongBinder(eventMemory->asBinder()); + data.writeStrongBinder(IInterface::asBinder(eventMemory)); remote()->transact(ON_SOUNDMODEL_EVENT, data, &reply); @@ -63,7 +63,7 @@ public: { Parcel data, reply; data.writeInterfaceToken(ISoundTriggerClient::getInterfaceDescriptor()); - data.writeStrongBinder(eventMemory->asBinder()); + data.writeStrongBinder(IInterface::asBinder(eventMemory)); remote()->transact(ON_SERVICE_STATE_CHANGE, data, &reply); diff --git a/soundtrigger/ISoundTriggerHwService.cpp b/soundtrigger/ISoundTriggerHwService.cpp index 05728e9..75f68b8 100644 --- a/soundtrigger/ISoundTriggerHwService.cpp +++ b/soundtrigger/ISoundTriggerHwService.cpp @@ -82,7 +82,7 @@ public: Parcel data, reply; data.writeInterfaceToken(ISoundTriggerHwService::getInterfaceDescriptor()); data.write(&handle, sizeof(sound_trigger_module_handle_t)); - data.writeStrongBinder(client->asBinder()); + data.writeStrongBinder(IInterface::asBinder(client)); remote()->transact(ATTACH, data, &reply); status_t status = reply.readInt32(); if (reply.readInt32() != 0) { @@ -147,7 +147,7 @@ status_t BnSoundTriggerHwService::onTransact( reply->writeInt32(status); if (module != 0) { reply->writeInt32(1); - reply->writeStrongBinder(module->asBinder()); + reply->writeStrongBinder(IInterface::asBinder(module)); } else { reply->writeInt32(0); } diff --git a/soundtrigger/SoundTrigger.cpp b/soundtrigger/SoundTrigger.cpp index 0015c30..2138cb7 100644 --- a/soundtrigger/SoundTrigger.cpp +++ b/soundtrigger/SoundTrigger.cpp @@ -104,7 +104,7 @@ sp SoundTrigger::attach(const sound_trigger_module_handle_t module status_t status = service->attach(module, soundTrigger, soundTrigger->mISoundTrigger); if (status == NO_ERROR && soundTrigger->mISoundTrigger != 0) { - soundTrigger->mISoundTrigger->asBinder()->linkToDeath(soundTrigger); + IInterface::asBinder(soundTrigger->mISoundTrigger)->linkToDeath(soundTrigger); } else { ALOGW("Error %d connecting to sound trigger service", status); soundTrigger.clear(); @@ -144,7 +144,7 @@ void SoundTrigger::detach() { mCallback.clear(); if (mISoundTrigger != 0) { mISoundTrigger->detach(); - mISoundTrigger->asBinder()->unlinkToDeath(this); + IInterface::asBinder(mISoundTrigger)->unlinkToDeath(this); mISoundTrigger = 0; } } -- cgit v1.1