File tree Expand file tree Collapse file tree 3 files changed +26
-8
lines changed
binder/src/main/java/io/grpc/binder Expand file tree Collapse file tree 3 files changed +26
-8
lines changed Original file line number Diff line number Diff line change @@ -250,7 +250,22 @@ public Builder setBindIntentFromComponent(ComponentName component) {
250
250
return this ;
251
251
}
252
252
253
- /** See {@link AndroidComponentAddress#getTargetUser()}. */
253
+ /**
254
+ * Specifies the Android user in which the built Address' bind Intent will be evaluated.
255
+ *
256
+ * <p>Connecting to a server in a different Android user is uncommon and requires the client app
257
+ * have runtime visibility of @SystemApi's and hold certain @SystemApi permissions.
258
+ * The device must also be running Android SDK version 30 or higher.
259
+ *
260
+ * <p>See https://developer.android.com/guide/app-compatibility/restrictions-non-sdk-interfaces
261
+ * for details on which apps can call the underlying @SystemApi's needed to make this type
262
+ * of connection.
263
+ *
264
+ * <p>One of the "android.permission.INTERACT_ACROSS_XXX" permissions is required. The exact one
265
+ * depends on the calling user's relationship to the target user, whether client and server are
266
+ * in the same or different apps, and the version of Android in use. See {@link
267
+ * Context#bindServiceAsUser}, the essential underlying Android API, for details.
268
+ */
254
269
@ ExperimentalApi ("https://github.com/grpc/grpc-java/issues/10173" )
255
270
public Builder setTargetUser (@ Nullable UserHandle targetUser ) {
256
271
this .targetUser = targetUser ;
Original file line number Diff line number Diff line change @@ -35,12 +35,15 @@ private ApiConstants() {}
35
35
/**
36
36
* Specifies the Android user in which target URIs should be resolved.
37
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.
38
+ * <p>{@link UserHandle} can't reasonably be encoded in a target URI string. Instead, all {@link
39
+ * io.grpc.NameResolverProvider}s producing {@link AndroidComponentAddress}es should let clients
40
+ * address servers in another Android user using this argument.
41
41
*
42
- * <p>See also {@link AndroidComponentAddress#getTargetUser()}.
42
+ * <p>Connecting to a server in a different Android user is uncommon and can only be done by a
43
+ * "system app" client with special permissions. See {@link
44
+ * AndroidComponentAddress.Builder#setTargetUser(UserHandle)} for details.
43
45
*/
46
+ @ ExperimentalApi ("https://github.com/grpc/grpc-java/issues/10173" )
44
47
public static final NameResolver .Args .Key <UserHandle > TARGET_ANDROID_USER =
45
48
NameResolver .Args .Key .create ("target-android-user" );
46
49
}
Original file line number Diff line number Diff line change @@ -242,9 +242,9 @@ public BinderChannelBuilder securityPolicy(SecurityPolicy securityPolicy) {
242
242
* specify a {@link UserHandle}. If neither the Channel nor the {@link AndroidComponentAddress}
243
243
* specifies a target user, the {@link UserHandle} of the current process will be used.
244
244
*
245
- * <p>Targeting a Service in a different Android user is uncommon and requires special permissions
246
- * normally reserved for system apps . See {@link android.content.Context#bindServiceAsUser} for
247
- * details.
245
+ * <p>Connecting to a server in a different Android user is uncommon and can only be done by a
246
+ * "system app" client with special permissions . See {@link
247
+ * AndroidComponentAddress.Builder#setTargetUser(UserHandle)} for details.
248
248
*
249
249
* @deprecated This method's name is misleading because it implies an impersonated client identity
250
250
* when it's actually specifying part of the server's location. It's also no longer necessary
You can’t perform that action at this time.
0 commit comments