Fix crash on Android < 23 where there is not dialler stuff
This commit is contained in:
parent
5e8a492044
commit
ed216fe0d9
|
@ -3,6 +3,7 @@ package eu.siacs.conversations.ui;
|
|||
import android.content.ActivityNotFoundException;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.security.KeyChain;
|
||||
import android.security.KeyChainAliasCallback;
|
||||
|
@ -86,6 +87,8 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda
|
|||
startActivity(new Intent(android.telecom.TelecomManager.ACTION_CHANGE_PHONE_ACCOUNTS));
|
||||
});
|
||||
|
||||
if (Build.VERSION.SDK_INT < 23) return;
|
||||
|
||||
outer:
|
||||
for (Account account : xmppConnectionService.getAccounts()) {
|
||||
for (Contact contact : account.getRoster().getContacts()) {
|
||||
|
|
|
@ -6,6 +6,7 @@ import android.content.Context;
|
|||
import android.database.Cursor;
|
||||
import android.graphics.drawable.Icon;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.telecom.PhoneAccount;
|
||||
import android.telecom.PhoneAccountHandle;
|
||||
|
@ -609,6 +610,8 @@ public class Contact implements ListItem, Blockable {
|
|||
|
||||
// This Contact is a gateway to use for voice calls, register it with OS
|
||||
public void registerAsPhoneAccount(XmppConnectionService ctx) {
|
||||
if (Build.VERSION.SDK_INT < 23) return;
|
||||
|
||||
TelecomManager telecomManager = ctx.getSystemService(TelecomManager.class);
|
||||
|
||||
PhoneAccount phoneAccount = PhoneAccount.builder(
|
||||
|
@ -631,6 +634,8 @@ public class Contact implements ListItem, Blockable {
|
|||
|
||||
// Unregister any associated PSTN gateway integration
|
||||
public void unregisterAsPhoneAccount(Context ctx) {
|
||||
if (Build.VERSION.SDK_INT < 23) return;
|
||||
|
||||
TelecomManager telecomManager = ctx.getSystemService(TelecomManager.class);
|
||||
telecomManager.unregisterPhoneAccount(phoneAccountHandle());
|
||||
}
|
||||
|
|
|
@ -429,6 +429,8 @@ public class NotificationService {
|
|||
}
|
||||
|
||||
private synchronized boolean tryRingingWithDialerUI(final AbstractJingleConnection.Id id, final Set<Media> media) {
|
||||
if (Build.VERSION.SDK_INT < 23) return false;
|
||||
|
||||
if (mXmppConnectionService.checkSelfPermission(Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED) {
|
||||
// We cannot request audio permission in Dialer UI
|
||||
// when Dialer is shown over keyguard, the user cannot even necessarily
|
||||
|
|
Loading…
Reference in New Issue