赞
踩
android11和安卓低版本一样固定WIFI热点路由器IP 的路径不同
这个是在 android11上的修改:
--- a/frameworks/base/packages/Tethering/src/android/net/ip/IpServer.java
+++ b/frameworks/base/packages/Tethering/src/android/net/ip/IpServer.java
- @@ -110,6 +110,7 @@ public class IpServer extends StateMachine {
-
- // TODO: have PanService use some visible version of this constant
- private static final String BLUETOOTH_IFACE_ADDR = "192.168.44.1/24";
- + private static final LinkAddress WIFI_HOST_IFACE_ADDR = new LinkAddress("192.168.43.1/24");
-
- // TODO: have this configurable
- private static final int DHCP_LEASE_TIME_SECS = 3600;
- @@ -597,7 +598,8 @@ public class IpServer extends StateMachine {
- if (VDBG) Log.d(TAG, "configureIPv4(" + enabled + ")");
-
- if (enabled) {
- - mIpv4Address = requestIpv4Address();
- + // mIpv4Address = requestIpv4Address();
- + mIpv4Address = WIFI_HOST_IFACE_ADDR;
- }
-
- if (mIpv4Address == null) {
android 9修改路径frameworks/base/services/core/java/com/android/server/connectivity/tethering/TetherInterfaceStateMachine.java
- private boolean configureIPv4(boolean enabled) {
- if (VDBG) Log.d(TAG, "configureIPv4(" + enabled + ")");
-
- // TODO: Replace this hard-coded information with dynamically selected
- // config passed down to us by a higher layer IP-coordinating element.
- String ipAsString = null;
- int prefixLen = 0;
- if (mInterfaceType == ConnectivityManager.TETHERING_USB) {
- ipAsString = USB_NEAR_IFACE_ADDR;
- prefixLen = USB_PREFIX_LENGTH;
- } else if (mInterfaceType == ConnectivityManager.TETHERING_WIFI) {
- ipAsString = getRandomWifiIPv4Address();
- //ip固定设置为192.168.43.1
- ipAsString = "192.168.43.1";
- prefixLen = WIFI_HOST_IFACE_PREFIX_LENGTH;
- } else {
- // Nothing to do, BT does this elsewhere.
- return true;
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。