Fix getWifiManager exception if phone is encrypted
[Issue Details] NetworkPolicyManagerService may invoke dispatchRestrictBackgroundChanged after reboot if settings changed, and invokes untetherAll in turn, which triggers ServiceNotFoundException indirectly if the device is under encryption. The cause is that WifiService is not running if the device is still locked. [Solution] In order to avoid ServiceNotFoundException in setWifiTethering, we add check on return value of getWifiManager. Moreover, check of UsbManager is also added to prevent potential similar issues of USB tethering. Bug: 123504004 Test: FrameworksNetTests adb shell am instrument -w com.android.frameworks.tests.net Test: CTS - CtsNetTestCases ANDROID_BUILD_droid-cts/tools/cts-tradefed run cts -m CtsNetTestCases Test: CTS - CtsNetTestCasesLegacyApi22 ANDROID_BUILD_droid-cts/tools/cts-tradefed run cts -m CtsNetTestCasesLegacyApi22 Test: CTS - CtsNetTestCasesLegacyPermission22 ANDROID_BUILD_droid-cts/tools/cts-tradefed run cts -m CtsNetTestCasesLegacyPermission22 Change-Id: I2643188b51900f97ba58c8614c66cb55ebfaa2f6
Loading
Please register or sign in to comment