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) {
250250 return this ;
251251 }
252252
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+ */
254269 @ ExperimentalApi ("https://github.com/grpc/grpc-java/issues/10173" )
255270 public Builder setTargetUser (@ Nullable UserHandle targetUser ) {
256271 this .targetUser = targetUser ;
Original file line number Diff line number Diff line change @@ -35,12 +35,15 @@ private ApiConstants() {}
3535 /**
3636 * Specifies the Android user in which target URIs should be resolved.
3737 *
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.
4141 *
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.
4345 */
46+ @ ExperimentalApi ("https://github.com/grpc/grpc-java/issues/10173" )
4447 public static final NameResolver .Args .Key <UserHandle > TARGET_ANDROID_USER =
4548 NameResolver .Args .Key .create ("target-android-user" );
4649}
Original file line number Diff line number Diff line change @@ -242,9 +242,9 @@ public BinderChannelBuilder securityPolicy(SecurityPolicy securityPolicy) {
242242 * specify a {@link UserHandle}. If neither the Channel nor the {@link AndroidComponentAddress}
243243 * specifies a target user, the {@link UserHandle} of the current process will be used.
244244 *
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.
248248 *
249249 * @deprecated This method's name is misleading because it implies an impersonated client identity
250250 * 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