aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de/pixart/messenger/services/XmppConnectionService.java')
-rw-r--r--src/main/java/de/pixart/messenger/services/XmppConnectionService.java24
1 files changed, 9 insertions, 15 deletions
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
index 132ede7b6..f47893e48 100644
--- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
+++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
@@ -47,12 +47,14 @@ import net.java.otr4j.session.SessionID;
import net.java.otr4j.session.SessionImpl;
import net.java.otr4j.session.SessionStatus;
+import org.conscrypt.Conscrypt;
import org.openintents.openpgp.IOpenPgpService2;
import org.openintents.openpgp.util.OpenPgpApi;
import org.openintents.openpgp.util.OpenPgpServiceConnection;
import java.net.URL;
import java.security.SecureRandom;
+import java.security.Security;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.text.SimpleDateFormat;
@@ -125,7 +127,6 @@ import de.pixart.messenger.utils.ExceptionHelper;
import de.pixart.messenger.utils.MimeUtils;
import de.pixart.messenger.utils.Namespace;
import de.pixart.messenger.utils.OnPhoneContactsLoadedListener;
-import de.pixart.messenger.utils.PRNGFixes;
import de.pixart.messenger.utils.PhoneHelper;
import de.pixart.messenger.utils.QuickLoader;
import de.pixart.messenger.utils.ReplacingSerialSingleThreadExecutor;
@@ -490,11 +491,6 @@ public class XmppConnectionService extends Service {
}
public void attachFileToConversation(final Conversation conversation, final Uri uri, final String type, final UiCallback<Message> callback) {
- if (FileBackend.weOwnFile(this, uri)) {
- Log.d(Config.LOGTAG, "trying to attach file that belonged to us");
- callback.error(R.string.security_error_invalid_file_access, null);
- return;
- }
final Message message;
if (conversation.getNextEncryption() == Message.ENCRYPTION_PGP) {
message = new Message(conversation, "", Message.ENCRYPTION_DECRYPTED);
@@ -512,11 +508,6 @@ public class XmppConnectionService extends Service {
}
public void attachImageToConversation(final Conversation conversation, final Uri uri, final UiCallback<Message> callback) {
- if (FileBackend.weOwnFile(this, uri)) {
- Log.d(Config.LOGTAG, "trying to attach file that belonged to us");
- callback.error(R.string.security_error_invalid_file_access, null);
- return;
- }
final String mimeType = MimeUtils.guessMimeTypeFromUri(this, uri);
final String compressPictures = getCompressPicturesPreference();
@@ -1100,7 +1091,11 @@ public class XmppConnectionService extends Service {
public void onCreate() {
OmemoSetting.load(this);
ExceptionHelper.init(getApplicationContext());
- PRNGFixes.apply();
+ try {
+ Security.insertProviderAt(Conscrypt.newProvider(), 1);
+ } catch (Throwable throwable) {
+ Log.e(Config.LOGTAG, "unable to initialize security provider", throwable);
+ }
Resolver.init(this);
this.mRandom = new SecureRandom();
updateMemorizingTrustmanager();
@@ -1160,7 +1155,7 @@ public class XmppConnectionService extends Service {
}
this.pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
- this.wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "XmppConnectionService");
+ this.wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, Config.LOGTAG + ":Service");
toggleForegroundService();
updateUnreadCountBadge();
toggleScreenEventReceiver();
@@ -1875,8 +1870,7 @@ public class XmppConnectionService extends Service {
public List<Conversation> findAllConferencesWith(Contact contact) {
ArrayList<Conversation> results = new ArrayList<>();
for (final Conversation c : conversations) {
- if (c.getMode() == Conversation.MODE_MULTI
- && (c.getJid().asBareJid().equals(c.getJid().asBareJid()) || c.getMucOptions().isContactInRoom(contact))) {
+ if (c.getMode() == Conversation.MODE_MULTI && c.getMucOptions().isContactInRoom(contact)) {
results.add(c);
}
}