diff options
author | Michael Plass <mplass@google.com> | 2017-02-07 16:39:17 -0800 |
---|---|---|
committer | Michael Plass <mplass@google.com> | 2017-02-08 13:54:07 -0800 |
commit | 7e7e2e3fd4da1f5ccda2f03dcdb321654e9f6ff8 (patch) | |
tree | 5afd948b4802cd418763afdec9e1bd8be0974747 /service | |
parent | 969f150805d1ee94038c8447fb52a7b841ce508b (diff) |
[WifiVendorHal] driver, firmware version getters
Test: Unit test passes
Bug: 34901572
Change-Id: I31a28965a8a57a886dc5934a285e471d3fd7c429
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/WifiVendorHal.java | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/service/java/com/android/server/wifi/WifiVendorHal.java b/service/java/com/android/server/wifi/WifiVendorHal.java index 03f0e2361..373afe26f 100644 --- a/service/java/com/android/server/wifi/WifiVendorHal.java +++ b/service/java/com/android/server/wifi/WifiVendorHal.java @@ -587,24 +587,48 @@ public class WifiVendorHal { throw new UnsupportedOperationException(); } - private String mDriverDescription; + private String mDriverDescription; // Cached value filled by requestChipDebugInfo() /** * Vendor-provided wifi driver version string */ public String getDriverVersion() { - kilroy(); - throw new UnsupportedOperationException(); + synchronized (sLock) { + if (mDriverDescription == null) requestChipDebugInfo(); + return mDriverDescription; + } } - private String mFirmwareDescription; + private String mFirmwareDescription; // Cached value filled by requestChipDebugInfo() /** * Vendor-provided wifi firmware version string */ public String getFirmwareVersion() { - kilroy(); - throw new UnsupportedOperationException(); + synchronized (sLock) { + if (mFirmwareDescription == null) requestChipDebugInfo(); + return mFirmwareDescription; + } + } + + /** + * Refreshes our idea of the driver and firmware versions + */ + private void requestChipDebugInfo() { + mDriverDescription = null; + mFirmwareDescription = null; + try { + if (mIWifiChip == null) return; + mIWifiChip.requestChipDebugInfo((status, chipDebugInfo) -> { + if (status.code != WifiStatusCode.SUCCESS) return; + mDriverDescription = chipDebugInfo.driverDescription; + mFirmwareDescription = chipDebugInfo.firmwareDescription; + }); + } catch (RemoteException e) { + handleRemoteException(e); + return; + } + Log.e(TAG, "Driver: " + mDriverDescription + " Firmware: " + mFirmwareDescription); } /** |