Merge "Fix a bug to not complete the augmented autofill request when fill window is shown" into rvc-dev am: 79f38179de am: 9d098aaaf1
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11876607 Change-Id: Ib694a6a30affc429ffc01d8f3659ecb9592379ef
This commit is contained in:
@@ -564,9 +564,9 @@ public abstract class AugmentedAutofillService extends Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void reportResult(@Nullable List<Dataset> inlineSuggestionsData,
|
void reportResult(@Nullable List<Dataset> inlineSuggestionsData,
|
||||||
@Nullable Bundle clientState) {
|
@Nullable Bundle clientState, boolean showingFillWindow) {
|
||||||
try {
|
try {
|
||||||
mCallback.onSuccess(inlineSuggestionsData, clientState);
|
mCallback.onSuccess(inlineSuggestionsData, clientState, showingFillWindow);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Log.e(TAG, "Error calling back with the inline suggestions data: " + e);
|
Log.e(TAG, "Error calling back with the inline suggestions data: " + e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,23 +56,24 @@ public final class FillCallback {
|
|||||||
|
|
||||||
if (response == null) {
|
if (response == null) {
|
||||||
mProxy.logEvent(AutofillProxy.REPORT_EVENT_NO_RESPONSE);
|
mProxy.logEvent(AutofillProxy.REPORT_EVENT_NO_RESPONSE);
|
||||||
mProxy.reportResult(/* inlineSuggestionsData */ null, /* clientState */ null);
|
mProxy.reportResult(/* inlineSuggestionsData */ null, /* clientState */
|
||||||
|
null, /* showingFillWindow */ false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Dataset> inlineSuggestions = response.getInlineSuggestions();
|
final List<Dataset> inlineSuggestions = response.getInlineSuggestions();
|
||||||
Bundle clientState = response.getClientState();
|
final Bundle clientState = response.getClientState();
|
||||||
// We need to report result regardless of whether inline suggestions are returned or not.
|
final FillWindow fillWindow = response.getFillWindow();
|
||||||
mProxy.reportResult(inlineSuggestions, clientState);
|
boolean showingFillWindow = false;
|
||||||
if (inlineSuggestions != null && !inlineSuggestions.isEmpty()) {
|
if (inlineSuggestions != null && !inlineSuggestions.isEmpty()) {
|
||||||
mProxy.logEvent(AutofillProxy.REPORT_EVENT_INLINE_RESPONSE);
|
mProxy.logEvent(AutofillProxy.REPORT_EVENT_INLINE_RESPONSE);
|
||||||
return;
|
} else if (fillWindow != null) {
|
||||||
}
|
|
||||||
|
|
||||||
final FillWindow fillWindow = response.getFillWindow();
|
|
||||||
if (fillWindow != null) {
|
|
||||||
fillWindow.show();
|
fillWindow.show();
|
||||||
|
showingFillWindow = true;
|
||||||
}
|
}
|
||||||
|
// We need to report result regardless of whether inline suggestions are returned or not.
|
||||||
|
mProxy.reportResult(inlineSuggestions, clientState, showingFillWindow);
|
||||||
|
|
||||||
// TODO(b/123099468): must notify the server so it can update the session state to avoid
|
// TODO(b/123099468): must notify the server so it can update the session state to avoid
|
||||||
// showing conflicting UIs (for example, if a new request is made to the main autofill
|
// showing conflicting UIs (for example, if a new request is made to the main autofill
|
||||||
// service and it now wants to show something).
|
// service and it now wants to show something).
|
||||||
|
|||||||
@@ -30,7 +30,9 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
interface IFillCallback {
|
interface IFillCallback {
|
||||||
void onCancellable(in ICancellationSignal cancellation);
|
void onCancellable(in ICancellationSignal cancellation);
|
||||||
void onSuccess(in @nullable List<Dataset> inlineSuggestionsData, in @nullable Bundle clientState);
|
void onSuccess(in @nullable List<Dataset> inlineSuggestionsData,
|
||||||
|
in @nullable Bundle clientState,
|
||||||
|
boolean showingFillWindow);
|
||||||
boolean isCompleted();
|
boolean isCompleted();
|
||||||
void cancel();
|
void cancel();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -167,14 +167,16 @@ final class RemoteAugmentedAutofillService
|
|||||||
new IFillCallback.Stub() {
|
new IFillCallback.Stub() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(@Nullable List<Dataset> inlineSuggestionsData,
|
public void onSuccess(@Nullable List<Dataset> inlineSuggestionsData,
|
||||||
@Nullable Bundle clientState) {
|
@Nullable Bundle clientState, boolean showingFillWindow) {
|
||||||
mCallbacks.resetLastResponse();
|
mCallbacks.resetLastResponse();
|
||||||
maybeRequestShowInlineSuggestions(sessionId,
|
maybeRequestShowInlineSuggestions(sessionId,
|
||||||
inlineSuggestionsRequest, inlineSuggestionsData,
|
inlineSuggestionsRequest, inlineSuggestionsData,
|
||||||
clientState, focusedId, focusedValue,
|
clientState, focusedId, focusedValue,
|
||||||
inlineSuggestionsCallback,
|
inlineSuggestionsCallback,
|
||||||
client, onErrorCallback, remoteRenderService);
|
client, onErrorCallback, remoteRenderService);
|
||||||
requestAutofill.complete(null);
|
if (!showingFillWindow) {
|
||||||
|
requestAutofill.complete(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user