Merge branch 'nougat' into 'master'
Support for PrivilegedExtension on Nougat Closes privileged-extension#17 See merge request !442
This commit is contained in:
commit
9e1458f41e
@ -20,6 +20,7 @@
|
||||
package org.fdroid.fdroid.installer;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.support.v4.content.FileProvider;
|
||||
|
||||
@ -59,8 +60,9 @@ public class ApkFileProvider extends FileProvider {
|
||||
|
||||
if (useContentUri) {
|
||||
// return a content Uri using support libs FileProvider
|
||||
|
||||
return getUriForFile(context, AUTHORITY, sanitizedApkFile);
|
||||
Uri apkUri = 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.
|
||||
|
@ -27,6 +27,7 @@ import android.content.Intent;
|
||||
import android.content.ServiceConnection;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Log;
|
||||
@ -406,7 +407,6 @@ public class PrivilegedInstaller extends Installer {
|
||||
|
||||
@Override
|
||||
protected boolean supportsContentUri() {
|
||||
// TODO: correct?
|
||||
return false;
|
||||
return Build.VERSION.SDK_INT >= 24;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user