اعتبارًا من 27 آذار (مارس) 2025، ننصحك باستخدام android-latest-release
بدلاً من aosp-main
لإنشاء AOSP والمساهمة فيه. لمزيد من المعلومات، يُرجى الاطّلاع على التغييرات في AOSP.
استخدام خدمة كاميرا Android
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
تتألف خدمة كاميرا Android من حِزم الكاميرا المستخدَمة في الأجهزة المخصّصة للسيارات، بالإضافة إلى أشكال الأجهزة الأخرى، مثل الهواتف الجوّالة والأجهزة اللوحية والتلفزيونات. للاطّلاع على البنية العامة للكاميرا، يُرجى الاطّلاع على
الكاميرا. تركّز هذه الصفحة على مواضيع تتعلّق بالأجهزة المخصّصة للسيارات
واستخدام Android Camera API.
تفعيل خدمة كاميرا Android
لتفعيل "خدمة كاميرا Android" على منصة السيارات، يجب أن يحدِّدملف ENABLE_CAMERA_SERVICE
makefile للمنتجات ENABLE_CAMERA_SERVICE
على أنّه true
.
خصائص الكاميرا المخصّصة للمركبات
في سياق الأجهزة المخصّصة للسيارات، يجب أن يتضمّن HAL للكاميرا سمتَين
مميّزتين خاصتَين بتصميم الأجهزة المخصّصة للسيارات:
في الحالات التي لا تتوافق فيها الكاميرات بدقة مع موقع جغرافي أو اتجاه عدسة معيّنَين (يُشار إلى ذلك من خلال توفّر *_OTHER
في سمات
android.automotive.location
أو android.automotive.lens.facing
)، أو عندما تتشارك كاميرات متعدّدة الموقع الجغرافي والاتجاه نفسهَين، يجب أن يوفّر HAL للكاميرا سمات إضافية لتتمكّن التطبيقات من تحديد موقع الكاميرا بدقة. وتشمل هذه الخصائص
ما يلي:
منح إذن الوصول إلى "مستخدِم النظام بلا واجهة مستخدم رسومية"
يمكن لبعض تطبيقات النظام والتطبيقات التابعة للجهة الأولى الوصول إلى الكاميرا بصفتها "مستخدِم لنظام بلا واجهة مستخدم رسومية"، والمعروف أيضًا باسم "المستخدِم 0". تضمن هذه الميزة أنّ التطبيقات المُهمّة للسلامة، مثل كاميرا الرؤية الخلفية، يمكنها مواصلة بث الكاميرا بدون انقطاع، بغض النظر عن تبديل المستخدم للتطبيقات التي تعمل في المقدّمة. لا يمكن للتطبيقات التي تم
توقيعها على النظام الأساسي والحصول على الإذن الجديد
android.permission.CAMERA_HEADLESS_SYSTEM_USER
الوصول إلى الكاميرا بصفته
المستخدم 0.
بالنسبة إلى التطبيقات التي تصل إلى الكاميرات بصفتها "المستخدم 0"، يجب استخدام بيانات الكاميرا محليًا
ويجب عدم نقلها خارج الجهاز، بما في ذلك أي بيانات مستمَدة من
بيانات الكاميرا. تتطلّب هذه التطبيقات منح الإذن android.permission.CAMERA
مسبقًا، ويجب أن تلتزم بسياسة منح الأذونات مسبقًا الموضّحة في التصميم للقيادة لمتطلبات GAS.
ضبط قائمة مسموح بها لخصوصية الكاميرا
يمكن الآن للمصنّعين الأصليين للأجهزة ضبط تطبيقات كاميرا معيّنة
لتضمينها في قائمة مسموح بها تمنح إذن الوصول إلى الكاميرا بغض النظر عن
حالة مفتاح التبديل الخاص بالخصوصية في الكاميرا. تتيح هذه الميزة للمستخدمين إيقاف إذن الوصول إلى الكاميرamatin لتطبيقات الترفيه، مثل وسائل التواصل الاجتماعي ومكالمات الفيديو،
مع السماح في الوقت نفسه بالوصول إلى الكاميرا لتطبيقات معيّنة مُدرَجة في القائمة المسموح بها.
لا يمكن استخدام هذه الميزة إلا من خلال تطبيقات النظام والتطبيقات المميّزة التي تم منحها الإذن
android.permission.CAMERA_PRIVACY_ALLOWLIST
.
على شركاء "خدمات Google Automotive" إرسال التطبيقات المدرَجة في القائمة المسموح بها
لمراجعتها والالتزام بسياسة القائمة المسموح بها للخصوصية. لمزيد من المعلومات، يُرجى الاطّلاع على مقالة
Android للسيارات.
إضافة تطبيق إلى القائمة المسموح بها
في دليل etc/sysconfig
:
أضِف اسم حزمة التطبيق في ملف XML لإعدادات النظام:
<!-- In an xml file under etc/sysconfig —>
<!--
Allowlisted packages for the camera privacy toggle. Users will not be able to turn the privacy on for these packages as OEM requires camera access for these packages to preserve user safety.
-->
<config>
<camera-privacy-allowlisted-app package="package_name" />
</config>
أضِف عنوان URL لبيان الإفصاح عن سياسة الخصوصية في التطبيق إلى AndroidManifest.xml
.
يجب أن يكون اسم meta-data
هو privacy_policy
.
<meta-data android:name="privacy_policy" android:value= privacy policy URL/>
بشكلٍ تلقائي، يتم
إخفاء مفتاح خصوصية الكاميرا للتطبيقات المدرَجة في القائمة المسموح بها أو التطبيقات المطلوبة في واجهة مستخدم إعدادات الخصوصية. ومع ذلك، يمكن لمصنّعي المعدّات الأصلية إلغاء هذا السلوك
من خلال ضبط العلامة التالية على TRUE
. يتيح ذلك لمصنّعي الأجهزة الأصليين تخصيص
مستوى ظهور مفتاح خصوصية الكاميرا للتطبيقات المطلوبة استنادًا إلى
إعداداتهم المفضّلة.
<!-- Whether to show the toggle to turn on the camera privacy for required apps -->
<bool name="config_show_camera_required_apps_toggle">false</bool>
استخدام الكاميرا قبل إطلاقها
يمكن لبعض التطبيقات الحساسة للوقت والمتعلقة بالسلامة الوصول إلى الكاميرا قبل اكتمال عملية تشغيل Android. ومع ذلك، لا يُمنح إذن الوصول هذا إلّا
للعملاء المميّزين الذين لديهم UID AID_AUTOMOTIVE_EVS
. لمزيد من المعلومات
عن منح رقم تعريف مستخدم معيّن لتطبيق أصلي،
اطّلِع على مقالة التحكّم في الوصول التقديري (DAC).
يقتصر هذا الوصول المبكر إلى الكاميرا على كاميرات النظام المُثبَّتة على
الجانب الخارجي من هيكل المركبة.
يخضع كل من المحتوى وعيّنات التعليمات البرمجية في هذه الصفحة للتراخيص الموضحّة في ترخيص استخدام المحتوى. إنّ Java وOpenJDK هما علامتان تجاريتان مسجَّلتان لشركة Oracle و/أو الشركات التابعة لها.
تاريخ التعديل الأخير: 2025-06-12 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","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-06-12 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],null,["# Use the Android Camera Service\n\nThe Android Camera Service comprises the camera stack used in automotive\ndevices, as well as in other form factors such as mobile phones, tablets,\nand TVs. To view the overall camera architecture, see\n[Camera](/docs/core/camera). This page focuses on topics specific to automotive\ndevices, and working with the [Android Camera API](https://developer.android.com/reference/android/hardware/camera2/package-summary).\n\nEnable Android Camera Service\n-----------------------------\n\nTo enable the Android Camera Service on the automotive platform, the product's\nmakefile must specify `ENABLE_CAMERA_SERVICE` as `true`.\n\nAutomotive-specific camera characteristics\n------------------------------------------\n\nIn the context of automotive devices, the camera HAL must include two\ndistinctive characteristics specific to the automotive form factor:\n\n| Name | Description |\n|-------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------|\n| [android.automotive.location](https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics#AUTOMOTIVE_LOCATION) | Specifies the positioning of cameras in relation to the vehicle's body frame. |\n| [android.automotive.lens.facing](https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics#AUTOMOTIVE_LENS_FACING) | Indicates which direction a camera lens is facing relative to the vehicle body frame and passenger seats. |\n\nIn situations when cameras don't precisely align with specific location or lens\norientation (indicated by the presence of `*_OTHER` in the\n[`android.automotive.location`](https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics#AUTOMOTIVE_LOCATION) or [`android.automotive.lens.facing`](https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics#AUTOMOTIVE_LENS_FACING)\ncharacteristics), or when multiple cameras share the same location and\ndirection, the camera HAL should provide additional characteristics to enable\napps to accurately determine the camera's location. These characteristics\ninclude:\n\n- [`android.lens.poseReference`](https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics#LENS_POSE_REFERENCE)\n- [`android.lens.poseRotation`](https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics#LENS_POSE_ROTATION)\n- [`android.lens.poseTranslation`](https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics#LENS_POSE_TRANSLATION)\n\nGrant access to the Headless System User\n----------------------------------------\n\nCertain system and first-party (1P) apps can access the camera as the Headless\nSystem User, also known as User 0. This feature ensures that safety-critical\napps, such as the rear-view camera, can continue camera streaming without\ninterruption, regardless of foreground user switching. Only apps that are\nplatform-signed and hold the new permission\n`android.permission.CAMERA_HEADLESS_SYSTEM_USER` can access the camera as\nUser 0.\n\nFor apps accessing cameras as User 0, the camera data MUST be consumed locally\nand MUST not be transmitted off the device, including any data derived from the\ncamera data. These apps require that the `android.permission.CAMERA` permission\nbe pre-granted and must adhere to the pre-grant permission policy outlined in\n[Design for Driving](https://developers.google.com/cars) for GAS requirements.\n\nConfigure a camera privacy allowlist\n------------------------------------\n\nOriginal equipment manufacturers (OEMs) can now configure specific camera apps\nto be included on an allowlist that grants camera access regardless of the\ncamera privacy toggle's status. This feature enables users to disable camera\naccess for entertainment apps, such as social media and video conferencing,\nwhile simultaneously permitting camera access for certain allowlisted apps.\n\nOnly system and privileged apps granted the\n`android.permission.CAMERA_PRIVACY_ALLOWLIST` permission can use this feature.\nGoogle Automotive Services (GAS) partners must submit their allowlisted apps\nfor review and comply with the privacy allowlist policy. To learn more, see\n[Android for Cars](https://developers.google.com/cars).\n\n### Add an app to the allowlist\n\nIn the `etc/sysconfig` directory:\n\n1. Add the app's package name in a system configuration XML file:\n\n \u003c!-- In an xml file under etc/sysconfig ---\u003e\n\n \u003c!--\n Allowlisted packages for the camera privacy toggle. Users will not be able to turn the privacy on for these packages as OEM requires camera access for these packages to preserve user safety.\n --\u003e\n\n \u003cconfig\u003e\n \u003ccamera-privacy-allowlisted-app package=\"package_name\" /\u003e\n \u003c/config\u003e\n\n2. Add the app's URL of privacy policy disclosure to `AndroidManifest.xml`.\n The name of the `meta-data` should be `privacy_policy`.\n\n \u003cmeta-data android:name=\"privacy_policy\" android:value= privacy policy URL/\u003e\n\nBy default, the camera privacy toggle for allowlisted apps or required apps is\nhidden in the **Privacy Settings** UI. However, OEMs can override this behavior\nby setting the following flag to `TRUE`. This allows OEMs to customize the\nvisibility of the camera privacy toggle for the required apps based on their\npreferences. \n\n \u003c!-- Whether to show the toggle to turn on the camera privacy for required apps --\u003e\n\n \u003cbool name=\"config_show_camera_required_apps_toggle\"\u003efalse\u003c/bool\u003e\n\nGet early camera access\n-----------------------\n\nSpecific time-sensitive and safety-oriented apps can access the camera before\nthe Android boot process is finished. However, this access is exclusively\ngranted to privileged clients with the `UID AID_AUTOMOTIVE_EVS`. To learn more\nabout assigning a specific UID to a native app,\nsee [Discretionary access control (DAC)](/docs/core/permissions/filesystem).\nThis early access to the camera is limited to system cameras positioned on the\nexterior of the vehicle's body."]]