Merge "audio_channel_in/out_mask_from_count"
diff --git a/src/Android.mk b/src/Android.mk
index 9c69bfa..c0ced44 100644
--- a/src/Android.mk
+++ b/src/Android.mk
@@ -8,7 +8,7 @@
         ut/slesutResult.c
 
 LOCAL_C_INCLUDES:= \
-        system/media/wilhelm/include
+        $(call include-path-for, wilhelm)
 
 LOCAL_CFLAGS += -fvisibility=hidden -UNDEBUG
 
@@ -19,7 +19,7 @@
 include $(CLEAR_VARS)
 
 LOCAL_C_INCLUDES:= \
-        system/media/wilhelm/include
+        $(call include-path-for, wilhelm)
 
 LOCAL_CFLAGS += -Wno-override-init
 # -Wno-missing-field-initializers
@@ -159,11 +159,11 @@
         itf/IVisualization.c
 
 LOCAL_C_INCLUDES:=                                                  \
-        system/media/wilhelm/include                                \
+        $(call include-path-for, wilhelm)                           \
         frameworks/base/media/libstagefright                        \
         frameworks/base/media/libstagefright/include                \
         frameworks/native/include/media/openmax                     \
-        system/media/audio_effects/include
+        $(call include-path-for, audio-effects)
 
 # __pthread_gettid
 LOCAL_C_INCLUDES += bionic/libc/private
@@ -177,6 +177,7 @@
 LOCAL_SHARED_LIBRARIES :=         \
         libutils                  \
         libmedia                  \
+        libmedia_native           \
         libbinder                 \
         libstagefright            \
         libstagefright_foundation \
@@ -199,7 +200,7 @@
 include $(CLEAR_VARS)
 LOCAL_SRC_FILES := sl_entry.c sl_iid.c assert.c
 LOCAL_C_INCLUDES:=                                                  \
-        system/media/wilhelm/include                                \
+        $(call include-path-for, wilhelm)                           \
         frameworks/base/media/libstagefright                        \
         frameworks/base/media/libstagefright/include                \
         frameworks/native/include/media/openmax
@@ -214,7 +215,7 @@
 include $(CLEAR_VARS)
 LOCAL_SRC_FILES := xa_entry.c xa_iid.c assert.c
 LOCAL_C_INCLUDES:=                                                  \
-        system/media/wilhelm/include                                \
+        $(call include-path-for, wilhelm)                           \
         frameworks/base/media/libstagefright                        \
         frameworks/base/media/libstagefright/include                \
         frameworks/native/include/media/openmax
diff --git a/src/android/AudioPlayer_to_android.cpp b/src/android/AudioPlayer_to_android.cpp
index 36a036d..ae526fe 100644
--- a/src/android/AudioPlayer_to_android.cpp
+++ b/src/android/AudioPlayer_to_android.cpp
@@ -129,7 +129,7 @@
 
             // the buffer at the head of the buffer queue is full, update the state
             ap->mBufferQueue.mSizeConsumed = 0;
-            if (newFront ==  &ap->mBufferQueue.mArray[ap->mBufferQueue.mNumBuffers + 1]) {
+            if (newFront == &ap->mBufferQueue.mArray[ap->mBufferQueue.mNumBuffers + 1]) {
                 newFront = ap->mBufferQueue.mArray;
             }
             ap->mBufferQueue.mFront = newFront;
@@ -900,7 +900,7 @@
     case SL_DATALOCATOR_BUFFERQUEUE:
     case SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE:
         {
-        SLDataLocator_BufferQueue *dl_bq =  (SLDataLocator_BufferQueue *) pAudioSrc->pLocator;
+        SLDataLocator_BufferQueue *dl_bq = (SLDataLocator_BufferQueue *) pAudioSrc->pLocator;
 
         // Buffer format
         switch (sourceFormatType) {
@@ -990,7 +990,7 @@
     //   URI
     case SL_DATALOCATOR_URI:
         {
-        SLDataLocator_URI *dl_uri =  (SLDataLocator_URI *) pAudioSrc->pLocator;
+        SLDataLocator_URI *dl_uri = (SLDataLocator_URI *) pAudioSrc->pLocator;
         if (NULL == dl_uri->URI) {
             return SL_RESULT_PARAMETER_INVALID;
         }
@@ -1364,7 +1364,7 @@
         {
         // initialize platform-specific CAudioPlayer fields
 
-        SLDataLocator_BufferQueue *dl_bq =  (SLDataLocator_BufferQueue *)
+        SLDataLocator_BufferQueue *dl_bq = (SLDataLocator_BufferQueue *)
                 pAudioPlayer->mDynamicSource.mDataSource;
         SLDataFormat_PCM *df_pcm = (SLDataFormat_PCM *)
                 pAudioPlayer->mDynamicSource.mDataSource->pFormat;
@@ -1562,39 +1562,39 @@
     SL_LOGD("android_audioPlayer_preDestroy(%p)", pAudioPlayer);
     SLresult result = SL_RESULT_SUCCESS;
 
-  bool disableCallbacksBeforePreDestroy;
-  switch (pAudioPlayer->mAndroidObjType) {
-  // Not yet clear why this order is important, but it reduces detected deadlocks
-  case AUDIOPLAYER_FROM_URIFD_TO_PCM_BUFFERQUEUE:
-    disableCallbacksBeforePreDestroy = true;
-    break;
-  // Use the old behavior for all other use cases until proven
-  // case AUDIOPLAYER_FROM_ADTS_ABQ_TO_PCM_BUFFERQUEUE:
-  default:
-    disableCallbacksBeforePreDestroy = false;
-    break;
-  }
-
-  if (disableCallbacksBeforePreDestroy) {
-    object_unlock_exclusive(&pAudioPlayer->mObject);
-    if (pAudioPlayer->mCallbackProtector != 0) {
-        pAudioPlayer->mCallbackProtector->requestCbExitAndWait();
+    bool disableCallbacksBeforePreDestroy;
+    switch (pAudioPlayer->mAndroidObjType) {
+    // Not yet clear why this order is important, but it reduces detected deadlocks
+    case AUDIOPLAYER_FROM_URIFD_TO_PCM_BUFFERQUEUE:
+        disableCallbacksBeforePreDestroy = true;
+        break;
+    // Use the old behavior for all other use cases until proven
+    // case AUDIOPLAYER_FROM_ADTS_ABQ_TO_PCM_BUFFERQUEUE:
+    default:
+        disableCallbacksBeforePreDestroy = false;
+        break;
     }
-    object_lock_exclusive(&pAudioPlayer->mObject);
-  }
+
+    if (disableCallbacksBeforePreDestroy) {
+        object_unlock_exclusive(&pAudioPlayer->mObject);
+        if (pAudioPlayer->mCallbackProtector != 0) {
+            pAudioPlayer->mCallbackProtector->requestCbExitAndWait();
+        }
+        object_lock_exclusive(&pAudioPlayer->mObject);
+    }
 
     if (pAudioPlayer->mAPlayer != 0) {
         pAudioPlayer->mAPlayer->preDestroy();
     }
     SL_LOGD("android_audioPlayer_preDestroy(%p) after mAPlayer->preDestroy()", pAudioPlayer);
 
-  if (!disableCallbacksBeforePreDestroy) {
-    object_unlock_exclusive(&pAudioPlayer->mObject);
-    if (pAudioPlayer->mCallbackProtector != 0) {
-        pAudioPlayer->mCallbackProtector->requestCbExitAndWait();
+    if (!disableCallbacksBeforePreDestroy) {
+        object_unlock_exclusive(&pAudioPlayer->mObject);
+        if (pAudioPlayer->mCallbackProtector != 0) {
+            pAudioPlayer->mCallbackProtector->requestCbExitAndWait();
+        }
+        object_lock_exclusive(&pAudioPlayer->mObject);
     }
-    object_lock_exclusive(&pAudioPlayer->mObject);
-  }
 
     return result;
 }
diff --git a/src/android/AudioRecorder_to_android.cpp b/src/android/AudioRecorder_to_android.cpp
index e288a6e..326b8c9 100644
--- a/src/android/AudioRecorder_to_android.cpp
+++ b/src/android/AudioRecorder_to_android.cpp
@@ -192,7 +192,7 @@
     } else {
 
         // check it's an input device
-        SLDataLocator_IODevice *dl_iod =  (SLDataLocator_IODevice *) pAudioSrc->pLocator;
+        SLDataLocator_IODevice *dl_iod = (SLDataLocator_IODevice *) pAudioSrc->pLocator;
         if (SL_IODEVICE_AUDIOINPUT != dl_iod->deviceType) {
             SL_LOGE(ERROR_RECORDER_IODEVICE_MUST_BE_AUDIOINPUT);
             return SL_RESULT_PARAMETER_INVALID;
@@ -244,7 +244,7 @@
                 // finish pushing the buffer or push the buffer in one shot
                 pBuff->size = oldFront->mSize - ar->mBufferQueue.mSizeConsumed;
                 ar->mBufferQueue.mSizeConsumed = 0;
-                if (newFront ==  &ar->mBufferQueue.mArray[ar->mBufferQueue.mNumBuffers + 1]) {
+                if (newFront == &ar->mBufferQueue.mArray[ar->mBufferQueue.mNumBuffers + 1]) {
                     newFront = ar->mBufferQueue.mArray;
                 }
                 ar->mBufferQueue.mFront = newFront;
diff --git a/src/android/VideoCodec_to_android.cpp b/src/android/VideoCodec_to_android.cpp
index 01c3af2..113bd8c 100644
--- a/src/android/VideoCodec_to_android.cpp
+++ b/src/android/VideoCodec_to_android.cpp
@@ -181,7 +181,7 @@
             pDescr->codecId = decoderId;
             pDescr->profileSetting = convertOpenMaxIlToAl(VideoDecoderCapabilities[decoderIndex].
                     itemAt(0).mProfileLevels.itemAt(plIndex).mProfile);
-            pDescr->levelSetting =  convertOpenMaxIlToAl(VideoDecoderCapabilities[decoderIndex].
+            pDescr->levelSetting = convertOpenMaxIlToAl(VideoDecoderCapabilities[decoderIndex].
                     itemAt(0).mProfileLevels.itemAt(plIndex).mLevel);
             //     initialize the fields we don't know about
             pDescr->maxWidth = 0;
diff --git a/src/itf/IEqualizer.c b/src/itf/IEqualizer.c
index e50bdb7..14ff965 100644
--- a/src/itf/IEqualizer.c
+++ b/src/itf/IEqualizer.c
@@ -80,25 +80,25 @@
 {
     SL_ENTER_INTERFACE
 
-      if (NULL == pEnabled) {
-          result = SL_RESULT_PARAMETER_INVALID;
-      } else {
-          IEqualizer *thiz = (IEqualizer *) self;
-          interface_lock_exclusive(thiz);
-          SLboolean enabled = thiz->mEnabled;
+    if (NULL == pEnabled) {
+        result = SL_RESULT_PARAMETER_INVALID;
+    } else {
+        IEqualizer *thiz = (IEqualizer *) self;
+        interface_lock_exclusive(thiz);
+        SLboolean enabled = thiz->mEnabled;
  #if !defined(ANDROID)
-          *pEnabled = enabled;
-          result = SL_RESULT_SUCCESS;
+        *pEnabled = enabled;
+        result = SL_RESULT_SUCCESS;
  #else
-          if (NO_EQ(thiz)) {
-              result = SL_RESULT_CONTROL_LOST;
-          } else {
-              *pEnabled = (SLboolean) thiz->mEqEffect->getEnabled();
-              result = SL_RESULT_SUCCESS;
-          }
+        if (NO_EQ(thiz)) {
+            result = SL_RESULT_CONTROL_LOST;
+        } else {
+            *pEnabled = (SLboolean) thiz->mEqEffect->getEnabled();
+            result = SL_RESULT_SUCCESS;
+        }
  #endif
-          interface_unlock_exclusive(thiz);
-      }
+        interface_unlock_exclusive(thiz);
+    }
 
       SL_LEAVE_INTERFACE
 }
diff --git a/src/itf/IStreamInformation.c b/src/itf/IStreamInformation.c
index bfd9233..d8da5a9 100644
--- a/src/itf/IStreamInformation.c
+++ b/src/itf/IStreamInformation.c
@@ -60,7 +60,7 @@
     }
 
 #ifndef ANDROID
-    *domain =  XA_DOMAINTYPE_UNKNOWN;
+    *domain = XA_DOMAINTYPE_UNKNOWN;
 #else
     if (0 == streamIndex) {
         // stream 0 is reserved for the container
diff --git a/src/itf/IVirtualizer.c b/src/itf/IVirtualizer.c
index 70e2295..c640811 100644
--- a/src/itf/IVirtualizer.c
+++ b/src/itf/IVirtualizer.c
@@ -64,27 +64,27 @@
 {
     SL_ENTER_INTERFACE
 
-     if (NULL == pEnabled) {
-         result = SL_RESULT_PARAMETER_INVALID;
-     } else {
-         IVirtualizer *thiz = (IVirtualizer *) self;
-         interface_lock_exclusive(thiz);
-         SLboolean enabled = thiz->mEnabled;
+    if (NULL == pEnabled) {
+        result = SL_RESULT_PARAMETER_INVALID;
+    } else {
+        IVirtualizer *thiz = (IVirtualizer *) self;
+        interface_lock_exclusive(thiz);
+        SLboolean enabled = thiz->mEnabled;
 #if !defined(ANDROID)
-         *pEnabled = enabled;
-         result = SL_RESULT_SUCCESS;
+        *pEnabled = enabled;
+        result = SL_RESULT_SUCCESS;
 #else
-         if (NO_VIRTUALIZER(thiz)) {
-             result = SL_RESULT_CONTROL_LOST;
-         } else {
-             *pEnabled = (SLboolean) thiz->mVirtualizerEffect->getEnabled();
-             result = SL_RESULT_SUCCESS;
-         }
+        if (NO_VIRTUALIZER(thiz)) {
+            result = SL_RESULT_CONTROL_LOST;
+        } else {
+            *pEnabled = (SLboolean) thiz->mVirtualizerEffect->getEnabled();
+            result = SL_RESULT_SUCCESS;
+        }
 #endif
-         interface_unlock_exclusive(thiz);
-     }
+        interface_unlock_exclusive(thiz);
+    }
 
-     SL_LEAVE_INTERFACE
+    SL_LEAVE_INTERFACE
 }
 
 
@@ -92,27 +92,27 @@
 {
     SL_ENTER_INTERFACE
 
-     if ((VIRTUALIZER_STRENGTH_MIN > strength) || (VIRTUALIZER_STRENGTH_MAX < strength)) {
-         result = SL_RESULT_PARAMETER_INVALID;
-     } else {
-         IVirtualizer *thiz = (IVirtualizer *) self;
-         interface_lock_exclusive(thiz);
+    if ((VIRTUALIZER_STRENGTH_MIN > strength) || (VIRTUALIZER_STRENGTH_MAX < strength)) {
+        result = SL_RESULT_PARAMETER_INVALID;
+    } else {
+        IVirtualizer *thiz = (IVirtualizer *) self;
+        interface_lock_exclusive(thiz);
 #if !defined(ANDROID)
-         thiz->mStrength = strength;
-         result = SL_RESULT_SUCCESS;
+        thiz->mStrength = strength;
+        result = SL_RESULT_SUCCESS;
 #else
-         if (NO_VIRTUALIZER(thiz)) {
-             result = SL_RESULT_CONTROL_LOST;
-         } else {
-             android::status_t status = android_virt_setParam(thiz->mVirtualizerEffect,
-                     VIRTUALIZER_PARAM_STRENGTH, &strength);
-             result = android_fx_statusToResult(status);
-         }
+        if (NO_VIRTUALIZER(thiz)) {
+            result = SL_RESULT_CONTROL_LOST;
+        } else {
+            android::status_t status = android_virt_setParam(thiz->mVirtualizerEffect,
+                    VIRTUALIZER_PARAM_STRENGTH, &strength);
+            result = android_fx_statusToResult(status);
+        }
 #endif
-         interface_unlock_exclusive(thiz);
-     }
+        interface_unlock_exclusive(thiz);
+    }
 
-     SL_LEAVE_INTERFACE
+    SL_LEAVE_INTERFACE
 }
 
 
diff --git a/tests/Android.mk b/tests/Android.mk
index 9580245..9818656 100644
--- a/tests/Android.mk
+++ b/tests/Android.mk
@@ -18,7 +18,7 @@
     bionic \
     bionic/libstdc++/include \
     external/gtest/include \
-    system/media/wilhelm/include \
+    $(call include-path-for, wilhelm) \
     external/stlport/stlport
 
 module_tags := tests
diff --git a/tests/automated/Android.mk b/tests/automated/Android.mk
index fcb9eeb..76a2401 100644
--- a/tests/automated/Android.mk
+++ b/tests/automated/Android.mk
@@ -8,9 +8,9 @@
     bionic \
     bionic/libstdc++/include \
     external/gtest/include \
-    system/media/wilhelm/include \
+    $(call include-path-for, wilhelm) \
     external/stlport/stlport \
-    system/media/wilhelm/src/ut
+    $(call include-path-for, wilhelm-ut)
 
 LOCAL_SRC_FILES:= \
     BufferQueue_test.cpp
diff --git a/tests/examples/Android.mk b/tests/examples/Android.mk
index f9e912e..d16164e 100644
--- a/tests/examples/Android.mk
+++ b/tests/examples/Android.mk
@@ -7,7 +7,7 @@
 LOCAL_MODULE_TAGS := tests
 
 LOCAL_C_INCLUDES:= \
-	system/media/wilhelm/include
+	$(call include-path-for, wilhelm)
 
 LOCAL_SRC_FILES:= \
 	slesTestRecBuffQueue.cpp
@@ -31,7 +31,7 @@
 LOCAL_MODULE_TAGS := tests
 
 LOCAL_C_INCLUDES:= \
-	system/media/wilhelm/include
+	$(call include-path-for, wilhelm)
 
 LOCAL_SRC_FILES:= \
 	slesTestPlayFdPath.cpp
@@ -55,7 +55,7 @@
 LOCAL_MODULE_TAGS := tests
 
 LOCAL_C_INCLUDES:= \
-	system/media/wilhelm/include
+	$(call include-path-for, wilhelm)
 
 LOCAL_SRC_FILES:= \
     slesTestFeedback.cpp
@@ -82,7 +82,7 @@
 LOCAL_MODULE_TAGS := tests
 
 LOCAL_C_INCLUDES:= \
-	system/media/wilhelm/include
+	$(call include-path-for, wilhelm)
 
 LOCAL_SRC_FILES:= \
 	slesTestSawtoothBufferQueue.cpp
@@ -107,7 +107,7 @@
 LOCAL_MODULE_TAGS := tests
 
 LOCAL_C_INCLUDES:= \
-	system/media/wilhelm/include
+	$(call include-path-for, wilhelm)
 
 LOCAL_SRC_FILES:= \
 	slesTestEqFdPath.cpp
@@ -131,7 +131,7 @@
 LOCAL_MODULE_TAGS := tests
 
 LOCAL_C_INCLUDES:= \
-	system/media/wilhelm/include
+	$(call include-path-for, wilhelm)
 
 LOCAL_SRC_FILES:= \
 	slesTestEqOutputPath.cpp
@@ -155,7 +155,7 @@
 LOCAL_MODULE_TAGS := tests
 
 LOCAL_C_INCLUDES:= \
-	system/media/wilhelm/include
+	$(call include-path-for, wilhelm)
 
 LOCAL_SRC_FILES:= \
 	slesTestBassBoostPath.cpp
@@ -179,7 +179,7 @@
 LOCAL_MODULE_TAGS := tests
 
 LOCAL_C_INCLUDES:= \
-	system/media/wilhelm/include
+	$(call include-path-for, wilhelm)
 
 LOCAL_SRC_FILES:= \
 	slesTestVirtualizerPath.cpp
@@ -203,7 +203,7 @@
 LOCAL_MODULE_TAGS := tests
 
 LOCAL_C_INCLUDES:= \
-	system/media/wilhelm/include
+	$(call include-path-for, wilhelm)
 
 LOCAL_SRC_FILES:= \
 	slesTestEffectCapabilities.cpp
@@ -227,7 +227,7 @@
 LOCAL_MODULE_TAGS := tests
 
 LOCAL_C_INCLUDES:= \
-	system/media/wilhelm/include
+	$(call include-path-for, wilhelm)
 
 LOCAL_SRC_FILES:= \
 	slesTestSendToPresetReverb.cpp
@@ -251,7 +251,7 @@
 LOCAL_MODULE_TAGS := tests
 
 LOCAL_C_INCLUDES:= \
-	system/media/wilhelm/include
+	$(call include-path-for, wilhelm)
 
 LOCAL_SRC_FILES:= \
 	slesTestDecodeToBuffQueue.cpp
@@ -276,7 +276,7 @@
 LOCAL_MODULE_TAGS := tests
 
 LOCAL_C_INCLUDES:= \
-	system/media/wilhelm/include
+	$(call include-path-for, wilhelm)
 
 LOCAL_SRC_FILES:= \
 	slesTestDecodeAac.cpp
@@ -307,7 +307,7 @@
 LOCAL_MODULE_TAGS := tests
 
 LOCAL_C_INCLUDES:= \
-	system/media/wilhelm/include
+	$(call include-path-for, wilhelm)
 
 LOCAL_SRC_FILES:= \
 	xaVideoDecoderCapabilities.cpp
diff --git a/tests/listening/Android.mk b/tests/listening/Android.mk
index 89d838a..8b165d1 100644
--- a/tests/listening/Android.mk
+++ b/tests/listening/Android.mk
@@ -7,7 +7,7 @@
 LOCAL_MODULE_TAGS := tests
 
 LOCAL_C_INCLUDES:= \
-	system/media/wilhelm/include
+	$(call include-path-for, wilhelm)
 
 LOCAL_SRC_FILES:= \
 	seekTorture.c
@@ -31,7 +31,7 @@
 LOCAL_MODULE_TAGS := tests
 
 LOCAL_C_INCLUDES:= \
-	system/media/wilhelm/include
+	$(call include-path-for, wilhelm)
 
 LOCAL_SRC_FILES:= \
 	slesTest_playMuteSolo.cpp
diff --git a/tests/mimeUri/Android.mk b/tests/mimeUri/Android.mk
index 04742ba..ac2ed88 100644
--- a/tests/mimeUri/Android.mk
+++ b/tests/mimeUri/Android.mk
@@ -7,7 +7,7 @@
 LOCAL_MODULE_TAGS := tests
 
 LOCAL_C_INCLUDES:= \
-	system/media/wilhelm/include
+	$(call include-path-for, wilhelm)
 
 LOCAL_SRC_FILES:= \
 	slesTest_playStates.cpp
@@ -33,7 +33,7 @@
 LOCAL_MODULE_TAGS := tests
 
 LOCAL_C_INCLUDES:= \
-	system/media/wilhelm/include
+	$(call include-path-for, wilhelm)
 
 LOCAL_SRC_FILES:= \
 	slesTestPlayStreamType.cpp
@@ -59,7 +59,7 @@
 LOCAL_MODULE_TAGS := tests
 
 LOCAL_C_INCLUDES:= \
-	system/media/wilhelm/include
+	$(call include-path-for, wilhelm)
 
 LOCAL_SRC_FILES:= \
 	slesTestPlayUri.cpp
@@ -85,7 +85,7 @@
 LOCAL_MODULE_TAGS := tests
 
 LOCAL_C_INCLUDES:= \
-	system/media/wilhelm/include
+	$(call include-path-for, wilhelm)
 
 LOCAL_SRC_FILES:= \
 	slesTestLoopUri.cpp
@@ -111,7 +111,7 @@
 LOCAL_MODULE_TAGS := tests
 
 LOCAL_C_INCLUDES:= \
-	system/media/wilhelm/include
+	$(call include-path-for, wilhelm)
 
 LOCAL_SRC_FILES:= \
 	slesTestPlayUri2.cpp
@@ -137,7 +137,7 @@
 LOCAL_MODULE_TAGS := tests
 
 LOCAL_C_INCLUDES:= \
-	system/media/wilhelm/include
+	$(call include-path-for, wilhelm)
 
 LOCAL_SRC_FILES:= \
 	slesTestSlowDownUri.cpp
@@ -163,7 +163,7 @@
 LOCAL_MODULE_TAGS := tests
 
 LOCAL_C_INCLUDES:= \
-	system/media/wilhelm/include
+	$(call include-path-for, wilhelm)
 
 LOCAL_SRC_FILES:= \
 	slesTestManyPlayers.cpp
@@ -189,7 +189,7 @@
 LOCAL_MODULE_TAGS := tests
 
 LOCAL_C_INCLUDES:= \
-	system/media/wilhelm/include
+	$(call include-path-for, wilhelm)
 
 LOCAL_SRC_FILES:= \
 	slesTestGetPositionUri.cpp
diff --git a/tests/native-media/jni/Android.mk b/tests/native-media/jni/Android.mk
index 4d111ac..ad5e806 100644
--- a/tests/native-media/jni/Android.mk
+++ b/tests/native-media/jni/Android.mk
@@ -5,7 +5,7 @@
 LOCAL_MODULE_TAGS := tests
 LOCAL_MODULE    := libnative-media-jni
 LOCAL_SRC_FILES := native-media-jni.c
-LOCAL_CFLAGS += -Isystem/media/wilhelm/include
+LOCAL_CFLAGS += -I$(call include-path-for, wilhelm)
 LOCAL_CFLAGS += -UNDEBUG
 
 LOCAL_PRELINK_MODULE := false
diff --git a/tests/native-media/jni/native-media-jni.c b/tests/native-media/jni/native-media-jni.c
index a43cb9e..6d7ec28 100644
--- a/tests/native-media/jni/native-media-jni.c
+++ b/tests/native-media/jni/native-media-jni.c
@@ -445,7 +445,7 @@
 
     // start the playback
     res = (*playerPlayItf)->SetPlayState(playerPlayItf, XA_PLAYSTATE_PLAYING);
-        assert(XA_RESULT_SUCCESS == res);
+    assert(XA_RESULT_SUCCESS == res);
 
     return JNI_TRUE;
 }
diff --git a/tests/sandbox/Android.mk b/tests/sandbox/Android.mk
index 53c4fd0..4f39385 100644
--- a/tests/sandbox/Android.mk
+++ b/tests/sandbox/Android.mk
@@ -7,7 +7,7 @@
 LOCAL_MODULE_TAGS := tests
 
 LOCAL_C_INCLUDES:= \
-	system/media/wilhelm/include
+	$(call include-path-for, wilhelm)
 
 LOCAL_SRC_FILES:= \
     intbufq.c \
@@ -35,7 +35,7 @@
 LOCAL_MODULE_TAGS := tests
 
 LOCAL_C_INCLUDES:= \
-	system/media/wilhelm/include
+	$(call include-path-for, wilhelm)
 
 LOCAL_SRC_FILES:= \
 	multiplay.c
@@ -61,8 +61,8 @@
 LOCAL_MODULE_TAGS := tests
 
 LOCAL_C_INCLUDES:= \
-	system/media/wilhelm/include \
-	system/media/wilhelm/src/ut
+	$(call include-path-for, wilhelm) \
+	$(call include-path-for, wilhelm-ut)
 
 LOCAL_SRC_FILES:= \
 	engine.c
@@ -91,8 +91,8 @@
 LOCAL_MODULE_TAGS := tests
 
 LOCAL_C_INCLUDES:= \
-	system/media/wilhelm/include \
-    system/media/wilhelm/src/ut
+	$(call include-path-for, wilhelm) \
+	$(call include-path-for, wilhelm-ut)
 
 LOCAL_SRC_FILES:= \
 	object.c
@@ -121,7 +121,7 @@
 LOCAL_MODULE_TAGS := tests
 
 LOCAL_C_INCLUDES:= \
-	system/media/wilhelm/include
+	$(call include-path-for, wilhelm)
 
 LOCAL_SRC_FILES:= \
 	configbq.c
@@ -147,7 +147,7 @@
 LOCAL_MODULE_TAGS := tests
 
 LOCAL_C_INCLUDES:= \
-	system/media/wilhelm/include
+	$(call include-path-for, wilhelm)
 
 LOCAL_SRC_FILES:= \
 	reverb.c
@@ -176,7 +176,7 @@
 LOCAL_MODULE_TAGS := tests
 
 LOCAL_C_INCLUDES:= \
-	system/media/wilhelm/include
+	$(call include-path-for, wilhelm)
 
 LOCAL_SRC_FILES:= \
 	srcsink.c
@@ -205,8 +205,8 @@
 LOCAL_MODULE_TAGS := tests
 
 LOCAL_C_INCLUDES:= \
-	system/media/wilhelm/include \
-	system/media/wilhelm/src/ut
+	$(call include-path-for, wilhelm) \
+	$(call include-path-for, wilhelm-ut)
 
 LOCAL_SRC_FILES:= \
 	outputmix.c
@@ -235,7 +235,7 @@
 LOCAL_MODULE_TAGS := tests
 
 LOCAL_C_INCLUDES:= \
-	system/media/wilhelm/include
+	$(call include-path-for, wilhelm)
 
 LOCAL_SRC_FILES:= \
 	urimime.c
@@ -264,7 +264,7 @@
 LOCAL_MODULE_TAGS := tests
 
 LOCAL_C_INCLUDES:= \
-	system/media/wilhelm/include
+	$(call include-path-for, wilhelm)
 
 LOCAL_SRC_FILES:= \
 	dim.c
@@ -293,7 +293,7 @@
 LOCAL_MODULE_TAGS := tests
 
 LOCAL_C_INCLUDES:= \
-	system/media/wilhelm/include
+	$(call include-path-for, wilhelm)
 
 LOCAL_SRC_FILES:= \
 	multithread.c
@@ -322,7 +322,7 @@
 LOCAL_MODULE_TAGS := tests
 
 LOCAL_C_INCLUDES:= \
-	system/media/wilhelm/include
+	$(call include-path-for, wilhelm)
 
 LOCAL_SRC_FILES:= \
 	playbq.c
@@ -353,7 +353,7 @@
 LOCAL_MODULE_TAGS := tests
 
 LOCAL_C_INCLUDES:= \
-	system/media/wilhelm/include
+	$(call include-path-for, wilhelm)
 
 LOCAL_SRC_FILES:= \
 	monkey.c
@@ -382,7 +382,7 @@
 LOCAL_MODULE_TAGS := tests
 
 LOCAL_C_INCLUDES:= \
-	system/media/wilhelm/include
+	$(call include-path-for, wilhelm)
 
 LOCAL_SRC_FILES:= \
 	xa.c
@@ -411,7 +411,7 @@
 LOCAL_MODULE_TAGS := tests
 
 LOCAL_C_INCLUDES:= \
-	system/media/wilhelm/include
+	$(call include-path-for, wilhelm)
 
 LOCAL_SRC_FILES:= \
 	dual.c
@@ -441,7 +441,7 @@
 LOCAL_MODULE_TAGS := tests
 
 LOCAL_C_INCLUDES:= \
-	system/media/wilhelm/include
+	$(call include-path-for, wilhelm)
 
 LOCAL_SRC_FILES:= \
 	xaplay.c nativewindow.cpp
diff --git a/tests/sandbox/streamSource/Android.mk b/tests/sandbox/streamSource/Android.mk
index b5fdd10..bdaccc6 100644
--- a/tests/sandbox/streamSource/Android.mk
+++ b/tests/sandbox/streamSource/Android.mk
@@ -7,7 +7,7 @@
 LOCAL_MODULE_TAGS := tests
 
 LOCAL_C_INCLUDES:= \
-	system/media/wilhelm/include
+	$(call include-path-for, wilhelm)
 
 LOCAL_SRC_FILES:= \
 	slesTestPlayStream.cpp
diff --git a/tools/hashgen/Makefile b/tools/hashgen/Makefile
index b9db863..525e2f9 100644
--- a/tools/hashgen/Makefile
+++ b/tools/hashgen/Makefile
@@ -58,7 +58,7 @@
 
 clean :
 	$(RM) part5gen frag1 *.o
-	$(RM) part23in.gperf part5gen.c part23in.c 
+	$(RM) part23in.gperf part5gen.c part23in.c
 	$(RM) part2.c part3.c part5.c part7.c
 
 distclean : clean