summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2020-02-27 10:15:08 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2020-02-27 10:15:08 +0000
commit28a5ed1cfb186a29b10912edeee17cbdfb1ae723 (patch)
treeb2b6f36a43f87f131d695b2415b83a98aa578d3b
parent8f24e997547fae24f8c4ad3d1155810d0acf7b0e (diff)
parent2106506181d403bda139c473c812f9836fe0ce53 (diff)
Merge "Allow disojoint datasets for inline suggestions." into rvc-dev
-rw-r--r--services/autofill/java/com/android/server/autofill/RemoteAugmentedAutofillService.java34
-rw-r--r--services/autofill/java/com/android/server/autofill/Session.java6
-rw-r--r--services/autofill/java/com/android/server/autofill/ui/InlineSuggestionFactory.java4
3 files changed, 29 insertions, 15 deletions
diff --git a/services/autofill/java/com/android/server/autofill/RemoteAugmentedAutofillService.java b/services/autofill/java/com/android/server/autofill/RemoteAugmentedAutofillService.java
index 1eb769216e63..228c6286a0f0 100644
--- a/services/autofill/java/com/android/server/autofill/RemoteAugmentedAutofillService.java
+++ b/services/autofill/java/com/android/server/autofill/RemoteAugmentedAutofillService.java
@@ -47,6 +47,7 @@ import android.view.autofill.AutofillManager;
import android.view.autofill.AutofillValue;
import android.view.autofill.IAutoFillManagerClient;
import android.view.inputmethod.InlineSuggestionsRequest;
+import android.view.inputmethod.InlineSuggestionsResponse;
import com.android.internal.infra.AbstractRemoteService;
import com.android.internal.infra.AndroidFuture;
@@ -243,20 +244,27 @@ final class RemoteAugmentedAutofillService
}
mCallbacks.setLastResponse(sessionId);
+ final InlineSuggestionsResponse inlineSuggestionsResponse =
+ InlineSuggestionFactory.createAugmentedInlineSuggestionsResponse(
+ request, inlineSuggestionsData, focusedId, mContext,
+ dataset -> {
+ mCallbacks.logAugmentedAutofillSelected(sessionId,
+ dataset.getId());
+ try {
+ client.autofill(sessionId, dataset.getFieldIds(),
+ dataset.getFieldValues());
+ } catch (RemoteException e) {
+ Slog.w(TAG, "Encounter exception autofilling the values");
+ }
+ }, onErrorCallback, remoteRenderService);
+
+ if (inlineSuggestionsResponse == null) {
+ Slog.w(TAG, "InlineSuggestionFactory created null response");
+ return;
+ }
+
try {
- inlineSuggestionsCallback.onInlineSuggestionsResponse(
- InlineSuggestionFactory.createAugmentedInlineSuggestionsResponse(
- request, inlineSuggestionsData, focusedId, mContext,
- dataset -> {
- mCallbacks.logAugmentedAutofillSelected(sessionId,
- dataset.getId());
- try {
- client.autofill(sessionId, dataset.getFieldIds(),
- dataset.getFieldValues());
- } catch (RemoteException e) {
- Slog.w(TAG, "Encounter exception autofilling the values");
- }
- }, onErrorCallback, remoteRenderService));
+ inlineSuggestionsCallback.onInlineSuggestionsResponse(inlineSuggestionsResponse);
} catch (RemoteException e) {
Slog.w(TAG, "Exception sending inline suggestions response back to IME.");
}
diff --git a/services/autofill/java/com/android/server/autofill/Session.java b/services/autofill/java/com/android/server/autofill/Session.java
index 317ce4cb5fee..960997dd7df8 100644
--- a/services/autofill/java/com/android/server/autofill/Session.java
+++ b/services/autofill/java/com/android/server/autofill/Session.java
@@ -2686,6 +2686,12 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
requestHideFillUi(mCurrentViewId);
}
}, mService.getRemoteInlineSuggestionRenderServiceLocked());
+
+ if (inlineSuggestionsResponse == null) {
+ Slog.w(TAG, "InlineSuggestionFactory created null response");
+ return false;
+ }
+
try {
imeResponse.getCallback().onInlineSuggestionsResponse(inlineSuggestionsResponse);
} catch (RemoteException e) {
diff --git a/services/autofill/java/com/android/server/autofill/ui/InlineSuggestionFactory.java b/services/autofill/java/com/android/server/autofill/ui/InlineSuggestionFactory.java
index b8051ddf9466..0d1b6ddd2933 100644
--- a/services/autofill/java/com/android/server/autofill/ui/InlineSuggestionFactory.java
+++ b/services/autofill/java/com/android/server/autofill/ui/InlineSuggestionFactory.java
@@ -150,13 +150,13 @@ public final class InlineSuggestionFactory {
final int fieldIndex = dataset.getFieldIds().indexOf(autofillId);
if (fieldIndex < 0) {
Slog.w(TAG, "AutofillId=" + autofillId + " not found in dataset");
- return null;
+ continue;
}
final InlinePresentation inlinePresentation = dataset.getFieldInlinePresentation(
fieldIndex);
if (inlinePresentation == null) {
Slog.w(TAG, "InlinePresentation not found in dataset");
- return null;
+ continue;
}
if (!includeDataset(dataset, fieldIndex, filterText)) {
continue;