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

Commit 595159cc authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Allow creation of EmergencyNumberTracker when CALLING or MESSAGING is enabled" into main

parents b6f88edb b58bf9cd
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
@@ -1966,6 +1966,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);
    }
}