ตั้งแต่วันที่ 27 มีนาคม 2025 เป็นต้นไป เราขอแนะนำให้ใช้ android-latest-release
แทน aosp-main
เพื่อสร้างและมีส่วนร่วมใน AOSP โปรดดูข้อมูลเพิ่มเติมที่หัวข้อการเปลี่ยนแปลงใน AOSP
ล็อกหน้าจอ
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
การใช้งานหน้าจอล็อกเริ่มต้นของ AOSP ที่มีความสามารถในการปลดล็อก (Keyguard) จะปรากฏบนจอแสดงผลหลักเท่านั้น ใน Android 9 (และต่ำกว่า) หน้าจอรองรองรับหน้าต่างที่ล็อกเดียวบนจอแสดงผลภายนอกเพียงจอเดียว ใน Android 10 หน้าจอล็อกจะขยายไปยังจอแสดงผลรองสาธารณะทั้งหมด หน้าจอล็อกจะยังคงเรียบง่ายและไม่รองรับการปลดล็อกจากหน้าจอรอง

รูปที่ 1 หน้าจอล็อกบนจอแสดงผลรอง
ผู้ผลิตอุปกรณ์สามารถใช้หน้าจอล็อกสำหรับจอแสดงผลรองได้ ตราบใดที่เป็นไปตามข้อกำหนดด้านความปลอดภัยขั้นพื้นฐาน เมื่ออุปกรณ์ล็อกอยู่ ข้อมูลควรถูกซ่อนอย่างปลอดภัยบนจอแสดงผลทั้งหมด ไม่มีนโยบายหรือการควบคุมในตัวเกี่ยวกับเนื้อหาที่ควรแสดงหรือซ่อนเมื่ออุปกรณ์ล็อกอยู่ ดังนั้น วิธีเดียวที่ปลอดภัยในการใช้การเข้าถึงที่จํากัดคือการซ่อนเนื้อหาทั้งหมดไว้เบื้องหลังหน้าจอล็อกและหน้าต่างที่ล็อก ข้อยกเว้นเพียงอย่างเดียวคือแอปที่เลือกให้แสดงที่ด้านบนของหน้าจอล็อกอย่างชัดเจนโดยใช้เมธอด R.attr.showWhenLocked
หรือ Activity.setShowWhenLocked()
มิเช่นนั้น อาจมีแนวโน้มสูงที่จะเกิดการรั่วไหลของข้อมูลจากจอแสดงผลสาธารณะและส่วนตัว
แม้ว่าจอแสดงผลจะอยู่ในสถานะต่างๆ ได้ (ON
/OFF
) แต่สถานะ "ล็อก" จะเป็นแบบรวมสำหรับจอแสดงผลทั้งหมด เช่นเดียวกับการติดตั้งใช้งานอุปกรณ์อื่นๆ ผู้ใช้ควรทราบได้อย่างชัดเจนเมื่ออุปกรณ์ล็อกอยู่ (หรือปลดล็อกอยู่) เช่น การกดปุ่มเปิด/ปิดมักจะล็อกอุปกรณ์เคลื่อนที่ ปุ่มเปิด/ปิดควรล็อกหน้าจอทั้งภายในและภายนอกด้วย
เนื่องจากหน้าต่างล็อกเป็นของ SystemUI จึงไม่แสดงในจอแสดงผลส่วนตัว เจ้าของจอแสดงผลส่วนตัวมีหน้าที่รับผิดชอบในการซ่อนหน้าต่างและปกป้องเนื้อหาเมื่ออุปกรณ์ล็อกอยู่ การใช้งานระบบเริ่มต้นเท่านั้นที่จะซ่อนกิจกรรมในจอแสดงผลส่วนตัวโดยการเปลี่ยนระดับการเข้าถึง
การใช้งาน
หน้าต่างการล็อกบนจอแสดงผลรองจะใช้เป็นหน้าต่างการนำเสนอใน KeyguardDisplayManager
Android 10 เปลี่ยน KeyguardDisplayManager#mPresentations
เป็นอาร์เรย์ที่เก็บหน้าต่างล็อกทั้งหมดสำหรับหน้าจอรองทั้งหมด KeyguardDisplayManager
ยังมีโปรแกรมรับฟังการเปลี่ยนแปลงการแสดงผลเพื่อตอบสนองต่อการเปลี่ยนแปลงของจอแสดงผลที่ใช้ได้และรักษาความปลอดภัยให้กับหน้าจอทั้งหมด คุณควรล็อกจอแสดงผลที่เชื่อมต่อทั้งหมดทันทีในทุกๆ ครั้งเพื่อให้ผู้โจมตีไม่สามารถดึงข้อมูลผู้ใช้ได้ แม้ว่าจะมีสิทธิ์เข้าถึงอุปกรณ์ก็ตาม
หน้าต่างการล็อกจะแสดงบนจอแสดงผลรองสาธารณะทั้งหมด (ดูKeyguardDisplayManager#isKeyguardShowable()
) เจ้าของจอแสดงผลส่วนตัวมีหน้าที่รับผิดชอบในการรักษาความปลอดภัยของเนื้อหาเมื่ออุปกรณ์ล็อกอยู่
ตัวอย่างเนื้อหาและโค้ดในหน้าเว็บนี้ขึ้นอยู่กับใบอนุญาตที่อธิบายไว้ในใบอนุญาตการใช้เนื้อหา 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,["# Lock screen\n\nAOSP's default implementation of the Lock screen with affordances to unlock\nit (keyguard) appears only on the primary display. In Android 9 (and lower),\nsecondary screens supported a single *locking window* on a single external\ndisplay. In Android 10, the Lock screen is expanded to all public secondary\ndisplays. The Lock screen remains simple and doesn't support unlocking from secondary\nscreens.\n\n**Figure 1.** Lock screen on secondary display\n\nDevice manufacturers can implement their Lock screen for secondary displays,\nprovided the fundamental security requirement is fulfilled. When the device is\nlocked, information should be securely concealed on all displays. There's no\nbuilt-in policy or control over what content should be shown or hidden when device\nis locked. Therefore, the only secure way of implementing restricted access is to\nhide all content behind the Lock screen and locking windows. The only exceptions\nare apps that have explicitly opted in to be displayed on top of the Lock screen\nusing the\n[R.attr.showWhenLocked](https://developer.android.com/reference/android/R.attr.html#showWhenLocked) or\n[Activity.setShowWhenLocked()](https://developer.android.com/reference/android/app/Activity.html#setShowWhenLocked(boolean)) methods.\nOtherwise, there is strong potential to leak information from public and private\ndisplays.\n\nWhile displays can be placed in to different states (`ON`/`OFF`),\nthe locked state is global for all displays. As with any device implementation, it should\nbe obvious to a user when a device is locked (or unlocked). For example, pressing\na power button typically locks a mobile device. A power button should also lock all\ninternal and external screens.\n\nBecause the locking window is owned by SystemUI, it won't be placed on\nprivate displays. Owners of the private displays are responsible for hiding\nthe windows and protecting content when a device is locked. The default system\nimplementation *only* hides activities on private displays by changing\nvisibility.\n\nImplementation\n--------------\n\nThe locking window on secondary displays is implemented as a [Presentation](https://developer.android.com/reference/android/app/Presentation)\nwindow in `KeyguardDisplayManager`. Android 10 changed\n`KeyguardDisplayManager#mPresentations` to an array that holds all\nlocking windows for all secondary screens. `KeyguardDisplayManager` also\nhas a display-change listener to respond to changes to the available displays and\nsecure all screens. It's important to immediately lock all connected displays at\nany given time so that attackers can't extract user data even with physical access\nto the device.\n\nThe locking window is displayed on all public secondary displays (see\n`KeyguardDisplayManager#isKeyguardShowable()`). Owners of private\ndisplays are responsible for securing the content when a device is\nlocked."]]