That is a type of posts the place I may reply in a single sentence, however I made a decision to incorporate a narrative behind this small however maybe apparent discovery of mine about AOSP. While you’re an Android App developer and be a part of the group constructing the OS for VR headsets, it is a bit of a problem. All the pieces is so acquainted but so totally different.
It was 2019, half a 12 months earlier than the pandemic began, I joined Oculus, it is humorous how many individuals do not even know it is a part of Fb. I joined the VROS group that’s constructing the most effective OS for VR, then MR, and hopefully AR sooner or later. I am excited to enter the VR area with my expertise in Android App improvement: migrate to Dagger, constantly take a look at higher RxJava operators appropriate for displaying record of things, apply MVP then MVVM then Unidirectional Move, transfer the View on Display screen 3 pixels left then proper 4 . It is a new space for me and an unknown territory when working with AOSP (VROS is Android itself).
Regardless of being a good Android App developer (I hope), I’ve by no means understood why I would wish an Android Service. The one factor I miss from working with companies is a really previous presentation of HTTP requests within the background the place an instance exhibits a service utilizing HttpUrlConnection to course of bytes backwards and forwards. I am at all times undecided why it wants a Service. One of many few locations the place I cope with Providers as an Utility developer is that each one these fancy SDKs and libs used the Service to “mix” the whole lot within the background, however you simply name the SDK API and do not care a lot concerning the Service implementation (until there’s a bug).
So I obtained a heat welcome from VROS or the truth that AOSP is usually Android Service or System Service speaking to one another through IPC, HAL, Broadcast and Intent. Now it isn’t about Exercise lifecycle quirks however weekdays going by means of Java and JNI boilerplates to get the native code and lots of instances AIDL to get the Translate behaviors primary service. And if within the case of Broadcasts and Intents as an App developer you know the way to seek for actions and discover uncooked string representations (i.e. NEXT_ALARM_CLOCK_CHANGED) and JNI are normally additionally searchable by methodology title as they’re fastidiously named and distinguishable from the whole lot else, however for AIDL I needed to scratch my head a bit. on the time.
AIDL, when you do not keep in mind, is **Android interface definition language — an interface might be carried out someplace within the codebase and can’t “bodily” (as a lot because the phrase is utilized to code) be related to the implementation if you should utilize an some good IDEs and naturally no IDEs with listed search (like ctrl+B in IntelliJ IDEA) can work properly with the entire AOSP. In order that textual content search is – https://cs.android.com/android/platform/superproject.
IE Telephone Supervisor class is a part of the Android framework that gives “details about the telephony companies on the system”. It makes use of ITelephony.aidl below the hood to speak with different system companies that talk with deeper layers to get info. So if that you must discover a strategy to implement the category behind that interface, the obvious factor is Precise seek for the phrase “ITelephony” provides you tons of of locations to take a look at. Not a brilliant environment friendly strategy to spend time going by means of all of them (which I did).
I’ve checked out different examples to make my search simpler and can solely present right here one instance to show the purpose (actually I spent a number of weeks with totally different duties to comprehend myself). how silly). Vitality Supervisor with out introduction and it makes use of iPowerManager.aidl which I’d count on to be carried out by PowerManager, however not as a result of it makes use of one. Related steps – seek for “IPowerManager” and luck is excessive sufficient within the search outcomes:
So “IPowerManager.Stub” or higher but “extends IPowerManager.Stub” looks as if an affordable question to make use of. And sure it really works with the unique case – “develop ITelephony.Stub” provides precisely one outcome to be 100% certain that is the implementation I have to cope with.
Fairly easy. In some unspecified time in the future I even tried to ask ChatGPT, Bard and Bing to point out me the right way to implement the required AIDL, so the AI shouldn’t be there but (shut however not actual), at the very least this month I will not lose my job.
If you wish to discover the code to obtain and course of calls by means of AIDL, search “AIDLInterfaceName.Stub” or share a greater method within the feedback (I actually admire that).
It is nice to study one thing new and even after a decade of working with Android as an App developer, it is enjoyable to dig deep into AOSP!
Are you packaging APKs or working with AOSP?