From 62e934a039ddfa786811dabba4bd926d6b2ea7cb Mon Sep 17 00:00:00 2001 From: Bonian Chen Date: Tue, 28 Feb 2023 17:50:00 +0000 Subject: [PATCH] [Settings] Improve logging to support issue triage 1. Avoid from deprecated warning log 2. Add targetting subscription id into log Bug: 271126362 Test: local Change-Id: I6eac2032cc29b193dab009626a9824ee4fb451f5 --- .../network/MobileNetworkRepository.java | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/com/android/settings/network/MobileNetworkRepository.java b/src/com/android/settings/network/MobileNetworkRepository.java index 01c763f7c65..e483a4dbd52 100644 --- a/src/com/android/settings/network/MobileNetworkRepository.java +++ b/src/com/android/settings/network/MobileNetworkRepository.java @@ -125,7 +125,8 @@ public class MobileNetworkRepository extends SubscriptionManager.OnSubscriptions mContext = context; mMobileNetworkDatabase = MobileNetworkDatabase.getInstance(context); mMetricsFeatureProvider = FeatureFactory.getFactory(context).getMetricsFeatureProvider(); - mMetricsFeatureProvider.action(mContext, SettingsEnums.ACTION_MOBILE_NETWORK_DB_CREATED); + mMetricsFeatureProvider.action(mContext, SettingsEnums.ACTION_MOBILE_NETWORK_DB_CREATED, + subId); mSubscriptionManager = context.getSystemService(SubscriptionManager.class); mCallback = mobileNetworkCallback; mSubscriptionInfoDao = mMobileNetworkDatabase.mSubscriptionInfoDao(); @@ -327,7 +328,8 @@ public class MobileNetworkRepository extends SubscriptionManager.OnSubscriptions } } mMetricsFeatureProvider.action(mContext, - SettingsEnums.ACTION_MOBILE_NETWORK_DB_GET_UICC_INFO); + SettingsEnums.ACTION_MOBILE_NETWORK_DB_GET_UICC_INFO, + subInfo.getSubscriptionId()); } private void onAvailableSubInfoChanged( @@ -343,7 +345,7 @@ public class MobileNetworkRepository extends SubscriptionManager.OnSubscriptions } mCallback.onAvailableSubInfoChanged(availableSubInfoEntityList); mMetricsFeatureProvider.action(mContext, - SettingsEnums.ACTION_MOBILE_NETWORK_DB_NOTIFY_SUB_INFO_IS_CHANGED); + SettingsEnums.ACTION_MOBILE_NETWORK_DB_NOTIFY_SUB_INFO_IS_CHANGED, 0); setActiveSubInfoList(mActiveSubInfoEntityList); } @@ -359,7 +361,7 @@ public class MobileNetworkRepository extends SubscriptionManager.OnSubscriptions mUiccInfoEntityList = uiccInfoEntityList; mCallback.onAllUiccInfoChanged(uiccInfoEntityList); mMetricsFeatureProvider.action(mContext, - SettingsEnums.ACTION_MOBILE_NETWORK_DB_NOTIFY_UICC_INFO_IS_CHANGED); + SettingsEnums.ACTION_MOBILE_NETWORK_DB_NOTIFY_UICC_INFO_IS_CHANGED, 0); } private void onAllMobileNetworkInfoChanged( @@ -367,7 +369,7 @@ public class MobileNetworkRepository extends SubscriptionManager.OnSubscriptions mMobileNetworkInfoEntityList = mobileNetworkInfoEntityList; mCallback.onAllMobileNetworkInfoChanged(mobileNetworkInfoEntityList); mMetricsFeatureProvider.action(mContext, - SettingsEnums.ACTION_MOBILE_NETWORK_DB_NOTIFY_MOBILE_NETWORK_INFO_IS_CHANGED); + SettingsEnums.ACTION_MOBILE_NETWORK_DB_NOTIFY_MOBILE_NETWORK_INFO_IS_CHANGED, 0); } public void insertSubInfo(Context context, SubscriptionInfo info) { @@ -388,7 +390,7 @@ public class MobileNetworkRepository extends SubscriptionManager.OnSubscriptions insertUiccInfo(subId); insertMobileNetworkInfo(context, subId); mMetricsFeatureProvider.action(mContext, - SettingsEnums.ACTION_MOBILE_NETWORK_DB_INSERT_SUB_INFO); + SettingsEnums.ACTION_MOBILE_NETWORK_DB_INSERT_SUB_INFO, mSubId); } else if (DEBUG) { Log.d(TAG, "Can not insert subInfo, the entity is null"); } @@ -414,7 +416,7 @@ public class MobileNetworkRepository extends SubscriptionManager.OnSubscriptions sCacheUiccInfoEntityMap.remove(subId); sCacheMobileNetworkInfoEntityMap.remove(subId); mMetricsFeatureProvider.action(mContext, - SettingsEnums.ACTION_MOBILE_NETWORK_DB_DELETE_DATA); + SettingsEnums.ACTION_MOBILE_NETWORK_DB_DELETE_DATA, id); } public SubscriptionInfoEntity convertToSubscriptionInfoEntity(Context context, @@ -477,7 +479,8 @@ public class MobileNetworkRepository extends SubscriptionManager.OnSubscriptions sCacheUiccInfoEntityMap.put(subId, uiccInfoEntity); mMobileNetworkDatabase.insertUiccInfo(uiccInfoEntity); mMetricsFeatureProvider.action(mContext, - SettingsEnums.ACTION_MOBILE_NETWORK_DB_INSERT_UICC_INFO); + SettingsEnums.ACTION_MOBILE_NETWORK_DB_INSERT_UICC_INFO, + Integer.parseInt(subId)); } } @@ -491,7 +494,8 @@ public class MobileNetworkRepository extends SubscriptionManager.OnSubscriptions sCacheMobileNetworkInfoEntityMap.put(subId, mobileNetworkInfoEntity); mMobileNetworkDatabase.insertMobileNetworkInfo(mobileNetworkInfoEntity); mMetricsFeatureProvider.action(mContext, - SettingsEnums.ACTION_MOBILE_NETWORK_DB_INSERT_MOBILE_NETWORK_INFO); + SettingsEnums.ACTION_MOBILE_NETWORK_DB_INSERT_MOBILE_NETWORK_INFO, + Integer.parseInt(subId)); } }