DeviceFileReporter

public class DeviceFileReporter
extends Object

java.lang.Object
   ↳ com.android.tradefed.result.DeviceFileReporter


A utility class that checks the device for files and sends them to testLog(String, LogDataType, InputStreamSource) if found.

Summary

Public constructors

DeviceFileReporter(ITestDevice device, ITestInvocationListener listener)

Initialize a new DeviceFileReporter with the provided ITestDevice

Public methods

void addPatterns(List<String> patterns)

Add patterns with the log data type set to the default.

void addPatterns(Map<String, LogDataType> patterns)

Add patterns with the respective log data types

void addPatterns(String... patterns)

Add patterns with the log data type set to the default.

List<String> run()

Actually search the filesystem for the specified patterns and send them to testLog(String, LogDataType, InputStreamSource) if found

void setDefaultLogDataType(LogDataType type)

Set the default log data type set for patterns that don't have an associated type.

void setInferUnknownDataTypes(boolean infer)

Whether to attempt to infer the data types of UNKNOWN files by checking the file extensions against a list.

void setSkipRepeatFiles(boolean skip)

Whether or not to skip files which have already been reported.

Public constructors

DeviceFileReporter

DeviceFileReporter (ITestDevice device, 
                ITestInvocationListener listener)

Initialize a new DeviceFileReporter with the provided ITestDevice

Parameters
device ITestDevice

listener ITestInvocationListener

Public methods

addPatterns

void addPatterns (List<String> patterns)

Add patterns with the log data type set to the default.

Parameters
patterns List: a List of String filename glob patterns. Should be absolute.

addPatterns

void addPatterns (Map<String, LogDataType> patterns)

Add patterns with the respective log data types

Parameters
patterns Map: a Map of String filename glob patterns to their respective LogDataTypes. The globs should be absolute.

addPatterns

void addPatterns (String... patterns)

Add patterns with the log data type set to the default.

Parameters
patterns String: a varargs array of String filename glob patterns. Should be absolute.

run

List<String> run ()

Actually search the filesystem for the specified patterns and send them to testLog(String, LogDataType, InputStreamSource) if found

Returns
List<String>

Throws
DeviceNotAvailableException

setDefaultLogDataType

void setDefaultLogDataType (LogDataType type)

Set the default log data type set for patterns that don't have an associated type.

Parameters
type LogDataType: the LogDataType

See also:

setInferUnknownDataTypes

void setInferUnknownDataTypes (boolean infer)

Whether to attempt to infer the data types of UNKNOWN files by checking the file extensions against a list.

Note that, when enabled, these inferences will only be made for patterns with file type UNKNOWN (which includes patterns added without a specific type, and without the) default type having been set manually). If the inference fails, the data type will remain as UNKNOWN.

Parameters
infer boolean

setSkipRepeatFiles

void setSkipRepeatFiles (boolean skip)

Whether or not to skip files which have already been reported. This is only relevant when multiple patterns are being used, and two or more of those patterns match the same file.

Note that this must only be called prior to calling run(). Doing otherwise will cause undefined behavior.

Parameters
skip boolean