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 import android.os.Bundle; 20 21 interface ICrossProfileService { 22 // When making a call containing params larger than 23 // CrossProfileSender.MAX_BYTES_PER_BLOCK bytes, first split the marshalled 24 // params parcel byte array into blocks of 25 // CrossProfileSender.MAX_BYTES_PER_BLOCK bytes, and call prepareCall with 26 // all but the final block. 27 // callId is arbitrary and is used to link together calls to prepareCall and 28 // call. 29 // numBytes represents the full amount of bytes in total across all blocks 30 // and is used to prepare the cache with the first use of prepareCall prepareCall(long callId, int blockId, int numBytes, in byte[] params)31 void prepareCall(long callId, int blockId, int numBytes, in byte[] params); 32 33 prepareBundle(long callId, int bundleId, in Bundle bundle)34 void prepareBundle(long callId, int bundleId, in Bundle bundle); 35 36 // When making a call with params smaller than 37 // CrossProfileSender.MAX_BYTES_PER_BLOCK bytes bytes, or with the final 38 // block in a larger call, this method is used. 39 // crossProfileTypeIdentifier and methodIdentifier are used to identify the 40 // method to call. call(long callId, int blockId, long crossProfileTypeIdentifier, int methodIdentifier, in byte[] params, ICrossProfileCallback callback)41 byte[] call(long callId, int blockId, long crossProfileTypeIdentifier, int methodIdentifier, in byte[] params, 42 ICrossProfileCallback callback); 43 fetchResponse(long callId, int blockId)44 byte[] fetchResponse(long callId, int blockId); 45 fetchResponseBundle(long callId, int bundleId)46 Bundle fetchResponseBundle(long callId, int bundleId); 47 }