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

Commit 71be9d22 authored by Susheel nyamala's avatar Susheel nyamala Committed by Linux Build Service Account
Browse files

Add support for data+Mms

1. Add makePhoneSwitcher method to create PhoneSwitcher object.
2. Modify visibility of member variables required for this feature.

Change-Id: I0ad5d73573be9485510b9f4be6fa0b9a5d3a5f8d
CRs-Fixed: 1048079
parent 24431f66
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -81,8 +81,11 @@ public class PhoneFactory {

    static private final HashMap<String, LocalLog>sLocalLogs = new HashMap<String, LocalLog>();

    //property to get max data run time
    private static final String OVERRIDE_MODEM_DUAL_DATA_CAP_PROP = "persist.radio.msim.data.cap";
    // TODO - make this a dynamic property read from the modem
    public static final int MAX_ACTIVE_PHONES = 1;
    public static final int MAX_ACTIVE_PHONES = SystemProperties.getInt(
            OVERRIDE_MODEM_DUAL_DATA_CAP_PROP, 1);

    //***** Class Methods

@@ -217,7 +220,8 @@ public class PhoneFactory {

                sSubscriptionMonitor = new SubscriptionMonitor(tr, sContext, sc, numPhones);

                sPhoneSwitcher = new PhoneSwitcher(MAX_ACTIVE_PHONES, numPhones,
                sPhoneSwitcher = telephonyComponentFactory.
                        makePhoneSwitcher (MAX_ACTIVE_PHONES, numPhones,
                        sContext, sc, Looper.myLooper(), tr, sCommandsInterfaces,
                        sPhones);

+19 −17
Original line number Diff line number Diff line
@@ -64,25 +64,27 @@ public class PhoneSwitcher extends Handler {
    private final static boolean VDBG = false;

    private final int mMaxActivePhones;
    private final List<DcRequest> mPrioritizedDcRequests = new ArrayList<DcRequest>();
    private final RegistrantList[] mActivePhoneRegistrants;
    private final SubscriptionController mSubscriptionController;
    protected final List<DcRequest> mPrioritizedDcRequests = new ArrayList<DcRequest>();
    protected final RegistrantList[] mActivePhoneRegistrants;
    protected final SubscriptionController mSubscriptionController;
    private final int[] mPhoneSubscriptions;
    private final CommandsInterface[] mCommandsInterfaces;
    private final Context mContext;
    private final PhoneState[] mPhoneStates;
    private final int mNumPhones;
    protected final CommandsInterface[] mCommandsInterfaces;
    protected final Context mContext;
    protected final PhoneState[] mPhoneStates;
    protected final int mNumPhones;
    private final Phone[] mPhones;
    private final LocalLog mLocalLog;

    private int mDefaultDataSubscription;
    protected int mDefaultDataSubscription;

    private final static int EVENT_DEFAULT_SUBSCRIPTION_CHANGED = 101;
    protected final static int EVENT_DEFAULT_SUBSCRIPTION_CHANGED = 101;
    private final static int EVENT_SUBSCRIPTION_CHANGED         = 102;
    private final static int EVENT_REQUEST_NETWORK              = 103;
    protected final static int EVENT_REQUEST_NETWORK              = 103;
    private final static int EVENT_RELEASE_NETWORK              = 104;
    private final static int EVENT_EMERGENCY_TOGGLE             = 105;
    private final static int EVENT_RESEND_DATA_ALLOWED          = 106;
    protected final static int EVENT_ALLOW_DATA_RESPONSE        = 107;
    protected final static int EVENT_VOICE_CALL_ENDED           = 108;

    private final static int MAX_LOCAL_LOG_LINES = 30;

@@ -257,7 +259,7 @@ public class PhoneSwitcher extends Handler {
    }

    private static final boolean REQUESTS_CHANGED   = true;
    private static final boolean REQUESTS_UNCHANGED = false;
    protected static final boolean REQUESTS_UNCHANGED = false;
    /**
     * Re-evaluate things.
     * Do nothing if nothing's changed.
@@ -267,7 +269,7 @@ public class PhoneSwitcher extends Handler {
     * phones that aren't in the active phone list.  Finally, activate all
     * phones in the active phone list.
     */
    private void onEvaluate(boolean requestsChanged, String reason) {
    protected void onEvaluate(boolean requestsChanged, String reason) {
        StringBuilder sb = new StringBuilder(reason);
        if (isEmergency()) {
            log("onEvalute aborted due to Emergency");
@@ -328,7 +330,7 @@ public class PhoneSwitcher extends Handler {
        }
    }

    private static class PhoneState {
    protected static class PhoneState {
        public volatile boolean active = false;
        public long lastRequested = 0;
    }
@@ -343,7 +345,7 @@ public class PhoneSwitcher extends Handler {
        mActivePhoneRegistrants[phoneId].notifyRegistrants();
    }

    private void activate(int phoneId) {
    protected void activate(int phoneId) {
        PhoneState state = mPhoneStates[phoneId];
        if (state.active == true) return;
        state.active = true;
@@ -362,12 +364,12 @@ public class PhoneSwitcher extends Handler {
        msg.sendToTarget();
    }

    private void onResendDataAllowed(Message msg) {
    protected void onResendDataAllowed(Message msg) {
        final int phoneId = msg.arg1;
        mCommandsInterfaces[phoneId].setDataAllowed(mPhoneStates[phoneId].active, null);
    }

    private int phoneIdForRequest(NetworkRequest netRequest) {
    protected int phoneIdForRequest(NetworkRequest netRequest) {
        String specifier = netRequest.networkCapabilities.getNetworkSpecifier();
        int subId;

@@ -411,7 +413,7 @@ public class PhoneSwitcher extends Handler {
        }
    }

    private void log(String l) {
    protected void log(String l) {
        Rlog.d(LOG_TAG, l);
        mLocalLog.log(l);
    }
+10 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.content.Context;
import android.database.Cursor;
import android.os.Handler;
import android.os.IDeviceIdleController;
import android.os.Looper;
import android.os.PowerManager;
import android.os.ServiceManager;
import android.telephony.Rlog;
@@ -221,4 +222,13 @@ public class TelephonyComponentFactory {
            Phone[] phones, CommandsInterface[] commandsInterfaces) {
        Rlog.d(LOG_TAG, "makeExtTelephonyClasses");
    }

    public PhoneSwitcher makePhoneSwitcher(int maxActivePhones, int numPhones, Context context,
            SubscriptionController subscriptionController, Looper looper, ITelephonyRegistry tr,
            CommandsInterface[] cis, Phone[] phones) {
        Rlog.d(LOG_TAG, "makePhoneSwitcher");
        return new PhoneSwitcher(maxActivePhones,numPhones,
                context, subscriptionController, looper, tr, cis,
                phones);
    }
}