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.processor;
17 
18 import com.squareup.javapoet.ClassName;
19 
20 /**
21  * {@link ClassName} instances shared across the processor.
22  *
23  * <p>This is required as most classes are not available to the processor so need to be referenced
24  * through {@link ClassName}
25  */
26 public class CommonClassNames {
27   static final ClassName CONTEXT_CLASSNAME = ClassName.get("android.content", "Context");
28   static final ClassName BUNDLE_CLASSNAME = ClassName.get("android.os", "Bundle");
29   static final ClassName PARCEL_CLASSNAME = ClassName.get("android.os", "Parcel");
30   static final ClassName PARCELABLE_CLASSNAME = ClassName.get("android.os", "Parcelable");
31   static final ClassName USER_HANDLE_CLASSNAME = ClassName.get("android.os", "UserHandle");
32   static final ClassName PROCESS_CLASSNAME = ClassName.get("android.os", "Process");
33   static final ClassName CROSS_PROFILE_FUTURE_RESULT_WRITER =
34       ClassName.get(
35           "com.google.android.enterprise.connectedapps.internal", "CrossProfileFutureResultWriter");
36   static final ClassName IF_AVAILABLE_FUTURE_RESULT_WRITER =
37       ClassName.get(
38           "com.google.android.enterprise.connectedapps.internal", "IfAvailableFutureResultWriter");
39   static final ClassName PARCELABLE_CREATOR_CLASSNAME =
40       ClassName.get("android.os.Parcelable", "Creator");
41   static final ClassName UNAVAILABLE_PROFILE_EXCEPTION_CLASSNAME =
42       ClassName.get(
43           "com.google.android.enterprise.connectedapps.exceptions", "UnavailableProfileException");
44   static final ClassName AVAILABILITY_RESTRICTIONS_CLASSNAME =
45       ClassName.get(
46           "com.google.android.enterprise.connectedapps.annotations", "AvailabilityRestrictions");
47   static final ClassName PROFILE_RUNTIME_EXCEPTION_CLASSNAME =
48       ClassName.get(
49           "com.google.android.enterprise.connectedapps.exceptions", "ProfileRuntimeException");
50   static final ClassName PROFILE_AWARE_UTILS_CLASSNAME =
51       ClassName.get("com.google.android.enterprise.connectedapps", "ConnectedAppsUtils");
52   static final ClassName EXCEPTION_THROWER_CLASSNAME =
53       ClassName.get("com.google.android.enterprise.connectedapps.internal", "ExceptionThrower");
54   static final ClassName BUNDLE_UTILITIES_CLASSNAME =
55       ClassName.get("com.google.android.enterprise.connectedapps.internal", "BundleUtilities");
56   static final ClassName METHOD_RUNNER_CLASSNAME =
57       ClassName.get("com.google.android.enterprise.connectedapps.internal", "MethodRunner");
58   static final ClassName BUNDLER_CLASSNAME =
59       ClassName.get("com.google.android.enterprise.connectedapps.internal", "Bundler");
60   static final ClassName BUNDLER_TYPE_CLASSNAME =
61       ClassName.get("com.google.android.enterprise.connectedapps.internal", "BundlerType");
62   static final ClassName BUNDLE_CALL_RECEIVER_CLASSNAME =
63       ClassName.get("com.google.android.enterprise.connectedapps.internal", "BundleCallReceiver");
64   public static final ClassName BINDER_CLASSNAME = ClassName.get("android.os", "Binder");
65   public static final ClassName INTENT_CLASSNAME = ClassName.get("android.content", "Intent");
66   static final ClassName CROSS_PROFILE_SENDER_CLASSNAME =
67       ClassName.get("com.google.android.enterprise.connectedapps", "CrossProfileSender");
68   public static final ClassName CROSSPROFILESERVICE_STUB_CLASSNAME =
69       ClassName.get("com.google.android.enterprise.connectedapps.ICrossProfileService", "Stub");
70   static final ClassName INVALID_PROTOCOL_BUFFER_EXCEPTION_CLASSNAME =
71       ClassName.get("com.google.protobuf", "InvalidProtocolBufferException");
72   static final ClassName PROFILE_CLASSNAME =
73       ClassName.get("com.google.android.enterprise.connectedapps", "Profile");
74   static final ClassName LOCAL_CALLBACK_CLASSNAME =
75       ClassName.get("com.google.android.enterprise.connectedapps", "LocalCallback");
76   public static final ClassName CROSS_PROFILE_CALLBACK_CLASSNAME =
77       ClassName.get("com.google.android.enterprise.connectedapps", "ICrossProfileCallback");
78   static final ClassName ASYNC_CALLBACK_PARAM_MULTIMERGER_CLASSNAME =
79       ClassName.get(
80           "com.google.android.enterprise.connectedapps.internal",
81           "CrossProfileCallbackMultiMerger");
82   static final ClassName CROSS_PROFILE_CALLBACK_BUNDLE_CALL_SENDER_CLASSNAME =
83       ClassName.get(
84           "com.google.android.enterprise.connectedapps.internal",
85           "CrossProfileCallbackBundleCallSender");
86   static final ClassName CROSS_PROFILE_CALLBACK_EXCEPTION_BUNDLE_CALL_SENDER_CLASSNAME =
87       ClassName.get(
88           "com.google.android.enterprise.connectedapps.internal",
89           "CrossProfileCallbackExceptionBundleCallSender");
90   static final ClassName ASYNC_CALLBACK_PARAM_MULTIMERGER_COMPLETE_LISTENER_CLASSNAME =
91       ClassName.get(
92           "com.google.android.enterprise.connectedapps.internal.CrossProfileCallbackMultiMerger",
93           "CrossProfileCallbackMultiMergerCompleteListener");
94 
95   public static final ClassName SERVICE_CLASSNAME = ClassName.get("android.app", "Service");
96   public static final ClassName EXCEPTION_CALLBACK_CLASSNAME =
97       ClassName.get("com.google.android.enterprise.connectedapps", "ExceptionCallback");
98   public static final ClassName CALLBACK_MERGER_EXCEPTION_CALLBACK_CLASSNAME =
99       ClassName.get(
100           "com.google.android.enterprise.connectedapps.internal",
101           "CallbackMergerExceptionCallback");
102   public static final ClassName PROFILE_CONNECTOR_CLASSNAME =
103       ClassName.get("com.google.android.enterprise.connectedapps", "ProfileConnector");
104   public static final ClassName ABSTRACT_PROFILE_CONNECTOR_CLASSNAME =
105       ClassName.get("com.google.android.enterprise.connectedapps", "AbstractProfileConnector");
106   public static final ClassName USER_CONNECTOR_CLASSNAME =
107       ClassName.get("com.google.android.enterprise.connectedapps", "UserConnector");
108   public static final ClassName ABSTRACT_USER_CONNECTOR_CLASSNAME =
109       ClassName.get("com.google.android.enterprise.connectedapps", "AbstractUserConnector");
110   public static final ClassName USER_CONNECTOR_WRAPPER_CLASSNAME =
111       ClassName.get("com.google.android.enterprise.connectedapps", "UserConnectorWrapper");
112   public static final ClassName ABSTRACT_PROFILE_CONNECTOR_BUILDER_CLASSNAME =
113       ClassName.get(
114           "com.google.android.enterprise.connectedapps.AbstractProfileConnector", "Builder");
115   public static final ClassName ABSTRACT_USER_CONNECTOR_BUILDER_CLASSNAME =
116       ClassName.get("com.google.android.enterprise.connectedapps.AbstractUserConnector", "Builder");
117   public static final ClassName CONNECTION_BINDER_CLASSNAME =
118       ClassName.get("com.google.android.enterprise.connectedapps", "ConnectionBinder");
119   public static final ClassName USER_BINDER_FACTORY_CLASSNAME =
120       ClassName.get("com.google.android.enterprise.connectedapps", "UserBinderFactory");
121   public static final ClassName SCHEDULED_EXECUTOR_SERVICE_CLASSNAME =
122       ClassName.get("java.util.concurrent", "ScheduledExecutorService");
123   public static final ClassName FAKE_PROFILE_CONNECTOR_CLASSNAME =
124       ClassName.get("com.google.android.enterprise.connectedapps.testing", "FakeProfileConnector");
125   public static final ClassName ABSTRACT_FAKE_PROFILE_CONNECTOR_CLASSNAME =
126       ClassName.get(
127           "com.google.android.enterprise.connectedapps.testing", "AbstractFakeProfileConnector");
128   public static final ClassName ABSTRACT_FAKE_USER_CONNECTOR_CLASSNAME =
129       ClassName.get(
130           "com.google.android.enterprise.connectedapps.testing", "AbstractFakeUserConnector");
131   public static final ClassName FAKE_USER_CONNECTOR_WRAPPER_CLASSNAME =
132       ClassName.get(
133           "com.google.android.enterprise.connectedapps.testing", "FakeUserConnectorWrapper");
134 
135   public static final ClassName VERSION_CLASSNAME = ClassName.get("android.os.Build", "VERSION");
136   public static final ClassName VERSION_CODES_CLASSNAME =
137       ClassName.get("android.os.Build", "VERSION_CODES");
138 
CommonClassNames()139   private CommonClassNames() {}
140 }
141