Android 16 platformunda, uygulamanızı etkileyebilecek davranış değişiklikleri vardır. Aşağıdaki davranış değişiklikleri, targetSdkVersion
'ten bağımsız olarak Android 16'da çalıştırılan tüm uygulamalar için geçerlidir. Uygulamanızı test etmeniz ve ardından geçerli olduğu durumlarda bu değişiklikleri desteklemek için gerektiği gibi değiştirmeniz gerekir.
Yalnızca Android 16'yı hedefleyen uygulamaları etkileyen davranış değişiklikleri listesini de inceleyin.
Temel işlevler
Android 16, Android sisteminin çeşitli temel özelliklerini değiştiren veya genişleten aşağıdaki değişiklikleri içerir.
JobScheduler kota optimizasyonları
Starting in Android 16, we're adjusting regular and expedited job execution runtime quota based on the following factors:
- Which app standby bucket the application is in: in Android 16, active standby buckets will start being enforced by a generous runtime quota.
- If the job starts execution while the app is in a top state: in Android 16, Jobs started while the app is visible to the user and continues after the app becomes invisible, will adhere to the job runtime quota.
- If the job is executing while running a Foreground Service: in Android 16, jobs that are executing while concurrently with a foreground service will adhere to the job runtime quota. If you're leveraging jobs for user initiated data transfer, consider using user initiated data transfer jobs instead.
This change impacts tasks scheduled using WorkManager, JobScheduler, and
DownloadManager. To debug why a job was stopped, we recommend logging why your
job was stopped by calling WorkInfo.getStopReason()
(for
JobScheduler jobs, call JobParameters.getStopReason()
).
For more information on battery-optimal best practices, refer to guidance on optimize battery use for task scheduling APIs.
We also recommend leveraging the new
JobScheduler#getPendingJobReasonsHistory
API introduced in
Android 16 to understand why a job has not executed.
Testing
To test your app's behavior, you can enable override of certain job quota optimizations as long as the app is running on an Android 16 device.
To disable enforcement of "top state will adhere to job runtime quota", run the
following adb
command:
adb shell am compat enable OVERRIDE_QUOTA_ENFORCEMENT_TO_TOP_STARTED_JOBS APP_PACKAGE_NAME
To disable enforcement of "jobs that are executing while concurrently with a
foreground service will adhere to the job runtime quota", run the following
adb
command:
adb shell am compat enable OVERRIDE_QUOTA_ENFORCEMENT_TO_FGS_JOBS APP_PACKAGE_NAME
To test certain app standby bucket behavior, you can set the app standby bucket
of your app using the following adb
command:
adb shell am set-standby-bucket APP_PACKAGE_NAME active|working_set|frequent|rare|restricted
To understand the app standby bucket your app is in, you can get the app standby
bucket of your app using the following adb
command:
adb shell am get-standby-bucket APP_PACKAGE_NAME
JobInfo#setImportantWhileForeground desteğinin tamamen sonlandırılması
JobInfo.Builder#setImportantWhileForeground(boolean)
方法用于在调度应用位于前台或暂时豁免于后台限制时指示作业的优先级。
自 Android 12(API 级别 31)起,此方法已废弃。从 Android 16 开始,它不再有效,系统会忽略调用此方法。
此功能移除也适用于 JobInfo#isImportantWhileForeground()
。从 Android 16 开始,如果调用该方法,该方法会返回 false
。
Kullanıcı deneyimi ve sistem kullanıcı arayüzü
Android 16, daha tutarlı ve sezgisel bir kullanıcı deneyimi sunmak için tasarlanmış aşağıdaki değişiklikleri içerir.
Kullanımı engelleyen erişilebilirlik duyurularının kullanımdan kaldırılması
Android 16 废弃了无障碍功能通告,其特征是使用 announceForAccessibility
或调度 TYPE_ANNOUNCEMENT
无障碍功能事件。这可能会给 TalkBack 和 Android 屏幕阅读器用户带来不一致的用户体验,而替代方案可以更好地满足各种 Android 辅助技术的用户需求。
替代方案示例:
- 对于窗口更改等重大界面更改,请使用
Activity.setTitle(CharSequence)
和setAccessibilityPaneTitle(java.lang.CharSequence)
。在 Compose 中,使用Modifier.semantics { paneTitle = "paneTitle" }
- 如需向用户告知关键界面的更改,请使用
setAccessibilityLiveRegion(int)
。在 Compose 中,请使用Modifier.semantics { liveRegion = LiveRegionMode.[Polite|Assertive]}
。应谨慎使用这些事件,因为它们可能会在每次更新视图时生成通知。 - 如需向用户发送错误通知,请发送类型为
AccessibilityEvent#CONTENT_CHANGE_TYPE_ERROR
的AccessibilityEvent
并设置AccessibilityNodeInfo#setError(CharSequence)
,或使用TextView#setError(CharSequence)
。
已废弃的 announceForAccessibility
API 的参考文档中包含有关建议替代方案的更多详细信息。