Set package name before starting call assistant activity
Setting package name is necessary to make sure the correct
app is launched.
Bug: 18294259
Change-Id: I2b2684e81f5be6e72cb13ae44bc095352f4f7c8a
diff --git a/src/com/android/phone/settings/PhoneAccountSettingsFragment.java b/src/com/android/phone/settings/PhoneAccountSettingsFragment.java
index 6f436fd..3c501a7 100644
--- a/src/com/android/phone/settings/PhoneAccountSettingsFragment.java
+++ b/src/com/android/phone/settings/PhoneAccountSettingsFragment.java
@@ -31,10 +31,6 @@
Preference.OnPreferenceClickListener,
AccountSelectionPreference.AccountSelectionListener {
- private static final Intent CONNECTION_SERVICE_CONFIGURE_INTENT =
- new Intent(TelecomManager.ACTION_CONNECTION_SERVICE_CONFIGURE)
- .addCategory(Intent.CATEGORY_DEFAULT);
-
private static final String ACCOUNTS_LIST_CATEGORY_KEY =
"phone_accounts_accounts_list_category_key";
@@ -184,10 +180,20 @@
@Override
public boolean onPreferenceClick(Preference pref) {
if (pref == mConfigureCallAssistant) {
- try {
- startActivity(CONNECTION_SERVICE_CONFIGURE_INTENT);
- } catch (ActivityNotFoundException e) {
- Log.d(LOG_TAG, "Could not resolve telecom connection service configure intent.");
+ String packageName = null;
+ PhoneAccountHandle handle = mTelecomManager.getSimCallManager();
+ if (handle != null) {
+ packageName = handle.getComponentName().getPackageName();
+ }
+ if (packageName != null) {
+ Intent intent = new Intent(TelecomManager.ACTION_CONNECTION_SERVICE_CONFIGURE)
+ .addCategory(Intent.CATEGORY_DEFAULT)
+ .setPackage(packageName);
+ try {
+ startActivity(intent);
+ } catch (ActivityNotFoundException e) {
+ Log.d(LOG_TAG, "Could not resolve call assistant configure intent: " + intent);
+ }
}
return true;
}