Nền tảng Android 15 có các thay đổi về hành vi có thể ảnh hưởng đến ứng dụng của bạn. Những thay đổi sau đây về hành vi sẽ áp dụng cho tất cả ứng dụng khi chúng chạy trên Android 15, bất kể targetSdkVersion
. Bạn nên kiểm thử ứng dụng rồi sửa đổi để hỗ trợ những thay đổi này cho phù hợp (nếu cần).
Ngoài ra, hãy nhớ tham khảo danh sách thay đổi về hành vi chỉ ảnh hưởng đến những ứng dụng nhắm đến Android 15.
Chức năng cốt lõi
Android 15 sửa đổi hoặc mở rộng nhiều tính năng cốt lõi của hệ thống Android.
Thay đổi trạng thái đã dừng của gói
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 are updating 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 will also cancel all pending intents when the app enters
the stopped state on Android 15. When the user's actions remove the app from the
stopped state, the ACTION_BOOT_COMPLETED
broadcast
will be 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.
Máy ảnh và nội dung nghe nhìn
Android 15 thực hiện các thay đổi sau đây đối với hành vi của máy ảnh và nội dung nghe nhìn cho tất cả ứng dụng.
Giờ đây, tính năng phát âm thanh trực tiếp và giảm tải sẽ vô hiệu hoá các bản âm thanh đang mở trực tiếp hoặc giảm tải trước đó khi đạt đến giới hạn tài nguyên
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.)
Ngừng sử dụng
Với mỗi bản phát hành, các API Android cụ thể có thể trở nên lỗi thời hoặc cần được tái cấu trúc để mang lại trải nghiệm tốt hơn cho nhà phát triển hoặc hỗ trợ các tính năng mới của nền tảng. Trong những trường hợp như vậy, chúng tôi chính thức không dùng các API lỗi thời và trực tiếp cho nhà phát triển để chuyển sang sử dụng các API thay thế.
Việc ngừng sử dụng có nghĩa là chúng tôi đã chấm dứt dịch vụ hỗ trợ chính thức dành cho các API này, nhưng nhà phát triển vẫn sẽ có thể sử dụng chúng. Để tìm hiểu thêm về những trường hợp ngừng hoạt động đáng chú ý trong bản phát hành Android này, hãy xem trang những trường hợp ngừng hoạt động.