תכונות וממשקי API

‫Android 16 כולל תכונות חדשות ו-API חדשים למפתחים. בקטעים הבאים מופיע סיכום של התכונות האלה שיעזור לכם להתחיל להשתמש בממשקי ה-API שקשורים אליהן.

רשימה מפורטת של ממשקי API חדשים, ממשקי API שעברו שינוי וממשקי API שהוסרו מופיעה בדוח ההבדלים בין גרסאות API. פרטים על ממשקי API חדשים זמינים בהפניית Android API. ממשקי API חדשים מודגשים כדי שיהיה קל לראות אותם.

כדאי גם לבדוק תחומים שבהם שינויים בפלטפורמה עשויים להשפיע על האפליקציות שלכם. למידע נוסף, ראו את הדפים הבאים:

פונקציונליות עיקרית

‫Android כולל ממשקי API חדשים שמרחיבים את היכולות העיקריות של מערכת Android.

שתי גרסאות של Android API בשנת 2025

  • 此预览版适用于 Android 的下一个主要版本,计划于 2025 年第 2 季度发布。此版本与我们过去的所有 API 版本类似,我们可以进行计划性的行为更改,这些更改通常与 targetSdkVersion 相关联。
  • 我们计划提前一个季度(2021 年第 2 季度,而非之前的第 3 季度)发布主要版本,以便更好地与整个生态系统中的设备发布时间表保持一致,让更多设备能够更早地搭载 Android 主要版本。由于主要版本将于第 2 季度发布,因此您需要比往年提前几个月进行年度兼容性测试,以确保您的应用已做好准备。
  • 我们计划在 2025 年第 4 季度再发布一次,届时还将推出新的开发者 API。2025 年只有第二季度的主要版本包含可能影响应用的计划行为变更。

除了新的开发者 API 之外,第 4 季度次要版本还将包含功能更新、优化和 bug 修复;其中不会包含任何会影响应用的行为变更。

2025 年 Android 版本的时间轴视图,请注意,25Q2 版本是一个主要版本,25Q4 版本是一个次要版本。

我们将继续每季度发布 Android 版本。在 API 版本之间,第 1 季度和第 3 季度的更新将提供增量更新,以帮助确保持续提供高质量的服务。我们正积极与设备合作伙伴合作,将 Q2 版本推广到尽可能多的设备。

在主要版本和次要版本中使用新 API

目前,使用 SDK_INT 常量与 VERSION_CODES 结合使用,即可通过检查 API 级别来保护代码块。我们将继续支持主要 Android 版本。

if (SDK_INT >= VERSION_CODES.BAKLAVA) {
  // Use APIs introduced in Android 16
}

新的 SDK_INT_FULL 常量可用于针对主要版本和次要版本进行 API 检查,并使用新的 VERSION_CODES_FULL 枚举。

if (SDK_INT_FULL >= VERSION_CODES_FULL.[MAJOR or MINOR RELEASE]) {
  // Use APIs introduced in a major or minor release
}

您还可以使用 Build.getMinorSdkVersion() 方法仅获取 SDK 次要版本。

val minorSdkVersion = Build.getMinorSdkVersion(VERSION_CODES_FULL.BAKLAVA)

这些 API 尚未最终确定,可能会发生变化,因此如果您有任何疑虑,请向我们发送反馈

חוויית משתמש וממשק משתמש של המערכת

ב-Android 16, מפתחי אפליקציות ומשתמשים מקבלים יותר שליטה וגמישות בהגדרת המכשיר כך שיתאים לצרכים שלהם.

התראות שמתמקדות בהתקדמות

Android 16 引入了以进度为中心的通知,可帮助用户顺畅地跟踪用户发起的端到端历程。

Notification.ProgressStyle 是一种新的通知样式,可让您创建以进度为中心的通知。主要用例包括共享车辆、送货和导航。在 Notification.ProgressStyle 类中,您可以使用细分来表示用户体验历程中的状态和里程碑。

To learn more, see the Progress-centric notifications documentation page.

התראה שמתמקדת בהתקדמות מוצגת במסך הנעילה.
התראה שמתמקדת בהתקדמות מוצגת בחלונית ההתראות.

עדכונים של חיזוי החזרה

Android 16 adds new APIs to help you enable predictive back system animations in gesture navigation such as the back-to-home animation. Registering the onBackInvokedCallback with the new PRIORITY_SYSTEM_NAVIGATION_OBSERVER allows your app to receive the regular onBackInvoked call whenever the system handles a back navigation without impacting the normal back navigation flow.

Android 16 additionally adds the finishAndRemoveTaskCallback() and moveTaskToBackCallback. By registering these callbacks with the OnBackInvokedDispatcher, the system can trigger specific behaviors and play corresponding ahead-of-time animations when the back gesture is invoked.

משוב פיזי עשיר יותר

מערכת Android חשפה שליטה על המפעיל הרטט כבר מההתחלה.

ב-Android 11 נוספה תמיכה באפקטים הקטנים והחושתיים (haptic) מורכבים יותר, שיכולים לתמוך במפעילים מתקדמים יותר באמצעות VibrationEffect.Compositions של פרימיטיבים סמנטיים מוגדרים-מכשיר.

ב-Android 16 נוספו ממשקי API לחישה שמאפשרים לאפליקציות להגדיר את עקומות האמפליטודה והתדר של אפקטים לחושיים, תוך התעלמות מהבדלים בין יכולות המכשירים.

פרודוקטיביות וכלים למפתחים

רוב העבודה שלנו לשיפור הפרודוקטיביות מתמקדת בכלים כמו Android Studio,‏ Jetpack Compose וספריות Android Jetpack, אבל אנחנו תמיד מחפשים דרכים בפלטפורמה לעזור לכם להגשים את החזון שלכם.

טיפול בתוכן של טפטים דינמיים

In Android 16, the live wallpaper framework is gaining a new content API to address the challenges of dynamic, user-driven wallpapers. Currently, live wallpapers incorporating user-provided content require complex, service-specific implementations. Android 16 introduces WallpaperDescription and WallpaperInstance. WallpaperDescription lets you identify distinct instances of a live wallpaper from the same service. For example, a wallpaper that has instances on both the home screen and on the lock screen may have unique content in both places. The wallpaper picker and WallpaperManager use this metadata to better present wallpapers to users, streamlining the process for you to create diverse and personalized live wallpaper experiences.

ביצועים וסוללה

‫Android 16 כולל ממשקי API שעוזרים לאסוף תובנות לגבי האפליקציות.

יצירת פרופילים שמופעלת על ידי המערכת

ProfilingManager 在 Android 15 中添加,让应用能够在现场使用 Perfetto 请求收集性能数据。不过,由于此性能分析必须从应用启动,因此应用很难或根本无法捕获启动或 ANR 等关键流程。

为此,Android 16 向 ProfilingManager 引入了系统触发的性能分析。应用可以注册接收特定触发器(例如冷启动 reportFullyDrawn 或 ANR)轨迹的兴趣,然后系统会代表应用启动和停止轨迹。轨迹完成后,结果会传送到应用的数据目录。

הפעלת רכיב ב-ApplicationStartInfo

ApplicationStartInfo 在 Android 15 中添加,可让应用查看进程启动原因、启动类型、启动时间、节流和其他实用诊断数据。Android 16 添加了 getStartComponent(),用于区分触发启动的组件类型,这有助于优化应用的启动流程。

בדיקה טובה יותר של המשרה

ה-API של JobScheduler#getPendingJobReason() מחזיר את הסיבה לכך שמשימת עשויה להמתין. עם זאת, יכולות להיות כמה סיבות לכך שמשימה נמצאת בהמתנה.

ב-Android 16 אנחנו משיקים ממשק API חדש, JobScheduler#getPendingJobReasons(int jobId), שמציג כמה סיבות לכך שמשימה נמצאת בהמתנה, גם בגלל אילוצים מפורשים שהמפתח הגדיר וגם בגלל אילוצים משתמעים שהמערכת הגדירה.

אנחנו גם משיקים את הפונקציה JobScheduler#getPendingJobReasonsHistory(int jobId), שמחזירה רשימה של השינויים האחרונים באילוצים.

מומלץ להשתמש ב-API כדי לנפות באגים ולגלות למה המשימות לא מתבצעות, במיוחד אם נתוני ההצלחה של משימות מסוימות נמוכים או אם יש באגים בזמן האחזור של משימות מסוימות. לדוגמה, העדכון של הווידג'טים ברקע נכשל או שהקריאה למשימה של אחסון נתונים לפני האצת האפליקציה נכשלה לפני הפעלת האפליקציה.

כך תוכלו גם להבין טוב יותר אם משימות מסוימות לא מסתיימות בגלל אילוצים שהוגדרו על ידי המערכת, לעומת אילוצים שהוגדרו באופן מפורש.

קצב רענון דינמי

Android 15 中引入的自适应刷新率 (ARR) 可让受支持硬件上的显示屏刷新率使用离散的 VSync 步长来适应内容帧速率。这不仅降低了功耗,还无需进行可能导致卡顿的模式切换。

Android 16 引入了 hasArrSupport()getSuggestedFrameRate(int),同时恢复了 getSupportedRefreshRates(),以便您的应用更轻松地利用 ARR。RecyclerView 1.4从快速滑动或平滑滚动中稳定下来时会在内部支持 ARR,我们将继续努力,将 ARR 支持添加到更多 Jetpack 库中。这篇帧速率文章介绍了许多可用于设置帧速率的 API,以便您的应用可以直接使用 ARR。

ממשקי Headroom API ב-ADPF

The SystemHealthManager introduces the getCpuHeadroom and getGpuHeadroom APIs, designed to provide games and resource-intensive apps with estimates of available CPU and GPU resources. These methods offer a way for you to gauge how your app or game can best improve system health, particularly when used in conjunction with other Android Dynamic Performance Framework (ADPF) APIs that detect thermal throttling.

By using CpuHeadroomParams and GpuHeadroomParams on supported devices, you can customize the time window used to compute the headroom and select between average or minimum resource availability. This can help you reduce your CPU or GPU resource usage accordingly, leading to better user experiences and improved battery life.

נגישות

ב-Android 16 נוספו ממשקי API ותכונות חדשים של נגישות שיכולים לעזור לכם להנגיש את האפליקציה לכל המשתמשים.

ממשקי API משופרים לנגישות

Android 16 adds additional APIs to enhance UI semantics that help improve consistency for users that rely on accessibility services, such as TalkBack.

Outline text for maximum text contrast

Users with low vision often have reduced contrast sensitivity, making it challenging to distinguish objects from their backgrounds. To help these users, Android 16 introduces outline text, replacing high contrast text, which draws a larger contrasting area around text to greatly improve legibility.

Android 16 contains new AccessibilityManager APIs to let your apps check or register a listener to see if this mode is enabled. This is primarily for UI Toolkits like Compose to offer a similar visual experience. If you maintain a UI Toolkit library or your app performs custom text rendering that bypasses the android.text.Layout class then you can use this to know when outline text is enabled.

Text with enhanced contrast before and after Android 16's new outline text accessibility feature

Duration added to TtsSpan

Android 16 extends TtsSpan with a TYPE_DURATION, consisting of ARG_HOURS, ARG_MINUTES, and ARG_SECONDS. This lets you directly annotate time duration, ensuring accurate and consistent text-to-speech output with services like TalkBack.

Support elements with multiple labels

Android currently allows UI elements to derive their accessibility label from another, and now offers the ability for multiple labels to be associated, a common scenario in web content. By introducing a list-based API within AccessibilityNodeInfo, Android can directly support these multi-label relationships. As part of this change, we've deprecated AccessibilityNodeInfo#setLabeledBy and #getLabeledBy in favor of #addLabeledBy, #removeLabeledBy, and #getLabeledByList.

Improved support for expandable elements

Android 16 adds accessibility APIs that allow you to convey the expanded or collapsed state of interactive elements, such as menus and expandable lists. By setting the expanded state using setExpandedState and dispatching TYPE_WINDOW_CONTENT_CHANGED AccessibilityEvents with a CONTENT_CHANGE_TYPE_EXPANDED content change type, you can ensure that screen readers like TalkBack announce state changes, providing a more intuitive and inclusive user experience.

Indeterminate ProgressBars

Android 16 adds RANGE_TYPE_INDETERMINATE, giving a way for you to expose RangeInfo for both determinate and indeterminate ProgressBar widgets, allowing services like TalkBack to more consistently provide feedback for progress indicators.

Tri-state CheckBox

The new AccessibilityNodeInfo getChecked and setChecked(int) methods in Android 16 now support a "partially checked" state in addition to "checked" and "unchecked." This replaces the deprecated boolean isChecked and setChecked(boolean).

Supplemental descriptions

When an accessibility service describes a ViewGroup, it combines content labels from its child views. If you provide a contentDescription for the ViewGroup, accessibility services assume you are also overriding the description of non-focusable child views. This can be problematic if you want to label things like a drop-down (for example, "Font Family") while preserving the current selection for accessibility (for example, "Roboto"). Android 16 adds setSupplementalDescription so you can provide text that provides information about a ViewGroup without overriding information from its children.

Required form fields

Android 16 adds setFieldRequired to AccessibilityNodeInfo so apps can tell an accessibility service that input to a form field is required. This is an important scenario for users filling out many types of forms, even things as simple as a required terms and conditions checkbox, helping users to consistently identify and quickly navigate between required fields.

הטלפון כקלט מיקרופון לשיחות קוליות עם מכשירי שמיעה בטכנולוגיית LEA

Android 16 adds the capability for users of LE Audio hearing aids to switch between the built-in microphones on the hearing aids and the microphone on their phone for voice calls. This can be helpful in noisy environments or other situations where the hearing aid's microphones might not perform well.

שליטה בעוצמת הקולות מהסביבה במכשירי שמיעה עם LEA

Android 16 adds the capability for users of LE Audio hearing aids to adjust the volume of ambient sound that is picked up by the hearing aid's microphones. This can be helpful in situations where background noise is too loud or too quiet.

מצלמה

ב-Android 16 יש תמיכה משופרת במשתמשים במצלמות מקצועיות, עם אפשרות לחשיפה אוטומטית היברידית ושינויים מדויקים בטמפרטורת הצבע ובגוון. מחוון חדש של מצב לילה עוזר לאפליקציה לדעת מתי לעבור למצב לילה ומתי לצאת ממנו במהלך צילום במצלמה. Intentפעולות חדשות מקלות על צילום תמונות עם תנועה, ואנחנו ממשיכים לשפר את תמונות ה-UltraHDR עם תמיכה בקידוד HEIC ופרמטרים חדשים מטיוטת התקן ISO 21496-1.

חשיפה אוטומטית היברידית

Android 16 向 Camera2 添加了新的混合自动曝光模式,让您可以手动控制曝光的特定方面,同时让自动曝光 (AE) 算法处理其余部分。您可以控制 ISO + AE曝光时间 + AE,与当前方法(您要么完全手动控制,要么完全依赖自动曝光)相比,可提供更大的灵活性。

fun setISOPriority() {
    // ... (Your existing code before the snippet) ...

    val availablePriorityModes = mStaticInfo.characteristics.get(
        CameraCharacteristics.CONTROL_AE_AVAILABLE_PRIORITY_MODES
    )

    // ... (Your existing code between the snippets) ...

    // Turn on AE mode to set priority mode
    reqBuilder.set(
        CaptureRequest.CONTROL_AE_MODE,
        CameraMetadata.CONTROL_AE_MODE_ON
    )
    reqBuilder.set(
        CaptureRequest.CONTROL_AE_PRIORITY_MODE,
        CameraMetadata.CONTROL_AE_PRIORITY_MODE_SENSOR_SENSITIVITY_PRIORITY
    )
    reqBuilder.set(
        CaptureRequest.SENSOR_SENSITIVITY,
        TEST_SENSITIVITY_VALUE
    )
    val request: CaptureRequest = reqBuilder.build()

    // ... (Your existing code after the snippet) ...
}

התאמות מדויקות של טמפרטורת הצבע והגוון

Android 16 adds camera support for fine color temperature and tint adjustments to better support professional video recording applications. In previous Android versions, you could control white balance settings through CONTROL_AWB_MODE, which contains options limited to a preset list, such as Incandescent, Cloudy, and Twilight. The COLOR_CORRECTION_MODE_CCT enables the use of COLOR_CORRECTION_COLOR_TEMPERATURE and COLOR_CORRECTION_COLOR_TINT for precise adjustments of white balance based on the correlated color temperature.

fun setCCT() {
    // ... (Your existing code before this point) ...

    val colorTemperatureRange: Range<Int> =
        mStaticInfo.characteristics[CameraCharacteristics.COLOR_CORRECTION_COLOR_TEMPERATURE_RANGE]

    // Set to manual mode to enable CCT mode
    reqBuilder[CaptureRequest.CONTROL_AWB_MODE] = CameraMetadata.CONTROL_AWB_MODE_OFF
    reqBuilder[CaptureRequest.COLOR_CORRECTION_MODE] = CameraMetadata.COLOR_CORRECTION_MODE_CCT
    reqBuilder[CaptureRequest.COLOR_CORRECTION_COLOR_TEMPERATURE] = 5000
    reqBuilder[CaptureRequest.COLOR_CORRECTION_COLOR_TINT] = 30

    val request: CaptureRequest = reqBuilder.build()

    // ... (Your existing code after this point) ...
}

The following examples show how a photo would look after applying different color temperature and tint adjustments:

The original image with no color temperature or tint adjustments applied.
The image with color temperature adjusted to 3000.
The image with color temperature adjusted to 7000.


The image with tint levels lowered by 50.
The image with tint levels raised by 50.

זיהוי סצנות במצב לילה במצלמה

To help your app know when to switch to and from a night mode camera session, Android 16 adds EXTENSION_NIGHT_MODE_INDICATOR. If supported, it's available in the CaptureResult within Camera2.

This is the API we briefly mentioned as coming soon in the How Instagram enabled users to take stunning low light photos blog post. That post is a practical guide on how to implement night mode together with a case study that links higher-quality in-app night mode photos with an increase in the number of photos shared from the in-app camera.

פעולות Intent לצילום תמונות עם תנועה

Android 16 添加了标准 intent 操作 ACTION_MOTION_PHOTO_CAPTUREACTION_MOTION_PHOTO_CAPTURE_SECURE,用于请求相机应用拍摄动态照片并将其返回。

您必须传递额外的 EXTRA_OUTPUT 来控制将图片写入的位置,或者通过 Intent.setClipData(ClipData) 传递 Uri。如果您未设置 ClipData,系统会在调用 Context.startActivity(Intent) 时将其复制到该位置。

动态照片示例,显示静态图片和动态播放画面。

שיפורים בתמונות UltraHDR

标准动态范围 (SDR) 与高动态范围 (HDR) 图片质量对比示意图。

Android 16 继续致力于通过 UltraHDR 图片提供出色的图片质量。它添加了对 HEIC 文件格式的 UltraHDR 图片的支持。这些图片将获得 ImageFormat 类型 HEIC_ULTRAHDR,并包含类似于现有 UltraHDR JPEG 格式的嵌入式增益图。我们还在努力为 UltraHDR 添加 AVIF 支持,敬请期待。

此外,Android 16 在 UltraHDR 中实现了 ISO 21496-1 草稿标准中的其他参数,包括能够获取和设置应应用增益图算法的色彩空间,以及支持使用 SDR 增益图的 HDR 编码基础图片。

גרפיקה

‫Android 16 כולל את השיפורים האחרונים בגרפיקה, כמו אפקטים גרפיים מותאמים אישית עם AGSL.

אפקטים גרפיים בהתאמה אישית באמצעות AGSL

Android 16 adds RuntimeColorFilter and RuntimeXfermode, allowing you to author complex effects like Threshold, Sepia, and Hue Saturation and apply them to draw calls. Since Android 13, you've been able to use AGSL to create custom RuntimeShaders that extend Shader. The new API mirrors this, adding an AGSL-powered RuntimeColorFilter that extends ColorFilter, and a Xfermode effect that lets you implement AGSL-based custom compositing and blending between source and destination pixels.

private val thresholdEffectString = """
    uniform half threshold;

    half4 main(half4 c) {
        half luminosity = dot(c.rgb, half3(0.2126, 0.7152, 0.0722));
        half bw = step(threshold, luminosity);
        return bw.xxx1 * c.a;
    }"""

fun setCustomColorFilter(paint: Paint) {
   val filter = RuntimeColorFilter(thresholdEffectString)
   filter.setFloatUniform(0.5);
   paint.colorFilter = filter
}

קישוריות

ב-Android 16, הפלטפורמה מתעדכנת כדי לתת לאפליקציה שלכם גישה לחידושים האחרונים בטכנולוגיות תקשורת וטכנולוגיות אלחוטיות.

טווח עם אבטחה משופרת

Android 16 adds support for robust security features in Wi-Fi location on supported devices with Wi-Fi 6's 802.11az, allowing apps to combine the higher accuracy, greater scalability, and dynamic scheduling of the protocol with security enhancements including AES-256-based encryption and protection against MITM attacks. This allows it to be used more safely in proximity use cases, such as unlocking a laptop or a vehicle door. 802.11az is integrated with the Wi-Fi 6 standard, leveraging its infrastructure and capabilities for wider adoption and easier deployment.

Generic ranging APIs

Android 16 includes the new RangingManager, which provides ways to determine the distance and angle on supported hardware between the local device and a remote device. RangingManager supports the usage of a variety of ranging technologies such as BLE channel sounding, BLE RSSI-based ranging, Ultra Wideband, and Wi-Fi round trip time.

נוכחות של מכשיר נלווה

In Android 16, new APIs are being introduced for binding your companion app service. Service will be bound when BLE is in range and Bluetooth is connected and service will be unbound when BLE is out of range or Bluetooth is disconnected. App will receives a new 'onDevicePresenceEvent()' callback based on various of DevicePresenceEvent. More details can be found in 'startObservingDevicePresence(ObservingDevicePresenceRequest)'.

מדיה

‫Android 16 כולל מגוון תכונות שמשפרות את חוויית המדיה.

שיפורים בכלי לבחירת תמונות

照片选择器为用户提供了一种安全的内置授权方式,让用户可以向应用授予对本地存储空间和云端存储空间中所选图片和视频的访问权限,而不是对整个媒体库的访问权限。通过 Google 系统更新Google Play 服务组合使用模块化系统组件,该工具向后支持到 Android 4.4(API 级别 19)。只需几行代码即可与相关的 Android Jetpack 库集成。

Android 16 对照片选择器进行了以下改进:

  • 嵌入式照片选择器新 API,可让应用将照片选择器嵌入其视图层次结构中。这样,它就感觉像是应用中更为集成的一部分,同时仍可利用进程隔离功能,让用户能够选择媒体,而无需应用拥有过于宽泛的权限。为了最大限度地提高跨平台版本的兼容性并简化集成,如果您想集成嵌入式照片选择器,则需要使用即将推出的 Android Jetpack 库。
  • 照片选择器中的云搜索新的 API 可让 Android 照片选择器从云端媒体提供商中进行搜索。照片选择器中的搜索功能即将推出。

סרטונים מקצועיים מתקדמים

ב-Android 16 נוספה תמיכה בקודק Advanced Professional Video‏ (APV), שנועד לשימוש ברמה מקצועית להקלטת וידאו באיכות גבוהה ולפוסט-פרודקשן.

תקן הקודק APV כולל את התכונות הבאות:

  • איכות וידאו ללא אובדן מידע נתפס (קרוב לאיכות וידאו גולמי)
  • קידוד בתוך פריים בלבד (ללא חיזוי של תחום הפיקסלים) עם מורכבות נמוכה ונתונים רבים, כדי לתמוך טוב יותר בתהליכי עבודה של עריכה
  • תמיכה בטווח של קצב ביט גבוה עד כמה Gbps לתוכן ברזולוציות 2K, ‏ 4K ו-8K, באמצעות סכימה קלה של קידוד אנטרופי
  • יצירת משבצות של פריימים לתוכן immersive ולאפשרות קידוד ופענוח במקביל
  • תמיכה בפורמטים שונים של דגימת צבע ובעומק ביט שונים
  • תמיכה במספר פענוחים וקידוד מחדש ללא פגיעה משמעותית באיכות החזותית
  • תמיכה בסרטונים של צפייה בכמה משחקים בו-זמנית ובסרטונים משניים כמו סרטוני עומק, סרטוני אלפא וסרטוני תצוגה מקדימה
  • תמיכה ב-HDR10/10+ ובמטא-נתונים מוגדרים על ידי משתמשים

יישום עזר של APV זמין דרך פרויקט OpenAPV. ב-Android 16 תהיה תמיכה בפרופיל APV 422-10, שמספק דגימת צבע YUV 422 עם קידוד 10 ביט, וקצב נתונים יעד של עד 2Gbps.

פרטיות

‫Android 16 כולל מגוון תכונות שעוזרות למפתחי אפליקציות להגן על פרטיות המשתמשים.

עדכונים של Health Connect

Health Connect 添加了 ACTIVITY_INTENSITY,这是一种根据世界卫生组织关于中等强度和剧烈强度活动的指南定义的数据类型。每个记录都需要提供开始时间、结束时间以及活动强度(中等或剧烈)。

Health Connect 还包含支持医疗记录的更新版 API。这样一来,应用便可在征得用户明确同意的情况下,读取和写入 FHIR 格式的医疗记录。

ארגז החול לפרטיות ב-Android

Android 16 incorporates the latest version of the Privacy Sandbox on Android, part of our ongoing work to develop technologies where users know their privacy is protected. Our website has more about the Privacy Sandbox on Android developer beta program to help you get started. Check out the SDK Runtime which allows SDKs to run in a dedicated runtime environment separate from the app they are serving, providing stronger safeguards around user data collection and sharing.

אבטחה

‫Android 16 כולל תכונות שעוזרות לשפר את האבטחה של האפליקציה ולהגן על הנתונים שלה.

Key sharing API

Android 16 adds APIs that support sharing access to Android Keystore keys with other apps. The new KeyStoreManager class supports granting and revoking access to keys by app uid, and includes an API for apps to access shared keys.

גורמי צורה של מכשירים

‫Android 16 מספק לאפליקציות שלכם תמיכה כדי להפיק את המרב מגורמי הצורה של Android.

מסגרת תקנים לאיכות התמונה והאודיו בטלוויזיות

The new MediaQuality package in Android 16 exposes a set of standardized APIs for access to audio and picture profiles and hardware-related settings. This allows streaming apps to query profiles and apply them to media dynamically:

  • Movies mastered with a wider dynamic range require greater color accuracy to see subtle details in shadows and adjust to ambient light, so a profile that prefers color accuracy over brightness may be appropriate.
  • Live sporting events are often mastered with a narrow dynamic range, but are often watched in daylight, so a profile that preferences brightness over color accuracy can give better results.
  • Fully interactive content wants minimal processing to reduce latency, and wants higher frame rates, which is why many TV's ship with a game profile.

The API allows apps to switch between profiles and users to enjoy tuning supported TVs to best suit their content.

אינטרנציונליזציה

ב-Android 16 נוספו תכונות ויכולות שמשלימות את חוויית המשתמש כשמשתמשים במכשיר בשפות שונות.

טקסט אנכי

Android 16 adds low-level support for rendering and measuring text vertically to provide foundational vertical writing support for library developers. This is particularly useful for languages like Japanese that commonly use vertical writing systems. A new flag, VERTICAL_TEXT_FLAG, has been added to the Paint class. When this flag is set using Paint.setFlags, Paint's text measurement APIs will report vertical advances instead of horizontal advances, and Canvas will draw text vertically.

val text = "「春は、曙。」"
Box(
    Modifier.padding(innerPadding).background(Color.White).fillMaxSize().drawWithContent {
        drawIntoCanvas { canvas ->
            val paint = Paint().apply { textSize = 64.sp.toPx() }
            // Draw text vertically
            paint.flags = paint.flags or VERTICAL_TEXT_FLAG
            val height = paint.measureText(text)
            canvas.nativeCanvas.drawText(
                text,
                0,
                text.length,
                size.width / 2,
                (size.height - height) / 2,
                paint
            )
        }
    }
) {}

התאמה אישית של שיטת המדידה

用户现在可以在“设置”中的地区偏好设置中自定义测量系统。用户偏好设置包含在语言区域代码中,因此您可以在 ACTION_LOCALE_CHANGED 上注册 BroadcastReceiver,以便在地区偏好设置发生更改时处理语言区域配置更改。

使用格式设置程序有助于提供符合当地体验的服务。例如,对于将手机设置为英语(丹麦)或将手机设置为英语(美国)并将公制作为首选测量系统的用户,“0.5 in”的英语(美国)对应于“12,7 mm”。

如需找到这些设置,请打开“设置”应用,然后依次前往系统 > 语言和地区