ApkFileProvider: Explicitly grant read permission to PrivExt

This commit is contained in:
Chirayu Desai 2017-02-28 17:47:36 +05:30
parent c004f1ce10
commit 1a586511cf

View File

@ -20,6 +20,7 @@
package org.fdroid.fdroid.installer; package org.fdroid.fdroid.installer;
import android.content.Context; import android.content.Context;
import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.support.v4.content.FileProvider; import android.support.v4.content.FileProvider;
@ -59,8 +60,9 @@ public class ApkFileProvider extends FileProvider {
if (useContentUri) { if (useContentUri) {
// return a content Uri using support libs FileProvider // return a content Uri using support libs FileProvider
Uri apkUri = getUriForFile(context, AUTHORITY, sanitizedApkFile);
return getUriForFile(context, AUTHORITY, sanitizedApkFile); context.grantUriPermission("org.fdroid.fdroid.privileged", apkUri, Intent.FLAG_GRANT_READ_URI_PERMISSION);
return apkUri;
} }
// Need the apk to be world readable, so that the installer is able to read it. // Need the apk to be world readable, so that the installer is able to read it.