Merge "[Autofill PCC] Fix crash on picking result from Fill Dialog Note that these are band-aid fixes, and proper fixes would come later. Also, guard an existing call behind the flag. Bug: 275608129 Test: Manually tested twitter app" into udc-dev

This commit is contained in:
Simranjit Kohli
2023-03-30 17:08:35 +00:00
committed by Android (Google) Code Review
3 changed files with 9 additions and 3 deletions

View File

@@ -127,7 +127,7 @@ public final class FillContext implements Parcelable {
final int index = missingNodeIndexes.keyAt(i);
final AutofillId id = ids[index];
if (id.equals(node.getAutofillId())) {
if (id != null && id.equals(node.getAutofillId())) {
foundNodes[index] = node;
if (mViewNodeLookupTable == null) {

View File

@@ -350,6 +350,10 @@ public final class AutofillClientController implements AutofillManager.AutofillC
final boolean[] visible = new boolean[autofillIdCount];
for (int i = 0; i < autofillIdCount; i++) {
final AutofillId autofillId = autofillIds[i];
if (autofillId == null) {
visible[i] = false;
continue;
}
final View view = autofillClientFindViewByAutofillIdTraversal(autofillId);
if (view != null) {
if (!autofillId.isVirtualInt()) {
@@ -383,6 +387,7 @@ public final class AutofillClientController implements AutofillManager.AutofillC
@Override
public View autofillClientFindViewByAutofillIdTraversal(AutofillId autofillId) {
if (autofillId == null) return null;
final ArrayList<ViewRootImpl> roots =
WindowManagerGlobal.getInstance().getRootViews(mActivity.getActivityToken());
for (int rootNum = 0; rootNum < roots.size(); rootNum++) {
@@ -410,7 +415,7 @@ public final class AutofillClientController implements AutofillManager.AutofillC
if (rootView != null) {
final int viewCount = autofillIds.length;
for (int viewNum = 0; viewNum < viewCount; viewNum++) {
if (views[viewNum] == null) {
if (autofillIds[viewNum] != null && views[viewNum] == null) {
views[viewNum] = rootView.findViewByAutofillIdTraversal(
autofillIds[viewNum].getViewId());
}

View File

@@ -1176,7 +1176,8 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
// structure is taken. This causes only one fill request per burst of focus changes.
cancelCurrentRequestLocked();
if (mClassificationState.mHintsToAutofillIdMap == null) {
if (mService.getMaster().isPccClassificationEnabled()
&& mClassificationState.mHintsToAutofillIdMap == null) {
if (sVerbose) {
Slog.v(TAG, "triggering field classification");
}