Extra apk existence check

This commit is contained in:
Sergey Eremin
2017-12-03 22:38:18 +03:00
parent 4b0c4276b1
commit f7e40f9534

View File

@@ -58,10 +58,12 @@ public abstract class InstallerAbstract {
}
protected boolean verify(App app) {
if (!new ApkSignatureVerifier(context).match(
app.getPackageName(),
Paths.getApkPath(context, app.getPackageName(), app.getVersionCode())
)) {
File apkPath = Paths.getApkPath(context, app.getPackageName(), app.getVersionCode());
if (!apkPath.exists()) {
Log.w(getClass().getSimpleName(), apkPath.getAbsolutePath() + " does not exist");
return false;
}
if (!new ApkSignatureVerifier(context).match(app.getPackageName(), apkPath)) {
Log.i(getClass().getSimpleName(), "Signature mismatch for " + app.getPackageName());
((YalpStoreApplication) context.getApplicationContext()).removePendingUpdate(app.getPackageName());
if (ContextUtil.isAlive(context)) {
@@ -87,7 +89,7 @@ public abstract class InstallerAbstract {
? DetailsInstallReceiver.ACTION_PACKAGE_REPLACED_NON_SYSTEM
: DetailsInstallReceiver.ACTION_PACKAGE_INSTALLATION_FAILED
);
intent.setData(new Uri.Builder().scheme("package").path(packageName).build());
intent.setData(new Uri.Builder().path(packageName).build());
context.sendBroadcast(intent);
}