เช่นเดียวกับรุ่นก่อนหน้า Android 17 มีการเปลี่ยนแปลงลักษณะการทำงานที่อาจส่งผลต่อ แอปของคุณ การเปลี่ยนแปลงลักษณะการทำงานต่อไปนี้จะมีผลเฉพาะกับแอปที่ กำหนดเป้าหมายเป็น Android 17 ขึ้นไป หากแอปกำหนดเป้าหมายเป็น Android 17 ขึ้นไป คุณควรแก้ไขแอปให้รองรับลักษณะการทำงานเหล่านี้ในกรณีที่เกี่ยวข้อง
นอกจากนี้ โปรดตรวจสอบรายการการเปลี่ยนแปลงลักษณะการทำงานที่ส่งผลต่อแอปทั้งหมด
ที่ทำงานบน Android 17 ไม่ว่า targetSdkVersion ของแอปจะเป็นอย่างไร
ฟังก์ชันหลัก
Android 17 มีการเปลี่ยนแปลงต่อไปนี้ซึ่งแก้ไขหรือ ขยายความสามารถหลักต่างๆ ของระบบ Android
การติดตั้งใช้งาน MessageQueue แบบใหม่ที่ไม่มีการล็อก
Beginning with Android 17, apps targeting Android 17 (API level 37)
or higher receive a new lock-free implementation of
android.os.MessageQueue. The new implementation improves performance and
reduces missed frames, but may break clients that reflect on MessageQueue
private fields and methods.
For more information, including mitigation strategies, see MessageQueue behavior change guidance.
ตอนนี้ฟิลด์สุดท้ายแบบคงที่แก้ไขไม่ได้แล้ว
Apps running on Android 17 or higher that target
Android 17 (API level 37) or higher cannot change static final fields. If
an app attempts to change a static final field by using reflection, it will
cause an IllegalAccessException. Attempting to modify one of these fields
through JNI APIs (such as SetStaticLongField()) will cause the app to crash.
การช่วยเหลือพิเศษ
Android 17 ทำการเปลี่ยนแปลงต่อไปนี้เพื่อปรับปรุงการช่วยเหลือพิเศษ
การรองรับการช่วยเหลือพิเศษสำหรับการพิมพ์ด้วยแป้นพิมพ์จริงของ 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.
ความเป็นส่วนตัว
Android 17 มีการเปลี่ยนแปลงต่อไปนี้เพื่อปรับปรุงความเป็นส่วนตัวของผู้ใช้
เปิดใช้ ECH (Encrypted Client Hello) แล้ว
Android 17 ขอแนะนำการรองรับแพลตฟอร์มสำหรับ ClientHello ที่เข้ารหัส (ECH) ซึ่งเป็นส่วนขยาย TLS ที่ช่วยเพิ่มความเป็นส่วนตัวของผู้ใช้ด้วยการเข้ารหัสการระบุชื่อเซิร์ฟเวอร์ (SNI) ในการแฮนด์เชก TLS การเข้ารหัสนี้ช่วยป้องกันไม่ให้ผู้สังเกตการณ์เครือข่ายระบุโดเมนที่เฉพาะเจาะจงซึ่งแอปของคุณเชื่อมต่ออยู่ได้อย่างง่ายดาย
สำหรับแอปที่กำหนดเป้าหมายเป็น Android 17 (ระดับ API 37) ขึ้นไป ระบบจะใช้ ECH สำหรับการเชื่อมต่อ TLS ECH จะทำงานก็ต่อเมื่อไลบรารีเครือข่ายที่แอปใช้ (เช่น HttpEngine, WebView หรือ OkHttp) มีการรองรับ ECH ในตัว และเซิร์ฟเวอร์ระยะไกลรองรับโปรโตคอล ECH ด้วย หากเจรจาต่อรอง ECH ไม่ได้ ไคลเอ็นต์จะส่งส่วนขยาย ECH ที่มีเนื้อหาแบบสุ่ม (กลไกที่เรียกว่า ECH GREASE) ดูรายละเอียดเพิ่มเติมเกี่ยวกับวิธีที่ ECH GREASE ทำงานได้ที่ RFC 9849
Android 17 เพิ่มองค์ประกอบใหม่
<domainEncryption>ลงในไฟล์การกำหนดค่าความปลอดภัยของเครือข่ายเพื่อให้แอปปรับแต่งลักษณะการทำงานนี้ได้
นักพัฒนาแอปสามารถใช้ <domainEncryption> ภายใน <base-config> หรือ
<domain-config> แท็กเพื่อเลือกโหมด ECH (เช่น
"enabled" หรือ "disabled") ในระดับโลกหรือระดับโดเมน
ดูข้อมูลเพิ่มเติมได้ที่เอกสารประกอบเกี่ยวกับ ClientHello ที่เข้ารหัส
ต้องมีสิทธิ์เข้าถึงเครือข่าย LAN สำหรับแอปที่กำหนดเป้าหมายเป็น Android 17
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 มาตรฐาน
Beginning with Android 17, Android is extending its SMS OTP protection
to apply to standard SMS messages (SMS messages containing an OTP that do not
use the WebOTP or SMS Retriever formats). For most apps targeting
Android 17 (API level 37) or higher, these SMS messages do not become
available until three hours after receipt. This delay is intended to help
prevent OTP hijacking. During this three hour delay, the
SMS_RECEIVED_ACTION broadcast is withheld and
SMS provider database queries are filtered. The SMS message is
available to these apps after the delay.
Certain apps such as the default SMS assistant app, connected device companion apps, etc., are exempted from this delay. All apps that rely on reading SMS messages for OTP extraction should transition to using SMS Retriever or SMS User Consent APIs to ensure continued functionality.
ความปลอดภัย
Android 17 มีการปรับปรุงความปลอดภัยของอุปกรณ์และแอปดังนี้
ความปลอดภัยของกิจกรรม
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
对于以 Android 17(API 级别 37)及更高版本为目标平台的应用,当在没有 READ_CONTACTS 权限的情况下访问 ContactsContract.Data 表时,联系人提供程序 2 (CP2) 会强制执行严格的 SQL 查询验证。
在此项更改生效后,如果应用没有 READ_CONTACTS 权限,则在查询 ContactsContract.Data 表时会设置 StrictColumns 和 StrictGrammar 选项。如果查询使用的模式与这些模式不兼容,则会被拒绝并导致抛出异常。
สื่อ
Android 17 มีการเปลี่ยนแปลงลักษณะการทำงานของสื่อต่อไปนี้
การปิดช่องโหว่ของเสียงเบื้องหลัง
ตั้งแต่ Android 17 เป็นต้นไป เฟรมเวิร์กเสียงจะบังคับใช้ข้อจำกัดเกี่ยวกับการโต้ตอบกับเสียงในเบื้องหลัง ซึ่งรวมถึงการเล่นเสียง คำขอโฟกัสเสียง และ API การเปลี่ยนแปลงระดับเสียง เพื่อให้มั่นใจว่าผู้ใช้เป็นผู้เริ่มการเปลี่ยนแปลงเหล่านี้โดยเจตนา
ข้อจำกัดด้านเสียงบางอย่างมีผลกับแอปทั้งหมด อย่างไรก็ตาม ข้อจำกัดจะเข้มงวดมากขึ้นหากแอปกำหนดเป้าหมายเป็น Android 17 (ระดับ API 37) หากแอปใดแอปหนึ่งต่อไปนี้โต้ตอบกับเสียงขณะทำงานในเบื้องหลัง แอปนั้นจะต้องมีบริการที่ทำงานอยู่เบื้องหน้า นอกจากนี้ แอปต้องเป็นไปตามข้อกำหนดข้อใดข้อหนึ่งหรือทั้ง 2 ข้อต่อไปนี้
- บริการที่ทำงานอยู่เบื้องหน้าต้องมีความสามารถในการทำงานขณะใช้งาน (WIU)
- แอปต้องมีสิทธิ์ปลุกที่แน่นอนและโต้ตอบกับ
USAGE_ALARMสตรีมเสียง
ดูข้อมูลเพิ่มเติม รวมถึงกลยุทธ์การลดผลกระทบได้ที่การรักษาความปลอดภัยของเสียงในเบื้องหลัง
รูปแบบของอุปกรณ์
Android 17 มีการเปลี่ยนแปลงต่อไปนี้เพื่อปรับปรุงประสบการณ์ของผู้ใช้ ในอุปกรณ์ขนาดและรูปแบบต่างๆ
การเปลี่ยนแปลง API ของแพลตฟอร์มเพื่อไม่สนใจข้อจำกัดด้านการวางแนว ความสามารถในการปรับขนาด และสัดส่วนภาพบนหน้าจอขนาดใหญ่ (sw>=600dp)
We introduced Platform API changes in Android 16 to ignore orientation, aspect ratio, and resizability restrictions on large screens (sw >= 600dp) for apps targeting API level 36 or higher. Developers have the option to opt out of these changes with SDK 36, but this opt-out will no longer be available for apps that target Android 17 (API level 37) or higher.
For more information, see Restrictions on orientation and resizability are ignored.
การเชื่อมต่อ
Android 17 มีการเปลี่ยนแปลงต่อไปนี้เพื่อปรับปรุงความสอดคล้องและ
ให้สอดคล้องกับInputStreamลักษณะการทำงานของ Java มาตรฐานสำหรับซ็อกเก็ต RFCOMM ของบลูทูธ
ลักษณะการทำงานของ read() ใน BluetoothSocket สำหรับ RFCOMM ที่สอดคล้องกัน
สำหรับแอปที่กำหนดเป้าหมายเป็น Android 17 (API ระดับ 37) ตอนนี้เมธอด
read() ของ InputStream ที่ได้จาก
BluetoothSocket ที่อิงตาม RFCOMM จะแสดงผล -1 เมื่อ
ซ็อกเก็ตปิดอยู่หรือการเชื่อมต่อขาดหายไป
การเปลี่ยนแปลงนี้ทำให้พฤติกรรมของซ็อกเก็ต RFCOMM สอดคล้องกับซ็อกเก็ต LE CoC และ
สอดคล้องกับเอกสารประกอบ InputStream.read()
มาตรฐาน ซึ่งระบุว่าระบบจะแสดงผล -1 เมื่อถึงจุดสิ้นสุดของสตรีม
แอปที่อาศัยการดักจับ IOException เพียงอย่างเดียวเพื่อออกจากลูปการอ่านอาจได้รับผลกระทบจากการเปลี่ยนแปลงนี้ และควรอัปเดตลูปการอ่าน BluetoothSocket เพื่อตรวจสอบค่าที่แสดงผล -1 อย่างชัดแจ้ง ซึ่งจะช่วยให้ลูปสิ้นสุดลงอย่างถูกต้องเมื่ออุปกรณ์ระยะไกลตัดการเชื่อมต่อหรือซ็อกเก็ตปิดอยู่ ดูตัวอย่างการติดตั้งใช้งานที่แนะนำได้ใน
ข้อมูลโค้ดในคู่มือการโอนข้อมูล Bluetooth