Update import/export process for ICS+

This commit is contained in:
Moxie Marlinspike 2012-08-05 13:12:51 -07:00
parent 8520cb558a
commit e45bc61624
2 changed files with 12 additions and 12 deletions

View File

@ -185,8 +185,6 @@ public class ConversationListActivity extends SherlockFragmentActivity
Intent clearKeyIntent = new Intent(KeyCachingService.CLEAR_KEY_ACTION, null, Intent clearKeyIntent = new Intent(KeyCachingService.CLEAR_KEY_ACTION, null,
ConversationListActivity.this, KeyCachingService.class); ConversationListActivity.this, KeyCachingService.class);
startService(clearKeyIntent); startService(clearKeyIntent);
DatabaseFactory.getInstance(ConversationListActivity.this).close();
} }
}; };

View File

@ -60,7 +60,8 @@ public class ApplicationExporter {
throw new NoExternalStorageException(); throw new NoExternalStorageException();
} }
private static void migrateFile(File from, File to) throws IOException { private static void migrateFile(File from, File to) {
try {
if (from.exists()) { if (from.exists()) {
FileChannel source = new FileInputStream(from).getChannel(); FileChannel source = new FileInputStream(from).getChannel();
FileChannel destination = new FileOutputStream(to).getChannel(); FileChannel destination = new FileOutputStream(to).getChannel();
@ -69,6 +70,9 @@ public class ApplicationExporter {
source.close(); source.close();
destination.close(); destination.close();
} }
} catch (IOException ioe) {
Log.w("ApplicationExporter", ioe);
}
} }
private static void exportDirectory(Context context, String directoryName) throws IOException { private static void exportDirectory(Context context, String directoryName) throws IOException {
@ -104,9 +108,7 @@ public class ApplicationExporter {
File[] contents = directory.listFiles(); File[] contents = directory.listFiles();
for (int i=0;i<contents.length;i++) { for (File exportedFile : contents) {
File exportedFile = contents[i];
if (exportedFile.isFile()) { if (exportedFile.isFile()) {
File localFile = new File(importDirectory.getAbsolutePath() + File.separator + exportedFile.getName()); File localFile = new File(importDirectory.getAbsolutePath() + File.separator + exportedFile.getName());
migrateFile(exportedFile, localFile); migrateFile(exportedFile, localFile);