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 package com.android.server.contentcapture; 17 18 import android.annotation.NonNull; 19 import android.annotation.Nullable; 20 import android.annotation.UserIdInt; 21 import android.app.assist.ActivityId; 22 import android.content.ComponentName; 23 import android.content.ContentCaptureOptions; 24 import android.content.Intent; 25 import android.os.Bundle; 26 import android.os.IBinder; 27 import android.service.contentcapture.ActivityEvent.ActivityEventType; 28 29 /** 30 * ContentCapture Manager local system service interface. 31 * 32 * @hide Only for use within the system server. 33 */ 34 public abstract class ContentCaptureManagerInternal { 35 36 /** 37 * Checks whether the given {@code uid} owns the 38 * {@link android.service.contentcapture.ContentCaptureService} implementation associated with 39 * the given {@code userId}. 40 */ isContentCaptureServiceForUser(int uid, @UserIdInt int userId)41 public abstract boolean isContentCaptureServiceForUser(int uid, @UserIdInt int userId); 42 43 /** 44 * Notifies the intelligence service of new intent data associated with an activity start event. 45 * 46 * @return {@code false} if there was no service set for the given user 47 */ sendActivityStartAssistData(@serIdInt int userId, @NonNull IBinder activityToken, @NonNull Intent intentData)48 public abstract boolean sendActivityStartAssistData(@UserIdInt int userId, 49 @NonNull IBinder activityToken, @NonNull Intent intentData); 50 51 /** 52 * Notifies the intelligence service of new assist data for the given activity. 53 * 54 * @return {@code false} if there was no service set for the given user 55 */ sendActivityAssistData(@serIdInt int userId, @NonNull IBinder activityToken, @NonNull Bundle data)56 public abstract boolean sendActivityAssistData(@UserIdInt int userId, 57 @NonNull IBinder activityToken, @NonNull Bundle data); 58 59 /** 60 * Gets the content capture options for the given user and package, or {@code null} if the 61 * package is not allowlisted by the service. 62 * 63 * <p><b>NOTE: </b>this method is called by the {@code ActivityManager} service and hence cannot 64 * hold the main service lock. 65 */ 66 @Nullable getOptionsForPackage(@serIdInt int userId, @NonNull String packageName)67 public abstract ContentCaptureOptions getOptionsForPackage(@UserIdInt int userId, 68 @NonNull String packageName); 69 70 /** 71 * Notifies the intelligence service of a high-level activity event for the given user. 72 */ notifyActivityEvent(@serIdInt int userId, @NonNull ComponentName activityComponent, @ActivityEventType int eventType, @NonNull ActivityId activityId)73 public abstract void notifyActivityEvent(@UserIdInt int userId, 74 @NonNull ComponentName activityComponent, @ActivityEventType int eventType, 75 @NonNull ActivityId activityId); 76 } 77