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

Commit 8a792c15 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 6701292 from 4756708f to rvc-qpr1-release

Change-Id: Ic350ea31bc18f0305400f61a1871ab4921fdafa4
parents 93a9219e 4756708f
Loading
Loading
Loading
Loading
+31 −23
Original line number Diff line number Diff line
@@ -739,6 +739,7 @@ public class SubscriptionController extends ISub.Stub {
     * @hide
     */
    public SubscriptionInfo getSubscriptionInfo(int subId) {
        synchronized (mSubInfoListLock) {
            // check cache for active subscriptions first, before querying db
            for (SubscriptionInfo subInfo : mCacheActiveSubInfoList) {
                if (subInfo.getSubscriptionId() == subId) {
@@ -751,6 +752,7 @@ public class SubscriptionController extends ISub.Stub {
                    return subInfo;
                }
            }
        }

        List<SubscriptionInfo> subInfoList = getSubInfo(
                SubscriptionManager.UNIQUE_KEY_SUBSCRIPTION_ID + "=" + subId, null);
@@ -1530,6 +1532,7 @@ public class SubscriptionController extends ISub.Stub {
        // validate the given info - does it exist in the active subscription list
        int subId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
        int slotIndex = SubscriptionManager.INVALID_SIM_SLOT_INDEX;
        synchronized (mSubInfoListLock) {
            for (SubscriptionInfo info : mCacheActiveSubInfoList) {
                if ((info.getSubscriptionType() == subscriptionType)
                        && info.getIccId().equalsIgnoreCase(uniqueId)) {
@@ -1538,6 +1541,7 @@ public class SubscriptionController extends ISub.Stub {
                    break;
                }
            }
        }
        if (subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
            if (DBG) {
                logd("Invalid subscription details: subscriptionType = " + subscriptionType
@@ -2752,13 +2756,15 @@ public class SubscriptionController extends ISub.Stub {
    }

    private boolean isSubscriptionVisible(int subId) {
        synchronized (mSubInfoListLock) {
            for (SubscriptionInfo info : mCacheOpportunisticSubInfoList) {
                if (info.getSubscriptionId() == subId) {
                // If group UUID is null, it's stand alone opportunistic profile. So it's visible.
                // otherwise, it's bundled opportunistic profile, and is not visible.
                    // If group UUID is null, it's stand alone opportunistic profile. So it's
                    // visible. Otherwise, it's bundled opportunistic profile, and is not visible.
                    return info.getGroupUuid() == null;
                }
            }
        }

        return true;
    }
@@ -4116,11 +4122,13 @@ public class SubscriptionController extends ISub.Stub {
    private boolean shouldDisableSubGroup(ParcelUuid groupUuid) {
        if (groupUuid == null) return false;

        synchronized (mSubInfoListLock) {
            for (SubscriptionInfo activeInfo : mCacheActiveSubInfoList) {
                if (!activeInfo.isOpportunistic() && groupUuid.equals(activeInfo.getGroupUuid())) {
                    return false;
                }
            }
        }

        return true;
    }
+39 −30
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.internal.telephony.dataconnection;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.net.KeepalivePacketData;
import android.net.LinkProperties;
import android.net.NattKeepalivePacketData;
@@ -32,7 +33,7 @@ import android.telephony.AccessNetworkConstants;
import android.telephony.AccessNetworkConstants.TransportType;
import android.telephony.AnomalyReporter;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.ArrayMap;
import android.util.LocalLog;
import android.util.SparseArray;

@@ -46,8 +47,8 @@ import com.android.telephony.Rlog;
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.time.Duration;
import java.util.HashSet;
import java.util.Set;
import java.util.Map;
import java.util.Objects;
import java.util.UUID;

/**
@@ -63,6 +64,8 @@ import java.util.UUID;
public class DcNetworkAgent extends NetworkAgent {
    private final String mTag;

    private final int mId;

    private Phone mPhone;

    private int mTransportType;
@@ -77,8 +80,8 @@ public class DcNetworkAgent extends NetworkAgent {

    private NetworkInfo mNetworkInfo;

    // For debugging duplicate interface issue. Remove before R released.
    private static Set<String> sInterfaceNames = new HashSet<>();
    // For interface duplicate detection. Key is the net id, value is the interface name in string.
    private static Map<Integer, String> sInterfaceNames = new ArrayMap<>();

    DcNetworkAgent(DataConnection dc, Phone phone, NetworkInfo ni, int score,
            NetworkAgentConfig config, NetworkProvider networkProvider, int transportType) {
@@ -86,33 +89,38 @@ public class DcNetworkAgent extends NetworkAgent {
                dc.getNetworkCapabilities(), dc.getLinkProperties(), score, config,
                networkProvider);
        register();
        mTag = "DcNetworkAgent" + "-" + getNetwork().netId;
        mId = getNetwork().netId;
        mTag = "DcNetworkAgent" + "-" + mId;
        mPhone = phone;
        mNetworkCapabilities = dc.getNetworkCapabilities();
        mTransportType = transportType;
        mDataConnection = dc;
        mNetworkInfo = new NetworkInfo(ni);
        setLegacyExtraInfo(ni.getExtraInfo());
        // TODO: Remove before R is released.
        if (dc.getLinkProperties() != null
                && !TextUtils.isEmpty(dc.getLinkProperties().getInterfaceName())) {
            checkDuplicateInterface(dc.getLinkProperties().getInterfaceName());
        if (dc.getLinkProperties() != null) {
            checkDuplicateInterface(mId, dc.getLinkProperties().getInterfaceName());
            logd("created for data connection " + dc.getName() + ", "
                    + dc.getLinkProperties().getInterfaceName());
        } else {
            loge("The connection does not have a valid link properties.");
        }
        logd(mTag + " created for data connection " + dc.getName());
    }

    // This is a temp code to catch the duplicate network interface issue.
    // TODO: Remove before R is released.
    private void checkDuplicateInterface(String interfaceName) {
        if (sInterfaceNames.contains(interfaceName)) {
            String message = "Duplicate interface " + interfaceName + " is detected.";
            log(message);
    private void checkDuplicateInterface(int netId, @Nullable String interfaceName) {
        for (Map.Entry<Integer, String> entry: sInterfaceNames.entrySet()) {
            if (Objects.equals(interfaceName, entry.getValue())) {
                String message = "Duplicate interface " + interfaceName
                        + " is detected. DcNetworkAgent-" + entry.getKey()
                        + " already used this interface name.";
                loge(message);
                // Using fixed UUID to avoid duplicate bugreport notification
                AnomalyReporter.reportAnomaly(
                        UUID.fromString("02f3d3f6-4613-4415-b6cb-8d92c8a938a6"),
                        message);
                return;
            }
        sInterfaceNames.add(interfaceName);
        }
        sInterfaceNames.put(netId, interfaceName);
    }

    /**
@@ -143,7 +151,7 @@ public class DcNetworkAgent extends NetworkAgent {
            loge("releaseOwnership called on no-owner DcNetworkAgent!");
            return;
        } else if (mDataConnection != dc) {
            log("releaseOwnership: This agent belongs to "
            loge("releaseOwnership: This agent belongs to "
                    + mDataConnection.getName() + ", ignored the request from " + dc.getName());
            return;
        }
@@ -252,9 +260,11 @@ public class DcNetworkAgent extends NetworkAgent {
     * @param linkProperties The link properties
     * @param dc The data connection that invokes this method.
     */
    public synchronized void sendLinkProperties(LinkProperties linkProperties,
    public synchronized void sendLinkProperties(@NonNull LinkProperties linkProperties,
                                                DataConnection dc) {
        if (!isOwned(dc, "sendLinkProperties")) return;

        sInterfaceNames.put(mId, dc.getLinkProperties().getInterfaceName());
        sendLinkProperties(linkProperties);
    }

@@ -277,11 +287,8 @@ public class DcNetworkAgent extends NetworkAgent {
    public synchronized void unregister(DataConnection dc) {
        if (!isOwned(dc, "unregister")) return;

        if (dc.getLinkProperties() != null
                && !TextUtils.isEmpty(dc.getLinkProperties().getInterfaceName())) {
            sInterfaceNames.remove(dc.getLinkProperties().getInterfaceName());
        }
        logd("Unregister from connectivity service");
        logd("Unregister from connectivity service. " + sInterfaceNames.get(mId) + " removed.");
        sInterfaceNames.remove(mId);
        super.unregister();
    }

@@ -347,11 +354,13 @@ public class DcNetworkAgent extends NetworkAgent {

    @Override
    public String toString() {
        return "DcNetworkAgent:"
        return "DcNetworkAgent-"
                + mId
                + " mDataConnection="
                + ((mDataConnection != null) ? mDataConnection.getName() : null)
                + " mTransportType="
                + AccessNetworkConstants.transportTypeToString(mTransportType)
                + " " + ((mDataConnection != null) ? mDataConnection.getLinkProperties() : null)
                + " mNetworkCapabilities=" + mNetworkCapabilities;
    }

+23 −25
Original line number Diff line number Diff line
@@ -59,7 +59,6 @@ import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileDescriptor;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
@@ -80,7 +79,9 @@ public class EmergencyNumberTracker extends Handler {
    private static final String EMERGENCY_NUMBER_DB_OTA_FILE_NAME = "emergency_number_db";
    private static final String EMERGENCY_NUMBER_DB_OTA_FILE_PATH =
            "misc/emergencynumberdb/" + EMERGENCY_NUMBER_DB_OTA_FILE_NAME;
    private FileInputStream mEmergencyNumberDbOtaFileInputStream = null;

    /** Used for storing overrided (non-default) OTA database file path */
    private ParcelFileDescriptor mOverridedOtaDbParcelFileDescriptor = null;

    /** @hide */
    public static boolean DBG = false;
@@ -170,13 +171,6 @@ public class EmergencyNumberTracker extends Handler {
        mPhone = phone;
        mCi = ci;

        try {
            mEmergencyNumberDbOtaFileInputStream = new FileInputStream(
                    new File(Environment.getDataDirectory(), EMERGENCY_NUMBER_DB_OTA_FILE_PATH));
        } catch (FileNotFoundException ex) {
            loge("Initialize ota emergency database file input failure: " + ex);
        }

        if (mPhone != null) {
            CarrierConfigManager configMgr = (CarrierConfigManager)
                    mPhone.getContext().getSystemService(Context.CARRIER_CONFIG_SERVICE);
@@ -488,6 +482,7 @@ public class EmergencyNumberTracker extends Handler {
    }

    private int cacheOtaEmergencyNumberDatabase() {
        FileInputStream fileInputStream = null;
        BufferedInputStream inputStream = null;
        ProtobufEccData.AllInfo allEccMessages = null;
        int otaDatabaseVersion = INVALID_DATABASE_VERSION;
@@ -496,11 +491,16 @@ public class EmergencyNumberTracker extends Handler {
        List<EmergencyNumber> updatedOtaEmergencyNumberList = new ArrayList<>();
        try {
            // If OTA File partition is not available, try to reload the default one.
            if (mEmergencyNumberDbOtaFileInputStream == null) {
                mEmergencyNumberDbOtaFileInputStream = new FileInputStream(
                      new File(Environment.getDataDirectory(), EMERGENCY_NUMBER_DB_OTA_FILE_PATH));
            if (mOverridedOtaDbParcelFileDescriptor == null) {
                fileInputStream = new FileInputStream(
                        new File(Environment.getDataDirectory(),
                                EMERGENCY_NUMBER_DB_OTA_FILE_PATH));
            } else {
                File file = ParcelFileDescriptor
                        .getFile(mOverridedOtaDbParcelFileDescriptor.getFileDescriptor());
                fileInputStream = new FileInputStream(new File(file.getAbsolutePath()));
            }
            inputStream = new BufferedInputStream(mEmergencyNumberDbOtaFileInputStream);
            inputStream = new BufferedInputStream(fileInputStream);
            allEccMessages = ProtobufEccData.AllInfo.parseFrom(readInputStreamToByteArray(
                    new GZIPInputStream(inputStream)));
            logd(mCountryIso + " ota emergency database is loaded. Ver: " + otaDatabaseVersion);
@@ -517,7 +517,7 @@ public class EmergencyNumberTracker extends Handler {
        } catch (IOException ex) {
            loge("Cache ota emergency database IOException: " + ex);
        } finally {
            // close quietly by catching non-runtime exceptions.
            // Close quietly by catching non-runtime exceptions.
            if (inputStream != null) {
                try {
                    inputStream.close();
@@ -526,6 +526,14 @@ public class EmergencyNumberTracker extends Handler {
                } catch (Exception ignored) {
                }
            }
            if (fileInputStream != null) {
                try {
                    fileInputStream.close();
                } catch (RuntimeException rethrown) {
                    throw rethrown;
                } catch (Exception ignored) {
                }
            }
        }

        // Use a valid database that has higher version.
@@ -606,17 +614,7 @@ public class EmergencyNumberTracker extends Handler {
    private void overrideOtaEmergencyNumberDbFilePath(
            ParcelFileDescriptor otaParcelableFileDescriptor) {
        logd("overrideOtaEmergencyNumberDbFilePath:" + otaParcelableFileDescriptor);
        try {
            if (otaParcelableFileDescriptor == null) {
                mEmergencyNumberDbOtaFileInputStream = new FileInputStream(
                    new File(Environment.getDataDirectory(), EMERGENCY_NUMBER_DB_OTA_FILE_PATH));
            } else {
                mEmergencyNumberDbOtaFileInputStream = new FileInputStream(
                    otaParcelableFileDescriptor.getFileDescriptor());
            }
        } catch (FileNotFoundException ex) {
            loge("Override ota emergency database failure: " + ex);
        }
        mOverridedOtaDbParcelFileDescriptor = otaParcelableFileDescriptor;
    }

    private void updateOtaEmergencyNumberListDatabaseAndNotify() {