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 android.car.remoteaccess; 18 19 import android.car.remoteaccess.ICarRemoteAccessCallback; 20 import android.car.remoteaccess.TaskScheduleInfo; 21 22 /** @hide */ 23 interface ICarRemoteAccessService { 24 /** 25 * General service error code. 26 */ 27 const int SERVICE_ERROR_CODE_GENERAL = 1; 28 29 /** 30 * Adds the remote task client represented as {@link ICarRemoteAccessCallback} to listen to 31 * remote access related events. 32 */ addCarRemoteTaskClient(in ICarRemoteAccessCallback callback)33 void addCarRemoteTaskClient(in ICarRemoteAccessCallback callback); 34 35 /** 36 * Removes the remote task client represented as {@link ICarRemoteAccessCallback} from 37 * CarRemoteAccessService. 38 */ removeCarRemoteTaskClient(in ICarRemoteAccessCallback callback)39 void removeCarRemoteTaskClient(in ICarRemoteAccessCallback callback); 40 41 /** 42 * Tells CarRemoteAccessService that the remote task is completed. 43 * 44 * @param clientId ID of the remote task client. 45 */ reportRemoteTaskDone(in String clientId, in String taskId)46 void reportRemoteTaskDone(in String clientId, in String taskId); 47 48 /** 49 * Sets the power state after all the remote tasks are completed. 50 * 51 * @param nextPowerState The next power state. 52 * @param runGarageMode Whether to run GarageMode. 53 */ setPowerStatePostTaskExecution(int nextPowerState, boolean runGarageMode)54 void setPowerStatePostTaskExecution(int nextPowerState, boolean runGarageMode); 55 56 /** 57 * Tells CarRemoteAccessService that the remote task client is ready for shutdown. 58 * 59 * <p>After the allowed delay(= 5s), CarRemoteAccessService moves on to shutdown the system 60 * even without this confirmation. 61 * 62 * @param clientId ID of the remote task client. 63 */ confirmReadyForShutdown(in String clientId)64 void confirmReadyForShutdown(in String clientId); 65 66 /** 67 * Returns whether task scheduling is supported. 68 */ isTaskScheduleSupported()69 boolean isTaskScheduleSupported(); 70 71 /** 72 * Schedules a task to be executed later even when the vehicle is off. 73 * 74 * <p>This sends a scheduled task message to a device external to Android so that the device 75 * can wake up Android and deliver the task through {@code ICarRemoteAccessCallback}. 76 */ scheduleTask(in TaskScheduleInfo scheduleInfo)77 void scheduleTask(in TaskScheduleInfo scheduleInfo); 78 79 /** 80 * Unschedules a scheduled task. 81 */ unscheduleTask(in String scheduleId)82 void unscheduleTask(in String scheduleId); 83 84 /** 85 * Unschedules all scheduled tasks for this client. 86 */ unscheduleAllTasks()87 void unscheduleAllTasks(); 88 89 /** 90 * Returns whether the specified task is scheduled. 91 */ isTaskScheduled(in String scheduleId)92 boolean isTaskScheduled(in String scheduleId); 93 94 /** 95 * Gets all pending scheduled tasks for this client. 96 */ getAllPendingScheduledTasks()97 List<TaskScheduleInfo> getAllPendingScheduledTasks(); 98 99 /** 100 * Gets the supported task types for scheduling. 101 * 102 * <p>If task scheduling is not supported, this returns an empty array. 103 * 104 * <p>Otherwise, this returns a list of {@code CarRemoteAccessManager.TaskType}. 105 * 106 * <p>{@code CarRemoteAccessManager.TASK_TYPE_CUSTOM} must be supported. 107 */ getSupportedTaskTypesForScheduling()108 int[] getSupportedTaskTypesForScheduling(); 109 110 /** 111 * For testing only. Add a package as a new serverless remote access client. 112 */ addServerlessRemoteTaskClient(in String packageName, in String clientId)113 void addServerlessRemoteTaskClient(in String packageName, in String clientId); 114 115 /** 116 * For testing only. Remove a package as serverless remote access client. 117 */ removeServerlessRemoteTaskClient(in String packageName)118 void removeServerlessRemoteTaskClient(in String packageName); 119 120 /** 121 * For testing only. Check whether the VHAL property: {@code VEHICLE_IN_USE} is supported. 122 */ isVehicleInUseSupported()123 boolean isVehicleInUseSupported(); 124 125 /** 126 * For testing only. Check whether the VHAL property: {@code SHUTDOWN_REQUEST} is supported. 127 */ isShutdownRequestSupported()128 boolean isShutdownRequestSupported(); 129 } 130