Cleanup before CR.

This commit is contained in:
Peter Serwylo 2015-09-05 11:12:24 +10:00
parent cc0adcc5ad
commit b34853a776
4 changed files with 7 additions and 38 deletions

View File

@ -184,10 +184,12 @@ public class RepoUpdater {
/** /**
* My crappy benchmark with a Nexus 4, Android 5.0 on a fairly crappy internet connection I get: * My crappy benchmark with a Nexus 4, Android 5.0 on a fairly crappy internet connection I get:
* * 25 = { 39, 35 } seconds * * 25 = 37 seconds
* * 50 = { 36, 30 } seconds * * 50 = 33 seconds
* * 100 = { 33, 27 } seconds * * 100 = 30 seconds
* * 200 = { 30, 33 } seconds * * 200 = 32 seconds
* Raising this means more memory consumption, so we'd like it to be low, but not
* so low that it takes too long.
*/ */
private static final int MAX_APP_BUFFER = 50; private static final int MAX_APP_BUFFER = 50;
@ -241,8 +243,7 @@ public class RepoUpdater {
try { try {
context.getContentResolver().applyBatch(TempAppProvider.getAuthority(), appOperations); context.getContentResolver().applyBatch(TempAppProvider.getAuthority(), appOperations);
} catch (RemoteException|OperationApplicationException e) { } catch (RemoteException|OperationApplicationException e) {
Log.e(TAG, "Error updating apps", e); throw new UpdateException(repo, "An internal error occured while updating the database", e);
throw new UpdateException(repo, "Error updating apps: " + e.getMessage(), e);
} }
} }
@ -378,7 +379,6 @@ public class RepoUpdater {
} }
} }
// TODO: Deal with more than MAX_QUERY_PARAMS...
if (toDelete.size() > 0) { if (toDelete.size() > 0) {
Uri uri = TempApkProvider.getApksUri(repo, toDelete); Uri uri = TempApkProvider.getApksUri(repo, toDelete);
return ContentProviderOperation.newDelete(uri).build(); return ContentProviderOperation.newDelete(uri).build();

View File

@ -34,17 +34,6 @@ import java.util.List;
/** /**
* Parses the index.xml into Java data structures. * Parses the index.xml into Java data structures.
*
* For streaming apks from an index file, it is helpful if the index has the <repo> tag before
* any <application> tags. This means that apps and apks can be saved instantly by the RepoUpdater,
* without having to buffer them at all, saving memory. The XML spec doesn't mandate order like
* this, though it is almost always a fair assumption:
*
* http://www.ibm.com/developerworks/library/x-eleord/index.html
*
* This is doubly so, as repo indices are likely from fdroidserver, which will output everybodys
* repo the same way. Having said that, this also should not be _forced_ upon people, but we can
* at least consider rejecting malformed indexes.
*/ */
public class RepoXMLHandler extends DefaultHandler { public class RepoXMLHandler extends DefaultHandler {

View File

@ -1,20 +1,12 @@
package org.fdroid.fdroid.data; package org.fdroid.fdroid.data;
import android.content.ContentResolver;
import android.content.ContentValues; import android.content.ContentValues;
import android.content.Context; import android.content.Context;
import android.content.UriMatcher; import android.content.UriMatcher;
import android.database.Cursor;
import android.net.Uri; import android.net.Uri;
import android.provider.BaseColumns;
import android.util.Log; import android.util.Log;
import org.fdroid.fdroid.Utils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* This class does all of its operations in a temporary sqlite table. * This class does all of its operations in a temporary sqlite table.
@ -27,7 +19,6 @@ public class TempApkProvider extends ApkProvider {
private static final String PATH_INIT = "init"; private static final String PATH_INIT = "init";
private static final String PATH_COMMIT = "commit"; private static final String PATH_COMMIT = "commit";
private static final String PATH_ROLLBACK = "rollback";
private static final int CODE_INIT = 10000; private static final int CODE_INIT = 10000;
private static final int CODE_COMMIT = CODE_INIT + 1; private static final int CODE_COMMIT = CODE_INIT + 1;
@ -119,8 +110,4 @@ public class TempApkProvider extends ApkProvider {
write().execSQL("DELETE FROM " + DBHelper.TABLE_APK); write().execSQL("DELETE FROM " + DBHelper.TABLE_APK);
write().execSQL("INSERT INTO " + DBHelper.TABLE_APK + " SELECT * FROM " + getTableName()); write().execSQL("INSERT INTO " + DBHelper.TABLE_APK + " SELECT * FROM " + getTableName());
} }
private void removeTable() {
write().execSQL("DROP TABLE IF EXISTS " + getTableName());
}
} }

View File

@ -6,8 +6,6 @@ import android.content.UriMatcher;
import android.net.Uri; import android.net.Uri;
import android.util.Log; import android.util.Log;
import java.util.List;
/** /**
* This class does all of its operations in a temporary sqlite table. * This class does all of its operations in a temporary sqlite table.
*/ */
@ -19,7 +17,6 @@ public class TempAppProvider extends AppProvider {
private static final String PATH_INIT = "init"; private static final String PATH_INIT = "init";
private static final String PATH_COMMIT = "commit"; private static final String PATH_COMMIT = "commit";
private static final String PATH_ROLLBACK = "rollback";
private static final int CODE_INIT = 10000; private static final int CODE_INIT = 10000;
private static final int CODE_COMMIT = CODE_INIT + 1; private static final int CODE_COMMIT = CODE_INIT + 1;
@ -96,8 +93,4 @@ public class TempAppProvider extends AppProvider {
write().execSQL("DELETE FROM " + DBHelper.TABLE_APP); write().execSQL("DELETE FROM " + DBHelper.TABLE_APP);
write().execSQL("INSERT INTO " + DBHelper.TABLE_APP + " SELECT * FROM " + getTableName()); write().execSQL("INSERT INTO " + DBHelper.TABLE_APP + " SELECT * FROM " + getTableName());
} }
private void removeTable() {
}
} }