Android 13 中有关限制非 SDK 接口的更新
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
Android 13 包含更新后的受限制非 SDK 接口列表(基于与 Android 开发者之间的协作以及最新的内部测试)。在限制使用非 SDK 接口之前,我们会尽可能确保有可用的公开替代方案。
如果您的应用并非以 Android 13 为目标平台,其中一些变更可能不会立即对您产生影响。然而,虽然您目前仍可以使用一些非 SDK 接口(具体取决于应用的目标 API 级别),但只要您使用任何非 SDK 方法或字段,终归存在导致应用出问题的显著风险。
如果您不确定自己的应用是否使用了非 SDK 接口,则可以测试您的应用来进行确认。如果您的应用依赖于非 SDK 接口,您应该开始计划迁移到 SDK 替代方案。然而,我们知道某些应用具有使用非 SDK 接口的有效用例。如果您无法为应用中的某项功能找到使用非 SDK 接口的替代方案,应请求新的公共 API。
Android 13 的列表变更
Android 13 中的列表变更分为以下几类:
如需查看 Android 13 的所有非 SDK 接口的完整列表,请下载以下文件:
文件:hiddenapi-flags.csv
SHA-256 校验和:233a277aa8ac475b6df61bffd95665d86aac6eb2ad187b90bf42a98f5f2a11a3
目前在 Android 13 中被屏蔽的非 SDK 接口
以下代码框列出了 Android 12(API 级别 31)中不受支持的所有非 SDK 接口,这些接口在 Android 13(API 级别 33)中被屏蔽。也就是说,这些接口属于 max-target-s
列表,因此只有在您的应用以 Android 12(API 级别 31)及更低版本为目标平台时,才能使用这些接口。
我们的目标是在限制使用非 SDK 接口之前确保有可用的公开替代方案,并且我们知道您的应用可能具有使用这些接口的有效用例。如果您的应用在先前版本中使用的某个接口在 Android 13 中被屏蔽,则应针对该接口请求新的公共 API。
Landroid/app/Activity;->setDisablePreviewScreenshots(Z)V # Use setRecentsScreenshotEnabled() instead.
Landroid/os/PowerManager;->isLightDeviceIdleMode()Z # Use isDeviceLightIdleMode() instead.
Landroid/os/Process;->setArgV0(Ljava/lang/String;)V # In general, do not try to change the process name. If you must change the process name (for instance, for debugging), you can use pthread_setname_np() instead, though be aware that doing this might confuse the system.
Landroid/view/accessibility/AccessibilityInteractionClient;->clearCache(I)V # Use android.accessibilityservice.AccessibilityService#clearCache() instead.
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-21。
[null,null,["最后更新时间 (UTC):2025-08-21。"],[],[],null,["# Updates to non-SDK interface restrictions in Android 13\n\nAndroid 13 includes updated lists of restricted non-SDK\ninterfaces based on collaboration with Android developers and the latest\ninternal testing. Whenever possible, we make sure that public alternatives are\navailable before we restrict non-SDK interfaces.\n\nIf your app does not target Android 13, some of these changes\nmight not immediately affect you. However, while you can currently use some\nnon-SDK interfaces ([depending on your app's target API\nlevel](/guide/app-compatibility/restrictions-non-sdk-interfaces#list-names)),\nusing any non-SDK method or field always carries a high risk of breaking your\napp.\n\nIf you are unsure if your app uses non-SDK interfaces, you can [test your\napp](/guide/app-compatibility/restrictions-non-sdk-interfaces#test-for-non-sdk)\nto find out. If your app relies on non-SDK interfaces, you should begin planning\na migration to SDK alternatives. Nevertheless, we understand that some apps have\nvalid use cases for using non-SDK interfaces. If you cannot find an alternative\nto using a non-SDK interface for a feature in your app, you should [request a\nnew public API](/guide/app-compatibility/restrictions-non-sdk-interfaces#feature-request).\n\nList changes for Android 13\n---------------------------\n\nThe list changes in Android 13 fall into the following category:\n\n- Non-SDK interfaces that were unsupported in Android 12 (API level 31) that are [blocked in Android 13](#new-blocked).\n\nFor a complete list of all non-SDK interfaces for Android 13, download the\nfollowing file:\n\nFile: [`hiddenapi-flags.csv`](https://dl.google.com/developers/android/tm/non-sdk/hiddenapi-flags.csv)\n\nSHA-256 checksum: `233a277aa8ac475b6df61bffd95665d86aac6eb2ad187b90bf42a98f5f2a11a3`\n\n### Non-SDK interfaces that are now blocked in Android 13\n\nThe following code box lists all of the non-SDK interfaces that were unsupported\nin Android 12 (API level 31) that are blocked in Android 13 (API level 33). That\nis, these interfaces belong to the `max-target-s` list, so your app can only use\nthese interfaces if it targets Android 12 (API level 31) or lower.\n\nOur goal is to make sure that public alternatives are available before we\nrestrict non-SDK interfaces, and we understand that your app might have a valid\nuse case for using these interfaces. If an interface that your app uses in a\nprior version is now blocked in Android 13, you should [request a new public\nAPI](/guide/app-compatibility/restrictions-non-sdk-interfaces#feature-request)\nfor that interface. \n\n```\nLandroid/app/Activity;-\u003esetDisablePreviewScreenshots(Z)V # Use /reference/android/app/Activity#setRecentsScreenshotEnabled(boolean) instead.\nLandroid/os/PowerManager;-\u003eisLightDeviceIdleMode()Z # Use /reference/android/os/PowerManager#isDeviceLightIdleMode() instead.\nLandroid/os/Process;-\u003esetArgV0(Ljava/lang/String;)V # In general, do not try to change the process name. If you must change the process name (for instance, for debugging), you can use pthread_setname_np() instead, though be aware that doing this might confuse the system.\nLandroid/view/accessibility/AccessibilityInteractionClient;-\u003eclearCache(I)V # Use /reference/android/accessibilityservice/AccessibilityService#clearCache() instead.\n```"]]