Bug 1734552 - Don't walk though the accessibility nodes on autofill. r=geckoview-reviewers,agi

When Autofill service runs with compatibility mode [*1] (such as Bitwarden),
`View.onProvideAutofillStructure` walks through the accessibility nodes.
Walking through it spends a lot of times.

When checking Android's source code, the following walks through it.

- `onProvideAutofillVirtualStructure`
- `autofill`
- `isVisibleToUserForAutofill`

Actually, since we already add autofill's virtual nodes, it is unnecessary to
walk through it.

*1 https://developer.android.com/reference/android/service/autofill/AutofillService#compatibility-mode

Differential Revision: https://phabricator.services.mozilla.com/D127952
This commit is contained in:
Makoto Kato 2021-10-11 13:16:45 +00:00
Родитель cd949b6356
Коммит 9408d87ba5
1 изменённых файлов: 8 добавлений и 4 удалений

Просмотреть файл

@ -785,8 +785,6 @@ public class GeckoView extends FrameLayout {
@Override
public void onProvideAutofillVirtualStructure(final ViewStructure structure,
final int flags) {
super.onProvideAutofillVirtualStructure(structure, flags);
if (mSession == null) {
return;
}
@ -798,8 +796,6 @@ public class GeckoView extends FrameLayout {
@Override
@TargetApi(26)
public void autofill(@NonNull final SparseArray<AutofillValue> values) {
super.autofill(values);
if (mSession == null) {
return;
}
@ -814,6 +810,14 @@ public class GeckoView extends FrameLayout {
mSession.autofill(strValues);
}
@Override
public boolean isVisibleToUserForAutofill(final int virtualId) {
// If autofill service works with compatibility mode,
// View.isVisibleToUserForAutofill walks through the accessibility nodes.
// This override avoids it.
return true;
}
/**
* Request a {@link Bitmap} of the visible portion of the web page currently being
* rendered.