Closed matze10000 closed 11 months ago
Could you please provide more details such as:
Sorry for the late reply. The test device is a Pixel 3 XL with Android 11. Test app is a fresh current React-Native version 0.71.10 with "@react-native-tethering/wifi": "^1.0.0" and "react-native-wifi-reborn": "^4.8.3" to test against.
After successful connection, the following code is no longer called, (no Error logs, the Connection is successful) :
await TetheringManager.connectToLocalNetwork({ ssid: 'XXX', password: 'XXX', isHidden: false, }); ToastAndroid.show('WiFi Connected', ToastAndroid.SHORT); //never executed console.log('WiFi Connected'); //never executed
Can you test it on another phone which running Android 11 or above and let me know?
I could now test with a Pixel 6 / Android 13. There the problem does not occur, the following code is executed. The problem still exists with Pixel 3 XL with Android 11.
target wifi: WiFi-Repeater1
adb log:
06-20 15:29:09.562 1497 1891 D WifiConfigStore: Writing to stores completed in 7 ms.
06-20 15:29:09.563 1497 1837 D WifiMemoryStoreImpl: Remove cluster G345309e5bcbf0f04: SUCCESS deleted: 2
06-20 15:29:09.570 1497 1891 D SupplicantStaIfaceHal: Remove cached HAL data for config id 186
06-20 15:29:09.579 1497 1891 D WifiConfigStore: Writing to stores completed in 4 ms.
06-20 15:29:08.388 1497 1910 D ConnectivityService: NetReassign [no changes]
06-20 15:29:09.584 1497 1837 D ConnectivityService: requestNetwork for uid/pid:10353/24519 NetworkRequest [ REQUEST id=8156, [ Transports: WIFI Capabilities: NOT_RESTRICTED&TRUSTED&NOT_VPN Specifier: <WifiNetworkSpecifier [, SSID Match pattern=PatternMatcher{LITERAL: WiFi-Repeater1}, BSSID Match pattern=Pair{00:23:13:05:8b:be ff:ff:ff:ff:ff:ff}, SSID="WiFi-Repeater1", BSSID=00:23:13:05:8b:be]> Uid: 10353 AdministratorUids: [] RequestorUid: 10353 RequestorPackageName: com.wifi_tether] ]
06-20 15:29:09.584 1497 1910 D ConnectivityService: NetReassign [no changes]
06-20 15:29:09.585 1497 1891 D UntrustedWifiNetworkFactory: got request NetworkRequest [ REQUEST id=8156, [ Transports: WIFI Capabilities: NOT_RESTRICTED&TRUSTED&NOT_VPN Specifier: <WifiNetworkSpecifier [, SSID Match pattern=PatternMatcher{LITERAL: WiFi-Repeater1}, BSSID Match pattern=Pair{00:23:13:05:8b:be ff:ff:ff:ff:ff:ff}, SSID="WiFi-Repeater1", BSSID=00:23:13:05:8b:be]> Uid: 10353 AdministratorUids: [] RequestorUid: 10353 RequestorPackageName: com.wifi_tether] ] with score 0 and providerId 0
06-20 15:29:09.585 1497 1941 D Ethernet: got request NetworkRequest [ REQUEST id=8156, [ Transports: WIFI Capabilities: NOT_RESTRICTED&TRUSTED&NOT_VPN Specifier: <WifiNetworkSpecifier [, SSID Match pattern=PatternMatcher{LITERAL: WiFi-Repeater1}, BSSID Match pattern=Pair{00:23:13:05:8b:be ff:ff:ff:ff:ff:ff}, SSID="WiFi-Repeater1", BSSID=00:23:13:05:8b:be]> Uid: 10353 AdministratorUids: [] RequestorUid: 10353 RequestorPackageName: com.wifi_tether] ] with score 0 and providerId 0
06-20 15:29:09.585 1497 1940 D WIFI_AWARE_FACTORY: got request NetworkRequest [ REQUEST id=8156, [ Transports: WIFI Capabilities: NOT_RESTRICTED&TRUSTED&NOT_VPN Specifier: <WifiNetworkSpecifier [, SSID Match pattern=PatternMatcher{LITERAL: WiFi-Repeater1}, BSSID Match pattern=Pair{00:23:13:05:8b:be ff:ff:ff:ff:ff:ff}, SSID="WiFi-Repeater1", BSSID=00:23:13:05:8b:be]> Uid: 10353 AdministratorUids: [] RequestorUid: 10353 RequestorPackageName: com.wifi_tether] ] with score 0 and providerId 0
06-20 15:29:09.585 1497 1891 D WifiNetworkFactory: got request NetworkRequest [ REQUEST id=8156, [ Transports: WIFI Capabilities: NOT_RESTRICTED&TRUSTED&NOT_VPN Specifier: <WifiNetworkSpecifier [, SSID Match pattern=PatternMatcher{LITERAL: WiFi-Repeater1}, BSSID Match pattern=Pair{00:23:13:05:8b:be ff:ff:ff:ff:ff:ff}, SSID="WiFi-Repeater1", BSSID=00:23:13:05:8b:be]> Uid: 10353 AdministratorUids: [] RequestorUid: 10353 RequestorPackageName: com.wifi_tether] ] with score 0 and providerId 0
06-20 15:29:09.587 1497 1891 V WifiNetworkFactory: Approved access point found in matching scan results. Triggering connect WiFi-Repeater1/00:23:13:05:8b:be
06-20 15:29:09.588 1497 1891 E WifiConfigManager: Cannot find network with configKey "WiFi-Repeater1"WPA_PSK-0
06-20 15:29:09.588 1497 1891 E WifiNetworkFactory: Network not present in config manager
06-20 15:29:09.588 1497 1891 E WifiConfigManager: Cannot find network with configKey "WiFi-Repeater1"WPA_PSK-0
06-20 15:29:09.588 1497 1891 E WifiConfigManager: Cannot find network with networkId -1 or configKey "WiFi-Repeater1"WPA_PSK-0
06-20 15:29:09.588 1497 1891 E WifiConfigManager: Cannot find network with networkId -1 or configKey "WiFi-Repeater1"WPA_PSK-0
06-20 15:29:09.604 1497 1891 E WifiConfigManager: Cannot find network with configKey "WiFi-Repeater1"WPA_PSK-0
06-20 15:29:09.605 1497 1891 D WifiConfigManager: Enable disabled network: "WiFi-Repeater1" num=0
06-20 15:29:09.631 1497 1522 I EthernetTracker: interfaceLinkStateChanged, iface: wlan0, up: false
06-20 15:29:09.632 1497 1522 I EthernetTracker: interfaceLinkStateChanged, iface: wlan0, up: false
06-20 15:29:09.632 29014 29014 I wpa_supplicant: wlan0: CTRL-EVENT-DISCONNECTED bssid=3c:37:12:e5:41:1d reason=3 locally_generated=1
06-20 15:29:09.633 1170 1170 E cnss-daemon: wlan_service_update_sys_param: unable to open /proc/sys/net/ipv4/tcp_use_userconfig
06-20 15:29:09.635 1497 1891 D WifiClientModeImpl: ClientModeImpl: Leaving Connected state
06-20 15:29:09.636 1497 1891 D WifiCountryCode: Reading country code from telephony
06-20 15:29:09.637 1497 1891 D WifiCountryCode: Set telephony country code to:
06-20 15:29:09.637 1497 1891 D WifiCountryCode: updateCountryCode to 00
06-20 15:29:09.637 29014 29014 I wpa_supplicant: wlan0: CTRL-EVENT-REGDOM-CHANGE init=USER type=COUNTRY alpha2=00
06-20 15:29:09.638 1497 1891 D WifiCountryCode: Succeeded to set country code to: 00
06-20 15:29:09.638 1497 1891 D WifiClientModeImpl: Start Disconnecting Watchdog 338
06-20 15:29:09.639 1497 1891 D WifiConfigManager: Enable disabled network: "WiFi-Repeater1" num=0
06-20 15:29:09.639 1497 1891 E WifiPermissionsUtil: isDeviceOwner: packageName is null, returning false
06-20 15:29:09.645 1497 1891 D WifiConfigStore: Writing to stores completed in 3 ms.
06-20 15:29:09.646 1497 1891 E WifiVendorHal: stopRssiMonitoring(l.2100) failed {.code = ERROR_NOT_AVAILABLE, .description = }
06-20 15:29:09.647 1497 1891 V WifiClientModeImpl: stopIpClient IpClientWithPreConnection: false
06-20 15:29:09.647 1497 1891 V WifiClientModeImpl: java.lang.Throwable
06-20 15:29:09.647 1497 1891 V WifiClientModeImpl: at com.android.server.wifi.ClientModeImpl.stopIpClient(ClientModeImpl.java:1070)
06-20 15:29:09.647 1497 1891 V WifiClientModeImpl: at com.android.server.wifi.ClientModeImpl.stopDhcpSetup(ClientModeImpl.java:1085)
06-20 15:29:09.647 1497 1891 V WifiClientModeImpl: at com.android.server.wifi.ClientModeImpl.handleNetworkDisconnect(ClientModeImpl.java:2765)
06-20 15:29:09.647 1497 1891 V WifiClientModeImpl: at com.android.server.wifi.ClientModeImpl.access$5600(ClientModeImpl.java:164)
06-20 15:29:09.647 1497 1891 V WifiClientModeImpl: at com.android.server.wifi.ClientModeImpl$ConnectModeState.processMessage(ClientModeImpl.java:4288)
06-20 15:29:09.647 1497 1891 V WifiClientModeImpl: at com.android.wifi.x.com.android.internal.util.StateMachine$SmHandler.processMsg(StateMachine.java:992)
06-20 15:29:09.647 1497 1891 V WifiClientModeImpl: at com.android.wifi.x.com.android.internal.util.StateMachine$SmHandler.handleMessage(StateMachine.java:809)
06-20 15:29:09.647 1497 1891 V WifiClientModeImpl: at android.os.Handler.dispatchMessage(Handler.java:106)
06-20 15:29:09.647 1497 1891 V WifiClientModeImpl: at android.os.Looper.loop(Looper.java:223)
06-20 15:29:09.647 1497 1891 V WifiClientModeImpl: at android.os.HandlerThread.run(HandlerThread.java:67)
06-20 15:29:09.649 2137 29015 D DhcpClient: doQuit
06-20 15:29:09.585 1497 1910 D ConnectivityService: NetReassign [no changes]
06-20 15:29:09.649 1497 1910 D ConnectivityService: [498 WIFI] EVENT_NETWORK_INFO_CHANGED, going from CONNECTED to DISCONNECTED
06-20 15:29:09.649 1497 1910 D ConnectivityService: [498 WIFI] disconnected, was satisfying 40
06-20 15:29:09.649 1497 1891 I WifiClientModeImpl: disconnectedstate enter
06-20 15:29:09.650 1497 1891 D WifiClientModeImpl: connectToUserSelectNetwork netId 229, uid 10353, forceReconnect = false
06-20 15:29:09.653 2170 2265 I QCNEJ/CndHalConnector: -> SND notifyRatConnectionStatusChanged(rat = 1, DISCONNECTED)
06-20 15:29:09.653 1497 1891 D WifiNetworkAgent: NetworkAgent: NetworkAgent channel lost
06-20 15:29:09.654 1497 1891 D WifiClientModeImpl: CMD_START_CONNECT my state DisconnectedState nid=229 roam=false
06-20 15:29:09.654 2137 29015 D ApfFilter: (wlan0): shutting down
06-20 15:29:09.662 2137 29015 D DhcpClient: DHCP Packet Handler stopped
06-20 15:29:09.662 2137 29015 D DhcpClient: onQuitting
06-20 15:29:09.668 1497 1522 I GnssNetworkConnectivityHandler: Network connection lost. Available networks count: 0
06-20 15:29:09.668 1497 1522 I GnssNetworkConnectivityHandler: updateNetworkState, state=CLOSED, connected=false, network=498, capabilities=[ Transports: WIFI Capabilities: NOT_METERED&INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VPN&VALIDATED&NOT_ROAMING&FOREGROUND&NOT_CONGESTED&NOT_SUSPENDED LinkUpBandwidth>=318000Kbps LinkDnBandwidth>=318000Kbps SignalStrength: -65 OwnerUid: 1000 AdministratorUids: [] SSID: "dealino.de" RequestorUid: -1 RequestorPackageName: null], apn: , availableNetworkCount: 0
06-20 15:29:09.669 2170 2284 W QCNEJ : |CORE| network lost: 498
06-20 15:29:09.670 2170 2284 W QCNEJ : |CORE| onLost: unbind the process to WIFI
06-20 15:29:09.672 28512 28617 V NativeCrypto: Read error: ssl=0x7dafa33b98: I/O error during system call, Software caused connection abort
06-20 15:29:09.673 24519 24601 D RNWifiTethering: onLost
06-20 15:29:09.678 28512 13129 V NativeCrypto: SSL shutdown failed: ssl=0x7dafa33b98: I/O error during system call, Broken pipe
06-20 15:29:09.678 28512 13129 E WakeLock: GCM_HB_ALARM release without a matched acquire!
06-20 15:29:09.679 28512 13129 W WakeLock: GCM_HB_ALARM counter does not exist
06-20 15:29:09.679 18591 18649 I CarrierServices: [40007] glt.handleMessage: RcsEngineImpl[DUAL_REG]:[e9198652-94f5]>Handler: handleMessage processing message:[NOTIFY_UPTIME_IGNORE_STATE_CHANGED] with [non-null]:RcsEngineImpl reference
06-20 15:29:09.680 1497 1910 D ConnectivityService: Sending DISCONNECTED broadcast for type 1 [498 WIFI] isDefaultNetwork=true
06-20 15:29:09.681 1497 1910 D ConnectivityService: NetReassign [no changes]
06-20 15:29:09.686 28512 13129 I AlarmManager: setExactAndAllowWhileIdle [name: GCM_CONN_ALARM type: 2 triggerAtMillis: 2163720443]
06-20 15:29:09.687 28512 13129 E WakeLock: GCM_CONN_ALARM release without a matched acquire!
06-20 15:29:09.687 18591 18649 I CarrierServices: [40007] gix.g: RCS Configuration storage in Bugle is disabled by p/h flag, using ProvisioningEngineStateCacheUtil.getProvisioningConfigurationForGivenSimIfExist()
06-20 15:29:09.687 28512 13129 W WakeLock: GCM_CONN_ALARM counter does not exist
06-20 15:29:09.688 943 943 V ContextHubHal: sendMessageToHub
06-20 15:29:09.691 955 1050 D CHRE : @ 2163721.604: Parsed nanoapp message from host: app ID 0x476f6f676c00100b, endpoint 0x28, msgType 112, payload size 14
06-20 15:29:09.691 955 1050 I CHRE : @ 2163721.605: [NanoMinion] received MSG Type 0x70, Version 1, 10 bytes
06-20 15:29:09.691 955 1050 I CHRE : @ 2163721.605: [AR] context-signal: has_bt=0, bt=0, has_wifi=1, wifi=0
06-20 15:29:09.692 18591 18651 I CarrierServices: [40009] fuc.c: Connected state: [2], networkType: [null]
06-20 15:29:09.693 13751 13810 I BugleTransport: RCS Configuration is empty. Enabled transport is Dual Reg [CONTEXT ratelimit_period="5 SECONDS" ]
06-20 15:29:09.694 10552 13920 I DeviceStatusMonitor: DeviceStatusMonitor.handleBroadcast():123 onReceive() : Action = android.net.conn.CONNECTIVITY_CHANGE
06-20 15:29:09.694 1497 1522 I EthernetTracker: interfaceLinkStateChanged, iface: wlan0, up: false
06-20 15:29:09.696 970 970 D vendor.google.wifi_ext@1.0-service-vendor: Successfully SetMacAddress.
06-20 15:29:09.696 1497 1522 I EthernetTracker: interfaceLinkStateChanged, iface: wlan0, up: false
06-20 15:29:09.697 1497 1891 D WifiClientModeImpl: ConnectedMacRandomization SSID(WiFi-Repeater1). setMacAddress(3e:c6:60:d5:7a:8e) from aa:33:dd:a1:5d:c3 = true
06-20 15:29:09.697 1497 1522 I EthernetTracker: interfaceLinkStateChanged, iface: wlan0, up: false
06-20 15:29:09.698 1497 1891 I WifiClientModeImpl: Connecting with 3e:c6:60:d5:7a:8e as the mac address
06-20 15:29:09.699 1161 1161 W wificond: Scan is not started. Ignore abort request
06-20 15:29:09.699 1497 1891 D SupplicantStaIfaceHal: connectToNetwork "WiFi-Repeater1"WPA_PSK-0
06-20 15:29:09.699 10552 13920 I DeviceStatusMonitor: DeviceStatusMonitor.getCurrentNetworkState():195 getCurrentNetworkState(): no networks
06-20 15:29:09.704 1497 1891 I SupplicantStaIfaceHal: addSupplicantStaNetwork via HIDL
06-20 15:29:09.704 10552 13920 I DeviceStatusMonitor: DeviceStatusMonitor.notifyIfNetworkChanged():180 notifyIfNetworkChanged: newState = NO_CONNECTION, airplaneModeOn = false, notifyAnyway = false
06-20 15:29:09.707 10552 10552 I NetworkInfoNotification: NetworkInfoNotification$Listener.onReceive():98 onNetworkLost: networkState = NO_CONNECTION, isAirplaneModeOn = false
06-20 15:29:09.708 10552 13924 I NetworkInfoNotification: NetworkInfoNotification$Listener.onReceive():98 onNetworkLost: networkState = NO_CONNECTION, isAirplaneModeOn = false
06-20 15:29:09.708 10552 13923 I NetworkInfoNotification: NetworkInfoNotification$Listener.onReceive():98 onNetworkLost: networkState = NO_CONNECTION, isAirplaneModeOn = false
06-20 15:29:09.717 1497 1531 D CompatibilityChangeReporter: Compat change id reported: 135634846; UID 10123; state: DISABLED
06-20 15:29:09.717 1497 1532 D CompatibilityChangeReporter: Compat change id reported: 143937733; UID 10123; state: ENABLED
06-20 15:29:09.718 970 29012 I WifiHAL : event received NL80211_CMD_VENDOR, vendor_id = 0x1374, subcmd = 0x6a
06-20 15:29:09.723 2170 2265 I QCNEJ/CndHalConnector: -> SND notifyRatConnectionStatusChanged(rat = 1, DISCONNECTED)
06-20 15:29:09.724 922 922 D Zygote : Forked child process 13925
06-20 15:29:09.726 1497 1532 I ActivityManager: Start proc 13925:com.google.android.settings.intelligence/u0a123 for broadcast {com.google.android.settings.intelligence/com.google.android.settings.intelligence.modules.routines.impl.WifiBroadcastReceiver}
06-20 15:29:09.727 2211 2211 D GRIL-S : [1348]> UPDATE_DEVICE_STATE DeviceState: Usb:1, Wifi: 0, Wifi AP: 0, Earpiece: 0, Bluetooth: 0, Wireless charging: 0, Screen: 1, Camera: 0, 0, 0, 0, Motion: 1, Bluetooth tethering: 0, Voice: 0, Wifi 2.4G: 0, Radio: 0, Bluetooth connected: 0, Bluetooth media: 0
06-20 15:29:09.733 13925 13925 E gs.intelligenc: Not starting debugger since process cannot load the jdwp agent.
06-20 15:29:09.748 2211 3115 D GRIL-S : [1348]< UPDATE_DEVICE_STATE
06-20 15:29:09.762 13925 13925 I gs.intelligenc: The ClassLoaderContext is a special shared library.
06-20 15:29:09.793 13925 13925 D NetworkSecurityConfig: No Network Security Config specified, using platform default
06-20 15:29:09.794 13925 13925 D NetworkSecurityConfig: No Network Security Config specified, using platform default
06-20 15:29:09.798 13925 13925 W gs.intelligenc: Accessing hidden field Ljava/util/Collections$SynchronizedCollection;->mutex:Ljava/lang/Object; (greylist-max-o, reflection, denied)
06-20 15:29:09.798 13925 13925 W gs.intelligenc: Accessing hidden method Ljava/util/Collections$SynchronizedSet;->
Logs seems okay could you please do some debug on that function which handle the promise resolve? https://github.com/aboozaid/react-native-tethering/blob/9f3eb11bfc9b6e3d163fdd6c3d53bd06018a3508/packages/wifi/android/src/main/java/com/reactnativetethering/wifi/WifiTethering.kt#L139
We are facing the same issue here.
The test device is a Redmi Android 30 system.
The problem is that isAlreadyConnected always return false while ssid can successfully retrieved in that line you mentioned above.
In our research, it seems that getNetworkInfo has been deprecated since Android 29.
@aboozaid
With connectToLocalNetwork the Promise is never resolved in case of success (wifi is connected). The errors work.