From 259cc5ad4505b658447c542df81474b7889bb8d6 Mon Sep 17 00:00:00 2001 From: Gabriel Biren Date: Fri, 21 Feb 2025 00:37:23 +0000 Subject: Add a method to check whether mainline supplicant is available. Bug: 365585450 Flag: com.android.wifi.flags.mainline_supplicant Test: Manual test - verify that the method returns true under the appropriate conditions Change-Id: I8c3ac30b2dfa8b9d8aeb2444673b55b3df0f9dd6 --- framework/java/android/net/wifi/util/Environment.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'framework/java') diff --git a/framework/java/android/net/wifi/util/Environment.java b/framework/java/android/net/wifi/util/Environment.java index f98265845a..a20b24744d 100644 --- a/framework/java/android/net/wifi/util/Environment.java +++ b/framework/java/android/net/wifi/util/Environment.java @@ -45,6 +45,12 @@ public class Environment { private static final String WIFI_APEX_PATH = new File("/apex", WIFI_APEX_NAME).getAbsolutePath(); + /** + * Path to the mainline supplicant binary. + */ + private static final String MAINLINE_SUPPLICANT_BINARY_PATH = + WIFI_APEX_PATH + "/bin/wpa_supplicant_mainline"; + /** * Wifi shared folder. */ @@ -68,6 +74,13 @@ public class Environment { return appInfo.sourceDir.startsWith(WIFI_APEX_PATH); } + /** + * Returns true if the mainline supplicant binary is in the Wifi Apex. + */ + public static boolean isMainlineSupplicantBinaryInWifiApex() { + return new File(MAINLINE_SUPPLICANT_BINARY_PATH).isFile(); + } + /** * Return whether the VNDK version of the vendor partition is newer than the given API level. * If the property is set to non-integer value, this means the vendor partition is using -- cgit v1.2.3-59-g8ed1b