diff options
4 files changed, 23 insertions, 1 deletions
diff --git a/core/java/android/view/autofill/AutofillManager.java b/core/java/android/view/autofill/AutofillManager.java index 5d121ad2957f..2ef7419ac1b1 100644 --- a/core/java/android/view/autofill/AutofillManager.java +++ b/core/java/android/view/autofill/AutofillManager.java @@ -1773,7 +1773,7 @@ public final class AutofillManager { mForAugmentedAutofillOnly = false; } - if ((flags & FLAG_SUPPORTS_FILL_DIALOG) != 0 && view != null) { + if ((flags & FLAG_SUPPORTS_FILL_DIALOG) != 0) { flags |= FLAG_RESET_FILL_DIALOG_STATE; } diff --git a/services/autofill/java/com/android/server/autofill/AutofillInlineSessionController.java b/services/autofill/java/com/android/server/autofill/AutofillInlineSessionController.java index dd5e58a94d15..cac3c20ec3e0 100644 --- a/services/autofill/java/com/android/server/autofill/AutofillInlineSessionController.java +++ b/services/autofill/java/com/android/server/autofill/AutofillInlineSessionController.java @@ -206,4 +206,11 @@ final class AutofillInlineSessionController { } return false; } + + boolean isImeShowing() { + if (mSession != null) { + return mSession.isImeShowing(); + } + return false; + } } diff --git a/services/autofill/java/com/android/server/autofill/AutofillInlineSuggestionsRequestSession.java b/services/autofill/java/com/android/server/autofill/AutofillInlineSuggestionsRequestSession.java index a089f3ddcb86..468b9ab5710e 100644 --- a/services/autofill/java/com/android/server/autofill/AutofillInlineSuggestionsRequestSession.java +++ b/services/autofill/java/com/android/server/autofill/AutofillInlineSuggestionsRequestSession.java @@ -106,6 +106,8 @@ final class AutofillInlineSuggestionsRequestSession { @GuardedBy("mLock") private boolean mImeSessionInvalidated = false; + private boolean mImeShowing = false; + AutofillInlineSuggestionsRequestSession( @NonNull InputMethodManagerInternal inputMethodManagerInternal, int userId, @NonNull ComponentName componentName, @NonNull Handler handler, @NonNull Object lock, @@ -320,6 +322,7 @@ final class AutofillInlineSuggestionsRequestSession { if (mDestroyed) { return; } + mImeShowing = imeInputViewStarted; if (mImeCurrentFieldId != null) { boolean imeInputStartedChanged = (mImeInputStarted != imeInputStarted); boolean imeInputViewStartedChanged = (mImeInputViewStarted != imeInputViewStarted); @@ -364,6 +367,12 @@ final class AutofillInlineSuggestionsRequestSession { } } + boolean isImeShowing() { + synchronized (mLock) { + return !mDestroyed && mImeShowing; + } + } + /** * Internal implementation of {@link IInlineSuggestionsRequestCallback}. */ diff --git a/services/autofill/java/com/android/server/autofill/Session.java b/services/autofill/java/com/android/server/autofill/Session.java index 311300043b1b..c4c1750e0a63 100644 --- a/services/autofill/java/com/android/server/autofill/Session.java +++ b/services/autofill/java/com/android/server/autofill/Session.java @@ -4365,6 +4365,12 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState return false; } + if (mInlineSessionController.isImeShowing()) { + // IME is showing, fallback to normal suggestions UI + // Note: only work when inline suggestions supported + return false; + } + synchronized (mLock) { if (mLastFillDialogTriggerIds == null || !ArrayUtils.contains(mLastFillDialogTriggerIds, filledId)) { |