react-native-webrtc / react-native-callkeep

iOS CallKit framework and Android ConnectionService for React Native
ISC License
923 stars 445 forks source link

Fix security error when trying to get phone account #773

Open manuquentin opened 7 months ago

wilmxre commented 6 months ago

hello @manuquentin. i am glad you've got back to this repo and are working on phone account related issues. can you please tell me, why do we bypass checking if the device supports phone accounts, if the app is self managed?:

 private boolean hasPhoneAccount() {
        if (telecomManager == null) {
            this.initializeTelecomManager();
        }

        if (isSelfManaged()) {
            return true;
        }

        return isConnectionServiceAvailable() && telecomManager != null &&
            hasPermissions() && telecomManager.getPhoneAccount(handle) != null &&
            telecomManager.getPhoneAccount(handle).isEnabled();
    }

same goes to this method, we just simply accept that devices after api 23 must support the telecom feature:

public static Boolean isConnectionServiceAvailable() {
        // PhoneAccount is available since api level 23
        return Build.VERSION.SDK_INT >= 23;
    }

from my experience, there are some tablets (i noticed it especially on several Lenovo devices) that do not support the telecom feature and by this they won't support registering the phone account or using the connection service at all.

these devices usually have the config_voice_capable set to false. you can see it in frameworks/base/core/res/res/values/config.xml Ex: <bool name="config_voice_capable">false</bool>

from my understanding, it isn't a great idea to early return in the aforementioned methods, that are used basically in every function in this library.

am i missing something?