Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7ef191c8 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Update AIBinder_setExtension docs" into main

parents ec4fb37b 49842f1b
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -718,9 +718,17 @@ binder_status_t AIBinder_getExtension(AIBinder* binder, AIBinder** outExt) __INT
 *     When registering the interface, add:
 *         std::shared_ptr<MyFoo> foo = new MyFoo; // class in AOSP codebase
 *         std::shared_ptr<MyBar> bar = new MyBar; // custom extension class
 *         ... = AIBinder_setExtension(foo->asBinder().get(), bar->asBinder().get());
 *         SpAIBinder binder = foo->asBinder(); // target binder to extend
 *         ... = AIBinder_setExtension(binder.get(), bar->asBinder().get());
 *         ... = AServiceManager_addService(binder.get(), instanceName);
 *         // handle error
 *
 *         Do not use foo->asBinder().get() as the target binder argument to
 *         AIBinder_setExtensions because asBinder it creates a new binder
 *         object that will be destroyed after the function is called. The same
 *         binder object must be used for AIBinder_setExtension and
 *         AServiceManager_addService to register the service with an extension.
 *
 *     Then, clients of IFoo can get this extension:
 *         SpAIBinder binder = ...;
 *         std::shared_ptr<IFoo> foo = IFoo::fromBinder(binder); // handle if null