Merge "Allow disojoint datasets for inline suggestions." into rvc-dev am: 28a5ed1cfb
Change-Id: I689bef340b151837b66e19fd56046e771f6e53ea
This commit is contained in:
@@ -47,6 +47,7 @@ import android.view.autofill.AutofillManager;
|
|||||||
import android.view.autofill.AutofillValue;
|
import android.view.autofill.AutofillValue;
|
||||||
import android.view.autofill.IAutoFillManagerClient;
|
import android.view.autofill.IAutoFillManagerClient;
|
||||||
import android.view.inputmethod.InlineSuggestionsRequest;
|
import android.view.inputmethod.InlineSuggestionsRequest;
|
||||||
|
import android.view.inputmethod.InlineSuggestionsResponse;
|
||||||
|
|
||||||
import com.android.internal.infra.AbstractRemoteService;
|
import com.android.internal.infra.AbstractRemoteService;
|
||||||
import com.android.internal.infra.AndroidFuture;
|
import com.android.internal.infra.AndroidFuture;
|
||||||
@@ -243,20 +244,27 @@ final class RemoteAugmentedAutofillService
|
|||||||
}
|
}
|
||||||
mCallbacks.setLastResponse(sessionId);
|
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 {
|
try {
|
||||||
inlineSuggestionsCallback.onInlineSuggestionsResponse(
|
inlineSuggestionsCallback.onInlineSuggestionsResponse(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));
|
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Slog.w(TAG, "Exception sending inline suggestions response back to IME.");
|
Slog.w(TAG, "Exception sending inline suggestions response back to IME.");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2686,6 +2686,12 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
|
|||||||
requestHideFillUi(mCurrentViewId);
|
requestHideFillUi(mCurrentViewId);
|
||||||
}
|
}
|
||||||
}, mService.getRemoteInlineSuggestionRenderServiceLocked());
|
}, mService.getRemoteInlineSuggestionRenderServiceLocked());
|
||||||
|
|
||||||
|
if (inlineSuggestionsResponse == null) {
|
||||||
|
Slog.w(TAG, "InlineSuggestionFactory created null response");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
imeResponse.getCallback().onInlineSuggestionsResponse(inlineSuggestionsResponse);
|
imeResponse.getCallback().onInlineSuggestionsResponse(inlineSuggestionsResponse);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
|
|||||||
@@ -150,13 +150,13 @@ public final class InlineSuggestionFactory {
|
|||||||
final int fieldIndex = dataset.getFieldIds().indexOf(autofillId);
|
final int fieldIndex = dataset.getFieldIds().indexOf(autofillId);
|
||||||
if (fieldIndex < 0) {
|
if (fieldIndex < 0) {
|
||||||
Slog.w(TAG, "AutofillId=" + autofillId + " not found in dataset");
|
Slog.w(TAG, "AutofillId=" + autofillId + " not found in dataset");
|
||||||
return null;
|
continue;
|
||||||
}
|
}
|
||||||
final InlinePresentation inlinePresentation = dataset.getFieldInlinePresentation(
|
final InlinePresentation inlinePresentation = dataset.getFieldInlinePresentation(
|
||||||
fieldIndex);
|
fieldIndex);
|
||||||
if (inlinePresentation == null) {
|
if (inlinePresentation == null) {
|
||||||
Slog.w(TAG, "InlinePresentation not found in dataset");
|
Slog.w(TAG, "InlinePresentation not found in dataset");
|
||||||
return null;
|
continue;
|
||||||
}
|
}
|
||||||
if (!includeDataset(dataset, fieldIndex, filterText)) {
|
if (!includeDataset(dataset, fieldIndex, filterText)) {
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user