ตั้งแต่วันที่ 27 มีนาคม 2025 เป็นต้นไป เราขอแนะนำให้ใช้ android-latest-release
แทน aosp-main
เพื่อสร้างและมีส่วนร่วมใน AOSP โปรดดูข้อมูลเพิ่มเติมที่หัวข้อการเปลี่ยนแปลงใน AOSP
สภาพแวดล้อมการทดสอบและการพัฒนา
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
วิธีที่เร็วและง่ายที่สุดในการทดสอบจอแสดงผลรองคือการใช้จอแสดงผลจำลองซึ่งระบบเป็นเจ้าของ เนื่องจากมีการแชร์ system_server
UID จึงเชื่อถือได้และได้รับอนุญาตให้โฮสต์หน้าต่างและกิจกรรมการตกแต่งทั้งหมด
หากมีอุปกรณ์ที่รองรับการเชื่อมต่อฮาร์ดแวร์ (เช่น HDMI หรือ DisplayPort ผ่าน USB-C) คุณสามารถใช้จอแสดงผลฮาร์ดแวร์ภายนอกเพื่อทดสอบได้
โดยค่าเริ่มต้น ระบบจะถือว่าจอแสดงผลเสมือนที่ไม่ได้เป็นเจ้าของโดย UID ของระบบไม่น่าเชื่อถือ และจะมีการใช้ข้อจํากัดบางอย่างเพื่อป้องกันการรั่วไหลของข้อมูลผู้ใช้
ใช้โหมดเดสก์ท็อปเพื่อทดสอบฟีเจอร์และความสามารถใหม่ของหน้าต่างที่เพิ่มลงในแพลตฟอร์มใน Android 10 ตัวเลือกนี้มีไว้สำหรับนักพัฒนาแอปโดยเฉพาะ ซึ่งจะช่วยให้นักพัฒนาแอปทดสอบแอปในสภาพแวดล้อมโหมดหลายหน้าจอและโหมดหน้าต่างรูปแบบอิสระได้


รูปที่ 1 โหมดเดสก์ท็อปบนจอแสดงผล 2 จอ โดยที่ 1 จอเป็นจอจำลอง (ด้านบน) และอีก 1 จอเป็นจอภายนอก (ด้านล่าง)
เมื่อผู้ผลิตอุปกรณ์ต้องการมอบประสบการณ์การใช้งานที่เหมือนเดสก์ท็อป ให้ใช้ฟีเจอร์นี้เพื่อแสดงวิธีแนะนำในการใช้ฟีเจอร์การแบ่งหน้าจอบางรายการ
- เปิดใช้ตัวเลือกสำหรับนักพัฒนาแอปบังคับใช้โหมดเดสก์ท็อป
- รีบูตโทรศัพท์
- เชื่อมต่อเมาส์ (ผ่าน USB หรือบลูทูธ)
- สร้างจอแสดงผลจำลองจากตัวเลือกสำหรับนักพัฒนาแอปหรือใช้จอแสดงผลฮาร์ดแวร์
- เปิดกิจกรรมจากตัวเปิดแอปในจอแสดงผลนั้นและใช้เมาส์เพื่อโต้ตอบ
MD Launcher (platform/development/samples/MultiDisplay
) มีประโยชน์ต่อการทดสอบการเปิดใช้งานกิจกรรมที่กำหนดเป้าหมายและขออินสแตนซ์ใหม่
ตัวอย่างเนื้อหาและโค้ดในหน้าเว็บนี้ขึ้นอยู่กับใบอนุญาตที่อธิบายไว้ในใบอนุญาตการใช้เนื้อหา 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,["# Testing and development environment\n\nThe fastest and easiest way to test secondary displays is to use a simulated\ndisplay, which is owned by the system. Because it shares the `system_server`\nUID, it's trusted and allowed to host all decor windows and activities.\n\nIf you have a device that supports a hardware connection (for example, HDMI\nor DisplayPort over USB-C), you can use external hardware displays to test.\n\nBy default, virtual displays that aren't owned by the system UID are considered\nto be *not trusted* and a number of restrictions are applied to prevent the\nleaking of user data.\n\nUse desktop mode to test new windowing features and capabilities added to\nthe platform in Android 10. It's a developer option\ntargeted for app developers and enables developers to test apps in\nmulti-display and freeform windowing mode environments.\n\n**Figure 1.** Desktop mode on two displays, simulated (top) and\nexternal (bottom)\n\nWhen device manufacturers want to provide a desktop-like experience, use this\nfeature to showcase the recommended way to implement some of the windowing features.\n\n1. Enable the **Force desktop mode** developer option.\n2. Reboot the phone.\n3. Connect the mouse (via USB or Bluetooth).\n4. Create a simulated display from the developer options or use a hardware display.\n5. Launch activities from the launcher on that display and use the mouse to interact.\n\nMD Launcher (`platform/development/samples/MultiDisplay`) is useful\nfor testing a targeted activity launch and to request a new instance."]]