11diff --git a/node_modules/react-native-callkeep/android/src/main/java/io/wazo/callkeep/RNCallKeepModule.java b/node_modules/react-native-callkeep/android/src/main/java/io/wazo/callkeep/RNCallKeepModule.java
2- index 025480a..70a1305 100644
2+ index 025480a..6a66858 100644
33--- a/node_modules/react-native-callkeep/android/src/main/java/io/wazo/callkeep/RNCallKeepModule.java
44+++ b/node_modules/react-native-callkeep/android/src/main/java/io/wazo/callkeep/RNCallKeepModule.java
5+ @@ -221,7 +221,7 @@ public class RNCallKeepModule extends ReactContextBaseJavaModule implements Life
6+ ComponentName cName = new ComponentName(context, VoiceConnectionService.class);
7+ String appName = this.getApplicationName(context);
8+
9+ - handle = new PhoneAccountHandle(cName, appName);
10+ + handle = new PhoneAccountHandle(cName, context.getPackageName());
11+ telecomManager = (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE);
12+ }
13+
514@@ -434,11 +434,6 @@ public class RNCallKeepModule extends ReactContextBaseJavaModule implements Life
615 this.hasListeners = false;
716 }
@@ -26,11 +35,65 @@ index 025480a..70a1305 100644
2635 @ReactMethod
2736 public void startCall(String uuid, String number, String callerName, boolean hasVideo) {
2837 this.startCall(uuid, number, callerName, hasVideo, null);
38+ @@ -1196,9 +1186,14 @@ public class RNCallKeepModule extends ReactContextBaseJavaModule implements Life
39+ return true;
40+ }
41+
42+ - return isConnectionServiceAvailable() && telecomManager != null &&
43+ - hasPermissions() && telecomManager.getPhoneAccount(handle) != null &&
44+ - telecomManager.getPhoneAccount(handle).isEnabled();
45+ + try {
46+ + return isConnectionServiceAvailable() && telecomManager != null &&
47+ + hasPermissions() && telecomManager.getPhoneAccount(handle) != null &&
48+ + telecomManager.getPhoneAccount(handle).isEnabled();
49+ + } catch (SecurityException e) {
50+ + Log.w(TAG, "[RNCallKeepModule] hasPhoneAccount: SecurityException querying phone account", e);
51+ + return false;
52+ + }
53+ }
54+
55+ protected void registerReceiver() {
56+ diff --git a/node_modules/react-native-callkeep/android/src/main/java/io/wazo/callkeep/VoiceConnectionService.java b/node_modules/react-native-callkeep/android/src/main/java/io/wazo/callkeep/VoiceConnectionService.java
57+ index 5d58692..f4e4b1b 100644
58+ --- a/node_modules/react-native-callkeep/android/src/main/java/io/wazo/callkeep/VoiceConnectionService.java
59+ +++ b/node_modules/react-native-callkeep/android/src/main/java/io/wazo/callkeep/VoiceConnectionService.java
60+ @@ -317,7 +317,7 @@ public class VoiceConnectionService extends ConnectionService {
61+ notificationBuilder.setOngoing(true)
62+ .setContentTitle(foregroundSettings.getString("notificationTitle"))
63+ .setPriority(NotificationManager.IMPORTANCE_MIN)
64+ .setCategory(Notification.CATEGORY_SERVICE);
65+
66+ - Activity currentActivity = RNCallKeepModule.instance.getCurrentReactActivity();
67+ + Activity currentActivity = RNCallKeepModule.instance != null ? RNCallKeepModule.instance.getCurrentReactActivity() : null;
68+ if (currentActivity != null) {
69+ @@ -459,18 +459,10 @@ public class VoiceConnectionService extends ConnectionService {
70+ connection.setConnectionCapabilities(Connection.CAPABILITY_MUTE | Connection.CAPABILITY_SUPPORT_HOLD);
71+
72+ if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
73+ - Context context = getApplicationContext();
74+ - TelecomManager telecomManager = (TelecomManager) context.getSystemService(context.TELECOM_SERVICE);
75+ - PhoneAccount phoneAccount = telecomManager.getPhoneAccount(request.getAccountHandle());
76+ -
77+ - //If the phone account is self managed, then this connection must also be self managed.
78+ - if((phoneAccount.getCapabilities() & PhoneAccount.CAPABILITY_SELF_MANAGED) == PhoneAccount.CAPABILITY_SELF_MANAGED) {
79+ - Log.d(TAG, "[VoiceConnectionService] PhoneAccount is SELF_MANAGED, so connection will be too");
80+ - connection.setConnectionProperties(Connection.PROPERTY_SELF_MANAGED);
81+ - }
82+ - else {
83+ - Log.d(TAG, "[VoiceConnectionService] PhoneAccount is not SELF_MANAGED, so connection won't be either");
84+ - }
85+ + // This app always registers its PhoneAccount with CAPABILITY_SELF_MANAGED.
86+ + // Skip telecomManager.getPhoneAccount(...) which requires READ_PHONE_NUMBERS on
87+ + // Android 11+ and isn't grantable from an FCM background context.
88+ + connection.setConnectionProperties(Connection.PROPERTY_SELF_MANAGED);
89+ }
90+
91+ connection.setInitializing();
2992diff --git a/node_modules/react-native-callkeep/ios/RNCallKeep/RNCallKeep.m b/node_modules/react-native-callkeep/ios/RNCallKeep/RNCallKeep.m
3093index 786045f..a989d58 100644
3194--- a/node_modules/react-native-callkeep/ios/RNCallKeep/RNCallKeep.m
3295+++ b/node_modules/react-native-callkeep/ios/RNCallKeep/RNCallKeep.m
33- @@ -171,6 +171,8 @@ - (void)sendEventWithNameWrapper:(NSString *)name body:(id)body {
96+ @@ -171,6 +171,8 @@ RCT_EXPORT_MODULE()
3497 body, @"data",
3598 nil
3699 ];
0 commit comments