CasUtil
public
final
class
CasUtil
extends Object
| java.lang.Object | |
| ↳ | com.android.tradefed.util.CasUtil |
Summary
Constants | |
|---|---|
String |
ANDROID_INFO_FILENAME
|
String |
CAS_LOG_ROOT_NAME
|
String |
CHUNKS_DIR_NAME
|
String |
CHUNKS_INDEX_FILENAME
|
String |
SUPER_IMAGE_FILENAME
|
String |
SYSTEM_IMAGE_FILENAME
|
Public methods | |
|---|---|
static
void
|
checkCasClientFlags(Path clientPath, Consumer<Set<String>> flagsConsumerFn)
Checks the supported flags of the CAS client. |
static
Path
|
createUniqueCasLogDir(Path logDirRootPath)
|
static
void
|
ensureCasClientExecutable(Path casClientPath, boolean logMetricsIfNotExecutable)
|
static
String
|
getCasLogFromDir(Path logDirPath)
Reads the CAS log file " |
static
String
|
getCasLogFromDir(Path logDirPath, String clientName, String tag, boolean removeLogDirAfterRead)
Reads the CAS log file from the given directory. |
static
String
|
getCasLogFromDir(Path logDirPath, String clientName)
Reads the CAS log file " |
static
boolean
|
isChunkedDir(Path path)
Returns true if the given path is a valid FastCDC-chunked directory. |
static
boolean
|
isUncompressedDeviceImage(Path path)
Returns true if the given path is a valid uncompressed device image. |
static
void
|
logCasClientVersion(Path clientPath, Consumer<String> versionHandlerFn)
|
static
void
|
logCasClientVersion(Path clientPath)
|
static
void
|
validateChunkedDir(Path path)
Validates the given path is a valid FastCDC-chunked directory. |
Constants
ANDROID_INFO_FILENAME
public static final String ANDROID_INFO_FILENAME
Constant Value: "android-info.txt"
CAS_LOG_ROOT_NAME
public static final String CAS_LOG_ROOT_NAME
Constant Value: "tf-cas-fuse-log-root"
CHUNKS_DIR_NAME
public static final String CHUNKS_DIR_NAME
Constant Value: "_chunks"
CHUNKS_INDEX_FILENAME
public static final String CHUNKS_INDEX_FILENAME
Constant Value: "_chunks_index.json"
SUPER_IMAGE_FILENAME
public static final String SUPER_IMAGE_FILENAME
Constant Value: "super.img"
SYSTEM_IMAGE_FILENAME
public static final String SYSTEM_IMAGE_FILENAME
Constant Value: "system.img"
Public methods
checkCasClientFlags
public static void checkCasClientFlags (Path clientPath,
Consumer<Set<String>> flagsConsumerFn)Checks the supported flags of the CAS client.
| Parameters | |
|---|---|
clientPath |
Path: The path to the CAS client binary. |
flagsConsumerFn |
Consumer: A consumer that accepts the set of supported flags. |
createUniqueCasLogDir
public static Path createUniqueCasLogDir (Path logDirRootPath)
| Parameters | |
|---|---|
logDirRootPath |
Path |
| Returns | |
|---|---|
Path |
|
| Throws | |
|---|---|
IOException |
|
ensureCasClientExecutable
public static void ensureCasClientExecutable (Path casClientPath,
boolean logMetricsIfNotExecutable)| Parameters | |
|---|---|
casClientPath |
Path |
logMetricsIfNotExecutable |
boolean |
getCasLogFromDir
public static String getCasLogFromDir (Path logDirPath)
Reads the CAS log file "
| Parameters | |
|---|---|
logDirPath |
Path: The directory path to read the CAS log file from. |
| Returns | |
|---|---|
String |
The CAS log file content or null if the log file cannot be read. |
getCasLogFromDir
public static String getCasLogFromDir (Path logDirPath,
String clientName,
String tag,
boolean removeLogDirAfterRead)Reads the CAS log file from the given directory.
| Parameters | |
|---|---|
logDirPath |
Path: The directory path to read the CAS log file from. |
clientName |
String: The name of the CAS client. |
tag |
String: The tag of the CAS log file, like "INFO", "WARNING", "ERROR", etc. |
removeLogDirAfterRead |
boolean: Whether to remove the log directory after reading the log file. |
| Returns | |
|---|---|
String |
The CAS log file content. |
| Throws | |
|---|---|
IOException |
If the CAS log file cannot be read. |
getCasLogFromDir
public static String getCasLogFromDir (Path logDirPath,
String clientName)Reads the CAS log file "
| Parameters | |
|---|---|
logDirPath |
Path: The directory path to read the CAS log file from. |
clientName |
String: The name of the CAS client. |
| Returns | |
|---|---|
String |
The CAS log file content or "" if the log file cannot be read. |
isChunkedDir
public static boolean isChunkedDir (Path path)
Returns true if the given path is a valid FastCDC-chunked directory.
| Parameters | |
|---|---|
path |
Path |
| Returns | |
|---|---|
boolean |
|
isUncompressedDeviceImage
public static boolean isUncompressedDeviceImage (Path path)
Returns true if the given path is a valid uncompressed device image.
For the most robust and reliable check, verify the existence of (system.img or super.img) AND android-info.txt.
system.img/super.img: Confirms that the core OS data is present.
android-info.txt: Confirms that this is an official build package with metadata describing the device and build version.
This combination is extremely unlikely to occur in a directory that isn't an uncompressed device image and correctly handles cases like the TV build where boot.img is absent.
| Parameters | |
|---|---|
path |
Path: The absolute path to the device image. |
| Returns | |
|---|---|
boolean |
True if the path is a valid uncompressed device image, false otherwise. |
logCasClientVersion
public static void logCasClientVersion (Path clientPath,
Consumer<String> versionHandlerFn)| Parameters | |
|---|---|
clientPath |
Path |
versionHandlerFn |
Consumer |
logCasClientVersion
public static void logCasClientVersion (Path clientPath)
| Parameters | |
|---|---|
clientPath |
Path |
validateChunkedDir
public static void validateChunkedDir (Path path)
Validates the given path is a valid FastCDC-chunked directory.
device_image.zip/
_chunks/
_chunks_index.json
chunk1.img
_chunks_index.json
| Parameters | |
|---|---|
path |
Path: The path to the chunked directory. |
| Throws | |
|---|---|
IOException |
If the path is not a valid FastCDC-chunked directory. |