diff --git a/src/cheogram/java/eu/siacs/conversations/ui/ManageAccountActivity.java b/src/cheogram/java/eu/siacs/conversations/ui/ManageAccountActivity.java index de54b67aaf34f51851c26332357387bf261fb65f..8f73f370f933533f1355fba895dd51a210e6f50c 100644 --- a/src/cheogram/java/eu/siacs/conversations/ui/ManageAccountActivity.java +++ b/src/cheogram/java/eu/siacs/conversations/ui/ManageAccountActivity.java @@ -307,7 +307,14 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda try { startActivity(mMicIntent); } catch (final android.content.ActivityNotFoundException e) { - Toast.makeText(this, "Your OS has blocked dialler integration", Toast.LENGTH_SHORT).show(); + try { + final Intent fallback = new Intent(); + fallback.setComponent(new ComponentName("com.google.android.telecomui", + "com.android.server.telecomui.settings.EnableAccountPreferenceActivity")); + startActivity(fallback); + } catch (final android.content.ActivityNotFoundException e2) { + Toast.makeText(this, "Your OS has blocked dialler integration", Toast.LENGTH_SHORT).show(); + } } mMicIntent = null; return; diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java index e44e701151175e954a517c599707038cb46294d6..0d40a1e607bb25077c18331f49a09b3e3aa74be9 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java @@ -1001,10 +1001,21 @@ public class ConversationsActivity extends XmppActivity Intent intent = new Intent(); intent.setComponent(new ComponentName("com.android.server.telecom", "com.android.server.telecom.settings.EnableAccountPreferenceActivity")); + Log.d(Config.LOGTAG, "Dialler integration: launching " + intent.getComponent()); try { startActivityForResult(intent, DIALLER_INTEGRATION); } catch (ActivityNotFoundException e) { - displayToast("Dialler integration not available on your OS"); + Log.w(Config.LOGTAG, "Dialler integration: missing legacy telecom enable-account activity, trying telecomui fallback", e); + intent = new Intent(); + intent.setComponent(new ComponentName("com.google.android.telecomui", + "com.android.server.telecomui.settings.EnableAccountPreferenceActivity")); + Log.d(Config.LOGTAG, "Dialler integration: launching fallback " + intent.getComponent()); + try { + startActivityForResult(intent, DIALLER_INTEGRATION); + } catch (ActivityNotFoundException e2) { + Log.w(Config.LOGTAG, "Dialler integration: telecomui fallback activity not found", e2); + displayToast("Dialler integration not available on your OS"); + } } break; case REQUEST_DOWNLOAD_STICKERS: @@ -1034,8 +1045,18 @@ public class ConversationsActivity extends XmppActivity if (requestCode == DIALLER_INTEGRATION) { mRequestCode = requestCode; try { - startActivity(new Intent(android.telecom.TelecomManager.ACTION_CHANGE_PHONE_ACCOUNTS)); + final Intent phoneAccountsIntent = new Intent(android.telecom.TelecomManager.ACTION_CHANGE_PHONE_ACCOUNTS); + Log.d( + Config.LOGTAG, + "Dialler integration: result=" + + resultCode + + ", launching " + + phoneAccountsIntent.getAction() + + " resolved=" + + phoneAccountsIntent.resolveActivity(getPackageManager())); + startActivity(phoneAccountsIntent); } catch (ActivityNotFoundException e) { + Log.w(Config.LOGTAG, "Dialler integration: ACTION_CHANGE_PHONE_ACCOUNTS not available", e); displayToast("Dialler integration not available on your OS"); } return;