From 20cd1a95203a6a59c4636d0929a062f910dab0ea Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Thu, 6 Apr 2023 10:54:16 -0400 Subject: [PATCH] Fix autofill for android (flutter/engine#40771) Fix autofill for android --- .../io/flutter/embedding/android/FlutterView.java | 2 +- .../io/flutter/embedding/android/FlutterViewTest.java | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterView.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterView.java index 0c26f7d8dc..9bd0022fe3 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterView.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterView.java @@ -388,7 +388,7 @@ public class FlutterView extends FrameLayout setFocusable(true); setFocusableInTouchMode(true); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - setImportantForAutofill(View.IMPORTANT_FOR_AUTOFILL_YES_EXCLUDE_DESCENDANTS); + setImportantForAutofill(View.IMPORTANT_FOR_AUTOFILL_YES); } } diff --git a/engine/src/flutter/shell/platform/android/test/io/flutter/embedding/android/FlutterViewTest.java b/engine/src/flutter/shell/platform/android/test/io/flutter/embedding/android/FlutterViewTest.java index beb05cc29e..41337f0c30 100644 --- a/engine/src/flutter/shell/platform/android/test/io/flutter/embedding/android/FlutterViewTest.java +++ b/engine/src/flutter/shell/platform/android/test/io/flutter/embedding/android/FlutterViewTest.java @@ -92,6 +92,15 @@ public class FlutterViewTest { verify(platformViewsController, times(1)).attachToView(flutterView); } + @Test + public void flutterView_importantForAutofillDoesNotExcludeDescendants() { + FlutterView flutterView = new FlutterView(Robolectric.setupActivity(Activity.class)); + + // Value should not exclude descendants because platform views are added as child views and + // can be eligible for autofill (e.g. a WebView). + assertEquals(View.IMPORTANT_FOR_AUTOFILL_YES, flutterView.getImportantForAutofill()); + } + @Test public void detachFromFlutterEngine_alertsPlatformViews() { FlutterView flutterView = new FlutterView(Robolectric.setupActivity(Activity.class));