Allow translation cts can add itself into allowlist for content capture
The UiTranslationManager APIs need the token that report by the
content capture, we need to have a test ContentCaptureService for
translation cts to test UiTranslationManager. So we also allow
translation cts can add itself into allow list.
Bug: 179047265
Test: atest CtsContentCaptureServiceTestCases
Test: atest CtsTranslationTestCases to make sure the service can be
connected
Change-Id: I15874ce6fc68dbb5fba0a51cf74899d2dec9bae1
diff --git a/core/java/android/content/ContentCaptureOptions.java b/core/java/android/content/ContentCaptureOptions.java
index c296bb5..7707289 100644
--- a/core/java/android/content/ContentCaptureOptions.java
+++ b/core/java/android/content/ContentCaptureOptions.java
@@ -134,7 +134,8 @@
final String packageName = at.getApplication().getPackageName();
- if (!"android.contentcaptureservice.cts".equals(packageName)) {
+ if (!"android.contentcaptureservice.cts".equals(packageName)
+ && !"android.translation.cts".equals(packageName)) {
Log.e(TAG, "forWhitelistingItself(): called by " + packageName);
throw new SecurityException("Thou shall not pass!");
}