Pass bluetoothUseRandomAddress via RoutingCoordinator constructor
This refactoring changes how the bluetoothUseRandomAddress flag is accessed. PrivateAddressCoordinator is in a library used by multiple mainline modules(Tethering, NetworkStack, CaptivePortal, WiFi) and cannot directly read a Tethering mainline beta flag. To fix this, the flag's value is now passed down through constructors. An alternative solution would be to split the Java library for each module, but with this solution, a single utility class cannot be shared. This commit is a no-op as the passed value is hardcoded to false. Test: TH Flag: EXEMPT refactor Bug: 287177081 Change-Id: I5f2174ee94b55e7a7298b9742221d6e6c3c5cac5
This commit is contained in:
parent
767436932a
commit
323d22a497
2 changed files with 50 additions and 31 deletions
|
|
@ -96,7 +96,13 @@ public final class PrivateAddressCoordinatorTest {
|
|||
mMobileNetwork2, mMobileNetwork3, mMobileNetwork4, mMobileNetwork5, mMobileNetwork6};
|
||||
|
||||
private PrivateAddressCoordinator makePrivateAddressCoordinator() {
|
||||
return spy(new PrivateAddressCoordinator(mConnectivityMgr::getAllNetworks, mDeps));
|
||||
return makePrivateAddressCoordinator(false);
|
||||
}
|
||||
|
||||
private PrivateAddressCoordinator makePrivateAddressCoordinator(
|
||||
boolean bluetoothTetheringUseRandomAddress) {
|
||||
return spy(new PrivateAddressCoordinator(
|
||||
mConnectivityMgr::getAllNetworks, mDeps, bluetoothTetheringUseRandomAddress));
|
||||
}
|
||||
|
||||
private void setUpIpServer(IpServer ipServer, int interfaceType) throws Exception {
|
||||
|
|
@ -352,8 +358,8 @@ public final class PrivateAddressCoordinatorTest {
|
|||
|
||||
@Test
|
||||
public void testBluetoothPrefix_legacy() throws Exception {
|
||||
when(mDeps.shouldBluetoothUseRandomAddress()).thenReturn(false);
|
||||
mPrivateAddressCoordinator = makePrivateAddressCoordinator();
|
||||
mPrivateAddressCoordinator =
|
||||
makePrivateAddressCoordinator(false /* bluetoothTetheringUseRandomAddress */);
|
||||
final LinkAddress bluetoothAddress = requestStickyDownstreamAddress(mBluetoothIpServer,
|
||||
CONNECTIVITY_SCOPE_GLOBAL);
|
||||
assertEquals(mLegacyBluetoothAddress, bluetoothAddress);
|
||||
|
|
@ -361,8 +367,8 @@ public final class PrivateAddressCoordinatorTest {
|
|||
|
||||
@Test
|
||||
public void testBluetoothPrefix_randomized() throws Exception {
|
||||
when(mDeps.shouldBluetoothUseRandomAddress()).thenReturn(true);
|
||||
mPrivateAddressCoordinator = makePrivateAddressCoordinator();
|
||||
mPrivateAddressCoordinator =
|
||||
makePrivateAddressCoordinator(true /* bluetoothTetheringUseRandomAddress */);
|
||||
final LinkAddress bluetoothAddress = requestStickyDownstreamAddress(mBluetoothIpServer,
|
||||
CONNECTIVITY_SCOPE_GLOBAL);
|
||||
assertNotEquals(mLegacyBluetoothAddress, bluetoothAddress);
|
||||
|
|
|
|||
|
|
@ -544,7 +544,8 @@ public class TetheringTest {
|
|||
RoutingCoordinatorService service = new RoutingCoordinatorService(
|
||||
getINetd(context, log),
|
||||
cm::getAllNetworks,
|
||||
mPrivateAddressCoordinatorDependencies);
|
||||
mPrivateAddressCoordinatorDependencies,
|
||||
false /* bluetoothTetheringUseRandomAddress */);
|
||||
mRoutingCoordinatorManager = spy(new RoutingCoordinatorManager(context, service));
|
||||
return mRoutingCoordinatorManager;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue