Merge "Build libOpenSLES for Brillo."
am: 3bfb87aa6d

* commit '3bfb87aa6d0400ec0fbec0aacac644509220cd24':
  Build libOpenSLES for Brillo.
diff --git a/src/Android.mk b/src/Android.mk
index 0b242a4..601321c 100644
--- a/src/Android.mk
+++ b/src/Android.mk
@@ -185,13 +185,19 @@
         libbinder                 \
         libstagefright            \
         libstagefright_foundation \
-        libstagefright_http_support \
         libcutils                 \
         libgui                    \
         libdl                     \
         libeffects
 
-
+# For Brillo, we do not want this dependency as it significantly increases the
+# size of the checkout. Also, the library is dependent on Java (which is not
+# present in Brillo), so it doesn't really make sense to have it anyways. See
+# b/24507845 for more details.
+ifndef BRILLO
+LOCAL_SHARED_LIBRARIES += \
+        libstagefright_http_support
+endif
 
 LOCAL_MODULE := libwilhelm
 LOCAL_MODULE_TAGS := optional
diff --git a/src/android/android_LocAVPlayer.cpp b/src/android/android_LocAVPlayer.cpp
index fc1694f..67ec5c9 100644
--- a/src/android/android_LocAVPlayer.cpp
+++ b/src/android/android_LocAVPlayer.cpp
@@ -54,12 +54,21 @@
                     mPlaybackParams.sessionId);
             if (mPlayer == NULL) {
                 SL_LOGE("media player service failed to create player by URI");
-            } else if (mPlayer->setDataSource(
-                        CreateHTTPServiceInCurrentJavaContext(),
-                        mDataLocator.uriRef,
-                        NULL /*headers*/) != NO_ERROR) {
-                SL_LOGE("setDataSource failed");
-                mPlayer.clear();
+            } else {
+                sp <IMediaHTTPService> mediaHTTPService;
+#ifndef __BRILLO__
+                // As Brillo doesn't have a Java layer, we don't have to call this
+                // function since it would return NULL anyways. Not having this
+                // function call allows us to significantly reduce the size of the
+                // Brillo checkout.
+                mediaHTTPService = CreateHTTPServiceInCurrentJavaContext();
+#endif
+                status_t status =  mPlayer->setDataSource(
+                    mediaHTTPService, mDataLocator.uriRef, NULL /*headers*/);
+                if (status != NO_ERROR) {
+                    SL_LOGE("setDataSource failed");
+                    mPlayer.clear();
+                }
             }
             break;
         case kDataLocatorFd: