Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0ffb89d1 authored by Peter Qiu's avatar Peter Qiu
Browse files

wifi: catch UnsupportedOperationException for getMatchingWifiConfig

On a device without Passpoint support, an UnsupportedOperationException
will be thrown when invoking WifiManager#getMatchingWifiConfig.
So catch it to avoid crash.

Bug: 36649203
Test: manually set config_wifi_hotspot2_enabled to false and verify
      Settings app doesn't crash

Change-Id: I69f37897449033da9d21edda9953ad2738f7e314
parent c75dbe9d
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -394,10 +394,14 @@ public class WifiTracker {
                        // the given ScanResult.  This is used for showing that a given AP
                        // (ScanResult) is available via a Passpoint provider (provider friendly
                        // name).
                        try {
                            WifiConfiguration config = mWifiManager.getMatchingWifiConfig(result);
                            if (config != null) {
                                accessPoint.update(config);
                            }
                        } catch (UnsupportedOperationException e) {
                            // Passpoint not supported on the device.
                        }
                    }

                    accessPoints.add(accessPoint);