public static File insertDriveFile(Drive drive,String folderId,Context context,MyTracksProviderUtils myTracksProviderUtils,Track track,boolean canRetry,boolean updateTrack) throws IOException {
  java.io.File file=null;
  try {
    file=getTempFile(context,myTracksProviderUtils,track,true);
    if (file == null) {
      Log.e(TAG,"Unable to add Drive file. File is null for track " + track.getName());
      return null;
    }
    Log.d(TAG,"Add Drive file for track " + track.getName());
    File uploadedFile=insertDriveFile(drive,folderId,track.getName(),file,canRetry);
    if (uploadedFile == null) {
      Log.e(TAG,"Unable to add Drive file. Uploaded file is null for track " + track.getName());
      return null;
    }
    if (updateTrack) {
      SyncUtils.updateTrack(myTracksProviderUtils,track,uploadedFile);
    }
    return uploadedFile;
  }
  finally {
    if (file != null) {
      file.delete();
    }
  }
}

public static File insertDriveFile ( Drive drive , String folderId , Context context , MyTracksProviderUtils myTracksProviderUtils , Track track , boolean canRetry , boolean updateTrack ) throws IOException { java . io . File file = null ; try { file = getTempFile ( context , myTracksProviderUtils , track , true ) ; if ( file == null ) { Log . e ( TAG , "Unable to add Drive file. File is null for track " + track . getName ( ) ) ; return null ; } Log . d ( TAG , "Add Drive file for track " + track . getName ( ) ) ; File uploadedFile = insertDriveFile ( drive , folderId , track . getName ( ) , file , canRetry ) ; if ( uploadedFile == null ) { Log . e ( TAG , "Unable to add Drive file. Uploaded file is null for track " + track . getName ( ) ) ; return null ; } if ( updateTrack ) { SyncUtils . updateTrack ( myTracksProviderUtils , track , uploadedFile ) ; } return uploadedFile ; } finally { if ( file != null ) { file . delete ( ) ; } } }
inserts a drive file using info from a track .
