Introduce NameResolver.Args.Extensions #11669
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
grpc-binder's upcoming
IntentNameResolver
needs to know the target Android user so it can resolve target URIs in the correct place. Unfortunately, Android's built in intent:// URI scheme has no way to specify a user and in fact theandroid.os.UserHandle
object can't reasonably be encoded as a String at all.We solve this problem by extending
NameResolver.Args
to permit externally defined arguments using the same type-safe and domain-specificKey<T>
pattern used byCallOptions
,Context
andCreateSubchannelArgs
. New "extension" arguments could apply to all NameResolvers of a certain URI scheme, to all NameResolvers producing a particular type ofjava.net.SocketAddress
, or even to a specificNameResolver
subclass.A follow up PR will move the target
UserHandle
from being a property of theManagedChannel
to being a property of theSocketAddress
.