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

Commit 88eae3bc authored by Felipe Leme's avatar Felipe Leme
Browse files

Added moar ContentCapture APIs (and their initial implementation).

There are 4 new APIs on View:
  - boolean setImportantForContentCapture()
  - boolean getImportantForContentCapture()
  - boolean isImportantForContentCapture()
  - boolean onProvideContentCaptureStructure()

And 4 on IntelligenceManager:
  - void notifyViewAppeared()
  - void notifyViewDisappeared()
  - void notifyViewTextChanged()
  - ViewStructure newVirtualViewStructure()

These methods are similar to the equivalent methods that are used for Autofill
and/or Assist, except for the following differences:

- The view hierarchy nodes are reported as they are rendered, rather than at
  once in a tree, recursively. Hence, the ViewStructure implementation does
  not implement the methods that add children to it, and views that provide
  virtual hierarchies must manually call IntelligenceManager to create the
  ViewStructure to their children and notify when their children are added and
  removed.
- It does not support methods added for Autofill to handle HTML pages (such
  as setHtmlInfo() and setWewbDomain()), as they're not important in the
  Content Capture context.
- Similarly, it also does not support setDataIsSensitive(), because the
  Intelligence service does not have the same restrictions as the Autofill
  service.

The CL also provides the initial implementation of these APIs, although still
full of TODOs (for example, we're not holding the events to send as a batch
yet).

Test: m -j update-api doc-comment-check-docs
Bug: 117944706

Change-Id: I43f06ce82bfe3b14d8d13fb3b2ebee223db83284
parent 9c045fe6
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -740,6 +740,7 @@ package android {
    field public static final int immersive = 16843456; // 0x10102c0
    field public static final int importantForAccessibility = 16843690; // 0x10103aa
    field public static final int importantForAutofill = 16844120; // 0x1010558
    field public static final int importantForContentCapture = 16844182; // 0x1010596
    field public static final int inAnimation = 16843127; // 0x1010177
    field public static final int includeFontPadding = 16843103; // 0x101015f
    field public static final int includeInGlobalSearch = 16843374; // 0x101026e
@@ -48785,6 +48786,7 @@ package android.view {
    method public int getId();
    method public int getImportantForAccessibility();
    method public int getImportantForAutofill();
    method public int getImportantForContentCapture();
    method public boolean getKeepScreenOn();
    method public android.view.KeyEvent.DispatcherState getKeyDispatcherState();
    method public int getLabelFor();
@@ -48918,6 +48920,7 @@ package android.view {
    method public boolean isHovered();
    method public boolean isImportantForAccessibility();
    method public final boolean isImportantForAutofill();
    method public final boolean isImportantForContentCapture();
    method public boolean isInEditMode();
    method public boolean isInLayout();
    method public boolean isInTouchMode();
@@ -48992,6 +48995,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 onProvideStructure(android.view.ViewStructure);
    method public void onProvideVirtualStructure(android.view.ViewStructure);
    method public android.view.PointerIcon onResolvePointerIcon(android.view.MotionEvent, int);
@@ -49110,6 +49114,7 @@ package android.view {
    method public void setId(int);
    method public void setImportantForAccessibility(int);
    method public void setImportantForAutofill(int);
    method public void setImportantForContentCapture(int);
    method public void setKeepScreenOn(boolean);
    method public void setKeyboardNavigationCluster(boolean);
    method public void setLabelFor(int);
@@ -49280,6 +49285,11 @@ package android.view {
    field public static final int IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS = 8; // 0x8
    field public static final int IMPORTANT_FOR_AUTOFILL_YES = 1; // 0x1
    field public static final int IMPORTANT_FOR_AUTOFILL_YES_EXCLUDE_DESCENDANTS = 4; // 0x4
    field public static final int IMPORTANT_FOR_CONTENT_CAPTURE_AUTO = 0; // 0x0
    field public static final int IMPORTANT_FOR_CONTENT_CAPTURE_NO = 2; // 0x2
    field public static final int IMPORTANT_FOR_CONTENT_CAPTURE_NO_EXCLUDE_DESCENDANTS = 8; // 0x8
    field public static final int IMPORTANT_FOR_CONTENT_CAPTURE_YES = 1; // 0x1
    field public static final int IMPORTANT_FOR_CONTENT_CAPTURE_YES_EXCLUDE_DESCENDANTS = 4; // 0x4
    field public static final int INVISIBLE = 4; // 0x4
    field public static final int KEEP_SCREEN_ON = 67108864; // 0x4000000
    field public static final int LAYER_TYPE_HARDWARE = 2; // 0x2
@@ -51734,6 +51744,10 @@ package android.view.intelligence {
    method public void disableContentCapture();
    method public android.content.ComponentName getIntelligenceServiceComponentName();
    method public boolean isContentCaptureEnabled();
    method public android.view.ViewStructure newVirtualViewStructure(android.view.autofill.AutofillId, int);
    method public void notifyViewAppeared(android.view.ViewStructure);
    method public void notifyViewDisappeared(android.view.autofill.AutofillId);
    method public void notifyViewTextChanged(android.view.autofill.AutofillId, java.lang.CharSequence, int);
    field public static final int FLAG_USER_INPUT = 1; // 0x1
  }
+2 −2
Original line number Diff line number Diff line
@@ -6994,8 +6994,8 @@ package android.view.intelligence {
    field public static final int TYPE_ACTIVITY_RESUMED = 2; // 0x2
    field public static final int TYPE_ACTIVITY_STARTED = 1; // 0x1
    field public static final int TYPE_ACTIVITY_STOPPED = 4; // 0x4
    field public static final int TYPE_VIEW_ADDED = 5; // 0x5
    field public static final int TYPE_VIEW_REMOVED = 6; // 0x6
    field public static final int TYPE_VIEW_APPEARED = 5; // 0x5
    field public static final int TYPE_VIEW_DISAPPEARED = 6; // 0x6
    field public static final int TYPE_VIEW_TEXT_CHANGED = 7; // 0x7
  }

+3 −3
Original line number Diff line number Diff line
@@ -1637,9 +1637,9 @@ package android.view {
  }

  public abstract interface WindowManager implements android.view.ViewManager {
    method public abstract void setShouldShowIme(int, boolean);
    method public abstract void setShouldShowWithInsecureKeyguard(int, boolean);
    method public abstract void setShouldShowSystemDecors(int, boolean);
    method public default void setShouldShowIme(int, boolean);
    method public default void setShouldShowSystemDecors(int, boolean);
    method public default void setShouldShowWithInsecureKeyguard(int, boolean);
  }

  public static class WindowManager.LayoutParams extends android.view.ViewGroup.LayoutParams implements android.os.Parcelable {
+415 −14

File changed.

Preview size limit exceeded, changes collapsed.

+0 −1
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@ import android.os.Bundle;
import android.os.LocaleList;
import android.util.Pair;
import android.view.View.AutofillImportance;
import android.view.ViewStructure.HtmlInfo;
import android.view.autofill.AutofillId;
import android.view.autofill.AutofillValue;

Loading