利用 Android 动态性能框架优化散热和 CPU 性能
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
本指南介绍了如何使用 Android 动态性能框架 (ADPF) 根据 Android 上的动态散热和 CPU 管理功能优化游戏。这些功能侧重于游戏,但也可以用于其他性能密集型应用。
ADPF 是一组 API,可让游戏和性能密集型应用更为直接地与 Android 设备的电源和散热系统进行互动。借助这些 API,您可以监控 Android 系统上的动态行为,在不造成设备过热问题的可持续界限内优化游戏性能。
与桌面设备和游戏机相比,移动 SoC 和 Android 具有更多的动态性能行为。这些行为包括热状态管理、不同的 CPU 时钟和不同的 CPU 核心类型。再加上 SoC 核心拓扑日益多样化,这给尝试确保您的游戏能够利用这种行为而不对设备性能产生负面影响时带来了挑战。ADPF 提供其中一些信息是为了提高性能的可预测性。
以下是主要的 ADPF 功能:
- Thermal API:监控设备的热状态,以便应用在工作负载变得不可持续之前主动调整工作负载。
- CPU Performance Hint API:提供性能提示,让 Android 能够为工作负载选择合适的性能设置(例如 CPU 操作点或核心)。
- Game Mode API 和 Game State API:根据用户的设置和游戏专用配置,通过确定性能或电池续航时间特征的优先级来启用游戏优化功能。
- 固定性能模式:在进行基准测试期间在设备上启用固定性能模式,以获取不会因动态 CPU 时钟设置而更改的测量结果。
- 节能模式:告知会话可以安全地安排性能提示会话中的线程,使其优先考虑节能而非性能。(适用于 Android 15)
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-27。
[null,null,["最后更新时间 (UTC):2025-07-27。"],[],[],null,["# Optimize thermal and CPU performance with the Android Dynamic Performance Framework\n\nThis guide describes how to use the Android Dynamic Performance Framework (ADPF)\nto optimize games based on the dynamic thermal and CPU management features on\nAndroid. The focus is on games, but you can also use the features for other\nperformance-intensive apps.\n\nADPF is a set of APIs that allow games and performance-intensive apps to\ninteract more directly with power and thermal systems of Android devices. With\nthese APIs, you can monitor the dynamic behavior on Android systems and optimize\ngame performance at a sustainable level that doesn't overheat devices.\n\nMobile SoCs and Android have more dynamic performance behaviors than desktops\nand consoles. These behaviors include thermal state management, varying CPU\nclocks, and varying CPU core types. This combined with the increasingly diverse\ncore topology of SoCs creates challenges when trying to ensure that your game\ncan take advantage of this behavior without negatively impacting device\nperformance. ADPF provides some of this information in order to make performance\nmore predictable.\n\nHere are the main ADPF features:\n\n- **Thermal API**: Monitor the thermal state of a device so that the application can proactively adjust workload before it becomes unsustainable.\n- **CPU Performance Hint API**: Provide performance hints that let Android choose the right performance settings (for example, CPU operating point or core) for the workload.\n- **Game Mode API \\& Game State API**: Enable game play optimization by prioritizing performance or battery life characteristics, based on user's settings and game specific configurations.\n- **Fixed Performance Mode**: Enable fixed-performance mode on a device during benchmarking to get measurements that aren't altered by dynamic CPU clocking.\n- **Power Efficiency Mode** : Tells the session that the threads in Performance Hint Session can be safely scheduled to prefer power efficiency over performance. ([Available in Android 15](/reference/android/os/PerformanceHintManager.Session#setPreferPowerEfficiency(boolean)))"]]