- بناء الجملة:
<permission android:description="string resource" android:icon="drawable resource" android:label="string resource" android:name="string" android:permissionGroup="string" android:protectionLevel=["normal" | "dangerous" | "signature" | ...] />
- الواردة في:
<manifest>
- description:
- أعلن عن إذن أمان يُستخدم من أجل تقييد الوصول إلى مكونات أو ميزات معينة لهذا التطبيق أو التطبيقات الأخرى. لمزيد من المعلومات حول كيفية عمل الأذونات، يُرجى الاطّلاع على قسم الأذونات في النظرة العامة على بيان التطبيق ونصائح الأمان.
- :
android:description
- وصف سهل القراءة للمستخدم للإذن أطول وأكثر
مفيدة أكثر من التسمية. وقد تعرض، على سبيل المثال، لشرح
الإذن الممنوح للمستخدم عندما يُطلب منه ذلك
لمنح الإذن لتطبيق آخر.
تم تعيين هذه السمة كمرجع لمورد السلسلة. وعلى عكس السمة
label
، لا يمكن أن تكون سلسلة أولية. android:icon
- إشارة إلى مورد قابل للرسم لرمز يمثّل إذن.
android:label
- اسم للإذن سهل القراءة للمستخدم.
ولتسهيل الأمر، يمكن ضبط التصنيف مباشرةً كسلسلة أولية أثناء تطوير التطبيق. ومع ذلك، عندما يكون التطبيق جاهزًا للنشر، يمكنك ضبطه مرجعًا لمورد سلسلة، بحيث يمكن ترجمته مثل غيرها السلاسل في واجهة المستخدم.
android:name
- الاسم الذي سيتم استخدامه في
رمز للإشارة إلى الإذن، كما هو الحال في
<uses-permission>
أو العنصرpermission
سمات مكونات التطبيق.ملاحظة: لا يسمح النظام بالإفصاح عن حزم متعدّدة. إذن بالاسم نفسه ما لم يتم توقيع جميع الحزم باستخدام الشهادة نفسها. إذا أعلنت حزمة عن إذن، لا يسمح النظام بذلك. المستخدِم بتثبيت حِزم أخرى باسم الإذن نفسه، ما لم يتم توقيع هذه الحزم بنفس الشهادة مثل الحزمة الأولى.
لهذا السبب، تنصح Google باستخدام بادئة أذونات باسم حزمة التطبيق، باستخدام تسمية نمط النطاق العكسي. اتّبِع هذه البادئة مع
.permission.
، ثم وصف الذي يمثله الإذن في الجزء العلوي من SNAKE_CASE. مثل:com.example.myapp.permission.ENGAGE_HYPERSPACE
يؤدي اتباع هذه التوصية إلى تجنب تسمية التضاربات والمساعدة في تحديد المالك بوضوح الإذن المخصّص وهدفه
android:permissionGroup
- يعيّن هذا الإذن إلى مجموعة. قيمة هذه السمة هي
باسم المجموعة، والذي يتم الإعلان عنه باستخدام
العنصر
<permission-group>
في هذه المشاركة أو تطبيقًا آخر. إذا لم يتم ضبط هذه السمة، سيتم منح الإذن لا ينتمي إلى مجموعة. android:protectionLevel
-
يصف المخاطر المحتملة الضمنية في الإذن تشير إلى الإجراء الذي ينبغي أن يتبعه النظام عند تحديد ما إذا كان يتم منح الإذن لتطبيق يطلبه أم لا.
يتألّف كل مستوى حماية من نوع إذن أساسي وصفر أو أكثر. الأعلام. على سبيل المثال، لا يحتوي مستوى الحماية
"dangerous"
على أي الأعلام. في المقابل، مستوى الحماية"signature|privileged"
هو مزيج من نوع الإذن الأساسي"signature"
علم"privileged"
يعرض الجدول التالي جميع أنواع الأذونات الأساسية. للحصول على قائمة بالعلامات، راجع
protectionLevel
القيمة المعنى "normal"
القيمة التلقائية. إذن منخفض الخطورة يمنح إمكانية وصول التطبيقات إلى ميزات معزولة على مستوى التطبيقات خطرًا بسيطًا على التطبيقات الأخرى أو النظام أو المستخدم. يمنح النظام هذا النوع تلقائيًا منح إذن للتطبيق المطلوب عند التثبيت، دون يطلب موافقة المستخدم الصريحة، على الرغم من أن المستخدم دائمًا خيار مراجعة هذه الأذونات قبل التثبيت. "dangerous"
يشير هذا المصطلح إلى إذن عالي الخطورة يتيح تقديم طلب. الوصول إلى بيانات المستخدم الخاصة أو التحكم في الجهاز الذي يمكنه تؤثر سلبًا على المستخدم. لأنّ هذا النوع من الأذونات إلى مخاطر محتملة، فقد لا يقوم النظام تلقائيًا ومنحه للتطبيق صاحب الطلب. على سبيل المثال، أي علامات قد يتم عرض الأذونات التي يطلبها التطبيق على المستخدم وتطلب تأكيدًا قبل المتابعة أو نهجًا متبعًا لتجنب منح المستخدم لاستخدام هذه المرافق. "signature"
إذن يمنحه النظام فقط إذا كان مقدّم الطلب تم توقيع التطبيق باستخدام الشهادة نفسها التي يستخدمها التطبيق التي أعلنت عن الإذن. في حال تطابُق الشهادتين، يتولى النظام يتم تلقائيًا منح الإذن بدون إشعار المستخدم لطلب موافقة صريحة من المستخدم. "knownSigner"
إذن يمنحه النظام فقط إذا كان مقدّم الطلب تم توقيع الطلب باستخدام مسموح به الشهادة. وإذا كانت شهادة مقدِّم الطلب مُدرجة، يفحص النظام يتم تلقائيًا منح الإذن بدون إشعار المستخدم لطلب موافقة صريحة من المستخدم. "signatureOrSystem"
المرادف القديم لـ
"signature|privileged"
. تم إيقافها في واجهة برمجة التطبيقات المستوى 23إذن يمنحه النظام للتطبيقات التي في مجلد مخصص على صورة نظام Android أو التي بالشهادة نفسها التابعة للتطبيق الذي أعلن عن إذن. تجنَّب استخدام هذا الخيار، باعتباره
"signature"
مستوى الحماية كافٍ لمعظم الاحتياجات ويعمل بغضّ النظر التي تم تثبيت التطبيقات عليها.تشير رسالة الأشكال البيانية يتم استخدام إذن
"signatureOrSystem"
لبعض أنواع الأذونات الخاصة. الحالات التي يكون فيها لدى العديد من الموردين تطبيقات مضمنة في النظام وتحتاج إلى مشاركة ميزات محددة بشكل صريح لأنها قيد الإنشاء معًا.
- تم تقديمها في:
- المستوى 1 من واجهة برمجة التطبيقات
- راجِع أيضًا:
<uses-permission>
<permission-tree>
<permission-group>
<إذن>
يخضع كل من المحتوى وعيّنات التعليمات البرمجية في هذه الصفحة للتراخيص الموضحّة في ترخيص استخدام المحتوى. إنّ 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,["# <permission\u003e\n\nsyntax:\n:\n\n ```xml\n \u003cpermission android:description=\"string resource\"\n android:icon=\"drawable resource\"\n android:label=\"string resource\"\n android:name=\"string\"\n android:permissionGroup=\"string\"\n android:protectionLevel=[\"normal\" | \"dangerous\" |\n \"signature\" | ...] /\u003e\n ```\n\ncontained in:\n: [\u003cmanifest\u003e](/guide/topics/manifest/manifest-element)\n\ndescription:\n: Declares a security permission used to\n limit access to specific components or features of this or other applications.\n For more information about how permissions work, see the [Permissions](/guide/topics/manifest/manifest-intro#perms) section in the app manifest overview and [Security tips](/guide/topics/security/security).\n\nattributes:\n:\n\n `android:description`\n\n : A user-readable description of the permission that is longer and more informative than the label. It might display, for example, to explain the permission to the user when the user is asked to grant the permission to another application.\u003cbr /\u003e\n\n\n This attribute is set as a reference to a string resource.\n Unlike the `label` attribute, it can't be a raw string.\n\n `android:icon`\n : A reference to a drawable resource for an icon that represents the\n permission.\n\n `android:label`\n\n : A user-readable name for the permission.\u003cbr /\u003e\n\n\n As a convenience, the label can be directly set\n as a raw string while you're developing the application. However,\n when the application is ready to publish, set it as a\n reference to a string resource, so that it can be localized like other\n strings in the user interface.\n\n `android:name`\n : The name to be used in\n code to refer to the permission, such as in a\n [\u003cuses-permission\u003e](/guide/topics/manifest/uses-permission-element) element or the\n `permission` attributes of application components.\n\n\n **Note:** The system doesn't let multiple packages declare\n a permission with the same name unless all the packages are signed with the\n same certificate. If a package declares a permission, the system doesn't permit\n the user to install other packages with the same permission name, unless\n those packages are signed with the same certificate as the first package.\n\n For this reason, Google recommends prefixing permissions with the app's package name,\n using reverse-domain-style naming.\n Follow this prefix with `.permission.` and then a description of the\n capability that the permission represents in upper SNAKE_CASE. For example:\n `com.example.myapp.permission.ENGAGE_HYPERSPACE`.\n\n Following this recommendation avoids naming collisions and helps clearly identify the owner\n and intention of a custom permission.\n\n `android:permissionGroup`\n : Assigns this permission to a group. The value of this attribute is\n the name of the group, which is declared with the\n [\u003cpermission-group\u003e](/guide/topics/manifest/permission-group-element) element in this\n or another application. If this attribute isn't set, the permission\n doesn't belong to a group.\n\n `android:protectionLevel`\n\n :\n Characterizes the potential risk implied in the permission and\n indicates the procedure for the system to follow when determining\n whether to grant the permission to an application requesting it.\n\n\n Each protection level consists of a base permission type and zero or more\n flags. For example, the `\"dangerous\"` protection level has no\n flags. In contrast, the protection level `\"signature|privileged\"`\n is a combination of the `\"signature\"` base permission type and the\n `\"privileged\"` flag.\n\n\n The following table shows all base permission types. For a list of flags, see\n [protectionLevel](/reference/android/R.attr#protectionLevel).\n\n | Value | Meaning |\n |-----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n | `\"normal\"` | The default value. A lower-risk permission that gives requesting applications access to isolated application-level features with minimal risk to other applications, the system, or the user. The system automatically grants this type of permission to a requesting application at installation, without asking for the user's explicit approval, though the user always has the option to review these permissions before installing. |\n | `\"dangerous\"` | A higher-risk permission that gives a requesting application access to private user data or control over the device that can negatively impact the user. Because this type of permission introduces potential risk, the system might not automatically grant it to the requesting application. For example, any dangerous permissions requested by an application might be displayed to the user and require confirmation before proceeding, or some other approach might be taken to avoid the user automatically granting the use of such facilities. |\n | `\"signature\"` | A permission that the system grants only if the requesting application is signed with the same certificate as the application that declared the permission. If the certificates match, the system automatically grants the permission without notifying the user or asking for the user's explicit approval. |\n | `\"knownSigner\"` | A permission that the system grants only if the requesting application is signed with [an allowed certificate](/guide/topics/permissions/defining#grant-signature-permissions). If the requester's certificate is listed, the system automatically grants the permission without notifying the user or asking for the user's explicit approval. |\n | `\"signatureOrSystem\"` | *Old synonym for `\"signature|privileged\"`. Deprecated in API level 23.* A permission that the system grants only to applications that are in a dedicated folder on the Android system image *or* that are signed with the same certificate as the application that declared the permission. Avoid using this option, as the `\"signature\"` protection level is sufficient for most needs and works regardless of where apps are installed. The `\"signatureOrSystem\"` permission is used for certain special situations where multiple vendors have applications built into a system image and need to share specific features explicitly because they are being built together. |\n\nintroduced in:\n: API level 1\n\nsee also:\n: [\u003cuses-permission\u003e](/guide/topics/manifest/uses-permission-element)\n\n [\u003cpermission-tree\u003e](/guide/topics/manifest/permission-tree-element)\n\n [\u003cpermission-group\u003e](/guide/topics/manifest/permission-group-element)"]]