Snap for 5130802 from 9eaec3c95de0183d0c5e2f507cd118d492f46913 to pie-cts-release
Change-Id: I9d09ab7c45d55435eaf13d9cca0abbac8a400282
diff --git a/tests/grp_pwd_test.cpp b/tests/grp_pwd_test.cpp
index 6316387..2cf5023 100644
--- a/tests/grp_pwd_test.cpp
+++ b/tests/grp_pwd_test.cpp
@@ -32,6 +32,10 @@
#include <android-base/strings.h>
#include <private/android_filesystem_config.h>
+#if defined(__BIONIC__)
+#include <android-base/properties.h>
+#endif
+
// Generated android_ids array
#include "generated_android_ids.h"
@@ -207,6 +211,7 @@
check_get_passwd("u1_i0", 199000, TYPE_APP);
}
+#if defined(__BIONIC__)
template <typename T>
static void expect_ids(const T& ids) {
std::set<typename T::key_type> expected_ids;
@@ -233,6 +238,14 @@
expect_range(AID_SHARED_GID_START, AID_SHARED_GID_END);
expect_range(AID_ISOLATED_START, AID_ISOLATED_END);
+ // Upgrading devices launched before API level 28 may not comply with the below check.
+ // Due to the difficulty in changing uids after launch, it is waived for these devices.
+ // Also grant this check for device launched with 28(P) to give the vendor time to
+ // adopt the AID scheme.
+ if (android::base::GetIntProperty("ro.product.first_api_level", 0) <= 28) {
+ return;
+ }
+
// Ensure that no other ids were returned.
auto return_differences = [&ids, &expected_ids] {
std::vector<typename T::key_type> missing_from_ids;
@@ -253,6 +266,7 @@
};
EXPECT_EQ(expected_ids, ids) << return_differences();
}
+#endif
TEST(pwd, getpwent_iterate) {
#if defined(__BIONIC__)