[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
This commit is contained in:
tom hsu
2021-06-07 16:47:39 +08:00
parent 787685b2cc
commit 4f3ac2fcbd

View File

@@ -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<Integer, Preference> existingPrefs = mSubscriptionPreferences;
mSubscriptionPreferences = new ArrayMap<>();