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