Synchronize getScanCapabilities() with other commands

This is required to ensure that only one HAL command is
issued at a time by the framework.

Bug: 22480212
Change-Id: Iaf4bf7cf4c34f8804bf4522e96cb7a1903f41cf3
diff --git a/service/java/com/android/server/wifi/WifiNative.java b/service/java/com/android/server/wifi/WifiNative.java
index b859bc7..c33b232 100644
--- a/service/java/com/android/server/wifi/WifiNative.java
+++ b/service/java/com/android/server/wifi/WifiNative.java
@@ -1331,8 +1331,10 @@
         public int  max_significant_wifi_change_aps;
     }
 
-    public static boolean getScanCapabilities(ScanCapabilities capabilities) {
-        return getScanCapabilitiesNative(sWlan0Index, capabilities);
+    synchronized public static boolean getScanCapabilities(ScanCapabilities capabilities) {
+        synchronized (mLock) {
+            return isHalStarted() && getScanCapabilitiesNative(sWlan0Index, capabilities);
+        }
     }
 
     private static native boolean getScanCapabilitiesNative(