Merge "Allow AutofillService can identify if fill dialog presentation is needed." into tm-dev
This commit is contained in:
@@ -38251,6 +38251,7 @@ package android.service.autofill {
|
||||
field @NonNull public static final android.os.Parcelable.Creator<android.service.autofill.FillRequest> CREATOR;
|
||||
field public static final int FLAG_COMPATIBILITY_MODE_REQUEST = 2; // 0x2
|
||||
field public static final int FLAG_MANUAL_REQUEST = 1; // 0x1
|
||||
field public static final int FLAG_SUPPORTS_FILL_DIALOG = 64; // 0x40
|
||||
}
|
||||
|
||||
public final class FillResponse implements android.os.Parcelable {
|
||||
|
||||
@@ -100,10 +100,10 @@ public final class FillRequest implements Parcelable {
|
||||
// The flag value 0x20 has been defined in AutofillManager.
|
||||
|
||||
/**
|
||||
* Indicates the request is coming from the activity just started.
|
||||
* @hide
|
||||
* Indicates the request supports fill dialog presentation for the fields, the
|
||||
* system will send the request when the activity just started.
|
||||
*/
|
||||
public static final @RequestFlags int FLAG_ACTIVITY_START = 0x40;
|
||||
public static final @RequestFlags int FLAG_SUPPORTS_FILL_DIALOG = 0x40;
|
||||
|
||||
/** @hide */
|
||||
public static final int INVALID_REQUEST_ID = Integer.MIN_VALUE;
|
||||
@@ -140,8 +140,10 @@ public final class FillRequest implements Parcelable {
|
||||
/**
|
||||
* Gets the flags associated with this request.
|
||||
*
|
||||
* @return any combination of {@link #FLAG_MANUAL_REQUEST} and
|
||||
* @return any combination of {@link #FLAG_MANUAL_REQUEST},
|
||||
* {@link #FLAG_SUPPORTS_FILL_DIALOG} and
|
||||
* {@link #FLAG_COMPATIBILITY_MODE_REQUEST}.
|
||||
*
|
||||
*/
|
||||
private final @RequestFlags int mFlags;
|
||||
|
||||
@@ -199,7 +201,7 @@ public final class FillRequest implements Parcelable {
|
||||
FLAG_COMPATIBILITY_MODE_REQUEST,
|
||||
FLAG_PASSWORD_INPUT_TYPE,
|
||||
FLAG_VIEW_NOT_FOCUSED,
|
||||
FLAG_ACTIVITY_START
|
||||
FLAG_SUPPORTS_FILL_DIALOG
|
||||
})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@DataClass.Generated.Member
|
||||
@@ -223,8 +225,8 @@ public final class FillRequest implements Parcelable {
|
||||
return "FLAG_PASSWORD_INPUT_TYPE";
|
||||
case FLAG_VIEW_NOT_FOCUSED:
|
||||
return "FLAG_VIEW_NOT_FOCUSED";
|
||||
case FLAG_ACTIVITY_START:
|
||||
return "FLAG_ACTIVITY_START";
|
||||
case FLAG_SUPPORTS_FILL_DIALOG:
|
||||
return "FLAG_SUPPORTS_FILL_DIALOG";
|
||||
default: return Integer.toHexString(value);
|
||||
}
|
||||
}
|
||||
@@ -253,7 +255,8 @@ public final class FillRequest implements Parcelable {
|
||||
* @param flags
|
||||
* Gets the flags associated with this request.
|
||||
*
|
||||
* @return any combination of {@link #FLAG_MANUAL_REQUEST} and
|
||||
* @return any combination of {@link #FLAG_MANUAL_REQUEST},
|
||||
* {@link #FLAG_SUPPORTS_FILL_DIALOG} and
|
||||
* {@link #FLAG_COMPATIBILITY_MODE_REQUEST}.
|
||||
* @param inlineSuggestionsRequest
|
||||
* Gets the {@link InlineSuggestionsRequest} associated
|
||||
@@ -299,7 +302,7 @@ public final class FillRequest implements Parcelable {
|
||||
| FLAG_COMPATIBILITY_MODE_REQUEST
|
||||
| FLAG_PASSWORD_INPUT_TYPE
|
||||
| FLAG_VIEW_NOT_FOCUSED
|
||||
| FLAG_ACTIVITY_START);
|
||||
| FLAG_SUPPORTS_FILL_DIALOG);
|
||||
this.mInlineSuggestionsRequest = inlineSuggestionsRequest;
|
||||
this.mDelayedFillIntentSender = delayedFillIntentSender;
|
||||
|
||||
@@ -347,7 +350,8 @@ public final class FillRequest implements Parcelable {
|
||||
/**
|
||||
* Gets the flags associated with this request.
|
||||
*
|
||||
* @return any combination of {@link #FLAG_MANUAL_REQUEST} and
|
||||
* @return any combination of {@link #FLAG_MANUAL_REQUEST},
|
||||
* {@link #FLAG_SUPPORTS_FILL_DIALOG} and
|
||||
* {@link #FLAG_COMPATIBILITY_MODE_REQUEST}.
|
||||
*/
|
||||
@DataClass.Generated.Member
|
||||
@@ -458,7 +462,7 @@ public final class FillRequest implements Parcelable {
|
||||
| FLAG_COMPATIBILITY_MODE_REQUEST
|
||||
| FLAG_PASSWORD_INPUT_TYPE
|
||||
| FLAG_VIEW_NOT_FOCUSED
|
||||
| FLAG_ACTIVITY_START);
|
||||
| FLAG_SUPPORTS_FILL_DIALOG);
|
||||
this.mInlineSuggestionsRequest = inlineSuggestionsRequest;
|
||||
this.mDelayedFillIntentSender = delayedFillIntentSender;
|
||||
|
||||
@@ -480,10 +484,10 @@ public final class FillRequest implements Parcelable {
|
||||
};
|
||||
|
||||
@DataClass.Generated(
|
||||
time = 1643386870464L,
|
||||
time = 1647644111186L,
|
||||
codegenVersion = "1.0.23",
|
||||
sourceFile = "frameworks/base/core/java/android/service/autofill/FillRequest.java",
|
||||
inputSignatures = "public static final @android.service.autofill.FillRequest.RequestFlags int FLAG_MANUAL_REQUEST\npublic static final @android.service.autofill.FillRequest.RequestFlags int FLAG_COMPATIBILITY_MODE_REQUEST\npublic static final @android.service.autofill.FillRequest.RequestFlags int FLAG_PASSWORD_INPUT_TYPE\npublic static final @android.service.autofill.FillRequest.RequestFlags int FLAG_VIEW_NOT_FOCUSED\npublic static final @android.service.autofill.FillRequest.RequestFlags int FLAG_ACTIVITY_START\npublic static final int INVALID_REQUEST_ID\nprivate final int mId\nprivate final @android.annotation.NonNull java.util.List<android.service.autofill.FillContext> mFillContexts\nprivate final @android.annotation.Nullable android.os.Bundle mClientState\nprivate final @android.service.autofill.FillRequest.RequestFlags int mFlags\nprivate final @android.annotation.Nullable android.view.inputmethod.InlineSuggestionsRequest mInlineSuggestionsRequest\nprivate final @android.annotation.Nullable android.content.IntentSender mDelayedFillIntentSender\nprivate void onConstructed()\nclass FillRequest extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genToString=true, genHiddenConstructor=true, genHiddenConstDefs=true)")
|
||||
inputSignatures = "public static final @android.service.autofill.FillRequest.RequestFlags int FLAG_MANUAL_REQUEST\npublic static final @android.service.autofill.FillRequest.RequestFlags int FLAG_COMPATIBILITY_MODE_REQUEST\npublic static final @android.service.autofill.FillRequest.RequestFlags int FLAG_PASSWORD_INPUT_TYPE\npublic static final @android.service.autofill.FillRequest.RequestFlags int FLAG_VIEW_NOT_FOCUSED\npublic static final @android.service.autofill.FillRequest.RequestFlags int FLAG_SUPPORTS_FILL_DIALOG\npublic static final int INVALID_REQUEST_ID\nprivate final int mId\nprivate final @android.annotation.NonNull java.util.List<android.service.autofill.FillContext> mFillContexts\nprivate final @android.annotation.Nullable android.os.Bundle mClientState\nprivate final @android.service.autofill.FillRequest.RequestFlags int mFlags\nprivate final @android.annotation.Nullable android.view.inputmethod.InlineSuggestionsRequest mInlineSuggestionsRequest\nprivate final @android.annotation.Nullable android.content.IntentSender mDelayedFillIntentSender\nprivate void onConstructed()\nclass FillRequest extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genToString=true, genHiddenConstructor=true, genHiddenConstDefs=true)")
|
||||
@Deprecated
|
||||
private void __metadata() {}
|
||||
|
||||
|
||||
@@ -16,9 +16,9 @@
|
||||
|
||||
package android.view.autofill;
|
||||
|
||||
import static android.service.autofill.FillRequest.FLAG_ACTIVITY_START;
|
||||
import static android.service.autofill.FillRequest.FLAG_MANUAL_REQUEST;
|
||||
import static android.service.autofill.FillRequest.FLAG_PASSWORD_INPUT_TYPE;
|
||||
import static android.service.autofill.FillRequest.FLAG_SUPPORTS_FILL_DIALOG;
|
||||
import static android.service.autofill.FillRequest.FLAG_VIEW_NOT_FOCUSED;
|
||||
import static android.view.ContentInfo.SOURCE_AUTOFILL;
|
||||
import static android.view.autofill.Helper.sDebug;
|
||||
@@ -1118,7 +1118,7 @@ public final class AutofillManager {
|
||||
return;
|
||||
}
|
||||
|
||||
int flags = FLAG_ACTIVITY_START;
|
||||
int flags = FLAG_SUPPORTS_FILL_DIALOG;
|
||||
flags |= FLAG_VIEW_NOT_FOCUSED;
|
||||
notifyViewEntered(view, flags);
|
||||
}
|
||||
|
||||
@@ -18,9 +18,9 @@ package com.android.server.autofill;
|
||||
|
||||
import static android.service.autofill.AutofillFieldClassificationService.EXTRA_SCORES;
|
||||
import static android.service.autofill.AutofillService.EXTRA_FILL_RESPONSE;
|
||||
import static android.service.autofill.FillRequest.FLAG_ACTIVITY_START;
|
||||
import static android.service.autofill.FillRequest.FLAG_MANUAL_REQUEST;
|
||||
import static android.service.autofill.FillRequest.FLAG_PASSWORD_INPUT_TYPE;
|
||||
import static android.service.autofill.FillRequest.FLAG_SUPPORTS_FILL_DIALOG;
|
||||
import static android.service.autofill.FillRequest.FLAG_VIEW_NOT_FOCUSED;
|
||||
import static android.service.autofill.FillRequest.INVALID_REQUEST_ID;
|
||||
import static android.view.autofill.AutofillManager.ACTION_RESPONSE_EXPIRED;
|
||||
@@ -965,7 +965,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
|
||||
mService.getRemoteInlineSuggestionRenderServiceLocked();
|
||||
if ((mSessionFlags.mInlineSupportedByService || mSessionFlags.mClientSuggestionsEnabled)
|
||||
&& remoteRenderService != null
|
||||
&& (isViewFocusedLocked(flags) || (isRequestFromActivityStarted(flags)))) {
|
||||
&& (isViewFocusedLocked(flags) || (isRequestSupportFillDialog(flags)))) {
|
||||
final Consumer<InlineSuggestionsRequest> inlineSuggestionsRequestConsumer;
|
||||
if (mSessionFlags.mClientSuggestionsEnabled) {
|
||||
final int finalRequestId = requestId;
|
||||
@@ -1011,8 +1011,8 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
|
||||
requestAssistStructureLocked(requestId, flags);
|
||||
}
|
||||
|
||||
private boolean isRequestFromActivityStarted(int flags) {
|
||||
return (flags & FLAG_ACTIVITY_START) != 0;
|
||||
private boolean isRequestSupportFillDialog(int flags) {
|
||||
return (flags & FLAG_SUPPORTS_FILL_DIALOG) != 0;
|
||||
}
|
||||
|
||||
@GuardedBy("mLock")
|
||||
@@ -3002,7 +3002,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
|
||||
// View is triggering autofill.
|
||||
mCurrentViewId = viewState.id;
|
||||
viewState.update(value, virtualBounds, flags);
|
||||
if (!isRequestFromActivityStarted(flags)) {
|
||||
if (!isRequestSupportFillDialog(flags)) {
|
||||
mSessionFlags.mFillDialogDisabled = true;
|
||||
}
|
||||
requestNewFillResponseLocked(viewState, ViewState.STATE_STARTED_SESSION, flags);
|
||||
|
||||
Reference in New Issue
Block a user