Read DNS query log settings from system property
Currently, we need to provide a special build of the image for carrier
testing, so that we can find out which apps are using DNS queries
when the device idle. In fact, DnsQueryLog already can dump the required
information, but lacks the interface to set the number of records. The
default number of records 200 may not be enough for a 24 hours idle
test. This commit enables DNS resolver to read the record setting from
system properties, which is limited to 0 ~ 10000.
Dumping DnsQueryLog requires root permission. There is no privacy
concern in production builds.
Bug: 279596912
Bug: 231264474
Bug: 200748696
Test: Run script like this to trigger 400 DNS queries
#!/bin/bash
for ((i=1; i<=400; i++))
do
hostname="http://example${i}.com"
adb shell am start -a android.intent.action.VIEW -d "$hostname"
sleep 1
done
$adb root; chmod +x run_dns_queries.sh; ./run_dns_queries.sh
$adb shell dumpsys dnsresolver querylog | grep time | wc -l
200
$adb shell setprop persist.net.dns_query_log_size 3
$adb reboot
$adb root; chmod +x run_dns_queries.sh; ./run_dns_queries.sh
$adb shell dumpsys dnsresolver querylog | grep time | wc -l
3
$adb shell setprop persist.net.dns_query_log_size 300
$adb reboot
$adb root; chmod +x run_dns_queries.sh; ./run_dns_queries.sh
$adb shell dumpsys dnsresolver querylog | grep time | wc -l
300
Change-Id: Ic8fbe7e3ec52e1901fea9962d1c7564152693fc3
Loading
Please register or sign in to comment