Revert "[Thread] post broacast receivers on the handler thread"

This reverts commit f8aaac0dd0.

Reason for revert: see b/350586929

Change-Id: I34f3a87664992e5324f89bcf49e56707d0143743
This commit is contained in:
Kangping Dong 2024-07-10 08:45:09 +00:00 • committed by Gerrit Code Review
commit 65b4f5fa53
3 changed files with 11 additions and 6 deletions

View file

@ -523,10 +523,12 @@ final class ThreadNetworkControllerService extends IThreadNetworkController.Stub
new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
mHandler.post(() -> onUserRestrictionsChanged(isThreadUserRestricted()));
onUserRestrictionsChanged(isThreadUserRestricted());
}
},
new IntentFilter(UserManager.ACTION_USER_RESTRICTIONS_CHANGED));
new IntentFilter(UserManager.ACTION_USER_RESTRICTIONS_CHANGED),
null /* broadcastPermission */,
mHandler);
}
private void onUserRestrictionsChanged(boolean newUserRestrictedState) {
@ -578,10 +580,12 @@ final class ThreadNetworkControllerService extends IThreadNetworkController.Stub
new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
mHandler.post(() -> onAirplaneModeChanged(isAirplaneModeOn()));
onAirplaneModeChanged(isAirplaneModeOn());
}
},
new IntentFilter(Intent.ACTION_AIRPLANE_MODE_CHANGED));
new IntentFilter(Intent.ACTION_AIRPLANE_MODE_CHANGED),
null /* broadcastPermission */,
mHandler);
}
private void onAirplaneModeChanged(boolean newAirplaneModeOn) {

View file

@ -45,7 +45,6 @@ import static com.google.common.util.concurrent.MoreExecutors.directExecutor;
import static org.junit.Assert.assertThrows;
import static org.junit.Assert.fail;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import android.content.Context;

View file

@ -539,7 +539,9 @@ public final class ThreadNetworkControllerServiceTest {
.when(mContext)
.registerReceiver(
any(BroadcastReceiver.class),
argThat(actualIntentFilter -> actualIntentFilter.hasAction(action)));
argThat(actualIntentFilter -> actualIntentFilter.hasAction(action)),
any(),
any());
return receiverRef;
}