[[["เข้าใจง่าย","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 UTC"],[],[],null,["# PermissionController\n\nThe PermissionController Mainline module contains privacy policies and the\nUI related to granting and managing permissions (for example, the policies and\nUI for granting and managing permissions).\n\nAbout PermissionController\n--------------------------\n\nThe PermissionController module handles permission-related UI, logic, and roles\nto allow access for apps for specific purpose. It controls the following:\n\n- Runtime permission granting (including granting to system apps)\n- Runtime permission management (including grouping of permissions)\n- Runtime permission usage tracking\n- Roles\n\nStarting in Android 12, the framework and system server\nclasses for [`Role`](https://developer.android.com/reference/kotlin/androidx/compose/ui/semantics/Role)\nare moved into the module to make `Role` completely modular.\n\nIn Android 10, the Package Installer app\nis split into sections to enable the permissions logic to be updated. As an\nupdatable Mainline module, PermissionController:\n\n- Interacts with the framework only via stable @SystemApi (no @hide API usage).\n- Handles permission-related intents with priority \\\u003e 0.\n- Exposes a mechanism for enabling OEMs to customize theming.\n- Provides services to which the system and applications can bind, including role management, permission revocation, and basic permission information (for Settings).\n- Supports auto-revoke for unused apps (new in Android 11).\n\nIn Android9, permission control is part of\n`com.android.packageinstaller`.\n\nAuto-revoke for unused apps\n---------------------------\n\nIn Android 11, the PermissionsController module can\nautomatically revoke runtime permissions for apps that haven't been used for an\nextended period of time. Apps targeting SDK 30 or higher have auto-revoke\n**enabled** by default, while apps targeting SDK 29 or lower have auto-revoke\n**disabled** by default. When enabled, auto-revoke affects all runtime\npermissions but exempts all pre-granted permissions, including policy- and\nsystem-fixed permissions and permissions granted by default or by role. For\ndetails, refer to [Auto-reset permissions from unused\napps](https://developer.android.com/about/versions/11/privacy/permissions#auto-reset).\n\nPackage format\n--------------\n\nThe format of the PermissionController module differs between releases.\n\n- In Android 11 or higher, the PermissionController module is in\n [APEX](/docs/core/ota/apex) format\n and is updatable. The package name is `com.google.android.permission`.\n\n- In Android 10, the PermissionController module is in APK format and isn't\n updatable. The package name is `com.google.android.permissioncontroller`.\n\nModule boundary\n---------------\n\nIn Android 12, the Permission\nmodule code is moved from `packages/apps/PermissionController`\n(the `platform/packages/apps/PackageInstaller` project) and\n`frameworks/base/apex/permission` (this is a subdirectory of the\n`frameworks/base` project).\n\nThe new project structure for `packages/modules/Permission` is as follows:\n\n- Files from `frameworks/base/apex/permission`\n- PermissionController files from `packages/apps/PermissionController`\n\nOEMs can use the sample commands to help move their patches\nfrom the original project directories to the new project directory.\n| **Note:** These commands are just a reference. OEMs can use different ways to move the patch.\n\n### Move a patch from frameworks/base/apex/permission\n\n root/frameworks/base/$ git format-patch -1 --relative=apex/permission \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-nx\"\u003ecommit\u003c/span\u003e\u003c/var\u003e --stdout \u003e \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-nx\"\u003epatch\u003c/span\u003e\u003cspan class=\"devsite-syntax-o\"\u003e-\u003c/span\u003e\u003cspan class=\"devsite-syntax-nx\"\u003efile\u003c/span\u003e\u003cspan class=\"devsite-syntax-p\"\u003e.\u003c/span\u003e\u003cspan class=\"devsite-syntax-nx\"\u003etxt\u003c/span\u003e\u003c/var\u003e\n\n root/packages/modules/Permission$ git am -p2 \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-nx\"\u003epatch\u003c/span\u003e\u003cspan class=\"devsite-syntax-o\"\u003e-\u003c/span\u003e\u003cspan class=\"devsite-syntax-nx\"\u003efile\u003c/span\u003e\u003cspan class=\"devsite-syntax-p\"\u003e.\u003c/span\u003e\u003cspan class=\"devsite-syntax-nx\"\u003etxt\u003c/span\u003e\u003c/var\u003e\n\n### Move a patch from packages/apps/PermissionController\n\n root/packages/apps/PermissionController$ git format-patch -1 \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-nx\"\u003ecommit\u003c/span\u003e\u003c/var\u003e --stdout \u003e \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-nx\"\u003epatch\u003c/span\u003e\u003cspan class=\"devsite-syntax-o\"\u003e-\u003c/span\u003e\u003cspan class=\"devsite-syntax-nx\"\u003efile\u003c/span\u003e\u003cspan class=\"devsite-syntax-p\"\u003e.\u003c/span\u003e\u003cspan class=\"devsite-syntax-nx\"\u003etxt\u003c/span\u003e\u003c/var\u003e\n\n root/packages/modules/Permission$ git am -p2 --directory=PermissionController \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-nx\"\u003epatch\u003c/span\u003e\u003cspan class=\"devsite-syntax-o\"\u003e-\u003c/span\u003e\u003cspan class=\"devsite-syntax-nx\"\u003efile\u003c/span\u003e\u003cspan class=\"devsite-syntax-p\"\u003e.\u003c/span\u003e\u003cspan class=\"devsite-syntax-nx\"\u003etxt\u003c/span\u003e\u003c/var\u003e\n\nCustomization\n-------------\n\nOEMs can customize the permissions UI theme (colors, margins, fonts, and\ndrawables) using [runtime resource overlays\n(RROS)](/docs/core/architecture/rros)."]]