summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNingyuan Wang <nywang@google.com>2016-05-10 15:37:12 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-05-10 15:37:12 +0000
commit70860e60e51f2e85ea79249abd5eb5df202cb42a (patch)
tree669ccfe1bd5c314f3a7b23ca4fd62dfd53e001a5
parent0a75995008f38ebce1be028f19b8c084571aaac7 (diff)
parent208c3c19bae4801f7e18c44e1ce2b6e06dd19d05 (diff)
Merge "Fix string comparision and return value in try catch block" into nyc-dev
am: 208c3c19ba * commit '208c3c19bae4801f7e18c44e1ce2b6e06dd19d05': Fix string comparision and return value in try catch block Change-Id: I056bd5a3a2c3768d723076566b1b72d712dcc2ca
-rw-r--r--service/java/com/android/server/wifi/WifiApConfigStore.java22
-rw-r--r--service/java/com/android/server/wifi/WifiCertManager.java3
-rw-r--r--service/java/com/android/server/wifi/WifiConfigManager.java2
-rw-r--r--service/java/com/android/server/wifi/WifiCountryCode.java2
-rw-r--r--service/java/com/android/server/wifi/WifiStateMachine.java6
5 files changed, 11 insertions, 24 deletions
diff --git a/service/java/com/android/server/wifi/WifiApConfigStore.java b/service/java/com/android/server/wifi/WifiApConfigStore.java
index 2983227a4..bcd8d03e9 100644
--- a/service/java/com/android/server/wifi/WifiApConfigStore.java
+++ b/service/java/com/android/server/wifi/WifiApConfigStore.java
@@ -164,13 +164,10 @@ public class WifiApConfigStore {
/**
* Write AP configuration to persistent storage.
*/
- private static boolean writeApConfiguration(final String filename,
- final WifiConfiguration config) {
- DataOutputStream out = null;
- try {
- out = new DataOutputStream(new BufferedOutputStream(
- new FileOutputStream(filename)));
-
+ private static void writeApConfiguration(final String filename,
+ final WifiConfiguration config) {
+ try (DataOutputStream out = new DataOutputStream(new BufferedOutputStream(
+ new FileOutputStream(filename)))) {
out.writeInt(AP_CONFIG_FILE_VERSION);
out.writeUTF(config.SSID);
out.writeInt(config.apBand);
@@ -182,18 +179,7 @@ public class WifiApConfigStore {
}
} catch (IOException e) {
Log.e(TAG, "Error writing hotspot configuration" + e);
- return false;
- } finally {
- if (out != null) {
- try {
- out.close();
- } catch (IOException e) {
- Log.e(TAG, "Error closing hotspot configuration during write" + e);
- return false;
- }
- }
}
- return true;
}
/**
diff --git a/service/java/com/android/server/wifi/WifiCertManager.java b/service/java/com/android/server/wifi/WifiCertManager.java
index 6883df939..e180f5153 100644
--- a/service/java/com/android/server/wifi/WifiCertManager.java
+++ b/service/java/com/android/server/wifi/WifiCertManager.java
@@ -125,9 +125,8 @@ public class WifiCertManager {
stream.readFully(bytes);
} catch (IOException e) {
Log.e(TAG, "readConfigFile: failed to read " + e, e);
- } finally {
- return bytes;
}
+ return bytes;
}
protected void writeConfigFile(byte[] payload) {
diff --git a/service/java/com/android/server/wifi/WifiConfigManager.java b/service/java/com/android/server/wifi/WifiConfigManager.java
index 424a2318e..de4ec1f31 100644
--- a/service/java/com/android/server/wifi/WifiConfigManager.java
+++ b/service/java/com/android/server/wifi/WifiConfigManager.java
@@ -2182,7 +2182,7 @@ public class WifiConfigManager {
if (originalConfig.wepKeys != null && currentConfig.wepKeys != null) {
if (originalConfig.wepKeys.length == currentConfig.wepKeys.length) {
for (int i = 0; i < originalConfig.wepKeys.length; i++) {
- if (originalConfig.wepKeys[i] != currentConfig.wepKeys[i]) {
+ if (!Objects.equals(originalConfig.wepKeys[i], currentConfig.wepKeys[i])) {
return true;
}
}
diff --git a/service/java/com/android/server/wifi/WifiCountryCode.java b/service/java/com/android/server/wifi/WifiCountryCode.java
index 8136eeb7d..b603d904a 100644
--- a/service/java/com/android/server/wifi/WifiCountryCode.java
+++ b/service/java/com/android/server/wifi/WifiCountryCode.java
@@ -131,7 +131,7 @@ public class WifiCountryCode {
return;
}
mTelephonyCountryCode = countryCode;
- mTelephonyCountryCode.toUpperCase();
+ mTelephonyCountryCode = mTelephonyCountryCode.toUpperCase();
// If wpa_supplicant is ready we set the country code now, otherwise it will be
// set once wpa_supplicant is ready.
if (mReady) {
diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java
index cc3e8252c..1079ae112 100644
--- a/service/java/com/android/server/wifi/WifiStateMachine.java
+++ b/service/java/com/android/server/wifi/WifiStateMachine.java
@@ -412,7 +412,8 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss
if (bssid == null) bssid = "any";
if (config == null) return false; // Nothing to do
- if (mTargetRoamBSSID != null && bssid == mTargetRoamBSSID && bssid == config.BSSID) {
+ if (mTargetRoamBSSID != null
+ && bssid.equals(mTargetRoamBSSID) && bssid.equals(config.BSSID)) {
return false; // We didnt change anything
}
if (!mTargetRoamBSSID.equals("any") && bssid.equals("any")) {
@@ -1338,7 +1339,8 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss
private static final String LOGD_LEVEL_DEBUG = "D";
private static final String LOGD_LEVEL_VERBOSE = "V";
private void configureVerboseHalLogging(boolean enableVerbose) {
- if (Build.TYPE == BUILD_TYPE_USER) { // Verbose HAL logging not supported on user builds.
+ // Verbose HAL logging not supported on user builds.
+ if (Build.TYPE.equals(BUILD_TYPE_USER)) {
return;
}
mPropertyService.set(SYSTEM_PROPERTY_LOG_CONTROL_WIFIHAL,