Merge "Connecting to BufferQueue before setting surface." into oc-dev
diff --git a/bluetooth/1.0/default/Android.bp b/bluetooth/1.0/default/Android.bp
index 292f97c..c77f0e6 100644
--- a/bluetooth/1.0/default/Android.bp
+++ b/bluetooth/1.0/default/Android.bp
@@ -41,21 +41,20 @@
 
 cc_library_static {
     name: "android.hardware.bluetooth-async",
+    proprietary: true,
     defaults: ["hidl_defaults"],
     srcs: [
         "async_fd_watcher.cc",
     ],
     export_include_dirs: ["."],
     shared_libs: [
-        "libbase",
-        "libcutils",
         "liblog",
-        "libutils",
     ],
 }
 
 cc_library_static {
     name: "android.hardware.bluetooth-hci",
+    proprietary: true,
     defaults: ["hidl_defaults"],
     srcs: [
         "hci_packetizer.cc",
@@ -66,7 +65,6 @@
     export_include_dirs: ["."],
     shared_libs: [
         "libbase",
-        "libcutils",
         "libhidlbase",
         "liblog",
         "libutils",
diff --git a/bluetooth/1.0/default/bluetooth_hci.cc b/bluetooth/1.0/default/bluetooth_hci.cc
index 8eccfc7..e14e3d7 100644
--- a/bluetooth/1.0/default/bluetooth_hci.cc
+++ b/bluetooth/1.0/default/bluetooth_hci.cc
@@ -17,7 +17,7 @@
 #define LOG_TAG "android.hardware.bluetooth@1.0-impl"
 #include "bluetooth_hci.h"
 
-#include <utils/Log.h>
+#include <log/log.h>
 
 #include "vendor_interface.h"
 
diff --git a/bluetooth/1.0/default/hci_protocol.cc b/bluetooth/1.0/default/hci_protocol.cc
index bb1e36b..a208da1 100644
--- a/bluetooth/1.0/default/hci_protocol.cc
+++ b/bluetooth/1.0/default/hci_protocol.cc
@@ -17,10 +17,9 @@
 #include "hci_protocol.h"
 
 #define LOG_TAG "android.hardware.bluetooth-hci-hci_protocol"
-#include <android-base/logging.h>
 #include <assert.h>
 #include <fcntl.h>
-#include <utils/Log.h>
+#include <log/log.h>
 
 namespace android {
 namespace hardware {
diff --git a/bluetooth/1.0/default/test/async_fd_watcher_unittest.cc b/bluetooth/1.0/default/test/async_fd_watcher_unittest.cc
index b0c533c..dfc50a3 100644
--- a/bluetooth/1.0/default/test/async_fd_watcher_unittest.cc
+++ b/bluetooth/1.0/default/test/async_fd_watcher_unittest.cc
@@ -22,12 +22,12 @@
 #include <cstring>
 #include <vector>
 
+#include <log/log.h>
 #include <netdb.h>
 #include <netinet/in.h>
 #include <sys/socket.h>
 #include <sys/types.h>
 #include <unistd.h>
-#include <utils/Log.h>
 
 namespace android {
 namespace hardware {
diff --git a/bluetooth/1.0/default/test/h4_protocol_unittest.cc b/bluetooth/1.0/default/test/h4_protocol_unittest.cc
index d53aaa9..ad08086 100644
--- a/bluetooth/1.0/default/test/h4_protocol_unittest.cc
+++ b/bluetooth/1.0/default/test/h4_protocol_unittest.cc
@@ -25,10 +25,10 @@
 #include <mutex>
 #include <vector>
 
+#include <log/log.h>
 #include <sys/socket.h>
 #include <sys/types.h>
 #include <unistd.h>
-#include <utils/Log.h>
 
 namespace android {
 namespace hardware {
diff --git a/bluetooth/1.0/default/test/mct_protocol_unittest.cc b/bluetooth/1.0/default/test/mct_protocol_unittest.cc
index 0a6e9eb..d45058e 100644
--- a/bluetooth/1.0/default/test/mct_protocol_unittest.cc
+++ b/bluetooth/1.0/default/test/mct_protocol_unittest.cc
@@ -25,10 +25,10 @@
 #include <mutex>
 #include <vector>
 
+#include <log/log.h>
 #include <sys/socket.h>
 #include <sys/types.h>
 #include <unistd.h>
-#include <utils/Log.h>
 
 namespace android {
 namespace hardware {
diff --git a/bluetooth/1.0/default/test/properties.cc b/bluetooth/1.0/default/test/properties.cc
index ad5c194..6ac4fb4 100644
--- a/bluetooth/1.0/default/test/properties.cc
+++ b/bluetooth/1.0/default/test/properties.cc
@@ -23,7 +23,7 @@
 #include <unistd.h>
 
 #include <cutils/properties.h>
-#include <utils/Log.h>
+#include <log/log.h>
 
 static const int MAX_PROPERTIES = 5;
 
diff --git a/camera/common/1.0/default/Android.bp b/camera/common/1.0/default/Android.bp
index 6437480..10f9fdb 100644
--- a/camera/common/1.0/default/Android.bp
+++ b/camera/common/1.0/default/Android.bp
@@ -1,5 +1,6 @@
 cc_library_static {
     name: "android.hardware.camera.common@1.0-helper",
+    vendor: true,
     defaults: ["hidl_defaults"],
     srcs: [
         "CameraModule.cpp",
diff --git a/camera/provider/2.4/default/Android.bp b/camera/provider/2.4/default/Android.bp
index 9506827..8e8df62 100644
--- a/camera/provider/2.4/default/Android.bp
+++ b/camera/provider/2.4/default/Android.bp
@@ -37,6 +37,7 @@
     shared_libs: [
         "libhidlbase",
         "libhidltransport",
+	"libbinder",
         "liblog",
         "libutils",
         "android.hardware.camera.device@1.0",
diff --git a/camera/provider/2.4/default/service.cpp b/camera/provider/2.4/default/service.cpp
index df2602e..7eeb637 100644
--- a/camera/provider/2.4/default/service.cpp
+++ b/camera/provider/2.4/default/service.cpp
@@ -19,11 +19,16 @@
 #include <android/hardware/camera/provider/2.4/ICameraProvider.h>
 #include <hidl/LegacySupport.h>
 
+#include <binder/ProcessState.h>
+
 using android::hardware::camera::provider::V2_4::ICameraProvider;
 using android::hardware::defaultPassthroughServiceImplementation;
 
 int main()
 {
     ALOGI("Camera provider Service is starting.");
+    // The camera HAL may communicate to other vendor components via
+    // /dev/vndbinder
+    android::ProcessState::initWithDriver("/dev/vndbinder");
     return defaultPassthroughServiceImplementation<ICameraProvider>("legacy/0", /*maxThreads*/ 6);
 }
diff --git a/configstore/1.0/ISurfaceFlingerConfigs.hal b/configstore/1.0/ISurfaceFlingerConfigs.hal
index dcc9bbb..5f975bd 100644
--- a/configstore/1.0/ISurfaceFlingerConfigs.hal
+++ b/configstore/1.0/ISurfaceFlingerConfigs.hal
@@ -108,4 +108,10 @@
      * FramebufferSurface.
      */
     maxFrameBufferAcquiredBuffers() generates(OptionalInt64 value);
+
+    /**
+     * Returns true if surface flinger should start
+     * hardware.graphics.allocator@2.0::IAllocator service.
+     */
+    startGraphicsAllocatorService() generates(OptionalBool value);
 };
diff --git a/configstore/1.0/default/SurfaceFlingerConfigs.cpp b/configstore/1.0/default/SurfaceFlingerConfigs.cpp
index 70bd803..9c134ef 100644
--- a/configstore/1.0/default/SurfaceFlingerConfigs.cpp
+++ b/configstore/1.0/default/SurfaceFlingerConfigs.cpp
@@ -112,6 +112,16 @@
     return Void();
 }
 
+Return<void> SurfaceFlingerConfigs::startGraphicsAllocatorService(
+    startGraphicsAllocatorService_cb _hidl_cb) {
+    bool value = false;
+#ifdef START_GRAPHICS_ALLOCATOR_SERVICE
+    value = true;
+#endif
+    _hidl_cb({true, value});
+    return Void();
+}
+
 }  // namespace implementation
 }  // namespace V1_0
 }  // namespace configstore
diff --git a/configstore/1.0/default/SurfaceFlingerConfigs.h b/configstore/1.0/default/SurfaceFlingerConfigs.h
index 9300511..17a424e 100644
--- a/configstore/1.0/default/SurfaceFlingerConfigs.h
+++ b/configstore/1.0/default/SurfaceFlingerConfigs.h
@@ -35,6 +35,8 @@
     Return<void> hasSyncFramework(hasSyncFramework_cb _hidl_cb) override;
     Return<void> useVrFlinger(useVrFlinger_cb _hidl_cb) override;
     Return<void> maxFrameBufferAcquiredBuffers(maxFrameBufferAcquiredBuffers_cb _hidl_cb) override;
+    Return<void> startGraphicsAllocatorService(
+        startGraphicsAllocatorService_cb _hidl_cb) override;
 
     // Methods from ::android::hidl::base::V1_0::IBase follow.
 
diff --git a/configstore/1.0/default/surfaceflinger.mk b/configstore/1.0/default/surfaceflinger.mk
index 9e3d4d4..3ce768a 100644
--- a/configstore/1.0/default/surfaceflinger.mk
+++ b/configstore/1.0/default/surfaceflinger.mk
@@ -50,3 +50,7 @@
 ifneq ($(NUM_FRAMEBUFFER_SURFACE_BUFFERS),)
     LOCAL_CFLAGS += -DNUM_FRAMEBUFFER_SURFACE_BUFFERS=$(NUM_FRAMEBUFFER_SURFACE_BUFFERS)
 endif
+
+ifneq ($(SF_START_GRAPHICS_ALLOCATOR_SERVICE),)
+    LOCAL_CFLAGS += -DSTART_GRAPHICS_ALLOCATOR_SERVICE
+endif
diff --git a/drm/1.0/default/service.cpp b/drm/1.0/default/service.cpp
index a112aaf..823f39e 100644
--- a/drm/1.0/default/service.cpp
+++ b/drm/1.0/default/service.cpp
@@ -32,11 +32,11 @@
     ALOGD("android.hardware.drm@1.0-service starting...");
     configureRpcThreadpool(8, true /* callerWillJoin */);
     android::status_t status =
-        registerPassthroughServiceImplementation<IDrmFactory>("drm");
+        registerPassthroughServiceImplementation<IDrmFactory>();
     LOG_ALWAYS_FATAL_IF(
         status != android::OK,
         "Error while registering drm service: %d", status);
-    status = registerPassthroughServiceImplementation<ICryptoFactory>("crypto");
+    status = registerPassthroughServiceImplementation<ICryptoFactory>();
     LOG_ALWAYS_FATAL_IF(
         status != android::OK,
         "Error while registering crypto service: %d", status);
diff --git a/drm/1.0/vts/functional/drm_hal_clearkey_test.cpp b/drm/1.0/vts/functional/drm_hal_clearkey_test.cpp
index e97ac10..4dd98ce 100644
--- a/drm/1.0/vts/functional/drm_hal_clearkey_test.cpp
+++ b/drm/1.0/vts/functional/drm_hal_clearkey_test.cpp
@@ -94,12 +94,10 @@
               test_info->name());
 
         drmFactory =
-                ::testing::VtsHalHidlTargetTestBase::getService<IDrmFactory>(
-                        "drm");
+                ::testing::VtsHalHidlTargetTestBase::getService<IDrmFactory>();
         ASSERT_NE(drmFactory, nullptr);
         cryptoFactory =
-                ::testing::VtsHalHidlTargetTestBase::getService<ICryptoFactory>(
-                        "crypto");
+                ::testing::VtsHalHidlTargetTestBase::getService<ICryptoFactory>();
         ASSERT_NE(cryptoFactory, nullptr);
     }
 
diff --git a/drm/1.0/vts/functional/drm_hal_vendor_test.cpp b/drm/1.0/vts/functional/drm_hal_vendor_test.cpp
index 5945c05..93e6d46 100644
--- a/drm/1.0/vts/functional/drm_hal_vendor_test.cpp
+++ b/drm/1.0/vts/functional/drm_hal_vendor_test.cpp
@@ -114,14 +114,14 @@
         string name = vendorModule->getServiceName();
         drmFactory = VtsTestBase::getService<IDrmFactory>(name);
         if (drmFactory == nullptr) {
-            drmFactory = VtsTestBase::getService<IDrmFactory>("drm");
+            drmFactory = VtsTestBase::getService<IDrmFactory>();
         }
         ASSERT_NE(drmFactory, nullptr);
 
-        // Dot the same for the crypto factory
+        // Do the same for the crypto factory
         cryptoFactory = VtsTestBase::getService<ICryptoFactory>(name);
         if (cryptoFactory == nullptr) {
-            VtsTestBase::getService<ICryptoFactory>("crypto");
+            VtsTestBase::getService<ICryptoFactory>();
         }
         ASSERT_NE(cryptoFactory, nullptr);
     }
diff --git a/graphics/composer/2.1/default/Android.bp b/graphics/composer/2.1/default/Android.bp
index 0367fcd..fb75beb 100644
--- a/graphics/composer/2.1/default/Android.bp
+++ b/graphics/composer/2.1/default/Android.bp
@@ -1,5 +1,6 @@
 cc_library_static {
     name: "libhwcomposer-client",
+    vendor_available: true,
     defaults: ["hidl_defaults"],
     export_include_dirs: ["."],
     srcs: ["ComposerClient.cpp"],
diff --git a/graphics/composer/2.1/default/service.cpp b/graphics/composer/2.1/default/service.cpp
index 712dac1..aa0604a 100644
--- a/graphics/composer/2.1/default/service.cpp
+++ b/graphics/composer/2.1/default/service.cpp
@@ -28,6 +28,7 @@
 
 int main() {
     // the conventional HAL might start binder services
+    android::ProcessState::initWithDriver("/dev/vndbinder");
     android::ProcessState::self()->setThreadPoolMaxThreadCount(4);
     android::ProcessState::self()->startThreadPool();
 
diff --git a/sensors/1.0/default/Android.bp b/sensors/1.0/default/Android.bp
index 2ab1b90..8144590 100644
--- a/sensors/1.0/default/Android.bp
+++ b/sensors/1.0/default/Android.bp
@@ -23,6 +23,7 @@
 
 cc_library_static {
     name: "android.hardware.sensors@1.0-convert",
+    vendor_available: true,
     defaults: ["hidl_defaults"],
     srcs: ["convert.cpp"],
     export_include_dirs: ["include"],