<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by anuragsingh on Medium]]></title>
        <description><![CDATA[Stories by anuragsingh on Medium]]></description>
        <link>https://medium.com/@anuragsingh7238?source=rss-bcf9b9b5f273------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*kpP6ltZE1Elw_dOniAwniQ.png</url>
            <title>Stories by anuragsingh on Medium</title>
            <link>https://medium.com/@anuragsingh7238?source=rss-bcf9b9b5f273------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 20:14:16 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@anuragsingh7238/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Understanding Routine Identifier (RID) in Automotive Diagnostics (AAOS)]]></title>
            <link>https://medium.com/@anuragsingh7238/understanding-routine-identifier-rid-in-automotive-diagnostics-aaos-bed2e0693a76?source=rss-bcf9b9b5f273------2</link>
            <guid isPermaLink="false">https://medium.com/p/bed2e0693a76</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[automotive]]></category>
            <category><![CDATA[embedded-systems]]></category>
            <category><![CDATA[android-automotive]]></category>
            <dc:creator><![CDATA[anuragsingh]]></dc:creator>
            <pubDate>Tue, 04 Aug 2026 19:05:54 GMT</pubDate>
            <atom:updated>2026-08-04T19:05:54.158Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ua1SqtolhUR6IT9IbRcDsQ.png" /></figure><h4><strong>What is a Routine Identifier (RID)?</strong></h4><p>A <strong>Routine Identifier (RID)</strong> is a unique identifier used in the <strong>Unified Diagnostic Services (UDS)</strong> protocol (ISO 14229) to execute a predefined routine or function inside an Electronic Control Unit (ECU).</p><p>Unlike a <strong>Data Identifier (DID)</strong>, which is used to read or write stored information, an RID is used to <strong>start, stop, or retrieve the results of an ECU operation</strong>.</p><p>Think of it this way:</p><ul><li><strong>DID = Read or Write a Variable</strong></li><li><strong>RID = Execute a Function</strong></li></ul><p>If a DID is similar to reading a variable in programming, then an RID is equivalent to calling a function that performs a specific task.</p><p><strong>Routine Identifiers (RIDs) </strong>are a key component of the UDS diagnostic protocol, enabling ECUs to execute predefined operations rather than simply exposing stored data. From camera calibration and steering angle alignment to flash memory erase and battery balancing, RIDs support many of the critical maintenance and diagnostic functions used throughout a vehicle’s lifecycle.</p><h3>RID in the UDS Protocol (0x31 RoutineControl)</h3><p>Routine Identifiers are controlled using the <strong>Routine Control</strong> service. RIDs are primarily operated using the UDS <strong>RoutineControl (</strong><strong>0x31)</strong> service. This service provides three distinct sub-functions to control and read the status of an ECU routine:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/749/1*XuUjVuBNrjMpm6GCBP-AuQ.png" /></figure><h3>1. Start Routine (sub-function 0x01)</h3><p>This command instructs the ECU to begin executing a predefined routine.</p><blockquote>Example:<em> Commanding the ECU to initiate an automated brake bleeding or sensor calibration routine.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/1*-x08BCJXSz4bxQjgvOezTg.png" /></figure><h3>2. Stop Routine (sub-function 0x02)</h3><p>Some routines run continuously until instructed to stop. Forces the ECU to halt an actively running routine safely.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/747/1*lzzEaeossjlF4YOEcgqDAA.png" /></figure><h3>3. Request Routine Results (sub-function 0x03)</h3><p>Many routines require time to complete. Instead of waiting indefinitely, the diagnostic tester requests the result. Acts as the <strong>Read Routine Data</strong> mechanism. It asks the ECU for the current status, execution state, or final test results of the routine associated with the specified RID.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/753/1*jUP7pCuMj8WUBFNLgQm2UQ.png" /></figure><h3>How RID Works ?</h3><p>How does a diagnostic request for an RID flow from an Android application down to the vehicle ECU?</p><p>When the ECU receives an RID request, it:</p><ol><li>Validates the diagnostic session.</li><li>Checks security permissions.</li><li>Verifies that the requested RID exists.</li><li>Executes the routine.</li><li>Returns the execution status or results.</li></ol><p>For example, if a service application initiates a camera calibration:</p><ol><li>The application requests camera calibration.</li><li>Car Service forwards the request.</li><li>Vehicle HAL communicates with the Diagnostic HAL.</li><li>The Diagnostic HAL sends a UDS Routine Control request (Service 0x31).</li><li>The ECU executes the calibration routine.</li><li>The result is returned through the same software layers back to the application.</li></ol><p>This abstraction allows Android applications to work with vehicle functions without handling low-level communication details.</p><p>#AndroidAutomotive #AutomotiveSoftware #VehicleDiagnostics #VHAL #EmbeddedLinux #AAOS #Android #RID #UDS #RoutineControl</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bed2e0693a76" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Data Identifiers (DIDs) in Android Automotive (AAOS)]]></title>
            <link>https://medium.com/@anuragsingh7238/understanding-data-identifiers-dids-in-android-automotive-aaos-4b180013974d?source=rss-bcf9b9b5f273------2</link>
            <guid isPermaLink="false">https://medium.com/p/4b180013974d</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[android-automotive]]></category>
            <category><![CDATA[automotive]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[embedded-systems]]></category>
            <dc:creator><![CDATA[anuragsingh]]></dc:creator>
            <pubDate>Tue, 04 Aug 2026 16:58:26 GMT</pubDate>
            <atom:updated>2026-08-04T17:11:40.028Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KPK-q7e-tfs5DGwC780K0A.png" /></figure><h3>What is a Data Identifier (DID)?</h3><p>A <strong>Data Identifier (DID)</strong> is a unique identifier used in the <strong>Unified Diagnostic Services (UDS)</strong> protocol (ISO 14229) to represent a specific piece of information stored inside an Electronic Control Unit (ECU). You can think of a DID as an address or label for a particular data item inside the ECU.</p><p>In automotive diagnostics, a <strong>DID</strong> (Data Identifier) is a 2-byte code used under the <a href="https://en.wikipedia.org/wiki/Unified_Diagnostic_Services">Unified Diagnostic Services</a> (UDS) protocol to request specific data values — such as sensor readings, the <a href="https://www.dgtech.com/wp-content/uploads/2019/08/WP1903_UDS_V01.pdf">VIN</a>, or software versions — from a vehicle’s electronic control unit. Each data item is assigned a unique hexadecimal identifier.</p><h3>DID in the UDS Protocol</h3><p>DIDs are primarily used with two UDS services:</p><h4><strong>Reading and Writing DIDs -</strong></h4><ul><li><strong>Reading Data:</strong> You use the <strong>ReadDataByIdentifier (0x22)</strong> service to request specific values (like the VIN or sensor states) from an Electronic Control Unit (ECU).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/755/1*nWZZmoyCMkudz2cFWb_Xcg.png" /><figcaption><strong>Fig : This service reads data from an ECU</strong></figcaption></figure><ul><li><strong>Writing Data:</strong> You use the <strong>WriteDataByIdentifier (0x2E)</strong> service to update or store new configuration values into the ECU’s memory.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/754/1*HFTp3ObazZh2OWSH70ndIA.png" /><figcaption><strong>Fig : DID writing data into the ECU</strong></figcaption></figure><h4><strong>Key Rules for Access -</strong></h4><ul><li><strong>Read-Only vs. Read/Write:</strong> Not every DID can be written to. Many DIDs (like hardware or software part numbers) are configured by the manufacturer as read-only.</li><li><strong>Security Access:</strong> To write data using service 0x2E, you often need to unlock the ECU first using a security access service like 0x27 (Seed &amp; Key) to prevent unauthorized changes.</li></ul><h4>DID Communication in Android Automotive OS (AAOS)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/758/1*trxowM3V2h3-r0DdMmXL4A.png" /><figcaption><strong>Fig : Detailed Architectural Flow Diagram</strong></figcaption></figure><p>For example, when an application wants to display the vehicle VIN:</p><ol><li>The application requests the VIN.</li><li>Car Service forwards the request to Vehicle HAL.</li><li>Vehicle HAL communicates with the vehicle network.</li><li>The Engine ECU receives a UDS Read Data by Identifier request.</li><li>The ECU returns the VIN.</li><li>The VIN is displayed in the application.</li></ol><p>This layered architecture abstracts the complexity of vehicle communication from application developers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r1xuIxNtVnyQtG5HWHqbaQ.png" /></figure><p>#AndroidAutomotive #AutomotiveSoftware #VehicleDiagnostics #VHAL #EmbeddedLinux #AAOS #Android #DID #Diagnostic</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4b180013974d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Android Auto vs Android Automotive OS (AAOS): Complete Automotive AOSP Guide (2026)]]></title>
            <link>https://medium.com/@anuragsingh7238/android-auto-vs-android-automotive-os-aaos-complete-automotive-aosp-guide-2026-c10e1081eca1?source=rss-bcf9b9b5f273------2</link>
            <guid isPermaLink="false">https://medium.com/p/c10e1081eca1</guid>
            <category><![CDATA[aosp]]></category>
            <category><![CDATA[android-automotive]]></category>
            <category><![CDATA[autonomous-cars]]></category>
            <category><![CDATA[automotive]]></category>
            <category><![CDATA[infotainment]]></category>
            <dc:creator><![CDATA[anuragsingh]]></dc:creator>
            <pubDate>Sat, 27 Dec 2025 21:39:43 GMT</pubDate>
            <atom:updated>2025-12-27T21:45:44.503Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CFcORuuMTo47tLX1cNaqRg.jpeg" /></figure><h3>What Is Android Auto? (Projection-Based System)</h3><p><strong>Android Auto</strong> is <strong>not an operating system</strong>. <br>It is a <strong>phone projection framework</strong>.</p><h3>How Android Auto Works</h3><ul><li>Runs entirely on the <strong>Android phone</strong></li><li>Car screen only mirrors the UI</li><li>Apps execute on the phone CPU</li><li>Vehicle hardware is mostly inaccessible</li></ul><h3>Android Auto Limitations</h3><ul><li>No access to <strong>Vehicle HAL (VHAL)</strong></li><li>No CAN bus interaction</li><li>No climate or speed control</li><li>Strict UI templates only</li></ul><p><strong>Android Auto is designed for convenience, not vehicle control.</strong></p><h3>What Is Android Automotive OS (AAOS)? (Native Automotive OS)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YYHDj71CtHsrrPzM.jpg" /></figure><p><strong>Android Automotive OS (AAOS)</strong> is a <strong>full Android OS running directly on vehicle hardware</strong>. Companies like <strong>Volvo</strong> and <strong>Polestar</strong> use AAOS as their primary infotainment platform. It is built on <strong>Automotive AOSP</strong> and deeply integrated with the car.</p><h3>AAOS Key Characteristics</h3><ul><li>No phone required</li><li>Runs on car SoC</li><li>OEM-controlled system</li><li>Direct access to vehicle data</li><li>Supports system services &amp; HALs</li></ul><h3>Android Auto vs Android Automotive : Comparison</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/784/1*MQnPf488-_9pdsMEX8F1lQ.png" /></figure><h3>Automotive AOSP: Why AAOS Matters</h3><p>From an <strong>AOSP developer perspective</strong>, AAOS is where real engineering happens.</p><h3>AAOS Allows:</h3><ul><li>Custom <strong>SystemServer services</strong></li><li>AIDL-based HALs</li><li>SELinux automotive domains</li><li>CarService extensions</li><li>OEM frameworks</li></ul><p>This is why <strong>Automotive AOSP engineers</strong> focus on AAOS — not Android Auto.</p><h3>App Development: Android Auto vs AAOS</h3><h4>Android Auto App Development</h4><ul><li>Media &amp; navigation apps only</li><li>Template-based UI</li><li>No background services</li><li>No hardware access</li></ul><h4>AAOS App Development</h4><ul><li>Native Android apps</li><li>System apps possible</li><li>Privileged permissions</li><li>Vehicle data access</li><li>Direct Binder / AIDL communication</li></ul><p>AAOS supports <strong>true system-level Android development</strong>.</p><h3>Why OEMs Prefer Android Automotive OS</h3><p>OEMs move to AAOS because it provides:</p><ul><li>Full UX ownership</li><li>Vehicle data control</li><li>Subscription features</li><li>Long-term OTA strategy</li><li>Reduced phone dependency</li></ul><p>Android Auto does not offer these advantages.</p><h3>Use-Case Comparison</h3><h3>When Android Auto Makes Sense</h3><ul><li>Budget cars</li><li>Personal vehicle use</li><li>Minimal OEM software effort</li></ul><h3>When AAOS Is the Right Choice</h3><ul><li>Electric vehicles</li><li>Premium infotainment</li><li>Fleet &amp; commercial vehicles</li><li>Long software lifecycle</li><li>Deep vehicle integration</li></ul><h3>Why OEMs Prefer Android Automotive OS</h3><p>OEMs increasingly adopt AAOS because it offers:</p><ul><li>Full ownership of in-vehicle UX</li><li>Direct control over vehicle data</li><li>Subscription-based feature models</li><li>Long-term OTA update strategy</li><li>Reduced dependency on smartphones</li></ul><p>Android Auto does <strong>not</strong> provide these capabilities.</p><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><h3>Who This Article Is For (Search Intent Clarified)</h3><p>This article is written <strong>specifically</strong> for readers searching for:</p><ul><li><strong>Android Automotive OS vs Android Auto</strong></li><li><strong>AAOS architecture explained</strong></li><li><strong>Automotive AOSP system design</strong></li><li><strong>AAOS interview preparation</strong></li><li><strong>How Android works inside cars</strong></li><li><strong>Difference between Android Auto and AAOS</strong></li><li><strong>AAOS vs Android Auto for OEMs</strong></li></ul><p>If you are trying to understand <strong>how Android actually integrates with vehicle hardware</strong>, <strong>where AOSP fits into automotive systems</strong>, or <strong>why OEMs are moving toward AAOS</strong>, this article addresses that intent directly.</p><p>AAOS supports <strong>true system-level Android development</strong>, not just projection.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c10e1081eca1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Add a New Vehicle Property in Android Automotive OS (VHAL)]]></title>
            <link>https://medium.com/@anuragsingh7238/how-to-add-a-new-vehicle-property-in-android-automotive-os-vhal-d2e73e5649b0?source=rss-bcf9b9b5f273------2</link>
            <guid isPermaLink="false">https://medium.com/p/d2e73e5649b0</guid>
            <category><![CDATA[automotive]]></category>
            <category><![CDATA[vhal]]></category>
            <category><![CDATA[infotainment]]></category>
            <category><![CDATA[hal]]></category>
            <category><![CDATA[aosp]]></category>
            <dc:creator><![CDATA[anuragsingh]]></dc:creator>
            <pubDate>Thu, 24 Jul 2025 01:16:24 GMT</pubDate>
            <atom:updated>2025-07-24T01:16:24.096Z</atom:updated>
            <content:encoded><![CDATA[<h3>🚗 What is VHAL?</h3><p><strong>VHAL (Vehicle HAL)</strong> is a <strong>specialized hardware abstraction layer</strong> designed specifically for <strong>Android Automotive OS (AAOS)</strong>. It acts as a <strong>communication bridge</strong> between Android’s higher-level <strong>Car Services</strong> and the <strong>underlying vehicle ECU (Electronic Control Unit)</strong> or simulation stack.</p><h3>✅ Key Functions:</h3><ul><li>To Access vehicle data like <strong>speed, RPM, fuel level, HVAC, door status, etc.</strong></li><li>Serves the <strong>CarPropertyManager API</strong> in Android apps.</li><li>Ensures <strong>standardized and extendable</strong> integration between Android and embedded vehicle subsystems.</li></ul><p>🔧 1. VehicleProperty.aidl</p><p>📌 Location:</p><pre>hardware/interfaces/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl</pre><h3>✅ Purpose:</h3><p>Defines <strong>all property IDs</strong> used in the VHAL — things like speed, fuel level, HVAC status, door locks, and custom vendor-defined properties.</p><p>This AIDL file defines the <strong>enumerated list of all supported vehicle property IDs</strong>. These IDs uniquely identify the data points exposed by the vehicle — like speed, temperature, or custom vendor signals.</p><h3>🧩 Example:</h3><pre>@Backing(type=&quot;int&quot;)<br>enum VehicleProperty {<br>    VEHICLE_SPEED = 0x00000103,<br>    HVAC_FAN_SPEED = 0x05000503,<br>    MY_CUSTOM_PROPERTY = 0x0FFFFFFF,  // Vendor-defined<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/811/1*1F3m3ngyPT0_DErJ3N2PdA.png" /></figure><h3>🚦 Importance:</h3><ul><li>Each property ID follows a <strong>bit-encoded structure</strong>:<br> 0xPPTTNNNN (PP = group, TT = type, NNNN = number).</li><li>Used by <strong>both HAL (C++) and framework (Java)</strong> to identify vehicle data items.</li><li>Without defining your property here, it cannot be referenced or accessed anywhere else in the HAL stack.</li></ul><h3>⚙️ 2. DefaultConfig.cpp</h3><h3>📌 Location:</h3><pre>hardware/interfaces/automotive/vehicle/aidl/default/impl/vhal_v2_0/DefaultConfig.cpp</pre><h3>✅ Purpose:</h3><p>This file <strong>registers and configures</strong> all the vehicle properties your HAL supports — like setting the access type (read/write), update mode, and data type.</p><h3>🧩 Example Entry:</h3><pre>{<br>    .prop = toInt(VehicleProperty::VEHICLE_SPEED),<br>    .access = VehiclePropertyAccess::READ,<br>    .changeMode = VehiclePropertyChangeMode::CONTINUOUS,<br>    .valueType = VehiclePropertyType::FLOAT,<br>    .configArray = {100},  // e.g., max sample rate<br>}</pre><h3>💡 Why It’s Important:</h3><ul><li>Provides <strong>metadata about each property</strong>.</li><li>Used during VehicleHal::onInit() to <strong>initialize and advertise</strong> supported properties to the Android framework.</li><li>Without it, the framework won’t know the HAL supports the property!</li></ul><h3>🧠 3. DefaultVehicleHal.cpp</h3><h3>📌 Location:</h3><pre>hardware/interfaces/automotive/vehicle/aidl/default/impl/vhal_v2_0/DefaultVehicleHal.cpp</pre><h3>✅ Purpose:</h3><p>Implements the actual logic to <strong>get or set</strong> each vehicle property and manage its values.</p><h3>🔩 Key Methods:</h3><ul><li>onInit() → Initializes the HAL, loads supported properties from DefaultConfig.</li><li>onPropertySet() → Handles set() calls from the framework.</li><li>onPropertyGet() → Responds to get() calls.</li><li>onPropertySubscribe() → Handles data subscription, if change mode is CONTINUOUS.</li></ul><h3>🧩 Example:</h3><pre>ScopedAStatus DefaultVehicleHal::onPropertyGet(const VehiclePropGet&amp; request, VehiclePropValue* outValue) {<br>    switch (request.propId) {<br>        case toInt(VehicleProperty::VEHICLE_SPEED):<br>            outValue-&gt;value.floatValues = {42.0f};<br>            return ScopedAStatus::ok();<br>    }<br>    return ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);<br>}</pre><h3>🚗 Real Example:</h3><p>If the Android app calls:</p><pre>carPropertyManager.getFloatProperty(VehiclePropertyIds.VEHICLE_SPEED, 0)</pre><p>→ DefaultVehicleHal::onPropertyGet() gets invoked<br> → Returns 42.0f as the speed.</p><h3>🔄 Summary Table</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/811/1*yI10Xw7tGvFGGMY3_ubM2A.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d2e73e5649b0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HAL using AIDL]]></title>
            <link>https://medium.com/@anuragsingh7238/hal-using-aidl-a0202a16c904?source=rss-bcf9b9b5f273------2</link>
            <guid isPermaLink="false">https://medium.com/p/a0202a16c904</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[hal-for-aidl]]></category>
            <category><![CDATA[hal]]></category>
            <category><![CDATA[aosp]]></category>
            <category><![CDATA[aidl]]></category>
            <dc:creator><![CDATA[anuragsingh]]></dc:creator>
            <pubDate>Thu, 24 Jul 2025 00:17:45 GMT</pubDate>
            <atom:updated>2026-08-04T17:08:02.139Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>HAL</strong> is the <strong>bridge between the Android Framework and hardware implementations</strong>. <strong>HAL (Hardware Abstraction Layer)</strong> in AOSP is a <strong>layer of code</strong> that lets Android Framework interact with <strong>device hardware or low-level system components</strong> (like sensors, camera, radio, or even software-only subsystems) without knowing the details of the hardware implementation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8d04ROXe92JBY9aNzn0pzA.png" /></figure><h3>🔍 Why HAL Exists</h3><p>Android runs on a wide variety of devices. Instead of writing custom framework code for every hardware, HAL allows:</p><blockquote><em>🔁 </em><strong><em>Standardized Interfaces ↔ Custom Implementations</em></strong></blockquote><ul><li>The <strong>Android Framework</strong> talks to a <strong>standard API</strong></li><li>The <strong>Vendor/OEM</strong> implements this API using real hardware drivers or emulation</li></ul><h3>✅ GOAL</h3><p>Build a minimal <strong>AIDL-based HAL</strong> named IMyHal.aidl with:</p><ul><li>A single method: int add(int a, int b);</li><li>Full HAL skeleton:</li><li>AIDL file</li><li>C++ service implementation</li><li>Init .rc file</li><li>Android.bp files</li><li>Device manifest registration</li><li>No hardware dependency (runs on emulator or software)</li></ul><h3>🗂️ FOLDER STRUCTURE</h3><pre>hardware/interfaces/myhal/<br>├── aidl/<br>│   ├── Android.bp<br>│   ├── android/hardware/myhal/IMyHal.aidl<br>│   └── default/<br>│       ├── Android.bp<br>│       ├── MyHal.h<br>│       ├── MyHal.cpp<br>│       ├── service.cpp<br>│       └── myhal.rc</pre><h3>🧩 1. Define AIDL Interface</h3><p>📄 hardware/interfaces/myhal/aidl/android/hardware/myhal/IMyHal.aidl</p><pre>package android.hardware.myhal;<br>@VintfStability<br>interface IMyHal {<br>    int add(int a, int b);<br>}</pre><p><strong>VintfStability</strong> is an annotation used in AIDL to mark the stability level of the interface. It’s required for HALs that are used in the Android Vendor Interface (VINTF) and must follow stability guarantees between the Android framework and vendor.</p><h4>🔍 What is VINTF?</h4><p><strong>VINTF (Vendor Interface)</strong> ensures that:</p><ul><li>The <strong>framework and vendor</strong> parts of the OS remain <strong>compatible</strong>, even if updated separately.</li><li>The HAL interface must be <strong>versioned and stable</strong>.</li></ul><h3>🧱 2. AIDL Android.bp</h3><p>📄 hardware/interfaces/myhal/aidl/Android.bp</p><pre>aidl_interface {<br>    name: &quot;android.hardware.myhal&quot;,<br>    vendor_available: true,<br>    srcs: [&quot;android/hardware/myhal/IMyHal.aidl&quot;],<br>    stability: &quot;vintf&quot;,<br>    backend: {<br>        cpp: {<br>            enabled: true,<br>        },<br>    },<br>    versions: [&quot;1&quot;],<br>}</pre><h3>⚙️ What the Build System Will Generate:</h3><p>After you define IMyHal.aidl and run m android.hardware.myhal, the system generates:</p><ul><li>BnMyHal.h (C++ server-side base class)</li><li>BpMyHal.h (C++ client-side proxy)</li><li>I*Hal.h interfaces</li><li>Stub and proxy binder code</li></ul><p>Location: under out/soong/.intermediates/android.hardware.myhal/.../gen/include/aidl/android/hardware/myhal</p><h3>✅ 1. BnMyHal.h → Binder Native Stub</h3><blockquote><em>🔧 </em><strong><em>Purpose:</em></strong><em> Server-side base class you inherit from to implement your service logic.</em></blockquote><p>📁 Location (auto-generated):</p><pre>out/soong/.intermediates/android.hardware.myhal/.../gen/include/aidl/android/hardware/myhal/BnMyHal.h</pre><h3>🧩 Looks like:</h3><pre>class BnMyHal : public ::ndk::BnCInterface&lt;IMyHal&gt; {<br>public:<br>    ::ndk::ScopedAStatus onTransact(...) override;<br>};</pre><h3>🧠 You Inherit From This:</h3><pre>class MyHal : public BnMyHal {<br>    ScopedAStatus add(...) override { ... }<br>};</pre><h3>✅ 2. BpMyHal.h → Binder Native Proxy (Client)</h3><blockquote><em>🔧 </em><strong><em>Purpose:</em></strong><em> Client-side implementation used to call the service from another process (or from test apps).</em></blockquote><p>📁 Location:</p><pre>out/soong/.intermediates/.../BpMyHal.h</pre><h3>🧩 Used like this:</h3><pre>std::shared_ptr&lt;IMyHal&gt; hal =<br>    IMyHal::fromBinder(binder);<br>hal-&gt;add(1, 2, &amp;out);</pre><p>📦 Internally this makes a <strong>binder transaction</strong> under the hood.</p><h3>✅ 3. IMyHal.h → Pure AIDL Interface</h3><blockquote><em>🔧 </em><strong><em>Purpose:</em></strong><em> Common base that defines the abstract interface (pure virtual functions).</em></blockquote><h3>Example:</h3><pre>class IMyHal : public ::ndk::ICInterface {<br>public:<br>    virtual ::ndk::ScopedAStatus add(int32_t a, int32_t b, int32_t* result) = 0;<br>};</pre><p>All other generated classes inherit or wrap this.</p><h3>🧠 3. C++ Implementation</h3><h3>📄 MyHal.h</h3><pre>#pragma once<br>#include &lt;aidl/android/hardware/myhal/BnMyHal.h&gt;<br>namespace aidl::android::hardware::myhal {<br>class MyHal : public BnMyHal {<br>public:<br>    ndk::ScopedAStatus add(int32_t a, int32_t b, int32_t* result) override;<br>};<br>}  // namespace aidl::android::hardware::myhal</pre><h3>📄 MyHal.cpp</h3><pre>#include &quot;MyHal.h&quot;<br>namespace aidl::android::hardware::myhal {<br>ndk::ScopedAStatus MyHal::add(int32_t a, int32_t b, int32_t* result) {<br>    *result = a + b;<br>    return ndk::ScopedAStatus::ok();<br>}<br>}  // namespace aidl::android::hardware::myhal</pre><h3>📄 service.cpp</h3><pre>#include &lt;android-base/logging.h&gt;<br>#include &lt;android/binder_manager.h&gt;<br>#include &lt;android/binder_process.h&gt;<br>#include &quot;MyHal.h&quot;<br><br>using aidl::android::hardware::myhal::MyHal;<br>int main() {<br>    ABinderProcess_setThreadPoolMaxThreadCount(1);<br>    ABinderProcess_startThreadPool();<br>    std::shared_ptr&lt;MyHal&gt; service = ndk::SharedRefBase::make&lt;MyHal&gt;();<br>    const char* instance = &quot;android.hardware.myhal.IMyHal/default&quot;;<br>    binder_status_t status = AServiceManager_addService(service-&gt;asBinder().get(), instance);<br>    if (status != STATUS_OK) {<br>        LOG(ERROR) &lt;&lt; &quot;Failed to register MyHal service.&quot;;<br>        return 1;<br>    }<br>    LOG(INFO) &lt;&lt; &quot;MyHal service registered.&quot;;<br>    ABinderProcess_joinThreadPool();<br>    return 0;<br>}</pre><h3>🔧 4. Init RC File</h3><p>📄 myhal.rc</p><pre>service myhal /vendor/bin/myhal_service<br>    class hal<br>    user system<br>    group system<br>    oneshot</pre><p><strong>service myhal: </strong>Declares a service named myhal.</p><p><strong>/vendor/bin/myhal_service: </strong>The executable that will be launched when this service starts.</p><ul><li>This binary is typically the AIDL HAL implementation binary, compiled via the defaultServiceImplementation = true directive in Android.bp.</li></ul><p><strong>class hal</strong><br>Assigns this service to the hal class.</p><ul><li>The hal class is triggered during early boot, typically during init, so your HAL starts early in the boot process (before system services).</li></ul><p><strong>user system<br>group system<br></strong>Specifies that the service should run as the system user and group.</p><ul><li>This determines what permissions the service will have.</li><li>For system user/group is common for HALs because it has sufficient privileges to access devices or Binder.</li></ul><p><strong>oneshot</strong></p><p>This means the service will be started once, and not restarted automatically if it dies.</p><ul><li>Typically used for simple HALs or binder services that don’t need auto-recovery.</li></ul><h3>🧰 5. HAL Service Build File</h3><p>📄 default/Android.bp</p><pre>cc_binary {<br>    name: &quot;myhal_service&quot;,<br>    srcs: [&quot;MyHal.cpp&quot;, &quot;service.cpp&quot;],<br>    shared_libs: [<br>        &quot;liblog&quot;,<br>        &quot;libutils&quot;,<br>        &quot;libbinder_ndk&quot;,<br>    ],<br>    static_libs: [<br>        &quot;android.hardware.myhal-V1-ndk_platform&quot;,<br>    ],<br>    init_rc: [&quot;myhal.rc&quot;],<br>    vendor: true,<br>}</pre><h3>📦 6. Device manifest.xml</h3><p>📄 device/&lt;vendor&gt;/&lt;device&gt;/manifest.xml</p><pre>&lt;manifest version=&quot;1.0&quot; type=&quot;device&quot;&gt;<br>    &lt;hal format=&quot;aidl&quot;&gt;<br>        &lt;name&gt;android.hardware.myhal&lt;/name&gt;<br>        &lt;version&gt;1&lt;/version&gt;<br>        &lt;interface&gt;<br>            &lt;name&gt;IMyHal&lt;/name&gt;<br>            &lt;instance&gt;default&lt;/instance&gt;<br>        &lt;/interface&gt;<br>    &lt;/hal&gt;<br>&lt;/manifest&gt;</pre><h3>🔨 7. Build &amp; Deploy</h3><pre># Build HAL<br>m myhal_service</pre><pre># Push and run manually (for emulator/testing)<br>adb root<br>adb remount<br>adb push out/target/product/&lt;device&gt;/vendor/bin/myhal_service /vendor/bin/<br>adb shell /vendor/bin/myhal_service</pre><h3>✅ 8. Verify</h3><pre>adb shell lshal | grep myhal<br>adb shell service list | grep myhal</pre><h3>✅ Java Test App to Call IMyHal::add(a, b)</h3><p>You <strong>can write a Java test client</strong> that connects to your HAL using IBinder and IMyHal.Stub.asInterface().</p><h3>📱 Java Test App</h3><h4>Step 1: Add AIDL Interface to App</h4><p>Copy the IMyHal.aidl file to your app:</p><p>📄 app/src/main/aidl/android/hardware/myhal/IMyHal.aidl</p><pre>package android.hardware.myhal;<br><br>@VintfStability<br>interface IMyHal {<br>    int add(int a, int b);<br>}</pre><h4>Step 2: Java Test Code</h4><pre>import android.hardware.myhal.IMyHal;<br>import android.os.IBinder;<br>import android.os.RemoteException;<br>import android.os.ServiceManager;<br>import android.util.Log;<br><br>public class MyHalTester {<br>    private static final String TAG = &quot;MyHalTester&quot;;<br>    public static void testHal() {<br>        IBinder binder = ServiceManager.getService(&quot;android.hardware.myhal.IMyHal/default&quot;);<br>        if (binder == null) {<br>            Log.e(TAG, &quot;IMyHal service not found&quot;);<br>            return;<br>        }<br>        IMyHal hal = IMyHal.Stub.asInterface(binder);<br>        try {<br>            int result = hal.add(10, 20);<br>            Log.i(TAG, &quot;add(10, 20) = &quot; + result);<br>        } catch (RemoteException e) {<br>            Log.e(TAG, &quot;HAL call failed&quot;, e);<br>        }<br>    }<br>}</pre><p>✅ Make sure your test app is signed with the <strong>platform key</strong> or is installed as a <strong>system app</strong>, since it binds to a <strong>vendor service</strong>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a0202a16c904" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HIDL vs AIDL in Android: Understanding the Evolution of HAL Interfaces]]></title>
            <link>https://medium.com/@anuragsingh7238/hidl-vs-aidl-in-android-understanding-the-evolution-of-hal-interfaces-6a70d75e6fd9?source=rss-bcf9b9b5f273------2</link>
            <guid isPermaLink="false">https://medium.com/p/6a70d75e6fd9</guid>
            <category><![CDATA[ipc]]></category>
            <category><![CDATA[aosp]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[hal]]></category>
            <category><![CDATA[hidl]]></category>
            <dc:creator><![CDATA[anuragsingh]]></dc:creator>
            <pubDate>Wed, 23 Jul 2025 01:13:07 GMT</pubDate>
            <atom:updated>2025-07-23T23:09:46.305Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UkT9EwQ9ADINYIdjpjO2Vw.png" /></figure><p>With the evolution of Android, the way the Android framework talks to hardware has significantly changed. Two core technologies responsible for this are <strong>HIDL</strong> and <strong>AIDL</strong>. But what are they? How do they work? And which one should you use today?</p><p>Full Form Used In Language <strong>HIDL</strong> HAL Interface Definition Language Android 8 — Android 10/11 Java/C++ XML-based <strong>AIDL</strong> Android Interface Definition Language Android (all versions) Java / C++ (since Android 10)</p><h3>📦 What is HIDL?</h3><p><strong>HIDL (HAL Interface Definition Language)</strong> was introduced in <strong>Android 8 (Oreo)</strong> to improve the modularity of Android. Its goal was to <strong>separate vendor code (hardware-specific) from Android framework code</strong>, helping manufacturers push updates without breaking HAL implementations.</p><h3>🔧 How HIDL Works:</h3><ul><li>Uses .hal files to define interfaces.</li><li>These are compiled using hidl-gen to generate <strong>C++ and Java code</strong>.</li><li>Can be <strong>passthrough</strong> (direct call to HAL) or <strong>binderized</strong> (uses Binder IPC).</li><li>Typically lives in: hardware/interfaces/.</li></ul><h3>📌 Example:</h3><pre>interface IExample {<br>    doSomething(int32_t value);<br>};</pre><h3>🧱 Use Case:</h3><ul><li>Hardware abstraction like Bluetooth, Camera, Sensors (until Android 10).</li><li>Vendor implementations located in /vendor/.</li></ul><h3>❌ HIDL Limitations</h3><ul><li><strong>Manual memory and threading</strong> management in C++.</li><li>Complex tooling (hidl-gen, version-specific directories).</li><li>No async transactions — every call was synchronous unless manually threaded.</li><li>Harder for system-wide use (Java → C++ bridge was limited).</li></ul><h3>🧩 What is AIDL?</h3><p><strong>AIDL (Android Interface Definition Language)</strong> has existed since early Android for <strong>inter-process communication (IPC)</strong>, primarily between system services and apps (in Java). From <strong>Android 10</strong>, it was extended to support <strong>native C++ AIDL HALs</strong>, making it a modern replacement for HIDL.</p><h3>✨ Benefits of AIDL:</h3><ul><li>Easier to write and read.</li><li>Better type safety and maintenance.</li><li>Native support for <strong>structured types</strong>, <strong>callbacks</strong>, and <strong>async calls</strong>.</li><li>Supports <strong>Java ↔ C++</strong> and <strong>C++ ↔ C++</strong> IPC using Binder.</li><li>Lives in: aidl/ directory in system/vendor projects.</li></ul><h3>📌 Example:</h3><pre>interface IExample {<br>    int doSomething(int value);<br>}</pre><h3>🔍 HIDL vs AIDL: Key Differences</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*84LNK8YHzS3gTByUc-VlBg.png" /></figure><h3>✅ Why AIDL Replaces HIDL?</h3><p>Google moved to AIDL because:</p><ol><li><strong>Unified Interface</strong>: Same system for HALs and app/service IPC.</li><li><strong>Improved Developer Experience</strong>: Easier to write, compile, and debug.</li><li><strong>Support for New Features</strong>: Async methods, stability levels, parcelables.</li><li><strong>Better NDK Integration</strong>: Full native support in modern Android.</li></ol><h3>📁 Where You’ll See This in AOSP</h3><h3>HIDL:</h3><ul><li>hardware/interfaces/camera/3.4/ICameraDeviceSession.hal</li><li>Built with hidl-gen</li></ul><h3>AIDL:</h3><ul><li>hardware/interfaces/vibrator/aidl/android/hardware/vibrator/IVibrator.aidl</li><li>Built with aidl_interface and aidl_gen</li></ul><h3>🚧 Migration from HIDL to AIDL</h3><ul><li>AOSP provides tools to migrate HALs to AIDL.</li><li>In Android 11+, HIDL is <strong>deprecated</strong> and all new HALs <strong>must use AIDL</strong>.</li><li>Google’s own HALs like <strong>Vibrator, Dumpstate, Bluetooth</strong> are now AIDL-based.</li></ul><h3>📌 Conclusion</h3><ul><li>HIDL served its purpose well from Android 8–10.</li><li>From Android 11 onwards, <strong>AIDL is the future</strong> of Android HAL development.</li><li>If you’re writing a <strong>custom HAL</strong>, <strong>start with AIDL</strong>.</li></ul><blockquote><em>💡 Whether you are an app developer, a system engineer, or a vendor developer — understanding this transition will help you work better with Android internals.</em></blockquote><h3>✅ When JNI is NOT Required</h3><p>If your <strong>HAL is written using AIDL</strong> (AIDL HAL), then:</p><h3>🔄 App ↔ Java Service ↔ AIDL HAL</h3><p>You can write:</p><ul><li>AIDL interface for the HAL</li><li>Java system service that talks to the HAL via Binder</li><li>The communication is 100% Binder-based</li></ul><p>✅ <strong>Example Path:</strong></p><pre>App (Java) → Binder → Java System Service → Binder → AIDL HAL (C++ or Rust)</pre><p>In this case:</p><ul><li>AIDL compiler generates both C++ and Java bindings.</li><li>Framework services can directly talk to native HALs over Binder without needing to write JNI manually.</li></ul><p>Here’s a Binder IPC flow of AIDL:</p><pre>Client (App/Service)<br>        |<br>        | AIDL Proxy (IMyService.Stub.asInterface)<br>        | --&gt; transact() via Binder<br>        ↓<br>System Service (Java or Native)<br>        |<br>        | AIDL Stub (extends Stub/implements interface)<br>        | --&gt; onTransact() executes method<br>        ↓<br>     HAL (AIDL C++ Impl)<br>        |<br>    Talks to Hardware</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6a70d75e6fd9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Android Booting Process]]></title>
            <link>https://medium.com/@anuragsingh7238/android-booting-process-b64cd071c66e?source=rss-bcf9b9b5f273------2</link>
            <guid isPermaLink="false">https://medium.com/p/b64cd071c66e</guid>
            <category><![CDATA[aosp]]></category>
            <category><![CDATA[boot-process]]></category>
            <category><![CDATA[android-boot]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[boot-sequence]]></category>
            <dc:creator><![CDATA[anuragsingh]]></dc:creator>
            <pubDate>Wed, 23 Jul 2025 00:47:20 GMT</pubDate>
            <atom:updated>2025-07-23T00:49:36.591Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BI09oZ3BfjeDp1tO0xUDwA.png" /></figure><blockquote><em>Ever wondered what happens when you press the power button on your Android device? Let’s break down the </em><strong><em>boot process</em></strong><em> step-by-step, from boot ROM to launching your home screen.</em></blockquote><h3>🧠 What Is the Android Boot Process?</h3><p>The Android boot sequence is the process by which the system transitions from <strong>powered off</strong> to <strong>ready-to-use</strong>. It involves low-level firmware, kernel loading, system services, and finally the user interface.</p><p><strong>Let us first understand the Android booting process.</strong></p><ol><li><strong>Boot ROM</strong>: The process begins with the Boot ROM, a firmware embedded in the device’s read-only memory. It initializes essential hardware components and loads the bootloader.</li><li><strong>Bootloader</strong>: The bootloader, a small program separate from the OS, initializes hardware, loads the kernel, and sets up essential system parameters. It’s responsible for transitioning control to the kernel.</li><li><strong>Kernel</strong>: The kernel serves as the central core of the operating system, managing hardware resources and loading necessary drivers. It initializes system memory management, loads core libraries, and starts the init process.</li><li><strong>Init Process</strong>: Init, the parent of all Android processes, reads the init.rc configuration file, setting up the environment, and starting essential services. Once completed, it launches the Zygote process.</li><li><strong>Zygote</strong>: The process loads core libraries for the Android runtime, enabling efficient memory management and quick application startup. It waits for requests to launch applications and forks itself to create new processes.</li><li><strong>System Server</strong>: The System Server initializes and manages system-level services such as ActivityManager, PackageManager, and NotificationManager. It ensures system readiness and stability by establishing essential services and managing system resources.</li><li><strong>SystemUI</strong>: Finally, SystemUI is launched to manage various user interface elements like the status bar, navigation bar, and notifications. It provides users with a stable and responsive environment for interacting with the device.</li></ol><h3>🛠️ Key Boot Stages in Android</h3><pre><br>    A[Boot ROM] --&gt; B[Bootloader (e.g., U-Boot)]<br>    B --&gt; C[AVB (Verified Boot)]<br>    C --&gt; D[Kernel + Initramfs]<br>    D --&gt; E[Init Process (/init)]<br>    E --&gt; F[Zygote &amp; SystemServer]<br>    F --&gt; G[Home Screen / Launcher]</pre><h3>🧩 Stage-by-Stage Boot Breakdown</h3><h3>1️⃣ Boot ROM (SoC-level)</h3><ul><li><strong>Starts automatically</strong> when the power button is pressed.</li><li><strong>Hardcoded</strong> in the SoC (System on Chip).</li><li>Initializes basic hardware (RAM, storage).</li><li>Loads the <strong>Bootloader</strong> from the boot media (eMMC, UFS).</li></ul><p>📁 Not in AOSP — this is <strong>vendor-specific firmware</strong>.</p><h3>2️⃣ Bootloader (Primary + Secondary)</h3><ul><li>Initializes hardware (RAM, CPU clocks, storage).</li><li>Loads the <strong>boot image</strong> (boot.img).</li><li>Executes <strong>AVB (Android Verified Boot)</strong> to verify boot integrity.</li><li>Provides recovery and fastboot modes.</li></ul><p>📁 AOSP Location: bootable/bootloader/</p><p>👉 Uses boot.img, which contains:</p><ul><li>Linux Kernel (zImage)</li><li>Ramdisk (init scripts)</li><li>Device Tree Blob (DTB)</li></ul><h3>3️⃣ Android Verified Boot (AVB)</h3><ul><li>Ensures integrity of the boot and system partitions.</li><li>Prevents tampering or rooting without detection.</li><li>Uses <strong>dm-verity</strong> for integrity checks.</li></ul><p>📁 Code: system/avb/</p><p>🧠 AVB 2.0 signs:</p><ul><li>boot.img</li><li>vendor.img</li><li>system.img</li></ul><h3>4️⃣ Linux Kernel</h3><ul><li>Starts executing with control from the bootloader.</li><li>Initializes:</li><li>Process 0 (swapper)</li><li>Low-level drivers (input, display, GPU)</li><li>Filesystem mounting</li><li>Loads the <strong>initramfs</strong> (rootfs image).</li></ul><p>📁 Kernel code not in AOSP — found in kernel/ sources.</p><h3>5️⃣ Init Process (/init)</h3><ul><li>First <strong>userspace process</strong> (PID 1).</li><li>Parses init.rc, init.*.rc files.</li><li>Mounts /system, /vendor, /product partitions.</li><li>Starts native daemons (e.g., vold, logd, servicemanager).</li></ul><p>📁 AOSP: system/core/init/<br> 📄 Configs: /system/etc/init/, /vendor/etc/init/</p><p>🔑 Responsible for:</p><ul><li>Service startup</li><li>SELinux policy loading</li><li>Trigger handling</li></ul><h3>6️⃣ Zygote Process</h3><ul><li>Starts from ZygoteInit.java</li><li>Preloads Java classes and resources.</li><li>Forks every new app process to improve startup time.</li></ul><p>📁 AOSP:</p><ul><li>frameworks/base/core/java/com/android/internal/os/ZygoteInit.java</li><li>Native Zygote: app_main.cpp</li></ul><p>✅ Also starts:</p><ul><li>system_server (hosts core system services)</li><li>surfaceflinger (renders display)</li></ul><h3>7️⃣ SystemServer</h3><p>The <strong>heart of Android OS</strong>.</p><ul><li>Starts in Zygote, runs Java system services:</li><li><strong>ActivityManagerService</strong></li><li><strong>WindowManagerService</strong></li><li><strong>PackageManagerService</strong></li><li><strong>PowerManagerService</strong></li><li>and many more…</li></ul><p>📁 AOSP:<br> frameworks/base/services/java/com/android/server/SystemServer.java</p><p>🔧 Services register with <strong>ServiceManager</strong>:</p><pre>ServiceManager.addService(Context.ACTIVITY_SERVICE, new ActivityManagerService());</pre><h3>8️⃣ Launcher / Home Screen</h3><p>Once SystemServer completes:</p><ul><li><strong>ActivityManagerService (AMS)</strong> starts the <strong>Launcher app</strong>.</li><li>The Launcher is just an ordinary app marked as:</li></ul><pre>&lt;category android:name=&quot;android.intent.category.HOME&quot; /&gt;</pre><p>📁 Default Launcher:<br> packages/apps/Launcher3/ (AOSP example)</p><h3>📦 Boot Image Internals</h3><p>Use mkbootimg to inspect:</p><pre>$ unpack_bootimg --boot_img=boot.img --out=boot_out</pre><p>Boot image includes:</p><ul><li>kernel</li><li>ramdisk</li><li>second_stage_loader</li><li>device_tree_blob</li></ul><p>📁 Code: system/tools/mkbootimg/</p><h3>🔒 Security in Boot Sequence</h3><p>Android enforces multiple security checks:</p><ul><li><strong>Bootloader Lock State</strong></li><li><strong>Verified Boot (AVB)</strong></li><li><strong>dm-verity hash tree</strong></li><li><strong>Keymaster / keystore attestation</strong></li></ul><p>These prevent unauthorized modifications of boot, vendor, or system partitions.</p><h3>🧪 Debugging Boot Issues</h3><p>Use these tools:</p><ul><li>fastboot getvar all</li><li>adb logcat (once system is up)</li><li>UART/serial logs (for early boot logs)</li><li>dmesg, last_kmsg</li></ul><p>Check logs in:</p><pre>/data/tombstones/</pre><h3>📌 Summary of Boot Flow</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7Z9zq4Rj-pQ1QDiJWIV12g.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b64cd071c66e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AIDL (Android Interface Definition Language): How Binder IPC Works Inside AOSP]]></title>
            <link>https://medium.com/@anuragsingh7238/aidl-android-interface-definition-language-how-binder-ipc-works-inside-aosp-19465655bd00?source=rss-bcf9b9b5f273------2</link>
            <guid isPermaLink="false">https://medium.com/p/19465655bd00</guid>
            <category><![CDATA[ipc]]></category>
            <category><![CDATA[proxy]]></category>
            <category><![CDATA[aidl]]></category>
            <category><![CDATA[aosp]]></category>
            <category><![CDATA[stub]]></category>
            <dc:creator><![CDATA[anuragsingh]]></dc:creator>
            <pubDate>Tue, 22 Jul 2025 23:53:04 GMT</pubDate>
            <atom:updated>2025-07-23T22:22:57.638Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Learn how AIDL enables communication between system services, apps, and HALs in Android using the Binder IPC mechanism — with full step-by-step breakdown from source code to runtime.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DYhvXC1-G-e-x59DP60IkQ.png" /></figure><h3>🔍 What is AIDL?</h3><p>AIDL (Android Interface Definition Language) is a language used to define inter-process communication (IPC) interfaces in Android. It enables different processes (like system services and apps) to communicate securely and efficiently via Binder IPC.</p><p>AIDL files are used to:</p><ul><li>Define the <strong>methods</strong>, <strong>parameters</strong>, and <strong>data types</strong></li><li>Generate <strong>proxy</strong> (client-side) and <strong>stub</strong> (server-side) classes</li><li>Facilitate <strong>marshalling/unmarshalling</strong> of data using Parcel</li></ul><h3>🧠 AIDL IPC Full Mechanism in AOSP — Step-by-Step</h3><h4>📄 1. Write AIDL File</h4><pre>// IMyService.aidl<br>package com.example.aidl;<br><br>interface IMyService {<br>    int add(int a, int b);<br>}</pre><ul><li>This interface defines a remote method add(int, int).</li></ul><h4>⚙️ <strong>2. Compile AIDL (via build system)</strong></h4><p>During the build:</p><ol><li>The aidl compiler scans .aidl files listed in your Android.bp or Android.mk.</li><li>It generates the Java code needed for Binder IPC:</li></ol><ul><li>The <strong>interface</strong></li><li>The <strong>Stub (server)</strong> side class</li><li>The <strong>Proxy (client)</strong> side class inside Stub</li></ul><p>These classes handle <strong>serialization, Binder transactions, and method routing</strong> behind the scenes.</p><h4><strong>Generated Java Class for AIDL :</strong></h4><pre>// Generated: IMyService.java<br><br>public interface IMyService extends IInterface {<br>    int add(int a, int b) throws RemoteException;<br><br>abstract static class Stub extends Binder implements IMyService {<br>        ...<br>    }<br>}</pre><h4>🔹 IMyService extends IInterface</h4><ul><li>Every AIDL-generated interface extends Android’s IInterface</li><li>Declares the <strong>remote method(s)</strong> (e.g., add())</li></ul><h4>🔹 Stub extends Binder implements IMyService</h4><p>This is the <strong>server-side Binder implementation</strong>. It handles incoming transactions and routes them to the actual implementation of add() in your service class.</p><ul><li>Stub acts as a <strong>server dispatcher</strong></li><li>It <strong>overrides </strong><strong>onTransact()</strong> to decode requests coming from the client</li><li>It contains a <strong>Proxy inner class</strong> for client-side use</li></ul><h3>🔹 Proxy class (inside Stub)</h3><pre>private static class Proxy implements IMyService {<br>    private IBinder mRemote;<br>public int add(int a, int b) throws RemoteException {<br>        Parcel _data = Parcel.obtain();<br>        Parcel _reply = Parcel.obtain();<br>        int result;<br>        try {<br>            _data.writeInterfaceToken(DESCRIPTOR);<br>            _data.writeInt(a);<br>            _data.writeInt(b);<br>            mRemote.transact(TRANSACTION_add, _data, _reply, 0);<br>            _reply.readException();<br>            result = _reply.readInt();<br>        } finally {<br>            _data.recycle();<br>            _reply.recycle();<br>        }<br>        return result;<br>    }<br>}</pre><p>When a client calls add(), it:</p><ul><li>Writes arguments into a Parcel</li><li>Calls transact() on the Binder</li><li>Waits for response and reads result</li><li>This is the <strong>client-side proxy</strong></li></ul><h3>🧾 Summary Table</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/739/1*MS0KioLDwbZtjT3w0TuJtQ.png" /></figure><h4>For C++ AIDL(used in AIDL HALs):</h4><p>Generates:</p><ul><li>.cpp, .h, and .impl files</li><li>Used when implementing native system services or HALs</li></ul><h3>🧩 3. Implement the AIDL Stub on Server-Side</h3><p>The service implements the generated Stub:</p><pre>public class MyService extends IMyService.Stub {<br>    @Override<br>    public int add(int a, int b) {<br>        return a + b;<br>    }<br>}</pre><p>In AOSP:</p><ul><li>This service might live in SystemServer.java or a custom service</li><li>It is registered like this:</li></ul><blockquote>ServiceManager.addService(“my_service”, new MyService());</blockquote><h3>🧑‍💻 4. Use the AIDL Proxy on Client-Side</h3><p>Client code interacts with the service via the generated proxy.<br>When the client wants to use the service:</p><ul><li>It gets the IBinder via ServiceManager.getService(&quot;my_service&quot;)</li><li>Casts it using IMyService.Stub.asInterface(binder)</li><li>Internally uses a <strong>proxy</strong> object to forward calls via Binder IPC</li></ul><pre>IBinder binder = ServiceManager.getService(&quot;my_service&quot;);<br>IMyService service = IMyService.Stub.asInterface(binder);<br>int result = service.add(5, 3);  // Remote call</pre><p>An <strong>application developer or client-side component</strong> (another service or app) will use to <strong>query or invoke a remote method</strong> from a system service exposed via AIDL:</p><p>🔍<strong> Let’s break it down step-by-step for clarity:</strong></p><h4>🔹 1. ServiceManager.getService(&quot;my_service&quot;)</h4><ul><li>Queries the <strong>system service registry</strong> for a Binder object associated with the service name &quot;my_service&quot;.</li><li>Returns an IBinder instance (a raw Binder reference).</li></ul><h4>🔹 2. IMyService.Stub.asInterface(binder)</h4><ul><li>Converts the generic IBinder into a <strong>typed proxy interface</strong> (IMyService) using the generated Stub.asInterface() method.</li><li>If the service is in the same process, it returns the actual implementation.</li><li>If it’s in a different process, it returns a <strong>proxy object</strong> that communicates over Binder IPC.</li></ul><h4>🔹 3. service.add(5, 3)</h4><ul><li>Calls the add() method.</li></ul><p>Behind the scenes:</p><ul><li>Arguments are <strong>written into a </strong><strong>Parcel</strong>.</li><li>Binder framework <strong>sends this Parcel</strong> to the remote service process.</li><li>Remote service <strong>unpacks the Parcel</strong>, executes the method, and sends back the result.</li></ul><h3>🛠 Example Use in a Custom App:</h3><p>If the app is a <strong>privileged system app</strong> (or has permission), it can query the system service like this:</p><pre>public class MainActivity extends Activity {<br>    @Override<br>    protected void onStart() {<br>        super.onStart();<br>        IBinder binder = ServiceManager.getService(&quot;my_service&quot;);<br>        IMyService service = IMyService.Stub.asInterface(binder);<br>        try {<br>            int result = service.add(10, 20);<br>            Log.d(&quot;MyApp&quot;, &quot;Result: &quot; + result);<br>        } catch (RemoteException e) {<br>            e.printStackTrace();<br>        }<br>    }<br>}</pre><blockquote><em>✅ Note: </em><em>ServiceManager is not part of the </em><strong><em>public SDK</em></strong><em>, so this approach is typically used:</em></blockquote><ul><li>In <strong>system apps</strong></li><li>In <strong>AOSP platform code</strong></li><li>When building <strong>debug/test tools</strong> for internal system integration</li></ul><h3>🏗 5. Integrating AIDL into AOSP System Services</h3><p>To integrate AIDL into your AOSP source:</p><ol><li>Create the AIDL file in your module (frameworks/base/etc.)</li><li>Define the interface:</li></ol><pre>interface IMyService {<br>    ...<br>}</pre><p>3. Add to Android.bp:</p><pre>aidl_interface {<br>    name: &quot;my_aidl_interface&quot;,<br>    srcs: [&quot;IMyService.aidl&quot;],<br>    stability: &quot;vintf&quot;,  // Optional: AIDL HALs use this<br>    backend: {<br>        java: {<br>            enabled: true,<br>        },<br>    },<br>}</pre><p>4. Implement your service in Java or native (via JNI)</p><p>5. Register the service in SystemServer.java or main_xxx.cpp</p><h3>⚙️ How Binder + AIDL Works :</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SkZk8k7ADSDVgBj5IvATUQ.png" /></figure><pre>Client Process                         System Service Process<br>---------------                        ------------------------<br>Proxy (IMyService.Stub.asInterface)   Stub (MyService extends IMyService.Stub)<br>        |                                          |<br>        | -- transact() --&gt; Binder IPC --------&gt;   |<br>        |                                          | -- onTransact()<br>        |                                          | -- executes method<br>        | &lt;---- result via Parcel ---------------- |</pre><h3>🧱 Summary</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8N2wJ2vAWJ9dubBIhR_0JQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=19465655bd00" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Add a Custom System App in AOSP]]></title>
            <link>https://medium.com/@anuragsingh7238/how-to-add-a-custom-system-app-in-aosp-011b6a879ef6?source=rss-bcf9b9b5f273------2</link>
            <guid isPermaLink="false">https://medium.com/p/011b6a879ef6</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[aosp]]></category>
            <category><![CDATA[custom-app]]></category>
            <category><![CDATA[system-app]]></category>
            <dc:creator><![CDATA[anuragsingh]]></dc:creator>
            <pubDate>Wed, 16 Jul 2025 22:22:11 GMT</pubDate>
            <atom:updated>2025-07-17T12:25:13.915Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QpyiqfGevFXQ-qPy" /></figure><h3>📱 What is a System App in AOSP?</h3><p>In the <strong>Android Open Source Project (AOSP)</strong>, a <strong>System App</strong> is an application that is <strong>built into the system image</strong> and resides in privileged locations like:</p><ul><li>/system/app/ (Normal system apps)</li><li>/system/priv-app/ (Privileged system apps)</li><li>/vendor/app/ or /product/app/ OEM or SoC-specific system apps</li></ul><h3>🔑 Key Characteristics of a System App</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P6XKt9ZzGTzlPhD4O_wEwQ.png" /></figure><h3>System App vs. User App :</h3><h3>System App</h3><p>These are pre-installed apps that are considered essential for the core functionality of the Android system. They are typically part of the AOSP source code and are installed during the system image build. Examples include the dialer, contacts, and system settings.</p><h3>Examples of System Apps :</h3><ul><li><strong>SystemUI</strong></li><li><strong>Settings</strong></li><li><strong>Package Installer</strong></li><li><strong>Updater app</strong></li><li>Any OEM-custom utility app (e.g., Xiaomi Security App)</li></ul><h3>User App</h3><p>These are applications installed by the user, either from the Google Play Store or through other means like sideloading APK files. They are not part of the core system image and can be installed, updated, or uninstalled by the user.</p><h3>Examples of User Apps :</h3><p><strong>Media Apps:<br></strong>Apps providing media playback functionality, such as YouTube Music or Spotify, are often user apps integrated into the system.</p><p><strong>Third-Party Car Apps:<br></strong>In the context of Android Automotive, third-party car apps are user apps that can be integrated into the infotainment system.</p><p><strong>General Utility Apps:<br></strong>Apps like file managers, browsers, and other utility apps are typically user apps installed by users.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rhsIpe7QuQCFEpa8t2YtQg.png" /><figcaption>Fig : System App vs User App</figcaption></figure><h3>🔧 Why Use a System App</h3><h3><strong>1.Access to Restricted or Hidden APIs</strong></h3><p>System apps can use hidden, internal, and signature-level permissions that are normally blocked for user apps.</p><p>Example :<br>APIs that only system/privileged apps can use:</p><blockquote><strong><em>android.permission.WRITE_SECURE_SETTINGS<br>DevicePolicyManager.setGlobalSetting()<br>Hidden APIs from com.android.internal.*</em></strong></blockquote><h3>2. <strong>Tighter OS Integration</strong></h3><p>System apps can:</p><ul><li>Start on <strong>boot</strong></li><li>Interact with <strong>system services</strong> directly (via Binder)</li><li>Be used by <strong>SystemUI</strong>, <strong>Settings</strong>, or <strong>other system components</strong></li></ul><p>Example: A system-level <strong>logging</strong>, <strong>power control</strong>, or <strong>custom lockscreen app</strong>.</p><h3><strong>3.</strong> <strong>Cannot Be Uninstalled</strong></h3><p>System apps are stored in <strong>read-only partitions</strong> (/system, /vendor, /product), making them:</p><ul><li><strong>Non-removable</strong> without root</li><li>More <strong>secure</strong> for critical use cases</li><li>Persistent even after factory reset</li></ul><p>This is essential for:</p><ul><li><strong>Enterprise MDM</strong> (Mobile Device Management)</li><li><strong>Kiosk mode</strong> deployments</li><li><strong>OEM mandatory apps</strong></li></ul><h3>4. Sign with Platform Certificate</h3><p>System apps can be <strong>signed with the platform certificate</strong>, giving them even more trust:</p><ul><li>Enables use of @SystemApi and @TestApi</li><li>Allows sharing of UIDs with system components</li><li>Can define <strong>shared UID apps</strong></li></ul><h3>5. Automotive &amp; Industrial Use Cases</h3><p>In <strong>Android Automotive OS (AAOS)</strong> or <strong>Industrial Android devices</strong>, system apps are used for:</p><ul><li>HVAC control</li><li>Instrument cluster display</li><li>Vehicle status dashboard</li><li>Barcode scanning and factory operations</li></ul><p>These need <strong>permanent</strong>, <strong>always-available</strong> functionality with <strong>system-level control</strong>.</p><h3>🧱 Prerequisites:</h3><p>Before you begin:</p><ul><li>Set up and sync a working AOSP environment (e.g., Android 12/13/14)</li><li>Be able to successfully build your target device (lunch + make)</li><li>Modify the application directory structure as following format :</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/766/1*Ijsm0sqJA8E1QadAe9c_-A.png" /><figcaption>Fig : Directory Structure of Custom App</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/488/1*8Lq9sU61VZPrHwVYWdQ7fQ.png" /></figure><ul><li>If Application is already build in <strong>APK format</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*Nafy6_RTj7iHDh0mgQxrmQ.png" /><figcaption>Fig : Directory Structure to Build APK</figcaption></figure><h3>🪜 Steps to Add Your Custom System App</h3><h3>📁 Step 1: Place Your App in the AOSP Source Tree</h3><p>For <strong>source-based app</strong>:</p><pre>mkdir -p packages/apps/MySystemApp<br>cp -r MySystemApp/* packages/apps/MySystemApp/</pre><p>For <strong>prebuilt APK</strong>:</p><pre>mkdir -p prebuilts/apps/MySystemApp<br>cp MySystemApp.apk prebuilts/apps/MySystemApp/</pre><h3>🧾 Step 2: Create Android.mk or Android.bp File</h3><h4>If you are compiling from source (recommended):</h4><p><strong>Android.mk</strong> (older method):</p><pre>LOCAL_PATH := $(call my-dir)<br>include $(CLEAR_VARS)<br>LOCAL_PACKAGE_NAME := MySystemApp<br>LOCAL_SRC_FILES := $(call all-java-files-under, src)<br>LOCAL_CERTIFICATE := platform<br>LOCAL_PRIVILEGED_MODULE := true<br>LOCAL_MODULE_TAGS := optional<br>include $(BUILD_PACKAGE)</pre><p><strong>Android.bp</strong> (modern method):</p><pre>android_app {<br>    name: &quot;MySystemApp&quot;,<br>    srcs: [&quot;src/**/*.java&quot;],<br>    privileged: true,<br>    platform_apis: true,<br>    certificate: &quot;platform&quot;,<br>}</pre><h4>For prebuilt APKs:</h4><pre>LOCAL_PATH := $(call my-dir)<br>include $(CLEAR_VARS)<br>LOCAL_MODULE := MySystemApp<br>LOCAL_MODULE_CLASS := APPS<br>LOCAL_MODULE_PATH := $(TARGET_OUT_PRIV_APPS)<br>LOCAL_SRC_FILES := MySystemApp.apk<br>LOCAL_CERTIFICATE := PRESIGNED<br>LOCAL_PRIVILEGED_MODULE := true<br>include $(BUILD_PREBUILT)</pre><h3>🧷 Step 3: Add to Product Makefile</h3><p>Add the module name to your device/product makefile (usually under device/&lt;vendor&gt;/&lt;device&gt;/device.mk):</p><pre>PRODUCT_PACKAGES += \<br>    MySystemApp</pre><h3>🔐 Step 4: (Optional) Add Signature-Level Permissions</h3><p>If your app requires special permissions:</p><p>Create a file like this:</p><p>📄 privapp-permissions-myproduct.xml:</p><pre>&lt;permissions&gt;<br>  &lt;privapp-permissions package=&quot;com.example.mysystemapp&quot;&gt;<br>    &lt;permission name=&quot;android.permission.WRITE_SECURE_SETTINGS&quot;/&gt;<br>    &lt;permission name=&quot;android.permission.INTERNET&quot;/&gt;<br>  &lt;/privapp-permissions&gt;<br>&lt;/permissions&gt;</pre><p>And reference it in device.mk:</p><pre>PRODUCT_COPY_FILES += \<br>    frameworks/base/data/etc/privapp-permissions-myproduct.xml:system/etc/permissions/privapp-permissions-myproduct.xml</pre><h3>🏗️ Step 5: Build and Flash</h3><h4>Build your app individually:</h4><pre>m MySystemApp</pre><h4>Or build the full system image:</h4><pre>make -j$(nproc)</pre><p>Check if the app is present:</p><pre>adb shell pm list packages | grep mysystemapp<br>adb shell dumpsys package com.example.mysystemapp</pre><p>Or inspect the filesystem:</p><pre>adb shell ls /system/priv-app/MySystemApp/</pre><p><strong>References : </strong><br><a href="https://source.android.com/docs/core/permissions/perms-allowlist">https://source.android.com/docs/core/permissions/perms-allowlist</a><br><a href="https://source.android.com/docs/core/permissions/preinstalled-packages">https://source.android.com/docs/core/permissions/preinstalled-packages</a></p><h3>💬 Questions or Feedback?</h3><p>Feel free to leave a comment or connect on LinkedIn if you need help integrating your system app or modifying AOSP.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=011b6a879ef6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Android Automotive Architecture : Inside In-Vehicle Operating System]]></title>
            <link>https://medium.com/@anuragsingh7238/android-automotive-os-architecture-explained-inside-googles-in-vehicle-operating-system-b0aa14c07a23?source=rss-bcf9b9b5f273------2</link>
            <guid isPermaLink="false">https://medium.com/p/b0aa14c07a23</guid>
            <category><![CDATA[android-architecture]]></category>
            <category><![CDATA[automotive-os]]></category>
            <category><![CDATA[android-automotive]]></category>
            <category><![CDATA[android-auto]]></category>
            <dc:creator><![CDATA[anuragsingh]]></dc:creator>
            <pubDate>Tue, 24 Jun 2025 23:36:32 GMT</pubDate>
            <atom:updated>2025-07-02T22:22:25.471Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pPvsowae8c6wgTn_QNX0Dw.png" /></figure><p><strong>Android Automotive OS (AAOS)</strong> is rapidly becoming the preferred embedded operating system for in-vehicle infotainment (IVI) systems. Unlike Android Auto, which mirrors your phone, AAOS runs <strong>natively on the car’s hardware</strong> — powering media, navigation, telephony, HVAC, and more. But what powers this seamless experience?</p><p>In this article, we’ll break down the complete architecture of Android Automotive OS, layer by layer, to help developers and OEMs understand how the system works under the hood.</p><h3>📦 Google Automotive Services (GAS) vs Non-GAS</h3><p>Before diving into the architecture, it’s important to understand two distinct AAOS variants: <strong>GAS-based</strong> and <strong>Non-GAS</strong> systems.</p><h3>🔹 Google Automotive Services (GAS)</h3><p>GAS is a <strong>licensed suite</strong> of proprietary Google applications and services that OEMs can optionally integrate into their AAOS build.</p><p>Key GAS components include:</p><ul><li><strong>Google Maps &amp; Navigation</strong> — Intelligent navigation with real-time traffic, fuel station, and charging point integration.</li><li><strong>Google Assistant</strong> — A voice-first assistant to control apps and vehicle functions.</li><li><strong>Google Play Store</strong> — Enables downloading of third-party apps optimized for cars.</li><li><strong>SetupWizard</strong> — Assists in creating user profiles and configuring connectivity.</li><li><strong>Automotive Keyboard</strong> — An on-screen keyboard designed specifically for in-vehicle use.</li></ul><p>📝 GAS requires a licensing agreement with Google, offering OEMs access to pre-release versions, support, and advanced documentation.</p><h3>🔹 Non-GAS AAOS</h3><p>In a <strong>non-GAS AAOS deployment</strong>, the system is built purely on <strong>AOSP (Android Open Source Project)</strong>. This means <strong>Google’s proprietary apps and services</strong> — like Google Maps, Assistant, Play Store — are <em>not</em> included.</p><p>As a result, OEMs must provide <strong>equivalent alternatives</strong> for key functions to offer a complete user experience. OEMs must build or integrate their own:</p><ul><li><strong>Navigation:</strong> Provides turn-by-turn directions, live traffic, and POI search. In non-GAS systems, OEMs must use third-party SDKs (e.g., HERE, TomTom) or build custom GPS-based apps.</li><li><strong>Voice Assistant:</strong> Enables hands-free control of media, HVAC, and calls. Without Google Assistant, OEMs can integrate Alexa, Cerence, or develop their own assistant.</li><li><strong>App Store:</strong> Manages app installation and updates. In place of Google Play, OEMs must offer their own secure app store or use alternatives like Aptoide Auto.</li><li><strong>Media Center: </strong>Skeleton for the integration of media sources such as the <em>LocalMediaPlayer</em>. The skeleton is fully integrated and interacts seamlessly with the Notification center and the Dialer.</li><li><strong>Dialer:</strong> The central telephone application, which allows the contacts of the connected smartphone to be managed and calls to be made.</li><li><strong>Car Settings:</strong> Management of various system settings such as Time &amp; Languages, User Management and Connectivity.</li><li><strong>Notification Center:</strong> Brief system- notifications for the user and interactions to start applications.</li></ul><p>This offers more control and flexibility but requires more engineering investment.</p><h3>🧱 AAOS Architecture Overview</h3><p>The architecture of Android Automotive OS is structured into five key layers — each responsible for handling a specific aspect of the in-vehicle platform.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*jaSZt0RwrZbf67Pj.png" /><figcaption><strong>Fig : Architecture of AAOS</strong></figcaption></figure><h3>1. Application Layer</h3><p>This is the <strong>user-facing layer</strong> that powers the in-car experience. The <strong>Application Layer</strong> is where users interact with the infotainment system through the car’s infotainment display. This layer contains several key components:</p><h3>Car Launcher App</h3><ul><li>Acts like the home screen on Android phones.</li><li>Launches and manages apps and widgets.</li><li>OEM-customizable for branded experiences.</li></ul><h3>Car System UI</h3><ul><li>Manages system-level UI elements like the <strong>status bar</strong>, <strong>navigation bar</strong>, and <strong>quick settings</strong>.</li><li>📁 Code location: packages/apps/Car/SystemUI</li></ul><h3>Car UI Library (car-ui-lib)</h3><ul><li>A UI toolkit for creating apps with rotary and touch-friendly components.</li><li>Offers predefined layouts, themes, and buttons.</li><li>📁 Code location: packages/apps/Car/libs/car-ui-lib</li></ul><h3>OEM and System Apps</h3><ul><li><strong>OEM apps</strong>: Custom-built apps such as HVAC control or vehicle settings.</li><li><strong>System apps</strong>: Core apps like the media player, dialer, and settings.</li></ul><h3>Third-Party Apps</h3><ul><li>Downloaded from the Play Store (if GAS is included) and built using the <strong>Android for Cars App Library</strong>.</li></ul><h3>2. Framework Layer</h3><p>This layer houses the <strong>standard Android APIs</strong> and the <strong>automotive-specific extensions</strong> known as the <strong>Car API</strong>.</p><h3>Car API</h3><p>The <strong>Car API</strong> allows developers to access automotive-specific features in their apps. It provides access to hardware properties, vehicle state information, UX restrictions, and power management.</p><p>This API ensures that only devices with the necessary automotive features can call certain automotive-related methods, preventing errors on non-automotive devices. These APIs allow applications to interact with:</p><ul><li>Vehicle data (speed, fuel level, gear state)</li><li>UX restrictions (e.g., blocking video while driving)</li><li>Power state transitions (sleep, wake)</li></ul><p>📚 The Car API ensures that only <strong>automotive-capable devices</strong> can invoke car-specific features.</p><h3>3. Service Layer</h3><p>This is where core Android system services and <strong>car-specific services</strong> reside. This layer includes the <strong>Car Libraries (car-lib)</strong>, which provide essential functions for the system and applications. It also includes both <strong>Car Managers</strong> and <strong>Car Services</strong>, which enable communication between the Android system and the vehicle’s hardware.</p><h3>Car Managers</h3><p>These are high-level, app-accessible APIs that allow access to vehicle data and control:</p><ul><li><strong>CarPropertyManager</strong>: Read/write vehicle property data.</li><li><strong>CarPowerManager</strong>: Manage ignition and power states.</li><li><strong>CarSensorManager</strong>: Access live sensor data from the vehicle.</li></ul><p>📁 Code location: packages/services/Car/car-lib</p><h3>Car Services</h3><p>The <strong>CarService</strong> is a core system service that wraps vehicle properties and exposes a set of APIs to applications. It provides access to important vehicle functionalities, such as controlling the car’s media system, climate settings, and more. <br>These are <strong>system services</strong> implemented in CarService.java and run inside the persistent system app com.android.car.</p><p>They manage:</p><ul><li>Media playback</li><li>HVAC control</li><li>Diagnostic info</li></ul><p>🔧 Debug using: adb shell dumpsys car_service<br> 📁 Code location: packages/services/Car/service</p><h3>4. Vehicle HAL (VHAL)</h3><p>The <strong>Vehicle Hardware Abstraction Layer (VHAL)</strong> is the bridge between Android services and the vehicle’s hardware.</p><p>Stores vehicle data as <strong>Vehicle Properties</strong>, which represent signals from the vehicle bus (e.g., speed in m/s, HVAC temperature in °C). These properties can be updated either by changes on the vehicle bus or programmatically through Android apps. VHAL exposes these properties via a standard interface called <strong>IVehicle</strong>.</p><h3>Key Responsibilities:</h3><ul><li>Abstract communication with the vehicle’s ECUs (engine, climate, brakes, etc.)</li><li>Convert hardware signals into standardized <strong>Vehicle Properties</strong></li><li>Provide a vendor-neutral interface via IVehicle.aidl</li></ul><h3>Example Vehicle Properties:</h3><ul><li>VehicleProperty.SPEED</li><li>VehicleProperty.HVAC_TEMPERATURE</li><li>VehicleProperty.FUEL_LEVEL</li></ul><p>This allows system services and apps to work across different vehicle platforms without needing to know hardware details.</p><h3>5. Linux Kernel Layer</h3><p>At the bottom lies the <strong>Linux kernel</strong>, which manages the core hardware interactions. At the foundation of AAOS lies the <strong>Linux Kernel</strong>, which provides the basic functionality for managing hardware drivers like display, camera, Bluetooth, and audio.</p><p><strong>Handled Components:-</strong></p><ul><li><strong>Display &amp; Touchscreen</strong></li><li><strong>Audio &amp; Microphone</strong></li><li><strong>Bluetooth &amp; Wi-Fi</strong></li><li><strong>Camera, USB, and storage</strong></li></ul><p>OEMs may enhance this layer with custom drivers and real-time patches to meet <strong>automotive-grade performance and reliability</strong>.</p><h3>🧠 Conclusion</h3><p>Android Automotive OS offers a <strong>modular</strong>, <strong>secure</strong>, and <strong>scalable</strong> architecture to build next-generation in-vehicle infotainment systems. Whether you’re an OEM, Tier-1 supplier, or system integrator, understanding this architecture empowers you to build better, safer, and smarter car experiences.</p><p>Android Automotive OS is rapidly becoming the platform of choice for automakers seeking to integrate advanced infotainment systems into their vehicles. With its modular and flexible architecture, AAOS provides a comprehensive suite of tools that not only enhance the user experience but also empower automotive developers to create custom solutions.</p><h3>📚 Further Reading &amp; References</h3><ul><li><a href="https://developer.android.com/training/cars">Android Automotive OS Documentation</a></li><li><a href="https://cs.android.com/android/platform/superproject/+/main:packages/services/Car/">AOSP Car Service Source Code</a></li><li><a href="https://source.android.com/docs/automotive/vhal">Vehicle HAL Interface (AOSP)</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b0aa14c07a23" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>