1 /* 2 * Copyright 2021 Google LLC 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 * https://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.google.android.enterprise.connectedapps; 17 18 import com.google.android.enterprise.connectedapps.ICrossProfileCallback; 19 20 interface ICrossProfileService { 21 // When making a call containing params larger than 22 // CrossProfileSender.MAX_BYTES_PER_BLOCK bytes, first split the marshalled 23 // params parcel byte array into blocks of 24 // CrossProfileSender.MAX_BYTES_PER_BLOCK bytes, and call prepareCall with 25 // all but the final block. 26 // callId is arbitrary and is used to link together calls to prepareCall and 27 // call. 28 // numBytes represents the full amount of bytes in total across all blocks 29 // and is used to prepare the cache with the first use of prepareCall prepareCall(long callId, int blockId, int numBytes, in byte[] params)30 void prepareCall(long callId, int blockId, int numBytes, in byte[] params); 31 32 // When making a call with params smaller than 33 // CrossProfileSender.MAX_BYTES_PER_BLOCK bytes bytes, or with the final 34 // block in a larger call, this method is used. 35 // crossProfileTypeIdentifier and methodIdentifier are used to identify the 36 // method to call. call(long callId, int blockId, long crossProfileTypeIdentifier, int methodIdentifier, in byte[] params, ICrossProfileCallback callback)37 byte[] call(long callId, int blockId, long crossProfileTypeIdentifier, int methodIdentifier, in byte[] params, 38 ICrossProfileCallback callback); 39 fetchResponse(long callId, int blockId)40 byte[] fetchResponse(long callId, int blockId); 41 }