• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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     /**
32      * Remove idle self-managed associations.
33      */
removeInactiveSelfManagedAssociations()34     void removeInactiveSelfManagedAssociations();
35 
36     /**
37      * Registers a callback from an InCallService / ConnectionService to CDM to process sync
38      * requests and perform call control actions.
39      */
registerCallMetadataSyncCallback(CrossDeviceSyncControllerCallback callback, @CrossDeviceSyncControllerCallback.Type int type)40     void registerCallMetadataSyncCallback(CrossDeviceSyncControllerCallback callback,
41             @CrossDeviceSyncControllerCallback.Type int type);
42 
43     /**
44      * Requests a sync from an InCallService / ConnectionService to CDM, for the given association
45      * and message.
46      */
sendCrossDeviceSyncMessage(int associationId, byte[] message)47     void sendCrossDeviceSyncMessage(int associationId, byte[] message);
48 
49     /** Sends the provided message to all active associations for the specified user. */
sendCrossDeviceSyncMessageToAllDevices(int userId, byte[] message)50     void sendCrossDeviceSyncMessageToAllDevices(int userId, byte[] message);
51 
52     /** Mark a call id as "self owned" (i.e. this device owns the canonical call). */
addSelfOwnedCallId(String callId)53     void addSelfOwnedCallId(String callId);
54 
55     /** Unmark a call id as "self owned" (i.e. this device no longer owns the canonical call). */
removeSelfOwnedCallId(String callId)56     void removeSelfOwnedCallId(String callId);
57 
58     /**
59      * Requests a sync from an InCallService to CDM, for the given user and call metadata.
60      */
crossDeviceSync(int userId, Collection<CrossDeviceCall> calls)61     void crossDeviceSync(int userId, Collection<CrossDeviceCall> calls);
62 
63     /**
64      * Requests a sync from an InCallService to CDM, for the given association and call metadata.
65      */
crossDeviceSync(AssociationInfo associationInfo, Collection<CrossDeviceCall> calls)66     void crossDeviceSync(AssociationInfo associationInfo, Collection<CrossDeviceCall> calls);
67 }
68