summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/service/contentcapture/ContentCaptureService.java18
-rw-r--r--core/java/android/service/contentcapture/IContentCaptureServiceCallback.aidl4
-rw-r--r--core/java/android/view/contentcapture/ContentCaptureManager.java35
-rw-r--r--core/java/android/view/contentcapture/IContentCaptureManager.aidl5
4 files changed, 22 insertions, 40 deletions
diff --git a/core/java/android/service/contentcapture/ContentCaptureService.java b/core/java/android/service/contentcapture/ContentCaptureService.java
index b60fbc593b1c..d361a2c50935 100644
--- a/core/java/android/service/contentcapture/ContentCaptureService.java
+++ b/core/java/android/service/contentcapture/ContentCaptureService.java
@@ -284,6 +284,24 @@ public abstract class ContentCaptureService extends Service {
}
/**
+ * Disables the Content Capture service for the given user.
+ */
+ public final void disableContentCaptureServices() {
+ if (DEBUG) Log.d(TAG, "disableContentCaptureServices()");
+
+ final IContentCaptureServiceCallback callback = mCallback;
+ if (callback == null) {
+ Log.w(TAG, "disableContentCaptureServices(): no server callback");
+ return;
+ }
+ try {
+ callback.disableSelf();
+ } catch (RemoteException e) {
+ e.rethrowFromSystemServer();
+ }
+ }
+
+ /**
* Called when the Android system disconnects from the service.
*
* <p> At this point this service may no longer be an active {@link AutofillService}.
diff --git a/core/java/android/service/contentcapture/IContentCaptureServiceCallback.aidl b/core/java/android/service/contentcapture/IContentCaptureServiceCallback.aidl
index 2a729b6dc874..8bc8defede80 100644
--- a/core/java/android/service/contentcapture/IContentCaptureServiceCallback.aidl
+++ b/core/java/android/service/contentcapture/IContentCaptureServiceCallback.aidl
@@ -17,7 +17,6 @@
package android.service.contentcapture;
import android.content.ComponentName;
-import com.android.internal.os.IResultReceiver;
import java.util.List;
@@ -28,4 +27,5 @@ import java.util.List;
*/
oneway interface IContentCaptureServiceCallback {
void setContentCaptureWhitelist(in List<String> packages, in List<ComponentName> activities);
-}
+ void disableSelf();
+ }
diff --git a/core/java/android/view/contentcapture/ContentCaptureManager.java b/core/java/android/view/contentcapture/ContentCaptureManager.java
index 99063083e229..87e358c1165f 100644
--- a/core/java/android/view/contentcapture/ContentCaptureManager.java
+++ b/core/java/android/view/contentcapture/ContentCaptureManager.java
@@ -327,39 +327,8 @@ public final class ContentCaptureManager {
case RESULT_CODE_NOT_SERVICE:
throw new SecurityException("caller is not user's ContentCapture service");
default:
- throw new IllegalStateException("received invalid result: " + resultCode);
- }
- }
-
- /**
- * Sets whether Content Capture is enabled for the given user.
- *
- * @throws SecurityException if caller is not the app that owns the Content Capture service
- * associated with the user.
- *
- * @hide
- */
- @SystemApi
- @TestApi
- public void setContentCaptureFeatureEnabled(boolean enabled) {
- if (sDebug) Log.d(TAG, "setContentCaptureFeatureEnabled(): setting to " + enabled);
-
- final SyncResultReceiver resultReceiver = new SyncResultReceiver(SYNC_CALLS_TIMEOUT_MS);
- final int resultCode;
- try {
- mService.setContentCaptureFeatureEnabled(enabled, resultReceiver);
- resultCode = resultReceiver.getIntResult();
- } catch (RemoteException e) {
- throw e.rethrowFromSystemServer();
- }
- switch (resultCode) {
- case RESULT_CODE_TRUE:
- // Our work is done here, in our void existance...
- return;
- case RESULT_CODE_NOT_SERVICE:
- throw new SecurityException("caller is not user's ContentCapture service");
- default:
- throw new IllegalStateException("received invalid result: " + resultCode);
+ Log.wtf(TAG, "received invalid result: " + resultCode);
+ return false;
}
}
diff --git a/core/java/android/view/contentcapture/IContentCaptureManager.aidl b/core/java/android/view/contentcapture/IContentCaptureManager.aidl
index 26cf34c1b88e..e3b0372a8cc7 100644
--- a/core/java/android/view/contentcapture/IContentCaptureManager.aidl
+++ b/core/java/android/view/contentcapture/IContentCaptureManager.aidl
@@ -67,9 +67,4 @@ oneway interface IContentCaptureManager {
* Returns whether the content capture feature is enabled for the calling user.
*/
void isContentCaptureFeatureEnabled(in IResultReceiver result);
-
- /**
- * Sets whether the content capture feature is enabled for the given user.
- */
- void setContentCaptureFeatureEnabled(boolean enabled, in IResultReceiver result);
}