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

Commit 92ab3857 authored by Felipe Leme's avatar Felipe Leme
Browse files

Simplified View.onProvideContentCaptureStructure()

That method was returning a boolean to indicate whether the IntelligenceManager
should be notify, so views with virtual hierarchy could return false.

But now it returns void and always notify, which makes the API easier to
understand and use.

Bug: 117944706

Test: m -j update-api doc-comment-check-docs
Test: atest CtsAutoFillServiceTestCases

Change-Id: I216cacb6edb144239b6eabe56ab177fc2582e1aa
parent 9ca7a38d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -49061,7 +49061,7 @@ package android.view {
    method public void onPopulateAccessibilityEvent(android.view.accessibility.AccessibilityEvent);
    method public void onProvideAutofillStructure(android.view.ViewStructure, int);
    method public void onProvideAutofillVirtualStructure(android.view.ViewStructure, int);
    method public boolean onProvideContentCaptureStructure(android.view.ViewStructure, int);
    method public void onProvideContentCaptureStructure(android.view.ViewStructure, int);
    method public void onProvideStructure(android.view.ViewStructure);
    method public void onProvideVirtualStructure(android.view.ViewStructure);
    method public android.view.PointerIcon onResolvePointerIcon(android.view.MotionEvent, int);
+2 −4
Original line number Diff line number Diff line
@@ -3645,12 +3645,9 @@ package android.net.wifi {
    method public int getWifiApState();
    method public boolean isDeviceToApRttSupported();
    method public boolean isDeviceToDeviceRttSupported();
    method public boolean isOweSupported();
    method public boolean isPortableHotspotSupported();
    method public boolean isWifiApEnabled();
    method public boolean isWifiScannerSupported();
    method public boolean isWpa3SaeSupported();
    method public boolean isWpa3SuiteBSupported();
    method public void registerNetworkRequestMatchCallback(android.net.wifi.WifiManager.NetworkRequestMatchCallback, android.os.Handler);
    method public boolean setWifiApConfiguration(android.net.wifi.WifiConfiguration);
    method public boolean startScan(android.os.WorkSource);
@@ -4639,6 +4636,7 @@ package android.rolecontrollerservice {
    method public abstract void onAddRoleHolder(java.lang.String, java.lang.String, android.app.role.RoleManagerCallback);
    method public final android.os.IBinder onBind(android.content.Intent);
    method public abstract void onClearRoleHolders(java.lang.String, android.app.role.RoleManagerCallback);
    method public abstract void onGrantDefaultRoles(android.app.role.RoleManagerCallback);
    method public abstract void onRemoveRoleHolder(java.lang.String, java.lang.String, android.app.role.RoleManagerCallback);
    field public static final java.lang.String SERVICE_INTERFACE = "android.rolecontrollerservice.RoleControllerService";
  }
@@ -7430,7 +7428,7 @@ package android.webkit {
    method public default void onMovedToDisplay(int, android.content.res.Configuration);
    method public abstract void onOverScrolled(int, int, boolean, boolean);
    method public default void onProvideAutofillVirtualStructure(android.view.ViewStructure, int);
    method public default boolean onProvideContentCaptureStructure(android.view.ViewStructure, int);
    method public default void onProvideContentCaptureStructure(android.view.ViewStructure, int);
    method public abstract void onProvideVirtualStructure(android.view.ViewStructure);
    method public abstract void onScrollChanged(int, int, int, int);
    method public abstract void onSizeChanged(int, int, int, int);
+6 −12
Original line number Diff line number Diff line
@@ -8142,6 +8142,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     * the user, and the activity rendering the view is enabled for Content Capture) is laid out and
     * is visible.
     *
     * <p>The populated structure is then passed to the service through
     * {@link IntelligenceManager#notifyViewAppeared(ViewStructure)}.
     *
     * <p><b>Note: </b>the following methods of the {@code structure} will be ignored:
     * <ul>
     *   <li>{@link ViewStructure#setChildCount(int)}
@@ -8155,16 +8158,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     *   <li>{@link ViewStructure#setHtmlInfo(android.view.ViewStructure.HtmlInfo)}
     *   <li>{@link ViewStructure#setDataIsSensitive(boolean)}
     * </ul>
     *
     * @return whether the IntelligenceService should be notified that the view was added (through
     * the {@link IntelligenceManager#notifyViewAppeared(ViewStructure)} method) to the view
     * hierarchy. Most views should return {@code true} here, but views that contains virtual
     * hierarchy might opt to return {@code false} and notify the manager independently, as the
     * virtual views are rendered.
     */
    public boolean onProvideContentCaptureStructure(@NonNull ViewStructure structure, int flags) {
    public void onProvideContentCaptureStructure(@NonNull ViewStructure structure, int flags) {
        onProvideStructure(structure, VIEW_STRUCTURE_FOR_CONTENT_CAPTURE, flags);
        return true;
    }
    /** @hide */
@@ -8976,10 +8972,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        if (type == CONTENT_CAPTURE_NOTIFICATION_TYPE_APPEARED) {
            final ViewStructure structure = im.newViewStructure(this);
            boolean notifyMgr = onProvideContentCaptureStructure(structure, /* flags= */ 0);
            if (notifyMgr) {
            onProvideContentCaptureStructure(structure, /* flags= */ 0);
            im.notifyViewAppeared(structure);
            }
            mPrivateFlags4 |= PFLAG4_NOTIFIED_CONTENT_CAPTURE_ADDED;
        } else {
            if ((mPrivateFlags4 & PFLAG4_NOTIFIED_CONTENT_CAPTURE_ADDED) == 0) {
+2 −2
Original line number Diff line number Diff line
@@ -2695,8 +2695,8 @@ public class WebView extends AbsoluteLayout
    }

    @Override
    public boolean onProvideContentCaptureStructure(ViewStructure structure, int flags) {
        return mProvider.getViewDelegate().onProvideContentCaptureStructure(structure, flags);
    public void onProvideContentCaptureStructure(ViewStructure structure, int flags) {
        mProvider.getViewDelegate().onProvideContentCaptureStructure(structure, flags);
    }

    @Override
+1 −2
Original line number Diff line number Diff line
@@ -341,10 +341,9 @@ public interface WebViewProvider {
            return true; // true is the default value returned by View.isVisibleToUserForAutofill()
        }

        default boolean onProvideContentCaptureStructure(
        default void onProvideContentCaptureStructure(
                @SuppressWarnings("unused") android.view.ViewStructure structure,
                @SuppressWarnings("unused") int flags) {
            return false; // WebView provides virtual views and is responsible to notify manager
        }

        public AccessibilityNodeProvider getAccessibilityNodeProvider();
Loading