From f876b914461c5492d94db15fa864304fb33e0578 Mon Sep 17 00:00:00 2001 From: Joanne Chung Date: Thu, 4 Mar 2021 17:40:22 +0800 Subject: [PATCH] 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 --- core/java/android/content/ContentCaptureOptions.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/java/android/content/ContentCaptureOptions.java b/core/java/android/content/ContentCaptureOptions.java index c296bb52e73d2..77072890a1eb0 100644 --- a/core/java/android/content/ContentCaptureOptions.java +++ b/core/java/android/content/ContentCaptureOptions.java @@ -134,7 +134,8 @@ public final class ContentCaptureOptions implements Parcelable { 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!"); }