Esempio n. 1
0
 private void logFinalizeProblem(String tag) {
   try {
     FinskyLog.w("Failure %s while finalizing %s", tag, toString());
     FinskyLog.w(" file=%s, size=%d", this.mFileName, Long.valueOf(this.mSize));
     File destinationDir = ObbFactory.getParentDirectory(this.mPackageName);
     FinskyLog.w(" Contents of %s:", destinationDir.getAbsolutePath());
     if (!destinationDir.exists()) {
       FinskyLog.w(" (Does not exist)", new Object[0]);
     } else if (destinationDir.isDirectory()) {
       File[] files = destinationDir.listFiles();
       if (files == null) {
         FinskyLog.w(" (listFiles() returned null)", new Object[0]);
         return;
       }
       for (File existingFile : files) {
         FinskyLog.w(
             "  name=%s size=%d", existingFile.getName(), Long.valueOf(existingFile.length()));
       }
     } else {
       FinskyLog.w(" (Is not a directory)", new Object[0]);
     }
   } catch (Exception e) {
     FinskyLog.wtf(e, "Unexpected exception", new Object[0]);
   }
 }
Esempio n. 2
0
 public File getFile() {
   if (!Storage.externalStorageAvailable() || this.mSize <= 0) {
     return null;
   }
   File destinationDir = ObbFactory.getParentDirectory(this.mPackageName);
   if (!destinationDir.exists()) {
     destinationDir.mkdirs();
   }
   return new File(destinationDir, this.mFileName);
 }