Loading services/net/java/android/net/apf/ApfCapabilities.java +1 −1 Original line number Diff line number Diff line Loading @@ -46,7 +46,7 @@ public class ApfCapabilities { } public String toString() { return String.format("%s{version: %d, maxSize: %d format: %d}", getClass().getSimpleName(), return String.format("%s{version: %d, maxSize: %d, format: %d}", getClass().getSimpleName(), apfVersionSupported, maximumApfProgramSize, apfPacketFormat); } } services/net/java/android/net/ip/IpManager.java +29 −10 Original line number Diff line number Diff line Loading @@ -524,7 +524,7 @@ public class IpManager extends StateMachine { try { mNwService.registerObserver(mNetlinkTracker); } catch (RemoteException e) { Log.e(mTag, "Couldn't register NetlinkTracker: " + e.toString()); logError("Couldn't register NetlinkTracker: %s", e); } mMultinetworkPolicyTracker.start(); Loading Loading @@ -611,18 +611,35 @@ public class IpManager extends StateMachine { return; } // Thread-unsafe access to mApfFilter but just used for debugging. final ApfFilter apfFilter = mApfFilter; final ProvisioningConfiguration provisioningConfig = mConfiguration; final ApfCapabilities apfCapabilities = (provisioningConfig != null) ? provisioningConfig.mApfCapabilities : null; IndentingPrintWriter pw = new IndentingPrintWriter(writer, " "); pw.println(mTag + " APF dump:"); pw.increaseIndent(); // Thread-unsafe access to mApfFilter but just used for debugging. ApfFilter apfFilter = mApfFilter; if (apfFilter != null) { apfFilter.dump(pw); } else { pw.println("No apf support"); pw.print("No active ApfFilter; "); if (provisioningConfig == null) { pw.println("IpManager not yet started."); } else if (apfCapabilities == null || apfCapabilities.apfVersionSupported == 0) { pw.println("Hardware does not support APF."); } else { pw.println("ApfFilter not yet started, APF capabilities: " + apfCapabilities); } } pw.decreaseIndent(); pw.println(); pw.println(mTag + " current ProvisioningConfiguration:"); pw.increaseIndent(); pw.println(Objects.toString(provisioningConfig, "N/A")); pw.decreaseIndent(); pw.println(); pw.println(mTag + " StateMachine dump:"); pw.increaseIndent(); Loading Loading @@ -684,7 +701,9 @@ public class IpManager extends StateMachine { // TODO: Migrate all Log.e(...) to logError(...). private void logError(String fmt, Object... args) { mLocalLog.log("ERROR " + String.format(fmt, args)); final String msg = "ERROR " + String.format(fmt, args); Log.e(mTag, msg); mLocalLog.log(msg); } private void getNetworkInterface() { Loading @@ -692,7 +711,7 @@ public class IpManager extends StateMachine { mNetworkInterface = NetworkInterface.getByName(mInterfaceName); } catch (SocketException | NullPointerException e) { // TODO: throw new IllegalStateException. Log.e(mTag, "ALERT: Failed to get interface object: ", e); logError("Failed to get interface object: %s", e); } } Loading Loading @@ -948,7 +967,7 @@ public class IpManager extends StateMachine { ifcg.setLinkAddress(new LinkAddress("0.0.0.0/0")); mNwService.setInterfaceConfig(mInterfaceName, ifcg); } catch (IllegalStateException | RemoteException e) { Log.e(mTag, "ALERT: Failed to clear IPv4 address on interface " + mInterfaceName, e); logError("Failed to clear IPv4 address on interface %s: %s", mInterfaceName, e); } } Loading Loading @@ -1074,13 +1093,13 @@ public class IpManager extends StateMachine { try { mNwService.disableIpv6(mInterfaceName); } catch (Exception e) { Log.e(mTag, "Failed to disable IPv6" + e); logError("Failed to disable IPv6: %s", e); } try { mNwService.clearInterfaceAddresses(mInterfaceName); } catch (Exception e) { Log.e(mTag, "Failed to clear addresses " + e); logError("Failed to clear addresses: %s", e); } } Loading Loading @@ -1404,7 +1423,7 @@ public class IpManager extends StateMachine { if (setIPv4Address(ipAddress)) { mDhcpClient.sendMessage(DhcpClient.EVENT_LINKADDRESS_CONFIGURED); } else { Log.e(mTag, "Failed to set IPv4 address!"); logError("Failed to set IPv4 address."); dispatchCallback(ProvisioningChange.LOST_PROVISIONING, new LinkProperties(mLinkProperties)); transitionTo(mStoppingState); Loading services/net/java/android/net/util/ConnectivityPacketSummary.java +2 −2 Original line number Diff line number Diff line Loading @@ -368,9 +368,9 @@ public class ConnectivityPacketSummary { byte[] bytes = new byte[ETHER_ADDR_LEN]; mac.get(bytes, 0, bytes.length); Byte[] printableBytes = new Byte[bytes.length]; Object[] printableBytes = new Object[bytes.length]; int i = 0; for (byte b : bytes) printableBytes[i++] = b; for (byte b : bytes) printableBytes[i++] = new Byte(b); final String MAC48_FORMAT = "%02x:%02x:%02x:%02x:%02x:%02x"; return String.format(MAC48_FORMAT, printableBytes); Loading Loading
services/net/java/android/net/apf/ApfCapabilities.java +1 −1 Original line number Diff line number Diff line Loading @@ -46,7 +46,7 @@ public class ApfCapabilities { } public String toString() { return String.format("%s{version: %d, maxSize: %d format: %d}", getClass().getSimpleName(), return String.format("%s{version: %d, maxSize: %d, format: %d}", getClass().getSimpleName(), apfVersionSupported, maximumApfProgramSize, apfPacketFormat); } }
services/net/java/android/net/ip/IpManager.java +29 −10 Original line number Diff line number Diff line Loading @@ -524,7 +524,7 @@ public class IpManager extends StateMachine { try { mNwService.registerObserver(mNetlinkTracker); } catch (RemoteException e) { Log.e(mTag, "Couldn't register NetlinkTracker: " + e.toString()); logError("Couldn't register NetlinkTracker: %s", e); } mMultinetworkPolicyTracker.start(); Loading Loading @@ -611,18 +611,35 @@ public class IpManager extends StateMachine { return; } // Thread-unsafe access to mApfFilter but just used for debugging. final ApfFilter apfFilter = mApfFilter; final ProvisioningConfiguration provisioningConfig = mConfiguration; final ApfCapabilities apfCapabilities = (provisioningConfig != null) ? provisioningConfig.mApfCapabilities : null; IndentingPrintWriter pw = new IndentingPrintWriter(writer, " "); pw.println(mTag + " APF dump:"); pw.increaseIndent(); // Thread-unsafe access to mApfFilter but just used for debugging. ApfFilter apfFilter = mApfFilter; if (apfFilter != null) { apfFilter.dump(pw); } else { pw.println("No apf support"); pw.print("No active ApfFilter; "); if (provisioningConfig == null) { pw.println("IpManager not yet started."); } else if (apfCapabilities == null || apfCapabilities.apfVersionSupported == 0) { pw.println("Hardware does not support APF."); } else { pw.println("ApfFilter not yet started, APF capabilities: " + apfCapabilities); } } pw.decreaseIndent(); pw.println(); pw.println(mTag + " current ProvisioningConfiguration:"); pw.increaseIndent(); pw.println(Objects.toString(provisioningConfig, "N/A")); pw.decreaseIndent(); pw.println(); pw.println(mTag + " StateMachine dump:"); pw.increaseIndent(); Loading Loading @@ -684,7 +701,9 @@ public class IpManager extends StateMachine { // TODO: Migrate all Log.e(...) to logError(...). private void logError(String fmt, Object... args) { mLocalLog.log("ERROR " + String.format(fmt, args)); final String msg = "ERROR " + String.format(fmt, args); Log.e(mTag, msg); mLocalLog.log(msg); } private void getNetworkInterface() { Loading @@ -692,7 +711,7 @@ public class IpManager extends StateMachine { mNetworkInterface = NetworkInterface.getByName(mInterfaceName); } catch (SocketException | NullPointerException e) { // TODO: throw new IllegalStateException. Log.e(mTag, "ALERT: Failed to get interface object: ", e); logError("Failed to get interface object: %s", e); } } Loading Loading @@ -948,7 +967,7 @@ public class IpManager extends StateMachine { ifcg.setLinkAddress(new LinkAddress("0.0.0.0/0")); mNwService.setInterfaceConfig(mInterfaceName, ifcg); } catch (IllegalStateException | RemoteException e) { Log.e(mTag, "ALERT: Failed to clear IPv4 address on interface " + mInterfaceName, e); logError("Failed to clear IPv4 address on interface %s: %s", mInterfaceName, e); } } Loading Loading @@ -1074,13 +1093,13 @@ public class IpManager extends StateMachine { try { mNwService.disableIpv6(mInterfaceName); } catch (Exception e) { Log.e(mTag, "Failed to disable IPv6" + e); logError("Failed to disable IPv6: %s", e); } try { mNwService.clearInterfaceAddresses(mInterfaceName); } catch (Exception e) { Log.e(mTag, "Failed to clear addresses " + e); logError("Failed to clear addresses: %s", e); } } Loading Loading @@ -1404,7 +1423,7 @@ public class IpManager extends StateMachine { if (setIPv4Address(ipAddress)) { mDhcpClient.sendMessage(DhcpClient.EVENT_LINKADDRESS_CONFIGURED); } else { Log.e(mTag, "Failed to set IPv4 address!"); logError("Failed to set IPv4 address."); dispatchCallback(ProvisioningChange.LOST_PROVISIONING, new LinkProperties(mLinkProperties)); transitionTo(mStoppingState); Loading
services/net/java/android/net/util/ConnectivityPacketSummary.java +2 −2 Original line number Diff line number Diff line Loading @@ -368,9 +368,9 @@ public class ConnectivityPacketSummary { byte[] bytes = new byte[ETHER_ADDR_LEN]; mac.get(bytes, 0, bytes.length); Byte[] printableBytes = new Byte[bytes.length]; Object[] printableBytes = new Object[bytes.length]; int i = 0; for (byte b : bytes) printableBytes[i++] = b; for (byte b : bytes) printableBytes[i++] = new Byte(b); final String MAC48_FORMAT = "%02x:%02x:%02x:%02x:%02x:%02x"; return String.format(MAC48_FORMAT, printableBytes); Loading