Merge branch 'verify-target-sdk' into 'master'
ApkVerifier: check targetSdkVersion See merge request !333
This commit is contained in:
commit
05a5041971
@ -24,6 +24,7 @@ import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.fdroid.fdroid.Hasher;
|
||||
@ -85,8 +86,15 @@ public class ApkVerifier {
|
||||
}
|
||||
|
||||
int localTargetSdkVersion = localApkInfo.applicationInfo.targetSdkVersion;
|
||||
int expectedTargetSdkVersion = expectedApk.targetSdkVersion;
|
||||
Utils.debugLog(TAG, "localTargetSdkVersion: " + localTargetSdkVersion);
|
||||
// TODO: check target sdk
|
||||
Utils.debugLog(TAG, "expectedTargetSdkVersion: " + expectedTargetSdkVersion);
|
||||
if (expectedTargetSdkVersion == Apk.SDK_VERSION_MIN_VALUE) {
|
||||
// NOTE: In old fdroidserver versions, targetSdkVersion was not stored inside the repo!
|
||||
Log.w(TAG, "Skipping check for targetSdkVersion, not available in this repo!");
|
||||
} else if (localTargetSdkVersion != expectedTargetSdkVersion) {
|
||||
throw new ApkVerificationException("targetSdkVersion of apk not equals expected targetSdkVersion!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,7 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.PatternMatcher;
|
||||
import android.support.v4.content.LocalBroadcastManager;
|
||||
import android.text.TextUtils;
|
||||
@ -110,12 +111,10 @@ public abstract class Installer {
|
||||
}
|
||||
|
||||
private int newPermissionCount(Apk apk) {
|
||||
// TODO: requires targetSdk in Apk class/database
|
||||
//boolean supportsRuntimePermissions = pkgInfo.applicationInfo.targetSdkVersion
|
||||
// >= Build.VERSION_CODES.M;
|
||||
//if (supportsRuntimePermissions) {
|
||||
// return 0;
|
||||
//}
|
||||
boolean supportsRuntimePermissions = apk.targetSdkVersion >= Build.VERSION_CODES.M;
|
||||
if (supportsRuntimePermissions) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
AppDiff appDiff = new AppDiff(context.getPackageManager(), apk);
|
||||
if (appDiff.pkgInfo == null) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user