1b5e698c8bf4efc7bcbe5fd24685968db10e62735Christopher Wiley/* 2b5e698c8bf4efc7bcbe5fd24685968db10e62735Christopher Wiley * Copyright (C) 2015 The Android Open Source Project 3b5e698c8bf4efc7bcbe5fd24685968db10e62735Christopher Wiley * 4b5e698c8bf4efc7bcbe5fd24685968db10e62735Christopher Wiley * Licensed under the Apache License, Version 2.0 (the "License"); 5b5e698c8bf4efc7bcbe5fd24685968db10e62735Christopher Wiley * you may not use this file except in compliance with the License. 6b5e698c8bf4efc7bcbe5fd24685968db10e62735Christopher Wiley * You may obtain a copy of the License at 7b5e698c8bf4efc7bcbe5fd24685968db10e62735Christopher Wiley * 8b5e698c8bf4efc7bcbe5fd24685968db10e62735Christopher Wiley * http://www.apache.org/licenses/LICENSE-2.0 9b5e698c8bf4efc7bcbe5fd24685968db10e62735Christopher Wiley * 10b5e698c8bf4efc7bcbe5fd24685968db10e62735Christopher Wiley * Unless required by applicable law or agreed to in writing, software 11b5e698c8bf4efc7bcbe5fd24685968db10e62735Christopher Wiley * distributed under the License is distributed on an "AS IS" BASIS, 12b5e698c8bf4efc7bcbe5fd24685968db10e62735Christopher Wiley * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13b5e698c8bf4efc7bcbe5fd24685968db10e62735Christopher Wiley * See the License for the specific language governing permissions and 14b5e698c8bf4efc7bcbe5fd24685968db10e62735Christopher Wiley * limitations under the License. 15b5e698c8bf4efc7bcbe5fd24685968db10e62735Christopher Wiley */ 16b5e698c8bf4efc7bcbe5fd24685968db10e62735Christopher Wiley 17521bb618fa16d0b88ae88b8dcd98b72e579f1ed4Christopher Wileypackage android.aidl.tests; 18b5e698c8bf4efc7bcbe5fd24685968db10e62735Christopher Wiley 19389781f56bb6b4363e9eb03acf915ba297f607d5Casey Dahlinimport android.aidl.tests.INamedCallback; 2095d44b08a267e695d1f5ee7c61286fddfb3b83e0Christopher Wileyimport android.aidl.tests.SimpleParcelable; 2188c320053c5c0f9c45a5700c89b23a9c0c745369Samuel Tanimport android.os.PersistableBundle; 22d6130f24cfdc3ae1247c4ac290e3f282b34e7615Christopher Wiley 23389781f56bb6b4363e9eb03acf915ba297f607d5Casey Dahlininterface ITestService { 24d40e2fed2c19850d53f1620322ac5cbca2c0e245Casey Dahlin // Test that constants are accessible 25d40e2fed2c19850d53f1620322ac5cbca2c0e245Casey Dahlin const int TEST_CONSTANT = 42; 26661c808160e3e4a584e0814229ba3bfdd78949d5Eino-Ville Talvala const int TEST_CONSTANT2 = -42; 27661c808160e3e4a584e0814229ba3bfdd78949d5Eino-Ville Talvala const int TEST_CONSTANT3 = +42; 28661c808160e3e4a584e0814229ba3bfdd78949d5Eino-Ville Talvala const int TEST_CONSTANT4 = +4; 29661c808160e3e4a584e0814229ba3bfdd78949d5Eino-Ville Talvala const int TEST_CONSTANT5 = -4; 30661c808160e3e4a584e0814229ba3bfdd78949d5Eino-Ville Talvala const int TEST_CONSTANT6 = -0; 31661c808160e3e4a584e0814229ba3bfdd78949d5Eino-Ville Talvala const int TEST_CONSTANT7 = +0; 32661c808160e3e4a584e0814229ba3bfdd78949d5Eino-Ville Talvala const int TEST_CONSTANT8 = 0; 333b2203ddadae8b44ebe14a882274707ba58bc9c3Roshan Pius const int TEST_CONSTANT9 = 0x56; 343b2203ddadae8b44ebe14a882274707ba58bc9c3Roshan Pius const int TEST_CONSTANT10 = 0xa5; 353b2203ddadae8b44ebe14a882274707ba58bc9c3Roshan Pius const int TEST_CONSTANT11 = 0xFA; 363b2203ddadae8b44ebe14a882274707ba58bc9c3Roshan Pius const int TEST_CONSTANT12 = 0xffffffff; 37d40e2fed2c19850d53f1620322ac5cbca2c0e245Casey Dahlin 3869b44cf003bd5bda9dcd97a6fe872630c1b2818fChristopher Wiley const String STRING_TEST_CONSTANT = "foo"; 3969b44cf003bd5bda9dcd97a6fe872630c1b2818fChristopher Wiley const String STRING_TEST_CONSTANT2 = "bar"; 4069b44cf003bd5bda9dcd97a6fe872630c1b2818fChristopher Wiley 41d6130f24cfdc3ae1247c4ac290e3f282b34e7615Christopher Wiley // Test that primitives work as parameters and return types. 42d6130f24cfdc3ae1247c4ac290e3f282b34e7615Christopher Wiley boolean RepeatBoolean(boolean token); 43d6130f24cfdc3ae1247c4ac290e3f282b34e7615Christopher Wiley byte RepeatByte(byte token); 44d6130f24cfdc3ae1247c4ac290e3f282b34e7615Christopher Wiley char RepeatChar(char token); 45d6130f24cfdc3ae1247c4ac290e3f282b34e7615Christopher Wiley int RepeatInt(int token); 46d6130f24cfdc3ae1247c4ac290e3f282b34e7615Christopher Wiley long RepeatLong(long token); 47d6130f24cfdc3ae1247c4ac290e3f282b34e7615Christopher Wiley float RepeatFloat(float token); 48d6130f24cfdc3ae1247c4ac290e3f282b34e7615Christopher Wiley double RepeatDouble(double token); 49d6130f24cfdc3ae1247c4ac290e3f282b34e7615Christopher Wiley String RepeatString(String token); 50cd8c135d8f4840e628afbb8c83546d94926ef537Robert Quattlebaum Map RepeatMap(in Map token); 51d6130f24cfdc3ae1247c4ac290e3f282b34e7615Christopher Wiley 5288c320053c5c0f9c45a5700c89b23a9c0c745369Samuel Tan SimpleParcelable RepeatSimpleParcelable(in SimpleParcelable input, 5388c320053c5c0f9c45a5700c89b23a9c0c745369Samuel Tan out SimpleParcelable repeat); 5488c320053c5c0f9c45a5700c89b23a9c0c745369Samuel Tan PersistableBundle RepeatPersistableBundle(in PersistableBundle input); 5595d44b08a267e695d1f5ee7c61286fddfb3b83e0Christopher Wiley 568949f838b881fe52e8fc6be527ab25806f4cc4e6Christopher Wiley // Test that arrays work as parameters and return types. 578949f838b881fe52e8fc6be527ab25806f4cc4e6Christopher Wiley boolean[] ReverseBoolean(in boolean[] input, out boolean[] repeated); 588949f838b881fe52e8fc6be527ab25806f4cc4e6Christopher Wiley byte[] ReverseByte (in byte[] input, out byte[] repeated); 598949f838b881fe52e8fc6be527ab25806f4cc4e6Christopher Wiley char[] ReverseChar (in char[] input, out char[] repeated); 608949f838b881fe52e8fc6be527ab25806f4cc4e6Christopher Wiley int[] ReverseInt (in int[] input, out int[] repeated); 618949f838b881fe52e8fc6be527ab25806f4cc4e6Christopher Wiley long[] ReverseLong (in long[] input, out long[] repeated); 628949f838b881fe52e8fc6be527ab25806f4cc4e6Christopher Wiley float[] ReverseFloat (in float[] input, out float[] repeated); 638949f838b881fe52e8fc6be527ab25806f4cc4e6Christopher Wiley double[] ReverseDouble (in double[] input, out double[] repeated); 648949f838b881fe52e8fc6be527ab25806f4cc4e6Christopher Wiley String[] ReverseString (in String[] input, out String[] repeated); 65389781f56bb6b4363e9eb03acf915ba297f607d5Casey Dahlin 6688c320053c5c0f9c45a5700c89b23a9c0c745369Samuel Tan SimpleParcelable[] ReverseSimpleParcelables(in SimpleParcelable[] input, 6788c320053c5c0f9c45a5700c89b23a9c0c745369Samuel Tan out SimpleParcelable[] repeated); 6888c320053c5c0f9c45a5700c89b23a9c0c745369Samuel Tan PersistableBundle[] ReversePersistableBundles( 6988c320053c5c0f9c45a5700c89b23a9c0c745369Samuel Tan in PersistableBundle[] input, out PersistableBundle[] repeated); 7095d44b08a267e695d1f5ee7c61286fddfb3b83e0Christopher Wiley 7156c9bf3c4fb731d5557427667f13f963fa5ef0f7Christopher Wiley // Test that clients can send and receive Binders. 72389781f56bb6b4363e9eb03acf915ba297f607d5Casey Dahlin INamedCallback GetOtherTestService(String name); 73389781f56bb6b4363e9eb03acf915ba297f607d5Casey Dahlin boolean VerifyName(INamedCallback service, String name); 7456c9bf3c4fb731d5557427667f13f963fa5ef0f7Christopher Wiley 7556c9bf3c4fb731d5557427667f13f963fa5ef0f7Christopher Wiley // Test that List<T> types work correctly. 7656c9bf3c4fb731d5557427667f13f963fa5ef0f7Christopher Wiley List<String> ReverseStringList(in List<String> input, 7756c9bf3c4fb731d5557427667f13f963fa5ef0f7Christopher Wiley out List<String> repeated); 787ecd69f2cc3c31cf569840e9c2d53ed352328d18Casey Dahlin List<IBinder> ReverseNamedCallbackList(in List<IBinder> input, 797ecd69f2cc3c31cf569840e9c2d53ed352328d18Casey Dahlin out List<IBinder> repeated); 80a4ba4b6868977b26b471860c038c7bbda4470946Casey Dahlin 81a4ba4b6868977b26b471860c038c7bbda4470946Casey Dahlin FileDescriptor RepeatFileDescriptor(in FileDescriptor read); 82a4ba4b6868977b26b471860c038c7bbda4470946Casey Dahlin FileDescriptor[] ReverseFileDescriptorArray(in FileDescriptor[] input, 83a4ba4b6868977b26b471860c038c7bbda4470946Casey Dahlin out FileDescriptor[] repeated); 847621d4d0592fbf3fb396d0c092a8e41c3c8215cdChristopher Wiley 857621d4d0592fbf3fb396d0c092a8e41c3c8215cdChristopher Wiley // Test that service specific exceptions work correctly. 867621d4d0592fbf3fb396d0c092a8e41c3c8215cdChristopher Wiley void ThrowServiceException(int code); 8757dbe24bcb8f4509a876e8445c78d9504d7e616aCasey Dahlin 8857dbe24bcb8f4509a876e8445c78d9504d7e616aCasey Dahlin // Test nullability 8957dbe24bcb8f4509a876e8445c78d9504d7e616aCasey Dahlin @nullable int[] RepeatNullableIntArray(in @nullable int[] input); 9057dbe24bcb8f4509a876e8445c78d9504d7e616aCasey Dahlin @nullable String RepeatNullableString(in @nullable String input); 9157dbe24bcb8f4509a876e8445c78d9504d7e616aCasey Dahlin @nullable List<String> RepeatNullableStringList(in @nullable List<String> input); 9257dbe24bcb8f4509a876e8445c78d9504d7e616aCasey Dahlin @nullable SimpleParcelable RepeatNullableParcelable(in @nullable SimpleParcelable input); 93dca2ecf2883771b4c895e52a9f07e2467d603f77Christopher Wiley 9433375d7e672c854b3691ae5fd17af782ff49b3aaChristopher Wiley void TakesAnIBinder(in IBinder input); 9533375d7e672c854b3691ae5fd17af782ff49b3aaChristopher Wiley void TakesAnIBinderList(in List<IBinder> input); 9633375d7e672c854b3691ae5fd17af782ff49b3aaChristopher Wiley void TakesANullableIBinder(in @nullable IBinder input); 9733375d7e672c854b3691ae5fd17af782ff49b3aaChristopher Wiley void TakesANullableIBinderList(in @nullable List<IBinder> input); 9833375d7e672c854b3691ae5fd17af782ff49b3aaChristopher Wiley 99dca2ecf2883771b4c895e52a9f07e2467d603f77Christopher Wiley // Test utf8 decoding from utf16 wire format 100dca2ecf2883771b4c895e52a9f07e2467d603f77Christopher Wiley @utf8InCpp String RepeatUtf8CppString(@utf8InCpp String token); 101dca2ecf2883771b4c895e52a9f07e2467d603f77Christopher Wiley @nullable @utf8InCpp String RepeatNullableUtf8CppString( 102dca2ecf2883771b4c895e52a9f07e2467d603f77Christopher Wiley @nullable @utf8InCpp String token); 103dca2ecf2883771b4c895e52a9f07e2467d603f77Christopher Wiley 104dca2ecf2883771b4c895e52a9f07e2467d603f77Christopher Wiley @utf8InCpp String[] ReverseUtf8CppString (in @utf8InCpp String[] input, 105dca2ecf2883771b4c895e52a9f07e2467d603f77Christopher Wiley out @utf8InCpp String[] repeated); 106dca2ecf2883771b4c895e52a9f07e2467d603f77Christopher Wiley 107d2bcf2fea80501be334d15e54d7900b997881293Casey Dahlin @nullable @utf8InCpp String[] ReverseNullableUtf8CppString ( 108d2bcf2fea80501be334d15e54d7900b997881293Casey Dahlin in @nullable @utf8InCpp String[] input, 109d2bcf2fea80501be334d15e54d7900b997881293Casey Dahlin out @nullable @utf8InCpp String[] repeated); 110d2bcf2fea80501be334d15e54d7900b997881293Casey Dahlin 11199d699bef10f2455931fdd46861a25742a8fd7eaChristopher Wiley @nullable @utf8InCpp List<String> ReverseUtf8CppStringList( 11299d699bef10f2455931fdd46861a25742a8fd7eaChristopher Wiley in @nullable @utf8InCpp List<String> input, 11399d699bef10f2455931fdd46861a25742a8fd7eaChristopher Wiley out @nullable @utf8InCpp List<String> repeated); 114513fec62fb714caf60ca18a0ab57d772e38b6f0dChristopher Wiley 115513fec62fb714caf60ca18a0ab57d772e38b6f0dChristopher Wiley @nullable INamedCallback GetCallback(boolean return_null); 116b5e698c8bf4efc7bcbe5fd24685968db10e62735Christopher Wiley} 117