• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "tests/test_data.h"
18 
19 namespace android {
20 namespace aidl {
21 namespace test_data {
22 namespace example_interface {
23 
24 const char kCanonicalName[] = "android.test.IExampleInterface";
25 
26 const char kJavaOutputPath[] = "some/path/to/output.java";
27 
28 const char* kImportedParcelables[] = {
29   "android.foo.ExampleParcelable",
30   nullptr,
31 };
32 
33 const char* kImportedInterfaces[] = {
34   "android.bar.IAuxInterface",
35   "android.test.IAuxInterface2",
36   nullptr,
37 };
38 
39 const char kInterfaceDefinition[] = R"(
40 package android.test;
41 
42 import android.foo.ExampleParcelable;
43 import android.test.CompoundParcelable;
44 import android.bar.IAuxInterface;
45 import android.test.IAuxInterface2;
46 
47 @Hide
48 @UnsupportedAppUsage
49 interface IExampleInterface {
50     const int EXAMPLE_CONSTANT = 3;
51     boolean isEnabled();
52     int getState();
53     String getAddress();
54 
55     /* Test long comment */
56     @Hide
57     @UnsupportedAppUsage
58     ExampleParcelable[] getParcelables();
59 
60     // Test short comment
61     boolean setScanMode(int mode, int duration);
62 
63     /* Test long comment */
64     // And short comment
65     void registerBinder(IAuxInterface foo);
66     IExampleInterface getRecursiveBinder();
67 
68     int takesAnInterface(in IAuxInterface2 arg);
69     int takesAParcelable(in CompoundParcelable.Subclass1 arg,
70                          inout CompoundParcelable.Subclass2 arg2);
71 }
72 )";
73 
74 const char kInterfaceDefinitionOutlining[] = R"(
75 package android.test;
76 
77 import android.foo.ExampleParcelable;
78 import android.test.CompoundParcelable;
79 import android.bar.IAuxInterface;
80 import android.test.IAuxInterface2;
81 
82 interface IExampleInterface {
83     const int EXAMPLE_CONSTANT = 3;
84     boolean isEnabled();
85     int getState(int a, int b);
86     String getAddress();
87 
88     /* Test long comment */
89     ExampleParcelable[] getParcelables();
90 
91     // Test short comment
92     boolean setScanMode(int mode, int duration);
93 
94     /* Test long comment */
95     // And short comment
96     void registerBinder(IAuxInterface foo);
97     IExampleInterface getRecursiveBinder();
98 
99     int takesAnInterface(in IAuxInterface2 arg);
100     int takesAParcelable(in CompoundParcelable.Subclass1 arg,
101                          inout CompoundParcelable.Subclass2 arg2);
102 }
103 )";
104 
105 const char kExpectedJavaDepsOutput[] =
106     R"(some/path/to/output.java : \
107   android/test/IExampleInterface.aidl \
108   ./android/foo/ExampleParcelable.aidl \
109   ./android/test/CompoundParcelable.aidl \
110   ./android/bar/IAuxInterface.aidl \
111   ./android/test/IAuxInterface2.aidl
112 
113 android/test/IExampleInterface.aidl :
114 ./android/foo/ExampleParcelable.aidl :
115 ./android/test/CompoundParcelable.aidl :
116 ./android/bar/IAuxInterface.aidl :
117 ./android/test/IAuxInterface2.aidl :
118 )";
119 
120 const char kExpectedJavaOutput[] =
121     R"(/*
122  * This file is auto-generated.  DO NOT MODIFY.
123  */
124 package android.test;
125 @android.annotation.Hide
126 @android.compat.annotation.UnsupportedAppUsage(overrideSourcePosition="android/test/IExampleInterface.aidl:10:1:10:21")
127 public interface IExampleInterface extends android.os.IInterface
128 {
129   /** Default implementation for IExampleInterface. */
130   public static class Default implements android.test.IExampleInterface
131   {
132     @Override public boolean isEnabled() throws android.os.RemoteException
133     {
134       return false;
135     }
136     @Override public int getState() throws android.os.RemoteException
137     {
138       return 0;
139     }
140     @Override public java.lang.String getAddress() throws android.os.RemoteException
141     {
142       return null;
143     }
144     /* Test long comment */
145     @Override public android.foo.ExampleParcelable[] getParcelables() throws android.os.RemoteException
146     {
147       return null;
148     }
149     // Test short comment
150 
151     @Override public boolean setScanMode(int mode, int duration) throws android.os.RemoteException
152     {
153       return false;
154     }
155     /* Test long comment */// And short comment
156 
157     @Override public void registerBinder(android.bar.IAuxInterface foo) throws android.os.RemoteException
158     {
159     }
160     @Override public android.test.IExampleInterface getRecursiveBinder() throws android.os.RemoteException
161     {
162       return null;
163     }
164     @Override public int takesAnInterface(android.test.IAuxInterface2 arg) throws android.os.RemoteException
165     {
166       return 0;
167     }
168     @Override public int takesAParcelable(android.test.CompoundParcelable.Subclass1 arg, android.test.CompoundParcelable.Subclass2 arg2) throws android.os.RemoteException
169     {
170       return 0;
171     }
172     @Override
173     public android.os.IBinder asBinder() {
174       return null;
175     }
176   }
177   /** Local-side IPC implementation stub class. */
178   public static abstract class Stub extends android.os.Binder implements android.test.IExampleInterface
179   {
180     private static final java.lang.String DESCRIPTOR = "android.test.IExampleInterface";
181     /** Construct the stub at attach it to the interface. */
182     public Stub()
183     {
184       this.attachInterface(this, DESCRIPTOR);
185     }
186     /**
187      * Cast an IBinder object into an android.test.IExampleInterface interface,
188      * generating a proxy if needed.
189      */
190     public static android.test.IExampleInterface asInterface(android.os.IBinder obj)
191     {
192       if ((obj==null)) {
193         return null;
194       }
195       android.os.IInterface iin = obj.queryLocalInterface(DESCRIPTOR);
196       if (((iin!=null)&&(iin instanceof android.test.IExampleInterface))) {
197         return ((android.test.IExampleInterface)iin);
198       }
199       return new android.test.IExampleInterface.Stub.Proxy(obj);
200     }
201     @Override public android.os.IBinder asBinder()
202     {
203       return this;
204     }
205     @Override public boolean onTransact(int code, android.os.Parcel data, android.os.Parcel reply, int flags) throws android.os.RemoteException
206     {
207       java.lang.String descriptor = DESCRIPTOR;
208       switch (code)
209       {
210         case INTERFACE_TRANSACTION:
211         {
212           reply.writeString(descriptor);
213           return true;
214         }
215         case TRANSACTION_isEnabled:
216         {
217           data.enforceInterface(descriptor);
218           boolean _result = this.isEnabled();
219           reply.writeNoException();
220           reply.writeInt(((_result)?(1):(0)));
221           return true;
222         }
223         case TRANSACTION_getState:
224         {
225           data.enforceInterface(descriptor);
226           int _result = this.getState();
227           reply.writeNoException();
228           reply.writeInt(_result);
229           return true;
230         }
231         case TRANSACTION_getAddress:
232         {
233           data.enforceInterface(descriptor);
234           java.lang.String _result = this.getAddress();
235           reply.writeNoException();
236           reply.writeString(_result);
237           return true;
238         }
239         case TRANSACTION_getParcelables:
240         {
241           data.enforceInterface(descriptor);
242           android.foo.ExampleParcelable[] _result = this.getParcelables();
243           reply.writeNoException();
244           reply.writeTypedArray(_result, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
245           return true;
246         }
247         case TRANSACTION_setScanMode:
248         {
249           data.enforceInterface(descriptor);
250           int _arg0;
251           _arg0 = data.readInt();
252           int _arg1;
253           _arg1 = data.readInt();
254           boolean _result = this.setScanMode(_arg0, _arg1);
255           reply.writeNoException();
256           reply.writeInt(((_result)?(1):(0)));
257           return true;
258         }
259         case TRANSACTION_registerBinder:
260         {
261           data.enforceInterface(descriptor);
262           android.bar.IAuxInterface _arg0;
263           _arg0 = android.bar.IAuxInterface.Stub.asInterface(data.readStrongBinder());
264           this.registerBinder(_arg0);
265           reply.writeNoException();
266           return true;
267         }
268         case TRANSACTION_getRecursiveBinder:
269         {
270           data.enforceInterface(descriptor);
271           android.test.IExampleInterface _result = this.getRecursiveBinder();
272           reply.writeNoException();
273           reply.writeStrongBinder((((_result!=null))?(_result.asBinder()):(null)));
274           return true;
275         }
276         case TRANSACTION_takesAnInterface:
277         {
278           data.enforceInterface(descriptor);
279           android.test.IAuxInterface2 _arg0;
280           _arg0 = android.test.IAuxInterface2.Stub.asInterface(data.readStrongBinder());
281           int _result = this.takesAnInterface(_arg0);
282           reply.writeNoException();
283           reply.writeInt(_result);
284           return true;
285         }
286         case TRANSACTION_takesAParcelable:
287         {
288           data.enforceInterface(descriptor);
289           android.test.CompoundParcelable.Subclass1 _arg0;
290           if ((0!=data.readInt())) {
291             _arg0 = android.test.CompoundParcelable.Subclass1.CREATOR.createFromParcel(data);
292           }
293           else {
294             _arg0 = null;
295           }
296           android.test.CompoundParcelable.Subclass2 _arg1;
297           if ((0!=data.readInt())) {
298             _arg1 = android.test.CompoundParcelable.Subclass2.CREATOR.createFromParcel(data);
299           }
300           else {
301             _arg1 = null;
302           }
303           int _result = this.takesAParcelable(_arg0, _arg1);
304           reply.writeNoException();
305           reply.writeInt(_result);
306           if ((_arg1!=null)) {
307             reply.writeInt(1);
308             _arg1.writeToParcel(reply, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
309           }
310           else {
311             reply.writeInt(0);
312           }
313           return true;
314         }
315         default:
316         {
317           return super.onTransact(code, data, reply, flags);
318         }
319       }
320     }
321     private static class Proxy implements android.test.IExampleInterface
322     {
323       private android.os.IBinder mRemote;
324       Proxy(android.os.IBinder remote)
325       {
326         mRemote = remote;
327       }
328       @Override public android.os.IBinder asBinder()
329       {
330         return mRemote;
331       }
332       public java.lang.String getInterfaceDescriptor()
333       {
334         return DESCRIPTOR;
335       }
336       @Override public boolean isEnabled() throws android.os.RemoteException
337       {
338         android.os.Parcel _data = android.os.Parcel.obtain();
339         android.os.Parcel _reply = android.os.Parcel.obtain();
340         boolean _result;
341         try {
342           _data.writeInterfaceToken(DESCRIPTOR);
343           boolean _status = mRemote.transact(Stub.TRANSACTION_isEnabled, _data, _reply, 0);
344           if (!_status && getDefaultImpl() != null) {
345             return getDefaultImpl().isEnabled();
346           }
347           _reply.readException();
348           _result = (0!=_reply.readInt());
349         }
350         finally {
351           _reply.recycle();
352           _data.recycle();
353         }
354         return _result;
355       }
356       @Override public int getState() throws android.os.RemoteException
357       {
358         android.os.Parcel _data = android.os.Parcel.obtain();
359         android.os.Parcel _reply = android.os.Parcel.obtain();
360         int _result;
361         try {
362           _data.writeInterfaceToken(DESCRIPTOR);
363           boolean _status = mRemote.transact(Stub.TRANSACTION_getState, _data, _reply, 0);
364           if (!_status && getDefaultImpl() != null) {
365             return getDefaultImpl().getState();
366           }
367           _reply.readException();
368           _result = _reply.readInt();
369         }
370         finally {
371           _reply.recycle();
372           _data.recycle();
373         }
374         return _result;
375       }
376       @Override public java.lang.String getAddress() throws android.os.RemoteException
377       {
378         android.os.Parcel _data = android.os.Parcel.obtain();
379         android.os.Parcel _reply = android.os.Parcel.obtain();
380         java.lang.String _result;
381         try {
382           _data.writeInterfaceToken(DESCRIPTOR);
383           boolean _status = mRemote.transact(Stub.TRANSACTION_getAddress, _data, _reply, 0);
384           if (!_status && getDefaultImpl() != null) {
385             return getDefaultImpl().getAddress();
386           }
387           _reply.readException();
388           _result = _reply.readString();
389         }
390         finally {
391           _reply.recycle();
392           _data.recycle();
393         }
394         return _result;
395       }
396       /* Test long comment */
397       @Override public android.foo.ExampleParcelable[] getParcelables() throws android.os.RemoteException
398       {
399         android.os.Parcel _data = android.os.Parcel.obtain();
400         android.os.Parcel _reply = android.os.Parcel.obtain();
401         android.foo.ExampleParcelable[] _result;
402         try {
403           _data.writeInterfaceToken(DESCRIPTOR);
404           boolean _status = mRemote.transact(Stub.TRANSACTION_getParcelables, _data, _reply, 0);
405           if (!_status && getDefaultImpl() != null) {
406             return getDefaultImpl().getParcelables();
407           }
408           _reply.readException();
409           _result = _reply.createTypedArray(android.foo.ExampleParcelable.CREATOR);
410         }
411         finally {
412           _reply.recycle();
413           _data.recycle();
414         }
415         return _result;
416       }
417       // Test short comment
418 
419       @Override public boolean setScanMode(int mode, int duration) throws android.os.RemoteException
420       {
421         android.os.Parcel _data = android.os.Parcel.obtain();
422         android.os.Parcel _reply = android.os.Parcel.obtain();
423         boolean _result;
424         try {
425           _data.writeInterfaceToken(DESCRIPTOR);
426           _data.writeInt(mode);
427           _data.writeInt(duration);
428           boolean _status = mRemote.transact(Stub.TRANSACTION_setScanMode, _data, _reply, 0);
429           if (!_status && getDefaultImpl() != null) {
430             return getDefaultImpl().setScanMode(mode, duration);
431           }
432           _reply.readException();
433           _result = (0!=_reply.readInt());
434         }
435         finally {
436           _reply.recycle();
437           _data.recycle();
438         }
439         return _result;
440       }
441       /* Test long comment */// And short comment
442 
443       @Override public void registerBinder(android.bar.IAuxInterface foo) throws android.os.RemoteException
444       {
445         android.os.Parcel _data = android.os.Parcel.obtain();
446         android.os.Parcel _reply = android.os.Parcel.obtain();
447         try {
448           _data.writeInterfaceToken(DESCRIPTOR);
449           _data.writeStrongBinder((((foo!=null))?(foo.asBinder()):(null)));
450           boolean _status = mRemote.transact(Stub.TRANSACTION_registerBinder, _data, _reply, 0);
451           if (!_status && getDefaultImpl() != null) {
452             getDefaultImpl().registerBinder(foo);
453             return;
454           }
455           _reply.readException();
456         }
457         finally {
458           _reply.recycle();
459           _data.recycle();
460         }
461       }
462       @Override public android.test.IExampleInterface getRecursiveBinder() throws android.os.RemoteException
463       {
464         android.os.Parcel _data = android.os.Parcel.obtain();
465         android.os.Parcel _reply = android.os.Parcel.obtain();
466         android.test.IExampleInterface _result;
467         try {
468           _data.writeInterfaceToken(DESCRIPTOR);
469           boolean _status = mRemote.transact(Stub.TRANSACTION_getRecursiveBinder, _data, _reply, 0);
470           if (!_status && getDefaultImpl() != null) {
471             return getDefaultImpl().getRecursiveBinder();
472           }
473           _reply.readException();
474           _result = android.test.IExampleInterface.Stub.asInterface(_reply.readStrongBinder());
475         }
476         finally {
477           _reply.recycle();
478           _data.recycle();
479         }
480         return _result;
481       }
482       @Override public int takesAnInterface(android.test.IAuxInterface2 arg) throws android.os.RemoteException
483       {
484         android.os.Parcel _data = android.os.Parcel.obtain();
485         android.os.Parcel _reply = android.os.Parcel.obtain();
486         int _result;
487         try {
488           _data.writeInterfaceToken(DESCRIPTOR);
489           _data.writeStrongBinder((((arg!=null))?(arg.asBinder()):(null)));
490           boolean _status = mRemote.transact(Stub.TRANSACTION_takesAnInterface, _data, _reply, 0);
491           if (!_status && getDefaultImpl() != null) {
492             return getDefaultImpl().takesAnInterface(arg);
493           }
494           _reply.readException();
495           _result = _reply.readInt();
496         }
497         finally {
498           _reply.recycle();
499           _data.recycle();
500         }
501         return _result;
502       }
503       @Override public int takesAParcelable(android.test.CompoundParcelable.Subclass1 arg, android.test.CompoundParcelable.Subclass2 arg2) throws android.os.RemoteException
504       {
505         android.os.Parcel _data = android.os.Parcel.obtain();
506         android.os.Parcel _reply = android.os.Parcel.obtain();
507         int _result;
508         try {
509           _data.writeInterfaceToken(DESCRIPTOR);
510           if ((arg!=null)) {
511             _data.writeInt(1);
512             arg.writeToParcel(_data, 0);
513           }
514           else {
515             _data.writeInt(0);
516           }
517           if ((arg2!=null)) {
518             _data.writeInt(1);
519             arg2.writeToParcel(_data, 0);
520           }
521           else {
522             _data.writeInt(0);
523           }
524           boolean _status = mRemote.transact(Stub.TRANSACTION_takesAParcelable, _data, _reply, 0);
525           if (!_status && getDefaultImpl() != null) {
526             return getDefaultImpl().takesAParcelable(arg, arg2);
527           }
528           _reply.readException();
529           _result = _reply.readInt();
530           if ((0!=_reply.readInt())) {
531             arg2.readFromParcel(_reply);
532           }
533         }
534         finally {
535           _reply.recycle();
536           _data.recycle();
537         }
538         return _result;
539       }
540       public static android.test.IExampleInterface sDefaultImpl;
541     }
542     static final int TRANSACTION_isEnabled = (android.os.IBinder.FIRST_CALL_TRANSACTION + 0);
543     static final int TRANSACTION_getState = (android.os.IBinder.FIRST_CALL_TRANSACTION + 1);
544     static final int TRANSACTION_getAddress = (android.os.IBinder.FIRST_CALL_TRANSACTION + 2);
545     static final int TRANSACTION_getParcelables = (android.os.IBinder.FIRST_CALL_TRANSACTION + 3);
546     static final int TRANSACTION_setScanMode = (android.os.IBinder.FIRST_CALL_TRANSACTION + 4);
547     static final int TRANSACTION_registerBinder = (android.os.IBinder.FIRST_CALL_TRANSACTION + 5);
548     static final int TRANSACTION_getRecursiveBinder = (android.os.IBinder.FIRST_CALL_TRANSACTION + 6);
549     static final int TRANSACTION_takesAnInterface = (android.os.IBinder.FIRST_CALL_TRANSACTION + 7);
550     static final int TRANSACTION_takesAParcelable = (android.os.IBinder.FIRST_CALL_TRANSACTION + 8);
551     public static boolean setDefaultImpl(android.test.IExampleInterface impl) {
552       // Only one user of this interface can use this function
553       // at a time. This is a heuristic to detect if two different
554       // users in the same process use this function.
555       if (Stub.Proxy.sDefaultImpl != null) {
556         throw new IllegalStateException("setDefaultImpl() called twice");
557       }
558       if (impl != null) {
559         Stub.Proxy.sDefaultImpl = impl;
560         return true;
561       }
562       return false;
563     }
564     public static android.test.IExampleInterface getDefaultImpl() {
565       return Stub.Proxy.sDefaultImpl;
566     }
567   }
568   public static final int EXAMPLE_CONSTANT = 3;
569   public boolean isEnabled() throws android.os.RemoteException;
570   public int getState() throws android.os.RemoteException;
571   public java.lang.String getAddress() throws android.os.RemoteException;
572   /* Test long comment */
573   @android.annotation.Hide
574   @android.compat.annotation.UnsupportedAppUsage(overrideSourcePosition="android/test/IExampleInterface.aidl:19:1:19:25")
575   public android.foo.ExampleParcelable[] getParcelables() throws android.os.RemoteException;
576   // Test short comment
577 
578   public boolean setScanMode(int mode, int duration) throws android.os.RemoteException;
579   /* Test long comment */// And short comment
580 
581   public void registerBinder(android.bar.IAuxInterface foo) throws android.os.RemoteException;
582   public android.test.IExampleInterface getRecursiveBinder() throws android.os.RemoteException;
583   public int takesAnInterface(android.test.IAuxInterface2 arg) throws android.os.RemoteException;
584   public int takesAParcelable(android.test.CompoundParcelable.Subclass1 arg, android.test.CompoundParcelable.Subclass2 arg2) throws android.os.RemoteException;
585 }
586 )";
587 
588 const char kExpectedJavaOutputWithTransactionNames[] =
589     R"(/*
590  * This file is auto-generated.  DO NOT MODIFY.
591  */
592 package android.test;
593 @android.annotation.Hide
594 @android.compat.annotation.UnsupportedAppUsage(overrideSourcePosition="android/test/IExampleInterface.aidl:10:1:10:21")
595 public interface IExampleInterface extends android.os.IInterface
596 {
597   /** Default implementation for IExampleInterface. */
598   public static class Default implements android.test.IExampleInterface
599   {
600     @Override public boolean isEnabled() throws android.os.RemoteException
601     {
602       return false;
603     }
604     @Override public int getState() throws android.os.RemoteException
605     {
606       return 0;
607     }
608     @Override public java.lang.String getAddress() throws android.os.RemoteException
609     {
610       return null;
611     }
612     /* Test long comment */
613     @Override public android.foo.ExampleParcelable[] getParcelables() throws android.os.RemoteException
614     {
615       return null;
616     }
617     // Test short comment
618 
619     @Override public boolean setScanMode(int mode, int duration) throws android.os.RemoteException
620     {
621       return false;
622     }
623     /* Test long comment */// And short comment
624 
625     @Override public void registerBinder(android.bar.IAuxInterface foo) throws android.os.RemoteException
626     {
627     }
628     @Override public android.test.IExampleInterface getRecursiveBinder() throws android.os.RemoteException
629     {
630       return null;
631     }
632     @Override public int takesAnInterface(android.test.IAuxInterface2 arg) throws android.os.RemoteException
633     {
634       return 0;
635     }
636     @Override public int takesAParcelable(android.test.CompoundParcelable.Subclass1 arg, android.test.CompoundParcelable.Subclass2 arg2) throws android.os.RemoteException
637     {
638       return 0;
639     }
640     @Override
641     public android.os.IBinder asBinder() {
642       return null;
643     }
644   }
645   /** Local-side IPC implementation stub class. */
646   public static abstract class Stub extends android.os.Binder implements android.test.IExampleInterface
647   {
648     private static final java.lang.String DESCRIPTOR = "android.test.IExampleInterface";
649     /** Construct the stub at attach it to the interface. */
650     public Stub()
651     {
652       this.attachInterface(this, DESCRIPTOR);
653     }
654     /**
655      * Cast an IBinder object into an android.test.IExampleInterface interface,
656      * generating a proxy if needed.
657      */
658     public static android.test.IExampleInterface asInterface(android.os.IBinder obj)
659     {
660       if ((obj==null)) {
661         return null;
662       }
663       android.os.IInterface iin = obj.queryLocalInterface(DESCRIPTOR);
664       if (((iin!=null)&&(iin instanceof android.test.IExampleInterface))) {
665         return ((android.test.IExampleInterface)iin);
666       }
667       return new android.test.IExampleInterface.Stub.Proxy(obj);
668     }
669     @Override public android.os.IBinder asBinder()
670     {
671       return this;
672     }
673     /** @hide */
674     public static java.lang.String getDefaultTransactionName(int transactionCode)
675     {
676       switch (transactionCode)
677       {
678         case TRANSACTION_isEnabled:
679         {
680           return "isEnabled";
681         }
682         case TRANSACTION_getState:
683         {
684           return "getState";
685         }
686         case TRANSACTION_getAddress:
687         {
688           return "getAddress";
689         }
690         case TRANSACTION_getParcelables:
691         {
692           return "getParcelables";
693         }
694         case TRANSACTION_setScanMode:
695         {
696           return "setScanMode";
697         }
698         case TRANSACTION_registerBinder:
699         {
700           return "registerBinder";
701         }
702         case TRANSACTION_getRecursiveBinder:
703         {
704           return "getRecursiveBinder";
705         }
706         case TRANSACTION_takesAnInterface:
707         {
708           return "takesAnInterface";
709         }
710         case TRANSACTION_takesAParcelable:
711         {
712           return "takesAParcelable";
713         }
714         default:
715         {
716           return null;
717         }
718       }
719     }
720     /** @hide */
721     public java.lang.String getTransactionName(int transactionCode)
722     {
723       return this.getDefaultTransactionName(transactionCode);
724     }
725     @Override public boolean onTransact(int code, android.os.Parcel data, android.os.Parcel reply, int flags) throws android.os.RemoteException
726     {
727       java.lang.String descriptor = DESCRIPTOR;
728       switch (code)
729       {
730         case INTERFACE_TRANSACTION:
731         {
732           reply.writeString(descriptor);
733           return true;
734         }
735         case TRANSACTION_isEnabled:
736         {
737           data.enforceInterface(descriptor);
738           boolean _result = this.isEnabled();
739           reply.writeNoException();
740           reply.writeInt(((_result)?(1):(0)));
741           return true;
742         }
743         case TRANSACTION_getState:
744         {
745           data.enforceInterface(descriptor);
746           int _result = this.getState();
747           reply.writeNoException();
748           reply.writeInt(_result);
749           return true;
750         }
751         case TRANSACTION_getAddress:
752         {
753           data.enforceInterface(descriptor);
754           java.lang.String _result = this.getAddress();
755           reply.writeNoException();
756           reply.writeString(_result);
757           return true;
758         }
759         case TRANSACTION_getParcelables:
760         {
761           data.enforceInterface(descriptor);
762           android.foo.ExampleParcelable[] _result = this.getParcelables();
763           reply.writeNoException();
764           reply.writeTypedArray(_result, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
765           return true;
766         }
767         case TRANSACTION_setScanMode:
768         {
769           data.enforceInterface(descriptor);
770           int _arg0;
771           _arg0 = data.readInt();
772           int _arg1;
773           _arg1 = data.readInt();
774           boolean _result = this.setScanMode(_arg0, _arg1);
775           reply.writeNoException();
776           reply.writeInt(((_result)?(1):(0)));
777           return true;
778         }
779         case TRANSACTION_registerBinder:
780         {
781           data.enforceInterface(descriptor);
782           android.bar.IAuxInterface _arg0;
783           _arg0 = android.bar.IAuxInterface.Stub.asInterface(data.readStrongBinder());
784           this.registerBinder(_arg0);
785           reply.writeNoException();
786           return true;
787         }
788         case TRANSACTION_getRecursiveBinder:
789         {
790           data.enforceInterface(descriptor);
791           android.test.IExampleInterface _result = this.getRecursiveBinder();
792           reply.writeNoException();
793           reply.writeStrongBinder((((_result!=null))?(_result.asBinder()):(null)));
794           return true;
795         }
796         case TRANSACTION_takesAnInterface:
797         {
798           data.enforceInterface(descriptor);
799           android.test.IAuxInterface2 _arg0;
800           _arg0 = android.test.IAuxInterface2.Stub.asInterface(data.readStrongBinder());
801           int _result = this.takesAnInterface(_arg0);
802           reply.writeNoException();
803           reply.writeInt(_result);
804           return true;
805         }
806         case TRANSACTION_takesAParcelable:
807         {
808           data.enforceInterface(descriptor);
809           android.test.CompoundParcelable.Subclass1 _arg0;
810           if ((0!=data.readInt())) {
811             _arg0 = android.test.CompoundParcelable.Subclass1.CREATOR.createFromParcel(data);
812           }
813           else {
814             _arg0 = null;
815           }
816           android.test.CompoundParcelable.Subclass2 _arg1;
817           if ((0!=data.readInt())) {
818             _arg1 = android.test.CompoundParcelable.Subclass2.CREATOR.createFromParcel(data);
819           }
820           else {
821             _arg1 = null;
822           }
823           int _result = this.takesAParcelable(_arg0, _arg1);
824           reply.writeNoException();
825           reply.writeInt(_result);
826           if ((_arg1!=null)) {
827             reply.writeInt(1);
828             _arg1.writeToParcel(reply, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
829           }
830           else {
831             reply.writeInt(0);
832           }
833           return true;
834         }
835         default:
836         {
837           return super.onTransact(code, data, reply, flags);
838         }
839       }
840     }
841     private static class Proxy implements android.test.IExampleInterface
842     {
843       private android.os.IBinder mRemote;
844       Proxy(android.os.IBinder remote)
845       {
846         mRemote = remote;
847       }
848       @Override public android.os.IBinder asBinder()
849       {
850         return mRemote;
851       }
852       public java.lang.String getInterfaceDescriptor()
853       {
854         return DESCRIPTOR;
855       }
856       @Override public boolean isEnabled() throws android.os.RemoteException
857       {
858         android.os.Parcel _data = android.os.Parcel.obtain();
859         android.os.Parcel _reply = android.os.Parcel.obtain();
860         boolean _result;
861         try {
862           _data.writeInterfaceToken(DESCRIPTOR);
863           boolean _status = mRemote.transact(Stub.TRANSACTION_isEnabled, _data, _reply, 0);
864           if (!_status && getDefaultImpl() != null) {
865             return getDefaultImpl().isEnabled();
866           }
867           _reply.readException();
868           _result = (0!=_reply.readInt());
869         }
870         finally {
871           _reply.recycle();
872           _data.recycle();
873         }
874         return _result;
875       }
876       @Override public int getState() throws android.os.RemoteException
877       {
878         android.os.Parcel _data = android.os.Parcel.obtain();
879         android.os.Parcel _reply = android.os.Parcel.obtain();
880         int _result;
881         try {
882           _data.writeInterfaceToken(DESCRIPTOR);
883           boolean _status = mRemote.transact(Stub.TRANSACTION_getState, _data, _reply, 0);
884           if (!_status && getDefaultImpl() != null) {
885             return getDefaultImpl().getState();
886           }
887           _reply.readException();
888           _result = _reply.readInt();
889         }
890         finally {
891           _reply.recycle();
892           _data.recycle();
893         }
894         return _result;
895       }
896       @Override public java.lang.String getAddress() throws android.os.RemoteException
897       {
898         android.os.Parcel _data = android.os.Parcel.obtain();
899         android.os.Parcel _reply = android.os.Parcel.obtain();
900         java.lang.String _result;
901         try {
902           _data.writeInterfaceToken(DESCRIPTOR);
903           boolean _status = mRemote.transact(Stub.TRANSACTION_getAddress, _data, _reply, 0);
904           if (!_status && getDefaultImpl() != null) {
905             return getDefaultImpl().getAddress();
906           }
907           _reply.readException();
908           _result = _reply.readString();
909         }
910         finally {
911           _reply.recycle();
912           _data.recycle();
913         }
914         return _result;
915       }
916       /* Test long comment */
917       @Override public android.foo.ExampleParcelable[] getParcelables() throws android.os.RemoteException
918       {
919         android.os.Parcel _data = android.os.Parcel.obtain();
920         android.os.Parcel _reply = android.os.Parcel.obtain();
921         android.foo.ExampleParcelable[] _result;
922         try {
923           _data.writeInterfaceToken(DESCRIPTOR);
924           boolean _status = mRemote.transact(Stub.TRANSACTION_getParcelables, _data, _reply, 0);
925           if (!_status && getDefaultImpl() != null) {
926             return getDefaultImpl().getParcelables();
927           }
928           _reply.readException();
929           _result = _reply.createTypedArray(android.foo.ExampleParcelable.CREATOR);
930         }
931         finally {
932           _reply.recycle();
933           _data.recycle();
934         }
935         return _result;
936       }
937       // Test short comment
938 
939       @Override public boolean setScanMode(int mode, int duration) throws android.os.RemoteException
940       {
941         android.os.Parcel _data = android.os.Parcel.obtain();
942         android.os.Parcel _reply = android.os.Parcel.obtain();
943         boolean _result;
944         try {
945           _data.writeInterfaceToken(DESCRIPTOR);
946           _data.writeInt(mode);
947           _data.writeInt(duration);
948           boolean _status = mRemote.transact(Stub.TRANSACTION_setScanMode, _data, _reply, 0);
949           if (!_status && getDefaultImpl() != null) {
950             return getDefaultImpl().setScanMode(mode, duration);
951           }
952           _reply.readException();
953           _result = (0!=_reply.readInt());
954         }
955         finally {
956           _reply.recycle();
957           _data.recycle();
958         }
959         return _result;
960       }
961       /* Test long comment */// And short comment
962 
963       @Override public void registerBinder(android.bar.IAuxInterface foo) throws android.os.RemoteException
964       {
965         android.os.Parcel _data = android.os.Parcel.obtain();
966         android.os.Parcel _reply = android.os.Parcel.obtain();
967         try {
968           _data.writeInterfaceToken(DESCRIPTOR);
969           _data.writeStrongBinder((((foo!=null))?(foo.asBinder()):(null)));
970           boolean _status = mRemote.transact(Stub.TRANSACTION_registerBinder, _data, _reply, 0);
971           if (!_status && getDefaultImpl() != null) {
972             getDefaultImpl().registerBinder(foo);
973             return;
974           }
975           _reply.readException();
976         }
977         finally {
978           _reply.recycle();
979           _data.recycle();
980         }
981       }
982       @Override public android.test.IExampleInterface getRecursiveBinder() throws android.os.RemoteException
983       {
984         android.os.Parcel _data = android.os.Parcel.obtain();
985         android.os.Parcel _reply = android.os.Parcel.obtain();
986         android.test.IExampleInterface _result;
987         try {
988           _data.writeInterfaceToken(DESCRIPTOR);
989           boolean _status = mRemote.transact(Stub.TRANSACTION_getRecursiveBinder, _data, _reply, 0);
990           if (!_status && getDefaultImpl() != null) {
991             return getDefaultImpl().getRecursiveBinder();
992           }
993           _reply.readException();
994           _result = android.test.IExampleInterface.Stub.asInterface(_reply.readStrongBinder());
995         }
996         finally {
997           _reply.recycle();
998           _data.recycle();
999         }
1000         return _result;
1001       }
1002       @Override public int takesAnInterface(android.test.IAuxInterface2 arg) throws android.os.RemoteException
1003       {
1004         android.os.Parcel _data = android.os.Parcel.obtain();
1005         android.os.Parcel _reply = android.os.Parcel.obtain();
1006         int _result;
1007         try {
1008           _data.writeInterfaceToken(DESCRIPTOR);
1009           _data.writeStrongBinder((((arg!=null))?(arg.asBinder()):(null)));
1010           boolean _status = mRemote.transact(Stub.TRANSACTION_takesAnInterface, _data, _reply, 0);
1011           if (!_status && getDefaultImpl() != null) {
1012             return getDefaultImpl().takesAnInterface(arg);
1013           }
1014           _reply.readException();
1015           _result = _reply.readInt();
1016         }
1017         finally {
1018           _reply.recycle();
1019           _data.recycle();
1020         }
1021         return _result;
1022       }
1023       @Override public int takesAParcelable(android.test.CompoundParcelable.Subclass1 arg, android.test.CompoundParcelable.Subclass2 arg2) throws android.os.RemoteException
1024       {
1025         android.os.Parcel _data = android.os.Parcel.obtain();
1026         android.os.Parcel _reply = android.os.Parcel.obtain();
1027         int _result;
1028         try {
1029           _data.writeInterfaceToken(DESCRIPTOR);
1030           if ((arg!=null)) {
1031             _data.writeInt(1);
1032             arg.writeToParcel(_data, 0);
1033           }
1034           else {
1035             _data.writeInt(0);
1036           }
1037           if ((arg2!=null)) {
1038             _data.writeInt(1);
1039             arg2.writeToParcel(_data, 0);
1040           }
1041           else {
1042             _data.writeInt(0);
1043           }
1044           boolean _status = mRemote.transact(Stub.TRANSACTION_takesAParcelable, _data, _reply, 0);
1045           if (!_status && getDefaultImpl() != null) {
1046             return getDefaultImpl().takesAParcelable(arg, arg2);
1047           }
1048           _reply.readException();
1049           _result = _reply.readInt();
1050           if ((0!=_reply.readInt())) {
1051             arg2.readFromParcel(_reply);
1052           }
1053         }
1054         finally {
1055           _reply.recycle();
1056           _data.recycle();
1057         }
1058         return _result;
1059       }
1060       public static android.test.IExampleInterface sDefaultImpl;
1061     }
1062     static final int TRANSACTION_isEnabled = (android.os.IBinder.FIRST_CALL_TRANSACTION + 0);
1063     static final int TRANSACTION_getState = (android.os.IBinder.FIRST_CALL_TRANSACTION + 1);
1064     static final int TRANSACTION_getAddress = (android.os.IBinder.FIRST_CALL_TRANSACTION + 2);
1065     static final int TRANSACTION_getParcelables = (android.os.IBinder.FIRST_CALL_TRANSACTION + 3);
1066     static final int TRANSACTION_setScanMode = (android.os.IBinder.FIRST_CALL_TRANSACTION + 4);
1067     static final int TRANSACTION_registerBinder = (android.os.IBinder.FIRST_CALL_TRANSACTION + 5);
1068     static final int TRANSACTION_getRecursiveBinder = (android.os.IBinder.FIRST_CALL_TRANSACTION + 6);
1069     static final int TRANSACTION_takesAnInterface = (android.os.IBinder.FIRST_CALL_TRANSACTION + 7);
1070     static final int TRANSACTION_takesAParcelable = (android.os.IBinder.FIRST_CALL_TRANSACTION + 8);
1071     public static boolean setDefaultImpl(android.test.IExampleInterface impl) {
1072       // Only one user of this interface can use this function
1073       // at a time. This is a heuristic to detect if two different
1074       // users in the same process use this function.
1075       if (Stub.Proxy.sDefaultImpl != null) {
1076         throw new IllegalStateException("setDefaultImpl() called twice");
1077       }
1078       if (impl != null) {
1079         Stub.Proxy.sDefaultImpl = impl;
1080         return true;
1081       }
1082       return false;
1083     }
1084     public static android.test.IExampleInterface getDefaultImpl() {
1085       return Stub.Proxy.sDefaultImpl;
1086     }
1087   }
1088   public static final int EXAMPLE_CONSTANT = 3;
1089   public boolean isEnabled() throws android.os.RemoteException;
1090   public int getState() throws android.os.RemoteException;
1091   public java.lang.String getAddress() throws android.os.RemoteException;
1092   /* Test long comment */
1093   @android.annotation.Hide
1094   @android.compat.annotation.UnsupportedAppUsage(overrideSourcePosition="android/test/IExampleInterface.aidl:19:1:19:25")
1095   public android.foo.ExampleParcelable[] getParcelables() throws android.os.RemoteException;
1096   // Test short comment
1097 
1098   public boolean setScanMode(int mode, int duration) throws android.os.RemoteException;
1099   /* Test long comment */// And short comment
1100 
1101   public void registerBinder(android.bar.IAuxInterface foo) throws android.os.RemoteException;
1102   public android.test.IExampleInterface getRecursiveBinder() throws android.os.RemoteException;
1103   public int takesAnInterface(android.test.IAuxInterface2 arg) throws android.os.RemoteException;
1104   public int takesAParcelable(android.test.CompoundParcelable.Subclass1 arg, android.test.CompoundParcelable.Subclass2 arg2) throws android.os.RemoteException;
1105 }
1106 )";
1107 
1108 const char kExpectedJavaOutputWithTrace[] =
1109     R"(/*
1110  * This file is auto-generated.  DO NOT MODIFY.
1111  */
1112 package android.test;
1113 @android.annotation.Hide
1114 @android.compat.annotation.UnsupportedAppUsage(overrideSourcePosition="android/test/IExampleInterface.aidl:10:1:10:21")
1115 public interface IExampleInterface extends android.os.IInterface
1116 {
1117   /** Default implementation for IExampleInterface. */
1118   public static class Default implements android.test.IExampleInterface
1119   {
1120     @Override public boolean isEnabled() throws android.os.RemoteException
1121     {
1122       return false;
1123     }
1124     @Override public int getState() throws android.os.RemoteException
1125     {
1126       return 0;
1127     }
1128     @Override public java.lang.String getAddress() throws android.os.RemoteException
1129     {
1130       return null;
1131     }
1132     /* Test long comment */
1133     @Override public android.foo.ExampleParcelable[] getParcelables() throws android.os.RemoteException
1134     {
1135       return null;
1136     }
1137     // Test short comment
1138 
1139     @Override public boolean setScanMode(int mode, int duration) throws android.os.RemoteException
1140     {
1141       return false;
1142     }
1143     /* Test long comment */// And short comment
1144 
1145     @Override public void registerBinder(android.bar.IAuxInterface foo) throws android.os.RemoteException
1146     {
1147     }
1148     @Override public android.test.IExampleInterface getRecursiveBinder() throws android.os.RemoteException
1149     {
1150       return null;
1151     }
1152     @Override public int takesAnInterface(android.test.IAuxInterface2 arg) throws android.os.RemoteException
1153     {
1154       return 0;
1155     }
1156     @Override public int takesAParcelable(android.test.CompoundParcelable.Subclass1 arg, android.test.CompoundParcelable.Subclass2 arg2) throws android.os.RemoteException
1157     {
1158       return 0;
1159     }
1160     @Override
1161     public android.os.IBinder asBinder() {
1162       return null;
1163     }
1164   }
1165   /** Local-side IPC implementation stub class. */
1166   public static abstract class Stub extends android.os.Binder implements android.test.IExampleInterface
1167   {
1168     private static final java.lang.String DESCRIPTOR = "android.test.IExampleInterface";
1169     /** Construct the stub at attach it to the interface. */
1170     public Stub()
1171     {
1172       this.attachInterface(this, DESCRIPTOR);
1173     }
1174     /**
1175      * Cast an IBinder object into an android.test.IExampleInterface interface,
1176      * generating a proxy if needed.
1177      */
1178     public static android.test.IExampleInterface asInterface(android.os.IBinder obj)
1179     {
1180       if ((obj==null)) {
1181         return null;
1182       }
1183       android.os.IInterface iin = obj.queryLocalInterface(DESCRIPTOR);
1184       if (((iin!=null)&&(iin instanceof android.test.IExampleInterface))) {
1185         return ((android.test.IExampleInterface)iin);
1186       }
1187       return new android.test.IExampleInterface.Stub.Proxy(obj);
1188     }
1189     @Override public android.os.IBinder asBinder()
1190     {
1191       return this;
1192     }
1193     @Override public boolean onTransact(int code, android.os.Parcel data, android.os.Parcel reply, int flags) throws android.os.RemoteException
1194     {
1195       java.lang.String descriptor = DESCRIPTOR;
1196       switch (code)
1197       {
1198         case INTERFACE_TRANSACTION:
1199         {
1200           reply.writeString(descriptor);
1201           return true;
1202         }
1203         case TRANSACTION_isEnabled:
1204         {
1205           data.enforceInterface(descriptor);
1206           boolean _result;
1207           try {
1208             android.os.Trace.traceBegin(android.os.Trace.TRACE_TAG_AIDL, "IExampleInterface::isEnabled::server");
1209             _result = this.isEnabled();
1210           }
1211           finally {
1212             android.os.Trace.traceEnd(android.os.Trace.TRACE_TAG_AIDL);
1213           }
1214           reply.writeNoException();
1215           reply.writeInt(((_result)?(1):(0)));
1216           return true;
1217         }
1218         case TRANSACTION_getState:
1219         {
1220           data.enforceInterface(descriptor);
1221           int _result;
1222           try {
1223             android.os.Trace.traceBegin(android.os.Trace.TRACE_TAG_AIDL, "IExampleInterface::getState::server");
1224             _result = this.getState();
1225           }
1226           finally {
1227             android.os.Trace.traceEnd(android.os.Trace.TRACE_TAG_AIDL);
1228           }
1229           reply.writeNoException();
1230           reply.writeInt(_result);
1231           return true;
1232         }
1233         case TRANSACTION_getAddress:
1234         {
1235           data.enforceInterface(descriptor);
1236           java.lang.String _result;
1237           try {
1238             android.os.Trace.traceBegin(android.os.Trace.TRACE_TAG_AIDL, "IExampleInterface::getAddress::server");
1239             _result = this.getAddress();
1240           }
1241           finally {
1242             android.os.Trace.traceEnd(android.os.Trace.TRACE_TAG_AIDL);
1243           }
1244           reply.writeNoException();
1245           reply.writeString(_result);
1246           return true;
1247         }
1248         case TRANSACTION_getParcelables:
1249         {
1250           data.enforceInterface(descriptor);
1251           android.foo.ExampleParcelable[] _result;
1252           try {
1253             android.os.Trace.traceBegin(android.os.Trace.TRACE_TAG_AIDL, "IExampleInterface::getParcelables::server");
1254             _result = this.getParcelables();
1255           }
1256           finally {
1257             android.os.Trace.traceEnd(android.os.Trace.TRACE_TAG_AIDL);
1258           }
1259           reply.writeNoException();
1260           reply.writeTypedArray(_result, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1261           return true;
1262         }
1263         case TRANSACTION_setScanMode:
1264         {
1265           data.enforceInterface(descriptor);
1266           int _arg0;
1267           _arg0 = data.readInt();
1268           int _arg1;
1269           _arg1 = data.readInt();
1270           boolean _result;
1271           try {
1272             android.os.Trace.traceBegin(android.os.Trace.TRACE_TAG_AIDL, "IExampleInterface::setScanMode::server");
1273             _result = this.setScanMode(_arg0, _arg1);
1274           }
1275           finally {
1276             android.os.Trace.traceEnd(android.os.Trace.TRACE_TAG_AIDL);
1277           }
1278           reply.writeNoException();
1279           reply.writeInt(((_result)?(1):(0)));
1280           return true;
1281         }
1282         case TRANSACTION_registerBinder:
1283         {
1284           data.enforceInterface(descriptor);
1285           android.bar.IAuxInterface _arg0;
1286           _arg0 = android.bar.IAuxInterface.Stub.asInterface(data.readStrongBinder());
1287           try {
1288             android.os.Trace.traceBegin(android.os.Trace.TRACE_TAG_AIDL, "IExampleInterface::registerBinder::server");
1289             this.registerBinder(_arg0);
1290           }
1291           finally {
1292             android.os.Trace.traceEnd(android.os.Trace.TRACE_TAG_AIDL);
1293           }
1294           reply.writeNoException();
1295           return true;
1296         }
1297         case TRANSACTION_getRecursiveBinder:
1298         {
1299           data.enforceInterface(descriptor);
1300           android.test.IExampleInterface _result;
1301           try {
1302             android.os.Trace.traceBegin(android.os.Trace.TRACE_TAG_AIDL, "IExampleInterface::getRecursiveBinder::server");
1303             _result = this.getRecursiveBinder();
1304           }
1305           finally {
1306             android.os.Trace.traceEnd(android.os.Trace.TRACE_TAG_AIDL);
1307           }
1308           reply.writeNoException();
1309           reply.writeStrongBinder((((_result!=null))?(_result.asBinder()):(null)));
1310           return true;
1311         }
1312         case TRANSACTION_takesAnInterface:
1313         {
1314           data.enforceInterface(descriptor);
1315           android.test.IAuxInterface2 _arg0;
1316           _arg0 = android.test.IAuxInterface2.Stub.asInterface(data.readStrongBinder());
1317           int _result;
1318           try {
1319             android.os.Trace.traceBegin(android.os.Trace.TRACE_TAG_AIDL, "IExampleInterface::takesAnInterface::server");
1320             _result = this.takesAnInterface(_arg0);
1321           }
1322           finally {
1323             android.os.Trace.traceEnd(android.os.Trace.TRACE_TAG_AIDL);
1324           }
1325           reply.writeNoException();
1326           reply.writeInt(_result);
1327           return true;
1328         }
1329         case TRANSACTION_takesAParcelable:
1330         {
1331           data.enforceInterface(descriptor);
1332           android.test.CompoundParcelable.Subclass1 _arg0;
1333           if ((0!=data.readInt())) {
1334             _arg0 = android.test.CompoundParcelable.Subclass1.CREATOR.createFromParcel(data);
1335           }
1336           else {
1337             _arg0 = null;
1338           }
1339           android.test.CompoundParcelable.Subclass2 _arg1;
1340           if ((0!=data.readInt())) {
1341             _arg1 = android.test.CompoundParcelable.Subclass2.CREATOR.createFromParcel(data);
1342           }
1343           else {
1344             _arg1 = null;
1345           }
1346           int _result;
1347           try {
1348             android.os.Trace.traceBegin(android.os.Trace.TRACE_TAG_AIDL, "IExampleInterface::takesAParcelable::server");
1349             _result = this.takesAParcelable(_arg0, _arg1);
1350           }
1351           finally {
1352             android.os.Trace.traceEnd(android.os.Trace.TRACE_TAG_AIDL);
1353           }
1354           reply.writeNoException();
1355           reply.writeInt(_result);
1356           if ((_arg1!=null)) {
1357             reply.writeInt(1);
1358             _arg1.writeToParcel(reply, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1359           }
1360           else {
1361             reply.writeInt(0);
1362           }
1363           return true;
1364         }
1365         default:
1366         {
1367           return super.onTransact(code, data, reply, flags);
1368         }
1369       }
1370     }
1371     private static class Proxy implements android.test.IExampleInterface
1372     {
1373       private android.os.IBinder mRemote;
1374       Proxy(android.os.IBinder remote)
1375       {
1376         mRemote = remote;
1377       }
1378       @Override public android.os.IBinder asBinder()
1379       {
1380         return mRemote;
1381       }
1382       public java.lang.String getInterfaceDescriptor()
1383       {
1384         return DESCRIPTOR;
1385       }
1386       @Override public boolean isEnabled() throws android.os.RemoteException
1387       {
1388         android.os.Parcel _data = android.os.Parcel.obtain();
1389         android.os.Parcel _reply = android.os.Parcel.obtain();
1390         boolean _result;
1391         try {
1392           android.os.Trace.traceBegin(android.os.Trace.TRACE_TAG_AIDL, "IExampleInterface::isEnabled::client");
1393           _data.writeInterfaceToken(DESCRIPTOR);
1394           boolean _status = mRemote.transact(Stub.TRANSACTION_isEnabled, _data, _reply, 0);
1395           if (!_status && getDefaultImpl() != null) {
1396             return getDefaultImpl().isEnabled();
1397           }
1398           _reply.readException();
1399           _result = (0!=_reply.readInt());
1400         }
1401         finally {
1402           _reply.recycle();
1403           _data.recycle();
1404           android.os.Trace.traceEnd(android.os.Trace.TRACE_TAG_AIDL);
1405         }
1406         return _result;
1407       }
1408       @Override public int getState() throws android.os.RemoteException
1409       {
1410         android.os.Parcel _data = android.os.Parcel.obtain();
1411         android.os.Parcel _reply = android.os.Parcel.obtain();
1412         int _result;
1413         try {
1414           android.os.Trace.traceBegin(android.os.Trace.TRACE_TAG_AIDL, "IExampleInterface::getState::client");
1415           _data.writeInterfaceToken(DESCRIPTOR);
1416           boolean _status = mRemote.transact(Stub.TRANSACTION_getState, _data, _reply, 0);
1417           if (!_status && getDefaultImpl() != null) {
1418             return getDefaultImpl().getState();
1419           }
1420           _reply.readException();
1421           _result = _reply.readInt();
1422         }
1423         finally {
1424           _reply.recycle();
1425           _data.recycle();
1426           android.os.Trace.traceEnd(android.os.Trace.TRACE_TAG_AIDL);
1427         }
1428         return _result;
1429       }
1430       @Override public java.lang.String getAddress() throws android.os.RemoteException
1431       {
1432         android.os.Parcel _data = android.os.Parcel.obtain();
1433         android.os.Parcel _reply = android.os.Parcel.obtain();
1434         java.lang.String _result;
1435         try {
1436           android.os.Trace.traceBegin(android.os.Trace.TRACE_TAG_AIDL, "IExampleInterface::getAddress::client");
1437           _data.writeInterfaceToken(DESCRIPTOR);
1438           boolean _status = mRemote.transact(Stub.TRANSACTION_getAddress, _data, _reply, 0);
1439           if (!_status && getDefaultImpl() != null) {
1440             return getDefaultImpl().getAddress();
1441           }
1442           _reply.readException();
1443           _result = _reply.readString();
1444         }
1445         finally {
1446           _reply.recycle();
1447           _data.recycle();
1448           android.os.Trace.traceEnd(android.os.Trace.TRACE_TAG_AIDL);
1449         }
1450         return _result;
1451       }
1452       /* Test long comment */
1453       @Override public android.foo.ExampleParcelable[] getParcelables() throws android.os.RemoteException
1454       {
1455         android.os.Parcel _data = android.os.Parcel.obtain();
1456         android.os.Parcel _reply = android.os.Parcel.obtain();
1457         android.foo.ExampleParcelable[] _result;
1458         try {
1459           android.os.Trace.traceBegin(android.os.Trace.TRACE_TAG_AIDL, "IExampleInterface::getParcelables::client");
1460           _data.writeInterfaceToken(DESCRIPTOR);
1461           boolean _status = mRemote.transact(Stub.TRANSACTION_getParcelables, _data, _reply, 0);
1462           if (!_status && getDefaultImpl() != null) {
1463             return getDefaultImpl().getParcelables();
1464           }
1465           _reply.readException();
1466           _result = _reply.createTypedArray(android.foo.ExampleParcelable.CREATOR);
1467         }
1468         finally {
1469           _reply.recycle();
1470           _data.recycle();
1471           android.os.Trace.traceEnd(android.os.Trace.TRACE_TAG_AIDL);
1472         }
1473         return _result;
1474       }
1475       // Test short comment
1476 
1477       @Override public boolean setScanMode(int mode, int duration) throws android.os.RemoteException
1478       {
1479         android.os.Parcel _data = android.os.Parcel.obtain();
1480         android.os.Parcel _reply = android.os.Parcel.obtain();
1481         boolean _result;
1482         try {
1483           android.os.Trace.traceBegin(android.os.Trace.TRACE_TAG_AIDL, "IExampleInterface::setScanMode::client");
1484           _data.writeInterfaceToken(DESCRIPTOR);
1485           _data.writeInt(mode);
1486           _data.writeInt(duration);
1487           boolean _status = mRemote.transact(Stub.TRANSACTION_setScanMode, _data, _reply, 0);
1488           if (!_status && getDefaultImpl() != null) {
1489             return getDefaultImpl().setScanMode(mode, duration);
1490           }
1491           _reply.readException();
1492           _result = (0!=_reply.readInt());
1493         }
1494         finally {
1495           _reply.recycle();
1496           _data.recycle();
1497           android.os.Trace.traceEnd(android.os.Trace.TRACE_TAG_AIDL);
1498         }
1499         return _result;
1500       }
1501       /* Test long comment */// And short comment
1502 
1503       @Override public void registerBinder(android.bar.IAuxInterface foo) throws android.os.RemoteException
1504       {
1505         android.os.Parcel _data = android.os.Parcel.obtain();
1506         android.os.Parcel _reply = android.os.Parcel.obtain();
1507         try {
1508           android.os.Trace.traceBegin(android.os.Trace.TRACE_TAG_AIDL, "IExampleInterface::registerBinder::client");
1509           _data.writeInterfaceToken(DESCRIPTOR);
1510           _data.writeStrongBinder((((foo!=null))?(foo.asBinder()):(null)));
1511           boolean _status = mRemote.transact(Stub.TRANSACTION_registerBinder, _data, _reply, 0);
1512           if (!_status && getDefaultImpl() != null) {
1513             getDefaultImpl().registerBinder(foo);
1514             return;
1515           }
1516           _reply.readException();
1517         }
1518         finally {
1519           _reply.recycle();
1520           _data.recycle();
1521           android.os.Trace.traceEnd(android.os.Trace.TRACE_TAG_AIDL);
1522         }
1523       }
1524       @Override public android.test.IExampleInterface getRecursiveBinder() throws android.os.RemoteException
1525       {
1526         android.os.Parcel _data = android.os.Parcel.obtain();
1527         android.os.Parcel _reply = android.os.Parcel.obtain();
1528         android.test.IExampleInterface _result;
1529         try {
1530           android.os.Trace.traceBegin(android.os.Trace.TRACE_TAG_AIDL, "IExampleInterface::getRecursiveBinder::client");
1531           _data.writeInterfaceToken(DESCRIPTOR);
1532           boolean _status = mRemote.transact(Stub.TRANSACTION_getRecursiveBinder, _data, _reply, 0);
1533           if (!_status && getDefaultImpl() != null) {
1534             return getDefaultImpl().getRecursiveBinder();
1535           }
1536           _reply.readException();
1537           _result = android.test.IExampleInterface.Stub.asInterface(_reply.readStrongBinder());
1538         }
1539         finally {
1540           _reply.recycle();
1541           _data.recycle();
1542           android.os.Trace.traceEnd(android.os.Trace.TRACE_TAG_AIDL);
1543         }
1544         return _result;
1545       }
1546       @Override public int takesAnInterface(android.test.IAuxInterface2 arg) throws android.os.RemoteException
1547       {
1548         android.os.Parcel _data = android.os.Parcel.obtain();
1549         android.os.Parcel _reply = android.os.Parcel.obtain();
1550         int _result;
1551         try {
1552           android.os.Trace.traceBegin(android.os.Trace.TRACE_TAG_AIDL, "IExampleInterface::takesAnInterface::client");
1553           _data.writeInterfaceToken(DESCRIPTOR);
1554           _data.writeStrongBinder((((arg!=null))?(arg.asBinder()):(null)));
1555           boolean _status = mRemote.transact(Stub.TRANSACTION_takesAnInterface, _data, _reply, 0);
1556           if (!_status && getDefaultImpl() != null) {
1557             return getDefaultImpl().takesAnInterface(arg);
1558           }
1559           _reply.readException();
1560           _result = _reply.readInt();
1561         }
1562         finally {
1563           _reply.recycle();
1564           _data.recycle();
1565           android.os.Trace.traceEnd(android.os.Trace.TRACE_TAG_AIDL);
1566         }
1567         return _result;
1568       }
1569       @Override public int takesAParcelable(android.test.CompoundParcelable.Subclass1 arg, android.test.CompoundParcelable.Subclass2 arg2) throws android.os.RemoteException
1570       {
1571         android.os.Parcel _data = android.os.Parcel.obtain();
1572         android.os.Parcel _reply = android.os.Parcel.obtain();
1573         int _result;
1574         try {
1575           android.os.Trace.traceBegin(android.os.Trace.TRACE_TAG_AIDL, "IExampleInterface::takesAParcelable::client");
1576           _data.writeInterfaceToken(DESCRIPTOR);
1577           if ((arg!=null)) {
1578             _data.writeInt(1);
1579             arg.writeToParcel(_data, 0);
1580           }
1581           else {
1582             _data.writeInt(0);
1583           }
1584           if ((arg2!=null)) {
1585             _data.writeInt(1);
1586             arg2.writeToParcel(_data, 0);
1587           }
1588           else {
1589             _data.writeInt(0);
1590           }
1591           boolean _status = mRemote.transact(Stub.TRANSACTION_takesAParcelable, _data, _reply, 0);
1592           if (!_status && getDefaultImpl() != null) {
1593             return getDefaultImpl().takesAParcelable(arg, arg2);
1594           }
1595           _reply.readException();
1596           _result = _reply.readInt();
1597           if ((0!=_reply.readInt())) {
1598             arg2.readFromParcel(_reply);
1599           }
1600         }
1601         finally {
1602           _reply.recycle();
1603           _data.recycle();
1604           android.os.Trace.traceEnd(android.os.Trace.TRACE_TAG_AIDL);
1605         }
1606         return _result;
1607       }
1608       public static android.test.IExampleInterface sDefaultImpl;
1609     }
1610     static final int TRANSACTION_isEnabled = (android.os.IBinder.FIRST_CALL_TRANSACTION + 0);
1611     static final int TRANSACTION_getState = (android.os.IBinder.FIRST_CALL_TRANSACTION + 1);
1612     static final int TRANSACTION_getAddress = (android.os.IBinder.FIRST_CALL_TRANSACTION + 2);
1613     static final int TRANSACTION_getParcelables = (android.os.IBinder.FIRST_CALL_TRANSACTION + 3);
1614     static final int TRANSACTION_setScanMode = (android.os.IBinder.FIRST_CALL_TRANSACTION + 4);
1615     static final int TRANSACTION_registerBinder = (android.os.IBinder.FIRST_CALL_TRANSACTION + 5);
1616     static final int TRANSACTION_getRecursiveBinder = (android.os.IBinder.FIRST_CALL_TRANSACTION + 6);
1617     static final int TRANSACTION_takesAnInterface = (android.os.IBinder.FIRST_CALL_TRANSACTION + 7);
1618     static final int TRANSACTION_takesAParcelable = (android.os.IBinder.FIRST_CALL_TRANSACTION + 8);
1619     public static boolean setDefaultImpl(android.test.IExampleInterface impl) {
1620       // Only one user of this interface can use this function
1621       // at a time. This is a heuristic to detect if two different
1622       // users in the same process use this function.
1623       if (Stub.Proxy.sDefaultImpl != null) {
1624         throw new IllegalStateException("setDefaultImpl() called twice");
1625       }
1626       if (impl != null) {
1627         Stub.Proxy.sDefaultImpl = impl;
1628         return true;
1629       }
1630       return false;
1631     }
1632     public static android.test.IExampleInterface getDefaultImpl() {
1633       return Stub.Proxy.sDefaultImpl;
1634     }
1635   }
1636   public static final int EXAMPLE_CONSTANT = 3;
1637   public boolean isEnabled() throws android.os.RemoteException;
1638   public int getState() throws android.os.RemoteException;
1639   public java.lang.String getAddress() throws android.os.RemoteException;
1640   /* Test long comment */
1641   @android.annotation.Hide
1642   @android.compat.annotation.UnsupportedAppUsage(overrideSourcePosition="android/test/IExampleInterface.aidl:19:1:19:25")
1643   public android.foo.ExampleParcelable[] getParcelables() throws android.os.RemoteException;
1644   // Test short comment
1645 
1646   public boolean setScanMode(int mode, int duration) throws android.os.RemoteException;
1647   /* Test long comment */// And short comment
1648 
1649   public void registerBinder(android.bar.IAuxInterface foo) throws android.os.RemoteException;
1650   public android.test.IExampleInterface getRecursiveBinder() throws android.os.RemoteException;
1651   public int takesAnInterface(android.test.IAuxInterface2 arg) throws android.os.RemoteException;
1652   public int takesAParcelable(android.test.CompoundParcelable.Subclass1 arg, android.test.CompoundParcelable.Subclass2 arg2) throws android.os.RemoteException;
1653 }
1654 )";
1655 
1656 const char kExpectedJavaOutputOutlining[] =
1657     R"(/*
1658  * This file is auto-generated.  DO NOT MODIFY.
1659  */
1660 package android.test;
1661 public interface IExampleInterface extends android.os.IInterface
1662 {
1663   /** Default implementation for IExampleInterface. */
1664   public static class Default implements android.test.IExampleInterface
1665   {
1666     @Override public boolean isEnabled() throws android.os.RemoteException
1667     {
1668       return false;
1669     }
1670     @Override public int getState(int a, int b) throws android.os.RemoteException
1671     {
1672       return 0;
1673     }
1674     @Override public java.lang.String getAddress() throws android.os.RemoteException
1675     {
1676       return null;
1677     }
1678     /* Test long comment */
1679     @Override public android.foo.ExampleParcelable[] getParcelables() throws android.os.RemoteException
1680     {
1681       return null;
1682     }
1683     // Test short comment
1684 
1685     @Override public boolean setScanMode(int mode, int duration) throws android.os.RemoteException
1686     {
1687       return false;
1688     }
1689     /* Test long comment */// And short comment
1690 
1691     @Override public void registerBinder(android.bar.IAuxInterface foo) throws android.os.RemoteException
1692     {
1693     }
1694     @Override public android.test.IExampleInterface getRecursiveBinder() throws android.os.RemoteException
1695     {
1696       return null;
1697     }
1698     @Override public int takesAnInterface(android.test.IAuxInterface2 arg) throws android.os.RemoteException
1699     {
1700       return 0;
1701     }
1702     @Override public int takesAParcelable(android.test.CompoundParcelable.Subclass1 arg, android.test.CompoundParcelable.Subclass2 arg2) throws android.os.RemoteException
1703     {
1704       return 0;
1705     }
1706     @Override
1707     public android.os.IBinder asBinder() {
1708       return null;
1709     }
1710   }
1711   /** Local-side IPC implementation stub class. */
1712   public static abstract class Stub extends android.os.Binder implements android.test.IExampleInterface
1713   {
1714     private static final java.lang.String DESCRIPTOR = "android.test.IExampleInterface";
1715     /** Construct the stub at attach it to the interface. */
1716     public Stub()
1717     {
1718       this.attachInterface(this, DESCRIPTOR);
1719     }
1720     /**
1721      * Cast an IBinder object into an android.test.IExampleInterface interface,
1722      * generating a proxy if needed.
1723      */
1724     public static android.test.IExampleInterface asInterface(android.os.IBinder obj)
1725     {
1726       if ((obj==null)) {
1727         return null;
1728       }
1729       android.os.IInterface iin = obj.queryLocalInterface(DESCRIPTOR);
1730       if (((iin!=null)&&(iin instanceof android.test.IExampleInterface))) {
1731         return ((android.test.IExampleInterface)iin);
1732       }
1733       return new android.test.IExampleInterface.Stub.Proxy(obj);
1734     }
1735     @Override public android.os.IBinder asBinder()
1736     {
1737       return this;
1738     }
1739     @Override public boolean onTransact(int code, android.os.Parcel data, android.os.Parcel reply, int flags) throws android.os.RemoteException
1740     {
1741       java.lang.String descriptor = DESCRIPTOR;
1742       switch (code)
1743       {
1744         case INTERFACE_TRANSACTION:
1745         {
1746           reply.writeString(descriptor);
1747           return true;
1748         }
1749         case TRANSACTION_isEnabled:
1750         {
1751           data.enforceInterface(descriptor);
1752           boolean _result = this.isEnabled();
1753           reply.writeNoException();
1754           reply.writeInt(((_result)?(1):(0)));
1755           return true;
1756         }
1757         case TRANSACTION_getState:
1758         {
1759           return this.onTransact$getState$(data, reply);
1760         }
1761         case TRANSACTION_getAddress:
1762         {
1763           data.enforceInterface(descriptor);
1764           java.lang.String _result = this.getAddress();
1765           reply.writeNoException();
1766           reply.writeString(_result);
1767           return true;
1768         }
1769         case TRANSACTION_getParcelables:
1770         {
1771           data.enforceInterface(descriptor);
1772           android.foo.ExampleParcelable[] _result = this.getParcelables();
1773           reply.writeNoException();
1774           reply.writeTypedArray(_result, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1775           return true;
1776         }
1777         case TRANSACTION_setScanMode:
1778         {
1779           return this.onTransact$setScanMode$(data, reply);
1780         }
1781         case TRANSACTION_registerBinder:
1782         {
1783           return this.onTransact$registerBinder$(data, reply);
1784         }
1785         case TRANSACTION_getRecursiveBinder:
1786         {
1787           return this.onTransact$getRecursiveBinder$(data, reply);
1788         }
1789         case TRANSACTION_takesAnInterface:
1790         {
1791           return this.onTransact$takesAnInterface$(data, reply);
1792         }
1793         case TRANSACTION_takesAParcelable:
1794         {
1795           return this.onTransact$takesAParcelable$(data, reply);
1796         }
1797         default:
1798         {
1799           return super.onTransact(code, data, reply, flags);
1800         }
1801       }
1802     }
1803     private static class Proxy implements android.test.IExampleInterface
1804     {
1805       private android.os.IBinder mRemote;
1806       Proxy(android.os.IBinder remote)
1807       {
1808         mRemote = remote;
1809       }
1810       @Override public android.os.IBinder asBinder()
1811       {
1812         return mRemote;
1813       }
1814       public java.lang.String getInterfaceDescriptor()
1815       {
1816         return DESCRIPTOR;
1817       }
1818       @Override public boolean isEnabled() throws android.os.RemoteException
1819       {
1820         android.os.Parcel _data = android.os.Parcel.obtain();
1821         android.os.Parcel _reply = android.os.Parcel.obtain();
1822         boolean _result;
1823         try {
1824           _data.writeInterfaceToken(DESCRIPTOR);
1825           boolean _status = mRemote.transact(Stub.TRANSACTION_isEnabled, _data, _reply, 0);
1826           if (!_status && getDefaultImpl() != null) {
1827             return getDefaultImpl().isEnabled();
1828           }
1829           _reply.readException();
1830           _result = (0!=_reply.readInt());
1831         }
1832         finally {
1833           _reply.recycle();
1834           _data.recycle();
1835         }
1836         return _result;
1837       }
1838       @Override public int getState(int a, int b) throws android.os.RemoteException
1839       {
1840         android.os.Parcel _data = android.os.Parcel.obtain();
1841         android.os.Parcel _reply = android.os.Parcel.obtain();
1842         int _result;
1843         try {
1844           _data.writeInterfaceToken(DESCRIPTOR);
1845           _data.writeInt(a);
1846           _data.writeInt(b);
1847           boolean _status = mRemote.transact(Stub.TRANSACTION_getState, _data, _reply, 0);
1848           if (!_status && getDefaultImpl() != null) {
1849             return getDefaultImpl().getState(a, b);
1850           }
1851           _reply.readException();
1852           _result = _reply.readInt();
1853         }
1854         finally {
1855           _reply.recycle();
1856           _data.recycle();
1857         }
1858         return _result;
1859       }
1860       @Override public java.lang.String getAddress() throws android.os.RemoteException
1861       {
1862         android.os.Parcel _data = android.os.Parcel.obtain();
1863         android.os.Parcel _reply = android.os.Parcel.obtain();
1864         java.lang.String _result;
1865         try {
1866           _data.writeInterfaceToken(DESCRIPTOR);
1867           boolean _status = mRemote.transact(Stub.TRANSACTION_getAddress, _data, _reply, 0);
1868           if (!_status && getDefaultImpl() != null) {
1869             return getDefaultImpl().getAddress();
1870           }
1871           _reply.readException();
1872           _result = _reply.readString();
1873         }
1874         finally {
1875           _reply.recycle();
1876           _data.recycle();
1877         }
1878         return _result;
1879       }
1880       /* Test long comment */
1881       @Override public android.foo.ExampleParcelable[] getParcelables() throws android.os.RemoteException
1882       {
1883         android.os.Parcel _data = android.os.Parcel.obtain();
1884         android.os.Parcel _reply = android.os.Parcel.obtain();
1885         android.foo.ExampleParcelable[] _result;
1886         try {
1887           _data.writeInterfaceToken(DESCRIPTOR);
1888           boolean _status = mRemote.transact(Stub.TRANSACTION_getParcelables, _data, _reply, 0);
1889           if (!_status && getDefaultImpl() != null) {
1890             return getDefaultImpl().getParcelables();
1891           }
1892           _reply.readException();
1893           _result = _reply.createTypedArray(android.foo.ExampleParcelable.CREATOR);
1894         }
1895         finally {
1896           _reply.recycle();
1897           _data.recycle();
1898         }
1899         return _result;
1900       }
1901       // Test short comment
1902 
1903       @Override public boolean setScanMode(int mode, int duration) throws android.os.RemoteException
1904       {
1905         android.os.Parcel _data = android.os.Parcel.obtain();
1906         android.os.Parcel _reply = android.os.Parcel.obtain();
1907         boolean _result;
1908         try {
1909           _data.writeInterfaceToken(DESCRIPTOR);
1910           _data.writeInt(mode);
1911           _data.writeInt(duration);
1912           boolean _status = mRemote.transact(Stub.TRANSACTION_setScanMode, _data, _reply, 0);
1913           if (!_status && getDefaultImpl() != null) {
1914             return getDefaultImpl().setScanMode(mode, duration);
1915           }
1916           _reply.readException();
1917           _result = (0!=_reply.readInt());
1918         }
1919         finally {
1920           _reply.recycle();
1921           _data.recycle();
1922         }
1923         return _result;
1924       }
1925       /* Test long comment */// And short comment
1926 
1927       @Override public void registerBinder(android.bar.IAuxInterface foo) throws android.os.RemoteException
1928       {
1929         android.os.Parcel _data = android.os.Parcel.obtain();
1930         android.os.Parcel _reply = android.os.Parcel.obtain();
1931         try {
1932           _data.writeInterfaceToken(DESCRIPTOR);
1933           _data.writeStrongBinder((((foo!=null))?(foo.asBinder()):(null)));
1934           boolean _status = mRemote.transact(Stub.TRANSACTION_registerBinder, _data, _reply, 0);
1935           if (!_status && getDefaultImpl() != null) {
1936             getDefaultImpl().registerBinder(foo);
1937             return;
1938           }
1939           _reply.readException();
1940         }
1941         finally {
1942           _reply.recycle();
1943           _data.recycle();
1944         }
1945       }
1946       @Override public android.test.IExampleInterface getRecursiveBinder() throws android.os.RemoteException
1947       {
1948         android.os.Parcel _data = android.os.Parcel.obtain();
1949         android.os.Parcel _reply = android.os.Parcel.obtain();
1950         android.test.IExampleInterface _result;
1951         try {
1952           _data.writeInterfaceToken(DESCRIPTOR);
1953           boolean _status = mRemote.transact(Stub.TRANSACTION_getRecursiveBinder, _data, _reply, 0);
1954           if (!_status && getDefaultImpl() != null) {
1955             return getDefaultImpl().getRecursiveBinder();
1956           }
1957           _reply.readException();
1958           _result = android.test.IExampleInterface.Stub.asInterface(_reply.readStrongBinder());
1959         }
1960         finally {
1961           _reply.recycle();
1962           _data.recycle();
1963         }
1964         return _result;
1965       }
1966       @Override public int takesAnInterface(android.test.IAuxInterface2 arg) throws android.os.RemoteException
1967       {
1968         android.os.Parcel _data = android.os.Parcel.obtain();
1969         android.os.Parcel _reply = android.os.Parcel.obtain();
1970         int _result;
1971         try {
1972           _data.writeInterfaceToken(DESCRIPTOR);
1973           _data.writeStrongBinder((((arg!=null))?(arg.asBinder()):(null)));
1974           boolean _status = mRemote.transact(Stub.TRANSACTION_takesAnInterface, _data, _reply, 0);
1975           if (!_status && getDefaultImpl() != null) {
1976             return getDefaultImpl().takesAnInterface(arg);
1977           }
1978           _reply.readException();
1979           _result = _reply.readInt();
1980         }
1981         finally {
1982           _reply.recycle();
1983           _data.recycle();
1984         }
1985         return _result;
1986       }
1987       @Override public int takesAParcelable(android.test.CompoundParcelable.Subclass1 arg, android.test.CompoundParcelable.Subclass2 arg2) throws android.os.RemoteException
1988       {
1989         android.os.Parcel _data = android.os.Parcel.obtain();
1990         android.os.Parcel _reply = android.os.Parcel.obtain();
1991         int _result;
1992         try {
1993           _data.writeInterfaceToken(DESCRIPTOR);
1994           if ((arg!=null)) {
1995             _data.writeInt(1);
1996             arg.writeToParcel(_data, 0);
1997           }
1998           else {
1999             _data.writeInt(0);
2000           }
2001           if ((arg2!=null)) {
2002             _data.writeInt(1);
2003             arg2.writeToParcel(_data, 0);
2004           }
2005           else {
2006             _data.writeInt(0);
2007           }
2008           boolean _status = mRemote.transact(Stub.TRANSACTION_takesAParcelable, _data, _reply, 0);
2009           if (!_status && getDefaultImpl() != null) {
2010             return getDefaultImpl().takesAParcelable(arg, arg2);
2011           }
2012           _reply.readException();
2013           _result = _reply.readInt();
2014           if ((0!=_reply.readInt())) {
2015             arg2.readFromParcel(_reply);
2016           }
2017         }
2018         finally {
2019           _reply.recycle();
2020           _data.recycle();
2021         }
2022         return _result;
2023       }
2024       public static android.test.IExampleInterface sDefaultImpl;
2025     }
2026     static final int TRANSACTION_isEnabled = (android.os.IBinder.FIRST_CALL_TRANSACTION + 0);
2027     static final int TRANSACTION_getState = (android.os.IBinder.FIRST_CALL_TRANSACTION + 1);
2028     private boolean onTransact$getState$(android.os.Parcel data, android.os.Parcel reply) throws android.os.RemoteException
2029     {
2030       data.enforceInterface(DESCRIPTOR);
2031       int _arg0;
2032       _arg0 = data.readInt();
2033       int _arg1;
2034       _arg1 = data.readInt();
2035       int _result = this.getState(_arg0, _arg1);
2036       reply.writeNoException();
2037       reply.writeInt(_result);
2038       return true;
2039     }
2040     static final int TRANSACTION_getAddress = (android.os.IBinder.FIRST_CALL_TRANSACTION + 2);
2041     static final int TRANSACTION_getParcelables = (android.os.IBinder.FIRST_CALL_TRANSACTION + 3);
2042     static final int TRANSACTION_setScanMode = (android.os.IBinder.FIRST_CALL_TRANSACTION + 4);
2043     private boolean onTransact$setScanMode$(android.os.Parcel data, android.os.Parcel reply) throws android.os.RemoteException
2044     {
2045       data.enforceInterface(DESCRIPTOR);
2046       int _arg0;
2047       _arg0 = data.readInt();
2048       int _arg1;
2049       _arg1 = data.readInt();
2050       boolean _result = this.setScanMode(_arg0, _arg1);
2051       reply.writeNoException();
2052       reply.writeInt(((_result)?(1):(0)));
2053       return true;
2054     }
2055     static final int TRANSACTION_registerBinder = (android.os.IBinder.FIRST_CALL_TRANSACTION + 5);
2056     private boolean onTransact$registerBinder$(android.os.Parcel data, android.os.Parcel reply) throws android.os.RemoteException
2057     {
2058       data.enforceInterface(DESCRIPTOR);
2059       android.bar.IAuxInterface _arg0;
2060       _arg0 = android.bar.IAuxInterface.Stub.asInterface(data.readStrongBinder());
2061       this.registerBinder(_arg0);
2062       reply.writeNoException();
2063       return true;
2064     }
2065     static final int TRANSACTION_getRecursiveBinder = (android.os.IBinder.FIRST_CALL_TRANSACTION + 6);
2066     private boolean onTransact$getRecursiveBinder$(android.os.Parcel data, android.os.Parcel reply) throws android.os.RemoteException
2067     {
2068       data.enforceInterface(DESCRIPTOR);
2069       android.test.IExampleInterface _result = this.getRecursiveBinder();
2070       reply.writeNoException();
2071       reply.writeStrongBinder((((_result!=null))?(_result.asBinder()):(null)));
2072       return true;
2073     }
2074     static final int TRANSACTION_takesAnInterface = (android.os.IBinder.FIRST_CALL_TRANSACTION + 7);
2075     private boolean onTransact$takesAnInterface$(android.os.Parcel data, android.os.Parcel reply) throws android.os.RemoteException
2076     {
2077       data.enforceInterface(DESCRIPTOR);
2078       android.test.IAuxInterface2 _arg0;
2079       _arg0 = android.test.IAuxInterface2.Stub.asInterface(data.readStrongBinder());
2080       int _result = this.takesAnInterface(_arg0);
2081       reply.writeNoException();
2082       reply.writeInt(_result);
2083       return true;
2084     }
2085     static final int TRANSACTION_takesAParcelable = (android.os.IBinder.FIRST_CALL_TRANSACTION + 8);
2086     private boolean onTransact$takesAParcelable$(android.os.Parcel data, android.os.Parcel reply) throws android.os.RemoteException
2087     {
2088       data.enforceInterface(DESCRIPTOR);
2089       android.test.CompoundParcelable.Subclass1 _arg0;
2090       if ((0!=data.readInt())) {
2091         _arg0 = android.test.CompoundParcelable.Subclass1.CREATOR.createFromParcel(data);
2092       }
2093       else {
2094         _arg0 = null;
2095       }
2096       android.test.CompoundParcelable.Subclass2 _arg1;
2097       if ((0!=data.readInt())) {
2098         _arg1 = android.test.CompoundParcelable.Subclass2.CREATOR.createFromParcel(data);
2099       }
2100       else {
2101         _arg1 = null;
2102       }
2103       int _result = this.takesAParcelable(_arg0, _arg1);
2104       reply.writeNoException();
2105       reply.writeInt(_result);
2106       if ((_arg1!=null)) {
2107         reply.writeInt(1);
2108         _arg1.writeToParcel(reply, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2109       }
2110       else {
2111         reply.writeInt(0);
2112       }
2113       return true;
2114     }
2115     public static boolean setDefaultImpl(android.test.IExampleInterface impl) {
2116       // Only one user of this interface can use this function
2117       // at a time. This is a heuristic to detect if two different
2118       // users in the same process use this function.
2119       if (Stub.Proxy.sDefaultImpl != null) {
2120         throw new IllegalStateException("setDefaultImpl() called twice");
2121       }
2122       if (impl != null) {
2123         Stub.Proxy.sDefaultImpl = impl;
2124         return true;
2125       }
2126       return false;
2127     }
2128     public static android.test.IExampleInterface getDefaultImpl() {
2129       return Stub.Proxy.sDefaultImpl;
2130     }
2131   }
2132   public static final int EXAMPLE_CONSTANT = 3;
2133   public boolean isEnabled() throws android.os.RemoteException;
2134   public int getState(int a, int b) throws android.os.RemoteException;
2135   public java.lang.String getAddress() throws android.os.RemoteException;
2136   /* Test long comment */
2137   public android.foo.ExampleParcelable[] getParcelables() throws android.os.RemoteException;
2138   // Test short comment
2139 
2140   public boolean setScanMode(int mode, int duration) throws android.os.RemoteException;
2141   /* Test long comment */// And short comment
2142 
2143   public void registerBinder(android.bar.IAuxInterface foo) throws android.os.RemoteException;
2144   public android.test.IExampleInterface getRecursiveBinder() throws android.os.RemoteException;
2145   public int takesAnInterface(android.test.IAuxInterface2 arg) throws android.os.RemoteException;
2146   public int takesAParcelable(android.test.CompoundParcelable.Subclass1 arg, android.test.CompoundParcelable.Subclass2 arg2) throws android.os.RemoteException;
2147 }
2148 )";
2149 
2150 const char kExpectedJavaOutputWithVersionAndHash[] =
2151     R"(/*
2152  * This file is auto-generated.  DO NOT MODIFY.
2153  */
2154 package android.test;
2155 public interface IExampleInterface extends android.os.IInterface
2156 {
2157   /**
2158    * The version of this interface that the caller is built against.
2159    * This might be different from what {@link #getInterfaceVersion()
2160    * getInterfaceVersion} returns as that is the version of the interface
2161    * that the remote object is implementing.
2162    */
2163   public static final int VERSION = 10;
2164   public static final String HASH = "abcdefg";
2165   /** Default implementation for IExampleInterface. */
2166   public static class Default implements android.test.IExampleInterface
2167   {
2168     @Override public boolean isEnabled() throws android.os.RemoteException
2169     {
2170       return false;
2171     }
2172     @Override public int getState(int a, int b) throws android.os.RemoteException
2173     {
2174       return 0;
2175     }
2176     @Override public java.lang.String getAddress() throws android.os.RemoteException
2177     {
2178       return null;
2179     }
2180     /* Test long comment */
2181     @Override public android.foo.ExampleParcelable[] getParcelables() throws android.os.RemoteException
2182     {
2183       return null;
2184     }
2185     // Test short comment
2186 
2187     @Override public boolean setScanMode(int mode, int duration) throws android.os.RemoteException
2188     {
2189       return false;
2190     }
2191     /* Test long comment */// And short comment
2192 
2193     @Override public void registerBinder(android.bar.IAuxInterface foo) throws android.os.RemoteException
2194     {
2195     }
2196     @Override public android.test.IExampleInterface getRecursiveBinder() throws android.os.RemoteException
2197     {
2198       return null;
2199     }
2200     @Override public int takesAnInterface(android.test.IAuxInterface2 arg) throws android.os.RemoteException
2201     {
2202       return 0;
2203     }
2204     @Override public int takesAParcelable(android.test.CompoundParcelable.Subclass1 arg, android.test.CompoundParcelable.Subclass2 arg2) throws android.os.RemoteException
2205     {
2206       return 0;
2207     }
2208     @Override
2209     public int getInterfaceVersion() {
2210       return 0;
2211     }
2212     @Override
2213     public String getInterfaceHash() {
2214       return "";
2215     }
2216     @Override
2217     public android.os.IBinder asBinder() {
2218       return null;
2219     }
2220   }
2221   /** Local-side IPC implementation stub class. */
2222   public static abstract class Stub extends android.os.Binder implements android.test.IExampleInterface
2223   {
2224     private static final java.lang.String DESCRIPTOR = "android.test.IExampleInterface";
2225     /** Construct the stub at attach it to the interface. */
2226     public Stub()
2227     {
2228       this.attachInterface(this, DESCRIPTOR);
2229     }
2230     /**
2231      * Cast an IBinder object into an android.test.IExampleInterface interface,
2232      * generating a proxy if needed.
2233      */
2234     public static android.test.IExampleInterface asInterface(android.os.IBinder obj)
2235     {
2236       if ((obj==null)) {
2237         return null;
2238       }
2239       android.os.IInterface iin = obj.queryLocalInterface(DESCRIPTOR);
2240       if (((iin!=null)&&(iin instanceof android.test.IExampleInterface))) {
2241         return ((android.test.IExampleInterface)iin);
2242       }
2243       return new android.test.IExampleInterface.Stub.Proxy(obj);
2244     }
2245     @Override public android.os.IBinder asBinder()
2246     {
2247       return this;
2248     }
2249     @Override public boolean onTransact(int code, android.os.Parcel data, android.os.Parcel reply, int flags) throws android.os.RemoteException
2250     {
2251       java.lang.String descriptor = DESCRIPTOR;
2252       switch (code)
2253       {
2254         case INTERFACE_TRANSACTION:
2255         {
2256           reply.writeString(descriptor);
2257           return true;
2258         }
2259         case TRANSACTION_isEnabled:
2260         {
2261           data.enforceInterface(descriptor);
2262           boolean _result = this.isEnabled();
2263           reply.writeNoException();
2264           reply.writeInt(((_result)?(1):(0)));
2265           return true;
2266         }
2267         case TRANSACTION_getState:
2268         {
2269           return this.onTransact$getState$(data, reply);
2270         }
2271         case TRANSACTION_getAddress:
2272         {
2273           data.enforceInterface(descriptor);
2274           java.lang.String _result = this.getAddress();
2275           reply.writeNoException();
2276           reply.writeString(_result);
2277           return true;
2278         }
2279         case TRANSACTION_getParcelables:
2280         {
2281           data.enforceInterface(descriptor);
2282           android.foo.ExampleParcelable[] _result = this.getParcelables();
2283           reply.writeNoException();
2284           reply.writeTypedArray(_result, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2285           return true;
2286         }
2287         case TRANSACTION_setScanMode:
2288         {
2289           return this.onTransact$setScanMode$(data, reply);
2290         }
2291         case TRANSACTION_registerBinder:
2292         {
2293           return this.onTransact$registerBinder$(data, reply);
2294         }
2295         case TRANSACTION_getRecursiveBinder:
2296         {
2297           return this.onTransact$getRecursiveBinder$(data, reply);
2298         }
2299         case TRANSACTION_takesAnInterface:
2300         {
2301           return this.onTransact$takesAnInterface$(data, reply);
2302         }
2303         case TRANSACTION_takesAParcelable:
2304         {
2305           return this.onTransact$takesAParcelable$(data, reply);
2306         }
2307         case TRANSACTION_getInterfaceVersion:
2308         {
2309           data.enforceInterface(descriptor);
2310           reply.writeNoException();
2311           reply.writeInt(getInterfaceVersion());
2312           return true;
2313         }
2314         case TRANSACTION_getInterfaceHash:
2315         {
2316           data.enforceInterface(descriptor);
2317           reply.writeNoException();
2318           reply.writeString(getInterfaceHash());
2319           return true;
2320         }
2321         default:
2322         {
2323           return super.onTransact(code, data, reply, flags);
2324         }
2325       }
2326     }
2327     private static class Proxy implements android.test.IExampleInterface
2328     {
2329       private android.os.IBinder mRemote;
2330       Proxy(android.os.IBinder remote)
2331       {
2332         mRemote = remote;
2333       }
2334       private int mCachedVersion = -1;
2335       private String mCachedHash = "-1";
2336       @Override public android.os.IBinder asBinder()
2337       {
2338         return mRemote;
2339       }
2340       public java.lang.String getInterfaceDescriptor()
2341       {
2342         return DESCRIPTOR;
2343       }
2344       @Override public boolean isEnabled() throws android.os.RemoteException
2345       {
2346         android.os.Parcel _data = android.os.Parcel.obtain();
2347         android.os.Parcel _reply = android.os.Parcel.obtain();
2348         boolean _result;
2349         try {
2350           _data.writeInterfaceToken(DESCRIPTOR);
2351           boolean _status = mRemote.transact(Stub.TRANSACTION_isEnabled, _data, _reply, 0);
2352           if (!_status && getDefaultImpl() != null) {
2353             return getDefaultImpl().isEnabled();
2354           }
2355           _reply.readException();
2356           _result = (0!=_reply.readInt());
2357         }
2358         finally {
2359           _reply.recycle();
2360           _data.recycle();
2361         }
2362         return _result;
2363       }
2364       @Override public int getState(int a, int b) throws android.os.RemoteException
2365       {
2366         android.os.Parcel _data = android.os.Parcel.obtain();
2367         android.os.Parcel _reply = android.os.Parcel.obtain();
2368         int _result;
2369         try {
2370           _data.writeInterfaceToken(DESCRIPTOR);
2371           _data.writeInt(a);
2372           _data.writeInt(b);
2373           boolean _status = mRemote.transact(Stub.TRANSACTION_getState, _data, _reply, 0);
2374           if (!_status && getDefaultImpl() != null) {
2375             return getDefaultImpl().getState(a, b);
2376           }
2377           _reply.readException();
2378           _result = _reply.readInt();
2379         }
2380         finally {
2381           _reply.recycle();
2382           _data.recycle();
2383         }
2384         return _result;
2385       }
2386       @Override public java.lang.String getAddress() throws android.os.RemoteException
2387       {
2388         android.os.Parcel _data = android.os.Parcel.obtain();
2389         android.os.Parcel _reply = android.os.Parcel.obtain();
2390         java.lang.String _result;
2391         try {
2392           _data.writeInterfaceToken(DESCRIPTOR);
2393           boolean _status = mRemote.transact(Stub.TRANSACTION_getAddress, _data, _reply, 0);
2394           if (!_status && getDefaultImpl() != null) {
2395             return getDefaultImpl().getAddress();
2396           }
2397           _reply.readException();
2398           _result = _reply.readString();
2399         }
2400         finally {
2401           _reply.recycle();
2402           _data.recycle();
2403         }
2404         return _result;
2405       }
2406       /* Test long comment */
2407       @Override public android.foo.ExampleParcelable[] getParcelables() throws android.os.RemoteException
2408       {
2409         android.os.Parcel _data = android.os.Parcel.obtain();
2410         android.os.Parcel _reply = android.os.Parcel.obtain();
2411         android.foo.ExampleParcelable[] _result;
2412         try {
2413           _data.writeInterfaceToken(DESCRIPTOR);
2414           boolean _status = mRemote.transact(Stub.TRANSACTION_getParcelables, _data, _reply, 0);
2415           if (!_status && getDefaultImpl() != null) {
2416             return getDefaultImpl().getParcelables();
2417           }
2418           _reply.readException();
2419           _result = _reply.createTypedArray(android.foo.ExampleParcelable.CREATOR);
2420         }
2421         finally {
2422           _reply.recycle();
2423           _data.recycle();
2424         }
2425         return _result;
2426       }
2427       // Test short comment
2428 
2429       @Override public boolean setScanMode(int mode, int duration) throws android.os.RemoteException
2430       {
2431         android.os.Parcel _data = android.os.Parcel.obtain();
2432         android.os.Parcel _reply = android.os.Parcel.obtain();
2433         boolean _result;
2434         try {
2435           _data.writeInterfaceToken(DESCRIPTOR);
2436           _data.writeInt(mode);
2437           _data.writeInt(duration);
2438           boolean _status = mRemote.transact(Stub.TRANSACTION_setScanMode, _data, _reply, 0);
2439           if (!_status && getDefaultImpl() != null) {
2440             return getDefaultImpl().setScanMode(mode, duration);
2441           }
2442           _reply.readException();
2443           _result = (0!=_reply.readInt());
2444         }
2445         finally {
2446           _reply.recycle();
2447           _data.recycle();
2448         }
2449         return _result;
2450       }
2451       /* Test long comment */// And short comment
2452 
2453       @Override public void registerBinder(android.bar.IAuxInterface foo) throws android.os.RemoteException
2454       {
2455         android.os.Parcel _data = android.os.Parcel.obtain();
2456         android.os.Parcel _reply = android.os.Parcel.obtain();
2457         try {
2458           _data.writeInterfaceToken(DESCRIPTOR);
2459           _data.writeStrongBinder((((foo!=null))?(foo.asBinder()):(null)));
2460           boolean _status = mRemote.transact(Stub.TRANSACTION_registerBinder, _data, _reply, 0);
2461           if (!_status && getDefaultImpl() != null) {
2462             getDefaultImpl().registerBinder(foo);
2463             return;
2464           }
2465           _reply.readException();
2466         }
2467         finally {
2468           _reply.recycle();
2469           _data.recycle();
2470         }
2471       }
2472       @Override public android.test.IExampleInterface getRecursiveBinder() throws android.os.RemoteException
2473       {
2474         android.os.Parcel _data = android.os.Parcel.obtain();
2475         android.os.Parcel _reply = android.os.Parcel.obtain();
2476         android.test.IExampleInterface _result;
2477         try {
2478           _data.writeInterfaceToken(DESCRIPTOR);
2479           boolean _status = mRemote.transact(Stub.TRANSACTION_getRecursiveBinder, _data, _reply, 0);
2480           if (!_status && getDefaultImpl() != null) {
2481             return getDefaultImpl().getRecursiveBinder();
2482           }
2483           _reply.readException();
2484           _result = android.test.IExampleInterface.Stub.asInterface(_reply.readStrongBinder());
2485         }
2486         finally {
2487           _reply.recycle();
2488           _data.recycle();
2489         }
2490         return _result;
2491       }
2492       @Override public int takesAnInterface(android.test.IAuxInterface2 arg) throws android.os.RemoteException
2493       {
2494         android.os.Parcel _data = android.os.Parcel.obtain();
2495         android.os.Parcel _reply = android.os.Parcel.obtain();
2496         int _result;
2497         try {
2498           _data.writeInterfaceToken(DESCRIPTOR);
2499           _data.writeStrongBinder((((arg!=null))?(arg.asBinder()):(null)));
2500           boolean _status = mRemote.transact(Stub.TRANSACTION_takesAnInterface, _data, _reply, 0);
2501           if (!_status && getDefaultImpl() != null) {
2502             return getDefaultImpl().takesAnInterface(arg);
2503           }
2504           _reply.readException();
2505           _result = _reply.readInt();
2506         }
2507         finally {
2508           _reply.recycle();
2509           _data.recycle();
2510         }
2511         return _result;
2512       }
2513       @Override public int takesAParcelable(android.test.CompoundParcelable.Subclass1 arg, android.test.CompoundParcelable.Subclass2 arg2) throws android.os.RemoteException
2514       {
2515         android.os.Parcel _data = android.os.Parcel.obtain();
2516         android.os.Parcel _reply = android.os.Parcel.obtain();
2517         int _result;
2518         try {
2519           _data.writeInterfaceToken(DESCRIPTOR);
2520           if ((arg!=null)) {
2521             _data.writeInt(1);
2522             arg.writeToParcel(_data, 0);
2523           }
2524           else {
2525             _data.writeInt(0);
2526           }
2527           if ((arg2!=null)) {
2528             _data.writeInt(1);
2529             arg2.writeToParcel(_data, 0);
2530           }
2531           else {
2532             _data.writeInt(0);
2533           }
2534           boolean _status = mRemote.transact(Stub.TRANSACTION_takesAParcelable, _data, _reply, 0);
2535           if (!_status && getDefaultImpl() != null) {
2536             return getDefaultImpl().takesAParcelable(arg, arg2);
2537           }
2538           _reply.readException();
2539           _result = _reply.readInt();
2540           if ((0!=_reply.readInt())) {
2541             arg2.readFromParcel(_reply);
2542           }
2543         }
2544         finally {
2545           _reply.recycle();
2546           _data.recycle();
2547         }
2548         return _result;
2549       }
2550       @Override
2551       public int getInterfaceVersion() throws android.os.RemoteException {
2552         if (mCachedVersion == -1) {
2553           android.os.Parcel data = android.os.Parcel.obtain();
2554           android.os.Parcel reply = android.os.Parcel.obtain();
2555           try {
2556             data.writeInterfaceToken(DESCRIPTOR);
2557             boolean _status = mRemote.transact(Stub.TRANSACTION_getInterfaceVersion, data, reply, 0);
2558             if (!_status) {
2559               if (getDefaultImpl() != null) {
2560                 return getDefaultImpl().getInterfaceVersion();
2561               }
2562             }
2563             reply.readException();
2564             mCachedVersion = reply.readInt();
2565           } finally {
2566             reply.recycle();
2567             data.recycle();
2568           }
2569         }
2570         return mCachedVersion;
2571       }
2572       @Override
2573       public synchronized String getInterfaceHash() throws android.os.RemoteException {
2574         if ("-1".equals(mCachedHash)) {
2575           android.os.Parcel data = android.os.Parcel.obtain();
2576           android.os.Parcel reply = android.os.Parcel.obtain();
2577           try {
2578             data.writeInterfaceToken(DESCRIPTOR);
2579             boolean _status = mRemote.transact(Stub.TRANSACTION_getInterfaceHash, data, reply, 0);
2580             if (!_status) {
2581               if (getDefaultImpl() != null) {
2582                 return getDefaultImpl().getInterfaceHash();
2583               }
2584             }
2585             reply.readException();
2586             mCachedHash = reply.readString();
2587           } finally {
2588             reply.recycle();
2589             data.recycle();
2590           }
2591         }
2592         return mCachedHash;
2593       }
2594       public static android.test.IExampleInterface sDefaultImpl;
2595     }
2596     static final int TRANSACTION_isEnabled = (android.os.IBinder.FIRST_CALL_TRANSACTION + 0);
2597     static final int TRANSACTION_getState = (android.os.IBinder.FIRST_CALL_TRANSACTION + 1);
2598     private boolean onTransact$getState$(android.os.Parcel data, android.os.Parcel reply) throws android.os.RemoteException
2599     {
2600       data.enforceInterface(DESCRIPTOR);
2601       int _arg0;
2602       _arg0 = data.readInt();
2603       int _arg1;
2604       _arg1 = data.readInt();
2605       int _result = this.getState(_arg0, _arg1);
2606       reply.writeNoException();
2607       reply.writeInt(_result);
2608       return true;
2609     }
2610     static final int TRANSACTION_getAddress = (android.os.IBinder.FIRST_CALL_TRANSACTION + 2);
2611     static final int TRANSACTION_getParcelables = (android.os.IBinder.FIRST_CALL_TRANSACTION + 3);
2612     static final int TRANSACTION_setScanMode = (android.os.IBinder.FIRST_CALL_TRANSACTION + 4);
2613     private boolean onTransact$setScanMode$(android.os.Parcel data, android.os.Parcel reply) throws android.os.RemoteException
2614     {
2615       data.enforceInterface(DESCRIPTOR);
2616       int _arg0;
2617       _arg0 = data.readInt();
2618       int _arg1;
2619       _arg1 = data.readInt();
2620       boolean _result = this.setScanMode(_arg0, _arg1);
2621       reply.writeNoException();
2622       reply.writeInt(((_result)?(1):(0)));
2623       return true;
2624     }
2625     static final int TRANSACTION_registerBinder = (android.os.IBinder.FIRST_CALL_TRANSACTION + 5);
2626     private boolean onTransact$registerBinder$(android.os.Parcel data, android.os.Parcel reply) throws android.os.RemoteException
2627     {
2628       data.enforceInterface(DESCRIPTOR);
2629       android.bar.IAuxInterface _arg0;
2630       _arg0 = android.bar.IAuxInterface.Stub.asInterface(data.readStrongBinder());
2631       this.registerBinder(_arg0);
2632       reply.writeNoException();
2633       return true;
2634     }
2635     static final int TRANSACTION_getRecursiveBinder = (android.os.IBinder.FIRST_CALL_TRANSACTION + 6);
2636     private boolean onTransact$getRecursiveBinder$(android.os.Parcel data, android.os.Parcel reply) throws android.os.RemoteException
2637     {
2638       data.enforceInterface(DESCRIPTOR);
2639       android.test.IExampleInterface _result = this.getRecursiveBinder();
2640       reply.writeNoException();
2641       reply.writeStrongBinder((((_result!=null))?(_result.asBinder()):(null)));
2642       return true;
2643     }
2644     static final int TRANSACTION_takesAnInterface = (android.os.IBinder.FIRST_CALL_TRANSACTION + 7);
2645     private boolean onTransact$takesAnInterface$(android.os.Parcel data, android.os.Parcel reply) throws android.os.RemoteException
2646     {
2647       data.enforceInterface(DESCRIPTOR);
2648       android.test.IAuxInterface2 _arg0;
2649       _arg0 = android.test.IAuxInterface2.Stub.asInterface(data.readStrongBinder());
2650       int _result = this.takesAnInterface(_arg0);
2651       reply.writeNoException();
2652       reply.writeInt(_result);
2653       return true;
2654     }
2655     static final int TRANSACTION_takesAParcelable = (android.os.IBinder.FIRST_CALL_TRANSACTION + 8);
2656     private boolean onTransact$takesAParcelable$(android.os.Parcel data, android.os.Parcel reply) throws android.os.RemoteException
2657     {
2658       data.enforceInterface(DESCRIPTOR);
2659       android.test.CompoundParcelable.Subclass1 _arg0;
2660       if ((0!=data.readInt())) {
2661         _arg0 = android.test.CompoundParcelable.Subclass1.CREATOR.createFromParcel(data);
2662       }
2663       else {
2664         _arg0 = null;
2665       }
2666       android.test.CompoundParcelable.Subclass2 _arg1;
2667       if ((0!=data.readInt())) {
2668         _arg1 = android.test.CompoundParcelable.Subclass2.CREATOR.createFromParcel(data);
2669       }
2670       else {
2671         _arg1 = null;
2672       }
2673       int _result = this.takesAParcelable(_arg0, _arg1);
2674       reply.writeNoException();
2675       reply.writeInt(_result);
2676       if ((_arg1!=null)) {
2677         reply.writeInt(1);
2678         _arg1.writeToParcel(reply, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2679       }
2680       else {
2681         reply.writeInt(0);
2682       }
2683       return true;
2684     }
2685     static final int TRANSACTION_getInterfaceVersion = (android.os.IBinder.FIRST_CALL_TRANSACTION + 16777214);
2686     static final int TRANSACTION_getInterfaceHash = (android.os.IBinder.FIRST_CALL_TRANSACTION + 16777213);
2687     public static boolean setDefaultImpl(android.test.IExampleInterface impl) {
2688       // Only one user of this interface can use this function
2689       // at a time. This is a heuristic to detect if two different
2690       // users in the same process use this function.
2691       if (Stub.Proxy.sDefaultImpl != null) {
2692         throw new IllegalStateException("setDefaultImpl() called twice");
2693       }
2694       if (impl != null) {
2695         Stub.Proxy.sDefaultImpl = impl;
2696         return true;
2697       }
2698       return false;
2699     }
2700     public static android.test.IExampleInterface getDefaultImpl() {
2701       return Stub.Proxy.sDefaultImpl;
2702     }
2703   }
2704   public static final int EXAMPLE_CONSTANT = 3;
2705   public boolean isEnabled() throws android.os.RemoteException;
2706   public int getState(int a, int b) throws android.os.RemoteException;
2707   public java.lang.String getAddress() throws android.os.RemoteException;
2708   /* Test long comment */
2709   public android.foo.ExampleParcelable[] getParcelables() throws android.os.RemoteException;
2710   // Test short comment
2711 
2712   public boolean setScanMode(int mode, int duration) throws android.os.RemoteException;
2713   /* Test long comment */// And short comment
2714 
2715   public void registerBinder(android.bar.IAuxInterface foo) throws android.os.RemoteException;
2716   public android.test.IExampleInterface getRecursiveBinder() throws android.os.RemoteException;
2717   public int takesAnInterface(android.test.IAuxInterface2 arg) throws android.os.RemoteException;
2718   public int takesAParcelable(android.test.CompoundParcelable.Subclass1 arg, android.test.CompoundParcelable.Subclass2 arg2) throws android.os.RemoteException;
2719   public int getInterfaceVersion() throws android.os.RemoteException;
2720   public String getInterfaceHash() throws android.os.RemoteException;
2721 }
2722 )";
2723 
2724 }  // namespace example_interface
2725 }  // namespace test_data
2726 }  // namespace aidl
2727 }  // namespace android
2728