Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2f8fb1f6 authored by Svet Ganov's avatar Svet Ganov
Browse files

Fix a few auto fill ussues

1. Ensure clicking on a focused view brings up autofill if needed

2. Notify the autofill manager in a couple of cases we missed

3. Renamed the AutofillManager app facing APIs to better reflect what
    they do and added a API for the app to cancel the autofill interaction

4. Fix view structure dispatch where the ordering of children for autofill
    was mixed with ordering of direct view children - the autofill children
    may be indirect as views can be marked not important for autofill

5. Show scrollbars only if there are more fill options than want is shown

6. Show only three fill options and the rest can be accessed with a scroll

7. Remove the list divider to allow fill items to control all fill window content

8. Renamed the autofill manager internal service classes to xxAutofillxx

9. Fixed a comment that was not addressed in a previous CL

10. Showing max three fill options - rest needs a scroll

11. Make sure fill UI shown when filter with no matches is changed
      to filter with some matches

12. Make sure the fill window has a shadow

Test: Autofill CTS tests pass and manual

bug:36038929
bug:36040101
bug:36149166
bug:36034681
bug:36126001
bug:36035654

Change-Id: Ic8726146fc3c0a19d3e536becdd63fb65622136e
parent 67916b86
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -47497,15 +47497,16 @@ package android.view.autofill {
  }
  public final class AutofillManager {
    method public void cancel();
    method public void commit();
    method public void notifyValueChanged(android.view.View);
    method public void notifyViewEntered(android.view.View);
    method public void notifyViewExited(android.view.View);
    method public void notifyVirtualValueChanged(android.view.View, int, android.view.autofill.AutofillValue);
    method public void notifyVirtualViewEntered(android.view.View, int, android.graphics.Rect);
    method public void notifyVirtualViewExited(android.view.View, int);
    method public void registerCallback(android.view.autofill.AutofillManager.AutofillCallback);
    method public void reset();
    method public void startAutofillRequest(android.view.View);
    method public void startAutofillRequestOnVirtualView(android.view.View, int, android.graphics.Rect);
    method public void stopAutofillRequest(android.view.View);
    method public void stopAutofillRequestOnVirtualView(android.view.View, int);
    method public void unregisterCallback(android.view.autofill.AutofillManager.AutofillCallback);
    method public void valueChanged(android.view.View);
    method public void virtualValueChanged(android.view.View, int, android.view.autofill.AutofillValue);
    field public static final java.lang.String EXTRA_ASSIST_STRUCTURE = "android.view.autofill.extra.ASSIST_STRUCTURE";
    field public static final java.lang.String EXTRA_AUTHENTICATION_RESULT = "android.view.autofill.extra.AUTHENTICATION_RESULT";
  }
+8 −7
Original line number Diff line number Diff line
@@ -50960,15 +50960,16 @@ package android.view.autofill {
  }
  public final class AutofillManager {
    method public void cancel();
    method public void commit();
    method public void notifyValueChanged(android.view.View);
    method public void notifyViewEntered(android.view.View);
    method public void notifyViewExited(android.view.View);
    method public void notifyVirtualValueChanged(android.view.View, int, android.view.autofill.AutofillValue);
    method public void notifyVirtualViewEntered(android.view.View, int, android.graphics.Rect);
    method public void notifyVirtualViewExited(android.view.View, int);
    method public void registerCallback(android.view.autofill.AutofillManager.AutofillCallback);
    method public void reset();
    method public void startAutofillRequest(android.view.View);
    method public void startAutofillRequestOnVirtualView(android.view.View, int, android.graphics.Rect);
    method public void stopAutofillRequest(android.view.View);
    method public void stopAutofillRequestOnVirtualView(android.view.View, int);
    method public void unregisterCallback(android.view.autofill.AutofillManager.AutofillCallback);
    method public void valueChanged(android.view.View);
    method public void virtualValueChanged(android.view.View, int, android.view.autofill.AutofillValue);
    field public static final java.lang.String EXTRA_ASSIST_STRUCTURE = "android.view.autofill.extra.ASSIST_STRUCTURE";
    field public static final java.lang.String EXTRA_AUTHENTICATION_RESULT = "android.view.autofill.extra.AUTHENTICATION_RESULT";
  }
+8 −7
Original line number Diff line number Diff line
@@ -47866,15 +47866,16 @@ package android.view.autofill {
  }
  public final class AutofillManager {
    method public void cancel();
    method public void commit();
    method public void notifyValueChanged(android.view.View);
    method public void notifyViewEntered(android.view.View);
    method public void notifyViewExited(android.view.View);
    method public void notifyVirtualValueChanged(android.view.View, int, android.view.autofill.AutofillValue);
    method public void notifyVirtualViewEntered(android.view.View, int, android.graphics.Rect);
    method public void notifyVirtualViewExited(android.view.View, int);
    method public void registerCallback(android.view.autofill.AutofillManager.AutofillCallback);
    method public void reset();
    method public void startAutofillRequest(android.view.View);
    method public void startAutofillRequestOnVirtualView(android.view.View, int, android.graphics.Rect);
    method public void stopAutofillRequest(android.view.View);
    method public void stopAutofillRequestOnVirtualView(android.view.View, int);
    method public void unregisterCallback(android.view.autofill.AutofillManager.AutofillCallback);
    method public void valueChanged(android.view.View);
    method public void virtualValueChanged(android.view.View, int, android.view.autofill.AutofillValue);
    field public static final java.lang.String EXTRA_ASSIST_STRUCTURE = "android.view.autofill.extra.ASSIST_STRUCTURE";
    field public static final java.lang.String EXTRA_AUTHENTICATION_RESULT = "android.view.autofill.extra.AUTHENTICATION_RESULT";
  }
+1 −1
Original line number Diff line number Diff line
@@ -1783,7 +1783,7 @@ public class Activity extends ContextThemeWrapper
        mTranslucentCallback = null;
        mCalled = true;
        if (isFinishing() && mAutoFillResetNeeded) {
            getSystemService(AutofillManager.class).reset();
            getSystemService(AutofillManager.class).commit();
        }
    }

+27 −21
Original line number Diff line number Diff line
@@ -6132,6 +6132,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        }
        sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_CLICKED);
        notifyEnterOrExitForAutoFillIfNeeded(true);
        return result;
    }
@@ -6791,14 +6794,18 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
            mAttachInfo.mKeyDispatchState.reset(this);
        }
        notifyEnterOrExitForAutoFillIfNeeded(gainFocus);
    }
    private void notifyEnterOrExitForAutoFillIfNeeded(boolean enter) {
        if (isAutofillable() && isAttachedToWindow()
                && getResolvedAutofillMode() == AUTOFILL_MODE_AUTO) {
            AutofillManager afm = getAutofillManager();
            if (afm != null) {
                if (gainFocus) {
                    afm.startAutofillRequest(this);
                } else {
                    afm.stopAutofillRequest(this);
                if (enter && hasWindowFocus() && isFocused()) {
                    afm.notifyViewEntered(this);
                } else if (!hasWindowFocus() || !isFocused()) {
                    afm.notifyViewExited(this);
                }
            }
        }
@@ -7368,13 +7375,17 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     * <li>Also implement {@link #autofillVirtual(int, AutofillValue)} to autofill the virtual
     * children.
     * <li>Call
     * {@link android.view.autofill.AutofillManager#startAutofillRequestOnVirtualView} and
     * {@link android.view.autofill.AutofillManager#stopAutofillRequestOnVirtualView(View, int)}
     * {@link android.view.autofill.AutofillManager#notifyVirtualViewEntered} and
     * {@link android.view.autofill.AutofillManager#notifyVirtualViewExited(View, int)}
     * when the focus inside the view changed.
     * <li>Call {@link android.view.autofill.AutofillManager#virtualValueChanged(View, int,
     * <li>Call {@link android.view.autofill.AutofillManager#notifyVirtualValueChanged(View, int,
     * AutofillValue)} when the value of a child changed.
     * <li>Call {@link android.view.autofill.AutofillManager#reset()} when the autofill context
     * of the view structure changed.
     * <li>Call {@link AutofillManager#commit()} when the autofill context
     * of the view structure changed and you want the current autofill interaction if such
     * to be commited.
     * <li>Call {@link AutofillManager#cancel()} ()} when the autofill context
     * of the view structure changed and you want the current autofill interaction if such
     * to be cancelled.
     * </ol>
     *
     * @param structure Fill in with structured view data.
@@ -11085,6 +11096,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
    @CallSuper
    public void dispatchStartTemporaryDetach() {
        mPrivateFlags3 |= PFLAG3_TEMPORARY_DETACH;
        notifyEnterOrExitForAutoFillIfNeeded(false);
        onStartTemporaryDetach();
    }
@@ -11110,6 +11122,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        if (hasWindowFocus() && hasFocus()) {
            InputMethodManager.getInstance().focusIn(this);
        }
        notifyEnterOrExitForAutoFillIfNeeded(true);
    }
    /**
@@ -11512,6 +11525,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        } else if (imm != null && (mPrivateFlags & PFLAG_FOCUSED) != 0) {
            imm.focusIn(this);
        }
        notifyEnterOrExitForAutoFillIfNeeded(hasWindowFocus);
        refreshDrawableState();
    }
@@ -16879,12 +16895,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        }
        needGlobalAttributesUpdate(false);
        if (isAutofillable() && isFocused() && getResolvedAutofillMode() == AUTOFILL_MODE_AUTO) {
            AutofillManager afm = getAutofillManager();
            if (afm != null) {
                afm.startAutofillRequest(this);
            }
        }
        notifyEnterOrExitForAutoFillIfNeeded(true);
    }
    void dispatchDetachedFromWindow() {
@@ -16932,12 +16943,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
            mOverlay.getOverlayView().dispatchDetachedFromWindow();
        }
        if (isAutofillable() && isFocused() && getResolvedAutofillMode() == AUTOFILL_MODE_AUTO) {
            AutofillManager afm = getAutofillManager();
            if (afm != null) {
                afm.stopAutofillRequest(this);
            }
        }
        notifyEnterOrExitForAutoFillIfNeeded(false);
    }
    /**
Loading