From 0ec6955ec5a701034c1624e2ebf6be1aa08238a1 Mon Sep 17 00:00:00 2001 From: Nagendra Prasad Nagarle Basavaraju Date: Tue, 4 Apr 2023 09:06:37 +0000 Subject: [HysteresisDB] Fix NullPointerException at CellularQualityMonitor Bug: 276850662 Bug: 274605921 Test: atest QualifiedNetworksServiceTest Change-Id: I9d1d126e0112fe86d6f077ecb325f0f8976953a7 --- .../com/android/telephony/qns/QnsComponents.java | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'services/QualifiedNetworksService/src/com/android') diff --git a/services/QualifiedNetworksService/src/com/android/telephony/qns/QnsComponents.java b/services/QualifiedNetworksService/src/com/android/telephony/qns/QnsComponents.java index 5862bc2..0471ea8 100644 --- a/services/QualifiedNetworksService/src/com/android/telephony/qns/QnsComponents.java +++ b/services/QualifiedNetworksService/src/com/android/telephony/qns/QnsComponents.java @@ -72,12 +72,6 @@ class QnsComponents { mCellularNetworkStatusTrackers.put( slotId, new CellularNetworkStatusTracker(mQnsTelephonyListeners.get(slotId), slotId)); - mCellularQualityMonitors.put( - slotId, - new CellularQualityMonitor(mContext, - mQnsCarrierConfigManagers.get(slotId), - mQnsTelephonyListeners.get(slotId), - slotId)); mQnsProvisioningListeners.put( slotId, new QnsProvisioningListener(mContext, mQnsImsManagers.get(slotId), slotId)); mQnsEventDispatchers.put( @@ -90,6 +84,12 @@ class QnsComponents { mQnsCarrierConfigManagers.put( slotId, new QnsCarrierConfigManager(mContext, mQnsEventDispatchers.get(slotId), slotId)); + mCellularQualityMonitors.put( + slotId, + new CellularQualityMonitor(mContext, + mQnsCarrierConfigManagers.get(slotId), + mQnsTelephonyListeners.get(slotId), + slotId)); if (mQnsTimer == null) { mQnsTimer = new QnsTimer(mContext); } @@ -266,6 +266,11 @@ class QnsComponents { mQnsTimer.close(); mQnsTimer = null; } + CellularQualityMonitor cellularQualityMonitor = mCellularQualityMonitors.get(slotId); + if (cellularQualityMonitor != null) { + mCellularQualityMonitors.remove(slotId); + cellularQualityMonitor.close(); + } QnsCarrierConfigManager qnsCarrierConfigManager = mQnsCarrierConfigManagers.get(slotId); if (qnsCarrierConfigManager != null) { mQnsCarrierConfigManagers.remove(slotId); @@ -281,11 +286,6 @@ class QnsComponents { mQnsProvisioningListeners.remove(slotId); qnsProvisioningListener.close(); } - CellularQualityMonitor cellularQualityMonitor = mCellularQualityMonitors.get(slotId); - if (cellularQualityMonitor != null) { - mCellularQualityMonitors.remove(slotId); - cellularQualityMonitor.close(); - } CellularNetworkStatusTracker cellularTracker = mCellularNetworkStatusTrackers.get(slotId); if (cellularTracker != null) { mCellularNetworkStatusTrackers.remove(slotId); -- cgit v1.2.3