Loading src/com/android/settings/datausage/DataUsageList.java +13 −6 Original line number Diff line number Diff line Loading @@ -165,11 +165,7 @@ public class DataUsageList extends DataUsageBaseFragment } processArgument(); mMobileNetworkRepository = MobileNetworkRepository.getInstance(getContext()); ThreadUtils.postOnBackgroundThread(() -> { mSubscriptionInfoEntity = mMobileNetworkRepository.getSubInfoById( String.valueOf(mSubId)); }); updateSubscriptionInfoEntity(); mDataStateListener = new MobileDataEnabledListener(activity, this); } Loading Loading @@ -294,6 +290,15 @@ public class DataUsageList extends DataUsageBaseFragment } } @VisibleForTesting void updateSubscriptionInfoEntity() { mMobileNetworkRepository = MobileNetworkRepository.getInstance(getContext()); ThreadUtils.postOnBackgroundThread(() -> { mSubscriptionInfoEntity = mMobileNetworkRepository.getSubInfoById( String.valueOf(mSubId)); }); } /** * Implementation of {@code MobileDataEnabledListener.Client} */ Loading Loading @@ -503,11 +508,13 @@ public class DataUsageList extends DataUsageBaseFragment Collections.sort(items); final List<String> packageNames = Arrays.asList(getContext().getResources().getStringArray( R.array.datausage_hiding_carrier_service_package_names)); // When there is no specified SubscriptionInfo, Wi-Fi data usage will be displayed. // In this case, the carrier service package also needs to be hidden. boolean shouldHidePackageName = mSubscriptionInfoEntity != null ? Arrays.stream(getContext().getResources().getIntArray( R.array.datausage_hiding_carrier_service_carrier_id)) .anyMatch(carrierId -> (carrierId == mSubscriptionInfoEntity.carrierId)) : false; : true; for (int i = 0; i < items.size(); i++) { UidDetail detail = mUidDetailProvider.getUidDetail(items.get(i).key, true); Loading tests/robotests/src/com/android/settings/datausage/DataUsageListTest.java +1 −0 Original line number Diff line number Diff line Loading @@ -106,6 +106,7 @@ public class DataUsageListTest { ReflectionHelpers.setField(mDataUsageList, "services", mNetworkServices); doReturn(mLoaderManager).when(mDataUsageList).getLoaderManager(); mDataUsageList.mLoadingViewController = mock(LoadingViewController.class); doNothing().when(mDataUsageList).updateSubscriptionInfoEntity(); } @Test Loading Loading
src/com/android/settings/datausage/DataUsageList.java +13 −6 Original line number Diff line number Diff line Loading @@ -165,11 +165,7 @@ public class DataUsageList extends DataUsageBaseFragment } processArgument(); mMobileNetworkRepository = MobileNetworkRepository.getInstance(getContext()); ThreadUtils.postOnBackgroundThread(() -> { mSubscriptionInfoEntity = mMobileNetworkRepository.getSubInfoById( String.valueOf(mSubId)); }); updateSubscriptionInfoEntity(); mDataStateListener = new MobileDataEnabledListener(activity, this); } Loading Loading @@ -294,6 +290,15 @@ public class DataUsageList extends DataUsageBaseFragment } } @VisibleForTesting void updateSubscriptionInfoEntity() { mMobileNetworkRepository = MobileNetworkRepository.getInstance(getContext()); ThreadUtils.postOnBackgroundThread(() -> { mSubscriptionInfoEntity = mMobileNetworkRepository.getSubInfoById( String.valueOf(mSubId)); }); } /** * Implementation of {@code MobileDataEnabledListener.Client} */ Loading Loading @@ -503,11 +508,13 @@ public class DataUsageList extends DataUsageBaseFragment Collections.sort(items); final List<String> packageNames = Arrays.asList(getContext().getResources().getStringArray( R.array.datausage_hiding_carrier_service_package_names)); // When there is no specified SubscriptionInfo, Wi-Fi data usage will be displayed. // In this case, the carrier service package also needs to be hidden. boolean shouldHidePackageName = mSubscriptionInfoEntity != null ? Arrays.stream(getContext().getResources().getIntArray( R.array.datausage_hiding_carrier_service_carrier_id)) .anyMatch(carrierId -> (carrierId == mSubscriptionInfoEntity.carrierId)) : false; : true; for (int i = 0; i < items.size(); i++) { UidDetail detail = mUidDetailProvider.getUidDetail(items.get(i).key, true); Loading
tests/robotests/src/com/android/settings/datausage/DataUsageListTest.java +1 −0 Original line number Diff line number Diff line Loading @@ -106,6 +106,7 @@ public class DataUsageListTest { ReflectionHelpers.setField(mDataUsageList, "services", mNetworkServices); doReturn(mLoaderManager).when(mDataUsageList).getLoaderManager(); mDataUsageList.mLoadingViewController = mock(LoadingViewController.class); doNothing().when(mDataUsageList).updateSubscriptionInfoEntity(); } @Test Loading