Merge "Address comments from aosp/1298476"

This commit is contained in:
Aaron Huang
2020-06-18 10:18:57 +00:00
committed by Gerrit Code Review
2 changed files with 9 additions and 7 deletions

View File

@@ -442,7 +442,7 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
handlerThread.start();
mHandler = new NetworkStatsHandler(handlerThread.getLooper());
mNetworkStatsSubscriptionsMonitor = deps.makeSubscriptionsMonitor(mContext,
new HandlerExecutor(mHandler), this);
mHandler.getLooper(), new HandlerExecutor(mHandler), this);
mContentResolver = mContext.getContentResolver();
mContentObserver = mDeps.makeContentObserver(mHandler, mSettings,
mNetworkStatsSubscriptionsMonitor);
@@ -468,11 +468,12 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
*/
@NonNull
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
// when forceUpdateIface.
return new NetworkStatsSubscriptionsMonitor(context, executor, (subscriberId, type) ->
service.handleOnCollapsedRatTypeChanged());
return new NetworkStatsSubscriptionsMonitor(context, looper, executor,
(subscriberId, type) -> service.handleOnCollapsedRatTypeChanged());
}
/**

View File

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