مانند نسخههای قبلی، اندروید ۱۷ شامل تغییرات رفتاری است که ممکن است بر برنامه شما تأثیر بگذارد. تغییرات رفتاری زیر منحصراً برای برنامههایی اعمال میشود که اندروید ۱۷ یا بالاتر را هدف قرار میدهند. اگر برنامه شما اندروید ۱۷ یا بالاتر را هدف قرار میدهد، باید برنامه خود را برای پشتیبانی از این رفتارها، در صورت لزوم، اصلاح کنید.
حتماً فهرست تغییرات رفتاری که صرف نظر از targetSdkVersion برنامه شما، بر همه برنامههای در حال اجرا در اندروید ۱۷ تأثیر میگذارند را نیز بررسی کنید.
عملکرد اصلی
اندروید ۱۷ شامل تغییرات زیر است که قابلیتهای اصلی مختلف سیستم اندروید را اصلاح یا گسترش میدهد.
پیادهسازی جدید و بدون قفل MessageQueue
从 Android 17 开始,以 Android 17(API 级别 37)
或更高版本为目标平台的应用会收到
android.os.MessageQueue 的新无锁实现。新实现可提升性能并减少丢帧,但可能会破坏反映 MessageQueue 私有字段和方法的客户端。
如需了解详情(包括缓解措施),请参阅 MessageQueue 行为变更指南。
فیلدهای نهایی استاتیک اکنون غیرقابل تغییر هستند
在以 Android 17(API 级别 37)或更高版本为目标平台的 Android 17 或更高版本上运行的应用无法更改 static final 字段。如果应用尝试使用反射更改 static final 字段,则会导致 IllegalAccessException。尝试通过 JNI API(例如 SetStaticLongField())修改其中一个字段会导致应用崩溃。
دسترسیپذیری
اندروید ۱۷ تغییرات زیر را برای بهبود دسترسی ایجاد میکند.
پشتیبانی از قابلیت دسترسی برای تایپ پیچیده با صفحه کلید فیزیکی IME
This feature introduces new AccessibilityEvent and TextAttribute
APIs to enhance screen reader spoken feedback for CJKV language input. CJKV IME
apps can now signal whether a text conversion candidate has been selected during
text composition. Apps with edit fields can specify text change types when
sending text changed accessibility events.
For example, apps can specify that a text change occurred during text
composition, or that a text change resulted from a commit.
Doing this enables accessibility
services such as screen readers to deliver more precise feedback based on the
nature of the text modification.
App adoption
IME Apps: When setting composing text in edit fields, IMEs can use
TextAttribute.Builder.setTextSuggestionSelected()to indicate whether a specific conversion candidate was selected.Apps with Edit Fields: Apps that maintain a custom
InputConnectioncan retrieve candidate selection data by callingTextAttribute.isTextSuggestionSelected(). These apps should then callAccessibilityEvent.setTextChangeTypes()when dispatchingTYPE_VIEW_TEXT_CHANGEDevents. Apps targeting Android 17 (API level 37) that use the standardTextViewwill have this feature enabled by default. (That is,TextViewwill handle retrieving data from the IME and setting text change types when sending events to accessibility services).Accessibility Services: Accessibility services that process
TYPE_VIEW_TEXT_CHANGEDevents can callAccessibilityEvent.getTextChangeTypes()to identify the nature of the modification and adjust their feedback strategies accordingly.
حریم خصوصی
اندروید ۱۷ شامل تغییرات زیر برای بهبود حریم خصوصی کاربران است.
ECH (سلام کلاینت رمزگذاری شده) فعال شد
Android 17 引入了对加密客户端问候 (ECH) 的平台支持。ECH 是一种 TLS 扩展,可通过加密 TLS 握手中的服务器名称指示 (SNI) 来增强用户隐私保护。这种加密有助于防止网络观察者轻松识别您的应用所连接的特定网域。
对于以 Android 17(API 级别 37)或更高版本为目标平台的应用,ECH 用于 TLS 连接。只有当应用使用的网络库(例如 HttpEngine、WebView 或 OkHttp)已集成 ECH 支持,并且远程服务器也支持 ECH 协议时,ECH 才会处于活跃状态。如果无法协商 ECH,客户端会发送一个包含随机内容的 ECH 扩展(一种称为 ECH GREASE 的机制)。如需详细了解 ECH GREASE 的工作原理,请参阅 RFC 9849。
为了让应用能够自定义此行为,Android 17 向网络安全配置文件添加了一个新的
<domainEncryption> 元素。
开发者可以在 <base-config> 或
<domain-config> 标记中使用 <domainEncryption>,以全局或按网域的方式选择 ECH 模式(例如
"enabled" 或 "disabled")。
如需了解详情,请参阅加密客户端问候文档。
مجوز شبکه محلی برای برنامههایی که اندروید ۱۷ را هدف قرار میدهند، الزامی است
Android 17 introduces the ACCESS_LOCAL_NETWORK runtime permission
to protect users from unauthorized local network access. Because this falls
under the existing NEARBY_DEVICES permission group, users who have already
granted other NEARBY_DEVICES permissions aren't prompted again. This new
requirement prevents malicious apps from exploiting unrestricted local network
access for covert user tracking and fingerprinting. By declaring and requesting
this permission, your app can discover and connect to devices on the local area
network (LAN), such as smart home devices or casting receivers.
Apps targeting Android 17 (API level 37) or higher now have two paths to maintain communication with LAN devices: Adopt system-mediated, privacy-preserving device pickers to skip the permission prompt, or explicitly request this new permission at runtime to maintain local network communication.
For more information, see the Local network permission documentation.
پنهان کردن رمزهای عبور از دستگاههای فیزیکی
如果应用以 Android 17(API 级别 37)或更高版本为目标平台,并且用户使用的是实体输入设备(例如外接键盘),Android
操作系统会对密码字段中的所有字符应用新的 show_passwords_physical 设置。默认情况下,该设置会隐藏所有密码字符。
Android 系统会显示用户最后输入的密码字符,以帮助用户查看是否输错了密码。不过,对于较大的外接键盘,此功能就没那么必要了。此外,配备外接键盘的设备通常具有较大的显示屏,这会增加他人看到输入密码的风险。
如果用户使用的是设备触摸屏,系统会应用新的 show_passwords_touch 设置。
محافظت OTP برای پیامهای SMS استاندارد
从 Android 17 开始,Android 将扩展其短信验证码保护功能,以适用于标准短信(包含验证码但不使用 WebOTP 或 SMS Retriever 格式的短信)。对于以 Android 17(API 级别 37)或更高版本为目标平台的应用,这些短信在收到后三小时内不会提供。此延迟旨在帮助防止动态密码劫持。在这三小时的延迟期间,系统会保留
SMS_RECEIVED_ACTION广播,并过滤
短信提供商数据库查询。延迟结束后,这些应用即可使用短信。
某些应用(例如默认短信助理应用、已连接的设备配套应用等)不受此延迟限制。所有依赖于读取短信 来提取动态密码的应用都应改用 SMS Retriever 或 SMS User Consent API,以确保功能持续可用。
امنیت
اندروید ۱۷ بهبودهای زیر را در امنیت دستگاه و برنامهها ایجاد میکند.
امنیت فعالیت
In Android 17, the platform continues its shift toward a "secure-by-default" architecture, introducing a suite of enhancements designed to mitigate high-severity exploits such as phishing, interaction hijacking, and confused deputy attacks. This update requires developers to explicitly opt in to new security standards to maintain app compatibility and user protection.
Key impacts for developers include:
- BAL hardening & improved opt-in: We are refining Background Activity
Launch (BAL) restrictions by extending protections to
IntentSender. Developers must migrate away from the legacyMODE_BACKGROUND_ACTIVITY_START_ALLOWEDconstant. Instead, you should adopt granular controls likeMODE_BACKGROUND_ACTIVITY_START_ALLOW_IF_VISIBLE, which restricts activity starts to scenarios where the calling app is visible, significantly reducing the attack surface. - Adoption tools: Developers should utilize strict mode and updated lint checks to identify legacy patterns and ensure readiness for future target SDK requirements.
فعال کردن CT به صورت پیشفرض
If an app targets Android 17 (API level 37) or higher, certificate transparency (CT) is enabled by default. (On Android 16, CT is available but apps had to opt in.)
DCL بومی امنتر—C
If your app targets Android 17 (API level 37) or higher, the Safer Dynamic Code Loading (DCL) protection introduced in Android 14 for DEX and JAR files now extends to native libraries.
All native files loaded using System.load() must be marked as read-only.
Otherwise, the system throws UnsatisfiedLinkError.
We recommend that apps avoid dynamically loading code whenever possible, as doing so greatly increases the risk that an app can be compromised by code injection or code tampering.
محدود کردن فیلدهای PII در نمای داده CP2
For apps targeting Android 17 (API level Android 17 (API level 37)) and higher, Contacts Provider 2 (CP2) restricts certain columns containing Personally Identifiable Information (PII) from the data view. When this change is enabled, these columns are removed from the data view to enhance user privacy. The restricted columns include:
Apps that are using these columns from ContactsContract.Data
can extract them from ContactsContract.RawContacts
instead, by joining with RAW_CONTACT_ID.
اعمال بررسیهای سختگیرانه SQL در CP2
For apps targeting Android 17 (API level Android 17 (API level 37)) and
higher, Contacts Provider 2 (CP2) enforces strict SQL query validation when
the ContactsContract.Data table is accessed without
READ_CONTACTS permission.
With this change, if an app doesn't have READ_CONTACTS
permission, StrictColumns and
StrictGrammar options are set when querying
the ContactsContract.Data table. If a query
uses a pattern that isn't compatible with these, it will be
rejected and cause an exception to be thrown.
رسانه
اندروید ۱۷ شامل تغییرات زیر در رفتار رسانهای است.
تقویت صدای پسزمینه
从 Android 17 开始,音频框架对后台音频互动(包括音频播放、音频焦点请求和音量更改 API)强制执行限制,以确保这些更改是由用户有意启动的。
部分音频限制适用于所有应用。不过,如果应用以 Android 17(API 级别 37)为目标平台,则限制会更加严格。如果这些应用在后台运行时与音频互动,则必须有前台服务正在运行。此外,应用还必须满足以下一项或两项要求:
- 前台服务必须具有仅在使用时授予的权限 (WIU)。
- 应用必须具有精确闹钟权限,并且正在与
USAGE_ALARM音频流互动。
如需了解详情(包括缓解措施),请参阅后台音频安全加固。
فاکتورهای شکل دستگاه
اندروید ۱۷ شامل تغییرات زیر است تا تجربه کاربری را در طیف وسیعی از اندازهها و فرمفکتورهای دستگاه بهبود بخشد.
تغییرات API پلتفرم برای نادیده گرفتن محدودیتهای جهتگیری، تغییر اندازه و نسبت ابعاد در صفحات نمایش بزرگ (sw>=600dp)
我们在 Android 16 中引入了平台 API 变更,以 忽略屏幕方向、 宽高比和尺寸调整能力限制(针对大型屏幕,sw >= 600dp),适用于面向 API 级别 36 或更高级别的应用。开发者可以选择使用 SDK 36 退出这些变更,但对于面向 Android 17(API 级别 37)或更高级别的应用,此退出选项将不再可用。
如需了解详情,请参阅忽略屏幕方向和尺寸调整能力限制。
اتصال
اندروید ۱۷ تغییر زیر را برای بهبود سازگاری و همسویی با رفتار استاندارد Java InputStream برای سوکتهای بلوتوث RFCOMM معرفی میکند.
رفتار خواندن() ثابت BluetoothSocket برای RFCOMM
For apps targeting Android 17 (API level 37), the
read() method of the InputStream obtained from an
RFCOMM-based BluetoothSocket now returns -1 when the
socket is closed or the connection is dropped.
This change makes RFCOMM socket behavior consistent with LE CoC sockets and
aligns with the standard InputStream.read()
documentation, which states that -1 is returned when the end of the stream is
reached.
Apps that rely solely on catching an IOException to break out of a read loop may
be impacted by this change and should update the BluetoothSocket read loops to
explicitly check for a return value of -1. This ensures the loop terminates
correctly when the remote device disconnects or the socket is closed. For an
example of the recommended implementation, see the
code snippet in the Transfer Bluetooth data
guide.