Commit 338a3bb9 authored by mdjones's avatar mdjones Committed by Commit bot

Revert of Native SSID extraction moved to platform code on Android (patchset...

Revert of Native SSID extraction moved to platform code on Android (patchset #8 id:140001 of https://codereview.chromium.org/1633733005/ )

Reason for revert:
Causes instant crash on Android KK, L, and M.

Original issue's 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
>
> 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.

TBR=bengr@chromium.org,rch@chromium.org,rsleevi@chromium.org,ripp@yandex-team.ru
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=555067

Review URL: https://codereview.chromium.org/1688103002

Cr-Commit-Position: refs/heads/master@{#374833}
parent afbb0c0d
...@@ -9,8 +9,6 @@ import android.content.Context; ...@@ -9,8 +9,6 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.net.ConnectivityManager; import android.net.ConnectivityManager;
import android.net.NetworkInfo; import android.net.NetworkInfo;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.security.KeyChain; import android.security.KeyChain;
import android.telephony.TelephonyManager; import android.telephony.TelephonyManager;
import android.util.Log; import android.util.Log;
...@@ -230,34 +228,4 @@ class AndroidNetworkLibrary { ...@@ -230,34 +228,4 @@ class AndroidNetworkLibrary {
NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo(); NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo();
return networkInfo.isRoaming(); return networkInfo.isRoaming();
} }
/*
* Returns the current SSID if the device is connected to a Wi-Fi network.
*/
@CalledByNative
private static String getWifiSSID(Context context) {
WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
WifiInfo wifiInfo = wifiManager.getConnectionInfo();
if (wifiInfo == null) {
return "";
}
String ssid = wifiInfo.getSSID();
if (ssid == null || "<unknown ssid>".equals(ssid)) {
return "";
}
return removeSurroundingQuotes(ssid);
}
private static String removeSurroundingQuotes(String string) {
if (string.length() > 2 && string.charAt(0) == '\"'
&& string.charAt(string.length() - 1) == '\"') {
return string.substring(1, string.length() - 1);
}
return string;
}
} }
...@@ -143,13 +143,6 @@ bool GetIsRoaming() { ...@@ -143,13 +143,6 @@ bool GetIsRoaming() {
base::android::GetApplicationContext()); base::android::GetApplicationContext());
} }
std::string GetWifiSSID() {
return base::android::ConvertJavaStringToUTF8(
Java_AndroidNetworkLibrary_getWifiSSID(
base::android::AttachCurrentThread(),
base::android::GetApplicationContext()));
}
bool RegisterNetworkLibrary(JNIEnv* env) { bool RegisterNetworkLibrary(JNIEnv* env) {
return RegisterNativesImpl(env); return RegisterNativesImpl(env);
} }
......
...@@ -82,9 +82,6 @@ NET_EXPORT std::string GetTelephonySimOperator(); ...@@ -82,9 +82,6 @@ NET_EXPORT std::string GetTelephonySimOperator();
// true, it suggests that use of data may incur extra costs. // true, it suggests that use of data may incur extra costs.
NET_EXPORT bool GetIsRoaming(); NET_EXPORT bool GetIsRoaming();
// Returns the current SSID if device is connected to a Wi-Fi network.
NET_EXPORT std::string GetWifiSSID();
// Register JNI methods // Register JNI methods
NET_EXPORT bool RegisterNetworkLibrary(JNIEnv* env); NET_EXPORT bool RegisterNetworkLibrary(JNIEnv* env);
......
...@@ -11,7 +11,6 @@ found in the LICENSE file. ...@@ -11,7 +11,6 @@ found in the LICENSE file.
android:versionName="1.0"> android:versionName="1.0">
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="23" /> <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="23" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS"/> <uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS"/>
<uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
......
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "net/base/network_interfaces.h"
#include "net/android/network_library.h"
namespace net {
std::string GetWifiSSID() {
return android::GetWifiSSID();
}
} // namespace net
...@@ -215,7 +215,6 @@ bool GetNetworkList(NetworkInterfaceList* networks, int policy) { ...@@ -215,7 +215,6 @@ bool GetNetworkList(NetworkInterfaceList* networks, int policy) {
&internal::AddressTrackerLinux::GetInterfaceName); &internal::AddressTrackerLinux::GetInterfaceName);
} }
#if !defined(OS_ANDROID)
std::string GetWifiSSID() { std::string GetWifiSSID() {
NetworkInterfaceList networks; NetworkInterfaceList networks;
if (GetNetworkList(&networks, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES)) { if (GetNetworkList(&networks, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES)) {
...@@ -224,6 +223,5 @@ std::string GetWifiSSID() { ...@@ -224,6 +223,5 @@ std::string GetWifiSSID() {
} }
return ""; return "";
} }
#endif // !defined(OS_ANDROID)
} // namespace net } // namespace net
...@@ -503,7 +503,6 @@ ...@@ -503,7 +503,6 @@
'base/network_delegate.h', 'base/network_delegate.h',
'base/network_delegate_impl.cc', 'base/network_delegate_impl.cc',
'base/network_delegate_impl.h', 'base/network_delegate_impl.h',
'base/network_interfaces_android.cc',
'base/network_interfaces_linux.cc', 'base/network_interfaces_linux.cc',
'base/network_interfaces_mac.cc', 'base/network_interfaces_mac.cc',
'base/network_interfaces_win.cc', 'base/network_interfaces_win.cc',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment