summaryrefslogtreecommitdiffstats
path: root/tests/android/aidl/tests/ITestService.aidl
blob: 91b13b4c4865cb899cece7a1cdd147b1686336c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/*
 * Copyright (C) 2015 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.aidl.tests;

import android.aidl.tests.INamedCallback;
import android.aidl.tests.SimpleParcelable;
import android.os.PersistableBundle;

interface ITestService {
  // Test that constants are accessible
  const int TEST_CONSTANT = 42;
  const int TEST_CONSTANT2 = -42;
  const int TEST_CONSTANT3 = +42;
  const int TEST_CONSTANT4 = +4;
  const int TEST_CONSTANT5 = -4;
  const int TEST_CONSTANT6 = -0;
  const int TEST_CONSTANT7 = +0;
  const int TEST_CONSTANT8 = 0;
  const int TEST_CONSTANT9 = 0x56;
  const int TEST_CONSTANT10 = 0xa5;
  const int TEST_CONSTANT11 = 0xFA;
  const int TEST_CONSTANT12 = 0xffffffff;

  const String STRING_TEST_CONSTANT = "foo";
  const String STRING_TEST_CONSTANT2 = "bar";

  // Test that primitives work as parameters and return types.
  boolean RepeatBoolean(boolean token);
  byte RepeatByte(byte token);
  char RepeatChar(char token);
  int RepeatInt(int token);
  long RepeatLong(long token);
  float RepeatFloat(float token);
  double RepeatDouble(double token);
  String RepeatString(String token);
  Map RepeatMap(in Map token);

  SimpleParcelable RepeatSimpleParcelable(in SimpleParcelable input,
                                          out SimpleParcelable repeat);
  PersistableBundle RepeatPersistableBundle(in PersistableBundle input);

  // Test that arrays work as parameters and return types.
  boolean[] ReverseBoolean(in boolean[] input, out boolean[] repeated);
  byte[]    ReverseByte   (in byte[]    input, out byte[]    repeated);
  char[]    ReverseChar   (in char[]    input, out char[]    repeated);
  int[]     ReverseInt    (in int[]     input, out int[]     repeated);
  long[]    ReverseLong   (in long[]    input, out long[]    repeated);
  float[]   ReverseFloat  (in float[]   input, out float[]   repeated);
  double[]  ReverseDouble (in double[]  input, out double[]  repeated);
  String[]  ReverseString (in String[]  input, out String[]  repeated);

  SimpleParcelable[]  ReverseSimpleParcelables(in SimpleParcelable[] input,
                                               out SimpleParcelable[] repeated);
  PersistableBundle[] ReversePersistableBundles(
      in PersistableBundle[] input, out PersistableBundle[] repeated);

  // Test that clients can send and receive Binders.
  INamedCallback GetOtherTestService(String name);
  boolean VerifyName(INamedCallback service, String name);

  // Test that List<T> types work correctly.
  List<String> ReverseStringList(in List<String> input,
                                 out List<String> repeated);
  List<IBinder> ReverseNamedCallbackList(in List<IBinder> input,
                                         out List<IBinder> repeated);

  FileDescriptor RepeatFileDescriptor(in FileDescriptor read);
  FileDescriptor[] ReverseFileDescriptorArray(in FileDescriptor[] input,
                                              out FileDescriptor[] repeated);

  // Test that service specific exceptions work correctly.
  void ThrowServiceException(int code);

  // Test nullability
  @nullable int[] RepeatNullableIntArray(in @nullable int[] input);
  @nullable String RepeatNullableString(in @nullable String input);
  @nullable List<String> RepeatNullableStringList(in @nullable List<String> input);
  @nullable SimpleParcelable RepeatNullableParcelable(in @nullable SimpleParcelable input);

  void TakesAnIBinder(in IBinder input);
  void TakesAnIBinderList(in List<IBinder> input);
  void TakesANullableIBinder(in @nullable IBinder input);
  void TakesANullableIBinderList(in @nullable List<IBinder> input);

  // Test utf8 decoding from utf16 wire format
  @utf8InCpp String RepeatUtf8CppString(@utf8InCpp String token);
  @nullable @utf8InCpp String RepeatNullableUtf8CppString(
      @nullable @utf8InCpp String token);

  @utf8InCpp String[]  ReverseUtf8CppString (in @utf8InCpp String[] input,
                                             out @utf8InCpp String[] repeated);

  @nullable @utf8InCpp List<String> ReverseUtf8CppStringList(
      in @nullable @utf8InCpp List<String> input,
      out @nullable @utf8InCpp List<String> repeated);

  @nullable INamedCallback GetCallback(boolean return_null);
}