Merge "Removed the Content Capture blacklist APIs."

This commit is contained in:
TreeHugger Robot
2019-02-04 23:04:48 +00:00
committed by Android (Google) Code Review
4 changed files with 0 additions and 115 deletions

View File

@@ -6305,8 +6305,6 @@ package android.service.contentcapture {
public abstract class ContentCaptureService extends android.app.Service {
ctor public ContentCaptureService();
method @NonNull public final java.util.Set<android.content.ComponentName> getContentCaptureDisabledActivities();
method @NonNull public final java.util.Set<java.lang.String> 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);
@@ -6315,9 +6313,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<java.lang.String>, @Nullable java.util.List<android.content.ComponentName>);
method public final void setPackageContentCaptureEnabled(@NonNull String, boolean);
field public static final String SERVICE_INTERFACE = "android.service.contentcapture.ContentCaptureService";
}

View File

@@ -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.
*
* <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
@@ -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}.
*
* <p>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}.
*
* <p>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<ComponentName> 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<String> 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.
*

View File

@@ -28,8 +28,4 @@ import java.util.List;
*/
oneway interface IContentCaptureServiceCallback {
void setContentCaptureWhitelist(in List<String> packages, in List<ComponentName> 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);
}

View File

@@ -416,36 +416,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
}
}
}