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 34 // Test that primitives work as parameters and return types. RepeatBoolean(boolean token)35 boolean RepeatBoolean(boolean token); RepeatByte(byte token)36 byte RepeatByte(byte token); RepeatChar(char token)37 char RepeatChar(char token); RepeatInt(int token)38 int RepeatInt(int token); RepeatLong(long token)39 long RepeatLong(long token); RepeatFloat(float token)40 float RepeatFloat(float token); RepeatDouble(double token)41 double RepeatDouble(double token); RepeatString(String token)42 String RepeatString(String token); 43 RepeatSimpleParcelable(in SimpleParcelable input, out SimpleParcelable repeat)44 SimpleParcelable RepeatSimpleParcelable(in SimpleParcelable input, 45 out SimpleParcelable repeat); RepeatPersistableBundle(in PersistableBundle input)46 PersistableBundle RepeatPersistableBundle(in PersistableBundle input); 47 48 // Test that arrays work as parameters and return types. ReverseBoolean(in boolean[] input, out boolean[] repeated)49 boolean[] ReverseBoolean(in boolean[] input, out boolean[] repeated); ReverseByte(in byte[] input, out byte[] repeated)50 byte[] ReverseByte (in byte[] input, out byte[] repeated); ReverseChar(in char[] input, out char[] repeated)51 char[] ReverseChar (in char[] input, out char[] repeated); ReverseInt(in int[] input, out int[] repeated)52 int[] ReverseInt (in int[] input, out int[] repeated); ReverseLong(in long[] input, out long[] repeated)53 long[] ReverseLong (in long[] input, out long[] repeated); ReverseFloat(in float[] input, out float[] repeated)54 float[] ReverseFloat (in float[] input, out float[] repeated); ReverseDouble(in double[] input, out double[] repeated)55 double[] ReverseDouble (in double[] input, out double[] repeated); ReverseString(in String[] input, out String[] repeated)56 String[] ReverseString (in String[] input, out String[] repeated); 57 ReverseSimpleParcelables(in SimpleParcelable[] input, out SimpleParcelable[] repeated)58 SimpleParcelable[] ReverseSimpleParcelables(in SimpleParcelable[] input, 59 out SimpleParcelable[] repeated); ReversePersistableBundles( in PersistableBundle[] input, out PersistableBundle[] repeated)60 PersistableBundle[] ReversePersistableBundles( 61 in PersistableBundle[] input, out PersistableBundle[] repeated); 62 63 // Test that clients can send and receive Binders. GetOtherTestService(String name)64 INamedCallback GetOtherTestService(String name); VerifyName(INamedCallback service, String name)65 boolean VerifyName(INamedCallback service, String name); 66 67 // Test that List<T> types work correctly. ReverseStringList(in List<String> input, out List<String> repeated)68 List<String> ReverseStringList(in List<String> input, 69 out List<String> repeated); ReverseNamedCallbackList(in List<IBinder> input, out List<IBinder> repeated)70 List<IBinder> ReverseNamedCallbackList(in List<IBinder> input, 71 out List<IBinder> repeated); 72 RepeatFileDescriptor(in FileDescriptor read)73 FileDescriptor RepeatFileDescriptor(in FileDescriptor read); ReverseFileDescriptorArray(in FileDescriptor[] input, out FileDescriptor[] repeated)74 FileDescriptor[] ReverseFileDescriptorArray(in FileDescriptor[] input, 75 out FileDescriptor[] repeated); 76 77 // Test that service specific exceptions work correctly. ThrowServiceException(int code)78 void ThrowServiceException(int code); 79 80 // Test nullability RepeatNullableIntArray(in @ullable int[] input)81 @nullable int[] RepeatNullableIntArray(in @nullable int[] input); RepeatNullableString(in @ullable String input)82 @nullable String RepeatNullableString(in @nullable String input); RepeatNullableStringList(in @ullable List<String> input)83 @nullable List<String> RepeatNullableStringList(in @nullable List<String> input); RepeatNullableParcelable(in @ullable SimpleParcelable input)84 @nullable SimpleParcelable RepeatNullableParcelable(in @nullable SimpleParcelable input); 85 86 // Test utf8 decoding from utf16 wire format RepeatUtf8CppString(@tf8InCpp String token)87 @utf8InCpp String RepeatUtf8CppString(@utf8InCpp String token); RepeatNullableUtf8CppString( @ullable @tf8InCpp String token)88 @nullable @utf8InCpp String RepeatNullableUtf8CppString( 89 @nullable @utf8InCpp String token); 90 ReverseUtf8CppString(in @tf8InCpp String[] input, out @utf8InCpp String[] repeated)91 @utf8InCpp String[] ReverseUtf8CppString (in @utf8InCpp String[] input, 92 out @utf8InCpp String[] repeated); 93 ReverseUtf8CppStringList( in @ullable @tf8InCpp List<String> input, out @nullable @utf8InCpp List<String> repeated)94 @nullable @utf8InCpp List<String> ReverseUtf8CppStringList( 95 in @nullable @utf8InCpp List<String> input, 96 out @nullable @utf8InCpp List<String> repeated); 97 } 98