Merge "Add VTS test for ISupplicantP2pIface::removeGroup()" 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/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..fec43cf 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);
     }
@@ -953,6 +953,7 @@
     EXPECT_TRUE(result.args);
     EXPECT_EQ(sessionId, result.args->sessionId);
     EXPECT_EQ(keyStatusList, result.args->keyStatusList);
+    closeSession(sessionId);
 }
 
 /**
@@ -1429,7 +1430,7 @@
 
             uint32_t byteCount = decrypt(Mode::AES_CTR, key.isSecure,
                     toHidlArray(key.keyId), &iv[0], subSamples, noPattern,
-                    key.clearContentKey, Status::ERROR_DRM_DECRYPT);
+                    key.clearContentKey, Status::ERROR_DRM_NO_LICENSE);
             EXPECT_EQ(0u, byteCount);
 
             closeSession(sessionId);
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/renderscript/1.0/vts/functional/VtsMiscellaneousTests.cpp b/renderscript/1.0/vts/functional/VtsMiscellaneousTests.cpp
index 23b09ac..278dbf3 100644
--- a/renderscript/1.0/vts/functional/VtsMiscellaneousTests.cpp
+++ b/renderscript/1.0/vts/functional/VtsMiscellaneousTests.cpp
@@ -175,6 +175,8 @@
     ASSERT_NE(NativeWindow(0), nativeWindow);
 
     ((ANativeWindow *)nativeWindow)->incStrong(nullptr);
+    native_window_api_connect((ANativeWindow*)nativeWindow,
+                              NATIVE_WINDOW_API_CPU);
 
     context->allocationSetNativeWindow(allocationSend, nativeWindow);
     context->allocation2DWrite(allocationSend, 0, 0, 0, AllocationCubemapFace::POSITIVE_X, 512, 512,
@@ -239,6 +241,8 @@
     EXPECT_EQ(nativeWindow2, nativeWindow1);
 
     ((ANativeWindow *)nativeWindow1)->incStrong(nullptr);
+    native_window_api_connect((ANativeWindow*)nativeWindow1,
+                              NATIVE_WINDOW_API_CPU);
 
     context->allocationSetNativeWindow(allocationSend, nativeWindow1);
     context->allocation2DWrite(allocationSend, 0, 0, 0, AllocationCubemapFace::POSITIVE_X, 512, 512,
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"],
diff --git a/wifi/supplicant/1.0/vts/functional/supplicant_sta_iface_hidl_test.cpp b/wifi/supplicant/1.0/vts/functional/supplicant_sta_iface_hidl_test.cpp
index 3670321..2797160 100644
--- a/wifi/supplicant/1.0/vts/functional/supplicant_sta_iface_hidl_test.cpp
+++ b/wifi/supplicant/1.0/vts/functional/supplicant_sta_iface_hidl_test.cpp
@@ -47,6 +47,10 @@
     ISupplicantStaIface::Hs20AnqpSubtypes::WAN_METRICS,
     ISupplicantStaIface::Hs20AnqpSubtypes::OPERATOR_FRIENDLY_NAME};
 constexpr char kTestHs20IconFile[] = "TestFile";
+constexpr char kTestRadioWorkName[] = "TestRadioWork";
+constexpr uint32_t kTestRadioWorkFrequency = 2412;
+constexpr uint32_t kTestRadioWorkTimeout = 8;
+constexpr uint32_t kTestRadioWorkId = 16;
 constexpr int8_t kTestCountryCode[] = {'U', 'S'};
 }  // namespace
 
@@ -427,3 +431,38 @@
             EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
         });
 }
+
+/*
+ * SetExternalSim
+ */
+TEST_F(SupplicantStaIfaceHidlTest, SetExternalSim) {
+    EXPECT_EQ(SupplicantStatusCode::SUCCESS,
+              HIDL_INVOKE(sta_iface_, setExternalSim, true).code);
+    EXPECT_EQ(SupplicantStatusCode::SUCCESS,
+              HIDL_INVOKE(sta_iface_, setExternalSim, false).code);
+}
+
+/*
+ * AddExtRadioWork
+ */
+TEST_F(SupplicantStaIfaceHidlTest, AddExtRadioWork) {
+    const auto& status_and_radio_work_id =
+        HIDL_INVOKE(sta_iface_, addExtRadioWork, kTestRadioWorkName,
+                    kTestRadioWorkFrequency, kTestRadioWorkTimeout);
+    EXPECT_EQ(SupplicantStatusCode::SUCCESS,
+              status_and_radio_work_id.first.code);
+    // removeExtRadio only succeeds if the added radio work hasn't started yet.
+    // So there this no guaranteed result from calling removeExtRadioWork here.
+    // That being said, currently we are not able to test addExtRadioWork and
+    // removeExtRadioWork in a row.
+}
+
+/*
+ * RemoveExtRadioWork
+ */
+TEST_F(SupplicantStaIfaceHidlTest, RemoveExtRadioWork) {
+    // This fails because there is no on going radio work with kTestRadioWorkId.
+    EXPECT_NE(
+        SupplicantStatusCode::SUCCESS,
+        HIDL_INVOKE(sta_iface_, removeExtRadioWork, kTestRadioWorkId).code);
+}