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

Commit efad8a1c authored by Nathan Harold's avatar Nathan Harold
Browse files

Add FeatureFlags to the Phone Objects

Add the new FeatureFlags reference to the base
phone object and update all the snaking constructors
to support it.

Bug: 302033535
Test: compilation (non-functional change)
Change-Id: I39c9531d3c5e54cbfceecfc74be259bf5cd1d6fb
parent d94ec18b
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -321,7 +321,8 @@ public class GsmCdmaPhone extends Phone {
            TelephonyComponentFactory telephonyComponentFactory,
            ImsManagerFactory imsManagerFactory, @NonNull FeatureFlags featureFlags) {
        super(precisePhoneType == PhoneConstants.PHONE_TYPE_GSM ? "GSM" : "CDMA",
                notifier, context, ci, unitTestMode, phoneId, telephonyComponentFactory);
                notifier, context, ci, unitTestMode, phoneId, telephonyComponentFactory,
                featureFlags);

        // phone type needs to be set before other initialization as other objects rely on it
        mPrecisePhoneType = precisePhoneType;
+14 −3
Original line number Diff line number Diff line
@@ -93,6 +93,7 @@ import com.android.internal.telephony.domainselection.DomainSelectionResolver;
import com.android.internal.telephony.emergency.EmergencyConstants;
import com.android.internal.telephony.emergency.EmergencyNumberTracker;
import com.android.internal.telephony.emergency.EmergencyStateTracker;
import com.android.internal.telephony.flags.FeatureFlags;
import com.android.internal.telephony.imsphone.ImsCallInfo;
import com.android.internal.telephony.imsphone.ImsPhone;
import com.android.internal.telephony.imsphone.ImsPhoneCall;
@@ -283,6 +284,8 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
            "pref_null_cipher_and_integrity_enabled";
    private final TelephonyAdminReceiver m2gAdminUpdater;

    protected final FeatureFlags mFeatureFlags;

    /**
     * This method is invoked when the Phone exits Emergency Callback Mode.
     */
@@ -548,22 +551,25 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
    /**
     * Constructs a Phone in normal (non-unit test) mode.
     *
     * @param name a name for this phone object
     * @param notifier An instance of DefaultPhoneNotifier,
     * @param context Context object from hosting application
     * unless unit testing.
     * @param ci is CommandsInterface
     * @param unitTestMode when true, prevents notifications
     * of state change events
     * @param featureFlags an instance of the FeatureFlags set
     */
    protected Phone(String name, PhoneNotifier notifier, Context context, CommandsInterface ci,
                    boolean unitTestMode) {
                    boolean unitTestMode, FeatureFlags featureFlags) {
        this(name, notifier, context, ci, unitTestMode, SubscriptionManager.DEFAULT_PHONE_INDEX,
                TelephonyComponentFactory.getInstance());
                TelephonyComponentFactory.getInstance(), featureFlags);
    }

    /**
     * Constructs a Phone in normal (non-unit test) mode.
     *
     * @param name a name for this phone object
     * @param notifier An instance of DefaultPhoneNotifier,
     * @param context Context object from hosting application
     * unless unit testing.
@@ -571,10 +577,13 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
     * @param unitTestMode when true, prevents notifications
     * of state change events
     * @param phoneId the phone-id of this phone.
     * @param telephonyComponentFactory a factory for injecting telephony components
     * @param featureFlags an instance of the FeatureFlags set
     */
    protected Phone(String name, PhoneNotifier notifier, Context context, CommandsInterface ci,
                    boolean unitTestMode, int phoneId,
                    TelephonyComponentFactory telephonyComponentFactory) {
                    TelephonyComponentFactory telephonyComponentFactory,
                    FeatureFlags featureFlags) {
        mPhoneId = phoneId;
        mName = name;
        mNotifier = notifier;
@@ -587,6 +596,8 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
                .makeAppSmsManager(context);
        mLocalLog = new LocalLog(64);

        mFeatureFlags = featureFlags;

        setUnitTestMode(unitTestMode);

        SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
+1 −1
Original line number Diff line number Diff line
@@ -455,7 +455,7 @@ public class PhoneFactory {
     * @return the {@code ImsPhone} object or null if the exception occured
     */
    public static Phone makeImsPhone(PhoneNotifier phoneNotifier, Phone defaultPhone) {
        return ImsPhoneFactory.makePhone(sContext, phoneNotifier, defaultPhone);
        return ImsPhoneFactory.makePhone(sContext, phoneNotifier, defaultPhone, sFeatureFlags);
    }

    /**
+6 −4
Original line number Diff line number Diff line
@@ -120,6 +120,7 @@ import com.android.internal.telephony.TelephonyIntents;
import com.android.internal.telephony.domainselection.DomainSelectionResolver;
import com.android.internal.telephony.emergency.EmergencyNumberTracker;
import com.android.internal.telephony.emergency.EmergencyStateTracker;
import com.android.internal.telephony.flags.FeatureFlags;
import com.android.internal.telephony.gsm.SuppServiceNotification;
import com.android.internal.telephony.metrics.ImsStats;
import com.android.internal.telephony.metrics.TelephonyMetrics;
@@ -454,14 +455,15 @@ public class ImsPhone extends ImsPhoneBase {
    }

    // Constructors
    public ImsPhone(Context context, PhoneNotifier notifier, Phone defaultPhone) {
        this(context, notifier, defaultPhone, ImsManager::getInstance, false);
    public ImsPhone(Context context, PhoneNotifier notifier,
            Phone defaultPhone, FeatureFlags featureFlags) {
        this(context, notifier, defaultPhone, ImsManager::getInstance, false, featureFlags);
    }

    @VisibleForTesting
    public ImsPhone(Context context, PhoneNotifier notifier, Phone defaultPhone,
            ImsManagerFactory imsManagerFactory, boolean unitTestMode) {
        super("ImsPhone", context, notifier, unitTestMode);
            ImsManagerFactory imsManagerFactory, boolean unitTestMode, FeatureFlags featureFlags) {
        super("ImsPhone", context, notifier, unitTestMode, featureFlags);

        mDefaultPhone = defaultPhone;
        mImsManagerFactory = imsManagerFactory;
+4 −2
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ import com.android.internal.telephony.OperatorInfo;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.PhoneNotifier;
import com.android.internal.telephony.flags.FeatureFlags;
import com.android.internal.telephony.uicc.IccFileHandler;
import com.android.telephony.Rlog;

@@ -58,8 +59,9 @@ abstract class ImsPhoneBase extends Phone {
    private PhoneConstants.State mState = PhoneConstants.State.IDLE;

    public ImsPhoneBase(String name, Context context, PhoneNotifier notifier,
                        boolean unitTestMode) {
        super(name, notifier, context, new ImsPhoneCommandInterface(context), unitTestMode);
                        boolean unitTestMode, FeatureFlags featureFlags) {
        super(name, notifier, context, new ImsPhoneCommandInterface(context), unitTestMode,
                featureFlags);
    }

    @Override
Loading