Tổng quan về các tính năng và API

Android 15 mang đến cho nhà phát triển các tính năng và API mới tuyệt vời. Các phần sau đây tóm tắt các tính năng này để giúp bạn bắt đầu sử dụng các API liên quan.

Để biết danh sách chi tiết về các API mới, đã được sửa đổi, cũng như đã bị xoá, hãy đọc báo cáo điểm khác biệt về API. Để biết thông tin chi tiết về các API mới, hãy truy cập tài liệu tham khảo về API cho Android (các API mới được trình bày nổi bật). Ngoài ra, để tìm hiểu về những khía cạnh mà thay đổi của nền tảng có thể ảnh hưởng đến ứng dụng của bạn, hãy nhớ tham khảo các thay đổi về hành vi trên Android 15 ảnh hưởng đến ứng dụng khi ứng dụng nhắm đến Android 15các thay đổi về hành vi ảnh hưởng đến tất cả ứng dụng bất kể targetSdkVersion.

Máy ảnh và nội dung nghe nhìn

Android 15 có nhiều tính năng giúp cải thiện trải nghiệm máy ảnh và nội dung đa phương tiện, đồng thời cho phép bạn sử dụng các công cụ và phần cứng để hỗ trợ nhà sáng tạo hiện thực hoá tầm nhìn của mình trên Android.

Để biết thêm thông tin về các tính năng cũng như giải pháp mới nhất dành cho nhà phát triển cho nội dung nghe nhìn và máy ảnh Android, hãy xem bài nói chuyện Xây dựng trải nghiệm máy ảnh và nội dung nghe nhìn Android hiện đại của Google I/O.

Tăng cường ánh sáng yếu

Android 15 introduces Low Light Boost, an auto-exposure mode available to both Camera 2 and the night mode camera extension. Low Light Boost adjusts the exposure of the Preview stream in low-light conditions. This is different from how the night mode camera extension creates still images, because night mode combines a burst of photos to create a single, enhanced image. While night mode works very well for creating a still image, it can't create a continuous stream of frames, but Low Light Boost can. Thus, Low Light Boost enables camera capabilities, such as:

  • Providing an enhanced image preview, so users are better able to frame their low-light pictures
  • Scanning QR codes in low light

If you enable Low Light Boost, it automatically turns on when there's a low light level, and turns off when there's more light.

Apps can record off the Preview stream in low-light conditions to save a brightened video.

For more information, see Low Light Boost.

Điều khiển máy ảnh trong ứng dụng

Android 15 添加了一个新扩展,用于在支持的设备上更好地控制相机硬件及其算法:

  • 高级闪光灯强度调整,可让您在拍摄照片时精确控制 SINGLETORCH 模式下的闪光强度。

Điều khiển khoảng trần HDR

Android 15 chooses HDR headroom that is appropriate for the underlying device capabilities and bit-depth of the panel. For pages that have lots of SDR content, such as a messaging app displaying a single HDR thumbnail, this behavior can end up adversely influencing the perceived brightness of the SDR content. Android 15 lets you control the HDR headroom with setDesiredHdrHeadroom to strike a balance between SDR and HDR content.

The brightness of SDR UI elements on the left screen appears to be more uniform than the brightness on the right screen, which simulates possible headroom issues when HDR and SDR content are mixed. By adjusting the HDR headroom, you can achieve a better balance between the SDR and HDR content.

Kiểm soát âm lượng

Android 15 hỗ trợ cho Tiêu chuẩn độ lớn CTA-2075 để trợ giúp bạn tránh sự không thống nhất về độ ồn của âm thanh và đảm bảo người dùng không phải liên tục điều chỉnh âm lượng khi chuyển đổi giữa các nội dung. Hệ thống tận dụng các đặc điểm đã biết của thiết bị đầu ra (tai nghe và loa) cùng với siêu dữ liệu về độ to trong nội dung âm thanh AAC để điều chỉnh độ to của âm thanh và mức độ nén phạm vi động một cách thông minh.

Để bật tính năng này, bạn cần đảm bảo siêu dữ liệu về độ to trong nội dung AAC và bật tính năng nền tảng trong ứng dụng. Để thực hiện việc này, bạn tạo bản sao của đối tượng LoudnessCodecController bằng cách gọi phương thức nhà máy create của đối tượng đó với mã phiên âm thanh từ AudioTrack được liên kết; thao tác này sẽ tự động bắt đầu áp dụng các bản cập nhật âm thanh. Bạn có thể truyền một OnLoudnessCodecUpdateListener để sửa đổi hoặc lọc các thông số âm lượng trước khi áp dụng các thông số đó trên MediaCodec.

// Media contains metadata of type MPEG_4 OR MPEG_D
val mediaCodec = 
val audioTrack = AudioTrack.Builder()
                                .setSessionId(sessionId)
                                .build()
...
// Create new loudness controller that applies the parameters to the MediaCodec
try {
   val lcController = LoudnessCodecController.create(mSessionId)
   // Starts applying audio updates for each added MediaCodec
}

AndroidX media3 ExoPlayer cũng sẽ được cập nhật để sử dụng Các API LoudnessCodecController để tích hợp liền mạch ứng dụng.

Thiết bị MIDI 2.0 ảo

Android 13 hỗ trợ thêm tính năng kết nối với Thiết bị MIDI 2.0 sử dụng USB, giao tiếp bằng Gói MIDI chung (UMP). Android 15 mở rộng tính năng hỗ trợ UMP cho các ứng dụng MIDI ảo, cho phép các ứng dụng sáng tác điều khiển các ứng dụng tổng hợp dưới dạng thiết bị MIDI 2.0 ảo giống như khi sử dụng thiết bị USB MIDI 2.0.

Giải mã phần mềm AV1 hiệu quả hơn

dav1d logo

dav1d, the popular AV1 software decoder from VideoLAN is available for Android devices that don't support AV1 decode in hardware. dav1d is up to 3x more performant than the legacy AV1 software decoder, enabling HD AV1 playback for more users, including some low and mid tier devices.

Your app needs to opt-in to using dav1d by invoking it by name "c2.android.av1-dav1d.decoder". dav1d will be made the default AV1 software decoder in a subsequent update. This support is standardized and backported to Android 11 devices that receive Google Play system updates.

Năng suất và công cụ dành cho nhà phát triển

Mặc dù hầu hết nỗ lực của chúng tôi là cải thiện các trung tâm năng suất cho bạn xoay quanh các công cụ như Android Studio, Jetpack Compose và thư viện Android Jetpack, nhưng chúng tôi luôn tìm cách trong nền tảng này để giúp bạn dễ dàng hiện thực hoá tầm nhìn của mình.

Nội dung cập nhật OpenJDK 17

Android 15 会继续更新 Android 的核心库,以与最新 OpenJDK LTS 版本中的功能保持一致。

其中包含以下主要功能和改进:

这些 API 通过 Google Play 系统更新在超过 10 亿台搭载 Android 12(API 级别 31)及更高版本的设备上进行了更新,让您能够以最新的编程功能为目标平台。

Cải tiến về PDF

Android 15 includes substantial improvements to the PdfRenderer APIs. Apps can incorporate advanced features such as rendering password-protected files, annotations, form editing, searching, and selection with copy. Linearized PDF optimizations are supported to speed local PDF viewing and reduce resource use. The Jetpack PDF library uses these APIs to simplify adding PDF viewing capabilities to your app.

The latest updates to PDF rendering include features such as searching an embedded PDF file.

The PdfRenderer has been moved to a module that can be updated using Google Play system updates independent of the platform release, and we're supporting these changes back to Android 11 (API level 30) by creating a compatible pre-Android 15 version of the API surface, called PdfRendererPreV.

Tinh chỉnh chuyển đổi ngôn ngữ tự động

Android 14 增加了设备端音频中的多语言识别功能,可在语言之间自动切换,但这可能会导致单词丢失,尤其是在语言切换时,两种话语之间的停顿较少时。Android 15 添加了额外的控件,可帮助应用根据其用例调整此切换。EXTRA_LANGUAGE_SWITCH_INITIAL_ACTIVE_DURATION_TIME_MILLIS 会将自动切换限制为仅在音频会话开始时进行,而 EXTRA_LANGUAGE_SWITCH_MATCH_SWITCHES 则会在指定次数的切换后停用语言切换。如果您希望自动检测到会话期间只讲一种语言,这些选项特别有用。

Cải thiện API phông chữ biến OpenType

Android 15 cải thiện khả năng hữu dụng của phông chữ biến OpenType. Bạn có thể làm điều này ngay bây giờ tạo một thực thể FontFamily từ phông chữ biến mà không cần chỉ định trục trọng số bằng API buildVariableFamily. Trình kết xuất văn bản ghi đè giá trị của trục wght để khớp với văn bản đang hiển thị.

Việc sử dụng API mới sẽ giúp đơn giản hoá mã để tạo Typeface đáng kể:

Kotlin

val newTypeface = Typeface.CustomFallbackBuilder(
            FontFamily.Builder(
                Font.Builder(assets, "RobotoFlex.ttf").build())
                    .buildVariableFamily())
    .build()

Java

Typeface newTypeface = Typeface.CustomFallbackBuilder(
            new FontFamily.Builder(
                new Font.Builder(assets, "RobotoFlex.ttf").build())
                    .buildVariableFamily())
    .build();

Trước đây, để tạo cùng một Typeface, bạn sẽ cần nhiều mã hơn:

Kotlin

val oldTypeface = Typeface.CustomFallbackBuilder(
            FontFamily.Builder(
                Font.Builder(assets, "RobotoFlex.ttf")
                    .setFontVariationSettings("'wght' 400")
                    .setWeight(400)
                    .build())
                .addFont(
                    Font.Builder(assets, "RobotoFlex.ttf")
                        .setFontVariationSettings("'wght' 100")
                        .setWeight(100)
                        .build()
                )
                .addFont(
                    Font.Builder(assets, "RobotoFlex.ttf")
                        .setFontVariationSettings("'wght' 200")
                        .setWeight(200)
                        .build()
                )
                .addFont(
                    Font.Builder(assets, "RobotoFlex.ttf")
                        .setFontVariationSettings("'wght' 300")
                        .setWeight(300)
                        .build()
                )
                .addFont(
                    Font.Builder(assets, "RobotoFlex.ttf")
                        .setFontVariationSettings("'wght' 500")
                        .setWeight(500)
                        .build()
                )
                .addFont(
                    Font.Builder(assets, "RobotoFlex.ttf")
                        .setFontVariationSettings("'wght' 600")
                        .setWeight(600)
                        .build()
                )
                .addFont(
                    Font.Builder(assets, "RobotoFlex.ttf")
                        .setFontVariationSettings("'wght' 700")
                        .setWeight(700)
                        .build()
                )
                .addFont(
                    Font.Builder(assets, "RobotoFlex.ttf")
                        .setFontVariationSettings("'wght' 800")
                        .setWeight(800)
                        .build()
                )
                .addFont(
                    Font.Builder(assets, "RobotoFlex.ttf")
                        .setFontVariationSettings("'wght' 900")
                        .setWeight(900)
                        .build()
                ).build()
        ).build()

Java

Typeface oldTypeface = new Typeface.CustomFallbackBuilder(
    new FontFamily.Builder(
        new Font.Builder(assets, "RobotoFlex.ttf")
            .setFontVariationSettings("'wght' 400")
            .setWeight(400)
            .build()
    )
    .addFont(
        new Font.Builder(assets, "RobotoFlex.ttf")
            .setFontVariationSettings("'wght' 100")
            .setWeight(100)
            .build()
    )
    .addFont(
        new Font.Builder(assets, "RobotoFlex.ttf")
            .setFontVariationSettings("'wght' 200")
            .setWeight(200)
            .build()
    )
    .addFont(
        new Font.Builder(assets, "RobotoFlex.ttf")
            .setFontVariationSettings("'wght' 300")
            .setWeight(300)
            .build()
    )
    .addFont(
        new Font.Builder(assets, "RobotoFlex.ttf")
            .setFontVariationSettings("'wght' 500")
            .setWeight(500)
            .build()
    )
    .addFont(
        new Font.Builder(assets, "RobotoFlex.ttf")
            .setFontVariationSettings("'wght' 600")
            .setWeight(600)
            .build()
    )
    .addFont(
        new Font.Builder(assets, "RobotoFlex.ttf")
            .setFontVariationSettings("'wght' 700")
            .setWeight(700)
            .build()
    )
    .addFont(
        new Font.Builder(assets, "RobotoFlex.ttf")
            .setFontVariationSettings("'wght' 800")
            .setWeight(800)
            .build()
    )
    .addFont(
        new Font.Builder(assets, "RobotoFlex.ttf")
            .setFontVariationSettings("'wght' 900")
            .setWeight(900)
            .build()
    )
    .build()
).build();

Dưới đây là ví dụ về cách một Typeface được tạo bằng cả API cũ và mới hiển thị:

Một ví dụ về sự khác biệt giữa quá trình kết xuất Phông chữ khi sử dụng kiểu kết xuất mới và cũ
API

Trong ví dụ này, Typeface được tạo bằng API cũ không có cho phép tạo độ đậm phông chữ chính xác cho cỡ chữ 350, 450, 550 và 650. Font để trình kết xuất sẽ quay lại trọng số gần nhất. Do đó, trong trong trường hợp này, 300 sẽ được kết xuất thay vì 350, 400 được kết xuất thay vì 450 và v.v. Ngược lại, Typeface được tạo bằng các API mới sẽ tự động tạo thực thể Font cho một trọng số nhất định, do đó trọng số chính xác được hiển thị là 350, 450, 550 và 650.

Kiểm soát ngắt dòng chi tiết

Kể từ Android 15, TextView và cơ sở dấu ngắt dòng có thể giữ nguyên phần văn bản đã cho trong cùng một dòng để cải thiện dễ đọc. Bạn có thể tận dụng khả năng tuỳ chỉnh ngắt dòng này bằng cách sử dụng thẻ <nobreak> trong tài nguyên chuỗi hoặc createNoBreakSpan. Tương tự, bạn có thể giữ nguyên các từ dấu gạch nối bằng cách sử dụng thẻ <nohyphen> hoặc createNoHyphenationSpan.

Ví dụ: tài nguyên chuỗi sau đây không bao gồm ngắt dòng và hiển thị với văn bản "Pixel 8 Pro". đột nhập ở nơi không mong muốn:

<resources>
    <string name="pixel8pro">The power and brains behind Pixel 8 Pro.</string>
</resources>

Ngược lại, tài nguyên chuỗi này bao gồm thẻ <nobreak>, thẻ này gói cụm từ "Pixel 8 Pro". và tránh bị ngắt dòng:

<resources>
    <string name="pixel8pro">The power and brains behind <nobreak>Pixel 8 Pro.</nobreak></string>
</resources>

Sự khác biệt về cách hiển thị các chuỗi này được thể hiện trong ví dụ sau hình ảnh:

Bố cục của một dòng văn bản có cụm từ "Pixel 8 Pro". không được gói bằng thẻ <nobreak>.
Bố cục cho cùng một dòng văn bản có cụm từ "Pixel 8 Pro". được gói bằng thẻ <nobreak>.

Lưu trữ ứng dụng

Android and Google Play announced support for app archiving last year, allowing users to free up space by partially removing infrequently used apps from the device that were published using Android App Bundle on Google Play. Android 15 includes OS level support for app archiving and unarchiving, making it easier for all app stores to implement it.

Apps with the REQUEST_DELETE_PACKAGES permission can call the PackageInstaller requestArchive method to request archiving an installed app package, which removes the APK and any cached files, but persists user data. Archived apps are returned as displayable apps through the LauncherApps APIs; users will see a UI treatment to highlight that those apps are archived. If a user taps on an archived app, the responsible installer will get a request to unarchive it, and the restoration process can be monitored by the ACTION_PACKAGE_ADDED broadcast.

Đồ hoạ

Android 15 mang đến những điểm cải tiến mới nhất về đồ hoạ, bao gồm cả ANGLE và các thành phần bổ sung cho hệ thống đồ hoạ Canvas.

Hiện đại hoá quyền truy cập vào GPU của Android

Vulkan logo

Android hardware has evolved quite a bit from the early days where the core OS would run on a single CPU and GPUs were accessed using APIs based on fixed-function pipelines. The Vulkan® graphics API has been available in the NDK since Android 7.0 (API level 24) with a lower-level abstraction that better reflects modern GPU hardware, scales better to support multiple CPU cores, and offers reduced CPU driver overhead — leading to improved app performance. Vulkan is supported by all modern game engines.

Vulkan is Android's preferred interface to the GPU. Therefore, Android 15 includes ANGLE as an optional layer for running OpenGL® ES on top of Vulkan. Moving to ANGLE will standardize the Android OpenGL implementation for improved compatibility, and, in some cases, improved performance. You can test out your OpenGL ES app stability and performance with ANGLE by enabling the developer option in Settings -> System -> Developer Options -> Experimental: Enable ANGLE on Android 15.

The Android ANGLE on Vulkan roadmap

Roadmap of upcoming changes to the Android GPU APIs.

As part of streamlining our GPU stack, going forward we will be shipping ANGLE as the GL system driver on more new devices, with the future expectation that OpenGL/ES will be only available through ANGLE. That being said, we plan to continue support for OpenGL ES on all devices.

Recommended next steps

Use the developer options to select the ANGLE driver for OpenGL ES and test your app. For new projects, we strongly encourage using Vulkan for C/C++.

Những điểm cải tiến cho Canvas

Android 15 tiếp tục hiện đại hoá hệ thống đồ hoạ Canvas của Android với các tính năng mới:

  • Matrix44 cung cấp ma trận 4x4 để biến đổi các toạ độ nên dùng khi bạn muốn điều khiển canvas ở chế độ 3D.
  • clipShader giao cắt đoạn video hiện tại với chương trình đổ bóng được chỉ định, trong khi clipOutShader đặt đối tượng cắt thành điểm khác biệt của đoạn video hiện tại và chương trình đổ bóng, mỗi chương trình coi chương trình đổ bóng là một mặt nạ alpha. Tính năng này hỗ trợ vẽ các hình dạng phức tạp một cách hiệu quả.

Hiệu suất và pin

Android tiếp tục tập trung vào việc giúp bạn cải thiện hiệu suất và chất lượng của các ứng dụng. Android 15 giới thiệu các API mới giúp thực thi, tối ưu hoá hiệu suất ứng dụng và thu thập thông tin chi tiết về ứng dụng một cách hiệu quả hơn.

Để biết các phương pháp hay nhất về tiết kiệm pin, gỡ lỗi mức sử dụng mạng và nguồn điện, cũng như thông tin chi tiết về cách chúng tôi cải thiện hiệu suất pin của công việc ở chế độ nền trong Android 15 và các phiên bản Android gần đây, hãy xem bài viết Cải thiện hiệu suất pin của công việc ở chế độ nền trên Android tại Google I/O.

API ApplicationStartInfo

In previous versions of Android, app startup has been a bit of a mystery. It was challenging to determine within your app whether it started from a cold, warm, or hot state. It was also difficult to know how long your app spent during the various launch phases: forking the process, calling onCreate, drawing the first frame, and more. When your Application class was instantiated, you had no way of knowing whether the app started from a broadcast, a content provider, a job, a backup, boot complete, an alarm, or an Activity.

The ApplicationStartInfo API on Android 15 provides all of this and more. You can even choose to add your own timestamps into the flow to help collect timing data in one place. In addition to collecting metrics, you can use ApplicationStartInfo to help directly optimize app startup; for example, you can eliminate the costly instantiation of UI-related libraries within your Application class when your app is starting up due to a broadcast.

Thông tin chi tiết về kích thước ứng dụng

Kể từ Android 8.0 (API cấp 26), Android đã bao gồm API StorageStats.getAppBytes nhằm tóm tắt kích thước cài đặt của một ứng dụng dưới dạng một số byte duy nhất, là tổng kích thước APK, kích thước của tệp được trích xuất từ APK và các tệp được tạo trên thiết bị như mã biên dịch trước khi chạy (AOT). Con số này chưa cho thấy nhiều thông tin chi tiết về cách ứng dụng của bạn đang sử dụng bộ nhớ.

Android 15 bổ sung API StorageStats.getAppBytesByDataType([type]), cho phép bạn nắm được thông tin chi tiết về cách ứng dụng đang sử dụng hết dung lượng đó, bao gồm cả việc phân tách tệp APK, mã AOT và tăng tốc, siêu dữ liệu dex, thư viện và hồ sơ có hướng dẫn.

Lập hồ sơ do ứng dụng quản lý

Android 15 包含 ProfilingManager 类,可让您从应用内部收集性能分析信息。我们计划使用 Android Jetpack API 封装此类,以简化性能分析请求的构建,但核心 API 将允许收集堆转储、堆分析报告、堆栈采样等。它会使用 提供的标记用于标识输出文件,该文件会传送到您应用的文件 目录。该 API 会进行速率限制,以尽可能降低对性能的影响。

Cải thiện cơ sở dữ liệu SQLite

Android 15 introduces SQLite APIs that expose advanced features from the underlying SQLite engine that target specific performance issues that can manifest in apps.

Developers should consult best practices for SQLite performance to get the most out of their SQLite database, especially when working with large databases or when running latency-sensitive queries.

  • Read-only deferred transactions: when issuing transactions that are read-only (don't include write statements), use beginTransactionReadOnly() and beginTransactionWithListenerReadOnly(SQLiteTransactionListener) to issue read-only DEFERRED transactions. Such transactions can run concurrently with each other, and if the database is in WAL mode, they can run concurrently with IMMEDIATE or EXCLUSIVE transactions.
  • Row counts and IDs: APIs were added to retrieve the count of changed rows or the last inserted row ID without issuing an additional query. getLastChangedRowCount() returns the number of rows that were inserted, updated, or deleted by the most recent SQL statement within the current transaction, while getTotalChangedRowCount() returns the count on the current connection. getLastInsertRowId() returns the rowid of the last row to be inserted on the current connection.
  • Raw statements: issue a raw SQlite statement, bypassing convenience wrappers and any additional processing overhead that they may incur.

Bản cập nhật Android Dynamic Performance Framework

Android 15 继续投资开发 Android 动态性能框架 (ADPF),这是一组 API,可让游戏和性能密集型应用更直接地与 Android 设备的电源和散热系统进行互动。在受支持的设备上,Android 15 将添加新的 ADPF 功能:

  • 适用于提示会话的节能模式,用于指明其关联的线程应该优先考虑节能而非性能,非常适合长时间运行的后台工作负载。
  • 可以在提示会话中报告 GPU 和 CPU 的运行时长,从而使系统能够同时调整 CPU 和 GPU 频率,以便更好地满足工作负载需求。
  • 热余量阈值,用于根据余量预测来解释可能的热节流状态。

如需详细了解如何在应用和游戏中使用 ADPF,请参阅相关文档

Quyền riêng tư

Android 15 cung cấp nhiều tính năng giúp nhà phát triển ứng dụng bảo vệ quyền riêng tư của người dùng.

Phát hiện video ghi màn hình

Android 15 adds support for apps to detect that they are being recorded. A callback is invoked whenever the app transitions between being visible or invisible within a screen recording. An app is considered visible if activities owned by the registering process's UID are being recorded. This way, if your app is performing a sensitive operation, you can inform the user that they're being recorded.

val mCallback = Consumer<Int> { state ->
  if (state == SCREEN_RECORDING_STATE_VISIBLE) {
    // We're being recorded
  } else {
    // We're not being recorded
  }
}

override fun onStart() {
   super.onStart()
   val initialState =
      windowManager.addScreenRecordingCallback(mainExecutor, mCallback)
   mCallback.accept(initialState)
}

override fun onStop() {
    super.onStop()
    windowManager.removeScreenRecordingCallback(mCallback)
}

Mở rộng các chức năng của IntentFilter

Bản dựng Android 15 hỗ trợ độ phân giải Intent chính xác hơn thông qua UriRelativeFilterGroup, chứa tập hợp Các đối tượng UriRelativeFilter tạo thành một tập hợp Intent quy tắc so khớp phải được đáp ứng, bao gồm cả tham số truy vấn URL, URL mảnh và quy tắc chặn hoặc loại trừ.

Bạn có thể xác định các quy tắc này trong tệp XML AndroidManifest bằng <uri-relative-filter-group>, có thể tuỳ ý bao gồm Thẻ android:allow. Các thẻ này có thể chứa <data> thẻ sử dụng dữ liệu hiện có cũng như thuộc tính thẻ android:queryandroid:fragment mới .

Dưới đây là ví dụ về cú pháp AndroidManifest:

<intent-filter>
  <action android:name="android.intent.action.VIEW" />
  <category android:name="android.intent.category.BROWSABLE" />
  <data android:scheme="http" />
  <data android:scheme="https" />
  <data android:domain="astore.com" />
  <uri-relative-filter-group>
    <data android:pathPrefix="/auth" />
    <data android:query="region=na" />
  </uri-relative-filter-group>
  <uri-relative-filter-group android:allow="false">
    <data android:pathPrefix="/auth" />
    <data android:query="mobileoptout=true" />
  </uri-relative-filter-group>
  <uri-relative-filter-group android:allow="false">
    <data android:pathPrefix="/auth" />
    <data android:fragmentPrefix="faq" />
  </uri-relative-filter-group>
</intent-filter>

Không gian riêng tư

The private space can be unlocked and locked to show or hide sensitive apps on a device.

Private space lets users create a separate space on their device where they can keep sensitive apps away from prying eyes, under an additional layer of authentication. The private space uses a separate user profile. The user can choose to use the device lock or a separate lock factor for the private space.

Apps in the private space show up in a separate container in the launcher, and are hidden from the recents view, notifications, settings, and from other apps when the private space is locked. User-generated and downloaded content (such as media or files) and accounts are separated between the private space and the main space. The system sharesheet and the photo picker can be used to give apps access to content across spaces when the private space is unlocked.

Users can't move existing apps and their data into the private space. Instead, users select an install option in the private space to install an app using whichever app store they prefer. Apps in the private space are installed as separate copies from any apps in the main space (new copies of the same app).

When a user locks the private space, the profile is stopped. While the profile is stopped, apps in the private space are no longer active and can't perform foreground or background activities, including showing notifications.

We recommend that you test your app with private space to make sure your app works as expected, especially if your app falls into one of the following categories:

Truy vấn lựa chọn gần đây nhất của người dùng về Quyền truy cập vào ảnh đã chọn

Apps can now highlight only the most-recently-selected photos and videos when partial access to media permissions is granted. This feature can improve the user experience for apps that frequently request access to photos and videos. To use this feature in your app, enable the QUERY_ARG_LATEST_SELECTION_ONLY argument when querying MediaStore through ContentResolver.

Kotlin

val externalContentUri = MediaStore.Files.getContentUri("external")

val mediaColumns = arrayOf(
   FileColumns._ID,
   FileColumns.DISPLAY_NAME,
   FileColumns.MIME_TYPE,
)

val queryArgs = bundleOf(
   // Return only items from the last selection (selected photos access)
   QUERY_ARG_LATEST_SELECTION_ONLY to true,
   // Sort returned items chronologically based on when they were added to the device's storage
   QUERY_ARG_SQL_SORT_ORDER to "${FileColumns.DATE_ADDED} DESC",
   QUERY_ARG_SQL_SELECTION to "${FileColumns.MEDIA_TYPE} = ? OR ${FileColumns.MEDIA_TYPE} = ?",
   QUERY_ARG_SQL_SELECTION_ARGS to arrayOf(
       FileColumns.MEDIA_TYPE_IMAGE.toString(),
       FileColumns.MEDIA_TYPE_VIDEO.toString()
   )
)

Java

Uri externalContentUri = MediaStore.Files.getContentUri("external");

String[] mediaColumns = {
    FileColumns._ID,
    FileColumns.DISPLAY_NAME,
    FileColumns.MIME_TYPE
};

Bundle queryArgs = new Bundle();
queryArgs.putBoolean(MediaStore.QUERY_ARG_LATEST_SELECTION_ONLY, true);
queryArgs.putString(MediaStore.QUERY_ARG_SQL_SORT_ORDER, FileColumns.DATE_ADDED + " DESC");
queryArgs.putString(MediaStore.QUERY_ARG_SQL_SELECTION, FileColumns.MEDIA_TYPE + " = ? OR " + FileColumns.MEDIA_TYPE + " = ?");
queryArgs.putStringArray(MediaStore.QUERY_ARG_SQL_SELECTION_ARGS, new String[] {
    String.valueOf(FileColumns.MEDIA_TYPE_IMAGE),
    String.valueOf(FileColumns.MEDIA_TYPE_VIDEO)
});

Hộp cát về quyền riêng tư trên Android

Android 15 bao gồm các tiện ích Dịch vụ quảng cáo Android mới nhất, kết hợp với phiên bản mới nhất của Hộp cát về quyền riêng tư trên Android. Việc bổ sung này là một phần trong nỗ lực của chúng tôi nhằm phát triển các công nghệ mới giúp cải thiện quyền riêng tư của người dùng và mang lại trải nghiệm quảng cáo được cá nhân hoá hiệu quả cho các ứng dụng di động. Trang hộp cát về quyền riêng tư của chúng tôi có thêm thông tin về Bản dùng thử cho nhà phát triển và các chương trình beta của Hộp cát về quyền riêng tư trên Android để giúp bạn bắt đầu.

Health Connect

Android 15 tích hợp các tiện ích mới nhất Health Connect của Android, một ứng dụng bảo mật và tập trung để quản lý và chia sẻ dữ liệu sức khoẻ và thể chất do ứng dụng thu thập. Thông tin cập nhật này thêm tính năng hỗ trợ cho các loại dữ liệu khác về tính năng thể dục, dinh dưỡng, nhiệt độ trên da, kế hoạch tập luyện, v.v.

Tính năng theo dõi nhiệt độ trên da giúp người dùng lưu trữ và chia sẻ thông tin chính xác hơn dữ liệu về nhiệt độ từ thiết bị đeo hoặc thiết bị theo dõi khác.

Kế hoạch tập luyện là kế hoạch tập thể dục có cấu trúc để giúp người dùng đạt được mục tiêu về thể chất. Hỗ trợ kế hoạch tập luyện bao gồm nhiều mục tiêu về hiệu suất và hoàn thành:

Tìm hiểu thêm về các bản cập nhật mới nhất cho Health Connect trong Android trong bài nói chuyện Tạo trải nghiệm thích ứng bằng Android Health tại Google I/O.

Chia sẻ một phần màn hình

Android 15 supports partial screen sharing so users can share or record just an app window rather than the entire device screen. This feature, first enabled in Android 14 QPR2, includes MediaProjection callbacks that allow your app to customize the partial screen sharing experience. Note that for apps targeting Android 14 (API level 34) or higher, user consent is required for each MediaProjection capture session.

Trải nghiệm người dùng và giao diện người dùng hệ thống

Android 15 trao cho nhà phát triển ứng dụng và người dùng nhiều quyền kiểm soát cũng như sự linh hoạt hơn để định cấu hình thiết bị cho phù hợp với nhu cầu của họ.

Để tìm hiểu thêm về cách sử dụng các điểm cải tiến mới nhất trong Android 15 nhằm cải thiện trải nghiệm người dùng trên ứng dụng, hãy xem bài viết Cải thiện trải nghiệm người dùng của ứng dụng Android tại Google I/O.

Xem trước tiện ích phong phú hơn với Generated Previews API

Trước Android 15, cách duy nhất để cung cấp bản xem trước bộ chọn tiện ích là chỉ định tài nguyên hình ảnh hoặc bố cục tĩnh. Các bản xem trước này thường khác nhau đáng kể so với giao diện của tiện ích thực tế khi tiện ích được đặt trên trang chủ màn hình. Ngoài ra, không thể tạo tài nguyên tĩnh bằng Jetpack Glance, vì vậy tính năng Glance nhà phát triển phải chụp ảnh màn hình tiện ích của họ hoặc tạo bố cục XML để có một bản xem trước tiện ích.

Android 15 bổ sung tính năng hỗ trợ cho bản xem trước đã tạo. Điều này có nghĩa là tiện ích ứng dụng thay vào đó, nhà cung cấp có thể tạo RemoteViews để dùng làm bản xem trước của bộ chọn của một tài nguyên tĩnh.

Các ứng dụng có thể cung cấp Chế độ xem từ xa cho Bộ chọn tiện ích để có thể cập nhật nội dung trong bộ chọn để thể hiện chính xác hơn nội dung mà người dùng sẽ thấy.

API Đẩy

Các ứng dụng có thể cung cấp bản xem trước được tạo thông qua API đẩy. Các ứng dụng có thể cung cấp bản xem trước tại bất kỳ thời điểm nào trong vòng đời và không nhận được yêu cầu rõ ràng từ máy chủ để cung cấp bản xem trước. Bản xem trước vẫn tồn tại trong AppWidgetService, và người tổ chức có thể yêu cầu các quảng cáo đó theo yêu cầu. Ví dụ sau đây tải một tiện ích XML tài nguyên bố cục và đặt tài nguyên đó làm bản xem trước:

AppWidgetManager.getInstance(appContext).setWidgetPreview(
   ComponentName(
       appContext,
       SociaLiteAppWidgetReceiver::class.java
   ),
   AppWidgetProviderInfo.WIDGET_CATEGORY_HOME_SCREEN,
   RemoteViews("com.example", R.layout.widget_preview)
)

Luồng dự kiến là:

  1. Nhà cung cấp tiện ích sẽ gọi setWidgetPreview bất cứ lúc nào. Các bản xem trước vẫn tồn tại trong AppWidgetService kèm theo thông tin khác về nhà cung cấp.
  2. setWidgetPreview thông báo cho máy chủ về bản xem trước đã cập nhật thông qua Lệnh gọi lại AppWidgetHost.onProvidersChanged. Để đáp lại, tiện ích này máy chủ lưu trữ tải lại tất cả thông tin về nhà cung cấp của nó.
  3. Khi hiển thị bản xem trước của tiện ích, máy chủ lưu trữ sẽ kiểm tra AppWidgetProviderInfo.generatedPreviewCategories và nếu được chọn có sẵn danh mục, hãy gọi AppWidgetManager.getWidgetPreview tới trả về bản xem trước đã lưu cho ứng dụng nhà cung cấp này.

Thời điểm gọi setWidgetPreview

Do không có lệnh gọi lại để cung cấp bản xem trước, ứng dụng có thể chọn gửi bản xem trước bất kỳ lúc nào khi chúng đang chạy. Tần suất cập nhật bản xem trước phụ thuộc vào trường hợp sử dụng tiện ích.

Danh sách sau đây mô tả hai danh mục chính của trường hợp sử dụng bản xem trước:

  • Những nhà cung cấp cho thấy dữ liệu thực trong bản xem trước tiện ích, chẳng hạn như dữ liệu được cá nhân hoá hoặc thông tin gần đây. Các nhà cung cấp này có thể đặt bản xem trước sau khi người dùng đã đăng nhập hoặc đã thực hiện định cấu hình ban đầu trong ứng dụng của họ. Sau đó, họ có thể thiết lập một nhiệm vụ định kỳ để cập nhật bản xem trước theo tần suất họ chọn. Ví dụ về loại tiện ích này có thể là ảnh, lịch, thời tiết hoặc tin tức tiện ích.
  • Các trình cung cấp hiển thị thông tin tĩnh trong bản xem trước hoặc tiện ích thao tác nhanh mà không hiển thị bất kỳ dữ liệu nào. Các nhà cung cấp này có thể đặt bản xem trước một lần, khi khởi chạy ứng dụng lần đầu tiên. Ví dụ về loại tiện ích này bao gồm trình đơn nhanh tiện ích hành động hoặc tiện ích lối tắt Chrome.

Một số nhà cung cấp có thể hiển thị bản xem trước tĩnh trên bộ chọn chế độ thiết bị trung tâm, nhưng thực tế thông tin trên bộ chọn màn hình chính. Các nhà cung cấp này nên tuân thủ hướng dẫn cho cả hai trường hợp sử dụng này để đặt bản xem trước.

Hình trong hình

Android 15 giới thiệu các thay đổi trong tính năng Hình trong hình (PiP) để đảm bảo quá trình chuyển đổi diễn ra suôn sẻ hơn khi chuyển sang chế độ PiP. Điều này sẽ có lợi cho các ứng dụng có thành phần giao diện người dùng phủ lên trên giao diện người dùng chính và chuyển sang chế độ Hình trong hình.

Nhà phát triển dùng lệnh gọi lại onPictureInPictureModeChanged để xác định logic bật/tắt chế độ hiển thị các phần tử ở lớp phủ trên giao diện người dùng. Lệnh gọi lại này là được kích hoạt khi hoàn tất quá trình nhập hoặc thoát ảnh động PiP. Bắt đầu vào Trên Android 15, lớp PictureInPictureUiState bao gồm một trạng thái khác.

Với trạng thái giao diện người dùng này, các ứng dụng nhắm đến Android 15 (API cấp 35) sẽ tuân thủ Lệnh gọi lại Activity#onPictureInPictureUiStateChanged đang được gọi bằng isTransitioningToPip() ngay khi ảnh động trong Hình trong hình bắt đầu. Có nhiều thành phần trên giao diện người dùng không liên quan đến ứng dụng khi ứng dụng ở chế độ PiP (Hình trong hình), đối với thành phần hiển thị hoặc bố cục mẫu bao gồm thông tin như nội dung đề xuất, video, mức phân loại và tiêu đề. Khi ứng dụng chuyển sang chế độ PiP, hãy sử dụng Lệnh gọi lại onPictureInPictureUiStateChanged để ẩn các thành phần này trên giao diện người dùng. Khi ứng dụng chuyển sang chế độ toàn màn hình từ cửa sổ PiP, hãy sử dụng lệnh gọi lại onPictureInPictureModeChanged để ẩn các phần tử này, như minh hoạ trong các ví dụ sau:

override fun onPictureInPictureUiStateChanged(pipState: PictureInPictureUiState) {
        if (pipState.isTransitioningToPip()) {
          // Hide UI elements
        }
    }
override fun onPictureInPictureModeChanged(isInPictureInPictureMode: Boolean) {
        if (isInPictureInPictureMode) {
          // Unhide UI elements
        }
    }

Nút bật/tắt chế độ hiển thị nhanh các thành phần không liên quan trên giao diện người dùng (đối với cửa sổ PiP) giúp đảm bảo ảnh động nhập PiP mượt mà và không nhấp nháy.

Cải thiện quy tắc Không làm phiền

AutomaticZenRule lets apps customize Attention Management (Do Not Disturb) rules and decide when to activate or deactivate them. Android 15 greatly enhances these rules with the goal of improving the user experience. The following enhancements are included:

  • Adding types to AutomaticZenRule, allowing the system to apply special treatment to some rules.
  • Adding an icon to AutomaticZenRule, helping to make the modes be more recognizable.
  • Adding a triggerDescription string to AutomaticZenRule that describes the conditions on which the rule should become active for the user.
  • Added ZenDeviceEffects to AutomaticZenRule, allowing rules to trigger things like grayscale display, night mode, or dimming the wallpaper.

Đặt RungEffect cho kênh thông báo

Android 15 hỗ trợ chế độ rung mạnh cho các thông báo đến bằng cách kênh của bạn bằng NotificationChannel.setVibrationEffect, vì vậy người dùng có thể phân biệt giữa các loại thông báo khác nhau mà không cần phải xem thiết bị của mình.

Màn hình lớn và kiểu dáng thiết bị

Android 15 hỗ trợ ứng dụng của bạn khai thác tối đa các kiểu dáng thiết bị của Android, bao gồm màn hình lớn, thiết bị có thể lật và thiết bị có thể gập lại.

Cải thiện tính năng đa nhiệm trên màn hình lớn

Android 15 gives users better ways to multitask on large screen devices. For example, users can save their favorite split-screen app combinations for quick access and pin the taskbar on screen to quickly switch between apps. This means that making sure your app is adaptive is more important than ever.

Google I/O has sessions on Building adaptive Android apps and Building UI with the Material 3 adaptive library that can help, and our documentation has more to help you Design for large screens.

Hỗ trợ màn hình ngoài

Your app can declare a property that Android 15 uses to allow your Application or Activity to be presented on the small cover screens of supported flippable devices. These screens are too small to be considered as compatible targets for Android apps to run on, but your app can opt in to supporting them, making your app available in more places.

Khả năng kết nối

Android 15 cập nhật nền tảng để cấp cho ứng dụng của bạn quyền tiếp cận những tiến bộ mới nhất về giao tiếp và công nghệ không dây.

Hỗ trợ vệ tinh

Android 15 continues to extend platform support for satellite connectivity and includes some UI elements to ensure a consistent user experience across the satellite connectivity landscape.

Apps can use ServiceState.isUsingNonTerrestrialNetwork() to detect when a device is connected to a satellite, giving them more awareness of why full network services might be unavailable. Additionally, Android 15 provides support for SMS and MMS apps as well as preloaded RCS apps to use satellite connectivity for sending and receiving messages.

A notification appears when the device connects to a satellite.

Trải nghiệm NFC mượt mà hơn

Android 15 致力于打造更顺畅、更可靠的感应式付款体验,同时继续支持 Android 强大的 NFC 应用生态系统。在受支持的设备上,应用可以请求 NfcAdapter 进入观察模式。在该模式下,设备会监听 NFC 读取器但不会响应 NFC 读取器,从而将应用的 NFC 服务 PollingFrame 对象发送给系统进行处理。PollingFrame 对象可用于在与 NFC 读取器首次通信之前进行身份验证,以便在许多情况下实现一键交易。

此外,应用现在可以在受支持的设备上注册过滤器,以便接收轮询循环 activity 的通知,从而与多个 NFC 感知应用顺畅运行。

Vai trò trên Wallet

Android 15 introduces a Wallet role that allows tighter integration with the user's preferred wallet app. This role replaces the NFC default contactless payment setting. Users can manage the Wallet role holder by navigating to Settings > Apps > Default Apps.

The Wallet role is used when routing NFC taps for AIDs registered in the payment category. Taps always go to the Wallet role holder unless another app that is registered for the same AID is running in the foreground.

This role is also used to determine where the Wallet Quick Access tile should go when activated. When the role is set to "None", the Quick Access tile isn't available and payment category NFC taps are only delivered to the foreground app.

Bảo mật

Android 15 giúp bạn tăng cường tính bảo mật của ứng dụng, bảo vệ dữ liệu của ứng dụng, đồng thời mang lại cho người dùng thông tin minh bạch hơn và nhiều quyền kiểm soát hơn đối với dữ liệu của họ. Xem bài viết Bảo vệ bảo mật người dùng trên Android tại Google I/O để biết thêm về những việc chúng tôi đang thực hiện nhằm cải thiện các biện pháp bảo vệ người dùng và bảo vệ ứng dụng của bạn trước các mối đe doạ mới.

Tích hợp Trình quản lý thông tin xác thực với tính năng tự động điền

Starting with Android 15, developers can link specific views like username or password fields with Credential Manager requests, making it easier to provide a tailored user experience during the sign-in process. When the user focuses on one of these views, a corresponding request is sent to Credential Manager. The resulting credentials are aggregated across providers and displayed in autofill fallback UIs, such as inline suggestions or drop-down suggestions. The Jetpack androidx.credentials library is the preferred endpoint for developers to use and will soon be available to further enhance this feature in Android 15 and higher.

Tích hợp tính năng đăng ký và đăng nhập bằng một lần chạm với lời nhắc sinh trắc học

Trình quản lý thông tin xác thực tích hợp lời nhắc sinh trắc học vào quy trình tạo thông tin xác thực và đăng nhập, giúp các nhà cung cấp không cần phải quản lý lời nhắc sinh trắc học. Do đó, trình cung cấp thông tin xác thực chỉ cần tập trung vào kết quả của quy trình tạo và nhận, được tăng cường bằng kết quả của quy trình sinh trắc học. Quy trình đơn giản này giúp tạo và truy xuất thông tin xác thực hiệu quả và đơn giản hơn.

Quản lý khoá cho phương thức mã hoá hai đầu

我们在 Android 15 中引入了 E2eeContactKeysManager,它提供用于存储加密公钥的操作系统级 API,有助于 Android 应用中的端到端加密 (E2EE)。

E2eeContactKeysManager 旨在与平台通讯录应用集成,使用户能够集中管理和验证其联系人的公钥。

Kiểm tra quyền đối với URI nội dung

Android 15 introduces a set of APIs that perform permission checks on content URIs:

Hỗ trợ tiếp cận

Android 15 bổ sung các tính năng giúp cải thiện khả năng hỗ trợ tiếp cận cho người dùng.

Chữ nổi tốt hơn

Trên Android 15, chúng tôi đã tạo điều kiện để TalkBack có thể hỗ trợ màn hình chữ nổi đang sử dụng tiêu chuẩn HID qua cả USB và Bluetooth bảo mật.

Tiêu chuẩn này, cũng giống như tiêu chuẩn mà chuột và bàn phím sử dụng, sẽ giúp Android hỗ trợ nhiều loại màn hình chữ nổi hơn theo thời gian.

Quốc tế hoá

Android 15 bổ sung các tính năng và chức năng nhằm bổ sung trải nghiệm người dùng khi sử dụng thiết bị bằng nhiều ngôn ngữ.

Phông chữ biến CJK

从 Android 15 开始,中文、日语和韩语 (CJK) 语言的字体文件 NotoSansCJK 现已成为可变字体。可变字体为 CJK 语言的广告素材排版开辟了新的可能性。设计师可以探索更广泛的样式,并创建以前难以或无法实现的具有视觉冲击力的布局。

中文、日语和韩语 (CJK) 语言的可变字体在不同字体宽度下的显示效果。

Giải thích giữa các ký tự

从 Android 15 开始,可以通过 使用 JUSTIFICATION_MODE_INTER_CHARACTER。“字词间的理由”原为 最初是在 Android 8.0(API 级别 26)中引入的, Justifications 功能为使用 例如中文、日语等。

使用 JUSTIFICATION_MODE_NONE 的日语文本布局。
使用 JUSTIFICATION_MODE_NONE 的英语文本布局。


使用 JUSTIFICATION_MODE_INTER_WORD 的日语文本布局。
使用 JUSTIFICATION_MODE_INTER_WORD 的英语文本布局。


使用 JUSTIFICATION_MODE_INTER_CHARACTER 的日语文本布局。
使用 JUSTIFICATION_MODE_INTER_CHARACTER 的英语文本布局。

Cấu hình ngắt dòng tự động

Android started supporting phrase-based line breaks for Japanese and Korean in Android 13 (API level 33). However, while phrase-based line breaks improve the readability of short lines of text, they don't work well for long lines of text. In Android 15, apps can apply phrase-based line breaks only for short lines of text, using the LINE_BREAK_WORD_STYLE_AUTO option. This option selects the best word style option for the text.

For short lines of text, phrase-based line breaks are used, functioning the same as LINE_BREAK_WORD_STYLE_PHRASE, as shown in the following image:

For short lines of text, LINE_BREAK_WORD_STYLE_AUTO applies phrase-based line breaks to improve the readability of the text. This is the same as applying LINE_BREAK_WORD_STYLE_PHRASE.

For longer lines of text, LINE_BREAK_WORD_STYLE_AUTO uses a no line-break word style, functioning the same as LINE_BREAK_WORD_STYLE_NONE, as shown in the following image:

For long lines of text, LINE_BREAK_WORD_STYLE_AUTO applies no line-break word style to improve the readability of the text. This is the same as applying LINE_BREAK_WORD_STYLE_NONE.

Phông chữ Hentaigana mới của tiếng Nhật

Trong Android 15, một tệp phông chữ dành cho chữ Hiragana tiếng Nhật cũ (còn gọi là Hentaigana) được nhóm theo mặc định. Hình dạng độc đáo của các nhân vật trong Hentaigana có thể khiến nét đặc trưng riêng cho hình minh hoạ hoặc thiết kế, đồng thời vẫn giúp đảm bảo tính chính xác sự truyền tải và hiểu biết của các tài liệu cổ của Nhật Bản.

Kiểu ký tự và văn bản của Hentaigana tiếng Nhật phông chữ.

VideoLAN nón Bản quyền (c) 1996-2010 VideoLAN. Biểu trưng này hoặc phiên bản đã sửa đổi có thể được bất kỳ ai sử dụng hoặc sửa đổi để tham chiếu đến dự án VideoLAN hoặc bất kỳ sản phẩm nào do nhóm VideoLAN phát triển, nhưng không thể hiện sự chứng thực của dự án.

Vulkan và biểu trưng Vulkan là nhãn hiệu đã đăng ký của Khronos Group Inc.

OpenGL là một nhãn hiệu đã đăng ký và biểu trưng OpenGL ES là nhãn hiệu của Hewlett Packard Enterprise do Khronos sử dụng.