1 /* 2 * Copyright (C) 2021 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.companion; 18 19 import android.companion.AssociationInfo; 20 21 import com.android.server.companion.datatransfer.contextsync.CrossDeviceCall; 22 import com.android.server.companion.datatransfer.contextsync.CrossDeviceSyncControllerCallback; 23 24 import java.util.Collection; 25 26 /** 27 * Companion Device Manager Local System Service Interface. 28 */ 29 public interface CompanionDeviceManagerServiceInternal { 30 /** 31 * @see CompanionDeviceManagerService#removeInactiveSelfManagedAssociations 32 */ removeInactiveSelfManagedAssociations()33 void removeInactiveSelfManagedAssociations(); 34 35 /** 36 * Registers a callback from an InCallService / ConnectionService to CDM to process sync 37 * requests and perform call control actions. 38 */ registerCallMetadataSyncCallback(CrossDeviceSyncControllerCallback callback, @CrossDeviceSyncControllerCallback.Type int type)39 void registerCallMetadataSyncCallback(CrossDeviceSyncControllerCallback callback, 40 @CrossDeviceSyncControllerCallback.Type int type); 41 42 /** 43 * Requests a sync from an InCallService / ConnectionService to CDM, for the given association 44 * and message. 45 */ sendCrossDeviceSyncMessage(int associationId, byte[] message)46 void sendCrossDeviceSyncMessage(int associationId, byte[] message); 47 48 /** Sends the provided message to all active associations for the specified user. */ sendCrossDeviceSyncMessageToAllDevices(int userId, byte[] message)49 void sendCrossDeviceSyncMessageToAllDevices(int userId, byte[] message); 50 51 /** Mark a call id as "self owned" (i.e. this device owns the canonical call). */ addSelfOwnedCallId(String callId)52 void addSelfOwnedCallId(String callId); 53 54 /** Unmark a call id as "self owned" (i.e. this device no longer owns the canonical call). */ removeSelfOwnedCallId(String callId)55 void removeSelfOwnedCallId(String callId); 56 57 /** 58 * Requests a sync from an InCallService to CDM, for the given user and call metadata. 59 */ crossDeviceSync(int userId, Collection<CrossDeviceCall> calls)60 void crossDeviceSync(int userId, Collection<CrossDeviceCall> calls); 61 62 /** 63 * Requests a sync from an InCallService to CDM, for the given association and call metadata. 64 */ crossDeviceSync(AssociationInfo associationInfo, Collection<CrossDeviceCall> calls)65 void crossDeviceSync(AssociationInfo associationInfo, Collection<CrossDeviceCall> calls); 66 } 67