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