From 3186bcdedac9432909b8821dfed23c3db12a1866 Mon Sep 17 00:00:00 2001 From: Felipe Leme Date: Thu, 31 Jan 2019 17:53:46 -0800 Subject: [PATCH] Removed the Content Capture blacklist APIs. We'll initially implement just the whitelist ones... Bug: 122595322 Test: m update-api Test: atest CtsContentCaptureServiceTestCases Change-Id: I403716905d429abb2e1cb4085c838706226e9969 --- api/system-current.txt | 4 - .../contentcapture/ContentCaptureService.java | 76 ------------------- .../IContentCaptureServiceCallback.aidl | 4 - .../ContentCapturePerUserService.java | 31 -------- 4 files changed, 115 deletions(-) diff --git a/api/system-current.txt b/api/system-current.txt index 43d055b1199b4..3205db7837b60 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -6275,8 +6275,6 @@ package android.service.contentcapture { public abstract class ContentCaptureService extends android.app.Service { ctor public ContentCaptureService(); - method @NonNull public final java.util.Set getContentCaptureDisabledActivities(); - method @NonNull public final java.util.Set getContentCaptureDisabledPackages(); method public void onActivitySnapshot(@NonNull android.view.contentcapture.ContentCaptureSessionId, @NonNull android.service.contentcapture.SnapshotData); method public void onConnected(); method public void onContentCaptureEvent(@NonNull android.view.contentcapture.ContentCaptureSessionId, @NonNull android.view.contentcapture.ContentCaptureEvent); @@ -6285,9 +6283,7 @@ package android.service.contentcapture { method public void onDestroyContentCaptureSession(@NonNull android.view.contentcapture.ContentCaptureSessionId); method public void onDisconnected(); method public void onUserDataRemovalRequest(@NonNull android.view.contentcapture.UserDataRemovalRequest); - method public final void setActivityContentCaptureEnabled(@NonNull android.content.ComponentName, boolean); method public final void setContentCaptureWhitelist(@Nullable java.util.List, @Nullable java.util.List); - method public final void setPackageContentCaptureEnabled(@NonNull String, boolean); field public static final String SERVICE_INTERFACE = "android.service.contentcapture.ContentCaptureService"; } diff --git a/core/java/android/service/contentcapture/ContentCaptureService.java b/core/java/android/service/contentcapture/ContentCaptureService.java index 020de7f24048e..cc2e59a073cab 100644 --- a/core/java/android/service/contentcapture/ContentCaptureService.java +++ b/core/java/android/service/contentcapture/ContentCaptureService.java @@ -48,9 +48,7 @@ import com.android.internal.os.IResultReceiver; import java.io.FileDescriptor; import java.io.PrintWriter; -import java.util.Collections; import java.util.List; -import java.util.Set; /** * A service used to capture the content of the screen to provide contextual data in other areas of @@ -166,10 +164,6 @@ public abstract class ContentCaptureService extends Service { /** * Explicitly limits content capture to the given packages and activities. * - *

When the whitelist is set, it overrides the values passed to - * {@link #setActivityContentCaptureEnabled(ComponentName, boolean)} - * and {@link #setPackageContentCaptureEnabled(String, boolean)}. - * *

To reset the whitelist, call it passing {@code null} to both arguments. * *

Useful when the service wants to restrict content capture to a category of apps, like @@ -193,76 +187,6 @@ public abstract class ContentCaptureService extends Service { } } - /** - * Defines whether content capture should be enabled for activities with such - * {@link android.content.ComponentName}. - * - *

Useful to blacklist a particular activity. - */ - public final void setActivityContentCaptureEnabled(@NonNull ComponentName activity, - boolean enabled) { - final IContentCaptureServiceCallback callback = mCallback; - if (callback == null) { - Log.w(TAG, "setActivityContentCaptureEnabled(): no server callback"); - return; - } - try { - callback.setActivityContentCaptureEnabled(activity, enabled); - } catch (RemoteException e) { - e.rethrowFromSystemServer(); - } - } - - /** - * Defines whether content capture should be enabled for activities of the app with such - * {@code packageName}. - * - *

Useful to blacklist any activity from a particular app. - */ - public final void setPackageContentCaptureEnabled(@NonNull String packageName, - boolean enabled) { - final IContentCaptureServiceCallback callback = mCallback; - if (callback == null) { - Log.w(TAG, "setPackageContentCaptureEnabled(): no server callback"); - return; - } - try { - callback.setPackageContentCaptureEnabled(packageName, enabled); - } catch (RemoteException e) { - e.rethrowFromSystemServer(); - } - } - - /** - * Gets the activities where content capture was disabled by - * {@link #setActivityContentCaptureEnabled(ComponentName, boolean)}. - */ - @NonNull - public final Set getContentCaptureDisabledActivities() { - final IContentCaptureServiceCallback callback = mCallback; - if (callback == null) { - Log.w(TAG, "getContentCaptureDisabledActivities(): no server callback"); - return Collections.emptySet(); - } - //TODO(b/122595322): implement (using SyncResultReceiver) - return null; - } - - /** - * Gets the apps where content capture was disabled by - * {@link #setPackageContentCaptureEnabled(String, boolean)}. - */ - @NonNull - public final Set getContentCaptureDisabledPackages() { - final IContentCaptureServiceCallback callback = mCallback; - if (callback == null) { - Log.w(TAG, "getContentCaptureDisabledPackages(): no server callback"); - return Collections.emptySet(); - } - //TODO(b/122595322): implement (using SyncResultReceiver) - return null; - } - /** * Called when the Android system connects to service. * diff --git a/core/java/android/service/contentcapture/IContentCaptureServiceCallback.aidl b/core/java/android/service/contentcapture/IContentCaptureServiceCallback.aidl index e84bd6fdf2b69..2a729b6dc8748 100644 --- a/core/java/android/service/contentcapture/IContentCaptureServiceCallback.aidl +++ b/core/java/android/service/contentcapture/IContentCaptureServiceCallback.aidl @@ -28,8 +28,4 @@ import java.util.List; */ oneway interface IContentCaptureServiceCallback { void setContentCaptureWhitelist(in List packages, in List activities); - void setActivityContentCaptureEnabled(in ComponentName activity, boolean enabled); - void setPackageContentCaptureEnabled(in String packageName, boolean enabled); - void getContentCaptureDisabledActivities(in IResultReceiver receiver); - void getContentCaptureDisabledPackages(in IResultReceiver receiver); } diff --git a/services/contentcapture/java/com/android/server/contentcapture/ContentCapturePerUserService.java b/services/contentcapture/java/com/android/server/contentcapture/ContentCapturePerUserService.java index bc0e19a690400..b487b0d59fc90 100644 --- a/services/contentcapture/java/com/android/server/contentcapture/ContentCapturePerUserService.java +++ b/services/contentcapture/java/com/android/server/contentcapture/ContentCapturePerUserService.java @@ -406,36 +406,5 @@ final class ContentCapturePerUserService // TODO(b/122595322): implement // TODO(b/119613670): log metrics } - - @Override - public void setActivityContentCaptureEnabled(ComponentName activity, boolean enabled) { - if (mMaster.verbose) { - Log.v(TAG, "setActivityContentCaptureEnabled(activity=" + activity + ", enabled=" - + enabled + ")"); - } - // TODO(b/122595322): implement - // TODO(b/119613670): log metrics - } - - @Override - public void setPackageContentCaptureEnabled(String packageName, boolean enabled) { - if (mMaster.verbose) { - Log.v(TAG, - "setPackageContentCaptureEnabled(packageName=" + packageName + ", enabled=" - + enabled + ")"); - } - // TODO(b/122595322): implement - // TODO(b/119613670): log metrics - } - - @Override - public void getContentCaptureDisabledActivities(IResultReceiver receiver) { - // TODO(b/122595322): implement - } - - @Override - public void getContentCaptureDisabledPackages(IResultReceiver receiver) { - // TODO(b/122595322): implement - } } }