Catch ActivityNotFoundException by trying new name
Amolith
created 3 weeks ago
Seems com.android.server.telecom.settings.EnableAccountPreferenceActivity was
named com.android.server.telecomui.settings.EnableAccountPreferenceActivity in
Android 17 beta: https://issuetracker.google.com/issues/476293144
Add logging around the onboarding dialler-integration flow so we can see which
system activity branch runs and what ACTION_CHANGE_PHONE_ACCOUNTS resolves to
on-device.
Change summary
src/cheogram/java/eu/siacs/conversations/ui/ManageAccountActivity.java | 9
src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java | 25
2 files changed, 31 insertions(+), 3 deletions(-)
Detailed changes
@@ -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;
@@ -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;