ตั้งแต่วันที่ 27 มีนาคม 2025 เป็นต้นไป เราขอแนะนำให้ใช้ android-latest-release
แทน aosp-main
เพื่อสร้างและมีส่วนร่วมใน AOSP โปรดดูข้อมูลเพิ่มเติมที่หัวข้อการเปลี่ยนแปลงใน AOSP
การเพิ่มประสิทธิภาพของ Android
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ทำตามวิธีการในส่วนนี้เพื่อให้อุปกรณ์ Android ใช้ทรัพยากรน้อยที่สุดและเพิ่มประสิทธิภาพให้สูงสุด และใช้ประโยชน์จากการทดสอบและเครื่องมือมากมายที่อธิบายไว้ในการประเมินประสิทธิภาพเพื่อใช้ Android ให้เกิดประโยชน์สูงสุด
การแคช APK
เอกสารนี้อธิบายการออกแบบโซลูชันการแคช APK เพื่อการติดตั้งแอปที่โหลดไว้ล่วงหน้าอย่างรวดเร็วในอุปกรณ์ที่รองรับพาร์ติชัน A/B OEM สามารถวางแอปที่โหลดล่วงหน้าและแอปยอดนิยมไว้ในแคช APK ที่เก็บไว้ในพาร์ติชัน B ซึ่งส่วนใหญ่ว่างเปล่าในอุปกรณ์ใหม่ที่แบ่งพาร์ติชัน A/B โดยไม่ส่งผลกระทบต่อพื้นที่เก็บข้อมูลสำหรับผู้ใช้
เวลาในการบูต
Android 8.0 ช่วยให้ระบบบูตได้เร็วขึ้นด้วยการรองรับการปรับปรุงหลายอย่างในคอมโพเนนต์ต่างๆ เอกสารนี้ให้คำแนะนำแก่พาร์ทเนอร์เกี่ยวกับการปรับปรุงเวลาในการบูตสำหรับอุปกรณ์ Android บางรุ่น
สุขภาพ
Android 9 มี android.hardware.health
HAL 2.0 ซึ่งเป็นการอัปเกรดเวอร์ชันที่สำคัญจาก HAL ของ health@1.0 HAL ใหม่นี้มีการแยกเฟรมเวิร์กออกจากโค้ดของเวนเดอร์อย่างชัดเจนยิ่งขึ้น ช่วยให้เวนเดอร์ปรับแต่งรายงานข้อมูลด้านสุขภาพได้อย่างอิสระมากขึ้น และแสดงข้อมูลด้านสุขภาพของอุปกรณ์ได้มากกว่าแค่แบตเตอรี่
lowmemorykiller
กระบวนการ lmkd
ใน Userspace ใช้ฟังก์ชันการทำงานเดียวกัน แต่มีกลไกเคอร์เนลที่มีอยู่แล้วเพื่อตรวจหาและประมาณการใช้หน่วยความจำ โดยจะใช้เหตุการณ์ vmpressure ที่เคอร์เนลสร้างขึ้นเพื่อรับการแจ้งเตือนเกี่ยวกับระดับการกดดันของหน่วยความจำ
การเพิ่มประสิทธิภาพโดยอิงตามโปรไฟล์
ระบบบิลด์ Android รองรับการใช้การเพิ่มประสิทธิภาพที่แนะนำโดยโปรไฟล์ (PGO) ของ Clang ในโมดูล Android เนทีฟที่มีกฎการสร้างบิลด์เพลน
ภาพรวมงาน
ภาพรวมงานเป็นโครงสร้างพื้นฐานที่เปิดตัวใน Android O ซึ่งรวมภาพหน้าจอสำหรับภาพขนาดย่อล่าสุดและพื้นผิวที่บันทึกไว้จาก WindowManager ภาพขนาดย่อล่าสุดแสดงสถานะล่าสุดของงานในมุมมอง "ล่าสุด"
การบันทึกการเขียนล่วงหน้า
Android 9 เปิดตัวโหมดพิเศษของ SQLiteDatabase ที่เรียกว่า WAL ที่เข้ากันได้ (การบันทึกล่วงหน้า) ซึ่งช่วยให้ฐานข้อมูลใช้ journal_mode=WAL
ได้ในขณะที่ยังคงรักษาลักษณะการทำงานในการรักษาการเชื่อมต่อสูงสุด 1 รายการต่อฐานข้อมูล
ตัวอย่างเนื้อหาและโค้ดในหน้าเว็บนี้ขึ้นอยู่กับใบอนุญาตที่อธิบายไว้ในใบอนุญาตการใช้เนื้อหา 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 performance optimization\n\nFollow the instructions in this section to ensure your Android devices\nminimize resource use and optimize performance. And take advantage of the many\ntests and tools described in\n[Evaluating Performance](/docs/core/tests/debug/eval_perf) as part of\nyour work getting the most out of Android.\n\nAPK caching\n-----------\n\nThis document describes design of an APK caching solution for rapid installation\nof preloaded apps on a device that supports A/B partitions. OEMs can place\npreloads and popular apps in the APK cache stored in the mostly empty B\npartition on new A/B-partitioned devices without impacting any user-facing data\nspace.\n\nBoot times\n----------\n\nAndroid 8.0 allows for reduced boot times by supporting several improvements\nacross a range of components. This document provides partner guidance for\nimproving boot times for specific Android devices.\n\nHealth\n------\n\nAndroid 9 includes `android.hardware.health` HAL 2.0, a major version upgrade\nfrom health@1.0 HAL. This new HAL offers cleaner separation between framework\nand vendor code, greater degrees of freedom for vendor customization in health\ninformation reports, and more device health information than just battery.\n\nlowmemorykiller\n---------------\n\nThe userspace `lmkd` process implements the same functionality but with already\nexisting kernel mechanisms to detect and estimate memory pressure. It uses\nvmpressure events generated by the kernel to get notifications about memory\npressure levels.\n\nProfile-guided optimization\n---------------------------\n\nThe Android build system supports using Clang's profile-guided optimization\n(PGO) on native Android modules that have blueprint build rules.\n\nTask Snapshots\n--------------\n\nTask Snapshots is infrastructure introduced in Android O that combines\nscreenshots for Recents Thumbnails as well as Saved Surfaces from Window\nManager. Recents Thumbnails represent the last state of a task in the Recents\nview.\n\nWrite-ahead logging\n-------------------\n\nAndroid 9 introduces a special mode of SQLiteDatabase called Compatibility WAL\n(write-ahead logging) that allows a database to use `journal_mode=WAL` while\npreserving the behavior of keeping a maximum of one connection per database."]]