diff options
| author | 2020-06-10 11:06:37 -0700 | |
|---|---|---|
| committer | 2020-06-10 11:07:12 -0700 | |
| commit | 6bdadaf0a01b7efd4347c99c6e2a23f151d01970 (patch) | |
| tree | a43676d04b2c76b9182d91d25394127ee6e77522 | |
| parent | a621dad0b63a219fa47b2cbf7158930569502947 (diff) | |
Fix PackagePartitions contains null check
The subfolders can be null depending on the partition.
Bug: 158671002
Test: manual was tested as part of not yet merged
Ie09ccf4b64a0be26d19c9034a68ca4877ca49b81
Change-Id: Ic3a07867cb50b6b0b0e265e9540c52ee94c68050
| -rw-r--r-- | core/java/android/content/pm/PackagePartitions.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/core/java/android/content/pm/PackagePartitions.java b/core/java/android/content/pm/PackagePartitions.java index 653b9ec9e8f2..98a20f73a120 100644 --- a/core/java/android/content/pm/PackagePartitions.java +++ b/core/java/android/content/pm/PackagePartitions.java @@ -183,17 +183,20 @@ public class PackagePartitions { /** Returns whether the partition contains the specified file in its priv-app folder. */ public boolean containsPrivApp(@NonNull File scanFile) { - return FileUtils.contains(mPrivAppFolder.getFile(), canonicalize(scanFile)); + return mPrivAppFolder != null + && FileUtils.contains(mPrivAppFolder.getFile(), canonicalize(scanFile)); } /** Returns whether the partition contains the specified file in its app folder. */ public boolean containsApp(@NonNull File scanFile) { - return FileUtils.contains(mAppFolder.getFile(), canonicalize(scanFile)); + return mAppFolder != null + && FileUtils.contains(mAppFolder.getFile(), canonicalize(scanFile)); } /** Returns whether the partition contains the specified file in its overlay folder. */ public boolean containsOverlay(@NonNull File scanFile) { - return FileUtils.contains(mOverlayFolder.getFile(), canonicalize(scanFile)); + return mOverlayFolder != null + && FileUtils.contains(mOverlayFolder.getFile(), canonicalize(scanFile)); } } |