Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b58bf9cd authored by Madhav's avatar Madhav
Browse files

Allow creation of EmergencyNumberTracker when CALLING or MESSAGING is enabled

Messaging relies on EmergencyNumberTracker, which is currently tied to
FEATURE_TELEPHONY_CALLING. This prevents messaging from working on
devices with CALLING disabled but DATA and MESSAGING enabled. To resolve
this, EmergencyNumberTracker should be enabled when either
FEATURE_TELEPHONY_CALLING or FEATURE_TELEPHONY_MESSAGING is enabled.

Bug: 395178686
Flag: EXEMPT bug fix
Test: atest CtsTelephonyTestCases --no-bazel-mode
Change-Id: Ie3988c088adeb945202c066f809ece8deef72599
parent c6f7a968
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -349,7 +349,6 @@ public class GsmCdmaPhone extends Phone {
        super(precisePhoneType == PhoneConstants.PHONE_TYPE_GSM ? "GSM" : "CDMA",
                notifier, context, ci, unitTestMode, phoneId, telephonyComponentFactory,
                featureFlags);

        // phone type needs to be set before other initialization as other objects rely on it
        mPrecisePhoneType = precisePhoneType;
        mVoiceCallSessionStats = new VoiceCallSessionStats(mPhoneId, this, featureFlags);
@@ -370,7 +369,7 @@ public class GsmCdmaPhone extends Phone {
                SignalStrengthController.class.getName()).makeSignalStrengthController(this);
        mSST = mTelephonyComponentFactory.inject(ServiceStateTracker.class.getName())
                .makeServiceStateTracker(this, this.mCi, featureFlags);
        if (hasCalling()) {
        if (hasCalling() || hasMessaging()) {
            mEmergencyNumberTracker = mTelephonyComponentFactory
                    .inject(EmergencyNumberTracker.class.getName()).makeEmergencyNumberTracker(
                            this, this.mCi, mFeatureFlags);
+7 −0
Original line number Diff line number Diff line
@@ -1965,6 +1965,13 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
        return TelephonyCapabilities.supportsTelephonyCalling(mFeatureFlags, mContext);
    }

    /**
     * @return true if this device supports messaging, false otherwise.
     */
    public boolean hasMessaging() {
        return TelephonyCapabilities.supportsTelephonyMessaging(mFeatureFlags, mContext);
    }

    /**
     * Retrieves the EmergencyNumberTracker of the phone instance.
     */
+10 −0
Original line number Diff line number Diff line
@@ -219,4 +219,14 @@ public class TelephonyCapabilities {
        return context.getPackageManager().hasSystemFeature(
                PackageManager.FEATURE_TELEPHONY_CALLING);
    }

    /**
     * @return true if this device supports telephony messaging, false if it does not.
     */
    public static boolean supportsTelephonyMessaging(@NonNull FeatureFlags featureFlags,
            Context context) {
        if (!TelephonyCapabilities.minimalTelephonyCdmCheck(featureFlags)) return true;
        return context.getPackageManager().hasSystemFeature(
                PackageManager.FEATURE_TELEPHONY_MESSAGING);
    }
}