use dynamic applicationId for the providers, not more conflicts with signal, closes #75

This commit is contained in:
B. Petersen
2018-10-02 20:51:29 +02:00
parent 138144b938
commit 7d85e2c3e8
4 changed files with 13 additions and 16 deletions
+3 -11
View File
@@ -5,10 +5,6 @@
<uses-sdk tools:overrideLibrary="com.amulyakhare.textdrawable,com.astuetz.pagerslidingtabstrip,pl.tajchert.waitingdots,com.h6ah4i.android.multiselectlistpreferencecompat,android.support.v13,com.davemorrissey.labs.subscaleview,com.tomergoldst.tooltips,com.klinker.android.send_message,com.takisoft.colorpicker,android.support.v14.preference"/>
<permission android:name="org.thoughtcrime.securesms.ACCESS_SECRETS"
android:label="Access to TextSecure Secrets"
android:protectionLevel="signature" />
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-feature android:name="android.hardware.bluetooth" android:required="false" />
<uses-feature android:name="android.hardware.location" android:required="false"/>
@@ -88,10 +84,6 @@
<uses-permission android:name="android.permission.RAISED_THREAD_PRIORITY" />
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/>
<permission android:name="org.thoughtcrime.securesms.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="org.thoughtcrime.securesms.permission.C2D_MESSAGE" />
<application android:name=".ApplicationContext"
android:icon="@mipmap/ic_launcher_dev"
android:label="@string/app_name"
@@ -466,15 +458,15 @@
<provider android:name=".providers.PartProvider"
android:grantUriPermissions="true"
android:exported="false"
android:authorities="org.thoughtcrime.provider.securesms" />
android:authorities="{$applicationId}.provider.securesms" />
<provider android:name=".providers.MmsBodyProvider"
android:grantUriPermissions="true"
android:exported="false"
android:authorities="org.thoughtcrime.provider.securesms.mms" />
android:authorities="{$applicationId}.provider.securesms.mms" />
<provider android:name="android.support.v4.content.FileProvider"
android:authorities="org.thoughtcrime.securesms.fileprovider"
android:authorities="{$applicationId}.securesms.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
@@ -26,6 +26,8 @@ import android.net.Uri;
import android.os.ParcelFileDescriptor;
import android.util.Log;
import org.thoughtcrime.securesms.BuildConfig;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.InputStream;
@@ -33,7 +35,7 @@ import java.io.OutputStream;
public class MmsBodyProvider extends ContentProvider {
private static final String TAG = MmsBodyProvider.class.getSimpleName();
private static final String CONTENT_URI_STRING = "content://org.thoughtcrime.provider.securesms.mms/mms";
private static final String CONTENT_URI_STRING = "content://"+ BuildConfig.APPLICATION_ID+".provider.securesms.mms/mms";
public static final Uri CONTENT_URI = Uri.parse(CONTENT_URI_STRING);
private static final int SINGLE_ROW = 1;
@@ -41,7 +43,7 @@ public class MmsBodyProvider extends ContentProvider {
static {
uriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
uriMatcher.addURI("org.thoughtcrime.provider.securesms.mms", "mms/#", SINGLE_ROW);
uriMatcher.addURI(BuildConfig.APPLICATION_ID+".provider.securesms.mms", "mms/#", SINGLE_ROW);
}
@Override
@@ -29,6 +29,7 @@ import android.provider.OpenableColumns;
import android.support.annotation.NonNull;
import android.util.Log;
import org.thoughtcrime.securesms.BuildConfig;
import org.thoughtcrime.securesms.attachments.AttachmentId;
import org.thoughtcrime.securesms.attachments.DatabaseAttachment;
import org.thoughtcrime.securesms.database.DatabaseFactory;
@@ -46,7 +47,7 @@ public class PartProvider extends ContentProvider {
private static final String TAG = PartProvider.class.getSimpleName();
private static final String CONTENT_URI_STRING = "content://org.thoughtcrime.provider.securesms/part";
private static final String CONTENT_URI_STRING = "content://"+BuildConfig.APPLICATION_ID+".provider.securesms/part";
private static final Uri CONTENT_URI = Uri.parse(CONTENT_URI_STRING);
private static final int SINGLE_ROW = 1;
@@ -54,7 +55,7 @@ public class PartProvider extends ContentProvider {
static {
uriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
uriMatcher.addURI("org.thoughtcrime.provider.securesms", "part/*/#", SINGLE_ROW);
uriMatcher.addURI(BuildConfig.APPLICATION_ID+".provider.securesms", "part/*/#", SINGLE_ROW);
}
@Override
@@ -7,11 +7,13 @@ import android.os.Build;
import android.support.annotation.NonNull;
import android.support.v4.content.FileProvider;
import org.thoughtcrime.securesms.BuildConfig;
import java.io.File;
public class FileProviderUtil {
private static final String AUTHORITY = "org.thoughtcrime.securesms.fileprovider";
private static final String AUTHORITY = BuildConfig.APPLICATION_ID+".securesms.fileprovider";
public static Uri getUriFor(@NonNull Context context, @NonNull File file) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) return FileProvider.getUriForFile(context, AUTHORITY, file);