اعتبارًا من 27 آذار (مارس) 2025، ننصحك باستخدام android-latest-release بدلاً من aosp-main لإنشاء AOSP والمساهمة فيه. لمزيد من المعلومات، يُرجى الاطّلاع على التغييرات في AOSP.
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
يقدّم نظام التشغيل Android 15 كيفية أخذ لقطة شاشة و
استعادتها لجهاز افتراضي من Cuttlefish. يتيح لك أخذ لقطة شاشة لجهاز
Cuttlefish حفظ حالة الجهاز في صورة على القرص.
يمكنك بعد ذلك استعادة اللقطة لإعادة جهاز Cuttlefish إلى
الحالة المحفوظة سابقًا.
يمكنك استخدام اللقطات في عمليات سير العمل المختلفة المبرمَجة أو اليدوية. عند تنفيذ إجراء يؤدي إلى تعديل الجهاز، يمكنك أخذ لقطة شاشة له لضمان إمكانية استعادة الجهاز إلى حالة محدّدة.
على سبيل المثال، عند تشغيل مجموعات اختبارات تعدِّل حالة الجهاز
ويمكن أن تتسبّب في حدوث مشاكل أو عدم استقرار في الاختبارات التالية،
يمكنك أخذ لقطة شاشة حتى تتمكّن من استعادة الجهاز إلى حالة محفوظة بعد
إجراء الاختبار، ما يضمن إجراء الاختبارات اللاحقة بسلاسة.
من الأمثلة الأخرى على سير العمل الذي تكون فيه اللقطات مفيدة هو اختبار
سلوك التطبيق. عند اختبار سلوك التطبيق استنادًا إلى مجموعة من
الإجراءات، يمكنك أخذ لقطة بين الإجراءات أثناء تشغيل التطبيق
للسماح لك باستعادة هذه اللقطة بدون الحاجة إلى إعادة البدء من
البداية. على سبيل المثال، إذا كان تشغيل لعبة يستغرق وقتًا طويلاً،
يمكنك أخذ لقطة شاشة بعد الوصول إلى القائمة الرئيسية حتى تتمكّن من استعادة
الجهاز إلى هذه الحالة، وتجاوز وقت التشغيل.
التقاط لقطة لجهاز Cuttlefish
عند أخذ لقطة شاشة لجهاز، يجب تعليق جهاز Cuttlefish
للتأكّد من أنّ جهاز Cuttlefish في حالة ثابتة. عند تعليق الجهاز، يتم إيقاف جميع وحدات المعالجة المركزية الافتراضية والأجهزة، وتُرسِل جميع المخازن المؤقتة حالتها إلى الجهاز الظاهري. بعد ذلك، تحفظ اللقطة حالة وحدة المعالجة المركزية الافتراضية والذاكرة
وحالة الجهاز على القرص في مجلد وجهة محدّد.
لا يتوافق VirtiosFS مع هذه العملية ويجب إيقافه عند أخذ لقطة خاطفة. لإيقاف VirtioFS، عليك تمرير الوسيطة
--enable_virtiofs=false عند تشغيل cvd create أو cvd start.
لا يتوفّر سوى وضع وحدة معالجة الرسومات SwiftShader (guest_swiftshader) لالتقاط
لقطات الشاشة. وأوضاع الرسومات المحسّنة
غير متوافقة.
توضّح الخطوات التالية عملية تشغيل جهاز Cuttlefish
وأخذ لقطة شاشة.
شغِّل جهازًا مع إيقاف VirtioFS. (يمكنك بعد ذلك استخدام الجهاز).
عند استعادة لقطة شاشة لجهاز Cuttlefish، يجب إيقاف مثيل Cuttlefish الذي تم التقاط اللقطة له. إذا سبق أن
تم إيقاف المثيل، ليس عليك اتّخاذ أي إجراء آخر ويمكن استعادة اللقطة.
لاستعادة لقطة شاشة لجهاز Cuttlefish، يمكنك تشغيل جهاز باستخدام cvd create
وتضمين مسار اللقطة. إذا كان رقم الإصدار الأساسي لجهاز Cuttlefish
الذي تم التقاط اللقطة منه يختلف عن رقم الإصدار الأساسي لوحدة Cuttlefish الحالية، يجب ضبط هذا الرقم باستخدام العلامة --base_instance_num.
يمكنك تعليق جهاز Cuttlefish بدون أخذ لقطة (لا يتم استخدام مساحة القرص لحفظ الحالة). لتعليق جهاز Cuttlefish، شغِّل:
cvdsuspend
استئناف استخدام جهاز Cuttlefish
لاستئناف عمل جهاز Cuttlefish المعلّق، شغِّل:
cvdresume
التحقّق من صحة ميزة "لقطة احتياطية/استعادة"
يمكن التحقّق من ميزة "التقاط لقطة احتياطية/استعادتها" من خلال إجراء الاختبار التالي:
atestSnapshotTest
يخضع كل من المحتوى وعيّنات التعليمات البرمجية في هذه الصفحة للتراخيص الموضحّة في ترخيص استخدام المحتوى. إنّ 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,["# Cuttlefish: Snapshot and restore\n\nAndroid 15 introduces how to take a snapshot and\nrestore a snapshot of a Cuttlefish virtual device. Taking a snapshot of a\nCuttlefish device lets you save the state of the device in an image on disk.\nYou can then restore the snapshot to bring up a Cuttlefish device to the\npreviously saved state.\n\nYou can use snapshots in various automated or manual workflows. When\nperforming a procedure that modifies the device, you can take a snapshot of\nthe device to ensure you can restore the device back to a specified state.\nFor example, when running test suites that modify the state of the device\nand can potentially cause issues or instabilities in the following tests,\nyou can take a snapshot so you can restore the device to a saved state after\na test, ensuring that subsequent tests run cleanly.\n\nAnother example workflow where snapshots are useful is when testing the\nbehavior of an app. When testing the behavior of an app based on a set of\nactions, you can take a snapshot in between actions as the app is running\nto let you restore to that snapshot without having to restart from the\nbeginning. For example, if launching a game has a long bringup time, you\ncan take a snapshot after reaching the main menu so you can restore the\ndevice to that state, skipping the bringup time.\n\nTake snapshot of a Cuttlefish device\n------------------------------------\n\n| **Note:** Snapshots are only supported on x86_64 platforms.\n\nWhen taking a snapshot of a device, the Cuttlefish device must be suspended\nto make sure the Cuttlefish device is in a stable state. When the device\nis suspended, all vCPUs and devices are stopped, and all buffers push\ntheir state to the VM. The snapshot then saves the vCPU state, memory,\nand device state to disk at a specified destination folder.\n\nVirtiosFS isn't supported and must be disabled when taking a snapshot. To\ndisable VirtioFS, pass the argument\n`--enable_virtiofs=false` when running `cvd create` or `cvd start`.\n\nOnly the SwiftShader (`guest_swiftshader`) GPU mode is supported for\nsnapshots. Other [accelerated graphics modes](/docs/devices/cuttlefish/gpu)\naren't supported.\n\nThe following steps describes the process of launching a Cuttlefish device\nand taking a snapshot.\n\n1. Launch a device, while disabling VirtioFS. (You can then use the device.)\n\n cvd create --enable_virtiofs=false --gpu_mode=guest_swiftshader\n\n2. Take a snapshot by running `cvd snapshot_take` with the following flags:\n\n - `--force`: If a folder exists at the specified snapshot path, this\n flag ensures that the existing folder is deleted, and a new folder\n is created at the snapshot path containing the snapshot\n\n - `--auto_suspend`: Suspends the device before the snapshot is taken and\n resumes the device after the snapshot is taken.\n\n - `--snapshot_path`: The specified path where a new folder is created\n with the snapshot.\n\n cvd snapshot_take --force --auto_suspend \\\n --snapshot_path=\u003cvar translate=\"no\"\u003ePATH\u003c/var\u003e\n\nRestore a Cuttlefish device\n---------------------------\n\nWhen restoring a Cuttlefish device snapshot, the Cuttlefish instance for\nwhich the snapshot was taken must be stopped. If the instance is already\nstopped, no further action is required and the snapshot can be restored.\n\nTo restore a snapshot of a Cuttlefish device, launch a device with `cvd create`\nand include the snapshot path. If the base instance number of the Cuttlefish\ndevice on which the snapshot was taken is different from the base instance\nnumber of the current Cuttlefish instance, pass that base instance\nnumber using the `--base_instance_num` flag. \n\n cvd create --snapshot_path=\u003cvar translate=\"no\"\u003ePATH\u003c/var\u003e \\\n --base_instance_num=\u003cvar translate=\"no\"\u003eID\u003c/var\u003e\n\nSuspend a Cuttlefish device\n---------------------------\n\nYou can suspend a Cuttlefish device without taking a snapshot (no disk space\nis used for saving the state). To suspend a Cuttlefish device, run: \n\n cvd suspend\n\nResume a Cuttlefish device\n--------------------------\n\nTo resume a suspended Cuttlefish device, run: \n\n cvd resume\n\nValidate the Snapshot/Restore feature\n-------------------------------------\n\nThe Snapshot/Restore feature can be validated by running the following test: \n\n atest SnapshotTest"]]