自 2025 年 3 月 27 日起,我們建議您使用 android-latest-release
而非 aosp-main
建構及貢獻 AOSP。詳情請參閱「Android 開放原始碼計畫變更」。
OnDevicePersonalization
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
Android 13 推出的 OnDevicePersonalization 模組提供一組以使用者隱私為核心原則的建構元素,可支援開發可為使用者提供個人化體驗的 APK。提供的構件範例包括政策引擎,可保護使用者資料的輸入、輸出和許可清單作業。使用者控制項可表達為由這項政策引擎強制執行的政策。另一個提供的構成要素範例包括各種聯合運算,例如聯合學習和聯合數據分析,可協同訓練機器學習模型,並分析本機原始資料,無須集中收集資料。
OnDevicePersonalization 會嘗試打造開發人員體驗,消除資料收集、同意聲明、控制和法規遵循等方面的瓶頸。這可讓原始設備製造商和應用程式開發人員專注於應用程式中新穎且具有意義的部分,並充分利用裝置上提供的超豐富即時資料。
動機
OnDevicePersonalization 模組的目標是開發新技術,讓原始設備製造商和應用程式開發人員能繼續為終端使用者提供優質的個人化體驗,同時保護使用者資訊的隱私。
模組邊界
這是沒有模組邊界的全新程式碼。
代碼位置:packages/modules/OnDevicePersonalization
圖 1 顯示 OnDevicePersonalization 模組 API 設計。
圖 1. OnDevicePersonalization 模組 API 設計
這個套件的大部分功能都會在 APEX com.google.android.ondevicepersonalization
中提供。
OnDevicePersonalization API 功能將在 APK com.google.android.ondevicepersonalization
中提供。
在 APK com.google.android.federatedcompute
中提供 FederatedCompute API 功能。
依附元件
- 變更 PackageManager 以解讀新的資訊清單標記
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。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,["# OnDevicePersonalization\n\nThe OnDevicePersonalization module, introduced in Android 13,\nprovides a set of building blocks developed with user privacy as their core\ntenet, to support development of APKs that offer a personalized experience for\ntheir users. Examples of the building blocks provided include a policy engine\nto guard the ingress, egress, and allow-listed operations of user data. User\ncontrols can be expressed as policies that are enforced by this policy engine.\nAnother example of the building blocks provided includes various federated\ncomputations, such as\n[federated learning](https://ai.googleblog.com/2017/04/federated-learning-collaborative.html)\nand [federated analytics](https://ai.googleblog.com/2020/05/federated-analytics-collaborative-data.html),\nthat enable collaborative training of machine learning models and analysis of\nlocal raw data without central data collection.\n\nOnDevicePersonalization attempts to create a developer experience that removes\nbottlenecks that arose from data collection, consent, control and compliance.\nThis allows OEMs and app developers to focus on the novel and semantically\ninteresting parts of their applications and take advantage of the super-rich and\nreal-time data that's available only on the devices.\n\nMotivation\n----------\n\nThe goal of the OnDevicePersonalization module is to build new technology to\nenable OEMs and app developers to continue to offer a quality personalization\nexperience to their end users while keeping user information private.\n\nModule boundary\n---------------\n\nThis is all new code with no module boundary.\n\nCode Location: `packages/modules/OnDevicePersonalization`\n\nFigure 1 shows the OnDevicePersonalization module API design.\n\n**Figure 1.** OnDevicePersonalization module API design\n\nPackage format\n--------------\n\nMain functionality for the package will be available in APEX\n`com.google.android.ondevicepersonalization`.\n\nOnDevicePersonalization API functionality will be available in APK\n`com.google.android.ondevicepersonalization`.\n\nFederatedCompute APIs functionality will be available in APK\n`com.google.android.federatedcompute`.\n\nDependencies\n------------\n\n- Changes in PackageManager to interpret the new manifest tag"]]