1 /*
2  * Copyright 2021 Google LLC
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *   https://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package com.google.android.enterprise.connectedapps.annotations;
17 
18 import java.lang.annotation.ElementType;
19 import java.lang.annotation.Retention;
20 import java.lang.annotation.RetentionPolicy;
21 import java.lang.annotation.Target;
22 
23 /**
24  * Indicate something is accessible from a different user.
25  *
26  * <p>Annotated methods must only return, or take as parameters, types supported by the Profile
27  * Aware SDK.
28  *
29  * <p>Annotated types must be provided by a {@link CrossUserProvider} class.
30  */
31 @Target({ElementType.METHOD, ElementType.TYPE})
32 @Retention(RetentionPolicy.CLASS)
33 public @interface CrossUser {
34 
35   /**
36    * The {@link CustomProfileConnector} used by this type.
37    *
38    * <p>Setting this option for a cross-profile type ensures the generated code provides a better
39    * API surface with more accurate Javadoc and stronger compile-time checking.
40    *
41    * <p>This argument can only be passed when annotating types, not methods.
42    *
43    * <p>Defaults to undefined, which allows any connector to be used.
44    */
connector()45   Class<?> connector() default CrossProfile.class;
46 
47   /**
48    * Custom parcelable wrappers to be accessible in this cross-profile type.
49    *
50    * <p>This argument can only be passed when annotating types, not methods.
51    */
parcelableWrappers()52   Class<?>[] parcelableWrappers() default {};
53 
54   /**
55    * Custom future wrappers to be accessible in this cross-profile type.
56    *
57    * <p>This argument can only be passed when annotating types, not methods.
58    */
futureWrappers()59   Class<?>[] futureWrappers() default {};
60 
61   /**
62    * Can this type contain only static {@link CrossUser} annotated methods.
63    *
64    * <p>This argument can only be passed when annotating types, not methods.
65    */
isStatic()66   boolean isStatic() default false;
67 
68   /**
69    * A list of additional used types
70    *
71    * <p>This argument can only be passed when annotating types, not methods.
72    */
additionalUsedTypes()73   Class<?>[] additionalUsedTypes() default {};
74 }
75