@@ -61,13 +61,22 @@ object TelecomManagerExtension {
6161
6262 fun TelecomManager.openPhoneAccountSettings (activity : Activity ) {
6363 if (Build .MANUFACTURER .equals(" Samsung" , ignoreCase = true )) {
64- val intent = Intent (TelecomManager .ACTION_CHANGE_PHONE_ACCOUNTS )
65- intent.component = ComponentName (
66- " com.android.server.telecom" ,
67- " com.android.server.telecom.settings.EnableAccountPreferenceActivity"
68- )
69- intent.flags = Intent .FLAG_ACTIVITY_NEW_TASK
70- activity.startActivity(intent, null )
64+ try {
65+ val intent = Intent (TelecomManager .ACTION_CHANGE_PHONE_ACCOUNTS )
66+ intent.component = ComponentName (
67+ " com.android.server.telecom" ,
68+ " com.android.server.telecom.settings.EnableAccountPreferenceActivity"
69+ )
70+ intent.flags = Intent .FLAG_ACTIVITY_NEW_TASK
71+ activity.startActivity(intent, null )
72+ } catch (e: Exception ) {
73+ Log .e(" TelecomManager" , " openPhoneAccountSettings: ${e.message} " )
74+
75+ // use fallback method
76+ val intent = Intent (TelecomManager .ACTION_CHANGE_PHONE_ACCOUNTS )
77+ activity.startActivity(intent, null )
78+ }
79+
7180 } else {
7281 val intent = Intent (TelecomManager .ACTION_CHANGE_PHONE_ACCOUNTS )
7382 activity.startActivity(intent, null )
0 commit comments