remove unused 'projection' argument from ApkProvider.findApkFromAnyRepo()

One small victory in the ever lasting battle against creeping complexity!
This commit is contained in:
Hans-Christoph Steiner 2019-05-29 14:50:30 +02:00
parent 301c2fff2d
commit b400df3ac3
2 changed files with 2 additions and 24 deletions

View File

@ -93,18 +93,13 @@ public class ApkProvider extends FDroidProvider {
} }
public static Apk findApkFromAnyRepo(Context context, String packageName, int versionCode) { public static Apk findApkFromAnyRepo(Context context, String packageName, int versionCode) {
return findApkFromAnyRepo(context, packageName, versionCode, null, Cols.ALL); return findApkFromAnyRepo(context, packageName, versionCode, null);
} }
public static Apk findApkFromAnyRepo(Context context, String packageName, int versionCode, public static Apk findApkFromAnyRepo(Context context, String packageName, int versionCode,
String signature) { String signature) {
return findApkFromAnyRepo(context, packageName, versionCode, signature, Cols.ALL);
}
public static Apk findApkFromAnyRepo(Context context, String packageName, int versionCode,
@Nullable String signature, String[] projection) {
final Uri uri = getApkFromAnyRepoUri(packageName, versionCode, signature); final Uri uri = getApkFromAnyRepoUri(packageName, versionCode, signature);
return findByUri(context, uri, projection); return findByUri(context, uri, Cols.ALL);
} }
public static Apk findByUri(Context context, Uri uri, String[] projection) { public static Apk findByUri(Context context, Uri uri, String[] projection) {

View File

@ -392,23 +392,6 @@ public class ApkProviderTest extends FDroidProviderTest {
assertEquals("xxxxyyyy", apk.hash); assertEquals("xxxxyyyy", apk.hash);
assertEquals("a hash type", apk.hashType); assertEquals("a hash type", apk.hashType);
String[] projection = {
Cols.Package.PACKAGE_NAME,
Cols.HASH,
};
Apk apkLessFields = ApkProvider.Helper.findApkFromAnyRepo(context, "com.example", 11, null, projection);
assertNotNull(apkLessFields);
assertEquals("com.example", apkLessFields.packageName);
assertEquals("xxxxyyyy", apkLessFields.hash);
// Didn't ask for these fields, so should be their default values...
assertNull(apkLessFields.hashType);
assertNull(apkLessFields.versionName);
assertEquals(0, apkLessFields.versionCode);
Apk notFound = ApkProvider.Helper.findApkFromAnyRepo(context, "com.doesnt.exist", 1000); Apk notFound = ApkProvider.Helper.findApkFromAnyRepo(context, "com.doesnt.exist", 1000);
assertNull(notFound); assertNull(notFound);
} }