I recently wanted to use the fingerprint scanner on my Galaxy S6 in an app and doubted if Android would have classes pertaining to it (it does), which led me to ask:

Does Android add classes to its library for every minor hardware feature on every device that supports Android (like the fingerprint scanner on the Galaxy S6) even the obscure ones that maybe only 1 device has? If not, how would one access those hardware features?


Most hardware-specific code doesn't come from AOSP1, but is provided by the corresponding manufacturer (often as so-called binary blobs). This is especially true for "exotic components" (like your "fingerprint sensor") – but also for more common components as the camera. Which BTW also is one of the reasons why there isn't a "generic ROM" fitting all devices.2

1: Android Open Source Project
2: see Why is it that Android still can't be installed as regular OS? and Can I install any ROM for my Android device?

| improve this answer | |

This actually depends on what you are trying to do. Like it has been mentioned, hardware-specific code is provided by manufacturer (a.k.a) drivers. But to use them, all you need is an API that gives you access to those driver features. Most of the time, these API's may come from Android API itself, or if it's not mature enough directly from the manufacturer.

| improve this answer | |

Your Answer

