Loading src/com/android/settings/network/InternetPreferenceController.java +26 −11 Original line number Diff line number Diff line Loading @@ -101,7 +101,7 @@ public class InternetPreferenceController extends AbstractPreferenceController i mInternetUpdater = new InternetUpdater(context, lifecycle, this); mInternetType = mInternetUpdater.getInternetType(); mLifecycleOwner = lifecycleOwner; mMobileNetworkRepository = new MobileNetworkRepository(context, this); mMobileNetworkRepository = MobileNetworkRepository.create(context, this); lifecycle.addObserver(this); } Loading Loading @@ -163,7 +163,6 @@ public class InternetPreferenceController extends AbstractPreferenceController i /** @OnLifecycleEvent(ON_PAUSE) */ @OnLifecycleEvent(ON_PAUSE) public void onPause() { mMobileNetworkRepository.removeRegister(); mSummaryHelper.register(false); } Loading Loading @@ -203,22 +202,38 @@ public class InternetPreferenceController extends AbstractPreferenceController i @VisibleForTesting void updateCellularSummary() { CharSequence summary = null; for (SubscriptionInfoEntity subInfo : mSubInfoEntityList) { if (subInfo.isSubscriptionVisible && subInfo.isActiveDataSubscriptionId) { summary = subInfo.uniqueName; break; } else if (subInfo.isDefaultDataSubscription) { summary = mContext.getString( R.string.mobile_data_temp_using, subInfo.uniqueName); SubscriptionInfoEntity activeSubInfo = null; SubscriptionInfoEntity defaultSubInfo = null; for (SubscriptionInfoEntity subInfo : getSubscriptionInfoList()) { if (subInfo.isActiveDataSubscriptionId) { activeSubInfo = subInfo; } if (subInfo.isDefaultDataSubscription) { defaultSubInfo = subInfo; } if (summary == null) { } if (activeSubInfo == null) { return; } activeSubInfo = activeSubInfo.isSubscriptionVisible ? activeSubInfo : defaultSubInfo; if (activeSubInfo.equals(defaultSubInfo)) { // DDS is active summary = activeSubInfo.uniqueName; } else { summary = mContext.getString( R.string.mobile_data_temp_using, activeSubInfo.uniqueName); } mPreference.setSummary(summary); } @VisibleForTesting protected List<SubscriptionInfoEntity> getSubscriptionInfoList() { return mSubInfoEntityList; } @Override public void onAvailableSubInfoChanged(List<SubscriptionInfoEntity> subInfoEntityList) { if ((mSubInfoEntityList != null && Loading src/com/android/settings/network/MobileNetworkRepository.java +12 −3 Original line number Diff line number Diff line Loading @@ -93,10 +93,15 @@ public class MobileNetworkRepository extends SubscriptionManager.OnSubscriptions private boolean mIsRemovable = false; private boolean mIsActive = false; MobileNetworkRepository(Context context, MobileNetworkCallback mobileNetworkCallback) { public static MobileNetworkRepository create(Context context, MobileNetworkCallback mobileNetworkCallback) { return new MobileNetworkRepository(context, mobileNetworkCallback); } private MobileNetworkRepository(Context context, MobileNetworkCallback mobileNetworkCallback) { mContext = context; mCallback = mobileNetworkCallback; mMobileNetworkDatabase = MobileNetworkDatabase.createDatabase(context); mMobileNetworkDatabase = MobileNetworkDatabase.getInstance(context); mSubscriptionInfoDao = mMobileNetworkDatabase.mSubscriptionInfoDao(); mUiccInfoDao = mMobileNetworkDatabase.mUiccInfoDao(); mMobileNetworkInfoDao = mMobileNetworkDatabase.mMobileNetworkInfoDao(); Loading Loading @@ -194,6 +199,10 @@ public class MobileNetworkRepository extends SubscriptionManager.OnSubscriptions return mMobileNetworkInfoEntityList; } public SubscriptionInfoEntity getSubInfoById(String subId) { return mSubscriptionInfoDao.querySubInfoById(subId); } public int getSubInfosCount() { return mSubscriptionInfoDao.count(); } Loading Loading @@ -439,7 +448,7 @@ public class MobileNetworkRepository extends SubscriptionManager.OnSubscriptions * Callback for clients to get the latest info changes if the framework or content observers. * updates the relevant info. */ interface MobileNetworkCallback { public interface MobileNetworkCallback { void onAvailableSubInfoChanged(List<SubscriptionInfoEntity> subInfoEntityList); void onActiveSubInfoChanged(List<SubscriptionInfoEntity> subInfoEntityList); Loading src/com/android/settings/network/MobileNetworkSummaryController.java +1 −2 Original line number Diff line number Diff line Loading @@ -87,7 +87,7 @@ public class MobileNetworkSummaryController extends AbstractPreferenceController mMetricsFeatureProvider = FeatureFactory.getFactory(mContext).getMetricsFeatureProvider(); mUserManager = context.getSystemService(UserManager.class); mLifecycleOwner = lifecycleOwner; mMobileNetworkRepository = new MobileNetworkRepository(context, this); mMobileNetworkRepository = MobileNetworkRepository.create(context, this); if (lifecycle != null) { lifecycle.addObserver(this); } Loading @@ -101,7 +101,6 @@ public class MobileNetworkSummaryController extends AbstractPreferenceController @OnLifecycleEvent(ON_PAUSE) public void onPause() { mMobileNetworkRepository.removeRegister(); } @Override Loading src/com/android/settings/network/NetworkProviderCallsSmsController.java +1 −2 Original line number Diff line number Diff line Loading @@ -71,7 +71,7 @@ public class NetworkProviderCallsSmsController extends AbstractPreferenceControl mIsRtlMode = context.getResources().getConfiguration().getLayoutDirection() == View.LAYOUT_DIRECTION_RTL; mLifecycleOwner = lifecycleOwner; mMobileNetworkRepository = new MobileNetworkRepository(context, this); mMobileNetworkRepository = MobileNetworkRepository.create(context, this); if (lifecycle != null) { lifecycle.addObserver(this); } Loading @@ -85,7 +85,6 @@ public class NetworkProviderCallsSmsController extends AbstractPreferenceControl @OnLifecycleEvent(Event.ON_PAUSE) public void onPause() { mMobileNetworkRepository.removeRegister(); } @Override Loading src/com/android/settings/network/NetworkProviderDownloadedSimListController.java +1 −1 Original line number Diff line number Diff line Loading @@ -72,7 +72,7 @@ public class NetworkProviderDownloadedSimListController extends mSubscriptionManager = context.getSystemService(SubscriptionManager.class); mPreferences = new ArrayMap<>(); mLifecycleOwner = lifecycleOwner; mMobileNetworkRepository = new MobileNetworkRepository(context, this); mMobileNetworkRepository = MobileNetworkRepository.create(context, this); lifecycle.addObserver(this); } Loading Loading
src/com/android/settings/network/InternetPreferenceController.java +26 −11 Original line number Diff line number Diff line Loading @@ -101,7 +101,7 @@ public class InternetPreferenceController extends AbstractPreferenceController i mInternetUpdater = new InternetUpdater(context, lifecycle, this); mInternetType = mInternetUpdater.getInternetType(); mLifecycleOwner = lifecycleOwner; mMobileNetworkRepository = new MobileNetworkRepository(context, this); mMobileNetworkRepository = MobileNetworkRepository.create(context, this); lifecycle.addObserver(this); } Loading Loading @@ -163,7 +163,6 @@ public class InternetPreferenceController extends AbstractPreferenceController i /** @OnLifecycleEvent(ON_PAUSE) */ @OnLifecycleEvent(ON_PAUSE) public void onPause() { mMobileNetworkRepository.removeRegister(); mSummaryHelper.register(false); } Loading Loading @@ -203,22 +202,38 @@ public class InternetPreferenceController extends AbstractPreferenceController i @VisibleForTesting void updateCellularSummary() { CharSequence summary = null; for (SubscriptionInfoEntity subInfo : mSubInfoEntityList) { if (subInfo.isSubscriptionVisible && subInfo.isActiveDataSubscriptionId) { summary = subInfo.uniqueName; break; } else if (subInfo.isDefaultDataSubscription) { summary = mContext.getString( R.string.mobile_data_temp_using, subInfo.uniqueName); SubscriptionInfoEntity activeSubInfo = null; SubscriptionInfoEntity defaultSubInfo = null; for (SubscriptionInfoEntity subInfo : getSubscriptionInfoList()) { if (subInfo.isActiveDataSubscriptionId) { activeSubInfo = subInfo; } if (subInfo.isDefaultDataSubscription) { defaultSubInfo = subInfo; } if (summary == null) { } if (activeSubInfo == null) { return; } activeSubInfo = activeSubInfo.isSubscriptionVisible ? activeSubInfo : defaultSubInfo; if (activeSubInfo.equals(defaultSubInfo)) { // DDS is active summary = activeSubInfo.uniqueName; } else { summary = mContext.getString( R.string.mobile_data_temp_using, activeSubInfo.uniqueName); } mPreference.setSummary(summary); } @VisibleForTesting protected List<SubscriptionInfoEntity> getSubscriptionInfoList() { return mSubInfoEntityList; } @Override public void onAvailableSubInfoChanged(List<SubscriptionInfoEntity> subInfoEntityList) { if ((mSubInfoEntityList != null && Loading
src/com/android/settings/network/MobileNetworkRepository.java +12 −3 Original line number Diff line number Diff line Loading @@ -93,10 +93,15 @@ public class MobileNetworkRepository extends SubscriptionManager.OnSubscriptions private boolean mIsRemovable = false; private boolean mIsActive = false; MobileNetworkRepository(Context context, MobileNetworkCallback mobileNetworkCallback) { public static MobileNetworkRepository create(Context context, MobileNetworkCallback mobileNetworkCallback) { return new MobileNetworkRepository(context, mobileNetworkCallback); } private MobileNetworkRepository(Context context, MobileNetworkCallback mobileNetworkCallback) { mContext = context; mCallback = mobileNetworkCallback; mMobileNetworkDatabase = MobileNetworkDatabase.createDatabase(context); mMobileNetworkDatabase = MobileNetworkDatabase.getInstance(context); mSubscriptionInfoDao = mMobileNetworkDatabase.mSubscriptionInfoDao(); mUiccInfoDao = mMobileNetworkDatabase.mUiccInfoDao(); mMobileNetworkInfoDao = mMobileNetworkDatabase.mMobileNetworkInfoDao(); Loading Loading @@ -194,6 +199,10 @@ public class MobileNetworkRepository extends SubscriptionManager.OnSubscriptions return mMobileNetworkInfoEntityList; } public SubscriptionInfoEntity getSubInfoById(String subId) { return mSubscriptionInfoDao.querySubInfoById(subId); } public int getSubInfosCount() { return mSubscriptionInfoDao.count(); } Loading Loading @@ -439,7 +448,7 @@ public class MobileNetworkRepository extends SubscriptionManager.OnSubscriptions * Callback for clients to get the latest info changes if the framework or content observers. * updates the relevant info. */ interface MobileNetworkCallback { public interface MobileNetworkCallback { void onAvailableSubInfoChanged(List<SubscriptionInfoEntity> subInfoEntityList); void onActiveSubInfoChanged(List<SubscriptionInfoEntity> subInfoEntityList); Loading
src/com/android/settings/network/MobileNetworkSummaryController.java +1 −2 Original line number Diff line number Diff line Loading @@ -87,7 +87,7 @@ public class MobileNetworkSummaryController extends AbstractPreferenceController mMetricsFeatureProvider = FeatureFactory.getFactory(mContext).getMetricsFeatureProvider(); mUserManager = context.getSystemService(UserManager.class); mLifecycleOwner = lifecycleOwner; mMobileNetworkRepository = new MobileNetworkRepository(context, this); mMobileNetworkRepository = MobileNetworkRepository.create(context, this); if (lifecycle != null) { lifecycle.addObserver(this); } Loading @@ -101,7 +101,6 @@ public class MobileNetworkSummaryController extends AbstractPreferenceController @OnLifecycleEvent(ON_PAUSE) public void onPause() { mMobileNetworkRepository.removeRegister(); } @Override Loading
src/com/android/settings/network/NetworkProviderCallsSmsController.java +1 −2 Original line number Diff line number Diff line Loading @@ -71,7 +71,7 @@ public class NetworkProviderCallsSmsController extends AbstractPreferenceControl mIsRtlMode = context.getResources().getConfiguration().getLayoutDirection() == View.LAYOUT_DIRECTION_RTL; mLifecycleOwner = lifecycleOwner; mMobileNetworkRepository = new MobileNetworkRepository(context, this); mMobileNetworkRepository = MobileNetworkRepository.create(context, this); if (lifecycle != null) { lifecycle.addObserver(this); } Loading @@ -85,7 +85,6 @@ public class NetworkProviderCallsSmsController extends AbstractPreferenceControl @OnLifecycleEvent(Event.ON_PAUSE) public void onPause() { mMobileNetworkRepository.removeRegister(); } @Override Loading
src/com/android/settings/network/NetworkProviderDownloadedSimListController.java +1 −1 Original line number Diff line number Diff line Loading @@ -72,7 +72,7 @@ public class NetworkProviderDownloadedSimListController extends mSubscriptionManager = context.getSystemService(SubscriptionManager.class); mPreferences = new ArrayMap<>(); mLifecycleOwner = lifecycleOwner; mMobileNetworkRepository = new MobileNetworkRepository(context, this); mMobileNetworkRepository = MobileNetworkRepository.create(context, this); lifecycle.addObserver(this); } Loading