VtsKernelEncryptionTest: Bypass FBEPolicyTest for non-FBE device
For non-FBE project, it doesn't support FS_IOC_ADD_ENCRYPTION_KEY
and it will return EOPNOTSUPP.
Thus it doesn't need to report error in IsFscryptV2Supported().
Bug: 176860654
Test: run FBEPolicyTest#TestAesPerFileKeysPolicy on FDE device
Change-Id: I3875ca9cdafc46bbe3ba96f9fda4e645ca19ab3a
diff --git a/encryption/file_based_encryption_tests.cpp b/encryption/file_based_encryption_tests.cpp
index 528469e..f0f4379 100644
--- a/encryption/file_based_encryption_tests.cpp
+++ b/encryption/file_based_encryption_tests.cpp
@@ -157,7 +157,9 @@
// available, as the other features were added in the same AOSP release.
//
// The easiest way to do this is to just execute the ioctl with a NULL argument.
-// If available it will fail with EFAULT; otherwise it will fail with ENOTTY.
+// If available it will fail with EFAULT; otherwise it will fail with ENOTTY (or
+// EOPNOTSUPP if encryption isn't enabled on the filesystem; that happens on old
+// devices that aren't using FBE and are upgraded to a new kernel).
//
static bool IsFscryptV2Supported(const std::string &mountpoint) {
android::base::unique_fd fd(
@@ -176,6 +178,7 @@
switch (errno) {
case EFAULT:
return true;
+ case EOPNOTSUPP:
case ENOTTY:
GTEST_LOG_(INFO) << "No support for FS_IOC_ADD_ENCRYPTION_KEY on "
<< mountpoint;