summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Aaron Li <aarli@google.com> 2023-09-20 14:01:18 -0700
committer Aaron Li <aarli@google.com> 2023-10-10 18:13:22 +0000
commit721668de97aee4ffbaf6ff6aa07cf49b5ed08fe8 (patch)
tree5438c042245a68f7326a5e8e8795565169c97aad
parentb04104d98ddae3b6cccff7646757cae7d910e6da (diff)
Fix for: Generated suggested strong passwords not autofill'd for certain apps.
Context: This bug mainly occurs in multi page auth scenarios such as: Page/Screen 1: username field Page/Screen 2: password + confirm password field For the above: On completion of page 1, the session is committed and a new session is kicked off. However, the new session (for page 2) will now contain the username field from the prev session (merged) along with the two new fields (pw + confirm pw). As a result, a fill req + fill response (triggered by generate strong pw) will now contain (username, pw, confirm pw) in the returned dataset. However, this will fail as (username) is in the returned dataset but it is not part of the current screen. Fix: The fix here is to ignore any fields (in the fillresponse) that don't belong to the current session. The previously submitted gms fix will be reverted (separately) as well to not conflict with this change Test + confirmed that w/ flag (fill_fields_from_current_session_only=True) enabled the issue is no longer observed. Flag: fill_fields_from_current_session_only Bug: 270722825 Bug: 289585475 Test: atest CtsAutoFillServiceTestCases Change-Id: I05b5d841ea99d7738b306ba4acfb577827da71a8
-rw-r--r--services/autofill/bugfixes.aconfig7
-rw-r--r--services/autofill/java/com/android/server/autofill/AutofillManagerService.java14
-rw-r--r--services/autofill/java/com/android/server/autofill/Session.java10
3 files changed, 30 insertions, 1 deletions
diff --git a/services/autofill/bugfixes.aconfig b/services/autofill/bugfixes.aconfig
index 123b65c039ba..b37bbd6ea27f 100644
--- a/services/autofill/bugfixes.aconfig
+++ b/services/autofill/bugfixes.aconfig
@@ -8,6 +8,13 @@ flag {
}
flag {
+ name: "fill_fields_from_current_session_only"
+ namespace: "autofill"
+ description: "Only fill autofill fields that are part of the current session."
+ bug: "270722825"
+}
+
+flag {
name: "relayout"
namespace: "autofill"
description: "Mitigation for relayout issue"
diff --git a/services/autofill/java/com/android/server/autofill/AutofillManagerService.java b/services/autofill/java/com/android/server/autofill/AutofillManagerService.java
index c7b53c55d89b..3e134992c763 100644
--- a/services/autofill/java/com/android/server/autofill/AutofillManagerService.java
+++ b/services/autofill/java/com/android/server/autofill/AutofillManagerService.java
@@ -58,6 +58,7 @@ import android.os.UserManager;
import android.provider.DeviceConfig;
import android.provider.Settings;
import android.service.autofill.FillEventHistory;
+import android.service.autofill.Flags;
import android.service.autofill.UserData;
import android.text.TextUtils;
import android.text.TextUtils.SimpleStringSplitter;
@@ -226,6 +227,9 @@ public final class AutofillManagerService
@GuardedBy("mFlagLock")
private int mMaxInputLengthForAutofill;
+ @GuardedBy("mFlagLock")
+ private boolean mIsFillFieldsFromCurrentSessionOnly;
+
// Default flag values for Autofill PCC
private static final String DEFAULT_PCC_FEATURE_PROVIDER_HINTS = "";
@@ -701,6 +705,7 @@ public final class AutofillManagerService
DeviceConfig.NAMESPACE_AUTOFILL,
AutofillFeatureFlags.DEVICE_CONFIG_MAX_INPUT_LENGTH_FOR_AUTOFILL,
AutofillFeatureFlags.DEFAULT_MAX_INPUT_LENGTH_FOR_AUTOFILL);
+ mIsFillFieldsFromCurrentSessionOnly = Flags.fillFieldsFromCurrentSessionOnly();
if (verbose) {
Slog.v(mTag, "setDeviceConfigProperties() for PCC: "
+ "mPccClassificationEnabled=" + mPccClassificationEnabled
@@ -1004,6 +1009,15 @@ public final class AutofillManagerService
}
}
+ /**
+ * Return if autofill should only fill in fields from current session.
+ */
+ public boolean getIsFillFieldsFromCurrentSessionOnly() {
+ synchronized (mFlagLock) {
+ return mIsFillFieldsFromCurrentSessionOnly;
+ }
+ }
+
@Nullable
@VisibleForTesting
static Map<String, String[]> getAllowedCompatModePackages(String setting) {
diff --git a/services/autofill/java/com/android/server/autofill/Session.java b/services/autofill/java/com/android/server/autofill/Session.java
index 265ed4652bfb..ae1487775b74 100644
--- a/services/autofill/java/com/android/server/autofill/Session.java
+++ b/services/autofill/java/com/android/server/autofill/Session.java
@@ -6142,9 +6142,17 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
continue;
}
final AutofillId viewId = dataset.getFieldIds().get(i);
+ final ViewState viewState = mViewStates.get(viewId);
+ if (mService.getMaster().getIsFillFieldsFromCurrentSessionOnly()
+ && viewState != null && viewState.id.getSessionId() != id) {
+ if (sVerbose) {
+ Slog.v(TAG, "Skipping filling view: " +
+ viewId + " as it isn't part of the current session: " + id);
+ }
+ continue;
+ }
ids.add(viewId);
values.add(dataset.getFieldValues().get(i));
- final ViewState viewState = mViewStates.get(viewId);
if (viewState != null
&& (viewState.getState() & ViewState.STATE_WAITING_DATASET_AUTH) != 0) {
if (sVerbose) {