ב-Android 15 יש תכונות וממשקי API נהדרים למפתחים. בקטעים הבאים מפורט סיכום של התכונות האלה, כדי לעזור לכם להתחיל להשתמש בממשקי ה-API הרלוונטיים.
רשימה מפורטת של ממשקי ה-API שנוספו, שונו והוסרו מפורטת בדוח ההבדלים של ממשקי ה-API. פרטים על ממשקי API שנוספו זמינים בחומר העזר בנושא Android API. לגבי Android 15, מחפשים ממשקי API שנוספו ברמת API 35. כדי לקבל מידע על תחומים שבהם שינויים בפלטפורמה עשויים להשפיע על האפליקציות שלכם, כדאי לעיין בשינויים בהתנהגות של Android 15 באפליקציות שמטרגטות את Android 15 ובכל האפליקציות.
מצלמה ומדיה
Android 15 כולל מגוון תכונות לשיפור חוויית השימוש במצלמה ובמדיה, ומעניק גישה לכלים ולחומרה שיעזרו ליוצרי תוכן להגשים את החזון שלהם ב-Android.
מידע נוסף על התכונות והפתרונות העדכניים ביותר למפתחים בתחום המדיה והמצלמה ב-Android זמין בהרצאה יצירת חוויות מודרניות של מדיה ומצלמה ב-Android מ-Google I/O.
הגברת התאורה החלשה
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.
אמצעי בקרה למצלמה באפליקציה
Android 15 添加了一个扩展程序,可让您更好地控制支持的设备上的相机硬件及其算法:
בקרת מרווח ביטחון ל-HDR
Android 15 会选择适合底层设备功能和面板位深的 HDR 余量。对于包含大量 SDR 内容的网页(例如显示单个 HDR 缩略图的消息应用),此行为最终可能会对 SDR 内容的感知亮度产生不利影响。在 Android 15 中,您可以使用 setDesiredHdrHeadroom
控制 HDR 余量,以便在 SDR 内容和 HDR 内容之间取得平衡。
![](https://developer.android.google.cn/static/about/versions/15/images/hdr-headroom.png?authuser=1&hl=he)
בקרת עוצמת הקול
Android 15 引入了对 CTA-2075 响度标准的支持,可帮助您避免音频响度不一致,并确保用户在切换内容时不必不断调整音量。系统利用输出设备(头戴式耳机和扬声器)的已知特性以及 AAC 音频内容中提供的响度元数据,智能调整音频响度和动态范围压缩级别。
如需启用此功能,您需要确保 AAC 内容中提供响度元数据,并在应用中启用平台功能。为此,您可以通过使用关联的 AudioTrack
中的音频会话 ID 调用其 create 工厂方法来实例化 LoudnessCodecController
对象;这会自动开始应用音频更新。您可以传递 OnLoudnessCodecUpdateListener
来修改或过滤响度参数,然后再将其应用于 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 也将更新,以使用
LoudnessCodecController
API,可实现无缝应用集成。
מכשירי MIDI 2.0 וירטואליים
Android 13 添加了对使用 USB 连接 MIDI 2.0 设备的支持,这些设备使用通用 MIDI 数据包 (UMP) 进行通信。Android 15 将 UMP 支持扩展到了虚拟 MIDI 应用,使作曲应用能够像使用 USB MIDI 2.0 设备一样,将虚拟 MIDI 2.0 设备用作控制合成器应用的设备。
פענוח יעיל יותר של קוד AV1 בתוכנה
dav1d 是 VideoLAN 推出的热门 AV1 软件解码器,适用于不支持硬件 AV1 解码的 Android 设备。与旧版 AV1 软件解码器相比,dav1d 的性能最高可提升 3 倍,让更多用户(包括一些低端和中端设备)能够播放高清 AV1 视频。
您的应用需要选择启用 dav1d,方法是通过名称 "c2.android.av1-dav1d.decoder"
调用它。在后续更新中,dav1d 将成为默认的 AV1 软件解码器。此支持已标准化,并向后移植到收到 Google Play 系统更新的 Android 11 设备。
כלים ודרכים לשיפור הפרודוקטיביות של מפתחים
רוב המאמצים שלנו לשיפור הפרודוקטיביות מתמקדים בכלים כמו Android Studio, Jetpack Compose וספריות Android Jetpack, אבל אנחנו תמיד מחפשים דרכים בתוך הפלטפורמה שיעזרו לכם להגשים את החזון שלכם בקלות רבה יותר.
עדכונים ל-OpenJDK 17
Android 15 将继续更新 Android 的核心库,以与最新 OpenJDK LTS 版本中的功能保持一致。
其中包含以下主要功能和改进:
- 改进了 NIO 缓冲区的使用体验
- 数据流
- 其他
math
和strictmath
方法 util
软件包更新,包括顺序的collection
、map
和set
Deflater
中的ByteBuffer
支持- 安全更新,例如
X500PrivateCredential
和安全密钥更新
这些 API 会通过 Google Play 系统更新在搭载 Android 12(API 级别 31)及更高版本的 10 亿多部设备上更新,以便您以最新的编程功能为目标平台。
שיפורים בקובצי 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.
![](https://developer.android.google.cn/static/about/versions/15/images/pdf-rendering.png?authuser=1&hl=he)
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
.
שיפורים בהחלפת השפה באופן אוטומטי
Android 14 在音频中添加了设备端多语言识别功能,并支持在语言之间自动切换,但这可能会导致丢失字词,尤其是当两次语音之间语言切换的间隔时间较短时。Android 15 添加了其他控件,以帮助应用根据其用例调整此切换。EXTRA_LANGUAGE_SWITCH_INITIAL_ACTIVE_DURATION_TIME_MILLIS
会将自动切换限制在音频会话开始时,而 EXTRA_LANGUAGE_SWITCH_MATCH_SWITCHES
会在发生指定次数的切换后停用语言切换。如果您预计会话期间只会使用一种语言,并且该语言应被自动检测到,这些选项会特别有用。
שיפורים ב-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:
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.
אמצעי בקרה מפורטים למעברי שורה
从 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>
以下图片展示了这些字符串呈现方式的差异:
![](https://developer.android.google.cn/static/about/versions/15/images/line-breaks-none.png?authuser=1&hl=he)
<nobreak>
标记换行。![](https://developer.android.google.cn/static/about/versions/15/images/line-breaks-included.png?authuser=1&hl=he)
<nobreak>
标记封装“Pixel 8 Pro.”短语的同一行文本的布局。העברת אפליקציות לארכיון
Android 和 Google Play 宣布支持最后的应用归档功能 年,这让用户可以通过移除部分内容来释放空间 通过 Android 应用发布的设备中不常用的应用 前往 Google Play 下载套装。Android 15 在操作系统级别支持应用归档和解压缩,让所有应用商店都能更轻松地实现归档和解压缩。
具有 REQUEST_DELETE_PACKAGES
权限的应用可以调用
PackageInstaller
requestArchive
方法请求归档
已安装的应用软件包,这会移除 APK 和所有缓存的文件,但会保留
用户数据已归档的应用会通过 LauncherApps
API 作为可显示的应用返回;用户会看到一个界面处理,以突出显示这些应用已归档。如果用户点按已归档的应用,负责安装的应用会收到解除归档请求,并且可以通过 ACTION_PACKAGE_ADDED
广播监控恢复过程。
הפעלת מצב 16KB במכשיר באמצעות אפשרויות למפתחים
![](https://developer.android.google.cn/static/images/guide/practices/16-kb-dev-option.png?authuser=1&hl=he)
מפעילים או משביתים את האפשרות הפעלה בגודל דף של 16KB כדי להפעיל מכשיר במצב 16KB.
החל מגרסה QPR1 של Android 15, אפשר להשתמש באפשרות למפתחים שזמינה במכשירים מסוימים כדי להפעיל את המכשיר במצב 16KB ולבצע בדיקה במכשיר.
אפשרות הפיתוח הזו זמינה במכשירים הבאים:
Pixel 8 ו-Pixel 8 Pro (עם Android 15 QPR1 ואילך)
אזהרה: עקב בעיה ידועה ב-Android 15 QPR2 Beta 3, מסך המגע לא פועל במכשירי Pixel 8 אחרי התקנת Android 15 QPR2 Beta 3 והפעלת המכשיר במצב 16KB. הבעיה הזו לא משפיעה על מכשירי Pixel 8 Pro.
Pixel 8a (עם Android 15 QPR1 ואילך)
אזהרה: עקב בעיה ידועה ב-Android 15 QPR2 Beta 3, מסך המגע לא פועל במכשירי Pixel 8a אחרי התקנת Android 15 QPR2 Beta 3 והפעלת המכשיר במצב 16KB.
Pixel 9, Pixel 9 Pro ו-Pixel 9 Pro XL (עם Android 15 QPR2 Beta 2 ואילך)
גרפיקה
ב-Android 15 יש את השיפורים האחרונים בתחום הגרפיקה, כולל ANGLE ותוספות למערכת הגרפיקה של Canvas.
מודרניזציה של הגישה ל-GPU ב-Android
חומרת Android התפתחה משמעותית מאז הימים הראשונים שבהם הליבה של מערכת ההפעלה רצה על מעבד יחיד, והגישה ל-GPU התבצעה באמצעות ממשקי API שמבוססים על צינורות עיבוד נתונים עם פונקציות קבועות. Vulkan® graphics API זמין ב-NDK מאז Android 7.0 (רמת API 24) עם הפשטה ברמה נמוכה יותר שמשקפת טוב יותר את החומרה המודרנית של המעבד הגרפי, מתאימה טוב יותר לתמיכה בכמה ליבות של מעבדים ומציעה עלות ריבית נמוכה יותר של מנהל ה-CPU – וכך משפרת את ביצועי האפליקציה. כל מנועי המשחקים המודרניים תומכים ב-Vulkan.
Vulkan הוא הממשק המועדף של Android ל-GPU. לכן, Android 15 כולל את ANGLE כשכבה אופציונלית להרצת OpenGL® ES מעל Vulkan. המעבר ל-ANGLE יעזור לסטנדרטיזציה של הטמעת OpenGL ב-Android, כדי לשפר את התאימות ובמקרים מסוימים גם את הביצועים. כדי לבדוק את היציבות והביצועים של אפליקציות OpenGL ES באמצעות ANGLE, מפעילים את האפשרות למפתחים ב-Android 15: הגדרות -> מערכת -> אפשרויות למפתחים -> ניסיוני: הפעלת ANGLE.
מפת הדרכים של Android ANGLE ב-Vulkan
![מפת דרכים של שינויים שיחולו בקרוב בממשקי ה-API של GPU ב-Android.](https://developer.android.google.cn/static/about/versions/15/images/angle-vulkan-roadmap.png?authuser=1&hl=he)
כחלק מהיעילות של סטאק ה-GPU שלנו, מעכשיו נתחיל לשלוח את ANGLE בתור מנהל המערכת GL במכשירים חדשים נוספים, ומצפים שבעתיד OpenGL/ES תהיה זמינה רק דרך ANGLE. עם זאת, אנחנו מתכננים להמשיך את התמיכה ב-OpenGL ES בכל המכשירים.
השלבים המומלצים הבאים
אפשר להשתמש באפשרויות למפתחים כדי לבחור את הנהג ANGLE ל-OpenGL ES ולבדוק את האפליקציה. בפרויקטים חדשים, מומלץ מאוד להשתמש ב-Vulkan ל-C/C++.
שיפורים ב-Canvas
Android 15 继续对 Android 的 Canvas 图形系统进行现代化改造,并新增了以下功能:
Matrix44
提供一个 4x4 矩阵来转换坐标,当您想在 3D 中操控画布时,应使用此矩阵。clipShader
会将当前剪裁区域与指定的着色器相交,而clipOutShader
会将剪裁区域设为当前剪裁区域与着色器的差值,每个操作都会将着色器视为一个 Alpha 遮罩。这支持高效地绘制复杂形状。
ביצועים וסוללה
אנחנו ב-Android ממשיכים להתמקד בסיוע לכם לשפר את הביצועים והאיכות של האפליקציות שלכם. ב-Android 15 נוספו ממשקי API שיעזרו לכם לבצע משימות באפליקציה בצורה יעילה יותר, לבצע אופטימיזציה של ביצועי האפליקציה ולקבל תובנות על האפליקציות שלכם.
כדי לקבל שיטות מומלצות לחיסכון בסוללה, ניפוי באגים של שימוש ברשת ובחשמל ופירוט על האופן שבו אנחנו משפרים את יעילות השימוש בסוללה של משימות ברקע ב-Android 15 ובגרסאות האחרונות של Android, כדאי לצפות בהרצאה שיפור יעילות השימוש בסוללה של משימות ברקע ב-Android מ-Google I/O.
ApplicationStartInfo API
在以前的 Android 版本中,应用启动一直是个谜。在应用中确定应用是从冷启动、温启动还是热启动状态启动很困难。您还很难了解应用在各种启动阶段(分叉进程、调用 onCreate
、绘制第一个帧等)所花的时间。在 Application
类被实例化时,您无法知道应用是通过广播、content provider、作业、备份、启动完成、闹钟还是 Activity
启动的。
Android 15 上的 ApplicationStartInfo
API 提供了所有这些功能,以及更多功能。您甚至可以选择在流程中添加自己的时间戳,以便在一个位置收集时间数据。除了收集指标之外,您还可以使用 ApplicationStartInfo
直接优化应用启动;例如,您可以消除在应用因广播而启动时在 Application
类中实例化与界面相关的库所带来的高昂开销。
מידע מפורט על גודל האפליקציה
从 Android 8.0(API 级别 26)开始,Android 包含 StorageStats.getAppBytes
API,该 API 会将应用的安装大小总结为一个字节数,该数值是 APK 大小、从 APK 中提取的文件的大小以及在设备上生成的文件(例如提前编译 [AOT] 代码)的总和。此数字对于了解应用的存储空间使用情况而言,没有太大帮助。
Android 15 添加了 StorageStats.getAppBytesByDataType([type])
API,可让您深入了解应用如何使用所有这些空间,包括 APK 文件分块、AOT 和加速相关代码、DEX 元数据、库和引导式配置文件。
יצירת פרופילים בניהול האפליקציה
Android 15 包含 ProfilingManager
类,可让您从应用内部收集性能分析信息,例如堆转储、堆分析报告、堆栈采样等。它使用提供的标记为您的应用提供回调,以标识输出文件,该文件将传递给应用的文件目录。该 API 会进行速率限制,以尽可能降低对性能的影响。
为了简化在应用中构建性能分析请求的过程,我们建议您使用 Core 1.15.0-rc01 或更高版本中的相应 Profiling
AndroidX API。
שיפורים במסד הנתונים של SQLite
Android 15 引入了 SQLite API,这些 API 可公开底层 SQLite 引擎的高级功能,以解决可能在应用中出现的特定性能问题。将 SQLite 更新到版本 3.44.3。
开发者应参阅 SQLite 性能最佳实践 以便充分利用其 SQLite 数据库,尤其是在处理大型 或运行对延迟敏感的查询时
- 只读延迟事务:在发出
只读(不包括写入语句),请使用
beginTransactionReadOnly()
和beginTransactionWithListenerReadOnly(SQLiteTransactionListener)
发出只读的DEFERRED
事务。此类事务 如果数据库处于 WAL 模式 与IMMEDIATE
或EXCLUSIVE
事务并发运行。 - 行数和 ID:添加了 API 以检索已更改的行数和 ID
行或最后插入的行 ID 而不发出额外的查询。
getLastChangedRowCount()
会返回当前事务中最近的 SQL 语句插入、更新或删除的行数,而getTotalChangedRowCount()
会返回当前连接的计数。getLastInsertRowId()
返回最后一行的rowid
以便在当前连接中插入 - 原始语句:发出原始 SQlite 语句,从而绕过便利 及其可能产生的任何额外处理开销。
עדכונים של Android Dynamic Performance Framework
ב-Android 15 אנחנו ממשיכים להשקיע ב-Android Dynamic Performance Framework (ADPF), קבוצה של ממשקי API שמאפשרים למשחקים ולאפליקציות עם ביצועים כבדים לקיים אינטראקציה ישירה יותר עם מערכות החשמל והתרמית של מכשירי Android. במכשירים נתמכים, Android 15 מוסיף יכולות ADPF:
- מצב חיסכון באנרגיה לסשנים של רמזים, כדי לציין שהשרשורים המשויכים צריכים להעדיף חיסכון באנרגיה על פני ביצועים. המצב הזה מתאים מאוד לעומסי עבודה ארוכים ברקע.
- אפשר לדווח על משכי העבודה של ה-GPU ושל המעבד במהלך סשנים של הנחיות, וכך לאפשר למערכת לשנות את התדרים של המעבד ושל ה-GPU יחד כדי לעמוד בצורה הטובה ביותר בדרישות של עומס העבודה.
- סף מרווח תרמי כדי לפרש את סטטוס הצמצום התרמי האפשרי על סמך תחזית של מרווח.
במסמכי העזרה תוכלו לקרוא מידע נוסף על השימוש ב-ADPF באפליקציות ובמשחקים.
פרטיות
Android 15 כולל מגוון תכונות שיעזרו למפתחי אפליקציות להגן על הפרטיות של המשתמשים.
זיהוי הקלטת מסך
Android 15 增加了对应用的支持,以检测 正在录制。每当应用转换时,系统都会调用回调 在屏幕录制内容中处于可见与隐藏状态之间。如果正在记录注册进程的 UID 拥有的 activity,则系统会将应用视为可见。这样一来,如果您的应用执行敏感操作,您就可以告知用户正在录制他们的操作。
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)
}
יכולות מורחבות של 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>
המרחב הפרטי
借助私密空间,用户可以在设备上创建一个单独的空间,在额外的身份验证层保护下,防止敏感应用遭到窥探。私密空间使用单独的用户个人资料。用户可以选择使用设备锁定方式或为私密空间使用单独的锁定方式。
私密空间中的应用会显示在启动器的单独容器中,并且当私密空间处于锁定状态时,这些应用不会显示在“最近用过”视图、通知、“设置”和其他应用中。用户生成的内容和下载的内容(例如媒体内容或文件)以及账号在私密空间和主空间之间是分开的。在私密空间处于解锁状态时,您可以使用系统 Sharesheet 和照片选择器向应用授予对各个空间中内容的访问权限。
用户无法将现有应用及其数据移至私密空间。相反,用户可以在私密空间中选择安装选项,以便使用他们偏好的任意应用商店安装应用。私密空间中的应用会作为主空间中任何应用的单独副本进行安装(同一应用的新副本)。
当用户锁定私密空间时,系统会停止该个人资料。在个人资料停止运行时,私密空间中的应用将不再处于活动状态,无法执行前台或后台活动,包括显示通知。
我们建议您使用私密空间测试应用,以确保应用能按预期运行,尤其是当您的应用属于以下某一类别时:
- 具有工作资料逻辑的应用:假定其应用的任何已安装副本(不在主资料中)均位于工作资料中。
- 医疗应用
- 启动器应用
- 应用商店应用
שאילתה לגבי הבחירה האחרונה של המשתמש לגישה לתמונות שנבחרו
מעכשיו, אפליקציות יכולות להציג רק את התמונות והסרטונים שנבחרו לאחרונה ביותר כשנותנים להן גישה חלקית להרשאות מדיה. התכונה הזו יכולה לשפר את חוויית המשתמש באפליקציות שמבקשות גישה לתמונות ולסרטונים לעיתים קרובות. כדי להשתמש בתכונה הזו באפליקציה, מפעילים את הארגומנט QUERY_ARG_LATEST_SELECTION_ONLY
כששולחים שאילתה אל MediaStore
דרך 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) });
ארגז החול לפרטיות ב-Android
Android 15 包含最新的 Android 广告服务扩展,其中包含最新版本的 Privacy Sandbox on Android。我们一直致力于开发可更好地保护用户隐私,并为移动应用打造高效的个性化广告体验的技术,此次添加新功能就是其中的一项举措。我们的 Privacy Sandbox 页面详细介绍了 Privacy Sandbox on Android 开发者预览版和 Beta 版计划,可帮助您上手使用。
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:
- Completion goals around calories burned, distance, duration, repetition, and steps.
- Performance goals around as many repetitions as possible (AMRAP), cadence, heart rate, power, perceived rate of exertion, and speed.
Learn more about the latest updates to Health Connect in Android in the Building adaptable experiences with Android Health talk from Google I/O.
שיתוף מסך של אפליקציה
Android 15 תומך בשיתוף מסך של אפליקציה, כך שמשתמשים יכולים לשתף או להקליט רק חלון של אפליקציה במקום את כל מסך המכשיר. התכונה הזו, שהופעל לראשונה ב-Android 14 QPR2, כוללת קריאות חזרה מסוג MediaProjection
שמאפשרות לאפליקציה להתאים אישית את חוויית שיתוף המסך שלה. חשוב לזכור שבאפליקציות שמטרגטות ל-Android 14 (רמת API 34) ואילך, נדרשת הסכמה מהמשתמשים לכל סשן צילום של MediaProjection
.
חוויית משתמש וממשק המשתמש של המערכת
Android 15 מעניק למפתחי אפליקציות ולמשתמשים יותר שליטה וגמישות בהגדרת המכשיר בהתאם לצרכים שלהם.
כדי ללמוד איך להשתמש בשיפורים האחרונים ב-Android 15 כדי לשפר את חוויית המשתמש באפליקציה, כדאי לצפות בהרצאה שיפור חוויית המשתמש באפליקציה ל-Android מוועידת Google I/O.
תצוגות מקדימה עשירות יותר של ווידג'טים באמצעות 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.
![](https://developer.android.google.cn/static/about/versions/15/images/generated-previews.png?authuser=1&hl=he)
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:
- At any time, the widget provider calls
setWidgetPreview
. The provided previews are persisted inAppWidgetService
with other provider info. setWidgetPreview
notifies hosts of an updated preview through theAppWidgetHost.onProvidersChanged
callback. In response, the widget host reloads all of its provider information.- When displaying a widget preview, the host checks
AppWidgetProviderInfo.generatedPreviewCategories
, and if the chosen category is available, callsAppWidgetManager.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.
תמונה בתוך תמונה
Android 15 introduces changes in Picture-in-Picture (PiP) ensuring an even smoother transition when entering into PiP mode. This will be beneficial for apps having UI elements overlaid on top of their main UI, which goes into PiP.
Developers use the onPictureInPictureModeChanged
callback to define logic
that toggles the visibility of the overlaid UI elements. This callback is
triggered when the PiP enter or exit animation is completed. Beginning in
Android 15, the PictureInPictureUiState
class includes another state.
With this UI state, apps targeting Android 15 (API level 35) will observe the
Activity#onPictureInPictureUiStateChanged
callback being invoked with
isTransitioningToPip()
as soon as the PiP animation starts. There are
many UI elements that are not relevant for the app when it is in PiP mode, for
example views or layout that include information such as suggestions, upcoming
video, ratings, and titles. When the app goes to PiP mode, use the
onPictureInPictureUiStateChanged
callback to hide these UI elements. When the
app goes to full screen mode from the PiP window, use
onPictureInPictureModeChanged
callback to unhide these elements, as shown in
the following examples:
override fun onPictureInPictureUiStateChanged(pipState: PictureInPictureUiState) {
if (pipState.isTransitioningToPip()) {
// Hide UI elements
}
}
override fun onPictureInPictureModeChanged(isInPictureInPictureMode: Boolean) {
if (isInPictureInPictureMode) {
// Unhide UI elements
}
}
This quick visibility toggle of irrelevant UI elements (for a PiP window) helps ensure a smoother and flicker-free PiP enter animation.
כללים משופרים של 'נא לא להפריע'
AutomaticZenRule
允许应用自定义注意力机制
管理(勿扰)规则,并确定何时启用或停用
。Android 15 极大地增强了这些规则,旨在提高
用户体验。其中包含以下增强功能:
- 向
AutomaticZenRule
添加类型,让系统能够应用特殊类型 对某些规则的处理 - 向
AutomaticZenRule
添加图标,使模式更加丰富 易于识别。 - 将
triggerDescription
字符串添加到AutomaticZenRule
,用于描述 规则应当对用户生效的条件。 - 已添加
ZenDeviceEffects
更改为AutomaticZenRule
,从而允许规则触发灰度等操作 显示、夜间模式或调暗壁纸。
הגדרת VibrationEffect לערוצי התראות
ב-Android 15 יש תמיכה בהגדרת רטט עשירים להתראות נכנסות באמצעות
הערוץ באמצעות NotificationChannel.setVibrationEffect
, כך
המשתמשים יכולים להבחין בין סוגים שונים של התראות,
שצריך לבדוק את המכשיר שלהם.
צ'יפ בשורת הסטטוס של הקרנת המדיה ועצירה אוטומטית
媒体投放可能会泄露用户的私密信息。一个醒目的新状态栏条状标签可让用户了解任何正在进行的屏幕投影。用户可以点按该条状标签停止投屏、共享或录制屏幕。此外,为了提供更直观的用户体验,当设备屏幕锁定后,所有正在进行的屏幕投影都会自动停止。
![](https://developer.android.google.cn/static/media/images/grow/media_projection_status_bar_chip.png?authuser=1&hl=he)
מסכים גדולים וגורמי צורה
Android 15 מספק לאפליקציות תמיכה שמאפשרת להפיק את המקסימום מהעיצובים השונים של Android, כולל מסכים גדולים, מכשירים מתקפלים ומכשירים עם צג מסתובב.
ריבוי משימות משופר במסך גדול
Android 15 为用户提供了在大屏设备上更好地进行多任务处理的方式。对于 例如,用户可以保存自己喜爱的分屏应用组合, 访问并固定屏幕上的任务栏,以便在应用之间快速切换。这意味着 让应用具备自适应能力比以往任何时候都更加重要。
Google I/O 大会上有一些关于构建自适应 Android 的会议 应用和使用 Material 3 构建界面 自适应库 我们的文档中提供了更多帮助信息,帮助您针对大型语言 。
תמיכה במסך הקדמי
您的应用可以声明一个属性,Android 15 会使用该属性来允许您的 Application
或 Activity
显示在受支持的可翻转设备的小封面屏幕上。这些屏幕太小,无法被视为适合运行 Android 应用的兼容目标平台,但您的应用可以选择支持它们,从而让您的应用在更多平台上可用。
קישוריות
ב-Android 15 מתבצע עדכון לפלטפורמה כדי לתת לאפליקציה שלכם גישה להתקדמות האחרונה בתחומי התקשורת והטכנולוגיות האלחוטיות.
תמיכה בלוויין
Android 15 继续扩大对卫星连接的平台支持,并包含一些界面元素,以确保在整个卫星连接环境中提供一致的用户体验。
应用可以使用 ServiceState.isUsingNonTerrestrialNetwork()
执行以下操作:
检测设备是否连接到卫星,让他们更清楚地了解
可能会导致完全网络服务不可用的原因此外,Android 15 支持短信和彩信应用以及预加载的 RCS 应用,以便使用卫星连接发送和接收消息。
![](https://developer.android.google.cn/static/about/versions/15/images/satellite-notification.png?authuser=1&hl=he)
חוויית שימוש חלקה יותר ב-NFC
Android 15 正在努力打造更顺畅、更可靠的感应式付款体验,同时继续支持 Android 强大的 NFC 应用生态系统。在受支持的设备上,应用可以请求 NfcAdapter
进入观察模式,在该模式下,设备会监听但不会响应 NFC 读卡器,并将应用的 NFC 服务 PollingFrame
对象发送以进行处理。PollingFrame
对象可用于在与 NFC 读卡器进行首次通信之前进行身份验证,在许多情况下,这支持一触式交易。
此外,应用可以在受支持的设备上注册过滤器,以便在有轮询循环活动时收到通知,从而能够与多个感知 NFC 的应用顺畅运行。
תפקיד ב-Wallet
Android 15 引入了钱包角色,可与用户的首选钱包应用更紧密地集成。此角色会取代 NFC 默认的感应式付款设置。用户可以前往设置 > 应用 > 默认应用,管理钱包角色持有者。
在为在付款类别中注册的 AID 路由 NFC 感应式付款时,系统会使用钱包角色。点按操作始终会转到 Google 钱包角色持有者,除非有已注册相同 AID 的其他应用在前台运行。
此角色还用于确定“Google 钱包”快速访问功能块在启用后应显示在何处。将角色设为“无”时,“快速访问”功能块不可用,并且支付类别 NFC 点按仅传送到前台应用。
אבטחה
Android 15 עוזר לכם לשפר את האבטחה של האפליקציה, להגן על הנתונים של האפליקציה ולספק למשתמשים יותר שקיפות ושליטה בנתונים שלהם. כדאי לצפות בהרצאה הגנה על אבטחת המשתמשים ב-Android מ-Google I/O כדי לקבל מידע נוסף על הפעולות שאנחנו מבצעים כדי לשפר את אמצעי ההגנה על המשתמשים ולהגן על האפליקציה מפני איומים חדשים.
שילוב של Credential Manager עם מילוי אוטומטי
从 Android 15 开始,开发者可以将用户名或密码字段等特定视图与 Credential Manager 请求相关联,从而更轻松地在登录过程中提供量身定制的用户体验。当用户聚焦于其中一个视图时,系统会向 Credential Manager 发送相应请求。系统会汇总来自各个提供商的凭据,并在自动填充后备界面(例如内嵌建议或下拉菜单建议)中显示这些凭据。Jetpack androidx.credentials 库是开发者首选的端点,很快将在 Android 15 及更高版本中推出,以进一步增强此功能。
שילוב של הרשמה וכניסה בהקשה אחת עם הנחיות לביומטריה
מנהל פרטי הכניסה משלב הנחיות ביומטריות בתהליכי היצירה והכניסה של פרטי הכניסה, כך שהספקים לא צריכים לנהל את ההנחיות הביומטריות. כתוצאה מכך, ספקי פרטי הכניסה צריכים להתמקד רק בתוצאות של תהליכי היצירה והאחזור, עם תוספת של תוצאת התהליך הביומטרי. התהליך הפשוט הזה יוצר פרטי כניסה יעילים וקלים יותר תהליך היצירה והאחזור.
ניהול מפתחות להצפנה מקצה לקצה
אנחנו משיקים את E2eeContactKeysManager
ב-Android 15, שמאפשר הצפנה מקצה לקצה (E2EE) באפליקציות ל-Android באמצעות ממשק API ברמת מערכת ההפעלה לאחסון מפתחות ציבוריים קריפטוגרפיים.
ה-E2eeContactKeysManager
מיועד לשילוב עם אפליקציית אנשי הקשר של הפלטפורמה, כדי לספק למשתמשים דרך מרוכזת לניהול ולאימות של המפתחות הציבוריים של אנשי הקשר שלהם.
בדיקות הרשאות במזהי URI של תוכן
Android 15 引入了一组用于对内容 URI 执行权限检查的 API:
Context.checkContentUriPermissionFull
:此选项会对内容 URI 执行完整权限检查。Activity
清单属性requireContentUriPermissionFromCaller
:此属性会在 activity 启动时对提供的内容 URI 强制执行指定权限。Activity
调用方的ComponentCaller
类:此类表示启动 activity 的应用。
נגישות
ב-Android 15 נוספו תכונות לשיפור הנגישות למשתמשים.
ברייל משופר
ב-Android 15, הוספנו ל-TalkBack תמיכה בצגי ברייל שמשתמשים בתקן HID גם דרך USB וגם דרך Bluetooth מאובטח.
התקן הזה, בדומה לזה שמשמש עכברים ומקלדות, יעזור ל-Android לתמוך במגוון רחב יותר של צגי בריל לאורך זמן.
אינטרנציונליזציה
ב-Android 15 נוספו תכונות ויכולות שמשתלבות בחוויית המשתמש כשמשתמשים במכשיר בשפות שונות.
גופן משתנה CJK
从 Android 15 开始,面向中文、日文和韩文 (CJK) 语言的字体文件 NotoSansCJK 现在是可变字体。可变字体为中日韩语言的创意排版提供了更多可能性。设计师可以探索更多样式的排版,并制作出以前难以实现或根本无法实现的视觉效果出色的布局。
![](https://developer.android.google.cn/static/about/versions/15/images/cjk-variable-font.png?authuser=1&hl=he)
תצוגה צפופה בין התווים
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.
![](https://developer.android.google.cn/static/about/versions/15/images/none-japanese.png?authuser=1&hl=he)
JUSTIFICATION_MODE_NONE
.![](https://developer.android.google.cn/static/about/versions/15/images/none-english.png?authuser=1&hl=he)
JUSTIFICATION_MODE_NONE
.![](https://developer.android.google.cn/static/about/versions/15/images/inter-word-japanese.png?authuser=1&hl=he)
JUSTIFICATION_MODE_INTER_WORD
.![](https://developer.android.google.cn/static/about/versions/15/images/inter-word-english.png?authuser=1&hl=he)
JUSTIFICATION_MODE_INTER_WORD
.![](https://developer.android.google.cn/static/about/versions/15/images/inter-character-japanese.png?authuser=1&hl=he)
JUSTIFICATION_MODE_INTER_CHARACTER
.![](https://developer.android.google.cn/static/about/versions/15/images/inter-character-english.png?authuser=1&hl=he)
JUSTIFICATION_MODE_INTER_CHARACTER
.הגדרה אוטומטית של מעבר שורה
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:
![](https://developer.android.google.cn/static/about/versions/15/images/line-break-auto-short.png?authuser=1&hl=he)
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:
![](https://developer.android.google.cn/static/about/versions/15/images/line-break-auto-long.png?authuser=1&hl=he)
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
.גופן נוסף של היפנית הנטאיגאנה
בגרסה Android 15, קובץ גופן של היראגאנה היפנית הישנה (המכונה Hentaigana) נכלל בחבילה כברירת מחדל. הצורות הייחודיות של דמויות הנטאייגה יכולות להוסיף מראה ייחודי לגרפיקה או לעיצוב, תוך שמירה על רמת דיוק גבוהה הפצה והבנה של מסמכים יפניים עתיקים.
![](https://developer.android.google.cn/static/about/versions/15/images/hentaigana-font.png?authuser=1&hl=he)
VideoLAN cone Copyright (c) 1996-2010 VideoLAN. This logo or a modified version may be used or modified by anyone to refer to the VideoLAN project or any product developed by the VideoLAN team, but does not indicate endorsement by the project.
Vulkan and the Vulkan logo are registered trademarks of the Khronos Group Inc.
OpenGL is a registered trademark and the OpenGL ES logo is a trademark of Hewlett Packard Enterprise used by permission by Khronos.