1 /* 2 * Copyright (C) 2022 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 com.android.server.ambientcontext; 18 19 import android.annotation.NonNull; 20 import android.app.ambientcontext.AmbientContextEvent; 21 import android.app.ambientcontext.AmbientContextEventRequest; 22 import android.os.RemoteCallback; 23 24 import java.io.PrintWriter; 25 26 /** 27 * Interface for a remote service implementing Ambient Context Detection Service capabilities. 28 */ 29 interface RemoteAmbientDetectionService { 30 /** 31 * Asks the implementation to start detection. 32 * 33 * @param request The request with events to detect, and optional detection options. 34 * @param packageName The app package that requested the detection 35 * @param detectionResultCallback callback for detection results 36 * @param statusCallback callback for service status 37 */ startDetection( @onNull AmbientContextEventRequest request, String packageName, RemoteCallback detectionResultCallback, RemoteCallback statusCallback)38 void startDetection( 39 @NonNull AmbientContextEventRequest request, String packageName, 40 RemoteCallback detectionResultCallback, RemoteCallback statusCallback); 41 42 /** 43 * Asks the implementation to stop detection. 44 * 45 * @param packageName stop detection for the given package 46 */ stopDetection(String packageName)47 void stopDetection(String packageName); 48 49 /** 50 * Asks the implementation to return the event status for the package. 51 */ queryServiceStatus( @mbientContextEvent.EventCode int[] eventTypes, String packageName, RemoteCallback callback)52 void queryServiceStatus( 53 @AmbientContextEvent.EventCode int[] eventTypes, 54 String packageName, 55 RemoteCallback callback); 56 57 /** 58 * Dumps the RemoteAmbientDetectionService. 59 */ dump(@onNull String prefix, @NonNull PrintWriter pw)60 void dump(@NonNull String prefix, @NonNull PrintWriter pw); 61 62 /** 63 * Unbinds from the remote service. 64 */ unbind()65 void unbind(); 66 } 67