From 7428ecfebd0e3f0aed000f48c24cf1622fc1362b Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Mon, 26 Jul 2021 10:12:28 -0700 Subject: [PATCH] ipn/ipnlocal: populate Hostinfo.Package on Android Fixes tailscale/corp#2266 Signed-off-by: Brad Fitzpatrick --- ipn/ipnlocal/local.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ipn/ipnlocal/local.go b/ipn/ipnlocal/local.go index eb7bf4cf5..b612ccde7 100644 --- a/ipn/ipnlocal/local.go +++ b/ipn/ipnlocal/local.go @@ -2159,6 +2159,18 @@ func applyPrefsToHostinfo(hi *tailcfg.Hostinfo, prefs *ipn.Prefs) { } if v := prefs.OSVersion; v != "" { hi.OSVersion = v + + // The Android app annotates when Google Play Services + // aren't available by tacking on a string to the + // OSVersion. Promote that to the Hostinfo.Package + // field instead, rather than adding a new pref, as + // this applyPrefsToHostinfo mechanism is mostly + // abused currently. TODO(bradfitz): instead let + // frontends update Hostinfo, without using Prefs. + if runtime.GOOS == "android" && strings.HasSuffix(v, " [nogoogle]") { + hi.Package = "nogoogle" + hi.OSVersion = strings.TrimSuffix(v, " [nogoogle]") + } } if m := prefs.DeviceModel; m != "" { hi.DeviceModel = m