xref: /aosp_15_r20/cts/tests/tests/binder_ndk/libbinder_ndk_test/test_package/ITest.aidl (revision b7c941bb3fa97aba169d73cee0bed2de8ac964bf)
1 /*
2  * Copyright (C) 2018 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 test_package;
18 
19 import test_package.ByteEnum;
20 import test_package.Foo;
21 import test_package.IEmpty;
22 import test_package.IntEnum;
23 import test_package.LongEnum;
24 import test_package.RegularPolygon;
25 import test_package.GenericBar;
26 import test_package.ExtendableParcelable;
27 import test_package.SimpleUnion;
28 import android.os.PersistableBundle;
29 
30 // This test interface is used in order to test the all of the things that AIDL can generate which
31 // build on top of the NDK.
32 //
33 // Repeat => return the same value. This is used to keep the clients/tests simple.
34 interface ITest {
35     const int kZero = 0;
36     const int kOne = 1;
37     const int kOnes = 0xffffffff;
38     const byte kByteOne = 1;
39     const long kLongOnes = 0xffffffffffffffff;
40     const String kEmpty = "";
41     const String kFoo = "foo";
42 
GetName()43     String GetName();
44 
TestVoidReturn()45     void TestVoidReturn();
TestOneway()46     oneway void TestOneway();
47 
GiveMeMyCallingPid()48     int GiveMeMyCallingPid();
GiveMeMyCallingUid()49     int GiveMeMyCallingUid();
50 
51     // This must be called before calling one of the give-me methods below
CacheCallingInfoFromOneway()52     oneway void CacheCallingInfoFromOneway();
GiveMeMyCallingPidFromOneway()53     int GiveMeMyCallingPidFromOneway();
GiveMeMyCallingUidFromOneway()54     int GiveMeMyCallingUidFromOneway();
55 
56     // Sending/receiving primitive types.
RepeatInt(int value)57     int RepeatInt(int value);
RepeatLong(long value)58     long RepeatLong(long value);
RepeatFloat(float value)59     float RepeatFloat(float value);
RepeatDouble(double value)60     double RepeatDouble(double value);
RepeatBoolean(boolean value)61     boolean RepeatBoolean(boolean value);
RepeatChar(char value)62     char RepeatChar(char value);
RepeatByte(byte value)63     byte RepeatByte(byte value);
RepeatByteEnum(ByteEnum value)64     ByteEnum RepeatByteEnum(ByteEnum value);
RepeatIntEnum(IntEnum value)65     IntEnum RepeatIntEnum(IntEnum value);
RepeatLongEnum(LongEnum value)66     LongEnum RepeatLongEnum(LongEnum value);
67 
RepeatBinder(IBinder value)68     IBinder RepeatBinder(IBinder value);
RepeatNullableBinder(@ullable IBinder value)69     @nullable IBinder RepeatNullableBinder(@nullable IBinder value);
RepeatInterface(IEmpty value)70     IEmpty RepeatInterface(IEmpty value);
RepeatNullableInterface(@ullable IEmpty value)71     @nullable IEmpty RepeatNullableInterface(@nullable IEmpty value);
72 
RepeatFd(in ParcelFileDescriptor fd)73     ParcelFileDescriptor RepeatFd(in ParcelFileDescriptor fd);
RepeatNullableFd(in @ullable ParcelFileDescriptor fd)74     @nullable ParcelFileDescriptor RepeatNullableFd(in @nullable ParcelFileDescriptor fd);
75 
RepeatString(String value)76     String RepeatString(String value);
RepeatNullableString(@ullable String value)77     @nullable String RepeatNullableString(@nullable String value);
78 
RepeatPolygon(in RegularPolygon value)79     RegularPolygon RepeatPolygon(in RegularPolygon value);
RepeatNullablePolygon(in @ullable RegularPolygon value)80     @nullable RegularPolygon RepeatNullablePolygon(in @nullable RegularPolygon value);
81 
RepeatPersistableBundle(in PersistableBundle input)82     PersistableBundle RepeatPersistableBundle(in PersistableBundle input);
83 
84     // Testing inout
RenamePolygon(inout RegularPolygon value, String newName)85     void RenamePolygon(inout RegularPolygon value, String newName);
86 
87     // Arrays
RepeatBooleanArray(in boolean[] input, out boolean[] repeated)88     boolean[] RepeatBooleanArray(in boolean[] input, out boolean[] repeated);
RepeatByteArray(in byte[] input, out byte[] repeated)89     byte[] RepeatByteArray(in byte[] input, out byte[] repeated);
RepeatCharArray(in char[] input, out char[] repeated)90     char[] RepeatCharArray(in char[] input, out char[] repeated);
RepeatIntArray(in int[] input, out int[] repeated)91     int[] RepeatIntArray(in int[] input, out int[] repeated);
RepeatLongArray(in long[] input, out long[] repeated)92     long[] RepeatLongArray(in long[] input, out long[] repeated);
RepeatFloatArray(in float[] input, out float[] repeated)93     float[] RepeatFloatArray(in float[] input, out float[] repeated);
RepeatDoubleArray(in double[] input, out double[] repeated)94     double[] RepeatDoubleArray(in double[] input, out double[] repeated);
RepeatByteEnumArray(in ByteEnum[] input, out ByteEnum[] repeated)95     ByteEnum[] RepeatByteEnumArray(in ByteEnum[] input, out ByteEnum[] repeated);
RepeatIntEnumArray(in IntEnum[] input, out IntEnum[] repeated)96     IntEnum[] RepeatIntEnumArray(in IntEnum[] input, out IntEnum[] repeated);
RepeatLongEnumArray(in LongEnum[] input, out LongEnum[] repeated)97     LongEnum[] RepeatLongEnumArray(in LongEnum[] input, out LongEnum[] repeated);
RepeatStringArray(in String[] input, out String[] repeated)98     String[] RepeatStringArray(in String[] input, out String[] repeated);
RepeatRegularPolygonArray(in RegularPolygon[] input, out RegularPolygon[] repeated)99     RegularPolygon[] RepeatRegularPolygonArray(in RegularPolygon[] input, out RegularPolygon[] repeated);
RepeatFdArray(in ParcelFileDescriptor[] input, out ParcelFileDescriptor[] repeated)100     ParcelFileDescriptor[] RepeatFdArray(in ParcelFileDescriptor[] input, out ParcelFileDescriptor[] repeated);
RepeatBinderArray(in IBinder[] input, out IBinder[] repeated)101     IBinder[] RepeatBinderArray(in IBinder[] input, out IBinder[] repeated);
RepeatInterfaceArray(in IEmpty[] input, out IEmpty[] repeated)102     IEmpty[] RepeatInterfaceArray(in IEmpty[] input, out IEmpty[] repeated);
103 
104     // Lists
Repeat2StringList(in List<String> input, out List<String> repeated)105     List<String> Repeat2StringList(in List<String> input, out List<String> repeated);
Repeat2RegularPolygonList(in List<RegularPolygon> input, out List<RegularPolygon> repeated)106     List<RegularPolygon> Repeat2RegularPolygonList(in List<RegularPolygon> input, out List<RegularPolygon> repeated);
107 
108     // Nullable Arrays
RepeatNullableBooleanArray(in @ullable boolean[] input)109     @nullable boolean[] RepeatNullableBooleanArray(in @nullable boolean[] input);
RepeatNullableByteArray(in @ullable byte[] input)110     @nullable byte[] RepeatNullableByteArray(in @nullable byte[] input);
RepeatNullableCharArray(in @ullable char[] input)111     @nullable char[] RepeatNullableCharArray(in @nullable char[] input);
RepeatNullableIntArray(in @ullable int[] input)112     @nullable int[] RepeatNullableIntArray(in @nullable int[] input);
RepeatNullableLongArray(in @ullable long[] input)113     @nullable long[] RepeatNullableLongArray(in @nullable long[] input);
RepeatNullableFloatArray(in @ullable float[] input)114     @nullable float[] RepeatNullableFloatArray(in @nullable float[] input);
RepeatNullableDoubleArray(in @ullable double[] input)115     @nullable double[] RepeatNullableDoubleArray(in @nullable double[] input);
RepeatNullableByteEnumArray(in @ullable ByteEnum[] input)116     @nullable ByteEnum[] RepeatNullableByteEnumArray(in @nullable ByteEnum[] input);
RepeatNullableIntEnumArray(in @ullable IntEnum[] input)117     @nullable IntEnum[] RepeatNullableIntEnumArray(in @nullable IntEnum[] input);
RepeatNullableLongEnumArray(in @ullable LongEnum[] input)118     @nullable LongEnum[] RepeatNullableLongEnumArray(in @nullable LongEnum[] input);
RepeatNullableStringArray(in @ullable String[] input)119     @nullable String[] RepeatNullableStringArray(in @nullable String[] input);
RepeatNullableBinderArray(in @ullable IBinder[] input)120     @nullable IBinder[] RepeatNullableBinderArray(in @nullable IBinder[] input);
RepeatNullableInterfaceArray(in @ullable IEmpty[] input)121     @nullable IEmpty[] RepeatNullableInterfaceArray(in @nullable IEmpty[] input);
122 
123     // Nullable Arrays where each individual element can be nullable
124     // (specifically for testing out parameters)
DoubleRepeatNullableStringArray( in @ullable String[] input, out @nullable String[] repeated)125     @nullable String[] DoubleRepeatNullableStringArray(
126         in @nullable String[] input, out @nullable String[] repeated);
127 
repeatFoo(in Foo inFoo)128     Foo repeatFoo(in Foo inFoo);
renameFoo(inout Foo foo, String name)129     void renameFoo(inout Foo foo, String name);
renameBar(inout Foo foo, String name)130     void renameBar(inout Foo foo, String name);
getF(in Foo foo)131     int getF(in Foo foo);
132 
repeatGenericBar(in GenericBar<int> bar)133     GenericBar<int> repeatGenericBar(in GenericBar<int> bar);
134 
RepeatExtendableParcelable(in ExtendableParcelable input, out ExtendableParcelable output)135     void RepeatExtendableParcelable(in ExtendableParcelable input, out ExtendableParcelable output);
136 
RepeatSimpleUnion(in SimpleUnion u)137     SimpleUnion RepeatSimpleUnion(in SimpleUnion u);
138 
getICompatTest()139     IBinder getICompatTest();
140 
RepeatExtendableParcelableWithoutExtension(in ExtendableParcelable input, out ExtendableParcelable output)141     void RepeatExtendableParcelableWithoutExtension(in ExtendableParcelable input, out ExtendableParcelable output);
142 
getLegacyBinderTest()143     IBinder getLegacyBinderTest();
144 }
145