Fix allow background activity start for OpenKeyChain intents
This commit is contained in:
parent
3d3cc32f55
commit
3ecb77d963
2 changed files with 26 additions and 15 deletions
|
@ -628,16 +628,25 @@ public class ConversationFragment extends XmppFragment
|
|||
PendingIntent pendingIntent = conversation.getAccount().getPgpDecryptionService().getPendingIntent();
|
||||
if (pendingIntent != null) {
|
||||
try {
|
||||
getActivity().startIntentSenderForResult(pendingIntent.getIntentSender(),
|
||||
REQUEST_DECRYPT_PGP,
|
||||
null,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
Compatibility.pgpStartIntentSenderOptions());
|
||||
getActivity()
|
||||
.startIntentSenderForResult(
|
||||
pendingIntent.getIntentSender(),
|
||||
REQUEST_DECRYPT_PGP,
|
||||
null,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
Compatibility.pgpStartIntentSenderOptions());
|
||||
} catch (SendIntentException e) {
|
||||
ToastCompat.makeText(getActivity(), R.string.unable_to_connect_to_keychain, ToastCompat.LENGTH_SHORT).show();
|
||||
conversation.getAccount().getPgpDecryptionService().continueDecryption(true);
|
||||
Toast.makeText(
|
||||
getActivity(),
|
||||
R.string.unable_to_connect_to_keychain,
|
||||
Toast.LENGTH_SHORT)
|
||||
.show();
|
||||
conversation
|
||||
.getAccount()
|
||||
.getPgpDecryptionService()
|
||||
.continueDecryption(true);
|
||||
}
|
||||
}
|
||||
updateSnackBar(conversation);
|
||||
|
@ -4501,12 +4510,14 @@ public class ConversationFragment extends XmppFragment
|
|||
return m != null && m.getMergedBody().toString().toLowerCase().contains(q.toLowerCase());
|
||||
}
|
||||
|
||||
private void startPendingIntent(PendingIntent pendingIntent, int requestCode) {
|
||||
try {
|
||||
getActivity().startIntentSenderForResult(pendingIntent.getIntentSender(), requestCode, null, 0, 0, 0);
|
||||
} catch (final SendIntentException ignored) {
|
||||
private void startPendingIntent(PendingIntent pendingIntent, int requestCode) {
|
||||
try {
|
||||
getActivity()
|
||||
.startIntentSenderForResult(
|
||||
pendingIntent.getIntentSender(), requestCode, null, 0, 0, 0, Compatibility.pgpStartIntentSenderOptions());
|
||||
} catch (final SendIntentException ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackendConnected() {
|
||||
|
|
|
@ -1261,7 +1261,7 @@ public abstract class XmppActivity extends ActionBarActivity {
|
|||
0, 0, Compatibility.pgpStartIntentSenderOptions());
|
||||
} catch (final Throwable e) {
|
||||
Log.d(Config.LOGTAG,"could not launch OpenKeyChain", e);
|
||||
ToastCompat.makeText(XmppActivity.this, R.string.openpgp_error, ToastCompat.LENGTH_SHORT).show();
|
||||
Toast.makeText(XmppActivity.this, R.string.openpgp_error, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue