This catches before dlopen fails if the default Android-26 layers are being used and attempted to be ran on Android 25 or below
| 167 | |
| 168 | // This catches before dlopen fails if the default Android-26 layers are being used and attempted to be ran on Android 25 or below |
| 169 | void __attribute__((constructor)) CheckAndroidVersion() { |
| 170 | const std::string version = GetEnvironment("ro.build.version.sdk"); |
| 171 | |
| 172 | if (version.empty()) { |
| 173 | return; |
| 174 | } |
| 175 | |
| 176 | constexpr uint32_t target_android_api = 26; |
| 177 | constexpr uint32_t android_api = __ANDROID_API__; |
| 178 | |
| 179 | static_assert(android_api >= target_android_api, "Vulkan-ValidationLayers is not supported on Android 25 and below"); |
| 180 | |
| 181 | uint32_t queried_version{}; |
| 182 | |
| 183 | if (std::from_chars(version.data(), version.data() + version.size(), queried_version).ec != std::errc()) { |
| 184 | return; |
| 185 | } |
| 186 | |
| 187 | if (queried_version < target_android_api) { |
| 188 | __android_log_print(ANDROID_LOG_FATAL, "VALIDATION", "ERROR - Android version is %d and needs to be 26 or above.", |
| 189 | queried_version); |
| 190 | } |
| 191 | } |
| 192 | |
| 193 | #endif |
nothing calls this directly
no test coverage detected