Change the DropBoxManager API slightly (this is public, but not yet released) --

take a File instead of a ParcelFileDescriptor (gets opened internally) --
that way the caller doesn't have to worry about closing their PFD and so on.
(Pretty much 100% of the time the caller will be uploading a file, anyway.)
This commit is contained in:
Dan Egnor
2009-11-25 12:38:00 -08:00
parent a85a0ac107
commit eb7a7d57ca
4 changed files with 23 additions and 33 deletions

View File

@@ -23,7 +23,6 @@ import android.content.Intent;
import android.os.Build;
import android.os.DropBoxManager;
import android.os.FileUtils;
import android.os.ParcelFileDescriptor;
import android.os.SystemProperties;
import android.provider.Settings;
import android.util.Log;
@@ -100,10 +99,6 @@ public class BootReceiver extends BroadcastReceiver {
String setting = "logfile:" + filename;
long lastTime = Settings.Secure.getLong(cr, setting, 0);
if (lastTime == fileTime) return; // Already logged this particular file
ParcelFileDescriptor pfd =
ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY);
db.addFile(tag, pfd, DropBoxManager.IS_TEXT);
pfd.close();
db.addFile(tag, file, DropBoxManager.IS_TEXT);
}
}