1 /* 2 * Copyright (C) 2018 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.view.contentcapture; 18 19 import android.content.ComponentName; 20 import android.content.pm.ParceledListSlice; 21 import android.view.contentcapture.ContentCaptureContext; 22 import android.view.contentcapture.ContentCaptureEvent; 23 import android.view.contentcapture.DataRemovalRequest; 24 import android.view.contentcapture.DataShareRequest; 25 import android.view.contentcapture.IDataShareWriteAdapter; 26 import android.view.contentcapture.IContentCaptureOptionsCallback; 27 import android.os.IBinder; 28 import android.os.ICancellationSignal; 29 30 import com.android.internal.os.IResultReceiver; 31 32 import java.util.List; 33 34 /** 35 * Interface between an app (ContentCaptureManager / ContentCaptureSession) and the system-server 36 * implementation service (ContentCaptureManagerService). 37 * 38 * @hide 39 */ 40 oneway interface IContentCaptureManager { 41 /** 42 * Starts a new session for the calling user running as part of the 43 * app's activity identified by {@code activityToken}/{@code componentName}. 44 * 45 * @param sessionId Unique session id as provided by the app. 46 * @param flags Meta flags that enable or disable content capture (see 47 * {@link IContentCaptureContext#flags}). 48 */ startSession(IBinder activityToken, IBinder shareableActivityToken, in ComponentName componentName, int sessionId, int flags, in IResultReceiver result)49 void startSession(IBinder activityToken, IBinder shareableActivityToken, 50 in ComponentName componentName, int sessionId, int flags, 51 in IResultReceiver result); 52 53 /** 54 * Marks the end of a session for the calling user identified by 55 * the corresponding {@code startSession}'s {@code sessionId}. 56 */ finishSession(int sessionId)57 void finishSession(int sessionId); 58 59 /** 60 * Returns the content capture service's component name (if enabled and 61 * connected). 62 * @param Receiver of the content capture service's @{code ComponentName} 63 * provided {@code Bundle} with key "{@code EXTRA}". 64 */ getServiceComponentName(in IResultReceiver result)65 void getServiceComponentName(in IResultReceiver result); 66 67 /** 68 * Requests the removal of content catpure data for the calling user. 69 */ removeData(in DataRemovalRequest request)70 void removeData(in DataRemovalRequest request); 71 72 /** 73 * Requests sharing of a binary data with the content capture service. 74 */ shareData(in DataShareRequest request, in IDataShareWriteAdapter adapter)75 void shareData(in DataShareRequest request, in IDataShareWriteAdapter adapter); 76 77 /** 78 * Returns whether the content capture feature is enabled for the calling user. 79 */ isContentCaptureFeatureEnabled(in IResultReceiver result)80 void isContentCaptureFeatureEnabled(in IResultReceiver result); 81 82 /** 83 * Returns a ComponentName with the name of custom service activity, if defined. 84 */ getServiceSettingsActivity(in IResultReceiver result)85 void getServiceSettingsActivity(in IResultReceiver result); 86 87 /** 88 * Returns a list with the ContentCaptureConditions for the package (or null if not defined). 89 */ getContentCaptureConditions(String packageName, in IResultReceiver result)90 void getContentCaptureConditions(String packageName, in IResultReceiver result); 91 92 /** 93 * Resets the temporary service implementation to the default component. 94 */ resetTemporaryService(int userId)95 void resetTemporaryService(int userId); 96 97 /** 98 * Temporarily sets the service implementation. 99 */ setTemporaryService(int userId, in String serviceName, int duration)100 void setTemporaryService(int userId, in String serviceName, int duration); 101 102 /** 103 * Sets whether the default service should be used. 104 */ setDefaultServiceEnabled(int userId, boolean enabled)105 void setDefaultServiceEnabled(int userId, boolean enabled); 106 107 /** 108 * Registers a listener to handle updates ContentCaptureOptions from server. 109 */ registerContentCaptureOptionsCallback(String packageName, in IContentCaptureOptionsCallback callback)110 void registerContentCaptureOptionsCallback(String packageName, 111 in IContentCaptureOptionsCallback callback); 112 113 /** 114 * Notifies the system server that a login was detected. 115 */ onLoginDetected(in ParceledListSlice<ContentCaptureEvent> events)116 void onLoginDetected(in ParceledListSlice<ContentCaptureEvent> events); 117 } 118