Don't enable DscpPolicyTracker on pre-T devices.

The code cannot work before T because before T the tethering
module can only load BPF programs/maps into /sys/fs/tethering/bpf
and the system server cannot access that directory.

Additionally, this is causing unit tests to fail on pre-T devices
because on those devices the seccomp filter blocks the bpf
syscall from apps (including Java tests).

Test: revert aosp/1907693 and atest FrameworksNetTests:ConnectivityServiceTest
Change-Id: I6c398031dffb840da1d723b11ea4d0845ad6c6f2
This commit is contained in:
Lorenzo Colitti
2022-01-27 23:02:59 +09:00
parent 82ed9e6058
commit debd9eaffa

View File

@@ -1495,7 +1495,14 @@ public class ConnectivityService extends IConnectivityManager.Stub
mLingerDelayMs, mQosCallbackTracker, mDeps);
try {
mDscpPolicyTracker = new DscpPolicyTracker();
// DscpPolicyTracker cannot run on S because on S the tethering module can only load
// BPF programs/maps into /sys/fs/tethering/bpf, which the system server cannot access.
// Even if it could, running on S would at least require mocking out the BPF map,
// otherwise the unit tests will fail on pre-T devices where the seccomp filter blocks
// the bpf syscall. http://aosp/1907693
if (SdkLevel.isAtLeastT()) {
mDscpPolicyTracker = new DscpPolicyTracker();
}
} catch (ErrnoException e) {
loge("Unable to create DscpPolicyTracker");
}