summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Julia Reynolds <juliacr@google.com> 2023-08-18 13:46:20 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2023-08-18 13:46:20 +0000
commit551f53de325698907613cdde1b38e60bc9e02e6b (patch)
treee515b8f6df8a8d171a49bca831fb79f321caf59b
parent4b5d78bb32fda5f4cb7404980f583b3c6d31609c (diff)
parenta254049856f00083ea42c8007916f118d05ce1d4 (diff)
Merge "Closes file descriptor after loading ranking map" into udc-qpr-dev
-rw-r--r--core/java/android/service/notification/NotificationRankingUpdate.java1
-rw-r--r--core/tests/coretests/src/android/service/notification/NotificationRankingUpdateTest.java6
2 files changed, 6 insertions, 1 deletions
diff --git a/core/java/android/service/notification/NotificationRankingUpdate.java b/core/java/android/service/notification/NotificationRankingUpdate.java
index 75640bd47ab9..f3b4c6da4a01 100644
--- a/core/java/android/service/notification/NotificationRankingUpdate.java
+++ b/core/java/android/service/notification/NotificationRankingUpdate.java
@@ -92,6 +92,7 @@ public class NotificationRankingUpdate implements Parcelable {
mapParcel.recycle();
if (buffer != null) {
mRankingMapFd.unmap(buffer);
+ mRankingMapFd.close();
}
}
} else {
diff --git a/core/tests/coretests/src/android/service/notification/NotificationRankingUpdateTest.java b/core/tests/coretests/src/android/service/notification/NotificationRankingUpdateTest.java
index a84ac55f0d5a..55ded9c8813d 100644
--- a/core/tests/coretests/src/android/service/notification/NotificationRankingUpdateTest.java
+++ b/core/tests/coretests/src/android/service/notification/NotificationRankingUpdateTest.java
@@ -136,7 +136,11 @@ public class NotificationRankingUpdateTest {
NotificationListenerService.RankingMap retrievedRankings =
retrievedRankingUpdate.getRankingMap();
assertNotNull(retrievedRankings);
- assertTrue(retrievedRankingUpdate.isFdNotNullAndClosed());
+ // The rankingUpdate file descriptor is only non-null in the new path.
+ if (SystemUiSystemPropertiesFlags.getResolver().isEnabled(
+ SystemUiSystemPropertiesFlags.NotificationFlags.RANKING_UPDATE_ASHMEM)) {
+ assertTrue(retrievedRankingUpdate.isFdNotNullAndClosed());
+ }
NotificationListenerService.Ranking retrievedRanking =
new NotificationListenerService.Ranking();
assertTrue(retrievedRankings.getRanking(TEST_KEY, retrievedRanking));