aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/AndroidManifest.xml4
-rw-r--r--src/main/java/eu/siacs/conversations/persistance/FileBackend.java9
-rw-r--r--src/main/java/eu/siacs/conversations/services/BarcodeProvider.java7
-rw-r--r--src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java2
-rw-r--r--src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java2
5 files changed, 15 insertions, 9 deletions
diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml
index c1baf42d..d6991f88 100644
--- a/src/main/AndroidManifest.xml
+++ b/src/main/AndroidManifest.xml
@@ -197,7 +197,7 @@
<provider
android:name="android.support.v4.content.FileProvider"
- android:authorities="eu.siacs.conversations.files"
+ android:authorities="${applicationId}.files"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
@@ -205,7 +205,7 @@
android:resource="@xml/file_paths" />
</provider>
<provider
- android:authorities="eu.siacs.conversations.barcodes"
+ android:authorities="${applicationId}.barcodes"
android:name=".services.BarcodeProvider"
android:exported="false"
android:grantUriPermissions="true"/>
diff --git a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java
index 1886d3c0..13e27f89 100644
--- a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java
+++ b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java
@@ -60,7 +60,7 @@ import eu.siacs.conversations.xmpp.pep.Avatar;
public class FileBackend {
private static final SimpleDateFormat IMAGE_DATE_FORMAT = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.US);
- public static final String CONVERSATIONS_FILE_PROVIDER = "eu.siacs.conversations.files";
+ private static final String FILE_PROVIDER = ".files";
private XmppConnectionService mXmppConnectionService;
@@ -454,12 +454,17 @@ public class FileBackend {
File file = new File(getTakePhotoPath()+"IMG_" + this.IMAGE_DATE_FORMAT.format(new Date()) + ".jpg");
file.getParentFile().mkdirs();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
- return FileProvider.getUriForFile(mXmppConnectionService, CONVERSATIONS_FILE_PROVIDER, file);
+ return getUriForFile(mXmppConnectionService,file);
} else {
return Uri.fromFile(file);
}
}
+ public static Uri getUriForFile(Context context, File file) {
+ String packageId = context.getPackageName();
+ return FileProvider.getUriForFile(context, packageId + FILE_PROVIDER, file);
+ }
+
public static Uri getIndexableTakePhotoUri(Uri original) {
if ("file".equals(original.getScheme())) {
return original;
diff --git a/src/main/java/eu/siacs/conversations/services/BarcodeProvider.java b/src/main/java/eu/siacs/conversations/services/BarcodeProvider.java
index 8d00b33e..9c50b081 100644
--- a/src/main/java/eu/siacs/conversations/services/BarcodeProvider.java
+++ b/src/main/java/eu/siacs/conversations/services/BarcodeProvider.java
@@ -34,7 +34,7 @@ import eu.siacs.conversations.xmpp.jid.Jid;
public class BarcodeProvider extends ContentProvider implements ServiceConnection {
- private static final String AUTHORITY = "eu.siacs.conversations.barcodes";
+ private static final String AUTHORITY = ".barcodes";
private final Object lock = new Object();
@@ -176,8 +176,9 @@ public class BarcodeProvider extends ContentProvider implements ServiceConnectio
}
}
- public static Uri getUriForAccount(Account account) {
- return Uri.parse("content://" + AUTHORITY + "/" + account.getJid().toBareJid() + ".png");
+ public static Uri getUriForAccount(Context context, Account account) {
+ final String packageId = context.getPackageName();
+ return Uri.parse("content://" + packageId + AUTHORITY + "/" + account.getJid().toBareJid() + ".png");
}
public static Bitmap createAztecBitmap(String input, int size) {
diff --git a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java
index 008c563b..e14f559e 100644
--- a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java
@@ -763,7 +763,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
private void shareBarcode() {
Intent intent = new Intent(Intent.ACTION_SEND);
- intent.putExtra(Intent.EXTRA_STREAM,BarcodeProvider.getUriForAccount(mAccount));
+ intent.putExtra(Intent.EXTRA_STREAM,BarcodeProvider.getUriForAccount(this,mAccount));
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
intent.setType("image/png");
startActivity(Intent.createChooser(intent, getText(R.string.share_with)));
diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java
index 5418b344..2de80895 100644
--- a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java
+++ b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java
@@ -711,7 +711,7 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
Uri uri;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
try {
- uri = FileProvider.getUriForFile(activity, FileBackend.CONVERSATIONS_FILE_PROVIDER, file);
+ uri = FileBackend.getUriForFile(activity, file);
} catch (IllegalArgumentException e) {
Toast.makeText(activity,activity.getString(R.string.no_permission_to_access_x,file.getAbsolutePath()), Toast.LENGTH_SHORT).show();
return;