Closes file descriptor after loading ranking map
Closes file descriptor after loading ranking map from SharedMemory object. Bug: 249848655 Test: atest NotificationRankingUpdateTest, manual flash+NotificationShellCmd to issue 500 notifications with reranking. Change-Id: I66779f4eae5ff93cc6a90d3fd00b829ab3670cff
This commit is contained in:
@@ -92,6 +92,7 @@ public class NotificationRankingUpdate implements Parcelable {
|
||||
mapParcel.recycle();
|
||||
if (buffer != null) {
|
||||
mRankingMapFd.unmap(buffer);
|
||||
mRankingMapFd.close();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user