[android] correct API availibility checks for hcpp. (#163226)

This fixes the HCPP crashes in devicelab by correctly disabling HCPP for
devices that are < API level 34. Unfortunately this means we can't
benchmark on CI until we update the devices.
This commit is contained in:
Jonah Williams 2025-02-13 09:39:48 -08:00 committed by GitHub
parent 4ff2deafd4
commit 1cd3ab16ca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 4 deletions

View File

@ -59,7 +59,8 @@ std::shared_ptr<SwapchainVK> SwapchainVK::Create(
// Use AHB Swapchains if they are opted in.
if (ContextVK::Cast(*context).GetShouldEnableSurfaceControlSwapchain() &&
AHBSwapchainVK::IsAvailableOnPlatform()) {
AHBSwapchainVK::IsAvailableOnPlatform() &&
android_get_device_api_level() >= 34) {
FML_LOG(WARNING) << "Using Android SurfaceControl Swapchain.";
auto ahb_swapchain = std::shared_ptr<AHBSwapchainVK>(new AHBSwapchainVK(
context, //

View File

@ -136,13 +136,13 @@ PlatformViewAndroid::PlatformViewAndroid(
delegate.OnPlatformViewGetSettings().enable_impeller //
);
android_surface_ = surface_factory_->CreateSurface();
// TODO(jonahwilliams): we need to expose the runtime check for the
// correct extensions and allowlist for this to work correctly.
android_use_new_platform_view_ =
android_context->RenderingApi() ==
AndroidRenderingAPI::kImpellerVulkan &&
(android_get_device_api_level() >= kMinAPILevelHCPP) &&
delegate.OnPlatformViewGetSettings().enable_surface_control;
delegate.OnPlatformViewGetSettings().enable_surface_control &&
impeller::ContextVK::Cast(*android_context->GetImpellerContext())
.GetShouldEnableSurfaceControlSwapchain();
FML_CHECK(android_surface_ && android_surface_->IsValid())
<< "Could not create an OpenGL, Vulkan or Software surface to set "
"up "