Remove unused methods.

There are two methods which allow callers to choose which fields to
return. These were originally added for performance, so you only ask for
what you need. However empirically the performance gain doesn't mean
anything, because it is dwarfed by the query that was just executed.
However, it does open the code up to bugs because we forget to ask for
the right fields. So now it just returns all fields when querying for
apks.
This commit is contained in:
Peter Serwylo 2017-08-01 13:02:35 +10:00
parent 618f83bb23
commit 3b41287cf7

View File

@ -114,14 +114,10 @@ public class ApkProvider extends FDroidProvider {
}
public static List<Apk> findByPackageName(Context context, String packageName) {
return findByPackageName(context, packageName, Cols.ALL);
}
public static List<Apk> findByPackageName(Context context, String packageName, String[] projection) {
ContentResolver resolver = context.getContentResolver();
final Uri uri = getAppUri(packageName);
final String sort = "apk." + Cols.VERSION_CODE + " DESC";
Cursor cursor = resolver.query(uri, projection, null, null, sort);
Cursor cursor = resolver.query(uri, Cols.ALL, null, null, sort);
return cursorToList(cursor);
}
@ -153,13 +149,8 @@ public class ApkProvider extends FDroidProvider {
}
public static Apk get(Context context, Uri uri) {
return get(context, uri, Cols.ALL);
}
@Nullable
public static Apk get(Context context, Uri uri, String[] fields) {
ContentResolver resolver = context.getContentResolver();
Cursor cursor = resolver.query(uri, fields, null, null, null);
Cursor cursor = resolver.query(uri, Cols.ALL, null, null, null);
return cursorToApk(cursor);
}