1 /* 2 * Copyright (C) 2015 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.aidl.tests; 18 19 import android.aidl.tests.INamedCallback; 20 import android.aidl.tests.SimpleParcelable; 21 import android.os.PersistableBundle; 22 23 interface ITestService { 24 // Test that constants are accessible 25 const int TEST_CONSTANT = 42; 26 const int TEST_CONSTANT2 = -42; 27 const int TEST_CONSTANT3 = +42; 28 const int TEST_CONSTANT4 = +4; 29 const int TEST_CONSTANT5 = -4; 30 const int TEST_CONSTANT6 = -0; 31 const int TEST_CONSTANT7 = +0; 32 const int TEST_CONSTANT8 = 0; 33 const int TEST_CONSTANT9 = 0x56; 34 const int TEST_CONSTANT10 = 0xa5; 35 const int TEST_CONSTANT11 = 0xFA; 36 const int TEST_CONSTANT12 = 0xffffffff; 37 38 const String STRING_TEST_CONSTANT = "foo"; 39 const String STRING_TEST_CONSTANT2 = "bar"; 40 41 // Test that primitives work as parameters and return types. RepeatBoolean(boolean token)42 boolean RepeatBoolean(boolean token); RepeatByte(byte token)43 byte RepeatByte(byte token); RepeatChar(char token)44 char RepeatChar(char token); RepeatInt(int token)45 int RepeatInt(int token); RepeatLong(long token)46 long RepeatLong(long token); RepeatFloat(float token)47 float RepeatFloat(float token); RepeatDouble(double token)48 double RepeatDouble(double token); RepeatString(String token)49 String RepeatString(String token); RepeatMap(in Map token)50 Map RepeatMap(in Map token); 51 RepeatSimpleParcelable(in SimpleParcelable input, out SimpleParcelable repeat)52 SimpleParcelable RepeatSimpleParcelable(in SimpleParcelable input, 53 out SimpleParcelable repeat); RepeatPersistableBundle(in PersistableBundle input)54 PersistableBundle RepeatPersistableBundle(in PersistableBundle input); 55 56 // Test that arrays work as parameters and return types. ReverseBoolean(in boolean[] input, out boolean[] repeated)57 boolean[] ReverseBoolean(in boolean[] input, out boolean[] repeated); ReverseByte(in byte[] input, out byte[] repeated)58 byte[] ReverseByte (in byte[] input, out byte[] repeated); ReverseChar(in char[] input, out char[] repeated)59 char[] ReverseChar (in char[] input, out char[] repeated); ReverseInt(in int[] input, out int[] repeated)60 int[] ReverseInt (in int[] input, out int[] repeated); ReverseLong(in long[] input, out long[] repeated)61 long[] ReverseLong (in long[] input, out long[] repeated); ReverseFloat(in float[] input, out float[] repeated)62 float[] ReverseFloat (in float[] input, out float[] repeated); ReverseDouble(in double[] input, out double[] repeated)63 double[] ReverseDouble (in double[] input, out double[] repeated); ReverseString(in String[] input, out String[] repeated)64 String[] ReverseString (in String[] input, out String[] repeated); 65 ReverseSimpleParcelables(in SimpleParcelable[] input, out SimpleParcelable[] repeated)66 SimpleParcelable[] ReverseSimpleParcelables(in SimpleParcelable[] input, 67 out SimpleParcelable[] repeated); ReversePersistableBundles( in PersistableBundle[] input, out PersistableBundle[] repeated)68 PersistableBundle[] ReversePersistableBundles( 69 in PersistableBundle[] input, out PersistableBundle[] repeated); 70 71 // Test that clients can send and receive Binders. GetOtherTestService(String name)72 INamedCallback GetOtherTestService(String name); VerifyName(INamedCallback service, String name)73 boolean VerifyName(INamedCallback service, String name); 74 75 // Test that List<T> types work correctly. ReverseStringList(in List<String> input, out List<String> repeated)76 List<String> ReverseStringList(in List<String> input, 77 out List<String> repeated); ReverseNamedCallbackList(in List<IBinder> input, out List<IBinder> repeated)78 List<IBinder> ReverseNamedCallbackList(in List<IBinder> input, 79 out List<IBinder> repeated); 80 RepeatFileDescriptor(in FileDescriptor read)81 FileDescriptor RepeatFileDescriptor(in FileDescriptor read); ReverseFileDescriptorArray(in FileDescriptor[] input, out FileDescriptor[] repeated)82 FileDescriptor[] ReverseFileDescriptorArray(in FileDescriptor[] input, 83 out FileDescriptor[] repeated); 84 85 // Test that service specific exceptions work correctly. ThrowServiceException(int code)86 void ThrowServiceException(int code); 87 88 // Test nullability RepeatNullableIntArray(in @ullable int[] input)89 @nullable int[] RepeatNullableIntArray(in @nullable int[] input); RepeatNullableString(in @ullable String input)90 @nullable String RepeatNullableString(in @nullable String input); RepeatNullableStringList(in @ullable List<String> input)91 @nullable List<String> RepeatNullableStringList(in @nullable List<String> input); RepeatNullableParcelable(in @ullable SimpleParcelable input)92 @nullable SimpleParcelable RepeatNullableParcelable(in @nullable SimpleParcelable input); 93 TakesAnIBinder(in IBinder input)94 void TakesAnIBinder(in IBinder input); TakesAnIBinderList(in List<IBinder> input)95 void TakesAnIBinderList(in List<IBinder> input); TakesANullableIBinder(in @ullable IBinder input)96 void TakesANullableIBinder(in @nullable IBinder input); TakesANullableIBinderList(in @ullable List<IBinder> input)97 void TakesANullableIBinderList(in @nullable List<IBinder> input); 98 99 // Test utf8 decoding from utf16 wire format RepeatUtf8CppString(@tf8InCpp String token)100 @utf8InCpp String RepeatUtf8CppString(@utf8InCpp String token); RepeatNullableUtf8CppString( @ullable @tf8InCpp String token)101 @nullable @utf8InCpp String RepeatNullableUtf8CppString( 102 @nullable @utf8InCpp String token); 103 ReverseUtf8CppString(in @tf8InCpp String[] input, out @utf8InCpp String[] repeated)104 @utf8InCpp String[] ReverseUtf8CppString (in @utf8InCpp String[] input, 105 out @utf8InCpp String[] repeated); 106 ReverseUtf8CppStringList( in @ullable @tf8InCpp List<String> input, out @nullable @utf8InCpp List<String> repeated)107 @nullable @utf8InCpp List<String> ReverseUtf8CppStringList( 108 in @nullable @utf8InCpp List<String> input, 109 out @nullable @utf8InCpp List<String> repeated); 110 GetCallback(boolean return_null)111 @nullable INamedCallback GetCallback(boolean return_null); 112 } 113