اعتبارًا من 27 آذار (مارس) 2025، ننصحك باستخدام android-latest-release بدلاً من aosp-main لإنشاء AOSP والمساهمة فيه. لمزيد من المعلومات، يُرجى الاطّلاع على التغييرات في AOSP.
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
يجب أن تكون الأجهزة التي تعمل بنظام التشغيل Android 12 باستخدام إصدارات kernel
أعلى من الإصدار 5.4 مزوّدة بنواة GKI. لكي يتمكّن
الشركاء من الوصول إلى DebugFS في إصدارات userdebug أثناء تطويرهم باستخدام ملف تعريف GKI
النواة، يتم تفعيل إعدادات ملف تعريف النواة CONFIG_DEBUG_FS في ملف تعريف GKI defconfig.
عدم تركيب DebugFS مطلقًا في إصدارات المستخدمين للأجهزة التي تعمل بالإصدار 12 من Android
توفّر إصدارات Userdebug تغطية اختبار أفضل من إصدارات المستخدمين، ويتم اختبارها بشكل مكثّف
طوال دورة التطوير. تعمل الخطة التالية على تقليل
الفرق بين نوعَي الإصدار في ما يتعلّق بالوصول إلى DebugFS، وتوفر
الفوائد التالية:
منع إصدارات userdebug من الاعتماد عن طريق الخطأ على DebugFS
للحصول على وظائف جديدة
التأكّد من أنّ أي وظيفة حالية تتعذّر بسبب عدم توفّر DebugFS
معروفة في وقت مبكر من دورة التطوير
يتم تصنيف عمليات الوصول إلى Debugfs في عمليات إنشاء userdebug على النحو التالي:
عمليات إعداد ملفات DebugFS أثناء تشغيل الجهاز، مثل
إذن الوصول للكتابة إلى ملف في DebugFS لتفعيل جمع بيانات تصحيح الأخطاء
إنشاء تقرير أخطاء: يقرأ HAL dumpstate ملفات DebugFS عندما يُستخدَم DumpstateBoard() من قِبل dumpstate. تصبح هذه
المعلومات جزءًا من تقرير الخطأ.
الاختبار والتحقّق من الأجهزة
يوضِّح الجدول التالي كيفية إتاحة كل فئة من هذه الفئات الثلاث في الإصدار 12 من نظام التشغيل Android. يُرجى العِلم أنّ الخطوات التالية لا تنطبق إلا على إصدارات userdebug، لأنّه لا يمكن تركيب DebugFS في إصدارات المستخدم.
حالة الاستخدام
إصدار userdebug من Android 12
إعداد ملفات DebugFS لمرة واحدة أثناء بدء التشغيللا يحدث هذا الوصول إلا مرة واحدة أثناء عملية التمهيد.
ويعمل Dumpstate HAL على تنفيذ ذلك أثناء عملية إعداد HAL. لتفعيل ذلك،
يُثبِّت init DebugFS في إصدارات userdebug قبل بدء HAL.
يتصل Init بـ umount() على DebugFS عند
اكتمال عملية تشغيل الجهاز.
إنشاء تقرير الخطأ: يقرأ HAL dumpstate
ملفّات DebugFS، والتي تصبح جزءًا من تقرير الخطأ.
يتم تنفيذ ذلك من خلال HAL dumpstate في غضون DumpstateBoard() عند استدعائه من خلال dumpstate
(DumpstateDevice.cpp).
تضمن أداة dumpstate (جزء من إطار عمل Android) ربط DebugFS
أثناء الاستدعاء.
الاختبار والتحقّق من الأجهزة
Adb root وshell شغِّل DebugFS من shell adb باستخدام
إذن الوصول إلى الجذر1.
1لتركيب DebugFS من adb shell باستخدام
إذن الوصول إلى الجذر، استخدِم الأمر التالي:
adb shell mount -t debugfs debugfs /sys/kernel/debug.
إجراءات الشركاء المطلوبة
على الشركاء تنفيذ ما يلي استنادًا إلى هذه التغييرات في
أجهزة Android 12:
لا تسمح بالوصول إلى DebugFS أثناء وقت التشغيل. تنطبق الاستثناءات التالية:
إنشاء تقرير أخطاء (يأتي من HAL dumpstate)
الاختبار والتحقق (يمكن الوصول إليهما من خلال adb root وshell
- تأكَّد من تركيب DebugFS أولاً)
يمكن للمطوّرين ضبط السمة الثابتة لتصحيح الأخطاء
persist.dbg.keep_debugfs_mounted لإبقاء DebugFs مركّبًا على مستوى
عمليات إعادة التشغيل في إصدارَي userdebug وeng.
تضمن اختبارات الامتثال لبرنامج GTS عدم
تثبيت نظام الملفات DebugFS في إصدارات المستخدمين. تضمن عبارات neverallow في سياسة الأمان عدم منح العمليات غير المصرَّح بها إذنًا بالوصول إلى DebugFs على الأجهزة التي تعمل بالإصدار 12 من Android أو الإصدارات الأحدث.
يخضع كل من المحتوى وعيّنات التعليمات البرمجية في هذه الصفحة للتراخيص الموضحّة في ترخيص استخدام المحتوى. إنّ 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,["# Use DebugFS in Android 12\n\nDevices that launch with Android 12 using kernel\nversions higher than v5.4 are required to ship with the GKI kernel. So that\npartners can access `DebugFS` in userdebug builds while they develop on the GKI\nkernel, the kernel config `CONFIG_DEBUG_FS` is enabled in the GKI defconfig.\n**Never mount `DebugFS` in user builds** for devices\nlaunching on Android 12.\n\n\nUserdebug builds have better test coverage than user builds and get heavily\ntested throughout the development cycle. The following plan minimizes the\ndifference between the two build types with respect to `DebugFS` access, and\nprovides these benefits:\n\n- Prevents userdebug builds from accidentally depending on `DebugFS` for new functionality\n- Ensures that any existing functionality that's broken by the lack of DebugFS is known early in the development cycle\n\n\nDebugfs accesses **in userdebug builds** are categorized as\nfollows:\n\n1. `DebugFS` file initializations during device boot, such as a write access to a file in `DebugFS` to turn on debug data collection.\n2. Bugreport generation: The dumpstate HAL reads `DebugFS` files when `DumpstateBoard()` is invoked by `dumpstate`. This information becomes part of the bug report.\n3. Device-specific testing and validation.\n\nThe following table describes how each of these three categories is\nsupported in Android 12. Note that the\nfollowing only applies to userdebug builds since `DebugFS` can't be\nmounted in user builds.\n\n| Use case | Android 12 userdebug build |\n|-------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| **One-time `DebugFS` files initialization, during startup** . This access **happens only once** during boot time. | Dumpstate HAL performs this during HAL initialization. To enable the same, init mounts `DebugFS` in userdebug builds before the HAL initializes. `Init` calls `umount()` on `DebugFS` when the device has completed booting. |\n| **Bugreport generation** : The dumpstate HAL reads `DebugFS` files, which become part of the bug report. | Done by dumpstate HAL within `DumpstateBoard()` when invoked by dumpstate ([DumpstateDevice.cpp](https://cs.android.com/android/platform/superproject/+/android-latest-release:device/google/trout/hal/dumpstate/1.1/DumpstateDevice.cpp)). The dumpstate tool (part of the Android framework) ensures that `DebugFS` mounts during the invocation. |\n| **Device-specific testing and validation** | Adb root and shell. Mount `DebugFS` from the adb shell with root access^1^. |\n\n\n^1^To mount `DebugFS` from `adb shell` with\nroot access, use this command:\n\n`adb shell mount -t debugfs debugfs /sys/kernel/debug`.\n| **Note:**\n|\n| - **Android 12: There aren't any new APIs for accessing the\n| dumpstate HAL**.\n| - **Android 12: New clients don't have access** to the dumpstate HAL.\n| - Only the dumpstate HAL process and vendor-modprobe tool can access `DebugFS` for Android 12 launching devices, since the kernel modules it loads might create `DebugFS` files.\n\nRequired partner actions\n------------------------\n\n\nPartners must enact the following based on these changes in\nAndroid 12 devices:\n\n- Make all boot time initializations of `DebugFS` nodes happen during the dumpstate HAL initialization. For an example of how to do this, see [DNM:\n Example for boot time initialization of `DebugFS` files](https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1426054).\n- **Don't allow `DebugFS` access during runtime. The following exceptions\n apply:**\n - Bugreport generation (comes from the dumpstate HAL)\n - Testing and validation (accessible by `adb root` and `shell` - ensure that DebugFS is mounted first)\n\nDevelopers can set the debug persistent property\n`persist.dbg.keep_debugfs_mounted` to keep `DebugFs` mounted across\nreboots on userdebug and eng builds.\n\nGTS compliance tests ensure that the `DebugFS` filesystem isn't\nmounted in user builds. Sepolicy `neverallow` statements ensure that in devices\nlaunching on Android 12 or higher, unauthorized processes aren't provided\naccess to `DebugFs`."]]