Use correct default subscription id to get default network template.

- when launching the app info page and no network template is defined in
the launch arguments, use the correct default data subscription id to
check whether mobile network template should be used or not.

Change-Id: If9341abf3416c775a2b7407c1d6d0b33f4aad67f
Fixes: 120098637
Test: make RunSettingsRoboTests
This commit is contained in:
Doris Ling
2019-01-30 16:39:29 -08:00
parent 6e54c774be
commit dddeb5f25e
2 changed files with 32 additions and 3 deletions

View File

@@ -26,6 +26,7 @@ import android.graphics.drawable.Drawable;
import android.net.NetworkTemplate;
import android.os.Bundle;
import android.os.UserHandle;
import android.telephony.SubscriptionManager;
import android.util.ArraySet;
import android.util.IconDrawableFactory;
import android.util.Log;
@@ -88,7 +89,8 @@ public class AppDataUsage extends DataUsageBaseFragment implements OnPreferenceC
private CycleAdapter mCycleAdapter;
private List<NetworkCycleDataForUid> mUsageData;
private NetworkTemplate mTemplate;
@VisibleForTesting
NetworkTemplate mTemplate;
private AppItem mAppItem;
private Intent mAppSettingsIntent;
private SpinnerPreference mCycle;
@@ -108,7 +110,7 @@ public class AppDataUsage extends DataUsageBaseFragment implements OnPreferenceC
: null;
if (mTemplate == null) {
mTemplate = DataUsageUtils.getDefaultTemplate(mContext,
DataUsageUtils.getDefaultSubscriptionId(mContext));
SubscriptionManager.getDefaultDataSubscriptionId());
}
if (mAppItem == null) {
int uid = (args != null) ? args.getInt(AppInfoBase.ARG_PACKAGE_UID, -1)