1 /* 2 * Copyright 2020 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.fmq.test; 18 19 import android.hardware.common.fmq.MQDescriptor; 20 import android.hardware.common.fmq.SynchronizedReadWrite; 21 import android.hardware.common.fmq.UnsynchronizedWrite; 22 23 /** 24 * Test interface for MQDescriptor. 25 */ 26 interface ITestAidlMsgQ { 27 /** 28 * This method requests the service to set up a synchronous read/write 29 * wait-free FMQ using the input descriptor with the client as reader. 30 * 31 * @param mqDesc This structure describes the FMQ that was set up by the 32 * client. Server uses this descriptor to set up a FMQ object at its end. 33 * 34 * @return True if the setup is successful. 35 */ configureFmqSyncReadWrite(in MQDescriptor<int, SynchronizedReadWrite> mqDesc)36 boolean configureFmqSyncReadWrite(in MQDescriptor<int, SynchronizedReadWrite> mqDesc); 37 38 /** 39 * This method requests the service to return an MQDescriptor to 40 * an unsynchronized FMQ set up by the server. If 'configureFmq' is 41 * true, then the server sets up a new unsynchronized FMQ. This 42 * method is to be used to test multiple reader processes. 43 * 44 * @param configureFmq The server sets up a new unsynchronized FMQ if 45 * this parameter is true. 46 * @param userFd True to initialize the message queue with a user supplied 47 * file descriptor for the ring buffer. 48 * False to let the message queue use a single FD for everything. 49 * 50 * @param out ret True if successful. 51 * @param out mqDesc This structure describes the unsynchronized FMQ that was 52 * set up by the service. Client can use it to set up the FMQ at its end. 53 */ getFmqUnsyncWrite(in boolean configureFmq, in boolean userFd, out MQDescriptor<int, UnsynchronizedWrite> mqDesc)54 boolean getFmqUnsyncWrite(in boolean configureFmq, in boolean userFd, 55 out MQDescriptor<int, UnsynchronizedWrite> mqDesc); 56 57 /** 58 * This method requests the service to trigger a blocking read. 59 * 60 * @param count Number of messages to read. 61 * 62 */ requestBlockingRead(in int count)63 oneway void requestBlockingRead(in int count); 64 65 /** 66 * This method requests the service to trigger a blocking read using 67 * default Event Flag notification bits defined by the MessageQueue class. 68 * 69 * @param count Number of messages to read. 70 * 71 */ requestBlockingReadDefaultEventFlagBits(in int count)72 oneway void requestBlockingReadDefaultEventFlagBits(in int count); 73 74 /** 75 * This method requests the service to repeatedly trigger blocking reads. 76 * 77 * @param count Number of messages to read in a single blocking read. 78 * @param numIter Number of blocking reads to trigger. 79 * 80 */ requestBlockingReadRepeat(in int count, in int numIter)81 oneway void requestBlockingReadRepeat(in int count, in int numIter); 82 83 /** 84 * This method request the service to read from the synchronized read/write 85 * FMQ. 86 * 87 * @param count Number to messages to read. 88 * 89 * @return True if the read operation was successful. 90 */ requestReadFmqSync(in int count)91 boolean requestReadFmqSync(in int count); 92 93 /** 94 * This method request the service to read from the unsynchronized flavor of 95 * FMQ. 96 * 97 * @param count Number to messages to read. 98 * 99 * @return Will be True if the read operation was successful. 100 */ requestReadFmqUnsync(in int count)101 boolean requestReadFmqUnsync(in int count); 102 103 /** 104 * This method request the service to write into the synchronized read/write 105 * flavor of the FMQ. 106 * 107 * @param count Number to messages to write. 108 * 109 * @return True if the write operation was successful. 110 */ requestWriteFmqSync(in int count)111 boolean requestWriteFmqSync(in int count); 112 113 /** 114 * This method request the service to write into the unsynchronized flavor 115 * of FMQ. 116 * 117 * @param count Number to messages to write. 118 * 119 * @return True if the write operation was successful. 120 */ requestWriteFmqUnsync(in int count)121 boolean requestWriteFmqUnsync(in int count); 122 } 123