Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ INTERNAL NOTE

### [3.29.2](https://github.com/flutter/flutter/releases/tag/3.29.2)

- [flutter/164201](https://github.com/flutter/flutter/pull/164201) - Always use Android hardware buffers for platform views when supported.
- [flutter/162198](https://github.com/flutter/flutter/issues/162198) Fixes double-download of canvaskit.wasm

### [3.29.1](https://github.com/flutter/flutter/releases/tag/3.29.1)
Expand Down
4 changes: 0 additions & 4 deletions engine/src/flutter/ci/licenses_golden/licenses_flutter
Original file line number Diff line number Diff line change
Expand Up @@ -42833,8 +42833,6 @@ ORIGIN: ../../../flutter/impeller/toolkit/android/native_window.cc + ../../../fl
ORIGIN: ../../../flutter/impeller/toolkit/android/native_window.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/toolkit/android/proc_table.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/toolkit/android/proc_table.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/toolkit/android/shadow_realm.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/toolkit/android/shadow_realm.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/toolkit/android/surface_control.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/toolkit/android/surface_control.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/toolkit/android/surface_transaction.cc + ../../../flutter/LICENSE
Expand Down Expand Up @@ -45781,8 +45779,6 @@ FILE: ../../../flutter/impeller/toolkit/android/native_window.cc
FILE: ../../../flutter/impeller/toolkit/android/native_window.h
FILE: ../../../flutter/impeller/toolkit/android/proc_table.cc
FILE: ../../../flutter/impeller/toolkit/android/proc_table.h
FILE: ../../../flutter/impeller/toolkit/android/shadow_realm.cc
FILE: ../../../flutter/impeller/toolkit/android/shadow_realm.h
FILE: ../../../flutter/impeller/toolkit/android/surface_control.cc
FILE: ../../../flutter/impeller/toolkit/android/surface_control.h
FILE: ../../../flutter/impeller/toolkit/android/surface_transaction.cc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

#if FML_OS_ANDROID
#include "impeller/renderer/backend/vulkan/swapchain/ahb/ahb_swapchain_vk.h"
#include "impeller/toolkit/android/shadow_realm.h"
#endif // FML_OS_ANDROID

namespace impeller {
Expand Down
2 changes: 0 additions & 2 deletions engine/src/flutter/impeller/toolkit/android/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ impeller_component("android") {
"native_window.h",
"proc_table.cc",
"proc_table.h",
"shadow_realm.cc",
"shadow_realm.h",
"surface_control.cc",
"surface_control.h",
"surface_transaction.cc",
Expand Down
45 changes: 0 additions & 45 deletions engine/src/flutter/impeller/toolkit/android/shadow_realm.cc

This file was deleted.

27 changes: 0 additions & 27 deletions engine/src/flutter/impeller/toolkit/android/shadow_realm.h

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include "impeller/toolkit/android/choreographer.h"
#include "impeller/toolkit/android/hardware_buffer.h"
#include "impeller/toolkit/android/proc_table.h"
#include "impeller/toolkit/android/shadow_realm.h"
#include "impeller/toolkit/android/surface_control.h"
#include "impeller/toolkit/android/surface_transaction.h"

Expand Down Expand Up @@ -135,18 +134,4 @@ TEST(ToolkitAndroidTest, CanPostAndWaitForFrameCallbacks) {
event.Wait();
}

TEST(ToolkitAndroidTest, ShouldDisableAHB) {
EXPECT_FALSE(
ShadowRealm::ShouldDisableAHBInternal("android-huawei", "30", 30));
EXPECT_FALSE(
ShadowRealm::ShouldDisableAHBInternal("something made up", "29", 29));

EXPECT_TRUE(
ShadowRealm::ShouldDisableAHBInternal("android-huawei", "29", 29));
EXPECT_TRUE(
ShadowRealm::ShouldDisableAHBInternal("something made up", "27", 29));
EXPECT_TRUE(
ShadowRealm::ShouldDisableAHBInternal("android-huawei", "garbage", 29));
}

} // namespace impeller::android::testing
14 changes: 14 additions & 0 deletions engine/src/flutter/shell/platform/android/flutter_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ namespace {

fml::jni::ScopedJavaGlobalRef<jclass>* g_flutter_jni_class = nullptr;

static const constexpr char* kAndroidHuawei = "android-huawei";

/// These are SoCs that crash when using AHB imports.
static constexpr const char* kBLC[] = {
// Most Exynos Series SoC
Expand Down Expand Up @@ -310,6 +312,18 @@ AndroidRenderingAPI FlutterMain::SelectedRenderingAPI(
return kVulkanUnsupportedFallback;
}

__system_property_get("ro.com.google.clientidbase", product_model);
if (strcmp(product_model, kAndroidHuawei) == 0) {
// Avoid using Vulkan on Huawei as AHB imports do not
// consistently work.
return kVulkanUnsupportedFallback;
}

if (__system_property_find("ro.vendor.mediatek.platform") != nullptr) {
// Probably MediaTek. Avoid Vulkan.
return kVulkanUnsupportedFallback;
}

__system_property_get("ro.product.board", product_model);
if (IsKnownBadSOC(product_model)) {
// Avoid using Vulkan on known bad SoCs.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1535,14 +1535,4 @@ void updateSemantics(
public interface AsyncWaitForVsyncDelegate {
void asyncWaitForVsync(final long cookie);
}

/**
* Whether Android Hardware Buffer import is known to not work on this particular vendor + API
* level and should be disabled.
*/
public boolean ShouldDisableAHB() {
return nativeShouldDisableAHB();
}

private native boolean nativeShouldDisableAHB();
}
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,7 @@ public SurfaceProducer createSurfaceProducer() {
// version that is
// running Vulkan, so we don't have to worry about it not being supported.
final SurfaceProducer entry;
if (!debugForceSurfaceProducerGlTextures
&& Build.VERSION.SDK_INT >= API_LEVELS.API_29
&& !flutterJNI.ShouldDisableAHB()) {
if (!debugForceSurfaceProducerGlTextures && Build.VERSION.SDK_INT >= API_LEVELS.API_29) {
final long id = nextTextureId.getAndIncrement();
final ImageReaderSurfaceProducer producer = new ImageReaderSurfaceProducer(id);
registerImageTexture(id, producer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
#include <sstream>
#include <utility>

#include "impeller/toolkit/android/shadow_realm.h"
#include "include/android/SkImageAndroid.h"
#include "unicode/uchar.h"

#include "flutter/assets/directory_asset_bundle.h"
Expand Down Expand Up @@ -853,12 +851,6 @@ bool RegisterApi(JNIEnv* env) {
.name = "nativeUpdateDisplayMetrics",
.signature = "(J)V",
.fnPtr = reinterpret_cast<void*>(&UpdateDisplayMetrics),
},
{
.name = "nativeShouldDisableAHB",
.signature = "()Z",
.fnPtr = reinterpret_cast<void*>(
&impeller::android::ShadowRealm::ShouldDisableAHB),
}};

if (env->RegisterNatives(g_flutter_jni_class->obj(), flutter_jni_methods,
Expand Down