Reduce the flakiness of carrier privileges check
Monitoring carrier config change broadcast and then checking carrier privileges status is racy. The component that updates CP status (e.g. CarrierPrivilegeTracker) may monitor the same broadcast and the status check result will be determined by the fact who received it firstly. This CL moves the CP check after the current sleep to reduce the flakiness to unblock the CP migration. The follow CL (aosp/1971439) will throughly resolve the flakiness by the the help of CarrierPrivilegesListener. Bug: 217557996 Test: atest android.net.cts.ConnectivityDiagnosticsManagerTest Change-Id: Ib1ab554732b6bb25426a07a42043801a2d05c546
This commit is contained in:
parent
445dede4eb
commit
4d64bd6b2a
1 changed files with 8 additions and 3 deletions
|
|
@ -278,18 +278,23 @@ public class ConnectivityDiagnosticsManagerTest {
|
|||
|
||||
assertTrue("Didn't receive broadcast for ACTION_CARRIER_CONFIG_CHANGED for subId=" + subId,
|
||||
carrierConfigReceiver.waitForCarrierConfigChanged());
|
||||
assertTrue("Don't have Carrier Privileges after adding cert for this package",
|
||||
mTelephonyManager.createForSubscriptionId(subId).hasCarrierPrivileges());
|
||||
|
||||
// Wait for CarrierPrivilegesTracker to receive the ACTION_CARRIER_CONFIG_CHANGED
|
||||
// broadcast. CPT then needs to update the corresponding DataConnection, which then
|
||||
// updates ConnectivityService. Unfortunately, this update to the NetworkCapabilities in
|
||||
// CS does not trigger NetworkCallback#onCapabilitiesChanged as changing the
|
||||
// administratorUids is not a publicly visible change. In lieu of a better signal to
|
||||
// detministically wait for, use Thread#sleep here.
|
||||
// deterministically wait for, use Thread#sleep here.
|
||||
// TODO(b/157949581): replace this Thread#sleep with a deterministic signal
|
||||
Thread.sleep(DELAY_FOR_ADMIN_UIDS_MILLIS);
|
||||
|
||||
// TODO(b/217559768): Receiving carrier config change and immediately checking carrier
|
||||
// privileges is racy, as the CP status is updated after receiving the same signal. Move
|
||||
// the CP check after sleep to temporarily reduce the flakiness. This will soon be fixed
|
||||
// by switching to CarrierPrivilegesListener.
|
||||
assertTrue("Don't have Carrier Privileges after adding cert for this package",
|
||||
mTelephonyManager.createForSubscriptionId(subId).hasCarrierPrivileges());
|
||||
|
||||
final TestConnectivityDiagnosticsCallback connDiagsCallback =
|
||||
createAndRegisterConnectivityDiagnosticsCallback(CELLULAR_NETWORK_REQUEST);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue