From 4f3ac2fcbd733fcf96633ac610e403259c94666b Mon Sep 17 00:00:00 2001 From: tom hsu Date: Mon, 7 Jun 2021 16:47:39 +0800 Subject: [PATCH] [Settings] Resolves unsynced infomation between status bar and settings When activity go to background, the UI message shall be saved, and When activity is back to foreground, the UI shows previous state first. The situation make unsynced info between status bar and settings's page. Bug: 187091965 Test: Maunal Test Test: atest passed Change-Id: I7db2876e91c00126ebfa9dfa5b87d04c1f717e72 --- .../network/SubscriptionsPreferenceController.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/com/android/settings/network/SubscriptionsPreferenceController.java b/src/com/android/settings/network/SubscriptionsPreferenceController.java index 2d23f1f618e..3e568e9da26 100644 --- a/src/com/android/settings/network/SubscriptionsPreferenceController.java +++ b/src/com/android/settings/network/SubscriptionsPreferenceController.java @@ -38,6 +38,7 @@ import android.telephony.TelephonyDisplayInfo; import android.telephony.TelephonyManager; import android.text.Html; import android.util.ArraySet; +import android.util.Log; import androidx.annotation.VisibleForTesting; import androidx.collection.ArrayMap; @@ -196,6 +197,7 @@ public class SubscriptionsPreferenceController extends AbstractPreferenceControl mSignalStrengthListener.pause(); mTelephonyDisplayInfoListener.pause(); unRegisterReceiver(); + resetProviderPreferenceSummary(); } @Override @@ -275,6 +277,7 @@ public class SubscriptionsPreferenceController extends AbstractPreferenceControl String result = mSubsPrefCtrlInjector.getNetworkType( mContext, mConfig, mTelephonyDisplayInfo, subId, isActiveCarrierNetwork); if (mSubsPrefCtrlInjector.isActiveCellularNetwork(mContext) || isActiveCarrierNetwork) { + Log.i(TAG, "Active cellular network or active carrier network."); result = mContext.getString(R.string.preference_summary_default_combination, mContext.getString(R.string.mobile_data_connection_active), result); } else if (!isDataInService) { @@ -316,6 +319,13 @@ public class SubscriptionsPreferenceController extends AbstractPreferenceControl return icon; } + private void resetProviderPreferenceSummary() { + if (mSubsGearPref == null) { + return; + } + mSubsGearPref.setSummary(""); + } + private void updateForBase() { final Map existingPrefs = mSubscriptionPreferences; mSubscriptionPreferences = new ArrayMap<>();