Fix autofill for android (flutter/engine#40771)

Fix autofill for android
This commit is contained in:
Maurice Parrish
2023-04-06 10:54:16 -04:00
committed by GitHub
parent 04b27c2f63
commit 20cd1a9520
2 changed files with 10 additions and 1 deletions

View File

@@ -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);
}
}

View File

@@ -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));