Android 15 では、デベロッパー向けに優れた新しい機能と API が導入されています。以下のセクションでは、関連する API の使用を開始するにあたって役立つ機能の概要を示します。
新しい API、変更した API、削除された API の詳細なリストについては、API 差分レポートをご覧ください。新しい API について詳しくは、Android API リファレンスをご覧ください。新しい API は、見つけやすいようにハイライト表示されています。また、プラットフォームの変更がアプリに影響する領域については、Android 15 の Android 15 をターゲットとするアプリに影響する動作変更と、targetSdkVersion
に関係なくすべてのアプリに影響する動作変更をご確認ください。カメラとメディア
Android 15 には、カメラとメディアのエクスペリエンスを向上させるさまざまな機能が搭載されています。これにより、クリエイターが Android でビジョンを具現化できるよう、ツールやハードウェアにアクセスできるようになります。
アプリ内カメラ コントロール
Android 15 では、サポート対象デバイスのカメラ ハードウェアとアルゴリズムをより詳細に制御するための新しい拡張機能が追加されています。
HDR ヘッドルーム コントロール
Android 15 では、基盤となるデバイスの機能とパネルのビット深度に適した HDR ヘッドルームが選択されます。1 つの HDR サムネイルを表示するメッセージ アプリなど、SDR コンテンツが大量にあるページの場合、この動作は SDR コンテンツの明度に悪影響を及ぼす可能性があります。Android 15 では、setDesiredHdrHeadroom
を使用して HDR ヘッドルームを制御し、SDR と HDR のコンテンツのバランスを取ることができます。
ラウドネス コントロール
Android 15 introduces support for the CTA-2075 loudness standard to help you avoid audio loudness inconsistencies and ensure users don't have to constantly adjust volume when switching between content. The system leverages known characteristics of the output devices (headphones and speaker) along with loudness metadata available in AAC audio content to intelligently adjust the audio loudness and dynamic range compression levels.
To enable this feature, you need to ensure loudness metadata is available in
your AAC content and enable the platform feature in your app. For this, you
instantiate a LoudnessCodecController
object by
calling its create factory method with the audio
session ID from the associated AudioTrack
; this
automatically starts applying audio updates. You can pass an
OnLoudnessCodecUpdateListener
to modify or filter
loudness parameters before they are applied on the
MediaCodec
.
// Media contains metadata of type MPEG_4 OR MPEG_D
val mediaCodec = …
val audioTrack = AudioTrack.Builder()
.setSessionId(sessionId)
.build()
...
// Create new loudness controller that applies the parameters to the MediaCodec
try {
val lcController = LoudnessCodecController.create(mSessionId)
// Starts applying audio updates for each added MediaCodec
AndroidX media3 ExoPlayer will soon be updated to leverage
LoudnessCodecController
APIs for a seamless app integration.
ローライト ブースト
Android 15 introduces Low Light Boost, a new auto-exposure mode available to both Camera 2 and the night mode camera extension. Low Light Boost adjusts the exposure of the Preview stream in low-light conditions. This is different from how the night mode camera extension creates still images, because night mode combines a burst of photos to create a single, enhanced image. While night mode works very well for creating a still image, it can't create a continuous stream of frames, but Low Light Boost can. Thus, Low Light Boost enables new camera capabilities, such as:
- Providing an enhanced image preview, so users are better able to frame their low-light pictures
- Scanning QR codes in low light
If you enable Low Light Boost, it automatically turns on when there's a low light level, and turns off when there's more light.
Apps can record off the Preview stream in low-light conditions to save a brightened video.
For more information, see Low Light Boost.
仮想 MIDI 2.0 デバイス
Android 13 では、Universal MIDI Packets(UMP)を使用して通信する USB を使用して MIDI 2.0 デバイスに接続するためのサポートが追加されました。Android 15 では、UMP のサポートが仮想 MIDI アプリに拡張されています。これにより、合成アプリは USB MIDI 2.0 デバイスの場合と同様に、シンセサイザー アプリを仮想 MIDI 2.0 デバイスとして制御できます。
接続性
Android 15 ではプラットフォームが更新され、最新の通信機能をアプリが利用できるようになります。
衛星のサポート
Android 15 では、引き続き衛星接続のプラットフォーム サポートを拡張しており、衛星接続の状況全体で一貫したユーザー エクスペリエンスを実現するため、いくつかの UI 要素が含まれています。
アプリは ServiceState.isUsingNonTerrestrialNetwork()
を使用して、デバイスが衛星に接続されていることを検出できます。これにより、完全なネットワーク サービスが利用できない理由について、より認識しやすくなります。また、Android 15 では、SMS アプリと MMS アプリ、プリロードされた RCS アプリで、衛星接続を使用してメッセージを送受信できます。
NFC 操作がよりスムーズに
Android 15 is working to make the tap to pay experience more seamless and
reliable while continuing to support Android's robust NFC app ecosystem. On
supported devices, apps can request the NfcAdapter
to enter
observe mode, where the device listens but doesn't respond to NFC
readers, sending the app's NFC service PollingFrame
objects to process. The PollingFrame
objects can be used to auth
ahead of the first communication to the NFC reader, allowing for a one tap
transaction in many cases.
ウォレットの役割
Android 15 introduces a new Wallet role that allows tighter integration with the user's preferred wallet app. This role replaces the NFC default contactless payment setting. Users can manage the Wallet role holder by navigating to Settings > Apps > Default Apps.
The Wallet role is used when routing NFC taps for AIDs registered in the payment category. Taps always go to the Wallet role holder unless another app that is registered for the same AID is running in the foreground.
This role is also used to determine where the Wallet QuickAccess tile should go when activated. When the role is set to "None", the QuickAccess tile isn't available and payment category NFC taps are only delivered to the foreground app.
デベロッパーの生産性とツール
生産性を向上させるための Google の取り組みのほとんどは Android Studio、Jetpack Compose、Android Jetpack ライブラリなどのツールを中心に据えていますが、Google はビジョンの実現を容易にする方法を常に模索しています。
PDF の改善
Android 15 デベロッパー プレビュー 2 には、PdfRenderer
API を大幅に改善した早期プレビュー版が含まれています。アプリには、パスワード保護されたファイルのレンダリング、アノテーション、フォームの編集、検索、コピーによる選択などの高度な機能を組み込むことができます。線形化された PDF の最適化がサポートされ、ローカルの PDF 表示を高速化し、リソース使用量を削減できます。
PdfRenderer
は、プラットフォーム リリースに関係なく Google Play システム アップデートを使用して更新できるモジュールに移動されました。PdfRendererPreV
という Android 15 より前の互換性のある API サーフェスを作成することで、これらの変更を Android 11(API レベル 30)まで遡ってサポートしています。
PdfRenderer
API サーフェスの機能強化について皆様からのフィードバックをお待ちしております。今後の Android Jetpack ライブラリでは、こうした API の組み込みがより簡単になる予定です。
言語の自動切り替えの改良
Android 14 added on-device, multi-language recognition in audio with automatic
switching between languages, but this can cause words to get dropped,
especially when languages switch with less of a pause between the two
utterances. Android 15 adds additional controls to help apps tune this switching
to their use case.
EXTRA_LANGUAGE_SWITCH_INITIAL_ACTIVE_DURATION_TIME_MILLIS
confines the automatic switching to the beginning of the audio session, while
EXTRA_LANGUAGE_SWITCH_MATCH_SWITCHES
deactivates the
language switching after a defined number of switches. These options are
particularly useful if you expect that there will be a single language spoken
during the session that should be autodetected.
細かな改行コントロール
Starting in Android 15, a TextView
and the underlying
line breaker can preserve the given portion of text in the same line to improve
readability. You can take advantage of this line break customization by using
the <nobreak>
tag in string resources or
createNoBreakSpan
. Similarly, you can preserve words from
hyphenation by using the <nohyphen>
tag or
createNoHyphenationSpan
.
For example, the following string resource doesn't include a line break, and renders with the text "Pixel 8 Pro." breaking in an undesirable place:
<resources>
<string name="pixel8pro">The power and brains behind Pixel 8 Pro.</string>
</resources>
In contrast, this string resource includes the <nobreak>
tag, which wraps the
phrase "Pixel 8 Pro." and prevents line breaks:
<resources>
<string name="pixel8pro">The power and brains behind <nobreak>Pixel 8 Pro.</nobreak></string>
</resources>
The difference in how these strings are rendered is shown in the following images:
OpenJDK 17 の更新
Android 15 では、最新の OpenJDK LTS リリースの機能に合わせて Android のコアライブラリを更新する取り組みが引き続き行われています。
主な機能と改善点は次のとおりです。
- NIO バッファに関する品質向上
- ストリーム
- 追加の
math
メソッドとstrictmath
メソッド util
パッケージの更新(順序付けられたcollection
、map
、set
を含む)Deflater
でのByteBuffer
サポートX500PrivateCredential
やセキュリティ キーのアップデートなどのセキュリティ アップデート
これらの API は、Google Play システム アップデートを通じて Android 12(API レベル 31)以降を搭載した 10 億台を超えるデバイスで更新されるため、最新のプログラミング機能をターゲットにできます。
Java および OpenJDK は、Oracle およびその関連会社の商標または登録商標です。
大画面とフォーム ファクタ
Android 15 は、大画面、フリップ式、折りたたみ式デバイスなど、Android のフォーム ファクタを最大限に活用するためのサポートをアプリに提供します。
カバー画面のサポート
アプリは、サポートされているフリップ式デバイスの小さなカバー画面に Application
または Activity
を表示できるように、Android 15 で使用されるプロパティを宣言できます。これらの画面は小さすぎるため、Android アプリの実行可能なターゲットとして見なされませんが、アプリでサポートをオプトインすることで、より多くの場所でアプリを利用できるようになります。
パフォーマンスとバッテリー
Android は、引き続きアプリのパフォーマンスと品質の改善のサポートに重点を置いています。Android 15 では、アプリ内のタスクの実行、アプリのパフォーマンスの最適化、アプリに関する分析情報の収集に役立つ新しい API が導入されています。
ApplicationStartInfo API
In previous versions of Android, app startup has been a bit of a mystery. It was
challenging to determine within your app whether it started from a cold, warm,
or hot state. It was also difficult to know how long your app spent during the
various launch phases: forking the process, calling onCreate
, drawing the
first frame, and more. When your Application
class was instantiated, you had no
way of knowing whether the app started from a broadcast, a content provider, a
job, a backup, boot complete, an alarm, or an Activity
.
The ApplicationStartInfo
API on Android 15 provides
all of this and more. You can even choose to add your own timestamps into the
flow to help collect timing data in one place. In addition to collecting
metrics, you can use ApplicationStartInfo
to help directly optimize app
startup; for example, you can eliminate the costly instantiation of UI-related
libraries within your Application
class when your app is starting up due to a
broadcast.
アプリサイズの詳細情報
Android 8.0(API レベル 26)以降、アプリのインストール サイズを 1 つのバイト数として要約する StorageStats.getAppBytes
API が追加されました。これは、APK サイズ、APK から抽出されたファイルのサイズ、デバイス上で生成されたファイル(AOT コンパイル済みコードなど)の合計です。この数値は、アプリがストレージをどのように使用しているかという点から見て、あまり意味がありません。
Android 15 では、StorageStats.getAppBytesByDataType([type])
API が追加されています。これにより、APK ファイルの分割、AOT と高速化に関連するコード、dex メタデータ、ライブラリ、ガイド付きプロファイルなど、アプリがその容量をどのように使用しているかに関する分析情報を取得できます。
SQLite データベースの改善
Android 15 introduces new SQLite APIs that expose advanced features from the underlying SQLite engine that target specific performance issues that can manifest in apps.
Developers should consult best practices for SQLite performance to get the most out of their SQLite database, especially when working with large databases or when running latency-sensitive queries.
- Read-only deferred transactions: when issuing transactions that are
read-only (don't include write statements), use
beginTransactionReadOnly()
andbeginTransactionWithListenerReadOnly(SQLiteTransactionListener)
to issue read-onlyDEFERRED
transactions. Such transactions can run concurrently with each other, and if the database is in WAL mode, they can run concurrently withIMMEDIATE
orEXCLUSIVE
transactions. - Row counts and IDs: new APIs were added to retrieve the count of changed
rows or the last inserted row ID without issuing an additional query.
getLastChangedRowCount()
returns the number of rows that were inserted, updated, or deleted by the most recent SQL statement within the current transaction, whilegetTotalChangedRowCount()
returns the count on the current connection.getLastInsertRowId()
returns therowid
of the last row to be inserted on the current connection. - Raw statements: issue a raw SQlite statement, bypassing convenience wrappers and any additional processing overhead that they may incur.
Android Dynamic Performance Framework のアップデート
Android 15 では、Android Dynamic Performance Framework(ADPF)への投資を継続します。ADPF は、ゲームやパフォーマンス集約型のアプリが Android デバイスの電源システムや温度システムとより直接やり取りできるようにする API セットです。サポートされているデバイスでは、Android 15 で新しい ADPF 機能が追加されます。
- 関連するスレッドがパフォーマンスよりも省電力を優先する必要があることを示すヒント セッションの省電力モード。長時間実行されるバックグラウンド ワークロードに最適です。
- GPU と CPU の作業時間の両方をヒント セッションでレポートできます。これにより、システムは CPU と GPU の周波数を一緒に調整してワークロードの需要を最大限に満たすことができます。
- サーマル ヘッドルームしきい値。ヘッドルーム予測に基づいてサーマル スロットリング ステータスを解釈します。
アプリやゲームで ADPF を使用する方法について詳しくは、こちらのドキュメントをご覧ください。
プライバシー
Android 15 には、アプリ デベロッパーがユーザーのプライバシーを保護するために役立つさまざまな機能が用意されています。
画面録画の検出
Android 15 adds support for apps to detect that they are being recorded. A callback is invoked whenever the app transitions between being visible or invisible within a screen recording. An app is considered visible if activities owned by the registering process's UID are being recorded. This way, if your app is performing a sensitive operation, you can inform the user that they're being recorded.
val mCallback = Consumer<Int> { state ->
if (state == SCREEN_RECORDING_STATE_VISIBLE) {
// We're being recorded
} else {
// We're not being recorded
}
}
override fun onStart() {
super.onStart()
val initialState =
windowManager.addScreenRecordingCallback(mainExecutor, mCallback)
mCallback.accept(initialState)
}
override fun onStop() {
super.onStop()
windowManager.removeScreenRecordingCallback(mCallback)
}
IntentFilter 機能の拡張
Android 15 builds in support for more precise Intent
resolution through
UriRelativeFilterGroup
, which contains a set of
UriRelativeFilter
objects that form a set of Intent
matching rules that must each be satisfied, including URL query parameters, URL
fragments, and blocking or exclusion rules.
These rules can be defined in the AndroidManifest
XML file with the new
<uri-relative-filter-group>
tag, which can optionally include an
android:allow
tag. These tags can contain <data>
tags that use existing data
tag attributes as well as the new android:query
and android:fragment
attributes.
Here's an example of the AndroidManifest
syntax:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" />
<data android:scheme="https" />
<data android:domain="astore.com" />
<uri-relative-filter-group>
<data android:pathPrefix="/auth" />
<data android:query="region=na" />
</uri-relative-filter-group>
<uri-relative-filter-group android:allow="false">
<data android:pathPrefix="/auth" />
<data android:query="mobileoptout=true" />
</uri-relative-filter-group>
<uri-relative-filter-group android:allow="false">
<data android:pathPrefix="/auth" />
<data android:fragmentPrefix="faq" />
</uri-relative-filter-group>
</intent-filter>
Android 版プライバシー サンドボックス
Android 15 では、Android 広告サービスが拡張レベル 10 に引き上げられ、最新バージョンの Android 版プライバシー サンドボックスが組み込まれています。これは、モバイルアプリでユーザーのプライバシーを強化し、効果的なパーソナライズド広告体験を可能にする新しいテクノロジーを開発する取り組みの一環です。プライバシー サンドボックスのページには、Android 版プライバシー サンドボックスのデベロッパー プレビューとベータ版プログラムに関する詳細情報が記載されています。
ヘルスコネクト
Android 15 では、Android 14 拡張機能 10 が Android のヘルスコネクトに統合されています。これは、アプリで収集された健康やフィットネスのデータを管理および共有するための、安全で一元化されたプラットフォームです。このアップデートでは、フィットネスや栄養など、新しいデータ型のサポートが追加されています。
部分的画面共有
Android 15 では部分的な画面共有がサポートされているため、ユーザーはデバイスの画面全体ではなく、アプリ ウィンドウのみを共有または録画できます。この機能には Android 14 QPR2 で初めて有効になり、アプリで部分的な画面共有のエクスペリエンスをカスタマイズできる MediaProjection
コールバックが含まれています。Android 14(API レベル 34)以降をターゲットとするアプリでは、MediaProjection
キャプチャ セッションごとにユーザーの同意が必要になりました。
セキュリティ
Android 15 では、アプリのセキュリティを強化し、アプリのデータを保護できます。
fs-verity を使用してファイルを保護する
Android 15 の FileIntegrityManager
には、Linux カーネルの fs-verity 機能を利用する新しい API が含まれています。fs-verity を使用すると、ファイルをカスタム暗号署名で保護できるため、改ざんや破損がないことを保証できます。これによりセキュリティが強化され、アプリの機能やデータを損なうおそれのあるマルウェアや不正なファイル変更から保護できます。
ユーザー エクスペリエンス
Android 15 では、アプリ デベロッパーとユーザーは、ニーズに合わせてデバイスをきめ細かく柔軟に設定できます。
サイレント モード ルールの改善
AutomaticZenRule
を使用すると、アプリはアテンション管理(サイレント モード)ルールをカスタマイズし、いつ有効にするか無効にするかを決定できます。Android 15 では、ユーザー エクスペリエンスの向上を目的として、これらのルールが大幅に強化されています。次の機能強化が含まれています。
AutomaticZenRule
にタイプを追加し、システムで一部のルールに特別な処理を適用できるようにしました。AutomaticZenRule
にアイコンを追加して、モードを認識しやすくしました。- ユーザーに対してルールをアクティブにする条件を記述する
triggerDescription
文字列をAutomaticZenRule
に追加します。 AutomaticZenRule
にZenDeviceEffects
が追加され、グレースケール表示、夜間モード、壁紙を暗くするなどのルールをトリガーできるようになりました。