summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSongchun Fan <schfan@google.com>2022-06-17 13:18:48 -0700
committerSongchun Fan <schfan@google.com>2022-06-17 20:23:53 +0000
commiteda4cb6bca4d5364ede9d52184a27b87b005928d (patch)
treecdd26b00a65506656322df6f3d86743eefa02e91
parentb455e10fdceac0f39401aa4a15803dcf510f371e (diff)
downloadcts-eda4cb6bca4d5364ede9d52184a27b87b005928d.tar.gz
[cts] fix NPE in InstallSessionCleanupTest
During the test, it is possible that there exists install sessions that don't have a installer name. BUG: 235925351 Test: atest android.content.pm.cts.InstallSessionCleanupTest#testSessionsDeletedOnInstallerUninstalled Change-Id: I535d8b43ce8612296fa17b2d24bf34fb7aea2335
-rw-r--r--tests/tests/content/src/android/content/pm/cts/InstallSessionCleanupTest.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/tests/content/src/android/content/pm/cts/InstallSessionCleanupTest.java b/tests/tests/content/src/android/content/pm/cts/InstallSessionCleanupTest.java
index dd9d10f85c1..599be5ca9fd 100644
--- a/tests/tests/content/src/android/content/pm/cts/InstallSessionCleanupTest.java
+++ b/tests/tests/content/src/android/content/pm/cts/InstallSessionCleanupTest.java
@@ -103,7 +103,8 @@ public class InstallSessionCleanupTest {
final List<PackageInstaller.SessionInfo> allSessions = mPackageInstaller.getAllSessions();
List<Integer> result = new ArrayList<>();
for (PackageInstaller.SessionInfo sessionInfo : allSessions) {
- if (sessionInfo.installerPackageName.equals(installerPackageName)) {
+ if (sessionInfo.installerPackageName != null
+ && sessionInfo.installerPackageName.equals(installerPackageName)) {
result.add(sessionInfo.sessionId);
}
}