Update datausage for DataUsagePreferenceController

Data usage number was wrong because we didn't set correct
subId, this CL fixes this issue.

Bug: 132113657
Test: RunSettingsRoboTests
Change-Id: If7c9cf2f4709d9a8e5f9a154c02de9484800d6d5
This commit is contained in:
Lei Yu
2019-05-06 16:35:19 -07:00
parent 65a258e2a2
commit 9bc3273489
3 changed files with 13 additions and 14 deletions

View File

@@ -178,9 +178,10 @@ public final class DataUsageUtils {
* Returns the default network template based on the availability of mobile data, Wifi. Returns
* ethernet template if both mobile data and Wifi are not available.
*/
static NetworkTemplate getDefaultTemplate(Context context, int defaultSubId) {
public static NetworkTemplate getDefaultTemplate(Context context, int defaultSubId) {
if (hasMobileData(context) && defaultSubId != SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
TelephonyManager telephonyManager = TelephonyManager.from(context);
TelephonyManager telephonyManager = TelephonyManager.from(context)
.createForSubscriptionId(defaultSubId);
NetworkTemplate mobileAll = NetworkTemplate.buildTemplateMobileAll(
telephonyManager.getSubscriberId(defaultSubId));
return NetworkTemplate.normalize(mobileAll,