自 2025 年 3 月 27 日起,我們建議您使用 android-latest-release
而非 aosp-main
建構及貢獻 AOSP。詳情請參閱「Android 開放原始碼計畫變更」。
限制螢幕閱讀
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
在 Android 9 以下版本中,螢幕緩衝區擷取權限 (READ_FRAME_BUFFER
、CAPTURE_VIDEO_OUTPUT
和 CAPTURE_SECURE_VIDEO_OUTPUT
) 會授予具有簽章或特權權限的應用程式。這項功能可啟用流暢的螢幕緩衝區擷取活動,例如擷取螢幕截圖或錄製裝置的螢幕內容。
從 Android 10 開始,為避免裝置螢幕內容遭到靜默存取,系統不會將視訊擷取權限授予特權應用程式。未經使用者同意的存取權會受到限制,且僅授予具備簽章權限的應用程式。這項規定會影響到執行特權應用程式,且仰賴這項靜默擷取功能的裝置製造商。
自 Android 10 起,如果您沒有列出的螢幕緩衝區擷取簽章權限,應用程式就無法在未經使用者同意的情況下擷取螢幕緩衝區。為確保您具備所需權限,請在資訊清單檔案中搜尋先前列出的簽署權限。將所有受影響的特殊權限應用程式 (在搜尋中找到) 遷移至 MediaProjectionManager 類別,這樣一來,任何第三方應用程式都能在獲得使用者同意的情況下,無須取得權限即可擷取螢幕緩衝區。這個流程會顯示對話方塊,在應用程式啟動螢幕截圖功能時,提示使用者允許螢幕截圖。在 Android 10 中,對話方塊的新功能包括:
- 透過「投放」圖示提供更明顯的關聯。
- 提供可存取資料的敏感度相關詳細資訊。
- 防止使用者在日後啟動時隱藏對話方塊:每次都會顯示對話方塊。
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-27 (世界標準時間)。
[[["容易理解","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 (世界標準時間)。"],[],[],null,["# Restricted screen reading\n\nIn Android 9 and lower, the screen buffer\ncapture permissions (`READ_FRAME_BUFFER`,\n`CAPTURE_VIDEO_OUTPUT`, and\n`CAPTURE_SECURE_VIDEO_OUTPUT`) were granted to apps that\nhad *either* signature or privileged permissions. This\nenabled seamless screen-buffer capturing activities, such as\ntaking screenshots, or recording a device's screen contents.\n\nStarting in Android 10, to prevent\nsilent access to a device's screen contents, video capture\npermissions aren't granted to privileged apps. Access\nwithout user consent is [restricted](https://developer.android.com/about/versions/11/privacy/permissions),\nand granted only to apps that have signature\npermissions. Device manufacturers that run privileged apps relying\non this silent capture functionality are affected by this\nrequirement.\n\nAs of Android 10 if you\ndon't have the listed screen-buffer capture signature permissions, your\napp can't capture screen buffers without user consent. To\nensure you have the permissions you need, search your manifest file\nfor the previously listed signature permissions. Migrate all affected privileged\napps (as found in your search) to the [MediaProjectionManager](https://developer.android.com/reference/android/media/projection/MediaProjectionManager)\nclass, which allows any third party app\nto capture screen buffers without permissions, but with user\nconsent. This flow displays a dialog that prompts the user to\nallow screen capturing when an app initiates it. In Android 10,\nnew features of the dialog include the following:\n\n- Provides more visible associations with the **Cast** icon.\n- Provides more information about the sensitivity of the data that can be accessed.\n- Prevents users from hiding the dialog on future initiations: the dialog shows every time."]]