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;
 | 
					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.
 | 
				
			||||||
 | 
				
			|||||||
@ -27,6 +27,7 @@ import android.content.Intent;
 | 
				
			|||||||
import android.content.ServiceConnection;
 | 
					import android.content.ServiceConnection;
 | 
				
			||||||
import android.content.pm.PackageManager;
 | 
					import android.content.pm.PackageManager;
 | 
				
			||||||
import android.net.Uri;
 | 
					import android.net.Uri;
 | 
				
			||||||
 | 
					import android.os.Build;
 | 
				
			||||||
import android.os.IBinder;
 | 
					import android.os.IBinder;
 | 
				
			||||||
import android.os.RemoteException;
 | 
					import android.os.RemoteException;
 | 
				
			||||||
import android.util.Log;
 | 
					import android.util.Log;
 | 
				
			||||||
@ -406,7 +407,6 @@ public class PrivilegedInstaller extends Installer {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    protected boolean supportsContentUri() {
 | 
					    protected boolean supportsContentUri() {
 | 
				
			||||||
        // TODO: correct?
 | 
					        return Build.VERSION.SDK_INT >= 24;
 | 
				
			||||||
        return false;
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user