summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xapi/current.txt2
-rw-r--r--api/system-current.txt1
-rw-r--r--core/java/android/service/intelligence/InteractionContext.java2
-rw-r--r--core/java/android/view/intelligence/IntelligenceManager.java34
4 files changed, 35 insertions, 4 deletions
diff --git a/api/current.txt b/api/current.txt
index 28863b87d1de..cb343505f533 100755
--- a/api/current.txt
+++ b/api/current.txt
@@ -51799,13 +51799,13 @@ package android.view.inputmethod {
package android.view.intelligence {
public final class IntelligenceManager {
- 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);
+ method public void setContentCaptureEnabled(boolean);
field public static final int FLAG_USER_INPUT = 1; // 0x1
}
diff --git a/api/system-current.txt b/api/system-current.txt
index 5c4efcd90b5b..6706138661d3 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -7018,6 +7018,7 @@ package android.view.intelligence {
method public java.util.Set<android.content.ComponentName> getContentCaptureDisabledActivities();
method public java.util.Set<java.lang.String> getContentCaptureDisabledPackages();
method public void setActivityContentCaptureEnabled(android.content.ComponentName, boolean);
+ method public void setContentCaptureWhitelist(java.util.List<java.lang.String>, java.util.List<android.content.ComponentName>);
method public void setPackageContentCaptureEnabled(java.lang.String, boolean);
}
diff --git a/core/java/android/service/intelligence/InteractionContext.java b/core/java/android/service/intelligence/InteractionContext.java
index c1803ad259d5..0cc377bb030b 100644
--- a/core/java/android/service/intelligence/InteractionContext.java
+++ b/core/java/android/service/intelligence/InteractionContext.java
@@ -37,7 +37,7 @@ public final class InteractionContext implements Parcelable {
/**
* Flag used to indicate that the app explicitly disabled content capture for the activity
* (using
- * {@link android.view.intelligence.IntelligenceManager#disableContentCapture()}),
+ * {@link android.view.intelligence.IntelligenceManager#setContentCaptureEnabled()}),
* in which case the service will just receive activity-level events.
*/
public static final int FLAG_DISABLED_BY_APP = 0x1;
diff --git a/core/java/android/view/intelligence/IntelligenceManager.java b/core/java/android/view/intelligence/IntelligenceManager.java
index c02fb3218a2e..71b47f8f83a5 100644
--- a/core/java/android/view/intelligence/IntelligenceManager.java
+++ b/core/java/android/view/intelligence/IntelligenceManager.java
@@ -45,6 +45,7 @@ import com.android.internal.util.Preconditions;
import java.io.PrintWriter;
import java.util.ArrayList;
+import java.util.List;
import java.util.Set;
/**
@@ -384,12 +385,12 @@ public final class IntelligenceManager {
}
/**
- * Called by apps to disable content capture.
+ * Called by apps to explicitly enabled or disable content capture.
*
* <p><b>Note: </b> this call is not persisted accross reboots, so apps should typically call
* it on {@link android.app.Activity#onCreate(android.os.Bundle, android.os.PersistableBundle)}.
*/
- public void disableContentCapture() {
+ public void setContentCaptureEnabled(boolean enabled) {
//TODO(b/111276913): implement
}
@@ -414,6 +415,35 @@ public final class IntelligenceManager {
/**
* Called by the the service {@link android.service.intelligence.IntelligenceService}
+ * to explicitly limit content capture to the given packages and activities.
+ *
+ * <p>When the whitelist is set, it overrides the values passed to
+ * {@link #setActivityContentCaptureEnabled(ComponentName, boolean)}
+ * and {@link #setPackageContentCaptureEnabled(String, boolean)}.
+ *
+ * <p>To reset the whitelist, call it passing {@code null} to both arguments.
+ *
+ * <p>Useful when the service wants to restrict content capture to a category of apps, like
+ * chat apps. For example, if the service wants to support view captures on all activities of
+ * app {@code ChatApp1} and just activities {@code act1} and {@code act2} of {@code ChatApp2},
+ * it would call: {@code setContentCaptureWhitelist(Arrays.asList("ChatApp1"),
+ * Arrays.asList(new ComponentName("ChatApp2", "act1"),
+ * new ComponentName("ChatApp2", "act2")));}
+ *
+ * @throws UnsupportedOperationException if not called by the UID that owns the
+ * {@link android.service.intelligence.IntelligenceService} associated with the
+ * current user.
+ *
+ * @hide
+ */
+ @SystemApi
+ public void setContentCaptureWhitelist(@Nullable List<String> packages,
+ @Nullable List<ComponentName> activities) {
+ //TODO(b/111276913): implement
+ }
+
+ /**
+ * Called by the the service {@link android.service.intelligence.IntelligenceService}
* to define whether content capture should be enabled for activities of the app with such
* {@code packageName}.
*