แพลตฟอร์ม 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
Historically, Android has only supported 4 KB memory page sizes, which has optimized system memory performance for the average amount of total memory that Android devices have typically had. Beginning with Android 15, AOSP supports devices that are configured to use a page size of 16 KB (16 KB devices). If your app uses any NDK libraries, either directly or indirectly through an SDK, then you will need to rebuild your app for it to work on these 16 KB devices.
As device manufacturers continue to build devices with larger amounts of physical memory (RAM), many of these devices will adopt 16 KB (and eventually greater) page sizes to optimize the device's performance. Adding support for 16 KB page size devices enables your app to run on these devices and helps your app benefit from the associated performance improvements. Without recompiling, apps won't work on 16 KB devices in future Android releases.
To help you add support for your app, we've provided guidance on how to check if your app is impacted, how to rebuild your app (if applicable), and how to test your app in a 16 KB environment using emulators (including Android 15 system images for the Android Emulator).
ประโยชน์และประสิทธิภาพที่เพิ่มขึ้น
Devices configured with 16 KB page sizes use slightly more memory on average, but also gain various performance improvements for both the system and apps:
- Lower app launch times while the system is under memory pressure: 3.16% lower on average, with more significant improvements (up to 30%) for some apps that we tested
- Reduced power draw during app launch: 4.56% reduction on average
- Faster camera launch: 4.48% faster hot starts on average, and 6.60% faster cold starts on average
- Improved system boot time: improved by 8% (approximately 950 milliseconds) on average
These improvements are based on our initial testing, and results on actual devices will likely differ. We'll provide additional analysis of potential gains for apps as we continue our testing.
ตรวจสอบว่าแอปของคุณได้รับผลกระทบหรือไม่
If your app uses any native code, then you should rebuild your app with support for 16 KB devices. If you are unsure if your app uses native code, you can use the APK Analyzer to identify whether any native code is present and then check the alignment of ELF segments for any shared libraries that you find. Android Studio also provides features that help you to automatically detect alignment issues.
If your app only uses code written in the Java programming language or in Kotlin, including all libraries or SDKs, then your app already supports 16 KB devices. Nevertheless, we recommend that you test your app in a 16 KB environment to verify that there are no unexpected regressions in app behavior.
การเปลี่ยนแปลงที่จำเป็นสำหรับแอปบางแอปเพื่อให้รองรับพื้นที่ส่วนตัว
พื้นที่ส่วนตัวเป็นฟีเจอร์ใหม่ใน 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 ออกแล้ว
The legacy, PNG-based emoji font file (NotoColorEmojiLegacy.ttf) has been
removed, leaving just the vector-based file. Beginning with Android 13 (API
level 33), the emoji font file used by the system emoji renderer changed from a
PNG-based file to a vector based file. The system retained
the legacy font file in Android 13 and 14 for compatibility reasons, so that
apps with their own font renderers could continue to use the legacy font file
until they were able to upgrade.
To check if your app is affected, search your app's code for references to the
NotoColorEmojiLegacy.ttf file.
You can choose to adapt your app in a number of ways:
- Use platform APIs for text rendering. You can render text to a bitmap-backed
Canvasand use that to get a raw image if necessary. - Add COLRv1 font support to your app. The FreeType open source library supports COLRv1 in version 2.13.0 and higher.
- As a last resort, you can bundle the legacy emoji font file
(
NotoColorEmoji.ttf) into your APK, although in that case your app will be missing the latest emoji updates. For more information, see the Noto Emoji GitHub project page.
เพิ่มเวอร์ชัน 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 เปิดตัวมาตรการที่มีประสิทธิภาพในการต่อสู้กับการประพฤติมิชอบเกี่ยวกับรหัสผ่านแบบใช้ครั้งเดียว (OTP) และเพื่อปกป้องเนื้อหาที่มีความละเอียดอ่อนของผู้ใช้ โดยมุ่งเน้นที่การเพิ่มความแข็งแกร่งให้กับบริการโปรแกรมรับฟังการแจ้งเตือนและการปกป้องการแชร์หน้าจอ การปรับปรุงที่สำคัญ ได้แก่ การปกปิด OTP จากการแจ้งเตือนที่แอปที่ไม่เชื่อถือเข้าถึงได้ การซ่อนการแจ้งเตือนระหว่างการแชร์หน้าจอ และการรักษาความปลอดภัยของกิจกรรมในแอปเมื่อมีการแสดง OTP การเปลี่ยนแปลงเหล่านี้มีเป้าหมายเพื่อรักษาเนื้อหาที่ละเอียดอ่อนของผู้ใช้ให้ปลอดภัยจากบุคคลที่ไม่ได้รับอนุญาต
นักพัฒนาแอปต้องคำนึงถึงสิ่งต่อไปนี้เพื่อให้แอปของตนเข้ากันได้กับการเปลี่ยนแปลงใน Android 15
การปกปิดข้อมูลบางส่วนใน OTP
Android จะหยุดแอปที่ไม่เชื่อถือซึ่งใช้ NotificationListenerService ไม่ให้อ่านเนื้อหาที่ไม่มีการปกปิดจากการแจ้งเตือนที่ตรวจพบ OTP แอปที่เชื่อถือได้ เช่น การเชื่อมโยงกับเครื่องมือจัดการอุปกรณ์เสริมจะได้รับการยกเว้นจากข้อจำกัดเหล่านี้
การป้องกันการแชร์หน้าจอ
- ระบบจะซ่อนเนื้อหาการแจ้งเตือนระหว่างเซสชันการแชร์หน้าจอเพื่อรักษาความเป็นส่วนตัวของผู้ใช้ หากแอปใช้
setPublicVersion()แอป Android จะแสดงการแจ้งเตือนเวอร์ชันสาธารณะซึ่งทำหน้าที่เป็นการแจ้งเตือนแทนในบริบทที่ไม่ปลอดภัย ไม่เช่นนั้น ระบบจะปกปิดเนื้อหาการแจ้งเตือนโดยไม่มีบริบทเพิ่มเติม - ระบบจะซ่อนเนื้อหาที่ละเอียดอ่อน เช่น การป้อนรหัสผ่าน จากผู้ดูจากระยะไกลเพื่อป้องกันการเปิดเผยข้อมูลที่ละเอียดอ่อนของผู้ใช้
- ระบบจะซ่อนกิจกรรมจากแอปที่โพสต์การแจ้งเตือนระหว่างการแชร์หน้าจอซึ่งตรวจพบ OTP เนื้อหาแอปจะซ่อนจากผู้ดูระยะไกลเมื่อเปิดใช้งาน
- นอกจากการระบุช่องที่มีความละเอียดอ่อนโดยอัตโนมัติของ Android แล้ว นักพัฒนาแอปยังทำเครื่องหมายบางส่วนของแอปว่าละเอียดอ่อนด้วยตนเองได้โดยใช้
setContentSensitivityซึ่งจะซ่อนจากผู้ดูระยะไกลระหว่างการแชร์หน้าจอ - นักพัฒนาแอปสามารถเลือกเปิด/ปิดตัวเลือกปิดใช้การป้องกันการแชร์หน้าจอในส่วนตัวเลือกสำหรับนักพัฒนาแอปเพื่อยกเว้นจากการป้องกันการแชร์หน้าจอเพื่อวัตถุประสงค์ในการสาธิตหรือทดสอบ โปรแกรมบันทึกหน้าจอของระบบเริ่มต้นจะได้รับการยกเว้นจากการเปลี่ยนแปลงเหล่านี้ เนื่องจากไฟล์บันทึกจะยังคงอยู่ในอุปกรณ์
กล้องและสื่อ
Android 15 จะทำการเปลี่ยนแปลงลักษณะการทำงานของกล้องและสื่อต่อไปนี้สำหรับแอปทั้งหมด
การเล่นเสียงโดยตรงและการเล่นเสียงที่ออฟโหลดจะทำให้แทร็กเสียงที่เปิดโดยตรงหรือออฟโหลดก่อนหน้านี้ไม่ถูกต้องเมื่อถึงขีดจำกัดของทรัพยากร
ก่อนที่จะมี Android 15 หากแอปขอการเล่นเสียงโดยตรงหรือส่งออกเสียงขณะที่แอปอื่นกำลังเล่นเสียงและถึงขีดจำกัดทรัพยากร แอปจะเปิด AudioTrack ใหม่ไม่สำเร็จ
ตั้งแต่ Android 15 เป็นต้นไป เมื่อแอปขอการเล่นโดยตรงหรือการเล่นแบบออฟโหลดและถึงขีดจำกัดทรัพยากร ระบบจะทำให้ออบเจ็กต์ AudioTrack ที่เปิดอยู่ในปัจจุบันเป็นโมฆะ ซึ่งจะป้องกันไม่ให้มีการตอบสนองคำขอแทร็กใหม่
(โดยทั่วไปแล้ว ระบบจะเปิดแทร็กเสียงแบบส่งตรงและแบบโอนออกสำหรับการเล่นรูปแบบเสียงที่บีบอัด กรณีการใช้งานทั่วไปสำหรับการเล่นเสียงโดยตรง ได้แก่ สตรีมมิงเสียงที่เข้ารหัสผ่าน HDMI ไปยังทีวี โดยปกติแล้วระบบจะใช้การโอนแทร็กเพื่อเล่นเสียงที่บีบอัดแล้วในอุปกรณ์เคลื่อนที่ที่มีการเร่งฮาร์ดแวร์ DSP)
ประสบการณ์ของผู้ใช้และ UI ของระบบ
Android 15 มีการเปลี่ยนแปลงบางอย่างที่มีจุดประสงค์เพื่อสร้างประสบการณ์ของผู้ใช้ที่สอดคล้องกันมากขึ้น และใช้งานง่าย
เปิดใช้ภาพเคลื่อนไหวของการย้อนกลับที่คาดการณ์ได้สำหรับแอปที่เลือกใช้
Beginning in Android 15, the developer option for predictive back animations has been removed. System animations such as back-to-home, cross-task, and cross-activity now appear for apps that have opted in to the predictive back gesture either entirely or at an activity level. If your app is affected, take the following actions:
- Ensure that your app has been properly migrated to use the predictive back gesture.
- Ensure that your fragment transitions work with predictive back navigation.
- Migrate away from animation and framework transitions and use animator and androidx transitions instead.
- Migrate away from back stacks that
FragmentManagerdoesn't know about. Use back stacks managed byFragmentManageror by the Navigation component instead.
วิดเจ็ตจะปิดใช้เมื่อผู้ใช้บังคับให้แอปหยุด
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.
ชิปแถบสถานะการฉายสื่อจะแจ้งเตือนผู้ใช้เกี่ยวกับการแชร์หน้าจอ การแคสต์ และการบันทึก
Screen projection exploits expose private user data such as financial information because users don't realize their device screen is being shared.
For apps running on devices with Android 15 QPR1 or higher, a status bar chip that is large and prominent alerts users to any in‑progress screen projection. Users can tap the chip to stop their screen from being shared, cast, or recorded. Also, screen projection automatically stops when the device screen is locked.
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.
การเลิกใช้งาน
ในการเปิดตัวแต่ละครั้ง Android API บางรายการอาจล้าสมัยหรือต้อง ปรับโครงสร้างใหม่เพื่อมอบประสบการณ์การใช้งานที่ดียิ่งขึ้นแก่นักพัฒนาแอปหรือรองรับความสามารถใหม่ๆ ของแพลตฟอร์ม ในกรณีเหล่านี้ เราจะเลิกใช้งาน API ที่ล้าสมัยอย่างเป็นทางการและ แนะนำให้นักพัฒนาแอปใช้ API อื่นแทน
การเลิกใช้งานหมายความว่าเราได้สิ้นสุดการสนับสนุน API อย่างเป็นทางการแล้ว แต่ API จะยังคงพร้อมให้บริการแก่นักพัฒนาแอปต่อไป ดูข้อมูลเพิ่มเติมเกี่ยวกับการเลิกใช้งานที่สำคัญใน Android รุ่นนี้ได้ที่หน้าการเลิกใช้งาน