diff options
author | Roshan Pius <rpius@google.com> | 2020-03-09 14:53:23 -0700 |
---|---|---|
committer | Roshan Pius <rpius@google.com> | 2020-03-09 14:53:41 -0700 |
commit | a4df84863d554f08abebf0c39748deded4121814 (patch) | |
tree | 706cf76dce4592e45248385a61eb2b274769b773 /tests | |
parent | 1fc832135db1f2940f6e3b8ca676eefecd085515 (diff) |
WifiServiceImpl: Fix package removed handling
When package is fully removed (unlike app disable), then
getApplicationInfo will return NameNotFoundException exception.
Bug: 151107194
Test: atest com.android.server.wifi
Test: Manually verified that user approval for network request were
cleared after uninstalling CTS verifier app.
Change-Id: I50b8d4b67b6481c42b6157d6534f78bb08fb9d28
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java b/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java index 8ecac08bc..935c52fb4 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java @@ -3648,7 +3648,8 @@ public class WifiServiceImplTest extends WifiBaseTest { && filter.hasAction(Intent.ACTION_PACKAGE_CHANGED))); int uid = TEST_UID; String packageName = TEST_PACKAGE_NAME; - when(mPackageManager.getApplicationInfo(TEST_PACKAGE_NAME, 0)).thenReturn(null); + doThrow(new PackageManager.NameNotFoundException()).when(mPackageManager) + .getApplicationInfo(TEST_PACKAGE_NAME, 0); // Send the broadcast Intent intent = new Intent(Intent.ACTION_PACKAGE_FULLY_REMOVED); intent.putExtra(Intent.EXTRA_UID, uid); |