diff options
author | Ahmed ElArabawy <arabawy@google.com> | 2018-05-23 14:23:59 -0700 |
---|---|---|
committer | Ahmed ElArabawy <arabawy@google.com> | 2018-06-08 09:54:13 -0700 |
commit | 1b8216207b5ab9c5cc64932c9c731843fe819539 (patch) | |
tree | 2bf15db585e7f0944ded23628938bbb4c6660af5 | |
parent | 7db85489ea6deb3658ed6fc4895622e7a5ec3b18 (diff) |
WiFi: SAR: Cleanup dead code
In previous commits, new SAR functionality was added to support
handling of the SAR sensor. As part of the migration towards the new
functionality, some old code was kept.
This commit removes this old code (currently unused).
Bug: 65174506
Test: Run Wifi unit test suite
Test: ./frameworks/opt/net/wifi/tests/wifitests/runtests.sh
Change-Id: I2f9a789f0ae464e812c87a7c3c02c1955333a7a1
Signed-off-by: Ahmed ElArabawy <arabawy@google.com>
3 files changed, 0 insertions, 148 deletions
diff --git a/service/java/com/android/server/wifi/WifiNative.java b/service/java/com/android/server/wifi/WifiNative.java index 5369b0e1e..bc599c141 100644 --- a/service/java/com/android/server/wifi/WifiNative.java +++ b/service/java/com/android/server/wifi/WifiNative.java @@ -2820,30 +2820,6 @@ public class WifiNative { } /** - * TODO: These constants will be removed in a future change - * They are left for the interim use - * - * Tx power level scenarios that can be selected. - */ - public static final int TX_POWER_SCENARIO_NORMAL = 0; - public static final int TX_POWER_SCENARIO_VOICE_CALL = 1; - - /** - * TODO: This method is deprecated and will be removed in a future change to use - * the interface with sarInfo as an input instead. - * - * Select one of the pre-configured TX power level scenarios or reset it back to normal. - * Primarily used for meeting SAR requirements during voice calls. - * - * @param scenario Should be one {@link #TX_POWER_SCENARIO_NORMAL} or - * {@link #TX_POWER_SCENARIO_VOICE_CALL}. - * @return true for success; false for failure or if the HAL version does not support this API. - */ - public boolean selectTxPowerScenario(int scenario) { - return mWifiVendorHal.selectTxPowerScenario(scenario); - } - - /** * Select one of the pre-configured transmit power level scenarios or reset it back to normal. * Primarily used for meeting SAR requirements. * diff --git a/service/java/com/android/server/wifi/WifiVendorHal.java b/service/java/com/android/server/wifi/WifiVendorHal.java index fdbd97fb0..361387e2f 100644 --- a/service/java/com/android/server/wifi/WifiVendorHal.java +++ b/service/java/com/android/server/wifi/WifiVendorHal.java @@ -2653,56 +2653,6 @@ public class WifiVendorHal { return android.hardware.wifi.V1_2.IWifiStaIface.castFrom(iface); } - /* TODO: This method is to be removed in a future change */ - private int frameworkToHalTxPowerScenario(int scenario) { - switch (scenario) { - case WifiNative.TX_POWER_SCENARIO_VOICE_CALL: - return android.hardware.wifi.V1_1.IWifiChip.TxPowerScenario.VOICE_CALL; - default: - throw new IllegalArgumentException("bad scenario: " + scenario); - } - } - - /** - * TODO: This method will be removed in a future change - * It will be replaced with another method receiving SarInfo - * instance instead of the int for scenario - * - * Select one of the pre-configured TX power level scenarios or reset it back to normal. - * Primarily used for meeting SAR requirements during voice calls. - * - * @param scenario Should be one {@link WifiNative#TX_POWER_SCENARIO_NORMAL} or - * {@link WifiNative#TX_POWER_SCENARIO_VOICE_CALL}. - * @return true for success; false for failure or if the HAL version does not support this API. - */ - public boolean selectTxPowerScenario(int scenario) { - synchronized (sLock) { - try { - android.hardware.wifi.V1_1.IWifiChip iWifiChipV11 = getWifiChipForV1_1Mockable(); - if (iWifiChipV11 == null) return boolResult(false); - WifiStatus status; - if (scenario != WifiNative.TX_POWER_SCENARIO_NORMAL) { - int halScenario; - try { - halScenario = frameworkToHalTxPowerScenario(scenario); - } catch (IllegalArgumentException e) { - mLog.err("Illegal argument for select tx power scenario") - .c(e.toString()).flush(); - return false; - } - status = iWifiChipV11.selectTxPowerScenario(halScenario); - } else { - status = iWifiChipV11.resetTxPowerScenario(); - } - if (!ok(status)) return false; - } catch (RemoteException e) { - handleRemoteException(e); - return false; - } - return true; - } - } - /** * sarPowerBackoffRequired_1_1() * This method checks if we need to backoff wifi Tx power due to SAR requirements. diff --git a/tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java b/tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java index 60b5f81ad..fc030b83c 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java @@ -2000,80 +2000,6 @@ public class WifiVendorHalTest { } /** - * TODO: This test will be removed in a following change - * It is going to be replaced by another test using the new structure - * - * Test the new selectTxPowerScenario HIDL method invocation. This should return failure if the - * HAL service is exposing the 1.0 interface. - */ - @Test - public void testSelectTxPowerScenario_old() throws RemoteException { - assertTrue(mWifiVendorHal.startVendorHalSta()); - // Should fail because we exposed the 1.0 IWifiChip. - assertFalse( - mWifiVendorHal.selectTxPowerScenario(WifiNative.TX_POWER_SCENARIO_VOICE_CALL)); - verify(mIWifiChipV11, never()).selectTxPowerScenario(anyInt()); - mWifiVendorHal.stopVendorHal(); - - // Now expose the 1.1 IWifiChip. - mWifiVendorHal = new WifiVendorHalSpyV1_1(mHalDeviceManager, mLooper.getLooper()); - when(mIWifiChipV11.selectTxPowerScenario(anyInt())).thenReturn(mWifiStatusSuccess); - - assertTrue(mWifiVendorHal.startVendorHalSta()); - assertTrue( - mWifiVendorHal.selectTxPowerScenario(WifiNative.TX_POWER_SCENARIO_VOICE_CALL)); - verify(mIWifiChipV11).selectTxPowerScenario( - eq(android.hardware.wifi.V1_1.IWifiChip.TxPowerScenario.VOICE_CALL)); - verify(mIWifiChipV11, never()).resetTxPowerScenario(); - mWifiVendorHal.stopVendorHal(); - } - - /** - * TODO: This test will be removed in a following change - * It is going to be replaced by another test using the new structure - * - * Test the new resetTxPowerScenario HIDL method invocation. This should return failure if the - * HAL service is exposing the 1.0 interface. - */ - @Test - public void testResetTxPowerScenario_old() throws RemoteException { - assertTrue(mWifiVendorHal.startVendorHalSta()); - // Should fail because we exposed the 1.0 IWifiChip. - assertFalse(mWifiVendorHal.selectTxPowerScenario(WifiNative.TX_POWER_SCENARIO_NORMAL)); - verify(mIWifiChipV11, never()).resetTxPowerScenario(); - mWifiVendorHal.stopVendorHal(); - - // Now expose the 1.1 IWifiChip. - mWifiVendorHal = new WifiVendorHalSpyV1_1(mHalDeviceManager, mLooper.getLooper()); - when(mIWifiChipV11.resetTxPowerScenario()).thenReturn(mWifiStatusSuccess); - - assertTrue(mWifiVendorHal.startVendorHalSta()); - assertTrue(mWifiVendorHal.selectTxPowerScenario(WifiNative.TX_POWER_SCENARIO_NORMAL)); - verify(mIWifiChipV11).resetTxPowerScenario(); - verify(mIWifiChipV11, never()).selectTxPowerScenario(anyInt()); - mWifiVendorHal.stopVendorHal(); - } - - /** - * TODO: This test will be removed in a following change - * It is going to be replaced by another test using the new structure - * - * Test the new selectTxPowerScenario HIDL method invocation with a bad scenario index. - */ - @Test - public void testInvalidSelectTxPowerScenario_old() throws RemoteException { - // Expose the 1.1 IWifiChip. - mWifiVendorHal = new WifiVendorHalSpyV1_1(mHalDeviceManager, mLooper.getLooper()); - when(mIWifiChipV11.selectTxPowerScenario(anyInt())).thenReturn(mWifiStatusSuccess); - - assertTrue(mWifiVendorHal.startVendorHalSta()); - assertFalse(mWifiVendorHal.selectTxPowerScenario(-6)); - verify(mIWifiChipV11, never()).selectTxPowerScenario(anyInt()); - verify(mIWifiChipV11, never()).resetTxPowerScenario(); - mWifiVendorHal.stopVendorHal(); - } - - /** * Test the selectTxPowerScenario HIDL method invocation for 1.0 interface. * This should return failure since SAR is not supported for this interface version. */ |