Merge "BroadcastInterceptingContext: use passed-in broadcast Handler."
This commit is contained in:
@@ -4987,9 +4987,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
||||
private BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
// TODO: make BroadcastInterceptingContext use the Handler passed in to registerReceiver
|
||||
// and put this back.
|
||||
// ensureRunningOnConnectivityServiceThread();
|
||||
ensureRunningOnConnectivityServiceThread();
|
||||
final String action = intent.getAction();
|
||||
final int userId = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, UserHandle.USER_NULL);
|
||||
|
||||
|
||||
@@ -1300,10 +1300,8 @@ public class ConnectivityServiceTest {
|
||||
}
|
||||
|
||||
private void processBroadcastForVpn(Intent intent) {
|
||||
// The BroadcastReceiver for this broadcast checks it is being run on the handler thread.
|
||||
final Handler handler = new Handler(mVMSHandlerThread.getLooper());
|
||||
handler.post(() -> mServiceContext.sendBroadcast(intent));
|
||||
HandlerUtils.waitForIdle(handler, TIMEOUT_MS);
|
||||
mServiceContext.sendBroadcast(intent);
|
||||
HandlerUtils.waitForIdle(mVMSHandlerThread, TIMEOUT_MS);
|
||||
waitForIdle();
|
||||
}
|
||||
|
||||
@@ -1430,6 +1428,7 @@ public class ConnectivityServiceTest {
|
||||
FakeSettingsProvider.clearSettingsProvider();
|
||||
mServiceContext = new MockContext(InstrumentationRegistry.getContext(),
|
||||
new FakeSettingsProvider());
|
||||
mServiceContext.setUseRegisteredHandlers(true);
|
||||
LocalServices.removeServiceForTest(NetworkPolicyManagerInternal.class);
|
||||
LocalServices.addService(
|
||||
NetworkPolicyManagerInternal.class, mock(NetworkPolicyManagerInternal.class));
|
||||
|
||||
Reference in New Issue
Block a user