Fixed bug package signature info not included

This commit is contained in:
Glenn Carremans 2020-10-26 12:17:32 +01:00
parent dc314963f9
commit ee1a794680
No known key found for this signature in database
GPG Key ID: E197128A4E058CEF
2 changed files with 17 additions and 1 deletions

View File

@ -302,7 +302,7 @@ public class IndexV1Updater extends IndexUpdater {
repo.version = getIntRepoValue(repoMap, "version");
if (TextUtils.isEmpty(platformSigCache)) {
PackageInfo androidPackageInfo = Utils.getPackageInfo(context, "android");
PackageInfo androidPackageInfo = Utils.getPackageInfoWithSignatures(context, "android");
platformSigCache = Utils.getPackageSig(androidPackageInfo);
}

View File

@ -19,6 +19,7 @@
package org.fdroid.fdroid;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
@ -808,6 +809,21 @@ public final class Utils {
return null;
}
/**
* Try to get the {@link PackageInfo} with signature info for the {@code packageName} provided.
*
* @return null on failure
*/
@SuppressLint("PackageManagerGetSignatures")
public static PackageInfo getPackageInfoWithSignatures(Context context, String packageName) {
try {
return context.getPackageManager().getPackageInfo(packageName, PackageManager.GET_SIGNATURES);
} catch (PackageManager.NameNotFoundException e) {
debugLog(TAG, "Could not get PackageInfo: ", e);
}
return null;
}
/**
* Useful for debugging during development, so that arbitrary queries can be made, and their
* results inspected in the debugger.