From e160c0ca0868c65534e8ff34ab893b506b291c70 Mon Sep 17 00:00:00 2001 From: Kai Shi Date: Wed, 29 Sep 2021 12:42:06 -0700 Subject: [PATCH] Bug fix: LCE list initialization Initialize LCE list so that its size is at least 1. This is important for 1st call back after registration especially when there is no LCE report yet. Bug: 198682652 Test: atest -c TelephonyCallbackTest in airplane mode. Change-Id: I54b4ce0c51e6c10c6ef67776cf3083a04b7d5da3 --- .../core/java/com/android/server/TelephonyRegistry.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/TelephonyRegistry.java b/services/core/java/com/android/server/TelephonyRegistry.java index edf832f0fc22f..c11c4def1b500 100644 --- a/services/core/java/com/android/server/TelephonyRegistry.java +++ b/services/core/java/com/android/server/TelephonyRegistry.java @@ -385,6 +385,10 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { private int[] mAllowedNetworkTypeReason; private long[] mAllowedNetworkTypeValue; + private static final List INVALID_LCE_LIST = + new ArrayList(Arrays.asList(new LinkCapacityEstimate( + LinkCapacityEstimate.LCE_TYPE_COMBINED, + LinkCapacityEstimate.INVALID, LinkCapacityEstimate.INVALID))); private List> mLinkCapacityEstimateLists; /** @@ -719,7 +723,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { mPhysicalChannelConfigs.add(i, new ArrayList<>()); mAllowedNetworkTypeReason[i] = -1; mAllowedNetworkTypeValue[i] = -1; - mLinkCapacityEstimateLists.add(i, new ArrayList<>()); + mLinkCapacityEstimateLists.add(i, INVALID_LCE_LIST); } } @@ -819,7 +823,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { mPhysicalChannelConfigs.add(i, new ArrayList<>()); mAllowedNetworkTypeReason[i] = -1; mAllowedNetworkTypeValue[i] = -1; - mLinkCapacityEstimateLists.add(i, new ArrayList<>()); + mLinkCapacityEstimateLists.add(i, INVALID_LCE_LIST); } mAppOps = mContext.getSystemService(AppOpsManager.class);