summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/view/autofill/AutofillFeatureFlags.java32
-rw-r--r--services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java12
-rw-r--r--services/autofill/java/com/android/server/autofill/Session.java29
3 files changed, 65 insertions, 8 deletions
diff --git a/core/java/android/view/autofill/AutofillFeatureFlags.java b/core/java/android/view/autofill/AutofillFeatureFlags.java
index 206e47f13890..0814e23eea87 100644
--- a/core/java/android/view/autofill/AutofillFeatureFlags.java
+++ b/core/java/android/view/autofill/AutofillFeatureFlags.java
@@ -21,6 +21,7 @@ import static android.service.autofill.Flags.improveFillDialogAconfig;
import android.annotation.SuppressLint;
import android.annotation.TestApi;
import android.provider.DeviceConfig;
+import android.service.autofill.Flags;
import android.text.TextUtils;
import android.util.ArraySet;
import android.view.View;
@@ -348,6 +349,14 @@ public class AutofillFeatureFlags {
// END AUTOFILL REMOVE PRE_TRIGGER FLAGS
/**
+ * Whether per Session FillEventHistory is enabled.
+ *
+ * @hide
+ */
+ public static final String DEVICE_CONFIG_SESSION_FILL_EVENT_HISTORY =
+ "session_fill_event_history";
+
+ /**
* Define the max input length for autofill to show suggesiton UI
*
* E.g. if flag is set to 3, autofill will only show suggestions when user inputs less than 3
@@ -409,6 +418,13 @@ public class AutofillFeatureFlags {
// END AUTOFILL REMOVE PRE_TRIGGER FLAGS DEFAULTS
/**
+ * Default for whether per Session FillEventHistory is enabled
+ *
+ * @hide
+ */
+ public static final boolean DEFAULT_SESSION_FILL_EVENT_HISTORY_ENABLED = false;
+
+ /**
* @hide
*/
public static final int DEFAULT_MAX_INPUT_LENGTH_FOR_AUTOFILL = 3;
@@ -697,4 +713,20 @@ public class AutofillFeatureFlags {
DEVICE_CONFIG_FILL_DIALOG_MIN_WAIT_AFTER_IME_ANIMATION_END_MS,
DEFAULT_FILL_DIALOG_MIN_WAIT_AFTER_IME_ANIMATION_END_MS);
}
+
+ /**
+ * Whether tracking FillEventHistory per Session is enabled
+ *
+ * @hide
+ */
+ public static boolean isMultipleFillEventHistoryEnabled() {
+ if (!Flags.multipleFillHistory()) {
+ return false;
+ }
+
+ return DeviceConfig.getBoolean(
+ DeviceConfig.NAMESPACE_AUTOFILL,
+ DEVICE_CONFIG_SESSION_FILL_EVENT_HISTORY,
+ DEFAULT_SESSION_FILL_EVENT_HISTORY_ENABLED);
+ }
}
diff --git a/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java b/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java
index 11710c9d8a9b..b39b5b1a7660 100644
--- a/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java
+++ b/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java
@@ -73,6 +73,7 @@ import android.util.LocalLog;
import android.util.Pair;
import android.util.Slog;
import android.util.SparseArray;
+import android.view.autofill.AutofillFeatureFlags;
import android.view.autofill.AutofillId;
import android.view.autofill.AutofillManager;
import android.view.autofill.AutofillManager.AutofillCommitReason;
@@ -672,7 +673,7 @@ final class AutofillManagerServiceImpl
flags, mInputMethodManagerInternal, isPrimaryCredential);
mSessions.put(newSession.id, newSession);
- if (Flags.multipleFillHistory() && !forAugmentedAutofillOnly) {
+ if (AutofillFeatureFlags.isMultipleFillEventHistoryEnabled() && !forAugmentedAutofillOnly) {
mFillHistories.put(newSession.id, new FillEventHistory(sessionId, null));
}
@@ -772,7 +773,8 @@ final class AutofillManagerServiceImpl
FillEventHistory history = null;
- if (Flags.multipleFillHistory() && mFillHistories != null) {
+ if (AutofillFeatureFlags.isMultipleFillEventHistoryEnabled()
+ && mFillHistories != null) {
history = mFillHistories.get(sessionId);
mFillHistories.delete(sessionId);
}
@@ -922,7 +924,7 @@ final class AutofillManagerServiceImpl
}
}
mSessions.clear();
- if (Flags.multipleFillHistory()) {
+ if (AutofillFeatureFlags.isMultipleFillEventHistoryEnabled()) {
mFillHistories.clear();
}
@@ -991,7 +993,7 @@ final class AutofillManagerServiceImpl
mEventHistory.addEvent(event);
}
- if (Flags.multipleFillHistory()) {
+ if (AutofillFeatureFlags.isMultipleFillEventHistoryEnabled()) {
FillEventHistory history = mFillHistories.get(sessionId);
if (history != null) {
history.addEvent(event);
@@ -1180,7 +1182,7 @@ final class AutofillManagerServiceImpl
logViewEnteredForHistory(sessionId, clientState, mEventHistory, focusedId);
}
- if (Flags.multipleFillHistory()) {
+ if (AutofillFeatureFlags.isMultipleFillEventHistoryEnabled()) {
FillEventHistory history = mFillHistories.get(sessionId);
if (history != null) {
logViewEnteredForHistory(sessionId, clientState, history, focusedId);
diff --git a/services/autofill/java/com/android/server/autofill/Session.java b/services/autofill/java/com/android/server/autofill/Session.java
index 3ecff3b3ebae..6fdb2b6b83f7 100644
--- a/services/autofill/java/com/android/server/autofill/Session.java
+++ b/services/autofill/java/com/android/server/autofill/Session.java
@@ -442,6 +442,9 @@ final class Session
private Bundle mClientState;
@GuardedBy("mLock")
+ private Bundle mClientStateForSecondary;
+
+ @GuardedBy("mLock")
boolean mDestroyed;
/**
@@ -980,13 +983,19 @@ final class Session
mergePreviousSessionLocked(/* forSave= */ false);
final List<String> hints = getTypeHintsForProvider();
+ Bundle sendBackClientState = mClientState;
+ if (Flags.multipleFillHistory()
+ && mRequestId.isSecondaryProvider(requestId)) {
+ sendBackClientState = mClientStateForSecondary;
+ }
+
mDelayedFillPendingIntent = createPendingIntent(requestId);
request =
new FillRequest(
requestId,
contexts,
hints,
- mClientState,
+ sendBackClientState,
flags,
/* inlineSuggestionsRequest= */ null,
/* delayedFillIntentSender= */ mDelayedFillPendingIntent == null
@@ -3317,7 +3326,7 @@ final class Session
AUTHENTICATION_RESULT_SUCCESS);
if (newClientState != null) {
if (sDebug) Slog.d(TAG, "Updating client state from auth dataset");
- mClientState = newClientState;
+ setClientState(newClientState, requestId);
}
Dataset datasetFromResult = getEffectiveDatasetForAuthentication((Dataset) result);
final Dataset oldDataset = authenticatedResponse.getDatasets().get(datasetIdx);
@@ -6700,6 +6709,18 @@ final class Session
}
@GuardedBy("mLock")
+ private void setClientState(@Nullable Bundle newClientState, int requestId) {
+ if (Flags.multipleFillHistory()
+ && mRequestId.isSecondaryProvider(requestId)) {
+ // Set the secondary clientstate
+ mClientStateForSecondary = newClientState;
+ } else {
+ // The old way - only set the primary provider clientstate
+ mClientState = newClientState;
+ }
+ }
+
+ @GuardedBy("mLock")
private void processResponseLocked(
@NonNull FillResponse newResponse, @Nullable Bundle newClientState, int flags) {
// Make sure we are hiding the UI which will be shown
@@ -6734,7 +6755,9 @@ final class Session
mResponses = new SparseArray<>(2);
}
mResponses.put(requestId, newResponse);
- mClientState = newClientState != null ? newClientState : newResponse.getClientState();
+
+ setClientState(newClientState != null ? newClientState : newResponse.getClientState(),
+ requestId);
boolean webviewRequestedCredman =
newClientState != null