diff options
author | Aaron Huang <huangaaron@google.com> | 2020-03-18 23:27:55 +0800 |
---|---|---|
committer | Aaron Huang <huangaaron@google.com> | 2020-03-19 00:01:57 +0800 |
commit | ef98fa2b5c5f63371c7b6b4356187240e19c20a8 (patch) | |
tree | d3124b391d316f7f8cbca75f0f23481a3f628be6 | |
parent | caf73afd677addbf0fc2172e8446562dfcc5db13 (diff) |
API review: use getter to access field
Fields in KeepalivePacketData and InvalidPacketException are
changed to private and add setter/getter as API.
Bug: 151322799
Test: atest FrameworksNetTests
atest FrameworksWifiTests
atest FrameworksTelephonyTests: some failure in CarrierAppUtilsTest
Change-Id: Id7609f2f577947909b010e7b667eaf0abfc5d917
-rw-r--r-- | service/java/com/android/server/wifi/ClientModeImpl.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/service/java/com/android/server/wifi/ClientModeImpl.java b/service/java/com/android/server/wifi/ClientModeImpl.java index 5da041f8b..a669c0752 100644 --- a/service/java/com/android/server/wifi/ClientModeImpl.java +++ b/service/java/com/android/server/wifi/ClientModeImpl.java @@ -1366,7 +1366,7 @@ public class ClientModeImpl extends StateMachine { throws InvalidPacketException { try { InetAddress gateway = NetUtils.selectBestRoute( - mLinkProperties.getRoutes(), packetData.dstAddress).getGateway(); + mLinkProperties.getRoutes(), packetData.getDstAddress()).getGateway(); String dstMacStr = macAddressFromRoute(gateway.getHostAddress()); return NativeUtil.macAddressToByteArray(dstMacStr); } catch (NullPointerException | IllegalArgumentException e) { @@ -1376,9 +1376,9 @@ public class ClientModeImpl extends StateMachine { private static int getEtherProtoForKeepalive(KeepalivePacketData packetData) throws InvalidPacketException { - if (packetData.dstAddress instanceof Inet4Address) { + if (packetData.getDstAddress() instanceof Inet4Address) { return OsConstants.ETH_P_IP; - } else if (packetData.dstAddress instanceof Inet6Address) { + } else if (packetData.getDstAddress() instanceof Inet6Address) { return OsConstants.ETH_P_IPV6; } else { throw new InvalidPacketException(InvalidPacketException.ERROR_INVALID_IP_ADDRESS); @@ -1396,7 +1396,7 @@ public class ClientModeImpl extends StateMachine { dstMac = getDstMacForKeepalive(packetData); proto = getEtherProtoForKeepalive(packetData); } catch (InvalidPacketException e) { - return e.error; + return e.getError(); } int ret = mWifiNative.startSendingOffloadedPacket( |