|
|
DescriptionOn Android, move Wifi SSID extraction to a Java implementation
On some Android devices, the device will restart right
after the browser is launched. This is due to a kernel bug on
these devices when using the Linux GetWifiSSID implementation,
which causes a kernel panic and device restart.
To avoid this, a Java-based implementation is used for Android
devices, which avoids this. Examples of affected devices include:
HTC One S
Lenovo A820
Asus ZenFone 2
MediaPad 10 FHD
R=bengr@chromium.org,rch@chromium.org
BUG=555067
TEST=Take the problem device, install browser and start it, wait for
10 seconds. Make 10 experiments, cleaning data before each run.
Device should not reboot.
Committed: https://crrev.com/35f59b4376232b4685c2a2e922f00a3bce2fbfde
Cr-Commit-Position: refs/heads/master@{#374743}
Patch Set 1 #
Total comments: 6
Patch Set 2 : Refactoring of GetWifiSSID/GetCurrentWifiConnectionSsid #
Total comments: 2
Patch Set 3 : getCurrentWifiConnectionSsid renamed to getWifiSSID #
Total comments: 4
Patch Set 4 : Added check against <unknown ssid>; copyright comment corrected #
Total comments: 12
Patch Set 5 : Some refactoring and quotes removal improving #Patch Set 6 : Comment fixed #Patch Set 7 : Fixed gn gen #Patch Set 8 : Added permission for net_unittests #
Messages
Total messages: 38 (12 generated)
lgtm https://codereview.chromium.org/1633733005/diff/1/net/android/network_library.h File net/android/network_library.h (right): https://codereview.chromium.org/1633733005/diff/1/net/android/network_library... net/android/network_library.h:85: // Returns the current SSID if device is connected to Wi-Fi network. nit: "connected to a Wi-Fi network" (add "a")
rsleevi@chromium.org changed reviewers: + rsleevi@chromium.org
Please do *not* commit this yet. I have an important design request here Further, I'd like to suggest a reword of the commit description: On Android, Move Wifi SSID extraction to a Java implementation On some Android devices, the device will restart right after the browser is launched. This is due to a kernel bug on these devices when using the Linux GetWifiSSID implementation, which causes a kernel panic and device restart. To avoid this, a Java-based implementation is used for Android devices, which avoids this. Examples of affected devices include: HTC One S Lenovo A820 Asus ZenFone 2 MediaPad 10 FHD https://codereview.chromium.org/1633733005/diff/1/net/base/network_quality_es... File net/base/network_quality_estimator.cc (right): https://codereview.chromium.org/1633733005/diff/1/net/base/network_quality_es... net/base/network_quality_estimator.cc:782: network_id.id = android::GetCurrentWifiConnectionSsid(); DESIGN: Given that network_interfaces is already designed in a platform-abstracted way to avoid these #ifdefs, I would instead recommend the following approach: In network_interfaces_linux.cc, guard GetWifiSSID by a #if !defined(OS_ANDROID) std::string GetWifiSSID() { ... } #endif Then, implement a network_interfaces_android.cc which implements the GetWifiSSID function, and either calls android::GetCurrentWifiConnectionSsid() or simply move that implementation logic (the JNI call) into the _android file. Add the _android file to the .gyp and .gn files, conditionally as appropriate. This ensures the API semantics of net::GetWifiSSID() remain the same, and also avoids the inconsistent naming being introduced here (SSID vs Ssid)
not lgtm https://codereview.chromium.org/1633733005/diff/1/net/base/network_quality_es... File net/base/network_quality_estimator.cc (right): https://codereview.chromium.org/1633733005/diff/1/net/base/network_quality_es... net/base/network_quality_estimator.cc:782: network_id.id = android::GetCurrentWifiConnectionSsid(); On 2016/01/26 20:22:26, Ryan Sleevi wrote: > DESIGN: Given that network_interfaces is already designed in a > platform-abstracted way to avoid these #ifdefs, I would instead recommend the > following approach: > > In network_interfaces_linux.cc, guard GetWifiSSID by a > > #if !defined(OS_ANDROID) > std::string GetWifiSSID() { > ... > } > #endif > > Then, implement a network_interfaces_android.cc which implements the GetWifiSSID > function, and either calls android::GetCurrentWifiConnectionSsid() or simply > move that implementation logic (the JNI call) into the _android file. > > Add the _android file to the .gyp and .gn files, conditionally as appropriate. > > This ensures the API semantics of net::GetWifiSSID() remain the same, and also > avoids the inconsistent naming being introduced here (SSID vs Ssid) Oo! Good idea.
Description was changed from ========== Native SSID extraction moved to platform code on Android Some devices go to reboot, right after the start of the browser. We managed to found out that this happens when native function GetWifiSSID is called from the NetworkQualityEstimator::GetCurrentNetworkID() method - this leads to kernel panic and the device goes to reboot. Apparently this is due to some error in the kernel. We have replaced the native call to the platform one and the problem has gone. Affected devices are: HTC One S Lenovo A820 asus zenfone 2 MediaPad 10 FHD R=bengr@chromium.org,rch@chromium.org BUG=555067 TEST=Take the problem device, install browser and start it, wait for 10 seconds. Make 10 experiments, cleaning data before each run. Device should not reboot. ========== to ========== On Android, move Wifi SSID extraction to a Java implementation On some Android devices, the device will restart right after the browser is launched. This is due to a kernel bug on these devices when using the Linux GetWifiSSID implementation, which causes a kernel panic and device restart. To avoid this, a Java-based implementation is used for Android devices, which avoids this. Examples of affected devices include: HTC One S Lenovo A820 Asus ZenFone 2 MediaPad 10 FHD R=bengr@chromium.org,rch@chromium.org BUG=555067 TEST=Take the problem device, install browser and start it, wait for 10 seconds. Make 10 experiments, cleaning data before each run. Device should not reboot. ==========
https://codereview.chromium.org/1633733005/diff/1/net/android/network_library.h File net/android/network_library.h (right): https://codereview.chromium.org/1633733005/diff/1/net/android/network_library... net/android/network_library.h:85: // Returns the current SSID if device is connected to Wi-Fi network. On 2016/01/26 20:15:49, Ryan Hamilton wrote: > nit: "connected to a Wi-Fi network" (add "a") Done. https://codereview.chromium.org/1633733005/diff/1/net/base/network_quality_es... File net/base/network_quality_estimator.cc (right): https://codereview.chromium.org/1633733005/diff/1/net/base/network_quality_es... net/base/network_quality_estimator.cc:782: network_id.id = android::GetCurrentWifiConnectionSsid(); On 2016/01/26 20:22:26, Ryan Sleevi wrote: > DESIGN: Given that network_interfaces is already designed in a > platform-abstracted way to avoid these #ifdefs, I would instead recommend the > following approach: > > In network_interfaces_linux.cc, guard GetWifiSSID by a > > #if !defined(OS_ANDROID) > std::string GetWifiSSID() { > ... > } > #endif > > Then, implement a network_interfaces_android.cc which implements the GetWifiSSID > function, and either calls android::GetCurrentWifiConnectionSsid() or simply > move that implementation logic (the JNI call) into the _android file. > > Add the _android file to the .gyp and .gn files, conditionally as appropriate. > > This ensures the API semantics of net::GetWifiSSID() remain the same, and also > avoids the inconsistent naming being introduced here (SSID vs Ssid) Done. https://codereview.chromium.org/1633733005/diff/1/net/base/network_quality_es... net/base/network_quality_estimator.cc:782: network_id.id = android::GetCurrentWifiConnectionSsid(); On 2016/01/26 20:24:48, Ryan Hamilton wrote: > On 2016/01/26 20:22:26, Ryan Sleevi wrote: > > DESIGN: Given that network_interfaces is already designed in a > > platform-abstracted way to avoid these #ifdefs, I would instead recommend the > > following approach: > > > > In network_interfaces_linux.cc, guard GetWifiSSID by a > > > > #if !defined(OS_ANDROID) > > std::string GetWifiSSID() { > > ... > > } > > #endif > > > > Then, implement a network_interfaces_android.cc which implements the > GetWifiSSID > > function, and either calls android::GetCurrentWifiConnectionSsid() or simply > > move that implementation logic (the JNI call) into the _android file. > > > > Add the _android file to the .gyp and .gn files, conditionally as appropriate. > > > > This ensures the API semantics of net::GetWifiSSID() remain the same, and also > > avoids the inconsistent naming being introduced here (SSID vs Ssid) > > Oo! Good idea. Done.
https://codereview.chromium.org/1633733005/diff/20001/net/android/network_lib... File net/android/network_library.h (right): https://codereview.chromium.org/1633733005/diff/20001/net/android/network_lib... net/android/network_library.h:86: NET_EXPORT std::string GetCurrentWifiConnectionSsid(); Please see the previous remarks about matching style (Ssid vs SSID) Also, could you clarify why this is named differently than the //net method? That is, why not just android::GetWifiSSID() ?
https://codereview.chromium.org/1633733005/diff/20001/net/android/network_lib... File net/android/network_library.h (right): https://codereview.chromium.org/1633733005/diff/20001/net/android/network_lib... net/android/network_library.h:86: NET_EXPORT std::string GetCurrentWifiConnectionSsid(); On 2016/01/27 18:12:45, Ryan Sleevi wrote: > Please see the previous remarks about matching style (Ssid vs SSID) > > Also, could you clarify why this is named differently than the //net method? > That is, why not just > > android::GetWifiSSID() ? There was no particular reason. My mistake. changed to GetWifiSSID.
https://codereview.chromium.org/1633733005/diff/40001/net/android/java/src/or... File net/android/java/src/org/chromium/net/AndroidNetworkLibrary.java (right): https://codereview.chromium.org/1633733005/diff/40001/net/android/java/src/or... net/android/java/src/org/chromium/net/AndroidNetworkLibrary.java:238: return wifiInfo == null ? "" : wifiInfo.getSSID(); The Android API documentation says WifiInfo#getSSID() could return "<unknown ssid>" if there is no network currently connected but isn't clear if this is ever returned in practice because WifiManager#getConnectionInfo() only returns non-null if there currently is an active WiFi connection. It would be good to check (either in java or c++) that you do not return "<unknown ssid>". https://codereview.chromium.org/1633733005/diff/40001/net/base/network_interf... File net/base/network_interfaces_android.cc (right): https://codereview.chromium.org/1633733005/diff/40001/net/base/network_interf... net/base/network_interfaces_android.cc:1: // Copyright (c) 2016 The Chromium Authors. All rights reserved. Current convention is to remove the "(c)".
https://codereview.chromium.org/1633733005/diff/40001/net/android/java/src/or... File net/android/java/src/org/chromium/net/AndroidNetworkLibrary.java (right): https://codereview.chromium.org/1633733005/diff/40001/net/android/java/src/or... net/android/java/src/org/chromium/net/AndroidNetworkLibrary.java:238: return wifiInfo == null ? "" : wifiInfo.getSSID(); On 2016/01/30 01:12:30, bengr wrote: > The Android API documentation says WifiInfo#getSSID() could return "<unknown > ssid>" if there is no network currently connected but isn't clear if this is > ever returned in practice because WifiManager#getConnectionInfo() only returns > non-null if there currently is an active WiFi connection. It would be good to > check (either in java or c++) that you do not return "<unknown ssid>". Added check against <unknown ssid> and added removing of surround double quotation marks from returned ssid. As documentation says - if ssid is UTF8 string it is surronded by quotes - I've missed this in previous patch https://codereview.chromium.org/1633733005/diff/40001/net/base/network_interf... File net/base/network_interfaces_android.cc (right): https://codereview.chromium.org/1633733005/diff/40001/net/base/network_interf... net/base/network_interfaces_android.cc:1: // Copyright (c) 2016 The Chromium Authors. All rights reserved. On 2016/01/30 01:12:30, bengr wrote: > Current convention is to remove the "(c)". Done.
Dear colleagues, are there any more comments or I can commit?
sleevi@: Would you like to take another look? I'll take a pass now as well.
this lgtm now, but please refrain from landing until sleevi signs off.
lgtm
https://codereview.chromium.org/1633733005/diff/60001/net/android/java/src/or... File net/android/java/src/org/chromium/net/AndroidNetworkLibrary.java (right): https://codereview.chromium.org/1633733005/diff/60001/net/android/java/src/or... net/android/java/src/org/chromium/net/AndroidNetworkLibrary.java:235: * Returns the current SSID if device is connected to a Wi-Fi network. if -> if the https://codereview.chromium.org/1633733005/diff/60001/net/android/java/src/or... net/android/java/src/org/chromium/net/AndroidNetworkLibrary.java:242: if (wifiInfo != null) { You can return early here: if (wifiInfo == null) { return ""; } if (ssid == null || "<unknown ssid>".equals(ssid)) { return ""; } return ssid.replaceAll(...); https://codereview.chromium.org/1633733005/diff/60001/net/android/java/src/or... net/android/java/src/org/chromium/net/AndroidNetworkLibrary.java:245: if (ssid != null && !"<unknown ssid>".equals(ssid)) { Just to verify, when <unknown ssid> is returned, it does not have double quotes, right? https://codereview.chromium.org/1633733005/diff/60001/net/android/java/src/or... net/android/java/src/org/chromium/net/AndroidNetworkLibrary.java:246: // Remove surround double quotation marks and return result. Remove surround -> Remove the surrounding return -> return the https://codereview.chromium.org/1633733005/diff/60001/net/android/java/src/or... net/android/java/src/org/chromium/net/AndroidNetworkLibrary.java:247: return ssid.replaceAll("^\"|\"$", ""); Is the string guaranteed to be quoted? If so, what you have should work. It also removes a double quote if it appears at the beginning or end of the string and not both. Suggest either changing the comment to "Remove a double quotation mark if it appears at the beginning or end of the string." or checking explicitly that both the first and last character are double quotation marks and removing them both only if both are present. https://codereview.chromium.org/1633733005/diff/60001/net/android/java/src/or... net/android/java/src/org/chromium/net/AndroidNetworkLibrary.java:251: return ""; Can a valid SSID be the empty string? If so, you'd probably want to return something different when there isn't an SSID. Consider also the case of a string that is '""'.
https://codereview.chromium.org/1633733005/diff/60001/net/android/java/src/or... File net/android/java/src/org/chromium/net/AndroidNetworkLibrary.java (right): https://codereview.chromium.org/1633733005/diff/60001/net/android/java/src/or... net/android/java/src/org/chromium/net/AndroidNetworkLibrary.java:235: * Returns the current SSID if device is connected to a Wi-Fi network. On 2016/02/05 18:02:49, bengr wrote: > if -> if the Done. https://codereview.chromium.org/1633733005/diff/60001/net/android/java/src/or... net/android/java/src/org/chromium/net/AndroidNetworkLibrary.java:242: if (wifiInfo != null) { On 2016/02/05 18:02:49, bengr wrote: > You can return early here: > > if (wifiInfo == null) { > return ""; > } > > if (ssid == null || "<unknown ssid>".equals(ssid)) { > return ""; > } > > return ssid.replaceAll(...); Done. https://codereview.chromium.org/1633733005/diff/60001/net/android/java/src/or... net/android/java/src/org/chromium/net/AndroidNetworkLibrary.java:245: if (ssid != null && !"<unknown ssid>".equals(ssid)) { On 2016/02/05 18:02:49, bengr wrote: > Just to verify, when <unknown ssid> is returned, it does not have double quotes, > right? That's right. https://codereview.chromium.org/1633733005/diff/60001/net/android/java/src/or... net/android/java/src/org/chromium/net/AndroidNetworkLibrary.java:246: // Remove surround double quotation marks and return result. On 2016/02/05 18:02:49, bengr wrote: > Remove surround -> Remove the surrounding > return -> return the Comment replaced with self explanatory method removeSurroundingQuotes https://codereview.chromium.org/1633733005/diff/60001/net/android/java/src/or... net/android/java/src/org/chromium/net/AndroidNetworkLibrary.java:247: return ssid.replaceAll("^\"|\"$", ""); On 2016/02/05 18:02:49, bengr wrote: > Is the string guaranteed to be quoted? If so, what you have should work. It also > removes a double quote if it appears at the beginning or end of the string and > not both. > > Suggest either changing the comment to "Remove a double quotation mark if it > appears at the beginning or end of the string." or checking explicitly that both > the first and last character are double quotation marks and removing them both > only if both are present. Added explicit checking for quotation marks at the beginning and at the end of line https://codereview.chromium.org/1633733005/diff/60001/net/android/java/src/or... net/android/java/src/org/chromium/net/AndroidNetworkLibrary.java:251: return ""; On 2016/02/05 18:02:49, bengr wrote: > Can a valid SSID be the empty string? If so, you'd probably want to return > something different when there isn't an SSID. Consider also the case of a string > that is '""'. In fact, AndroidNetworkLibrary::getWifiSSID method is the implementation of net::GetWifiSSID function that already has such an interface.
lgtm
The CQ bit was checked by ripp@yandex-team.ru
The patchset sent to the CQ was uploaded after l-g-t-m from rch@chromium.org, rsleevi@chromium.org Link to the patchset: https://codereview.chromium.org/1633733005/#ps100001 (title: "Comment fixed")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1633733005/100001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1633733005/100001
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: android_chromium_gn_compile_dbg on tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/android_chro...) android_chromium_gn_compile_rel on tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/android_chro...)
The CQ bit was checked by ripp@yandex-team.ru
The patchset sent to the CQ was uploaded after l-g-t-m from bengr@chromium.org, rch@chromium.org, rsleevi@chromium.org Link to the patchset: https://codereview.chromium.org/1633733005/#ps120001 (title: "Fixed gn gen")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1633733005/120001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1633733005/120001
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: linux_android_rel_ng on tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/linux_androi...)
The CQ bit was checked by ripp@yandex-team.ru
The patchset sent to the CQ was uploaded after l-g-t-m from bengr@chromium.org, rch@chromium.org, rsleevi@chromium.org Link to the patchset: https://codereview.chromium.org/1633733005/#ps140001 (title: "Added permission for net_unittests")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1633733005/140001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1633733005/140001
Message was sent while issue was closed.
Description was changed from ========== On Android, move Wifi SSID extraction to a Java implementation On some Android devices, the device will restart right after the browser is launched. This is due to a kernel bug on these devices when using the Linux GetWifiSSID implementation, which causes a kernel panic and device restart. To avoid this, a Java-based implementation is used for Android devices, which avoids this. Examples of affected devices include: HTC One S Lenovo A820 Asus ZenFone 2 MediaPad 10 FHD R=bengr@chromium.org,rch@chromium.org BUG=555067 TEST=Take the problem device, install browser and start it, wait for 10 seconds. Make 10 experiments, cleaning data before each run. Device should not reboot. ========== to ========== On Android, move Wifi SSID extraction to a Java implementation On some Android devices, the device will restart right after the browser is launched. This is due to a kernel bug on these devices when using the Linux GetWifiSSID implementation, which causes a kernel panic and device restart. To avoid this, a Java-based implementation is used for Android devices, which avoids this. Examples of affected devices include: HTC One S Lenovo A820 Asus ZenFone 2 MediaPad 10 FHD R=bengr@chromium.org,rch@chromium.org BUG=555067 TEST=Take the problem device, install browser and start it, wait for 10 seconds. Make 10 experiments, cleaning data before each run. Device should not reboot. ==========
Message was sent while issue was closed.
Committed patchset #8 (id:140001)
Message was sent while issue was closed.
On 2016/02/10 22:10:40, commit-bot: I haz the power wrote: > Committed patchset #8 (id:140001) I've synced past this CL and I'm immediately crashing on startup because this CL accesses a function that requires a permission: 02-10 20:47:13.685 21394 21536 W System.err: java.lang.SecurityException: WifiService: Neither user 10196 nor current process has android.permission.ACCESS_WIFI_STATE. 02-10 20:47:13.686 21394 21536 W System.err: at android.os.Parcel.readException(Parcel.java:1546) 02-10 20:47:13.686 21394 21536 W System.err: at android.os.Parcel.readException(Parcel.java:1499) 02-10 20:47:13.686 21394 21536 W System.err: at android.net.wifi.IWifiManager$Stub$Proxy.getConnectionInfo(IWifiManager.java:991) 02-10 20:47:13.686 21394 21536 W System.err: at android.net.wifi.WifiManager.getConnectionInfo(WifiManager.java:1176) 02-10 20:47:13.686 21394 21536 W System.err: at org.chromium.net.AndroidNetworkLibrary.getWifiSSID(AndroidNetworkLibrary.java:240) Other folks on the team have hit this, as well. Don't know how it got past the bots, unless the code path doesn't get triggered in tests.
Message was sent while issue was closed.
A revert of this CL (patchset #8 id:140001) has been created in https://codereview.chromium.org/1688103002/ by mdjones@chromium.org. The reason for reverting is: Causes instant crash on Android KK, L, and M..
Message was sent while issue was closed.
Description was changed from ========== On Android, move Wifi SSID extraction to a Java implementation On some Android devices, the device will restart right after the browser is launched. This is due to a kernel bug on these devices when using the Linux GetWifiSSID implementation, which causes a kernel panic and device restart. To avoid this, a Java-based implementation is used for Android devices, which avoids this. Examples of affected devices include: HTC One S Lenovo A820 Asus ZenFone 2 MediaPad 10 FHD R=bengr@chromium.org,rch@chromium.org BUG=555067 TEST=Take the problem device, install browser and start it, wait for 10 seconds. Make 10 experiments, cleaning data before each run. Device should not reboot. ========== to ========== On Android, move Wifi SSID extraction to a Java implementation On some Android devices, the device will restart right after the browser is launched. This is due to a kernel bug on these devices when using the Linux GetWifiSSID implementation, which causes a kernel panic and device restart. To avoid this, a Java-based implementation is used for Android devices, which avoids this. Examples of affected devices include: HTC One S Lenovo A820 Asus ZenFone 2 MediaPad 10 FHD R=bengr@chromium.org,rch@chromium.org BUG=555067 TEST=Take the problem device, install browser and start it, wait for 10 seconds. Make 10 experiments, cleaning data before each run. Device should not reboot. Committed: https://crrev.com/35f59b4376232b4685c2a2e922f00a3bce2fbfde Cr-Commit-Position: refs/heads/master@{#374743} ==========
Message was sent while issue was closed.
Patchset 8 (id:??) landed as https://crrev.com/35f59b4376232b4685c2a2e922f00a3bce2fbfde Cr-Commit-Position: refs/heads/master@{#374743} |