Skip to content

Commit 1126a8e

Browse files
authoredDec 23, 2024··
binder: A standard API for pointing resolvers at a different Android User. (#11775)
1 parent 805cad3 commit 1126a8e

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
 

‎binder/src/main/java/io/grpc/binder/ApiConstants.java

+14
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717
package io.grpc.binder;
1818

1919
import android.content.Intent;
20+
import android.os.UserHandle;
2021
import io.grpc.ExperimentalApi;
22+
import io.grpc.NameResolver;
2123

2224
/** Constant parts of the gRPC binder transport public API. */
2325
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/8022")
@@ -29,4 +31,16 @@ private ApiConstants() {}
2931
* themselves in a {@link android.app.Service#onBind(Intent)} call.
3032
*/
3133
public static final String ACTION_BIND = "grpc.io.action.BIND";
34+
35+
/**
36+
* Specifies the Android user in which target URIs should be resolved.
37+
*
38+
* <p>{@link UserHandle} can't reasonably be encoded in a target URI string. Instead, all
39+
* {@link io.grpc.NameResolverProvider}s producing {@link AndroidComponentAddress}es should let
40+
* clients address servers in another Android user using this argument.
41+
*
42+
* <p>See also {@link AndroidComponentAddress#getTargetUser()}.
43+
*/
44+
public static final NameResolver.Args.Key<UserHandle> TARGET_ANDROID_USER =
45+
NameResolver.Args.Key.create("target-android-user");
3246
}

0 commit comments

Comments
 (0)
Please sign in to comment.