Merge "Add helper function to check that the Hostapd HAL implements a minimum service version." into main
diff --git a/service/java/com/android/server/wifi/HostapdHalAidlImp.java b/service/java/com/android/server/wifi/HostapdHalAidlImp.java
index 76f48b5..f8c0791 100644
--- a/service/java/com/android/server/wifi/HostapdHalAidlImp.java
+++ b/service/java/com/android/server/wifi/HostapdHalAidlImp.java
@@ -91,6 +91,7 @@
     private Set<String> mActiveInstances = new HashSet<>();
     private HostapdDeathEventHandler mDeathEventHandler;
     private boolean mServiceDeclared = false;
+    private int mServiceVersion;
     private CountDownLatch mWaitForDeathLatch;
 
     /**
@@ -462,6 +463,14 @@
     }
 
     /**
+     * Check that the service is running at least the expected version. Use to avoid the case where
+     * the framework is using a newer interface version than the service.
+     */
+    private boolean isServiceVersionAtLeast(int expectedVersion) {
+        return expectedVersion <= mServiceVersion;
+    }
+
+    /**
      * Wrapper functions created to be mockable in unit tests
      */
     @VisibleForTesting
@@ -501,7 +510,8 @@
             Log.i(TAG, "Local Version: " + IHostapd.VERSION);
 
             try {
-                Log.i(TAG, "Remote Version: " + mIHostapd.getInterfaceVersion());
+                mServiceVersion = mIHostapd.getInterfaceVersion();
+                Log.i(TAG, "Remote Version: " + mServiceVersion);
                 IBinder serviceBinder = getServiceBinderMockable();
                 if (serviceBinder == null) return false;
                 mWaitForDeathLatch = null;