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

Commit 74672e8e authored by Wink Saville's avatar Wink Saville
Browse files

Fix setup of retry filters.

There were multiple registered filters for INTENT_RESTART_TRYSETUP_ALARM
this caused a retry not to fire and contributing to not recovering from
a RAT change error in identified by Samsung in post #22 of 8849653.

Bug: 8849653
Change-Id: I9c5cdb740d87a05dd69d72f8bc5596230b75d6f2
parent 24286939
Loading
Loading
Loading
Loading
+21 −19
Original line number Diff line number Diff line
@@ -140,6 +140,14 @@ public final class DcTracker extends DcTrackerBase {

        initApnContextsAndDataConnection();

        for (ApnContext apnContext : mApnContexts.values()) {
            // Register the reconnect and restart actions.
            IntentFilter filter = new IntentFilter();
            filter.addAction(INTENT_RECONNECT_ALARM + '.' + apnContext.getApnType());
            filter.addAction(INTENT_RESTART_TRYSETUP_ALARM + '.' + apnContext.getApnType());
            mPhone.getContext().registerReceiver(mIntentReceiver, filter, null, mPhone);
        }

        ConnectivityManager cm = (ConnectivityManager)p.getContext().getSystemService(
                Context.CONNECTIVITY_SERVICE);
        cm.supplyMessenger(ConnectivityManager.TYPE_MOBILE, new Messenger(this));
@@ -1186,21 +1194,17 @@ public final class DcTracker extends DcTrackerBase {
    }

    private void startAlarmForReconnect(int delay, ApnContext apnContext) {
        DcAsyncChannel dcac = apnContext.getDcAc();

        if (dcac == null) {
            // should not happen, but just in case.
            loge("startAlarmForReconnect: null dcac or dc.");
            return;
        }

        Intent intent = new Intent(INTENT_RECONNECT_ALARM + '.' +
                                   dcac.getDataConnectionIdSync());
        String reason = apnContext.getReason();
        intent.putExtra(INTENT_RECONNECT_ALARM_EXTRA_REASON, reason);
        String apnType = apnContext.getApnType();

        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);

        if (DBG) {
            log("startAlarmForReconnect: delay=" + delay + " action=" + intent.getAction()
                    + " apn=" + apnContext);
        }

        PendingIntent alarmIntent = PendingIntent.getBroadcast (mPhone.getContext(), 0,
                                        intent, PendingIntent.FLAG_UPDATE_CURRENT);
        apnContext.setReconnectIntent(alarmIntent);
@@ -1209,10 +1213,14 @@ public final class DcTracker extends DcTrackerBase {
    }

    private void startAlarmForRestartTrySetup(int delay, ApnContext apnContext) {
        Intent intent = new Intent(INTENT_RESTART_TRYSETUP_ALARM);
        String apnType = apnContext.getApnType();
        Intent intent = new Intent(INTENT_RESTART_TRYSETUP_ALARM + "." + apnType);
        intent.putExtra(INTENT_RESTART_TRYSETUP_ALARM_EXTRA_TYPE, apnType);

        if (DBG) {
            log("startAlarmForRestartTrySetup: delay=" + delay + " action=" + intent.getAction()
                    + " apn=" + apnContext);
        }
        PendingIntent alarmIntent = PendingIntent.getBroadcast (mPhone.getContext(), 0,
                                        intent, PendingIntent.FLAG_UPDATE_CURRENT);
        apnContext.setReconnectIntent(alarmIntent);
@@ -1834,12 +1842,6 @@ public final class DcTracker extends DcTrackerBase {
            loge("createDataConnection: Could not connect to dcac=" + dcac + " status=" + status);
        }

        // install reconnect intent filter for this data connection.
        IntentFilter filter = new IntentFilter();
        filter.addAction(INTENT_RECONNECT_ALARM + '.' + id);
        filter.addAction(INTENT_RESTART_TRYSETUP_ALARM);
        mPhone.getContext().registerReceiver(mIntentReceiver, filter, null, mPhone);

        if (DBG) log("createDataConnection() X id=" + id + " dc=" + conn);
        return dcac;
    }
+5 −1
Original line number Diff line number Diff line
@@ -447,6 +447,11 @@ public abstract class DcTrackerBase extends Handler {
    protected void onActionIntentRestartTrySetupAlarm(Intent intent) {
        String apnType = intent.getStringExtra(INTENT_RESTART_TRYSETUP_ALARM_EXTRA_TYPE);
        ApnContext apnContext = mApnContexts.get(apnType);
        if (DBG) {
            log("onActionIntentRestartTrySetupAlarm: mState=" + mState +
                    " apnType=" + apnType + " apnContext=" + apnContext +
                    " mDataConnectionAsyncChannels=" + mDataConnectionAcHashMap);
        }
        sendMessage(obtainMessage(DctConstants.EVENT_TRY_SETUP_DATA, apnContext));
    }

@@ -473,7 +478,6 @@ public abstract class DcTrackerBase extends Handler {


        IntentFilter filter = new IntentFilter();
        filter.addAction(INTENT_RECONNECT_ALARM);
        filter.addAction(Intent.ACTION_SCREEN_ON);
        filter.addAction(Intent.ACTION_SCREEN_OFF);
        filter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION);