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 tuyệt vời. Các phần sau đây tóm tắt những 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 đã thêm, đã sửa đổi và đã 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 được thêm, hãy truy cập tài liệu tham khảo về API cho Android. Đối với Android 15, hãy tìm các API được thêm ở API cấp 35. Để tìm hiểu những thay đổi của nền tảng có thể tác động đến ứng dụng của bạn, hãy nhớ tham khảo các thay đổi về hành vi của Android 15 đối với ứng dụng nhắm đến Android 15tất cả ứng dụng.

Camera 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 về camera và nội dung nghe nhìn, đồng thời cung cấp cho bạn quyền truy cập vào các công cụ và phần cứng để hỗ trợ nhà sáng tạo hiện thực hoá ý tưởng của họ trên Android.

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

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

Android 15 ra mắt tính năng Tăng cường ánh sáng yếu, một chế độ tự động phơi sáng có sẵn cho cả Camera 2tiện ích máy ảnh chế độ ban đêm. Tính năng Tăng cường ánh sáng yếu điều chỉnh độ phơi sáng của luồng Xem trước trong điều kiện ánh sáng yếu. Điều này khác với cách tiện ích máy ảnh chế độ ban đêm tạo ảnh tĩnh, vì chế độ ban đêm kết hợp một loạt ảnh để tạo một ảnh duy nhất, được nâng cao. Mặc dù chế độ ban đêm hoạt động rất tốt để tạo ảnh tĩnh, nhưng không thể tạo luồng khung hình liên tục, còn tính năng Tăng cường ánh sáng yếu thì có thể. Do đó, tính năng Cải tiến ánh sáng yếu sẽ hỗ trợ các tính năng của máy ảnh, chẳng hạn như:

  • Cung cấp bản xem trước hình ảnh nâng cao để người dùng có thể căn chỉnh khung hình ảnh chụp trong điều kiện ánh sáng yếu tốt hơn
  • Quét mã QR trong điều kiện ánh sáng yếu

Nếu bạn bật tính năng Tăng cường ánh sáng yếu, tính năng này sẽ tự động bật khi có mức độ ánh sáng yếu và tắt khi có nhiều ánh sáng hơn.

Các ứng dụng có thể ghi lại luồng Xem trước trong điều kiện ánh sáng yếu để lưu video được làm sáng.

Để biết thêm thông tin, hãy xem phần Tăng cường ánh sáng yếu.

Các chế độ điều khiển camera trong ứng dụng

Android 15 bổ sung một tiện ích để kiểm soát tốt hơn phần cứng máy ảnh và các thuật toán của phần cứng đó trên các thiết bị được hỗ trợ:

  • Tính năng Điều chỉnh cường độ đèn flash nâng cao cho phép kiểm soát chính xác cường độ đèn flash ở cả chế độ SINGLETORCH trong khi chụp ảnh.

Kiểm soát khoảng không gian HDR

Android 15 会选择适合底层设备功能和面板位深的 HDR 余量。对于包含大量 SDR 内容的网页(例如显示单个 HDR 缩略图的消息应用),此行为最终可能会对 SDR 内容的感知亮度产生不利影响。在 Android 15 中,您可以使用 setDesiredHdrHeadroom 控制 HDR 余量,以便在 SDR 内容和 HDR 内容之间取得平衡。

左侧屏幕上的 SDR 界面元素的亮度似乎比右侧屏幕上的亮度更均匀,这模拟了混合 HDR 和 SDR 内容时可能出现的余量问题。通过调整 HDR 余量,您可以在 SDR 和 HDR 内容之间实现更好的平衡。

Điều chỉnh độ lớn âm thanh

Android 15 introduces support for the CTA-2075 loudness standard to help you avoid audio loudness inconsistencies and ensure users don't have to constantly adjust volume when switching between content. The system leverages known characteristics of the output devices (headphones and speaker) along with loudness metadata available in AAC audio content to intelligently adjust the audio loudness and dynamic range compression levels.

To enable this feature, you need to ensure loudness metadata is available in your AAC content and enable the platform feature in your app. For this, you instantiate a LoudnessCodecController object by calling its create factory method with the audio session ID from the associated AudioTrack; this automatically starts applying audio updates. You can pass an OnLoudnessCodecUpdateListener to modify or filter loudness parameters before they are applied on the 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 will also be updated to use the LoudnessCodecController APIs for a seamless app integration.

Thiết bị MIDI 2.0 ảo

Android 13 đã bổ sung tính năng hỗ trợ kết nối với thiết bị MIDI 2.0 bằng USB. Các thiết bị này giao tiếp bằng Gói MIDI phổ quát (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

Biểu trưng dav1d

dav1d, bộ giải mã phần mềm AV1 phổ biến của VideoLAN, có sẵn cho các thiết bị Android không hỗ trợ giải mã AV1 trong phần cứng. dav1d có hiệu suất cao hơn gấp 3 lần so với bộ giải mã phần mềm AV1 cũ, cho phép phát AV1 ở độ phân giải cao cho nhiều người dùng hơn, bao gồm cả một số thiết bị cấp thấp và trung bình.

Ứng dụng của bạn cần chọn sử dụng dav1d bằng cách gọi theo tên "c2.android.av1-dav1d.decoder". dav1d sẽ được đặt làm bộ giải mã phần mềm AV1 mặc định trong bản cập nhật tiếp theo. Tính năng hỗ trợ này được chuẩn hoá và điều chỉnh cho phiên bản cũ là các thiết bị Android 11 nhận được bản cập nhật hệ thống Google Play.

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

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

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

Android 15 tiếp tục công cuộc làm mới các thư viện cốt lõi của Android để phù hợp với các tính năng trong bản phát hành LTS OpenJDK mới nhất.

Bao gồm các tính năng và điểm cải tiến chính sau đây:

Các API này được cập nhật trên hơn một tỷ thiết bị chạy Android 12 (API cấp 31) trở lên thông qua bản cập nhật Hệ thống Google Play, nhờ đó, bạn có thể nhắm đến các tính năng lập trình mới nhất.

Cải thiện tệp PDF

Android 15 对 PdfRenderer API 进行了重大改进。应用可以整合呈现等高级功能 受密码保护的文件、注释、表单编辑searching,而 selection 则包含副本。支持线性化 PDF 优化,此功能可加快本地 PDF 查看速度并减少资源使用量。Jetpack PDF 库使用这些 API 来简化 PDF 的添加 查看功能。

<ph type="x-smartling-placeholder">
</ph>
PDF 渲染的最新更新包括 搜索嵌入式 PDF 文件中的内容。

PdfRenderer 已移至一个可使用 Google Play 系统更新独立于平台版本,并且我们支持 将这些变更还原到 Android 11(API 级别 30),方法是创建兼容的 Android 15 之前版本的 API Surface,称为 PdfRendererPreV

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

Android 14 added on-device, multi-language recognition in audio with automatic switching between languages, but this can cause words to get dropped, especially when languages switch with less of a pause between the two utterances. Android 15 adds additional controls to help apps tune this switching to their use case. EXTRA_LANGUAGE_SWITCH_INITIAL_ACTIVE_DURATION_TIME_MILLIS confines the automatic switching to the beginning of the audio session, while EXTRA_LANGUAGE_SWITCH_MATCH_SWITCHES deactivates the language switching after a defined number of switches. These options are particularly useful if you expect that there will be a single language spoken during the session that should be autodetected.

Cải thiện OpenType Variable Font API

Android 15 improves the usability of the OpenType variable font. You can create a FontFamily instance from a variable font without specifying weight axes with the buildVariableFamily API. The text renderer overrides the value of wght axis to match the displaying text.

Using the API simplifies the code for creating a Typeface considerably:

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();

Previously, to create the same Typeface, you would need much more code:

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();

Here's an example of how a Typeface created with both the old and new APIs renders:

An example of how Typeface rendering differs using new and old
APIs

In this example, the Typeface created with the old API doesn't have the capability to create accurate font weights for the 350, 450, 550 and 650 Font instances, so the renderer falls back to the closest weight. So in this case, 300 is rendered instead of 350, 400 is rendered instead of 450, and so on. By contrast, the Typeface created with the new APIs dynamically creates a Font instance for a given weight, so accurate weights are rendered for 350, 450, 550, and 650 as well.

Chế độ kiểm soát chi tiết dấu ngắt dòng

从 Android 15 开始,TextView 和底层行断开符可以将给定部分文本保留在同一行中,以提高可读性。您可以通过在字符串资源或 createNoBreakSpan 中使用 <nobreak> 标记来充分利用此换行符自定义功能。同样,您可以使用 <nohyphen> 标记或 createNoHyphenationSpan 来防止对字词进行分词。

例如,以下字符串资源不包含换行符,在呈现时,文本“Pixel 8 Pro”会在不合适的位置换行:

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

相比之下,此字符串资源包含 <nobreak> 标记,该标记会将字词“Pixel 8 Pro”换行,并防止换行:

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

以下图片展示了这些字符串呈现方式的差异:

一行文本的布局,其中显示短语“Pixel 8 Pro.”未使用 <nobreak> 标记换行。
使用 <nobreak> 标记封装“Pixel 8 Pro.”短语的同一行文本的布局。

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.

Bật chế độ 16 KB trên thiết bị bằng cách sử dụng tuỳ chọn cho nhà phát triển

Bật/tắt lựa chọn cho nhà phát triển Khởi động với kích thước trang 16 KB để khởi động thiết bị ở chế độ 16 KB.

Kể từ Android 15 QPR1, bạn có thể sử dụng tuỳ chọn dành cho nhà phát triển có trên một số thiết bị để khởi động thiết bị ở chế độ 16 KB và thực hiện kiểm thử trên thiết bị. Trước khi sử dụng tuỳ chọn cho nhà phát triển, hãy chuyển đến phần Cài đặt > Hệ thống > Bản cập nhật phần mềm rồi áp dụng mọi bản cập nhật hiện có.

Tuỳ chọn cho nhà phát triển này có trên các thiết bị sau:

  • Pixel 8 và Pixel 8 Pro (chạy Android 15 QPR1 trở lên)

  • Pixel 8a (chạy Android 15 QPR1 trở lên)

  • Pixel 9, 9 Pro và 9 Pro XL (chạy Android 15 QPR2 Beta 2 trở lên)

Đồ 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 điểm 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 继续对 Android 的 Canvas 图形系统进行现代化改造,并新增了以下功能:

  • Matrix44 提供一个 4x4 矩阵来转换坐标,当您想在 3D 中操控画布时,应使用此矩阵。
  • clipShader 会将当前剪裁区域与指定的着色器相交,而 clipOutShader 会将剪裁区域设为当前剪裁区域与着色器的差值,每个操作都会将着色器视为一个 Alpha 遮罩。这支持高效地绘制复杂形状。

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 ứng dụng. Android 15 giới thiệu các API giúp thực hiện các tác vụ trong ứng dụng của bạn hiệu quả hơn, 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 của bạn.

Để biết các phương pháp hay nhất giúp tiết kiệm pin, gỡ lỗi mức sử dụng mạng và điện năng, 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 hoạt động ở chế độ nền trong Android 15 và các phiên bản Android gần đây, hãy xem bài nói chuyện Cải thiện hiệu suất pin của hoạt động ở chế độ nền trên Android trong Google I/O.

ApplicationStartInfo API

Trong các phiên bản Android trước, việc khởi động ứng dụng có phần bí ẩn. Khó xác định trong ứng dụng của bạn liệu ứng dụng đó có bắt đầu từ trạng thái nguội, ấm hay nóng hay không. Bạn cũng khó biết ứng dụng của mình đã mất bao lâu trong các giai đoạn khởi chạy: phân nhánh quy trình, gọi onCreate, vẽ khung đầu tiên, v.v. Khi lớp Application được tạo bản sao, bạn không có cách nào để biết liệu ứng dụng có bắt đầu từ một thông báo truyền tin, nhà cung cấp nội dung, công việc, bản sao lưu, khởi động hoàn tất, chuông báo hay Activity hay không.

API ApplicationStartInfo trên Android 15 cung cấp tất cả những tính năng này và nhiều tính năng khác. Bạn thậm chí có thể chọn thêm dấu thời gian của riêng mình vào quy trình để thu thập dữ liệu thời gian ở một nơi. Ngoài việc thu thập các chỉ số, bạn có thể sử dụng ApplicationStartInfo để giúp trực tiếp tối ưu hoá quá trình khởi động ứng dụng; ví dụ: bạn có thể loại bỏ việc tạo bản sao tốn kém của các thư viện liên quan đến giao diện người dùng trong lớp Application khi ứng dụng khởi động do một thông báo truyền tin.

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

Kể từ Android 8.0 (API cấp 26), Android đã đưa API StorageStats.getAppBytes vào để 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 các tệp được trích xuất từ APK và các tệp được tạo trên thiết bị, chẳng hạn như mã được biên dịch trước (AOT). Con số này không phản ánh rõ ràng 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 sử dụng tất cả không gian đó, bao gồm cả các phần phân tách tệp APK, mã liên quan đến 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 类,可让您从应用内部收集性能分析信息,例如堆转储、堆分析报告、堆栈采样等。它使用提供的标记为您的应用提供回调,以标识输出文件,该文件将传递给应用的文件目录。该 API 会进行速率限制,以尽可能降低对性能的影响。

为了简化在应用中构建性能分析请求的过程,我们建议您使用 Core 1.15.0-rc01 或更高版本中的相应 Profiling AndroidX API。

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

Android 15 引入了 SQLite API,这些 API 可公开底层 SQLite 引擎的高级功能,以解决可能在应用中出现的特定性能问题。将 SQLite 更新到版本 3.44.3

开发者应参阅 SQLite 性能最佳实践 以便充分利用其 SQLite 数据库,尤其是在处理大型 或运行对延迟敏感的查询时

Bản cập nhật Khung hiệu suất động Android

Android 15 continues our investment in the Android Dynamic Performance Framework (ADPF), a set of APIs that allow games and performance intensive apps to interact more directly with power and thermal systems of Android devices. On supported devices, Android 15 adds ADPF capabilities:

  • A power-efficiency mode for hint sessions to indicate that their associated threads should prefer power saving over performance, great for long-running background workloads.
  • GPU and CPU work durations can both be reported in hint sessions, allowing the system to adjust CPU and GPU frequencies together to best meet workload demands.
  • Thermal headroom thresholds to interpret possible thermal throttling status based on headroom prediction.

To learn more about how to use ADPF in your apps and games, head over to the documentation.

Quyền riêng tư

Android 15 có 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 bản 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

Android 15 builds in support for more precise Intent resolution through UriRelativeFilterGroup, which contains a set of UriRelativeFilter objects that form a set of Intent matching rules that must each be satisfied, including URL query parameters, URL fragments, and blocking or exclusion rules.

These rules can be defined in the AndroidManifest XML file with the <uri-relative-filter-group> tag, which can optionally include an android:allow tag. These tags can contain <data> tags that use existing data tag attributes as well as the android:query and android:fragment attributes.

Here's an example of the AndroidManifest syntax:

<intent-filter android:autoVerify="true">
  <action android:name="android.intent.action.VIEW" />
  <category android:name="android.intent.category.BROWSABLE" />
  <category android:name="android.intent.category.DEFAULT" />
  <data android:scheme="http" />
  <data android:scheme="https" />
  <data android:host="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ư

Bạn có thể mở khoá và khoá không gian riêng tư để hiển thị hoặc ẩn các ứng dụng nhạy cảm trên thiết bị.

Không gian riêng tư cho phép người dùng tạo một không gian riêng biệt trên thiết bị của họ, nơi họ có thể bảo vệ các ứng dụng nhạy cảm khỏi những ánh mắt tò mò, nhờ một lớp xác thực bổ sung. Không gian riêng tư sử dụng một hồ sơ người dùng riêng biệt. Người dùng có thể chọn sử dụng phương thức khoá thiết bị hoặc một phương thức khoá riêng biệt cho không gian riêng tư.

Các ứng dụng trong không gian riêng tư sẽ xuất hiện trong một vùng chứa riêng biệt trong trình chạy và bị ẩn khỏi chế độ xem gần đây, thông báo, phần cài đặt và các ứng dụng khác khi không gian riêng tư bị khoá. Nội dung do người dùng tạo và tải xuống (chẳng hạn như nội dung nghe nhìn hoặc tệp) và tài khoản được tách riêng giữa không gian riêng tư và không gian chính. Bạn có thể dùng trang chia sẻ nội dung của hệ thốngcông cụ chọn ảnh để cấp cho ứng dụng quyền truy cập vào nội dung trên các không gian khi không gian riêng tư được mở khoá.

Người dùng không thể di chuyển các ứng dụng hiện có và dữ liệu của ứng dụng vào không gian riêng tư. Thay vào đó, người dùng chọn một tuỳ chọn cài đặt trong không gian riêng tư để cài đặt ứng dụng bằng bất kỳ cửa hàng ứng dụng nào họ muốn. Các ứng dụng trong không gian riêng tư được cài đặt dưới dạng bản sao riêng biệt với mọi ứng dụng trong không gian chính (bản sao mới của cùng một ứng dụng).

Khi người dùng khoá không gian riêng tư, hồ sơ sẽ bị dừng. Khi hồ sơ bị dừng, các ứng dụng trong không gian riêng tư sẽ không còn hoạt động và không thể thực hiện các hoạt động trên nền trước hoặc trong nền, bao gồm cả việc hiển thị thông báo.

Bạn nên kiểm thử ứng dụng của mình trong không gian riêng tư để đảm bảo ứng dụng hoạt động như mong đợi, đặc biệt là nếu ứng dụng của bạn thuộc một trong các danh mục sau:

Truy vấn lựa chọn gần đây nhất của người dùng đối với 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 includes the latest Android Ad Services extensions, incorporating the latest version of the Privacy Sandbox on Android. This addition is part of our work to develop technologies that improve user privacy and enable effective, personalized advertising experiences for mobile apps. Our privacy sandbox page has more information about the Privacy Sandbox on Android developer preview and beta programs to help you get started.

Health Connect

Android 15 integrates the latest extensions around Health Connect by Android, a secure and centralized platform to manage and share app-collected health and fitness data. This update adds support for additional data types across fitness, nutrition, skin temperature, training plans, and more.

Skin temperature tracking allows users to store and share more accurate temperature data from a wearable or other tracking device.

Training plans are structured workout plans to help a user achieve their fitness goals. Training plans support includes a variety of completion and performance goals:

Learn more about the latest updates to Health Connect in Android in the Building adaptable experiences with Android Health talk from Google I/O.

Chia sẻ màn hình ứng dụng

Android 15 supports app 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 app 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 mang đến cho nhà phát triển ứng dụng và người dùng nhiều quyền kiểm soát và tính linh hoạt hơn khi đị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 những đ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 của ứng dụng, hãy xem bài nói chuyện Cải thiện trải nghiệm người dùng trong ứng dụng Android tại Google I/O.

Bản xem trước tiện ích phong phú hơn nhờ Generated Previews API

Before Android 15, the only way to provide widget picker previews was to specify a static image or layout resource. These previews often differ significantly from the look of the actual widget when it is placed on the home screen. Also, static resources can't be created with Jetpack Glance, so a Glance developer had to screenshot their widget or create an XML layout to have a widget preview.

Android 15 adds support for generated previews. This means that app widget providers can generate RemoteViews to use as the picker preview, instead of a static resource.

Apps can provide Remote Views to the Widget Picker, so they can update the content in the picker to be more representative of what the user will see.

Push API

Apps can provide generated previews through a push API. Apps can provide previews at any point in their lifecycle, and don't receive an explicit request from the host to provide previews. Previews are persisted in AppWidgetService, and hosts can request them on-demand. The following example loads an XML widget layout resource and sets it as the preview:

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

The expected flow is:

  1. At any time, the widget provider calls setWidgetPreview. The provided previews are persisted in AppWidgetService with other provider info.
  2. setWidgetPreview notifies hosts of an updated preview through the AppWidgetHost.onProvidersChanged callback. In response, the widget host reloads all of its provider information.
  3. When displaying a widget preview, the host checks AppWidgetProviderInfo.generatedPreviewCategories, and if the chosen category is available, calls AppWidgetManager.getWidgetPreview to return the saved preview for this provider.

When to call setWidgetPreview

Because there is no callback to provide previews, apps can choose to send previews at any point when they are running. How often to update the preview depends on the widget's use case.

The following list describes the two main categories of preview use cases:

  • Providers that show real data in their widget previews, such as personalized or recent information. These providers can set the preview once the user has signed in or has done initial configuration in their app. After this, they can set up a periodic task to update the previews at their chosen cadence. Examples of this type of widget could be a photo, calendar, weather or news widget.
  • Providers that show static information in previews or quick-action widgets that don't display any data. These providers can set previews once, when the app first launches. Examples of this type of widget include a drive quick actions widget or chrome shortcuts widget.

Some providers might show static previews on the hub mode picker, but real information on the homescreen picker. These providers should follow the guidance for both of these use cases to set previews.

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 允许应用自定义注意力机制 管理(勿扰)规则,并确定何时启用或停用 。Android 15 极大地增强了这些规则,旨在提高 用户体验。其中包含以下增强功能:

  • AutomaticZenRule 添加类型,让系统能够应用特殊类型 对某些规则的处理
  • AutomaticZenRule 添加图标,使模式更加丰富 易于识别。
  • triggerDescription 字符串添加到 AutomaticZenRule,用于描述 规则应当对用户生效的条件。
  • 已添加 ZenDeviceEffects 更改为AutomaticZenRule,从而允许规则触发灰度等操作 显示、夜间模式或调暗壁纸。

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

Android 15 supports setting rich vibrations for incoming notifications by channel using NotificationChannel.setVibrationEffect, so your users can distinguish between different types of notifications without having to look at their device.

Khối trạng thái chiếu nội dung nghe nhìn và tính năng tự động dừng

Media projection can expose private user information. A new, prominent status bar chip makes users aware of any ongoing screen projection. Users can tap the chip to stop screen casting, sharing, or recording. Also, for a more intuitive user experience, any in‑progress screen projection now automatically stops when the device screen is locked.

用于屏幕共享、投屏和录制的状态栏条状标签。

Màn hình lớn và kiểu dáng

Android 15 hỗ trợ các ứng dụng của bạn khai thác tối đa các kiểu dáng của Android, bao gồm cả 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 khả năng đa nhiệm trên màn hình lớn

Android 15 mang đến cho người dùng nhiều cách tốt hơn để làm nhiều việc cùng lúc trên các thiết bị có màn hình lớn. Để Ví dụ: người dùng có thể lưu các kiểu kết hợp ứng dụng mà họ yêu thích ở chế độ chia đôi màn hình để hãy truy cập và ghim thanh tác vụ trên màn hình để chuyển đổi nhanh giữa các ứng dụng. Điều này có nghĩa là việc đảm bảo ứng dụng của bạn có khả năng thích ứng là quan trọng hơn bao giờ hết.

Google I/O có các phiên về chủ đề Xây dựng Android thích ứng ứng dụngXây dựng giao diện người dùng bằng Material 3 thư viện thích ứng có thể hữu ích, và tài liệu của chúng tôi có nhiều tài liệu hơn để giúp bạn Thiết kế cho màn hình.

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

您的应用可以声明一个属性,Android 15 会使用该属性来允许您的 ApplicationActivity 显示在受支持的可翻转设备的小封面屏幕上。这些屏幕太小,无法被视为适合运行 Android 应用的兼容目标平台,但您的应用可以选择支持它们,从而让您的应用在更多平台上可用。

Khả năng kết nối

Android 15 cập nhật nền tảng để ứng dụng của bạn có thể sử dụng những tiến bộ mới nhất về công nghệ truyền thông và 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 is working to make the tap to pay experience more seamless and reliable while continuing to support Android's robust NFC app ecosystem. On supported devices, apps can request the NfcAdapter to enter observe mode, where the device listens but doesn't respond to NFC readers, sending the app's NFC service PollingFrame objects to process. The PollingFrame objects can be used to auth ahead of the first communication to the NFC reader, allowing for a one tap transaction in many cases.

In addition, apps can register a filter on supported devices so they can be notified of polling loop activity, which allows for smooth operation with multiple NFC-aware applications.

Vai trò trong Wallet

Android 15 引入了钱包角色,可与用户的首选钱包应用更紧密地集成。此角色会取代 NFC 默认的感应式付款设置。用户可以前往设置 > 应用 > 默认应用,管理钱包角色持有者。

在为在付款类别中注册的 AID 路由 NFC 感应式付款时,系统会使用钱包角色。点按操作始终会转到 Google 钱包角色持有者,除非有已注册相同 AID 的其他应用在前台运行。

此角色还用于确定“Google 钱包”快速访问功能块在启用后应显示在何处。将角色设为“无”时,“快速访问”功能块不可用,并且支付类别 NFC 点按仅传送到前台应用。

Bảo mật

Android 15 giúp bạn tăng cường tính bảo mật cho ứng dụng, bảo vệ dữ liệu của ứng dụng và mang đến cho người dùng sự minh bạch cũng như quyền kiểm soát nhiều hơn đối với dữ liệu của họ. Xem bài nói chuyện Bảo vệ tính bảo mật của 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 làm 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

Kể từ Android 15, nhà phát triển có thể liên kết các thành phần hiển thị cụ thể như trường tên người dùng hoặc mật khẩu với các yêu cầu của Trình quản lý thông tin xác thực, giúp dễ dàng cung cấp trải nghiệm phù hợp cho người dùng trong quá trình đăng nhập. Khi người dùng tập trung vào một trong các chế độ xem này, một yêu cầu tương ứng sẽ được gửi đến Trình quản lý thông tin xác thực. Thông tin xác thực thu được được tổng hợp trên các trình cung cấp và hiển thị trong giao diện người dùng dự phòng tự động điền, chẳng hạn như đề xuất cùng dòng hoặc đề xuất thả xuống. Thư viện Jetpack androidx.credentials là điểm cuối ưu tiên mà nhà phát triển nên sử dụng và sẽ sớm ra mắt để nâng cao hơn nữa tính năng này trong Android 15 trở lên.

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

Credential Manager integrates biometric prompts into the credential creation and sign-in processes, eliminating the need for providers to manage biometric prompts. As a result, credential providers only need to focus on the results of the create and get flows, augmented with the biometric flow result. This simplified process creates a more efficient and streamlined credential creation and retrieval process.

Quản lý khoá để mã hoá hai đầu

We are introducing the E2eeContactKeysManager in Android 15, which facilitates end-to-end encryption (E2EE) in your Android apps by providing an OS-level API for the storage of cryptographic public keys.

The E2eeContactKeysManager is designed to integrate with the platform contacts app to give users a centralized way to manage and verify their contacts' public keys.

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

Trong Android 15, chúng tôi đã hỗ trợ TalkBack 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, 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 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 bổ trợ cho trải nghiệm người dùng khi thiết bị được dùng bằng nhiều ngôn ngữ.

Phông chữ biến đổi CJK

从 Android 15 开始,面向中文、日文和韩文 (CJK) 语言的字体文件 NotoSansCJK 现在是可变字体。可变字体为中日韩语言的创意排版提供了更多可能性。设计师可以探索更多样式的排版,并制作出以前难以实现或根本无法实现的视觉效果出色的布局。

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

Căn chỉnh giữa các ký tự

Starting with Android 15, text can be justified utilizing letter spacing by using JUSTIFICATION_MODE_INTER_CHARACTER. Inter-word justification was first introduced in Android 8.0 (API level 26), and inter-character justification provides similar capabilities for languages that use the whitespace character for segmentation, such as Chinese, Japanese, and others.

Layout for Japanese text using JUSTIFICATION_MODE_NONE.
Layout for English text using JUSTIFICATION_MODE_NONE.


Layout for Japanese text using JUSTIFICATION_MODE_INTER_WORD.
Layout for English text using JUSTIFICATION_MODE_INTER_WORD.


Layout for Japanese text using the JUSTIFICATION_MODE_INTER_CHARACTER.
Layout for English text using the JUSTIFICATION_MODE_INTER_CHARACTER.

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

Android bắt đầu hỗ trợ ngắt dòng dựa trên cụm từ cho tiếng Nhật và tiếng Hàn bằng Android 13 (API cấp 33). Tuy nhiên, mặc dù ngắt dòng dựa trên cụm từ sẽ cải thiện mức độ dễ đọc của các dòng văn bản ngắn, nhưng chúng sẽ không phù hợp với các dòng văn bản dài. Trên Android 15, ứng dụng chỉ có thể ngắt dòng dựa trên cụm từ cho các dòng ngắn văn bản, sử dụng LINE_BREAK_WORD_STYLE_AUTO . Lựa chọn này chọn kiểu từ phù hợp nhất cho văn bản.

Đối với các dòng văn bản ngắn, dấu ngắt dòng dựa trên cụm từ được sử dụng, hoạt động giống như LINE_BREAK_WORD_STYLE_PHRASE, như minh hoạ trong hình sau:

Đối với các dòng văn bản ngắn, LINE_BREAK_WORD_STYLE_AUTO áp dụng ngắt dòng dựa trên cụm từ để cải thiện khả năng đọc văn bản. Điều này giống như việc áp dụng LINE_BREAK_WORD_STYLE_PHRASE.

Đối với các dòng văn bản dài hơn, LINE_BREAK_WORD_STYLE_AUTO sử dụng ký tự no kiểu chữ ngắt dòng, hoạt động giống như LINE_BREAK_WORD_STYLE_NONE, như được hiển thị trong hình ảnh sau đây:

Đối với các dòng văn bản dài, LINE_BREAK_WORD_STYLE_AUTO sẽ áp dụng kiểu chữ không ngắt dòng để cải thiện khả năng đọc văn bản. Việc này cũng giống như áp dụng LINE_BREAK_WORD_STYLE_NONE.

Phông chữ Hentaigana bổ sung của Nhật Bản

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 cone Bản quyền (c) 1996-2010 VideoLAN. Bất kỳ ai cũng có thể sử dụng hoặc sửa đổi biểu trưng này hoặc phiên bản 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 điều này không có nghĩa là dự án này chứng thực.

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

OpenGL là nhãn hiệu đã đăng ký và biểu trưng OpenGL ES là nhãn hiệu của Hewlett Packard Enterprise được sử dụng theo sự cho phép của Khronos.