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.view.contentcapture.ContentCaptureContext;
21 import android.view.contentcapture.ContentCaptureEvent;
22 import android.view.contentcapture.DataRemovalRequest;
23 import android.view.contentcapture.DataShareRequest;
24 import android.view.contentcapture.IDataShareWriteAdapter;
25 import android.os.IBinder;
26 import android.os.ICancellationSignal;
27 
28 import com.android.internal.os.IResultReceiver;
29 
30 import java.util.List;
31 
32 /**
33   * Interface between an app (ContentCaptureManager / ContentCaptureSession) and the system-server
34   * implementation service (ContentCaptureManagerService).
35   *
36   * @hide
37   */
38 oneway interface IContentCaptureManager {
39     /**
40      * Starts a new session for the calling user running as part of the
41      * app's activity identified by {@code activityToken}/{@code componentName}.
42      *
43      * @param sessionId Unique session id as provided by the app.
44      * @param flags Meta flags that enable or disable content capture (see
45      *     {@link IContentCaptureContext#flags}).
46      */
startSession(IBinder activityToken, in ComponentName componentName, int sessionId, int flags, in IResultReceiver result)47     void startSession(IBinder activityToken, in ComponentName componentName,
48                       int sessionId, int flags, in IResultReceiver result);
49 
50     /**
51      * Marks the end of a session for the calling user identified by
52      * the corresponding {@code startSession}'s {@code sessionId}.
53      */
finishSession(int sessionId)54     void finishSession(int sessionId);
55 
56     /**
57      * Returns the content capture service's component name (if enabled and
58      * connected).
59      * @param Receiver of the content capture service's @{code ComponentName}
60      *     provided {@code Bundle} with key "{@code EXTRA}".
61      */
getServiceComponentName(in IResultReceiver result)62     void getServiceComponentName(in IResultReceiver result);
63 
64     /**
65      * Requests the removal of content catpure data for the calling user.
66      */
removeData(in DataRemovalRequest request)67     void removeData(in DataRemovalRequest request);
68 
69     /**
70     * Requests sharing of a binary data with the content capture service.
71     */
shareData(in DataShareRequest request, in IDataShareWriteAdapter adapter)72     void shareData(in DataShareRequest request, in IDataShareWriteAdapter adapter);
73 
74     /**
75      * Returns whether the content capture feature is enabled for the calling user.
76      */
isContentCaptureFeatureEnabled(in IResultReceiver result)77     void isContentCaptureFeatureEnabled(in IResultReceiver result);
78 
79     /**
80      * Returns a ComponentName with the name of custom service activity, if defined.
81      */
getServiceSettingsActivity(in IResultReceiver result)82     void getServiceSettingsActivity(in IResultReceiver result);
83 
84     /**
85      * Returns a list with the ContentCaptureConditions for the package (or null if not defined).
86      */
getContentCaptureConditions(String packageName, in IResultReceiver result)87     void getContentCaptureConditions(String packageName, in IResultReceiver result);
88 }
89