Merge "Add isInline info to augmented autofill request log" into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
7b8c8b72b3
@@ -117,6 +117,7 @@ import java.util.Optional;
|
|||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A session for a given activity.
|
* A session for a given activity.
|
||||||
@@ -3079,19 +3080,13 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
|
|||||||
final boolean isWhitelisted = mService
|
final boolean isWhitelisted = mService
|
||||||
.isWhitelistedForAugmentedAutofillLocked(mComponentName);
|
.isWhitelistedForAugmentedAutofillLocked(mComponentName);
|
||||||
|
|
||||||
final String historyItem =
|
|
||||||
"aug:id=" + id + " u=" + uid + " m=" + mode
|
|
||||||
+ " a=" + ComponentName.flattenToShortString(mComponentName)
|
|
||||||
+ " f=" + mCurrentViewId
|
|
||||||
+ " s=" + remoteService.getComponentName()
|
|
||||||
+ " w=" + isWhitelisted;
|
|
||||||
mService.getMaster().logRequestLocked(historyItem);
|
|
||||||
|
|
||||||
if (!isWhitelisted) {
|
if (!isWhitelisted) {
|
||||||
if (sVerbose) {
|
if (sVerbose) {
|
||||||
Slog.v(TAG, "triggerAugmentedAutofillLocked(): "
|
Slog.v(TAG, "triggerAugmentedAutofillLocked(): "
|
||||||
+ ComponentName.flattenToShortString(mComponentName) + " not whitelisted ");
|
+ ComponentName.flattenToShortString(mComponentName) + " not whitelisted ");
|
||||||
}
|
}
|
||||||
|
logAugmentedAutofillRequestLocked(mode, remoteService.getComponentName(),
|
||||||
|
mCurrentViewId, isWhitelisted, /*isInline*/null);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3116,24 +3111,27 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
|
|||||||
|
|
||||||
final AutofillId focusedId = mCurrentViewId;
|
final AutofillId focusedId = mCurrentViewId;
|
||||||
|
|
||||||
|
final Function<InlineSuggestionsResponse, Boolean> inlineSuggestionsResponseCallback =
|
||||||
|
response -> {
|
||||||
|
synchronized (mLock) {
|
||||||
|
return mInlineSessionController.onInlineSuggestionsResponseLocked(
|
||||||
|
focusedId, response);
|
||||||
|
}
|
||||||
|
};
|
||||||
final Consumer<InlineSuggestionsRequest> requestAugmentedAutofill =
|
final Consumer<InlineSuggestionsRequest> requestAugmentedAutofill =
|
||||||
(inlineSuggestionsRequest) -> {
|
(inlineSuggestionsRequest) -> {
|
||||||
remoteService.onRequestAutofillLocked(id, mClient, taskId, mComponentName,
|
synchronized (mLock) {
|
||||||
AutofillId.withoutSession(focusedId),
|
logAugmentedAutofillRequestLocked(mode, remoteService.getComponentName(),
|
||||||
currentValue, inlineSuggestionsRequest,
|
focusedId, isWhitelisted, inlineSuggestionsRequest != null);
|
||||||
/*inlineSuggestionsCallback=*/
|
remoteService.onRequestAutofillLocked(id, mClient, taskId, mComponentName,
|
||||||
response -> {
|
AutofillId.withoutSession(focusedId), currentValue,
|
||||||
synchronized (mLock) {
|
inlineSuggestionsRequest, inlineSuggestionsResponseCallback,
|
||||||
return mInlineSessionController
|
/*onErrorCallback=*/ () -> {
|
||||||
.onInlineSuggestionsResponseLocked(
|
synchronized (mLock) {
|
||||||
focusedId, response);
|
cancelAugmentedAutofillLocked();
|
||||||
}
|
}
|
||||||
},
|
}, mService.getRemoteInlineSuggestionRenderServiceLocked());
|
||||||
/*onErrorCallback=*/ () -> {
|
}
|
||||||
synchronized (mLock) {
|
|
||||||
cancelAugmentedAutofillLocked();
|
|
||||||
}
|
|
||||||
}, mService.getRemoteInlineSuggestionRenderServiceLocked());
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// When the inline suggestion render service is available, there are 2 cases when
|
// When the inline suggestion render service is available, there are 2 cases when
|
||||||
@@ -3150,9 +3148,11 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
|
|||||||
if (sDebug) Slog.d(TAG, "Create inline request for augmented autofill");
|
if (sDebug) Slog.d(TAG, "Create inline request for augmented autofill");
|
||||||
remoteRenderService.getInlineSuggestionsRendererInfo(new RemoteCallback(
|
remoteRenderService.getInlineSuggestionsRendererInfo(new RemoteCallback(
|
||||||
(extras) -> {
|
(extras) -> {
|
||||||
mInlineSessionController.onCreateInlineSuggestionsRequestLocked(
|
synchronized (mLock) {
|
||||||
focusedId, /*requestConsumer=*/ requestAugmentedAutofill,
|
mInlineSessionController.onCreateInlineSuggestionsRequestLocked(
|
||||||
extras);
|
focusedId, /*requestConsumer=*/ requestAugmentedAutofill,
|
||||||
|
extras);
|
||||||
|
}
|
||||||
}, mHandler));
|
}, mHandler));
|
||||||
} else {
|
} else {
|
||||||
requestAugmentedAutofill.accept(
|
requestAugmentedAutofill.accept(
|
||||||
@@ -3164,6 +3164,20 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
|
|||||||
return mAugmentedAutofillDestroyer;
|
return mAugmentedAutofillDestroyer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GuardedBy("mLock")
|
||||||
|
private void logAugmentedAutofillRequestLocked(int mode,
|
||||||
|
ComponentName augmentedRemoteServiceName, AutofillId focusedId, boolean isWhitelisted,
|
||||||
|
Boolean isInline) {
|
||||||
|
final String historyItem =
|
||||||
|
"aug:id=" + id + " u=" + uid + " m=" + mode
|
||||||
|
+ " a=" + ComponentName.flattenToShortString(mComponentName)
|
||||||
|
+ " f=" + focusedId
|
||||||
|
+ " s=" + augmentedRemoteServiceName
|
||||||
|
+ " w=" + isWhitelisted
|
||||||
|
+ " i=" + isInline;
|
||||||
|
mService.getMaster().logRequestLocked(historyItem);
|
||||||
|
}
|
||||||
|
|
||||||
@GuardedBy("mLock")
|
@GuardedBy("mLock")
|
||||||
private void cancelAugmentedAutofillLocked() {
|
private void cancelAugmentedAutofillLocked() {
|
||||||
final RemoteAugmentedAutofillService remoteService = mService
|
final RemoteAugmentedAutofillService remoteService = mService
|
||||||
|
|||||||
Reference in New Issue
Block a user