Enable IME to control the source of suggestions
Allow IME to control the applications and AutofillService to display inline suggestions in the inline strip. Bug: 184731683 Test: atest CtsAutoFillServiceTestCases Change-Id: Ifa99e51d93e844f5c28861e4466c2433f92d7881
This commit is contained in:
@@ -450,7 +450,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
|
||||
return;
|
||||
}
|
||||
mPendingInlineSuggestionsRequest = inlineSuggestionsRequest;
|
||||
maybeRequestFillLocked();
|
||||
maybeRequestFillFromServiceLocked();
|
||||
viewState.resetState(ViewState.STATE_PENDING_CREATE_INLINE_REQUEST);
|
||||
}
|
||||
} : null;
|
||||
@@ -462,7 +462,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
|
||||
mPendingInlineSuggestionsRequest = inlineRequest;
|
||||
}
|
||||
|
||||
void maybeRequestFillLocked() {
|
||||
void maybeRequestFillFromServiceLocked() {
|
||||
if (mPendingFillRequest == null) {
|
||||
return;
|
||||
}
|
||||
@@ -472,9 +472,12 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
|
||||
return;
|
||||
}
|
||||
|
||||
mPendingFillRequest = new FillRequest(mPendingFillRequest.getId(),
|
||||
mPendingFillRequest.getFillContexts(), mPendingFillRequest.getClientState(),
|
||||
mPendingFillRequest.getFlags(), mPendingInlineSuggestionsRequest);
|
||||
if (mPendingInlineSuggestionsRequest.isServiceSupported()) {
|
||||
mPendingFillRequest = new FillRequest(mPendingFillRequest.getId(),
|
||||
mPendingFillRequest.getFillContexts(),
|
||||
mPendingFillRequest.getClientState(),
|
||||
mPendingFillRequest.getFlags(), mPendingInlineSuggestionsRequest);
|
||||
}
|
||||
}
|
||||
|
||||
mRemoteFillService.onFillRequest(mPendingFillRequest);
|
||||
@@ -581,7 +584,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
|
||||
/*inlineSuggestionsRequest=*/null);
|
||||
|
||||
mPendingFillRequest = request;
|
||||
maybeRequestFillLocked();
|
||||
maybeRequestFillFromServiceLocked();
|
||||
}
|
||||
|
||||
if (mActivityToken != null) {
|
||||
@@ -3186,6 +3189,17 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
|
||||
return false;
|
||||
}
|
||||
|
||||
final InlineSuggestionsRequest request = inlineSuggestionsRequest.get();
|
||||
if (mSessionFlags.mClientSuggestionsEnabled && !request.isClientSupported()
|
||||
|| !mSessionFlags.mClientSuggestionsEnabled && !request.isServiceSupported()) {
|
||||
if (sDebug) {
|
||||
Slog.d(TAG, "Inline suggestions not supported for "
|
||||
+ (mSessionFlags.mClientSuggestionsEnabled ? "client" : "service")
|
||||
+ ". Falling back to dropdown.");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
final RemoteInlineSuggestionRenderService remoteRenderService =
|
||||
mService.getRemoteInlineSuggestionRenderServiceLocked();
|
||||
if (remoteRenderService == null) {
|
||||
@@ -3194,7 +3208,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
|
||||
}
|
||||
|
||||
final InlineFillUi.InlineFillUiInfo inlineFillUiInfo =
|
||||
new InlineFillUi.InlineFillUiInfo(inlineSuggestionsRequest.get(), focusedId,
|
||||
new InlineFillUi.InlineFillUiInfo(request, focusedId,
|
||||
filterText, remoteRenderService, userId, id);
|
||||
InlineFillUi inlineFillUi = InlineFillUi.forAutofill(inlineFillUiInfo, response,
|
||||
new InlineFillUi.InlineSuggestionUiCallback() {
|
||||
@@ -3807,6 +3821,10 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
|
||||
mContexts = new ArrayList<>(1);
|
||||
}
|
||||
|
||||
if (inlineSuggestionsRequest != null && !inlineSuggestionsRequest.isClientSupported()) {
|
||||
inlineSuggestionsRequest = null;
|
||||
}
|
||||
|
||||
mClientSuggestionsSession.onFillRequest(requestId, inlineSuggestionsRequest, mFlags);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user