Merge "Never interact with "phone" while holding locks." into pi-dev

am: d101084db7

Change-Id: I570994cd8ab5c7499dfa94b17e42687181637de0
This commit is contained in:
Jeff Sharkey
2018-04-19 20:00:48 -07:00
committed by android-build-merger

View File

@@ -116,7 +116,6 @@ import android.provider.Settings;
import android.provider.Settings.Global; import android.provider.Settings.Global;
import android.service.NetworkInterfaceProto; import android.service.NetworkInterfaceProto;
import android.service.NetworkStatsServiceDumpProto; import android.service.NetworkStatsServiceDumpProto;
import android.telephony.SubscriptionManager;
import android.telephony.SubscriptionPlan; import android.telephony.SubscriptionPlan;
import android.telephony.TelephonyManager; import android.telephony.TelephonyManager;
import android.text.format.DateUtils; import android.text.format.DateUtils;
@@ -678,22 +677,12 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
private SubscriptionPlan resolveSubscriptionPlan(NetworkTemplate template, int flags) { private SubscriptionPlan resolveSubscriptionPlan(NetworkTemplate template, int flags) {
SubscriptionPlan plan = null; SubscriptionPlan plan = null;
if ((flags & NetworkStatsManager.FLAG_AUGMENT_WITH_SUBSCRIPTION_PLAN) != 0 if ((flags & NetworkStatsManager.FLAG_AUGMENT_WITH_SUBSCRIPTION_PLAN) != 0
&& (template.getMatchRule() == NetworkTemplate.MATCH_MOBILE)
&& mSettings.getAugmentEnabled()) { && mSettings.getAugmentEnabled()) {
if (LOGD) Slog.d(TAG, "Resolving plan for " + template); if (LOGD) Slog.d(TAG, "Resolving plan for " + template);
final long token = Binder.clearCallingIdentity(); final long token = Binder.clearCallingIdentity();
try { try {
final SubscriptionManager sm = mContext.getSystemService(SubscriptionManager.class); plan = LocalServices.getService(NetworkPolicyManagerInternal.class)
final TelephonyManager tm = mContext.getSystemService(TelephonyManager.class); .getSubscriptionPlan(template);
for (int subId : sm.getActiveSubscriptionIdList()) {
if (template.matchesSubscriberId(tm.getSubscriberId(subId))) {
if (LOGD) Slog.d(TAG, "Found active matching subId " + subId);
final List<SubscriptionPlan> plans = sm.getSubscriptionPlans(subId);
if (!plans.isEmpty()) {
plan = plans.get(0);
}
}
}
} finally { } finally {
Binder.restoreCallingIdentity(token); Binder.restoreCallingIdentity(token);
} }