Android 14 offre aux développeurs de nouvelles fonctionnalités et API de qualité. Les informations suivantes vous aident à découvrir les fonctionnalités de vos applications et à vous familiariser avec les API associées.
Pour obtenir une liste détaillée des API ajoutées, modifiées et supprimées, consultez le rapport de différences des API. Pour en savoir plus sur les API ajoutées, consultez la documentation de référence des API Android. Pour Android 14, recherchez les API ajoutées au niveau d'API 34. Pour savoir dans quels domaines les changements de plate-forme peuvent affecter vos applications, consultez les modifications de comportement d'Android 14pour les applications ciblant Android 14 et pour toutes les applications.
Internationalisation
Préférences linguistiques par application
Android 14 expands on the per-app language features that were introduced in Android 13 (API level 33) with these additional capabilities:
Automatically generate an app's
localeConfig
: Starting with Android Studio Giraffe Canary 7 and AGP 8.1.0-alpha07, you can configure your app to support per-app language preferences automatically. Based on your project resources, the Android Gradle plugin generates theLocaleConfig
file and adds a reference to it in the final manifest file, so you no longer have to create or update the file manually. AGP uses the resources in theres
folders of your app modules and any library module dependencies to determine the locales to include in theLocaleConfig
file.Dynamic updates for an app's
localeConfig
: Use thesetOverrideLocaleConfig()
andgetOverrideLocaleConfig()
methods inLocaleManager
to dynamically update your app's list of supported languages in the device's system settings. Use this flexibility to customize the list of supported languages per region, run A/B experiments, or provide an updated list of locales if your app utilizes server-side pushes for localization.App language visibility for input method editors (IMEs): IMEs can utilize the
getApplicationLocales()
method to check the language of the current app and match the IME language to that language.
API Grammatical Inflection
有 30 亿人在使用区分性别的语言,此类语言的语法类别(例如名词、动词、形容词和介词)会根据您交谈所涉及的人或物的性别而变化。传统上,许多区分性别的语言使用阳性语法性别作为默认或通用性别。
以错误的语法性别来称呼用户,例如以阳性语法性别来称呼女性,可能会对她们的表现和态度产生负面影响。相比之下,界面语言如果能正确反映用户的语法性别,就可以提高用户互动度,并提供更个性化、更自然的用户体验。
为帮助您针对区分性别的语言构建以用户为中心的界面,Android 14 引入了 Grammatical Inflection API,让您无需重构应用便能添加对语法性别的支持。
Préférences régionales
Regional preferences enable users to personalize temperature units, the first day of the week, and numbering systems. A European living in the United States might prefer temperature units to be in Celsius rather than Fahrenheit and for apps to treat Monday as the beginning of the week instead of the US default of Sunday.
New Android Settings menus for these preferences provide users with a
discoverable and centralized location to change app preferences. These
preferences also persist through backup and restore. Several APIs and
intents—such as
getTemperatureUnit
and
getFirstDayOfWeek
—
grant your app read access to user preferences, so your app can adjust how it
displays information. You can also register a
BroadcastReceiver
on
ACTION_LOCALE_CHANGED
to handle locale configuration changes when regional preferences change.
To find these settings, open the Settings app and navigate to System > Languages & input > Regional preferences.


Accessibilité
Mise à l'échelle non linéaire de la police à 200 %
从 Android 14 开始,系统支持字体放大高达 200%,为弱视用户提供了符合网络内容无障碍指南 (WCAG) 的其他无障碍选项。
为防止屏幕上的大文本元素放大过大,系统会采用非线性放大曲线。这种放大策略意味着大号文本的放大比例不会与较小的文本相同。非线性字体缩放有助于保持不同大小元素之间的比例层次结构,同时缓解高级别线性文本缩放的问题(例如文本被截断或文本因超大显示大小而难以阅读)。
使用非线性字体放大测试应用

如果您已经使用放大像素 (sp) 单位来定义文本大小,那么这些额外的选项和缩放改进会自动应用于应用中的文本。但是,您仍然应该在启用最大字体大小 (200%) 的情况下执行界面测试,以确保应用正确应用字体大小,并且可以适应更大的字体大小,而不影响易用性。
要启用 200% 字号,请按以下步骤操作:
- 打开“设置”应用,然后依次前往无障碍 > 显示大小和文字。
- 在字号选项中,点按加号 (+) 图标,直到启用最大字号设置,如本部分随附的图片所示。
针对文本大小使用放大像素 (sp) 单位
请务必始终以 sp 为单位指定文本大小。当应用使用 sp 单位时,Android 可以应用用户的首选文本大小并相应地缩放。
不要为内边距使用 sp 单位,也不假设隐式内边距定义视图高度:使用非线性字体缩放 sp 尺寸可能不成比例,因此 4sp + 20sp 可能不等于 24sp。
转换放大像素 (sp) 单位
使用 TypedValue.applyDimension()
从 sp 单位转换为像素,并使用 TypedValue.deriveDimension()
将像素转换为 sp。这些方法会自动应用适当的非线性缩放曲线。
避免使用 Configuration.fontScale
或 DisplayMetrics.scaledDensity
对方程进行硬编码。由于字体缩放是非线性的,因此 scaledDensity
字段不再准确。fontScale
字段应仅用于提供信息,因为字体不再使用单个标量值进行缩放。
对 lineHeight 使用 sp 单位
始终使用 sp 单位(而非 dp)定义 android:lineHeight
,以便行高随文本一起缩放。否则,如果您的文本为 sp,而 lineHeight
以 dp 或 px 为单位,则文本无法缩放且看起来狭窄。TextView 会自动更正 lineHeight
以保留您预期的比例,但前提是以 sp 为单位同时定义 textSize
和 lineHeight
。
Appareil photo et médias
Ultra HDR pour les images

Android 14 新增了对高动态范围 (HDR) 图片的支持,可在拍摄照片时保留更多来自传感器的信息,从而实现鲜艳的色彩和更高的对比度。Android 使用 Ultra HDR 格式,该格式与 JPEG 图片完全向后兼容,可让应用与 HDR 图片无缝互操作,并根据需要以标准动态范围 (SDR) 显示这些图片。
当您的应用选择为其 activity 窗口使用 HDR 界面(通过清单条目或通过在运行时调用 Window.setColorMode()
)时,框架会自动在界面中以 HDR 格式渲染这些图片。您还可以在受支持的设备上拍摄压缩的 Ultra HDR 静态图片。从传感器中恢复的颜色越多,后期编辑的灵活性就越高。与 Ultra HDR 图片关联的 Gainmap
可用于使用 OpenGL 或 Vulkan 渲染这些图片。
Zoom, mise au point, postview et plus encore dans les extensions d'appareil photo
Android 14 upgrades and improves camera extensions, allowing apps to handle longer processing times, which enables improved images using compute-intensive algorithms like low-light photography on supported devices. These features give users an even more robust experience when using camera extension capabilities. Examples of these improvements include:
- Dynamic still capture processing latency estimation provides much more
accurate still capture latency estimates based on the current scene and
environment conditions. Call
CameraExtensionSession.getRealtimeStillCaptureLatency()
to get aStillCaptureLatency
object that has two latency estimation methods. ThegetCaptureLatency()
method returns the estimated latency betweenonCaptureStarted
andonCaptureProcessStarted()
, and thegetProcessingLatency()
method returns the estimated latency betweenonCaptureProcessStarted()
and the final processed frame being available. - Support for capture progress callbacks so that apps can display the current
progress of long-running, still-capture processing operations. You can check
if this feature is available with
CameraExtensionCharacteristics.isCaptureProcessProgressAvailable
, and if it is, you implement theonCaptureProcessProgressed()
callback, which has the progress (from 0 to 100) passed in as a parameter. Extension specific metadata, such as
CaptureRequest.EXTENSION_STRENGTH
for dialing in the amount of an extension effect, such as the amount of background blur withEXTENSION_BOKEH
.Postview Feature for Still Capture in camera extensions, which provides a less-processed image more quickly than the final image. If an extension has increased processing latency, a postview image could be provided as a placeholder to improve UX and switched out later for the final image. You can check if this feature is available with
CameraExtensionCharacteristics.isPostviewAvailable
. Then you can pass anOutputConfiguration
toExtensionSessionConfiguration.setPostviewOutputConfiguration
.Support for
SurfaceView
allowing for a more optimized and power-efficient preview render path.Support for tap to focus and zoom during extension usage.
Zoom dans le capteur
Lorsque REQUEST_AVAILABLE_CAPABILITIES_STREAM_USE_CASE
dans CameraCharacteristics
contient SCALER_AVAILABLE_STREAM_USE_CASES_CROPPED_RAW
, votre application peut utiliser des fonctionnalités avancées de capteur pour attribuer à un flux RAW recadré les mêmes pixels que le champ de vision complet à l'aide d'un CaptureRequest
avec une cible RAW dont le cas d'utilisation du flux est défini sur CameraMetadata.SCALER_AVAILABLE_STREAM_USE_CASES_CROPPED_RAW
.
En implémentant les commandes de forçage de la requête, la caméra mise à jour permet aux utilisateurs de contrôler le zoom avant même que les autres commandes de la caméra ne soient prêtes.
Audio USB sans perte
Android 14 支持无损音频格式,可通过 USB 有线耳机提供发烧友级体验。您可以查询 USB 设备的首选混音器属性,注册监听器以监听首选混音器属性的更改,以及使用 AudioMixerAttributes
类配置混音器属性。此类表示音频混音器的格式,例如声道掩码、采样率和行为。该类允许直接发送音频,而无需混音、调节音量或处理效果。
Productivité et outils pour les développeurs
Gestionnaire d'identifiants
Android 14 将 Credential Manager 添加为平台 API,并通过使用 Google Play 服务的 Jetpack 库,向后额外支持 Android 4.4(API 级别 19)设备。Credential Manager 旨在通过 API 使用用户配置的凭据提供程序检索和存储凭据,让用户更轻松地登录。Credential Manager 在单个 API 中支持多种登录方法,包括用户名和密码、通行密钥和联合登录解决方案(如“使用 Google 账号登录”)。
通行密钥具有许多优势。例如,通行密钥是基于业界标准构建的,可在各种不同的操作系统和浏览器生态系统中使用,并且可用于网站和应用。
如需了解详情,请参阅 Credential Manager 和通行密钥文档以及介绍 Credential Manager 和通行密钥的博文。
Santé Connect
Health Connect 是用户健康与健身数据的设备端仓库。借助该功能,用户可以在一个位置控制要与这些应用共享哪些数据,并在自己喜爱的应用之间共享数据。
在搭载 Android 14 之前的 Android 版本的设备上,Health Connect 可作为应用从 Google Play 商店下载。从 Android 14 开始,Health Connect 将成为 Android 平台的一部分,并通过 Google Play 系统更新接收更新,而无需单独下载。这样一来,Health Connect 就可以频繁更新,您的应用可以依赖于搭载 Android 14 或更高版本的设备上提供的 Health Connect。用户可以通过设备的“设置”访问 Health Connect,隐私控制功能集成到系统设置中。


Health Connect 在 Android 14 中包含多项新功能,例如锻炼路线,可让用户分享可在地图上直观呈现的锻炼路线。路线定义为在一定时间范围内保存的位置列表,您的应用可以将路线插入锻炼时段,将它们关联起来。为确保用户能够完全控制此类敏感数据,用户必须允许与其他应用共享单个路线。
如需了解详情,请参阅 Health Connect 文档以及有关 Android Health 中的新功能的博文。
Mises à jour OpenJDK 17
Android 14 continues the work of refreshing Android's core libraries to align with the features in the latest OpenJDK LTS releases, including both library updates and Java 17 language support for app and platform developers.
The following features and improvements are included:
- Updated approximately 300
java.base
classes to Java 17 support. - Text Blocks, which introduce multi-line string literals to the Java programming language.
- Pattern Matching for instanceof, which allows an object to
be treated as having a specific type in an
instanceof
without any additional variables. - Sealed classes, which allow you restrict which classes and interfaces can extend or implement them.
Thanks to Google Play system updates (Project Mainline), over 600 million devices are enabled to receive the latest Android Runtime (ART) updates that include these changes. This is part of our commitment to give apps a more consistent, secure environment across devices, and to deliver new features and capabilities to users independent of platform releases.
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Améliorations apportées aux plates-formes de téléchargement d'applications
Android 14 introduit plusieurs API PackageInstaller
qui permettent aux plates-formes de téléchargement d'applications d'améliorer leur expérience utilisateur.
Demander l'autorisation de l'installation avant le téléchargement
L'installation ou la mise à jour d'une application peut nécessiter l'autorisation de l'utilisateur.
Par exemple, lorsqu'un programme d'installation qui utilise l'autorisation REQUEST_INSTALL_PACKAGES
tente d'installer une nouvelle application. Dans les versions précédentes d'Android, les plates-formes de téléchargement d'applications ne pouvaient demander l'autorisation de l'utilisateur qu'une fois les APK écrits dans la session d'installation et que la session était lancée.
À partir d'Android 14, la méthode requestUserPreapproval()
permet aux installateurs de demander l'autorisation de l'utilisateur avant de lancer la session d'installation. Cette amélioration permet à une plate-forme de téléchargement d'applications de différer le téléchargement des APK jusqu'à ce que l'installation ait été autorisée par l'utilisateur. En outre, une fois qu'un utilisateur a autorisé l'installation de l'application, la plate-forme de téléchargement d'applications peut la télécharger et l'installer en arrière-plan sans interrompre l'utilisateur.
Revendiquer la responsabilité des prochaines mises à jour
La méthode setRequestUpdateOwnership()
permet à un programme d'installation d'indiquer au système qu'il a l'intention d'être responsable des futures mises à jour d'une application qu'il installe. Cette fonctionnalité active l'application forcée de la propriété de la mise à jour, ce qui signifie que seul le propriétaire des mises à jour est autorisé à installer des mises à jour automatiques de l'application. L'application forcée de la propriété de la mise à jour permet de s'assurer que les utilisateurs ne reçoivent des mises à jour que depuis la plate-forme de téléchargement d'applications attendue.
Tout autre programme d'installation, y compris ceux utilisant l'autorisation INSTALL_PACKAGES
, doit recevoir une approbation explicite de l'utilisateur pour installer une mise à jour. Si un utilisateur décide de procéder à une mise à jour à partir d'une autre source, la propriété de la mise à jour est perdue.
Mettre à jour les applications au meilleur moment
Les plates-formes de téléchargement d'applications évitent généralement de mettre à jour une application en cours d'utilisation, car cela entraîne la fermeture des processus en cours d'exécution, ce qui peut potentiellement interrompre l'activité de l'utilisateur.
À partir d'Android 14, l'API InstallConstraints
permet aux programmes d'installation de s'assurer que les mises à jour de leur application sont effectuées au moment opportun. Par exemple, une plate-forme de téléchargement d'applications peut appeler la méthode commitSessionAfterInstallConstraintsAreMet()
pour s'assurer qu'une mise à jour n'est lancée que lorsque l'utilisateur n'interagit plus avec l'application en question.
Installer facilement des divisions facultatives
Avec les APK divisés, les fonctionnalités d'une application peuvent être distribuées dans des fichiers APK distincts plutôt que sous forme d'un APK monolithique. Les APK divisés permettent aux plates-formes de téléchargement d'applications d'optimiser la distribution des différents composants de l'application. Par exemple, les plates-formes de téléchargement d'applications peuvent être optimisées en fonction des propriétés de l'appareil cible. L'API PackageInstaller
est compatible avec les divisions depuis son lancement au niveau d'API 22.
Dans Android 14, la méthode setDontKillApp()
permet à un programme d'installation d'indiquer que les processus en cours d'exécution de l'application ne doivent pas être supprimés lorsque de nouvelles divisions sont installées. Les plates-formes de téléchargement d'applications peuvent utiliser cette fonctionnalité pour installer facilement les nouvelles fonctionnalités d'une application lorsque l'utilisateur l'utilise.
Bundles de métadonnées d'application
从 Android 14 开始,Android 软件包安装程序可让您指定应用元数据(例如数据安全做法),以在 Google Play 等应用商店页面上架。
Détecter quand les utilisateurs prennent des captures d'écran de l'appareil
为了打造更加标准化的屏幕截图检测体验,Android 14 引入了可保护隐私的屏幕截图检测 API。借助此 API,应用可以按 activity 注册回调。如果用户在该 activity 可见时截取屏幕截图,系统会调用这些回调并通知用户。
Expérience utilisateur
Actions personnalisées Sharesheet et classement amélioré
Android 14 updates the system sharesheet to support custom app actions and more informative preview results for users.
Add custom actions
With Android 14, your app can add custom actions to the system sharesheet it invokes.

Improve ranking of Direct Share targets
Android 14 uses more signals from apps to determine the ranking of the direct share targets to provide more helpful results for the user. To provide the most useful signal for ranking, follow the guidance for improving rankings of your Direct Share targets. Communication apps can also report shortcut usage for outgoing and incoming messages.

Prise en charge des animations intégrées et personnalisées pour la prévisualisation du Retour
Android 13 introduced the predictive back-to-home animation behind a developer option. When used in a supported app with the developer option enabled, swiping back shows an animation indicating that the back gesture exits the app back to the home screen.
Android 14 includes multiple improvements and new guidance for Predictive Back:
- You can set
android:enableOnBackInvokedCallback=true
to opt in to predictive back system animations per-Activity instead of for the entire app. - We've added new system animations to accompany the back-to-home animation from Android 13. The new system animations are cross-activity and cross-task, which you get automatically after migrating to Predictive Back.
- We've added new Material Component animations for Bottom sheets, Side sheets, and Search.
- We've created design guidance for creating custom in-app animations and transitions.
- We've added new APIs to support custom in-app transition animations:
handleOnBackStarted
,handleOnBackProgressed
,handleOnBackCancelled
in
OnBackPressedCallback
onBackStarted
,onBackProgressed
,onBackCancelled
in
OnBackAnimationCallback
- Use
overrideActivityTransition
instead ofoverridePendingTransition
for transitions that respond as the user swipes back.
With this Android 14 preview release, all features of Predictive Back remain behind a developer option. See the developer guide to migrate your app to predictive back, as well as the developer guide to creating custom in-app transitions.
Forçages par application du fabricant d'appareils à grand écran
借助按应用替换项,设备制造商可以更改应用在大屏设备上的行为。例如,FORCE_RESIZE_APP
替换项会指示系统调整应用大小以适应显示屏尺寸(避免进入尺寸兼容模式),即使在应用清单中设置了 resizeableActivity="false"
也是如此。
替换项旨在改善大屏设备上的用户体验。
借助新的清单属性,您可以为应用停用某些设备制造商替换项。
Forçages par application pour les utilisateurs sur grand écran
按应用替换项会更改应用在大屏设备上的行为。例如,无论应用的配置如何,OVERRIDE_MIN_ASPECT_RATIO_LARGE
设备制造商替换项都会将应用宽高比设置为 16:9。
借助 Android 14 QPR1,用户可以在大屏设备上通过新的设置菜单应用按应用替换项。
Partager le contenu d'une appli sur l'écran
借助应用界面共享功能,用户可以在录制屏幕内容时共享应用窗口,而不是整个设备屏幕。
在应用屏幕共享模式下,状态栏、导航栏、通知和其他系统界面元素会从共享显示屏中排除。系统只会分享所选应用的内容。
应用屏幕共享功能可让用户运行多个应用,但将内容共享限制为单个应用,从而提高工作效率并保护隐私。
Réponse suggérée optimisée par LLM dans Gboard sur un Pixel 8 Pro
在搭载 12 月功能分块的 Pixel 8 Pro 设备上,开发者可以在 Gboard 中试用质量更高的智能回复,这些回复由在 Google Tensor 上运行的设备端大语言模型 (LLM) 提供支持。
此功能目前仅在 WhatsApp、Line 和 KakaoTalk 中以美式英语的形式提供给用户进行小范围测试。此功能需要使用 Pixel 8 Pro 设备,并将 Gboard 用作键盘。
如需试用此功能,请先依次前往设置 > 开发者选项 > AiCore 设置 > 启用 Aicore 持久性,启用该功能。
接下来,在受支持的应用中打开对话,即可在 Gboard 的建议栏中看到依托 LLM 的智能回复,以便回复收到的消息。
Graphiques
Les chemins sont interrogeables et interpolables
Android 的 Path
API 是一种强大且灵活的机制,可用于创建和渲染矢量图形,能够描边或填充路径、根据线段或二次曲线或立方曲线构建路径、执行布尔运算以获取更复杂的形状,或同时执行所有这些操作。但有一个限制是,您无法了解 Path 对象中实际包含的内容;该对象的内部信息在创建后对调用方是不透明的。
如需创建 Path
,您可以调用 moveTo()
、lineTo()
和 cubicTo()
等方法来添加路径段。但是,无法询问该路径有哪些片段,因此您必须在创建时保留该信息。
从 Android 14 开始,您可以查询路径以了解其内部内容。首先,您需要使用 Path.getPathIterator
API 获取 PathIterator
对象:
Kotlin
val path = Path().apply { moveTo(1.0f, 1.0f) lineTo(2.0f, 2.0f) close() } val pathIterator = path.pathIterator
Java
Path path = new Path(); path.moveTo(1.0F, 1.0F); path.lineTo(2.0F, 2.0F); path.close(); PathIterator pathIterator = path.getPathIterator();
接下来,您可以调用 PathIterator
逐个遍历片段,并检索每个片段的所有必要数据。以下示例使用了 PathIterator.Segment
对象,它会为您打包数据:
Kotlin
for (segment in pathIterator) { println("segment: ${segment.verb}, ${segment.points}") }
Java
while (pathIterator.hasNext()) { PathIterator.Segment segment = pathIterator.next(); Log.i(LOG_TAG, "segment: " + segment.getVerb() + ", " + segment.getPoints()); }
PathIterator
还有一个非分配版 next()
,您可以在其中传入缓冲区来保存点数据。
查询 Path
数据的一个重要用例是插值。例如,您可能想在两个不同的路径之间添加动画(或变形)。为了进一步简化该用例,Android 14 针对 Path
还包含 interpolate()
方法。假设两个路径具有相同的内部结构,interpolate()
方法会使用该插值结果创建一个新的 Path
。以下示例返回了一个形状介于 path
和 otherPath
之间的一半(线性插值为 0.5)的路径:
Kotlin
val interpolatedResult = Path() if (path.isInterpolatable(otherPath)) { path.interpolate(otherPath, .5f, interpolatedResult) }
Java
Path interpolatedResult = new Path(); if (path.isInterpolatable(otherPath)) { path.interpolate(otherPath, 0.5F, interpolatedResult); }
Jetpack graphics-path 库也为早期版本的 Android 启用了类似的 API。
Maillages personnalisés avec des nuanceurs de sommets et de fragments
Android 长期以来一直支持使用自定义着色绘制三角网格,但输入网格格式仅限于一些预定义的属性组合。Android 14 增加了对自定义网格的支持,可将其定义为三角形或三角形条,并且可以选择是否编入索引。这些网格是使用自定义属性、顶点步长、可变以及使用 AGSL 编写的顶点着色器和片段着色器指定的。
顶点着色器定义了位置和颜色等变量,而片段着色器可以选择为像素定义颜色,通常是使用顶点着色器创建的变量。如果片段着色器提供颜色,则系统会使用绘制网格时选择的混合模式将其与当前 Paint
颜色混合。Uniform 可以传递到片段着色器和顶点着色器,以提高灵活性。
Moteur de rendu de tampon matériel pour Canvas
协助使用 Android 的 Canvas
API 通过
硬件加速至 HardwareBuffer
、Android 14
引入了 HardwareBufferRenderer
。如果您的用例涉及通过 SurfaceControl
与系统合成器通信以实现低延迟绘制,此 API 特别有用。