Merge "Adding missing NI_TYPE for emergency SUPL" into oc-dev
diff --git a/automotive/evs/1.0/default/EvsCamera.cpp b/automotive/evs/1.0/default/EvsCamera.cpp
index 148b796..e0782ec 100644
--- a/automotive/evs/1.0/default/EvsCamera.cpp
+++ b/automotive/evs/1.0/default/EvsCamera.cpp
@@ -311,9 +311,7 @@
 
     while (added < numToAdd) {
         buffer_handle_t memHandle = nullptr;
-        status_t result = alloc.allocate(mWidth, mHeight,
-                                         mFormat, 1,
-                                         mUsage, mUsage,
+        status_t result = alloc.allocate(mWidth, mHeight, mFormat, 1, mUsage,
                                          &memHandle, &mStride, 0, "EvsCamera");
         if (result != NO_ERROR) {
             ALOGE("Error %d allocating %d x %d graphics buffer", result, mWidth, mHeight);
diff --git a/automotive/evs/1.0/default/EvsDisplay.cpp b/automotive/evs/1.0/default/EvsDisplay.cpp
index 9ad332a..9dd546d 100644
--- a/automotive/evs/1.0/default/EvsDisplay.cpp
+++ b/automotive/evs/1.0/default/EvsDisplay.cpp
@@ -166,11 +166,9 @@
         // Allocate the buffer that will hold our displayable image
         buffer_handle_t handle = nullptr;
         GraphicBufferAllocator& alloc(GraphicBufferAllocator::get());
-        status_t result = alloc.allocate(mBuffer.width, mBuffer.height,
-                                         mBuffer.format, 1, mBuffer.usage,
-                                         mBuffer.usage, &handle,
-                                         &mBuffer.stride,
-                                         0, "EvsDisplay");
+        status_t result = alloc.allocate(
+            mBuffer.width, mBuffer.height, mBuffer.format, 1, mBuffer.usage,
+            &handle, &mBuffer.stride, 0, "EvsDisplay");
         if (result != NO_ERROR) {
             ALOGE("Error %d allocating %d x %d graphics buffer",
                   result, mBuffer.width, mBuffer.height);
diff --git a/automotive/vehicle/2.0/default/VehicleService.cpp b/automotive/vehicle/2.0/default/VehicleService.cpp
index e6d292e..ff112c6 100644
--- a/automotive/vehicle/2.0/default/VehicleService.cpp
+++ b/automotive/vehicle/2.0/default/VehicleService.cpp
@@ -33,7 +33,7 @@
     auto emulator = std::make_unique<impl::VehicleEmulator>(hal.get());
     auto service = std::make_unique<VehicleHalManager>(hal.get());
 
-    configureRpcThreadpool(1, true /* callerWillJoin */);
+    configureRpcThreadpool(4, true /* callerWillJoin */);
 
     ALOGI("Registering as service...");
     service->registerAsService();
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h
index c4f935b..4835288 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h
@@ -77,6 +77,8 @@
             .prop = toInt(VehicleProperty::PERF_VEHICLE_SPEED),
             .access = VehiclePropertyAccess::READ,
             .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+            .minSampleRate = 1.0f,
+            .maxSampleRate = 1000.0f,
         },
         .initialValue = { .floatValues = {0.0f} }
     },
@@ -95,8 +97,10 @@
             .prop = toInt(VehicleProperty::ENGINE_RPM),
             .access = VehiclePropertyAccess::READ,
             .changeMode = VehiclePropertyChangeMode::CONTINUOUS,
+            .minSampleRate = 1.0f,
+            .maxSampleRate = 1000.0f,
         },
-        .initialValue = { .floatValues = {0.0f} }
+        .initialValue = { .floatValues = {0.0f} },
     },
 
     {
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 c8bcd60..1a8cfe2 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
@@ -52,8 +52,7 @@
 protected:
     VehicleEmulator* getEmulatorOrDie() {
         std::lock_guard<std::mutex> g(mEmulatorLock);
-        ALOGI("%s, emulator: %p", __func__, mEmulator);
-        assert(mEmulator != nullptr);
+        if (mEmulator == nullptr) abort();
         return mEmulator;
     }
 
diff --git a/automotive/vehicle/2.1/default/impl/vhal_v2_1/DefaultConfig.h b/automotive/vehicle/2.1/default/impl/vhal_v2_1/DefaultConfig.h
index aa9aa3c..0f10086 100644
--- a/automotive/vehicle/2.1/default/impl/vhal_v2_1/DefaultConfig.h
+++ b/automotive/vehicle/2.1/default/impl/vhal_v2_1/DefaultConfig.h
@@ -42,6 +42,8 @@
         .prop = WHEEL_TICK,
         .access = V2_0::VehiclePropertyAccess::READ,
         .changeMode = V2_0::VehiclePropertyChangeMode::CONTINUOUS,
+        .minSampleRate = 1.0f,
+        .maxSampleRate = 100.0f,
     },
 
     {
diff --git a/boot/1.0/default/android.hardware.boot@1.0-service.rc b/boot/1.0/default/android.hardware.boot@1.0-service.rc
index ef5dd91..68e7c22 100644
--- a/boot/1.0/default/android.hardware.boot@1.0-service.rc
+++ b/boot/1.0/default/android.hardware.boot@1.0-service.rc
@@ -1,4 +1,4 @@
 service boot-hal-1-0 /vendor/bin/hw/android.hardware.boot@1.0-service
-    class hal
+    class early_hal
     user root
     group root
diff --git a/camera/provider/2.4/vts/functional/Android.bp b/camera/provider/2.4/vts/functional/Android.bp
index a0be5cb..85312c1 100644
--- a/camera/provider/2.4/vts/functional/Android.bp
+++ b/camera/provider/2.4/vts/functional/Android.bp
@@ -33,7 +33,7 @@
         "libgui",
         "libui"
     ],
-    static_libs: ["VtsHalHidlTargetTestBase"],
+    static_libs: ["VtsHalHidlTargetTestBase", "libgrallocusage"],
     cflags: [
         "-O0",
         "-g",
diff --git a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
index b7ce858..c8e44d3 100644
--- a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
+++ b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
@@ -15,28 +15,29 @@
  */
 
 #define LOG_TAG "camera_hidl_hal_test"
-#include <android/hardware/camera/provider/2.4/ICameraProvider.h>
-#include <android/hardware/camera/device/3.2/ICameraDevice.h>
-#include <android/hardware/camera/device/1.0/ICameraDevice.h>
-#include "CameraParameters.h"
-#include <system/camera.h>
-#include <android/log.h>
-#include <ui/GraphicBuffer.h>
 #include <VtsHalHidlTargetTestBase.h>
+#include <android/hardware/camera/device/1.0/ICameraDevice.h>
+#include <android/hardware/camera/device/3.2/ICameraDevice.h>
+#include <android/hardware/camera/provider/2.4/ICameraProvider.h>
+#include <android/log.h>
+#include <binder/MemoryHeapBase.h>
+#include <grallocusage/GrallocUsageConversion.h>
+#include <gui/BufferItemConsumer.h>
 #include <gui/BufferQueue.h>
 #include <gui/Surface.h>
-#include <gui/BufferItemConsumer.h>
-#include <binder/MemoryHeapBase.h>
-#include <regex>
-#include "system/camera_metadata.h"
 #include <hardware/gralloc.h>
 #include <hardware/gralloc1.h>
-#include <unordered_map>
-#include <mutex>
-#include <condition_variable>
-#include <chrono>
 #include <inttypes.h>
+#include <system/camera.h>
+#include <ui/GraphicBuffer.h>
 #include <utils/Errors.h>
+#include <chrono>
+#include <condition_variable>
+#include <mutex>
+#include <regex>
+#include <unordered_map>
+#include "CameraParameters.h"
+#include "system/camera_metadata.h"
 
 using ::android::hardware::Return;
 using ::android::hardware::Void;
@@ -2480,11 +2481,12 @@
                     settings = req; });
             ASSERT_TRUE(ret.isOk());
 
-            sp<GraphicBuffer> gb = new GraphicBuffer(previewStream.width,
-                    previewStream.height,
-                    static_cast<int32_t> (halStreamConfig.streams[0].overrideFormat),
-                    1, halStreamConfig.streams[0].producerUsage,
-                    halStreamConfig.streams[0].consumerUsage);
+            sp<GraphicBuffer> gb = new GraphicBuffer(
+                previewStream.width, previewStream.height,
+                static_cast<int32_t>(halStreamConfig.streams[0].overrideFormat),
+                1, android_convertGralloc1To0Usage(
+                       halStreamConfig.streams[0].producerUsage,
+                       halStreamConfig.streams[0].consumerUsage));
             ASSERT_NE(nullptr, gb.get());
             StreamBuffer outputBuffer = {halStreamConfig.streams[0].id,
                     bufferId, hidl_handle(gb->getNativeBuffer()->handle),
@@ -2586,11 +2588,12 @@
                     &session /*out*/, &previewStream /*out*/,
                     &halStreamConfig /*out*/);
 
-            sp<GraphicBuffer> gb = new GraphicBuffer(previewStream.width,
-                    previewStream.height,
-                    static_cast<int32_t> (halStreamConfig.streams[0].overrideFormat),
-                    1, halStreamConfig.streams[0].producerUsage,
-                    halStreamConfig.streams[0].consumerUsage);
+            sp<GraphicBuffer> gb = new GraphicBuffer(
+                previewStream.width, previewStream.height,
+                static_cast<int32_t>(halStreamConfig.streams[0].overrideFormat),
+                1, android_convertGralloc1To0Usage(
+                       halStreamConfig.streams[0].producerUsage,
+                       halStreamConfig.streams[0].consumerUsage));
 
             StreamBuffer outputBuffer = {halStreamConfig.streams[0].id,
                     bufferId, hidl_handle(gb->getNativeBuffer()->handle),
@@ -2706,11 +2709,12 @@
                     settings = req; });
             ASSERT_TRUE(ret.isOk());
 
-            sp<GraphicBuffer> gb = new GraphicBuffer(previewStream.width,
-                    previewStream.height,
-                    static_cast<int32_t> (halStreamConfig.streams[0].overrideFormat),
-                    1, halStreamConfig.streams[0].producerUsage,
-                    halStreamConfig.streams[0].consumerUsage);
+            sp<GraphicBuffer> gb = new GraphicBuffer(
+                previewStream.width, previewStream.height,
+                static_cast<int32_t>(halStreamConfig.streams[0].overrideFormat),
+                1, android_convertGralloc1To0Usage(
+                       halStreamConfig.streams[0].producerUsage,
+                       halStreamConfig.streams[0].consumerUsage));
             ASSERT_NE(nullptr, gb.get());
             StreamBuffer outputBuffer = {halStreamConfig.streams[0].id,
                     bufferId, hidl_handle(gb->getNativeBuffer()->handle),
diff --git a/keymaster/3.0/default/KeymasterDevice.cpp b/keymaster/3.0/default/KeymasterDevice.cpp
index 58102bb..9c7c860 100644
--- a/keymaster/3.0/default/KeymasterDevice.cpp
+++ b/keymaster/3.0/default/KeymasterDevice.cpp
@@ -528,6 +528,8 @@
         case Tag::ATTESTATION_ID_SERIAL:
         case Tag::ATTESTATION_ID_IMEI:
         case Tag::ATTESTATION_ID_MEID:
+        case Tag::ATTESTATION_ID_MANUFACTURER:
+        case Tag::ATTESTATION_ID_MODEL:
             // Device id attestation may only be supported if the device is able to permanently
             // destroy its knowledge of the ids. This device is unable to do this, so it must
             // never perform any device id attestation.
diff --git a/wifi/1.0/default/android.hardware.wifi@1.0-service.rc b/wifi/1.0/default/android.hardware.wifi@1.0-service.rc
index 696b1f9..3672423 100644
--- a/wifi/1.0/default/android.hardware.wifi@1.0-service.rc
+++ b/wifi/1.0/default/android.hardware.wifi@1.0-service.rc
@@ -2,3 +2,4 @@
     class hal
     user wifi
     group wifi gps
+    capabilities NET_ADMIN NET_RAW
diff --git a/wifi/1.0/default/wifi_legacy_hal.cpp b/wifi/1.0/default/wifi_legacy_hal.cpp
index ba57ba7..6641be5 100644
--- a/wifi/1.0/default/wifi_legacy_hal.cpp
+++ b/wifi/1.0/default/wifi_legacy_hal.cpp
@@ -581,6 +581,11 @@
   return {status, std::move(freqs)};
 }
 
+wifi_error WifiLegacyHal::setDfsFlag(bool dfs_on) {
+  return global_func_table_.wifi_set_nodfs_flag(
+      wlan_interface_handle_, dfs_on ? 0 : 1);
+}
+
 wifi_error WifiLegacyHal::enableLinkLayerStats(bool debug) {
   wifi_link_layer_params params;
   params.mpdu_size_threshold = kLinkLayerStatsDataMpduSizeThreshold;
diff --git a/wifi/1.0/default/wifi_legacy_hal.h b/wifi/1.0/default/wifi_legacy_hal.h
index 576dfe6..1656f68 100644
--- a/wifi/1.0/default/wifi_legacy_hal.h
+++ b/wifi/1.0/default/wifi_legacy_hal.h
@@ -181,6 +181,7 @@
   wifi_error stopGscan(wifi_request_id id);
   std::pair<wifi_error, std::vector<uint32_t>> getValidFrequenciesForBand(
       wifi_band band);
+  wifi_error setDfsFlag(bool dfs_on);
   // Link layer stats functions.
   wifi_error enableLinkLayerStats(bool debug);
   wifi_error disableLinkLayerStats();
diff --git a/wifi/1.0/default/wifi_sta_iface.cpp b/wifi/1.0/default/wifi_sta_iface.cpp
index 626b195..3c52048 100644
--- a/wifi/1.0/default/wifi_sta_iface.cpp
+++ b/wifi/1.0/default/wifi_sta_iface.cpp
@@ -31,7 +31,14 @@
 WifiStaIface::WifiStaIface(
     const std::string& ifname,
     const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal)
-    : ifname_(ifname), legacy_hal_(legacy_hal), is_valid_(true) {}
+    : ifname_(ifname), legacy_hal_(legacy_hal), is_valid_(true) {
+  // Turn on DFS channel usage for STA iface.
+  legacy_hal::wifi_error legacy_status =
+      legacy_hal_.lock()->setDfsFlag(true);
+  if (legacy_status != legacy_hal::WIFI_SUCCESS) {
+    LOG(ERROR) << "Failed to set DFS flag; DFS channels may be unavailable.";
+  }
+}
 
 void WifiStaIface::invalidate() {
   legacy_hal_.reset();
@@ -309,7 +316,8 @@
   std::tie(legacy_status, legacy_logger_feature_set) =
       legacy_hal_.lock()->getLoggerSupportedFeatureSet();
   if (legacy_status != legacy_hal::WIFI_SUCCESS) {
-    return {createWifiStatusFromLegacyError(legacy_status), 0};
+    // some devices don't support querying logger feature set
+    legacy_logger_feature_set = 0;
   }
   uint32_t hidl_caps;
   if (!hidl_struct_util::convertLegacyFeaturesToHidlStaCapabilities(