Merge "Address comments from aosp/1298476" am: 72b4ffad5c am: eb276cb5b3

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1340040

Change-Id: I7b119758ac7cd65defdec77692957287af17566d
This commit is contained in:
Aaron Huang
2020-06-18 10:47:47 +00:00
committed by Automerger Merge Worker
2 changed files with 9 additions and 7 deletions

View File

@@ -442,7 +442,7 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
handlerThread.start(); handlerThread.start();
mHandler = new NetworkStatsHandler(handlerThread.getLooper()); mHandler = new NetworkStatsHandler(handlerThread.getLooper());
mNetworkStatsSubscriptionsMonitor = deps.makeSubscriptionsMonitor(mContext, mNetworkStatsSubscriptionsMonitor = deps.makeSubscriptionsMonitor(mContext,
new HandlerExecutor(mHandler), this); mHandler.getLooper(), new HandlerExecutor(mHandler), this);
mContentResolver = mContext.getContentResolver(); mContentResolver = mContext.getContentResolver();
mContentObserver = mDeps.makeContentObserver(mHandler, mSettings, mContentObserver = mDeps.makeContentObserver(mHandler, mSettings,
mNetworkStatsSubscriptionsMonitor); mNetworkStatsSubscriptionsMonitor);
@@ -468,11 +468,12 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
*/ */
@NonNull @NonNull
public NetworkStatsSubscriptionsMonitor makeSubscriptionsMonitor(@NonNull Context context, public NetworkStatsSubscriptionsMonitor makeSubscriptionsMonitor(@NonNull Context context,
@NonNull Executor executor, @NonNull NetworkStatsService service) { @NonNull Looper looper, @NonNull Executor executor,
@NonNull NetworkStatsService service) {
// TODO: Update RatType passively in NSS, instead of querying into the monitor // TODO: Update RatType passively in NSS, instead of querying into the monitor
// when forceUpdateIface. // when forceUpdateIface.
return new NetworkStatsSubscriptionsMonitor(context, executor, (subscriberId, type) -> return new NetworkStatsSubscriptionsMonitor(context, looper, executor,
service.handleOnCollapsedRatTypeChanged()); (subscriberId, type) -> service.handleOnCollapsedRatTypeChanged());
} }
/** /**

View File

@@ -20,6 +20,7 @@ import static android.net.NetworkTemplate.getCollapsedRatType;
import android.annotation.NonNull; import android.annotation.NonNull;
import android.content.Context; import android.content.Context;
import android.os.Looper;
import android.telephony.Annotation; import android.telephony.Annotation;
import android.telephony.PhoneStateListener; import android.telephony.PhoneStateListener;
import android.telephony.ServiceState; import android.telephony.ServiceState;
@@ -75,9 +76,9 @@ public class NetworkStatsSubscriptionsMonitor extends
@NonNull @NonNull
private final Executor mExecutor; private final Executor mExecutor;
NetworkStatsSubscriptionsMonitor(@NonNull Context context, @NonNull Executor executor, NetworkStatsSubscriptionsMonitor(@NonNull Context context, @NonNull Looper looper,
@NonNull Delegate delegate) { @NonNull Executor executor, @NonNull Delegate delegate) {
super(); super(looper);
mSubscriptionManager = (SubscriptionManager) context.getSystemService( mSubscriptionManager = (SubscriptionManager) context.getSystemService(
Context.TELEPHONY_SUBSCRIPTION_SERVICE); Context.TELEPHONY_SUBSCRIPTION_SERVICE);
mTeleManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); mTeleManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);