1 /*
2  * Copyright (C) 2020 The Android Open Source Project
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  *      http://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 
17 package android.appenumeration.cts;
18 
19 public class Constants {
20     public static final String PKG_BASE = "android.appenumeration.";
21     public static final String TEST_PKG = "android.appenumeration.cts";
22 
23     /** A package that queries for {@link #TARGET_NO_API} package */
24     public static final String QUERIES_PACKAGE = PKG_BASE + "queries.pkg";
25     /** Queries for the unexported authority in {@link #TARGET_FILTERS} provider */
26     public static final String QUERIES_UNEXPORTED_PROVIDER_AUTH =
27             PKG_BASE + "queries.provider.authority.unexported";
28     /** Queries for the unexported action in {@link #TARGET_FILTERS} provider */
29     public static final String QUERIES_UNEXPORTED_PROVIDER_ACTION =
30             PKG_BASE + "queries.provider.action.unexported";
31     /** Queries for the unexported action in {@link #TARGET_FILTERS} service filter */
32     public static final String QUERIES_UNEXPORTED_SERVICE_ACTION =
33             PKG_BASE + "queries.service.action.unexported";
34     /** Queries for the unexported action in {@link #TARGET_FILTERS} activity filter */
35     public static final String QUERIES_UNEXPORTED_ACTIVITY_ACTION =
36             PKG_BASE + "queries.activity.action.unexported";
37     /** A package that queries for the authority in {@link #TARGET_FILTERS} provider */
38     public static final String QUERIES_PROVIDER_AUTH = PKG_BASE + "queries.provider.authority";
39     /** A package that queries for the authority in {@link #TARGET_FILTERS} provider */
40     public static final String QUERIES_PROVIDER_ACTION = PKG_BASE + "queries.provider.action";
41     /** A package that queries for the action in {@link #TARGET_FILTERS} service filter */
42     public static final String QUERIES_SERVICE_ACTION = PKG_BASE + "queries.service.action";
43     /** A package that queries for the action in {@link #TARGET_FILTERS} activity filter */
44     public static final String QUERIES_ACTIVITY_ACTION = PKG_BASE + "queries.activity.action";
45     /** A package that has no queries but gets the QUERY_ALL_PACKAGES permission */
46     public static final String QUERIES_NOTHING_PERM = PKG_BASE + "queries.nothing.haspermission";
47     /** A package that has no queries but has a provider that can be queried */
48     public static final String QUERIES_NOTHING_PROVIDER = PKG_BASE + "queries.nothing.hasprovider";
49     /** A package that has no queries tag or permissions but targets Q */
50     public static final String QUERIES_NOTHING_Q = PKG_BASE + "queries.nothing.q";
51     /** A package that has no queries tag or permission to query any specific packages */
52     public static final String QUERIES_NOTHING = PKG_BASE + "queries.nothing";
53     /** Another package that has no queries tag or permission to query any specific packages */
54     public static final String QUERIES_NOTHING_RECEIVES_URI =
55             PKG_BASE + "queries.nothing.receives.uri";
56     public static final String QUERIES_NOTHING_RECEIVES_PERM_URI =
57             PKG_BASE + "queries.nothing.receives.perm.uri";
58     /** Another package that has no queries tag or permission to query any specific packages */
59     public static final String QUERIES_NOTHING_SEES_INSTALLER =
60             PKG_BASE + "queries.nothing.sees.installer";
61     /** A package that queries nothing, but is part of a shared user */
62     public static final String QUERIES_NOTHING_SHARED_USER = PKG_BASE + "queries.nothing.shareduid";
63     /** A package that queries nothing, but uses a shared library */
64     public static final String QUERIES_NOTHING_USES_LIBRARY =
65             PKG_BASE + "queries.nothing.useslibrary";
66     /** A package that queries nothing, but uses a shared library */
67     public static final String QUERIES_NOTHING_USES_OPTIONAL_LIBRARY =
68             PKG_BASE + "queries.nothing.usesoptionallibrary";
69     /** A package that queries via wildcard action. */
70     public static final String QUERIES_WILDCARD_ACTION = PKG_BASE + "queries.wildcard.action";
71     /** A package that queries for all BROWSABLE intents. */
72     public static final String QUERIES_WILDCARD_BROWSABLE = PKG_BASE + "queries.wildcard.browsable";
73     /** A package that queries for all profile / contact targets. */
74     public static final String QUERIES_WILDCARD_CONTACTS = PKG_BASE + "queries.wildcard.contacts";
75     /** A package that queries for document viewer / editor targets. */
76     public static final String QUERIES_WILDCARD_EDITOR = PKG_BASE + "queries.wildcard.editor";
77     /** A package that queries for all jpeg share targets. */
78     public static final String QUERIES_WILDCARD_SHARE = PKG_BASE + "queries.wildcard.share";
79     /** A package that queries for all web intent browsable targets. */
80     public static final String QUERIES_WILDCARD_WEB = PKG_BASE + "queries.wildcard.web";
81     /** A package that queries for only browser intent targets. */
82     public static final String QUERIES_WILDCARD_BROWSER = PKG_BASE + "queries.wildcard.browser";
83 
84     /** A package that queries for {@link #TARGET_NO_API} package */
85     public static final String TARGET_SHARED_USER = PKG_BASE + "noapi.shareduid";
86     /** A package that exposes itself via various intent filters (activities, services, etc.) */
87     public static final String TARGET_FILTERS = PKG_BASE + "filters";
88     /** A package that declares itself force queryable, making it visible to all other packages.
89      *  This is installed as forceQueryable as non-system apps cannot declare themselves as such. */
90     public static final String TARGET_FORCEQUERYABLE = PKG_BASE + "forcequeryable";
91     /** A package that declares itself force queryable, but is installed normally making it not
92      *  visible to other packages */
93     public static final String TARGET_FORCEQUERYABLE_NORMAL =
94             PKG_BASE + "forcequeryable.normalinstall";
95     /** A package with no published API and so isn't queryable by anything but package name */
96     public static final String TARGET_NO_API = PKG_BASE + "noapi";
97     /** A package with no published API and just for installing/uninstalling during test */
98     public static final String TARGET_STUB = PKG_BASE + "stub";
99     /** A package that offers an activity used for opening / editing file types */
100     public static final String TARGET_EDITOR = PKG_BASE + "editor.activity";
101     /** A package that offers an activity used viewing a contact / profile */
102     public static final String TARGET_CONTACTS = PKG_BASE + "contacts.activity";
103     /** A package that offers an content sharing activity */
104     public static final String TARGET_SHARE = PKG_BASE + "share.activity";
105     /** A package that offers an activity that handles browsable web intents for a specific host */
106     public static final String TARGET_WEB = PKG_BASE + "web.activity";
107     /** A package that offers an activity acts as a browser with host undefined */
108     public static final String TARGET_BROWSER = PKG_BASE + "browser.activity";
109     /** A package that offers an activity acts as a browser, but uses a wildcard for host */
110     public static final String TARGET_BROWSER_WILDCARD = PKG_BASE + "browser.wildcard.activity";
111     /** A package that offers a shared library */
112     public static final String TARGET_SHARED_LIBRARY_PACKAGE = "com.android.cts.ctsshim";
113     /** A package that exposes itself as a syncadapter. */
114     public static final String TARGET_SYNCADAPTER = PKG_BASE + "syncadapter";
115     /** A package that exposes itself as a syncadapter with a shared uid. */
116     public static final String TARGET_SYNCADAPTER_SHARED_USER = PKG_BASE + "syncadapter.shareduid";
117     /** A package that exposes itself as a appwidgetprovider. */
118     public static final String TARGET_APPWIDGETPROVIDER = PKG_BASE + "appwidgetprovider";
119     /** A package that exposes itself as a appwidgetprovider with a shared uid. */
120     public static final String TARGET_APPWIDGETPROVIDER_SHARED_USER =
121             PKG_BASE + "appwidgetprovider.shareduid";
122     /** A package that offers an activity which handles preferred activity test intent for the
123      *  tests of preferred activity. */
124     public static final String TARGET_PREFERRED_ACTIVITY = PKG_BASE + "preferred.activity";
125 
126     private static final String BASE_PATH = "/data/local/tmp/cts/appenumeration/";
127     public static final String TARGET_NO_API_APK = BASE_PATH + "CtsAppEnumerationNoApi.apk";
128     public static final String TARGET_STUB_APK = BASE_PATH + "CtsAppEnumerationStub.apk";
129     public static final String TARGET_FILTERS_APK = BASE_PATH + "CtsAppEnumerationFilters.apk";
130     public static final String QUERIES_NOTHING_SEES_INSTALLER_APK =
131             BASE_PATH + "CtsAppEnumerationQueriesNothingSeesInstaller.apk";
132 
133     public static final String[] ALL_QUERIES_TARGETING_R_PACKAGES = {
134             QUERIES_NOTHING,
135             QUERIES_NOTHING_PERM,
136             QUERIES_ACTIVITY_ACTION,
137             QUERIES_SERVICE_ACTION,
138             QUERIES_PROVIDER_AUTH,
139             QUERIES_UNEXPORTED_ACTIVITY_ACTION,
140             QUERIES_UNEXPORTED_SERVICE_ACTION,
141             QUERIES_UNEXPORTED_PROVIDER_AUTH,
142             QUERIES_PACKAGE,
143             QUERIES_NOTHING_SHARED_USER,
144             QUERIES_WILDCARD_ACTION,
145             QUERIES_WILDCARD_BROWSABLE,
146             QUERIES_WILDCARD_CONTACTS,
147             QUERIES_WILDCARD_EDITOR,
148             QUERIES_WILDCARD_SHARE,
149             QUERIES_WILDCARD_WEB,
150     };
151 
152     public static final String ACTIVITY_CLASS_TEST = PKG_BASE + "cts.query.TestActivity";
153     public static final String ACTIVITY_CLASS_DUMMY_ACTIVITY = PKG_BASE + "testapp.DummyActivity";
154 
155     public static final String ACTION_MANIFEST_ACTIVITY = PKG_BASE + "action.ACTIVITY";
156     public static final String ACTION_MANIFEST_SERVICE = PKG_BASE + "action.SERVICE";
157     public static final String ACTION_MANIFEST_PROVIDER = PKG_BASE + "action.PROVIDER";
158     public static final String ACTION_SEND_RESULT = PKG_BASE + "cts.action.SEND_RESULT";
159     public static final String ACTION_GET_PACKAGE_INFO = PKG_BASE + "cts.action.GET_PACKAGE_INFO";
160     public static final String ACTION_GET_PACKAGES_FOR_UID =
161             PKG_BASE + "cts.action.GET_PACKAGES_FOR_UID";
162     public static final String ACTION_GET_NAME_FOR_UID =
163             PKG_BASE + "cts.action.GET_NAME_FOR_UID";
164     public static final String ACTION_GET_NAMES_FOR_UIDS =
165             PKG_BASE + "cts.action.GET_NAMES_FOR_UIDS";
166     public static final String ACTION_CHECK_SIGNATURES = PKG_BASE + "cts.action.CHECK_SIGNATURES";
167     public static final String ACTION_HAS_SIGNING_CERTIFICATE =
168             PKG_BASE + "cts.action.HAS_SIGNING_CERTIFICATE";
169     public static final String ACTION_START_FOR_RESULT = PKG_BASE + "cts.action.START_FOR_RESULT";
170     public static final String ACTION_START_DIRECTLY = PKG_BASE + "cts.action.START_DIRECTLY";
171     public static final String ACTION_JUST_FINISH = PKG_BASE + "cts.action.JUST_FINISH";
172     public static final String ACTION_AWAIT_PACKAGE_REMOVED =
173             PKG_BASE + "cts.action.AWAIT_PACKAGE_REMOVED";
174     public static final String ACTION_AWAIT_PACKAGE_ADDED =
175             PKG_BASE + "cts.action.AWAIT_PACKAGE_ADDED";
176 
177     public static final String ACTION_QUERY_ACTIVITIES =
178             PKG_BASE + "cts.action.QUERY_INTENT_ACTIVITIES";
179     public static final String ACTION_QUERY_SERVICES =
180             PKG_BASE + "cts.action.QUERY_INTENT_SERVICES";
181     public static final String ACTION_QUERY_PROVIDERS =
182             PKG_BASE + "cts.action.QUERY_INTENT_PROVIDERS";
183     public static final String ACTION_GET_INSTALLED_PACKAGES =
184             PKG_BASE + "cts.action.GET_INSTALLED_PACKAGES";
185     public static final String ACTION_START_SENDER_FOR_RESULT =
186             PKG_BASE + "cts.action.START_SENDER_FOR_RESULT";
187     public static final String ACTION_QUERY_RESOLVER =
188             PKG_BASE + "cts.action.QUERY_RESOLVER_FOR_VISIBILITY";
189     public static final String ACTION_BIND_SERVICE = PKG_BASE + "cts.action.BIND_SERVICE";
190     public static final String ACTION_GET_SYNCADAPTER_TYPES =
191             PKG_BASE + "cts.action.GET_SYNCADAPTER_TYPES";
192     public static final String ACTION_GET_SYNCADAPTER_PACKAGES_FOR_AUTHORITY =
193             PKG_BASE + "cts.action.GET_SYNCADAPTER_PACKAGES_FOR_AUTHORITY";
194     public static final String ACTION_GET_INSTALLED_APPWIDGET_PROVIDERS =
195             PKG_BASE + "cts.action.GET_INSTALLED_APPWIDGET_PROVIDERS";
196     public static final String ACTION_AWAIT_PACKAGES_SUSPENDED =
197             PKG_BASE + "cts.action.AWAIT_PACKAGES_SUSPENDED";
198     public static final String ACTION_LAUNCHER_APPS_IS_ACTIVITY_ENABLED =
199             PKG_BASE + "cts.action.LAUNCHER_APPS_IS_ACTIVITY_ENABLED";
200     public static final String ACTION_AWAIT_LAUNCHER_APPS_CALLBACK =
201             PKG_BASE + "cts.action.AWAIT_LAUNCHER_APPS_CALLBACK";
202     public static final String ACTION_GET_SHAREDLIBRARY_DEPENDENT_PACKAGES =
203             PKG_BASE + "cts.action.GET_SHAREDLIBRARY_DEPENDENT_PACKAGES";
204     public static final String ACTION_GET_PREFERRED_ACTIVITIES =
205             PKG_BASE + "cts.action.GET_PREFERRED_ACTIVITIES";
206     public static final String ACTION_SET_INSTALLER_PACKAGE_NAME =
207             PKG_BASE + "cts.action.SET_INSTALLER_PACKAGE_NAME";
208     public static final String ACTION_GET_INSTALLED_ACCESSIBILITYSERVICES_PACKAGES =
209             PKG_BASE + "cts.action.GET_INSTALLED_ACCESSIBILITYSERVICES_PACKAGES";
210     public static final String EXTRA_REMOTE_CALLBACK = "remoteCallback";
211     public static final String EXTRA_REMOTE_READY_CALLBACK = "remoteReadyCallback";
212     public static final String EXTRA_ERROR = "error";
213     public static final String EXTRA_FLAGS = "flags";
214     public static final String EXTRA_DATA = "data";
215     public static final String EXTRA_CERT = "cert";
216     public static final String EXTRA_AUTHORITY = "authority";
217 
218     public static final int CALLBACK_EVENT_INVALID = -1;
219     public static final int CALLBACK_EVENT_PACKAGE_ADDED = 0;
220     public static final int CALLBACK_EVENT_PACKAGE_REMOVED = 1;
221     public static final int CALLBACK_EVENT_PACKAGE_CHANGED = 2;
222     public static final int CALLBACK_EVENT_PACKAGES_AVAILABLE = 3;
223     public static final int CALLBACK_EVENT_PACKAGES_UNAVAILABLE = 4;
224     public static final int CALLBACK_EVENT_PACKAGES_SUSPENDED = 5;
225     public static final int CALLBACK_EVENT_PACKAGES_UNSUSPENDED = 6;
226 }
227