Starting March 27, 2025, we recommend using android-latest-release instead of aosp-main to build and contribute to AOSP. For more information, see Changes to AOSP.
         
       
     
  
  
  
  
  
    
    
      
    
    
      
      Stay organized with collections
    
    
      
      Save and categorize content based on your preferences.
    
  
  
    
  
  
  
  
    
  
  
    
    
  
  
SearchArtifactUtil
  public
  
  
  
  class
  SearchArtifactUtil
  
    extends Object
  
  
  
  
  
  
  
    
    | java.lang.Object | 
  
  
    
      | ↳ | com.android.tradefed.util.SearchArtifactUtil | 
  
  
    
  A utility class that can be used to search for test artifacts.
Summary
| Public methods | 
|---|
  
  
  
    | 
        
        
        static
        
        
        File | 
      findModuleDir(String moduleName, boolean targetFirst)
      Finds the module directory that matches the given module name
        
    
 | 
  
  
  
  
    | 
        
        
        static
        
        
        File | 
      getModuleDirFromConfig(IInvocationContext moduleContext)
       | 
  
  
  
  
    | 
        
        
        static
        
        
        File | 
      getModuleDirFromConfig()
      Returns the module directory if present, when called inside a module scope.
        
    
 | 
  
  
  
  
    | 
        
        
        static
        
        
        File | 
      getModuleDirFromConfig(ConfigurationDescriptor descriptor)
       | 
  
  
  
  
    | 
        
        
        static
        
        
        File | 
      searchFile(String fileName, boolean targetFirst)
      Searches for a test artifact/dependency file from the test directory.
        
    
 | 
  
  
  
  
    | 
        
        
        static
        
        
        File | 
      searchFile(String fileName, boolean targetFirst, IAbi abi)
      Searches for a test artifact/dependency file from the test directory.
        
    
 | 
  
  
  
  
    | 
        
        
        static
        
        
        File | 
      searchFile(String fileName, boolean targetFirst, TestInformation testInfo)
      Searches for a test artifact/dependency file from the test directory.
        
    
 | 
  
  
  
  
    | 
        
        
        static
        
        
        File | 
      searchFile(String fileName, boolean targetFirst, IAbi abi,  altDirs, AltDirBehavior altDirBehavior, TestInformation testInfo, boolean includeDirectory)
      Searches for a test artifact/dependency file from the test directory.
        
    
 | 
  
  
  
  
    | 
        
        
        static
        
        
        File | 
      searchFile(String fileName, boolean targetFirst, IAbi abi,  altDirs, AltDirBehavior altDirBehavior, TestInformation testInfo)
      Searches for a test artifact/dependency file from the test directory.
        
    
 | 
  
  
  
  
    | 
        
        
        static
        
        
        File | 
      searchFile(String fileName, boolean targetFirst,  altDirs, AltDirBehavior altDirBehavior)
      Searches for a test artifact/dependency file from the test directory.
        
    
 | 
  
Fields
Public constructors
    SearchArtifactUtil
    
public SearchArtifactUtil ()
    
    
    
  
 
Public methods
    findModuleDir
    
public static File findModuleDir (String moduleName, 
                boolean targetFirst)
    
    
    
  Finds the module directory that matches the given module name
    
    | Parameters | 
|---|
      
        | moduleName | String: The name of the module. | 
      
        | targetFirst | boolean: Whether we are favoring target-side vs. host-side for the search. | 
    
    
      | Returns | 
|---|
      
        | File | the module directory. Can be null. | 
    
 
    getModuleDirFromConfig
    
public static File getModuleDirFromConfig (IInvocationContext moduleContext)
    
    
    
  
    
    | Parameters | 
|---|
      
        | moduleContext | IInvocationContext | 
    
    
 
    getModuleDirFromConfig
    
public static File getModuleDirFromConfig ()
    
    
    
  Returns the module directory if present, when called inside a module scope.
    
 
    getModuleDirFromConfig
    
public static File getModuleDirFromConfig (ConfigurationDescriptor descriptor)
    
    
    
  
    
    | Parameters | 
|---|
      
        | descriptor | ConfigurationDescriptor | 
    
    
 
    searchFile
    
public static File searchFile (String fileName, 
                boolean targetFirst)
    
    
    
  Searches for a test artifact/dependency file from the test directory.
    
    | Parameters | 
|---|
      
        | fileName | String: The name of the file to look for. | 
      
        | targetFirst | boolean: Whether we are favoring target-side files vs. host-side files for the
     search. | 
    
    
      | Returns | 
|---|
      
        | File | The found artifact file or null if none. | 
    
 
    searchFile
    
public static File searchFile (String fileName, 
                boolean targetFirst, 
                IAbi abi)
    
    
    
  Searches for a test artifact/dependency file from the test directory.
    
    | Parameters | 
|---|
      
        | fileName | String: The name of the file to look for. | 
      
        | targetFirst | boolean: Whether we are favoring target-side files vs. host-side files for the
     search. | 
      
        | abi | IAbi: TheIAbito match the file. | 
    
    
      | Returns | 
|---|
      
        | File | The found artifact file or null if none. | 
    
 
    
    
public static File searchFile (String fileName, 
                boolean targetFirst, 
                TestInformation testInfo)
    
    
    
  Searches for a test artifact/dependency file from the test directory.
    
    | Parameters | 
|---|
      
        | fileName | String: The name of the file to look for. | 
      
        | targetFirst | boolean: Whether we are favoring target-side files vs. host-side files for the
     search. | 
      
        | testInfo | TestInformation: TheTestInformationof the current test when available. | 
    
    
      | Returns | 
|---|
      
        | File | The found artifact file or null if none. | 
    
 
    
    
public static File searchFile (String fileName, 
                boolean targetFirst, 
                IAbi abi, 
                 altDirs, 
                AltDirBehavior altDirBehavior, 
                TestInformation testInfo, 
                boolean includeDirectory)
    
    
    
  Searches for a test artifact/dependency file from the test directory.
    
    | Parameters | 
|---|
      
        | fileName | String: The name of the file to look for. | 
      
        | targetFirst | boolean: Whether we are favoring target-side files vs. host-side files for the
     search. | 
      
        | abi | IAbi: TheIAbito match the file. | 
      
        | altDirs | : Alternative search paths, in addition to the default search paths. | 
      
        | altDirBehavior | AltDirBehavior: how alternative search paths should be used against default paths: as
     fallback, or as override; if unspecified, fallback will be used | 
      
        | testInfo | TestInformation: TheTestInformationof the current test when available. | 
      
        | includeDirectory | boolean: whether to include directories in the search result. | 
    
    
      | Returns | 
|---|
      
        | File | The found artifact file or null if none. | 
    
 
    
    
public static File searchFile (String fileName, 
                boolean targetFirst, 
                IAbi abi, 
                 altDirs, 
                AltDirBehavior altDirBehavior, 
                TestInformation testInfo)
    
    
    
  Searches for a test artifact/dependency file from the test directory.
    
    | Parameters | 
|---|
      
        | fileName | String: The name of the file to look for. | 
      
        | targetFirst | boolean: Whether we are favoring target-side files vs. host-side files for the
     search. | 
      
        | abi | IAbi: TheIAbito match the file. | 
      
        | altDirs | : Alternative search paths, in addition to the default search paths. | 
      
        | altDirBehavior | AltDirBehavior: how alternative search paths should be used against default paths: as
     fallback, or as override; if unspecified, fallback will be used | 
      
        | testInfo | TestInformation: TheTestInformationof the current test when available. | 
    
    
      | Returns | 
|---|
      
        | File | The found artifact file or null if none. | 
    
 
    searchFile
    
public static File searchFile (String fileName, 
                boolean targetFirst, 
                 altDirs, 
                AltDirBehavior altDirBehavior)
    
    
    
  Searches for a test artifact/dependency file from the test directory.
    
    | Parameters | 
|---|
      
        | fileName | String: The name of the file to look for. | 
      
        | targetFirst | boolean: Whether we are favoring target-side files vs. host-side files for the
     search. | 
      
        | altDirs | : Alternative search paths, in addition to the default search paths. | 
      
        | altDirBehavior | AltDirBehavior: how alternative search paths should be used against default paths: as
     fallback, or as override; if unspecified, fallback will be used | 
    
    
      | Returns | 
|---|
      
        | File | The found artifact file or null if none. | 
    
 
 
 
  
  
 
  
    
    
      
    
    
  
       
    
    
  
  
  Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
  Last updated 2025-03-19 UTC.
  
  
  
    
      [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-03-19 UTC."],[],[]]