IncrementalInstallSession

public class IncrementalInstallSession
extends Object implements AutoCloseable

java.lang.Object
com.android.incfs.install.IncrementalInstallSession


インストールされた APK のブロックを読み取る必要があるときにデバイスにストリーミングする、n 個の増分パッケージ インストール セッションを作成するために使用されます。

増分インストールでは、Incremental Filesystem(IncFs)を使用して、APK 全体がデバイスにストリーミングされる前にインストールを 完了できます。このクラスを使用すると、増分インストールを開始し、デバイスにストリーミングできる APK のブロックを制御し、APK のインストールが完了するまで、またはすべてのブロックがデバイスにストリーミングされるまで待機できます。

セッションが閉じられるか、インストールが失敗するか、デバイス接続がタイムアウトになるか、デバイスからのブロック リクエストの処理中に例外が発生するまで、デバイスへの接続は開いたままになります。

このクラスの使用例を次に示します。

try (IncrementalInstallSession session = new IncrementalInstallSession.Builder()
               .addApk(mTestApk0, mTestSignature0)
               .build()) {
         // Start the session on a separate thread.
         session.start(Executors.newCachedThreadPool(), mockDevice.getFactory());

         // Wait a maximum of 45 seconds for the install to finish.
         session.waitForInstallCompleted(45, TimeUnit.SECONDS);
 }

概要

ネストされたクラス

class IncrementalInstallSession.Builder

 

パブリック メソッド

void close()

デバイスとの通信をキャンセルします。

IncrementalInstallSession start(Executor executor, IDeviceConnection.Factory conFactory)

ストリーミング インストール セッションを開始します。

void waitForAnyCompletion(long timeout, TimeUnit units)

APK データがデバイスにストリーミングされるか、 インストールが完了するまで、現在のスレッドをブロックします。

void waitForInstallCompleted(long timeout, TimeUnit units)

すべての APK が正常にインストールされるまで、現在のスレッドをブロックします。

void waitForServingCompleted(long timeout, TimeUnit units)

すべての APK データがデバイスにストリーミングされるまで、現在のスレッドをブロックします。

パブリック メソッド

閉じる

public void close ()

デバイスとの通信をキャンセルします。

start

public IncrementalInstallSession start (Executor executor, 
                IDeviceConnection.Factory conFactory)

ストリーミング インストール セッションを開始します。

パラメータ
executor Executor: デバイスからのブロック リクエストの処理を開始するエグゼキュータ

conFactory IDeviceConnection.Factory: デバイス接続ファクトリ

戻り値
IncrementalInstallSession

例外
IOException デバイスとの通信中にエラーが発生した場合

waitForAnyCompletion

public void waitForAnyCompletion (long timeout, 
                TimeUnit units)

APK データがデバイスにストリーミングされるか、 インストールが完了するまで、現在のスレッドをブロックします。

パラメータ
timeout long: 待機する最大時間。値が 0 の場合、このメソッドは 無期限に待機します。

units TimeUnit: ゼロ以外の timeout の単位

例外
IOException 待機がタイムアウトした場合、APK のインストールに失敗した場合、またはブロック リクエストの処理中に例外が発生した場合 。
InterruptedException

waitForInstallCompleted

public void waitForInstallCompleted (long timeout, 
                TimeUnit units)

すべての APK が正常にインストールされるまで、現在のスレッドをブロックします。データの提供は、インストールの成功の前後に完了する可能性があります。

パラメータ
timeout long: インストールが完了するまで待機する最大時間。値が 0 の場合、このメソッドは無期限に待機します。

units TimeUnit: ゼロ以外の timeout の単位

例外
IOException 待機がタイムアウトした場合、APK のインストールに失敗した場合、またはブロック リクエストの処理中に例外が発生した場合 。
InterruptedException

waitForServingCompleted

public void waitForServingCompleted (long timeout, 
                TimeUnit units)

すべての APK データがデバイスにストリーミングされるまで、現在のスレッドをブロックします。インストール は、提供が完了する前後に完了する可能性があります。

パラメータ
timeout long: 提供が完了するまで待機する最大時間。値が 0 の場合、このメソッドは無期限に待機します。

units TimeUnit: ゼロ以外の timeout の単位

例外
IOException 待機がタイムアウトした場合、APK のストリーミングに失敗した場合、またはブロック リクエストの処理中に例外が発生した場合 。
InterruptedException