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.
    
  
  
    
  
  
  
  
    
  
  
    
    
  
  
TargetFileUtils
  public
  
  
  
  class
  TargetFileUtils
  
    extends Object
  
  
  
  
  
  
  
    
    | java.lang.Object | 
  
  
    
      | ↳ | com.android.tradefed.util.TargetFileUtils | 
  
  
    
Summary
Public constructors
    TargetFileUtils
    
public TargetFileUtils ()
    
    
    
  
 
Public methods
    findFile
    
public static  findFile (String path, 
                String namePattern, 
                 options, 
                ITestDevice device)
    
    
    
  Helper method which executes a adb shell find command and returns the results as an ERROR(/ArrayList).
    
    | Parameters | 
|---|
      
        | path | String: The path to search on device. | 
      
        | namePattern | String: The file name pattern. | 
      
        | options | : AERROR(/List)ofStringfor other options pass to find. | 
      
        | device | ITestDevice: The test device. | 
    
    
      
  
 
    getPermission
    
public static String getPermission (String filepath, 
                ITestDevice device)
    
    
    
  Read the file permission bits of a path.
    
    | Parameters | 
|---|
      
        | filepath | String: Path to a file or directory. | 
      
        | device | ITestDevice: The test device. | 
    
    
      | Returns | 
|---|
      
        | String | Octal permission bits for the path. | 
    
      
  
 
    hasPermission
    
public static boolean hasPermission (TargetFileUtils.FilePermission permission, 
                String permissionBits)
    
    
    
  Determines if the permission bits grant the specify permission to any group.
    
    | Parameters | 
|---|
      
        | permission | TargetFileUtils.FilePermission: The specify permissions. | 
      
        | permissionBits | String: The octal permissions string (e.g. 741). | 
    
    
      | Returns | 
|---|
      
        | boolean | True if any owner/group/global has the specify permission. | 
    
 
    isReadOnly
    
public static boolean isReadOnly (String filepath, 
                ITestDevice device)
    
    
    
  Check if the permission for a given path is readonly.
    
    | Parameters | 
|---|
      
        | filepath | String: Path to a file or directory. | 
      
        | device | ITestDevice: The test device. | 
    
    
      | Returns | 
|---|
      
        | boolean | true if the path is readonly, false otherwise. | 
    
      
  
 
    isReadWriteOnly
    
public static boolean isReadWriteOnly (String filepath, 
                ITestDevice device)
    
    
    
  Check if the permission for a given path is readwrite.
    
    | Parameters | 
|---|
      
        | filepath | String: Path to a file or directory. | 
      
        | device | ITestDevice: The test device. | 
    
    
      | Returns | 
|---|
      
        | boolean | true if the path is readwrite, false otherwise. | 
    
      
  
 
 
 
  
  
 
  
    
    
      
    
    
  
       
    
    
  
  
  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 2023-07-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 2023-07-19 UTC."],[],[]]