Merge "Make IpNeighborMonitor#NeighborEvent member as public immutable."
diff --git a/staticlibs/netd/Android.bp b/staticlibs/netd/Android.bp
index a648941..79bde9b 100644
--- a/staticlibs/netd/Android.bp
+++ b/staticlibs/netd/Android.bp
@@ -53,14 +53,6 @@
min_sdk_version: "29",
}
-// TODO: delete this one when AOSP is no longer auto-merge to git_sc-mainline-prod.
-cc_library_static {
- name: "netd_aidl_interface-lateststable-cpp",
- whole_static_libs: [
- "netd_aidl_interface-V10-cpp",
- ],
-}
-
cc_defaults {
name: "netd_aidl_interface_lateststable_cpp_static",
static_libs: ["netd_aidl_interface-V10-cpp"],
diff --git a/staticlibs/tests/unit/src/com/android/testutils/DeviceInfoUtilsTest.java b/staticlibs/tests/unit/src/com/android/testutils/DeviceInfoUtilsTest.java
index 6f603d5..e46dd59 100644
--- a/staticlibs/tests/unit/src/com/android/testutils/DeviceInfoUtilsTest.java
+++ b/staticlibs/tests/unit/src/com/android/testutils/DeviceInfoUtilsTest.java
@@ -106,4 +106,18 @@
assertFalse(v1.isAtLeast(v4));
assertFalse(v1.isAtLeast(v5));
}
+
+ @Test
+ public void testKernelVersionIsAtLeast() {
+ // Pick a lower kernel version 4.0 which was released at April 2015, the kernel
+ // version running on all test devices nowadays should be higher than it.
+ assertTrue(DeviceInfoUtils.isKernelVersionAtLeast("4.0"));
+
+ // Invalid kernel version.
+ assertTrue(DeviceInfoUtils.isKernelVersionAtLeast("0.0.0"));
+
+ // Pick a higher kernel version which isn't released yet, comparison should return false.
+ // Need to update the target version in the future to make sure the test still passes.
+ assertFalse(DeviceInfoUtils.isKernelVersionAtLeast("20.0.0"));
+ }
}
diff --git a/staticlibs/testutils/devicetests/com/android/testutils/DeviceInfoUtils.java b/staticlibs/testutils/devicetests/com/android/testutils/DeviceInfoUtils.java
index 1925b55..ea89eda 100644
--- a/staticlibs/testutils/devicetests/com/android/testutils/DeviceInfoUtils.java
+++ b/staticlibs/testutils/devicetests/com/android/testutils/DeviceInfoUtils.java
@@ -16,6 +16,7 @@
package com.android.testutils;
+import android.os.VintfRuntimeInfo;
import android.text.TextUtils;
import android.util.Pair;
@@ -157,4 +158,18 @@
return new KVersion(0, 0, 0);
}
}
+
+ /**
+ * Check if the current kernel version is at least satisfied with the given version.
+ *
+ * @param version the start version to compare
+ * @return return true if the current version is at least satisfied with the given version.
+ * otherwise, return false.
+ */
+ public static boolean isKernelVersionAtLeast(final String version) {
+ final String kernelVersion = VintfRuntimeInfo.getKernelVersion();
+ final KVersion current = DeviceInfoUtils.getMajorMinorSubminorVersion(kernelVersion);
+ final KVersion from = DeviceInfoUtils.getMajorMinorSubminorVersion(version);
+ return current.isAtLeast(from);
+ }
}