Merge "Fix input method switch handling in autofill" into rvc-dev am: e710511e85 am: 5570212564
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11855410 Change-Id: If415510a2b499ebb3b15fa6f7bf248b30df98c2f
This commit is contained in:
@@ -313,18 +313,28 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
|
|||||||
private final AssistDataReceiverImpl mAssistReceiver = new AssistDataReceiverImpl();
|
private final AssistDataReceiverImpl mAssistReceiver = new AssistDataReceiverImpl();
|
||||||
|
|
||||||
void onSwitchInputMethodLocked() {
|
void onSwitchInputMethodLocked() {
|
||||||
|
// One caveat is that for the case where the focus is on a field for which regular autofill
|
||||||
|
// returns null, and augmented autofill is triggered, and then the user switches the input
|
||||||
|
// method. Tapping on the field again will not trigger a new augmented autofill request.
|
||||||
|
// This may be fixed by adding more checks such as whether mCurrentViewId is null.
|
||||||
if (mExpiredResponse) {
|
if (mExpiredResponse) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (shouldResetSessionStateOnInputMethodSwitch()) {
|
||||||
if (shouldExpireResponseOnInputMethodSwitch()) {
|
|
||||||
// Set the old response expired, so the next action (ACTION_VIEW_ENTERED) can trigger
|
// Set the old response expired, so the next action (ACTION_VIEW_ENTERED) can trigger
|
||||||
// a new fill request.
|
// a new fill request.
|
||||||
mExpiredResponse = true;
|
mExpiredResponse = true;
|
||||||
|
// Clear the augmented autofillable ids so augmented autofill will trigger again.
|
||||||
|
mAugmentedAutofillableIds = null;
|
||||||
|
// In case the field is augmented autofill only, we clear the current view id, so that
|
||||||
|
// we won't skip view entered due to same view entered, for the augmented autofill.
|
||||||
|
if (mForAugmentedAutofillOnly) {
|
||||||
|
mCurrentViewId = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean shouldExpireResponseOnInputMethodSwitch() {
|
private boolean shouldResetSessionStateOnInputMethodSwitch() {
|
||||||
// One of below cases will need a new fill request to update the inline spec for the new
|
// One of below cases will need a new fill request to update the inline spec for the new
|
||||||
// input method.
|
// input method.
|
||||||
// 1. The autofill provider supports inline suggestion and the render service is available.
|
// 1. The autofill provider supports inline suggestion and the render service is available.
|
||||||
@@ -2588,15 +2598,14 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
|
|||||||
id)) {
|
id)) {
|
||||||
// Regular autofill handled the view and returned null response, but it
|
// Regular autofill handled the view and returned null response, but it
|
||||||
// triggered augmented autofill
|
// triggered augmented autofill
|
||||||
if (!isSameViewEntered || mExpiredResponse) {
|
if (!isSameViewEntered) {
|
||||||
if (sDebug) Slog.d(TAG, "trigger augmented autofill.");
|
if (sDebug) Slog.d(TAG, "trigger augmented autofill.");
|
||||||
triggerAugmentedAutofillLocked(flags);
|
triggerAugmentedAutofillLocked(flags);
|
||||||
} else {
|
} else {
|
||||||
if (sDebug) Slog.d(TAG, "skip augmented autofill for same view.");
|
if (sDebug) Slog.d(TAG, "skip augmented autofill for same view.");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
} else if (mForAugmentedAutofillOnly && isSameViewEntered
|
} else if (mForAugmentedAutofillOnly && isSameViewEntered) {
|
||||||
&& !mExpiredResponse) {
|
|
||||||
// Regular autofill is disabled.
|
// Regular autofill is disabled.
|
||||||
if (sDebug) Slog.d(TAG, "skip augmented autofill for same view.");
|
if (sDebug) Slog.d(TAG, "skip augmented autofill for same view.");
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user