From 9afbdaa2be66c61e5672fc1dcf543a25b130c760 Mon Sep 17 00:00:00 2001 From: Moxie Marlinspike Date: Tue, 31 Jan 2017 21:46:20 -0800 Subject: [PATCH] Don't let failed capability retrieval erroneously disable SMS Fixes #6135 // FREEBIE --- .../securesms/ConversationActivity.java | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/org/thoughtcrime/securesms/ConversationActivity.java b/src/org/thoughtcrime/securesms/ConversationActivity.java index 398c0c0e9b..e04036710a 100644 --- a/src/org/thoughtcrime/securesms/ConversationActivity.java +++ b/src/org/thoughtcrime/securesms/ConversationActivity.java @@ -55,7 +55,6 @@ import android.view.View; import android.view.View.OnClickListener; import android.view.View.OnFocusChangeListener; import android.view.View.OnKeyListener; -import android.view.ViewStub; import android.view.inputmethod.EditorInfo; import android.widget.Button; import android.widget.ImageButton; @@ -902,25 +901,24 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity new AsyncTask() { @Override protected boolean[] doInBackground(Recipients... params) { - try { - Context context = ConversationActivity.this; - Recipients recipients = params[0]; - UserCapabilities capabilities = DirectoryHelper.getUserCapabilities(context, recipients); + Context context = ConversationActivity.this; + Recipients recipients = params[0]; + UserCapabilities capabilities = DirectoryHelper.getUserCapabilities(context, recipients); - if (capabilities.getTextCapability() == Capability.UNKNOWN || - capabilities.getVoiceCapability() == Capability.UNKNOWN) - { + if (capabilities.getTextCapability() == Capability.UNKNOWN || + capabilities.getVoiceCapability() == Capability.UNKNOWN) + { + try { capabilities = DirectoryHelper.refreshDirectoryFor(context, masterSecret, recipients, TextSecurePreferences.getLocalNumber(context)); + } catch (IOException e) { + Log.w(TAG, e); } - - return new boolean[] {capabilities.getTextCapability() == Capability.SUPPORTED, - capabilities.getVoiceCapability() == Capability.SUPPORTED && !isSelfConversation(), - Util.isDefaultSmsProvider(context)}; - } catch (IOException e) { - Log.w(TAG, e); - return new boolean[]{false, false, false}; } + + return new boolean[] {capabilities.getTextCapability() == Capability.SUPPORTED, + capabilities.getVoiceCapability() == Capability.SUPPORTED && !isSelfConversation(), + Util.isDefaultSmsProvider(context)}; } @Override