[mdns] fix duplicated records for multiple questions
Existing MdnsRecordRepositiry#getReply will result in duplicated RRs in
answer and additional records sections if multiple PTR questions for the
same service are received in a single query message.
This commit fixes this by using a Set<> for maintaining the RR set and
moving the NSEC construction to outer of the addReplyFromService() after
all answer and additional records have been added.
This commit also refactors the unit tests to cover more cases of
multiple queries other than PTR records
Bug: 265095929
Change-Id: I379dd89703915406c5700ed19aad46ef4035b917
2 files changed