IncrementalInstallSession

public class IncrementalInstallSession
extends Object

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


설치된 APK의 블록이 읽어야 할 때 기기로 스트리밍되는 증분 패키지 설치 세션을 만드는 데 사용됩니다.

증분 설치는 증분 파일 시스템 (IncFs)을 사용하여 전체 APK가 기기에 스트리밍되기 전에 설치가 완료되도록 합니다. 이 클래스는 증분 설치를 시작하고, APK의 어떤 블록이 기기로 스트리밍될 수 있는지 제어하고, APK 설치가 완료될 때까지 또는 모든 블록이 기기로 스트리밍될 때까지 기다리는 데 사용할 수 있습니다.

기기와의 연결은 세션이 닫히거나, 설치가 실패하거나, 기기 연결 시간이 초과되거나, 기기에서 블록 요청을 처리하는 동안 예외가 발생할 때까지 열린 상태로 유지됩니다.

이 클래스의 사용 예는 다음과 같습니다.

{@code 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

생성 값
기기와 통신하는 중에 오류가 발생한 경우

waitForAnyCompletion

public void waitForAnyCompletion (long timeout, 
                TimeUnit units)

APK 데이터가 기기로 스트리밍되거나 설치가 완료될 때까지 현재 스레드를 차단합니다.

매개변수
timeout long: 대기할 최대 시간입니다. 값이 0이면 이 메서드가 무한정 대기합니다.

units TimeUnit: 0이 아닌 timeout의 단위

생성 값
대기 시간이 초과되거나 APK가 설치되지 않거나 블록 요청을 처리하는 중에 예외가 발생한 경우

waitForInstallCompleted

public void waitForInstallCompleted (long timeout, 
                TimeUnit units)

모든 APK가 성공적으로 설치될 때까지 현재 스레드를 차단합니다. 데이터 제공은 설치가 완료되기 전이나 후에 완료될 수 있습니다.

매개변수
timeout long: 설치가 완료될 때까지 기다리는 최대 시간입니다. 값이 0이면 이 메서드가 무한정 대기합니다.

units TimeUnit: 0이 아닌 timeout의 단위

생성 값
대기 시간이 초과되거나 APK가 설치되지 않거나 블록 요청을 처리하는 중에 예외가 발생한 경우

waitForServingCompleted

public void waitForServingCompleted (long timeout, 
                TimeUnit units)

모든 APK 데이터가 기기로 스트리밍될 때까지 현재 스레드를 차단합니다. 설치는 서빙이 완료되기 전이나 후에 완료될 수 있습니다.

매개변수
timeout long: 제공이 완료될 때까지 기다리는 최대 시간입니다. 값이 0이면 이 메서드가 무한정 대기합니다.

units TimeUnit: 0이 아닌 timeout의 단위

생성 값
대기 시간이 초과되거나 APK가 스트리밍되지 않거나 블록 요청을 처리하는 중에 예외가 발생합니다.