Use FileProvider for update file handling

Fixes #7654
Closes #7658
pull/1/head
Henning Dodenhof 6 years ago committed by Moxie Marlinspike
parent 2a1ce859c4
commit e0603abdd3

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<paths>
<external-cache-path name="external_cache" path="." />
<external-files-path name="external_files" path="." />
<external-path name="external_pictures" path="Pictures"/>
<external-path name="external_video" path="Movies"/>

@ -14,6 +14,7 @@ import android.support.v4.app.NotificationCompat;
import android.util.Log;
import org.thoughtcrime.securesms.R;
import org.thoughtcrime.securesms.util.FileProviderUtil;
import org.thoughtcrime.securesms.util.FileUtils;
import org.thoughtcrime.securesms.util.Hex;
import org.thoughtcrime.securesms.util.ServiceUtil;
@ -55,7 +56,7 @@ public class UpdateApkReadyListener extends BroadcastReceiver {
private void displayInstallNotification(Context context, Uri uri) {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_GRANT_READ_URI_PERMISSION);
intent.setDataAndType(uri, "application/vnd.android.package-archive");
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
@ -87,7 +88,7 @@ public class UpdateApkReadyListener extends BroadcastReceiver {
if (localUri != null) {
File localFile = new File(Uri.parse(localUri).getPath());
return Uri.fromFile(localFile);
return FileProviderUtil.getUriFor(context, localFile);
}
}
} finally {

Loading…
Cancel
Save