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

Commit d1e123cb authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Autofill: Add API for virtual view visibility"

parents a135b4b1 4db89ba8
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -47860,6 +47860,8 @@ package android.view.autofill {
    method public void notifyViewEntered(android.view.View, int, android.graphics.Rect);
    method public void notifyViewExited(android.view.View);
    method public void notifyViewExited(android.view.View, int);
    method public void notifyViewVisibilityChanged(android.view.View, boolean);
    method public void notifyViewVisibilityChanged(android.view.View, int, boolean);
    method public void registerCallback(android.view.autofill.AutofillManager.AutofillCallback);
    method public void requestAutofill(android.view.View);
    method public void requestAutofill(android.view.View, int, android.graphics.Rect);
+2 −0
Original line number Diff line number Diff line
@@ -51417,6 +51417,8 @@ package android.view.autofill {
    method public void notifyViewEntered(android.view.View, int, android.graphics.Rect);
    method public void notifyViewExited(android.view.View);
    method public void notifyViewExited(android.view.View, int);
    method public void notifyViewVisibilityChanged(android.view.View, boolean);
    method public void notifyViewVisibilityChanged(android.view.View, int, boolean);
    method public void registerCallback(android.view.autofill.AutofillManager.AutofillCallback);
    method public void requestAutofill(android.view.View);
    method public void requestAutofill(android.view.View, int, android.graphics.Rect);
+2 −0
Original line number Diff line number Diff line
@@ -48289,6 +48289,8 @@ package android.view.autofill {
    method public void notifyViewEntered(android.view.View, int, android.graphics.Rect);
    method public void notifyViewExited(android.view.View);
    method public void notifyViewExited(android.view.View, int);
    method public void notifyViewVisibilityChanged(android.view.View, boolean);
    method public void notifyViewVisibilityChanged(android.view.View, int, boolean);
    method public void registerCallback(android.view.autofill.AutofillManager.AutofillCallback);
    method public void requestAutofill(android.view.View);
    method public void requestAutofill(android.view.View, int, android.graphics.Rect);
+2 −2
Original line number Diff line number Diff line
@@ -12157,7 +12157,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
                // If the view is in the background but still part of the hierarchy this is called
                // with isVisible=false. Hence visibility==false requires further checks
                if (isVisible) {
                    afm.notifyViewVisibilityChange(this, true);
                    afm.notifyViewVisibilityChanged(this, true);
                } else {
                    if (mVisibilityChangeForAutofillHandler == null) {
                        mVisibilityChangeForAutofillHandler =
@@ -25017,7 +25017,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        @Override
        public void handleMessage(Message msg) {
            mAfm.notifyViewVisibilityChange(mView, mView.isShown());
            mAfm.notifyViewVisibilityChanged(mView, mView.isShown());
        }
    }
+31 −9
Original line number Diff line number Diff line
@@ -496,25 +496,48 @@ public final class AutofillManager {
    }

    /**
     * Called when a {@link View view's} visibility changes.
     * Called when a {@link View view's} visibility changed.
     *
     * @param view {@link View} that was exited.
     * @param isVisible visible if the view is visible in the view hierarchy.
     */
    public void notifyViewVisibilityChanged(@NonNull View view, boolean isVisible) {
        notifyViewVisibilityChangedInternal(view, 0, isVisible, false);
    }

    /**
     * Called when a virtual view's visibility changed.
     *
     * @hide
     * @param view {@link View} that was exited.
     * @param virtualId id identifying the virtual child inside the parent view.
     * @param isVisible visible if the view is visible in the view hierarchy.
     */
    public void notifyViewVisibilityChange(@NonNull View view, boolean isVisible) {
    public void notifyViewVisibilityChanged(@NonNull View view, int virtualId, boolean isVisible) {
        notifyViewVisibilityChangedInternal(view, virtualId, isVisible, true);
    }

    /**
     * Called when a view/virtual view's visibility changed.
     *
     * @param view {@link View} that was exited.
     * @param virtualId id identifying the virtual child inside the parent view.
     * @param isVisible visible if the view is visible in the view hierarchy.
     * @param virtual Whether the view is virtual.
     */
    private void notifyViewVisibilityChangedInternal(@NonNull View view, int virtualId,
            boolean isVisible, boolean virtual) {
        synchronized (mLock) {
            if (mEnabled && mSessionId != NO_SESSION) {
                final AutofillId id = virtual ? getAutofillId(view, virtualId)
                        : view.getAutofillId();
                if (!isVisible && mFillableIds != null) {
                    final AutofillId id = view.getAutofillId();
                    if (mFillableIds.contains(id)) {
                        if (sDebug) Log.d(TAG, "Hidding UI when view " + id + " became invisible");
                        requestHideFillUi(id, view);
                    }
                }
                if (mTrackedViews != null) {
                    mTrackedViews.notifyViewVisibilityChange(view, isVisible);
                    mTrackedViews.notifyViewVisibilityChanged(id, isVisible);
                }
            }
        }
@@ -1362,15 +1385,14 @@ public final class AutofillManager {
        /**
         * Called when a {@link View view's} visibility changes.
         *
         * @param view {@link View} that was exited.
         * @param id the id of the view/virtual view whose visibility changed.
         * @param isVisible visible if the view is visible in the view hierarchy.
         */
        void notifyViewVisibilityChange(@NonNull View view, boolean isVisible) {
            AutofillId id = getAutofillId(view);
        void notifyViewVisibilityChanged(@NonNull AutofillId id, boolean isVisible) {
            AutofillClient client = getClientLocked();

            if (sDebug) {
                Log.d(TAG, "notifyViewVisibilityChange(): id=" + id + " isVisible="
                Log.d(TAG, "notifyViewVisibilityChanged(): id=" + id + " isVisible="
                        + isVisible);
            }