Android 17 プラットフォームには、アプリに影響する可能性がある動作変更が含まれています。下記の動作変更は、targetSdkVersion に関係なく、Android 17 上で稼働するすべてのアプリに適用されます。該当する場合は、アプリをテストし、必要に応じて修正して、これらの変更に対応する必要があります。
Android 17 をターゲットとするアプリにのみ影響する動作変更のリストも必ずご確認ください。
セキュリティ
Android 17 では、デバイスとアプリのセキュリティが以下のように改善されています。
usesClearTraffic の非推奨プラン
今後のリリースで、usesCleartextTraffic 要素は非推奨になる予定です。暗号化されていない(HTTP)接続を行う必要があるアプリは、ネットワーク セキュリティ構成ファイルを使用するように移行する必要があります。このファイルを使用すると、アプリがクリアテキスト接続を行う必要があるドメインを指定できます。
ネットワーク セキュリティ構成ファイルは API レベル 24 以上でのみサポートされます。アプリの最小 API レベルが 24 未満の場合は、次の両方を行う必要があります。
usesCleartextTraffic属性をtrueに設定します。- ネットワーク構成ファイルを使用する
アプリの最小 API レベルが 24 以上の場合、ネットワーク構成ファイルを使用できるため、usesCleartextTraffic を設定する必要はありません。
暗黙的な URI 権限付与を制限する
現在、アプリが Send、SendMultiple、または ImageCapture のアクションを含む URI でインテントを起動すると、システムはターゲット アプリに読み取りと書き込みの URI 権限を自動的に付与します。この動作は Android 18 で変更される予定です。そのため、アプリはシステムに付与を任せるのではなく、関連する URI 権限を明示的に付与することをおすすめします。
アプリごとのキーストアの制限
Apps should avoid creating excessive numbers of keys in Android Keystore, because it is a shared resource for all apps on the device. Beginning with Android 17, the system enforces a limit on the number of keys an app can own. The limit is 50,000 keys for non-system apps targeting Android 17 or higher, and 200,000 keys for all other apps. System apps have a limit of 200,000 keys, regardless of which API level they target.
If an app attempts to create keys beyond the limit, the creation fails with a
KeyStoreException. The exception's message string contains information
about the key limit. If the app calls getNumericErrorCode() on the
exception, the return value depends on what API level the app targets:
- Apps targeting Android 17 or higher:
getNumericErrorCode()returns the newERROR_TOO_MANY_KEYSvalue. - All other apps:
getNumericErrorCode()returnsERROR_INCORRECT_USAGE.
ユーザー エクスペリエンスとシステム UI
Android 17 には、より一貫性のある直感的なユーザー エクスペリエンスを実現するための以下の変更が含まれています。
回転後の IME の可視性に関するデフォルトを復元
Android 17 以降では、デバイスの構成が変更されたとき(回転など)に、アプリ自体で処理されない場合、以前の IME の可視性は復元されません。
アプリが処理しない構成の変更が行われ、変更後にキーボードを表示する必要がある場合は、明示的にリクエストする必要があります。このリクエストは、次のいずれかの方法で行うことができます。
android:windowSoftInputMode属性をstateAlwaysVisibleに設定します。- アクティビティの
onCreate()メソッドでソフト キーボードをプログラムでリクエストするか、onConfigurationChanged()メソッドを追加します。
手入力
Android 17 には、キーボードやタッチパッドなどのヒューマン入力デバイスとアプリがやり取りする方法に影響する次の変更が含まれています。
タッチパッドは、ポインタ キャプチャ中にデフォルトで相対イベントを配信する
Beginning with Android 17, if an app requests pointer capture using
View.requestPointerCapture() and the user uses a touchpad, the system
recognizes pointer movement and scrolling gestures from the user's touches and
reports them to the app in the same way as pointer and scroll wheel movements
from a captured mouse. In most cases, this removes the need for apps that
support captured mice to add special handling logic for touchpads. For more
details, see the documentation for View.POINTER_CAPTURE_MODE_RELATIVE.
Previously, the system did not attempt to recognize gestures from the touchpad,
and instead delivered the raw, absolute finger locations to the app in a similar
format to touchscreen touches. If an app still requires this absolute data, it
should call the new View.requestPointerCapture(int) method with
View.POINTER_CAPTURE_MODE_ABSOLUTE instead.
メディア
Android 17 では、メディアの動作が次のように変更されています。
バックグラウンド音声の強化
Beginning with Android 17, the audio framework enforces restrictions on background audio interactions including audio playback, audio focus requests, and volume change APIs to ensure that these changes are started intentionally by the user.
If the app tries to call audio APIs while the app is not in a valid lifecycle,
the audio playback and volume change APIs fail silently without throwing an
exception or providing a failure message. The audio focus API fails with the
result code AUDIOFOCUS_REQUEST_FAILED.
For more information, including mitigation strategies, see Background audio hardening.