summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorFeng Cao <fengcao@google.com>2020-02-28 11:36:59 -0800
committerFeng Cao <fengcao@google.com>2020-02-28 17:25:30 -0800
commitec496000ec89664e2eaa6da610fbcd48374dbb62 (patch)
tree710a1e6e7291d59b72ebd98791b9d83fb271d197 /core/java/android
parent8839aaee6d5b5c9c7f19e60aedf11a73b4163269 (diff)
Several improvements and bug fixes to the inline autofill flow
* Pipe the augmented autofill's inline actions through to the InlineSuggestionsResponse * Do not send the inline action if the number of inline suggestions is zero * Refactor autofill inline suggstion session so that all the calls to the IME has happens within the class * Send an empty response to IME to hide the inline suggestion UI when view exits and the previous response wasn't empty Test: manual verification, atest InlineLoginActivityTest Bug: 149522488 Bug: 150312201 Change-Id: I7a0dbf44e9fad6e7da857448c0f2b186e1681d17
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/inputmethodservice/InlineSuggestionSession.java5
-rw-r--r--core/java/android/service/autofill/augmented/AugmentedAutofillService.java9
-rw-r--r--core/java/android/service/autofill/augmented/FillCallback.java4
-rw-r--r--core/java/android/service/autofill/augmented/IFillCallback.aidl6
4 files changed, 14 insertions, 10 deletions
diff --git a/core/java/android/inputmethodservice/InlineSuggestionSession.java b/core/java/android/inputmethodservice/InlineSuggestionSession.java
index edae06a0b9df..1f12d2a6b659 100644
--- a/core/java/android/inputmethodservice/InlineSuggestionSession.java
+++ b/core/java/android/inputmethodservice/InlineSuggestionSession.java
@@ -27,6 +27,7 @@ import android.os.IBinder;
import android.os.Looper;
import android.os.RemoteException;
import android.util.Log;
+import android.view.autofill.AutofillId;
import android.view.inputmethod.InlineSuggestionsRequest;
import android.view.inputmethod.InlineSuggestionsResponse;
@@ -145,8 +146,8 @@ class InlineSuggestionSession {
}
@Override
- public void onInlineSuggestionsResponse(InlineSuggestionsResponse response)
- throws RemoteException {
+ public void onInlineSuggestionsResponse(AutofillId fieldId,
+ InlineSuggestionsResponse response) {
final InlineSuggestionSession session = mInlineSuggestionSession.get();
if (session != null) {
session.mHandler.sendMessage(obtainMessage(
diff --git a/core/java/android/service/autofill/augmented/AugmentedAutofillService.java b/core/java/android/service/autofill/augmented/AugmentedAutofillService.java
index 672b501bbc41..fe792b1efd9f 100644
--- a/core/java/android/service/autofill/augmented/AugmentedAutofillService.java
+++ b/core/java/android/service/autofill/augmented/AugmentedAutofillService.java
@@ -40,6 +40,7 @@ import android.os.RemoteException;
import android.os.SystemClock;
import android.service.autofill.Dataset;
import android.service.autofill.FillEventHistory;
+import android.service.autofill.InlinePresentation;
import android.service.autofill.augmented.PresentationParams.SystemPopupPresentationParams;
import android.util.Log;
import android.util.Pair;
@@ -557,12 +558,10 @@ public abstract class AugmentedAutofillService extends Service {
}
}
- void reportResult(@Nullable List<Dataset> inlineSuggestionsData) {
+ void reportResult(@Nullable List<Dataset> inlineSuggestionsData,
+ @Nullable List<InlinePresentation> inlineActions) {
try {
- final Dataset[] inlineSuggestions = (inlineSuggestionsData != null)
- ? inlineSuggestionsData.toArray(new Dataset[inlineSuggestionsData.size()])
- : null;
- mCallback.onSuccess(inlineSuggestions);
+ mCallback.onSuccess(inlineSuggestionsData, inlineActions);
} catch (RemoteException e) {
Log.e(TAG, "Error calling back with the inline suggestions data: " + e);
}
diff --git a/core/java/android/service/autofill/augmented/FillCallback.java b/core/java/android/service/autofill/augmented/FillCallback.java
index 19eff57269ae..6b4e1185703c 100644
--- a/core/java/android/service/autofill/augmented/FillCallback.java
+++ b/core/java/android/service/autofill/augmented/FillCallback.java
@@ -55,14 +55,14 @@ public final class FillCallback {
if (response == null) {
mProxy.logEvent(AutofillProxy.REPORT_EVENT_NO_RESPONSE);
- mProxy.reportResult(null /*inlineSuggestions*/);
+ mProxy.reportResult(/* inlineSuggestionsData */ null, /* inlineActions */null);
return;
}
List<Dataset> inlineSuggestions = response.getInlineSuggestions();
if (inlineSuggestions != null && !inlineSuggestions.isEmpty()) {
mProxy.logEvent(AutofillProxy.REPORT_EVENT_INLINE_RESPONSE);
- mProxy.reportResult(inlineSuggestions);
+ mProxy.reportResult(inlineSuggestions, response.getInlineActions());
return;
}
diff --git a/core/java/android/service/autofill/augmented/IFillCallback.aidl b/core/java/android/service/autofill/augmented/IFillCallback.aidl
index d9837211be19..bf0adcd54ab1 100644
--- a/core/java/android/service/autofill/augmented/IFillCallback.aidl
+++ b/core/java/android/service/autofill/augmented/IFillCallback.aidl
@@ -20,6 +20,9 @@ import android.os.Bundle;
import android.os.ICancellationSignal;
import android.service.autofill.Dataset;
+import android.service.autofill.InlinePresentation;
+
+import java.util.List;
/**
* Interface to receive the result of an autofill request.
@@ -28,7 +31,8 @@ import android.service.autofill.Dataset;
*/
interface IFillCallback {
void onCancellable(in ICancellationSignal cancellation);
- void onSuccess(in @nullable Dataset[] inlineSuggestionsData);
+ void onSuccess(in @nullable List<Dataset> inlineSuggestionsData,
+ in @nullable List<InlinePresentation> inlineActions);
boolean isCompleted();
void cancel();
}