diff --git a/kotlin/android/app/src/main/java/dev/firezone/android/tunnel/TunnelService.kt b/kotlin/android/app/src/main/java/dev/firezone/android/tunnel/TunnelService.kt index b4bf9662f..9df573059 100644 --- a/kotlin/android/app/src/main/java/dev/firezone/android/tunnel/TunnelService.kt +++ b/kotlin/android/app/src/main/java/dev/firezone/android/tunnel/TunnelService.kt @@ -213,7 +213,7 @@ class TunnelService : VpnService() { apiUrl = config.apiUrl, token = token, deviceId = deviceId(), - deviceName = Build.MODEL, + deviceName = getDeviceName(), osVersion = Build.VERSION.RELEASE, logDir = getLogDir(), logFilter = config.logFilter, @@ -384,6 +384,15 @@ class TunnelService : VpnService() { startForeground(STATUS_NOTIFICATION_ID, notification) } + private fun getDeviceName(): String { + val deviceName = appRestrictions.getString("deviceName") + return if (deviceName.isNullOrBlank() || deviceName == "null") { + Build.MODEL + } else { + deviceName + } + } + companion object { enum class State { CONNECTING, diff --git a/kotlin/android/app/src/main/res/values/strings.xml b/kotlin/android/app/src/main/res/values/strings.xml index f640aa60c..66058adb0 100644 --- a/kotlin/android/app/src/main/res/values/strings.xml +++ b/kotlin/android/app/src/main/res/values/strings.xml @@ -26,7 +26,7 @@ Sign Out - Launching Chrome to sign in... + Launching Chrome to sign in… Error @@ -62,4 +62,9 @@ If this list is empty, no applications are disallowed. Either "Allowed Applications" OR "Disallowed Applications" may be set *but not* both. + Device Name + + The name of the device. This is used to identify the device in the admin portal. + If unset, device\'s model name will be used. + diff --git a/kotlin/android/app/src/main/res/xml/app_restrictions.xml b/kotlin/android/app/src/main/res/xml/app_restrictions.xml index 761527b9a..90296d198 100644 --- a/kotlin/android/app/src/main/res/xml/app_restrictions.xml +++ b/kotlin/android/app/src/main/res/xml/app_restrictions.xml @@ -18,4 +18,10 @@ android:key="disallowedApplications" android:restrictionType="string" android:title="@string/config_disallowed_applications_title" /> + +