summaryrefslogtreecommitdiff
path: root/wifi/java/src
diff options
context:
space:
mode:
author Oscar Shu <xshu@google.com> 2024-03-05 01:57:33 +0000
committer Oscar Shu <xshu@google.com> 2024-03-05 03:57:32 +0000
commita1168029bf07465f1678845c946532d2c21186a8 (patch)
tree17dcf4651a6df0bcadd460cb953bbb61a5975b5f /wifi/java/src
parent49e4227abe9eb7bd4c826dbb43d1f6be8a2f8445 (diff)
Catch NullPointer caused by race of setting mWifiCond
Similar to ag/25108489, but protecting all places where mWifiCond is used. Due to many places changed, uses catch exception instead of synchronized to minimize risk of breaking. Bug: 327918402 Test: build and flash Change-Id: I1760a524ac0eedbf21cea84f893be6ffd618d9d9
Diffstat (limited to 'wifi/java/src')
-rw-r--r--wifi/java/src/android/net/wifi/nl80211/WifiNl80211Manager.java22
1 files changed, 21 insertions, 1 deletions
diff --git a/wifi/java/src/android/net/wifi/nl80211/WifiNl80211Manager.java b/wifi/java/src/android/net/wifi/nl80211/WifiNl80211Manager.java
index 58638e8e1af4..45ab9863ff73 100644
--- a/wifi/java/src/android/net/wifi/nl80211/WifiNl80211Manager.java
+++ b/wifi/java/src/android/net/wifi/nl80211/WifiNl80211Manager.java
@@ -718,6 +718,9 @@ public class WifiNl80211Manager {
} catch (RemoteException e1) {
Log.e(TAG, "Failed to get IClientInterface due to remote exception");
return false;
+ } catch (NullPointerException e2) {
+ Log.e(TAG, "setupInterfaceForClientMode NullPointerException");
+ return false;
}
if (clientInterface == null) {
@@ -785,6 +788,9 @@ public class WifiNl80211Manager {
} catch (RemoteException e1) {
Log.e(TAG, "Failed to teardown client interface due to remote exception");
return false;
+ } catch (NullPointerException e2) {
+ Log.e(TAG, "tearDownClientInterface NullPointerException");
+ return false;
}
if (!success) {
Log.e(TAG, "Failed to teardown client interface");
@@ -816,6 +822,9 @@ public class WifiNl80211Manager {
} catch (RemoteException e1) {
Log.e(TAG, "Failed to get IApInterface due to remote exception");
return false;
+ } catch (NullPointerException e2) {
+ Log.e(TAG, "setupInterfaceForSoftApMode NullPointerException");
+ return false;
}
if (apInterface == null) {
@@ -854,6 +863,9 @@ public class WifiNl80211Manager {
} catch (RemoteException e1) {
Log.e(TAG, "Failed to teardown AP interface due to remote exception");
return false;
+ } catch (NullPointerException e2) {
+ Log.e(TAG, "tearDownSoftApInterface NullPointerException");
+ return false;
}
if (!success) {
Log.e(TAG, "Failed to teardown AP interface");
@@ -1328,6 +1340,8 @@ public class WifiNl80211Manager {
}
} catch (RemoteException e1) {
Log.e(TAG, "Failed to request getChannelsForBand due to remote exception");
+ } catch (NullPointerException e2) {
+ Log.e(TAG, "getChannelsMhzForBand NullPointerException");
}
if (result == null) {
result = new int[0];
@@ -1352,7 +1366,8 @@ public class WifiNl80211Manager {
*/
@Nullable public DeviceWiphyCapabilities getDeviceWiphyCapabilities(@NonNull String ifaceName) {
if (mWificond == null) {
- Log.e(TAG, "getDeviceWiphyCapabilities: mWificond binder is null! Did wificond die?");
+ Log.e(TAG, "getDeviceWiphyCapabilities: mWificond binder is null! "
+ + "Did wificond die?");
return null;
}
@@ -1360,6 +1375,9 @@ public class WifiNl80211Manager {
return mWificond.getDeviceWiphyCapabilities(ifaceName);
} catch (RemoteException e) {
return null;
+ } catch (NullPointerException e2) {
+ Log.e(TAG, "getDeviceWiphyCapabilities NullPointerException");
+ return null;
}
}
@@ -1409,6 +1427,8 @@ public class WifiNl80211Manager {
Log.i(TAG, "Receive country code change to " + newCountryCode);
} catch (RemoteException re) {
re.rethrowFromSystemServer();
+ } catch (NullPointerException e) {
+ new RemoteException("Wificond service doesn't exist!").rethrowFromSystemServer();
}
}