اعتبارًا من 27 آذار (مارس) 2025، ننصحك باستخدام android-latest-release بدلاً من aosp-main لإنشاء AOSP والمساهمة فيه. لمزيد من المعلومات، يُرجى الاطّلاع على التغييرات في AOSP.
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
على الأجهزة التي تتضمّن مستشعر بصمات الأصابع، يمكن للمستخدمين تسجيل بصمة إصبع واحدة أو أكثر واستخدامها لفتح قفل الجهاز وتنفيذ مهام أخرى. يستخدم Android لغة تعريف واجهة أجهزة بصمة الإصبع (HIDL) للاتصال بمكتبة خاصة بمورّد وأجهزة بصمة الإصبع (مثل مستشعر بصمة الإصبع).
يكون مستشعر بصمات الإصبع في الجهاز غير نشط بشكل عام. ومع ذلك، استجابةً لطلب إجراء عملية مسح ضوئي لبصمة الإصبع باستخدام authenticate أو enroll، يستمع مستشعر بصمة الإصبع إلى اللمس (قد تنشط الشاشة أيضًا عندما يلمس المستخدم مستشعر بصمة الإصبع). يتضمّن المسار العام لمطابقة بصمات الأصابع الخطوات التالية:
يضع المستخدم إصبعًا على مستشعر بصمات الأصابع.
تحدّد المكتبة الخاصة بالمورّد ما إذا كان هناك تطابق مع بصمة الإصبع في المجموعة الحالية من نماذج بصمات الأصابع المسجّلة.
يتم تمرير النتائج المطابقة إلى FingerprintService.
يفترض هذا المسار أنّه تم تسجيل بصمة إصبع على الجهاز، أي أنّ المكتبة الخاصة بالمورّد سجّلت نموذجًا لبصمة الإصبع. لمزيد من التفاصيل، يُرجى الاطّلاع على المصادقة.
هندسة معمارية
يتفاعل Fingerprint HAL مع المكوّنات التالية.
يتفاعل BiometricManager مباشرةً مع تطبيق في عملية التطبيق.
يحتوي كل تطبيق على مثيل من IBiometricsFingerprint.hal
تعمل FingerprintService في عملية النظام التي تتعامل مع الاتصال بواجهة HAL الخاصة ببصمة الإصبع.
Fingerprint HAL هو تطبيق C/C++ لواجهة IBiometricsFingerprint HIDL. يحتوي هذا الملف على المكتبة الخاصة بالمورّد
التي تتواصل مع الأجهزة الخاصة بالجهاز.
توفّر مكوّنات Keystore API وKeyMint (المعروفة سابقًا باسم Keymaster)
تشفيرًا مستندًا إلى الأجهزة لتخزين المفاتيح بشكل آمن في بيئة آمنة،
مثل بيئة التنفيذ الموثوقة (TEE).
الشكل 1. مخطّط تدفّق البيانات العالي المستوى للمصادقة ببصمة الإصبع
يجب أن يستخدم تنفيذ HAL خاص بمورّد بروتوكول الاتصال الذي يتطلبه TEE. يجب عدم تمرير الصور الأولية وميزات بصمات الأصابع المعالَجة في ذاكرة غير موثوق بها. يجب تخزين جميع بيانات المقاييس الحيوية هذه في أجهزة آمنة، مثل بيئة التنفيذ الموثوقة (TEE). يجب ألا يؤدي تحويل حالة الجهاز إلى جهاز جذر إلى تعريض بيانات المقاييس الحيوية للخطر.
تجري FingerprintService وfingerprintd مكالمات من خلال Fingerprint HAL إلى المكتبة الخاصة بالمورّد لتسجيل بصمات الأصابع وتنفيذ عمليات أخرى.
الشكل 2. تفاعل برنامج الخدمة لبصمة الإصبع
مع مكتبة بصمة الإصبع الخاصة بالمورّد
إرشادات التنفيذ
تم تصميم إرشادات Fingerprint HAL التالية لضمان عدم تسريب بيانات بصمة الإصبع وإزالتها عند إزالة مستخدم من الجهاز:
يجب ألا يكون من الممكن الوصول إلى بيانات بصمات الأصابع الأولية أو مشتقاتها (مثل النماذج) من خارج برنامج تشغيل جهاز الاستشعار أو بيئة التنفيذ الموثوقة (TEE). إذا كان الجهاز يتوافق مع
بيئة تنفيذ موثوقة (TEE)، يجب اقتصار إمكانية الوصول إلى الجهاز على TEE فقط وحمايته بموجب سياسة SELinux. يجب أن يكون بإمكان TEE فقط الوصول إلى قناة Serial Peripheral Interface (SPI)، ويجب أن تكون هناك سياسة SELinux صريحة على جميع ملفات الجهاز.
يجب أن يتم الحصول على بصمة الإصبع وتسجيلها والتعرّف عليها داخل TEE.
لا يتم تخزين بيانات بصمة الإصبع على نظام الملفات إلا بشكل مشفر حتى وإن كان نظام الملفات نفسه قد تم تشفيره.
يجب توقيع نماذج بصمات الأصابع باستخدام مفتاح خاص خاص بالجهاز.
بالنسبة إلى مقاييس التشفير المتقدّمة (AES)، يجب على الأقل توقيع نموذج باستخدام المسار المطلق لنظام الملفات والمجموعة ورقم تعريف البصمة، وذلك لضمان عدم إمكانية تشغيل ملفات النماذج على جهاز آخر أو من قِبل أي شخص آخر غير المستخدم الذي سجّل البصمة على الجهاز نفسه. فعلى سبيل المثال، يجب ألا ينجح تنفيذ عملية نسخ بيانات بصمة الإصبع من مستخدم آخر على نفس الجهاز أو من جهاز آخر.
يجب أن تستخدم عمليات التنفيذ إما مسار نظام الملفات الذي توفّره الدالة setActiveGroup() أو أن توفّر طريقة لمحو جميع بيانات نماذج المستخدمين عند إزالة المستخدم. ننصح بشدة بتخزين ملفات نموذج بصمة الإصبع بشكل مشفّر وفي المسار المقدَّم. إذا كان ذلك غير ممكن بسبب متطلبات التخزين في بيئة التنفيذ الموثوقة (TEE)، على المطوّر إضافة نقاط ربط لضمان إزالة البيانات عند إزالة المستخدم.
تؤدي إلى تبديل آلة الحالة في طبقة HAL لبدء جمع نموذج بصمة الإصبع وتخزينه. عند اكتمال عملية التسجيل،
أو بعد انتهاء المهلة، تعود آلة الحالة HAL إلى حالة الخمول.
preEnroll()
تنشئ هذه الطريقة رمزًا مميزًا فريدًا للإشارة إلى بدء عملية تسجيل بصمة الإصبع. توفّر رمزًا مميزًا للدالة enroll
لضمان إجراء مصادقة مسبقة، مثلاً باستخدام كلمة مرور. لمنع التلاعب، يتم تغليف الرمز المميّز بعد تأكيد بيانات اعتماد الجهاز. يجب التحقّق من الرمز المميّز أثناء التسجيل للتأكّد من أنّه لا يزال صالحًا.
getAuthenticatorId()
تعرض هذه الطريقة رمزًا مميزًا مرتبطًا بمجموعة بصمات الأصابع الحالية.
cancel()
يلغي هذا الرمز عمليات التسجيل أو المصادقة المعلّقة. يتم إعادة آلة الحالة الخاصة بطبقة HAL إلى حالة عدم النشاط.
enumerate()
طلب متزامن لتعداد جميع نماذج بصمات الأصابع المعروفة.
remove()
يحذف هذا الإجراء نموذج بصمة إصبع.
setActiveGroup()
تقصر هذه السمة عملية HAL على مجموعة من بصمات الأصابع التي تنتمي إلى مجموعة محدّدة، ويتم تحديدها من خلال معرّف المجموعة (GID).
authenticate()
تتم مصادقة عملية مرتبطة ببصمة الإصبع
(يتم تحديدها من خلال رقم تعريف العملية).
setNotify()
تسجِّل هذه السمة دالة مستخدم تتلقّى إشعارات من طبقة HAL. إذا كانت آلة الحالة في طبقة تجريد الأجهزة (HAL) في حالة انشغال، سيتم حظر الدالة إلى أن تخرج طبقة تجريد الأجهزة من حالة الانشغال.
postEnroll()
تنهي هذه الطريقة عملية التسجيل وتبطل التحدي الذي تم إنشاؤه
preEnroll(). يجب استدعاء هذا الإجراء في نهاية جلسة تسجيل بصمات متعددة للإشارة إلى أنّه لا يمكن إضافة المزيد من الأصابع.
يخضع كل من المحتوى وعيّنات التعليمات البرمجية في هذه الصفحة للتراخيص الموضحّة في ترخيص استخدام المحتوى. إنّ Java وOpenJDK هما علامتان تجاريتان مسجَّلتان لشركة Oracle و/أو الشركات التابعة لها.
تاريخ التعديل الأخير: 2025-07-27 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","easyToUnderstand","thumb-up"],["ساعَدني المحتوى في حلّ مشكلتي.","solvedMyProblem","thumb-up"],["غير ذلك","otherUp","thumb-up"]],[["لا يحتوي على المعلومات التي أحتاج إليها.","missingTheInformationINeed","thumb-down"],["الخطوات معقدة للغاية / كثيرة جدًا.","tooComplicatedTooManySteps","thumb-down"],["المحتوى قديم.","outOfDate","thumb-down"],["ثمة مشكلة في الترجمة.","translationIssue","thumb-down"],["مشكلة في العيّنات / التعليمات البرمجية","samplesCodeIssue","thumb-down"],["غير ذلك","otherDown","thumb-down"]],["تاريخ التعديل الأخير: 2025-07-27 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],null,["# Fingerprint HIDL\n\nOn devices with a fingerprint sensor, users can enroll one or more\nfingerprints and use those fingerprints to unlock the device and perform other\ntasks. Android uses the Fingerprint Hardware Interface Definition Language\n(HIDL) to connect to a vendor-specific library and fingerprint hardware (for\nexample, a fingerprint sensor).\n\nTo implement the Fingerprint HIDL, you must implement [`IBiometricsFingerprint.hal`](https://android.googlesource.com/platform/hardware/interfaces/+/refs/heads/android16-release/biometrics/fingerprint/2.1/IBiometricsFingerprint.hal)\nin a vendor-specific library.\n\nFingerprint matching\n--------------------\n\nThe fingerprint sensor of a device is generally idle. However, in response to\na call to `authenticate` or `enroll`, the\nfingerprint sensor listens for a touch (the screen might also wake when a user\ntouches the fingerprint sensor). The high-level flow of fingerprint matching\nincludes the following steps:\n\n1. User places a finger on the fingerprint sensor.\n2. The vendor-specific library determines if there is a fingerprint match in the current set of enrolled fingerprint templates.\n3. Matching results are passed to `FingerprintService`.\n\nThis flow assumes that a fingerprint has already been enrolled on the device, that is,\nthe vendor-specific library has enrolled a template for the fingerprint. For more\ndetails, see [Authentication](/docs/security/features/authentication).\n| **Note:** The more fingerprint templates stored on a device, the more time required for fingerprint matching.\n\nArchitecture\n------------\n\nThe Fingerprint HAL interacts with the following components.\n\n- `BiometricManager` interacts directly with an app in an app process. Each app has an instance of `IBiometricsFingerprint.hal`\n- `FingerprintService` operates in the system process, which handles communication with fingerprint HAL.\n- **Fingerprint HAL** is a C/C++ implementation of the IBiometricsFingerprint HIDL interface. This contains the vendor-specific library that communicates with the device-specific hardware.\n- **Keystore API and KeyMint (previously Keymaster)** components provide hardware-backed cryptography for secure key storage in a secure environment, such as the Trusted Execution Environment (TEE).\n\n**Figure 1.** High-level data flow for fingerprint authentication\n\nA vendor-specific HAL implementation must use the communication protocol\nrequired by a TEE. Raw images and processed fingerprint features must not\nbe passed in untrusted memory. All such biometric data needs to be stored\nin the secure hardware such as the TEE. Rooting **must not**\nbe able to compromise biometric data.\n\n`FingerprintService` and `fingerprintd` make calls through the Fingerprint HAL to\nthe vendor-specific library to enroll fingerprints and perform other\noperations.\n**Figure 2.** Interaction of the fingerprint daemon with the fingerprint vendor-specific library\n\nImplementation guidelines\n-------------------------\n\nThe following Fingerprint HAL guidelines are designed to ensure that\nfingerprint data is **not leaked** and is **removed**\nwhen a user is removed from a device:\n\n- Raw fingerprint data or derivatives (for example, templates) must never be accessible from outside the sensor driver or TEE. If the hardware supports a TEE, hardware access must be limited to the TEE and protected by an SELinux policy. The Serial Peripheral Interface (SPI) channel must be accessible only to the TEE and there must be an explicit SELinux policy on all device files.\n- Fingerprint acquisition, enrollment, and recognition must occur inside the TEE.\n- Only the encrypted form of the fingerprint data can be stored on the file system, even if the file system itself is encrypted.\n- Fingerprint templates must be signed with a private, device-specific key. For Advanced Encryption Standard (AES), at a minimum a template must be signed with the absolute file-system path, group, and finger ID such that template files are inoperable on another device or for anyone other than the user that enrolled them on the same device. For example, copying fingerprint data from a different user on the same device or from another device must not work.\n- Implementations must either use the file-system path provided by the `setActiveGroup()` function or provide a way to erase all user template data when the user is removed. It's strongly recommended that fingerprint template files be stored as encrypted and stored in the path provided. If this is infeasible due to TEE storage requirements, the implementer must add hooks to ensure removal of the data when the user is removed.\n\nFingerprint methods\n-------------------\n\nThe Fingerprint HIDL interface contains the following major methods in\n[`IBiometricsFingerprint.hal`](https://android.googlesource.com/platform/hardware/interfaces/+/refs/heads/android16-release/biometrics/fingerprint/2.1/IBiometricsFingerprint.hal).\n\n| Method | Description |\n|------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `enroll()` | Switches the HAL state machine to start the collection and storage of a fingerprint template. When enrollment is complete, or after a timeout, the HAL state machine returns to the idle state. |\n| `preEnroll()` | Generates a unique token to indicate the start of a fingerprint enrollment. Provides a token to the `enroll` function to ensure there was prior authentication, for example, using a password. To prevent tampering, the token is wrapped after the device credential is confirmed. The token must be checked during enrollment to verify that it's still valid. |\n| `getAuthenticatorId()` | Returns a token associated with the current fingerprint set. |\n| `cancel()` | Cancels pending enroll or authenticate operations. The HAL state machine is returned to the idle state. |\n| `enumerate()` | Synchronous call for enumerating all known fingerprint templates. |\n| `remove()` | Deletes a fingerprint template. |\n| `setActiveGroup()` | Restricts a HAL operation to a set of fingerprints that belong to a specified group, identified by a group identifier (GID). |\n| `authenticate()` | Authenticates a fingerprint-related operation (identified by an operation ID). |\n| `setNotify()` | Registers a user function that receives notifications from the HAL. If the HAL state machine is in a busy state, the function is blocked until the HAL leaves the busy state. |\n| `postEnroll()` | Finishes the enroll operation and invalidates the `preEnroll()` generated challenge. This must be called at the end of a multifinger enrollment session to indicate that no more fingers may be added. |\n\nFor more details on these, refer to the comments in [`IBiometricsFingerprint.hal`](https://android.googlesource.com/platform/hardware/interfaces/+/refs/heads/android16-release/biometrics/fingerprint/2.1/IBiometricsFingerprint.hal)."]]