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

Commit 8306e3b3 authored by Susheel Nyamala's avatar Susheel Nyamala Committed by Amit Mahajan
Browse files

Add bug fixes in vendor classes

1. Remove final declaration for VendorDcTracker
2. Update isPhoneInVoiceCall method for VendorPhoneSwitcher
3. Make constructor protected for VendorSubscriptionInfoUpdater

Test: TH
Change-Id: I8790f4f4f2062a5e15d1a1195f3129c07c7a09b4
Bug: 157726600
(cherry picked from commit 58da7215c9246ef335b1deee2503191bc65c7c33)
parent e3801157
Loading
Loading
Loading
Loading
+31 −23
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.internal.telephony.vendor;
import static android.telephony.SubscriptionManager.DEFAULT_SUBSCRIPTION_ID;
import static android.telephony.SubscriptionManager.INVALID_PHONE_INDEX;
import static android.telephony.SubscriptionManager.INVALID_SUBSCRIPTION_ID;
import static android.telephony.TelephonyManager.RADIO_POWER_UNAVAILABLE;

import android.content.BroadcastReceiver;
import android.content.Context;
@@ -42,6 +43,7 @@ import com.android.internal.telephony.CallManager;
import com.android.internal.telephony.Call;
import com.android.internal.telephony.CommandsInterface;
import com.android.internal.telephony.dataconnection.DcRequest;
import com.android.internal.telephony.dataconnection.DataEnabledSettings;
import com.android.internal.telephony.GsmCdmaCall;
import com.android.internal.telephony.imsphone.ImsPhone;
import com.android.internal.telephony.imsphone.ImsPhoneCall;
@@ -257,6 +259,7 @@ public class VendorPhoneSwitcher extends PhoneSwitcher {

        // Check to see if there is any active subscription on any phone
        boolean hasAnyActiveSubscription = false;
        boolean hasSubRefreshedOnThePreferredPhone = false;

        // Check if phoneId to subId mapping is changed.
        for (int i = 0; i < mActiveModemCount; i++) {
@@ -267,6 +270,11 @@ public class VendorPhoneSwitcher extends PhoneSwitcher {
            if (sub != mPhoneSubscriptions[i]) {
                sb.append(" phone[").append(i).append("] ").append(mPhoneSubscriptions[i]);
                sb.append("->").append(sub);
                if (SubscriptionManager.isValidSubscriptionId(mPreferredDataSubId.get())
                        && mPhoneSubscriptions[i] == mPreferredDataSubId.get()) {
                    sb.append("sub refreshed");
                    hasSubRefreshedOnThePreferredPhone = true;
                }
                mPhoneSubscriptions[i] = sub;
                diffDetected = true;
            }
@@ -307,6 +315,9 @@ public class VendorPhoneSwitcher extends PhoneSwitcher {
            }
            mDdsSwitchState = DdsSwitchState.REQUIRED;
            diffDetected = true;
        } else if (hasSubRefreshedOnThePreferredPhone) {
            // Tell connectivity the real active data phone
            notifyPreferredDataSubIdChanged();
        }

        if (diffDetected) {
@@ -405,10 +416,9 @@ public class VendorPhoneSwitcher extends PhoneSwitcher {
        return phoneId;
    }

    private boolean isUiccProvisioned(int phoneId) {
    protected boolean isUiccProvisioned(int phoneId) {
        boolean isUiccApplicationEnabled = true;
        // FIXME get the SubscriptionManager.UICC_APPLICATIONS_ENABLED value and use it here

        log("isUiccProvisioned: status= " + isUiccApplicationEnabled + " phoneid=" + phoneId);
        return mSubscriptionController.isActiveSubId(mPhoneSubscriptions[phoneId]) && isUiccApplicationEnabled; 
    }
@@ -475,27 +485,25 @@ public class VendorPhoneSwitcher extends PhoneSwitcher {
     */
    @Override
    protected boolean isPhoneInVoiceCall(Phone phone) {
        if (!SystemProperties.getBoolean(PROPERTY_TEMP_DDSSWITCH, false)) {
           return false;
        } else {
        if (phone == null) {
            return false;
        }

            int phoneId = phone.getPhoneId();
            return ((mFgCsCalls[phoneId].getState() != Call.State.IDLE &&
                    mFgCsCalls[phoneId].getState() != Call.State.DISCONNECTED) ||
                    (mBgCsCalls[phoneId].getState() != Call.State.IDLE &&
                    mBgCsCalls[phoneId].getState() != Call.State.DISCONNECTED) ||
                    (mRiCsCalls[phoneId].getState() != Call.State.IDLE &&
                    mRiCsCalls[phoneId].getState() != Call.State.DISCONNECTED) ||
                    (mFgImsCalls[phoneId].getState() != Call.State.IDLE &&
                    mFgImsCalls[phoneId].getState() != Call.State.DISCONNECTED) ||
                    (mBgImsCalls[phoneId].getState() != Call.State.IDLE &&
                    mBgImsCalls[phoneId].getState() != Call.State.DISCONNECTED) ||
                    (mRiImsCalls[phoneId].getState() != Call.State.IDLE &&
                    mRiImsCalls[phoneId].getState() != Call.State.DISCONNECTED));
        boolean dataDuringCallsEnabled = false;
        DataEnabledSettings dataEnabledSettings = phone.getDataEnabledSettings();
        if (dataEnabledSettings != null) {
            dataDuringCallsEnabled = dataEnabledSettings.isDataAllowedInVoiceCall();
        }
        if (!dataDuringCallsEnabled) {
            log("isPhoneInVoiceCall: dataDuringCallsEnabled=" + dataDuringCallsEnabled);
            return false;
        }
        int phoneId = phone.getPhoneId();
        return (mFgCsCalls[phoneId].getState().isAlive() ||
                mBgCsCalls[phoneId].getState().isAlive() ||
                mRiCsCalls[phoneId].getState().isAlive() ||
                mFgImsCalls[phoneId].getState().isAlive() ||
                mBgImsCalls[phoneId].getState().isAlive() ||
                mRiImsCalls[phoneId].getState().isAlive());
    }

    private void resetConnectFailureCount(int phoneId) {
+1 −1
Original line number Diff line number Diff line
@@ -67,7 +67,7 @@ public class VendorSubscriptionInfoUpdater extends SubscriptionInfoUpdater {
        return sInstance;
    }

    private VendorSubscriptionInfoUpdater(Looper looper, Context context,
    protected VendorSubscriptionInfoUpdater(Looper looper, Context context,
            CommandsInterface[] ci) {
        super(looper, context, ci);
        sContext = context;
+12 −4
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@ import android.telephony.Annotation.DataFailureCause;
import android.telephony.CarrierConfigManager;
import android.telephony.DataFailCause;
import android.telephony.data.ApnSetting;
import android.os.SystemProperties;
import android.telephony.Rlog;
import android.telephony.ServiceState;
import android.telephony.SubscriptionManager;
@@ -43,12 +42,12 @@ import com.android.internal.util.AsyncChannel;
import android.database.Cursor;
import android.content.Context;
import android.os.PersistableBundle;
import android.os.SystemProperties;
import android.provider.Telephony;

import java.util.HashSet;
import java.util.Iterator;

public final class VendorDcTracker extends DcTracker {
public class VendorDcTracker extends DcTracker {
    private String LOG_TAG = "VendorDCT";
    private HashSet<String> mIccidSet = new HashSet<String>();
    private int mTransportType = AccessNetworkConstants.TRANSPORT_TYPE_WWAN;
@@ -84,7 +83,16 @@ public final class VendorDcTracker extends DcTracker {

    @Override
    protected boolean allowInitialAttachForOperator() {
        return mPhone.getSubId() != SubscriptionManager.INVALID_SUBSCRIPTION_ID;
        String iccId = mPhone.getIccSerialNumber();
        if (iccId != null) {
            Iterator<String> itr = mIccidSet.iterator();
            while (itr.hasNext()) {
                if (iccId.contains(itr.next())) {
                    return false;
                }
            }
        }
        return true;
    }

    private void fillIccIdSet() {