[MS39.1] Remove the looper from NetworkStatsSubscriptionMonitor
OnSubscriptionsChangedListenerHandler(Looper looper) is hidden, there is no way to pass a looper to it in the test. This change partially revert aosp/1340040 to fix hidden API dependency. And will use a different approach to address this problem in later stages. Test: atest NetworkStatsSubscriptionMonitorTest Bug: 204830222 Bug: 213280079 Change-Id: I429be3578d599de9a5a3f78b02387c20744b37d3
This commit is contained in:
@@ -448,7 +448,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,
|
||||||
mHandler.getLooper(), new HandlerExecutor(mHandler), this);
|
new HandlerExecutor(mHandler), this);
|
||||||
mContentResolver = mContext.getContentResolver();
|
mContentResolver = mContext.getContentResolver();
|
||||||
mContentObserver = mDeps.makeContentObserver(mHandler, mSettings,
|
mContentObserver = mDeps.makeContentObserver(mHandler, mSettings,
|
||||||
mNetworkStatsSubscriptionsMonitor);
|
mNetworkStatsSubscriptionsMonitor);
|
||||||
@@ -474,11 +474,10 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
|
|||||||
*/
|
*/
|
||||||
@NonNull
|
@NonNull
|
||||||
public NetworkStatsSubscriptionsMonitor makeSubscriptionsMonitor(@NonNull Context context,
|
public NetworkStatsSubscriptionsMonitor makeSubscriptionsMonitor(@NonNull Context context,
|
||||||
@NonNull Looper looper, @NonNull Executor executor,
|
@NonNull Executor executor, @NonNull NetworkStatsService service) {
|
||||||
@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 notifyNetworkStatus.
|
// when notifyNetworkStatus.
|
||||||
return new NetworkStatsSubscriptionsMonitor(context, looper, executor,
|
return new NetworkStatsSubscriptionsMonitor(context, executor,
|
||||||
(subscriberId, type) -> service.handleOnCollapsedRatTypeChanged());
|
(subscriberId, type) -> service.handleOnCollapsedRatTypeChanged());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ 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.NetworkRegistrationInfo;
|
import android.telephony.NetworkRegistrationInfo;
|
||||||
import android.telephony.PhoneStateListener;
|
import android.telephony.PhoneStateListener;
|
||||||
@@ -79,9 +78,9 @@ public class NetworkStatsSubscriptionsMonitor extends
|
|||||||
@NonNull
|
@NonNull
|
||||||
private final Executor mExecutor;
|
private final Executor mExecutor;
|
||||||
|
|
||||||
NetworkStatsSubscriptionsMonitor(@NonNull Context context, @NonNull Looper looper,
|
NetworkStatsSubscriptionsMonitor(@NonNull Context context,
|
||||||
@NonNull Executor executor, @NonNull Delegate delegate) {
|
@NonNull Executor executor, @NonNull Delegate delegate) {
|
||||||
super(looper);
|
super();
|
||||||
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);
|
||||||
|
|||||||
Reference in New Issue
Block a user