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