Loading core/java/android/view/autofill/AutofillFeatureFlags.java +32 −0 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -347,6 +348,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 * Loading Loading @@ -408,6 +417,13 @@ public class AutofillFeatureFlags { public static final long DEFAULT_FILL_DIALOG_MIN_WAIT_AFTER_IME_ANIMATION_END_MS = 0; // 0 ms // 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 */ Loading Loading @@ -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); } } services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java +7 −5 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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)); } Loading Loading @@ -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); } Loading Loading @@ -922,7 +924,7 @@ final class AutofillManagerServiceImpl } } mSessions.clear(); if (Flags.multipleFillHistory()) { if (AutofillFeatureFlags.isMultipleFillEventHistoryEnabled()) { mFillHistories.clear(); } Loading Loading @@ -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); Loading Loading @@ -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); Loading services/autofill/java/com/android/server/autofill/Session.java +26 −3 Original line number Diff line number Diff line Loading @@ -441,6 +441,9 @@ final class Session @GuardedBy("mLock") private Bundle mClientState; @GuardedBy("mLock") private Bundle mClientStateForSecondary; @GuardedBy("mLock") boolean mDestroyed; Loading Loading @@ -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 Loading Loading @@ -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); Loading Loading @@ -6699,6 +6708,18 @@ final class Session remoteService.onDestroyAutofillWindowsRequest(); } @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) { Loading Loading @@ -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 Loading Loading
core/java/android/view/autofill/AutofillFeatureFlags.java +32 −0 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -347,6 +348,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 * Loading Loading @@ -408,6 +417,13 @@ public class AutofillFeatureFlags { public static final long DEFAULT_FILL_DIALOG_MIN_WAIT_AFTER_IME_ANIMATION_END_MS = 0; // 0 ms // 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 */ Loading Loading @@ -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); } }
services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java +7 −5 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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)); } Loading Loading @@ -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); } Loading Loading @@ -922,7 +924,7 @@ final class AutofillManagerServiceImpl } } mSessions.clear(); if (Flags.multipleFillHistory()) { if (AutofillFeatureFlags.isMultipleFillEventHistoryEnabled()) { mFillHistories.clear(); } Loading Loading @@ -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); Loading Loading @@ -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); Loading
services/autofill/java/com/android/server/autofill/Session.java +26 −3 Original line number Diff line number Diff line Loading @@ -441,6 +441,9 @@ final class Session @GuardedBy("mLock") private Bundle mClientState; @GuardedBy("mLock") private Bundle mClientStateForSecondary; @GuardedBy("mLock") boolean mDestroyed; Loading Loading @@ -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 Loading Loading @@ -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); Loading Loading @@ -6699,6 +6708,18 @@ final class Session remoteService.onDestroyAutofillWindowsRequest(); } @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) { Loading Loading @@ -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 Loading