StoreRules

规则 · 支持 16 KB 页面大小 · 为支持16 KB设备构建应用

Fix code and resolve runtime issues

通俗解读

即使你的应用已进行 16 KB 对齐,你仍必须删除假设特定页面大小(例如 4 KB)的代码,并检查需要页面对齐的 API(如 mmap())。

  • 删除对 PAGE_SIZE 常量的硬编码依赖以及任何假设 4 KB(4096)页面大小的逻辑;改用 getpagesize() 或 sysconf(_SC_PAGESIZE)。
  • 检查 mmap() 以及其他需要页面对齐参数的 API,并在必要时替换为其他方式。
  • 将 PAGE_SIZE 用作与实际页面大小无关的便捷值,在 16 KB 模式下不会出错;但在不使用 MAP_FIXED 的情况下将其传给 mmap,内核仍会分配整页,造成内存浪费。
  • 在 NDK r27 及更高版本中启用 16 KB 模式时,PAGE_SIZE 未定义。
  • 如果你以这种方式使用 PAGE_SIZE,且从不将其直接传给内核,请创建一个名称不同的新变量。

摘要由 StoreRules 撰写,并与官方原文核对。

官方原文摘录

Even if your app is 16 KB-aligned, your app can encounter errors if places in your code assume that a device is using a specific page size. To avoid this, complete the following steps: 1. Remove any hard-coded dependencies that reference the PAGESIZE constant or instances in your code logic that assume that a device's …

阅读官方全文 ↗ 在 StoreRules 规则库中打开 询问你的应用是否合规

变更历史

自 StoreRules 开始跟踪以来没有实质性变化。

首次出现: 2026-10-16

开发者关于此条款的案例

暂无案例。

分享你的案例