summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Simranjit Kohli <simranjit@google.com> 2023-03-30 17:08:35 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2023-03-30 17:08:35 +0000
commit646c4e0fe89b6ae54965b912c3b44fd740f7f32c (patch)
tree4c4babf534606618feab59c5d0e90609b8b53449
parentd013b0b2cf93d80ffe71b3d6c078b2c2700f2793 (diff)
parent5b3f1f5487cfa25ff730d6f31a6096ec230f17b0 (diff)
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
-rw-r--r--core/java/android/service/autofill/FillContext.java2
-rw-r--r--core/java/android/view/autofill/AutofillClientController.java7
-rw-r--r--services/autofill/java/com/android/server/autofill/Session.java3
3 files changed, 9 insertions, 3 deletions
diff --git a/core/java/android/service/autofill/FillContext.java b/core/java/android/service/autofill/FillContext.java
index cc1b6cda82bb..e36d899e02ee 100644
--- a/core/java/android/service/autofill/FillContext.java
+++ b/core/java/android/service/autofill/FillContext.java
@@ -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) {
diff --git a/core/java/android/view/autofill/AutofillClientController.java b/core/java/android/view/autofill/AutofillClientController.java
index 93d98ac51c3b..3a8e8027b88e 100644
--- a/core/java/android/view/autofill/AutofillClientController.java
+++ b/core/java/android/view/autofill/AutofillClientController.java
@@ -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());
}
diff --git a/services/autofill/java/com/android/server/autofill/Session.java b/services/autofill/java/com/android/server/autofill/Session.java
index 4af6b89eb939..46fc7628aae4 100644
--- a/services/autofill/java/com/android/server/autofill/Session.java
+++ b/services/autofill/java/com/android/server/autofill/Session.java
@@ -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");
}