Loading src/java/com/android/internal/telephony/PhoneSwitcher.java +21 −11 Original line number Diff line number Diff line Loading @@ -58,6 +58,7 @@ import android.telephony.data.ApnSetting; import android.util.LocalLog; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.telephony.SubscriptionController.WatchedInt; import com.android.internal.telephony.dataconnection.ApnConfigTypeRepository; import com.android.internal.telephony.dataconnection.DcRequest; import com.android.internal.telephony.metrics.TelephonyMetrics; Loading Loading @@ -214,7 +215,14 @@ public class PhoneSwitcher extends Handler { protected int mPreferredDataPhoneId = SubscriptionManager.INVALID_PHONE_INDEX; // Subscription ID corresponds to mPreferredDataPhoneId. private int mPreferredDataSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID; private WatchedInt mPreferredDataSubId = new WatchedInt(SubscriptionManager.INVALID_SUBSCRIPTION_ID) { @Override public void set(int newValue) { super.set(newValue); SubscriptionController.invalidateActiveDataSubIdCaches(); } }; // If non-null, An emergency call is about to be started, is ongoing, or has just ended and we // are overriding the DDS. Loading Loading @@ -312,6 +320,7 @@ public class PhoneSwitcher extends Handler { public static PhoneSwitcher make(int maxDataAttachModemCount, Context context, Looper looper) { if (sPhoneSwitcher == null) { sPhoneSwitcher = new PhoneSwitcher(maxDataAttachModemCount, context, looper); SubscriptionController.invalidateActiveDataSubIdCaches(); } return sPhoneSwitcher; Loading Loading @@ -441,10 +450,10 @@ public class PhoneSwitcher extends Handler { } case EVENT_PRIMARY_DATA_SUB_CHANGED: { if (onEvaluate(REQUESTS_UNCHANGED, "primary data subId changed")) { logDataSwitchEvent(mPreferredDataSubId, logDataSwitchEvent(mPreferredDataSubId.get(), TelephonyEvent.EventState.EVENT_STATE_START, DataSwitch.Reason.DATA_SWITCH_REASON_MANUAL); registerDefaultNetworkChangeCallback(mPreferredDataSubId, registerDefaultNetworkChangeCallback(mPreferredDataSubId.get(), DataSwitch.Reason.DATA_SWITCH_REASON_MANUAL); } break; Loading Loading @@ -515,10 +524,10 @@ public class PhoneSwitcher extends Handler { // fall through case EVENT_DATA_ENABLED_CHANGED: if (onEvaluate(REQUESTS_UNCHANGED, "EVENT_PRECISE_CALL_STATE_CHANGED")) { logDataSwitchEvent(mPreferredDataSubId, logDataSwitchEvent(mPreferredDataSubId.get(), TelephonyEvent.EventState.EVENT_STATE_START, DataSwitch.Reason.DATA_SWITCH_REASON_IN_CALL); registerDefaultNetworkChangeCallback(mPreferredDataSubId, registerDefaultNetworkChangeCallback(mPreferredDataSubId.get(), DataSwitch.Reason.DATA_SWITCH_REASON_IN_CALL); } break; Loading Loading @@ -1083,7 +1092,8 @@ public class PhoneSwitcher extends Handler { mPreferredDataPhoneId = phoneId; } mPreferredDataSubId = mSubscriptionController.getSubIdUsingPhoneId(mPreferredDataPhoneId); mPreferredDataSubId.set( mSubscriptionController.getSubIdUsingPhoneId(mPreferredDataPhoneId)); } private void transitionToEmergencyPhone() { Loading @@ -1097,8 +1107,8 @@ public class PhoneSwitcher extends Handler { mPreferredDataPhoneId = DEFAULT_EMERGENCY_PHONE_ID; } if (mPreferredDataSubId != INVALID_SUBSCRIPTION_ID) { mPreferredDataSubId = INVALID_SUBSCRIPTION_ID; if (mPreferredDataSubId.get() != INVALID_SUBSCRIPTION_ID) { mPreferredDataSubId.set(INVALID_SUBSCRIPTION_ID); notifyPreferredDataSubIdChanged(); } } Loading Loading @@ -1373,15 +1383,15 @@ public class PhoneSwitcher extends Handler { private void notifyPreferredDataSubIdChanged() { TelephonyRegistryManager telephonyRegistryManager = (TelephonyRegistryManager) mContext .getSystemService(Context.TELEPHONY_REGISTRY_SERVICE); log("notifyPreferredDataSubIdChanged to " + mPreferredDataSubId); telephonyRegistryManager.notifyActiveDataSubIdChanged(mPreferredDataSubId); log("notifyPreferredDataSubIdChanged to " + mPreferredDataSubId.get()); telephonyRegistryManager.notifyActiveDataSubIdChanged(mPreferredDataSubId.get()); } /** * @return The active data subscription id */ public int getActiveDataSubId() { return mPreferredDataSubId; return mPreferredDataSubId.get(); } // TODO (b/148396668): add an internal callback method to monitor phone capability change, Loading src/java/com/android/internal/telephony/SubscriptionController.java +51 −4 Original line number Diff line number Diff line Loading @@ -164,6 +164,7 @@ public class SubscriptionController extends ISub.Stub { public void clear() { mSlotIndexToSubIds.clear(); invalidateDefaultSubIdCaches(); invalidateSlotIndexCaches(); } public Set<Entry<Integer, ArrayList<Integer>>> entrySet() { Loading @@ -183,11 +184,13 @@ public class SubscriptionController extends ISub.Stub { public void put(int slotIndex, ArrayList<Integer> value) { mSlotIndexToSubIds.put(slotIndex, value); invalidateDefaultSubIdCaches(); invalidateSlotIndexCaches(); } public void remove(int slotIndex) { mSlotIndexToSubIds.remove(slotIndex); invalidateDefaultSubIdCaches(); invalidateSlotIndexCaches(); } public int size() { Loading @@ -210,6 +213,7 @@ public class SubscriptionController extends ISub.Stub { mSlotIndexToSubIds.remove(slotIndex); } invalidateDefaultSubIdCaches(); invalidateSlotIndexCaches(); return SUB_ID_FOUND; } else { return SUB_ID_NOT_IN_SLOT; Loading @@ -227,6 +231,7 @@ public class SubscriptionController extends ISub.Stub { subIdList.add(value); } invalidateDefaultSubIdCaches(); invalidateSlotIndexCaches(); } public void clearSubIdList(int slotIndex) { Loading @@ -234,6 +239,7 @@ public class SubscriptionController extends ISub.Stub { if (subIdList != null) { subIdList.clear(); invalidateDefaultSubIdCaches(); invalidateSlotIndexCaches(); } } } Loading @@ -251,13 +257,20 @@ public class SubscriptionController extends ISub.Stub { public void set(int newValue) { mValue = newValue; invalidateDefaultSubIdCaches(); } } private static WatchedSlotIndexToSubIds sSlotIndexToSubIds = new WatchedSlotIndexToSubIds(); protected static WatchedInt sDefaultFallbackSubId = new WatchedInt(SubscriptionManager.INVALID_SUBSCRIPTION_ID); new WatchedInt(SubscriptionManager.INVALID_SUBSCRIPTION_ID) { @Override public void set(int newValue) { super.set(newValue); invalidateDefaultSubIdCaches(); invalidateSlotIndexCaches(); } }; @UnsupportedAppUsage private static int mDefaultPhoneId = SubscriptionManager.DEFAULT_PHONE_INDEX; Loading Loading @@ -336,6 +349,9 @@ public class SubscriptionController extends ISub.Stub { // Initial invalidate activates caching. invalidateDefaultSubIdCaches(); invalidateDefaultDataSubIdCaches(); invalidateDefaultSmsSubIdCaches(); invalidateActiveDataSubIdCaches(); invalidateSlotIndexCaches(); if (DBG) logdl("[SubscriptionController] init by Context"); } Loading Loading @@ -4089,9 +4105,14 @@ public class SubscriptionController extends ISub.Stub { Settings.Global.putInt(mContext.getContentResolver(), name, value); if (name == Settings.Global.MULTI_SIM_DATA_CALL_SUBSCRIPTION) { invalidateDefaultDataSubIdCaches(); invalidateActiveDataSubIdCaches(); invalidateDefaultSubIdCaches(); invalidateSlotIndexCaches(); } else if (name == Settings.Global.MULTI_SIM_VOICE_CALL_SUBSCRIPTION) { invalidateDefaultSubIdCaches(); invalidateSlotIndexCaches(); } else if (name == Settings.Global.MULTI_SIM_SMS_SUBSCRIPTION) { invalidateDefaultSmsSubIdCaches(); } } Loading @@ -4113,6 +4134,33 @@ public class SubscriptionController extends ISub.Stub { } } /** * @hide */ private static void invalidateDefaultSmsSubIdCaches() { if (sCachingEnabled) { SubscriptionManager.invalidateDefaultSmsSubIdCaches(); } } /** * @hide */ protected static void invalidateActiveDataSubIdCaches() { if (sCachingEnabled) { SubscriptionManager.invalidateActiveDataSubIdCaches(); } } /** * @hide */ protected static void invalidateSlotIndexCaches() { if (sCachingEnabled) { SubscriptionManager.invalidateSlotIndexCaches(); } } /** * @hide */ Loading @@ -4124,9 +4172,8 @@ public class SubscriptionController extends ISub.Stub { /** * @hide */ @VisibleForTesting public static void enableCaching() { sCachingEnabled = true; } } src/java/com/android/internal/telephony/dataconnection/DcNetworkAgent.java +25 −26 Original line number Diff line number Diff line Loading @@ -32,6 +32,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.LocalLog; import android.util.SparseArray; Loading @@ -45,8 +46,8 @@ import com.android.telephony.Rlog; import java.io.FileDescriptor; import java.io.PrintWriter; import java.time.Duration; import java.util.ArrayList; import java.util.List; import java.util.HashSet; import java.util.Set; import java.util.UUID; /** Loading Loading @@ -76,10 +77,8 @@ public class DcNetworkAgent extends NetworkAgent { private NetworkInfo mNetworkInfo; // For debugging IMS redundant network agent issue. private static List<DcNetworkAgent> sNetworkAgents = new ArrayList<>(); private static int sRedundantTimes = 0; // For debugging duplicate interface issue. Remove before R released. private static Set<String> sInterfaceNames = new HashSet<>(); DcNetworkAgent(DataConnection dc, Phone phone, NetworkInfo ni, int score, NetworkAgentConfig config, NetworkProvider networkProvider, int transportType) { Loading @@ -94,29 +93,26 @@ public class DcNetworkAgent extends NetworkAgent { mDataConnection = dc; mNetworkInfo = new NetworkInfo(ni); setLegacyExtraInfo(ni.getExtraInfo()); // TODO: Remove after b/151487565 is fixed. sNetworkAgents.add(this); checkRedundantIms(); // TODO: Remove before R is released. if (dc.getLinkProperties() != null && !TextUtils.isEmpty(dc.getLinkProperties().getInterfaceName())) { checkDuplicateInterface(dc.getLinkProperties().getInterfaceName()); } logd(mTag + " created for data connection " + dc.getName()); } // This is a temp code to catch the multiple IMS network agents issue. // TODO: Remove after b/151487565 is fixed. private void checkRedundantIms() { if (sNetworkAgents.stream() .filter(n -> n.mNetworkCapabilities.hasCapability( NetworkCapabilities.NET_CAPABILITY_IMS)) .count() > 1) { sRedundantTimes++; if (sRedundantTimes == 5) { // When it occurs 5 times. String message = "Multiple IMS network agents detected."; // 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); // Using fixed UUID to avoid duplicate bugreport notification AnomalyReporter.reportAnomaly( UUID.fromString("a5cf4881-75ae-4129-a25d-71bc4293f493"), UUID.fromString("02f3d3f6-4613-4415-b6cb-8d92c8a938a6"), message); } } sInterfaceNames.add(interfaceName); } /** Loading Loading @@ -292,8 +288,11 @@ public class DcNetworkAgent extends NetworkAgent { } if ((oldState == NetworkInfo.State.SUSPENDED || oldState == NetworkInfo.State.CONNECTED) && state == NetworkInfo.State.DISCONNECTED) { if (dc.getLinkProperties() != null && !TextUtils.isEmpty(dc.getLinkProperties().getInterfaceName())) { sInterfaceNames.remove(dc.getLinkProperties().getInterfaceName()); } logd("Unregister from connectivity service"); sNetworkAgents.remove(this); unregister(); } mNetworkInfo = new NetworkInfo(networkInfo); Loading src/java/com/android/internal/telephony/metrics/MetricsCollector.java +4 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ import com.android.telephony.Rlog; import java.util.Arrays; import java.util.Comparator; import java.util.List; import java.util.Random; /** * Implements statsd pullers for Telephony. Loading Loading @@ -81,6 +82,7 @@ public class MetricsCollector implements StatsManager.StatsPullAtomCallback { private PersistAtomsStorage mStorage; private final StatsManager mStatsManager; private static final Random sRandom = new Random(); public MetricsCollector(Context context) { mStorage = new PersistAtomsStorage(context); Loading Loading @@ -249,6 +251,8 @@ public class MetricsCollector implements StatsManager.StatsPullAtomCallback { .writeBoolean(session.rttEnabled) .writeBoolean(session.isEmergency) .writeBoolean(session.isRoaming) // workaround: dimension required for keeping multiple pulled atoms .writeInt(sRandom.nextInt()) .build(); } Loading src/java/com/android/internal/telephony/uicc/UiccController.java +2 −1 Original line number Diff line number Diff line Loading @@ -1024,7 +1024,8 @@ public class UiccController extends Handler { boolean defaultEuiccCardIdIsStillInserted = false; String cardString = mCardStrings.get(mDefaultEuiccCardId); for (UiccSlot slot : mUiccSlots) { if (cardString.equals(IccUtils.stripTrailingFs(slot.getEid()))) { if (cardString.equals( IccUtils.stripTrailingFs(slot.getUiccCard().getCardId()))) { defaultEuiccCardIdIsStillInserted = true; } } Loading Loading
src/java/com/android/internal/telephony/PhoneSwitcher.java +21 −11 Original line number Diff line number Diff line Loading @@ -58,6 +58,7 @@ import android.telephony.data.ApnSetting; import android.util.LocalLog; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.telephony.SubscriptionController.WatchedInt; import com.android.internal.telephony.dataconnection.ApnConfigTypeRepository; import com.android.internal.telephony.dataconnection.DcRequest; import com.android.internal.telephony.metrics.TelephonyMetrics; Loading Loading @@ -214,7 +215,14 @@ public class PhoneSwitcher extends Handler { protected int mPreferredDataPhoneId = SubscriptionManager.INVALID_PHONE_INDEX; // Subscription ID corresponds to mPreferredDataPhoneId. private int mPreferredDataSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID; private WatchedInt mPreferredDataSubId = new WatchedInt(SubscriptionManager.INVALID_SUBSCRIPTION_ID) { @Override public void set(int newValue) { super.set(newValue); SubscriptionController.invalidateActiveDataSubIdCaches(); } }; // If non-null, An emergency call is about to be started, is ongoing, or has just ended and we // are overriding the DDS. Loading Loading @@ -312,6 +320,7 @@ public class PhoneSwitcher extends Handler { public static PhoneSwitcher make(int maxDataAttachModemCount, Context context, Looper looper) { if (sPhoneSwitcher == null) { sPhoneSwitcher = new PhoneSwitcher(maxDataAttachModemCount, context, looper); SubscriptionController.invalidateActiveDataSubIdCaches(); } return sPhoneSwitcher; Loading Loading @@ -441,10 +450,10 @@ public class PhoneSwitcher extends Handler { } case EVENT_PRIMARY_DATA_SUB_CHANGED: { if (onEvaluate(REQUESTS_UNCHANGED, "primary data subId changed")) { logDataSwitchEvent(mPreferredDataSubId, logDataSwitchEvent(mPreferredDataSubId.get(), TelephonyEvent.EventState.EVENT_STATE_START, DataSwitch.Reason.DATA_SWITCH_REASON_MANUAL); registerDefaultNetworkChangeCallback(mPreferredDataSubId, registerDefaultNetworkChangeCallback(mPreferredDataSubId.get(), DataSwitch.Reason.DATA_SWITCH_REASON_MANUAL); } break; Loading Loading @@ -515,10 +524,10 @@ public class PhoneSwitcher extends Handler { // fall through case EVENT_DATA_ENABLED_CHANGED: if (onEvaluate(REQUESTS_UNCHANGED, "EVENT_PRECISE_CALL_STATE_CHANGED")) { logDataSwitchEvent(mPreferredDataSubId, logDataSwitchEvent(mPreferredDataSubId.get(), TelephonyEvent.EventState.EVENT_STATE_START, DataSwitch.Reason.DATA_SWITCH_REASON_IN_CALL); registerDefaultNetworkChangeCallback(mPreferredDataSubId, registerDefaultNetworkChangeCallback(mPreferredDataSubId.get(), DataSwitch.Reason.DATA_SWITCH_REASON_IN_CALL); } break; Loading Loading @@ -1083,7 +1092,8 @@ public class PhoneSwitcher extends Handler { mPreferredDataPhoneId = phoneId; } mPreferredDataSubId = mSubscriptionController.getSubIdUsingPhoneId(mPreferredDataPhoneId); mPreferredDataSubId.set( mSubscriptionController.getSubIdUsingPhoneId(mPreferredDataPhoneId)); } private void transitionToEmergencyPhone() { Loading @@ -1097,8 +1107,8 @@ public class PhoneSwitcher extends Handler { mPreferredDataPhoneId = DEFAULT_EMERGENCY_PHONE_ID; } if (mPreferredDataSubId != INVALID_SUBSCRIPTION_ID) { mPreferredDataSubId = INVALID_SUBSCRIPTION_ID; if (mPreferredDataSubId.get() != INVALID_SUBSCRIPTION_ID) { mPreferredDataSubId.set(INVALID_SUBSCRIPTION_ID); notifyPreferredDataSubIdChanged(); } } Loading Loading @@ -1373,15 +1383,15 @@ public class PhoneSwitcher extends Handler { private void notifyPreferredDataSubIdChanged() { TelephonyRegistryManager telephonyRegistryManager = (TelephonyRegistryManager) mContext .getSystemService(Context.TELEPHONY_REGISTRY_SERVICE); log("notifyPreferredDataSubIdChanged to " + mPreferredDataSubId); telephonyRegistryManager.notifyActiveDataSubIdChanged(mPreferredDataSubId); log("notifyPreferredDataSubIdChanged to " + mPreferredDataSubId.get()); telephonyRegistryManager.notifyActiveDataSubIdChanged(mPreferredDataSubId.get()); } /** * @return The active data subscription id */ public int getActiveDataSubId() { return mPreferredDataSubId; return mPreferredDataSubId.get(); } // TODO (b/148396668): add an internal callback method to monitor phone capability change, Loading
src/java/com/android/internal/telephony/SubscriptionController.java +51 −4 Original line number Diff line number Diff line Loading @@ -164,6 +164,7 @@ public class SubscriptionController extends ISub.Stub { public void clear() { mSlotIndexToSubIds.clear(); invalidateDefaultSubIdCaches(); invalidateSlotIndexCaches(); } public Set<Entry<Integer, ArrayList<Integer>>> entrySet() { Loading @@ -183,11 +184,13 @@ public class SubscriptionController extends ISub.Stub { public void put(int slotIndex, ArrayList<Integer> value) { mSlotIndexToSubIds.put(slotIndex, value); invalidateDefaultSubIdCaches(); invalidateSlotIndexCaches(); } public void remove(int slotIndex) { mSlotIndexToSubIds.remove(slotIndex); invalidateDefaultSubIdCaches(); invalidateSlotIndexCaches(); } public int size() { Loading @@ -210,6 +213,7 @@ public class SubscriptionController extends ISub.Stub { mSlotIndexToSubIds.remove(slotIndex); } invalidateDefaultSubIdCaches(); invalidateSlotIndexCaches(); return SUB_ID_FOUND; } else { return SUB_ID_NOT_IN_SLOT; Loading @@ -227,6 +231,7 @@ public class SubscriptionController extends ISub.Stub { subIdList.add(value); } invalidateDefaultSubIdCaches(); invalidateSlotIndexCaches(); } public void clearSubIdList(int slotIndex) { Loading @@ -234,6 +239,7 @@ public class SubscriptionController extends ISub.Stub { if (subIdList != null) { subIdList.clear(); invalidateDefaultSubIdCaches(); invalidateSlotIndexCaches(); } } } Loading @@ -251,13 +257,20 @@ public class SubscriptionController extends ISub.Stub { public void set(int newValue) { mValue = newValue; invalidateDefaultSubIdCaches(); } } private static WatchedSlotIndexToSubIds sSlotIndexToSubIds = new WatchedSlotIndexToSubIds(); protected static WatchedInt sDefaultFallbackSubId = new WatchedInt(SubscriptionManager.INVALID_SUBSCRIPTION_ID); new WatchedInt(SubscriptionManager.INVALID_SUBSCRIPTION_ID) { @Override public void set(int newValue) { super.set(newValue); invalidateDefaultSubIdCaches(); invalidateSlotIndexCaches(); } }; @UnsupportedAppUsage private static int mDefaultPhoneId = SubscriptionManager.DEFAULT_PHONE_INDEX; Loading Loading @@ -336,6 +349,9 @@ public class SubscriptionController extends ISub.Stub { // Initial invalidate activates caching. invalidateDefaultSubIdCaches(); invalidateDefaultDataSubIdCaches(); invalidateDefaultSmsSubIdCaches(); invalidateActiveDataSubIdCaches(); invalidateSlotIndexCaches(); if (DBG) logdl("[SubscriptionController] init by Context"); } Loading Loading @@ -4089,9 +4105,14 @@ public class SubscriptionController extends ISub.Stub { Settings.Global.putInt(mContext.getContentResolver(), name, value); if (name == Settings.Global.MULTI_SIM_DATA_CALL_SUBSCRIPTION) { invalidateDefaultDataSubIdCaches(); invalidateActiveDataSubIdCaches(); invalidateDefaultSubIdCaches(); invalidateSlotIndexCaches(); } else if (name == Settings.Global.MULTI_SIM_VOICE_CALL_SUBSCRIPTION) { invalidateDefaultSubIdCaches(); invalidateSlotIndexCaches(); } else if (name == Settings.Global.MULTI_SIM_SMS_SUBSCRIPTION) { invalidateDefaultSmsSubIdCaches(); } } Loading @@ -4113,6 +4134,33 @@ public class SubscriptionController extends ISub.Stub { } } /** * @hide */ private static void invalidateDefaultSmsSubIdCaches() { if (sCachingEnabled) { SubscriptionManager.invalidateDefaultSmsSubIdCaches(); } } /** * @hide */ protected static void invalidateActiveDataSubIdCaches() { if (sCachingEnabled) { SubscriptionManager.invalidateActiveDataSubIdCaches(); } } /** * @hide */ protected static void invalidateSlotIndexCaches() { if (sCachingEnabled) { SubscriptionManager.invalidateSlotIndexCaches(); } } /** * @hide */ Loading @@ -4124,9 +4172,8 @@ public class SubscriptionController extends ISub.Stub { /** * @hide */ @VisibleForTesting public static void enableCaching() { sCachingEnabled = true; } }
src/java/com/android/internal/telephony/dataconnection/DcNetworkAgent.java +25 −26 Original line number Diff line number Diff line Loading @@ -32,6 +32,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.LocalLog; import android.util.SparseArray; Loading @@ -45,8 +46,8 @@ import com.android.telephony.Rlog; import java.io.FileDescriptor; import java.io.PrintWriter; import java.time.Duration; import java.util.ArrayList; import java.util.List; import java.util.HashSet; import java.util.Set; import java.util.UUID; /** Loading Loading @@ -76,10 +77,8 @@ public class DcNetworkAgent extends NetworkAgent { private NetworkInfo mNetworkInfo; // For debugging IMS redundant network agent issue. private static List<DcNetworkAgent> sNetworkAgents = new ArrayList<>(); private static int sRedundantTimes = 0; // For debugging duplicate interface issue. Remove before R released. private static Set<String> sInterfaceNames = new HashSet<>(); DcNetworkAgent(DataConnection dc, Phone phone, NetworkInfo ni, int score, NetworkAgentConfig config, NetworkProvider networkProvider, int transportType) { Loading @@ -94,29 +93,26 @@ public class DcNetworkAgent extends NetworkAgent { mDataConnection = dc; mNetworkInfo = new NetworkInfo(ni); setLegacyExtraInfo(ni.getExtraInfo()); // TODO: Remove after b/151487565 is fixed. sNetworkAgents.add(this); checkRedundantIms(); // TODO: Remove before R is released. if (dc.getLinkProperties() != null && !TextUtils.isEmpty(dc.getLinkProperties().getInterfaceName())) { checkDuplicateInterface(dc.getLinkProperties().getInterfaceName()); } logd(mTag + " created for data connection " + dc.getName()); } // This is a temp code to catch the multiple IMS network agents issue. // TODO: Remove after b/151487565 is fixed. private void checkRedundantIms() { if (sNetworkAgents.stream() .filter(n -> n.mNetworkCapabilities.hasCapability( NetworkCapabilities.NET_CAPABILITY_IMS)) .count() > 1) { sRedundantTimes++; if (sRedundantTimes == 5) { // When it occurs 5 times. String message = "Multiple IMS network agents detected."; // 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); // Using fixed UUID to avoid duplicate bugreport notification AnomalyReporter.reportAnomaly( UUID.fromString("a5cf4881-75ae-4129-a25d-71bc4293f493"), UUID.fromString("02f3d3f6-4613-4415-b6cb-8d92c8a938a6"), message); } } sInterfaceNames.add(interfaceName); } /** Loading Loading @@ -292,8 +288,11 @@ public class DcNetworkAgent extends NetworkAgent { } if ((oldState == NetworkInfo.State.SUSPENDED || oldState == NetworkInfo.State.CONNECTED) && state == NetworkInfo.State.DISCONNECTED) { if (dc.getLinkProperties() != null && !TextUtils.isEmpty(dc.getLinkProperties().getInterfaceName())) { sInterfaceNames.remove(dc.getLinkProperties().getInterfaceName()); } logd("Unregister from connectivity service"); sNetworkAgents.remove(this); unregister(); } mNetworkInfo = new NetworkInfo(networkInfo); Loading
src/java/com/android/internal/telephony/metrics/MetricsCollector.java +4 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ import com.android.telephony.Rlog; import java.util.Arrays; import java.util.Comparator; import java.util.List; import java.util.Random; /** * Implements statsd pullers for Telephony. Loading Loading @@ -81,6 +82,7 @@ public class MetricsCollector implements StatsManager.StatsPullAtomCallback { private PersistAtomsStorage mStorage; private final StatsManager mStatsManager; private static final Random sRandom = new Random(); public MetricsCollector(Context context) { mStorage = new PersistAtomsStorage(context); Loading Loading @@ -249,6 +251,8 @@ public class MetricsCollector implements StatsManager.StatsPullAtomCallback { .writeBoolean(session.rttEnabled) .writeBoolean(session.isEmergency) .writeBoolean(session.isRoaming) // workaround: dimension required for keeping multiple pulled atoms .writeInt(sRandom.nextInt()) .build(); } Loading
src/java/com/android/internal/telephony/uicc/UiccController.java +2 −1 Original line number Diff line number Diff line Loading @@ -1024,7 +1024,8 @@ public class UiccController extends Handler { boolean defaultEuiccCardIdIsStillInserted = false; String cardString = mCardStrings.get(mDefaultEuiccCardId); for (UiccSlot slot : mUiccSlots) { if (cardString.equals(IccUtils.stripTrailingFs(slot.getEid()))) { if (cardString.equals( IccUtils.stripTrailingFs(slot.getUiccCard().getCardId()))) { defaultEuiccCardIdIsStillInserted = true; } } Loading