Merge "Address comments from aosp/1298476" am: 72b4ffad5c am: eb276cb5b3 am: e9d35cc556 am: 15156482c4 am: 101911a85a

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

Change-Id: I29d735d0edb861fc154568aaf0e63a4ae2f9b441
This commit is contained in:
Aaron Huang
2020-06-18 11:25:23 +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();
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);