summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Julia Reynolds <juliacr@google.com> 2023-08-18 14:38:04 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2023-08-18 14:38:04 +0000
commit42ff9234f2b148ba042f36a4579ecfd1b719423b (patch)
tree962429bc891e1fc6b8f91021b0c4d55aa4ee9490
parent1da9e3408c1534a809cc24eeefe2f0fa2bfb7c21 (diff)
parent81e905613ea9cf194bfdb289b5af3123f5023a1b (diff)
Merge "Closes file descriptor after loading ranking map" into udc-qpr-dev am: 551f53de32 am: 81e905613e
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/24465916 Change-Id: Ic5bbf88adff2da9b0d75a09c42fb8a85bd31822b Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-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));