HostValidator
class HostValidator
Validates that the calling package is authorized to connect to a CarAppService.
Host are expected to either hold android.car.permission.TEMPLATE_RENDERER privileged permission, or be included in the allow-listed set of hosts, identified by their signatures.
| See also | |
|---|---|
HostValidator.Builder |
Summary
Nested types |
|---|
class HostValidator.BuilderBuilder of |
Constants |
|
|---|---|
const HostValidator |
A host validator that doesn't block any hosts. |
const String! |
TEMPLATE_RENDERER_PERMISSION = "android.car.permission.TEMPLATE_RENDERER"System permission used to identify valid hosts (only used by hosts running on Android API level 31 or later). |
Public functions |
|
|---|---|
(Mutable)Map<String!, (Mutable)List<String!>!> |
Returns a map from package name to signature digests of each of the allowed hosts. |
Boolean |
isValidHost(hostInfo: HostInfo)Returns whether the given host is allowed to bind to this client. |
Constants
ALLOW_ALL_HOSTS_VALIDATOR
const val ALLOW_ALL_HOSTS_VALIDATOR: HostValidator
A host validator that doesn't block any hosts.
This is intended to be used only during development.
| See also | |
|---|---|
createHostValidator |
TEMPLATE_RENDERER_PERMISSION
const val TEMPLATE_RENDERER_PERMISSION = "android.car.permission.TEMPLATE_RENDERER": String!
System permission used to identify valid hosts (only used by hosts running on Android API level 31 or later). Other hosts must be allow-listed using addAllowedHost or addAllowedHosts
Public functions
getAllowedHosts
fun getAllowedHosts(): (Mutable)Map<String!, (Mutable)List<String!>!>
Returns a map from package name to signature digests of each of the allowed hosts.
isValidHost
fun isValidHost(hostInfo: HostInfo): Boolean
Returns whether the given host is allowed to bind to this client.