Test readonly request input in AIDL VTS.
This CL modifies the AIDL generated tests to use readonly memory pool
for request inputs.
Bug: 188104713
Test: VtsHalNeuralnetworksTargetTest
Change-Id: I9e62f1cdeb501bf29bcb9c56317a452c9105b272
Merged-In: I9e62f1cdeb501bf29bcb9c56317a452c9105b272
(cherry picked from commit dfc013adaa13cae38393279a98a3753a44814827)
diff --git a/neuralnetworks/aidl/vts/functional/Utils.h b/neuralnetworks/aidl/vts/functional/Utils.h
index 77085a7..9dd7359 100644
--- a/neuralnetworks/aidl/vts/functional/Utils.h
+++ b/neuralnetworks/aidl/vts/functional/Utils.h
@@ -79,15 +79,18 @@
class TestAshmem : public TestMemoryBase {
public:
- static std::unique_ptr<TestAshmem> create(uint32_t size);
+ // If aidlReadonly is true, getAidlMemory will return a sAIDL memory with readonly access;
+ // otherwise, the sAIDL memory has read-write access. This only affects the sAIDL memory.
+ // getPointer will always return a valid address with read-write access.
+ static std::unique_ptr<TestAshmem> create(uint32_t size, bool aidlReadonly = false);
// Prefer TestAshmem::create.
// The constructor calls initialize, which constructs the memory resources. This is a workaround
// that gtest macros cannot be used directly in a constructor.
- TestAshmem(uint32_t size) { initialize(size); }
+ TestAshmem(uint32_t size, bool aidlReadonly) { initialize(size, aidlReadonly); }
private:
- void initialize(uint32_t size);
+ void initialize(uint32_t size, bool aidlReadonly);
nn::Mapping mMappedMemory;
};