ตั้งแต่วันที่ 27 มีนาคม 2025 เป็นต้นไป เราขอแนะนำให้ใช้ android-latest-release
แทน aosp-main
เพื่อสร้างและมีส่วนร่วมใน AOSP โปรดดูข้อมูลเพิ่มเติมที่หัวข้อการเปลี่ยนแปลงใน AOSP
สิทธิ์ของ Android
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
สิทธิ์ของ Android มีการควบคุมที่เพิ่มความตระหนักรู้ของผู้ใช้และจำกัดการเข้าถึงข้อมูลที่ละเอียดอ่อนของแอป การกำหนดค่าสิทธิ์ใน Android 8.0 และต่ำกว่าจะรวมรายการที่อนุญาตด้วย หากไม่มีรายการที่อนุญาต ระบบจะปิดใช้แอปที่มีสิทธิ์ แม้ว่าจะอยู่ในแทร็ก priv-app
ก็ตาม ใน Android 9 ขึ้นไป อุปกรณ์ที่พยายามใช้แอปที่ไม่ได้อยู่ในรายการที่อนุญาตอย่างถูกต้องจะไม่บูต
Android 10 ได้เปิดตัวแนวคิดบทบาท ซึ่งเป็นชื่อที่ไม่ซ้ำกันภายในระบบที่เชื่อมโยงกับข้อกำหนดและสิทธิ์บางอย่าง มอบหมายบทบาทให้กับแอปเพื่อให้สิทธิ์สำหรับวัตถุประสงค์หนึ่งๆ และกำหนดค่าบทบาทเริ่มต้นโดยใช้แหล่งข้อมูลการกำหนดค่าแพลตฟอร์ม
การป้องกันแอปที่อาจเป็นอันตราย (PHA) ที่เพิ่มขึ้นจะช่วยปรับปรุงสิ่งต่อไปนี้
- ความโปร่งใสเกี่ยวกับลักษณะการทำงานที่อาจเป็นอันตรายของแอป
- การควบคุมลักษณะการทํางานของแอปโดยผู้ใช้
- ดุลยพินิจของนักพัฒนาแอปเมื่อใช้ข้อมูลส่วนตัวที่ได้รับการคุ้มครองโดยสิทธิ์
การติดตั้งแพ็กเกจและสิทธิ์
ใน Android 9 และต่ำกว่า ฟังก์ชันการติดตั้งแพ็กเกจและการควบคุมสิทธิ์จะอยู่ในแพ็กเกจ PackageInstaller
(//packages/apps/PackageInstaller
) ใน Android 10 ขึ้นไป ฟังก์ชันการควบคุมสิทธิ์จะอยู่ในแพ็กเกจแยกต่างหาก ซึ่งก็คือ PermissionController
(//packages/apps/PermissionController
) รูปที่ 1 แสดงตำแหน่งของ 2 แพ็กเกจใน Android 10
รูปที่ 1 ฟังก์ชันการติดตั้งแพ็กเกจและการควบคุมสิทธิ์ใน Android 10
รายการที่อนุญาตและการเข้าถึง
ใน Android 6.0 ขึ้นไป แอปจะขอสิทธิ์ที่เป็นอันตรายในรันไทม์
Android 10 เพิ่มสิทธิ์รันไทม์ของการตรวจจับกิจกรรม (AR) ซึ่งจะแจ้งให้ผู้ใช้แก้ไขหรืออนุญาตสิทธิ์ที่เป็นอันตราย
Android 8.0 กําหนดให้คุณเพิ่มแอปที่มีสิทธิ์ในรายการที่อนุญาตอย่างชัดเจนในไฟล์ XML การกําหนดค่าระบบในไดเรกทอรี /etc/permissions
ใน Android 9 ขึ้นไป สิทธิ์ที่มีสิทธิ์ต้องอยู่ในรายการที่อนุญาต ไม่เช่นนั้นอุปกรณ์จะบูตไม่ได้
Android 7.0 ได้เปิดตัวเนมสเปซสำหรับไลบรารีแบบเนทีฟเพื่อจำกัดการแสดงผล API ภายในและป้องกันไม่ให้แอปเข้าถึงไลบรารีแพลตฟอร์มโดยไม่ตั้งใจ ซึ่งจะแยกไลบรารีของระบบออกจากไลบรารีของแอป และผู้ผลิตอุปกรณ์จะเพิ่มไลบรารีของตัวเองได้
ตั้งแต่ Android 10 เป็นต้นไป แอปต้องมีทั้งสิทธิ์ลายเซ็นและความยินยอมของผู้ใช้จึงจะ
เข้าถึงเนื้อหาบนหน้าจอของอุปกรณ์ได้ แอปที่มีสิทธิ์ซึ่งอาศัยฟังก์ชันการจับภาพแบบเงียบ เช่น การถ่ายภาพหน้าจอ ควรใช้คลาส MediaProjection แทน
Android 15 กำหนดให้คุณเพิ่มลงในรายการที่อนุญาตสิทธิ์ลายเซ็นแพลตฟอร์มที่แอปที่ไม่ใช่ระบบขอหรือที่การอัปเดตแอประบบขอใหม่อย่างชัดเจนในไฟล์ XML การกำหนดค่าระบบในไดเรกทอรี /etc/permissions
ความโปร่งใสและความเป็นส่วนตัว
ใน Android 6.0 ขึ้นไป ที่อยู่ MAC ของอุปกรณ์ที่มาจากโรงงานจะได้รับการปกป้องจากการเข้าถึงโดยผู้ให้บริการ Wi-Fi และเครื่องมือวิเคราะห์แพ็กเก็ต ข้อจำกัดเพิ่มเติมของ Android 10 จำกัดแอปไม่ให้เข้าถึงตัวระบุ (รหัส) ของอุปกรณ์ที่แก้ไขไม่ได้ เว้นแต่ว่าแอปจะอยู่ใน
รายการที่อนุญาตสำหรับสิทธิ์ที่มีสิทธิ์ (ส่วน
การเชื่อมต่อมีการพูดคุยเกี่ยวกับตัวระบุอุปกรณ์ที่เกี่ยวข้อง เนื่องจากข้อมูลนี้ส่งผลต่อผู้ให้บริการ)
ใน Android 9 และต่ำกว่า ผู้ใช้จะเลือกตัวเลือกแบบถาวรเมื่อให้สิทธิ์เข้าถึงตำแหน่งแก่แอป ตั้งแต่ Android 10 เป็นต้นไป ฟีเจอร์สิทธิ์เข้าถึงตำแหน่งแบบ 3 สถานะจะให้ตัวเลือกแก่ผู้ใช้ 3 ตัวเลือกในการอนุญาตให้แอปเข้าถึงตำแหน่งของอุปกรณ์ ข้อกําหนดด้านสิทธิ์เหล่านี้มีผลกับแอปใน Android 10 โดยไม่คํานึงถึง SDK เป้าหมาย
กำหนดค่าสิทธิ์สำหรับฟีเจอร์อื่นๆ ในด้านความโปร่งใสและความเป็นส่วนตัวตั้งแต่ Android 10 เป็นต้นไป
การกำหนดค่าที่มีประสิทธิภาพยิ่งขึ้น
การกำหนดค่าสิทธิ์ได้รับการปรับปรุงให้มีประสิทธิภาพมากขึ้นสำหรับ Android 6.0 ขึ้นไป
- ความสามารถของ Ambient สำหรับบริการที่เปิดตัวโดย
init
จะเก็บการกำหนดค่าบริการทุกแง่มุมไว้ในไฟล์ .rc
ไฟล์เดียว เมื่อตั้งค่าความสามารถสําหรับบริการที่ไม่ได้เปิดโดย init
ให้กําหนดค่าความสามารถของระบบไฟล์โดยใช้ fs_config.c
แทน
- Android 7.x และต่ำกว่าจะขยายกลไกรหัส Android (AID) โดยใช้ไฟล์
android_filesystem_config.h
สำหรับอุปกรณ์แต่ละเครื่องเพื่อระบุความสามารถของระบบไฟล์และ/หรือ AID ที่กำหนดเองของผู้ผลิตอุปกรณ์ Android 8.0 ขึ้นไปรองรับวิธีการใหม่ในการขยายความสามารถของระบบไฟล์
- ใน Android 8.0 การจัดการคำสั่ง USB ย้ายออกจากสคริปต์สำหรับอุปกรณ์โดยเฉพาะ
init
(แทนที่เลเยอร์ HAL) ไปยังเดมอน USB ดั้งเดิม ต้องใช้อินเทอร์เฟซ USB HAL ในอุปกรณ์ทุกเครื่องที่เปิดตัวใน Android 8.0 ขึ้นไป
ตัวอย่างเนื้อหาและโค้ดในหน้าเว็บนี้ขึ้นอยู่กับใบอนุญาตที่อธิบายไว้ในใบอนุญาตการใช้เนื้อหา Java และ OpenJDK เป็นเครื่องหมายการค้าหรือเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-27 UTC
[[["เข้าใจง่าย","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,["# Android permissions provide controls that increase user awareness and limit\nan app's access to sensitive data. Configuring permissions on Android 8.0 and\nlower includes allowlisting, without which privileged apps are disabled, even\nif they're in the `priv-app` path. On Android 9 and higher, a device\nthat tries to use apps that aren't properly allowlisted won't boot.\n\nAndroid 10 introduced the concept of a\n[role](https://developer.android.com/reference/android/app/role/RoleManager), a unique\nname within the system associated with\ncertain requirements and privileges. Assign roles to apps to grant them permissions for\na specific purpose, and configure default roles using platform config resources.\n\nThe increased protections against\n[Potentially\nHarmful Apps](https://developers.google.com/android/play-protect/potentially-harmful-applications) (PHAs) improve:\n\n- Transparency into potentially harmful app behavior.\n- User control over app behavior.\n- App developers' discretion when using private data, protected by permissions.\n\n### Package install and permission\n\nIn Android 9 and lower, the package install and permission control\nfunctionalities were contained in the `PackageInstaller` package\n(`//packages/apps/PackageInstaller`). In Android 10 and higher, the permission control functionality\nresides in a separate package, `PermissionController`\n(`//packages/apps/PermissionController`). [Figure 1](#package-install)\nillustrates where the two packages reside in Android 10.\n\n**Figure 1.** Package install and\npermission-control functionalities in Android 10\n\n### Allowlists and access\n\nIn Android 6.0 and higher, apps request access to dangerous permissions at\n[runtime](/docs/core/permissions/runtime_perms).\nAndroid 10 adds activity recognition (AR) runtime\npermissions, which prompt the user to modify or allow dangerous\npermissions.\n\nAndroid 8.0 required you to explicitly allowlist privileged apps in the\nsystem configuration XML files in the `/etc/permissions` directory.\nIn Android 9 and higher, privileged permissions must be\n[allowlisted](/docs/core/permissions/perms-allowlist)\nor the device can't boot.\n\nTo limit internal API visibility and prevent apps from accidentally\naccessing platform libraries, Android 7.0 introduced\n[Namespaces\nfor Native Libraries](/docs/core/permissions/namespaces_libraries). This separates system libraries from app\nlibraries, and device manufacturers can add their own native libraries.\n\nStarting in Android 10 apps must have both\nsignature permissions and user consent to [access a device's screen content](/docs/core/permissions/restricted-screen-reading). Privileged apps that rely on the silent\ncapture functionality, such as taking a screenshot, should use the\n[MediaProjection](https://developer.android.com/reference/android/media/projection/MediaProjection)\nclass instead.\n\nAndroid 15 requires you to explicitly\n[allowlist](/docs/core/permissions/signature-permission-allowlist)\nplatform signature permissions that are requested by nonsystem apps or newly requested by updates\nto system apps, in the system configuration XML files in the `/etc/permissions`\ndirectory.\n\n### Transparency and privacy\n\nIn Android 6.0 and higher, a device factory MAC address is protected from\naccess by Wi-Fi service providers and packet analyzers. Additional restrictions as\nof Android 10 limit apps from accessing the\n[immutable\ndevice identifiers (IDs)](/docs/core/permissions/immutable-device-ids) unless they're [allowlisted for privileged permissions](/docs/core/permissions/perms-allowlist). (The [**Connectivity**](/docs/core/connect) section provides a related discussion about\n[Device\nIdentifiers](/docs/core/connect/device-identifiers), as this impacts carriers.)\n\nOn Android 9 and lower, users make persistent choices when granting location\naccess to apps. Starting in Android 10, a\n[tristate\nlocation permissions](/docs/core/permissions/tristate-perms) feature gives users three options to allow app access\nto a device's location. These permission requirements are applied to apps in\nAndroid 10 regardless of target SDK.\n\nConfigure permissions for other transparency and privacy features starting\nin Android 10\n\n- The [background access location](/docs/core/permissions/background-location-access) reminder shows users when an app accesses their device location using [ACCESS_FINE_LOCATION](https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION) permission in the background.\n- Contacts-affinity related data, managed by the Contacts Provider component, is accessed differently: Apps can't write to or read from the [contact\n affinities](/docs/core/permissions/contacts-affinities) data in the database. This impacts [caller-related APIs](/docs/core/permissions/contacts-affinities#APIchanges).\n\n### Streamlined configurations\n\nPermissions configurations have been streamlined for Android 6.0 and\nhigher.\n\n- [Ambient\n capabilities](/docs/core/permissions/ambient) for services launched by `init` keeps all aspects of the service configuration in a single `.rc` file. When setting capabilities for services not launched by `init`, configure file system capabilities using `fs_config.c` instead.\n- Android 7.x and lower extend the Android IDs (AIDs) mechanism, using a device-specific `android_filesystem_config.h` file to specify filesystem capabilities and/or custom device-manufacturer AIDs. Android 8.0 and higher supports a [new method\n to extend filesystem capabilities](/docs/core/permissions/filesystem).\n- In Android 8.0, handling USB commands moved out of device-specific `init` scripts (a substitution for HAL layers) and into a native USB daemon. The [USB HAL](/docs/core/permissions/usb-hal) interface must be implemented on every device launching on Android 8.0 and higher."]]