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

Commit 3a04cdcc authored by Jack Yu's avatar Jack Yu
Browse files

Added transport type to the reconnect intent

For IWLAN refactoring, there will be multiple DcTrackers.
So we'll need to make sure the right DcTracker receives
the data reconnect intent.

Test: Unit tests
Bug: 73659459
Change-Id: Ief1508d648693e4ed68f1bbf071a6641d108088e
parent 5053c343
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -156,6 +156,8 @@ public class DcTracker extends Handler {
    private static final String INTENT_RECONNECT_ALARM_EXTRA_TYPE = "reconnect_alarm_extra_type";
    private static final String INTENT_RECONNECT_ALARM_EXTRA_REASON =
            "reconnect_alarm_extra_reason";
    private static final String INTENT_RECONNECT_ALARM_EXTRA_TRANSPORT_TYPE =
            "reconnect_alarm_extra_transport_type";

    private static final String INTENT_DATA_STALL_ALARM =
            "com.android.internal.telephony.data-stall";
@@ -239,7 +241,6 @@ public class DcTracker extends Handler {
                startNetStatPoll();
                restartDataStallAlarm();
            } else if (action.startsWith(INTENT_RECONNECT_ALARM)) {
                if (DBG) log("Reconnect alarm. Previous state was " + mState);
                onActionIntentReconnectAlarm(intent);
            } else if (action.equals(INTENT_DATA_STALL_ALARM)) {
                if (DBG) log("Data stall alarm");
@@ -388,12 +389,15 @@ public class DcTracker extends Handler {
        int phoneSubId = mPhone.getSubId();
        int currSubId = bundle.getInt(PhoneConstants.SUBSCRIPTION_KEY,
                SubscriptionManager.INVALID_SUBSCRIPTION_ID);
        log("onDataReconnect: currSubId = " + currSubId + " phoneSubId=" + phoneSubId);

        // Stop reconnect if not current subId is not correct.
        // FIXME STOPSHIP - phoneSubId is coming up as -1 way after boot and failing this?
        if (!SubscriptionManager.isValidSubscriptionId(currSubId) || (currSubId != phoneSubId)) {
            log("receive ReconnectAlarm but subId incorrect, ignore");
            return;
        }

        int transportType = bundle.getInt(INTENT_RECONNECT_ALARM_EXTRA_TRANSPORT_TYPE, 0);
        if (transportType != mTransportType) {
            return;
        }

@@ -2167,6 +2171,7 @@ public class DcTracker extends Handler {
        Intent intent = new Intent(INTENT_RECONNECT_ALARM + "." + apnType);
        intent.putExtra(INTENT_RECONNECT_ALARM_EXTRA_REASON, apnContext.getReason());
        intent.putExtra(INTENT_RECONNECT_ALARM_EXTRA_TYPE, apnType);
        intent.putExtra(INTENT_RECONNECT_ALARM_EXTRA_TRANSPORT_TYPE, mTransportType);
        intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);

        // Get current sub id.
+2 −0
Original line number Diff line number Diff line
@@ -714,6 +714,7 @@ public class DcTrackerTest extends TelephonyTest {
        // Simulate the timer expires.
        Intent intent = new Intent("com.android.internal.telephony.data-reconnect.default");
        intent.putExtra("reconnect_alarm_extra_type", PhoneConstants.APN_TYPE_DEFAULT);
        intent.putExtra("reconnect_alarm_extra_transport_type", TransportType.WWAN);
        intent.putExtra(PhoneConstants.SUBSCRIPTION_KEY, 0);
        intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
        mContext.sendBroadcast(intent);
@@ -1310,6 +1311,7 @@ public class DcTrackerTest extends TelephonyTest {
        Intent intent = new Intent("com.android.internal.telephony.data-reconnect.default");
        intent.putExtra("reconnect_alarm_extra_type", PhoneConstants.APN_TYPE_DEFAULT);
        intent.putExtra(PhoneConstants.SUBSCRIPTION_KEY, 0);
        intent.putExtra("reconnect_alarm_extra_transport_type", TransportType.WWAN);
        intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
        mContext.sendBroadcast(intent);
        waitForMs(200);