แพลตฟอร์ม Android 15 มีการเปลี่ยนแปลงลักษณะการทำงานที่อาจส่งผลต่อแอปของคุณ
การเปลี่ยนแปลงลักษณะการทำงานต่อไปนี้มีผลกับแอปทั้งหมดเมื่อทำงานบน Android 15 ไม่ว่าจะมี targetSdkVersion
หรือไม่ก็ตาม คุณควรทดสอบแอปแล้วแก้ไขแอปตามที่จำเป็นเพื่อรองรับฟีเจอร์เหล่านี้อย่างเหมาะสม (หากมี)
โปรดตรวจสอบรายการการเปลี่ยนแปลงลักษณะการทำงานที่ส่งผลต่อแอปที่กําหนดเป้าหมายเป็น Android 15 เท่านั้นด้วย
ฟังก์ชันหลัก
Android 15 แก้ไขหรือขยายความสามารถหลักต่างๆ ของระบบ Android
การเปลี่ยนแปลงสถานะ "หยุดแพ็กเกจ"
The intention of the package FLAG_STOPPED
state (which users
can engage in AOSP builds by long-pressing an app icon and selecting "Force
Stop") has always been to keep apps in this state until the user explicitly
removes the app from this state by directly launching the app or indirectly
interacting with the app (through the sharesheet or a widget, selecting the app
as live wallpaper, etc.). In Android 15, we've updated the behavior of the
system to be aligned with this intended behavior. Apps should only be removed
from the stopped state through direct or indirect user action.
To support the intended behavior, in addition to the existing restrictions, the
system also cancels all pending intents when the app enters the
stopped state on a device running Android 15. When the user's actions remove the
app from the stopped state, the ACTION_BOOT_COMPLETED
broadcast is delivered to the app providing an opportunity to re-register any
pending intents.
You can call the new
ApplicationStartInfo.wasForceStopped()
method to confirm whether the app was put into the stopped state.
การรองรับขนาดหน้า 16 KB
ที่ผ่านมา Android รองรับหน้าหน่วยความจำขนาด 4 KB เท่านั้น ซึ่งมี เพิ่มประสิทธิภาพหน่วยความจำของระบบสำหรับปริมาณหน่วยความจำทั้งหมดโดยเฉลี่ย อุปกรณ์ Android ที่มักมีในระบบ AOSP รองรับตั้งแต่ Android 15 เป็นต้นไป อุปกรณ์ที่มีการกำหนดค่าให้ใช้หน้าขนาด 16 KB (16 KB) อุปกรณ์) หากแอปใช้ไลบรารี NDK โดยตรงอย่างใดอย่างหนึ่ง หรือโดยอ้อมผ่าน SDK คุณจะต้องสร้างแอปใหม่เพื่อ ใช้ได้กับอุปกรณ์ขนาด 16 KB เหล่านี้
เนื่องจากผู้ผลิตอุปกรณ์ยังคงผลิตอุปกรณ์จำนวนมาก หน่วยความจำกายภาพ (RAM) อุปกรณ์จำนวนมากจะใช้ 16 KB (และ และใหญ่ขึ้น) เพื่อเพิ่มประสิทธิภาพของอุปกรณ์ กำลังเพิ่ม การรองรับอุปกรณ์ขนาดหน้า 16 KB จะช่วยให้แอปของคุณทํางานบนอุปกรณ์เหล่านี้ได้ อุปกรณ์และช่วยให้แอปของคุณได้รับประโยชน์จากประสิทธิภาพที่เกี่ยวข้อง เพิ่มขึ้น หากไม่ทำการคอมไพล์ซ้ำ แอปอาจไม่ทำงานในอุปกรณ์ขนาด 16 KB เมื่อเวอร์ชันที่ใช้งานจริงใน Android รุ่นต่อๆ ไป
เราได้ให้คำแนะนำเกี่ยวกับวิธีตรวจสอบ หากแอปได้รับผลกระทบ วิธีการ สร้างแอปอีกครั้ง (หากมี) และวิธีทดสอบแอปใน สภาพแวดล้อมขนาด 16 KB โดยใช้เครื่องมือจำลอง (รวมถึง Android 15 อิมเมจระบบสำหรับ Android Emulator)
ประโยชน์และประสิทธิภาพที่เพิ่มขึ้น
อุปกรณ์ที่กำหนดค่าหน้าเว็บขนาด 16 KB จะใช้หน่วยความจำโดยเฉลี่ยมากกว่าเล็กน้อย แต่ปรับปรุงประสิทธิภาพการทำงานได้หลากหลายสำหรับทั้งระบบและแอป ดังนี้
- เวลาเปิดแอปลดลงขณะที่ระบบมีภาระเกี่ยวกับหน่วยความจำ: ลดลงโดยเฉลี่ย 3.16% โดยการปรับปรุงที่เห็นได้ชัดมากขึ้น (สูงสุด 30%) สำหรับบางแอปที่เราทดสอบ
- การลดพลังงานในระหว่างการเปิดแอป: ลดลง 4.56% โดยเฉลี่ย
- การเปิดตัวกล้องเร็วขึ้น: Hot Start เร็วขึ้น 4.48% โดยเฉลี่ย และ Cold Start เร็วขึ้น 6.60% โดยเฉลี่ย
- ปรับปรุงเวลาในการบูตระบบ: เร็วขึ้น 8% (ประมาณ 950 มิลลิวินาที) โดยเฉลี่ย
การปรับปรุงเหล่านี้อิงตามการทดสอบขั้นต้นของเรา และผลลัพธ์ในอุปกรณ์จริงอาจแตกต่างกัน เราจะให้การวิเคราะห์เพิ่มเติมเกี่ยวกับโอกาสในการได้ผู้ใช้ใหม่สำหรับแอปขณะที่เราทำการทดสอบต่อไป
ตรวจสอบว่าแอปของคุณได้รับผลกระทบหรือไม่
หากแอปใช้โค้ดเนทีฟ คุณควรสร้างแอปใหม่โดยรองรับอุปกรณ์ 16 KB หากไม่แน่ใจว่าแอปใช้โค้ดเนทีฟหรือไม่ คุณสามารถใช้เครื่องมือวิเคราะห์ APK เพื่อดูว่ามีโค้ดเนทีฟอยู่หรือไม่ จากนั้นตรวจสอบการจัดแนวของกลุ่ม ELF เพื่อหาไลบรารีที่ใช้ร่วมกันที่คุณพบ
หากแอปใช้เฉพาะโค้ดที่เขียนด้วยภาษาโปรแกรม Java หรือ Kotlin รวมถึงไลบรารีหรือ SDK ทั้งหมด แอปของคุณรองรับอุปกรณ์ขนาด 16 KB อยู่แล้ว อย่างไรก็ตาม เราขอแนะนำให้คุณทดสอบแอปในสภาพแวดล้อม 16 KB เพื่อยืนยันว่าไม่มีการแสดงลักษณะการทำงานที่แย่ลงอย่างฉับพลันของแอป
การเปลี่ยนแปลงที่จำเป็นเพื่อให้แอปบางแอปรองรับพื้นที่ส่วนตัว
พื้นที่ส่วนตัวเป็นฟีเจอร์ใหม่ใน Android 15 ที่ช่วยให้ผู้ใช้สร้างพื้นที่แยกต่างหากในอุปกรณ์เพื่อซ่อนแอปที่มีความละเอียดอ่อนจากผู้อื่นได้ภายใต้การตรวจสอบสิทธิ์อีกชั้น เนื่องจากแอปในพื้นที่ส่วนตัวมีระดับการเข้าถึงที่จํากัด แอปบางประเภทจึงต้องทําตามขั้นตอนเพิ่มเติมเพื่อดูและโต้ตอบกับแอปในพื้นที่ส่วนตัวของผู้ใช้
แอปทั้งหมด
เนื่องจากแอปในพื้นที่ส่วนตัวจะจัดเก็บไว้ในโปรไฟล์ผู้ใช้แยกต่างหาก ซึ่งคล้ายกับโปรไฟล์งาน แอปจึงไม่ควรถือว่าสำเนาของแอปที่ติดตั้งไว้ซึ่งไม่ได้อยู่ในโปรไฟล์หลักอยู่ในโปรไฟล์งาน หากแอปของคุณมีตรรกะที่เกี่ยวข้องกับแอปโปรไฟล์งานซึ่งทำการคาดการณ์นี้ คุณจะต้องปรับตรรกะนี้
แอปการแพทย์
เมื่อผู้ใช้ล็อกพื้นที่ส่วนตัว แอปทั้งหมดในพื้นที่ส่วนตัวจะหยุดทำงาน และแอปเหล่านั้นจะไม่สามารถทำงานในเบื้องหน้าหรือเบื้องหลัง รวมถึงแสดงการแจ้งเตือน ลักษณะการทำงานนี้อาจส่งผลต่อการใช้งานและการทำงานของแอปการแพทย์ที่ติดตั้งในพื้นที่ส่วนตัวอย่างร้ายแรง
ประสบการณ์การตั้งค่าพื้นที่ส่วนตัวจะเตือนผู้ใช้ว่าพื้นที่ส่วนตัวไม่เหมาะสำหรับแอปที่ต้องทำงานในเบื้องหน้าหรือเบื้องหลังที่สำคัญ เช่น การแสดงการแจ้งเตือนจากแอปการแพทย์ อย่างไรก็ตาม แอปไม่สามารถระบุได้ว่ามีการใช้แอปดังกล่าวในพื้นที่ส่วนตัวหรือไม่ จึงไม่สามารถแสดงคำเตือนต่อผู้ใช้ในกรณีนี้ได้
ด้วยเหตุนี้ หากคุณพัฒนาแอปทางการแพทย์ โปรดตรวจสอบว่าฟีเจอร์นี้อาจส่งผลต่อแอปของคุณอย่างไรและดำเนินการตามความเหมาะสม เช่น แจ้งให้ผู้ใช้อย่าติดตั้งแอปในพื้นที่ส่วนตัว เพื่อไม่ให้ความสามารถที่สำคัญของแอปหยุดชะงัก
แอป Launcher
หากคุณพัฒนาแอป Launcher คุณต้องดำเนินการต่อไปนี้ก่อนแอปในพื้นที่ส่วนตัวจะปรากฏ
- แอปของคุณต้องได้รับการกำหนดเป็นแอป Launcher เริ่มต้นสำหรับอุปกรณ์ กล่าวคือ มีแอปมีบทบาท
ROLE_HOME
- แอปของคุณต้องประกาศสิทธิ์ทั่วไป
ACCESS_HIDDEN_PROFILES
ในไฟล์ Manifest ของแอป
แอป Launcher ที่ประกาศสิทธิ์ ACCESS_HIDDEN_PROFILES
ต้องจัดการกรณีการใช้งานพื้นที่ส่วนตัวต่อไปนี้
- แอปของคุณต้องมีคอนเทนเนอร์ Launcher แยกต่างหากสำหรับแอปที่ติดตั้งในพื้นที่ส่วนตัว ใช้เมธอด
getLauncherUserInfo()
เพื่อระบุประเภทโปรไฟล์ผู้ใช้ที่จัดการ - ผู้ใช้ต้องซ่อนและแสดงคอนเทนเนอร์พื้นที่ส่วนตัวได้
- ผู้ใช้ต้องสามารถล็อกและปลดล็อกคอนเทนเนอร์พื้นที่ส่วนตัวได้ ใช้เมธอด
requestQuietModeEnabled()
เพื่อล็อก (โดยส่งtrue
) หรือปลดล็อก (โดยส่งfalse
) พื้นที่ส่วนตัว ขณะล็อกอยู่ ไม่ควรมีแอปใดๆ ในคอนเทนเนอร์พื้นที่ส่วนตัวที่มองเห็นหรือค้นพบได้ผ่านกลไกต่างๆ เช่น การค้นหา แอปของคุณควรลงทะเบียนตัวรับสำหรับการออกอากาศ
ACTION_PROFILE_AVAILABLE
และACTION_PROFILE_UNAVAILABLE
และอัปเดต UI ในแอปเมื่อสถานะล็อกหรือปลดล็อกของคอนเทนเนอร์พื้นที่ส่วนตัวมีการเปลี่ยนแปลง การออกอากาศทั้ง 2 รายการนี้จะมีEXTRA_USER
ซึ่งแอปของคุณสามารถใช้เพื่ออ้างอิงผู้ใช้โปรไฟล์ส่วนตัวนอกจากนี้ คุณยังใช้วิธี
isQuietModeEnabled()
เพื่อตรวจสอบว่าโปรไฟล์พื้นที่ส่วนตัวล็อกอยู่หรือไม่ได้ด้วย
แอป App Store
พื้นที่ส่วนตัวจะมีปุ่ม "ติดตั้งแอป" ซึ่งจะเปิดใช้งานความตั้งใจโดยนัยในการติดตั้งแอปในพื้นที่ส่วนตัวของผู้ใช้ หากต้องการให้แอปได้รับ Intent ที่ไม่ชัดแจ้งนี้ ให้ประกาศ <intent-filter>
ในไฟล์ Manifest ของแอปที่มี <category>
ของ CATEGORY_APP_MARKET
นำแบบอักษรอีโมจิแบบ PNG ออกแล้ว
ระบบได้นำไฟล์แบบเดิมที่เป็นแบบอักษร Emoji ที่ใช้ PNG (NotoColorEmojiLegacy.ttf
) ออกแล้ว เหลือไว้เฉพาะไฟล์แบบเวกเตอร์ ตั้งแต่ Android 13 (API ระดับ 33) ไฟล์แบบอักษรอีโมจิที่โปรแกรมแสดงผลอีโมจิของระบบใช้เปลี่ยนจากไฟล์ที่ใช้ PNG เป็นไฟล์ที่ใช้เวกเตอร์ ระบบจะเก็บไฟล์แบบอักษรเดิมไว้ใน Android 13 และ 14 เพื่อเหตุผลด้านความเข้ากันได้ เพื่อให้แอปที่มีโปรแกรมแสดงผลแบบอักษรของตัวเองใช้ไฟล์แบบอักษรเดิมต่อไปได้จนกว่าจะอัปเกรดได้
หากต้องการตรวจสอบว่าแอปได้รับผลกระทบหรือไม่ ให้ค้นหาการอ้างอิงไฟล์ NotoColorEmojiLegacy.ttf
ในโค้ดของแอป
คุณเลือกปรับแอปได้หลายวิธี ดังนี้
- ใช้ API ของแพลตฟอร์มสำหรับการแสดงผลข้อความ คุณสามารถแสดงผลข้อความเป็นไฟล์ที่รองรับบิตแมป
Canvas
และใช้ไฟล์ดังกล่าวเพื่อรับรูปภาพดิบได้หากจำเป็น - เพิ่มการรองรับแบบอักษร COLRv1 ลงในแอป ไลบรารีโอเพนซอร์ส FreeType รองรับ COLRv1 ในเวอร์ชัน 2.13.0 ขึ้นไป
- วิธีสุดท้ายคือคุณสามารถรวมไฟล์แบบอักษรอีโมจิเดิม (
NotoColorEmoji.ttf
) ไว้ใน APK ได้ แต่ในกรณีนี้แอปจะไม่มีอีโมจิเวอร์ชันอัปเดตล่าสุด ดูข้อมูลเพิ่มเติมได้ในหน้าโปรเจ็กต์ GitHub ของ Noto Emoji
เพิ่มเวอร์ชัน SDK เป้าหมายขั้นต่ำจาก 23 เป็น 24
Android 15 builds on the
the changes that were made in Android 14 and extends this
security further. In Android 15, apps with a
targetSdkVersion
lower than 24 can't be installed.
Requiring apps to meet modern API levels helps to ensure better security and
privacy.
Malware often targets lower API levels in order to bypass security and privacy
protections that have been introduced in higher Android versions. For example,
some malware apps use a targetSdkVersion
of 22 to avoid being subjected to the
runtime permission model introduced in 2015 by Android 6.0 Marshmallow (API
level 23). This Android 15 change makes it harder for malware to avoid security
and privacy improvements. Attempting to install an app targeting a lower API
level results in an installation failure, with a message like the following one
appearing in Logcat:
INSTALL_FAILED_DEPRECATED_SDK_VERSION: App package must target at least SDK version 24, but found 7
On devices upgrading to Android 15, any apps with a targetSdkVersion
lower
than 24 remain installed.
If you need to test an app targeting an older API level, use the following ADB command:
adb install --bypass-low-target-sdk-block FILENAME.apk
ความปลอดภัยและความเป็นส่วนตัว
Android 15 introduces robust measures to combat one-time passcode (OTP) fraud and to protect the user's sensitive content, focusing on hardening the Notification Listener Service and screenshare protections. Key enhancements include redacting OTPs from notifications accessible to untrusted apps, hiding notifications during screenshare, and securing app activities when OTPs are posted. These changes aim to keep the user's sensitive content safe from unauthorized actors.
Developers need to be aware of the following to ensure their apps are compatible with the changes in Android 15:
OTP Redaction
Android will stop untrusted apps that implement a
NotificationListenerService
from reading unredacted content
from notifications where an OTP has been detected. Trusted apps such as
companion device manager associations are exempt from these restrictions.
Screenshare Protection
- Notification content is hidden during screen sharing sessions to preserve
the user's privacy. If the app implements
setPublicVersion()
, Android shows the public version of the notification which serves as a replacement notification in insecure contexts. Otherwise, the notification content is redacted without any further context. - Sensitive content like password input is hidden from remote viewers to prevent revealing the user's sensitive information.
- Activities from apps that post notifications during screenshare where an OTP has been detected will be hidden. App content is hidden from the remote viewer when launched.
- Beyond Android's automatic identification of sensitive fields, developers
can manually mark parts of their app as sensitive using
setContentSensitivity
, which is hidden from remote viewers during screenshare. - Developers can choose to toggle the Disable screen share protections option under Developer Options to be exempted from the screenshare protections for demo or testing purposes. The default system screen recorder is exempted from these changes, since the recordings remain on-device.
กล้องและสื่อ
Android 15 เปลี่ยนแปลงลักษณะการทํางานของกล้องและสื่อสําหรับแอปทั้งหมดดังต่อไปนี้
การเล่นเสียงโดยตรงและการโอนเสียงออกจะทำให้แทร็กเสียงโดยตรงหรือแทร็กเสียงที่โอนออกซึ่งเปิดอยู่ก่อนหน้านี้ใช้งานไม่ได้เมื่อถึงขีดจำกัดทรัพยากร
Before Android 15, if an app requested direct or offload audio playback while
another app was playing audio and the resource limits were reached, the app
would fail to open a new AudioTrack
.
Beginning with Android 15, when an app requests direct or offload
playback and the resource
limits are reached, the system invalidates any currently open
AudioTrack
objects which prevent fulfilling the new track request.
(Direct and offload audio tracks are typically opened for playback of compressed audio formats. Common use-cases for playing direct audio include streaming encoded audio over HDMI to a TV. Offload tracks are typically used to play compressed audio on a mobile device with hardware DSP acceleration.)
ประสบการณ์ของผู้ใช้และ UI ของระบบ
Android 15 มีการเปลี่ยนแปลงบางอย่างที่มุ่งสร้างประสบการณ์การใช้งานที่สม่ำเสมอและใช้งานง่ายยิ่งขึ้น
เปิดใช้ภาพเคลื่อนไหวย้อนกลับแบบคาดเดาสำหรับแอปที่เลือกใช้
ตั้งแต่ Android 15 เป็นต้นไป ระบบจะนำตัวเลือกสำหรับนักพัฒนาแอปสำหรับภาพเคลื่อนไหวย้อนกลับแบบคาดเดาออก ตอนนี้ภาพเคลื่อนไหวของระบบ เช่น การกลับไปที่หน้าจอหลัก การข้ามงาน และการข้ามกิจกรรมจะปรากฏในแอปที่เลือกใช้ท่าทางสัมผัสเพื่อกลับโดยประมาณทั้งในแอปหรือที่ระดับกิจกรรม หากแอปได้รับผลกระทบ ให้ดําเนินการต่อไปนี้
- ตรวจสอบว่าย้ายข้อมูลแอปอย่างถูกต้องเพื่อใช้ท่าทางสัมผัสย้อนกลับแบบคาดการณ์
- ตรวจสอบว่าการเปลี่ยนเฟรมทํางานกับการนําทางกลับแบบคาดการณ์
- ย้ายข้อมูลออกจากภาพเคลื่อนไหวและการเปลี่ยนเฟรมเวิร์ก และใช้ Animator และการเปลี่ยนของ androidx แทน
- ย้ายออกจากกองซ้อนด้านหลังที่
FragmentManager
ไม่รู้ ให้ใช้กองซ้อนย้อนกลับที่จัดการโดยFragmentManager
หรือคอมโพเนนต์การนําทางแทน
วิดเจ็ตปิดอยู่เมื่อผู้ใช้บังคับให้แอปหยุด
If a user force-stops an app on a device running Android 15, the system temporarily disables all the app's widgets. The widgets are grayed out, and the user cannot interact with them. This is because beginning with Android 15, the system cancels all an app's pending intents when the app is force-stopped.
The system re-enables those widgets the next time the user launches the app.
For more information, see Changes to package stopped state.
ชิปแถบสถานะการฉายสื่อจะแจ้งให้ผู้ใช้ทราบเกี่ยวกับการแชร์หน้าจอ การแคสต์ และการบันทึก
การลักลอบใช้การฉายหน้าจอจะเปิดเผยข้อมูลส่วนตัวของผู้ใช้ เช่น ข้อมูลทางการเงิน เนื่องจากผู้ใช้ไม่ทราบว่ามีการแชร์หน้าจออุปกรณ์
สำหรับแอปที่ทำงานในอุปกรณ์ที่ใช้ Android 15 QPR1 ขึ้นไป ชิปในแถบสถานะที่ใหญ่และเห็นได้ชัดจะแจ้งให้ผู้ใช้ทราบถึงการฉายหน้าจอที่กำลังดำเนินอยู่ ผู้ใช้สามารถแตะชิปเพื่อหยุดไม่ให้แชร์ แคสต์ หรือบันทึกหน้าจอ นอกจากนี้ การฉายหน้าจอจะหยุดโดยอัตโนมัติเมื่อหน้าจออุปกรณ์ล็อกอยู่

Check if your app is impacted
By default, your app includes the status bar chip and automatically suspends screen projection when the lock screen activates.
To learn more about how to test your app for these use cases, see Status bar chip and auto stop.
การจำกัดการเข้าถึงเครือข่ายในเบื้องหลัง
In Android 15, apps that start a network request outside of a valid process
lifecycle receive an exception. Typically, an
UnknownHostException
or other socket-related
IOException
. Network requests that happen outside of a valid lifecycle are
usually due to apps unknowingly continuing a network request even after the app
is no longer active.
To mitigate this exception, ensure your network requests are lifecycle aware and cancelled upon leaving a valid process lifecycle by using lifecycle aware components. If it is important that the network request should happen even when the user leaves the application, consider scheduling the network request using WorkManager or continue a user visible task using Foreground Service.
การเลิกใช้งาน
ในแต่ละรุ่น API ของ Android บางรายการอาจล้าสมัยหรือจำเป็นต้องมีการรีแฟกทอริงเพื่อให้นักพัฒนาแอปได้รับประสบการณ์การใช้งานที่ดียิ่งขึ้นหรือรองรับความสามารถใหม่ๆ ของแพลตฟอร์ม ในกรณีเหล่านี้ เราจะเลิกใช้งาน API ที่ล้าสมัยอย่างเป็นทางการและแนะนำให้นักพัฒนาแอปเปลี่ยนไปใช้ API อื่นแทน
การเลิกใช้งานหมายความว่าเราได้สิ้นสุดการสนับสนุนอย่างเป็นทางการสำหรับ API ดังกล่าวแล้ว แต่นักพัฒนาแอปจะยังคงใช้งาน API ดังกล่าวได้ ดูข้อมูลเพิ่มเติมเกี่ยวกับการเลิกใช้งานที่สำคัญใน Android เวอร์ชันนี้ได้ที่หน้าการเลิกใช้งาน