From ef98fa2b5c5f63371c7b6b4356187240e19c20a8 Mon Sep 17 00:00:00 2001 From: Aaron Huang Date: Wed, 18 Mar 2020 23:27:55 +0800 Subject: 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 --- service/java/com/android/server/wifi/ClientModeImpl.java | 8 ++++---- 1 file 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( -- cgit v1.2.3