summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
Diffstat (limited to 'services')
-rw-r--r--services/audioflinger/Android.mk13
-rw-r--r--services/audioflinger/AudioFlinger.cpp2
-rw-r--r--services/audioflinger/AudioMixer.h12
-rw-r--r--services/audioflinger/AudioResampler.cpp5
-rw-r--r--services/audioflinger/AudioResampler.h4
-rw-r--r--services/audioflinger/AudioResamplerFirGen.h10
-rw-r--r--services/audioflinger/AudioResamplerSinc.cpp5
-rw-r--r--services/audioflinger/StateQueue.cpp2
-rw-r--r--services/audioflinger/Threads.cpp2
-rw-r--r--services/audioflinger/tests/Android.mk23
-rw-r--r--services/audiopolicy/AudioPolicyService.cpp3
-rw-r--r--services/audiopolicy/AudioPolicyService.h2
-rw-r--r--services/camera/libcameraservice/CameraService.cpp23
-rw-r--r--services/camera/libcameraservice/CameraService.h2
-rw-r--r--services/camera/libcameraservice/api1/Camera2Client.cpp5
-rw-r--r--services/camera/libcameraservice/api1/CameraClient.cpp7
-rw-r--r--services/camera/libcameraservice/api1/client2/Parameters.h6
-rw-r--r--services/camera/libcameraservice/api2/CameraDeviceClient.cpp27
-rw-r--r--services/camera/libcameraservice/api_pro/ProCamera2Client.cpp5
-rw-r--r--services/camera/libcameraservice/common/Camera2ClientBase.cpp3
-rw-r--r--services/camera/libcameraservice/common/Camera2ClientBase.h2
-rw-r--r--services/camera/libcameraservice/device1/CameraHardwareInterface.h2
-rw-r--r--services/soundtrigger/SoundTriggerHwService.cpp4
23 files changed, 91 insertions, 78 deletions
diff --git a/services/audioflinger/Android.mk b/services/audioflinger/Android.mk
index 697fb37..f3290c6 100644
--- a/services/audioflinger/Android.mk
+++ b/services/audioflinger/Android.mk
@@ -23,6 +23,12 @@ include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
+# Clang++ aborts on AudioMixer.cpp,
+# b/18373866, "do not know how to split this operator."
+ifeq ($(filter $(TARGET_ARCH),arm arm64),$(TARGET_ARCH))
+ LOCAL_CLANG := false
+endif
+
LOCAL_SRC_FILES:= \
AudioFlinger.cpp \
Threads.cpp \
@@ -68,13 +74,6 @@ LOCAL_SRC_FILES += FastCapture.cpp FastCaptureState.cpp
LOCAL_CFLAGS += -DSTATE_QUEUE_INSTANTIATIONS='"StateQueueInstantiations.cpp"'
-# Define ANDROID_SMP appropriately. Used to get inline tracing fast-path.
-ifeq ($(TARGET_CPU_SMP),true)
- LOCAL_CFLAGS += -DANDROID_SMP=1
-else
- LOCAL_CFLAGS += -DANDROID_SMP=0
-endif
-
LOCAL_CFLAGS += -fvisibility=hidden
include $(BUILD_SHARED_LIBRARY)
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 8acfc07..71e6f83 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -1211,7 +1211,7 @@ void AudioFlinger::registerClient(const sp<IAudioFlingerClient>& client)
mNotificationClients.add(pid, notificationClient);
- sp<IBinder> binder = client->asBinder();
+ sp<IBinder> binder = IInterface::asBinder(client);
binder->linkToDeath(notificationClient);
clientAdded = true;
}
diff --git a/services/audioflinger/AudioMixer.h b/services/audioflinger/AudioMixer.h
index 3b972bb..f4f142b 100644
--- a/services/audioflinger/AudioMixer.h
+++ b/services/audioflinger/AudioMixer.h
@@ -21,15 +21,15 @@
#include <stdint.h>
#include <sys/types.h>
+#include <hardware/audio_effect.h>
+#include <media/AudioBufferProvider.h>
+#include <media/nbaio/NBLog.h>
+#include <system/audio.h>
+#include <utils/Compat.h>
#include <utils/threads.h>
-#include <media/AudioBufferProvider.h>
#include "AudioResampler.h"
-#include <hardware/audio_effect.h>
-#include <system/audio.h>
-#include <media/nbaio/NBLog.h>
-
// FIXME This is actually unity gain, which might not be max in future, expressed in U.12
#define MAX_GAIN_INT AudioMixer::UNITY_GAIN_INT
@@ -58,7 +58,7 @@ public:
static const uint32_t MAX_NUM_CHANNELS_TO_DOWNMIX = AUDIO_CHANNEL_COUNT_MAX;
static const uint16_t UNITY_GAIN_INT = 0x1000;
- static const float UNITY_GAIN_FLOAT = 1.0f;
+ static const CONSTEXPR float UNITY_GAIN_FLOAT = 1.0f;
enum { // names
diff --git a/services/audioflinger/AudioResampler.cpp b/services/audioflinger/AudioResampler.cpp
index 1f7a613..46e3d6c 100644
--- a/services/audioflinger/AudioResampler.cpp
+++ b/services/audioflinger/AudioResampler.cpp
@@ -29,14 +29,11 @@
#include "AudioResamplerDyn.h"
#ifdef __arm__
-#include <machine/cpu-features.h>
+ #define ASM_ARM_RESAMP1 // enable asm optimisation for ResamplerOrder1
#endif
namespace android {
-#ifdef __ARM_HAVE_HALFWORD_MULTIPLY // optimized asm option
- #define ASM_ARM_RESAMP1 // enable asm optimisation for ResamplerOrder1
-#endif // __ARM_HAVE_HALFWORD_MULTIPLY
// ----------------------------------------------------------------------------
class AudioResamplerOrder1 : public AudioResampler {
diff --git a/services/audioflinger/AudioResampler.h b/services/audioflinger/AudioResampler.h
index cdc6d92..069d946 100644
--- a/services/audioflinger/AudioResampler.h
+++ b/services/audioflinger/AudioResampler.h
@@ -19,7 +19,9 @@
#include <stdint.h>
#include <sys/types.h>
+
#include <cutils/compiler.h>
+#include <utils/Compat.h>
#include <media/AudioBufferProvider.h>
#include <system/audio.h>
@@ -47,7 +49,7 @@ public:
DYN_HIGH_QUALITY=7,
};
- static const float UNITY_GAIN_FLOAT = 1.0f;
+ static const CONSTEXPR float UNITY_GAIN_FLOAT = 1.0f;
static AudioResampler* create(audio_format_t format, int inChannelCount,
int32_t sampleRate, src_quality quality=DEFAULT_QUALITY);
diff --git a/services/audioflinger/AudioResamplerFirGen.h b/services/audioflinger/AudioResamplerFirGen.h
index d024b2f..f3718b6 100644
--- a/services/audioflinger/AudioResamplerFirGen.h
+++ b/services/audioflinger/AudioResamplerFirGen.h
@@ -17,6 +17,8 @@
#ifndef ANDROID_AUDIO_RESAMPLER_FIR_GEN_H
#define ANDROID_AUDIO_RESAMPLER_FIR_GEN_H
+#include "utils/Compat.h"
+
namespace android {
/*
@@ -187,22 +189,22 @@ static inline int64_t toint(double x, int64_t maxval) {
template <int N>
struct I0Term {
- static const double value = I0Term<N-1>::value / (4. * N * N);
+ static const CONSTEXPR double value = I0Term<N-1>::value / (4. * N * N);
};
template <>
struct I0Term<0> {
- static const double value = 1.;
+ static const CONSTEXPR double value = 1.;
};
template <int N>
struct I0ATerm {
- static const double value = I0ATerm<N-1>::value * (2.*N-1.) * (2.*N-1.) / (8. * N);
+ static const CONSTEXPR double value = I0ATerm<N-1>::value * (2.*N-1.) * (2.*N-1.) / (8. * N);
};
template <>
struct I0ATerm<0> { // 1/sqrt(2*PI);
- static const double value = 0.398942280401432677939946059934381868475858631164934657665925;
+ static const CONSTEXPR double value = 0.398942280401432677939946059934381868475858631164934657665925;
};
#if USE_HORNERS_METHOD
diff --git a/services/audioflinger/AudioResamplerSinc.cpp b/services/audioflinger/AudioResamplerSinc.cpp
index d03e578..e6fb76c 100644
--- a/services/audioflinger/AudioResamplerSinc.cpp
+++ b/services/audioflinger/AudioResamplerSinc.cpp
@@ -31,7 +31,10 @@
#include "AudioResamplerSinc.h"
-
+#if defined(__clang__) && !__has_builtin(__builtin_assume_aligned)
+#define __builtin_assume_aligned(p, a) \
+ (((uintptr_t(p) % (a)) == 0) ? (p) : (__builtin_unreachable(), (p)))
+#endif
#if defined(__arm__) && !defined(__thumb__)
#define USE_INLINE_ASSEMBLY (true)
diff --git a/services/audioflinger/StateQueue.cpp b/services/audioflinger/StateQueue.cpp
index 40d7bcd..9d4188f 100644
--- a/services/audioflinger/StateQueue.cpp
+++ b/services/audioflinger/StateQueue.cpp
@@ -48,7 +48,7 @@ template<typename T> StateQueue<T>::StateQueue() :
, mObserverDump(&mObserverDummyDump), mMutatorDump(&mMutatorDummyDump)
#endif
{
- atomic_init(&mNext, 0);
+ atomic_init(&mNext, static_cast<uintptr_t>(0));
}
template<typename T> StateQueue<T>::~StateQueue()
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index dab6d91..3f4ff3e 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -338,7 +338,7 @@ AudioFlinger::ThreadBase::~ThreadBase()
// do not lock the mutex in destructor
releaseWakeLock_l();
if (mPowerManager != 0) {
- sp<IBinder> binder = mPowerManager->asBinder();
+ sp<IBinder> binder = IInterface::asBinder(mPowerManager);
binder->unlinkToDeath(mDeathRecipient);
}
}
diff --git a/services/audioflinger/tests/Android.mk b/services/audioflinger/tests/Android.mk
index 7bba05b..8604ef5 100644
--- a/services/audioflinger/tests/Android.mk
+++ b/services/audioflinger/tests/Android.mk
@@ -10,19 +10,10 @@ LOCAL_SHARED_LIBRARIES := \
liblog \
libutils \
libcutils \
- libstlport \
libaudioutils \
libaudioresampler
-LOCAL_STATIC_LIBRARIES := \
- libgtest \
- libgtest_main
-
LOCAL_C_INCLUDES := \
- bionic \
- bionic/libstdc++/include \
- external/gtest/include \
- external/stlport/stlport \
$(call include-path-for, audio-utils) \
frameworks/av/services/audioflinger
@@ -32,21 +23,24 @@ LOCAL_SRC_FILES := \
LOCAL_MODULE := resampler_tests
LOCAL_MODULE_TAGS := tests
-include $(BUILD_EXECUTABLE)
+include $(BUILD_NATIVE_TEST)
#
# audio mixer test tool
#
include $(CLEAR_VARS)
+# Clang++ aborts on AudioMixer.cpp,
+# b/18373866, "do not know how to split this operator."
+ifeq ($(filter $(TARGET_ARCH),arm arm64),$(TARGET_ARCH))
+ LOCAL_CLANG := false
+endif
+
LOCAL_SRC_FILES:= \
test-mixer.cpp \
../AudioMixer.cpp.arm \
LOCAL_C_INCLUDES := \
- bionic \
- bionic/libstdc++/include \
- external/stlport/stlport \
$(call include-path-for, audio-effects) \
$(call include-path-for, audio-utils) \
frameworks/av/services/audioflinger
@@ -55,7 +49,6 @@ LOCAL_STATIC_LIBRARIES := \
libsndfile
LOCAL_SHARED_LIBRARIES := \
- libstlport \
libeffects \
libnbaio \
libcommon_time_client \
@@ -70,4 +63,6 @@ LOCAL_MODULE:= test-mixer
LOCAL_MODULE_TAGS := optional
+LOCAL_CXX_STL := libc++
+
include $(BUILD_EXECUTABLE)
diff --git a/services/audiopolicy/AudioPolicyService.cpp b/services/audiopolicy/AudioPolicyService.cpp
index 8a9abc9..b80380e 100644
--- a/services/audiopolicy/AudioPolicyService.cpp
+++ b/services/audiopolicy/AudioPolicyService.cpp
@@ -35,6 +35,7 @@
#include <hardware_legacy/power.h>
#include <media/AudioEffect.h>
#include <media/EffectsFactoryApi.h>
+#include <media/AudioParameter.h>
#include <hardware/hardware.h>
#include <system/audio.h>
@@ -160,7 +161,7 @@ void AudioPolicyService::registerClient(const sp<IAudioPolicyServiceClient>& cli
mNotificationClients.add(uid, notificationClient);
- sp<IBinder> binder = client->asBinder();
+ sp<IBinder> binder = IInterface::asBinder(client);
binder->linkToDeath(notificationClient);
}
}
diff --git a/services/audiopolicy/AudioPolicyService.h b/services/audiopolicy/AudioPolicyService.h
index da17728..74a59a8 100644
--- a/services/audiopolicy/AudioPolicyService.h
+++ b/services/audiopolicy/AudioPolicyService.h
@@ -30,7 +30,9 @@
#include <media/IAudioPolicyService.h>
#include <media/ToneGenerator.h>
#include <media/AudioEffect.h>
+#ifdef USE_LEGACY_AUDIO_POLICY
#include <hardware_legacy/AudioPolicyInterface.h>
+#endif
#include "AudioPolicyEffects.h"
#include "AudioPolicyManager.h"
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp
index 76428da..1232c32 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<BasicClient> 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<BasicClient> clientTmp;
if (!canConnectUnsafe(cameraId, clientPackageName,
- cameraClient->asBinder(),
+ IInterface::asBinder(cameraClient),
/*out*/clientTmp)) {
return -EBUSY;
} else if (client.get() != NULL) {
@@ -889,7 +889,7 @@ status_t CameraService::connectPro(
{
sp<BasicClient> client;
if (!canConnectUnsafe(cameraId, clientPackageName,
- cameraCb->asBinder(),
+ IInterface::asBinder(cameraCb),
/*out*/client)) {
return -EBUSY;
}
@@ -962,7 +962,7 @@ status_t CameraService::connectDevice(
{
sp<BasicClient> client;
if (!canConnectUnsafe(cameraId, clientPackageName,
- cameraCb->asBinder(),
+ IInterface::asBinder(cameraCb),
/*out*/client)) {
return -EBUSY;
}
@@ -1024,7 +1024,7 @@ status_t CameraService::addListener(
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;
@@ -1057,7 +1057,7 @@ status_t CameraService::removeListener(
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;
}
@@ -1170,7 +1170,7 @@ void CameraService::removeClientByRemote(const wp<IBinder>& 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,8 @@ CameraService::Client::Client(const sp<CameraService>& cameraService,
int cameraId, int cameraFacing,
int clientPid, uid_t clientUid,
int servicePid) :
- CameraService::BasicClient(cameraService, cameraClient->asBinder(),
+ CameraService::BasicClient(cameraService,
+ IInterface::asBinder(cameraClient),
clientPackageName,
cameraId, cameraFacing,
clientPid, clientUid,
@@ -1477,7 +1478,9 @@ status_t CameraService::BasicClient::finishCameraOps() {
}
// Always stop watching, even if no camera op is active
- mAppOpsManager.stopWatchingMode(mOpsCallback);
+ if (mOpsCallback != NULL) {
+ mAppOpsManager.stopWatchingMode(mOpsCallback);
+ }
mOpsCallback.clear();
return OK;
@@ -1573,7 +1576,7 @@ CameraService::ProClient::ProClient(const sp<CameraService>& 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<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 6e7824e..60939f9 100644
--- a/services/camera/libcameraservice/api1/Camera2Client.cpp
+++ b/services/camera/libcameraservice/api1/Camera2Client.cpp
@@ -165,7 +165,8 @@ status_t Camera2Client::dump(int fd, const Vector<String16>& args) {
String8 result;
result.appendFormat("Client2[%d] (%p) Client: %s PID: %d, dump:\n",
mCameraId,
- getRemoteCallback()->asBinder().get(),
+ (getRemoteCallback() != NULL ?
+ (IInterface::asBinder(getRemoteCallback()).get()) : NULL),
String8(mClientPackageName).string(),
mClientPid);
result.append(" State: ");
@@ -531,7 +532,7 @@ status_t Camera2Client::setPreviewTarget(
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 1a4d9a6..bbb2fe0 100644
--- a/services/camera/libcameraservice/api1/CameraClient.cpp
+++ b/services/camera/libcameraservice/api1/CameraClient.cpp
@@ -118,7 +118,8 @@ status_t CameraClient::dump(int fd, const Vector<String16>& args) {
size_t len = snprintf(buffer, SIZE, "Client[%d] (%p) PID: %d\n",
mCameraId,
- getRemoteCallback()->asBinder().get(),
+ (getRemoteCallback() != NULL ?
+ IInterface::asBinder(getRemoteCallback()).get() : NULL),
mClientPid);
len = (len > SIZE - 1) ? SIZE - 1 : len;
write(fd, buffer, len);
@@ -205,7 +206,7 @@ status_t CameraClient::connect(const sp<ICameraClient>& client) {
}
if (mRemoteCallback != 0 &&
- (client->asBinder() == mRemoteCallback->asBinder())) {
+ (IInterface::asBinder(client) == IInterface::asBinder(mRemoteCallback))) {
LOG1("Connect to the same client");
return NO_ERROR;
}
@@ -328,7 +329,7 @@ status_t CameraClient::setPreviewTarget(
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/client2/Parameters.h b/services/camera/libcameraservice/api1/client2/Parameters.h
index 7e5be84..e628a7e 100644
--- a/services/camera/libcameraservice/api1/client2/Parameters.h
+++ b/services/camera/libcameraservice/api1/client2/Parameters.h
@@ -19,11 +19,13 @@
#include <system/graphics.h>
+#include <utils/Compat.h>
#include <utils/Errors.h>
+#include <utils/KeyedVector.h>
#include <utils/Mutex.h>
#include <utils/String8.h>
#include <utils/Vector.h>
-#include <utils/KeyedVector.h>
+
#include <camera/CameraParameters.h>
#include <camera/CameraParameters2.h>
#include <camera/CameraMetadata.h>
@@ -187,7 +189,7 @@ struct Parameters {
static const int MAX_INITIAL_PREVIEW_WIDTH = 1920;
static const int MAX_INITIAL_PREVIEW_HEIGHT = 1080;
// Aspect ratio tolerance
- static const float ASPECT_RATIO_TOLERANCE = 0.001;
+ static const CONSTEXPR float ASPECT_RATIO_TOLERANCE = 0.001;
// Full static camera info, object owned by someone else, such as
// Camera2Device.
diff --git a/services/camera/libcameraservice/api2/CameraDeviceClient.cpp b/services/camera/libcameraservice/api2/CameraDeviceClient.cpp
index e3301aa..920adf6 100644
--- a/services/camera/libcameraservice/api2/CameraDeviceClient.cpp
+++ b/services/camera/libcameraservice/api2/CameraDeviceClient.cpp
@@ -42,8 +42,14 @@ CameraDeviceClientBase::CameraDeviceClientBase(
int clientPid,
uid_t clientUid,
int servicePid) :
- BasicClient(cameraService, remoteCallback->asBinder(), clientPackageName,
- cameraId, cameraFacing, clientPid, clientUid, servicePid),
+ BasicClient(cameraService,
+ IInterface::asBinder(remoteCallback),
+ clientPackageName,
+ cameraId,
+ cameraFacing,
+ clientPid,
+ clientUid,
+ servicePid),
mRemoteCallback(remoteCallback) {
}
@@ -157,7 +163,7 @@ status_t CameraDeviceClient::submitRequestList(List<sp<CaptureRequest> > request
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) {
@@ -327,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)",
@@ -353,12 +359,8 @@ status_t CameraDeviceClient::createStream(int width, int height, int format,
useAsync = true;
}
- sp<IBinder> binder;
- sp<ANativeWindow> anw;
- if (bufferProducer != 0) {
- binder = bufferProducer->asBinder();
- anw = new Surface(bufferProducer, useAsync);
- }
+ sp<IBinder> binder = IInterface::asBinder(bufferProducer);
+ sp<ANativeWindow> anw = new Surface(bufferProducer, useAsync);
// TODO: remove w,h,f since we are ignoring them
@@ -395,7 +397,7 @@ status_t CameraDeviceClient::createStream(int width, int height, int format,
res = mDevice->createStream(anw, width, height, format, &streamId);
if (res == OK) {
- mStreamMap.add(bufferProducer->asBinder(), streamId);
+ mStreamMap.add(binder, streamId);
ALOGV("%s: Camera %d: Successfully created a new stream ID %d",
__FUNCTION__, mCameraId, streamId);
@@ -514,7 +516,8 @@ status_t CameraDeviceClient::dump(int fd, const Vector<String16>& args) {
String8 result;
result.appendFormat("CameraDeviceClient[%d] (%p) dump:\n",
mCameraId,
- getRemoteCallback()->asBinder().get());
+ (getRemoteCallback() != 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 2ea460f..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<IBinder> binder;
sp<ANativeWindow> window;
if (bufferProducer != 0) {
- binder = bufferProducer->asBinder();
+ binder = IInterface::asBinder(bufferProducer);
window = new Surface(bufferProducer);
}
@@ -334,7 +334,8 @@ status_t ProCamera2Client::dump(int fd, const Vector<String16>& args) {
String8 result;
result.appendFormat("ProCamera2Client[%d] (%p) PID: %d, dump:\n",
mCameraId,
- getRemoteCallback()->asBinder().get(),
+ (getRemoteCallback() != 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 d6db151..453c8bd 100644
--- a/services/camera/libcameraservice/common/Camera2ClientBase.cpp
+++ b/services/camera/libcameraservice/common/Camera2ClientBase.cpp
@@ -128,7 +128,8 @@ status_t Camera2ClientBase<TClientBase>::dump(int fd,
String8 result;
result.appendFormat("Camera2ClientBase[%d] (%p) PID: %d, dump:\n",
TClientBase::mCameraId,
- TClientBase::getRemoteCallback()->asBinder().get(),
+ (TClientBase::getRemoteCallback() != 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<IBinder> asBinderWrapper() {
- return IInterface::asBinder();
+ return IInterface::asBinder(this);
}
virtual status_t dumpDevice(int fd, const Vector<String16>& args);
diff --git a/services/camera/libcameraservice/device1/CameraHardwareInterface.h b/services/camera/libcameraservice/device1/CameraHardwareInterface.h
index 6386838..1935c2b 100644
--- a/services/camera/libcameraservice/device1/CameraHardwareInterface.h
+++ b/services/camera/libcameraservice/device1/CameraHardwareInterface.h
@@ -588,7 +588,7 @@ private:
#ifndef container_of
#define container_of(ptr, type, member) ({ \
- const typeof(((type *) 0)->member) *__mptr = (ptr); \
+ const __typeof__(((type *) 0)->member) *__mptr = (ptr); \
(type *) ((char *) __mptr - (char *)(&((type *)0)->member)); })
#endif
diff --git a/services/soundtrigger/SoundTriggerHwService.cpp b/services/soundtrigger/SoundTriggerHwService.cpp
index d3b67f6..081aff7 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> 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<SoundTriggerHwService> service = mService.promote();
if (service == 0) {