การเปลี่ยนแปลงลักษณะการทํางาน: แอปทั้งหมด

แพลตฟอร์ม Android 15 มีการเปลี่ยนแปลงลักษณะการทำงานที่อาจส่งผลต่อแอปของคุณ การเปลี่ยนแปลงลักษณะการทำงานต่อไปนี้มีผลกับแอปทั้งหมดเมื่อทำงานบน Android 15 ไม่ว่าจะมี targetSdkVersion หรือไม่ก็ตาม คุณควรทดสอบแอปแล้วแก้ไขแอปตามที่จำเป็นเพื่อรองรับฟีเจอร์เหล่านี้อย่างเหมาะสม (หากมี)

โปรดตรวจสอบรายการการเปลี่ยนแปลงลักษณะการทำงานที่ส่งผลต่อแอปที่กําหนดเป้าหมายเป็น Android 15 เท่านั้นด้วย

ฟังก์ชันหลัก

Android 15 แก้ไขหรือขยายความสามารถหลักต่างๆ ของระบบ Android

การเปลี่ยนแปลงสถานะ "หยุดแพ็กเกจ"

เจตนาของสถานะ FLAG_STOPPED ของแพ็กเกจ (ซึ่งผู้ใช้สามารถมีส่วนร่วมในบิลด์ AOSP ได้โดยกดไอคอนแอปค้างไว้แล้วเลือก "บังคับหยุด") คือการทำให้แอปอยู่ในสถานะนี้เสมอจนกว่าผู้ใช้จะนำแอปออกจากสถานะนี้อย่างชัดเจนด้วยการเปิดแอปโดยตรงหรือโต้ตอบกับแอปโดยอ้อม (ผ่านชีตการแชร์หรือวิดเจ็ต การเลือกแอปเป็นวอลเปเปอร์แบบเคลื่อนไหว ฯลฯ) ใน Android 15 เราได้อัปเดตลักษณะการทํางานของระบบให้สอดคล้องกับลักษณะการทำงานที่ต้องการนี้ แอปควรถูกนำออกจากสถานะ "หยุดทำงาน" ผ่านการดําเนินการของผู้ใช้โดยตรงหรือโดยอ้อมเท่านั้น

นอกจากข้อจำกัดที่มีอยู่แล้ว ระบบยังยกเลิกIntent ที่รอดำเนินการทั้งหมดเมื่อแอปเข้าสู่สถานะ "หยุดทำงาน" ในอุปกรณ์ที่ใช้ Android 15 เพื่อรองรับลักษณะการทำงานที่ต้องการ เมื่อการดําเนินการของผู้ใช้นําแอปออกจากสถานะหยุดทำงาน ระบบจะส่งการออกอากาศ ACTION_BOOT_COMPLETED ไปยังแอปเพื่อให้ลงทะเบียน Intent ที่รอดําเนินการอีกครั้ง

คุณสามารถเรียกใช้เมธอดใหม่ ApplicationStartInfo.wasForceStopped() เพื่อยืนยันว่าแอปอยู่ในสถานะหยุดทำงานหรือไม่

การรองรับขนาดหน้า 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 might not work on 16 KB devices when they are productionized 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.

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 คุณต้องดำเนินการต่อไปนี้ก่อนแอปในพื้นที่ส่วนตัวจะปรากฏ

  1. แอปของคุณต้องได้รับการกำหนดเป็นแอป Launcher เริ่มต้นสำหรับอุปกรณ์ กล่าวคือ มีแอปมีบทบาท ROLE_HOME
  2. แอปของคุณต้องประกาศสิทธิ์ทั่วไป ACCESS_HIDDEN_PROFILESในไฟล์ Manifest ของแอป

แอป Launcher ที่ประกาศสิทธิ์ ACCESS_HIDDEN_PROFILES ต้องจัดการกรณีการใช้งานพื้นที่ส่วนตัวต่อไปนี้

  1. แอปของคุณต้องมีคอนเทนเนอร์ Launcher แยกต่างหากสำหรับแอปที่ติดตั้งในพื้นที่ส่วนตัว ใช้เมธอด getLauncherUserInfo() เพื่อระบุประเภทโปรไฟล์ผู้ใช้ที่จัดการ
  2. ผู้ใช้ต้องซ่อนและแสดงคอนเทนเนอร์พื้นที่ส่วนตัวได้
  3. ผู้ใช้ต้องสามารถล็อกและปลดล็อกคอนเทนเนอร์พื้นที่ส่วนตัวได้ ใช้เมธอด requestQuietModeEnabled() เพื่อล็อก (โดยส่ง true) หรือปลดล็อก (โดยส่ง false) พื้นที่ส่วนตัว
  4. ขณะล็อกอยู่ ไม่ควรมีแอปใดๆ ในคอนเทนเนอร์พื้นที่ส่วนตัวที่มองเห็นหรือค้นพบได้ผ่านกลไกต่างๆ เช่น การค้นหา แอปของคุณควรลงทะเบียนตัวรับสำหรับการออกอากาศ 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 Canvas and 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 สร้างขึ้นมาจาก การเปลี่ยนแปลงที่เกิดขึ้นใน Android 14 และขยายระยะเวลานี้ ด้านความปลอดภัยมากขึ้น ใน Android 15 แอปที่มี ติดตั้ง targetSdkVersion ที่ต่ำกว่า 24 ไม่ได้ การกําหนดให้แอปเป็นไปตามระดับ API สมัยใหม่จะช่วยให้มั่นใจได้ว่าแอปจะมีความปลอดภัยและความเป็นส่วนตัวที่ดียิ่งขึ้น

มัลแวร์มักกำหนดเป้าหมายเป็น API ระดับต่ำกว่าเพื่อหลีกเลี่ยงความปลอดภัยและความเป็นส่วนตัว ที่เกิดขึ้นใน Android เวอร์ชันที่สูงกว่า ตัวอย่างเช่น แอปมัลแวร์บางแอปใช้ targetSdkVersion เป็น 22 เพื่อหลีกเลี่ยง Android 6.0 Marshmallow (API) เปิดตัวโมเดลสิทธิ์รันไทม์ในปี 2015 ระดับ 23) การเปลี่ยนแปลงนี้ใน Android 15 ทำให้มัลแวร์หลบเลี่ยงการปรับปรุงด้านความปลอดภัยและความเป็นส่วนตัวได้ยากขึ้น การพยายามติดตั้งแอปที่กำหนดเป้าหมาย API ที่ต่ำกว่า จะทำให้การติดตั้งล้มเหลว โดยมีข้อความเหมือนกับข้อความต่อไปนี้ ปรากฏใน Logcat:

INSTALL_FAILED_DEPRECATED_SDK_VERSION: App package must target at least SDK version 24, but found 7

ในอุปกรณ์ที่อัปเกรดเป็น Android 15 แอปที่มี targetSdkVersion ต่ำกว่า 24 จะยังคงติดตั้งอยู่

หากต้องการทดสอบแอปที่กำหนดเป้าหมายเป็น API ระดับเก่า ให้ใช้ ADB ต่อไปนี้ คำสั่ง:

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 เปลี่ยนแปลงลักษณะการทํางานของกล้องและสื่อสําหรับแอปทั้งหมดดังต่อไปนี้

การเล่นเสียงโดยตรงและการออฟโหลดจะลบล้างแทร็กเสียงโดยตรงหรือแทร็กเสียงที่ออฟโหลดไว้ก่อนหน้านี้เมื่อถึงขีดจำกัดทรัพยากร

ก่อนที่จะมี 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 FragmentManager doesn't know about. Use back stacks managed by FragmentManager or by the Navigation component instead.

วิดเจ็ตปิดอยู่เมื่อผู้ใช้บังคับให้แอปหยุด

หากผู้ใช้บังคับหยุดแอปในอุปกรณ์ที่ใช้ Android 15 ระบบจะปิดใช้วิดเจ็ตทั้งหมดของแอปชั่วคราว วิดเจ็ตจะเป็นสีเทาและผู้ใช้โต้ตอบกับวิดเจ็ตไม่ได้ เนื่องจากตั้งแต่ Android 15 เป็นต้นไป ระบบจะยกเลิก Intent ที่รอดำเนินการทั้งหมดของแอปเมื่อมีการบังคับหยุดแอป

ระบบจะเปิดใช้วิดเจ็ตเหล่านั้นอีกครั้งเมื่อผู้ใช้เปิดแอปในครั้งถัดไป

ดูข้อมูลเพิ่มเติมได้ที่การเปลี่ยนแปลงสถานะ "หยุดแพ็กเกจ"

ชิปแถบสถานะการฉายสื่อจะแจ้งให้ผู้ใช้ทราบเกี่ยวกับการแชร์หน้าจอ การแคสต์ และการบันทึก

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.

Status bar chip for screen sharing, casting, and recording.

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.

การจำกัดการเข้าถึงเครือข่ายในเบื้องหลัง

ใน Android 15 แอปที่เริ่มคำขอเครือข่ายนอกวงจรของกระบวนการที่ถูกต้องจะได้รับข้อยกเว้น โดยปกติแล้ว จะเป็น UnknownHostException หรือ IOException อื่นๆ ที่เกี่ยวข้องกับซ็อกเก็ต คำขอเครือข่ายที่เกิดขึ้นนอกวงจรที่ถูกต้องมักเกิดจากแอปส่งคำขอเครือข่ายต่อไปโดยไม่รู้ตัว แม้ว่าแอปจะไม่ได้ใช้งานแล้วก็ตาม

หากต้องการลดข้อยกเว้นนี้ ให้ตรวจสอบว่าคำขอเครือข่ายของคุณรับรู้ถึงวงจรของลูกค้าและยกเลิกเมื่อออกจากวงจรกระบวนการที่ถูกต้องโดยใช้คอมโพเนนต์ที่รับรู้ถึงวงจรของลูกค้า หากการขอข้อมูลเครือข่ายต้องเกิดขึ้นแม้ว่าผู้ใช้จะออกจากแอปพลิเคชันแล้ว ให้พิจารณากำหนดเวลาการขอข้อมูลเครือข่ายโดยใช้ WorkManager หรือทำงานที่ผู้ใช้มองเห็นต่อไปโดยใช้บริการที่ทำงานอยู่เบื้องหน้า

การเลิกใช้งาน

ในแต่ละรุ่น API ของ Android บางรายการอาจล้าสมัยหรือจำเป็นต้องมีการรีแฟกทอริงเพื่อให้นักพัฒนาแอปได้รับประสบการณ์การใช้งานที่ดียิ่งขึ้นหรือรองรับความสามารถใหม่ๆ ของแพลตฟอร์ม ในกรณีเหล่านี้ เราจะเลิกใช้งาน API ที่ล้าสมัยอย่างเป็นทางการและแนะนำให้นักพัฒนาแอปเปลี่ยนไปใช้ API อื่นแทน

การเลิกใช้งานหมายความว่าเราได้สิ้นสุดการสนับสนุนอย่างเป็นทางการสำหรับ API ดังกล่าวแล้ว แต่นักพัฒนาแอปจะยังคงใช้งาน API ดังกล่าวได้ ดูข้อมูลเพิ่มเติมเกี่ยวกับการเลิกใช้งานที่สำคัญใน Android เวอร์ชันนี้ได้ที่หน้าการเลิกใช้งาน