これまでのリリースと同様、Android 17 には、アプリに影響する可能性がある動作変更が含まれています。下記の動作変更は、Android 17 以上をターゲットとするアプリにのみ適用されます。アプリが Android 17 以上をターゲットとする場合は、必要に応じてアプリを変更し、下記の動作に適切に対応できるようにしてください。
アプリの targetSdkVersion に関係なく、Android 17 で実行されるすべてのアプリに影響する 動作変更のリスト
も必ずご確認ください。
コア機能
Android 17 には、Android システムのさまざまなコア機能を変更または拡張する以下の変更が含まれています。
MessageQueue の新しいロックフリー実装
Android 17 以降、Android 17(API レベル 37)以上をターゲットとするアプリは、android.os.MessageQueue の新しいロックフリー実装を受け取ります。新しい実装ではパフォーマンスが向上し、フレーム落ちが減少しますが、MessageQueue のプライベート フィールドとメソッドを反映するクライアントが破損する可能性があります。
軽減策など、詳しくは、MessageQueue の動作変更に関するガイダンスをご覧ください。
static final フィールドが変更不可になった
Android 17(API レベル 37)以上をターゲットとする Android 17 以上で実行されているアプリは、static final フィールドを変更できません。アプリがリフレクションを使用して static final フィールドを変更しようとすると、IllegalAccessException が発生します。JNI API(SetStaticLongField() など)を使用してこれらのフィールドのいずれかを変更しようとすると、アプリがクラッシュします。
ユーザー補助
Android 17 では、ユーザー補助を改善するために以下の変更が行われています。
複雑な IME 物理キーボード入力のユーザー補助サポート
This feature introduces new AccessibilityEvent and TextAttribute
APIs to enhance screen reader spoken feedback for CJKV language input. CJKV IME
apps can now signal whether a text conversion candidate has been selected during
text composition. Apps with edit fields can specify text change types when
sending text changed accessibility events.
For example, apps can specify that a text change occurred during text
composition, or that a text change resulted from a commit.
Doing this enables accessibility
services such as screen readers to deliver more precise feedback based on the
nature of the text modification.
App adoption
IME Apps: When setting composing text in edit fields, IMEs can use
TextAttribute.Builder.setTextSuggestionSelected()to indicate whether a specific conversion candidate was selected.Apps with Edit Fields: Apps that maintain a custom
InputConnectioncan retrieve candidate selection data by callingTextAttribute.isTextSuggestionSelected(). These apps should then callAccessibilityEvent.setTextChangeTypes()when dispatchingTYPE_VIEW_TEXT_CHANGEDevents. Apps targeting Android 17 (API level 37) that use the standardTextViewwill have this feature enabled by default. (That is,TextViewwill handle retrieving data from the IME and setting text change types when sending events to accessibility services).Accessibility Services: Accessibility services that process
TYPE_VIEW_TEXT_CHANGEDevents can callAccessibilityEvent.getTextChangeTypes()to identify the nature of the modification and adjust their feedback strategies accordingly.
プライバシー
Android 17 には、ユーザーのプライバシーを強化するために以下の変更が含まれています。
ECH(Encrypted Client Hello)が有効になった
Android 17 introduces platform support for Encrypted Client Hello (ECH), a TLS extension that enhances user privacy by encrypting the Server Name Indication (SNI) in the TLS handshake. This encryption helps prevent network observers from easily identifying the specific domain your app is connecting to.
For apps targeting Android 17 (API level 37) or higher, ECH is used for TLS connections. ECH is active only if the networking library used by the app (for example, HttpEngine, WebView, or OkHttp) has integrated ECH support and the remote server also supports the ECH protocol. If ECH cannot be negotiated, the client sends an ECH extension with randomized contents (a mechanism called ECH GREASE). See RFC 9849 for more details on how ECH GREASE works.
To allow apps to customize this behavior, Android 17 adds a new
<domainEncryption> element to the Network Security Configuration file.
Developers can use <domainEncryption> within <base-config> or
<domain-config> tags to select an ECH mode (for example,
"enabled" or "disabled") on a global or per-domain basis.
For more information, see the Encrypted Client Hello documentation.
Android 17 をターゲットとするアプリにはローカル ネットワーク権限が必要になった
Android 17 introduces the ACCESS_LOCAL_NETWORK runtime permission
to protect users from unauthorized local network access. Because this falls
under the existing NEARBY_DEVICES permission group, users who have already
granted other NEARBY_DEVICES permissions aren't prompted again. This new
requirement prevents malicious apps from exploiting unrestricted local network
access for covert user tracking and fingerprinting. By declaring and requesting
this permission, your app can discover and connect to devices on the local area
network (LAN), such as smart home devices or casting receivers.
Apps targeting Android 17 (API level 37) or higher now have two paths to maintain communication with LAN devices: Adopt system-mediated, privacy-preserving device pickers to skip the permission prompt, or explicitly request this new permission at runtime to maintain local network communication.
For more information, see the Local network permission documentation.
物理デバイスからパスワードを非表示にする
If an app targets Android 17 (API level 37) or higher and the user is using
a physical input device (for example, an external keyboard), the Android
operating system applies the new show_passwords_physical setting to all
characters in the password field. By default, that setting hides all password
characters.
The Android system shows the last-typed password character to help the user see if they mistyped the password. However, this is much less necessary with larger external keyboards. In addition, devices with external keyboards often have larger displays, which increases the danger of someone seeing the typed password.
If the user is using the device's touchscreen, the system applies the new
show_passwords_touch setting.
標準 SMS メッセージの OTP 保護
Android 17 以降、Android は SMS OTP 保護を拡張し、標準の SMS メッセージ(WebOTP または SMS
Retriever 形式を使用しない OTP を含む SMS メッセージ)に適用します。Android 17(API レベル
37)以上をターゲットとするほとんどのアプリでは、これらの SMS メッセージは受信後 3 時間経過するまで利用できません。この遅延は、OTP
のハイジャックを防ぐことを目的としています。3 時間の遅延の間、
SMS_RECEIVED_ACTION ブロードキャストは保留され、
SMS プロバイダ データベース クエリはフィルタリングされます。遅延後、これらのアプリで SMS メッセージを利用できるようになります。
デフォルトの SMS アシスタント アプリやコネクテッド デバイス コンパニオン アプリなど、一部のアプリは、この遅延の対象外です。OTP 抽出のために SMS メッセージの読み取りに依存するすべてのアプリは、引き続き機能するように、SMS Retriever API または SMS ユーザー同意 API を使用するように移行する必要があります。
セキュリティ
Android 17 では、デバイスとアプリのセキュリティが次のように改善されています。
アクティビティのセキュリティ
Android 17 では、プラットフォームは「デフォルトで安全」なアーキテクチャへの移行を継続し、フィッシング、インタラクション ハイジャック、混乱した代理攻撃などの重大なエクスプロイトを軽減するように設計された一連の機能強化が導入されています。このアップデートでは、アプリの互換性とユーザー保護を維持するために、デベロッパーが新しいセキュリティ標準を明示的にオプトインする必要があります。
デベロッパーへの主な影響は次のとおりです。
- BAL の強化とオプトインの改善: バックグラウンド アクティビティ
の起動(BAL)の制限を改良し、保護を
IntentSenderにまで拡大しています。 デベロッパーは、従来のMODE_BACKGROUND_ACTIVITY_START_ALLOWED定数から移行する必要があります。代わりに、 アクティビティの開始が呼び出し元のアプリが表示されている場合に制限され、攻撃対象領域が大幅に縮小されるMODE_BACKGROUND_ACTIVITY_START_ALLOW_IF_VISIBLEなどのきめ細かい制御を採用する必要があります。 - 採用ツール: デベロッパーは、厳格モードと更新された lint チェックを使用して、従来のパターンを特定し、今後のターゲット SDK の要件に対応できるようにする必要があります。
CT がデフォルトで有効になった
アプリが Android 17(API レベル 37)以上をターゲットとしている場合、証明書の透明性(CT)はデフォルトで有効になっています。(Android 16 では CT は利用可能ですが、アプリはオプトインする必要があります)。
より安全なネイティブ DCL - C
如果您的应用以 Android 17(API 级别 37)或更高版本为目标平台,则 Android 14 中针对 DEX 和 JAR 文件引入的更安全的动态代码加载 (DCL) 保护功能现在也适用于原生库。
使用 System.load() 加载的所有原生文件都必须标记为只读。否则,系统会抛出 UnsatisfiedLinkError。
我们建议应用尽可能避免动态加载代码,因为这样做会大大增加应用因代码注入或代码篡改而遭到入侵的风险。
CP2 データビューで機密データのフィールドを制限する
Android 17(API レベル 37)以上を対象とするアプリの場合、連絡先プロバイダ 2(CP2)は、個人を特定できる情報(PII)を含む特定の列をデータビューから制限します。この変更を有効にすると、ユーザーのプライバシーを強化するために、これらの列がデータビューから削除されます。制限付き列には次のものがあります。
ContactsContract.Data のこれらの列を使用しているアプリは、RAW_CONTACT_ID と結合することで、代わりに ContactsContract.RawContacts から抽出できます。
CP2 で厳格な SQL チェックを適用する
对于以 Android 17(API 级别 37)及更高版本为目标平台的应用,当在没有 READ_CONTACTS 权限的情况下访问 ContactsContract.Data 表时,联系人提供程序 2 (CP2) 会强制执行严格的 SQL 查询验证。
在此项更改生效后,如果应用没有 READ_CONTACTS 权限,则在查询 ContactsContract.Data 表时会设置 StrictColumns 和 StrictGrammar 选项。如果查询使用的模式与这些模式不兼容,则会被拒绝并导致抛出异常。
メディア
Android 17 では、メディアの動作が次のように変更されています。
バックグラウンド オーディオの強化
从 Android 17 开始,音频框架对后台音频互动(包括音频播放、音频焦点请求和音量更改 API)强制执行限制,以确保这些更改是由用户有意启动的。
部分音频限制适用于所有应用。不过,如果应用以 Android 17(API 级别 37)为目标平台,则限制会更加严格。如果这些应用在后台运行时与音频互动,则必须有前台服务正在运行。此外,应用还必须满足以下一项或两项要求:
- 前台服务必须具有仅在使用时授予的权限 (WIU)。
- 应用必须具有精确闹钟权限,并且正在与
USAGE_ALARM音频流互动。
如需了解详情(包括缓解措施),请参阅后台音频安全加固。
デバイスのフォーム ファクタ
Android 17 には、さまざまなデバイスサイズとフォーム ファクタでユーザー エクスペリエンスを向上させるために、以下の変更が含まれています。
大画面(画面幅 600 dp 以上)での画面の向き、サイズ変更、アスペクト比の制約を無視するためのプラットフォーム API の変更
Android 16 では、API レベル 36 以上をターゲットとするアプリで大画面(sw >= 600dp)の画面の向き、アスペクト比、サイズ変更の制限を無視するためのプラットフォーム API の変更を導入しました。デベロッパーは SDK 36 でこれらの変更をオプトアウトできますが、Android 17(API レベル 37)以上をターゲットとするアプリでは、このオプトアウトは利用できなくなります。
詳しくは、向きとサイズ変更の制限が無視されるをご覧ください。
接続
Android 17 では、Bluetooth RFCOMM ソケットの整合性を高め、標準の Java InputStream の動作に合わせるために、以下の変更が導入されています。
RFCOMM の BluetoothSocket read() の動作の一貫性
对于以 Android 17(API 级别 37)为目标平台的应用,
read() 方法从InputStream 获取的
基于 RFCOMM 的 BluetoothSocket 现在会在
套接字关闭或连接断开时返回 -1。
此更改使 RFCOMM 套接字行为与 LE CoC 套接字保持一致,并与标准 InputStream.read()
文档保持一致,该文档指出,当到达流的末尾时,系统会返回 -1。
仅依赖于捕获 IOException 以跳出读取循环的应用可能会受到此更改的影响,并且应更新 BluetoothSocket 读取循环以明确检查返回值 -1。这可确保在远程设备断开连接或套接字关闭时,循环正确终止。如需查看推荐的实现示例,请参阅传输蓝牙数据指南中的代码段。