Merge "[WIFI][VTS] Don't call RequestDriverDebugDump API if not supported" into oc-dev
diff --git a/automotive/evs/1.0/default/service.cpp b/automotive/evs/1.0/default/service.cpp
index 1b64e44..d4181b9 100644
--- a/automotive/evs/1.0/default/service.cpp
+++ b/automotive/evs/1.0/default/service.cpp
@@ -19,9 +19,9 @@
 #include <unistd.h>
 
 #include <hidl/HidlTransportSupport.h>
+#include <log/log.h>
 #include <utils/Errors.h>
 #include <utils/StrongPointer.h>
-#include <utils/Log.h>
 
 #include "ServiceNames.h"
 #include "EvsEnumerator.h"
diff --git a/automotive/evs/1.0/vts/functional/VtsEvsV1_0TargetTest.cpp b/automotive/evs/1.0/vts/functional/VtsEvsV1_0TargetTest.cpp
index 6a0ae48..50b6581 100644
--- a/automotive/evs/1.0/vts/functional/VtsEvsV1_0TargetTest.cpp
+++ b/automotive/evs/1.0/vts/functional/VtsEvsV1_0TargetTest.cpp
@@ -37,10 +37,10 @@
 #include <string.h>
 
 #include <hidl/HidlTransportSupport.h>
+#include <hwbinder/ProcessState.h>
+#include <log/log.h>
 #include <utils/Errors.h>
 #include <utils/StrongPointer.h>
-#include <utils/Log.h>
-#include <hwbinder/ProcessState.h>
 
 #include <android/log.h>
 #include <android/hardware/automotive/evs/1.0/IEvsCamera.h>
diff --git a/automotive/vehicle/2.0/default/common/src/VehiclePropertyStore.cpp b/automotive/vehicle/2.0/default/common/src/VehiclePropertyStore.cpp
index 0e6b776..2c3ebfc 100644
--- a/automotive/vehicle/2.0/default/common/src/VehiclePropertyStore.cpp
+++ b/automotive/vehicle/2.0/default/common/src/VehiclePropertyStore.cpp
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 #define LOG_TAG "VehiclePropertyStore"
-#include <android/log.h>
+#include <log/log.h>
 
 #include <common/include/vhal_v2_0/VehicleUtils.h>
 #include "VehiclePropertyStore.h"
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/PipeComm.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/PipeComm.cpp
index 6f219fa..2b15aa3 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/PipeComm.cpp
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/PipeComm.cpp
@@ -18,6 +18,7 @@
 
 #include <android/hardware/automotive/vehicle/2.0/IVehicle.h>
 #include <android/log.h>
+#include <log/log.h>
 #include <system/qemu_pipe.h>
 
 #include "PipeComm.h"
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/SocketComm.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/SocketComm.cpp
index a3ef4b1..42c1c78 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/SocketComm.cpp
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/SocketComm.cpp
@@ -18,6 +18,7 @@
 
 #include <android/hardware/automotive/vehicle/2.0/IVehicle.h>
 #include <android/log.h>
+#include <log/log.h>
 #include <netinet/in.h>
 #include <sys/socket.h>
 
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/VehicleEmulator.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/VehicleEmulator.h
index 9a75ddc..c8bcd60 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/VehicleEmulator.h
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/VehicleEmulator.h
@@ -17,9 +17,11 @@
 #ifndef android_hardware_automotive_vehicle_V2_0_impl_VehicleHalEmulator_H_
 #define android_hardware_automotive_vehicle_V2_0_impl_VehicleHalEmulator_H_
 
+#include <log/log.h>
 #include <memory>
 #include <thread>
 #include <vector>
+
 #include "vhal_v2_0/VehicleHal.h"
 
 #include "CommBase.h"
diff --git a/automotive/vehicle/2.1/default/impl/vhal_v2_1/EmulatedVehicleHal.cpp b/automotive/vehicle/2.1/default/impl/vhal_v2_1/EmulatedVehicleHal.cpp
index ae7f416..4dceae0 100644
--- a/automotive/vehicle/2.1/default/impl/vhal_v2_1/EmulatedVehicleHal.cpp
+++ b/automotive/vehicle/2.1/default/impl/vhal_v2_1/EmulatedVehicleHal.cpp
@@ -17,9 +17,10 @@
 #define LOG_TAG "DefaultVehicleHal_v2_1"
 #include <android/log.h>
 
-#include <algorithm>
+#include <log/log.h>
 #include <netinet/in.h>
 #include <sys/socket.h>
+#include <algorithm>
 
 #include "EmulatedVehicleHal.h"
 #include "VehicleHalProto.pb.h"
diff --git a/biometrics/fingerprint/2.1/default/BiometricsFingerprint.cpp b/biometrics/fingerprint/2.1/default/BiometricsFingerprint.cpp
index 5b00675..4f5aaf9 100644
--- a/biometrics/fingerprint/2.1/default/BiometricsFingerprint.cpp
+++ b/biometrics/fingerprint/2.1/default/BiometricsFingerprint.cpp
@@ -79,7 +79,7 @@
         case -28: return RequestStatus::SYS_ENOSPC;
         case -110: return RequestStatus::SYS_ETIMEDOUT;
         default:
-            ALOGE("An unknown error returned from fingerprint vendor library");
+            ALOGE("An unknown error returned from fingerprint vendor library: %d", error);
             return RequestStatus::SYS_UNKNOWN;
     }
 }
diff --git a/boot/1.0/vts/functional/VtsHalBootV1_0TargetTest.cpp b/boot/1.0/vts/functional/VtsHalBootV1_0TargetTest.cpp
index 9789ee6..f48a95d 100644
--- a/boot/1.0/vts/functional/VtsHalBootV1_0TargetTest.cpp
+++ b/boot/1.0/vts/functional/VtsHalBootV1_0TargetTest.cpp
@@ -30,6 +30,8 @@
 using ::android::hardware::hidl_string;
 using ::android::hardware::Return;
 using ::android::sp;
+using std::string;
+using std::vector;
 
 // The main test class for the Boot HIDL HAL.
 class BootHidlTest : public ::testing::VtsHalHidlTargetTestBase {
@@ -83,7 +85,7 @@
   {
     // Restore original flags to avoid problems on reboot
     CommandResult cr;
-    Return <void> result = boot->markBootSuccessful(generate_callback(&cr));
+    Return<void> result = boot->markBootSuccessful(generate_callback(&cr));
     EXPECT_TRUE(result.isOk());
     EXPECT_TRUE(cr.success);
   }
@@ -151,22 +153,21 @@
 
 // Sanity check Boot::getSuffix() on good and bad inputs.
 TEST_F(BootHidlTest, GetSuffix) {
-  const char *suffixPtr;
-  auto cb = [&](hidl_string suffix) { suffixPtr = suffix.c_str(); };
-  for (Slot i = 0; i < 2; i++) {
-    CommandResult cr;
-    Return<void> result = boot->getSuffix(i, cb);
-    EXPECT_TRUE(result.isOk());
-    char correctSuffix[3];
-    snprintf(correctSuffix, sizeof(correctSuffix), "_%c", 'a' + i);
-    ASSERT_EQ(0, strcmp(suffixPtr, correctSuffix));
-  }
-  {
-    char emptySuffix[] = "";
-    Return<void> result = boot->getSuffix(boot->getNumberSlots(), cb);
-    EXPECT_TRUE(result.isOk());
-    ASSERT_EQ(0, strcmp(emptySuffix, suffixPtr));
-  }
+    string suffixStr;
+    vector<string> correctSuffixes = {"_a", "_b"};
+    auto cb = [&](hidl_string suffix) { suffixStr = suffix.c_str(); };
+    for (Slot i = 0; i < 2; i++) {
+        CommandResult cr;
+        Return<void> result = boot->getSuffix(i, cb);
+        EXPECT_TRUE(result.isOk());
+        ASSERT_EQ(0, suffixStr.compare(correctSuffixes[i]));
+    }
+    {
+        string emptySuffix = "";
+        Return<void> result = boot->getSuffix(boot->getNumberSlots(), cb);
+        EXPECT_TRUE(result.isOk());
+        ASSERT_EQ(0, suffixStr.compare(emptySuffix));
+    }
 }
 
 int main(int argc, char **argv) {
diff --git a/camera/common/1.0/default/CameraMetadata.cpp b/camera/common/1.0/default/CameraMetadata.cpp
index 44c2040..0e7ef6e 100644
--- a/camera/common/1.0/default/CameraMetadata.cpp
+++ b/camera/common/1.0/default/CameraMetadata.cpp
@@ -17,7 +17,7 @@
 // #define LOG_NDEBUG 0
 
 #define LOG_TAG "CamComm1.0-MD"
-#include <utils/Log.h>
+#include <log/log.h>
 #include <utils/Errors.h>
 
 #include "CameraMetadata.h"
diff --git a/camera/common/1.0/default/HandleImporter.cpp b/camera/common/1.0/default/HandleImporter.cpp
index dee2973..e22f26f 100644
--- a/camera/common/1.0/default/HandleImporter.cpp
+++ b/camera/common/1.0/default/HandleImporter.cpp
@@ -15,8 +15,8 @@
  */
 
 #define LOG_TAG "HandleImporter"
-#include <utils/Log.h>
 #include "HandleImporter.h"
+#include <log/log.h>
 
 namespace android {
 namespace hardware {
diff --git a/camera/common/1.0/default/VendorTagDescriptor.cpp b/camera/common/1.0/default/VendorTagDescriptor.cpp
index db884a8..bc18270 100644
--- a/camera/common/1.0/default/VendorTagDescriptor.cpp
+++ b/camera/common/1.0/default/VendorTagDescriptor.cpp
@@ -16,13 +16,13 @@
 
 #define LOG_TAG "CamComm1.0-VTDesc"
 
-#include <utils/Errors.h>
-#include <utils/Log.h>
-#include <utils/Mutex.h>
-#include <utils/Vector.h>
-#include <utils/SortedVector.h>
+#include <log/log.h>
 #include <system/camera_metadata.h>
 #include <camera_metadata_hidden.h>
+#include <utils/Errors.h>
+#include <utils/Mutex.h>
+#include <utils/SortedVector.h>
+#include <utils/Vector.h>
 
 #include "VendorTagDescriptor.h"
 
diff --git a/camera/device/1.0/default/CameraDevice.cpp b/camera/device/1.0/default/CameraDevice.cpp
index 877c6e7..6495f30 100644
--- a/camera/device/1.0/default/CameraDevice.cpp
+++ b/camera/device/1.0/default/CameraDevice.cpp
@@ -15,10 +15,10 @@
  */
 
 #define LOG_TAG "CamDev@1.0-impl"
-#include <utils/Log.h>
 #include <hardware/camera.h>
 #include <hardware/gralloc1.h>
 #include <hidlmemory/mapping.h>
+#include <log/log.h>
 #include <utils/Trace.h>
 
 #include "CameraDevice_1_0.h"
diff --git a/camera/device/3.2/default/CameraDevice.cpp b/camera/device/3.2/default/CameraDevice.cpp
index a742335..637a1e6 100644
--- a/camera/device/3.2/default/CameraDevice.cpp
+++ b/camera/device/3.2/default/CameraDevice.cpp
@@ -15,7 +15,7 @@
  */
 
 #define LOG_TAG "CamDev@3.2-impl"
-#include <utils/Log.h>
+#include <log/log.h>
 
 #include <utils/Vector.h>
 #include <utils/Trace.h>
diff --git a/camera/device/3.2/default/convert.cpp b/camera/device/3.2/default/convert.cpp
index 35676df..c7cc75a 100644
--- a/camera/device/3.2/default/convert.cpp
+++ b/camera/device/3.2/default/convert.cpp
@@ -15,7 +15,7 @@
  */
 
 #define LOG_TAG "android.hardware.camera.device@3.2-convert-impl"
-#include <android/log.h>
+#include <log/log.h>
 
 #include "include/convert.h"
 
diff --git a/camera/provider/2.4/vts/functional/CameraParameters.cpp b/camera/provider/2.4/vts/functional/CameraParameters.cpp
index 0285154..97b263b 100644
--- a/camera/provider/2.4/vts/functional/CameraParameters.cpp
+++ b/camera/provider/2.4/vts/functional/CameraParameters.cpp
@@ -16,7 +16,7 @@
 */
 
 #define LOG_TAG "CameraParams"
-#include <utils/Log.h>
+#include <log/log.h>
 
 #include <string.h>
 #include <stdlib.h>
diff --git a/contexthub/1.0/vts/functional/VtsHalContexthubV1_0TargetTest.cpp b/contexthub/1.0/vts/functional/VtsHalContexthubV1_0TargetTest.cpp
index 765857f..5672824 100644
--- a/contexthub/1.0/vts/functional/VtsHalContexthubV1_0TargetTest.cpp
+++ b/contexthub/1.0/vts/functional/VtsHalContexthubV1_0TargetTest.cpp
@@ -16,12 +16,13 @@
 
 #define LOG_TAG "contexthub_hidl_hal_test"
 
+#include <VtsHalHidlTargetTestBase.h>
 #include <android-base/logging.h>
 #include <android/hardware/contexthub/1.0/IContexthub.h>
 #include <android/hardware/contexthub/1.0/IContexthubCallback.h>
 #include <android/hardware/contexthub/1.0/types.h>
 #include <android/log.h>
-#include <VtsHalHidlTargetTestBase.h>
+#include <log/log.h>
 
 #include <cinttypes>
 #include <future>
diff --git a/drm/1.0/default/CryptoFactory.cpp b/drm/1.0/default/CryptoFactory.cpp
index 935786d..caab83b 100644
--- a/drm/1.0/default/CryptoFactory.cpp
+++ b/drm/1.0/default/CryptoFactory.cpp
@@ -16,10 +16,10 @@
 #define LOG_TAG "android.hardware.drm@1.0-impl"
 
 #include "CryptoFactory.h"
+#include <log/log.h>
 #include "CryptoPlugin.h"
 #include "LegacyPluginPath.h"
 #include "TypeConvert.h"
-#include <utils/Log.h>
 
 namespace android {
 namespace hardware {
diff --git a/drm/1.0/default/CryptoPlugin.cpp b/drm/1.0/default/CryptoPlugin.cpp
index 5e5b5a7..591861a 100644
--- a/drm/1.0/default/CryptoPlugin.cpp
+++ b/drm/1.0/default/CryptoPlugin.cpp
@@ -20,8 +20,8 @@
 
 #include <android/hidl/memory/1.0/IMemory.h>
 #include <hidlmemory/mapping.h>
+#include <log/log.h>
 #include <media/stagefright/foundation/AString.h>
-#include <utils/Log.h>
 
 using android::hardware::hidl_memory;
 using android::hidl::memory::V1_0::IMemory;
diff --git a/drm/1.0/default/DrmFactory.cpp b/drm/1.0/default/DrmFactory.cpp
index 72466a1..7e5d998 100644
--- a/drm/1.0/default/DrmFactory.cpp
+++ b/drm/1.0/default/DrmFactory.cpp
@@ -16,10 +16,10 @@
 #define LOG_TAG "android.hardware.drm@1.0-impl"
 
 #include "DrmFactory.h"
+#include <log/log.h>
 #include "DrmPlugin.h"
 #include "LegacyPluginPath.h"
 #include "TypeConvert.h"
-#include <utils/Log.h>
 
 namespace android {
 namespace hardware {
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 6910855..e97ac10 100644
--- a/drm/1.0/vts/functional/drm_hal_clearkey_test.cpp
+++ b/drm/1.0/vts/functional/drm_hal_clearkey_test.cpp
@@ -26,8 +26,9 @@
 #include <gtest/gtest.h>
 #include <hidl/HidlSupport.h>
 #include <hidlmemory/mapping.h>
-#include <memory>
+#include <log/log.h>
 #include <openssl/aes.h>
+#include <memory>
 #include <random>
 
 #include "VtsHalHidlTargetTestBase.h"
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 7448c42..44675dc 100644
--- a/drm/1.0/vts/functional/drm_hal_vendor_test.cpp
+++ b/drm/1.0/vts/functional/drm_hal_vendor_test.cpp
@@ -26,8 +26,9 @@
 #include <android/hidl/allocator/1.0/IAllocator.h>
 #include <gtest/gtest.h>
 #include <hidlmemory/mapping.h>
-#include <memory>
+#include <log/log.h>
 #include <openssl/aes.h>
+#include <memory>
 #include <random>
 
 #include "drm_hal_vendor_module_api.h"
diff --git a/drm/1.0/vts/functional/vendor_modules.cpp b/drm/1.0/vts/functional/vendor_modules.cpp
index bb232ae..2bf0b28 100644
--- a/drm/1.0/vts/functional/vendor_modules.cpp
+++ b/drm/1.0/vts/functional/vendor_modules.cpp
@@ -18,7 +18,7 @@
 
 #include <dirent.h>
 #include <dlfcn.h>
-#include <utils/Log.h>
+#include <log/log.h>
 #include <memory>
 
 #include "shared_library.h"
diff --git a/gatekeeper/1.0/vts/functional/VtsHalGatekeeperV1_0TargetTest.cpp b/gatekeeper/1.0/vts/functional/VtsHalGatekeeperV1_0TargetTest.cpp
index 391dea0..e9a44eb 100644
--- a/gatekeeper/1.0/vts/functional/VtsHalGatekeeperV1_0TargetTest.cpp
+++ b/gatekeeper/1.0/vts/functional/VtsHalGatekeeperV1_0TargetTest.cpp
@@ -30,6 +30,8 @@
 #include <android/hardware/gatekeeper/1.0/IGatekeeper.h>
 #include <android/hardware/gatekeeper/1.0/types.h>
 
+#include <log/log.h>
+
 #include <VtsHalHidlTargetTestBase.h>
 
 using ::android::hardware::hidl_string;
diff --git a/gnss/1.0/vts/functional/VtsHalGnssV1_0TargetTest.cpp b/gnss/1.0/vts/functional/VtsHalGnssV1_0TargetTest.cpp
index bd5cc2e..fde3171 100644
--- a/gnss/1.0/vts/functional/VtsHalGnssV1_0TargetTest.cpp
+++ b/gnss/1.0/vts/functional/VtsHalGnssV1_0TargetTest.cpp
@@ -16,7 +16,7 @@
 
 #define LOG_TAG "VtsHalGnssV1_0TargetTest"
 #include <android/hardware/gnss/1.0/IGnss.h>
-#include <android/log.h>
+#include <log/log.h>
 
 #include <VtsHalHidlTargetTestBase.h>
 
@@ -35,11 +35,11 @@
 using android::hardware::gnss::V1_0::IGnssMeasurement;
 using android::sp;
 
-#define TIMEOUT_SEC 3  // for basic commands/responses
+#define TIMEOUT_SEC 2  // for basic commands/responses
 
-// Set these false for release, true for stronger test
-#define GNSS_SIGNAL_IS_PRESENT false
-#define GNSS_ASSISTANCE_IS_PRESENT false
+// for command line argument on how strictly to run the test
+bool sAgpsIsPresent = false;  // if SUPL or XTRA assistance available
+bool sSignalIsWeak = false;  // if GNSS signals are weak (e.g. light indoor)
 
 // The main test class for GNSS HAL.
 class GnssHalTest : public ::testing::VtsHalHidlTargetTestBase {
@@ -204,7 +204,6 @@
  * CheckLocation:
  * Helper function to vet Location fields
  */
-
 void CheckLocation(GnssLocation& location, bool checkAccuracies) {
   EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_LAT_LONG);
   EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_ALTITUDE);
@@ -270,6 +269,39 @@
 }
 
 /*
+ * StartAndGetSingleLocation:
+ * Helper function to get one Location and check fields
+ *
+ * returns  true if a location was successfully generated
+ */
+bool StartAndGetSingleLocation(GnssHalTest* test, bool checkAccuracies) {
+  auto result = test->gnss_hal_->start();
+
+  EXPECT_TRUE(result.isOk());
+  EXPECT_TRUE(result);
+
+  /*
+   * GPS signals initially optional for this test, so don't expect fast fix,
+   * or no timeout, unless signal is present
+   */
+  int firstGnssLocationTimeoutSeconds = sAgpsIsPresent ? 15 : 45;
+  if (sSignalIsWeak) {
+    // allow more time for weak signals
+    firstGnssLocationTimeoutSeconds += 30;
+  }
+
+  test->wait(firstGnssLocationTimeoutSeconds);
+  if (sAgpsIsPresent) {
+    EXPECT_EQ(test->location_called_count_, 1);
+  }
+  if (test->location_called_count_ > 0) {
+    CheckLocation(test->last_location_, checkAccuracies);
+    return true;
+  }
+  return false;
+}
+
+/*
  * GetLocation:
  * Turns on location, waits 45 second for at least 5 locations,
  * and checks them for reasonable validity.
@@ -279,12 +311,6 @@
 #define PREFERRED_ACCURACY 0   // Ideally perfect (matches GnssLocationProvider)
 #define PREFERRED_TIME_MSEC 0  // Ideally immediate
 
-#if GNSS_ASSISTANCE_IS_PRESENT
-#define LOCATION_TIMEOUT_FIRST_SEC 15
-#else
-#define LOCATION_TIMEOUT_FIRST_SEC 45
-#endif
-
 #define LOCATION_TIMEOUT_SUBSEQUENT_SEC 3
 #define LOCATIONS_TO_CHECK 5
 
@@ -299,26 +325,17 @@
   ASSERT_TRUE(result.isOk());
   EXPECT_TRUE(result);
 
-  result = gnss_hal_->start();
-
-  ASSERT_TRUE(result.isOk());
-  EXPECT_TRUE(result);
-
   /*
    * GPS signals initially optional for this test, so don't expect no timeout
    * yet
    */
-  wait(LOCATION_TIMEOUT_FIRST_SEC);
-  if (GNSS_SIGNAL_IS_PRESENT) {
-    ASSERT_GT(location_called_count_, 0);
-  }
-  if (location_called_count_ > 0) {
-    CheckLocation(last_location_, checkMoreAccuracies);
-  }
+  bool gotLocation = StartAndGetSingleLocation(this, checkMoreAccuracies);
 
-  for (int i = 1; i < LOCATIONS_TO_CHECK; i++) {
-    wait(LOCATION_TIMEOUT_SUBSEQUENT_SEC);
-    if (location_called_count_ > 0) {
+  if (gotLocation) {
+    for (int i = 1; i < LOCATIONS_TO_CHECK; i++) {
+      EXPECT_EQ(std::cv_status::no_timeout,
+          wait(LOCATION_TIMEOUT_SUBSEQUENT_SEC));
+      EXPECT_EQ(location_called_count_, i + 1);
       CheckLocation(last_location_, checkMoreAccuracies);
     }
   }
@@ -332,13 +349,11 @@
 /*
  * InjectDelete:
  * Ensures that calls to inject and/or delete information state are handled.
- * Better tests await GPS signal
  */
 TEST_F(GnssHalTest, InjectDelete) {
   // confidently, well north of Alaska
   auto result = gnss_hal_->injectLocation(80.0, -170.0, 1000.0);
 
-  // TODO: full self-diff including TODO's :)
   ASSERT_TRUE(result.isOk());
   EXPECT_TRUE(result);
 
@@ -351,6 +366,9 @@
   auto resultVoid = gnss_hal_->deleteAidingData(IGnss::GnssAidingData::DELETE_ALL);
 
   ASSERT_TRUE(resultVoid.isOk());
+
+  // Ensure we can get a good location after a bad injection has been deleted
+  StartAndGetSingleLocation(this, false);
 }
 
 /*
@@ -413,6 +431,18 @@
 
 int main(int argc, char** argv) {
   ::testing::InitGoogleTest(&argc, argv);
+  /*
+   * These arguments not used by automated VTS testing.
+   * Only for use in manual testing, when wanting to run
+   * stronger tests that require the presence of GPS signal.
+   */
+  for (int i = 1; i < argc; i++) {
+    if (strcmp(argv[i],"-agps") == 0) {
+      sAgpsIsPresent = true;
+    } else if (strcmp(argv[i],"-weak") == 0) {
+      sSignalIsWeak = true;
+    }
+  }
   int status = RUN_ALL_TESTS();
   ALOGI("Test result = %d", status);
   return status;
diff --git a/graphics/allocator/2.0/default/Gralloc1On0Adapter.cpp b/graphics/allocator/2.0/default/Gralloc1On0Adapter.cpp
index f722429..be055ec 100644
--- a/graphics/allocator/2.0/default/Gralloc1On0Adapter.cpp
+++ b/graphics/allocator/2.0/default/Gralloc1On0Adapter.cpp
@@ -25,7 +25,7 @@
 
 #include <hardware/gralloc.h>
 
-#include <utils/Log.h>
+#include <log/log.h>
 #include <sync/sync.h>
 
 #include <inttypes.h>
diff --git a/keymaster/3.0/default/android.hardware.keymaster@3.0-service.rc b/keymaster/3.0/default/android.hardware.keymaster@3.0-service.rc
index fd43178..849d270 100644
--- a/keymaster/3.0/default/android.hardware.keymaster@3.0-service.rc
+++ b/keymaster/3.0/default/android.hardware.keymaster@3.0-service.rc
@@ -1,4 +1,4 @@
 service keymaster-3-0 /vendor/bin/hw/android.hardware.keymaster@3.0-service
-    class hal
+    class early_hal
     user system
     group system drmrpc
diff --git a/memtrack/1.0/vts/functional/VtsHalMemtrackV1_0TargetTest.cpp b/memtrack/1.0/vts/functional/VtsHalMemtrackV1_0TargetTest.cpp
index a8d8aea..6ff566e 100644
--- a/memtrack/1.0/vts/functional/VtsHalMemtrackV1_0TargetTest.cpp
+++ b/memtrack/1.0/vts/functional/VtsHalMemtrackV1_0TargetTest.cpp
@@ -22,6 +22,7 @@
 
 #include <VtsHalHidlTargetTestBase.h>
 
+#include <fcntl.h>
 #include <algorithm>
 #include <vector>
 
diff --git a/power/1.0/vts/functional/VtsHalPowerV1_0TargetTest.cpp b/power/1.0/vts/functional/VtsHalPowerV1_0TargetTest.cpp
index cd1a261..c94fa4f 100644
--- a/power/1.0/vts/functional/VtsHalPowerV1_0TargetTest.cpp
+++ b/power/1.0/vts/functional/VtsHalPowerV1_0TargetTest.cpp
@@ -24,6 +24,7 @@
 
 #include <VtsHalHidlTargetTestBase.h>
 
+#include <fcntl.h>
 #include <algorithm>
 
 using ::android::hardware::power::V1_0::IPower;
diff --git a/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp b/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp
index 14c4a2a..f757a64 100644
--- a/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp
+++ b/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp
@@ -15,14 +15,14 @@
  */
 
 #define LOG_TAG "sensors_hidl_hal_test"
+#include <VtsHalHidlTargetTestBase.h>
 #include <android-base/logging.h>
 #include <android/hardware/sensors/1.0/ISensors.h>
 #include <android/hardware/sensors/1.0/types.h>
-#include <android/log.h>
 #include <cutils/ashmem.h>
+#include <hardware/sensors.h>  // for sensor type strings
+#include <log/log.h>
 #include <utils/SystemClock.h>
-#include <VtsHalHidlTargetTestBase.h>
-#include <hardware/sensors.h>       // for sensor type strings
 
 #include <algorithm>
 #include <cinttypes>
diff --git a/soundtrigger/2.0/vts/functional/VtsHalSoundtriggerV2_0TargetTest.cpp b/soundtrigger/2.0/vts/functional/VtsHalSoundtriggerV2_0TargetTest.cpp
index 3fbef18..2eca8f4 100644
--- a/soundtrigger/2.0/vts/functional/VtsHalSoundtriggerV2_0TargetTest.cpp
+++ b/soundtrigger/2.0/vts/functional/VtsHalSoundtriggerV2_0TargetTest.cpp
@@ -23,6 +23,7 @@
 
 #include <android/log.h>
 #include <cutils/native_handle.h>
+#include <log/log.h>
 
 #include <android/hardware/audio/common/2.0/types.h>
 #include <android/hardware/soundtrigger/2.0/ISoundTriggerHw.h>
diff --git a/tests/baz/1.0/Android.bp b/tests/baz/1.0/Android.bp
index 8f327e3..1d5013b 100644
--- a/tests/baz/1.0/Android.bp
+++ b/tests/baz/1.0/Android.bp
@@ -7,6 +7,7 @@
         "IBase.hal",
         "IBaz.hal",
         "IBazCallback.hal",
+        "IQuux.hal",
     ],
 }
 
@@ -22,6 +23,7 @@
         "android/hardware/tests/baz/1.0/BaseAll.cpp",
         "android/hardware/tests/baz/1.0/BazAll.cpp",
         "android/hardware/tests/baz/1.0/BazCallbackAll.cpp",
+        "android/hardware/tests/baz/1.0/QuuxAll.cpp",
     ],
 }
 
@@ -50,6 +52,11 @@
         "android/hardware/tests/baz/1.0/BnHwBazCallback.h",
         "android/hardware/tests/baz/1.0/BpHwBazCallback.h",
         "android/hardware/tests/baz/1.0/BsBazCallback.h",
+        "android/hardware/tests/baz/1.0/IQuux.h",
+        "android/hardware/tests/baz/1.0/IHwQuux.h",
+        "android/hardware/tests/baz/1.0/BnHwQuux.h",
+        "android/hardware/tests/baz/1.0/BpHwQuux.h",
+        "android/hardware/tests/baz/1.0/BsQuux.h",
     ],
 }
 
diff --git a/tests/baz/1.0/Android.mk b/tests/baz/1.0/Android.mk
index 40026ec..9d4d6b6 100644
--- a/tests/baz/1.0/Android.mk
+++ b/tests/baz/1.0/Android.mk
@@ -76,6 +76,25 @@
 $(GEN): $(LOCAL_PATH)/IBazCallback.hal
 	$(transform-generated-source)
 LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IQuux.hal
+#
+GEN := $(intermediates)/android/hardware/tests/baz/V1_0/IQuux.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IQuux.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hardware:hardware/interfaces \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.tests.baz@1.0::IQuux
+
+$(GEN): $(LOCAL_PATH)/IQuux.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
 include $(BUILD_JAVA_LIBRARY)
 
 
@@ -153,6 +172,25 @@
 $(GEN): $(LOCAL_PATH)/IBazCallback.hal
 	$(transform-generated-source)
 LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IQuux.hal
+#
+GEN := $(intermediates)/android/hardware/tests/baz/V1_0/IQuux.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IQuux.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hardware:hardware/interfaces \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.tests.baz@1.0::IQuux
+
+$(GEN): $(LOCAL_PATH)/IQuux.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
 include $(BUILD_STATIC_JAVA_LIBRARY)
 
 
diff --git a/tests/baz/1.0/IQuux.hal b/tests/baz/1.0/IQuux.hal
new file mode 100644
index 0000000..ccf3212
--- /dev/null
+++ b/tests/baz/1.0/IQuux.hal
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.tests.baz@1.0;
+
+interface IQuux {
+};
diff --git a/usb/1.0/default/Usb.h b/usb/1.0/default/Usb.h
index c34d080..ddfcac6 100644
--- a/usb/1.0/default/Usb.h
+++ b/usb/1.0/default/Usb.h
@@ -4,7 +4,7 @@
 #include <android/hardware/usb/1.0/IUsb.h>
 #include <hidl/MQDescriptor.h>
 #include <hidl/Status.h>
-#include <utils/Log.h>
+#include <log/log.h>
 
 #ifdef LOG_TAG
 #undef LOG_TAG
diff --git a/usb/1.0/vts/functional/VtsHalUsbV1_0TargetTest.cpp b/usb/1.0/vts/functional/VtsHalUsbV1_0TargetTest.cpp
index ea6d4a9..b77398f 100644
--- a/usb/1.0/vts/functional/VtsHalUsbV1_0TargetTest.cpp
+++ b/usb/1.0/vts/functional/VtsHalUsbV1_0TargetTest.cpp
@@ -22,6 +22,7 @@
 #include <android/hardware/usb/1.0/types.h>
 
 #include <VtsHalHidlTargetTestBase.h>
+#include <log/log.h>
 #include <stdlib.h>
 #include <chrono>
 #include <condition_variable>
diff --git a/vr/1.0/vts/functional/VtsHalVrV1_0TargetTest.cpp b/vr/1.0/vts/functional/VtsHalVrV1_0TargetTest.cpp
index a983731..23f4c71 100644
--- a/vr/1.0/vts/functional/VtsHalVrV1_0TargetTest.cpp
+++ b/vr/1.0/vts/functional/VtsHalVrV1_0TargetTest.cpp
@@ -15,11 +15,11 @@
  */
 
 #define LOG_TAG "vr_hidl_hal_test"
+#include <VtsHalHidlTargetTestBase.h>
 #include <android-base/logging.h>
 #include <android/hardware/vr/1.0/IVr.h>
-#include <android/log.h>
-#include <VtsHalHidlTargetTestBase.h>
 #include <hardware/vr.h>
+#include <log/log.h>
 
 using ::android::hardware::vr::V1_0::IVr;
 using ::android::hardware::Return;