blob: a1c24cc1640113a675546b6a7e7a7b929a467f88 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 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
17package android.content.pm;
18
Svetoslavf7c06eb2015-06-10 18:43:22 -070019import android.Manifest;
Tor Norbye1c2bf032015-03-02 10:57:08 -080020import android.annotation.CheckResult;
Tor Norbye7b9c9122013-05-30 16:48:33 -070021import android.annotation.DrawableRes;
Tor Norbyed9273d62013-05-30 15:59:53 -070022import android.annotation.IntDef;
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -070023import android.annotation.NonNull;
Jeff Sharkeye2d45be2015-04-15 17:14:12 -070024import android.annotation.Nullable;
Svetoslavf7c06eb2015-06-10 18:43:22 -070025import android.annotation.RequiresPermission;
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -080026import android.annotation.SdkConstant;
27import android.annotation.SdkConstant.SdkConstantType;
Tor Norbye7b9c9122013-05-30 16:48:33 -070028import android.annotation.StringRes;
Jeff Sharkeybb580672014-07-10 12:10:25 -070029import android.annotation.SystemApi;
Jeff Sharkeya73b8fd2016-01-06 17:02:08 -070030import android.annotation.TestApi;
Jeff Sharkeybd940222016-01-08 11:07:13 -070031import android.annotation.UserIdInt;
Tor Norbye7b9c9122013-05-30 16:48:33 -070032import android.annotation.XmlRes;
Jeff Sharkey6c0b9da2014-08-07 22:07:11 -070033import android.app.PackageDeleteObserver;
Christopher Tatef1977b42014-03-24 16:25:51 -070034import android.app.PackageInstallObserver;
Amith Yamasani1d653272014-09-11 17:56:05 -070035import android.app.admin.DevicePolicyManager;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080036import android.content.ComponentName;
37import android.content.Context;
38import android.content.Intent;
39import android.content.IntentFilter;
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -070040import android.content.IntentSender;
Jeff Sharkeyc4858a22014-06-16 10:51:20 -070041import android.content.pm.PackageParser.PackageParserException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080042import android.content.res.Resources;
43import android.content.res.XmlResourceParser;
Svetoslavc7d62f02014-09-04 15:39:54 -070044import android.graphics.Rect;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080045import android.graphics.drawable.Drawable;
46import android.net.Uri;
Jeff Sharkeybb580672014-07-10 12:10:25 -070047import android.os.Bundle;
Jeff Sharkey620b32b2015-04-23 19:36:02 -070048import android.os.Handler;
Jeff Sharkey6c0b9da2014-08-07 22:07:11 -070049import android.os.RemoteException;
Dianne Hackborn0c380492012-08-20 17:23:30 -070050import android.os.UserHandle;
Jeff Sharkey8a372a02016-03-16 16:25:45 -060051import android.os.UserManager;
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -070052import android.os.storage.VolumeInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080053import android.util.AndroidException;
Jeff Sharkeybd940222016-01-08 11:07:13 -070054import android.util.Log;
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -070055
Svetoslavc6d1c342015-02-26 14:44:43 -080056import com.android.internal.util.ArrayUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080057
58import java.io.File;
Tor Norbyed9273d62013-05-30 15:59:53 -070059import java.lang.annotation.Retention;
60import java.lang.annotation.RetentionPolicy;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080061import java.util.List;
62
63/**
64 * Class for retrieving various kinds of information related to the application
65 * packages that are currently installed on the device.
66 *
67 * You can find this class through {@link Context#getPackageManager}.
68 */
69public abstract class PackageManager {
Jeff Sharkeybd940222016-01-08 11:07:13 -070070 private static final String TAG = "PackageManager";
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080071
Jeff Sharkeye4697132016-02-06 19:46:15 -070072 /** {@hide} */
Jeff Sharkey8a372a02016-03-16 16:25:45 -060073 public static final boolean APPLY_DEFAULT_TO_DEVICE_PROTECTED_STORAGE = true;
Jeff Sharkeye4697132016-02-06 19:46:15 -070074
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080075 /**
76 * This exception is thrown when a given package, application, or component
kmccormick30498b42013-03-27 17:39:17 -070077 * name cannot be found.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080078 */
79 public static class NameNotFoundException extends AndroidException {
80 public NameNotFoundException() {
81 }
82
83 public NameNotFoundException(String name) {
84 super(name);
85 }
86 }
87
88 /**
Svetoslavf7c06eb2015-06-10 18:43:22 -070089 * Listener for changes in permissions granted to a UID.
90 *
91 * @hide
92 */
93 @SystemApi
94 public interface OnPermissionsChangedListener {
95
96 /**
97 * Called when the permissions for a UID change.
98 * @param uid The UID with a change.
99 */
100 public void onPermissionsChanged(int uid);
101 }
102
103 /**
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700104 * As a guiding principle:
105 * <p>
106 * {@code GET_} flags are used to request additional data that may have been
107 * elided to save wire space.
108 * <p>
109 * {@code MATCH_} flags are used to include components or packages that
110 * would have otherwise been omitted from a result set by current system
111 * state.
112 */
113
114 /** @hide */
115 @IntDef(flag = true, value = {
116 GET_ACTIVITIES,
Todd Kennedy6b9bfa12016-01-08 13:44:51 -0800117 GET_CONFIGURATIONS,
118 GET_GIDS,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700119 GET_INSTRUMENTATION,
120 GET_INTENT_FILTERS,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700121 GET_META_DATA,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700122 GET_PERMISSIONS,
Todd Kennedy6b9bfa12016-01-08 13:44:51 -0800123 GET_PROVIDERS,
124 GET_RECEIVERS,
125 GET_SERVICES,
126 GET_SHARED_LIBRARY_FILES,
127 GET_SIGNATURES,
128 GET_URI_PERMISSION_PATTERNS,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700129 MATCH_UNINSTALLED_PACKAGES,
130 MATCH_DISABLED_COMPONENTS,
131 MATCH_DISABLED_UNTIL_USED_COMPONENTS,
Jeff Sharkeyc5967e92016-01-07 18:50:29 -0700132 MATCH_SYSTEM_ONLY,
Todd Kennedyd6ee0ba2016-03-31 15:11:11 -0700133 MATCH_FACTORY_ONLY,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700134 MATCH_DEBUG_TRIAGED_MISSING,
Todd Kennedy1f397f42016-06-28 12:14:11 -0700135 GET_DISABLED_COMPONENTS,
136 GET_DISABLED_UNTIL_USED_COMPONENTS,
137 GET_UNINSTALLED_PACKAGES,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700138 })
139 @Retention(RetentionPolicy.SOURCE)
140 public @interface PackageInfoFlags {}
141
142 /** @hide */
143 @IntDef(flag = true, value = {
144 GET_META_DATA,
145 GET_SHARED_LIBRARY_FILES,
146 MATCH_UNINSTALLED_PACKAGES,
147 MATCH_SYSTEM_ONLY,
148 MATCH_DEBUG_TRIAGED_MISSING,
Todd Kennedy5a32c6c2016-07-07 14:29:06 -0700149 MATCH_DISABLED_UNTIL_USED_COMPONENTS,
150 GET_DISABLED_UNTIL_USED_COMPONENTS,
Todd Kennedy1f397f42016-06-28 12:14:11 -0700151 GET_UNINSTALLED_PACKAGES,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700152 })
153 @Retention(RetentionPolicy.SOURCE)
154 public @interface ApplicationInfoFlags {}
155
156 /** @hide */
157 @IntDef(flag = true, value = {
158 GET_META_DATA,
159 GET_SHARED_LIBRARY_FILES,
Todd Kennedy6b9bfa12016-01-08 13:44:51 -0800160 MATCH_ALL,
161 MATCH_DEBUG_TRIAGED_MISSING,
162 MATCH_DEFAULT_ONLY,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700163 MATCH_DISABLED_COMPONENTS,
164 MATCH_DISABLED_UNTIL_USED_COMPONENTS,
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600165 MATCH_DIRECT_BOOT_AWARE,
166 MATCH_DIRECT_BOOT_UNAWARE,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700167 MATCH_SYSTEM_ONLY,
Todd Kennedy6b9bfa12016-01-08 13:44:51 -0800168 MATCH_UNINSTALLED_PACKAGES,
Todd Kennedy1f397f42016-06-28 12:14:11 -0700169 GET_DISABLED_COMPONENTS,
170 GET_DISABLED_UNTIL_USED_COMPONENTS,
171 GET_UNINSTALLED_PACKAGES,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700172 })
173 @Retention(RetentionPolicy.SOURCE)
174 public @interface ComponentInfoFlags {}
175
176 /** @hide */
177 @IntDef(flag = true, value = {
178 GET_META_DATA,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700179 GET_RESOLVED_FILTER,
Todd Kennedy6b9bfa12016-01-08 13:44:51 -0800180 GET_SHARED_LIBRARY_FILES,
181 MATCH_ALL,
182 MATCH_DEBUG_TRIAGED_MISSING,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700183 MATCH_DISABLED_COMPONENTS,
184 MATCH_DISABLED_UNTIL_USED_COMPONENTS,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700185 MATCH_DEFAULT_ONLY,
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600186 MATCH_DIRECT_BOOT_AWARE,
187 MATCH_DIRECT_BOOT_UNAWARE,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700188 MATCH_SYSTEM_ONLY,
Todd Kennedy6b9bfa12016-01-08 13:44:51 -0800189 MATCH_UNINSTALLED_PACKAGES,
Todd Kennedy1f397f42016-06-28 12:14:11 -0700190 GET_DISABLED_COMPONENTS,
191 GET_DISABLED_UNTIL_USED_COMPONENTS,
192 GET_UNINSTALLED_PACKAGES,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700193 })
194 @Retention(RetentionPolicy.SOURCE)
195 public @interface ResolveInfoFlags {}
196
197 /** @hide */
198 @IntDef(flag = true, value = {
199 GET_META_DATA,
200 })
201 @Retention(RetentionPolicy.SOURCE)
202 public @interface PermissionInfoFlags {}
203
204 /** @hide */
205 @IntDef(flag = true, value = {
206 GET_META_DATA,
207 })
208 @Retention(RetentionPolicy.SOURCE)
209 public @interface PermissionGroupInfoFlags {}
210
211 /** @hide */
212 @IntDef(flag = true, value = {
213 GET_META_DATA,
214 })
215 @Retention(RetentionPolicy.SOURCE)
216 public @interface InstrumentationInfoFlags {}
217
218 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800219 * {@link PackageInfo} flag: return information about
220 * activities in the package in {@link PackageInfo#activities}.
221 */
222 public static final int GET_ACTIVITIES = 0x00000001;
223
224 /**
225 * {@link PackageInfo} flag: return information about
226 * intent receivers in the package in
227 * {@link PackageInfo#receivers}.
228 */
229 public static final int GET_RECEIVERS = 0x00000002;
230
231 /**
232 * {@link PackageInfo} flag: return information about
233 * services in the package in {@link PackageInfo#services}.
234 */
235 public static final int GET_SERVICES = 0x00000004;
236
237 /**
238 * {@link PackageInfo} flag: return information about
239 * content providers in the package in
240 * {@link PackageInfo#providers}.
241 */
242 public static final int GET_PROVIDERS = 0x00000008;
243
244 /**
245 * {@link PackageInfo} flag: return information about
246 * instrumentation in the package in
247 * {@link PackageInfo#instrumentation}.
248 */
249 public static final int GET_INSTRUMENTATION = 0x00000010;
250
251 /**
252 * {@link PackageInfo} flag: return information about the
253 * intent filters supported by the activity.
254 */
255 public static final int GET_INTENT_FILTERS = 0x00000020;
256
257 /**
258 * {@link PackageInfo} flag: return information about the
259 * signatures included in the package.
260 */
261 public static final int GET_SIGNATURES = 0x00000040;
262
263 /**
264 * {@link ResolveInfo} flag: return the IntentFilter that
265 * was matched for a particular ResolveInfo in
266 * {@link ResolveInfo#filter}.
267 */
268 public static final int GET_RESOLVED_FILTER = 0x00000040;
269
270 /**
271 * {@link ComponentInfo} flag: return the {@link ComponentInfo#metaData}
272 * data {@link android.os.Bundle}s that are associated with a component.
273 * This applies for any API returning a ComponentInfo subclass.
274 */
275 public static final int GET_META_DATA = 0x00000080;
276
277 /**
278 * {@link PackageInfo} flag: return the
279 * {@link PackageInfo#gids group ids} that are associated with an
280 * application.
Ken Wakasaf76a50c2012-03-09 19:56:35 +0900281 * This applies for any API returning a PackageInfo class, either
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800282 * directly or nested inside of another.
283 */
284 public static final int GET_GIDS = 0x00000100;
285
286 /**
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700287 * @deprecated replaced with {@link #MATCH_DISABLED_COMPONENTS}
288 */
289 @Deprecated
290 public static final int GET_DISABLED_COMPONENTS = 0x00000200;
291
292 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800293 * {@link PackageInfo} flag: include disabled components in the returned info.
294 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700295 public static final int MATCH_DISABLED_COMPONENTS = 0x00000200;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800296
297 /**
298 * {@link ApplicationInfo} flag: return the
299 * {@link ApplicationInfo#sharedLibraryFiles paths to the shared libraries}
300 * that are associated with an application.
301 * This applies for any API returning an ApplicationInfo class, either
302 * directly or nested inside of another.
303 */
304 public static final int GET_SHARED_LIBRARY_FILES = 0x00000400;
305
306 /**
307 * {@link ProviderInfo} flag: return the
308 * {@link ProviderInfo#uriPermissionPatterns URI permission patterns}
309 * that are associated with a content provider.
Ken Wakasaf76a50c2012-03-09 19:56:35 +0900310 * This applies for any API returning a ProviderInfo class, either
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800311 * directly or nested inside of another.
312 */
313 public static final int GET_URI_PERMISSION_PATTERNS = 0x00000800;
314 /**
315 * {@link PackageInfo} flag: return information about
316 * permissions in the package in
317 * {@link PackageInfo#permissions}.
318 */
319 public static final int GET_PERMISSIONS = 0x00001000;
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700320
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800321 /**
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700322 * @deprecated replaced with {@link #MATCH_UNINSTALLED_PACKAGES}
323 */
324 @Deprecated
325 public static final int GET_UNINSTALLED_PACKAGES = 0x00002000;
326
327 /**
Kenny Root685f4902011-11-03 10:13:29 -0700328 * Flag parameter to retrieve some information about all applications (even
329 * uninstalled ones) which have data directories. This state could have
330 * resulted if applications have been deleted with flag
331 * {@code DONT_DELETE_DATA} with a possibility of being replaced or
332 * reinstalled in future.
333 * <p>
334 * Note: this flag may cause less information about currently installed
335 * applications to be returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800336 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700337 public static final int MATCH_UNINSTALLED_PACKAGES = 0x00002000;
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700338
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800339 /**
340 * {@link PackageInfo} flag: return information about
Dianne Hackborn49237342009-08-27 20:08:01 -0700341 * hardware preferences in
Adam Lesinskid3edfde2014-08-08 17:32:44 -0700342 * {@link PackageInfo#configPreferences PackageInfo.configPreferences},
343 * and requested features in {@link PackageInfo#reqFeatures} and
344 * {@link PackageInfo#featureGroups}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800345 */
346 public static final int GET_CONFIGURATIONS = 0x00004000;
347
348 /**
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700349 * @deprecated replaced with {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}.
350 */
351 @Deprecated
352 public static final int GET_DISABLED_UNTIL_USED_COMPONENTS = 0x00008000;
353
354 /**
Dianne Hackbornfd7aded2013-01-22 17:10:23 -0800355 * {@link PackageInfo} flag: include disabled components which are in
356 * that state only because of {@link #COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED}
357 * in the returned info. Note that if you set this flag, applications
358 * that are in this disabled state will be reported as enabled.
359 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700360 public static final int MATCH_DISABLED_UNTIL_USED_COMPONENTS = 0x00008000;
Dianne Hackbornfd7aded2013-01-22 17:10:23 -0800361
362 /**
Dianne Hackborn1655be42009-05-08 14:29:01 -0700363 * Resolution and querying flag: if set, only filters that support the
364 * {@link android.content.Intent#CATEGORY_DEFAULT} will be considered for
365 * matching. This is a synonym for including the CATEGORY_DEFAULT in your
366 * supplied Intent.
367 */
Fabrice Di Meglio9f7e39f2015-04-10 20:40:16 -0700368 public static final int MATCH_DEFAULT_ONLY = 0x00010000;
369
370 /**
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700371 * Querying flag: if set and if the platform is doing any filtering of the
372 * results, then the filtering will not happen. This is a synonym for saying
373 * that all results should be returned.
374 * <p>
375 * <em>This flag should be used with extreme care.</em>
Fabrice Di Meglio9f7e39f2015-04-10 20:40:16 -0700376 */
377 public static final int MATCH_ALL = 0x00020000;
Dianne Hackborn1655be42009-05-08 14:29:01 -0700378
Nicolas Prevot63798c52014-05-27 13:22:38 +0100379 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600380 * Querying flag: match components which are direct boot <em>unaware</em> in
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700381 * the returned info, regardless of the current user state.
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600382 * <p>
383 * When neither {@link #MATCH_DIRECT_BOOT_AWARE} nor
384 * {@link #MATCH_DIRECT_BOOT_UNAWARE} are specified, the default behavior is
385 * to match only runnable components based on the user state. For example,
386 * when a user is started but credentials have not been presented yet, the
387 * user is running "locked" and only {@link #MATCH_DIRECT_BOOT_AWARE}
388 * components are returned. Once the user credentials have been presented,
389 * the user is running "unlocked" and both {@link #MATCH_DIRECT_BOOT_AWARE}
390 * and {@link #MATCH_DIRECT_BOOT_UNAWARE} components are returned.
391 *
392 * @see UserManager#isUserUnlocked()
Jeff Sharkeye17ac152015-11-06 22:40:29 -0800393 */
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600394 public static final int MATCH_DIRECT_BOOT_UNAWARE = 0x00040000;
395
396 /**
397 * Querying flag: match components which are direct boot <em>aware</em> in
398 * the returned info, regardless of the current user state.
399 * <p>
400 * When neither {@link #MATCH_DIRECT_BOOT_AWARE} nor
401 * {@link #MATCH_DIRECT_BOOT_UNAWARE} are specified, the default behavior is
402 * to match only runnable components based on the user state. For example,
403 * when a user is started but credentials have not been presented yet, the
404 * user is running "locked" and only {@link #MATCH_DIRECT_BOOT_AWARE}
405 * components are returned. Once the user credentials have been presented,
406 * the user is running "unlocked" and both {@link #MATCH_DIRECT_BOOT_AWARE}
407 * and {@link #MATCH_DIRECT_BOOT_UNAWARE} components are returned.
408 *
409 * @see UserManager#isUserUnlocked()
410 */
411 public static final int MATCH_DIRECT_BOOT_AWARE = 0x00080000;
412
413 /** @removed */
414 @Deprecated
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700415 public static final int MATCH_ENCRYPTION_UNAWARE = 0x00040000;
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600416 /** @removed */
417 @Deprecated
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700418 public static final int MATCH_ENCRYPTION_AWARE = 0x00080000;
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600419 /** @removed */
420 @Deprecated
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700421 public static final int MATCH_ENCRYPTION_AWARE_AND_UNAWARE = MATCH_ENCRYPTION_AWARE
422 | MATCH_ENCRYPTION_UNAWARE;
Jeff Sharkey2a9e3f82015-12-18 10:57:58 -0700423
424 /**
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700425 * Querying flag: include only components from applications that are marked
426 * with {@link ApplicationInfo#FLAG_SYSTEM}.
Jeff Sharkey5217cac2015-12-20 15:34:01 -0700427 */
428 public static final int MATCH_SYSTEM_ONLY = 0x00100000;
429
430 /**
Todd Kennedyd6ee0ba2016-03-31 15:11:11 -0700431 * Internal {@link PackageInfo} flag: include only components on the system image.
432 * This will not return information on any unbundled update to system components.
433 * @hide
434 */
435 public static final int MATCH_FACTORY_ONLY = 0x00200000;
436
437 /**
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700438 * Internal flag used to indicate that a system component has done their
439 * homework and verified that they correctly handle packages and components
440 * that come and go over time. In particular:
441 * <ul>
442 * <li>Apps installed on external storage, which will appear to be
443 * uninstalled while the the device is ejected.
444 * <li>Apps with encryption unaware components, which will appear to not
445 * exist while the device is locked.
446 * </ul>
Jeff Sharkeye17ac152015-11-06 22:40:29 -0800447 *
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700448 * @see #MATCH_UNINSTALLED_PACKAGES
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600449 * @see #MATCH_DIRECT_BOOT_AWARE
450 * @see #MATCH_DIRECT_BOOT_UNAWARE
Jeff Sharkeye17ac152015-11-06 22:40:29 -0800451 * @hide
452 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700453 public static final int MATCH_DEBUG_TRIAGED_MISSING = 0x10000000;
Jeff Sharkeye17ac152015-11-06 22:40:29 -0800454
455 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700456 * Flag for {@link #addCrossProfileIntentFilter}: if this flag is set: when
457 * resolving an intent that matches the {@code CrossProfileIntentFilter},
458 * the current profile will be skipped. Only activities in the target user
459 * can respond to the intent.
460 *
Nicolas Prevot63798c52014-05-27 13:22:38 +0100461 * @hide
462 */
463 public static final int SKIP_CURRENT_PROFILE = 0x00000002;
464
Tony Mak807e01c2015-12-01 20:19:03 +0000465 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700466 * Flag for {@link #addCrossProfileIntentFilter}: if this flag is set:
Tony Mak807e01c2015-12-01 20:19:03 +0000467 * activities in the other profiles can respond to the intent only if no activity with
468 * non-negative priority in current profile can respond to the intent.
469 * @hide
470 */
471 public static final int ONLY_IF_NO_MATCH_FOUND = 0x00000004;
472
Tor Norbyed9273d62013-05-30 15:59:53 -0700473 /** @hide */
474 @IntDef({PERMISSION_GRANTED, PERMISSION_DENIED})
475 @Retention(RetentionPolicy.SOURCE)
476 public @interface PermissionResult {}
477
Dianne Hackborn1655be42009-05-08 14:29:01 -0700478 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800479 * Permission check result: this is returned by {@link #checkPermission}
480 * if the permission has been granted to the given package.
481 */
482 public static final int PERMISSION_GRANTED = 0;
483
484 /**
485 * Permission check result: this is returned by {@link #checkPermission}
486 * if the permission has not been granted to the given package.
487 */
488 public static final int PERMISSION_DENIED = -1;
489
490 /**
491 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700492 * if all signatures on the two packages match.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800493 */
494 public static final int SIGNATURE_MATCH = 0;
495
496 /**
497 * Signature check result: this is returned by {@link #checkSignatures}
498 * if neither of the two packages is signed.
499 */
500 public static final int SIGNATURE_NEITHER_SIGNED = 1;
501
502 /**
503 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700504 * if the first package is not signed but the second is.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800505 */
506 public static final int SIGNATURE_FIRST_NOT_SIGNED = -1;
507
508 /**
509 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700510 * if the second package is not signed but the first is.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800511 */
512 public static final int SIGNATURE_SECOND_NOT_SIGNED = -2;
513
514 /**
515 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700516 * if not all signatures on both packages match.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800517 */
518 public static final int SIGNATURE_NO_MATCH = -3;
519
520 /**
521 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700522 * if either of the packages are not valid.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800523 */
524 public static final int SIGNATURE_UNKNOWN_PACKAGE = -4;
525
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700526 /**
527 * Flag for {@link #setApplicationEnabledSetting(String, int, int)}
528 * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This
529 * component or application is in its default enabled state (as specified
530 * in its manifest).
531 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800532 public static final int COMPONENT_ENABLED_STATE_DEFAULT = 0;
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700533
534 /**
535 * Flag for {@link #setApplicationEnabledSetting(String, int, int)}
536 * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This
537 * component or application has been explictily enabled, regardless of
538 * what it has specified in its manifest.
539 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800540 public static final int COMPONENT_ENABLED_STATE_ENABLED = 1;
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700541
542 /**
543 * Flag for {@link #setApplicationEnabledSetting(String, int, int)}
544 * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This
545 * component or application has been explicitly disabled, regardless of
546 * what it has specified in its manifest.
547 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800548 public static final int COMPONENT_ENABLED_STATE_DISABLED = 2;
549
550 /**
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700551 * Flag for {@link #setApplicationEnabledSetting(String, int, int)} only: The
552 * user has explicitly disabled the application, regardless of what it has
553 * specified in its manifest. Because this is due to the user's request,
554 * they may re-enable it if desired through the appropriate system UI. This
kmccormick30498b42013-03-27 17:39:17 -0700555 * option currently <strong>cannot</strong> be used with
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700556 * {@link #setComponentEnabledSetting(ComponentName, int, int)}.
557 */
558 public static final int COMPONENT_ENABLED_STATE_DISABLED_USER = 3;
559
560 /**
Dianne Hackbornfd7aded2013-01-22 17:10:23 -0800561 * Flag for {@link #setApplicationEnabledSetting(String, int, int)} only: This
562 * application should be considered, until the point where the user actually
563 * wants to use it. This means that it will not normally show up to the user
564 * (such as in the launcher), but various parts of the user interface can
565 * use {@link #GET_DISABLED_UNTIL_USED_COMPONENTS} to still see it and allow
566 * the user to select it (as for example an IME, device admin, etc). Such code,
567 * once the user has selected the app, should at that point also make it enabled.
568 * This option currently <strong>can not</strong> be used with
569 * {@link #setComponentEnabledSetting(ComponentName, int, int)}.
570 */
571 public static final int COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED = 4;
572
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700573 /** @hide */
574 @IntDef(flag = true, value = {
575 INSTALL_FORWARD_LOCK,
576 INSTALL_REPLACE_EXISTING,
577 INSTALL_ALLOW_TEST,
578 INSTALL_EXTERNAL,
579 INSTALL_INTERNAL,
580 INSTALL_FROM_ADB,
581 INSTALL_ALL_USERS,
582 INSTALL_ALLOW_DOWNGRADE,
583 INSTALL_GRANT_RUNTIME_PERMISSIONS,
584 INSTALL_FORCE_VOLUME_UUID,
585 INSTALL_FORCE_PERMISSION_PROMPT,
586 INSTALL_EPHEMERAL,
Todd Kennedy39bfee52016-02-24 10:28:21 -0800587 INSTALL_DONT_KILL_APP,
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700588 })
589 @Retention(RetentionPolicy.SOURCE)
590 public @interface InstallFlags {}
591
Dianne Hackbornfd7aded2013-01-22 17:10:23 -0800592 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700593 * Flag parameter for {@link #installPackage} to indicate that this package
594 * should be installed as forward locked, i.e. only the app itself should
595 * have access to its code and non-resource assets.
596 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700597 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800598 */
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700599 public static final int INSTALL_FORWARD_LOCK = 0x00000001;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800600
601 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700602 * Flag parameter for {@link #installPackage} to indicate that you want to
603 * replace an already installed package, if one exists.
604 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700605 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800606 */
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700607 public static final int INSTALL_REPLACE_EXISTING = 0x00000002;
608
609 /**
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700610 * Flag parameter for {@link #installPackage} to indicate that you want to
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700611 * allow test packages (those that have set android:testOnly in their
612 * manifest) to be installed.
613 * @hide
614 */
615 public static final int INSTALL_ALLOW_TEST = 0x00000004;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800616
617 /**
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -0700618 * Flag parameter for {@link #installPackage} to indicate that this package
619 * must be installed to an ASEC on a {@link VolumeInfo#TYPE_PUBLIC}.
620 *
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800621 * @hide
622 */
Suchi Amalapurapu5b993ce2010-02-12 09:43:29 -0800623 public static final int INSTALL_EXTERNAL = 0x00000008;
Oscar Montemayor539d3c42010-01-29 15:27:00 -0800624
625 /**
Kenny Root5ab21572011-07-27 11:11:19 -0700626 * Flag parameter for {@link #installPackage} to indicate that this package
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -0700627 * must be installed to internal storage.
628 *
Kenny Root5ab21572011-07-27 11:11:19 -0700629 * @hide
630 */
631 public static final int INSTALL_INTERNAL = 0x00000010;
632
633 /**
634 * Flag parameter for {@link #installPackage} to indicate that this install
635 * was initiated via ADB.
636 *
637 * @hide
638 */
639 public static final int INSTALL_FROM_ADB = 0x00000020;
Suchi Amalapurapu14b6abd2010-03-17 08:37:04 -0700640
641 /**
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700642 * Flag parameter for {@link #installPackage} to indicate that this install
643 * should immediately be visible to all users.
644 *
645 * @hide
646 */
647 public static final int INSTALL_ALL_USERS = 0x00000040;
648
649 /**
650 * Flag parameter for {@link #installPackage} to indicate that it is okay
651 * to install an update to an app where the newly installed app has a lower
Alex Klyubin921dd752016-02-24 13:21:41 -0800652 * version code than the currently installed app. This is permitted only if
653 * the currently installed app is marked debuggable.
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700654 *
655 * @hide
656 */
657 public static final int INSTALL_ALLOW_DOWNGRADE = 0x00000080;
658
659 /**
Svet Ganov95c1ade2015-03-19 09:38:52 -0700660 * Flag parameter for {@link #installPackage} to indicate that all runtime
661 * permissions should be granted to the package. If {@link #INSTALL_ALL_USERS}
662 * is set the runtime permissions will be granted to all users, otherwise
663 * only to the owner.
664 *
665 * @hide
666 */
667 public static final int INSTALL_GRANT_RUNTIME_PERMISSIONS = 0x00000100;
668
Jeff Sharkeyab234092015-06-09 21:42:22 -0700669 /** {@hide} */
670 public static final int INSTALL_FORCE_VOLUME_UUID = 0x00000200;
671
Svet Ganov95c1ade2015-03-19 09:38:52 -0700672 /**
Todd Kennedya1d12cf2015-09-29 15:43:00 -0700673 * Flag parameter for {@link #installPackage} to indicate that we always want to force
674 * the prompt for permission approval. This overrides any special behaviour for internal
675 * components.
676 *
677 * @hide
678 */
679 public static final int INSTALL_FORCE_PERMISSION_PROMPT = 0x00000400;
680
681 /**
Todd Kennedy27c24fb2015-09-17 16:49:25 -0700682 * Flag parameter for {@link #installPackage} to indicate that this package is
Todd Kennedy2699f062015-11-20 13:07:17 -0800683 * to be installed as a lightweight "ephemeral" app.
684 *
685 * @hide
686 */
Todd Kennedy373f0b42015-12-16 14:45:14 -0800687 public static final int INSTALL_EPHEMERAL = 0x00000800;
Todd Kennedy2699f062015-11-20 13:07:17 -0800688
689 /**
Todd Kennedy39bfee52016-02-24 10:28:21 -0800690 * Flag parameter for {@link #installPackage} to indicate that this package contains
691 * a feature split to an existing application and the existing application should not
692 * be killed during the installation process.
693 *
694 * @hide
695 */
696 public static final int INSTALL_DONT_KILL_APP = 0x00001000;
697
698 /**
Todd Kennedyb1072712016-04-26 15:41:20 -0700699 * Flag parameter for {@link #installPackage} to indicate that this package is an
700 * upgrade to a package that refers to the SDK via release letter.
701 *
702 * @hide
703 */
704 public static final int INSTALL_FORCE_SDK = 0x00002000;
705
706 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800707 * Flag parameter for
708 * {@link #setComponentEnabledSetting(android.content.ComponentName, int, int)} to indicate
709 * that you don't want to kill the app containing the component. Be careful when you set this
710 * since changing component states can make the containing application's behavior unpredictable.
711 */
712 public static final int DONT_KILL_APP = 0x00000001;
713
714 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700715 * Installation return code: this is passed to the
716 * {@link IPackageInstallObserver} on success.
717 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700718 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800719 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700720 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800721 public static final int INSTALL_SUCCEEDED = 1;
722
723 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700724 * Installation return code: this is passed to the
725 * {@link IPackageInstallObserver} if the package is already installed.
726 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700727 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800728 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700729 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800730 public static final int INSTALL_FAILED_ALREADY_EXISTS = -1;
731
732 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700733 * Installation return code: this is passed to the
734 * {@link IPackageInstallObserver} if the package archive file is invalid.
735 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700736 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800737 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700738 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800739 public static final int INSTALL_FAILED_INVALID_APK = -2;
740
741 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700742 * Installation return code: this is passed to the
743 * {@link IPackageInstallObserver} if the URI passed in is invalid.
744 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700745 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800746 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700747 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800748 public static final int INSTALL_FAILED_INVALID_URI = -3;
749
750 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700751 * Installation return code: this is passed to the
752 * {@link IPackageInstallObserver} if the package manager service found that
753 * the device didn't have enough storage space to install the app.
754 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700755 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800756 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700757 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800758 public static final int INSTALL_FAILED_INSUFFICIENT_STORAGE = -4;
759
760 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700761 * Installation return code: this is passed to the
762 * {@link IPackageInstallObserver} if a package is already installed with
763 * the same name.
764 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700765 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800766 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700767 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800768 public static final int INSTALL_FAILED_DUPLICATE_PACKAGE = -5;
769
770 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700771 * Installation return code: this is passed to the
772 * {@link IPackageInstallObserver} if the requested shared user does not
773 * exist.
774 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700775 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800776 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700777 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800778 public static final int INSTALL_FAILED_NO_SHARED_USER = -6;
779
780 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700781 * Installation return code: this is passed to the
782 * {@link IPackageInstallObserver} if a previously installed package of the
783 * same name has a different signature than the new package (and the old
784 * package's data was not removed).
785 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700786 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800787 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700788 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800789 public static final int INSTALL_FAILED_UPDATE_INCOMPATIBLE = -7;
790
791 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700792 * Installation return code: this is passed to the
793 * {@link IPackageInstallObserver} if the new package is requested a shared
794 * user which is already installed on the device and does not have matching
795 * signature.
796 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700797 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800798 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700799 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800800 public static final int INSTALL_FAILED_SHARED_USER_INCOMPATIBLE = -8;
801
802 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700803 * Installation return code: this is passed to the
804 * {@link IPackageInstallObserver} if the new package uses a shared library
805 * that is not available.
806 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700807 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800808 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700809 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800810 public static final int INSTALL_FAILED_MISSING_SHARED_LIBRARY = -9;
811
812 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700813 * Installation return code: this is passed to the
814 * {@link IPackageInstallObserver} if the new package uses a shared library
815 * that is not available.
816 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700817 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800818 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700819 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800820 public static final int INSTALL_FAILED_REPLACE_COULDNT_DELETE = -10;
821
822 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700823 * Installation return code: this is passed to the
824 * {@link IPackageInstallObserver} if the new package failed while
825 * optimizing and validating its dex files, either because there was not
826 * enough storage or the validation failed.
827 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700828 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800829 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700830 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800831 public static final int INSTALL_FAILED_DEXOPT = -11;
832
833 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700834 * Installation return code: this is passed to the
835 * {@link IPackageInstallObserver} if the new package failed because the
836 * current SDK version is older than that required by the package.
837 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700838 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800839 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700840 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800841 public static final int INSTALL_FAILED_OLDER_SDK = -12;
842
843 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700844 * Installation return code: this is passed to the
845 * {@link IPackageInstallObserver} if the new package failed because it
846 * contains a content provider with the same authority as a provider already
847 * installed in the system.
848 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700849 * @hide
The Android Open Source Project10592532009-03-18 17:39:46 -0700850 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700851 @SystemApi
The Android Open Source Project10592532009-03-18 17:39:46 -0700852 public static final int INSTALL_FAILED_CONFLICTING_PROVIDER = -13;
853
854 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700855 * Installation return code: this is passed to the
856 * {@link IPackageInstallObserver} if the new package failed because the
857 * current SDK version is newer than that required by the package.
858 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700859 * @hide
Dianne Hackborn851a5412009-05-08 12:06:44 -0700860 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700861 @SystemApi
Dianne Hackborn851a5412009-05-08 12:06:44 -0700862 public static final int INSTALL_FAILED_NEWER_SDK = -14;
863
864 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700865 * Installation return code: this is passed to the
866 * {@link IPackageInstallObserver} if the new package failed because it has
867 * specified that it is a test-only package and the caller has not supplied
868 * the {@link #INSTALL_ALLOW_TEST} flag.
869 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700870 * @hide
871 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700872 @SystemApi
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700873 public static final int INSTALL_FAILED_TEST_ONLY = -15;
874
875 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700876 * Installation return code: this is passed to the
877 * {@link IPackageInstallObserver} if the package being installed contains
878 * native code, but none that is compatible with the device's CPU_ABI.
879 *
Dianne Hackbornb1811182009-05-21 15:45:42 -0700880 * @hide
881 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700882 @SystemApi
Dianne Hackbornb1811182009-05-21 15:45:42 -0700883 public static final int INSTALL_FAILED_CPU_ABI_INCOMPATIBLE = -16;
884
885 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700886 * Installation return code: this is passed to the
887 * {@link IPackageInstallObserver} if the new package uses a feature that is
888 * not available.
889 *
Dianne Hackborn49237342009-08-27 20:08:01 -0700890 * @hide
891 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700892 @SystemApi
Dianne Hackborn49237342009-08-27 20:08:01 -0700893 public static final int INSTALL_FAILED_MISSING_FEATURE = -17;
894
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800895 // ------ Errors related to sdcard
896 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700897 * Installation return code: this is passed to the
898 * {@link IPackageInstallObserver} if a secure container mount point
899 * couldn't be accessed on external media.
900 *
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800901 * @hide
902 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700903 @SystemApi
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800904 public static final int INSTALL_FAILED_CONTAINER_ERROR = -18;
905
Dianne Hackborn49237342009-08-27 20:08:01 -0700906 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700907 * Installation return code: this is passed to the
908 * {@link IPackageInstallObserver} if the new package couldn't be installed
909 * in the specified install location.
910 *
Suchi Amalapurapub56ae202010-02-04 22:51:07 -0800911 * @hide
912 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700913 @SystemApi
Suchi Amalapurapub56ae202010-02-04 22:51:07 -0800914 public static final int INSTALL_FAILED_INVALID_INSTALL_LOCATION = -19;
915
916 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700917 * Installation return code: this is passed to the
918 * {@link IPackageInstallObserver} if the new package couldn't be installed
919 * in the specified install location because the media is not available.
920 *
Suchi Amalapurapu8a9ab242010-03-11 16:49:16 -0800921 * @hide
922 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700923 @SystemApi
Suchi Amalapurapu8a9ab242010-03-11 16:49:16 -0800924 public static final int INSTALL_FAILED_MEDIA_UNAVAILABLE = -20;
925
926 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700927 * Installation return code: this is passed to the
928 * {@link IPackageInstallObserver} if the new package couldn't be installed
929 * because the verification timed out.
930 *
Kenny Root5ab21572011-07-27 11:11:19 -0700931 * @hide
932 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700933 @SystemApi
Kenny Root5ab21572011-07-27 11:11:19 -0700934 public static final int INSTALL_FAILED_VERIFICATION_TIMEOUT = -21;
935
936 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700937 * Installation return code: this is passed to the
938 * {@link IPackageInstallObserver} if the new package couldn't be installed
939 * because the verification did not succeed.
940 *
Kenny Root5ab21572011-07-27 11:11:19 -0700941 * @hide
942 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700943 @SystemApi
Kenny Root5ab21572011-07-27 11:11:19 -0700944 public static final int INSTALL_FAILED_VERIFICATION_FAILURE = -22;
945
946 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700947 * Installation return code: this is passed to the
948 * {@link IPackageInstallObserver} if the package changed from what the
949 * calling program expected.
950 *
Kenny Root5ab21572011-07-27 11:11:19 -0700951 * @hide
952 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700953 @SystemApi
Kenny Root5ab21572011-07-27 11:11:19 -0700954 public static final int INSTALL_FAILED_PACKAGE_CHANGED = -23;
955
956 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700957 * Installation return code: this is passed to the
958 * {@link IPackageInstallObserver} if the new package is assigned a
959 * different UID than it previously held.
960 *
Dianne Hackbornd0c5f512012-06-07 16:53:59 -0700961 * @hide
962 */
963 public static final int INSTALL_FAILED_UID_CHANGED = -24;
964
965 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700966 * Installation return code: this is passed to the
967 * {@link IPackageInstallObserver} if the new package has an older version
968 * code than the currently installed package.
969 *
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700970 * @hide
971 */
972 public static final int INSTALL_FAILED_VERSION_DOWNGRADE = -25;
973
974 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700975 * Installation return code: this is passed to the
976 * {@link IPackageInstallObserver} if the old package has target SDK high
977 * enough to support runtime permission and the new package has target SDK
978 * low enough to not support runtime permissions.
979 *
Svetoslavd9653702015-05-13 18:02:46 -0700980 * @hide
981 */
982 @SystemApi
983 public static final int INSTALL_FAILED_PERMISSION_MODEL_DOWNGRADE = -26;
984
985 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700986 * Installation parse return code: this is passed to the
987 * {@link IPackageInstallObserver} if the parser was given a path that is
988 * not a file, or does not end with the expected '.apk' extension.
989 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700990 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800991 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700992 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800993 public static final int INSTALL_PARSE_FAILED_NOT_APK = -100;
994
995 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700996 * Installation parse return code: this is passed to the
997 * {@link IPackageInstallObserver} if the parser was unable to retrieve the
998 * AndroidManifest.xml file.
999 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001000 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001001 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001002 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001003 public static final int INSTALL_PARSE_FAILED_BAD_MANIFEST = -101;
1004
1005 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001006 * Installation parse return code: this is passed to the
1007 * {@link IPackageInstallObserver} if the parser encountered an unexpected
1008 * exception.
1009 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001010 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001011 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001012 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001013 public static final int INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION = -102;
1014
1015 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001016 * Installation parse return code: this is passed to the
1017 * {@link IPackageInstallObserver} if the parser did not find any
1018 * certificates in the .apk.
1019 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001020 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001021 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001022 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001023 public static final int INSTALL_PARSE_FAILED_NO_CERTIFICATES = -103;
1024
1025 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001026 * Installation parse return code: this is passed to the
1027 * {@link IPackageInstallObserver} if the parser found inconsistent
1028 * certificates on the files in the .apk.
1029 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001030 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001031 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001032 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001033 public static final int INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES = -104;
1034
1035 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001036 * Installation parse return code: this is passed to the
1037 * {@link IPackageInstallObserver} if the parser encountered a
1038 * CertificateEncodingException in one of the files in the .apk.
1039 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001040 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001041 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001042 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001043 public static final int INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING = -105;
1044
1045 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001046 * Installation parse return code: this is passed to the
1047 * {@link IPackageInstallObserver} if the parser encountered a bad or
1048 * missing package name in the manifest.
1049 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001050 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001051 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001052 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001053 public static final int INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME = -106;
1054
1055 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001056 * Installation parse return code: this is passed to the
1057 * {@link IPackageInstallObserver} if the parser encountered a bad shared
1058 * user id name in the manifest.
1059 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001060 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001061 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001062 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001063 public static final int INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID = -107;
1064
1065 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001066 * Installation parse return code: this is passed to the
1067 * {@link IPackageInstallObserver} if the parser encountered some structural
1068 * problem in the manifest.
1069 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001070 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001071 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001072 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001073 public static final int INSTALL_PARSE_FAILED_MANIFEST_MALFORMED = -108;
1074
1075 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001076 * Installation parse return code: this is passed to the
1077 * {@link IPackageInstallObserver} if the parser did not find any actionable
1078 * tags (instrumentation or application) in the manifest.
1079 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001080 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001081 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001082 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001083 public static final int INSTALL_PARSE_FAILED_MANIFEST_EMPTY = -109;
1084
1085 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001086 * Installation failed return code: this is passed to the
1087 * {@link IPackageInstallObserver} if the system failed to install the
1088 * package because of system issues.
1089 *
Suchi Amalapurapu5b993ce2010-02-12 09:43:29 -08001090 * @hide
1091 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001092 @SystemApi
Suchi Amalapurapu5b993ce2010-02-12 09:43:29 -08001093 public static final int INSTALL_FAILED_INTERNAL_ERROR = -110;
1094
1095 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001096 * Installation failed return code: this is passed to the
1097 * {@link IPackageInstallObserver} if the system failed to install the
1098 * package because the user is restricted from installing apps.
1099 *
Amith Yamasanie4cf7342012-12-17 11:12:09 -08001100 * @hide
1101 */
1102 public static final int INSTALL_FAILED_USER_RESTRICTED = -111;
1103
1104 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001105 * Installation failed return code: this is passed to the
1106 * {@link IPackageInstallObserver} if the system failed to install the
1107 * package because it is attempting to define a permission that is already
1108 * defined by some existing package.
1109 * <p>
1110 * The package name of the app which has already defined the permission is
1111 * passed to a {@link PackageInstallObserver}, if any, as the
1112 * {@link #EXTRA_FAILURE_EXISTING_PACKAGE} string extra; and the name of the
1113 * permission being redefined is passed in the
1114 * {@link #EXTRA_FAILURE_EXISTING_PERMISSION} string extra.
Christopher Tatef1977b42014-03-24 16:25:51 -07001115 *
Christopher Tatef1977b42014-03-24 16:25:51 -07001116 * @hide
1117 */
1118 public static final int INSTALL_FAILED_DUPLICATE_PERMISSION = -112;
1119
1120 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001121 * Installation failed return code: this is passed to the
1122 * {@link IPackageInstallObserver} if the system failed to install the
1123 * package because its packaged native code did not match any of the ABIs
1124 * supported by the system.
Ramin Zaghi1378aba2014-02-28 15:03:19 +00001125 *
1126 * @hide
1127 */
Narayan Kamathd11f2232014-04-10 10:37:17 +01001128 public static final int INSTALL_FAILED_NO_MATCHING_ABIS = -113;
Ramin Zaghi1378aba2014-02-28 15:03:19 +00001129
1130 /**
1131 * Internal return code for NativeLibraryHelper methods to indicate that the package
1132 * being processed did not contain any native code. This is placed here only so that
1133 * it can belong to the same value space as the other install failure codes.
1134 *
1135 * @hide
1136 */
Narayan Kamathd11f2232014-04-10 10:37:17 +01001137 public static final int NO_NATIVE_LIBRARIES = -114;
Ramin Zaghi1378aba2014-02-28 15:03:19 +00001138
Jeff Sharkey7328a1b2014-08-07 14:01:43 -07001139 /** {@hide} */
Jeff Sharkeyf0600952014-08-07 17:31:53 -07001140 public static final int INSTALL_FAILED_ABORTED = -115;
Jeff Sharkey7328a1b2014-08-07 14:01:43 -07001141
Ramin Zaghi1378aba2014-02-28 15:03:19 +00001142 /**
Todd Kennedy2699f062015-11-20 13:07:17 -08001143 * Installation failed return code: ephemeral app installs are incompatible with some
1144 * other installation flags supplied for the operation; or other circumstances such
1145 * as trying to upgrade a system app via an ephemeral install.
1146 * @hide
1147 */
1148 public static final int INSTALL_FAILED_EPHEMERAL_INVALID = -116;
1149
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001150 /** @hide */
1151 @IntDef(flag = true, value = {
1152 DELETE_KEEP_DATA,
1153 DELETE_ALL_USERS,
1154 DELETE_SYSTEM_APP,
Todd Kennedy39bfee52016-02-24 10:28:21 -08001155 DELETE_DONT_KILL_APP,
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001156 })
1157 @Retention(RetentionPolicy.SOURCE)
1158 public @interface DeleteFlags {}
1159
Todd Kennedy2699f062015-11-20 13:07:17 -08001160 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001161 * Flag parameter for {@link #deletePackage} to indicate that you don't want to delete the
1162 * package's data directory.
1163 *
1164 * @hide
1165 */
Dianne Hackborn7767eac2012-08-23 18:25:40 -07001166 public static final int DELETE_KEEP_DATA = 0x00000001;
1167
1168 /**
1169 * Flag parameter for {@link #deletePackage} to indicate that you want the
1170 * package deleted for all users.
1171 *
1172 * @hide
1173 */
1174 public static final int DELETE_ALL_USERS = 0x00000002;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001175
1176 /**
Dianne Hackbornc895be72013-03-11 17:48:43 -07001177 * Flag parameter for {@link #deletePackage} to indicate that, if you are calling
1178 * uninstall on a system that has been updated, then don't do the normal process
1179 * of uninstalling the update and rolling back to the older system version (which
1180 * needs to happen for all users); instead, just mark the app as uninstalled for
1181 * the current user.
1182 *
1183 * @hide
1184 */
1185 public static final int DELETE_SYSTEM_APP = 0x00000004;
1186
1187 /**
Todd Kennedy39bfee52016-02-24 10:28:21 -08001188 * Flag parameter for {@link #deletePackage} to indicate that, if you are calling
1189 * uninstall on a package that is replaced to provide new feature splits, the
1190 * existing application should not be killed during the removal process.
1191 *
1192 * @hide
1193 */
1194 public static final int DELETE_DONT_KILL_APP = 0x00000008;
1195
1196 /**
Kenny Rootc39bb4a2011-02-28 13:27:19 -08001197 * Return code for when package deletion succeeds. This is passed to the
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001198 * {@link IPackageDeleteObserver} if the system succeeded in deleting the
1199 * package.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001200 *
Kenny Rootc39bb4a2011-02-28 13:27:19 -08001201 * @hide
1202 */
1203 public static final int DELETE_SUCCEEDED = 1;
1204
1205 /**
1206 * Deletion failed return code: this is passed to the
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001207 * {@link IPackageDeleteObserver} if the system failed to delete the package
1208 * for an unspecified reason.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001209 *
Kenny Rootc39bb4a2011-02-28 13:27:19 -08001210 * @hide
1211 */
1212 public static final int DELETE_FAILED_INTERNAL_ERROR = -1;
1213
1214 /**
1215 * Deletion failed return code: this is passed to the
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001216 * {@link IPackageDeleteObserver} if the system failed to delete the package
1217 * because it is the active DevicePolicy manager.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001218 *
Kenny Rootc39bb4a2011-02-28 13:27:19 -08001219 * @hide
1220 */
1221 public static final int DELETE_FAILED_DEVICE_POLICY_MANAGER = -2;
1222
1223 /**
Amith Yamasanie4cf7342012-12-17 11:12:09 -08001224 * Deletion failed return code: this is passed to the
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001225 * {@link IPackageDeleteObserver} if the system failed to delete the package
1226 * since the user is restricted.
Amith Yamasanie4cf7342012-12-17 11:12:09 -08001227 *
1228 * @hide
1229 */
1230 public static final int DELETE_FAILED_USER_RESTRICTED = -3;
1231
1232 /**
Kenny Guy1b88da52014-07-10 16:33:49 +01001233 * Deletion failed return code: this is passed to the
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001234 * {@link IPackageDeleteObserver} if the system failed to delete the package
1235 * because a profile or device owner has marked the package as
1236 * uninstallable.
Kenny Guyc13053b2014-05-29 14:17:17 +01001237 *
1238 * @hide
1239 */
Jeff Sharkeyf0600952014-08-07 17:31:53 -07001240 public static final int DELETE_FAILED_OWNER_BLOCKED = -4;
1241
1242 /** {@hide} */
1243 public static final int DELETE_FAILED_ABORTED = -5;
Kenny Guyc13053b2014-05-29 14:17:17 +01001244
1245 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001246 * Return code that is passed to the {@link IPackageMoveObserver} when the
Kenny Rootc39bb4a2011-02-28 13:27:19 -08001247 * package has been successfully moved by the system.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001248 *
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001249 * @hide
1250 */
Jeff Sharkey620b32b2015-04-23 19:36:02 -07001251 public static final int MOVE_SUCCEEDED = -100;
1252
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001253 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001254 * Error code that is passed to the {@link IPackageMoveObserver} when the
1255 * package hasn't been successfully moved by the system because of
1256 * insufficient memory on specified media.
1257 *
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001258 * @hide
1259 */
1260 public static final int MOVE_FAILED_INSUFFICIENT_STORAGE = -1;
1261
1262 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001263 * Error code that is passed to the {@link IPackageMoveObserver} if the
1264 * specified package doesn't exist.
1265 *
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001266 * @hide
1267 */
1268 public static final int MOVE_FAILED_DOESNT_EXIST = -2;
1269
1270 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001271 * Error code that is passed to the {@link IPackageMoveObserver} if the
1272 * specified package cannot be moved since its a system package.
1273 *
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001274 * @hide
1275 */
1276 public static final int MOVE_FAILED_SYSTEM_PACKAGE = -3;
1277
1278 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001279 * Error code that is passed to the {@link IPackageMoveObserver} if the
1280 * specified package cannot be moved since its forward locked.
1281 *
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001282 * @hide
1283 */
1284 public static final int MOVE_FAILED_FORWARD_LOCKED = -4;
1285
1286 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001287 * Error code that is passed to the {@link IPackageMoveObserver} if the
1288 * specified package cannot be moved to the specified location.
1289 *
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001290 * @hide
1291 */
1292 public static final int MOVE_FAILED_INVALID_LOCATION = -5;
1293
1294 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001295 * Error code that is passed to the {@link IPackageMoveObserver} if the
1296 * specified package cannot be moved to the specified location.
1297 *
Suchi Amalapurapu8a9ab242010-03-11 16:49:16 -08001298 * @hide
1299 */
1300 public static final int MOVE_FAILED_INTERNAL_ERROR = -6;
1301
1302 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001303 * Error code that is passed to the {@link IPackageMoveObserver} if the
1304 * specified package already has an operation pending in the queue.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001305 *
Kenny Rootdeb11262010-08-02 11:36:21 -07001306 * @hide
1307 */
1308 public static final int MOVE_FAILED_OPERATION_PENDING = -7;
1309
1310 /**
Makoto Onukif34db0a2016-02-17 11:17:15 -08001311 * Error code that is passed to the {@link IPackageMoveObserver} if the
1312 * specified package cannot be moved since it contains a device admin.
1313 *
1314 * @hide
1315 */
1316 public static final int MOVE_FAILED_DEVICE_ADMIN = -8;
1317
1318 /**
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001319 * Flag parameter for {@link #movePackage} to indicate that
1320 * the package should be moved to internal storage if its
1321 * been installed on external media.
1322 * @hide
1323 */
Jeff Sharkey620b32b2015-04-23 19:36:02 -07001324 @Deprecated
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001325 public static final int MOVE_INTERNAL = 0x00000001;
1326
1327 /**
1328 * Flag parameter for {@link #movePackage} to indicate that
1329 * the package should be moved to external media.
1330 * @hide
1331 */
Jeff Sharkey620b32b2015-04-23 19:36:02 -07001332 @Deprecated
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001333 public static final int MOVE_EXTERNAL_MEDIA = 0x00000002;
1334
Jeff Sharkey620b32b2015-04-23 19:36:02 -07001335 /** {@hide} */
1336 public static final String EXTRA_MOVE_ID = "android.content.pm.extra.MOVE_ID";
1337
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001338 /**
Kenny Root05ca4c92011-09-15 10:36:25 -07001339 * Usable by the required verifier as the {@code verificationCode} argument
1340 * for {@link PackageManager#verifyPendingInstall} to indicate that it will
1341 * allow the installation to proceed without any of the optional verifiers
1342 * needing to vote.
1343 *
1344 * @hide
1345 */
1346 public static final int VERIFICATION_ALLOW_WITHOUT_SUFFICIENT = 2;
1347
1348 /**
Kenny Root3a9b5fb2011-09-20 14:15:38 -07001349 * Used as the {@code verificationCode} argument for
1350 * {@link PackageManager#verifyPendingInstall} to indicate that the calling
1351 * package verifier allows the installation to proceed.
1352 */
1353 public static final int VERIFICATION_ALLOW = 1;
1354
1355 /**
1356 * Used as the {@code verificationCode} argument for
1357 * {@link PackageManager#verifyPendingInstall} to indicate the calling
1358 * package verifier does not vote to allow the installation to proceed.
1359 */
1360 public static final int VERIFICATION_REJECT = -1;
1361
1362 /**
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001363 * Used as the {@code verificationCode} argument for
1364 * {@link PackageManager#verifyIntentFilter} to indicate that the calling
1365 * IntentFilter Verifier confirms that the IntentFilter is verified.
1366 *
1367 * @hide
1368 */
Todd Kennedydfa93ab2016-03-03 15:24:33 -08001369 @SystemApi
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001370 public static final int INTENT_FILTER_VERIFICATION_SUCCESS = 1;
1371
1372 /**
1373 * Used as the {@code verificationCode} argument for
1374 * {@link PackageManager#verifyIntentFilter} to indicate that the calling
1375 * IntentFilter Verifier confirms that the IntentFilter is NOT verified.
1376 *
1377 * @hide
1378 */
Todd Kennedydfa93ab2016-03-03 15:24:33 -08001379 @SystemApi
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001380 public static final int INTENT_FILTER_VERIFICATION_FAILURE = -1;
1381
1382 /**
1383 * Internal status code to indicate that an IntentFilter verification result is not specified.
1384 *
1385 * @hide
1386 */
1387 public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED = 0;
1388
1389 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001390 * Used as the {@code status} argument for
1391 * {@link #updateIntentVerificationStatusAsUser} to indicate that the User
1392 * will always be prompted the Intent Disambiguation Dialog if there are two
1393 * or more Intent resolved for the IntentFilter's domain(s).
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001394 *
1395 * @hide
1396 */
1397 public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK = 1;
1398
1399 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001400 * Used as the {@code status} argument for
1401 * {@link #updateIntentVerificationStatusAsUser} to indicate that the User
1402 * will never be prompted the Intent Disambiguation Dialog if there are two
1403 * or more resolution of the Intent. The default App for the domain(s)
1404 * specified in the IntentFilter will also ALWAYS be used.
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001405 *
1406 * @hide
1407 */
1408 public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS = 2;
1409
1410 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001411 * Used as the {@code status} argument for
1412 * {@link #updateIntentVerificationStatusAsUser} to indicate that the User
1413 * may be prompted the Intent Disambiguation Dialog if there are two or more
1414 * Intent resolved. The default App for the domain(s) specified in the
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001415 * IntentFilter will also NEVER be presented to the User.
1416 *
1417 * @hide
1418 */
1419 public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER = 3;
1420
1421 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001422 * Used as the {@code status} argument for
1423 * {@link #updateIntentVerificationStatusAsUser} to indicate that this app
1424 * should always be considered as an ambiguous candidate for handling the
1425 * matching Intent even if there are other candidate apps in the "always"
1426 * state. Put another way: if there are any 'always ask' apps in a set of
1427 * more than one candidate app, then a disambiguation is *always* presented
1428 * even if there is another candidate app with the 'always' state.
Christopher Tate56f0ff32015-08-13 16:29:33 -07001429 *
1430 * @hide
1431 */
1432 public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS_ASK = 4;
1433
1434 /**
rich canningsd9ef3e52012-08-22 14:28:05 -07001435 * Can be used as the {@code millisecondsToDelay} argument for
1436 * {@link PackageManager#extendVerificationTimeout}. This is the
1437 * maximum time {@code PackageManager} waits for the verification
1438 * agent to return (in milliseconds).
1439 */
1440 public static final long MAXIMUM_VERIFICATION_TIMEOUT = 60*60*1000;
1441
1442 /**
Amith Yamasani0b285492011-04-14 17:35:23 -07001443 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: The device's
1444 * audio pipeline is low-latency, more suitable for audio applications sensitive to delays or
1445 * lag in sound input or output.
Dan Morrill898e1e82010-09-26 17:28:30 -07001446 */
1447 @SdkConstant(SdkConstantType.FEATURE)
1448 public static final String FEATURE_AUDIO_LOW_LATENCY = "android.hardware.audio.low_latency";
1449
1450 /**
1451 * Feature for {@link #getSystemAvailableFeatures} and
Unsuk Jung50909f62014-09-02 18:25:49 -07001452 * {@link #hasSystemFeature}: The device includes at least one form of audio
1453 * output, such as speakers, audio jack or streaming over bluetooth
1454 */
1455 @SdkConstant(SdkConstantType.FEATURE)
1456 public static final String FEATURE_AUDIO_OUTPUT = "android.hardware.audio.output";
1457
1458 /**
Glenn Kastencdcb5772015-05-06 15:54:49 -07001459 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Glenn Kasten7587edc2015-10-30 17:45:52 -07001460 * The device has professional audio level of functionality and performance.
Glenn Kastencdcb5772015-05-06 15:54:49 -07001461 */
1462 @SdkConstant(SdkConstantType.FEATURE)
1463 public static final String FEATURE_AUDIO_PRO = "android.hardware.audio.pro";
1464
1465 /**
Unsuk Jung50909f62014-09-02 18:25:49 -07001466 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001467 * {@link #hasSystemFeature}: The device is capable of communicating with
1468 * other devices via Bluetooth.
1469 */
1470 @SdkConstant(SdkConstantType.FEATURE)
1471 public static final String FEATURE_BLUETOOTH = "android.hardware.bluetooth";
1472
1473 /**
1474 * Feature for {@link #getSystemAvailableFeatures} and
Matthew Xiea7227722013-04-18 15:25:59 -07001475 * {@link #hasSystemFeature}: The device is capable of communicating with
1476 * other devices via Bluetooth Low Energy radio.
1477 */
1478 @SdkConstant(SdkConstantType.FEATURE)
1479 public static final String FEATURE_BLUETOOTH_LE = "android.hardware.bluetooth_le";
1480
1481 /**
1482 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001483 * {@link #hasSystemFeature}: The device has a camera facing away
1484 * from the screen.
1485 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001486 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001487 public static final String FEATURE_CAMERA = "android.hardware.camera";
Dan Morrill50ab63f2010-03-05 16:16:19 -08001488
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001489 /**
1490 * Feature for {@link #getSystemAvailableFeatures} and
1491 * {@link #hasSystemFeature}: The device's camera supports auto-focus.
1492 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001493 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001494 public static final String FEATURE_CAMERA_AUTOFOCUS = "android.hardware.camera.autofocus";
Dan Morrill50ab63f2010-03-05 16:16:19 -08001495
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001496 /**
1497 * Feature for {@link #getSystemAvailableFeatures} and
Eino-Ville Talvala752af832012-09-18 14:45:37 -07001498 * {@link #hasSystemFeature}: The device has at least one camera pointing in
Eino-Ville Talvala9131da22014-05-08 11:39:53 -07001499 * some direction, or can support an external camera being connected to it.
Eino-Ville Talvala752af832012-09-18 14:45:37 -07001500 */
1501 @SdkConstant(SdkConstantType.FEATURE)
1502 public static final String FEATURE_CAMERA_ANY = "android.hardware.camera.any";
1503
1504 /**
1505 * Feature for {@link #getSystemAvailableFeatures} and
Eino-Ville Talvala9131da22014-05-08 11:39:53 -07001506 * {@link #hasSystemFeature}: The device can support having an external camera connected to it.
1507 * The external camera may not always be connected or available to applications to use.
1508 */
1509 @SdkConstant(SdkConstantType.FEATURE)
1510 public static final String FEATURE_CAMERA_EXTERNAL = "android.hardware.camera.external";
1511
1512 /**
1513 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001514 * {@link #hasSystemFeature}: The device's camera supports flash.
1515 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001516 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001517 public static final String FEATURE_CAMERA_FLASH = "android.hardware.camera.flash";
Dan Morrill50ab63f2010-03-05 16:16:19 -08001518
1519 /**
1520 * Feature for {@link #getSystemAvailableFeatures} and
Chih-Chung Changde1057c2010-06-14 19:15:00 +08001521 * {@link #hasSystemFeature}: The device has a front facing camera.
1522 */
1523 @SdkConstant(SdkConstantType.FEATURE)
1524 public static final String FEATURE_CAMERA_FRONT = "android.hardware.camera.front";
1525
1526 /**
Eino-Ville Talvala611fece2014-07-10 17:29:38 -07001527 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one
1528 * of the cameras on the device supports the
1529 * {@link android.hardware.camera2.CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL full hardware}
1530 * capability level.
1531 */
1532 @SdkConstant(SdkConstantType.FEATURE)
1533 public static final String FEATURE_CAMERA_LEVEL_FULL = "android.hardware.camera.level.full";
1534
1535 /**
1536 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one
1537 * of the cameras on the device supports the
1538 * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR manual sensor}
1539 * capability level.
1540 */
1541 @SdkConstant(SdkConstantType.FEATURE)
1542 public static final String FEATURE_CAMERA_CAPABILITY_MANUAL_SENSOR =
1543 "android.hardware.camera.capability.manual_sensor";
1544
1545 /**
1546 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one
1547 * of the cameras on the device supports the
1548 * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MANUAL_POST_PROCESSING manual post-processing}
1549 * capability level.
1550 */
1551 @SdkConstant(SdkConstantType.FEATURE)
1552 public static final String FEATURE_CAMERA_CAPABILITY_MANUAL_POST_PROCESSING =
1553 "android.hardware.camera.capability.manual_post_processing";
1554
1555 /**
1556 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one
1557 * of the cameras on the device supports the
1558 * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_RAW RAW}
1559 * capability level.
1560 */
1561 @SdkConstant(SdkConstantType.FEATURE)
1562 public static final String FEATURE_CAMERA_CAPABILITY_RAW =
1563 "android.hardware.camera.capability.raw";
1564
1565 /**
Chih-Chung Changde1057c2010-06-14 19:15:00 +08001566 * Feature for {@link #getSystemAvailableFeatures} and
Alex Ray0c9d61f2013-10-03 12:17:54 -07001567 * {@link #hasSystemFeature}: The device is capable of communicating with
1568 * consumer IR devices.
1569 */
1570 @SdkConstant(SdkConstantType.FEATURE)
1571 public static final String FEATURE_CONSUMER_IR = "android.hardware.consumerir";
1572
1573 /**
1574 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001575 * {@link #hasSystemFeature}: The device supports one or more methods of
1576 * reporting current location.
1577 */
1578 @SdkConstant(SdkConstantType.FEATURE)
1579 public static final String FEATURE_LOCATION = "android.hardware.location";
1580
1581 /**
1582 * Feature for {@link #getSystemAvailableFeatures} and
1583 * {@link #hasSystemFeature}: The device has a Global Positioning System
1584 * receiver and can report precise location.
1585 */
1586 @SdkConstant(SdkConstantType.FEATURE)
1587 public static final String FEATURE_LOCATION_GPS = "android.hardware.location.gps";
1588
1589 /**
1590 * Feature for {@link #getSystemAvailableFeatures} and
1591 * {@link #hasSystemFeature}: The device can report location with coarse
1592 * accuracy using a network-based geolocation system.
1593 */
1594 @SdkConstant(SdkConstantType.FEATURE)
1595 public static final String FEATURE_LOCATION_NETWORK = "android.hardware.location.network";
1596
1597 /**
1598 * Feature for {@link #getSystemAvailableFeatures} and
1599 * {@link #hasSystemFeature}: The device can record audio via a
1600 * microphone.
1601 */
1602 @SdkConstant(SdkConstantType.FEATURE)
1603 public static final String FEATURE_MICROPHONE = "android.hardware.microphone";
1604
1605 /**
1606 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill76437d32010-09-01 11:17:20 -07001607 * {@link #hasSystemFeature}: The device can communicate using Near-Field
1608 * Communications (NFC).
1609 */
1610 @SdkConstant(SdkConstantType.FEATURE)
1611 public static final String FEATURE_NFC = "android.hardware.nfc";
1612
1613 /**
1614 * Feature for {@link #getSystemAvailableFeatures} and
Martijn Coenenf4bf1582013-07-22 12:01:19 -07001615 * {@link #hasSystemFeature}: The device supports host-
1616 * based NFC card emulation.
Martijn Coenendf4d1d62013-08-28 11:18:58 -07001617 *
1618 * TODO remove when depending apps have moved to new constant.
1619 * @hide
1620 * @deprecated
Martijn Coenenf4bf1582013-07-22 12:01:19 -07001621 */
Jose Lima970417c2014-04-10 10:42:19 -07001622 @Deprecated
Martijn Coenenf4bf1582013-07-22 12:01:19 -07001623 @SdkConstant(SdkConstantType.FEATURE)
1624 public static final String FEATURE_NFC_HCE = "android.hardware.nfc.hce";
1625
1626 /**
1627 * Feature for {@link #getSystemAvailableFeatures} and
Martijn Coenendf4d1d62013-08-28 11:18:58 -07001628 * {@link #hasSystemFeature}: The device supports host-
1629 * based NFC card emulation.
1630 */
1631 @SdkConstant(SdkConstantType.FEATURE)
1632 public static final String FEATURE_NFC_HOST_CARD_EMULATION = "android.hardware.nfc.hce";
1633
1634 /**
1635 * Feature for {@link #getSystemAvailableFeatures} and
Yoshinobu Itoc52adfe2016-01-22 18:14:18 +09001636 * {@link #hasSystemFeature}: The device supports host-
1637 * based NFC-F card emulation.
1638 */
1639 @SdkConstant(SdkConstantType.FEATURE)
1640 public static final String FEATURE_NFC_HOST_CARD_EMULATION_NFCF = "android.hardware.nfc.hcef";
1641
1642 /**
1643 * Feature for {@link #getSystemAvailableFeatures} and
Jesse Hall7f517062014-07-18 11:54:41 -07001644 * {@link #hasSystemFeature}: The device supports the OpenGL ES
1645 * <a href="http://www.khronos.org/registry/gles/extensions/ANDROID/ANDROID_extension_pack_es31a.txt">
1646 * Android Extension Pack</a>.
1647 */
1648 @SdkConstant(SdkConstantType.FEATURE)
1649 public static final String FEATURE_OPENGLES_EXTENSION_PACK = "android.hardware.opengles.aep";
1650
1651 /**
1652 * Feature for {@link #getSystemAvailableFeatures} and
Jesse Hall39ceeb52016-03-10 09:04:26 -08001653 * {@link #hasSystemFeature(String, int)}: If this feature is supported, the Vulkan native API
1654 * will enumerate at least one {@code VkPhysicalDevice}, and the feature version will indicate
1655 * what level of optional hardware features limits it supports.
Jesse Hallf77a34f2016-02-04 18:41:33 -08001656 * <p>
1657 * Level 0 includes the base Vulkan requirements as well as:
1658 * <ul><li>{@code VkPhysicalDeviceFeatures::textureCompressionETC2}</li></ul>
1659 * <p>
1660 * Level 1 additionally includes:
1661 * <ul>
1662 * <li>{@code VkPhysicalDeviceFeatures::fullDrawIndexUint32}</li>
1663 * <li>{@code VkPhysicalDeviceFeatures::imageCubeArray}</li>
1664 * <li>{@code VkPhysicalDeviceFeatures::independentBlend}</li>
1665 * <li>{@code VkPhysicalDeviceFeatures::geometryShader}</li>
1666 * <li>{@code VkPhysicalDeviceFeatures::tessellationShader}</li>
1667 * <li>{@code VkPhysicalDeviceFeatures::sampleRateShading}</li>
1668 * <li>{@code VkPhysicalDeviceFeatures::textureCompressionASTC_LDR}</li>
1669 * <li>{@code VkPhysicalDeviceFeatures::fragmentStoresAndAtomics}</li>
1670 * <li>{@code VkPhysicalDeviceFeatures::shaderImageGatherExtended}</li>
1671 * <li>{@code VkPhysicalDeviceFeatures::shaderUniformBufferArrayDynamicIndexing}</li>
1672 * <li>{@code VkPhysicalDeviceFeatures::shaderSampledImageArrayDynamicIndexing}</li>
1673 * </ul>
1674 */
1675 @SdkConstant(SdkConstantType.FEATURE)
1676 public static final String FEATURE_VULKAN_HARDWARE_LEVEL = "android.hardware.vulkan.level";
1677
1678 /**
1679 * Feature for {@link #getSystemAvailableFeatures} and
Jesse Hall39ceeb52016-03-10 09:04:26 -08001680 * {@link #hasSystemFeature(String, int)}: The version of this feature indicates the highest
Jesse Hallf77a34f2016-02-04 18:41:33 -08001681 * {@code VkPhysicalDeviceProperties::apiVersion} supported by the physical devices that support
1682 * the hardware level indicated by {@link #FEATURE_VULKAN_HARDWARE_LEVEL}. The feature version
1683 * uses the same encoding as Vulkan version numbers:
1684 * <ul>
1685 * <li>Major version number in bits 31-22</li>
1686 * <li>Minor version number in bits 21-12</li>
1687 * <li>Patch version number in bits 11-0</li>
1688 * </ul>
1689 */
1690 @SdkConstant(SdkConstantType.FEATURE)
1691 public static final String FEATURE_VULKAN_HARDWARE_VERSION = "android.hardware.vulkan.version";
1692
1693 /**
1694 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill5744bb42010-09-01 19:18:57 -07001695 * {@link #hasSystemFeature}: The device includes an accelerometer.
1696 */
1697 @SdkConstant(SdkConstantType.FEATURE)
1698 public static final String FEATURE_SENSOR_ACCELEROMETER = "android.hardware.sensor.accelerometer";
1699
1700 /**
1701 * Feature for {@link #getSystemAvailableFeatures} and
1702 * {@link #hasSystemFeature}: The device includes a barometer (air
1703 * pressure sensor.)
1704 */
1705 @SdkConstant(SdkConstantType.FEATURE)
1706 public static final String FEATURE_SENSOR_BAROMETER = "android.hardware.sensor.barometer";
1707
1708 /**
1709 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001710 * {@link #hasSystemFeature}: The device includes a magnetometer (compass).
1711 */
1712 @SdkConstant(SdkConstantType.FEATURE)
1713 public static final String FEATURE_SENSOR_COMPASS = "android.hardware.sensor.compass";
1714
1715 /**
1716 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill5744bb42010-09-01 19:18:57 -07001717 * {@link #hasSystemFeature}: The device includes a gyroscope.
Dan Morrill50ab63f2010-03-05 16:16:19 -08001718 */
1719 @SdkConstant(SdkConstantType.FEATURE)
Dan Morrill5744bb42010-09-01 19:18:57 -07001720 public static final String FEATURE_SENSOR_GYROSCOPE = "android.hardware.sensor.gyroscope";
Dan Morrill50ab63f2010-03-05 16:16:19 -08001721
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001722 /**
1723 * Feature for {@link #getSystemAvailableFeatures} and
1724 * {@link #hasSystemFeature}: The device includes a light sensor.
1725 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001726 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001727 public static final String FEATURE_SENSOR_LIGHT = "android.hardware.sensor.light";
Dan Morrill50ab63f2010-03-05 16:16:19 -08001728
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001729 /**
1730 * Feature for {@link #getSystemAvailableFeatures} and
1731 * {@link #hasSystemFeature}: The device includes a proximity sensor.
1732 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001733 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001734 public static final String FEATURE_SENSOR_PROXIMITY = "android.hardware.sensor.proximity";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001735
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001736 /**
1737 * Feature for {@link #getSystemAvailableFeatures} and
Aravind Akella068b0c02013-10-12 17:39:15 -07001738 * {@link #hasSystemFeature}: The device includes a hardware step counter.
1739 */
1740 @SdkConstant(SdkConstantType.FEATURE)
1741 public static final String FEATURE_SENSOR_STEP_COUNTER = "android.hardware.sensor.stepcounter";
1742
1743 /**
1744 * Feature for {@link #getSystemAvailableFeatures} and
1745 * {@link #hasSystemFeature}: The device includes a hardware step detector.
1746 */
1747 @SdkConstant(SdkConstantType.FEATURE)
1748 public static final String FEATURE_SENSOR_STEP_DETECTOR = "android.hardware.sensor.stepdetector";
1749
1750 /**
1751 * Feature for {@link #getSystemAvailableFeatures} and
Vinod Krishnan8afb23c2014-04-30 11:11:39 -07001752 * {@link #hasSystemFeature}: The device includes a heart rate monitor.
1753 */
1754 @SdkConstant(SdkConstantType.FEATURE)
1755 public static final String FEATURE_SENSOR_HEART_RATE = "android.hardware.sensor.heartrate";
1756
1757 /**
1758 * Feature for {@link #getSystemAvailableFeatures} and
Trevor Johns682c24e2016-04-12 10:13:47 -07001759 * {@link #hasSystemFeature}: The heart rate sensor on this device is an Electrocardiogram.
Vinod Krishnan1ab76892014-08-20 11:11:55 -07001760 */
1761 @SdkConstant(SdkConstantType.FEATURE)
1762 public static final String FEATURE_SENSOR_HEART_RATE_ECG =
1763 "android.hardware.sensor.heartrate.ecg";
1764
1765 /**
1766 * Feature for {@link #getSystemAvailableFeatures} and
Aravind Akella8b8e74b2014-07-09 11:52:39 -07001767 * {@link #hasSystemFeature}: The device includes a relative humidity sensor.
1768 */
1769 @SdkConstant(SdkConstantType.FEATURE)
1770 public static final String FEATURE_SENSOR_RELATIVE_HUMIDITY =
1771 "android.hardware.sensor.relative_humidity";
1772
1773 /**
1774 * Feature for {@link #getSystemAvailableFeatures} and
1775 * {@link #hasSystemFeature}: The device includes an ambient temperature sensor.
1776 */
1777 @SdkConstant(SdkConstantType.FEATURE)
1778 public static final String FEATURE_SENSOR_AMBIENT_TEMPERATURE =
1779 "android.hardware.sensor.ambient_temperature";
1780
1781 /**
1782 * Feature for {@link #getSystemAvailableFeatures} and
Ashutosh Joshieae371b2015-04-09 10:30:07 -07001783 * {@link #hasSystemFeature}: The device supports high fidelity sensor processing
1784 * capabilities.
1785 */
1786 @SdkConstant(SdkConstantType.FEATURE)
1787 public static final String FEATURE_HIFI_SENSORS =
1788 "android.hardware.sensor.hifi_sensors";
1789
1790 /**
1791 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001792 * {@link #hasSystemFeature}: The device has a telephony radio with data
1793 * communication support.
1794 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001795 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001796 public static final String FEATURE_TELEPHONY = "android.hardware.telephony";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001797
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001798 /**
1799 * Feature for {@link #getSystemAvailableFeatures} and
1800 * {@link #hasSystemFeature}: The device has a CDMA telephony stack.
1801 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001802 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001803 public static final String FEATURE_TELEPHONY_CDMA = "android.hardware.telephony.cdma";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001804
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001805 /**
1806 * Feature for {@link #getSystemAvailableFeatures} and
1807 * {@link #hasSystemFeature}: The device has a GSM telephony stack.
1808 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001809 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001810 public static final String FEATURE_TELEPHONY_GSM = "android.hardware.telephony.gsm";
Hung-ying Tyan3424c022010-08-27 18:08:19 +08001811
1812 /**
1813 * Feature for {@link #getSystemAvailableFeatures} and
Mike Lockwoodf4ca2472011-02-27 11:23:25 -08001814 * {@link #hasSystemFeature}: The device supports connecting to USB devices
1815 * as the USB host.
1816 */
1817 @SdkConstant(SdkConstantType.FEATURE)
1818 public static final String FEATURE_USB_HOST = "android.hardware.usb.host";
1819
1820 /**
1821 * Feature for {@link #getSystemAvailableFeatures} and
1822 * {@link #hasSystemFeature}: The device supports connecting to USB accessories.
1823 */
1824 @SdkConstant(SdkConstantType.FEATURE)
1825 public static final String FEATURE_USB_ACCESSORY = "android.hardware.usb.accessory";
1826
1827 /**
1828 * Feature for {@link #getSystemAvailableFeatures} and
Hung-ying Tyan3424c022010-08-27 18:08:19 +08001829 * {@link #hasSystemFeature}: The SIP API is enabled on the device.
1830 */
1831 @SdkConstant(SdkConstantType.FEATURE)
1832 public static final String FEATURE_SIP = "android.software.sip";
1833
1834 /**
1835 * Feature for {@link #getSystemAvailableFeatures} and
1836 * {@link #hasSystemFeature}: The device supports SIP-based VOIP.
1837 */
1838 @SdkConstant(SdkConstantType.FEATURE)
1839 public static final String FEATURE_SIP_VOIP = "android.software.sip.voip";
1840
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001841 /**
1842 * Feature for {@link #getSystemAvailableFeatures} and
Ihab Awad1ec68882014-09-12 11:09:01 -07001843 * {@link #hasSystemFeature}: The Connection Service API is enabled on the device.
1844 */
1845 @SdkConstant(SdkConstantType.FEATURE)
1846 public static final String FEATURE_CONNECTION_SERVICE = "android.software.connectionservice";
1847
1848 /**
1849 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrillb0fe0332010-04-05 14:43:58 -07001850 * {@link #hasSystemFeature}: The device's display has a touch screen.
1851 */
1852 @SdkConstant(SdkConstantType.FEATURE)
1853 public static final String FEATURE_TOUCHSCREEN = "android.hardware.touchscreen";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001854
Dan Morrillb0fe0332010-04-05 14:43:58 -07001855 /**
1856 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001857 * {@link #hasSystemFeature}: The device's touch screen supports
1858 * multitouch sufficient for basic two-finger gesture detection.
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001859 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001860 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001861 public static final String FEATURE_TOUCHSCREEN_MULTITOUCH = "android.hardware.touchscreen.multitouch";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001862
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001863 /**
1864 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001865 * {@link #hasSystemFeature}: The device's touch screen is capable of
1866 * tracking two or more fingers fully independently.
1867 */
1868 @SdkConstant(SdkConstantType.FEATURE)
1869 public static final String FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT = "android.hardware.touchscreen.multitouch.distinct";
1870
1871 /**
1872 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill6993d3d2010-09-03 14:30:14 -07001873 * {@link #hasSystemFeature}: The device's touch screen is capable of
1874 * tracking a full hand of fingers fully independently -- that is, 5 or
1875 * more simultaneous independent pointers.
1876 */
1877 @SdkConstant(SdkConstantType.FEATURE)
1878 public static final String FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND = "android.hardware.touchscreen.multitouch.jazzhand";
1879
1880 /**
1881 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrilla5376872011-01-23 13:15:53 -08001882 * {@link #hasSystemFeature}: The device does not have a touch screen, but
1883 * does support touch emulation for basic events. For instance, the
1884 * device might use a mouse or remote control to drive a cursor, and
1885 * emulate basic touch pointer events like down, up, drag, etc. All
1886 * devices that support android.hardware.touchscreen or a sub-feature are
1887 * presumed to also support faketouch.
1888 */
1889 @SdkConstant(SdkConstantType.FEATURE)
1890 public static final String FEATURE_FAKETOUCH = "android.hardware.faketouch";
1891
1892 /**
1893 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborne22fe932011-06-08 20:24:29 -07001894 * {@link #hasSystemFeature}: The device does not have a touch screen, but
1895 * does support touch emulation for basic events that supports distinct
1896 * tracking of two or more fingers. This is an extension of
1897 * {@link #FEATURE_FAKETOUCH} for input devices with this capability. Note
1898 * that unlike a distinct multitouch screen as defined by
1899 * {@link #FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT}, these kinds of input
1900 * devices will not actually provide full two-finger gestures since the
1901 * input is being transformed to cursor movement on the screen. That is,
1902 * single finger gestures will move a cursor; two-finger swipes will
1903 * result in single-finger touch events; other two-finger gestures will
1904 * result in the corresponding two-finger touch event.
1905 */
1906 @SdkConstant(SdkConstantType.FEATURE)
1907 public static final String FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT = "android.hardware.faketouch.multitouch.distinct";
1908
1909 /**
1910 * Feature for {@link #getSystemAvailableFeatures} and
1911 * {@link #hasSystemFeature}: The device does not have a touch screen, but
1912 * does support touch emulation for basic events that supports tracking
1913 * a hand of fingers (5 or more fingers) fully independently.
1914 * This is an extension of
1915 * {@link #FEATURE_FAKETOUCH} for input devices with this capability. Note
1916 * that unlike a multitouch screen as defined by
1917 * {@link #FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND}, not all two finger
1918 * gestures can be detected due to the limitations described for
1919 * {@link #FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT}.
1920 */
1921 @SdkConstant(SdkConstantType.FEATURE)
1922 public static final String FEATURE_FAKETOUCH_MULTITOUCH_JAZZHAND = "android.hardware.faketouch.multitouch.jazzhand";
1923
1924 /**
1925 * Feature for {@link #getSystemAvailableFeatures} and
Jim Millerd9b9d412015-07-22 19:51:40 -07001926 * {@link #hasSystemFeature}: The device has biometric hardware to detect a fingerprint.
1927 */
1928 @SdkConstant(SdkConstantType.FEATURE)
1929 public static final String FEATURE_FINGERPRINT = "android.hardware.fingerprint";
1930
1931 /**
1932 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborne289bff2011-06-13 19:33:22 -07001933 * {@link #hasSystemFeature}: The device supports portrait orientation
1934 * screens. For backwards compatibility, you can assume that if neither
1935 * this nor {@link #FEATURE_SCREEN_LANDSCAPE} is set then the device supports
1936 * both portrait and landscape.
1937 */
1938 @SdkConstant(SdkConstantType.FEATURE)
1939 public static final String FEATURE_SCREEN_PORTRAIT = "android.hardware.screen.portrait";
1940
1941 /**
1942 * Feature for {@link #getSystemAvailableFeatures} and
1943 * {@link #hasSystemFeature}: The device supports landscape orientation
1944 * screens. For backwards compatibility, you can assume that if neither
1945 * this nor {@link #FEATURE_SCREEN_PORTRAIT} is set then the device supports
1946 * both portrait and landscape.
1947 */
1948 @SdkConstant(SdkConstantType.FEATURE)
1949 public static final String FEATURE_SCREEN_LANDSCAPE = "android.hardware.screen.landscape";
1950
1951 /**
1952 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001953 * {@link #hasSystemFeature}: The device supports live wallpapers.
1954 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001955 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001956 public static final String FEATURE_LIVE_WALLPAPER = "android.software.live_wallpaper";
Oscar Montemayor1228d0a2010-01-28 12:01:44 -08001957 /**
Dan Morrill50ab63f2010-03-05 16:16:19 -08001958 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn119bbc32013-03-22 17:27:25 -07001959 * {@link #hasSystemFeature}: The device supports app widgets.
1960 */
1961 @SdkConstant(SdkConstantType.FEATURE)
1962 public static final String FEATURE_APP_WIDGETS = "android.software.app_widgets";
1963
1964 /**
Dianne Hackborn91097de2014-04-04 18:02:06 -07001965 * @hide
1966 * Feature for {@link #getSystemAvailableFeatures} and
1967 * {@link #hasSystemFeature}: The device supports
1968 * {@link android.service.voice.VoiceInteractionService} and
1969 * {@link android.app.VoiceInteractor}.
1970 */
1971 @SdkConstant(SdkConstantType.FEATURE)
1972 public static final String FEATURE_VOICE_RECOGNIZERS = "android.software.voice_recognizers";
1973
1974
1975 /**
Dianne Hackborn119bbc32013-03-22 17:27:25 -07001976 * Feature for {@link #getSystemAvailableFeatures} and
1977 * {@link #hasSystemFeature}: The device supports a home screen that is replaceable
1978 * by third party applications.
1979 */
1980 @SdkConstant(SdkConstantType.FEATURE)
1981 public static final String FEATURE_HOME_SCREEN = "android.software.home_screen";
1982
1983 /**
1984 * Feature for {@link #getSystemAvailableFeatures} and
1985 * {@link #hasSystemFeature}: The device supports adding new input methods implemented
1986 * with the {@link android.inputmethodservice.InputMethodService} API.
1987 */
1988 @SdkConstant(SdkConstantType.FEATURE)
1989 public static final String FEATURE_INPUT_METHODS = "android.software.input_methods";
1990
1991 /**
1992 * Feature for {@link #getSystemAvailableFeatures} and
Amith Yamasani44a01b72013-09-16 10:44:57 -07001993 * {@link #hasSystemFeature}: The device supports device policy enforcement via device admins.
1994 */
1995 @SdkConstant(SdkConstantType.FEATURE)
1996 public static final String FEATURE_DEVICE_ADMIN = "android.software.device_admin";
1997
1998 /**
1999 * Feature for {@link #getSystemAvailableFeatures} and
Tim Kilbournf94b6a92014-03-07 15:13:48 -08002000 * {@link #hasSystemFeature}: The device supports leanback UI. This is
2001 * typically used in a living room television experience, but is a software
2002 * feature unlike {@link #FEATURE_TELEVISION}. Devices running with this
2003 * feature will use resources associated with the "television" UI mode.
2004 */
2005 @SdkConstant(SdkConstantType.FEATURE)
2006 public static final String FEATURE_LEANBACK = "android.software.leanback";
2007
2008 /**
2009 * Feature for {@link #getSystemAvailableFeatures} and
2010 * {@link #hasSystemFeature}: The device supports only leanback UI. Only
2011 * applications designed for this experience should be run, though this is
2012 * not enforced by the system.
2013 * @hide
2014 */
2015 @SdkConstant(SdkConstantType.FEATURE)
2016 public static final String FEATURE_LEANBACK_ONLY = "android.software.leanback_only";
2017
2018 /**
2019 * Feature for {@link #getSystemAvailableFeatures} and
Jae Seocfd861e2014-08-27 14:02:15 -07002020 * {@link #hasSystemFeature}: The device supports live TV and can display
2021 * contents from TV inputs implemented with the
2022 * {@link android.media.tv.TvInputService} API.
2023 */
2024 @SdkConstant(SdkConstantType.FEATURE)
2025 public static final String FEATURE_LIVE_TV = "android.software.live_tv";
2026
2027 /**
2028 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08002029 * {@link #hasSystemFeature}: The device supports WiFi (802.11) networking.
2030 */
2031 @SdkConstant(SdkConstantType.FEATURE)
2032 public static final String FEATURE_WIFI = "android.hardware.wifi";
2033
2034 /**
Irfan Sheriff45b8b462011-09-07 11:24:16 -07002035 * Feature for {@link #getSystemAvailableFeatures} and
2036 * {@link #hasSystemFeature}: The device supports Wi-Fi Direct networking.
2037 */
2038 @SdkConstant(SdkConstantType.FEATURE)
2039 public static final String FEATURE_WIFI_DIRECT = "android.hardware.wifi.direct";
2040
2041 /**
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07002042 * Feature for {@link #getSystemAvailableFeatures} and
Etan Cohen0849ded2016-10-26 11:22:06 -07002043 * {@link #hasSystemFeature}: The device supports Wi-Fi Aware.
Etan Cohen20d329b2015-09-29 13:49:02 -07002044 */
2045 @SdkConstant(SdkConstantType.FEATURE)
Etan Cohen0849ded2016-10-26 11:22:06 -07002046 public static final String FEATURE_WIFI_AWARE = "android.hardware.wifi.aware";
Etan Cohen20d329b2015-09-29 13:49:02 -07002047
2048 /**
2049 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07002050 * {@link #hasSystemFeature}: This is a device dedicated to showing UI
Todd Kennedy7f95a002015-04-22 14:28:25 -07002051 * on a vehicle headunit. A headunit here is defined to be inside a
2052 * vehicle that may or may not be moving. A headunit uses either a
2053 * primary display in the center console and/or additional displays in
2054 * the instrument cluster or elsewhere in the vehicle. Headunit display(s)
2055 * have limited size and resolution. The user will likely be focused on
2056 * driving so limiting driver distraction is a primary concern. User input
2057 * can be a variety of hard buttons, touch, rotary controllers and even mouse-
2058 * like interfaces.
2059 */
2060 @SdkConstant(SdkConstantType.FEATURE)
2061 public static final String FEATURE_AUTOMOTIVE = "android.hardware.type.automotive";
2062
2063 /**
2064 * Feature for {@link #getSystemAvailableFeatures} and
2065 * {@link #hasSystemFeature}: This is a device dedicated to showing UI
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07002066 * on a television. Television here is defined to be a typical living
2067 * room television experience: displayed on a big screen, where the user
2068 * is sitting far away from it, and the dominant form of input will be
2069 * something like a DPAD, not through touch or mouse.
Tim Kilbournf94b6a92014-03-07 15:13:48 -08002070 * @deprecated use {@link #FEATURE_LEANBACK} instead.
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07002071 */
Jose Lima970417c2014-04-10 10:42:19 -07002072 @Deprecated
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07002073 @SdkConstant(SdkConstantType.FEATURE)
2074 public static final String FEATURE_TELEVISION = "android.hardware.type.television";
2075
2076 /**
Justin Kohb5731f091c2014-02-13 16:06:59 -08002077 * Feature for {@link #getSystemAvailableFeatures} and
2078 * {@link #hasSystemFeature}: This is a device dedicated to showing UI
2079 * on a watch. A watch here is defined to be a device worn on the body, perhaps on
2080 * the wrist. The user is very close when interacting with the device.
2081 */
2082 @SdkConstant(SdkConstantType.FEATURE)
2083 public static final String FEATURE_WATCH = "android.hardware.type.watch";
2084
2085 /**
Adam Lesinski3d9bcb92014-02-18 14:05:14 -08002086 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2087 * The device supports printing.
2088 */
2089 @SdkConstant(SdkConstantType.FEATURE)
2090 public static final String FEATURE_PRINTING = "android.software.print";
2091
2092 /**
2093 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2094 * The device can perform backup and restore operations on installed applications.
2095 */
2096 @SdkConstant(SdkConstantType.FEATURE)
2097 public static final String FEATURE_BACKUP = "android.software.backup";
2098
2099 /**
Vladislav Kaznacheevd303b252015-10-27 17:30:58 -07002100 * Feature for {@link #getSystemAvailableFeatures} and
2101 * {@link #hasSystemFeature}: The device supports freeform window management.
2102 * Windows have title bars and can be moved and resized.
2103 */
Filip Gruszczynski811dc3b2015-11-23 12:34:22 -08002104 // If this feature is present, you also need to set
2105 // com.android.internal.R.config_freeformWindowManagement to true in your configuration overlay.
Vladislav Kaznacheevd303b252015-10-27 17:30:58 -07002106 @SdkConstant(SdkConstantType.FEATURE)
2107 public static final String FEATURE_FREEFORM_WINDOW_MANAGEMENT
2108 = "android.software.freeform_window_management";
2109
2110 /**
Adam Connors23cc04e2014-04-01 12:12:20 +01002111 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Wale Ogunwalefbe12c42015-12-06 16:23:50 -08002112 * The device supports picture-in-picture multi-window mode.
2113 */
2114 @SdkConstant(SdkConstantType.FEATURE)
2115 public static final String FEATURE_PICTURE_IN_PICTURE = "android.software.picture_in_picture";
2116
2117 /**
2118 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Amith Yamasani1d653272014-09-11 17:56:05 -07002119 * The device supports creating secondary users and managed profiles via
2120 * {@link DevicePolicyManager}.
Adam Connors23cc04e2014-04-01 12:12:20 +01002121 */
2122 @SdkConstant(SdkConstantType.FEATURE)
Amith Yamasani1d653272014-09-11 17:56:05 -07002123 public static final String FEATURE_MANAGED_USERS = "android.software.managed_users";
2124
2125 /**
2126 * @hide
2127 * TODO: Remove after dependencies updated b/17392243
2128 */
2129 public static final String FEATURE_MANAGED_PROFILES = "android.software.managed_users";
Adam Connors23cc04e2014-04-01 12:12:20 +01002130
2131 /**
Ben Murdochf564c7f2014-05-20 18:58:06 +01002132 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Adam Connors19ccb5f2014-09-08 17:31:50 +01002133 * The device supports verified boot.
2134 */
2135 @SdkConstant(SdkConstantType.FEATURE)
2136 public static final String FEATURE_VERIFIED_BOOT = "android.software.verified_boot";
2137
2138 /**
2139 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2140 * The device supports secure removal of users. When a user is deleted the data associated
2141 * with that user is securely deleted and no longer available.
2142 */
2143 @SdkConstant(SdkConstantType.FEATURE)
2144 public static final String FEATURE_SECURELY_REMOVES_USERS
2145 = "android.software.securely_removes_users";
2146
Jeff Sharkeyb92b05b2016-01-28 09:50:00 -07002147 /** {@hide} */
2148 @SdkConstant(SdkConstantType.FEATURE)
2149 public static final String FEATURE_FILE_BASED_ENCRYPTION
2150 = "android.software.file_based_encryption";
2151
Adam Connors19ccb5f2014-09-08 17:31:50 +01002152 /**
2153 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Ben Murdoch422c7a52014-05-16 13:45:47 +01002154 * The device has a full implementation of the android.webkit.* APIs. Devices
2155 * lacking this feature will not have a functioning WebView implementation.
2156 */
2157 @SdkConstant(SdkConstantType.FEATURE)
2158 public static final String FEATURE_WEBVIEW = "android.software.webview";
2159
2160 /**
Joe LaPenna4bb015d2014-07-04 17:15:54 -07002161 * Feature for {@link #getSystemAvailableFeatures} and
2162 * {@link #hasSystemFeature}: This device supports ethernet.
Joe LaPenna4bb015d2014-07-04 17:15:54 -07002163 */
2164 @SdkConstant(SdkConstantType.FEATURE)
2165 public static final String FEATURE_ETHERNET = "android.hardware.ethernet";
2166
2167 /**
Yuncheol Heoa0c4a062014-07-10 20:49:27 +09002168 * Feature for {@link #getSystemAvailableFeatures} and
2169 * {@link #hasSystemFeature}: This device supports HDMI-CEC.
2170 * @hide
2171 */
2172 @SdkConstant(SdkConstantType.FEATURE)
2173 public static final String FEATURE_HDMI_CEC = "android.hardware.hdmi.cec";
2174
2175 /**
Michael Wright6faa6752014-09-05 17:57:44 -07002176 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2177 * The device has all of the inputs necessary to be considered a compatible game controller, or
2178 * includes a compatible game controller in the box.
2179 */
2180 @SdkConstant(SdkConstantType.FEATURE)
2181 public static final String FEATURE_GAMEPAD = "android.hardware.gamepad";
2182
Mike Lockwood5781cd52015-03-27 13:23:41 -07002183 /**
2184 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2185 * The device has a full implementation of the android.media.midi.* APIs.
2186 */
2187 @SdkConstant(SdkConstantType.FEATURE)
2188 public static final String FEATURE_MIDI = "android.software.midi";
Michael Wright6faa6752014-09-05 17:57:44 -07002189
2190 /**
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08002191 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Ruben Brunk927d3452016-05-02 19:30:51 -07002192 * The device implements an optimized mode for virtual reality (VR) applications that handles
2193 * stereoscopic rendering of notifications, and disables most monocular system UI components
2194 * while a VR application has user focus.
2195 * Devices declaring this feature must include an application implementing a
2196 * {@link android.service.vr.VrListenerService} that can be targeted by VR applications via
2197 * {@link android.app.Activity#setVrModeEnabled}.
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08002198 */
2199 @SdkConstant(SdkConstantType.FEATURE)
2200 public static final String FEATURE_VR_MODE = "android.software.vr.mode";
2201
2202 /**
Ruben Brunk31d80ea2016-01-25 20:14:08 -08002203 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Ruben Brunk927d3452016-05-02 19:30:51 -07002204 * The device implements {@link #FEATURE_VR_MODE} but additionally meets extra CDD requirements
2205 * to provide a high-quality VR experience. In general, devices declaring this feature will
2206 * additionally:
2207 * <ul>
2208 * <li>Deliver consistent performance at a high framerate over an extended period of time
2209 * for typical VR application CPU/GPU workloads with a minimal number of frame drops for VR
2210 * applications that have called
2211 * {@link android.view.Window#setSustainedPerformanceMode}.</li>
2212 * <li>Implement {@link #FEATURE_HIFI_SENSORS} and have a low sensor latency.</li>
2213 * <li>Include optimizations to lower display persistence while running VR applications.</li>
2214 * <li>Implement an optimized render path to minimize latency to draw to the device's main
2215 * display.</li>
2216 * <li>Include the following EGL extensions: EGL_ANDROID_create_native_client_buffer,
2217 * EGL_ANDROID_front_buffer_auto_refresh, EGL_EXT_protected_content,
2218 * EGL_KHR_mutable_render_buffer, EGL_KHR_reusable_sync, and EGL_KHR_wait_sync.</li>
2219 * <li>Provide at least one CPU core that is reserved for use solely by the top, foreground
2220 * VR application process for critical render threads while such an application is
2221 * running.</li>
2222 * </ul>
Ruben Brunk31d80ea2016-01-25 20:14:08 -08002223 */
2224 @SdkConstant(SdkConstantType.FEATURE)
2225 public static final String FEATURE_VR_MODE_HIGH_PERFORMANCE
2226 = "android.hardware.vr.high_performance";
2227
2228 /**
Dianne Hackborne83cefce2010-02-04 17:38:14 -08002229 * Action to external storage service to clean out removed apps.
2230 * @hide
2231 */
2232 public static final String ACTION_CLEAN_EXTERNAL_STORAGE
2233 = "android.content.pm.CLEAN_EXTERNAL_STORAGE";
Oscar Montemayor1228d0a2010-01-28 12:01:44 -08002234
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002235 /**
Kenny Root5ab21572011-07-27 11:11:19 -07002236 * Extra field name for the URI to a verification file. Passed to a package
2237 * verifier.
2238 *
2239 * @hide
2240 */
2241 public static final String EXTRA_VERIFICATION_URI = "android.content.pm.extra.VERIFICATION_URI";
2242
2243 /**
2244 * Extra field name for the ID of a package pending verification. Passed to
2245 * a package verifier and is used to call back to
Kenny Root3a9b5fb2011-09-20 14:15:38 -07002246 * {@link PackageManager#verifyPendingInstall(int, int)}
Kenny Root5ab21572011-07-27 11:11:19 -07002247 */
2248 public static final String EXTRA_VERIFICATION_ID = "android.content.pm.extra.VERIFICATION_ID";
2249
2250 /**
2251 * Extra field name for the package identifier which is trying to install
2252 * the package.
2253 *
2254 * @hide
2255 */
2256 public static final String EXTRA_VERIFICATION_INSTALLER_PACKAGE
2257 = "android.content.pm.extra.VERIFICATION_INSTALLER_PACKAGE";
2258
2259 /**
2260 * Extra field name for the requested install flags for a package pending
2261 * verification. Passed to a package verifier.
2262 *
2263 * @hide
2264 */
2265 public static final String EXTRA_VERIFICATION_INSTALL_FLAGS
2266 = "android.content.pm.extra.VERIFICATION_INSTALL_FLAGS";
2267
2268 /**
rich cannings13d428e2012-09-13 13:43:07 -07002269 * Extra field name for the uid of who is requesting to install
2270 * the package.
2271 *
2272 * @hide
2273 */
2274 public static final String EXTRA_VERIFICATION_INSTALLER_UID
2275 = "android.content.pm.extra.VERIFICATION_INSTALLER_UID";
2276
2277 /**
2278 * Extra field name for the package name of a package pending verification.
2279 *
2280 * @hide
2281 */
2282 public static final String EXTRA_VERIFICATION_PACKAGE_NAME
2283 = "android.content.pm.extra.VERIFICATION_PACKAGE_NAME";
2284 /**
rich canningsd1b5cfc2012-08-29 14:49:51 -07002285 * Extra field name for the result of a verification, either
2286 * {@link #VERIFICATION_ALLOW}, or {@link #VERIFICATION_REJECT}.
2287 * Passed to package verifiers after a package is verified.
2288 */
2289 public static final String EXTRA_VERIFICATION_RESULT
2290 = "android.content.pm.extra.VERIFICATION_RESULT";
2291
2292 /**
rich cannings13d428e2012-09-13 13:43:07 -07002293 * Extra field name for the version code of a package pending verification.
2294 *
2295 * @hide
2296 */
2297 public static final String EXTRA_VERIFICATION_VERSION_CODE
2298 = "android.content.pm.extra.VERIFICATION_VERSION_CODE";
2299
2300 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07002301 * Extra field name for the ID of a intent filter pending verification.
2302 * Passed to an intent filter verifier and is used to call back to
2303 * {@link #verifyIntentFilter}
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08002304 *
2305 * @hide
2306 */
2307 public static final String EXTRA_INTENT_FILTER_VERIFICATION_ID
2308 = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_ID";
2309
2310 /**
2311 * Extra field name for the scheme used for an intent filter pending verification. Passed to
2312 * an intent filter verifier and is used to construct the URI to verify against.
2313 *
2314 * Usually this is "https"
2315 *
2316 * @hide
2317 */
2318 public static final String EXTRA_INTENT_FILTER_VERIFICATION_URI_SCHEME
2319 = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_URI_SCHEME";
2320
2321 /**
2322 * Extra field name for the host names to be used for an intent filter pending verification.
2323 * Passed to an intent filter verifier and is used to construct the URI to verify the
2324 * intent filter.
2325 *
2326 * This is a space delimited list of hosts.
2327 *
2328 * @hide
2329 */
2330 public static final String EXTRA_INTENT_FILTER_VERIFICATION_HOSTS
2331 = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_HOSTS";
2332
2333 /**
2334 * Extra field name for the package name to be used for an intent filter pending verification.
2335 * Passed to an intent filter verifier and is used to check the verification responses coming
2336 * from the hosts. Each host response will need to include the package name of APK containing
2337 * the intent filter.
2338 *
2339 * @hide
2340 */
2341 public static final String EXTRA_INTENT_FILTER_VERIFICATION_PACKAGE_NAME
2342 = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_PACKAGE_NAME";
2343
2344 /**
2345 * The action used to request that the user approve a permission request
2346 * from the application.
Nick Kralevich035f80d2013-03-27 15:20:08 -07002347 *
2348 * @hide
2349 */
Svetoslavc6d1c342015-02-26 14:44:43 -08002350 @SystemApi
2351 public static final String ACTION_REQUEST_PERMISSIONS =
2352 "android.content.pm.action.REQUEST_PERMISSIONS";
Nick Kralevich035f80d2013-03-27 15:20:08 -07002353
2354 /**
Svetoslavc6d1c342015-02-26 14:44:43 -08002355 * The names of the requested permissions.
2356 * <p>
2357 * <strong>Type:</strong> String[]
2358 * </p>
2359 *
2360 * @hide
2361 */
2362 @SystemApi
2363 public static final String EXTRA_REQUEST_PERMISSIONS_NAMES =
2364 "android.content.pm.extra.REQUEST_PERMISSIONS_NAMES";
2365
2366 /**
2367 * The results from the permissions request.
2368 * <p>
2369 * <strong>Type:</strong> int[] of #PermissionResult
2370 * </p>
2371 *
2372 * @hide
2373 */
2374 @SystemApi
2375 public static final String EXTRA_REQUEST_PERMISSIONS_RESULTS
2376 = "android.content.pm.extra.REQUEST_PERMISSIONS_RESULTS";
Nick Kralevich035f80d2013-03-27 15:20:08 -07002377
2378 /**
Jeff Sharkeybb580672014-07-10 12:10:25 -07002379 * String extra for {@link PackageInstallObserver} in the 'extras' Bundle in case of
Christopher Tatef1977b42014-03-24 16:25:51 -07002380 * {@link #INSTALL_FAILED_DUPLICATE_PERMISSION}. This extra names the package which provides
2381 * the existing definition for the permission.
2382 * @hide
2383 */
2384 public static final String EXTRA_FAILURE_EXISTING_PACKAGE
2385 = "android.content.pm.extra.FAILURE_EXISTING_PACKAGE";
2386
2387 /**
Jeff Sharkeybb580672014-07-10 12:10:25 -07002388 * String extra for {@link PackageInstallObserver} in the 'extras' Bundle in case of
Christopher Tatef1977b42014-03-24 16:25:51 -07002389 * {@link #INSTALL_FAILED_DUPLICATE_PERMISSION}. This extra names the permission that is
2390 * being redundantly defined by the package being installed.
2391 * @hide
2392 */
2393 public static final String EXTRA_FAILURE_EXISTING_PERMISSION
2394 = "android.content.pm.extra.FAILURE_EXISTING_PERMISSION";
2395
Svet Ganov8c7f7002015-05-07 10:48:44 -07002396 /**
2397 * Permission flag: The permission is set in its current state
2398 * by the user and apps can still request it at runtime.
2399 *
2400 * @hide
2401 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08002402 @SystemApi
Svet Ganov8c7f7002015-05-07 10:48:44 -07002403 public static final int FLAG_PERMISSION_USER_SET = 1 << 0;
2404
2405 /**
2406 * Permission flag: The permission is set in its current state
2407 * by the user and it is fixed, i.e. apps can no longer request
2408 * this permission.
2409 *
2410 * @hide
2411 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08002412 @SystemApi
Svet Ganov8c7f7002015-05-07 10:48:44 -07002413 public static final int FLAG_PERMISSION_USER_FIXED = 1 << 1;
2414
2415 /**
2416 * Permission flag: The permission is set in its current state
2417 * by device policy and neither apps nor the user can change
2418 * its state.
2419 *
2420 * @hide
2421 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08002422 @SystemApi
Svet Ganov8c7f7002015-05-07 10:48:44 -07002423 public static final int FLAG_PERMISSION_POLICY_FIXED = 1 << 2;
2424
2425 /**
2426 * Permission flag: The permission is set in a granted state but
2427 * access to resources it guards is restricted by other means to
2428 * enable revoking a permission on legacy apps that do not support
2429 * runtime permissions. If this permission is upgraded to runtime
2430 * because the app was updated to support runtime permissions, the
2431 * the permission will be revoked in the upgrade process.
2432 *
2433 * @hide
2434 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08002435 @SystemApi
Svet Ganov8c7f7002015-05-07 10:48:44 -07002436 public static final int FLAG_PERMISSION_REVOKE_ON_UPGRADE = 1 << 3;
2437
Svet Ganovb3f22b42015-05-12 11:01:24 -07002438 /**
2439 * Permission flag: The permission is set in its current state
2440 * because the app is a component that is a part of the system.
2441 *
2442 * @hide
2443 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08002444 @SystemApi
Svet Ganovb3f22b42015-05-12 11:01:24 -07002445 public static final int FLAG_PERMISSION_SYSTEM_FIXED = 1 << 4;
Svet Ganov8c7f7002015-05-07 10:48:44 -07002446
Svet Ganov77ab6a82015-07-03 12:03:02 -07002447 /**
2448 * Permission flag: The permission is granted by default because it
2449 * enables app functionality that is expected to work out-of-the-box
2450 * for providing a smooth user experience. For example, the phone app
2451 * is expected to have the phone permission.
2452 *
2453 * @hide
2454 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08002455 @SystemApi
Svet Ganov77ab6a82015-07-03 12:03:02 -07002456 public static final int FLAG_PERMISSION_GRANTED_BY_DEFAULT = 1 << 5;
2457
Svet Ganov8c7f7002015-05-07 10:48:44 -07002458 /**
Svet Ganov9c165d72015-12-01 19:52:26 -08002459 * Permission flag: The permission has to be reviewed before any of
2460 * the app components can run.
2461 *
2462 * @hide
2463 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08002464 @SystemApi
Svet Ganov9c165d72015-12-01 19:52:26 -08002465 public static final int FLAG_PERMISSION_REVIEW_REQUIRED = 1 << 6;
2466
2467 /**
Svet Ganov8c7f7002015-05-07 10:48:44 -07002468 * Mask for all permission flags.
2469 *
2470 * @hide
2471 */
2472 @SystemApi
Svet Ganovb3f22b42015-05-12 11:01:24 -07002473 public static final int MASK_PERMISSION_FLAGS = 0xFF;
Svet Ganov8c7f7002015-05-07 10:48:44 -07002474
Christopher Tatef1977b42014-03-24 16:25:51 -07002475 /**
Svet Ganovd7b1f4112016-02-09 18:49:23 -08002476 * This is a library that contains components apps can invoke. For
2477 * example, a services for apps to bind to, or standard chooser UI,
2478 * etc. This library is versioned and backwards compatible. Clients
2479 * should check its version via {@link android.ext.services.Version
2480 * #getVersionCode()} and avoid calling APIs added in later versions.
2481 *
2482 * @hide
2483 */
2484 public static final String SYSTEM_SHARED_LIBRARY_SERVICES = "android.ext.services";
2485
2486 /**
2487 * This is a library that contains components apps can dynamically
2488 * load. For example, new widgets, helper classes, etc. This library
2489 * is versioned and backwards compatible. Clients should check its
2490 * version via {@link android.ext.shared.Version#getVersionCode()}
2491 * and avoid calling APIs added in later versions.
2492 *
2493 * @hide
2494 */
2495 public static final String SYSTEM_SHARED_LIBRARY_SHARED = "android.ext.shared";
2496
2497 /**
Brian Carlstromca82e612016-04-19 23:16:08 -07002498 * Used when starting a process for an Activity.
2499 *
2500 * @hide
2501 */
2502 public static final int NOTIFY_PACKAGE_USE_ACTIVITY = 0;
2503
2504 /**
2505 * Used when starting a process for a Service.
2506 *
2507 * @hide
2508 */
2509 public static final int NOTIFY_PACKAGE_USE_SERVICE = 1;
2510
2511 /**
2512 * Used when moving a Service to the foreground.
2513 *
2514 * @hide
2515 */
2516 public static final int NOTIFY_PACKAGE_USE_FOREGROUND_SERVICE = 2;
2517
2518 /**
2519 * Used when starting a process for a BroadcastReceiver.
2520 *
2521 * @hide
2522 */
2523 public static final int NOTIFY_PACKAGE_USE_BROADCAST_RECEIVER = 3;
2524
2525 /**
2526 * Used when starting a process for a ContentProvider.
2527 *
2528 * @hide
2529 */
2530 public static final int NOTIFY_PACKAGE_USE_CONTENT_PROVIDER = 4;
2531
2532 /**
2533 * Used when starting a process for a BroadcastReceiver.
2534 *
2535 * @hide
2536 */
2537 public static final int NOTIFY_PACKAGE_USE_BACKUP = 5;
2538
2539 /**
2540 * Used with Context.getClassLoader() across Android packages.
2541 *
2542 * @hide
2543 */
2544 public static final int NOTIFY_PACKAGE_USE_CROSS_PACKAGE = 6;
2545
2546 /**
2547 * Used when starting a package within a process for Instrumentation.
2548 *
2549 * @hide
2550 */
2551 public static final int NOTIFY_PACKAGE_USE_INSTRUMENTATION = 7;
2552
2553 /**
2554 * Total number of usage reasons.
2555 *
2556 * @hide
2557 */
2558 public static final int NOTIFY_PACKAGE_USE_REASONS_COUNT = 8;
2559
2560 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002561 * Retrieve overall information about an application package that is
2562 * installed on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002563 *
2564 * @param packageName The full name (i.e. com.google.apps.contacts) of the
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002565 * desired package.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002566 * @param flags Additional option flags. Use any combination of
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002567 * {@link #GET_ACTIVITIES}, {@link #GET_CONFIGURATIONS},
2568 * {@link #GET_GIDS}, {@link #GET_INSTRUMENTATION},
2569 * {@link #GET_INTENT_FILTERS}, {@link #GET_META_DATA},
2570 * {@link #GET_PERMISSIONS}, {@link #GET_PROVIDERS},
2571 * {@link #GET_RECEIVERS}, {@link #GET_SERVICES},
2572 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #GET_SIGNATURES},
2573 * {@link #GET_URI_PERMISSION_PATTERNS}, {@link #GET_UNINSTALLED_PACKAGES},
2574 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
2575 * {@link #MATCH_UNINSTALLED_PACKAGES}
2576 * to modify the data returned.
2577 *
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002578 * @return A PackageInfo object containing information about the
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002579 * package. If flag {@code MATCH_UNINSTALLED_PACKAGES} is set and if the
Kenny Root5ab21572011-07-27 11:11:19 -07002580 * package is not found in the list of installed applications, the
2581 * package information is retrieved from the list of uninstalled
kmccormick30498b42013-03-27 17:39:17 -07002582 * applications (which includes installed applications as well as
2583 * applications with data directory i.e. applications which had been
2584 * deleted with {@code DONT_DELETE_DATA} flag set).
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002585 * @throws NameNotFoundException if a package with the given name cannot be
2586 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002587 * @see #GET_ACTIVITIES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002588 * @see #GET_CONFIGURATIONS
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002589 * @see #GET_GIDS
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002590 * @see #GET_INSTRUMENTATION
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002591 * @see #GET_INTENT_FILTERS
2592 * @see #GET_META_DATA
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002593 * @see #GET_PERMISSIONS
2594 * @see #GET_PROVIDERS
2595 * @see #GET_RECEIVERS
2596 * @see #GET_SERVICES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002597 * @see #GET_SHARED_LIBRARY_FILES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002598 * @see #GET_SIGNATURES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002599 * @see #GET_URI_PERMISSION_PATTERNS
2600 * @see #MATCH_DISABLED_COMPONENTS
2601 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
2602 * @see #MATCH_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002603 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07002604 public abstract PackageInfo getPackageInfo(String packageName, @PackageInfoFlags int flags)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002605 throws NameNotFoundException;
2606
2607 /**
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002608 * @hide
2609 * Retrieve overall information about an application package that is
2610 * installed on the system.
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002611 *
2612 * @param packageName The full name (i.e. com.google.apps.contacts) of the
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002613 * desired package.
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002614 * @param flags Additional option flags. Use any combination of
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002615 * {@link #GET_ACTIVITIES}, {@link #GET_CONFIGURATIONS},
2616 * {@link #GET_GIDS}, {@link #GET_INSTRUMENTATION},
2617 * {@link #GET_INTENT_FILTERS}, {@link #GET_META_DATA},
2618 * {@link #GET_PERMISSIONS}, {@link #GET_PROVIDERS},
2619 * {@link #GET_RECEIVERS}, {@link #GET_SERVICES},
2620 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #GET_SIGNATURES},
2621 * {@link #GET_URI_PERMISSION_PATTERNS}, {@link #GET_UNINSTALLED_PACKAGES},
2622 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
2623 * {@link #MATCH_UNINSTALLED_PACKAGES}
2624 * to modify the data returned.
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002625 * @param userId The user id.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002626 *
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002627 * @return A PackageInfo object containing information about the
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002628 * package. If flag {@code MATCH_UNINSTALLED_PACKAGES} is set and if the
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002629 * package is not found in the list of installed applications, the
2630 * package information is retrieved from the list of uninstalled
2631 * applications (which includes installed applications as well as
2632 * applications with data directory i.e. applications which had been
2633 * deleted with {@code DONT_DELETE_DATA} flag set).
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002634 * @throws NameNotFoundException if a package with the given name cannot be
2635 * found on the system.
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002636 * @see #GET_ACTIVITIES
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002637 * @see #GET_CONFIGURATIONS
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002638 * @see #GET_GIDS
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002639 * @see #GET_INSTRUMENTATION
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002640 * @see #GET_INTENT_FILTERS
2641 * @see #GET_META_DATA
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002642 * @see #GET_PERMISSIONS
2643 * @see #GET_PROVIDERS
2644 * @see #GET_RECEIVERS
2645 * @see #GET_SERVICES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002646 * @see #GET_SHARED_LIBRARY_FILES
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002647 * @see #GET_SIGNATURES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002648 * @see #GET_URI_PERMISSION_PATTERNS
2649 * @see #MATCH_DISABLED_COMPONENTS
2650 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
2651 * @see #MATCH_UNINSTALLED_PACKAGES
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002652 */
2653 @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS)
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07002654 public abstract PackageInfo getPackageInfoAsUser(String packageName,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002655 @PackageInfoFlags int flags, @UserIdInt int userId) throws NameNotFoundException;
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002656
2657 /**
Dianne Hackborn47096932010-02-11 15:57:09 -08002658 * Map from the current package names in use on the device to whatever
2659 * the current canonical name of that package is.
2660 * @param names Array of current names to be mapped.
2661 * @return Returns an array of the same size as the original, containing
2662 * the canonical name for each package.
2663 */
2664 public abstract String[] currentToCanonicalPackageNames(String[] names);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002665
Dianne Hackborn47096932010-02-11 15:57:09 -08002666 /**
2667 * Map from a packages canonical name to the current name in use on the device.
2668 * @param names Array of new names to be mapped.
2669 * @return Returns an array of the same size as the original, containing
2670 * the current name for each package.
2671 */
2672 public abstract String[] canonicalToCurrentPackageNames(String[] names);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002673
Dianne Hackborn47096932010-02-11 15:57:09 -08002674 /**
Andrew Solovay5ae13352014-06-06 12:23:09 -07002675 * Returns a "good" intent to launch a front-door activity in a package.
2676 * This is used, for example, to implement an "open" button when browsing
2677 * through packages. The current implementation looks first for a main
2678 * activity in the category {@link Intent#CATEGORY_INFO}, and next for a
2679 * main activity in the category {@link Intent#CATEGORY_LAUNCHER}. Returns
2680 * <code>null</code> if neither are found.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002681 *
2682 * @param packageName The name of the package to inspect.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002683 *
Andrew Solovay5ae13352014-06-06 12:23:09 -07002684 * @return A fully-qualified {@link Intent} that can be used to launch the
2685 * main activity in the package. Returns <code>null</code> if the package
2686 * does not contain such an activity, or if <em>packageName</em> is not
Ihab Awad1ec68882014-09-12 11:09:01 -07002687 * recognized.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002688 */
Mihai Predaeae850c2009-05-13 10:13:48 +02002689 public abstract Intent getLaunchIntentForPackage(String packageName);
2690
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002691 /**
Jose Lima970417c2014-04-10 10:42:19 -07002692 * Return a "good" intent to launch a front-door Leanback activity in a
2693 * package, for use for example to implement an "open" button when browsing
2694 * through packages. The current implementation will look for a main
2695 * activity in the category {@link Intent#CATEGORY_LEANBACK_LAUNCHER}, or
2696 * return null if no main leanback activities are found.
Adam Connors551c0782014-06-05 12:13:03 +01002697 *
Jose Lima970417c2014-04-10 10:42:19 -07002698 * @param packageName The name of the package to inspect.
2699 * @return Returns either a fully-qualified Intent that can be used to launch
2700 * the main Leanback activity in the package, or null if the package
2701 * does not contain such an activity.
2702 */
2703 public abstract Intent getLeanbackLaunchIntentForPackage(String packageName);
2704
2705 /**
Jeff Sharkeycf3f0a12016-03-17 19:57:58 -06002706 * Return an array of all of the POSIX secondary group IDs that have been
2707 * assigned to the given package.
2708 * <p>
2709 * Note that the same package may have different GIDs under different
2710 * {@link UserHandle} on the same device.
Adam Connors551c0782014-06-05 12:13:03 +01002711 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002712 * @param packageName The full name (i.e. com.google.apps.contacts) of the
Jeff Sharkeycf3f0a12016-03-17 19:57:58 -06002713 * desired package.
2714 * @return Returns an int array of the assigned GIDs, or null if there are
Jose Lima970417c2014-04-10 10:42:19 -07002715 * none.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002716 * @throws NameNotFoundException if a package with the given name cannot be
2717 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002718 */
2719 public abstract int[] getPackageGids(String packageName)
2720 throws NameNotFoundException;
2721
2722 /**
Jeff Sharkeycf3f0a12016-03-17 19:57:58 -06002723 * Return an array of all of the POSIX secondary group IDs that have been
2724 * assigned to the given package.
2725 * <p>
2726 * Note that the same package may have different GIDs under different
2727 * {@link UserHandle} on the same device.
Dianne Hackborna06de0f2012-12-11 16:34:47 -08002728 *
2729 * @param packageName The full name (i.e. com.google.apps.contacts) of the
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002730 * desired package.
2731 * @return Returns an int array of the assigned gids, or null if there are
2732 * none.
2733 * @throws NameNotFoundException if a package with the given name cannot be
2734 * found on the system.
Dianne Hackborna06de0f2012-12-11 16:34:47 -08002735 */
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002736 public abstract int[] getPackageGids(String packageName, @PackageInfoFlags int flags)
Dianne Hackborna06de0f2012-12-11 16:34:47 -08002737 throws NameNotFoundException;
2738
2739 /**
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002740 * Return the UID associated with the given package name.
Jeff Sharkeycf3f0a12016-03-17 19:57:58 -06002741 * <p>
2742 * Note that the same package will have different UIDs under different
2743 * {@link UserHandle} on the same device.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002744 *
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002745 * @param packageName The full name (i.e. com.google.apps.contacts) of the
2746 * desired package.
2747 * @return Returns an integer UID who owns the given package name.
2748 * @throws NameNotFoundException if a package with the given name can not be
2749 * found on the system.
2750 */
2751 public abstract int getPackageUid(String packageName, @PackageInfoFlags int flags)
2752 throws NameNotFoundException;
2753
2754 /**
2755 * Return the UID associated with the given package name.
Jeff Sharkeycf3f0a12016-03-17 19:57:58 -06002756 * <p>
2757 * Note that the same package will have different UIDs under different
2758 * {@link UserHandle} on the same device.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002759 *
2760 * @param packageName The full name (i.e. com.google.apps.contacts) of the
2761 * desired package.
2762 * @param userId The user handle identifier to look up the package under.
2763 * @return Returns an integer UID who owns the given package name.
2764 * @throws NameNotFoundException if a package with the given name can not be
2765 * found on the system.
2766 * @hide
2767 */
2768 public abstract int getPackageUidAsUser(String packageName, @UserIdInt int userId)
2769 throws NameNotFoundException;
2770
2771 /**
2772 * Return the UID associated with the given package name.
Jeff Sharkeycf3f0a12016-03-17 19:57:58 -06002773 * <p>
2774 * Note that the same package will have different UIDs under different
2775 * {@link UserHandle} on the same device.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002776 *
2777 * @param packageName The full name (i.e. com.google.apps.contacts) of the
2778 * desired package.
2779 * @param userId The user handle identifier to look up the package under.
2780 * @return Returns an integer UID who owns the given package name.
2781 * @throws NameNotFoundException if a package with the given name can not be
2782 * found on the system.
2783 * @hide
2784 */
2785 public abstract int getPackageUidAsUser(String packageName, @PackageInfoFlags int flags,
2786 @UserIdInt int userId) throws NameNotFoundException;
2787
2788 /**
2789 * Retrieve all of the information we know about a particular permission.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002790 *
2791 * @param name The fully qualified name (i.e. com.google.permission.LOGIN)
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002792 * of the permission you are interested in.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002793 * @param flags Additional option flags. Use {@link #GET_META_DATA} to
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002794 * retrieve any meta-data associated with the permission.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002795 *
2796 * @return Returns a {@link PermissionInfo} containing information about the
2797 * permission.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002798 * @throws NameNotFoundException if a package with the given name cannot be
2799 * found on the system.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002800 *
2801 * @see #GET_META_DATA
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002802 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07002803 public abstract PermissionInfo getPermissionInfo(String name, @PermissionInfoFlags int flags)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002804 throws NameNotFoundException;
2805
2806 /**
2807 * Query for all of the permissions associated with a particular group.
2808 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002809 * @param group The fully qualified name (i.e. com.google.permission.LOGIN)
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002810 * of the permission group you are interested in. Use null to
2811 * find all of the permissions not associated with a group.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002812 * @param flags Additional option flags. Use {@link #GET_META_DATA} to
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002813 * retrieve any meta-data associated with the permissions.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002814 *
2815 * @return Returns a list of {@link PermissionInfo} containing information
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002816 * about all of the permissions in the given group.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002817 * @throws NameNotFoundException if a package with the given name cannot be
2818 * found on the system.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002819 *
2820 * @see #GET_META_DATA
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002821 */
2822 public abstract List<PermissionInfo> queryPermissionsByGroup(String group,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07002823 @PermissionInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002824
2825 /**
2826 * Retrieve all of the information we know about a particular group of
2827 * permissions.
2828 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002829 * @param name The fully qualified name (i.e. com.google.permission_group.APPS)
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002830 * of the permission you are interested in.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002831 * @param flags Additional option flags. Use {@link #GET_META_DATA} to
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002832 * retrieve any meta-data associated with the permission group.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002833 *
2834 * @return Returns a {@link PermissionGroupInfo} containing information
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002835 * about the permission.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002836 * @throws NameNotFoundException if a package with the given name cannot be
2837 * found on the system.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002838 *
2839 * @see #GET_META_DATA
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002840 */
2841 public abstract PermissionGroupInfo getPermissionGroupInfo(String name,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07002842 @PermissionGroupInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002843
2844 /**
2845 * Retrieve all of the known permission groups in the system.
2846 *
2847 * @param flags Additional option flags. Use {@link #GET_META_DATA} to
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002848 * retrieve any meta-data associated with the permission group.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002849 *
2850 * @return Returns a list of {@link PermissionGroupInfo} containing
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002851 * information about all of the known permission groups.
2852 *
2853 * @see #GET_META_DATA
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002854 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07002855 public abstract List<PermissionGroupInfo> getAllPermissionGroups(
2856 @PermissionGroupInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002857
2858 /**
2859 * Retrieve all of the information we know about a particular
2860 * package/application.
2861 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002862 * @param packageName The full name (i.e. com.google.apps.contacts) of an
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002863 * application.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002864 * @param flags Additional option flags. Use any combination of
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002865 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
2866 * {@link #MATCH_SYSTEM_ONLY}, {@link #MATCH_UNINSTALLED_PACKAGES}
2867 * to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002868 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002869 * @return An {@link ApplicationInfo} containing information about the
2870 * package. If flag {@code MATCH_UNINSTALLED_PACKAGES} is set and if the
2871 * package is not found in the list of installed applications, the
2872 * application information is retrieved from the list of uninstalled
2873 * applications (which includes installed applications as well as
2874 * applications with data directory i.e. applications which had been
kmccormick30498b42013-03-27 17:39:17 -07002875 * deleted with {@code DONT_DELETE_DATA} flag set).
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002876 * @throws NameNotFoundException if a package with the given name cannot be
2877 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002878 *
2879 * @see #GET_META_DATA
2880 * @see #GET_SHARED_LIBRARY_FILES
Todd Kennedy5a32c6c2016-07-07 14:29:06 -07002881 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002882 * @see #MATCH_SYSTEM_ONLY
2883 * @see #MATCH_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002884 */
2885 public abstract ApplicationInfo getApplicationInfo(String packageName,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07002886 @ApplicationInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002887
Jeff Sharkeycd654482016-01-08 17:42:11 -07002888 /** {@hide} */
2889 public abstract ApplicationInfo getApplicationInfoAsUser(String packageName,
2890 @ApplicationInfoFlags int flags, @UserIdInt int userId) throws NameNotFoundException;
2891
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002892 /**
2893 * Retrieve all of the information we know about a particular activity
2894 * class.
2895 *
Dianne Hackborn361199b2010-08-30 17:42:07 -07002896 * @param component The full component name (i.e.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06002897 * com.google.apps.contacts/com.google.apps.contacts.
2898 * ContactsList) of an Activity class.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002899 * @param flags Additional option flags. Use any combination of
Jeff Sharkey8a372a02016-03-16 16:25:45 -06002900 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
2901 * {@link #MATCH_ALL}, {@link #MATCH_DEFAULT_ONLY},
2902 * {@link #MATCH_DISABLED_COMPONENTS},
2903 * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
2904 * {@link #MATCH_DIRECT_BOOT_AWARE},
2905 * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY}
2906 * {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data
2907 * returned.
2908 * @return An {@link ActivityInfo} containing information about the
2909 * activity.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002910 * @throws NameNotFoundException if a package with the given name cannot be
2911 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002912 * @see #GET_META_DATA
2913 * @see #GET_SHARED_LIBRARY_FILES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002914 * @see #MATCH_ALL
2915 * @see #MATCH_DEBUG_TRIAGED_MISSING
2916 * @see #MATCH_DEFAULT_ONLY
2917 * @see #MATCH_DISABLED_COMPONENTS
2918 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
Jeff Sharkey8a372a02016-03-16 16:25:45 -06002919 * @see #MATCH_DIRECT_BOOT_AWARE
2920 * @see #MATCH_DIRECT_BOOT_UNAWARE
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002921 * @see #MATCH_SYSTEM_ONLY
2922 * @see #MATCH_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002923 */
Dianne Hackborn361199b2010-08-30 17:42:07 -07002924 public abstract ActivityInfo getActivityInfo(ComponentName component,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07002925 @ComponentInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002926
2927 /**
2928 * Retrieve all of the information we know about a particular receiver
2929 * class.
2930 *
Dianne Hackborn361199b2010-08-30 17:42:07 -07002931 * @param component The full component name (i.e.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06002932 * com.google.apps.calendar/com.google.apps.calendar.
2933 * CalendarAlarm) of a Receiver class.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002934 * @param flags Additional option flags. Use any combination of
Jeff Sharkey8a372a02016-03-16 16:25:45 -06002935 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
2936 * {@link #MATCH_ALL}, {@link #MATCH_DEFAULT_ONLY},
2937 * {@link #MATCH_DISABLED_COMPONENTS},
2938 * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
2939 * {@link #MATCH_DIRECT_BOOT_AWARE},
2940 * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY}
2941 * {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data
2942 * returned.
2943 * @return An {@link ActivityInfo} containing information about the
2944 * receiver.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002945 * @throws NameNotFoundException if a package with the given name cannot be
2946 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002947 * @see #GET_META_DATA
2948 * @see #GET_SHARED_LIBRARY_FILES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002949 * @see #MATCH_ALL
2950 * @see #MATCH_DEBUG_TRIAGED_MISSING
2951 * @see #MATCH_DEFAULT_ONLY
2952 * @see #MATCH_DISABLED_COMPONENTS
2953 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
Jeff Sharkey8a372a02016-03-16 16:25:45 -06002954 * @see #MATCH_DIRECT_BOOT_AWARE
2955 * @see #MATCH_DIRECT_BOOT_UNAWARE
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002956 * @see #MATCH_SYSTEM_ONLY
2957 * @see #MATCH_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002958 */
Dianne Hackborn361199b2010-08-30 17:42:07 -07002959 public abstract ActivityInfo getReceiverInfo(ComponentName component,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07002960 @ComponentInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002961
2962 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -06002963 * Retrieve all of the information we know about a particular service class.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002964 *
Dianne Hackborn361199b2010-08-30 17:42:07 -07002965 * @param component The full component name (i.e.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06002966 * com.google.apps.media/com.google.apps.media.
2967 * BackgroundPlayback) of a Service class.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002968 * @param flags Additional option flags. Use any combination of
Jeff Sharkey8a372a02016-03-16 16:25:45 -06002969 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
2970 * {@link #MATCH_ALL}, {@link #MATCH_DEFAULT_ONLY},
2971 * {@link #MATCH_DISABLED_COMPONENTS},
2972 * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
2973 * {@link #MATCH_DIRECT_BOOT_AWARE},
2974 * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY}
2975 * {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data
2976 * returned.
2977 * @return A {@link ServiceInfo} object containing information about the
2978 * service.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002979 * @throws NameNotFoundException if a package with the given name cannot be
2980 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002981 * @see #GET_META_DATA
2982 * @see #GET_SHARED_LIBRARY_FILES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002983 * @see #MATCH_ALL
2984 * @see #MATCH_DEBUG_TRIAGED_MISSING
2985 * @see #MATCH_DEFAULT_ONLY
2986 * @see #MATCH_DISABLED_COMPONENTS
2987 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
Jeff Sharkey8a372a02016-03-16 16:25:45 -06002988 * @see #MATCH_DIRECT_BOOT_AWARE
2989 * @see #MATCH_DIRECT_BOOT_UNAWARE
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002990 * @see #MATCH_SYSTEM_ONLY
2991 * @see #MATCH_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002992 */
Dianne Hackborn361199b2010-08-30 17:42:07 -07002993 public abstract ServiceInfo getServiceInfo(ComponentName component,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07002994 @ComponentInfoFlags int flags) throws NameNotFoundException;
Dianne Hackborn361199b2010-08-30 17:42:07 -07002995
2996 /**
2997 * Retrieve all of the information we know about a particular content
2998 * provider class.
2999 *
Dianne Hackborn361199b2010-08-30 17:42:07 -07003000 * @param component The full component name (i.e.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003001 * com.google.providers.media/com.google.providers.media.
3002 * MediaProvider) of a ContentProvider class.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003003 * @param flags Additional option flags. Use any combination of
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003004 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
3005 * {@link #MATCH_ALL}, {@link #MATCH_DEFAULT_ONLY},
3006 * {@link #MATCH_DISABLED_COMPONENTS},
3007 * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
3008 * {@link #MATCH_DIRECT_BOOT_AWARE},
3009 * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY}
3010 * {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data
3011 * returned.
3012 * @return A {@link ProviderInfo} object containing information about the
3013 * provider.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003014 * @throws NameNotFoundException if a package with the given name cannot be
3015 * found on the system.
Dianne Hackborn361199b2010-08-30 17:42:07 -07003016 * @see #GET_META_DATA
3017 * @see #GET_SHARED_LIBRARY_FILES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003018 * @see #MATCH_ALL
3019 * @see #MATCH_DEBUG_TRIAGED_MISSING
3020 * @see #MATCH_DEFAULT_ONLY
3021 * @see #MATCH_DISABLED_COMPONENTS
3022 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003023 * @see #MATCH_DIRECT_BOOT_AWARE
3024 * @see #MATCH_DIRECT_BOOT_UNAWARE
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003025 * @see #MATCH_SYSTEM_ONLY
3026 * @see #MATCH_UNINSTALLED_PACKAGES
Dianne Hackborn361199b2010-08-30 17:42:07 -07003027 */
3028 public abstract ProviderInfo getProviderInfo(ComponentName component,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003029 @ComponentInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003030
3031 /**
3032 * Return a List of all packages that are installed
3033 * on the device.
3034 *
3035 * @param flags Additional option flags. Use any combination of
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003036 * {@link #GET_ACTIVITIES}, {@link #GET_CONFIGURATIONS},
3037 * {@link #GET_GIDS}, {@link #GET_INSTRUMENTATION},
3038 * {@link #GET_INTENT_FILTERS}, {@link #GET_META_DATA},
3039 * {@link #GET_PERMISSIONS}, {@link #GET_PROVIDERS},
3040 * {@link #GET_RECEIVERS}, {@link #GET_SERVICES},
3041 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #GET_SIGNATURES},
3042 * {@link #GET_URI_PERMISSION_PATTERNS}, {@link #GET_UNINSTALLED_PACKAGES},
3043 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
3044 * {@link #MATCH_UNINSTALLED_PACKAGES}
3045 * to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003046 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003047 * @return A List of PackageInfo objects, one for each installed package,
3048 * containing information about the package. In the unlikely case
3049 * there are no installed packages, an empty list is returned. If
3050 * flag {@code MATCH_UNINSTALLED_PACKAGES} is set, the package
3051 * information is retrieved from the list of uninstalled
3052 * applications (which includes installed applications as well as
3053 * applications with data directory i.e. applications which had been
3054 * deleted with {@code DONT_DELETE_DATA} flag set).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003055 *
3056 * @see #GET_ACTIVITIES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003057 * @see #GET_CONFIGURATIONS
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003058 * @see #GET_GIDS
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003059 * @see #GET_INSTRUMENTATION
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003060 * @see #GET_INTENT_FILTERS
3061 * @see #GET_META_DATA
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003062 * @see #GET_PERMISSIONS
3063 * @see #GET_PROVIDERS
3064 * @see #GET_RECEIVERS
3065 * @see #GET_SERVICES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003066 * @see #GET_SHARED_LIBRARY_FILES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003067 * @see #GET_SIGNATURES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003068 * @see #GET_URI_PERMISSION_PATTERNS
3069 * @see #MATCH_DISABLED_COMPONENTS
3070 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
3071 * @see #MATCH_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003072 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003073 public abstract List<PackageInfo> getInstalledPackages(@PackageInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003074
3075 /**
Dianne Hackborne7991752013-01-16 17:56:46 -08003076 * Return a List of all installed packages that are currently
3077 * holding any of the given permissions.
3078 *
3079 * @param flags Additional option flags. Use any combination of
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003080 * {@link #GET_ACTIVITIES}, {@link #GET_CONFIGURATIONS},
3081 * {@link #GET_GIDS}, {@link #GET_INSTRUMENTATION},
3082 * {@link #GET_INTENT_FILTERS}, {@link #GET_META_DATA},
3083 * {@link #GET_PERMISSIONS}, {@link #GET_PROVIDERS},
3084 * {@link #GET_RECEIVERS}, {@link #GET_SERVICES},
3085 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #GET_SIGNATURES},
3086 * {@link #GET_URI_PERMISSION_PATTERNS}, {@link #GET_UNINSTALLED_PACKAGES},
3087 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
3088 * {@link #MATCH_UNINSTALLED_PACKAGES}
3089 * to modify the data returned.
Dianne Hackborne7991752013-01-16 17:56:46 -08003090 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003091 * @return A List of PackageInfo objects, one for each installed package
3092 * that holds any of the permissions that were provided, containing
3093 * information about the package. If no installed packages hold any
3094 * of the permissions, an empty list is returned. If flag
3095 * {@code MATCH_UNINSTALLED_PACKAGES} is set, the package information
3096 * is retrieved from the list of uninstalled applications (which
3097 * includes installed applications as well as applications with data
3098 * directory i.e. applications which had been deleted with
3099 * {@code DONT_DELETE_DATA} flag set).
Dianne Hackborne7991752013-01-16 17:56:46 -08003100 *
3101 * @see #GET_ACTIVITIES
Dianne Hackborne7991752013-01-16 17:56:46 -08003102 * @see #GET_CONFIGURATIONS
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003103 * @see #GET_GIDS
Dianne Hackborne7991752013-01-16 17:56:46 -08003104 * @see #GET_INSTRUMENTATION
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003105 * @see #GET_INTENT_FILTERS
3106 * @see #GET_META_DATA
Dianne Hackborne7991752013-01-16 17:56:46 -08003107 * @see #GET_PERMISSIONS
3108 * @see #GET_PROVIDERS
3109 * @see #GET_RECEIVERS
3110 * @see #GET_SERVICES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003111 * @see #GET_SHARED_LIBRARY_FILES
Dianne Hackborne7991752013-01-16 17:56:46 -08003112 * @see #GET_SIGNATURES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003113 * @see #GET_URI_PERMISSION_PATTERNS
3114 * @see #MATCH_DISABLED_COMPONENTS
3115 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
3116 * @see #MATCH_UNINSTALLED_PACKAGES
Dianne Hackborne7991752013-01-16 17:56:46 -08003117 */
3118 public abstract List<PackageInfo> getPackagesHoldingPermissions(
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003119 String[] permissions, @PackageInfoFlags int flags);
Dianne Hackborne7991752013-01-16 17:56:46 -08003120
3121 /**
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003122 * Return a List of all packages that are installed on the device, for a specific user.
3123 * Requesting a list of installed packages for another user
3124 * will require the permission INTERACT_ACROSS_USERS_FULL.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003125 *
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003126 * @param flags Additional option flags. Use any combination of
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003127 * {@link #GET_ACTIVITIES}, {@link #GET_CONFIGURATIONS},
3128 * {@link #GET_GIDS}, {@link #GET_INSTRUMENTATION},
3129 * {@link #GET_INTENT_FILTERS}, {@link #GET_META_DATA},
3130 * {@link #GET_PERMISSIONS}, {@link #GET_PROVIDERS},
3131 * {@link #GET_RECEIVERS}, {@link #GET_SERVICES},
3132 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #GET_SIGNATURES},
3133 * {@link #GET_URI_PERMISSION_PATTERNS}, {@link #GET_UNINSTALLED_PACKAGES},
3134 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
3135 * {@link #MATCH_UNINSTALLED_PACKAGES}
3136 * to modify the data returned.
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003137 * @param userId The user for whom the installed packages are to be listed
3138 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003139 * @return A List of PackageInfo objects, one for each installed package,
3140 * containing information about the package. In the unlikely case
3141 * there are no installed packages, an empty list is returned. If
3142 * flag {@code MATCH_UNINSTALLED_PACKAGES} is set, the package
3143 * information is retrieved from the list of uninstalled
3144 * applications (which includes installed applications as well as
3145 * applications with data directory i.e. applications which had been
3146 * deleted with {@code DONT_DELETE_DATA} flag set).
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003147 *
3148 * @see #GET_ACTIVITIES
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003149 * @see #GET_CONFIGURATIONS
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003150 * @see #GET_GIDS
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003151 * @see #GET_INSTRUMENTATION
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003152 * @see #GET_INTENT_FILTERS
3153 * @see #GET_META_DATA
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003154 * @see #GET_PERMISSIONS
3155 * @see #GET_PROVIDERS
3156 * @see #GET_RECEIVERS
3157 * @see #GET_SERVICES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003158 * @see #GET_SHARED_LIBRARY_FILES
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003159 * @see #GET_SIGNATURES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003160 * @see #GET_URI_PERMISSION_PATTERNS
3161 * @see #MATCH_DISABLED_COMPONENTS
3162 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
3163 * @see #MATCH_UNINSTALLED_PACKAGES
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003164 *
3165 * @hide
3166 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08003167 @SystemApi
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07003168 public abstract List<PackageInfo> getInstalledPackagesAsUser(@PackageInfoFlags int flags,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003169 @UserIdInt int userId);
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003170
3171 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003172 * Check whether a particular package has been granted a particular
3173 * permission.
3174 *
Svet Ganovad3b2972015-07-07 22:49:17 -07003175 * @param permName The name of the permission you are checking for.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003176 * @param pkgName The name of the package you are checking against.
3177 *
3178 * @return If the package has the permission, PERMISSION_GRANTED is
3179 * returned. If it does not have the permission, PERMISSION_DENIED
3180 * is returned.
3181 *
3182 * @see #PERMISSION_GRANTED
3183 * @see #PERMISSION_DENIED
3184 */
Tor Norbye1c2bf032015-03-02 10:57:08 -08003185 @CheckResult
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003186 public abstract int checkPermission(String permName, String pkgName);
3187
3188 /**
Svet Ganovad3b2972015-07-07 22:49:17 -07003189 * Checks whether a particular permissions has been revoked for a
3190 * package by policy. Typically the device owner or the profile owner
3191 * may apply such a policy. The user cannot grant policy revoked
3192 * permissions, hence the only way for an app to get such a permission
3193 * is by a policy change.
3194 *
3195 * @param permName The name of the permission you are checking for.
3196 * @param pkgName The name of the package you are checking against.
3197 *
3198 * @return Whether the permission is restricted by policy.
3199 */
3200 @CheckResult
Svet Ganovf1b7f202015-07-29 08:33:42 -07003201 public abstract boolean isPermissionRevokedByPolicy(@NonNull String permName,
3202 @NonNull String pkgName);
3203
3204 /**
3205 * Gets the package name of the component controlling runtime permissions.
3206 *
3207 * @return The package name.
3208 *
3209 * @hide
3210 */
3211 public abstract String getPermissionControllerPackageName();
Svet Ganovad3b2972015-07-07 22:49:17 -07003212
3213 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003214 * Add a new dynamic permission to the system. For this to work, your
3215 * package must have defined a permission tree through the
3216 * {@link android.R.styleable#AndroidManifestPermissionTree
3217 * &lt;permission-tree&gt;} tag in its manifest. A package can only add
3218 * permissions to trees that were defined by either its own package or
3219 * another with the same user id; a permission is in a tree if it
3220 * matches the name of the permission tree + ".": for example,
3221 * "com.foo.bar" is a member of the permission tree "com.foo".
3222 *
3223 * <p>It is good to make your permission tree name descriptive, because you
3224 * are taking possession of that entire set of permission names. Thus, it
3225 * must be under a domain you control, with a suffix that will not match
3226 * any normal permissions that may be declared in any applications that
3227 * are part of that domain.
3228 *
3229 * <p>New permissions must be added before
3230 * any .apks are installed that use those permissions. Permissions you
3231 * add through this method are remembered across reboots of the device.
3232 * If the given permission already exists, the info you supply here
3233 * will be used to update it.
3234 *
3235 * @param info Description of the permission to be added.
3236 *
3237 * @return Returns true if a new permission was created, false if an
3238 * existing one was updated.
3239 *
3240 * @throws SecurityException if you are not allowed to add the
3241 * given permission name.
3242 *
3243 * @see #removePermission(String)
3244 */
3245 public abstract boolean addPermission(PermissionInfo info);
3246
3247 /**
Dianne Hackbornd7c09682010-03-30 10:42:20 -07003248 * Like {@link #addPermission(PermissionInfo)} but asynchronously
3249 * persists the package manager state after returning from the call,
3250 * allowing it to return quicker and batch a series of adds at the
3251 * expense of no guarantee the added permission will be retained if
3252 * the device is rebooted before it is written.
3253 */
3254 public abstract boolean addPermissionAsync(PermissionInfo info);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003255
Dianne Hackbornd7c09682010-03-30 10:42:20 -07003256 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003257 * Removes a permission that was previously added with
3258 * {@link #addPermission(PermissionInfo)}. The same ownership rules apply
3259 * -- you are only allowed to remove permissions that you are allowed
3260 * to add.
3261 *
3262 * @param name The name of the permission to remove.
3263 *
3264 * @throws SecurityException if you are not allowed to remove the
3265 * given permission name.
3266 *
3267 * @see #addPermission(PermissionInfo)
3268 */
3269 public abstract void removePermission(String name);
3270
Svet Ganov8c7f7002015-05-07 10:48:44 -07003271
3272 /**
3273 * Permission flags set when granting or revoking a permission.
3274 *
3275 * @hide
3276 */
3277 @SystemApi
3278 @IntDef({FLAG_PERMISSION_USER_SET,
3279 FLAG_PERMISSION_USER_FIXED,
3280 FLAG_PERMISSION_POLICY_FIXED,
Svet Ganovb3f22b42015-05-12 11:01:24 -07003281 FLAG_PERMISSION_REVOKE_ON_UPGRADE,
Svet Ganov77ab6a82015-07-03 12:03:02 -07003282 FLAG_PERMISSION_SYSTEM_FIXED,
3283 FLAG_PERMISSION_GRANTED_BY_DEFAULT})
Svet Ganov8c7f7002015-05-07 10:48:44 -07003284 @Retention(RetentionPolicy.SOURCE)
3285 public @interface PermissionFlags {}
3286
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003287 /**
Svetoslavc6d1c342015-02-26 14:44:43 -08003288 * Grant a runtime permission to an application which the application does not
3289 * already have. The permission must have been requested by the application.
3290 * If the application is not allowed to hold the permission, a {@link
Ruben Brunk12ab5e12016-11-10 15:27:30 -08003291 * java.lang.SecurityException} is thrown. If the package or permission is
3292 * invalid, a {@link java.lang.IllegalArgumentException} is thrown.
Svetoslavc6d1c342015-02-26 14:44:43 -08003293 * <p>
3294 * <strong>Note: </strong>Using this API requires holding
3295 * android.permission.GRANT_REVOKE_PERMISSIONS and if the user id is
3296 * not the current user android.permission.INTERACT_ACROSS_USERS_FULL.
3297 * </p>
Nick Kralevich035f80d2013-03-27 15:20:08 -07003298 *
Svetoslavc6d1c342015-02-26 14:44:43 -08003299 * @param packageName The package to which to grant the permission.
3300 * @param permissionName The permission name to grant.
3301 * @param user The user for which to grant the permission.
3302 *
Svet Ganov8c7f7002015-05-07 10:48:44 -07003303 * @see #revokeRuntimePermission(String, String, android.os.UserHandle)
3304 * @see android.content.pm.PackageManager.PermissionFlags
Svetoslavc6d1c342015-02-26 14:44:43 -08003305 *
3306 * @hide
Nick Kralevich035f80d2013-03-27 15:20:08 -07003307 */
Svetoslavc6d1c342015-02-26 14:44:43 -08003308 @SystemApi
Svet Ganov8c7f7002015-05-07 10:48:44 -07003309 public abstract void grantRuntimePermission(@NonNull String packageName,
Svetoslavc6d1c342015-02-26 14:44:43 -08003310 @NonNull String permissionName, @NonNull UserHandle user);
Nick Kralevich035f80d2013-03-27 15:20:08 -07003311
Svetoslavc6d1c342015-02-26 14:44:43 -08003312 /**
3313 * Revoke a runtime permission that was previously granted by {@link
Svet Ganov8c7f7002015-05-07 10:48:44 -07003314 * #grantRuntimePermission(String, String, android.os.UserHandle)}. The
3315 * permission must have been requested by and granted to the application.
3316 * If the application is not allowed to hold the permission, a {@link
Ruben Brunk12ab5e12016-11-10 15:27:30 -08003317 * java.lang.SecurityException} is thrown. If the package or permission is
3318 * invalid, a {@link java.lang.IllegalArgumentException} is thrown.
Svetoslavc6d1c342015-02-26 14:44:43 -08003319 * <p>
3320 * <strong>Note: </strong>Using this API requires holding
3321 * android.permission.GRANT_REVOKE_PERMISSIONS and if the user id is
3322 * not the current user android.permission.INTERACT_ACROSS_USERS_FULL.
3323 * </p>
3324 *
3325 * @param packageName The package from which to revoke the permission.
3326 * @param permissionName The permission name to revoke.
3327 * @param user The user for which to revoke the permission.
3328 *
Svet Ganov8c7f7002015-05-07 10:48:44 -07003329 * @see #grantRuntimePermission(String, String, android.os.UserHandle)
3330 * @see android.content.pm.PackageManager.PermissionFlags
Svetoslavc6d1c342015-02-26 14:44:43 -08003331 *
3332 * @hide
3333 */
3334 @SystemApi
Svet Ganov8c7f7002015-05-07 10:48:44 -07003335 public abstract void revokeRuntimePermission(@NonNull String packageName,
Svetoslavc6d1c342015-02-26 14:44:43 -08003336 @NonNull String permissionName, @NonNull UserHandle user);
3337
3338 /**
Svet Ganov8c7f7002015-05-07 10:48:44 -07003339 * Gets the state flags associated with a permission.
3340 *
3341 * @param permissionName The permission for which to get the flags.
3342 * @param packageName The package name for which to get the flags.
3343 * @param user The user for which to get permission flags.
3344 * @return The permission flags.
3345 *
3346 * @hide
3347 */
3348 @SystemApi
3349 public abstract @PermissionFlags int getPermissionFlags(String permissionName,
3350 String packageName, @NonNull UserHandle user);
3351
3352 /**
3353 * Updates the flags associated with a permission by replacing the flags in
3354 * the specified mask with the provided flag values.
3355 *
3356 * @param permissionName The permission for which to update the flags.
3357 * @param packageName The package name for which to update the flags.
3358 * @param flagMask The flags which to replace.
3359 * @param flagValues The flags with which to replace.
3360 * @param user The user for which to update the permission flags.
3361 *
3362 * @hide
3363 */
3364 @SystemApi
3365 public abstract void updatePermissionFlags(String permissionName,
3366 String packageName, @PermissionFlags int flagMask, int flagValues,
3367 @NonNull UserHandle user);
3368
3369 /**
Svetoslav20770dd2015-05-29 15:43:04 -07003370 * Gets whether you should show UI with rationale for requesting a permission.
3371 * You should do this only if you do not have the permission and the context in
3372 * which the permission is requested does not clearly communicate to the user
3373 * what would be the benefit from grating this permission.
3374 *
3375 * @param permission A permission your app wants to request.
3376 * @return Whether you can show permission rationale UI.
3377 *
3378 * @hide
3379 */
3380 public abstract boolean shouldShowRequestPermissionRationale(String permission);
3381
3382 /**
Svetoslavc6d1c342015-02-26 14:44:43 -08003383 * Returns an {@link android.content.Intent} suitable for passing to
3384 * {@link android.app.Activity#startActivityForResult(android.content.Intent, int)}
3385 * which prompts the user to grant permissions to this application.
3386 *
3387 * @throws NullPointerException if {@code permissions} is {@code null} or empty.
3388 *
3389 * @hide
3390 */
3391 public Intent buildRequestPermissionsIntent(@NonNull String[] permissions) {
3392 if (ArrayUtils.isEmpty(permissions)) {
Svet Ganovf66381c2016-02-18 20:02:36 -08003393 throw new IllegalArgumentException("permission cannot be null or empty");
Svetoslavc6d1c342015-02-26 14:44:43 -08003394 }
3395 Intent intent = new Intent(ACTION_REQUEST_PERMISSIONS);
3396 intent.putExtra(EXTRA_REQUEST_PERMISSIONS_NAMES, permissions);
Svet Ganovf1b7f202015-07-29 08:33:42 -07003397 intent.setPackage(getPermissionControllerPackageName());
Svetoslavc6d1c342015-02-26 14:44:43 -08003398 return intent;
Nick Kralevich035f80d2013-03-27 15:20:08 -07003399 }
3400
3401 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003402 * Compare the signatures of two packages to determine if the same
3403 * signature appears in both of them. If they do contain the same
3404 * signature, then they are allowed special privileges when working
3405 * with each other: they can share the same user-id, run instrumentation
3406 * against each other, etc.
3407 *
3408 * @param pkg1 First package name whose signature will be compared.
3409 * @param pkg2 Second package name whose signature will be compared.
Chris Palmer09f33602010-09-13 14:27:18 -07003410 *
3411 * @return Returns an integer indicating whether all signatures on the
3412 * two packages match. The value is >= 0 ({@link #SIGNATURE_MATCH}) if
3413 * all signatures match or < 0 if there is not a match ({@link
3414 * #SIGNATURE_NO_MATCH} or {@link #SIGNATURE_UNKNOWN_PACKAGE}).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003415 *
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07003416 * @see #checkSignatures(int, int)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003417 * @see #SIGNATURE_MATCH
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003418 * @see #SIGNATURE_NO_MATCH
3419 * @see #SIGNATURE_UNKNOWN_PACKAGE
3420 */
Tor Norbye1c2bf032015-03-02 10:57:08 -08003421 @CheckResult
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003422 public abstract int checkSignatures(String pkg1, String pkg2);
3423
3424 /**
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07003425 * Like {@link #checkSignatures(String, String)}, but takes UIDs of
3426 * the two packages to be checked. This can be useful, for example,
3427 * when doing the check in an IPC, where the UID is the only identity
3428 * available. It is functionally identical to determining the package
3429 * associated with the UIDs and checking their signatures.
3430 *
Joe Onorato25660ec2009-08-12 22:40:37 -07003431 * @param uid1 First UID whose signature will be compared.
3432 * @param uid2 Second UID whose signature will be compared.
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07003433 *
Chris Palmer09f33602010-09-13 14:27:18 -07003434 * @return Returns an integer indicating whether all signatures on the
3435 * two packages match. The value is >= 0 ({@link #SIGNATURE_MATCH}) if
3436 * all signatures match or < 0 if there is not a match ({@link
3437 * #SIGNATURE_NO_MATCH} or {@link #SIGNATURE_UNKNOWN_PACKAGE}).
3438 *
3439 * @see #checkSignatures(String, String)
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07003440 * @see #SIGNATURE_MATCH
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07003441 * @see #SIGNATURE_NO_MATCH
3442 * @see #SIGNATURE_UNKNOWN_PACKAGE
3443 */
Tor Norbye1c2bf032015-03-02 10:57:08 -08003444 @CheckResult
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07003445 public abstract int checkSignatures(int uid1, int uid2);
3446
3447 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003448 * Retrieve the names of all packages that are associated with a particular
3449 * user id. In most cases, this will be a single package name, the package
3450 * that has been assigned that user id. Where there are multiple packages
3451 * sharing the same user id through the "sharedUserId" mechanism, all
3452 * packages with that id will be returned.
3453 *
3454 * @param uid The user id for which you would like to retrieve the
3455 * associated packages.
3456 *
3457 * @return Returns an array of one or more packages assigned to the user
3458 * id, or null if there are no known packages with the given id.
3459 */
Jeff Sharkey377ded0f2016-01-10 13:15:41 -07003460 public abstract @Nullable String[] getPackagesForUid(int uid);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003461
3462 /**
3463 * Retrieve the official name associated with a user id. This name is
Jonathan Basseri7ea3a332015-05-12 19:39:22 -07003464 * guaranteed to never change, though it is possible for the underlying
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003465 * user id to be changed. That is, if you are storing information about
3466 * user ids in persistent storage, you should use the string returned
3467 * by this function instead of the raw user-id.
3468 *
3469 * @param uid The user id for which you would like to retrieve a name.
3470 * @return Returns a unique name for the given user id, or null if the
3471 * user id is not currently assigned.
3472 */
Jeff Sharkey377ded0f2016-01-10 13:15:41 -07003473 public abstract @Nullable String getNameForUid(int uid);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003474
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003475 /**
3476 * Return the user id associated with a shared user name. Multiple
3477 * applications can specify a shared user name in their manifest and thus
3478 * end up using a common uid. This might be used for new applications
3479 * that use an existing shared user name and need to know the uid of the
3480 * shared user.
3481 *
3482 * @param sharedUserName The shared user name whose uid is to be retrieved.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003483 * @return Returns the UID associated with the shared user.
3484 * @throws NameNotFoundException if a package with the given name cannot be
3485 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003486 * @hide
3487 */
3488 public abstract int getUidForSharedUser(String sharedUserName)
3489 throws NameNotFoundException;
3490
3491 /**
3492 * Return a List of all application packages that are installed on the
3493 * device. If flag GET_UNINSTALLED_PACKAGES has been set, a list of all
kmccormick30498b42013-03-27 17:39:17 -07003494 * applications including those deleted with {@code DONT_DELETE_DATA} (partially
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003495 * installed apps with data directory) will be returned.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003496 *
3497 * @param flags Additional option flags. Use any combination of
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003498 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003499 * {@link #MATCH_SYSTEM_ONLY}, {@link #MATCH_UNINSTALLED_PACKAGES}
3500 * to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003501 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003502 * @return A List of ApplicationInfo objects, one for each installed application.
3503 * In the unlikely case there are no installed packages, an empty list
3504 * is returned. If flag {@code MATCH_UNINSTALLED_PACKAGES} is set, the
3505 * application information is retrieved from the list of uninstalled
3506 * applications (which includes installed applications as well as
3507 * applications with data directory i.e. applications which had been
3508 * deleted with {@code DONT_DELETE_DATA} flag set).
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003509 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003510 * @see #GET_META_DATA
3511 * @see #GET_SHARED_LIBRARY_FILES
Todd Kennedy5a32c6c2016-07-07 14:29:06 -07003512 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003513 * @see #MATCH_SYSTEM_ONLY
3514 * @see #MATCH_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003515 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003516 public abstract List<ApplicationInfo> getInstalledApplications(@ApplicationInfoFlags int flags);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003517
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003518 /**
Svet Ganov2acf0632015-11-24 19:10:59 -08003519 * Gets the ephemeral applications the user recently used. Requires
3520 * holding "android.permission.ACCESS_EPHEMERAL_APPS".
3521 *
3522 * @return The ephemeral app list.
3523 *
3524 * @hide
3525 */
3526 @RequiresPermission(Manifest.permission.ACCESS_EPHEMERAL_APPS)
3527 public abstract List<EphemeralApplicationInfo> getEphemeralApplications();
3528
3529 /**
3530 * Gets the icon for an ephemeral application.
3531 *
3532 * @param packageName The app package name.
3533 *
3534 * @hide
3535 */
3536 public abstract Drawable getEphemeralApplicationIcon(String packageName);
3537
3538 /**
3539 * Gets whether the caller is an ephemeral app.
3540 *
3541 * @return Whether caller is an ephemeral app.
3542 *
3543 * @see #setEphemeralCookie(byte[])
3544 * @see #getEphemeralCookie()
3545 * @see #getEphemeralCookieMaxSizeBytes()
Todd Kennedy12705132016-01-05 15:17:57 -08003546 *
3547 * @hide
Svet Ganov2acf0632015-11-24 19:10:59 -08003548 */
3549 public abstract boolean isEphemeralApplication();
3550
3551 /**
3552 * Gets the maximum size in bytes of the cookie data an ephemeral app
3553 * can store on the device.
3554 *
3555 * @return The max cookie size in bytes.
3556 *
3557 * @see #isEphemeralApplication()
3558 * @see #setEphemeralCookie(byte[])
3559 * @see #getEphemeralCookie()
Todd Kennedy12705132016-01-05 15:17:57 -08003560 *
3561 * @hide
Svet Ganov2acf0632015-11-24 19:10:59 -08003562 */
3563 public abstract int getEphemeralCookieMaxSizeBytes();
3564
3565 /**
3566 * Gets the ephemeral application cookie for this app. Non
3567 * ephemeral apps and apps that were ephemeral but were upgraded
3568 * to non-ephemeral can still access this API. For ephemeral apps
3569 * this cooke is cached for some time after uninstall while for
3570 * normal apps the cookie is deleted after the app is uninstalled.
3571 * The cookie is always present while the app is installed.
3572 *
3573 * @return The cookie.
3574 *
3575 * @see #isEphemeralApplication()
3576 * @see #setEphemeralCookie(byte[])
3577 * @see #getEphemeralCookieMaxSizeBytes()
Todd Kennedy12705132016-01-05 15:17:57 -08003578 *
3579 * @hide
Svet Ganov2acf0632015-11-24 19:10:59 -08003580 */
3581 public abstract @NonNull byte[] getEphemeralCookie();
3582
3583 /**
3584 * Sets the ephemeral application cookie for the calling app. Non
3585 * ephemeral apps and apps that were ephemeral but were upgraded
3586 * to non-ephemeral can still access this API. For ephemeral apps
3587 * this cooke is cached for some time after uninstall while for
3588 * normal apps the cookie is deleted after the app is uninstalled.
3589 * The cookie is always present while the app is installed. The
3590 * cookie size is limited by {@link #getEphemeralCookieMaxSizeBytes()}.
3591 *
3592 * @param cookie The cookie data.
3593 * @return True if the cookie was set.
3594 *
3595 * @see #isEphemeralApplication()
3596 * @see #getEphemeralCookieMaxSizeBytes()
Jeff Sharkey5aa86932016-01-08 19:07:49 -07003597 * @see #getEphemeralCookie()
Todd Kennedy12705132016-01-05 15:17:57 -08003598 *
3599 * @hide
Svet Ganov2acf0632015-11-24 19:10:59 -08003600 */
3601 public abstract boolean setEphemeralCookie(@NonNull byte[] cookie);
3602
3603 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003604 * Get a list of shared libraries that are available on the
3605 * system.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003606 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003607 * @return An array of shared library names that are
3608 * available on the system, or null if none are installed.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003609 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003610 */
3611 public abstract String[] getSystemSharedLibraryNames();
3612
3613 /**
Svet Ganovd7b1f4112016-02-09 18:49:23 -08003614 * Get the name of the package hosting the services shared library.
3615 *
3616 * @return The library host package.
3617 *
3618 * @hide
3619 */
Svetoslav Ganova9c25002016-04-13 19:25:56 -07003620 public abstract @NonNull String getServicesSystemSharedLibraryPackageName();
3621
3622 /**
3623 * Get the name of the package hosting the shared components shared library.
3624 *
3625 * @return The library host package.
3626 *
3627 * @hide
3628 */
3629 public abstract @NonNull String getSharedSystemSharedLibraryPackageName();
Svet Ganovd7b1f4112016-02-09 18:49:23 -08003630
3631 /**
Dianne Hackborn49237342009-08-27 20:08:01 -07003632 * Get a list of features that are available on the
3633 * system.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003634 *
Dianne Hackborn49237342009-08-27 20:08:01 -07003635 * @return An array of FeatureInfo classes describing the features
3636 * that are available on the system, or null if there are none(!!).
Dianne Hackborn49237342009-08-27 20:08:01 -07003637 */
3638 public abstract FeatureInfo[] getSystemAvailableFeatures();
3639
3640 /**
Jeff Sharkey115d2c12016-02-15 17:25:57 -07003641 * Check whether the given feature name is one of the available features as
3642 * returned by {@link #getSystemAvailableFeatures()}. This tests for the
3643 * presence of <em>any</em> version of the given feature name; use
3644 * {@link #hasSystemFeature(String, int)} to check for a minimum version.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003645 *
Jeff Sharkey115d2c12016-02-15 17:25:57 -07003646 * @return Returns true if the devices supports the feature, else false.
Dianne Hackborn039c68e2009-09-26 16:39:23 -07003647 */
3648 public abstract boolean hasSystemFeature(String name);
3649
3650 /**
Jeff Sharkey115d2c12016-02-15 17:25:57 -07003651 * Check whether the given feature name and version is one of the available
3652 * features as returned by {@link #getSystemAvailableFeatures()}. Since
3653 * features are defined to always be backwards compatible, this returns true
3654 * if the available feature version is greater than or equal to the
3655 * requested version.
3656 *
3657 * @return Returns true if the devices supports the feature, else false.
3658 */
3659 public abstract boolean hasSystemFeature(String name, int version);
3660
3661 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003662 * Determine the best action to perform for a given Intent. This is how
3663 * {@link Intent#resolveActivity} finds an activity if a class has not been
3664 * explicitly specified.
3665 * <p>
3666 * <em>Note:</em> if using an implicit Intent (without an explicit
3667 * ComponentName specified), be sure to consider whether to set the
3668 * {@link #MATCH_DEFAULT_ONLY} only flag. You need to do so to resolve the
3669 * activity in the same way that
3670 * {@link android.content.Context#startActivity(Intent)} and
Dianne Hackborn4d023d212010-10-01 13:41:04 -07003671 * {@link android.content.Intent#resolveActivity(PackageManager)
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003672 * Intent.resolveActivity(PackageManager)} do.
3673 * </p>
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003674 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003675 * @param intent An intent containing all of the desired specification
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003676 * (action, data, type, category, and/or component).
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003677 * @param flags Additional option flags. Use any combination of
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003678 * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER},
3679 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL},
3680 * {@link #MATCH_DISABLED_COMPONENTS},
3681 * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
3682 * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_DIRECT_BOOT_AWARE},
3683 * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY}
3684 * or {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data
3685 * returned. The most important is {@link #MATCH_DEFAULT_ONLY},
3686 * to limit the resolution to only those activities that support
3687 * the {@link android.content.Intent#CATEGORY_DEFAULT}.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003688 * @return Returns a ResolveInfo object containing the final activity intent
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003689 * that was determined to be the best action. Returns null if no
Mike LeBeaubd3f5272010-02-18 19:27:17 -08003690 * matching activity was found. If multiple matching activities are
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003691 * found and there is no default set, returns a ResolveInfo object
Mike LeBeaubd3f5272010-02-18 19:27:17 -08003692 * containing something else, such as the activity resolver.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003693 * @see #GET_META_DATA
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003694 * @see #GET_RESOLVED_FILTER
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003695 * @see #GET_SHARED_LIBRARY_FILES
3696 * @see #MATCH_ALL
3697 * @see #MATCH_DISABLED_COMPONENTS
3698 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
3699 * @see #MATCH_DEFAULT_ONLY
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003700 * @see #MATCH_DIRECT_BOOT_AWARE
3701 * @see #MATCH_DIRECT_BOOT_UNAWARE
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003702 * @see #MATCH_SYSTEM_ONLY
3703 * @see #MATCH_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003704 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003705 public abstract ResolveInfo resolveActivity(Intent intent, @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003706
3707 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003708 * Determine the best action to perform for a given Intent for a given user.
3709 * This is how {@link Intent#resolveActivity} finds an activity if a class
3710 * has not been explicitly specified.
3711 * <p>
3712 * <em>Note:</em> if using an implicit Intent (without an explicit
3713 * ComponentName specified), be sure to consider whether to set the
3714 * {@link #MATCH_DEFAULT_ONLY} only flag. You need to do so to resolve the
3715 * activity in the same way that
3716 * {@link android.content.Context#startActivity(Intent)} and
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07003717 * {@link android.content.Intent#resolveActivity(PackageManager)
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003718 * Intent.resolveActivity(PackageManager)} do.
3719 * </p>
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07003720 *
3721 * @param intent An intent containing all of the desired specification
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003722 * (action, data, type, category, and/or component).
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003723 * @param flags Additional option flags. Use any combination of
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003724 * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER},
3725 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL},
3726 * {@link #MATCH_DISABLED_COMPONENTS},
3727 * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
3728 * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_DIRECT_BOOT_AWARE},
3729 * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY}
3730 * or {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data
3731 * returned. The most important is {@link #MATCH_DEFAULT_ONLY},
3732 * to limit the resolution to only those activities that support
3733 * the {@link android.content.Intent#CATEGORY_DEFAULT}.
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07003734 * @param userId The user id.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003735 * @return Returns a ResolveInfo object containing the final activity intent
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003736 * that was determined to be the best action. Returns null if no
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07003737 * matching activity was found. If multiple matching activities are
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003738 * found and there is no default set, returns a ResolveInfo object
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07003739 * containing something else, such as the activity resolver.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003740 * @see #GET_META_DATA
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07003741 * @see #GET_RESOLVED_FILTER
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003742 * @see #GET_SHARED_LIBRARY_FILES
3743 * @see #MATCH_ALL
3744 * @see #MATCH_DISABLED_COMPONENTS
3745 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
3746 * @see #MATCH_DEFAULT_ONLY
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003747 * @see #MATCH_DIRECT_BOOT_AWARE
3748 * @see #MATCH_DIRECT_BOOT_UNAWARE
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003749 * @see #MATCH_SYSTEM_ONLY
3750 * @see #MATCH_UNINSTALLED_PACKAGES
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07003751 * @hide
3752 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003753 public abstract ResolveInfo resolveActivityAsUser(Intent intent, @ResolveInfoFlags int flags,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003754 @UserIdInt int userId);
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07003755
3756 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003757 * Retrieve all activities that can be performed for the given intent.
3758 *
3759 * @param intent The desired intent as per resolveActivity().
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003760 * @param flags Additional option flags. Use any combination of
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003761 * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER},
3762 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL},
3763 * {@link #MATCH_DISABLED_COMPONENTS},
3764 * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
3765 * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_DIRECT_BOOT_AWARE},
3766 * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY}
3767 * or {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data
3768 * returned. The most important is {@link #MATCH_DEFAULT_ONLY},
3769 * to limit the resolution to only those activities that support
3770 * the {@link android.content.Intent#CATEGORY_DEFAULT}. Or, set
3771 * {@link #MATCH_ALL} to prevent any filtering of the results.
3772 * @return Returns a List of ResolveInfo objects containing one entry for
3773 * each matching activity, ordered from best to worst. In other
3774 * words, the first item is what would be returned by
3775 * {@link #resolveActivity}. If there are no matching activities, an
3776 * empty list is returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003777 * @see #GET_META_DATA
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003778 * @see #GET_RESOLVED_FILTER
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003779 * @see #GET_SHARED_LIBRARY_FILES
3780 * @see #MATCH_ALL
3781 * @see #MATCH_DISABLED_COMPONENTS
3782 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
3783 * @see #MATCH_DEFAULT_ONLY
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003784 * @see #MATCH_DIRECT_BOOT_AWARE
3785 * @see #MATCH_DIRECT_BOOT_UNAWARE
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003786 * @see #MATCH_SYSTEM_ONLY
3787 * @see #MATCH_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003788 */
3789 public abstract List<ResolveInfo> queryIntentActivities(Intent intent,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003790 @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003791
3792 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003793 * Retrieve all activities that can be performed for the given intent, for a
3794 * specific user.
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003795 *
3796 * @param intent The desired intent as per resolveActivity().
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003797 * @param flags Additional option flags. Use any combination of
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003798 * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER},
3799 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL},
3800 * {@link #MATCH_DISABLED_COMPONENTS},
3801 * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
3802 * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_DIRECT_BOOT_AWARE},
3803 * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY}
3804 * or {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data
3805 * returned. The most important is {@link #MATCH_DEFAULT_ONLY},
3806 * to limit the resolution to only those activities that support
3807 * the {@link android.content.Intent#CATEGORY_DEFAULT}. Or, set
3808 * {@link #MATCH_ALL} to prevent any filtering of the results.
3809 * @return Returns a List of ResolveInfo objects containing one entry for
3810 * each matching activity, ordered from best to worst. In other
3811 * words, the first item is what would be returned by
3812 * {@link #resolveActivity}. If there are no matching activities, an
3813 * empty list is returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003814 * @see #GET_META_DATA
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003815 * @see #GET_RESOLVED_FILTER
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003816 * @see #GET_SHARED_LIBRARY_FILES
3817 * @see #MATCH_ALL
3818 * @see #MATCH_DISABLED_COMPONENTS
3819 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
3820 * @see #MATCH_DEFAULT_ONLY
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003821 * @see #MATCH_DIRECT_BOOT_AWARE
3822 * @see #MATCH_DIRECT_BOOT_UNAWARE
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003823 * @see #MATCH_SYSTEM_ONLY
3824 * @see #MATCH_UNINSTALLED_PACKAGES
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003825 * @hide
3826 */
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07003827 public abstract List<ResolveInfo> queryIntentActivitiesAsUser(Intent intent,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003828 @ResolveInfoFlags int flags, @UserIdInt int userId);
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003829
3830 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003831 * Retrieve a set of activities that should be presented to the user as
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003832 * similar options. This is like {@link #queryIntentActivities}, except it
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003833 * also allows you to supply a list of more explicit Intents that you would
3834 * like to resolve to particular options, and takes care of returning the
3835 * final ResolveInfo list in a reasonable order, with no duplicates, based
3836 * on those inputs.
3837 *
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003838 * @param caller The class name of the activity that is making the request.
3839 * This activity will never appear in the output list. Can be
3840 * null.
3841 * @param specifics An array of Intents that should be resolved to the first
3842 * specific results. Can be null.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003843 * @param intent The desired intent as per resolveActivity().
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003844 * @param flags Additional option flags. Use any combination of
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003845 * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER},
3846 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL},
3847 * {@link #MATCH_DISABLED_COMPONENTS},
3848 * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
3849 * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_DIRECT_BOOT_AWARE},
3850 * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY}
3851 * or {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data
3852 * returned. The most important is {@link #MATCH_DEFAULT_ONLY},
3853 * to limit the resolution to only those activities that support
3854 * the {@link android.content.Intent#CATEGORY_DEFAULT}.
3855 * @return Returns a List of ResolveInfo objects containing one entry for
3856 * each matching activity. The list is ordered first by all of the
3857 * intents resolved in <var>specifics</var> and then any additional
3858 * activities that can handle <var>intent</var> but did not get
3859 * included by one of the <var>specifics</var> intents. If there are
3860 * no matching activities, an empty list is returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003861 * @see #GET_META_DATA
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003862 * @see #GET_RESOLVED_FILTER
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003863 * @see #GET_SHARED_LIBRARY_FILES
3864 * @see #MATCH_ALL
3865 * @see #MATCH_DISABLED_COMPONENTS
3866 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
3867 * @see #MATCH_DEFAULT_ONLY
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003868 * @see #MATCH_DIRECT_BOOT_AWARE
3869 * @see #MATCH_DIRECT_BOOT_UNAWARE
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003870 * @see #MATCH_SYSTEM_ONLY
3871 * @see #MATCH_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003872 */
3873 public abstract List<ResolveInfo> queryIntentActivityOptions(
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003874 ComponentName caller, Intent[] specifics, Intent intent, @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003875
3876 /**
3877 * Retrieve all receivers that can handle a broadcast of the given intent.
3878 *
3879 * @param intent The desired intent as per resolveActivity().
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003880 * @param flags Additional option flags. Use any combination of
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003881 * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER},
3882 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL},
3883 * {@link #MATCH_DISABLED_COMPONENTS},
3884 * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
3885 * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_DIRECT_BOOT_AWARE},
3886 * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY}
3887 * or {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data
3888 * returned.
3889 * @return Returns a List of ResolveInfo objects containing one entry for
3890 * each matching receiver, ordered from best to worst. If there are
3891 * no matching receivers, an empty list or null is returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003892 * @see #GET_META_DATA
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003893 * @see #GET_RESOLVED_FILTER
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003894 * @see #GET_SHARED_LIBRARY_FILES
3895 * @see #MATCH_ALL
3896 * @see #MATCH_DISABLED_COMPONENTS
3897 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
3898 * @see #MATCH_DEFAULT_ONLY
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003899 * @see #MATCH_DIRECT_BOOT_AWARE
3900 * @see #MATCH_DIRECT_BOOT_UNAWARE
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003901 * @see #MATCH_SYSTEM_ONLY
3902 * @see #MATCH_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003903 */
3904 public abstract List<ResolveInfo> queryBroadcastReceivers(Intent intent,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003905 @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003906
3907 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003908 * Retrieve all receivers that can handle a broadcast of the given intent,
3909 * for a specific user.
Amith Yamasanif203aee2012-08-29 18:41:53 -07003910 *
3911 * @param intent The desired intent as per resolveActivity().
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003912 * @param flags Additional option flags. Use any combination of
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003913 * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER},
3914 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL},
3915 * {@link #MATCH_DISABLED_COMPONENTS},
3916 * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
3917 * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_DIRECT_BOOT_AWARE},
3918 * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY}
3919 * or {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data
3920 * returned.
Fyodor Kupolov940e8572016-01-26 12:03:51 -08003921 * @param userHandle UserHandle of the user being queried.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003922 * @return Returns a List of ResolveInfo objects containing one entry for
3923 * each matching receiver, ordered from best to worst. If there are
3924 * no matching receivers, an empty list or null is returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003925 * @see #GET_META_DATA
Amith Yamasanif203aee2012-08-29 18:41:53 -07003926 * @see #GET_RESOLVED_FILTER
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003927 * @see #GET_SHARED_LIBRARY_FILES
3928 * @see #MATCH_ALL
3929 * @see #MATCH_DISABLED_COMPONENTS
3930 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
3931 * @see #MATCH_DEFAULT_ONLY
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003932 * @see #MATCH_DIRECT_BOOT_AWARE
3933 * @see #MATCH_DIRECT_BOOT_UNAWARE
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003934 * @see #MATCH_SYSTEM_ONLY
3935 * @see #MATCH_UNINSTALLED_PACKAGES
Amith Yamasanif203aee2012-08-29 18:41:53 -07003936 * @hide
3937 */
Fyodor Kupolov940e8572016-01-26 12:03:51 -08003938 @SystemApi
3939 public List<ResolveInfo> queryBroadcastReceiversAsUser(Intent intent,
3940 @ResolveInfoFlags int flags, UserHandle userHandle) {
3941 return queryBroadcastReceiversAsUser(intent, flags, userHandle.getIdentifier());
3942 }
3943
3944 /**
3945 * @hide
3946 */
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07003947 public abstract List<ResolveInfo> queryBroadcastReceiversAsUser(Intent intent,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003948 @ResolveInfoFlags int flags, @UserIdInt int userId);
Amith Yamasanif203aee2012-08-29 18:41:53 -07003949
Fyodor Kupolov940e8572016-01-26 12:03:51 -08003950
Jeff Sharkeybd940222016-01-08 11:07:13 -07003951 /** {@hide} */
3952 @Deprecated
3953 public List<ResolveInfo> queryBroadcastReceivers(Intent intent,
3954 @ResolveInfoFlags int flags, @UserIdInt int userId) {
3955 Log.w(TAG, "STAHP USING HIDDEN APIS KTHX");
3956 return queryBroadcastReceiversAsUser(intent, flags, userId);
3957 }
3958
Amith Yamasanif203aee2012-08-29 18:41:53 -07003959 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003960 * Determine the best service to handle for a given Intent.
3961 *
3962 * @param intent An intent containing all of the desired specification
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003963 * (action, data, type, category, and/or component).
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003964 * @param flags Additional option flags. Use any combination of
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003965 * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER},
3966 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL},
3967 * {@link #MATCH_DISABLED_COMPONENTS},
3968 * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
3969 * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_DIRECT_BOOT_AWARE},
3970 * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY}
3971 * or {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data
3972 * returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003973 * @return Returns a ResolveInfo object containing the final service intent
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003974 * that was determined to be the best action. Returns null if no
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003975 * matching service was found.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003976 * @see #GET_META_DATA
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003977 * @see #GET_RESOLVED_FILTER
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003978 * @see #GET_SHARED_LIBRARY_FILES
3979 * @see #MATCH_ALL
3980 * @see #MATCH_DISABLED_COMPONENTS
3981 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
3982 * @see #MATCH_DEFAULT_ONLY
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003983 * @see #MATCH_DIRECT_BOOT_AWARE
3984 * @see #MATCH_DIRECT_BOOT_UNAWARE
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003985 * @see #MATCH_SYSTEM_ONLY
3986 * @see #MATCH_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003987 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003988 public abstract ResolveInfo resolveService(Intent intent, @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003989
3990 /**
3991 * Retrieve all services that can match the given intent.
3992 *
3993 * @param intent The desired intent as per resolveService().
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003994 * @param flags Additional option flags. Use any combination of
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003995 * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER},
3996 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL},
3997 * {@link #MATCH_DISABLED_COMPONENTS},
3998 * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
3999 * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_DIRECT_BOOT_AWARE},
4000 * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY}
4001 * or {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data
4002 * returned.
4003 * @return Returns a List of ResolveInfo objects containing one entry for
4004 * each matching service, ordered from best to worst. In other
4005 * words, the first item is what would be returned by
4006 * {@link #resolveService}. If there are no matching services, an
4007 * empty list or null is returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004008 * @see #GET_META_DATA
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004009 * @see #GET_RESOLVED_FILTER
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004010 * @see #GET_SHARED_LIBRARY_FILES
4011 * @see #MATCH_ALL
4012 * @see #MATCH_DISABLED_COMPONENTS
4013 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
4014 * @see #MATCH_DEFAULT_ONLY
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004015 * @see #MATCH_DIRECT_BOOT_AWARE
4016 * @see #MATCH_DIRECT_BOOT_UNAWARE
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004017 * @see #MATCH_SYSTEM_ONLY
4018 * @see #MATCH_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004019 */
4020 public abstract List<ResolveInfo> queryIntentServices(Intent intent,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004021 @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004022
4023 /**
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004024 * Retrieve all services that can match the given intent for a given user.
4025 *
4026 * @param intent The desired intent as per resolveService().
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004027 * @param flags Additional option flags. Use any combination of
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004028 * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER},
4029 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL},
4030 * {@link #MATCH_DISABLED_COMPONENTS},
4031 * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
4032 * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_DIRECT_BOOT_AWARE},
4033 * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY}
4034 * or {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data
4035 * returned.
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004036 * @param userId The user id.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004037 * @return Returns a List of ResolveInfo objects containing one entry for
4038 * each matching service, ordered from best to worst. In other
4039 * words, the first item is what would be returned by
4040 * {@link #resolveService}. If there are no matching services, an
4041 * empty list or null is returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004042 * @see #GET_META_DATA
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004043 * @see #GET_RESOLVED_FILTER
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004044 * @see #GET_SHARED_LIBRARY_FILES
4045 * @see #MATCH_ALL
4046 * @see #MATCH_DISABLED_COMPONENTS
4047 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
4048 * @see #MATCH_DEFAULT_ONLY
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004049 * @see #MATCH_DIRECT_BOOT_AWARE
4050 * @see #MATCH_DIRECT_BOOT_UNAWARE
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004051 * @see #MATCH_SYSTEM_ONLY
4052 * @see #MATCH_UNINSTALLED_PACKAGES
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004053 * @hide
4054 */
4055 public abstract List<ResolveInfo> queryIntentServicesAsUser(Intent intent,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004056 @ResolveInfoFlags int flags, @UserIdInt int userId);
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004057
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004058 /**
4059 * Retrieve all providers that can match the given intent.
4060 *
4061 * @param intent An intent containing all of the desired specification
4062 * (action, data, type, category, and/or component).
4063 * @param flags Additional option flags. Use any combination of
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004064 * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER},
4065 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL},
4066 * {@link #MATCH_DISABLED_COMPONENTS},
4067 * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
4068 * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_DIRECT_BOOT_AWARE},
4069 * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY}
4070 * or {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data
4071 * returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004072 * @param userId The user id.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004073 * @return Returns a List of ResolveInfo objects containing one entry for
4074 * each matching provider, ordered from best to worst. If there are
4075 * no matching services, an empty list or null is returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004076 * @see #GET_META_DATA
4077 * @see #GET_RESOLVED_FILTER
4078 * @see #GET_SHARED_LIBRARY_FILES
4079 * @see #MATCH_ALL
4080 * @see #MATCH_DISABLED_COMPONENTS
4081 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
4082 * @see #MATCH_DEFAULT_ONLY
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004083 * @see #MATCH_DIRECT_BOOT_AWARE
4084 * @see #MATCH_DIRECT_BOOT_UNAWARE
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004085 * @see #MATCH_SYSTEM_ONLY
4086 * @see #MATCH_UNINSTALLED_PACKAGES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004087 * @hide
4088 */
Jeff Sharkey85f5f812013-10-07 10:16:12 -07004089 public abstract List<ResolveInfo> queryIntentContentProvidersAsUser(
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004090 Intent intent, @ResolveInfoFlags int flags, @UserIdInt int userId);
Jeff Sharkey85f5f812013-10-07 10:16:12 -07004091
4092 /**
4093 * Retrieve all providers that can match the given intent.
4094 *
4095 * @param intent An intent containing all of the desired specification
4096 * (action, data, type, category, and/or component).
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004097 * @param flags Additional option flags. Use any combination of
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004098 * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER},
4099 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL},
4100 * {@link #MATCH_DISABLED_COMPONENTS},
4101 * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
4102 * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_DIRECT_BOOT_AWARE},
4103 * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY}
4104 * or {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data
4105 * returned.
4106 * @return Returns a List of ResolveInfo objects containing one entry for
4107 * each matching provider, ordered from best to worst. If there are
4108 * no matching services, an empty list or null is returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004109 * @see #GET_META_DATA
Jeff Sharkey85f5f812013-10-07 10:16:12 -07004110 * @see #GET_RESOLVED_FILTER
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004111 * @see #GET_SHARED_LIBRARY_FILES
4112 * @see #MATCH_ALL
4113 * @see #MATCH_DISABLED_COMPONENTS
4114 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
4115 * @see #MATCH_DEFAULT_ONLY
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004116 * @see #MATCH_DIRECT_BOOT_AWARE
4117 * @see #MATCH_DIRECT_BOOT_UNAWARE
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004118 * @see #MATCH_SYSTEM_ONLY
4119 * @see #MATCH_UNINSTALLED_PACKAGES
Jeff Sharkey85f5f812013-10-07 10:16:12 -07004120 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004121 public abstract List<ResolveInfo> queryIntentContentProviders(Intent intent,
4122 @ResolveInfoFlags int flags);
Jeff Sharkey85f5f812013-10-07 10:16:12 -07004123
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004124 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004125 * Find a single content provider by its base path name.
4126 *
4127 * @param name The name of the provider to find.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004128 * @param flags Additional option flags. Use any combination of
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004129 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
4130 * {@link #MATCH_ALL}, {@link #MATCH_DEFAULT_ONLY},
4131 * {@link #MATCH_DISABLED_COMPONENTS},
4132 * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
4133 * {@link #MATCH_DIRECT_BOOT_AWARE},
4134 * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY}
4135 * or {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data
4136 * returned.
4137 * @return A {@link ProviderInfo} object containing information about the
4138 * provider. If a provider was not found, returns null.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004139 * @see #GET_META_DATA
4140 * @see #GET_SHARED_LIBRARY_FILES
4141 * @see #MATCH_ALL
4142 * @see #MATCH_DEBUG_TRIAGED_MISSING
4143 * @see #MATCH_DEFAULT_ONLY
4144 * @see #MATCH_DISABLED_COMPONENTS
4145 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004146 * @see #MATCH_DIRECT_BOOT_AWARE
4147 * @see #MATCH_DIRECT_BOOT_UNAWARE
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004148 * @see #MATCH_SYSTEM_ONLY
4149 * @see #MATCH_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004150 */
4151 public abstract ProviderInfo resolveContentProvider(String name,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004152 @ComponentInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004153
4154 /**
Alexandra Gherghina0363c3e2014-06-23 13:34:59 +01004155 * Find a single content provider by its base path name.
4156 *
4157 * @param name The name of the provider to find.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004158 * @param flags Additional option flags. Use any combination of
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004159 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
4160 * {@link #MATCH_ALL}, {@link #MATCH_DEFAULT_ONLY},
4161 * {@link #MATCH_DISABLED_COMPONENTS},
4162 * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
4163 * {@link #MATCH_DIRECT_BOOT_AWARE},
4164 * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY}
4165 * or {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data
4166 * returned.
Alexandra Gherghina0363c3e2014-06-23 13:34:59 +01004167 * @param userId The user id.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004168 * @return A {@link ProviderInfo} object containing information about the
4169 * provider. If a provider was not found, returns null.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004170 * @see #GET_META_DATA
4171 * @see #GET_SHARED_LIBRARY_FILES
4172 * @see #MATCH_ALL
4173 * @see #MATCH_DEBUG_TRIAGED_MISSING
4174 * @see #MATCH_DEFAULT_ONLY
4175 * @see #MATCH_DISABLED_COMPONENTS
4176 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004177 * @see #MATCH_DIRECT_BOOT_AWARE
4178 * @see #MATCH_DIRECT_BOOT_UNAWARE
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004179 * @see #MATCH_SYSTEM_ONLY
4180 * @see #MATCH_UNINSTALLED_PACKAGES
Alexandra Gherghina0363c3e2014-06-23 13:34:59 +01004181 * @hide
4182 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004183 public abstract ProviderInfo resolveContentProviderAsUser(String name,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004184 @ComponentInfoFlags int flags, @UserIdInt int userId);
Alexandra Gherghina0363c3e2014-06-23 13:34:59 +01004185
4186 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004187 * Retrieve content provider information.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004188 * <p>
4189 * <em>Note: unlike most other methods, an empty result set is indicated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004190 * by a null return instead of an empty list.</em>
4191 *
4192 * @param processName If non-null, limits the returned providers to only
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004193 * those that are hosted by the given process. If null, all
4194 * content providers are returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004195 * @param uid If <var>processName</var> is non-null, this is the required
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004196 * uid owning the requested content providers.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004197 * @param flags Additional option flags. Use any combination of
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004198 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
4199 * {@link #MATCH_ALL}, {@link #MATCH_DEFAULT_ONLY},
4200 * {@link #MATCH_DISABLED_COMPONENTS},
4201 * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
4202 * {@link #MATCH_DIRECT_BOOT_AWARE},
4203 * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY}
4204 * or {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data
4205 * returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004206 * @return A list of {@link ProviderInfo} objects containing one entry for
4207 * each provider either matching <var>processName</var> or, if
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004208 * <var>processName</var> is null, all known content providers.
4209 * <em>If there are no matching providers, null is returned.</em>
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004210 * @see #GET_META_DATA
4211 * @see #GET_SHARED_LIBRARY_FILES
4212 * @see #MATCH_ALL
4213 * @see #MATCH_DEBUG_TRIAGED_MISSING
4214 * @see #MATCH_DEFAULT_ONLY
4215 * @see #MATCH_DISABLED_COMPONENTS
4216 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004217 * @see #MATCH_DIRECT_BOOT_AWARE
4218 * @see #MATCH_DIRECT_BOOT_UNAWARE
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004219 * @see #MATCH_SYSTEM_ONLY
4220 * @see #MATCH_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004221 */
4222 public abstract List<ProviderInfo> queryContentProviders(
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004223 String processName, int uid, @ComponentInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004224
4225 /**
4226 * Retrieve all of the information we know about a particular
4227 * instrumentation class.
4228 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004229 * @param className The full name (i.e.
4230 * com.google.apps.contacts.InstrumentList) of an
4231 * Instrumentation class.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004232 * @param flags Additional option flags. Use any combination of
4233 * {@link #GET_META_DATA}
4234 * to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004235 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004236 * @return An {@link InstrumentationInfo} object containing information about the
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004237 * instrumentation.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004238 * @throws NameNotFoundException if a package with the given name cannot be
4239 * found on the system.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004240 *
4241 * @see #GET_META_DATA
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004242 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004243 public abstract InstrumentationInfo getInstrumentationInfo(ComponentName className,
4244 @InstrumentationInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004245
4246 /**
4247 * Retrieve information about available instrumentation code. May be used
4248 * to retrieve either all instrumentation code, or only the code targeting
4249 * a particular package.
4250 *
4251 * @param targetPackage If null, all instrumentation is returned; only the
4252 * instrumentation targeting this package name is
4253 * returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004254 * @param flags Additional option flags. Use any combination of
4255 * {@link #GET_META_DATA}
4256 * to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004257 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004258 * @return A list of {@link InstrumentationInfo} objects containing one
4259 * entry for each matching instrumentation. If there are no
Jesse Hallf77a34f2016-02-04 18:41:33 -08004260 * instrumentation available, returns an empty list.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004261 *
4262 * @see #GET_META_DATA
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004263 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004264 public abstract List<InstrumentationInfo> queryInstrumentation(String targetPackage,
4265 @InstrumentationInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004266
4267 /**
4268 * Retrieve an image from a package. This is a low-level API used by
4269 * the various package manager info structures (such as
4270 * {@link ComponentInfo} to implement retrieval of their associated
4271 * icon.
4272 *
4273 * @param packageName The name of the package that this icon is coming from.
kmccormick30498b42013-03-27 17:39:17 -07004274 * Cannot be null.
4275 * @param resid The resource identifier of the desired image. Cannot be 0.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004276 * @param appInfo Overall information about <var>packageName</var>. This
4277 * may be null, in which case the application information will be retrieved
4278 * for you if needed; if you already have this information around, it can
4279 * be much more efficient to supply it here.
4280 *
4281 * @return Returns a Drawable holding the requested image. Returns null if
4282 * an image could not be found for any reason.
4283 */
Tor Norbye7b9c9122013-05-30 16:48:33 -07004284 public abstract Drawable getDrawable(String packageName, @DrawableRes int resid,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004285 ApplicationInfo appInfo);
4286
4287 /**
4288 * Retrieve the icon associated with an activity. Given the full name of
4289 * an activity, retrieves the information about it and calls
4290 * {@link ComponentInfo#loadIcon ComponentInfo.loadIcon()} to return its icon.
kmccormick30498b42013-03-27 17:39:17 -07004291 * If the activity cannot be found, NameNotFoundException is thrown.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004292 *
4293 * @param activityName Name of the activity whose icon is to be retrieved.
4294 *
4295 * @return Returns the image of the icon, or the default activity icon if
4296 * it could not be found. Does not return null.
4297 * @throws NameNotFoundException Thrown if the resources for the given
4298 * activity could not be loaded.
4299 *
4300 * @see #getActivityIcon(Intent)
4301 */
4302 public abstract Drawable getActivityIcon(ComponentName activityName)
4303 throws NameNotFoundException;
4304
4305 /**
4306 * Retrieve the icon associated with an Intent. If intent.getClassName() is
4307 * set, this simply returns the result of
4308 * getActivityIcon(intent.getClassName()). Otherwise it resolves the intent's
4309 * component and returns the icon associated with the resolved component.
kmccormick30498b42013-03-27 17:39:17 -07004310 * If intent.getClassName() cannot be found or the Intent cannot be resolved
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004311 * to a component, NameNotFoundException is thrown.
4312 *
4313 * @param intent The intent for which you would like to retrieve an icon.
4314 *
4315 * @return Returns the image of the icon, or the default activity icon if
4316 * it could not be found. Does not return null.
4317 * @throws NameNotFoundException Thrown if the resources for application
4318 * matching the given intent could not be loaded.
4319 *
4320 * @see #getActivityIcon(ComponentName)
4321 */
4322 public abstract Drawable getActivityIcon(Intent intent)
4323 throws NameNotFoundException;
4324
4325 /**
Jose Limaf78e3122014-03-06 12:13:15 -08004326 * Retrieve the banner associated with an activity. Given the full name of
4327 * an activity, retrieves the information about it and calls
4328 * {@link ComponentInfo#loadIcon ComponentInfo.loadIcon()} to return its
4329 * banner. If the activity cannot be found, NameNotFoundException is thrown.
4330 *
4331 * @param activityName Name of the activity whose banner is to be retrieved.
4332 * @return Returns the image of the banner, or null if the activity has no
4333 * banner specified.
4334 * @throws NameNotFoundException Thrown if the resources for the given
4335 * activity could not be loaded.
4336 * @see #getActivityBanner(Intent)
4337 */
4338 public abstract Drawable getActivityBanner(ComponentName activityName)
4339 throws NameNotFoundException;
4340
4341 /**
4342 * Retrieve the banner associated with an Intent. If intent.getClassName()
4343 * is set, this simply returns the result of
4344 * getActivityBanner(intent.getClassName()). Otherwise it resolves the
4345 * intent's component and returns the banner associated with the resolved
4346 * component. If intent.getClassName() cannot be found or the Intent cannot
4347 * be resolved to a component, NameNotFoundException is thrown.
4348 *
4349 * @param intent The intent for which you would like to retrieve a banner.
4350 * @return Returns the image of the banner, or null if the activity has no
4351 * banner specified.
4352 * @throws NameNotFoundException Thrown if the resources for application
4353 * matching the given intent could not be loaded.
4354 * @see #getActivityBanner(ComponentName)
4355 */
4356 public abstract Drawable getActivityBanner(Intent intent)
4357 throws NameNotFoundException;
4358
4359 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004360 * Return the generic icon for an activity that is used when no specific
4361 * icon is defined.
Adam Connors23cc04e2014-04-01 12:12:20 +01004362 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004363 * @return Drawable Image of the icon.
4364 */
4365 public abstract Drawable getDefaultActivityIcon();
4366
4367 /**
4368 * Retrieve the icon associated with an application. If it has not defined
4369 * an icon, the default app icon is returned. Does not return null.
4370 *
4371 * @param info Information about application being queried.
4372 *
4373 * @return Returns the image of the icon, or the default application icon
4374 * if it could not be found.
4375 *
4376 * @see #getApplicationIcon(String)
4377 */
4378 public abstract Drawable getApplicationIcon(ApplicationInfo info);
4379
4380 /**
4381 * Retrieve the icon associated with an application. Given the name of the
4382 * application's package, retrieves the information about it and calls
kmccormick30498b42013-03-27 17:39:17 -07004383 * getApplicationIcon() to return its icon. If the application cannot be
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004384 * found, NameNotFoundException is thrown.
4385 *
4386 * @param packageName Name of the package whose application icon is to be
4387 * retrieved.
4388 *
4389 * @return Returns the image of the icon, or the default application icon
4390 * if it could not be found. Does not return null.
4391 * @throws NameNotFoundException Thrown if the resources for the given
4392 * application could not be loaded.
4393 *
4394 * @see #getApplicationIcon(ApplicationInfo)
4395 */
4396 public abstract Drawable getApplicationIcon(String packageName)
4397 throws NameNotFoundException;
4398
4399 /**
Jose Limaf78e3122014-03-06 12:13:15 -08004400 * Retrieve the banner associated with an application.
4401 *
4402 * @param info Information about application being queried.
4403 * @return Returns the image of the banner or null if the application has no
4404 * banner specified.
4405 * @see #getApplicationBanner(String)
4406 */
4407 public abstract Drawable getApplicationBanner(ApplicationInfo info);
4408
4409 /**
4410 * Retrieve the banner associated with an application. Given the name of the
4411 * application's package, retrieves the information about it and calls
4412 * getApplicationIcon() to return its banner. If the application cannot be
4413 * found, NameNotFoundException is thrown.
4414 *
4415 * @param packageName Name of the package whose application banner is to be
4416 * retrieved.
4417 * @return Returns the image of the banner or null if the application has no
4418 * banner specified.
4419 * @throws NameNotFoundException Thrown if the resources for the given
4420 * application could not be loaded.
4421 * @see #getApplicationBanner(ApplicationInfo)
4422 */
4423 public abstract Drawable getApplicationBanner(String packageName)
4424 throws NameNotFoundException;
4425
4426 /**
4427 * Retrieve the logo associated with an activity. Given the full name of an
4428 * activity, retrieves the information about it and calls
4429 * {@link ComponentInfo#loadLogo ComponentInfo.loadLogo()} to return its
4430 * logo. If the activity cannot be found, NameNotFoundException is thrown.
Adam Powell81cd2e92010-04-21 16:35:18 -07004431 *
4432 * @param activityName Name of the activity whose logo is to be retrieved.
Jose Limaf78e3122014-03-06 12:13:15 -08004433 * @return Returns the image of the logo or null if the activity has no logo
4434 * specified.
Adam Powell81cd2e92010-04-21 16:35:18 -07004435 * @throws NameNotFoundException Thrown if the resources for the given
Jose Limaf78e3122014-03-06 12:13:15 -08004436 * activity could not be loaded.
Adam Powell81cd2e92010-04-21 16:35:18 -07004437 * @see #getActivityLogo(Intent)
4438 */
4439 public abstract Drawable getActivityLogo(ComponentName activityName)
4440 throws NameNotFoundException;
4441
4442 /**
4443 * Retrieve the logo associated with an Intent. If intent.getClassName() is
4444 * set, this simply returns the result of
4445 * getActivityLogo(intent.getClassName()). Otherwise it resolves the intent's
4446 * component and returns the logo associated with the resolved component.
kmccormick30498b42013-03-27 17:39:17 -07004447 * If intent.getClassName() cannot be found or the Intent cannot be resolved
Adam Powell81cd2e92010-04-21 16:35:18 -07004448 * to a component, NameNotFoundException is thrown.
4449 *
4450 * @param intent The intent for which you would like to retrieve a logo.
4451 *
4452 * @return Returns the image of the logo, or null if the activity has no
4453 * logo specified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004454 *
Adam Powell81cd2e92010-04-21 16:35:18 -07004455 * @throws NameNotFoundException Thrown if the resources for application
4456 * matching the given intent could not be loaded.
4457 *
4458 * @see #getActivityLogo(ComponentName)
4459 */
4460 public abstract Drawable getActivityLogo(Intent intent)
4461 throws NameNotFoundException;
4462
4463 /**
4464 * Retrieve the logo associated with an application. If it has not specified
4465 * a logo, this method returns null.
4466 *
4467 * @param info Information about application being queried.
4468 *
4469 * @return Returns the image of the logo, or null if no logo is specified
4470 * by the application.
4471 *
4472 * @see #getApplicationLogo(String)
4473 */
4474 public abstract Drawable getApplicationLogo(ApplicationInfo info);
4475
4476 /**
4477 * Retrieve the logo associated with an application. Given the name of the
4478 * application's package, retrieves the information about it and calls
kmccormick30498b42013-03-27 17:39:17 -07004479 * getApplicationLogo() to return its logo. If the application cannot be
Adam Powell81cd2e92010-04-21 16:35:18 -07004480 * found, NameNotFoundException is thrown.
4481 *
4482 * @param packageName Name of the package whose application logo is to be
4483 * retrieved.
4484 *
4485 * @return Returns the image of the logo, or null if no application logo
4486 * has been specified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004487 *
Adam Powell81cd2e92010-04-21 16:35:18 -07004488 * @throws NameNotFoundException Thrown if the resources for the given
4489 * application could not be loaded.
4490 *
4491 * @see #getApplicationLogo(ApplicationInfo)
4492 */
4493 public abstract Drawable getApplicationLogo(String packageName)
4494 throws NameNotFoundException;
4495
4496 /**
Vadim Tryshev66ae66a2016-02-18 15:41:21 -08004497 * Returns a managed-user-style badged copy of the given drawable allowing the user to
4498 * distinguish it from the original drawable.
4499 * The caller can specify the location in the bounds of the drawable to be
4500 * badged where the badge should be applied as well as the density of the
4501 * badge to be used.
4502 * <p>
4503 * If the original drawable is a BitmapDrawable and the backing bitmap is
4504 * mutable as per {@link android.graphics.Bitmap#isMutable()}, the badging
4505 * is performed in place and the original drawable is returned.
4506 * </p>
4507 *
4508 * @param drawable The drawable to badge.
4509 * @param badgeLocation Where in the bounds of the badged drawable to place
4510 * the badge. If it's {@code null}, the badge is applied on top of the entire
4511 * drawable being badged.
4512 * @param badgeDensity The optional desired density for the badge as per
4513 * {@link android.util.DisplayMetrics#densityDpi}. If it's not positive,
4514 * the density of the display is used.
4515 * @return A drawable that combines the original drawable and a badge as
4516 * determined by the system.
4517 * @hide
4518 */
4519 public abstract Drawable getManagedUserBadgedDrawable(Drawable drawable, Rect badgeLocation,
4520 int badgeDensity);
4521
4522 /**
Tony Mak4dc008c2016-03-16 10:46:49 +00004523 * If the target user is a managed profile, then this returns a badged copy of the given icon
4524 * to be able to distinguish it from the original icon. For badging an arbitrary drawable use
Kenny Guydf77d712015-05-29 17:02:22 +01004525 * {@link #getUserBadgedDrawableForDensity(
Svetoslavc7d62f02014-09-04 15:39:54 -07004526 * android.graphics.drawable.Drawable, UserHandle, android.graphics.Rect, int)}.
4527 * <p>
4528 * If the original drawable is a BitmapDrawable and the backing bitmap is
4529 * mutable as per {@link android.graphics.Bitmap#isMutable()}, the badging
4530 * is performed in place and the original drawable is returned.
4531 * </p>
4532 *
4533 * @param icon The icon to badge.
4534 * @param user The target user.
4535 * @return A drawable that combines the original icon and a badge as
4536 * determined by the system.
4537 */
4538 public abstract Drawable getUserBadgedIcon(Drawable icon, UserHandle user);
4539
4540 /**
4541 * If the target user is a managed profile of the calling user or the caller
4542 * is itself a managed profile, then this returns a badged copy of the given
4543 * drawable allowing the user to distinguish it from the original drawable.
4544 * The caller can specify the location in the bounds of the drawable to be
4545 * badged where the badge should be applied as well as the density of the
4546 * badge to be used.
4547 * <p>
4548 * If the original drawable is a BitmapDrawable and the backing bitmap is
Vadim Tryshev66ae66a2016-02-18 15:41:21 -08004549 * mutable as per {@link android.graphics.Bitmap#isMutable()}, the badging
Svetoslavc7d62f02014-09-04 15:39:54 -07004550 * is performed in place and the original drawable is returned.
4551 * </p>
4552 *
4553 * @param drawable The drawable to badge.
4554 * @param user The target user.
4555 * @param badgeLocation Where in the bounds of the badged drawable to place
Vadim Tryshev66ae66a2016-02-18 15:41:21 -08004556 * the badge. If it's {@code null}, the badge is applied on top of the entire
Svetoslavc7d62f02014-09-04 15:39:54 -07004557 * drawable being badged.
4558 * @param badgeDensity The optional desired density for the badge as per
Vadim Tryshev66ae66a2016-02-18 15:41:21 -08004559 * {@link android.util.DisplayMetrics#densityDpi}. If it's not positive,
Svetoslavc7d62f02014-09-04 15:39:54 -07004560 * the density of the display is used.
4561 * @return A drawable that combines the original drawable and a badge as
4562 * determined by the system.
4563 */
4564 public abstract Drawable getUserBadgedDrawableForDensity(Drawable drawable,
4565 UserHandle user, Rect badgeLocation, int badgeDensity);
4566
4567 /**
4568 * If the target user is a managed profile of the calling user or the caller
4569 * is itself a managed profile, then this returns a drawable to use as a small
4570 * icon to include in a view to distinguish it from the original icon.
4571 *
4572 * @param user The target user.
4573 * @param density The optional desired density for the badge as per
4574 * {@link android.util.DisplayMetrics#densityDpi}. If not provided
4575 * the density of the current display is used.
4576 * @return the drawable or null if no drawable is required.
4577 * @hide
4578 */
4579 public abstract Drawable getUserBadgeForDensity(UserHandle user, int density);
4580
4581 /**
4582 * If the target user is a managed profile of the calling user or the caller
Selim Cineke6ff9462016-01-15 15:07:06 -08004583 * is itself a managed profile, then this returns a drawable to use as a small
4584 * icon to include in a view to distinguish it from the original icon. This version
4585 * doesn't have background protection and should be used over a light background instead of
4586 * a badge.
4587 *
4588 * @param user The target user.
4589 * @param density The optional desired density for the badge as per
4590 * {@link android.util.DisplayMetrics#densityDpi}. If not provided
4591 * the density of the current display is used.
4592 * @return the drawable or null if no drawable is required.
4593 * @hide
4594 */
4595 public abstract Drawable getUserBadgeForDensityNoBackground(UserHandle user, int density);
4596
4597 /**
4598 * If the target user is a managed profile of the calling user or the caller
Svetoslavc7d62f02014-09-04 15:39:54 -07004599 * is itself a managed profile, then this returns a copy of the label with
4600 * badging for accessibility services like talkback. E.g. passing in "Email"
4601 * and it might return "Work Email" for Email in the work profile.
4602 *
4603 * @param label The label to change.
4604 * @param user The target user.
4605 * @return A label that combines the original label and a badge as
4606 * determined by the system.
4607 */
4608 public abstract CharSequence getUserBadgedLabel(CharSequence label, UserHandle user);
4609
4610 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004611 * Retrieve text from a package. This is a low-level API used by
4612 * the various package manager info structures (such as
4613 * {@link ComponentInfo} to implement retrieval of their associated
4614 * labels and other text.
4615 *
4616 * @param packageName The name of the package that this text is coming from.
kmccormick30498b42013-03-27 17:39:17 -07004617 * Cannot be null.
4618 * @param resid The resource identifier of the desired text. Cannot be 0.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004619 * @param appInfo Overall information about <var>packageName</var>. This
4620 * may be null, in which case the application information will be retrieved
4621 * for you if needed; if you already have this information around, it can
4622 * be much more efficient to supply it here.
4623 *
4624 * @return Returns a CharSequence holding the requested text. Returns null
4625 * if the text could not be found for any reason.
4626 */
Tor Norbye7b9c9122013-05-30 16:48:33 -07004627 public abstract CharSequence getText(String packageName, @StringRes int resid,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004628 ApplicationInfo appInfo);
4629
4630 /**
4631 * Retrieve an XML file from a package. This is a low-level API used to
4632 * retrieve XML meta data.
4633 *
4634 * @param packageName The name of the package that this xml is coming from.
kmccormick30498b42013-03-27 17:39:17 -07004635 * Cannot be null.
4636 * @param resid The resource identifier of the desired xml. Cannot be 0.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004637 * @param appInfo Overall information about <var>packageName</var>. This
4638 * may be null, in which case the application information will be retrieved
4639 * for you if needed; if you already have this information around, it can
4640 * be much more efficient to supply it here.
4641 *
4642 * @return Returns an XmlPullParser allowing you to parse out the XML
4643 * data. Returns null if the xml resource could not be found for any
4644 * reason.
4645 */
Tor Norbye7b9c9122013-05-30 16:48:33 -07004646 public abstract XmlResourceParser getXml(String packageName, @XmlRes int resid,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004647 ApplicationInfo appInfo);
4648
4649 /**
4650 * Return the label to use for this application.
4651 *
4652 * @return Returns the label associated with this application, or null if
4653 * it could not be found for any reason.
kmccormick30498b42013-03-27 17:39:17 -07004654 * @param info The application to get the label of.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004655 */
4656 public abstract CharSequence getApplicationLabel(ApplicationInfo info);
4657
4658 /**
4659 * Retrieve the resources associated with an activity. Given the full
4660 * name of an activity, retrieves the information about it and calls
4661 * getResources() to return its application's resources. If the activity
kmccormick30498b42013-03-27 17:39:17 -07004662 * cannot be found, NameNotFoundException is thrown.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004663 *
4664 * @param activityName Name of the activity whose resources are to be
4665 * retrieved.
4666 *
4667 * @return Returns the application's Resources.
4668 * @throws NameNotFoundException Thrown if the resources for the given
4669 * application could not be loaded.
4670 *
4671 * @see #getResourcesForApplication(ApplicationInfo)
4672 */
4673 public abstract Resources getResourcesForActivity(ComponentName activityName)
4674 throws NameNotFoundException;
4675
4676 /**
4677 * Retrieve the resources for an application. Throws NameNotFoundException
4678 * if the package is no longer installed.
4679 *
4680 * @param app Information about the desired application.
4681 *
4682 * @return Returns the application's Resources.
4683 * @throws NameNotFoundException Thrown if the resources for the given
4684 * application could not be loaded (most likely because it was uninstalled).
4685 */
4686 public abstract Resources getResourcesForApplication(ApplicationInfo app)
4687 throws NameNotFoundException;
4688
4689 /**
4690 * Retrieve the resources associated with an application. Given the full
4691 * package name of an application, retrieves the information about it and
4692 * calls getResources() to return its application's resources. If the
kmccormick30498b42013-03-27 17:39:17 -07004693 * appPackageName cannot be found, NameNotFoundException is thrown.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004694 *
4695 * @param appPackageName Package name of the application whose resources
4696 * are to be retrieved.
4697 *
4698 * @return Returns the application's Resources.
4699 * @throws NameNotFoundException Thrown if the resources for the given
4700 * application could not be loaded.
4701 *
4702 * @see #getResourcesForApplication(ApplicationInfo)
4703 */
4704 public abstract Resources getResourcesForApplication(String appPackageName)
4705 throws NameNotFoundException;
4706
Amith Yamasani98edc952012-09-25 14:09:27 -07004707 /** @hide */
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004708 public abstract Resources getResourcesForApplicationAsUser(String appPackageName,
4709 @UserIdInt int userId) throws NameNotFoundException;
Amith Yamasani98edc952012-09-25 14:09:27 -07004710
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004711 /**
4712 * Retrieve overall information about an application package defined
4713 * in a package archive file
4714 *
4715 * @param archiveFilePath The path to the archive file
4716 * @param flags Additional option flags. Use any combination of
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004717 * {@link #GET_ACTIVITIES}, {@link #GET_CONFIGURATIONS},
4718 * {@link #GET_GIDS}, {@link #GET_INSTRUMENTATION},
4719 * {@link #GET_INTENT_FILTERS}, {@link #GET_META_DATA},
4720 * {@link #GET_PERMISSIONS}, {@link #GET_PROVIDERS},
4721 * {@link #GET_RECEIVERS}, {@link #GET_SERVICES},
4722 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #GET_SIGNATURES},
4723 * {@link #GET_URI_PERMISSION_PATTERNS}, {@link #GET_UNINSTALLED_PACKAGES},
4724 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
4725 * {@link #MATCH_UNINSTALLED_PACKAGES}
4726 * to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004727 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004728 * @return A PackageInfo object containing information about the
4729 * package archive. If the package could not be parsed,
4730 * returns null.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004731 *
4732 * @see #GET_ACTIVITIES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004733 * @see #GET_CONFIGURATIONS
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004734 * @see #GET_GIDS
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004735 * @see #GET_INSTRUMENTATION
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004736 * @see #GET_INTENT_FILTERS
4737 * @see #GET_META_DATA
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004738 * @see #GET_PERMISSIONS
4739 * @see #GET_PROVIDERS
4740 * @see #GET_RECEIVERS
4741 * @see #GET_SERVICES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004742 * @see #GET_SHARED_LIBRARY_FILES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004743 * @see #GET_SIGNATURES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004744 * @see #GET_URI_PERMISSION_PATTERNS
4745 * @see #MATCH_DISABLED_COMPONENTS
4746 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
4747 * @see #MATCH_UNINSTALLED_PACKAGES
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004748 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004749 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004750 public PackageInfo getPackageArchiveInfo(String archiveFilePath, @PackageInfoFlags int flags) {
Jeff Sharkey275e0852014-06-17 18:18:49 -07004751 final PackageParser parser = new PackageParser();
4752 final File apkFile = new File(archiveFilePath);
Jeff Sharkeyc4858a22014-06-16 10:51:20 -07004753 try {
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004754 if ((flags & (MATCH_DIRECT_BOOT_UNAWARE | MATCH_DIRECT_BOOT_AWARE)) != 0) {
Jeff Sharkeyc3132512016-01-12 14:06:58 -07004755 // Caller expressed an explicit opinion about what encryption
4756 // aware/unaware components they want to see, so fall through and
4757 // give them what they want
4758 } else {
4759 // Caller expressed no opinion, so match everything
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004760 flags |= MATCH_DIRECT_BOOT_AWARE | MATCH_DIRECT_BOOT_UNAWARE;
Jeff Sharkeyc3132512016-01-12 14:06:58 -07004761 }
4762
Jeff Sharkey275e0852014-06-17 18:18:49 -07004763 PackageParser.Package pkg = parser.parseMonolithicPackage(apkFile, 0);
Jeff Sharkeyc4858a22014-06-16 10:51:20 -07004764 if ((flags & GET_SIGNATURES) != 0) {
Svet Ganov354cd3c2015-12-17 11:35:04 -08004765 PackageParser.collectCertificates(pkg, 0);
Jeff Sharkeyc4858a22014-06-16 10:51:20 -07004766 }
4767 PackageUserState state = new PackageUserState();
4768 return PackageParser.generatePackageInfo(pkg, null, flags, 0, 0, null, state);
4769 } catch (PackageParserException e) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004770 return null;
4771 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004772 }
4773
4774 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07004775 * @deprecated replaced by {@link PackageInstaller}
4776 * @hide
Jacek Surazski65e13172009-04-28 15:26:38 +02004777 */
Jeff Sharkey5aa86932016-01-08 19:07:49 -07004778 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004779 public abstract void installPackage(
Todd Kennedya6793232016-02-24 22:46:00 +00004780 Uri packageURI,
4781 IPackageInstallObserver observer,
4782 @InstallFlags int flags,
Jacek Surazski65e13172009-04-28 15:26:38 +02004783 String installerPackageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004784 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07004785 * @deprecated replaced by {@link PackageInstaller}
Christopher Tateab8a5012014-03-24 16:25:51 -07004786 * @hide
Christopher Tateab8a5012014-03-24 16:25:51 -07004787 */
Jeff Sharkey5aa86932016-01-08 19:07:49 -07004788 @Deprecated
Todd Kennedya6793232016-02-24 22:46:00 +00004789 public abstract void installPackage(
4790 Uri packageURI,
4791 PackageInstallObserver observer,
4792 @InstallFlags int flags,
4793 String installerPackageName);
Christopher Tateab8a5012014-03-24 16:25:51 -07004794
rich cannings706e8ba2012-08-20 13:20:14 -07004795 /**
Dianne Hackborn7767eac2012-08-23 18:25:40 -07004796 * If there is already an application with the given package name installed
4797 * on the system for other users, also install it for the calling user.
4798 * @hide
4799 */
Nicolas Prevot9a80e532015-09-23 15:49:28 +01004800 public abstract int installExistingPackage(String packageName) throws NameNotFoundException;
4801
4802 /**
4803 * If there is already an application with the given package name installed
4804 * on the system for other users, also install it for the specified user.
4805 * @hide
4806 */
4807 @RequiresPermission(anyOf = {
4808 Manifest.permission.INSTALL_PACKAGES,
4809 Manifest.permission.INTERACT_ACROSS_USERS_FULL})
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004810 public abstract int installExistingPackageAsUser(String packageName, @UserIdInt int userId)
Dianne Hackborn7767eac2012-08-23 18:25:40 -07004811 throws NameNotFoundException;
4812
4813 /**
Kenny Root5ab21572011-07-27 11:11:19 -07004814 * Allows a package listening to the
4815 * {@link Intent#ACTION_PACKAGE_NEEDS_VERIFICATION package verification
Kenny Root3a9b5fb2011-09-20 14:15:38 -07004816 * broadcast} to respond to the package manager. The response must include
4817 * the {@code verificationCode} which is one of
4818 * {@link PackageManager#VERIFICATION_ALLOW} or
4819 * {@link PackageManager#VERIFICATION_REJECT}.
Kenny Root5ab21572011-07-27 11:11:19 -07004820 *
4821 * @param id pending package identifier as passed via the
kmccormick30498b42013-03-27 17:39:17 -07004822 * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra.
Kenny Root3a9b5fb2011-09-20 14:15:38 -07004823 * @param verificationCode either {@link PackageManager#VERIFICATION_ALLOW}
4824 * or {@link PackageManager#VERIFICATION_REJECT}.
rich cannings7e671512012-08-27 14:44:16 -07004825 * @throws SecurityException if the caller does not have the
Dianne Hackborn8832c182012-09-17 17:20:24 -07004826 * PACKAGE_VERIFICATION_AGENT permission.
Kenny Root5ab21572011-07-27 11:11:19 -07004827 */
Kenny Root3a9b5fb2011-09-20 14:15:38 -07004828 public abstract void verifyPendingInstall(int id, int verificationCode);
Kenny Root5ab21572011-07-27 11:11:19 -07004829
4830 /**
rich canningsd9ef3e52012-08-22 14:28:05 -07004831 * Allows a package listening to the
4832 * {@link Intent#ACTION_PACKAGE_NEEDS_VERIFICATION package verification
4833 * broadcast} to extend the default timeout for a response and declare what
4834 * action to perform after the timeout occurs. The response must include
4835 * the {@code verificationCodeAtTimeout} which is one of
4836 * {@link PackageManager#VERIFICATION_ALLOW} or
4837 * {@link PackageManager#VERIFICATION_REJECT}.
4838 *
4839 * This method may only be called once per package id. Additional calls
4840 * will have no effect.
4841 *
4842 * @param id pending package identifier as passed via the
kmccormick30498b42013-03-27 17:39:17 -07004843 * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra.
rich canningsd9ef3e52012-08-22 14:28:05 -07004844 * @param verificationCodeAtTimeout either
4845 * {@link PackageManager#VERIFICATION_ALLOW} or
rich canningsd1b5cfc2012-08-29 14:49:51 -07004846 * {@link PackageManager#VERIFICATION_REJECT}. If
4847 * {@code verificationCodeAtTimeout} is neither
4848 * {@link PackageManager#VERIFICATION_ALLOW} or
4849 * {@link PackageManager#VERIFICATION_REJECT}, then
4850 * {@code verificationCodeAtTimeout} will default to
rich canningsd9ef3e52012-08-22 14:28:05 -07004851 * {@link PackageManager#VERIFICATION_REJECT}.
4852 * @param millisecondsToDelay the amount of time requested for the timeout.
4853 * Must be positive and less than
rich canningsd1b5cfc2012-08-29 14:49:51 -07004854 * {@link PackageManager#MAXIMUM_VERIFICATION_TIMEOUT}. If
4855 * {@code millisecondsToDelay} is out of bounds,
4856 * {@code millisecondsToDelay} will be set to the closest in
4857 * bounds value; namely, 0 or
rich canningsd9ef3e52012-08-22 14:28:05 -07004858 * {@link PackageManager#MAXIMUM_VERIFICATION_TIMEOUT}.
rich cannings7e671512012-08-27 14:44:16 -07004859 * @throws SecurityException if the caller does not have the
Dianne Hackborn8832c182012-09-17 17:20:24 -07004860 * PACKAGE_VERIFICATION_AGENT permission.
rich canningsd9ef3e52012-08-22 14:28:05 -07004861 */
4862 public abstract void extendVerificationTimeout(int id,
4863 int verificationCodeAtTimeout, long millisecondsToDelay);
4864
4865 /**
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004866 * Allows a package listening to the
Todd Kennedydfa93ab2016-03-03 15:24:33 -08004867 * {@link Intent#ACTION_INTENT_FILTER_NEEDS_VERIFICATION} intent filter verification
4868 * broadcast to respond to the package manager. The response must include
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004869 * the {@code verificationCode} which is one of
4870 * {@link PackageManager#INTENT_FILTER_VERIFICATION_SUCCESS} or
4871 * {@link PackageManager#INTENT_FILTER_VERIFICATION_FAILURE}.
4872 *
4873 * @param verificationId pending package identifier as passed via the
4874 * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra.
4875 * @param verificationCode either {@link PackageManager#INTENT_FILTER_VERIFICATION_SUCCESS}
4876 * or {@link PackageManager#INTENT_FILTER_VERIFICATION_FAILURE}.
Todd Kennedydfa93ab2016-03-03 15:24:33 -08004877 * @param failedDomains a list of failed domains if the verificationCode is
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004878 * {@link PackageManager#INTENT_FILTER_VERIFICATION_FAILURE}, otherwise null;
4879 * @throws SecurityException if the caller does not have the
4880 * INTENT_FILTER_VERIFICATION_AGENT permission.
4881 *
4882 * @hide
4883 */
Fabrice Di Meglioef741da2015-05-12 16:31:38 -07004884 @SystemApi
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004885 public abstract void verifyIntentFilter(int verificationId, int verificationCode,
Todd Kennedydfa93ab2016-03-03 15:24:33 -08004886 List<String> failedDomains);
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004887
4888 /**
4889 * Get the status of a Domain Verification Result for an IntentFilter. This is
4890 * related to the {@link android.content.IntentFilter#setAutoVerify(boolean)} and
4891 * {@link android.content.IntentFilter#getAutoVerify()}
4892 *
4893 * This is used by the ResolverActivity to change the status depending on what the User select
4894 * in the Disambiguation Dialog and also used by the Settings App for changing the default App
4895 * for a domain.
4896 *
4897 * @param packageName The package name of the Activity associated with the IntentFilter.
4898 * @param userId The user id.
4899 *
4900 * @return The status to set to. This can be
4901 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK} or
4902 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS} or
4903 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER} or
4904 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED}
4905 *
4906 * @hide
4907 */
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004908 public abstract int getIntentVerificationStatusAsUser(String packageName, @UserIdInt int userId);
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004909
4910 /**
4911 * Allow to change the status of a Intent Verification status for all IntentFilter of an App.
4912 * This is related to the {@link android.content.IntentFilter#setAutoVerify(boolean)} and
4913 * {@link android.content.IntentFilter#getAutoVerify()}
4914 *
4915 * This is used by the ResolverActivity to change the status depending on what the User select
4916 * in the Disambiguation Dialog and also used by the Settings App for changing the default App
4917 * for a domain.
4918 *
4919 * @param packageName The package name of the Activity associated with the IntentFilter.
4920 * @param status The status to set to. This can be
4921 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK} or
4922 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS} or
4923 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER}
4924 * @param userId The user id.
4925 *
4926 * @return true if the status has been set. False otherwise.
4927 *
4928 * @hide
4929 */
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07004930 public abstract boolean updateIntentVerificationStatusAsUser(String packageName, int status,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004931 @UserIdInt int userId);
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004932
4933 /**
4934 * Get the list of IntentFilterVerificationInfo for a specific package and User.
4935 *
4936 * @param packageName the package name. When this parameter is set to a non null value,
4937 * the results will be filtered by the package name provided.
4938 * Otherwise, there will be no filtering and it will return a list
Fabrice Di Meglio07885952015-04-06 19:41:28 -07004939 * corresponding for all packages
4940 *
4941 * @return a list of IntentFilterVerificationInfo for a specific package.
4942 *
4943 * @hide
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004944 */
4945 public abstract List<IntentFilterVerificationInfo> getIntentFilterVerifications(
4946 String packageName);
4947
4948 /**
Fabrice Di Meglio07885952015-04-06 19:41:28 -07004949 * Get the list of IntentFilter for a specific package.
4950 *
4951 * @param packageName the package name. This parameter is set to a non null value,
4952 * the list will contain all the IntentFilter for that package.
4953 * Otherwise, the list will be empty.
4954 *
4955 * @return a list of IntentFilter for a specific package.
4956 *
4957 * @hide
4958 */
4959 public abstract List<IntentFilter> getAllIntentFilters(String packageName);
4960
4961 /**
Fabrice Di Meglio62271722015-04-10 17:24:02 -07004962 * Get the default Browser package name for a specific user.
4963 *
4964 * @param userId The user id.
4965 *
4966 * @return the package name of the default Browser for the specified user. If the user id passed
4967 * is -1 (all users) it will return a null value.
4968 *
4969 * @hide
4970 */
Jeff Sharkeya73b8fd2016-01-06 17:02:08 -07004971 @TestApi
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004972 public abstract String getDefaultBrowserPackageNameAsUser(@UserIdInt int userId);
Fabrice Di Meglio62271722015-04-10 17:24:02 -07004973
4974 /**
4975 * Set the default Browser package name for a specific user.
4976 *
4977 * @param packageName The package name of the default Browser.
4978 * @param userId The user id.
4979 *
4980 * @return true if the default Browser for the specified user has been set,
4981 * otherwise return false. If the user id passed is -1 (all users) this call will not
4982 * do anything and just return false.
4983 *
4984 * @hide
4985 */
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004986 public abstract boolean setDefaultBrowserPackageNameAsUser(String packageName,
4987 @UserIdInt int userId);
Fabrice Di Meglio62271722015-04-10 17:24:02 -07004988
4989 /**
Dianne Hackborn880119b2010-11-18 22:26:40 -08004990 * Change the installer associated with a given package. There are limitations
4991 * on how the installer package can be changed; in particular:
4992 * <ul>
4993 * <li> A SecurityException will be thrown if <var>installerPackageName</var>
4994 * is not signed with the same certificate as the calling application.
4995 * <li> A SecurityException will be thrown if <var>targetPackage</var> already
4996 * has an installer package, and that installer package is not signed with
4997 * the same certificate as the calling application.
4998 * </ul>
4999 *
5000 * @param targetPackage The installed package whose installer will be changed.
5001 * @param installerPackageName The package name of the new installer. May be
5002 * null to clear the association.
5003 */
5004 public abstract void setInstallerPackageName(String targetPackage,
5005 String installerPackageName);
5006
5007 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005008 * Attempts to delete a package. Since this may take a little while, the
5009 * result will be posted back to the given observer. A deletion will fail if
5010 * the calling context lacks the
5011 * {@link android.Manifest.permission#DELETE_PACKAGES} permission, if the
5012 * named package cannot be found, or if the named package is a system
5013 * package.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005014 *
5015 * @param packageName The name of the package to delete
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005016 * @param observer An observer callback to get notified when the package
5017 * deletion is complete.
5018 * {@link android.content.pm.IPackageDeleteObserver#packageDeleted}
5019 * will be called when that happens. observer may be null to
5020 * indicate that no callback is desired.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005021 * @hide
5022 */
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005023 public abstract void deletePackage(String packageName, IPackageDeleteObserver observer,
5024 @DeleteFlags int flags);
Jacek Surazski65e13172009-04-28 15:26:38 +02005025
5026 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005027 * Attempts to delete a package. Since this may take a little while, the
5028 * result will be posted back to the given observer. A deletion will fail if
5029 * the named package cannot be found, or if the named package is a system
5030 * package.
Nicolas Prevot9a80e532015-09-23 15:49:28 +01005031 *
5032 * @param packageName The name of the package to delete
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005033 * @param observer An observer callback to get notified when the package
5034 * deletion is complete.
5035 * {@link android.content.pm.IPackageDeleteObserver#packageDeleted}
5036 * will be called when that happens. observer may be null to
5037 * indicate that no callback is desired.
Nicolas Prevot9a80e532015-09-23 15:49:28 +01005038 * @param userId The user Id
Nicolas Prevot9a80e532015-09-23 15:49:28 +01005039 * @hide
5040 */
5041 @RequiresPermission(anyOf = {
5042 Manifest.permission.DELETE_PACKAGES,
5043 Manifest.permission.INTERACT_ACROSS_USERS_FULL})
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005044 public abstract void deletePackageAsUser(String packageName, IPackageDeleteObserver observer,
5045 @DeleteFlags int flags, @UserIdInt int userId);
Nicolas Prevot9a80e532015-09-23 15:49:28 +01005046
5047 /**
Jacek Surazski65e13172009-04-28 15:26:38 +02005048 * Retrieve the package name of the application that installed a package. This identifies
5049 * which market the package came from.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005050 *
Jacek Surazski65e13172009-04-28 15:26:38 +02005051 * @param packageName The name of the package to query
5052 */
5053 public abstract String getInstallerPackageName(String packageName);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005054
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005055 /**
5056 * Attempts to clear the user data directory of an application.
5057 * Since this may take a little while, the result will
5058 * be posted back to the given observer. A deletion will fail if the
5059 * named package cannot be found, or if the named package is a "system package".
5060 *
5061 * @param packageName The name of the package
5062 * @param observer An observer callback to get notified when the operation is finished
5063 * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)}
5064 * will be called when that happens. observer may be null to indicate that
5065 * no callback is desired.
5066 *
5067 * @hide
5068 */
5069 public abstract void clearApplicationUserData(String packageName,
5070 IPackageDataObserver observer);
5071 /**
5072 * Attempts to delete the cache files associated with an application.
5073 * Since this may take a little while, the result will
5074 * be posted back to the given observer. A deletion will fail if the calling context
5075 * lacks the {@link android.Manifest.permission#DELETE_CACHE_FILES} permission, if the
5076 * named package cannot be found, or if the named package is a "system package".
5077 *
5078 * @param packageName The name of the package to delete
5079 * @param observer An observer callback to get notified when the cache file deletion
5080 * is complete.
5081 * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)}
5082 * will be called when that happens. observer may be null to indicate that
5083 * no callback is desired.
5084 *
5085 * @hide
5086 */
5087 public abstract void deleteApplicationCacheFiles(String packageName,
5088 IPackageDataObserver observer);
5089
5090 /**
Suprabh Shukla78c9eb82016-04-12 15:51:35 -07005091 * Attempts to delete the cache files associated with an application for a given user. Since
5092 * this may take a little while, the result will be posted back to the given observer. A
5093 * deletion will fail if the calling context lacks the
5094 * {@link android.Manifest.permission#DELETE_CACHE_FILES} permission, if the named package
5095 * cannot be found, or if the named package is a "system package". If {@code userId} does not
5096 * belong to the calling user, the caller must have
5097 * {@link android.Manifest.permission#INTERACT_ACROSS_USERS} permission.
5098 *
5099 * @param packageName The name of the package to delete
5100 * @param userId the user for which the cache files needs to be deleted
5101 * @param observer An observer callback to get notified when the cache file deletion is
5102 * complete.
5103 * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)}
5104 * will be called when that happens. observer may be null to indicate that no
5105 * callback is desired.
5106 * @hide
5107 */
5108 public abstract void deleteApplicationCacheFilesAsUser(String packageName, int userId,
5109 IPackageDataObserver observer);
5110
5111 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005112 * Free storage by deleting LRU sorted list of cache files across
5113 * all applications. If the currently available free storage
5114 * on the device is greater than or equal to the requested
5115 * free storage, no cache files are cleared. If the currently
5116 * available storage on the device is less than the requested
5117 * free storage, some or all of the cache files across
5118 * all applications are deleted (based on last accessed time)
5119 * to increase the free storage space on the device to
5120 * the requested value. There is no guarantee that clearing all
5121 * the cache files from all applications will clear up
5122 * enough storage to achieve the desired value.
5123 * @param freeStorageSize The number of bytes of storage to be
5124 * freed by the system. Say if freeStorageSize is XX,
5125 * and the current free storage is YY,
5126 * if XX is less than YY, just return. if not free XX-YY number
5127 * of bytes if possible.
5128 * @param observer call back used to notify when
5129 * the operation is completed
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005130 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005131 * @hide
5132 */
Jeff Sharkey529f91f2015-04-18 20:23:13 -07005133 public void freeStorageAndNotify(long freeStorageSize, IPackageDataObserver observer) {
5134 freeStorageAndNotify(null, freeStorageSize, observer);
5135 }
5136
5137 /** {@hide} */
5138 public abstract void freeStorageAndNotify(String volumeUuid, long freeStorageSize,
5139 IPackageDataObserver observer);
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -07005140
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005141 /**
5142 * Free storage by deleting LRU sorted list of cache files across
5143 * all applications. If the currently available free storage
5144 * on the device is greater than or equal to the requested
5145 * free storage, no cache files are cleared. If the currently
5146 * available storage on the device is less than the requested
5147 * free storage, some or all of the cache files across
5148 * all applications are deleted (based on last accessed time)
5149 * to increase the free storage space on the device to
5150 * the requested value. There is no guarantee that clearing all
5151 * the cache files from all applications will clear up
5152 * enough storage to achieve the desired value.
5153 * @param freeStorageSize The number of bytes of storage to be
5154 * freed by the system. Say if freeStorageSize is XX,
5155 * and the current free storage is YY,
5156 * if XX is less than YY, just return. if not free XX-YY number
5157 * of bytes if possible.
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -07005158 * @param pi IntentSender call back used to
5159 * notify when the operation is completed.May be null
5160 * to indicate that no call back is desired.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005161 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005162 * @hide
5163 */
Jeff Sharkey529f91f2015-04-18 20:23:13 -07005164 public void freeStorage(long freeStorageSize, IntentSender pi) {
5165 freeStorage(null, freeStorageSize, pi);
5166 }
5167
5168 /** {@hide} */
5169 public abstract void freeStorage(String volumeUuid, long freeStorageSize, IntentSender pi);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005170
5171 /**
5172 * Retrieve the size information for a package.
5173 * Since this may take a little while, the result will
5174 * be posted back to the given observer. The calling context
5175 * should have the {@link android.Manifest.permission#GET_PACKAGE_SIZE} permission.
5176 *
5177 * @param packageName The name of the package whose size information is to be retrieved
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07005178 * @param userId The user whose size information should be retrieved.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005179 * @param observer An observer callback to get notified when the operation
5180 * is complete.
5181 * {@link android.content.pm.IPackageStatsObserver#onGetStatsCompleted(PackageStats, boolean)}
5182 * The observer's callback is invoked with a PackageStats object(containing the
5183 * code, data and cache sizes of the package) and a boolean value representing
5184 * the status of the operation. observer may be null to indicate that
5185 * no callback is desired.
5186 *
5187 * @hide
5188 */
Jeff Sharkey8588bc12016-01-06 16:47:42 -07005189 public abstract void getPackageSizeInfoAsUser(String packageName, @UserIdInt int userId,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005190 IPackageStatsObserver observer);
5191
5192 /**
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07005193 * Like {@link #getPackageSizeInfoAsUser(String, int, IPackageStatsObserver)}, but
Dianne Hackborn0c380492012-08-20 17:23:30 -07005194 * returns the size for the calling user.
5195 *
5196 * @hide
5197 */
5198 public void getPackageSizeInfo(String packageName, IPackageStatsObserver observer) {
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07005199 getPackageSizeInfoAsUser(packageName, UserHandle.myUserId(), observer);
Dianne Hackborn0c380492012-08-20 17:23:30 -07005200 }
5201
5202 /**
Dianne Hackborna7ca0e52009-12-01 14:31:55 -08005203 * @deprecated This function no longer does anything; it was an old
kmccormickac66b852013-03-28 15:17:15 -07005204 * approach to managing preferred activities, which has been superseded
5205 * by (and conflicts with) the modern activity-based preferences.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005206 */
Dianne Hackborna7ca0e52009-12-01 14:31:55 -08005207 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005208 public abstract void addPackageToPreferred(String packageName);
5209
5210 /**
Dianne Hackborna7ca0e52009-12-01 14:31:55 -08005211 * @deprecated This function no longer does anything; it was an old
kmccormickac66b852013-03-28 15:17:15 -07005212 * approach to managing preferred activities, which has been superseded
5213 * by (and conflicts with) the modern activity-based preferences.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005214 */
Dianne Hackborna7ca0e52009-12-01 14:31:55 -08005215 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005216 public abstract void removePackageFromPreferred(String packageName);
5217
5218 /**
Jeff Sharkey629f9842016-01-08 16:36:54 -07005219 * Retrieve the list of all currently configured preferred packages. The
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005220 * first package on the list is the most preferred, the last is the
5221 * least preferred.
5222 *
5223 * @param flags Additional option flags. Use any combination of
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08005224 * {@link #GET_ACTIVITIES}, {@link #GET_CONFIGURATIONS},
5225 * {@link #GET_GIDS}, {@link #GET_INSTRUMENTATION},
5226 * {@link #GET_INTENT_FILTERS}, {@link #GET_META_DATA},
5227 * {@link #GET_PERMISSIONS}, {@link #GET_PROVIDERS},
5228 * {@link #GET_RECEIVERS}, {@link #GET_SERVICES},
5229 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #GET_SIGNATURES},
5230 * {@link #GET_URI_PERMISSION_PATTERNS}, {@link #GET_UNINSTALLED_PACKAGES},
5231 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
5232 * {@link #MATCH_UNINSTALLED_PACKAGES}
5233 * to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005234 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08005235 * @return A List of PackageInfo objects, one for each preferred application,
5236 * in order of preference.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005237 *
5238 * @see #GET_ACTIVITIES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005239 * @see #GET_CONFIGURATIONS
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08005240 * @see #GET_GIDS
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005241 * @see #GET_INSTRUMENTATION
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08005242 * @see #GET_INTENT_FILTERS
5243 * @see #GET_META_DATA
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005244 * @see #GET_PERMISSIONS
5245 * @see #GET_PROVIDERS
5246 * @see #GET_RECEIVERS
5247 * @see #GET_SERVICES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08005248 * @see #GET_SHARED_LIBRARY_FILES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005249 * @see #GET_SIGNATURES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08005250 * @see #GET_URI_PERMISSION_PATTERNS
5251 * @see #MATCH_DISABLED_COMPONENTS
5252 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
5253 * @see #MATCH_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005254 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07005255 public abstract List<PackageInfo> getPreferredPackages(@PackageInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005256
5257 /**
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08005258 * @deprecated This is a protected API that should not have been available
5259 * to third party applications. It is the platform's responsibility for
kmccormick30498b42013-03-27 17:39:17 -07005260 * assigning preferred activities and this cannot be directly modified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005261 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005262 * Add a new preferred activity mapping to the system. This will be used
5263 * to automatically select the given activity component when
5264 * {@link Context#startActivity(Intent) Context.startActivity()} finds
5265 * multiple matching activities and also matches the given filter.
5266 *
5267 * @param filter The set of intents under which this activity will be
5268 * made preferred.
5269 * @param match The IntentFilter match category that this preference
5270 * applies to.
5271 * @param set The set of activities that the user was picking from when
5272 * this preference was made.
5273 * @param activity The component name of the activity that is to be
5274 * preferred.
5275 */
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08005276 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005277 public abstract void addPreferredActivity(IntentFilter filter, int match,
5278 ComponentName[] set, ComponentName activity);
5279
5280 /**
Amith Yamasania3f133a2012-08-09 17:11:28 -07005281 * Same as {@link #addPreferredActivity(IntentFilter, int,
5282 ComponentName[], ComponentName)}, but with a specific userId to apply the preference
5283 to.
5284 * @hide
5285 */
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07005286 public void addPreferredActivityAsUser(IntentFilter filter, int match,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07005287 ComponentName[] set, ComponentName activity, @UserIdInt int userId) {
Amith Yamasania3f133a2012-08-09 17:11:28 -07005288 throw new RuntimeException("Not implemented. Must override in a subclass.");
5289 }
5290
5291 /**
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08005292 * @deprecated This is a protected API that should not have been available
5293 * to third party applications. It is the platform's responsibility for
kmccormick30498b42013-03-27 17:39:17 -07005294 * assigning preferred activities and this cannot be directly modified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005295 *
Satish Sampath8dbe6122009-06-02 23:35:54 +01005296 * Replaces an existing preferred activity mapping to the system, and if that were not present
5297 * adds a new preferred activity. This will be used
5298 * to automatically select the given activity component when
5299 * {@link Context#startActivity(Intent) Context.startActivity()} finds
5300 * multiple matching activities and also matches the given filter.
5301 *
5302 * @param filter The set of intents under which this activity will be
5303 * made preferred.
5304 * @param match The IntentFilter match category that this preference
5305 * applies to.
5306 * @param set The set of activities that the user was picking from when
5307 * this preference was made.
5308 * @param activity The component name of the activity that is to be
5309 * preferred.
5310 * @hide
5311 */
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08005312 @Deprecated
Satish Sampath8dbe6122009-06-02 23:35:54 +01005313 public abstract void replacePreferredActivity(IntentFilter filter, int match,
5314 ComponentName[] set, ComponentName activity);
5315
5316 /**
Amith Yamasani41c1ded2014-08-05 11:15:05 -07005317 * @hide
5318 */
5319 @Deprecated
5320 public void replacePreferredActivityAsUser(IntentFilter filter, int match,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07005321 ComponentName[] set, ComponentName activity, @UserIdInt int userId) {
Amith Yamasani41c1ded2014-08-05 11:15:05 -07005322 throw new RuntimeException("Not implemented. Must override in a subclass.");
5323 }
5324
5325 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005326 * Remove all preferred activity mappings, previously added with
5327 * {@link #addPreferredActivity}, from the
5328 * system whose activities are implemented in the given package name.
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08005329 * An application can only clear its own package(s).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005330 *
5331 * @param packageName The name of the package whose preferred activity
5332 * mappings are to be removed.
5333 */
5334 public abstract void clearPackagePreferredActivities(String packageName);
5335
5336 /**
5337 * Retrieve all preferred activities, previously added with
5338 * {@link #addPreferredActivity}, that are
5339 * currently registered with the system.
5340 *
John Spurlock38e64252015-03-18 12:09:32 -04005341 * @param outFilters A required list in which to place the filters of all of the
5342 * preferred activities.
5343 * @param outActivities A required list in which to place the component names of
5344 * all of the preferred activities.
5345 * @param packageName An optional package in which you would like to limit
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005346 * the list. If null, all activities will be returned; if non-null, only
5347 * those activities in the given package are returned.
5348 *
5349 * @return Returns the total number of registered preferred activities
5350 * (the number of distinct IntentFilter records, not the number of unique
5351 * activity components) that were found.
5352 */
John Spurlock38e64252015-03-18 12:09:32 -04005353 public abstract int getPreferredActivities(@NonNull List<IntentFilter> outFilters,
5354 @NonNull List<ComponentName> outActivities, String packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005355
5356 /**
Christopher Tatea2a0850d2013-09-05 16:38:58 -07005357 * Ask for the set of available 'home' activities and the current explicit
5358 * default, if any.
5359 * @hide
5360 */
5361 public abstract ComponentName getHomeActivities(List<ResolveInfo> outActivities);
5362
5363 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005364 * Set the enabled setting for a package component (activity, receiver, service, provider).
5365 * This setting will override any enabled state which may have been set by the component in its
5366 * manifest.
5367 *
5368 * @param componentName The component to enable
5369 * @param newState The new enabled state for the component. The legal values for this state
5370 * are:
5371 * {@link #COMPONENT_ENABLED_STATE_ENABLED},
5372 * {@link #COMPONENT_ENABLED_STATE_DISABLED}
5373 * and
5374 * {@link #COMPONENT_ENABLED_STATE_DEFAULT}
5375 * The last one removes the setting, thereby restoring the component's state to
5376 * whatever was set in it's manifest (or enabled, by default).
5377 * @param flags Optional behavior flags: {@link #DONT_KILL_APP} or 0.
5378 */
5379 public abstract void setComponentEnabledSetting(ComponentName componentName,
5380 int newState, int flags);
5381
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005382 /**
Amaury Medeirosdde24262014-06-03 20:06:41 -03005383 * Return the enabled setting for a package component (activity,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005384 * receiver, service, provider). This returns the last value set by
5385 * {@link #setComponentEnabledSetting(ComponentName, int, int)}; in most
5386 * cases this value will be {@link #COMPONENT_ENABLED_STATE_DEFAULT} since
5387 * the value originally specified in the manifest has not been modified.
5388 *
5389 * @param componentName The component to retrieve.
5390 * @return Returns the current enabled state for the component. May
5391 * be one of {@link #COMPONENT_ENABLED_STATE_ENABLED},
5392 * {@link #COMPONENT_ENABLED_STATE_DISABLED}, or
5393 * {@link #COMPONENT_ENABLED_STATE_DEFAULT}. The last one means the
5394 * component's enabled state is based on the original information in
5395 * the manifest as found in {@link ComponentInfo}.
5396 */
5397 public abstract int getComponentEnabledSetting(ComponentName componentName);
5398
5399 /**
5400 * Set the enabled setting for an application
5401 * This setting will override any enabled state which may have been set by the application in
5402 * its manifest. It also overrides the enabled state set in the manifest for any of the
5403 * application's components. It does not override any enabled state set by
5404 * {@link #setComponentEnabledSetting} for any of the application's components.
5405 *
5406 * @param packageName The package name of the application to enable
5407 * @param newState The new enabled state for the component. The legal values for this state
5408 * are:
5409 * {@link #COMPONENT_ENABLED_STATE_ENABLED},
5410 * {@link #COMPONENT_ENABLED_STATE_DISABLED}
5411 * and
5412 * {@link #COMPONENT_ENABLED_STATE_DEFAULT}
5413 * The last one removes the setting, thereby restoring the applications's state to
5414 * whatever was set in its manifest (or enabled, by default).
5415 * @param flags Optional behavior flags: {@link #DONT_KILL_APP} or 0.
5416 */
5417 public abstract void setApplicationEnabledSetting(String packageName,
5418 int newState, int flags);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005419
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005420 /**
Amaury Medeirosdde24262014-06-03 20:06:41 -03005421 * Return the enabled setting for an application. This returns
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005422 * the last value set by
5423 * {@link #setApplicationEnabledSetting(String, int, int)}; in most
5424 * cases this value will be {@link #COMPONENT_ENABLED_STATE_DEFAULT} since
5425 * the value originally specified in the manifest has not been modified.
5426 *
Amaury Medeirosdde24262014-06-03 20:06:41 -03005427 * @param packageName The package name of the application to retrieve.
5428 * @return Returns the current enabled state for the application. May
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005429 * be one of {@link #COMPONENT_ENABLED_STATE_ENABLED},
5430 * {@link #COMPONENT_ENABLED_STATE_DISABLED}, or
5431 * {@link #COMPONENT_ENABLED_STATE_DEFAULT}. The last one means the
5432 * application's enabled state is based on the original information in
Kevin Hufnagle5add7692016-08-29 16:50:17 -07005433 * the manifest as found in {@link ApplicationInfo}.
Mathew Inwood1b9f8d92011-09-26 13:23:56 +01005434 * @throws IllegalArgumentException if the named package does not exist.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005435 */
5436 public abstract int getApplicationEnabledSetting(String packageName);
5437
5438 /**
Sudheer Shankabbb3ff22015-07-09 15:39:23 +01005439 * Flush the package restrictions for a given user to disk. This forces the package restrictions
5440 * like component and package enabled settings to be written to disk and avoids the delay that
5441 * is otherwise present when changing those settings.
5442 *
5443 * @param userId Ther userId of the user whose restrictions are to be flushed.
5444 * @hide
5445 */
5446 public abstract void flushPackageRestrictionsAsUser(int userId);
5447
5448 /**
Amith Yamasanie5bcff62014-07-19 15:44:09 -07005449 * Puts the package in a hidden state, which is almost like an uninstalled state,
Amith Yamasani655d0e22013-06-12 14:19:10 -07005450 * making the package unavailable, but it doesn't remove the data or the actual
Amith Yamasanie5bcff62014-07-19 15:44:09 -07005451 * package file. Application can be unhidden by either resetting the hidden state
5452 * or by installing it, such as with {@link #installExistingPackage(String)}
Amith Yamasani655d0e22013-06-12 14:19:10 -07005453 * @hide
5454 */
Amith Yamasanie5bcff62014-07-19 15:44:09 -07005455 public abstract boolean setApplicationHiddenSettingAsUser(String packageName, boolean hidden,
Amith Yamasani655d0e22013-06-12 14:19:10 -07005456 UserHandle userHandle);
5457
5458 /**
Amith Yamasanie5bcff62014-07-19 15:44:09 -07005459 * Returns the hidden state of a package.
5460 * @see #setApplicationHiddenSettingAsUser(String, boolean, UserHandle)
Amith Yamasani655d0e22013-06-12 14:19:10 -07005461 * @hide
5462 */
Amith Yamasanie5bcff62014-07-19 15:44:09 -07005463 public abstract boolean getApplicationHiddenSettingAsUser(String packageName,
Amith Yamasani655d0e22013-06-12 14:19:10 -07005464 UserHandle userHandle);
5465
5466 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005467 * Return whether the device has been booted into safe mode.
5468 */
5469 public abstract boolean isSafeMode();
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08005470
5471 /**
Svetoslavf7c06eb2015-06-10 18:43:22 -07005472 * Adds a listener for permission changes for installed packages.
5473 *
5474 * @param listener The listener to add.
5475 *
5476 * @hide
5477 */
5478 @SystemApi
5479 @RequiresPermission(Manifest.permission.OBSERVE_GRANT_REVOKE_PERMISSIONS)
5480 public abstract void addOnPermissionsChangeListener(OnPermissionsChangedListener listener);
5481
5482 /**
5483 * Remvoes a listener for permission changes for installed packages.
5484 *
5485 * @param listener The listener to remove.
5486 *
5487 * @hide
5488 */
5489 @SystemApi
5490 public abstract void removeOnPermissionsChangeListener(OnPermissionsChangedListener listener);
5491
5492 /**
dcashman9d2f4412014-06-09 09:27:54 -07005493 * Return the {@link KeySet} associated with the String alias for this
5494 * application.
5495 *
5496 * @param alias The alias for a given {@link KeySet} as defined in the
5497 * application's AndroidManifest.xml.
dcashmanc6f22492014-08-14 09:54:51 -07005498 * @hide
dcashman9d2f4412014-06-09 09:27:54 -07005499 */
5500 public abstract KeySet getKeySetByAlias(String packageName, String alias);
5501
Ihab Awad1ec68882014-09-12 11:09:01 -07005502 /** Return the signing {@link KeySet} for this application.
dcashmanc6f22492014-08-14 09:54:51 -07005503 * @hide
5504 */
dcashman9d2f4412014-06-09 09:27:54 -07005505 public abstract KeySet getSigningKeySet(String packageName);
5506
5507 /**
5508 * Return whether the package denoted by packageName has been signed by all
5509 * of the keys specified by the {@link KeySet} ks. This will return true if
5510 * the package has been signed by additional keys (a superset) as well.
5511 * Compare to {@link #isSignedByExactly(String packageName, KeySet ks)}.
dcashmanc6f22492014-08-14 09:54:51 -07005512 * @hide
dcashman9d2f4412014-06-09 09:27:54 -07005513 */
5514 public abstract boolean isSignedBy(String packageName, KeySet ks);
5515
5516 /**
5517 * Return whether the package denoted by packageName has been signed by all
5518 * of, and only, the keys specified by the {@link KeySet} ks. Compare to
5519 * {@link #isSignedBy(String packageName, KeySet ks)}.
dcashmanc6f22492014-08-14 09:54:51 -07005520 * @hide
dcashman9d2f4412014-06-09 09:27:54 -07005521 */
5522 public abstract boolean isSignedByExactly(String packageName, KeySet ks);
5523
5524 /**
Andrei Stingaceanueb84b182016-01-26 18:39:55 +00005525 * Puts the package in a suspended state, where attempts at starting activities are denied.
Andrei Stingaceanu1e283912015-11-26 15:26:28 +00005526 *
Andrei Stingaceanueb84b182016-01-26 18:39:55 +00005527 * <p>It doesn't remove the data or the actual package file. The application notifications
5528 * will be hidden, the application will not show up in recents, will not be able to show
5529 * toasts or dialogs or ring the device.
5530 *
Kenny Guy871f3eb2016-03-09 20:06:16 +00005531 * <p>The package must already be installed. If the package is uninstalled while suspended
5532 * the package will no longer be suspended.
5533 *
Andrei Stingaceanueb84b182016-01-26 18:39:55 +00005534 * @param packageNames The names of the packages to set the suspended status.
5535 * @param suspended If set to {@code true} than the packages will be suspended, if set to
5536 * {@code false} the packages will be unsuspended.
Andrei Stingaceanu1e283912015-11-26 15:26:28 +00005537 * @param userId The user id.
5538 *
Andrei Stingaceanueb84b182016-01-26 18:39:55 +00005539 * @return an array of package names for which the suspended status is not set as requested in
5540 * this method.
5541 *
Andrei Stingaceanu1e283912015-11-26 15:26:28 +00005542 * @hide
5543 */
Andrei Stingaceanueb84b182016-01-26 18:39:55 +00005544 public abstract String[] setPackagesSuspendedAsUser(
5545 String[] packageNames, boolean suspended, @UserIdInt int userId);
Andrei Stingaceanu1e283912015-11-26 15:26:28 +00005546
Andrei Stingaceanu355b2322016-02-12 16:43:51 +00005547 /**
5548 * @see #setPackageSuspendedAsUser(String, boolean, int)
5549 * @param packageName The name of the package to get the suspended status of.
5550 * @param userId The user id.
5551 * @return {@code true} if the package is suspended or {@code false} if the package is not
5552 * suspended or could not be found.
5553 * @hide
5554 */
5555 public abstract boolean isPackageSuspendedForUser(String packageName, int userId);
5556
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -07005557 /** {@hide} */
Jeff Sharkey620b32b2015-04-23 19:36:02 -07005558 public static boolean isMoveStatusFinished(int status) {
5559 return (status < 0 || status > 100);
5560 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005561
Jeff Sharkeye2d45be2015-04-15 17:14:12 -07005562 /** {@hide} */
Jeff Sharkey620b32b2015-04-23 19:36:02 -07005563 public static abstract class MoveCallback {
Jeff Sharkey50a05452015-04-29 11:24:52 -07005564 public void onCreated(int moveId, Bundle extras) {}
5565 public abstract void onStatusChanged(int moveId, int status, long estMillis);
Jeff Sharkey620b32b2015-04-23 19:36:02 -07005566 }
Jeff Sharkeye2d45be2015-04-15 17:14:12 -07005567
5568 /** {@hide} */
Jeff Sharkey620b32b2015-04-23 19:36:02 -07005569 public abstract int getMoveStatus(int moveId);
5570
5571 /** {@hide} */
5572 public abstract void registerMoveCallback(MoveCallback callback, Handler handler);
5573 /** {@hide} */
5574 public abstract void unregisterMoveCallback(MoveCallback callback);
5575
5576 /** {@hide} */
5577 public abstract int movePackage(String packageName, VolumeInfo vol);
5578 /** {@hide} */
5579 public abstract @Nullable VolumeInfo getPackageCurrentVolume(ApplicationInfo app);
5580 /** {@hide} */
5581 public abstract @NonNull List<VolumeInfo> getPackageCandidateVolumes(ApplicationInfo app);
5582
5583 /** {@hide} */
5584 public abstract int movePrimaryStorage(VolumeInfo vol);
5585 /** {@hide} */
5586 public abstract @Nullable VolumeInfo getPrimaryStorageCurrentVolume();
5587 /** {@hide} */
5588 public abstract @NonNull List<VolumeInfo> getPrimaryStorageCandidateVolumes();
Jeff Sharkeye2d45be2015-04-15 17:14:12 -07005589
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005590 /**
Amith Yamasani13593602012-03-22 16:16:17 -07005591 * Returns the device identity that verifiers can use to associate their scheme to a particular
5592 * device. This should not be used by anything other than a package verifier.
Aravind Akella068b0c02013-10-12 17:39:15 -07005593 *
Kenny Root0aaa0d92011-09-12 16:42:55 -07005594 * @return identity that uniquely identifies current device
5595 * @hide
5596 */
5597 public abstract VerifierDeviceIdentity getVerifierDeviceIdentity();
Amith Yamasani742a6712011-05-04 14:49:28 -07005598
Jeff Sharkey6c833e02014-07-14 22:44:30 -07005599 /**
Jeff Hao9f60c082014-10-28 18:51:07 -07005600 * Returns true if the device is upgrading, such as first boot after OTA.
5601 *
5602 * @hide
5603 */
5604 public abstract boolean isUpgrade();
5605
5606 /**
Jeff Sharkey6c833e02014-07-14 22:44:30 -07005607 * Return interface that offers the ability to install, upgrade, and remove
5608 * applications on the device.
5609 */
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005610 public abstract @NonNull PackageInstaller getPackageInstaller();
Jeff Sharkey3a44f3f2014-04-28 17:36:31 -07005611
Amith Yamasani742a6712011-05-04 14:49:28 -07005612 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005613 * Adds a {@code CrossProfileIntentFilter}. After calling this method all
5614 * intents sent from the user with id sourceUserId can also be be resolved
5615 * by activities in the user with id targetUserId if they match the
5616 * specified intent filter.
5617 *
Nicolas Prevot3f7777f2014-07-24 15:58:39 +01005618 * @param filter The {@link IntentFilter} the intent has to match
5619 * @param sourceUserId The source user id.
5620 * @param targetUserId The target user id.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005621 * @param flags The possible values are {@link #SKIP_CURRENT_PROFILE} and
5622 * {@link #ONLY_IF_NO_MATCH_FOUND}.
Nicolas Prevotc79586e2014-05-06 12:47:57 +01005623 * @hide
5624 */
Nicolas Prevot63798c52014-05-27 13:22:38 +01005625 public abstract void addCrossProfileIntentFilter(IntentFilter filter, int sourceUserId,
5626 int targetUserId, int flags);
Nicolas Prevotc79586e2014-05-06 12:47:57 +01005627
5628 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005629 * Clearing {@code CrossProfileIntentFilter}s which have the specified user
5630 * as their source, and have been set by the app calling this method.
5631 *
Nicolas Prevot3f7777f2014-07-24 15:58:39 +01005632 * @param sourceUserId The source user id.
Nicolas Prevotc79586e2014-05-06 12:47:57 +01005633 * @hide
5634 */
Nicolas Prevot81948992014-05-16 18:25:26 +01005635 public abstract void clearCrossProfileIntentFilters(int sourceUserId);
Alexandra Gherghina6e2ae252014-06-12 16:03:58 +01005636
5637 /**
Nicolas Prevot88cc3462014-05-14 14:51:48 +01005638 * @hide
5639 */
Nicolas Prevot7f7b0c72014-06-23 15:59:38 +01005640 public abstract Drawable loadItemIcon(PackageItemInfo itemInfo, ApplicationInfo appInfo);
Jeff Sharkey6c833e02014-07-14 22:44:30 -07005641
Benjamin Franzec2d48b2014-10-01 15:38:43 +01005642 /**
5643 * @hide
5644 */
5645 public abstract Drawable loadUnbadgedItemIcon(PackageItemInfo itemInfo, ApplicationInfo appInfo);
5646
Jeff Sharkey6c833e02014-07-14 22:44:30 -07005647 /** {@hide} */
5648 public abstract boolean isPackageAvailable(String packageName);
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005649
5650 /** {@hide} */
Jeff Sharkeya0907432014-08-15 10:23:11 -07005651 public static String installStatusToString(int status, String msg) {
5652 final String str = installStatusToString(status);
5653 if (msg != null) {
5654 return str + ": " + msg;
5655 } else {
5656 return str;
5657 }
5658 }
5659
5660 /** {@hide} */
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005661 public static String installStatusToString(int status) {
5662 switch (status) {
5663 case INSTALL_SUCCEEDED: return "INSTALL_SUCCEEDED";
5664 case INSTALL_FAILED_ALREADY_EXISTS: return "INSTALL_FAILED_ALREADY_EXISTS";
5665 case INSTALL_FAILED_INVALID_APK: return "INSTALL_FAILED_INVALID_APK";
5666 case INSTALL_FAILED_INVALID_URI: return "INSTALL_FAILED_INVALID_URI";
5667 case INSTALL_FAILED_INSUFFICIENT_STORAGE: return "INSTALL_FAILED_INSUFFICIENT_STORAGE";
5668 case INSTALL_FAILED_DUPLICATE_PACKAGE: return "INSTALL_FAILED_DUPLICATE_PACKAGE";
5669 case INSTALL_FAILED_NO_SHARED_USER: return "INSTALL_FAILED_NO_SHARED_USER";
5670 case INSTALL_FAILED_UPDATE_INCOMPATIBLE: return "INSTALL_FAILED_UPDATE_INCOMPATIBLE";
5671 case INSTALL_FAILED_SHARED_USER_INCOMPATIBLE: return "INSTALL_FAILED_SHARED_USER_INCOMPATIBLE";
5672 case INSTALL_FAILED_MISSING_SHARED_LIBRARY: return "INSTALL_FAILED_MISSING_SHARED_LIBRARY";
5673 case INSTALL_FAILED_REPLACE_COULDNT_DELETE: return "INSTALL_FAILED_REPLACE_COULDNT_DELETE";
5674 case INSTALL_FAILED_DEXOPT: return "INSTALL_FAILED_DEXOPT";
5675 case INSTALL_FAILED_OLDER_SDK: return "INSTALL_FAILED_OLDER_SDK";
5676 case INSTALL_FAILED_CONFLICTING_PROVIDER: return "INSTALL_FAILED_CONFLICTING_PROVIDER";
5677 case INSTALL_FAILED_NEWER_SDK: return "INSTALL_FAILED_NEWER_SDK";
5678 case INSTALL_FAILED_TEST_ONLY: return "INSTALL_FAILED_TEST_ONLY";
5679 case INSTALL_FAILED_CPU_ABI_INCOMPATIBLE: return "INSTALL_FAILED_CPU_ABI_INCOMPATIBLE";
5680 case INSTALL_FAILED_MISSING_FEATURE: return "INSTALL_FAILED_MISSING_FEATURE";
5681 case INSTALL_FAILED_CONTAINER_ERROR: return "INSTALL_FAILED_CONTAINER_ERROR";
5682 case INSTALL_FAILED_INVALID_INSTALL_LOCATION: return "INSTALL_FAILED_INVALID_INSTALL_LOCATION";
5683 case INSTALL_FAILED_MEDIA_UNAVAILABLE: return "INSTALL_FAILED_MEDIA_UNAVAILABLE";
5684 case INSTALL_FAILED_VERIFICATION_TIMEOUT: return "INSTALL_FAILED_VERIFICATION_TIMEOUT";
5685 case INSTALL_FAILED_VERIFICATION_FAILURE: return "INSTALL_FAILED_VERIFICATION_FAILURE";
5686 case INSTALL_FAILED_PACKAGE_CHANGED: return "INSTALL_FAILED_PACKAGE_CHANGED";
5687 case INSTALL_FAILED_UID_CHANGED: return "INSTALL_FAILED_UID_CHANGED";
5688 case INSTALL_FAILED_VERSION_DOWNGRADE: return "INSTALL_FAILED_VERSION_DOWNGRADE";
5689 case INSTALL_PARSE_FAILED_NOT_APK: return "INSTALL_PARSE_FAILED_NOT_APK";
5690 case INSTALL_PARSE_FAILED_BAD_MANIFEST: return "INSTALL_PARSE_FAILED_BAD_MANIFEST";
5691 case INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION: return "INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION";
5692 case INSTALL_PARSE_FAILED_NO_CERTIFICATES: return "INSTALL_PARSE_FAILED_NO_CERTIFICATES";
5693 case INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES: return "INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES";
5694 case INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING: return "INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING";
5695 case INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME: return "INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME";
5696 case INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID: return "INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID";
5697 case INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: return "INSTALL_PARSE_FAILED_MANIFEST_MALFORMED";
5698 case INSTALL_PARSE_FAILED_MANIFEST_EMPTY: return "INSTALL_PARSE_FAILED_MANIFEST_EMPTY";
5699 case INSTALL_FAILED_INTERNAL_ERROR: return "INSTALL_FAILED_INTERNAL_ERROR";
5700 case INSTALL_FAILED_USER_RESTRICTED: return "INSTALL_FAILED_USER_RESTRICTED";
5701 case INSTALL_FAILED_DUPLICATE_PERMISSION: return "INSTALL_FAILED_DUPLICATE_PERMISSION";
5702 case INSTALL_FAILED_NO_MATCHING_ABIS: return "INSTALL_FAILED_NO_MATCHING_ABIS";
Jeff Sharkeyf0600952014-08-07 17:31:53 -07005703 case INSTALL_FAILED_ABORTED: return "INSTALL_FAILED_ABORTED";
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005704 default: return Integer.toString(status);
5705 }
5706 }
5707
5708 /** {@hide} */
Jeff Sharkeya0907432014-08-15 10:23:11 -07005709 public static int installStatusToPublicStatus(int status) {
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005710 switch (status) {
Jeff Sharkeya0907432014-08-15 10:23:11 -07005711 case INSTALL_SUCCEEDED: return PackageInstaller.STATUS_SUCCESS;
5712 case INSTALL_FAILED_ALREADY_EXISTS: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5713 case INSTALL_FAILED_INVALID_APK: return PackageInstaller.STATUS_FAILURE_INVALID;
5714 case INSTALL_FAILED_INVALID_URI: return PackageInstaller.STATUS_FAILURE_INVALID;
5715 case INSTALL_FAILED_INSUFFICIENT_STORAGE: return PackageInstaller.STATUS_FAILURE_STORAGE;
5716 case INSTALL_FAILED_DUPLICATE_PACKAGE: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5717 case INSTALL_FAILED_NO_SHARED_USER: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5718 case INSTALL_FAILED_UPDATE_INCOMPATIBLE: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5719 case INSTALL_FAILED_SHARED_USER_INCOMPATIBLE: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5720 case INSTALL_FAILED_MISSING_SHARED_LIBRARY: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5721 case INSTALL_FAILED_REPLACE_COULDNT_DELETE: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5722 case INSTALL_FAILED_DEXOPT: return PackageInstaller.STATUS_FAILURE_INVALID;
5723 case INSTALL_FAILED_OLDER_SDK: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5724 case INSTALL_FAILED_CONFLICTING_PROVIDER: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5725 case INSTALL_FAILED_NEWER_SDK: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5726 case INSTALL_FAILED_TEST_ONLY: return PackageInstaller.STATUS_FAILURE_INVALID;
5727 case INSTALL_FAILED_CPU_ABI_INCOMPATIBLE: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5728 case INSTALL_FAILED_MISSING_FEATURE: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5729 case INSTALL_FAILED_CONTAINER_ERROR: return PackageInstaller.STATUS_FAILURE_STORAGE;
5730 case INSTALL_FAILED_INVALID_INSTALL_LOCATION: return PackageInstaller.STATUS_FAILURE_STORAGE;
5731 case INSTALL_FAILED_MEDIA_UNAVAILABLE: return PackageInstaller.STATUS_FAILURE_STORAGE;
5732 case INSTALL_FAILED_VERIFICATION_TIMEOUT: return PackageInstaller.STATUS_FAILURE_ABORTED;
5733 case INSTALL_FAILED_VERIFICATION_FAILURE: return PackageInstaller.STATUS_FAILURE_ABORTED;
5734 case INSTALL_FAILED_PACKAGE_CHANGED: return PackageInstaller.STATUS_FAILURE_INVALID;
5735 case INSTALL_FAILED_UID_CHANGED: return PackageInstaller.STATUS_FAILURE_INVALID;
5736 case INSTALL_FAILED_VERSION_DOWNGRADE: return PackageInstaller.STATUS_FAILURE_INVALID;
Svetoslavd9653702015-05-13 18:02:46 -07005737 case INSTALL_FAILED_PERMISSION_MODEL_DOWNGRADE: return PackageInstaller.STATUS_FAILURE_INVALID;
Jeff Sharkeya0907432014-08-15 10:23:11 -07005738 case INSTALL_PARSE_FAILED_NOT_APK: return PackageInstaller.STATUS_FAILURE_INVALID;
5739 case INSTALL_PARSE_FAILED_BAD_MANIFEST: return PackageInstaller.STATUS_FAILURE_INVALID;
5740 case INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION: return PackageInstaller.STATUS_FAILURE_INVALID;
5741 case INSTALL_PARSE_FAILED_NO_CERTIFICATES: return PackageInstaller.STATUS_FAILURE_INVALID;
5742 case INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES: return PackageInstaller.STATUS_FAILURE_INVALID;
5743 case INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING: return PackageInstaller.STATUS_FAILURE_INVALID;
5744 case INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME: return PackageInstaller.STATUS_FAILURE_INVALID;
5745 case INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID: return PackageInstaller.STATUS_FAILURE_INVALID;
5746 case INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: return PackageInstaller.STATUS_FAILURE_INVALID;
5747 case INSTALL_PARSE_FAILED_MANIFEST_EMPTY: return PackageInstaller.STATUS_FAILURE_INVALID;
5748 case INSTALL_FAILED_INTERNAL_ERROR: return PackageInstaller.STATUS_FAILURE;
5749 case INSTALL_FAILED_USER_RESTRICTED: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5750 case INSTALL_FAILED_DUPLICATE_PERMISSION: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5751 case INSTALL_FAILED_NO_MATCHING_ABIS: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5752 case INSTALL_FAILED_ABORTED: return PackageInstaller.STATUS_FAILURE_ABORTED;
5753 default: return PackageInstaller.STATUS_FAILURE;
5754 }
5755 }
5756
5757 /** {@hide} */
5758 public static String deleteStatusToString(int status, String msg) {
5759 final String str = deleteStatusToString(status);
5760 if (msg != null) {
5761 return str + ": " + msg;
5762 } else {
5763 return str;
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005764 }
5765 }
5766
5767 /** {@hide} */
5768 public static String deleteStatusToString(int status) {
5769 switch (status) {
5770 case DELETE_SUCCEEDED: return "DELETE_SUCCEEDED";
5771 case DELETE_FAILED_INTERNAL_ERROR: return "DELETE_FAILED_INTERNAL_ERROR";
5772 case DELETE_FAILED_DEVICE_POLICY_MANAGER: return "DELETE_FAILED_DEVICE_POLICY_MANAGER";
5773 case DELETE_FAILED_USER_RESTRICTED: return "DELETE_FAILED_USER_RESTRICTED";
5774 case DELETE_FAILED_OWNER_BLOCKED: return "DELETE_FAILED_OWNER_BLOCKED";
Jeff Sharkeyf0600952014-08-07 17:31:53 -07005775 case DELETE_FAILED_ABORTED: return "DELETE_FAILED_ABORTED";
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005776 default: return Integer.toString(status);
5777 }
5778 }
Jeff Sharkeyf0600952014-08-07 17:31:53 -07005779
5780 /** {@hide} */
Jeff Sharkeya0907432014-08-15 10:23:11 -07005781 public static int deleteStatusToPublicStatus(int status) {
Jeff Sharkeyf0600952014-08-07 17:31:53 -07005782 switch (status) {
Jeff Sharkeya0907432014-08-15 10:23:11 -07005783 case DELETE_SUCCEEDED: return PackageInstaller.STATUS_SUCCESS;
5784 case DELETE_FAILED_INTERNAL_ERROR: return PackageInstaller.STATUS_FAILURE;
5785 case DELETE_FAILED_DEVICE_POLICY_MANAGER: return PackageInstaller.STATUS_FAILURE_BLOCKED;
5786 case DELETE_FAILED_USER_RESTRICTED: return PackageInstaller.STATUS_FAILURE_BLOCKED;
5787 case DELETE_FAILED_OWNER_BLOCKED: return PackageInstaller.STATUS_FAILURE_BLOCKED;
5788 case DELETE_FAILED_ABORTED: return PackageInstaller.STATUS_FAILURE_ABORTED;
5789 default: return PackageInstaller.STATUS_FAILURE;
Jeff Sharkeyf0600952014-08-07 17:31:53 -07005790 }
5791 }
Jeff Sharkey6c0b9da2014-08-07 22:07:11 -07005792
5793 /** {@hide} */
Svet Ganov77ab6a82015-07-03 12:03:02 -07005794 public static String permissionFlagToString(int flag) {
5795 switch (flag) {
Svetoslav4a5f4a22015-07-07 18:18:15 -07005796 case FLAG_PERMISSION_GRANTED_BY_DEFAULT: return "GRANTED_BY_DEFAULT";
5797 case FLAG_PERMISSION_POLICY_FIXED: return "POLICY_FIXED";
5798 case FLAG_PERMISSION_SYSTEM_FIXED: return "SYSTEM_FIXED";
5799 case FLAG_PERMISSION_USER_SET: return "USER_SET";
5800 case FLAG_PERMISSION_REVOKE_ON_UPGRADE: return "REVOKE_ON_UPGRADE";
5801 case FLAG_PERMISSION_USER_FIXED: return "USER_FIXED";
Svet Ganov9c165d72015-12-01 19:52:26 -08005802 case FLAG_PERMISSION_REVIEW_REQUIRED: return "REVIEW_REQUIRED";
Svet Ganov77ab6a82015-07-03 12:03:02 -07005803 default: return Integer.toString(flag);
5804 }
5805 }
5806
5807 /** {@hide} */
Jeff Sharkey6c0b9da2014-08-07 22:07:11 -07005808 public static class LegacyPackageInstallObserver extends PackageInstallObserver {
5809 private final IPackageInstallObserver mLegacy;
5810
5811 public LegacyPackageInstallObserver(IPackageInstallObserver legacy) {
5812 mLegacy = legacy;
5813 }
5814
5815 @Override
5816 public void onPackageInstalled(String basePackageName, int returnCode, String msg,
5817 Bundle extras) {
5818 if (mLegacy == null) return;
5819 try {
5820 mLegacy.packageInstalled(basePackageName, returnCode);
5821 } catch (RemoteException ignored) {
5822 }
5823 }
5824 }
5825
5826 /** {@hide} */
5827 public static class LegacyPackageDeleteObserver extends PackageDeleteObserver {
5828 private final IPackageDeleteObserver mLegacy;
5829
5830 public LegacyPackageDeleteObserver(IPackageDeleteObserver legacy) {
5831 mLegacy = legacy;
5832 }
5833
5834 @Override
5835 public void onPackageDeleted(String basePackageName, int returnCode, String msg) {
5836 if (mLegacy == null) return;
5837 try {
5838 mLegacy.packageDeleted(basePackageName, returnCode);
5839 } catch (RemoteException ignored) {
5840 }
5841 }
5842 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005843}