ตั้งแต่วันที่ 27 มีนาคม 2025 เป็นต้นไป เราขอแนะนำให้ใช้ android-latest-release
แทน aosp-main
เพื่อสร้างและมีส่วนร่วมใน AOSP โปรดดูข้อมูลเพิ่มเติมที่หัวข้อการเปลี่ยนแปลงใน AOSP
การเลิกใช้งาน SDCardFS
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ระบบเลิกใช้งาน SDCardFS ในอุปกรณ์ที่เปิดตัวด้วย Android 11 ขึ้นไปและใช้เคอร์เนลเวอร์ชัน 5.4 ขึ้นไป ในอุปกรณ์ดังกล่าว การทดสอบ VTS ไม่อนุญาตให้ระบบไฟล์ที่ติดตั้งแสดงเป็น SDCardFS อุปกรณ์ที่เปิดตัวด้วย Android 11 ขึ้นไปแต่ใช้เคอร์เนลเวอร์ชัน 4.19 หรือต่ำกว่าจะใช้ SDCardFS ต่อได้ แต่ Google จะไม่ให้การสนับสนุนเพิ่มเติม
ก่อนที่จะเลิกใช้งาน SDCardFS มีวิธีควบคุมการเข้าถึงที่จัดเก็บข้อมูลภายในที่จำลองและการ์ด SD ภายนอก ซึ่งช่วยให้แอปเข้าถึงเฉพาะข้อมูลที่เกี่ยวข้องได้ นอกจากนี้ ยังมีการไม่คำนึงถึงตัวพิมพ์เล็กและตัวพิมพ์ใหญ่อีกชั้น รวมถึงการติดตามพื้นที่เก็บข้อมูลเพิ่มเติม
ฟังก์ชันการแทนที่ SDCardFS
ฟีเจอร์ที่แทนที่ SDCardFS ใช้ฟีเจอร์ระบบไฟล์เคอร์เนล Linux หลายรายการเพื่อให้ได้ผลลัพธ์ที่คล้ายกัน ระบบไฟล์จะจัดการการไม่คำนึงถึงตัวพิมพ์เล็กและตัวพิมพ์ใหญ่โดยตรง ซึ่งส่งผลให้เวลาในการค้นหาในโฟลเดอร์ที่คำนึงถึงตัวพิมพ์เล็กและตัวพิมพ์ใหญ่เกือบจะเหมือนกัน จึงช่วยลดการชะลอการทำงานของโฟลเดอร์ขนาดใหญ่จาก SDCardFS ตอนนี้การติดตามโควต้าที่ SDCardFS ดำเนินการเพื่อรวบรวมข้อมูลพื้นที่เก็บข้อมูลสำหรับการตั้งค่าอย่างรวดเร็วได้รับการกำหนดค่าจากพื้นที่ผู้ใช้โดยใช้โควต้าโปรเจ็กต์แล้ว ในบริบทที่ละเอียดอ่อนด้านประสิทธิภาพบางบริบท ระบบจะทำการแมปไดเรกทอรี การใช้งาน FUSE ใหม่จะให้พื้นที่เก็บข้อมูลที่มีขอบเขตสําหรับการเข้าถึงระบบไฟล์โดยตรง โดยหลักๆ แล้วเพื่อรองรับการปกปิดข้อมูลตําแหน่ง
กำหนดค่าฟังก์ชันการเปลี่ยนการ์ด SD
หากต้องการเปิดใช้โควต้าโปรเจ็กต์และการแปลงอักขระเป็นตัวพิมพ์เล็กสำหรับพื้นที่เก็บข้อมูลจำลองโดยไม่มี SDCardFS ในอุปกรณ์ที่เปิดตัวด้วย Android 11 ขึ้นไป ให้รับค่าจาก emulated_storage.mk
ในไฟล์ device.mk
ดังนี้
$(call inherit-product, $(SRC_TARGET_DIR)/product/emulated_storage.mk)
คำเตือน: อย่าทำเช่นนี้ในอุปกรณ์ที่เปิดตัวด้วย Android 10 หรือต่ำกว่า เนื่องจากระบบไฟล์ที่มาพร้อมเครื่องไม่คำนึงถึงตัวพิมพ์เล็กและตัวพิมพ์ใหญ่เข้ากันไม่ได้กับการตั้งค่าการเข้ารหัสตามไฟล์ที่ใช้ในอุปกรณ์ดังกล่าว คุณจึงต้องใช้ SDCardFS ในอุปกรณ์ดังกล่าวต่อไป
เหตุผลที่ควรเลิกใช้งาน SDCardFS
มีหลายสาเหตุที่ควรเลิกใช้งาน SDCardFS
ความเสถียร
SDCardFS มีปัญหาหลายประการเกี่ยวกับเงื่อนไขการแข่งขันที่เกี่ยวข้องกับการคำนึงถึงตัวพิมพ์เล็กและตัวพิมพ์ใหญ่ รวมถึงปัญหาบางอย่างเกี่ยวกับสถานการณ์หน่วยความจำต่ำ การค้นหาแบบไม่คำนึงถึงตัวพิมพ์เล็กและตัวพิมพ์ใหญ่อาจทำงานช้าในไดเรกทอรีขนาดใหญ่ เนื่องจากต้องเรียกใช้ไดเรกทอรีย่อยเพื่อค้นหารูปแบบอื่นๆ การเข้าถึงระบบไฟล์ระดับบนและระดับล่างพร้อมกันอาจทำให้เกิดปัญหาได้เช่นกัน
ความเท่าเทียมของข้อมูลในระบบ
SDCardFS ต้องใช้แพตช์เพิ่มเติมใน VFS เพื่อรองรับตัวเลือกการเปลี่ยนแปลงใน การต่อเชื่อมการเชื่อมโยง การแก้ไขเหล่านี้ทำให้ต้องทํางานเพิ่มเติมเพื่อยอมรับการเปลี่ยนแปลงจาก upstream ในพื้นที่เหล่านี้ คอมโพเนนต์ต้นทางสามารถจำลองฟีเจอร์ของ SDCardFS ได้ ซึ่งจะช่วยขจัดปัญหานี้
ความเท่าเทียมของฟีเจอร์กับ API
ใน Android เวอร์ชันก่อนหน้า พื้นที่เก็บข้อมูลแบบจำกัดได้จำกัดการเข้าถึงข้อมูลเมตาบางประเภท การเข้าถึงพื้นที่เก็บข้อมูลโดยตรงผ่าน SDCardFS ไม่รองรับฟีเจอร์พื้นที่เก็บข้อมูลที่มีขอบเขตเหล่านี้
ตัวอย่างเนื้อหาและโค้ดในหน้าเว็บนี้ขึ้นอยู่กับใบอนุญาตที่อธิบายไว้ในใบอนุญาตการใช้เนื้อหา 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,["# SDCardFS deprecation\n\nSDCardFS is deprecated on devices that launch with Android 11 or higher and run kernel version 5.4 or higher. On such\ndevices, [VTS\ntesting](https://android.googlesource.com/platform/test/vts-testcase/kernel/+/refs/heads/android11-dev/sdcardfs/)\ndoesn't allow mounted file systems listed as SDCardFS. Devices that launch with\nAndroid 11 or higher but run kernel version 4.19 or\nlower can continue to use SDCardFS, but Google doesn't provide additional\nsupport.\n\nBefore its deprecation, SDCardFS provided a way to control access to emulated\ninternal storage and external SD cards, allowing apps to access only the data\nrelevant to them. Additionally, it provided a layer of case insensitivity, as\nwell as some additional storage tracking.\n\nSDCardFS replacement functionality\n----------------------------------\n\nThe replacement for SDCardFS uses several Linux kernel filesystem features to\nachieve similar results. Case insensitivity is handled directly by the\nfilesystem; this results in lookup times nearly identical in case-sensitive and\ncase-insensitive folders, removing the large folder slowdown from SDCardFS. The\nquota tracking that SDCardFS was doing to quickly gather storage data for\nsettings is now configured from userspace using project quotas. In some\nperformance-sensitive contexts, directories are bind mounted in place. A new\nFUSE implementation provides scoped storage for direct filesystem access,\nprimarily to support redaction of location information.\n\nConfigure SDCard replacement functionality\n------------------------------------------\n\nTo enable project quotas and case folding for emulated storage without SDCardFS\non a device that launched with Android 11 or higher,\ninherit from `emulated_storage.mk` in the `device.mk` file: \n\n $(call inherit-product, $(SRC_TARGET_DIR)/product/emulated_storage.mk)\n\n**Warning:** Do *not* do this on devices\nthat launched with Android 10 or lower, since\nfilesystem native case-insensitivity is incompatible with the file-based\nencryption settings used on such devices. It is necessary to keep using SDCardFS\non such devices.\n\nReasons to deprecate SDCardFS\n-----------------------------\n\nThere are various reasons to deprecate SDCardFS.\n\n### Stability\n\nSDCardFS suffers from several race conditions concerning case sensitivity, as\nwell as some issues concerning low memory circumstances. Case-insensitive\nlookups can be rather slow in large directories because lookups have to walk the\nlower directory to find alternate cases. Accessing the upper and lower\nfilesystems at the same time can lead to issues as well.\n\n### Upstream parity\n\nSDCardFS requires additional patches to the VFS to support changing options on\nbind mounts. These patches cause additional work to accept upstream changes to\nthese areas. SDCardFS's features can be replicated by upstream components,\nremoving this pain point.\n\n### Feature parity with API\n\nIn the previous release of Android, scoped storage limited access to particular\ntypes of metadata. Direct storage access through SDCardFS doesn't support these\nscoped storage features."]]