Merge sc-dev-plus-aosp-without-vendor@7634622
Merged-In: Ifa71accba7ecf2ab15980227a4413831cfceb187
Change-Id: I7fb44c6c578a51c8ad36649d20a46233fd9609ca
diff --git a/audio/core/all-versions/OWNERS b/audio/core/all-versions/OWNERS
index 6fdc97c..f9a2d6b 100644
--- a/audio/core/all-versions/OWNERS
+++ b/audio/core/all-versions/OWNERS
@@ -1,3 +1,3 @@
+# Bug component: 48436
elaurent@google.com
-krocard@google.com
mnaganov@google.com
diff --git a/bluetooth/1.0/vts/functional/OWNERS b/bluetooth/1.0/vts/functional/OWNERS
new file mode 100644
index 0000000..7f02612
--- /dev/null
+++ b/bluetooth/1.0/vts/functional/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 27441
+bluetooth-reviews@google.com
diff --git a/broadcastradio/2.0/vts/functional/OWNERS b/broadcastradio/2.0/vts/functional/OWNERS
new file mode 100644
index 0000000..2c21c25
--- /dev/null
+++ b/broadcastradio/2.0/vts/functional/OWNERS
@@ -0,0 +1,3 @@
+# Bug component: 533946
+oscarazu@google.com
+keunyoung@google.com
diff --git a/keymaster/4.0/vts/functional/KeymasterHidlTest.cpp b/keymaster/4.0/vts/functional/KeymasterHidlTest.cpp
index d0ad433..d326334 100644
--- a/keymaster/4.0/vts/functional/KeymasterHidlTest.cpp
+++ b/keymaster/4.0/vts/functional/KeymasterHidlTest.cpp
@@ -21,6 +21,7 @@
#include <android-base/logging.h>
#include <android/hidl/manager/1.0/IServiceManager.h>
+#include <cutils/properties.h>
#include <keymasterV4_0/key_param_output.h>
#include <keymasterV4_0/keymaster_utils.h>
@@ -685,6 +686,9 @@
case Algorithm::EC:
return {224, 384, 521};
case Algorithm::AES:
+ // The HAL language was clarified to exclude AES key sizes of 192 for StrongBox
+ // instances on devices launched on API Level 31 and above.
+ if (property_get_int32("ro.board.first_api_level", 0) < 31) return {};
return {192};
default:
return {};
diff --git a/neuralnetworks/1.0/utils/Android.bp b/neuralnetworks/1.0/utils/Android.bp
index 0ad9926..8c51c67 100644
--- a/neuralnetworks/1.0/utils/Android.bp
+++ b/neuralnetworks/1.0/utils/Android.bp
@@ -44,6 +44,7 @@
cc_test {
name: "neuralnetworks_utils_hal_1_0_test",
+ host_supported: true,
srcs: ["test/*.cpp"],
static_libs: [
"android.hardware.neuralnetworks@1.0",
@@ -62,8 +63,12 @@
"libhidlbase",
"libhidlmemory",
"liblog",
- "libnativewindow",
"libutils",
],
+ target: {
+ android: {
+ shared_libs: ["libnativewindow"],
+ },
+ },
test_suites: ["general-tests"],
}
diff --git a/neuralnetworks/1.0/vts/functional/Android.bp b/neuralnetworks/1.0/vts/functional/Android.bp
index 9a91560..b33c581 100644
--- a/neuralnetworks/1.0/vts/functional/Android.bp
+++ b/neuralnetworks/1.0/vts/functional/Android.bp
@@ -25,19 +25,10 @@
cc_defaults {
name: "neuralnetworks_vts_functional_defaults",
- defaults: ["VtsHalTargetTestDefaults"],
- arch: {
- x86: {
- cflags: [ "-D_Float16=__fp16",
- "-Xclang", "-fnative-half-type",
- "-Xclang", "-fallow-half-arguments-and-returns" ],
- },
- x86_64: {
- cflags: [ "-D_Float16=__fp16",
- "-Xclang", "-fnative-half-type",
- "-Xclang", "-fallow-half-arguments-and-returns" ],
- },
- },
+ defaults: [
+ "VtsHalTargetTestDefaults",
+ "neuralnetworks_float16",
+ ],
}
cc_library_static {
@@ -83,6 +74,7 @@
"libnativewindow",
],
static_libs: [
+ "VtsHalNeuralNetworksV1_0_utils",
"android.hardware.neuralnetworks@1.0",
"android.hidl.allocator@1.0",
"android.hidl.memory@1.0",
@@ -90,7 +82,6 @@
"libhidlmemory",
"libneuralnetworks_generated_test_harness",
"libneuralnetworks_utils",
- "VtsHalNeuralNetworksV1_0_utils",
],
whole_static_libs: [
"neuralnetworks_generated_V1_0_example",
@@ -98,5 +89,8 @@
header_libs: [
"libneuralnetworks_headers",
],
- test_suites: ["general-tests", "vts"],
+ test_suites: [
+ "general-tests",
+ "vts",
+ ],
}
diff --git a/neuralnetworks/1.1/utils/Android.bp b/neuralnetworks/1.1/utils/Android.bp
index d9e82d4..737ff58 100644
--- a/neuralnetworks/1.1/utils/Android.bp
+++ b/neuralnetworks/1.1/utils/Android.bp
@@ -46,6 +46,7 @@
cc_test {
name: "neuralnetworks_utils_hal_1_1_test",
+ host_supported: true,
srcs: ["test/*.cpp"],
static_libs: [
"android.hardware.neuralnetworks@1.0",
@@ -66,8 +67,12 @@
"libhidlbase",
"libhidlmemory",
"liblog",
- "libnativewindow",
"libutils",
],
+ target: {
+ android: {
+ shared_libs: ["libnativewindow"],
+ },
+ },
test_suites: ["general-tests"],
}
diff --git a/neuralnetworks/1.1/vts/functional/Android.bp b/neuralnetworks/1.1/vts/functional/Android.bp
index 826ba96..c001112 100644
--- a/neuralnetworks/1.1/vts/functional/Android.bp
+++ b/neuralnetworks/1.1/vts/functional/Android.bp
@@ -28,18 +28,19 @@
defaults: ["neuralnetworks_vts_functional_defaults"],
srcs: [
"BasicTests.cpp",
+ "GeneratedTestHarness.cpp",
"TestAssertions.cpp",
"TestMain.cpp",
"ValidateModel.cpp",
"ValidateRequest.cpp",
"VtsHalNeuralnetworks.cpp",
- "GeneratedTestHarness.cpp",
],
shared_libs: [
"libfmq",
"libnativewindow",
],
static_libs: [
+ "VtsHalNeuralNetworksV1_0_utils",
"android.hardware.neuralnetworks@1.0",
"android.hardware.neuralnetworks@1.1",
"android.hidl.allocator@1.0",
@@ -48,7 +49,6 @@
"libhidlmemory",
"libneuralnetworks_generated_test_harness",
"libneuralnetworks_utils",
- "VtsHalNeuralNetworksV1_0_utils",
],
whole_static_libs: [
"neuralnetworks_generated_V1_0_example",
@@ -57,5 +57,8 @@
header_libs: [
"libneuralnetworks_headers",
],
- test_suites: ["general-tests", "vts"],
+ test_suites: [
+ "general-tests",
+ "vts",
+ ],
}
diff --git a/neuralnetworks/1.2/utils/Android.bp b/neuralnetworks/1.2/utils/Android.bp
index 41281ee..4eefb0f 100644
--- a/neuralnetworks/1.2/utils/Android.bp
+++ b/neuralnetworks/1.2/utils/Android.bp
@@ -50,10 +50,21 @@
cflags: ["-DNN_DEBUGGABLE"],
},
},
+ target: {
+ host: {
+ cflags: [
+ "-D__INTRODUCED_IN(x)=",
+ "-D__assert(a,b,c)=",
+ // We want all the APIs to be available on the host.
+ "-D__ANDROID_API__=10000",
+ ],
+ },
+ },
}
cc_test {
name: "neuralnetworks_utils_hal_1_2_test",
+ host_supported: true,
srcs: ["test/*.cpp"],
static_libs: [
"android.hardware.neuralnetworks@1.0",
@@ -76,8 +87,12 @@
"libhidlbase",
"libhidlmemory",
"liblog",
- "libnativewindow",
"libutils",
],
+ target: {
+ android: {
+ shared_libs: ["libnativewindow"],
+ },
+ },
test_suites: ["general-tests"],
}
diff --git a/neuralnetworks/1.3/utils/Android.bp b/neuralnetworks/1.3/utils/Android.bp
index 28c036a..7acb4fc 100644
--- a/neuralnetworks/1.3/utils/Android.bp
+++ b/neuralnetworks/1.3/utils/Android.bp
@@ -47,10 +47,21 @@
export_static_lib_headers: [
"neuralnetworks_utils_hal_common",
],
+ target: {
+ host: {
+ cflags: [
+ "-D__INTRODUCED_IN(x)=",
+ "-D__assert(a,b,c)=",
+ // We want all the APIs to be available on the host.
+ "-D__ANDROID_API__=10000",
+ ],
+ },
+ },
}
cc_test {
name: "neuralnetworks_utils_hal_1_3_test",
+ host_supported: true,
srcs: ["test/*.cpp"],
static_libs: [
"android.hardware.neuralnetworks@1.0",
@@ -75,8 +86,12 @@
"libhidlbase",
"libhidlmemory",
"liblog",
- "libnativewindow",
"libutils",
],
+ target: {
+ android: {
+ shared_libs: ["libnativewindow"],
+ },
+ },
test_suites: ["general-tests"],
}
diff --git a/neuralnetworks/aidl/Android.bp b/neuralnetworks/aidl/Android.bp
index 1b1e78f..951cdd5 100644
--- a/neuralnetworks/aidl/Android.bp
+++ b/neuralnetworks/aidl/Android.bp
@@ -9,6 +9,7 @@
aidl_interface {
name: "android.hardware.neuralnetworks",
+ host_supported: true,
vendor_available: true,
srcs: [
"android/hardware/neuralnetworks/*.aidl",
diff --git a/neuralnetworks/aidl/utils/Android.bp b/neuralnetworks/aidl/utils/Android.bp
index 57d047b..508b1ea 100644
--- a/neuralnetworks/aidl/utils/Android.bp
+++ b/neuralnetworks/aidl/utils/Android.bp
@@ -41,8 +41,12 @@
"android.hardware.neuralnetworks-V1-ndk",
"libbinder_ndk",
"libhidlbase",
- "libnativewindow",
],
+ target: {
+ android: {
+ shared_libs: ["libnativewindow"],
+ },
+ },
}
cc_test {
@@ -70,9 +74,21 @@
"libhidlbase",
"libhidlmemory",
"liblog",
- "libnativewindow",
"libutils",
],
+ target: {
+ android: {
+ shared_libs: ["libnativewindow"],
+ },
+ host: {
+ cflags: [
+ "-D__INTRODUCED_IN(x)=",
+ "-D__assert(a,b,c)=",
+ // We want all the APIs to be available on the host.
+ "-D__ANDROID_API__=10000",
+ ],
+ },
+ },
cflags: [
/* GMOCK defines functions for printing all MOCK_DEVICE arguments and
* MockDevice contains a string pointer which triggers a warning in the
diff --git a/neuralnetworks/aidl/utils/src/Conversions.cpp b/neuralnetworks/aidl/utils/src/Conversions.cpp
index 0517730..f087156 100644
--- a/neuralnetworks/aidl/utils/src/Conversions.cpp
+++ b/neuralnetworks/aidl/utils/src/Conversions.cpp
@@ -25,7 +25,6 @@
#include <android-base/mapped_file.h>
#include <android-base/unique_fd.h>
#include <android/binder_auto_utils.h>
-#include <android/hardware_buffer.h>
#include <cutils/native_handle.h>
#include <nnapi/OperandTypes.h>
#include <nnapi/OperationTypes.h>
@@ -36,7 +35,6 @@
#include <nnapi/Validation.h>
#include <nnapi/hal/CommonUtils.h>
#include <nnapi/hal/HandleError.h>
-#include <vndk/hardware_buffer.h>
#include <algorithm>
#include <chrono>
@@ -48,6 +46,11 @@
#include "Utils.h"
+#ifdef __ANDROID__
+#include <android/hardware_buffer.h>
+#include <vndk/hardware_buffer.h>
+#endif // __ANDROID__
+
#define VERIFY_NON_NEGATIVE(value) \
while (UNLIKELY(value < 0)) return NN_ERROR()
@@ -119,6 +122,7 @@
using UniqueNativeHandle = std::unique_ptr<native_handle_t, NativeHandleDeleter>;
+#ifdef __ANDROID__
GeneralResult<UniqueNativeHandle> nativeHandleFromAidlHandle(const NativeHandle& handle) {
auto nativeHandle = UniqueNativeHandle(dupFromAidl(handle));
if (nativeHandle.get() == nullptr) {
@@ -131,6 +135,7 @@
}
return nativeHandle;
}
+#endif // __ANDROID__
} // anonymous namespace
@@ -371,6 +376,7 @@
return createSharedMemoryFromFd(size, prot, fd, offset);
}
case Tag::hardwareBuffer: {
+#ifdef __ANDROID__
const auto& hardwareBuffer = memory.get<Tag::hardwareBuffer>();
const UniqueNativeHandle handle =
@@ -393,6 +399,11 @@
}
return createSharedMemoryFromAHWB(ahwb, /*takeOwnership=*/true);
+#else // __ANDROID__
+ LOG(FATAL) << "GeneralResult<SharedMemory> unvalidatedConvert(const aidl_hal::Memory& "
+ "memory): Not Available on Host Build";
+ return NN_ERROR() << "createFromHandle failed";
+#endif // __ANDROID__
}
}
return NN_ERROR() << "Unrecognized Memory::Tag: " << memory.getTag();
@@ -612,6 +623,7 @@
template <class... Ts>
overloaded(Ts...)->overloaded<Ts...>;
+#ifdef __ANDROID__
nn::GeneralResult<common::NativeHandle> aidlHandleFromNativeHandle(
const native_handle_t& nativeHandle) {
auto handle = ::android::dupToAidl(&nativeHandle);
@@ -621,6 +633,7 @@
}
return handle;
}
+#endif // __ANDROID__
nn::GeneralResult<Memory> unvalidatedConvert(const nn::Memory::Ashmem& memory) {
if constexpr (std::numeric_limits<size_t>::max() > std::numeric_limits<int64_t>::max()) {
@@ -668,6 +681,7 @@
}
nn::GeneralResult<Memory> unvalidatedConvert(const nn::Memory::HardwareBuffer& memory) {
+#ifdef __ANDROID__
const native_handle_t* nativeHandle = AHardwareBuffer_getNativeHandle(memory.handle.get());
if (nativeHandle == nullptr) {
return (NN_ERROR() << "unvalidatedConvert failed because AHardwareBuffer_getNativeHandle "
@@ -695,6 +709,12 @@
.handle = std::move(handle),
};
return Memory::make<Memory::Tag::hardwareBuffer>(std::move(hardwareBuffer));
+#else // __ANDROID__
+ LOG(FATAL) << "nn::GeneralResult<Memory> unvalidatedConvert(const nn::Memory::HardwareBuffer& "
+ "memory): Not Available on Host Build";
+ (void)memory;
+ return (NN_ERROR() << "unvalidatedConvert failed").operator nn::GeneralResult<Memory>();
+#endif // __ANDROID__
}
nn::GeneralResult<Memory> unvalidatedConvert(const nn::Memory::Unknown& /*memory*/) {
diff --git a/neuralnetworks/utils/common/Android.bp b/neuralnetworks/utils/common/Android.bp
index a08e770..431885c 100644
--- a/neuralnetworks/utils/common/Android.bp
+++ b/neuralnetworks/utils/common/Android.bp
@@ -37,13 +37,18 @@
shared_libs: [
"android.hardware.neuralnetworks-V1-ndk",
"libhidlbase",
- "libnativewindow",
"libbinder_ndk",
],
+ target: {
+ android: {
+ shared_libs: ["libnativewindow"],
+ },
+ },
}
cc_test {
name: "neuralnetworks_utils_hal_common_test",
+ host_supported: true,
srcs: ["test/*.cpp"],
static_libs: [
"android.hardware.neuralnetworks@1.0",
@@ -61,8 +66,12 @@
"libhidlbase",
"libhidlmemory",
"liblog",
- "libnativewindow",
"libutils",
],
+ target: {
+ android: {
+ shared_libs: ["libnativewindow"],
+ },
+ },
test_suites: ["general-tests"],
}
diff --git a/neuralnetworks/utils/common/src/CommonUtils.cpp b/neuralnetworks/utils/common/src/CommonUtils.cpp
index 906b0cf..ae02c88 100644
--- a/neuralnetworks/utils/common/src/CommonUtils.cpp
+++ b/neuralnetworks/utils/common/src/CommonUtils.cpp
@@ -20,14 +20,12 @@
#include <android-base/logging.h>
#include <android-base/unique_fd.h>
-#include <android/hardware_buffer.h>
#include <hidl/HidlSupport.h>
#include <nnapi/Result.h>
#include <nnapi/SharedMemory.h>
#include <nnapi/TypeUtils.h>
#include <nnapi/Types.h>
#include <nnapi/Validation.h>
-#include <vndk/hardware_buffer.h>
#include <algorithm>
#include <any>
@@ -36,6 +34,11 @@
#include <variant>
#include <vector>
+#ifdef __ANDROID__
+#include <android/hardware_buffer.h>
+#include <vndk/hardware_buffer.h>
+#endif // __ANDROID__
+
namespace android::hardware::neuralnetworks::utils {
namespace {
@@ -139,6 +142,7 @@
}
nn::GeneralResult<hidl_memory> createHidlMemoryFrom(const nn::Memory::HardwareBuffer& memory) {
+#ifdef __ANDROID__
const auto* ahwb = memory.handle.get();
AHardwareBuffer_Desc bufferDesc;
AHardwareBuffer_describe(ahwb, &bufferDesc);
@@ -152,6 +156,12 @@
hidl_handle copiedHandle(hidlHandle);
return hidl_memory(name, std::move(copiedHandle), size);
+#else // __ANDROID__
+ LOG(FATAL) << "nn::GeneralResult<hidl_memory> createHidlMemoryFrom(const "
+ "nn::Memory::HardwareBuffer& memory): Not Available on Host Build";
+ (void)memory;
+ return (NN_ERROR() << "createHidlMemoryFrom failed").operator nn::GeneralResult<hidl_memory>();
+#endif // __ANDROID__
}
nn::GeneralResult<hidl_memory> createHidlMemoryFrom(const nn::Memory::Unknown& memory) {
@@ -333,9 +343,11 @@
return std::visit([](const auto& x) { return createHidlMemoryFrom(x); }, memory->handle);
}
+#ifdef __ANDROID__
static uint32_t roundUpToMultiple(uint32_t value, uint32_t multiple) {
return (value + multiple - 1) / multiple * multiple;
}
+#endif // __ANDROID__
nn::GeneralResult<nn::SharedMemory> createSharedMemoryFromHidlMemory(const hidl_memory& memory) {
CHECK_LE(memory.size(), std::numeric_limits<size_t>::max());
@@ -387,6 +399,7 @@
return std::make_shared<const nn::Memory>(nn::Memory{.handle = std::move(handle)});
}
+#ifdef __ANDROID__
const auto size = memory.size();
const auto format = AHARDWAREBUFFER_FORMAT_BLOB;
const auto usage = AHARDWAREBUFFER_USAGE_CPU_READ_OFTEN | AHARDWAREBUFFER_USAGE_CPU_WRITE_OFTEN;
@@ -423,6 +436,13 @@
}
return nn::createSharedMemoryFromAHWB(hardwareBuffer, /*takeOwnership=*/true);
+#else // __ANDROID__
+ LOG(FATAL) << "nn::GeneralResult<nn::SharedMemory> createSharedMemoryFromHidlMemory(const "
+ "hidl_memory& memory): Not Available on Host Build";
+ return (NN_ERROR() << "createSharedMemoryFromHidlMemory failed")
+ .
+ operator nn::GeneralResult<nn::SharedMemory>();
+#endif // __ANDROID__
}
nn::GeneralResult<hidl_handle> hidlHandleFromSharedHandle(const nn::Handle& handle) {
diff --git a/security/keymint/aidl/OWNERS b/security/keymint/aidl/OWNERS
index a93b171..54d820a 100644
--- a/security/keymint/aidl/OWNERS
+++ b/security/keymint/aidl/OWNERS
@@ -1,3 +1,4 @@
+drysdale@google.com
jbires@google.com
jdanis@google.com
seleneh@google.com
diff --git a/security/keymint/aidl/android/hardware/security/keymint/IKeyMintDevice.aidl b/security/keymint/aidl/android/hardware/security/keymint/IKeyMintDevice.aidl
index 1849723..cd8cfc5 100644
--- a/security/keymint/aidl/android/hardware/security/keymint/IKeyMintDevice.aidl
+++ b/security/keymint/aidl/android/hardware/security/keymint/IKeyMintDevice.aidl
@@ -96,7 +96,8 @@
*
* o AES
*
- * - 128 and 256-bit keys
+ * - TRUSTED_ENVIRONMENT IKeyMintDevices must support 128, 192 and 256-bit keys.
+ * STRONGBOX IKeyMintDevices must only support 128 and 256-bit keys.
* - CBC, CTR, ECB and GCM modes. The GCM mode must not allow the use of tags smaller than 96
* bits or nonce lengths other than 96 bits.
* - CBC and ECB modes must support unpadded and PKCS7 padding modes. With no padding CBC and
diff --git a/security/keymint/aidl/vts/functional/KeyMintTest.cpp b/security/keymint/aidl/vts/functional/KeyMintTest.cpp
index b695dee..931317f 100644
--- a/security/keymint/aidl/vts/functional/KeyMintTest.cpp
+++ b/security/keymint/aidl/vts/functional/KeyMintTest.cpp
@@ -3271,10 +3271,10 @@
for (uint32_t key_size : {bitlen - 1, bitlen + 1, bitlen - 8, bitlen + 8}) {
// Explicit key size doesn't match that of the provided key.
auto result = ImportKey(AuthorizationSetBuilder()
- .Authorization(TAG_NO_AUTH_REQUIRED)
- .AesEncryptionKey(key_size)
- .EcbMode()
- .Padding(PaddingMode::PKCS7),
+ .Authorization(TAG_NO_AUTH_REQUIRED)
+ .AesEncryptionKey(key_size)
+ .EcbMode()
+ .Padding(PaddingMode::PKCS7),
KeyFormat::RAW, key);
ASSERT_TRUE(result == ErrorCode::IMPORT_PARAMETER_MISMATCH ||
result == ErrorCode::UNSUPPORTED_KEY_SIZE)
@@ -3338,10 +3338,10 @@
for (uint32_t key_size : {bitlen - 1, bitlen + 1, bitlen - 8, bitlen + 8}) {
// Explicit key size doesn't match that of the provided key.
auto result = ImportKey(AuthorizationSetBuilder()
- .Authorization(TAG_NO_AUTH_REQUIRED)
- .TripleDesEncryptionKey(key_size)
- .EcbMode()
- .Padding(PaddingMode::PKCS7),
+ .Authorization(TAG_NO_AUTH_REQUIRED)
+ .TripleDesEncryptionKey(key_size)
+ .EcbMode()
+ .Padding(PaddingMode::PKCS7),
KeyFormat::RAW, key);
ASSERT_TRUE(result == ErrorCode::IMPORT_PARAMETER_MISMATCH ||
result == ErrorCode::UNSUPPORTED_KEY_SIZE)
@@ -6203,7 +6203,8 @@
.Digest(Digest::NONE)
.Padding(PaddingMode::NONE)
.Authorization(TAG_NO_AUTH_REQUIRED)
- .Authorization(TAG_ROLLBACK_RESISTANCE));
+ .Authorization(TAG_ROLLBACK_RESISTANCE)
+ .SetDefaultValidity());
ASSERT_TRUE(error == ErrorCode::ROLLBACK_RESISTANCE_UNAVAILABLE || error == ErrorCode::OK);
// Delete must work if rollback protection is implemented