From 1126a8e30b884c66f831e88f89ebf2f10a0e7795 Mon Sep 17 00:00:00 2001 From: John Cormie Date: Mon, 23 Dec 2024 13:29:40 -0800 Subject: [PATCH] binder: A standard API for pointing resolvers at a different Android User. (#11775) --- .../src/main/java/io/grpc/binder/ApiConstants.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/binder/src/main/java/io/grpc/binder/ApiConstants.java b/binder/src/main/java/io/grpc/binder/ApiConstants.java index 43e94338fdc..292c580c2b8 100644 --- a/binder/src/main/java/io/grpc/binder/ApiConstants.java +++ b/binder/src/main/java/io/grpc/binder/ApiConstants.java @@ -17,7 +17,9 @@ package io.grpc.binder; import android.content.Intent; +import android.os.UserHandle; import io.grpc.ExperimentalApi; +import io.grpc.NameResolver; /** Constant parts of the gRPC binder transport public API. */ @ExperimentalApi("https://github.com/grpc/grpc-java/issues/8022") @@ -29,4 +31,16 @@ private ApiConstants() {} * themselves in a {@link android.app.Service#onBind(Intent)} call. */ public static final String ACTION_BIND = "grpc.io.action.BIND"; + + /** + * Specifies the Android user in which target URIs should be resolved. + * + *

{@link UserHandle} can't reasonably be encoded in a target URI string. Instead, all + * {@link io.grpc.NameResolverProvider}s producing {@link AndroidComponentAddress}es should let + * clients address servers in another Android user using this argument. + * + *

See also {@link AndroidComponentAddress#getTargetUser()}. + */ + public static final NameResolver.Args.Key TARGET_ANDROID_USER = + NameResolver.Args.Key.create("target-android-user"); }