test_data_example_interface.cpp 95 KB

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