Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ebe06e8b authored by Maciej Żenczykowski's avatar Maciej Żenczykowski
Browse files

DnsResolver - improve aosp api level detection



This does a better job of handling non-cuttlefish,
ie. things like 'aosp_blueline' on aosp-master.

This will now detect rvc-dev as R, aosp cuttlefish as S,
and aosp blueline as R (should be S...).

Before this change aosp blueline would still be detected as Q.

Test: builds, atest, dnsresolver tests, TreeHugger
Bug: 159994981
Signed-off-by: default avatarMaciej Żenczykowski <maze@google.com>
Change-Id: I81cb89d221dc19fe19e1acaebe75b953ea3cfaa6
parent fc9aa724
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -31,10 +31,12 @@ bool resolv_init(const ResolverNetdCallbacks* callbacks) {
    resolv_set_log_severity(android::base::WARNING);

    uint64_t buildVersionSdk = android::base::GetUintProperty<uint64_t>("ro.build.version.sdk", 0);
    uint64_t buildVersionPreviewSdk =
            android::base::GetUintProperty<uint64_t>("ro.build.version.preview_sdk", 0);
    uint64_t firstApiLevel =
            android::base::GetUintProperty<uint64_t>("ro.product.first_api_level", 0);
    using android::net::gApiLevel;
    gApiLevel = std::max(buildVersionSdk, firstApiLevel);
    gApiLevel = std::max(buildVersionSdk + !!buildVersionPreviewSdk, firstApiLevel);
    using android::net::gResNetdCallbacks;
    gResNetdCallbacks.check_calling_permission = callbacks->check_calling_permission;
    gResNetdCallbacks.get_network_context = callbacks->get_network_context;