Merge "Closes file descriptor after loading ranking map" into udc-qpr-dev

This commit is contained in:
Julia Reynolds
2023-08-18 13:46:20 +00:00
committed by Android (Google) Code Review
2 changed files with 6 additions and 1 deletions

View File

@@ -92,6 +92,7 @@ public class NotificationRankingUpdate implements Parcelable {
mapParcel.recycle();
if (buffer != null) {
mRankingMapFd.unmap(buffer);
mRankingMapFd.close();
}
}
} else {

View File

@@ -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));