Merge "Use beta flag for bluetoothTetheringRandomizedAddress" into main

This commit is contained in:
Motomu Utsumi 2025-07-17 15:35:10 -07:00 • committed by Android (Google) Code Review
commit 5286486f3b
6 changed files with 36 additions and 2 deletions

View file

@ -37,6 +37,23 @@ java_aconfig_library {
],
}
aconfig_declarations {
name: "tethering.mainline.beta.flags",
package: "com.android.tethering.mainline.beta",
container: "com.android.tethering",
srcs: ["mainline_beta.aconfig"],
}
java_aconfig_library {
name: "com.android.tethering.mainline.beta.flags-aconfig-java",
aconfig_declarations: "tethering.mainline.beta.flags",
defaults: ["framework-minus-apex-aconfig-java-defaults"],
min_sdk_version: "30",
apex_available: [
"com.android.tethering",
],
}
aconfig_declarations {
name: "com.android.net.flags-aconfig",
package: "com.android.net.flags",

View file

@ -0,0 +1,9 @@
package: "com.android.tethering.mainline.beta"
container: "com.android.tethering"
flag {
name: "bluetooth_tethering_randomized_address"
namespace: "com_android_tethering"
description: "bluetooth tethering use randomized address"
bug: "287177081"
}

View file

@ -189,6 +189,7 @@ java_library {
// in framework-connectivity
"android.net.platform.flags-aconfig-java-export",
"androidx.annotation_annotation",
"com.android.tethering.mainline.beta.flags-aconfig-java",
"connectivity-net-module-utils-bpf",
"connectivity_native_aidl_interface-lateststable-java",
"dnsresolver_aidl_interface-V16-java",

View file

@ -2023,8 +2023,8 @@ public class ConnectivityService extends IConnectivityManager.Stub
* The flag value can change at runtime via a server push.
*/
public boolean shouldBluetoothTetheringUseRandomAddress() {
// TODO: add a mainline beta flag to enable the new behaviour.
return SdkLevel.isAtLeastT() && false;
return SdkLevel.isAtLeastT() &&
com.android.tethering.mainline.beta.Flags.bluetoothTetheringRandomizedAddress();
}
}

View file

@ -2432,6 +2432,11 @@ public class ConnectivityServiceTest {
public L2capNetworkProvider makeL2capNetworkProvider(Context context) {
return null;
}
@Override
public boolean shouldBluetoothTetheringUseRandomAddress() {
return false;
}
}
static class PermissionMonitorDependencies extends PermissionMonitor.Dependencies {

View file

@ -538,6 +538,8 @@ open class CSTest {
netlinkMessageUpdate = consumer
return ConnectivityService.AddressUpdateMonitor(h, log, tag, consumer)
}
override fun shouldBluetoothTetheringUseRandomAddress() = false
}
inner class PermDeps : PermissionMonitor.Dependencies() {