blob: 33ee510f14266d56b32e27d11eb264adaeda930c [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 Sharkeyb2b9ab82015-04-05 21:10:42 -070051import android.os.storage.VolumeInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080052import android.util.AndroidException;
Jeff Sharkeybd940222016-01-08 11:07:13 -070053import android.util.Log;
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -070054
Svetoslavc6d1c342015-02-26 14:44:43 -080055import com.android.internal.util.ArrayUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080056
57import java.io.File;
Tor Norbyed9273d62013-05-30 15:59:53 -070058import java.lang.annotation.Retention;
59import java.lang.annotation.RetentionPolicy;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080060import java.util.List;
61
62/**
63 * Class for retrieving various kinds of information related to the application
64 * packages that are currently installed on the device.
65 *
66 * You can find this class through {@link Context#getPackageManager}.
67 */
68public abstract class PackageManager {
Jeff Sharkeybd940222016-01-08 11:07:13 -070069 private static final String TAG = "PackageManager";
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080070
Jeff Sharkeye4697132016-02-06 19:46:15 -070071 /** {@hide} */
72 public static final boolean APPLY_FORCE_DEVICE_ENCRYPTED = true;
73
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080074 /**
75 * This exception is thrown when a given package, application, or component
kmccormick30498b42013-03-27 17:39:17 -070076 * name cannot be found.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080077 */
78 public static class NameNotFoundException extends AndroidException {
79 public NameNotFoundException() {
80 }
81
82 public NameNotFoundException(String name) {
83 super(name);
84 }
85 }
86
87 /**
Svetoslavf7c06eb2015-06-10 18:43:22 -070088 * Listener for changes in permissions granted to a UID.
89 *
90 * @hide
91 */
92 @SystemApi
93 public interface OnPermissionsChangedListener {
94
95 /**
96 * Called when the permissions for a UID change.
97 * @param uid The UID with a change.
98 */
99 public void onPermissionsChanged(int uid);
100 }
101
102 /**
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700103 * As a guiding principle:
104 * <p>
105 * {@code GET_} flags are used to request additional data that may have been
106 * elided to save wire space.
107 * <p>
108 * {@code MATCH_} flags are used to include components or packages that
109 * would have otherwise been omitted from a result set by current system
110 * state.
111 */
112
113 /** @hide */
114 @IntDef(flag = true, value = {
115 GET_ACTIVITIES,
Todd Kennedy6b9bfa12016-01-08 13:44:51 -0800116 GET_CONFIGURATIONS,
117 GET_GIDS,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700118 GET_INSTRUMENTATION,
119 GET_INTENT_FILTERS,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700120 GET_META_DATA,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700121 GET_PERMISSIONS,
Todd Kennedy6b9bfa12016-01-08 13:44:51 -0800122 GET_PROVIDERS,
123 GET_RECEIVERS,
124 GET_SERVICES,
125 GET_SHARED_LIBRARY_FILES,
126 GET_SIGNATURES,
127 GET_URI_PERMISSION_PATTERNS,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700128 MATCH_UNINSTALLED_PACKAGES,
129 MATCH_DISABLED_COMPONENTS,
130 MATCH_DISABLED_UNTIL_USED_COMPONENTS,
Jeff Sharkeyc5967e92016-01-07 18:50:29 -0700131 MATCH_SYSTEM_ONLY,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700132 MATCH_DEBUG_TRIAGED_MISSING,
133 })
134 @Retention(RetentionPolicy.SOURCE)
135 public @interface PackageInfoFlags {}
136
137 /** @hide */
138 @IntDef(flag = true, value = {
139 GET_META_DATA,
140 GET_SHARED_LIBRARY_FILES,
141 MATCH_UNINSTALLED_PACKAGES,
142 MATCH_SYSTEM_ONLY,
143 MATCH_DEBUG_TRIAGED_MISSING,
144 })
145 @Retention(RetentionPolicy.SOURCE)
146 public @interface ApplicationInfoFlags {}
147
148 /** @hide */
149 @IntDef(flag = true, value = {
150 GET_META_DATA,
151 GET_SHARED_LIBRARY_FILES,
Todd Kennedy6b9bfa12016-01-08 13:44:51 -0800152 MATCH_ALL,
153 MATCH_DEBUG_TRIAGED_MISSING,
154 MATCH_DEFAULT_ONLY,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700155 MATCH_DISABLED_COMPONENTS,
156 MATCH_DISABLED_UNTIL_USED_COMPONENTS,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700157 MATCH_ENCRYPTION_AWARE,
158 MATCH_ENCRYPTION_AWARE_AND_UNAWARE,
159 MATCH_ENCRYPTION_UNAWARE,
160 MATCH_SYSTEM_ONLY,
Todd Kennedy6b9bfa12016-01-08 13:44:51 -0800161 MATCH_UNINSTALLED_PACKAGES,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700162 })
163 @Retention(RetentionPolicy.SOURCE)
164 public @interface ComponentInfoFlags {}
165
166 /** @hide */
167 @IntDef(flag = true, value = {
168 GET_META_DATA,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700169 GET_RESOLVED_FILTER,
Todd Kennedy6b9bfa12016-01-08 13:44:51 -0800170 GET_SHARED_LIBRARY_FILES,
171 MATCH_ALL,
172 MATCH_DEBUG_TRIAGED_MISSING,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700173 MATCH_DISABLED_COMPONENTS,
174 MATCH_DISABLED_UNTIL_USED_COMPONENTS,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700175 MATCH_DEFAULT_ONLY,
176 MATCH_ENCRYPTION_AWARE,
177 MATCH_ENCRYPTION_AWARE_AND_UNAWARE,
178 MATCH_ENCRYPTION_UNAWARE,
179 MATCH_SYSTEM_ONLY,
Todd Kennedy6b9bfa12016-01-08 13:44:51 -0800180 MATCH_UNINSTALLED_PACKAGES,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700181 })
182 @Retention(RetentionPolicy.SOURCE)
183 public @interface ResolveInfoFlags {}
184
185 /** @hide */
186 @IntDef(flag = true, value = {
187 GET_META_DATA,
188 })
189 @Retention(RetentionPolicy.SOURCE)
190 public @interface PermissionInfoFlags {}
191
192 /** @hide */
193 @IntDef(flag = true, value = {
194 GET_META_DATA,
195 })
196 @Retention(RetentionPolicy.SOURCE)
197 public @interface PermissionGroupInfoFlags {}
198
199 /** @hide */
200 @IntDef(flag = true, value = {
201 GET_META_DATA,
202 })
203 @Retention(RetentionPolicy.SOURCE)
204 public @interface InstrumentationInfoFlags {}
205
206 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800207 * {@link PackageInfo} flag: return information about
208 * activities in the package in {@link PackageInfo#activities}.
209 */
210 public static final int GET_ACTIVITIES = 0x00000001;
211
212 /**
213 * {@link PackageInfo} flag: return information about
214 * intent receivers in the package in
215 * {@link PackageInfo#receivers}.
216 */
217 public static final int GET_RECEIVERS = 0x00000002;
218
219 /**
220 * {@link PackageInfo} flag: return information about
221 * services in the package in {@link PackageInfo#services}.
222 */
223 public static final int GET_SERVICES = 0x00000004;
224
225 /**
226 * {@link PackageInfo} flag: return information about
227 * content providers in the package in
228 * {@link PackageInfo#providers}.
229 */
230 public static final int GET_PROVIDERS = 0x00000008;
231
232 /**
233 * {@link PackageInfo} flag: return information about
234 * instrumentation in the package in
235 * {@link PackageInfo#instrumentation}.
236 */
237 public static final int GET_INSTRUMENTATION = 0x00000010;
238
239 /**
240 * {@link PackageInfo} flag: return information about the
241 * intent filters supported by the activity.
242 */
243 public static final int GET_INTENT_FILTERS = 0x00000020;
244
245 /**
246 * {@link PackageInfo} flag: return information about the
247 * signatures included in the package.
248 */
249 public static final int GET_SIGNATURES = 0x00000040;
250
251 /**
252 * {@link ResolveInfo} flag: return the IntentFilter that
253 * was matched for a particular ResolveInfo in
254 * {@link ResolveInfo#filter}.
255 */
256 public static final int GET_RESOLVED_FILTER = 0x00000040;
257
258 /**
259 * {@link ComponentInfo} flag: return the {@link ComponentInfo#metaData}
260 * data {@link android.os.Bundle}s that are associated with a component.
261 * This applies for any API returning a ComponentInfo subclass.
262 */
263 public static final int GET_META_DATA = 0x00000080;
264
265 /**
266 * {@link PackageInfo} flag: return the
267 * {@link PackageInfo#gids group ids} that are associated with an
268 * application.
Ken Wakasaf76a50c2012-03-09 19:56:35 +0900269 * This applies for any API returning a PackageInfo class, either
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800270 * directly or nested inside of another.
271 */
272 public static final int GET_GIDS = 0x00000100;
273
274 /**
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700275 * @deprecated replaced with {@link #MATCH_DISABLED_COMPONENTS}
276 */
277 @Deprecated
278 public static final int GET_DISABLED_COMPONENTS = 0x00000200;
279
280 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800281 * {@link PackageInfo} flag: include disabled components in the returned info.
282 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700283 public static final int MATCH_DISABLED_COMPONENTS = 0x00000200;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800284
285 /**
286 * {@link ApplicationInfo} flag: return the
287 * {@link ApplicationInfo#sharedLibraryFiles paths to the shared libraries}
288 * that are associated with an application.
289 * This applies for any API returning an ApplicationInfo class, either
290 * directly or nested inside of another.
291 */
292 public static final int GET_SHARED_LIBRARY_FILES = 0x00000400;
293
294 /**
295 * {@link ProviderInfo} flag: return the
296 * {@link ProviderInfo#uriPermissionPatterns URI permission patterns}
297 * that are associated with a content provider.
Ken Wakasaf76a50c2012-03-09 19:56:35 +0900298 * This applies for any API returning a ProviderInfo class, either
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800299 * directly or nested inside of another.
300 */
301 public static final int GET_URI_PERMISSION_PATTERNS = 0x00000800;
302 /**
303 * {@link PackageInfo} flag: return information about
304 * permissions in the package in
305 * {@link PackageInfo#permissions}.
306 */
307 public static final int GET_PERMISSIONS = 0x00001000;
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700308
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800309 /**
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700310 * @deprecated replaced with {@link #MATCH_UNINSTALLED_PACKAGES}
311 */
312 @Deprecated
313 public static final int GET_UNINSTALLED_PACKAGES = 0x00002000;
314
315 /**
Kenny Root685f4902011-11-03 10:13:29 -0700316 * Flag parameter to retrieve some information about all applications (even
317 * uninstalled ones) which have data directories. This state could have
318 * resulted if applications have been deleted with flag
319 * {@code DONT_DELETE_DATA} with a possibility of being replaced or
320 * reinstalled in future.
321 * <p>
322 * Note: this flag may cause less information about currently installed
323 * applications to be returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800324 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700325 public static final int MATCH_UNINSTALLED_PACKAGES = 0x00002000;
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700326
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800327 /**
328 * {@link PackageInfo} flag: return information about
Dianne Hackborn49237342009-08-27 20:08:01 -0700329 * hardware preferences in
Adam Lesinskid3edfde2014-08-08 17:32:44 -0700330 * {@link PackageInfo#configPreferences PackageInfo.configPreferences},
331 * and requested features in {@link PackageInfo#reqFeatures} and
332 * {@link PackageInfo#featureGroups}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800333 */
334 public static final int GET_CONFIGURATIONS = 0x00004000;
335
336 /**
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700337 * @deprecated replaced with {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}.
338 */
339 @Deprecated
340 public static final int GET_DISABLED_UNTIL_USED_COMPONENTS = 0x00008000;
341
342 /**
Dianne Hackbornfd7aded2013-01-22 17:10:23 -0800343 * {@link PackageInfo} flag: include disabled components which are in
344 * that state only because of {@link #COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED}
345 * in the returned info. Note that if you set this flag, applications
346 * that are in this disabled state will be reported as enabled.
347 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700348 public static final int MATCH_DISABLED_UNTIL_USED_COMPONENTS = 0x00008000;
Dianne Hackbornfd7aded2013-01-22 17:10:23 -0800349
350 /**
Dianne Hackborn1655be42009-05-08 14:29:01 -0700351 * Resolution and querying flag: if set, only filters that support the
352 * {@link android.content.Intent#CATEGORY_DEFAULT} will be considered for
353 * matching. This is a synonym for including the CATEGORY_DEFAULT in your
354 * supplied Intent.
355 */
Fabrice Di Meglio9f7e39f2015-04-10 20:40:16 -0700356 public static final int MATCH_DEFAULT_ONLY = 0x00010000;
357
358 /**
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700359 * Querying flag: if set and if the platform is doing any filtering of the
360 * results, then the filtering will not happen. This is a synonym for saying
361 * that all results should be returned.
362 * <p>
363 * <em>This flag should be used with extreme care.</em>
Fabrice Di Meglio9f7e39f2015-04-10 20:40:16 -0700364 */
365 public static final int MATCH_ALL = 0x00020000;
Dianne Hackborn1655be42009-05-08 14:29:01 -0700366
Nicolas Prevot63798c52014-05-27 13:22:38 +0100367 /**
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700368 * Querying flag: include only components which are encryption unaware in
369 * the returned info, regardless of the current user state.
Jeff Sharkeye17ac152015-11-06 22:40:29 -0800370 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700371 public static final int MATCH_ENCRYPTION_UNAWARE = 0x00040000;
Jeff Sharkeye17ac152015-11-06 22:40:29 -0800372
373 /**
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700374 * Querying flag: include only components which are encryption aware in the
375 * returned info, regardless of the current user state.
Jeff Sharkey2a9e3f82015-12-18 10:57:58 -0700376 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700377 public static final int MATCH_ENCRYPTION_AWARE = 0x00080000;
Jeff Sharkey2a9e3f82015-12-18 10:57:58 -0700378
379 /**
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700380 * Querying flag: include both encryption aware and unaware components in
381 * the returned info, regardless of the current user state.
Jeff Sharkey2a9e3f82015-12-18 10:57:58 -0700382 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700383 public static final int MATCH_ENCRYPTION_AWARE_AND_UNAWARE = MATCH_ENCRYPTION_AWARE
384 | MATCH_ENCRYPTION_UNAWARE;
Jeff Sharkey2a9e3f82015-12-18 10:57:58 -0700385
386 /**
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700387 * Querying flag: include only components from applications that are marked
388 * with {@link ApplicationInfo#FLAG_SYSTEM}.
Jeff Sharkey5217cac2015-12-20 15:34:01 -0700389 */
390 public static final int MATCH_SYSTEM_ONLY = 0x00100000;
391
392 /**
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700393 * Internal flag used to indicate that a system component has done their
394 * homework and verified that they correctly handle packages and components
395 * that come and go over time. In particular:
396 * <ul>
397 * <li>Apps installed on external storage, which will appear to be
398 * uninstalled while the the device is ejected.
399 * <li>Apps with encryption unaware components, which will appear to not
400 * exist while the device is locked.
401 * </ul>
Jeff Sharkeye17ac152015-11-06 22:40:29 -0800402 *
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700403 * @see #MATCH_UNINSTALLED_PACKAGES
404 * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE
Jeff Sharkeye17ac152015-11-06 22:40:29 -0800405 * @hide
406 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700407 public static final int MATCH_DEBUG_TRIAGED_MISSING = 0x10000000;
Jeff Sharkeye17ac152015-11-06 22:40:29 -0800408
409 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700410 * Flag for {@link #addCrossProfileIntentFilter}: if this flag is set: when
411 * resolving an intent that matches the {@code CrossProfileIntentFilter},
412 * the current profile will be skipped. Only activities in the target user
413 * can respond to the intent.
414 *
Nicolas Prevot63798c52014-05-27 13:22:38 +0100415 * @hide
416 */
417 public static final int SKIP_CURRENT_PROFILE = 0x00000002;
418
Tony Mak807e01c2015-12-01 20:19:03 +0000419 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700420 * Flag for {@link #addCrossProfileIntentFilter}: if this flag is set:
Tony Mak807e01c2015-12-01 20:19:03 +0000421 * activities in the other profiles can respond to the intent only if no activity with
422 * non-negative priority in current profile can respond to the intent.
423 * @hide
424 */
425 public static final int ONLY_IF_NO_MATCH_FOUND = 0x00000004;
426
Tor Norbyed9273d62013-05-30 15:59:53 -0700427 /** @hide */
428 @IntDef({PERMISSION_GRANTED, PERMISSION_DENIED})
429 @Retention(RetentionPolicy.SOURCE)
430 public @interface PermissionResult {}
431
Dianne Hackborn1655be42009-05-08 14:29:01 -0700432 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800433 * Permission check result: this is returned by {@link #checkPermission}
434 * if the permission has been granted to the given package.
435 */
436 public static final int PERMISSION_GRANTED = 0;
437
438 /**
439 * Permission check result: this is returned by {@link #checkPermission}
440 * if the permission has not been granted to the given package.
441 */
442 public static final int PERMISSION_DENIED = -1;
443
444 /**
445 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700446 * if all signatures on the two packages match.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800447 */
448 public static final int SIGNATURE_MATCH = 0;
449
450 /**
451 * Signature check result: this is returned by {@link #checkSignatures}
452 * if neither of the two packages is signed.
453 */
454 public static final int SIGNATURE_NEITHER_SIGNED = 1;
455
456 /**
457 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700458 * if the first package is not signed but the second is.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800459 */
460 public static final int SIGNATURE_FIRST_NOT_SIGNED = -1;
461
462 /**
463 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700464 * if the second package is not signed but the first is.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800465 */
466 public static final int SIGNATURE_SECOND_NOT_SIGNED = -2;
467
468 /**
469 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700470 * if not all signatures on both packages match.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800471 */
472 public static final int SIGNATURE_NO_MATCH = -3;
473
474 /**
475 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700476 * if either of the packages are not valid.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800477 */
478 public static final int SIGNATURE_UNKNOWN_PACKAGE = -4;
479
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700480 /**
481 * Flag for {@link #setApplicationEnabledSetting(String, int, int)}
482 * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This
483 * component or application is in its default enabled state (as specified
484 * in its manifest).
485 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800486 public static final int COMPONENT_ENABLED_STATE_DEFAULT = 0;
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700487
488 /**
489 * Flag for {@link #setApplicationEnabledSetting(String, int, int)}
490 * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This
491 * component or application has been explictily enabled, regardless of
492 * what it has specified in its manifest.
493 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800494 public static final int COMPONENT_ENABLED_STATE_ENABLED = 1;
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700495
496 /**
497 * Flag for {@link #setApplicationEnabledSetting(String, int, int)}
498 * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This
499 * component or application has been explicitly disabled, regardless of
500 * what it has specified in its manifest.
501 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800502 public static final int COMPONENT_ENABLED_STATE_DISABLED = 2;
503
504 /**
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700505 * Flag for {@link #setApplicationEnabledSetting(String, int, int)} only: The
506 * user has explicitly disabled the application, regardless of what it has
507 * specified in its manifest. Because this is due to the user's request,
508 * they may re-enable it if desired through the appropriate system UI. This
kmccormick30498b42013-03-27 17:39:17 -0700509 * option currently <strong>cannot</strong> be used with
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700510 * {@link #setComponentEnabledSetting(ComponentName, int, int)}.
511 */
512 public static final int COMPONENT_ENABLED_STATE_DISABLED_USER = 3;
513
514 /**
Dianne Hackbornfd7aded2013-01-22 17:10:23 -0800515 * Flag for {@link #setApplicationEnabledSetting(String, int, int)} only: This
516 * application should be considered, until the point where the user actually
517 * wants to use it. This means that it will not normally show up to the user
518 * (such as in the launcher), but various parts of the user interface can
519 * use {@link #GET_DISABLED_UNTIL_USED_COMPONENTS} to still see it and allow
520 * the user to select it (as for example an IME, device admin, etc). Such code,
521 * once the user has selected the app, should at that point also make it enabled.
522 * This option currently <strong>can not</strong> be used with
523 * {@link #setComponentEnabledSetting(ComponentName, int, int)}.
524 */
525 public static final int COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED = 4;
526
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700527 /** @hide */
528 @IntDef(flag = true, value = {
529 INSTALL_FORWARD_LOCK,
530 INSTALL_REPLACE_EXISTING,
531 INSTALL_ALLOW_TEST,
532 INSTALL_EXTERNAL,
533 INSTALL_INTERNAL,
534 INSTALL_FROM_ADB,
535 INSTALL_ALL_USERS,
536 INSTALL_ALLOW_DOWNGRADE,
537 INSTALL_GRANT_RUNTIME_PERMISSIONS,
538 INSTALL_FORCE_VOLUME_UUID,
539 INSTALL_FORCE_PERMISSION_PROMPT,
540 INSTALL_EPHEMERAL,
541 })
542 @Retention(RetentionPolicy.SOURCE)
543 public @interface InstallFlags {}
544
Dianne Hackbornfd7aded2013-01-22 17:10:23 -0800545 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700546 * Flag parameter for {@link #installPackage} to indicate that this package
547 * should be installed as forward locked, i.e. only the app itself should
548 * have access to its code and non-resource assets.
549 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700550 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800551 */
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700552 public static final int INSTALL_FORWARD_LOCK = 0x00000001;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800553
554 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700555 * Flag parameter for {@link #installPackage} to indicate that you want to
556 * replace an already installed package, if one exists.
557 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700558 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800559 */
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700560 public static final int INSTALL_REPLACE_EXISTING = 0x00000002;
561
562 /**
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700563 * Flag parameter for {@link #installPackage} to indicate that you want to
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700564 * allow test packages (those that have set android:testOnly in their
565 * manifest) to be installed.
566 * @hide
567 */
568 public static final int INSTALL_ALLOW_TEST = 0x00000004;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800569
570 /**
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -0700571 * Flag parameter for {@link #installPackage} to indicate that this package
572 * must be installed to an ASEC on a {@link VolumeInfo#TYPE_PUBLIC}.
573 *
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800574 * @hide
575 */
Suchi Amalapurapu5b993ce2010-02-12 09:43:29 -0800576 public static final int INSTALL_EXTERNAL = 0x00000008;
Oscar Montemayor539d3c42010-01-29 15:27:00 -0800577
578 /**
Kenny Root5ab21572011-07-27 11:11:19 -0700579 * Flag parameter for {@link #installPackage} to indicate that this package
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -0700580 * must be installed to internal storage.
581 *
Kenny Root5ab21572011-07-27 11:11:19 -0700582 * @hide
583 */
584 public static final int INSTALL_INTERNAL = 0x00000010;
585
586 /**
587 * Flag parameter for {@link #installPackage} to indicate that this install
588 * was initiated via ADB.
589 *
590 * @hide
591 */
592 public static final int INSTALL_FROM_ADB = 0x00000020;
Suchi Amalapurapu14b6abd2010-03-17 08:37:04 -0700593
594 /**
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700595 * Flag parameter for {@link #installPackage} to indicate that this install
596 * should immediately be visible to all users.
597 *
598 * @hide
599 */
600 public static final int INSTALL_ALL_USERS = 0x00000040;
601
602 /**
603 * Flag parameter for {@link #installPackage} to indicate that it is okay
604 * to install an update to an app where the newly installed app has a lower
Alex Klyubin921dd752016-02-24 13:21:41 -0800605 * version code than the currently installed app. This is permitted only if
606 * the currently installed app is marked debuggable.
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700607 *
608 * @hide
609 */
610 public static final int INSTALL_ALLOW_DOWNGRADE = 0x00000080;
611
612 /**
Svet Ganov95c1ade2015-03-19 09:38:52 -0700613 * Flag parameter for {@link #installPackage} to indicate that all runtime
614 * permissions should be granted to the package. If {@link #INSTALL_ALL_USERS}
615 * is set the runtime permissions will be granted to all users, otherwise
616 * only to the owner.
617 *
618 * @hide
619 */
620 public static final int INSTALL_GRANT_RUNTIME_PERMISSIONS = 0x00000100;
621
Jeff Sharkeyab234092015-06-09 21:42:22 -0700622 /** {@hide} */
623 public static final int INSTALL_FORCE_VOLUME_UUID = 0x00000200;
624
Svet Ganov95c1ade2015-03-19 09:38:52 -0700625 /**
Todd Kennedya1d12cf2015-09-29 15:43:00 -0700626 * Flag parameter for {@link #installPackage} to indicate that we always want to force
627 * the prompt for permission approval. This overrides any special behaviour for internal
628 * components.
629 *
630 * @hide
631 */
632 public static final int INSTALL_FORCE_PERMISSION_PROMPT = 0x00000400;
633
634 /**
Todd Kennedy27c24fb2015-09-17 16:49:25 -0700635 * Flag parameter for {@link #installPackage} to indicate that this package is
Todd Kennedy2699f062015-11-20 13:07:17 -0800636 * to be installed as a lightweight "ephemeral" app.
637 *
638 * @hide
639 */
Todd Kennedy373f0b42015-12-16 14:45:14 -0800640 public static final int INSTALL_EPHEMERAL = 0x00000800;
Todd Kennedy2699f062015-11-20 13:07:17 -0800641
642 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800643 * Flag parameter for
644 * {@link #setComponentEnabledSetting(android.content.ComponentName, int, int)} to indicate
645 * that you don't want to kill the app containing the component. Be careful when you set this
646 * since changing component states can make the containing application's behavior unpredictable.
647 */
648 public static final int DONT_KILL_APP = 0x00000001;
649
650 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700651 * Installation return code: this is passed to the
652 * {@link IPackageInstallObserver} on success.
653 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700654 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800655 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700656 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800657 public static final int INSTALL_SUCCEEDED = 1;
658
659 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700660 * Installation return code: this is passed to the
661 * {@link IPackageInstallObserver} if the package is already installed.
662 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700663 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800664 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700665 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800666 public static final int INSTALL_FAILED_ALREADY_EXISTS = -1;
667
668 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700669 * Installation return code: this is passed to the
670 * {@link IPackageInstallObserver} if the package archive file is invalid.
671 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700672 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800673 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700674 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800675 public static final int INSTALL_FAILED_INVALID_APK = -2;
676
677 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700678 * Installation return code: this is passed to the
679 * {@link IPackageInstallObserver} if the URI passed in is invalid.
680 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700681 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800682 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700683 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800684 public static final int INSTALL_FAILED_INVALID_URI = -3;
685
686 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700687 * Installation return code: this is passed to the
688 * {@link IPackageInstallObserver} if the package manager service found that
689 * the device didn't have enough storage space to install the app.
690 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700691 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800692 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700693 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800694 public static final int INSTALL_FAILED_INSUFFICIENT_STORAGE = -4;
695
696 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700697 * Installation return code: this is passed to the
698 * {@link IPackageInstallObserver} if a package is already installed with
699 * the same name.
700 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700701 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800702 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700703 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800704 public static final int INSTALL_FAILED_DUPLICATE_PACKAGE = -5;
705
706 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700707 * Installation return code: this is passed to the
708 * {@link IPackageInstallObserver} if the requested shared user does not
709 * exist.
710 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700711 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800712 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700713 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800714 public static final int INSTALL_FAILED_NO_SHARED_USER = -6;
715
716 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700717 * Installation return code: this is passed to the
718 * {@link IPackageInstallObserver} if a previously installed package of the
719 * same name has a different signature than the new package (and the old
720 * package's data was not removed).
721 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700722 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800723 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700724 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800725 public static final int INSTALL_FAILED_UPDATE_INCOMPATIBLE = -7;
726
727 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700728 * Installation return code: this is passed to the
729 * {@link IPackageInstallObserver} if the new package is requested a shared
730 * user which is already installed on the device and does not have matching
731 * signature.
732 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700733 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800734 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700735 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800736 public static final int INSTALL_FAILED_SHARED_USER_INCOMPATIBLE = -8;
737
738 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700739 * Installation return code: this is passed to the
740 * {@link IPackageInstallObserver} if the new package uses a shared library
741 * that is not available.
742 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700743 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800744 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700745 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800746 public static final int INSTALL_FAILED_MISSING_SHARED_LIBRARY = -9;
747
748 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700749 * Installation return code: this is passed to the
750 * {@link IPackageInstallObserver} if the new package uses a shared library
751 * that is not available.
752 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700753 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800754 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700755 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800756 public static final int INSTALL_FAILED_REPLACE_COULDNT_DELETE = -10;
757
758 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700759 * Installation return code: this is passed to the
760 * {@link IPackageInstallObserver} if the new package failed while
761 * optimizing and validating its dex files, either because there was not
762 * enough storage or the validation failed.
763 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700764 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800765 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700766 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800767 public static final int INSTALL_FAILED_DEXOPT = -11;
768
769 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700770 * Installation return code: this is passed to the
771 * {@link IPackageInstallObserver} if the new package failed because the
772 * current SDK version is older than that required by the package.
773 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700774 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800775 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700776 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800777 public static final int INSTALL_FAILED_OLDER_SDK = -12;
778
779 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700780 * Installation return code: this is passed to the
781 * {@link IPackageInstallObserver} if the new package failed because it
782 * contains a content provider with the same authority as a provider already
783 * installed in the system.
784 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700785 * @hide
The Android Open Source Project10592532009-03-18 17:39:46 -0700786 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700787 @SystemApi
The Android Open Source Project10592532009-03-18 17:39:46 -0700788 public static final int INSTALL_FAILED_CONFLICTING_PROVIDER = -13;
789
790 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700791 * Installation return code: this is passed to the
792 * {@link IPackageInstallObserver} if the new package failed because the
793 * current SDK version is newer than that required by the package.
794 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700795 * @hide
Dianne Hackborn851a5412009-05-08 12:06:44 -0700796 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700797 @SystemApi
Dianne Hackborn851a5412009-05-08 12:06:44 -0700798 public static final int INSTALL_FAILED_NEWER_SDK = -14;
799
800 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700801 * Installation return code: this is passed to the
802 * {@link IPackageInstallObserver} if the new package failed because it has
803 * specified that it is a test-only package and the caller has not supplied
804 * the {@link #INSTALL_ALLOW_TEST} flag.
805 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700806 * @hide
807 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700808 @SystemApi
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700809 public static final int INSTALL_FAILED_TEST_ONLY = -15;
810
811 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700812 * Installation return code: this is passed to the
813 * {@link IPackageInstallObserver} if the package being installed contains
814 * native code, but none that is compatible with the device's CPU_ABI.
815 *
Dianne Hackbornb1811182009-05-21 15:45:42 -0700816 * @hide
817 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700818 @SystemApi
Dianne Hackbornb1811182009-05-21 15:45:42 -0700819 public static final int INSTALL_FAILED_CPU_ABI_INCOMPATIBLE = -16;
820
821 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700822 * Installation return code: this is passed to the
823 * {@link IPackageInstallObserver} if the new package uses a feature that is
824 * not available.
825 *
Dianne Hackborn49237342009-08-27 20:08:01 -0700826 * @hide
827 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700828 @SystemApi
Dianne Hackborn49237342009-08-27 20:08:01 -0700829 public static final int INSTALL_FAILED_MISSING_FEATURE = -17;
830
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800831 // ------ Errors related to sdcard
832 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700833 * Installation return code: this is passed to the
834 * {@link IPackageInstallObserver} if a secure container mount point
835 * couldn't be accessed on external media.
836 *
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800837 * @hide
838 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700839 @SystemApi
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800840 public static final int INSTALL_FAILED_CONTAINER_ERROR = -18;
841
Dianne Hackborn49237342009-08-27 20:08:01 -0700842 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700843 * Installation return code: this is passed to the
844 * {@link IPackageInstallObserver} if the new package couldn't be installed
845 * in the specified install location.
846 *
Suchi Amalapurapub56ae202010-02-04 22:51:07 -0800847 * @hide
848 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700849 @SystemApi
Suchi Amalapurapub56ae202010-02-04 22:51:07 -0800850 public static final int INSTALL_FAILED_INVALID_INSTALL_LOCATION = -19;
851
852 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700853 * Installation return code: this is passed to the
854 * {@link IPackageInstallObserver} if the new package couldn't be installed
855 * in the specified install location because the media is not available.
856 *
Suchi Amalapurapu8a9ab242010-03-11 16:49:16 -0800857 * @hide
858 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700859 @SystemApi
Suchi Amalapurapu8a9ab242010-03-11 16:49:16 -0800860 public static final int INSTALL_FAILED_MEDIA_UNAVAILABLE = -20;
861
862 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700863 * Installation return code: this is passed to the
864 * {@link IPackageInstallObserver} if the new package couldn't be installed
865 * because the verification timed out.
866 *
Kenny Root5ab21572011-07-27 11:11:19 -0700867 * @hide
868 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700869 @SystemApi
Kenny Root5ab21572011-07-27 11:11:19 -0700870 public static final int INSTALL_FAILED_VERIFICATION_TIMEOUT = -21;
871
872 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700873 * Installation return code: this is passed to the
874 * {@link IPackageInstallObserver} if the new package couldn't be installed
875 * because the verification did not succeed.
876 *
Kenny Root5ab21572011-07-27 11:11:19 -0700877 * @hide
878 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700879 @SystemApi
Kenny Root5ab21572011-07-27 11:11:19 -0700880 public static final int INSTALL_FAILED_VERIFICATION_FAILURE = -22;
881
882 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700883 * Installation return code: this is passed to the
884 * {@link IPackageInstallObserver} if the package changed from what the
885 * calling program expected.
886 *
Kenny Root5ab21572011-07-27 11:11:19 -0700887 * @hide
888 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700889 @SystemApi
Kenny Root5ab21572011-07-27 11:11:19 -0700890 public static final int INSTALL_FAILED_PACKAGE_CHANGED = -23;
891
892 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700893 * Installation return code: this is passed to the
894 * {@link IPackageInstallObserver} if the new package is assigned a
895 * different UID than it previously held.
896 *
Dianne Hackbornd0c5f512012-06-07 16:53:59 -0700897 * @hide
898 */
899 public static final int INSTALL_FAILED_UID_CHANGED = -24;
900
901 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700902 * Installation return code: this is passed to the
903 * {@link IPackageInstallObserver} if the new package has an older version
904 * code than the currently installed package.
905 *
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700906 * @hide
907 */
908 public static final int INSTALL_FAILED_VERSION_DOWNGRADE = -25;
909
910 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700911 * Installation return code: this is passed to the
912 * {@link IPackageInstallObserver} if the old package has target SDK high
913 * enough to support runtime permission and the new package has target SDK
914 * low enough to not support runtime permissions.
915 *
Svetoslavd9653702015-05-13 18:02:46 -0700916 * @hide
917 */
918 @SystemApi
919 public static final int INSTALL_FAILED_PERMISSION_MODEL_DOWNGRADE = -26;
920
921 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700922 * Installation parse return code: this is passed to the
923 * {@link IPackageInstallObserver} if the parser was given a path that is
924 * not a file, or does not end with the expected '.apk' extension.
925 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700926 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800927 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700928 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800929 public static final int INSTALL_PARSE_FAILED_NOT_APK = -100;
930
931 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700932 * Installation parse return code: this is passed to the
933 * {@link IPackageInstallObserver} if the parser was unable to retrieve the
934 * AndroidManifest.xml file.
935 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700936 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800937 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700938 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800939 public static final int INSTALL_PARSE_FAILED_BAD_MANIFEST = -101;
940
941 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700942 * Installation parse return code: this is passed to the
943 * {@link IPackageInstallObserver} if the parser encountered an unexpected
944 * exception.
945 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700946 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800947 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700948 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800949 public static final int INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION = -102;
950
951 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700952 * Installation parse return code: this is passed to the
953 * {@link IPackageInstallObserver} if the parser did not find any
954 * certificates in the .apk.
955 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700956 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800957 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700958 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800959 public static final int INSTALL_PARSE_FAILED_NO_CERTIFICATES = -103;
960
961 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700962 * Installation parse return code: this is passed to the
963 * {@link IPackageInstallObserver} if the parser found inconsistent
964 * certificates on the files in the .apk.
965 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700966 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800967 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700968 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800969 public static final int INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES = -104;
970
971 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700972 * Installation parse return code: this is passed to the
973 * {@link IPackageInstallObserver} if the parser encountered a
974 * CertificateEncodingException in one of the files in the .apk.
975 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700976 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800977 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700978 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800979 public static final int INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING = -105;
980
981 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700982 * Installation parse return code: this is passed to the
983 * {@link IPackageInstallObserver} if the parser encountered a bad or
984 * missing package name in the manifest.
985 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700986 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800987 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700988 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800989 public static final int INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME = -106;
990
991 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700992 * Installation parse return code: this is passed to the
993 * {@link IPackageInstallObserver} if the parser encountered a bad shared
994 * user id name in the manifest.
995 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700996 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800997 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700998 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800999 public static final int INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID = -107;
1000
1001 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001002 * Installation parse return code: this is passed to the
1003 * {@link IPackageInstallObserver} if the parser encountered some structural
1004 * problem in the manifest.
1005 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001006 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001007 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001008 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001009 public static final int INSTALL_PARSE_FAILED_MANIFEST_MALFORMED = -108;
1010
1011 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001012 * Installation parse return code: this is passed to the
1013 * {@link IPackageInstallObserver} if the parser did not find any actionable
1014 * tags (instrumentation or application) in the manifest.
1015 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001016 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001017 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001018 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001019 public static final int INSTALL_PARSE_FAILED_MANIFEST_EMPTY = -109;
1020
1021 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001022 * Installation failed return code: this is passed to the
1023 * {@link IPackageInstallObserver} if the system failed to install the
1024 * package because of system issues.
1025 *
Suchi Amalapurapu5b993ce2010-02-12 09:43:29 -08001026 * @hide
1027 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001028 @SystemApi
Suchi Amalapurapu5b993ce2010-02-12 09:43:29 -08001029 public static final int INSTALL_FAILED_INTERNAL_ERROR = -110;
1030
1031 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001032 * Installation failed return code: this is passed to the
1033 * {@link IPackageInstallObserver} if the system failed to install the
1034 * package because the user is restricted from installing apps.
1035 *
Amith Yamasanie4cf7342012-12-17 11:12:09 -08001036 * @hide
1037 */
1038 public static final int INSTALL_FAILED_USER_RESTRICTED = -111;
1039
1040 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001041 * Installation failed return code: this is passed to the
1042 * {@link IPackageInstallObserver} if the system failed to install the
1043 * package because it is attempting to define a permission that is already
1044 * defined by some existing package.
1045 * <p>
1046 * The package name of the app which has already defined the permission is
1047 * passed to a {@link PackageInstallObserver}, if any, as the
1048 * {@link #EXTRA_FAILURE_EXISTING_PACKAGE} string extra; and the name of the
1049 * permission being redefined is passed in the
1050 * {@link #EXTRA_FAILURE_EXISTING_PERMISSION} string extra.
Christopher Tatef1977b42014-03-24 16:25:51 -07001051 *
Christopher Tatef1977b42014-03-24 16:25:51 -07001052 * @hide
1053 */
1054 public static final int INSTALL_FAILED_DUPLICATE_PERMISSION = -112;
1055
1056 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001057 * Installation failed return code: this is passed to the
1058 * {@link IPackageInstallObserver} if the system failed to install the
1059 * package because its packaged native code did not match any of the ABIs
1060 * supported by the system.
Ramin Zaghi1378aba2014-02-28 15:03:19 +00001061 *
1062 * @hide
1063 */
Narayan Kamathd11f2232014-04-10 10:37:17 +01001064 public static final int INSTALL_FAILED_NO_MATCHING_ABIS = -113;
Ramin Zaghi1378aba2014-02-28 15:03:19 +00001065
1066 /**
1067 * Internal return code for NativeLibraryHelper methods to indicate that the package
1068 * being processed did not contain any native code. This is placed here only so that
1069 * it can belong to the same value space as the other install failure codes.
1070 *
1071 * @hide
1072 */
Narayan Kamathd11f2232014-04-10 10:37:17 +01001073 public static final int NO_NATIVE_LIBRARIES = -114;
Ramin Zaghi1378aba2014-02-28 15:03:19 +00001074
Jeff Sharkey7328a1b2014-08-07 14:01:43 -07001075 /** {@hide} */
Jeff Sharkeyf0600952014-08-07 17:31:53 -07001076 public static final int INSTALL_FAILED_ABORTED = -115;
Jeff Sharkey7328a1b2014-08-07 14:01:43 -07001077
Ramin Zaghi1378aba2014-02-28 15:03:19 +00001078 /**
Todd Kennedy2699f062015-11-20 13:07:17 -08001079 * Installation failed return code: ephemeral app installs are incompatible with some
1080 * other installation flags supplied for the operation; or other circumstances such
1081 * as trying to upgrade a system app via an ephemeral install.
1082 * @hide
1083 */
1084 public static final int INSTALL_FAILED_EPHEMERAL_INVALID = -116;
1085
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001086 /** @hide */
1087 @IntDef(flag = true, value = {
1088 DELETE_KEEP_DATA,
1089 DELETE_ALL_USERS,
1090 DELETE_SYSTEM_APP,
1091 })
1092 @Retention(RetentionPolicy.SOURCE)
1093 public @interface DeleteFlags {}
1094
Todd Kennedy2699f062015-11-20 13:07:17 -08001095 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001096 * Flag parameter for {@link #deletePackage} to indicate that you don't want to delete the
1097 * package's data directory.
1098 *
1099 * @hide
1100 */
Dianne Hackborn7767eac2012-08-23 18:25:40 -07001101 public static final int DELETE_KEEP_DATA = 0x00000001;
1102
1103 /**
1104 * Flag parameter for {@link #deletePackage} to indicate that you want the
1105 * package deleted for all users.
1106 *
1107 * @hide
1108 */
1109 public static final int DELETE_ALL_USERS = 0x00000002;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001110
1111 /**
Dianne Hackbornc895be72013-03-11 17:48:43 -07001112 * Flag parameter for {@link #deletePackage} to indicate that, if you are calling
1113 * uninstall on a system that has been updated, then don't do the normal process
1114 * of uninstalling the update and rolling back to the older system version (which
1115 * needs to happen for all users); instead, just mark the app as uninstalled for
1116 * the current user.
1117 *
1118 * @hide
1119 */
1120 public static final int DELETE_SYSTEM_APP = 0x00000004;
1121
1122 /**
Kenny Rootc39bb4a2011-02-28 13:27:19 -08001123 * Return code for when package deletion succeeds. This is passed to the
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001124 * {@link IPackageDeleteObserver} if the system succeeded in deleting the
1125 * package.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001126 *
Kenny Rootc39bb4a2011-02-28 13:27:19 -08001127 * @hide
1128 */
1129 public static final int DELETE_SUCCEEDED = 1;
1130
1131 /**
1132 * Deletion failed return code: this is passed to the
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001133 * {@link IPackageDeleteObserver} if the system failed to delete the package
1134 * for an unspecified reason.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001135 *
Kenny Rootc39bb4a2011-02-28 13:27:19 -08001136 * @hide
1137 */
1138 public static final int DELETE_FAILED_INTERNAL_ERROR = -1;
1139
1140 /**
1141 * Deletion failed return code: this is passed to the
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001142 * {@link IPackageDeleteObserver} if the system failed to delete the package
1143 * because it is the active DevicePolicy manager.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001144 *
Kenny Rootc39bb4a2011-02-28 13:27:19 -08001145 * @hide
1146 */
1147 public static final int DELETE_FAILED_DEVICE_POLICY_MANAGER = -2;
1148
1149 /**
Amith Yamasanie4cf7342012-12-17 11:12:09 -08001150 * Deletion failed return code: this is passed to the
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001151 * {@link IPackageDeleteObserver} if the system failed to delete the package
1152 * since the user is restricted.
Amith Yamasanie4cf7342012-12-17 11:12:09 -08001153 *
1154 * @hide
1155 */
1156 public static final int DELETE_FAILED_USER_RESTRICTED = -3;
1157
1158 /**
Kenny Guy1b88da52014-07-10 16:33:49 +01001159 * Deletion failed return code: this is passed to the
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001160 * {@link IPackageDeleteObserver} if the system failed to delete the package
1161 * because a profile or device owner has marked the package as
1162 * uninstallable.
Kenny Guyc13053b2014-05-29 14:17:17 +01001163 *
1164 * @hide
1165 */
Jeff Sharkeyf0600952014-08-07 17:31:53 -07001166 public static final int DELETE_FAILED_OWNER_BLOCKED = -4;
1167
1168 /** {@hide} */
1169 public static final int DELETE_FAILED_ABORTED = -5;
Kenny Guyc13053b2014-05-29 14:17:17 +01001170
1171 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001172 * Return code that is passed to the {@link IPackageMoveObserver} when the
Kenny Rootc39bb4a2011-02-28 13:27:19 -08001173 * package has been successfully moved by the system.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001174 *
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001175 * @hide
1176 */
Jeff Sharkey620b32b2015-04-23 19:36:02 -07001177 public static final int MOVE_SUCCEEDED = -100;
1178
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001179 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001180 * Error code that is passed to the {@link IPackageMoveObserver} when the
1181 * package hasn't been successfully moved by the system because of
1182 * insufficient memory on specified media.
1183 *
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001184 * @hide
1185 */
1186 public static final int MOVE_FAILED_INSUFFICIENT_STORAGE = -1;
1187
1188 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001189 * Error code that is passed to the {@link IPackageMoveObserver} if the
1190 * specified package doesn't exist.
1191 *
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001192 * @hide
1193 */
1194 public static final int MOVE_FAILED_DOESNT_EXIST = -2;
1195
1196 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001197 * Error code that is passed to the {@link IPackageMoveObserver} if the
1198 * specified package cannot be moved since its a system package.
1199 *
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001200 * @hide
1201 */
1202 public static final int MOVE_FAILED_SYSTEM_PACKAGE = -3;
1203
1204 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001205 * Error code that is passed to the {@link IPackageMoveObserver} if the
1206 * specified package cannot be moved since its forward locked.
1207 *
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001208 * @hide
1209 */
1210 public static final int MOVE_FAILED_FORWARD_LOCKED = -4;
1211
1212 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001213 * Error code that is passed to the {@link IPackageMoveObserver} if the
1214 * specified package cannot be moved to the specified location.
1215 *
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001216 * @hide
1217 */
1218 public static final int MOVE_FAILED_INVALID_LOCATION = -5;
1219
1220 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001221 * Error code that is passed to the {@link IPackageMoveObserver} if the
1222 * specified package cannot be moved to the specified location.
1223 *
Suchi Amalapurapu8a9ab242010-03-11 16:49:16 -08001224 * @hide
1225 */
1226 public static final int MOVE_FAILED_INTERNAL_ERROR = -6;
1227
1228 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001229 * Error code that is passed to the {@link IPackageMoveObserver} if the
1230 * specified package already has an operation pending in the queue.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001231 *
Kenny Rootdeb11262010-08-02 11:36:21 -07001232 * @hide
1233 */
1234 public static final int MOVE_FAILED_OPERATION_PENDING = -7;
1235
1236 /**
Makoto Onukif34db0a2016-02-17 11:17:15 -08001237 * Error code that is passed to the {@link IPackageMoveObserver} if the
1238 * specified package cannot be moved since it contains a device admin.
1239 *
1240 * @hide
1241 */
1242 public static final int MOVE_FAILED_DEVICE_ADMIN = -8;
1243
1244 /**
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001245 * Flag parameter for {@link #movePackage} to indicate that
1246 * the package should be moved to internal storage if its
1247 * been installed on external media.
1248 * @hide
1249 */
Jeff Sharkey620b32b2015-04-23 19:36:02 -07001250 @Deprecated
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001251 public static final int MOVE_INTERNAL = 0x00000001;
1252
1253 /**
1254 * Flag parameter for {@link #movePackage} to indicate that
1255 * the package should be moved to external media.
1256 * @hide
1257 */
Jeff Sharkey620b32b2015-04-23 19:36:02 -07001258 @Deprecated
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001259 public static final int MOVE_EXTERNAL_MEDIA = 0x00000002;
1260
Jeff Sharkey620b32b2015-04-23 19:36:02 -07001261 /** {@hide} */
1262 public static final String EXTRA_MOVE_ID = "android.content.pm.extra.MOVE_ID";
1263
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001264 /**
Kenny Root05ca4c92011-09-15 10:36:25 -07001265 * Usable by the required verifier as the {@code verificationCode} argument
1266 * for {@link PackageManager#verifyPendingInstall} to indicate that it will
1267 * allow the installation to proceed without any of the optional verifiers
1268 * needing to vote.
1269 *
1270 * @hide
1271 */
1272 public static final int VERIFICATION_ALLOW_WITHOUT_SUFFICIENT = 2;
1273
1274 /**
Kenny Root3a9b5fb2011-09-20 14:15:38 -07001275 * Used as the {@code verificationCode} argument for
1276 * {@link PackageManager#verifyPendingInstall} to indicate that the calling
1277 * package verifier allows the installation to proceed.
1278 */
1279 public static final int VERIFICATION_ALLOW = 1;
1280
1281 /**
1282 * Used as the {@code verificationCode} argument for
1283 * {@link PackageManager#verifyPendingInstall} to indicate the calling
1284 * package verifier does not vote to allow the installation to proceed.
1285 */
1286 public static final int VERIFICATION_REJECT = -1;
1287
1288 /**
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001289 * Used as the {@code verificationCode} argument for
1290 * {@link PackageManager#verifyIntentFilter} to indicate that the calling
1291 * IntentFilter Verifier confirms that the IntentFilter is verified.
1292 *
1293 * @hide
1294 */
1295 public static final int INTENT_FILTER_VERIFICATION_SUCCESS = 1;
1296
1297 /**
1298 * Used as the {@code verificationCode} argument for
1299 * {@link PackageManager#verifyIntentFilter} to indicate that the calling
1300 * IntentFilter Verifier confirms that the IntentFilter is NOT verified.
1301 *
1302 * @hide
1303 */
1304 public static final int INTENT_FILTER_VERIFICATION_FAILURE = -1;
1305
1306 /**
1307 * Internal status code to indicate that an IntentFilter verification result is not specified.
1308 *
1309 * @hide
1310 */
1311 public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED = 0;
1312
1313 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001314 * Used as the {@code status} argument for
1315 * {@link #updateIntentVerificationStatusAsUser} to indicate that the User
1316 * will always be prompted the Intent Disambiguation Dialog if there are two
1317 * or more Intent resolved for the IntentFilter's domain(s).
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001318 *
1319 * @hide
1320 */
1321 public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK = 1;
1322
1323 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001324 * Used as the {@code status} argument for
1325 * {@link #updateIntentVerificationStatusAsUser} to indicate that the User
1326 * will never be prompted the Intent Disambiguation Dialog if there are two
1327 * or more resolution of the Intent. The default App for the domain(s)
1328 * specified in the IntentFilter will also ALWAYS be used.
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001329 *
1330 * @hide
1331 */
1332 public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS = 2;
1333
1334 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001335 * Used as the {@code status} argument for
1336 * {@link #updateIntentVerificationStatusAsUser} to indicate that the User
1337 * may be prompted the Intent Disambiguation Dialog if there are two or more
1338 * Intent resolved. The default App for the domain(s) specified in the
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001339 * IntentFilter will also NEVER be presented to the User.
1340 *
1341 * @hide
1342 */
1343 public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER = 3;
1344
1345 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001346 * Used as the {@code status} argument for
1347 * {@link #updateIntentVerificationStatusAsUser} to indicate that this app
1348 * should always be considered as an ambiguous candidate for handling the
1349 * matching Intent even if there are other candidate apps in the "always"
1350 * state. Put another way: if there are any 'always ask' apps in a set of
1351 * more than one candidate app, then a disambiguation is *always* presented
1352 * even if there is another candidate app with the 'always' state.
Christopher Tate56f0ff32015-08-13 16:29:33 -07001353 *
1354 * @hide
1355 */
1356 public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS_ASK = 4;
1357
1358 /**
rich canningsd9ef3e52012-08-22 14:28:05 -07001359 * Can be used as the {@code millisecondsToDelay} argument for
1360 * {@link PackageManager#extendVerificationTimeout}. This is the
1361 * maximum time {@code PackageManager} waits for the verification
1362 * agent to return (in milliseconds).
1363 */
1364 public static final long MAXIMUM_VERIFICATION_TIMEOUT = 60*60*1000;
1365
1366 /**
Amith Yamasani0b285492011-04-14 17:35:23 -07001367 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: The device's
1368 * audio pipeline is low-latency, more suitable for audio applications sensitive to delays or
1369 * lag in sound input or output.
Dan Morrill898e1e82010-09-26 17:28:30 -07001370 */
1371 @SdkConstant(SdkConstantType.FEATURE)
1372 public static final String FEATURE_AUDIO_LOW_LATENCY = "android.hardware.audio.low_latency";
1373
1374 /**
1375 * Feature for {@link #getSystemAvailableFeatures} and
Unsuk Jung50909f62014-09-02 18:25:49 -07001376 * {@link #hasSystemFeature}: The device includes at least one form of audio
1377 * output, such as speakers, audio jack or streaming over bluetooth
1378 */
1379 @SdkConstant(SdkConstantType.FEATURE)
1380 public static final String FEATURE_AUDIO_OUTPUT = "android.hardware.audio.output";
1381
1382 /**
Glenn Kastencdcb5772015-05-06 15:54:49 -07001383 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Glenn Kasten7587edc2015-10-30 17:45:52 -07001384 * The device has professional audio level of functionality and performance.
Glenn Kastencdcb5772015-05-06 15:54:49 -07001385 */
1386 @SdkConstant(SdkConstantType.FEATURE)
1387 public static final String FEATURE_AUDIO_PRO = "android.hardware.audio.pro";
1388
1389 /**
Unsuk Jung50909f62014-09-02 18:25:49 -07001390 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001391 * {@link #hasSystemFeature}: The device is capable of communicating with
1392 * other devices via Bluetooth.
1393 */
1394 @SdkConstant(SdkConstantType.FEATURE)
1395 public static final String FEATURE_BLUETOOTH = "android.hardware.bluetooth";
1396
1397 /**
1398 * Feature for {@link #getSystemAvailableFeatures} and
Matthew Xiea7227722013-04-18 15:25:59 -07001399 * {@link #hasSystemFeature}: The device is capable of communicating with
1400 * other devices via Bluetooth Low Energy radio.
1401 */
1402 @SdkConstant(SdkConstantType.FEATURE)
1403 public static final String FEATURE_BLUETOOTH_LE = "android.hardware.bluetooth_le";
1404
1405 /**
1406 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001407 * {@link #hasSystemFeature}: The device has a camera facing away
1408 * from the screen.
1409 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001410 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001411 public static final String FEATURE_CAMERA = "android.hardware.camera";
Dan Morrill50ab63f2010-03-05 16:16:19 -08001412
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001413 /**
1414 * Feature for {@link #getSystemAvailableFeatures} and
1415 * {@link #hasSystemFeature}: The device's camera supports auto-focus.
1416 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001417 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001418 public static final String FEATURE_CAMERA_AUTOFOCUS = "android.hardware.camera.autofocus";
Dan Morrill50ab63f2010-03-05 16:16:19 -08001419
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001420 /**
1421 * Feature for {@link #getSystemAvailableFeatures} and
Eino-Ville Talvala752af832012-09-18 14:45:37 -07001422 * {@link #hasSystemFeature}: The device has at least one camera pointing in
Eino-Ville Talvala9131da22014-05-08 11:39:53 -07001423 * some direction, or can support an external camera being connected to it.
Eino-Ville Talvala752af832012-09-18 14:45:37 -07001424 */
1425 @SdkConstant(SdkConstantType.FEATURE)
1426 public static final String FEATURE_CAMERA_ANY = "android.hardware.camera.any";
1427
1428 /**
1429 * Feature for {@link #getSystemAvailableFeatures} and
Eino-Ville Talvala9131da22014-05-08 11:39:53 -07001430 * {@link #hasSystemFeature}: The device can support having an external camera connected to it.
1431 * The external camera may not always be connected or available to applications to use.
1432 */
1433 @SdkConstant(SdkConstantType.FEATURE)
1434 public static final String FEATURE_CAMERA_EXTERNAL = "android.hardware.camera.external";
1435
1436 /**
1437 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001438 * {@link #hasSystemFeature}: The device's camera supports flash.
1439 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001440 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001441 public static final String FEATURE_CAMERA_FLASH = "android.hardware.camera.flash";
Dan Morrill50ab63f2010-03-05 16:16:19 -08001442
1443 /**
1444 * Feature for {@link #getSystemAvailableFeatures} and
Chih-Chung Changde1057c2010-06-14 19:15:00 +08001445 * {@link #hasSystemFeature}: The device has a front facing camera.
1446 */
1447 @SdkConstant(SdkConstantType.FEATURE)
1448 public static final String FEATURE_CAMERA_FRONT = "android.hardware.camera.front";
1449
1450 /**
Eino-Ville Talvala611fece2014-07-10 17:29:38 -07001451 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one
1452 * of the cameras on the device supports the
1453 * {@link android.hardware.camera2.CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL full hardware}
1454 * capability level.
1455 */
1456 @SdkConstant(SdkConstantType.FEATURE)
1457 public static final String FEATURE_CAMERA_LEVEL_FULL = "android.hardware.camera.level.full";
1458
1459 /**
1460 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one
1461 * of the cameras on the device supports the
1462 * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR manual sensor}
1463 * capability level.
1464 */
1465 @SdkConstant(SdkConstantType.FEATURE)
1466 public static final String FEATURE_CAMERA_CAPABILITY_MANUAL_SENSOR =
1467 "android.hardware.camera.capability.manual_sensor";
1468
1469 /**
1470 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one
1471 * of the cameras on the device supports the
1472 * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MANUAL_POST_PROCESSING manual post-processing}
1473 * capability level.
1474 */
1475 @SdkConstant(SdkConstantType.FEATURE)
1476 public static final String FEATURE_CAMERA_CAPABILITY_MANUAL_POST_PROCESSING =
1477 "android.hardware.camera.capability.manual_post_processing";
1478
1479 /**
1480 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one
1481 * of the cameras on the device supports the
1482 * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_RAW RAW}
1483 * capability level.
1484 */
1485 @SdkConstant(SdkConstantType.FEATURE)
1486 public static final String FEATURE_CAMERA_CAPABILITY_RAW =
1487 "android.hardware.camera.capability.raw";
1488
1489 /**
Chih-Chung Changde1057c2010-06-14 19:15:00 +08001490 * Feature for {@link #getSystemAvailableFeatures} and
Alex Ray0c9d61f2013-10-03 12:17:54 -07001491 * {@link #hasSystemFeature}: The device is capable of communicating with
1492 * consumer IR devices.
1493 */
1494 @SdkConstant(SdkConstantType.FEATURE)
1495 public static final String FEATURE_CONSUMER_IR = "android.hardware.consumerir";
1496
1497 /**
1498 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001499 * {@link #hasSystemFeature}: The device supports one or more methods of
1500 * reporting current location.
1501 */
1502 @SdkConstant(SdkConstantType.FEATURE)
1503 public static final String FEATURE_LOCATION = "android.hardware.location";
1504
1505 /**
1506 * Feature for {@link #getSystemAvailableFeatures} and
1507 * {@link #hasSystemFeature}: The device has a Global Positioning System
1508 * receiver and can report precise location.
1509 */
1510 @SdkConstant(SdkConstantType.FEATURE)
1511 public static final String FEATURE_LOCATION_GPS = "android.hardware.location.gps";
1512
1513 /**
1514 * Feature for {@link #getSystemAvailableFeatures} and
1515 * {@link #hasSystemFeature}: The device can report location with coarse
1516 * accuracy using a network-based geolocation system.
1517 */
1518 @SdkConstant(SdkConstantType.FEATURE)
1519 public static final String FEATURE_LOCATION_NETWORK = "android.hardware.location.network";
1520
1521 /**
1522 * Feature for {@link #getSystemAvailableFeatures} and
1523 * {@link #hasSystemFeature}: The device can record audio via a
1524 * microphone.
1525 */
1526 @SdkConstant(SdkConstantType.FEATURE)
1527 public static final String FEATURE_MICROPHONE = "android.hardware.microphone";
1528
1529 /**
1530 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill76437d32010-09-01 11:17:20 -07001531 * {@link #hasSystemFeature}: The device can communicate using Near-Field
1532 * Communications (NFC).
1533 */
1534 @SdkConstant(SdkConstantType.FEATURE)
1535 public static final String FEATURE_NFC = "android.hardware.nfc";
1536
1537 /**
1538 * Feature for {@link #getSystemAvailableFeatures} and
Martijn Coenenf4bf1582013-07-22 12:01:19 -07001539 * {@link #hasSystemFeature}: The device supports host-
1540 * based NFC card emulation.
Martijn Coenendf4d1d62013-08-28 11:18:58 -07001541 *
1542 * TODO remove when depending apps have moved to new constant.
1543 * @hide
1544 * @deprecated
Martijn Coenenf4bf1582013-07-22 12:01:19 -07001545 */
Jose Lima970417c2014-04-10 10:42:19 -07001546 @Deprecated
Martijn Coenenf4bf1582013-07-22 12:01:19 -07001547 @SdkConstant(SdkConstantType.FEATURE)
1548 public static final String FEATURE_NFC_HCE = "android.hardware.nfc.hce";
1549
1550 /**
1551 * Feature for {@link #getSystemAvailableFeatures} and
Martijn Coenendf4d1d62013-08-28 11:18:58 -07001552 * {@link #hasSystemFeature}: The device supports host-
1553 * based NFC card emulation.
1554 */
1555 @SdkConstant(SdkConstantType.FEATURE)
1556 public static final String FEATURE_NFC_HOST_CARD_EMULATION = "android.hardware.nfc.hce";
1557
1558 /**
1559 * Feature for {@link #getSystemAvailableFeatures} and
Yoshinobu Itoc52adfe2016-01-22 18:14:18 +09001560 * {@link #hasSystemFeature}: The device supports host-
1561 * based NFC-F card emulation.
1562 */
1563 @SdkConstant(SdkConstantType.FEATURE)
1564 public static final String FEATURE_NFC_HOST_CARD_EMULATION_NFCF = "android.hardware.nfc.hcef";
1565
1566 /**
1567 * Feature for {@link #getSystemAvailableFeatures} and
Jesse Hall7f517062014-07-18 11:54:41 -07001568 * {@link #hasSystemFeature}: The device supports the OpenGL ES
1569 * <a href="http://www.khronos.org/registry/gles/extensions/ANDROID/ANDROID_extension_pack_es31a.txt">
1570 * Android Extension Pack</a>.
1571 */
1572 @SdkConstant(SdkConstantType.FEATURE)
1573 public static final String FEATURE_OPENGLES_EXTENSION_PACK = "android.hardware.opengles.aep";
1574
1575 /**
1576 * Feature for {@link #getSystemAvailableFeatures} and
Jesse Hallf77a34f2016-02-04 18:41:33 -08001577 * {@link #hasSystemFeature}: If this feature is supported, the Vulkan native API will enumerate
1578 * at least one {@code VkPhysicalDevice}, and the feature version will indicate what
1579 * level of optional hardware features limits it supports.
1580 * <p>
1581 * Level 0 includes the base Vulkan requirements as well as:
1582 * <ul><li>{@code VkPhysicalDeviceFeatures::textureCompressionETC2}</li></ul>
1583 * <p>
1584 * Level 1 additionally includes:
1585 * <ul>
1586 * <li>{@code VkPhysicalDeviceFeatures::fullDrawIndexUint32}</li>
1587 * <li>{@code VkPhysicalDeviceFeatures::imageCubeArray}</li>
1588 * <li>{@code VkPhysicalDeviceFeatures::independentBlend}</li>
1589 * <li>{@code VkPhysicalDeviceFeatures::geometryShader}</li>
1590 * <li>{@code VkPhysicalDeviceFeatures::tessellationShader}</li>
1591 * <li>{@code VkPhysicalDeviceFeatures::sampleRateShading}</li>
1592 * <li>{@code VkPhysicalDeviceFeatures::textureCompressionASTC_LDR}</li>
1593 * <li>{@code VkPhysicalDeviceFeatures::fragmentStoresAndAtomics}</li>
1594 * <li>{@code VkPhysicalDeviceFeatures::shaderImageGatherExtended}</li>
1595 * <li>{@code VkPhysicalDeviceFeatures::shaderUniformBufferArrayDynamicIndexing}</li>
1596 * <li>{@code VkPhysicalDeviceFeatures::shaderSampledImageArrayDynamicIndexing}</li>
1597 * </ul>
1598 */
1599 @SdkConstant(SdkConstantType.FEATURE)
1600 public static final String FEATURE_VULKAN_HARDWARE_LEVEL = "android.hardware.vulkan.level";
1601
1602 /**
1603 * Feature for {@link #getSystemAvailableFeatures} and
1604 * {@link #hasSystemFeature}: The version of this feature indicates the highest
1605 * {@code VkPhysicalDeviceProperties::apiVersion} supported by the physical devices that support
1606 * the hardware level indicated by {@link #FEATURE_VULKAN_HARDWARE_LEVEL}. The feature version
1607 * uses the same encoding as Vulkan version numbers:
1608 * <ul>
1609 * <li>Major version number in bits 31-22</li>
1610 * <li>Minor version number in bits 21-12</li>
1611 * <li>Patch version number in bits 11-0</li>
1612 * </ul>
1613 */
1614 @SdkConstant(SdkConstantType.FEATURE)
1615 public static final String FEATURE_VULKAN_HARDWARE_VERSION = "android.hardware.vulkan.version";
1616
1617 /**
1618 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill5744bb42010-09-01 19:18:57 -07001619 * {@link #hasSystemFeature}: The device includes an accelerometer.
1620 */
1621 @SdkConstant(SdkConstantType.FEATURE)
1622 public static final String FEATURE_SENSOR_ACCELEROMETER = "android.hardware.sensor.accelerometer";
1623
1624 /**
1625 * Feature for {@link #getSystemAvailableFeatures} and
1626 * {@link #hasSystemFeature}: The device includes a barometer (air
1627 * pressure sensor.)
1628 */
1629 @SdkConstant(SdkConstantType.FEATURE)
1630 public static final String FEATURE_SENSOR_BAROMETER = "android.hardware.sensor.barometer";
1631
1632 /**
1633 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001634 * {@link #hasSystemFeature}: The device includes a magnetometer (compass).
1635 */
1636 @SdkConstant(SdkConstantType.FEATURE)
1637 public static final String FEATURE_SENSOR_COMPASS = "android.hardware.sensor.compass";
1638
1639 /**
1640 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill5744bb42010-09-01 19:18:57 -07001641 * {@link #hasSystemFeature}: The device includes a gyroscope.
Dan Morrill50ab63f2010-03-05 16:16:19 -08001642 */
1643 @SdkConstant(SdkConstantType.FEATURE)
Dan Morrill5744bb42010-09-01 19:18:57 -07001644 public static final String FEATURE_SENSOR_GYROSCOPE = "android.hardware.sensor.gyroscope";
Dan Morrill50ab63f2010-03-05 16:16:19 -08001645
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001646 /**
1647 * Feature for {@link #getSystemAvailableFeatures} and
1648 * {@link #hasSystemFeature}: The device includes a light sensor.
1649 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001650 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001651 public static final String FEATURE_SENSOR_LIGHT = "android.hardware.sensor.light";
Dan Morrill50ab63f2010-03-05 16:16:19 -08001652
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001653 /**
1654 * Feature for {@link #getSystemAvailableFeatures} and
1655 * {@link #hasSystemFeature}: The device includes a proximity sensor.
1656 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001657 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001658 public static final String FEATURE_SENSOR_PROXIMITY = "android.hardware.sensor.proximity";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001659
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001660 /**
1661 * Feature for {@link #getSystemAvailableFeatures} and
Aravind Akella068b0c02013-10-12 17:39:15 -07001662 * {@link #hasSystemFeature}: The device includes a hardware step counter.
1663 */
1664 @SdkConstant(SdkConstantType.FEATURE)
1665 public static final String FEATURE_SENSOR_STEP_COUNTER = "android.hardware.sensor.stepcounter";
1666
1667 /**
1668 * Feature for {@link #getSystemAvailableFeatures} and
1669 * {@link #hasSystemFeature}: The device includes a hardware step detector.
1670 */
1671 @SdkConstant(SdkConstantType.FEATURE)
1672 public static final String FEATURE_SENSOR_STEP_DETECTOR = "android.hardware.sensor.stepdetector";
1673
1674 /**
1675 * Feature for {@link #getSystemAvailableFeatures} and
Vinod Krishnan8afb23c2014-04-30 11:11:39 -07001676 * {@link #hasSystemFeature}: The device includes a heart rate monitor.
1677 */
1678 @SdkConstant(SdkConstantType.FEATURE)
1679 public static final String FEATURE_SENSOR_HEART_RATE = "android.hardware.sensor.heartrate";
1680
1681 /**
1682 * Feature for {@link #getSystemAvailableFeatures} and
Vinod Krishnan1ab76892014-08-20 11:11:55 -07001683 * {@link #hasSystemFeature}: The heart rate sensor on this device is an Electrocargiogram.
1684 */
1685 @SdkConstant(SdkConstantType.FEATURE)
1686 public static final String FEATURE_SENSOR_HEART_RATE_ECG =
1687 "android.hardware.sensor.heartrate.ecg";
1688
1689 /**
1690 * Feature for {@link #getSystemAvailableFeatures} and
Aravind Akella8b8e74b2014-07-09 11:52:39 -07001691 * {@link #hasSystemFeature}: The device includes a relative humidity sensor.
1692 */
1693 @SdkConstant(SdkConstantType.FEATURE)
1694 public static final String FEATURE_SENSOR_RELATIVE_HUMIDITY =
1695 "android.hardware.sensor.relative_humidity";
1696
1697 /**
1698 * Feature for {@link #getSystemAvailableFeatures} and
1699 * {@link #hasSystemFeature}: The device includes an ambient temperature sensor.
1700 */
1701 @SdkConstant(SdkConstantType.FEATURE)
1702 public static final String FEATURE_SENSOR_AMBIENT_TEMPERATURE =
1703 "android.hardware.sensor.ambient_temperature";
1704
1705 /**
1706 * Feature for {@link #getSystemAvailableFeatures} and
Ashutosh Joshieae371b2015-04-09 10:30:07 -07001707 * {@link #hasSystemFeature}: The device supports high fidelity sensor processing
1708 * capabilities.
1709 */
1710 @SdkConstant(SdkConstantType.FEATURE)
1711 public static final String FEATURE_HIFI_SENSORS =
1712 "android.hardware.sensor.hifi_sensors";
1713
1714 /**
1715 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001716 * {@link #hasSystemFeature}: The device has a telephony radio with data
1717 * communication support.
1718 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001719 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001720 public static final String FEATURE_TELEPHONY = "android.hardware.telephony";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001721
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001722 /**
1723 * Feature for {@link #getSystemAvailableFeatures} and
1724 * {@link #hasSystemFeature}: The device has a CDMA telephony stack.
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_TELEPHONY_CDMA = "android.hardware.telephony.cdma";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001728
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001729 /**
1730 * Feature for {@link #getSystemAvailableFeatures} and
1731 * {@link #hasSystemFeature}: The device has a GSM telephony stack.
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_TELEPHONY_GSM = "android.hardware.telephony.gsm";
Hung-ying Tyan3424c022010-08-27 18:08:19 +08001735
1736 /**
1737 * Feature for {@link #getSystemAvailableFeatures} and
Mike Lockwoodf4ca2472011-02-27 11:23:25 -08001738 * {@link #hasSystemFeature}: The device supports connecting to USB devices
1739 * as the USB host.
1740 */
1741 @SdkConstant(SdkConstantType.FEATURE)
1742 public static final String FEATURE_USB_HOST = "android.hardware.usb.host";
1743
1744 /**
1745 * Feature for {@link #getSystemAvailableFeatures} and
1746 * {@link #hasSystemFeature}: The device supports connecting to USB accessories.
1747 */
1748 @SdkConstant(SdkConstantType.FEATURE)
1749 public static final String FEATURE_USB_ACCESSORY = "android.hardware.usb.accessory";
1750
1751 /**
1752 * Feature for {@link #getSystemAvailableFeatures} and
Hung-ying Tyan3424c022010-08-27 18:08:19 +08001753 * {@link #hasSystemFeature}: The SIP API is enabled on the device.
1754 */
1755 @SdkConstant(SdkConstantType.FEATURE)
1756 public static final String FEATURE_SIP = "android.software.sip";
1757
1758 /**
1759 * Feature for {@link #getSystemAvailableFeatures} and
1760 * {@link #hasSystemFeature}: The device supports SIP-based VOIP.
1761 */
1762 @SdkConstant(SdkConstantType.FEATURE)
1763 public static final String FEATURE_SIP_VOIP = "android.software.sip.voip";
1764
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001765 /**
1766 * Feature for {@link #getSystemAvailableFeatures} and
Ihab Awad1ec68882014-09-12 11:09:01 -07001767 * {@link #hasSystemFeature}: The Connection Service API is enabled on the device.
1768 */
1769 @SdkConstant(SdkConstantType.FEATURE)
1770 public static final String FEATURE_CONNECTION_SERVICE = "android.software.connectionservice";
1771
1772 /**
1773 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrillb0fe0332010-04-05 14:43:58 -07001774 * {@link #hasSystemFeature}: The device's display has a touch screen.
1775 */
1776 @SdkConstant(SdkConstantType.FEATURE)
1777 public static final String FEATURE_TOUCHSCREEN = "android.hardware.touchscreen";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001778
Dan Morrillb0fe0332010-04-05 14:43:58 -07001779 /**
1780 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001781 * {@link #hasSystemFeature}: The device's touch screen supports
1782 * multitouch sufficient for basic two-finger gesture detection.
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001783 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001784 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001785 public static final String FEATURE_TOUCHSCREEN_MULTITOUCH = "android.hardware.touchscreen.multitouch";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001786
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001787 /**
1788 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001789 * {@link #hasSystemFeature}: The device's touch screen is capable of
1790 * tracking two or more fingers fully independently.
1791 */
1792 @SdkConstant(SdkConstantType.FEATURE)
1793 public static final String FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT = "android.hardware.touchscreen.multitouch.distinct";
1794
1795 /**
1796 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill6993d3d2010-09-03 14:30:14 -07001797 * {@link #hasSystemFeature}: The device's touch screen is capable of
1798 * tracking a full hand of fingers fully independently -- that is, 5 or
1799 * more simultaneous independent pointers.
1800 */
1801 @SdkConstant(SdkConstantType.FEATURE)
1802 public static final String FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND = "android.hardware.touchscreen.multitouch.jazzhand";
1803
1804 /**
1805 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrilla5376872011-01-23 13:15:53 -08001806 * {@link #hasSystemFeature}: The device does not have a touch screen, but
1807 * does support touch emulation for basic events. For instance, the
1808 * device might use a mouse or remote control to drive a cursor, and
1809 * emulate basic touch pointer events like down, up, drag, etc. All
1810 * devices that support android.hardware.touchscreen or a sub-feature are
1811 * presumed to also support faketouch.
1812 */
1813 @SdkConstant(SdkConstantType.FEATURE)
1814 public static final String FEATURE_FAKETOUCH = "android.hardware.faketouch";
1815
1816 /**
1817 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborne22fe932011-06-08 20:24:29 -07001818 * {@link #hasSystemFeature}: The device does not have a touch screen, but
1819 * does support touch emulation for basic events that supports distinct
1820 * tracking of two or more fingers. This is an extension of
1821 * {@link #FEATURE_FAKETOUCH} for input devices with this capability. Note
1822 * that unlike a distinct multitouch screen as defined by
1823 * {@link #FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT}, these kinds of input
1824 * devices will not actually provide full two-finger gestures since the
1825 * input is being transformed to cursor movement on the screen. That is,
1826 * single finger gestures will move a cursor; two-finger swipes will
1827 * result in single-finger touch events; other two-finger gestures will
1828 * result in the corresponding two-finger touch event.
1829 */
1830 @SdkConstant(SdkConstantType.FEATURE)
1831 public static final String FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT = "android.hardware.faketouch.multitouch.distinct";
1832
1833 /**
1834 * Feature for {@link #getSystemAvailableFeatures} and
1835 * {@link #hasSystemFeature}: The device does not have a touch screen, but
1836 * does support touch emulation for basic events that supports tracking
1837 * a hand of fingers (5 or more fingers) fully independently.
1838 * This is an extension of
1839 * {@link #FEATURE_FAKETOUCH} for input devices with this capability. Note
1840 * that unlike a multitouch screen as defined by
1841 * {@link #FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND}, not all two finger
1842 * gestures can be detected due to the limitations described for
1843 * {@link #FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT}.
1844 */
1845 @SdkConstant(SdkConstantType.FEATURE)
1846 public static final String FEATURE_FAKETOUCH_MULTITOUCH_JAZZHAND = "android.hardware.faketouch.multitouch.jazzhand";
1847
1848 /**
1849 * Feature for {@link #getSystemAvailableFeatures} and
Jim Millerd9b9d412015-07-22 19:51:40 -07001850 * {@link #hasSystemFeature}: The device has biometric hardware to detect a fingerprint.
1851 */
1852 @SdkConstant(SdkConstantType.FEATURE)
1853 public static final String FEATURE_FINGERPRINT = "android.hardware.fingerprint";
1854
1855 /**
1856 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborne289bff2011-06-13 19:33:22 -07001857 * {@link #hasSystemFeature}: The device supports portrait orientation
1858 * screens. For backwards compatibility, you can assume that if neither
1859 * this nor {@link #FEATURE_SCREEN_LANDSCAPE} is set then the device supports
1860 * both portrait and landscape.
1861 */
1862 @SdkConstant(SdkConstantType.FEATURE)
1863 public static final String FEATURE_SCREEN_PORTRAIT = "android.hardware.screen.portrait";
1864
1865 /**
1866 * Feature for {@link #getSystemAvailableFeatures} and
1867 * {@link #hasSystemFeature}: The device supports landscape orientation
1868 * screens. For backwards compatibility, you can assume that if neither
1869 * this nor {@link #FEATURE_SCREEN_PORTRAIT} is set then the device supports
1870 * both portrait and landscape.
1871 */
1872 @SdkConstant(SdkConstantType.FEATURE)
1873 public static final String FEATURE_SCREEN_LANDSCAPE = "android.hardware.screen.landscape";
1874
1875 /**
1876 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001877 * {@link #hasSystemFeature}: The device supports live wallpapers.
1878 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001879 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001880 public static final String FEATURE_LIVE_WALLPAPER = "android.software.live_wallpaper";
Oscar Montemayor1228d0a2010-01-28 12:01:44 -08001881 /**
Dan Morrill50ab63f2010-03-05 16:16:19 -08001882 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn119bbc32013-03-22 17:27:25 -07001883 * {@link #hasSystemFeature}: The device supports app widgets.
1884 */
1885 @SdkConstant(SdkConstantType.FEATURE)
1886 public static final String FEATURE_APP_WIDGETS = "android.software.app_widgets";
1887
1888 /**
Dianne Hackborn91097de2014-04-04 18:02:06 -07001889 * @hide
1890 * Feature for {@link #getSystemAvailableFeatures} and
1891 * {@link #hasSystemFeature}: The device supports
1892 * {@link android.service.voice.VoiceInteractionService} and
1893 * {@link android.app.VoiceInteractor}.
1894 */
1895 @SdkConstant(SdkConstantType.FEATURE)
1896 public static final String FEATURE_VOICE_RECOGNIZERS = "android.software.voice_recognizers";
1897
1898
1899 /**
Dianne Hackborn119bbc32013-03-22 17:27:25 -07001900 * Feature for {@link #getSystemAvailableFeatures} and
1901 * {@link #hasSystemFeature}: The device supports a home screen that is replaceable
1902 * by third party applications.
1903 */
1904 @SdkConstant(SdkConstantType.FEATURE)
1905 public static final String FEATURE_HOME_SCREEN = "android.software.home_screen";
1906
1907 /**
1908 * Feature for {@link #getSystemAvailableFeatures} and
1909 * {@link #hasSystemFeature}: The device supports adding new input methods implemented
1910 * with the {@link android.inputmethodservice.InputMethodService} API.
1911 */
1912 @SdkConstant(SdkConstantType.FEATURE)
1913 public static final String FEATURE_INPUT_METHODS = "android.software.input_methods";
1914
1915 /**
1916 * Feature for {@link #getSystemAvailableFeatures} and
Amith Yamasani44a01b72013-09-16 10:44:57 -07001917 * {@link #hasSystemFeature}: The device supports device policy enforcement via device admins.
1918 */
1919 @SdkConstant(SdkConstantType.FEATURE)
1920 public static final String FEATURE_DEVICE_ADMIN = "android.software.device_admin";
1921
1922 /**
1923 * Feature for {@link #getSystemAvailableFeatures} and
Tim Kilbournf94b6a92014-03-07 15:13:48 -08001924 * {@link #hasSystemFeature}: The device supports leanback UI. This is
1925 * typically used in a living room television experience, but is a software
1926 * feature unlike {@link #FEATURE_TELEVISION}. Devices running with this
1927 * feature will use resources associated with the "television" UI mode.
1928 */
1929 @SdkConstant(SdkConstantType.FEATURE)
1930 public static final String FEATURE_LEANBACK = "android.software.leanback";
1931
1932 /**
1933 * Feature for {@link #getSystemAvailableFeatures} and
1934 * {@link #hasSystemFeature}: The device supports only leanback UI. Only
1935 * applications designed for this experience should be run, though this is
1936 * not enforced by the system.
1937 * @hide
1938 */
1939 @SdkConstant(SdkConstantType.FEATURE)
1940 public static final String FEATURE_LEANBACK_ONLY = "android.software.leanback_only";
1941
1942 /**
1943 * Feature for {@link #getSystemAvailableFeatures} and
Jae Seocfd861e2014-08-27 14:02:15 -07001944 * {@link #hasSystemFeature}: The device supports live TV and can display
1945 * contents from TV inputs implemented with the
1946 * {@link android.media.tv.TvInputService} API.
1947 */
1948 @SdkConstant(SdkConstantType.FEATURE)
1949 public static final String FEATURE_LIVE_TV = "android.software.live_tv";
1950
1951 /**
1952 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001953 * {@link #hasSystemFeature}: The device supports WiFi (802.11) networking.
1954 */
1955 @SdkConstant(SdkConstantType.FEATURE)
1956 public static final String FEATURE_WIFI = "android.hardware.wifi";
1957
1958 /**
Irfan Sheriff45b8b462011-09-07 11:24:16 -07001959 * Feature for {@link #getSystemAvailableFeatures} and
1960 * {@link #hasSystemFeature}: The device supports Wi-Fi Direct networking.
1961 */
1962 @SdkConstant(SdkConstantType.FEATURE)
1963 public static final String FEATURE_WIFI_DIRECT = "android.hardware.wifi.direct";
1964
1965 /**
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07001966 * Feature for {@link #getSystemAvailableFeatures} and
Etan Cohen20d329b2015-09-29 13:49:02 -07001967 * {@link #hasSystemFeature}: The device supports Wi-Fi Aware (NAN)
1968 * networking.
1969 *
1970 * @hide PROPOSED_NAN_API
1971 */
1972 @SdkConstant(SdkConstantType.FEATURE)
1973 public static final String FEATURE_WIFI_NAN = "android.hardware.wifi.nan";
1974
1975 /**
1976 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07001977 * {@link #hasSystemFeature}: This is a device dedicated to showing UI
Todd Kennedy7f95a002015-04-22 14:28:25 -07001978 * on a vehicle headunit. A headunit here is defined to be inside a
1979 * vehicle that may or may not be moving. A headunit uses either a
1980 * primary display in the center console and/or additional displays in
1981 * the instrument cluster or elsewhere in the vehicle. Headunit display(s)
1982 * have limited size and resolution. The user will likely be focused on
1983 * driving so limiting driver distraction is a primary concern. User input
1984 * can be a variety of hard buttons, touch, rotary controllers and even mouse-
1985 * like interfaces.
1986 */
1987 @SdkConstant(SdkConstantType.FEATURE)
1988 public static final String FEATURE_AUTOMOTIVE = "android.hardware.type.automotive";
1989
1990 /**
1991 * Feature for {@link #getSystemAvailableFeatures} and
1992 * {@link #hasSystemFeature}: This is a device dedicated to showing UI
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07001993 * on a television. Television here is defined to be a typical living
1994 * room television experience: displayed on a big screen, where the user
1995 * is sitting far away from it, and the dominant form of input will be
1996 * something like a DPAD, not through touch or mouse.
Tim Kilbournf94b6a92014-03-07 15:13:48 -08001997 * @deprecated use {@link #FEATURE_LEANBACK} instead.
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07001998 */
Jose Lima970417c2014-04-10 10:42:19 -07001999 @Deprecated
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07002000 @SdkConstant(SdkConstantType.FEATURE)
2001 public static final String FEATURE_TELEVISION = "android.hardware.type.television";
2002
2003 /**
Justin Kohb5731f091c2014-02-13 16:06:59 -08002004 * Feature for {@link #getSystemAvailableFeatures} and
2005 * {@link #hasSystemFeature}: This is a device dedicated to showing UI
2006 * on a watch. A watch here is defined to be a device worn on the body, perhaps on
2007 * the wrist. The user is very close when interacting with the device.
2008 */
2009 @SdkConstant(SdkConstantType.FEATURE)
2010 public static final String FEATURE_WATCH = "android.hardware.type.watch";
2011
2012 /**
Adam Lesinski3d9bcb92014-02-18 14:05:14 -08002013 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2014 * The device supports printing.
2015 */
2016 @SdkConstant(SdkConstantType.FEATURE)
2017 public static final String FEATURE_PRINTING = "android.software.print";
2018
2019 /**
2020 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2021 * The device can perform backup and restore operations on installed applications.
2022 */
2023 @SdkConstant(SdkConstantType.FEATURE)
2024 public static final String FEATURE_BACKUP = "android.software.backup";
2025
2026 /**
Vladislav Kaznacheevd303b252015-10-27 17:30:58 -07002027 * Feature for {@link #getSystemAvailableFeatures} and
2028 * {@link #hasSystemFeature}: The device supports freeform window management.
2029 * Windows have title bars and can be moved and resized.
2030 */
Filip Gruszczynski811dc3b2015-11-23 12:34:22 -08002031 // If this feature is present, you also need to set
2032 // com.android.internal.R.config_freeformWindowManagement to true in your configuration overlay.
Vladislav Kaznacheevd303b252015-10-27 17:30:58 -07002033 @SdkConstant(SdkConstantType.FEATURE)
2034 public static final String FEATURE_FREEFORM_WINDOW_MANAGEMENT
2035 = "android.software.freeform_window_management";
2036
2037 /**
Adam Connors23cc04e2014-04-01 12:12:20 +01002038 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Wale Ogunwalefbe12c42015-12-06 16:23:50 -08002039 * The device supports picture-in-picture multi-window mode.
2040 */
2041 @SdkConstant(SdkConstantType.FEATURE)
2042 public static final String FEATURE_PICTURE_IN_PICTURE = "android.software.picture_in_picture";
2043
2044 /**
2045 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Amith Yamasani1d653272014-09-11 17:56:05 -07002046 * The device supports creating secondary users and managed profiles via
2047 * {@link DevicePolicyManager}.
Adam Connors23cc04e2014-04-01 12:12:20 +01002048 */
2049 @SdkConstant(SdkConstantType.FEATURE)
Amith Yamasani1d653272014-09-11 17:56:05 -07002050 public static final String FEATURE_MANAGED_USERS = "android.software.managed_users";
2051
2052 /**
2053 * @hide
2054 * TODO: Remove after dependencies updated b/17392243
2055 */
2056 public static final String FEATURE_MANAGED_PROFILES = "android.software.managed_users";
Adam Connors23cc04e2014-04-01 12:12:20 +01002057
2058 /**
Ben Murdochf564c7f2014-05-20 18:58:06 +01002059 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Adam Connors19ccb5f2014-09-08 17:31:50 +01002060 * The device supports verified boot.
2061 */
2062 @SdkConstant(SdkConstantType.FEATURE)
2063 public static final String FEATURE_VERIFIED_BOOT = "android.software.verified_boot";
2064
2065 /**
2066 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2067 * The device supports secure removal of users. When a user is deleted the data associated
2068 * with that user is securely deleted and no longer available.
2069 */
2070 @SdkConstant(SdkConstantType.FEATURE)
2071 public static final String FEATURE_SECURELY_REMOVES_USERS
2072 = "android.software.securely_removes_users";
2073
Jeff Sharkeyb92b05b2016-01-28 09:50:00 -07002074 /** {@hide} */
2075 @SdkConstant(SdkConstantType.FEATURE)
2076 public static final String FEATURE_FILE_BASED_ENCRYPTION
2077 = "android.software.file_based_encryption";
2078
Adam Connors19ccb5f2014-09-08 17:31:50 +01002079 /**
2080 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Ben Murdoch422c7a52014-05-16 13:45:47 +01002081 * The device has a full implementation of the android.webkit.* APIs. Devices
2082 * lacking this feature will not have a functioning WebView implementation.
2083 */
2084 @SdkConstant(SdkConstantType.FEATURE)
2085 public static final String FEATURE_WEBVIEW = "android.software.webview";
2086
2087 /**
Joe LaPenna4bb015d2014-07-04 17:15:54 -07002088 * Feature for {@link #getSystemAvailableFeatures} and
2089 * {@link #hasSystemFeature}: This device supports ethernet.
Joe LaPenna4bb015d2014-07-04 17:15:54 -07002090 */
2091 @SdkConstant(SdkConstantType.FEATURE)
2092 public static final String FEATURE_ETHERNET = "android.hardware.ethernet";
2093
2094 /**
Yuncheol Heoa0c4a062014-07-10 20:49:27 +09002095 * Feature for {@link #getSystemAvailableFeatures} and
2096 * {@link #hasSystemFeature}: This device supports HDMI-CEC.
2097 * @hide
2098 */
2099 @SdkConstant(SdkConstantType.FEATURE)
2100 public static final String FEATURE_HDMI_CEC = "android.hardware.hdmi.cec";
2101
2102 /**
Michael Wright6faa6752014-09-05 17:57:44 -07002103 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2104 * The device has all of the inputs necessary to be considered a compatible game controller, or
2105 * includes a compatible game controller in the box.
2106 */
2107 @SdkConstant(SdkConstantType.FEATURE)
2108 public static final String FEATURE_GAMEPAD = "android.hardware.gamepad";
2109
Mike Lockwood5781cd52015-03-27 13:23:41 -07002110 /**
2111 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2112 * The device has a full implementation of the android.media.midi.* APIs.
2113 */
2114 @SdkConstant(SdkConstantType.FEATURE)
2115 public static final String FEATURE_MIDI = "android.software.midi";
Michael Wright6faa6752014-09-05 17:57:44 -07002116
2117 /**
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08002118 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2119 * The device implements a an optimized mode for virtual reality (VR) applications that handles
2120 * stereoscopic rendering of notifications, and may potentially also include optimizations to
Ruben Brunk31d80ea2016-01-25 20:14:08 -08002121 * reduce latency in the graphics, display, and sensor stacks.
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08002122 */
2123 @SdkConstant(SdkConstantType.FEATURE)
2124 public static final String FEATURE_VR_MODE = "android.software.vr.mode";
2125
2126 /**
Ruben Brunk31d80ea2016-01-25 20:14:08 -08002127 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2128 * The device implements {@link #FEATURE_VR_MODE} but additionally meets all CTS requirements
2129 * to be certified as a "VR Ready" device, which guarantees that the device is capable of
2130 * delivering consistent performance at a high framerate over an extended period of time for
2131 * typical VR application CPU/GPU workloads with a minimal number of frame drops, implements
2132 * {@link #FEATURE_HIFI_SENSORS} with a low sensor latency, implements an optimized render path
2133 * to minimize latency to draw to the device's main display, and includes optimizations to
2134 * lower display persistence to an acceptable level.
2135 */
2136 @SdkConstant(SdkConstantType.FEATURE)
2137 public static final String FEATURE_VR_MODE_HIGH_PERFORMANCE
2138 = "android.hardware.vr.high_performance";
2139
2140 /**
Dianne Hackborne83cefce2010-02-04 17:38:14 -08002141 * Action to external storage service to clean out removed apps.
2142 * @hide
2143 */
2144 public static final String ACTION_CLEAN_EXTERNAL_STORAGE
2145 = "android.content.pm.CLEAN_EXTERNAL_STORAGE";
Oscar Montemayor1228d0a2010-01-28 12:01:44 -08002146
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002147 /**
Kenny Root5ab21572011-07-27 11:11:19 -07002148 * Extra field name for the URI to a verification file. Passed to a package
2149 * verifier.
2150 *
2151 * @hide
2152 */
2153 public static final String EXTRA_VERIFICATION_URI = "android.content.pm.extra.VERIFICATION_URI";
2154
2155 /**
2156 * Extra field name for the ID of a package pending verification. Passed to
2157 * a package verifier and is used to call back to
Kenny Root3a9b5fb2011-09-20 14:15:38 -07002158 * {@link PackageManager#verifyPendingInstall(int, int)}
Kenny Root5ab21572011-07-27 11:11:19 -07002159 */
2160 public static final String EXTRA_VERIFICATION_ID = "android.content.pm.extra.VERIFICATION_ID";
2161
2162 /**
2163 * Extra field name for the package identifier which is trying to install
2164 * the package.
2165 *
2166 * @hide
2167 */
2168 public static final String EXTRA_VERIFICATION_INSTALLER_PACKAGE
2169 = "android.content.pm.extra.VERIFICATION_INSTALLER_PACKAGE";
2170
2171 /**
2172 * Extra field name for the requested install flags for a package pending
2173 * verification. Passed to a package verifier.
2174 *
2175 * @hide
2176 */
2177 public static final String EXTRA_VERIFICATION_INSTALL_FLAGS
2178 = "android.content.pm.extra.VERIFICATION_INSTALL_FLAGS";
2179
2180 /**
rich cannings13d428e2012-09-13 13:43:07 -07002181 * Extra field name for the uid of who is requesting to install
2182 * the package.
2183 *
2184 * @hide
2185 */
2186 public static final String EXTRA_VERIFICATION_INSTALLER_UID
2187 = "android.content.pm.extra.VERIFICATION_INSTALLER_UID";
2188
2189 /**
2190 * Extra field name for the package name of a package pending verification.
2191 *
2192 * @hide
2193 */
2194 public static final String EXTRA_VERIFICATION_PACKAGE_NAME
2195 = "android.content.pm.extra.VERIFICATION_PACKAGE_NAME";
2196 /**
rich canningsd1b5cfc2012-08-29 14:49:51 -07002197 * Extra field name for the result of a verification, either
2198 * {@link #VERIFICATION_ALLOW}, or {@link #VERIFICATION_REJECT}.
2199 * Passed to package verifiers after a package is verified.
2200 */
2201 public static final String EXTRA_VERIFICATION_RESULT
2202 = "android.content.pm.extra.VERIFICATION_RESULT";
2203
2204 /**
rich cannings13d428e2012-09-13 13:43:07 -07002205 * Extra field name for the version code of a package pending verification.
2206 *
2207 * @hide
2208 */
2209 public static final String EXTRA_VERIFICATION_VERSION_CODE
2210 = "android.content.pm.extra.VERIFICATION_VERSION_CODE";
2211
2212 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07002213 * Extra field name for the ID of a intent filter pending verification.
2214 * Passed to an intent filter verifier and is used to call back to
2215 * {@link #verifyIntentFilter}
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08002216 *
2217 * @hide
2218 */
2219 public static final String EXTRA_INTENT_FILTER_VERIFICATION_ID
2220 = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_ID";
2221
2222 /**
2223 * Extra field name for the scheme used for an intent filter pending verification. Passed to
2224 * an intent filter verifier and is used to construct the URI to verify against.
2225 *
2226 * Usually this is "https"
2227 *
2228 * @hide
2229 */
2230 public static final String EXTRA_INTENT_FILTER_VERIFICATION_URI_SCHEME
2231 = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_URI_SCHEME";
2232
2233 /**
2234 * Extra field name for the host names to be used for an intent filter pending verification.
2235 * Passed to an intent filter verifier and is used to construct the URI to verify the
2236 * intent filter.
2237 *
2238 * This is a space delimited list of hosts.
2239 *
2240 * @hide
2241 */
2242 public static final String EXTRA_INTENT_FILTER_VERIFICATION_HOSTS
2243 = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_HOSTS";
2244
2245 /**
2246 * Extra field name for the package name to be used for an intent filter pending verification.
2247 * Passed to an intent filter verifier and is used to check the verification responses coming
2248 * from the hosts. Each host response will need to include the package name of APK containing
2249 * the intent filter.
2250 *
2251 * @hide
2252 */
2253 public static final String EXTRA_INTENT_FILTER_VERIFICATION_PACKAGE_NAME
2254 = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_PACKAGE_NAME";
2255
2256 /**
2257 * The action used to request that the user approve a permission request
2258 * from the application.
Nick Kralevich035f80d2013-03-27 15:20:08 -07002259 *
2260 * @hide
2261 */
Svetoslavc6d1c342015-02-26 14:44:43 -08002262 @SystemApi
2263 public static final String ACTION_REQUEST_PERMISSIONS =
2264 "android.content.pm.action.REQUEST_PERMISSIONS";
Nick Kralevich035f80d2013-03-27 15:20:08 -07002265
2266 /**
Svetoslavc6d1c342015-02-26 14:44:43 -08002267 * The names of the requested permissions.
2268 * <p>
2269 * <strong>Type:</strong> String[]
2270 * </p>
2271 *
2272 * @hide
2273 */
2274 @SystemApi
2275 public static final String EXTRA_REQUEST_PERMISSIONS_NAMES =
2276 "android.content.pm.extra.REQUEST_PERMISSIONS_NAMES";
2277
2278 /**
2279 * The results from the permissions request.
2280 * <p>
2281 * <strong>Type:</strong> int[] of #PermissionResult
2282 * </p>
2283 *
2284 * @hide
2285 */
2286 @SystemApi
2287 public static final String EXTRA_REQUEST_PERMISSIONS_RESULTS
2288 = "android.content.pm.extra.REQUEST_PERMISSIONS_RESULTS";
Nick Kralevich035f80d2013-03-27 15:20:08 -07002289
2290 /**
Jeff Sharkeybb580672014-07-10 12:10:25 -07002291 * String extra for {@link PackageInstallObserver} in the 'extras' Bundle in case of
Christopher Tatef1977b42014-03-24 16:25:51 -07002292 * {@link #INSTALL_FAILED_DUPLICATE_PERMISSION}. This extra names the package which provides
2293 * the existing definition for the permission.
2294 * @hide
2295 */
2296 public static final String EXTRA_FAILURE_EXISTING_PACKAGE
2297 = "android.content.pm.extra.FAILURE_EXISTING_PACKAGE";
2298
2299 /**
Jeff Sharkeybb580672014-07-10 12:10:25 -07002300 * String extra for {@link PackageInstallObserver} in the 'extras' Bundle in case of
Christopher Tatef1977b42014-03-24 16:25:51 -07002301 * {@link #INSTALL_FAILED_DUPLICATE_PERMISSION}. This extra names the permission that is
2302 * being redundantly defined by the package being installed.
2303 * @hide
2304 */
2305 public static final String EXTRA_FAILURE_EXISTING_PERMISSION
2306 = "android.content.pm.extra.FAILURE_EXISTING_PERMISSION";
2307
Svet Ganov8c7f7002015-05-07 10:48:44 -07002308 /**
2309 * Permission flag: The permission is set in its current state
2310 * by the user and apps can still request it at runtime.
2311 *
2312 * @hide
2313 */
Svet Ganov8c7f7002015-05-07 10:48:44 -07002314 public static final int FLAG_PERMISSION_USER_SET = 1 << 0;
2315
2316 /**
2317 * Permission flag: The permission is set in its current state
2318 * by the user and it is fixed, i.e. apps can no longer request
2319 * this permission.
2320 *
2321 * @hide
2322 */
Svet Ganov8c7f7002015-05-07 10:48:44 -07002323 public static final int FLAG_PERMISSION_USER_FIXED = 1 << 1;
2324
2325 /**
2326 * Permission flag: The permission is set in its current state
2327 * by device policy and neither apps nor the user can change
2328 * its state.
2329 *
2330 * @hide
2331 */
Svet Ganov8c7f7002015-05-07 10:48:44 -07002332 public static final int FLAG_PERMISSION_POLICY_FIXED = 1 << 2;
2333
2334 /**
2335 * Permission flag: The permission is set in a granted state but
2336 * access to resources it guards is restricted by other means to
2337 * enable revoking a permission on legacy apps that do not support
2338 * runtime permissions. If this permission is upgraded to runtime
2339 * because the app was updated to support runtime permissions, the
2340 * the permission will be revoked in the upgrade process.
2341 *
2342 * @hide
2343 */
Svet Ganov8c7f7002015-05-07 10:48:44 -07002344 public static final int FLAG_PERMISSION_REVOKE_ON_UPGRADE = 1 << 3;
2345
Svet Ganovb3f22b42015-05-12 11:01:24 -07002346 /**
2347 * Permission flag: The permission is set in its current state
2348 * because the app is a component that is a part of the system.
2349 *
2350 * @hide
2351 */
Svet Ganovb3f22b42015-05-12 11:01:24 -07002352 public static final int FLAG_PERMISSION_SYSTEM_FIXED = 1 << 4;
Svet Ganov8c7f7002015-05-07 10:48:44 -07002353
Svet Ganov77ab6a82015-07-03 12:03:02 -07002354 /**
2355 * Permission flag: The permission is granted by default because it
2356 * enables app functionality that is expected to work out-of-the-box
2357 * for providing a smooth user experience. For example, the phone app
2358 * is expected to have the phone permission.
2359 *
2360 * @hide
2361 */
2362 public static final int FLAG_PERMISSION_GRANTED_BY_DEFAULT = 1 << 5;
2363
Svet Ganov8c7f7002015-05-07 10:48:44 -07002364 /**
Svet Ganov9c165d72015-12-01 19:52:26 -08002365 * Permission flag: The permission has to be reviewed before any of
2366 * the app components can run.
2367 *
2368 * @hide
2369 */
2370 public static final int FLAG_PERMISSION_REVIEW_REQUIRED = 1 << 6;
2371
2372 /**
Svet Ganov8c7f7002015-05-07 10:48:44 -07002373 * Mask for all permission flags.
2374 *
2375 * @hide
2376 */
2377 @SystemApi
Svet Ganovb3f22b42015-05-12 11:01:24 -07002378 public static final int MASK_PERMISSION_FLAGS = 0xFF;
Svet Ganov8c7f7002015-05-07 10:48:44 -07002379
Christopher Tatef1977b42014-03-24 16:25:51 -07002380 /**
Svet Ganovd7b1f4112016-02-09 18:49:23 -08002381 * This is a library that contains components apps can invoke. For
2382 * example, a services for apps to bind to, or standard chooser UI,
2383 * etc. This library is versioned and backwards compatible. Clients
2384 * should check its version via {@link android.ext.services.Version
2385 * #getVersionCode()} and avoid calling APIs added in later versions.
2386 *
2387 * @hide
2388 */
2389 public static final String SYSTEM_SHARED_LIBRARY_SERVICES = "android.ext.services";
2390
2391 /**
2392 * This is a library that contains components apps can dynamically
2393 * load. For example, new widgets, helper classes, etc. This library
2394 * is versioned and backwards compatible. Clients should check its
2395 * version via {@link android.ext.shared.Version#getVersionCode()}
2396 * and avoid calling APIs added in later versions.
2397 *
2398 * @hide
2399 */
2400 public static final String SYSTEM_SHARED_LIBRARY_SHARED = "android.ext.shared";
2401
2402 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002403 * Retrieve overall information about an application package that is
2404 * installed on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002405 *
2406 * @param packageName The full name (i.e. com.google.apps.contacts) of the
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002407 * desired package.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002408 * @param flags Additional option flags. Use any combination of
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002409 * {@link #GET_ACTIVITIES}, {@link #GET_CONFIGURATIONS},
2410 * {@link #GET_GIDS}, {@link #GET_INSTRUMENTATION},
2411 * {@link #GET_INTENT_FILTERS}, {@link #GET_META_DATA},
2412 * {@link #GET_PERMISSIONS}, {@link #GET_PROVIDERS},
2413 * {@link #GET_RECEIVERS}, {@link #GET_SERVICES},
2414 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #GET_SIGNATURES},
2415 * {@link #GET_URI_PERMISSION_PATTERNS}, {@link #GET_UNINSTALLED_PACKAGES},
2416 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
2417 * {@link #MATCH_UNINSTALLED_PACKAGES}
2418 * to modify the data returned.
2419 *
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002420 * @return A PackageInfo object containing information about the
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002421 * package. If flag {@code MATCH_UNINSTALLED_PACKAGES} is set and if the
Kenny Root5ab21572011-07-27 11:11:19 -07002422 * package is not found in the list of installed applications, the
2423 * package information is retrieved from the list of uninstalled
kmccormick30498b42013-03-27 17:39:17 -07002424 * applications (which includes installed applications as well as
2425 * applications with data directory i.e. applications which had been
2426 * deleted with {@code DONT_DELETE_DATA} flag set).
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002427 * @throws NameNotFoundException if a package with the given name cannot be
2428 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002429 * @see #GET_ACTIVITIES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002430 * @see #GET_CONFIGURATIONS
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002431 * @see #GET_GIDS
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002432 * @see #GET_INSTRUMENTATION
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002433 * @see #GET_INTENT_FILTERS
2434 * @see #GET_META_DATA
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002435 * @see #GET_PERMISSIONS
2436 * @see #GET_PROVIDERS
2437 * @see #GET_RECEIVERS
2438 * @see #GET_SERVICES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002439 * @see #GET_SHARED_LIBRARY_FILES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002440 * @see #GET_SIGNATURES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002441 * @see #GET_URI_PERMISSION_PATTERNS
2442 * @see #MATCH_DISABLED_COMPONENTS
2443 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
2444 * @see #MATCH_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002445 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07002446 public abstract PackageInfo getPackageInfo(String packageName, @PackageInfoFlags int flags)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002447 throws NameNotFoundException;
2448
2449 /**
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002450 * @hide
2451 * Retrieve overall information about an application package that is
2452 * installed on the system.
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002453 *
2454 * @param packageName The full name (i.e. com.google.apps.contacts) of the
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002455 * desired package.
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002456 * @param flags Additional option flags. Use any combination of
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002457 * {@link #GET_ACTIVITIES}, {@link #GET_CONFIGURATIONS},
2458 * {@link #GET_GIDS}, {@link #GET_INSTRUMENTATION},
2459 * {@link #GET_INTENT_FILTERS}, {@link #GET_META_DATA},
2460 * {@link #GET_PERMISSIONS}, {@link #GET_PROVIDERS},
2461 * {@link #GET_RECEIVERS}, {@link #GET_SERVICES},
2462 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #GET_SIGNATURES},
2463 * {@link #GET_URI_PERMISSION_PATTERNS}, {@link #GET_UNINSTALLED_PACKAGES},
2464 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
2465 * {@link #MATCH_UNINSTALLED_PACKAGES}
2466 * to modify the data returned.
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002467 * @param userId The user id.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002468 *
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002469 * @return A PackageInfo object containing information about the
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002470 * package. If flag {@code MATCH_UNINSTALLED_PACKAGES} is set and if the
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002471 * package is not found in the list of installed applications, the
2472 * package information is retrieved from the list of uninstalled
2473 * applications (which includes installed applications as well as
2474 * applications with data directory i.e. applications which had been
2475 * deleted with {@code DONT_DELETE_DATA} flag set).
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002476 * @throws NameNotFoundException if a package with the given name cannot be
2477 * found on the system.
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002478 * @see #GET_ACTIVITIES
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002479 * @see #GET_CONFIGURATIONS
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002480 * @see #GET_GIDS
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002481 * @see #GET_INSTRUMENTATION
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002482 * @see #GET_INTENT_FILTERS
2483 * @see #GET_META_DATA
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002484 * @see #GET_PERMISSIONS
2485 * @see #GET_PROVIDERS
2486 * @see #GET_RECEIVERS
2487 * @see #GET_SERVICES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002488 * @see #GET_SHARED_LIBRARY_FILES
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002489 * @see #GET_SIGNATURES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002490 * @see #GET_URI_PERMISSION_PATTERNS
2491 * @see #MATCH_DISABLED_COMPONENTS
2492 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
2493 * @see #MATCH_UNINSTALLED_PACKAGES
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002494 */
2495 @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS)
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07002496 public abstract PackageInfo getPackageInfoAsUser(String packageName,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002497 @PackageInfoFlags int flags, @UserIdInt int userId) throws NameNotFoundException;
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002498
2499 /**
Dianne Hackborn47096932010-02-11 15:57:09 -08002500 * Map from the current package names in use on the device to whatever
2501 * the current canonical name of that package is.
2502 * @param names Array of current names to be mapped.
2503 * @return Returns an array of the same size as the original, containing
2504 * the canonical name for each package.
2505 */
2506 public abstract String[] currentToCanonicalPackageNames(String[] names);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002507
Dianne Hackborn47096932010-02-11 15:57:09 -08002508 /**
2509 * Map from a packages canonical name to the current name in use on the device.
2510 * @param names Array of new names to be mapped.
2511 * @return Returns an array of the same size as the original, containing
2512 * the current name for each package.
2513 */
2514 public abstract String[] canonicalToCurrentPackageNames(String[] names);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002515
Dianne Hackborn47096932010-02-11 15:57:09 -08002516 /**
Andrew Solovay5ae13352014-06-06 12:23:09 -07002517 * Returns a "good" intent to launch a front-door activity in a package.
2518 * This is used, for example, to implement an "open" button when browsing
2519 * through packages. The current implementation looks first for a main
2520 * activity in the category {@link Intent#CATEGORY_INFO}, and next for a
2521 * main activity in the category {@link Intent#CATEGORY_LAUNCHER}. Returns
2522 * <code>null</code> if neither are found.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002523 *
2524 * @param packageName The name of the package to inspect.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002525 *
Andrew Solovay5ae13352014-06-06 12:23:09 -07002526 * @return A fully-qualified {@link Intent} that can be used to launch the
2527 * main activity in the package. Returns <code>null</code> if the package
2528 * does not contain such an activity, or if <em>packageName</em> is not
Ihab Awad1ec68882014-09-12 11:09:01 -07002529 * recognized.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002530 */
Mihai Predaeae850c2009-05-13 10:13:48 +02002531 public abstract Intent getLaunchIntentForPackage(String packageName);
2532
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002533 /**
Jose Lima970417c2014-04-10 10:42:19 -07002534 * Return a "good" intent to launch a front-door Leanback activity in a
2535 * package, for use for example to implement an "open" button when browsing
2536 * through packages. The current implementation will look for a main
2537 * activity in the category {@link Intent#CATEGORY_LEANBACK_LAUNCHER}, or
2538 * return null if no main leanback activities are found.
Adam Connors551c0782014-06-05 12:13:03 +01002539 *
Jose Lima970417c2014-04-10 10:42:19 -07002540 * @param packageName The name of the package to inspect.
2541 * @return Returns either a fully-qualified Intent that can be used to launch
2542 * the main Leanback activity in the package, or null if the package
2543 * does not contain such an activity.
2544 */
2545 public abstract Intent getLeanbackLaunchIntentForPackage(String packageName);
2546
2547 /**
2548 * Return an array of all of the secondary group-ids that have been assigned
2549 * to a package.
Adam Connors551c0782014-06-05 12:13:03 +01002550 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002551 * @param packageName The full name (i.e. com.google.apps.contacts) of the
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002552 * desired package.
Jose Lima970417c2014-04-10 10:42:19 -07002553 * @return Returns an int array of the assigned gids, or null if there are
2554 * none.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002555 * @throws NameNotFoundException if a package with the given name cannot be
2556 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002557 */
2558 public abstract int[] getPackageGids(String packageName)
2559 throws NameNotFoundException;
2560
2561 /**
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002562 * Return an array of all of the secondary group-ids that have been assigned
2563 * to a package.
Dianne Hackborna06de0f2012-12-11 16:34:47 -08002564 *
2565 * @param packageName The full name (i.e. com.google.apps.contacts) of the
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002566 * desired package.
2567 * @return Returns an int array of the assigned gids, or null if there are
2568 * none.
2569 * @throws NameNotFoundException if a package with the given name cannot be
2570 * found on the system.
Dianne Hackborna06de0f2012-12-11 16:34:47 -08002571 */
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002572 public abstract int[] getPackageGids(String packageName, @PackageInfoFlags int flags)
Dianne Hackborna06de0f2012-12-11 16:34:47 -08002573 throws NameNotFoundException;
2574
2575 /**
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002576 * Return the UID associated with the given package name.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002577 *
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002578 * @param packageName The full name (i.e. com.google.apps.contacts) of the
2579 * desired package.
2580 * @return Returns an integer UID who owns the given package name.
2581 * @throws NameNotFoundException if a package with the given name can not be
2582 * found on the system.
2583 */
2584 public abstract int getPackageUid(String packageName, @PackageInfoFlags int flags)
2585 throws NameNotFoundException;
2586
2587 /**
2588 * Return the UID associated with the given package name.
2589 *
2590 * @param packageName The full name (i.e. com.google.apps.contacts) of the
2591 * desired package.
2592 * @param userId The user handle identifier to look up the package under.
2593 * @return Returns an integer UID who owns the given package name.
2594 * @throws NameNotFoundException if a package with the given name can not be
2595 * found on the system.
2596 * @hide
2597 */
2598 public abstract int getPackageUidAsUser(String packageName, @UserIdInt int userId)
2599 throws NameNotFoundException;
2600
2601 /**
2602 * Return the UID associated with the given package name.
2603 *
2604 * @param packageName The full name (i.e. com.google.apps.contacts) of the
2605 * desired package.
2606 * @param userId The user handle identifier to look up the package under.
2607 * @return Returns an integer UID who owns the given package name.
2608 * @throws NameNotFoundException if a package with the given name can not be
2609 * found on the system.
2610 * @hide
2611 */
2612 public abstract int getPackageUidAsUser(String packageName, @PackageInfoFlags int flags,
2613 @UserIdInt int userId) throws NameNotFoundException;
2614
2615 /**
2616 * Retrieve all of the information we know about a particular permission.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002617 *
2618 * @param name The fully qualified name (i.e. com.google.permission.LOGIN)
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002619 * of the permission you are interested in.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002620 * @param flags Additional option flags. Use {@link #GET_META_DATA} to
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002621 * retrieve any meta-data associated with the permission.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002622 *
2623 * @return Returns a {@link PermissionInfo} containing information about the
2624 * permission.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002625 * @throws NameNotFoundException if a package with the given name cannot be
2626 * found on the system.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002627 *
2628 * @see #GET_META_DATA
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002629 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07002630 public abstract PermissionInfo getPermissionInfo(String name, @PermissionInfoFlags int flags)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002631 throws NameNotFoundException;
2632
2633 /**
2634 * Query for all of the permissions associated with a particular group.
2635 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002636 * @param group The fully qualified name (i.e. com.google.permission.LOGIN)
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002637 * of the permission group you are interested in. Use null to
2638 * find all of the permissions not associated with a group.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002639 * @param flags Additional option flags. Use {@link #GET_META_DATA} to
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002640 * retrieve any meta-data associated with the permissions.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002641 *
2642 * @return Returns a list of {@link PermissionInfo} containing information
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002643 * about all of the permissions in the given group.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002644 * @throws NameNotFoundException if a package with the given name cannot be
2645 * found on the system.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002646 *
2647 * @see #GET_META_DATA
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002648 */
2649 public abstract List<PermissionInfo> queryPermissionsByGroup(String group,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07002650 @PermissionInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002651
2652 /**
2653 * Retrieve all of the information we know about a particular group of
2654 * permissions.
2655 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002656 * @param name The fully qualified name (i.e. com.google.permission_group.APPS)
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002657 * of the permission you are interested in.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002658 * @param flags Additional option flags. Use {@link #GET_META_DATA} to
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002659 * retrieve any meta-data associated with the permission group.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002660 *
2661 * @return Returns a {@link PermissionGroupInfo} containing information
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002662 * about the permission.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002663 * @throws NameNotFoundException if a package with the given name cannot be
2664 * found on the system.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002665 *
2666 * @see #GET_META_DATA
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002667 */
2668 public abstract PermissionGroupInfo getPermissionGroupInfo(String name,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07002669 @PermissionGroupInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002670
2671 /**
2672 * Retrieve all of the known permission groups in the system.
2673 *
2674 * @param flags Additional option flags. Use {@link #GET_META_DATA} to
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002675 * retrieve any meta-data associated with the permission group.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002676 *
2677 * @return Returns a list of {@link PermissionGroupInfo} containing
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002678 * information about all of the known permission groups.
2679 *
2680 * @see #GET_META_DATA
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002681 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07002682 public abstract List<PermissionGroupInfo> getAllPermissionGroups(
2683 @PermissionGroupInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002684
2685 /**
2686 * Retrieve all of the information we know about a particular
2687 * package/application.
2688 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002689 * @param packageName The full name (i.e. com.google.apps.contacts) of an
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002690 * application.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002691 * @param flags Additional option flags. Use any combination of
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002692 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
2693 * {@link #MATCH_SYSTEM_ONLY}, {@link #MATCH_UNINSTALLED_PACKAGES}
2694 * to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002695 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002696 * @return An {@link ApplicationInfo} containing information about the
2697 * package. If flag {@code MATCH_UNINSTALLED_PACKAGES} is set and if the
2698 * package is not found in the list of installed applications, the
2699 * application information is retrieved from the list of uninstalled
2700 * applications (which includes installed applications as well as
2701 * applications with data directory i.e. applications which had been
kmccormick30498b42013-03-27 17:39:17 -07002702 * deleted with {@code DONT_DELETE_DATA} flag set).
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002703 * @throws NameNotFoundException if a package with the given name cannot be
2704 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002705 *
2706 * @see #GET_META_DATA
2707 * @see #GET_SHARED_LIBRARY_FILES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002708 * @see #MATCH_SYSTEM_ONLY
2709 * @see #MATCH_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002710 */
2711 public abstract ApplicationInfo getApplicationInfo(String packageName,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07002712 @ApplicationInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002713
Jeff Sharkeycd654482016-01-08 17:42:11 -07002714 /** {@hide} */
2715 public abstract ApplicationInfo getApplicationInfoAsUser(String packageName,
2716 @ApplicationInfoFlags int flags, @UserIdInt int userId) throws NameNotFoundException;
2717
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002718 /**
2719 * Retrieve all of the information we know about a particular activity
2720 * class.
2721 *
Dianne Hackborn361199b2010-08-30 17:42:07 -07002722 * @param component The full component name (i.e.
2723 * com.google.apps.contacts/com.google.apps.contacts.ContactsList) of an Activity
2724 * class.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002725 * @param flags Additional option flags. Use any combination of
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002726 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
2727 * {@link #MATCH_ALL}, {@link #MATCH_DEFAULT_ONLY},
2728 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
2729 * {@link #MATCH_ENCRYPTION_AWARE}, {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE},
2730 * {@link #MATCH_ENCRYPTION_UNAWARE}, {@link #MATCH_SYSTEM_ONLY}
2731 * {@link #MATCH_UNINSTALLED_PACKAGES}
2732 * to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002733 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002734 * @return An {@link ActivityInfo} containing information about the activity.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002735 * @throws NameNotFoundException if a package with the given name cannot be
2736 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002737 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002738 * @see #GET_META_DATA
2739 * @see #GET_SHARED_LIBRARY_FILES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002740 * @see #MATCH_ALL
2741 * @see #MATCH_DEBUG_TRIAGED_MISSING
2742 * @see #MATCH_DEFAULT_ONLY
2743 * @see #MATCH_DISABLED_COMPONENTS
2744 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
2745 * @see #MATCH_ENCRYPTION_AWARE
2746 * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE
2747 * @see #MATCH_ENCRYPTION_UNAWARE
2748 * @see #MATCH_SYSTEM_ONLY
2749 * @see #MATCH_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002750 */
Dianne Hackborn361199b2010-08-30 17:42:07 -07002751 public abstract ActivityInfo getActivityInfo(ComponentName component,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07002752 @ComponentInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002753
2754 /**
2755 * Retrieve all of the information we know about a particular receiver
2756 * class.
2757 *
Dianne Hackborn361199b2010-08-30 17:42:07 -07002758 * @param component The full component name (i.e.
2759 * com.google.apps.calendar/com.google.apps.calendar.CalendarAlarm) of a Receiver
2760 * class.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002761 * @param flags Additional option flags. Use any combination of
2762 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
2763 * {@link #MATCH_ALL}, {@link #MATCH_DEFAULT_ONLY},
2764 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
2765 * {@link #MATCH_ENCRYPTION_AWARE}, {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE},
2766 * {@link #MATCH_ENCRYPTION_UNAWARE}, {@link #MATCH_SYSTEM_ONLY}
2767 * {@link #MATCH_UNINSTALLED_PACKAGES}
2768 * to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002769 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002770 * @return An {@link ActivityInfo} containing information about the receiver.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002771 * @throws NameNotFoundException if a package with the given name cannot be
2772 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002773 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002774 * @see #GET_META_DATA
2775 * @see #GET_SHARED_LIBRARY_FILES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002776 * @see #MATCH_ALL
2777 * @see #MATCH_DEBUG_TRIAGED_MISSING
2778 * @see #MATCH_DEFAULT_ONLY
2779 * @see #MATCH_DISABLED_COMPONENTS
2780 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
2781 * @see #MATCH_ENCRYPTION_AWARE
2782 * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE
2783 * @see #MATCH_ENCRYPTION_UNAWARE
2784 * @see #MATCH_SYSTEM_ONLY
2785 * @see #MATCH_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002786 */
Dianne Hackborn361199b2010-08-30 17:42:07 -07002787 public abstract ActivityInfo getReceiverInfo(ComponentName component,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07002788 @ComponentInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002789
2790 /**
2791 * Retrieve all of the information we know about a particular service
2792 * class.
2793 *
Dianne Hackborn361199b2010-08-30 17:42:07 -07002794 * @param component The full component name (i.e.
2795 * com.google.apps.media/com.google.apps.media.BackgroundPlayback) of a Service
2796 * class.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002797 * @param flags Additional option flags. Use any combination of
2798 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
2799 * {@link #MATCH_ALL}, {@link #MATCH_DEFAULT_ONLY},
2800 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
2801 * {@link #MATCH_ENCRYPTION_AWARE}, {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE},
2802 * {@link #MATCH_ENCRYPTION_UNAWARE}, {@link #MATCH_SYSTEM_ONLY}
2803 * {@link #MATCH_UNINSTALLED_PACKAGES}
2804 * to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002805 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002806 * @return A {@link ServiceInfo} object containing information about the service.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002807 * @throws NameNotFoundException if a package with the given name cannot be
2808 * found on the system.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002809 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002810 * @see #GET_META_DATA
2811 * @see #GET_SHARED_LIBRARY_FILES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002812 * @see #MATCH_ALL
2813 * @see #MATCH_DEBUG_TRIAGED_MISSING
2814 * @see #MATCH_DEFAULT_ONLY
2815 * @see #MATCH_DISABLED_COMPONENTS
2816 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
2817 * @see #MATCH_ENCRYPTION_AWARE
2818 * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE
2819 * @see #MATCH_ENCRYPTION_UNAWARE
2820 * @see #MATCH_SYSTEM_ONLY
2821 * @see #MATCH_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002822 */
Dianne Hackborn361199b2010-08-30 17:42:07 -07002823 public abstract ServiceInfo getServiceInfo(ComponentName component,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07002824 @ComponentInfoFlags int flags) throws NameNotFoundException;
Dianne Hackborn361199b2010-08-30 17:42:07 -07002825
2826 /**
2827 * Retrieve all of the information we know about a particular content
2828 * provider class.
2829 *
Dianne Hackborn361199b2010-08-30 17:42:07 -07002830 * @param component The full component name (i.e.
2831 * com.google.providers.media/com.google.providers.media.MediaProvider) of a
2832 * ContentProvider class.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002833 * @param flags Additional option flags. Use any combination of
2834 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
2835 * {@link #MATCH_ALL}, {@link #MATCH_DEFAULT_ONLY},
2836 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
2837 * {@link #MATCH_ENCRYPTION_AWARE}, {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE},
2838 * {@link #MATCH_ENCRYPTION_UNAWARE}, {@link #MATCH_SYSTEM_ONLY}
2839 * {@link #MATCH_UNINSTALLED_PACKAGES}
2840 * to modify the data returned.
Dianne Hackborn361199b2010-08-30 17:42:07 -07002841 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002842 * @return A {@link ProviderInfo} object containing information about the provider.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002843 * @throws NameNotFoundException if a package with the given name cannot be
2844 * found on the system.
Dianne Hackborn361199b2010-08-30 17:42:07 -07002845 *
2846 * @see #GET_META_DATA
2847 * @see #GET_SHARED_LIBRARY_FILES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002848 * @see #MATCH_ALL
2849 * @see #MATCH_DEBUG_TRIAGED_MISSING
2850 * @see #MATCH_DEFAULT_ONLY
2851 * @see #MATCH_DISABLED_COMPONENTS
2852 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
2853 * @see #MATCH_ENCRYPTION_AWARE
2854 * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE
2855 * @see #MATCH_ENCRYPTION_UNAWARE
2856 * @see #MATCH_SYSTEM_ONLY
2857 * @see #MATCH_UNINSTALLED_PACKAGES
Dianne Hackborn361199b2010-08-30 17:42:07 -07002858 */
2859 public abstract ProviderInfo getProviderInfo(ComponentName component,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07002860 @ComponentInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002861
2862 /**
2863 * Return a List of all packages that are installed
2864 * on the device.
2865 *
2866 * @param flags Additional option flags. Use any combination of
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002867 * {@link #GET_ACTIVITIES}, {@link #GET_CONFIGURATIONS},
2868 * {@link #GET_GIDS}, {@link #GET_INSTRUMENTATION},
2869 * {@link #GET_INTENT_FILTERS}, {@link #GET_META_DATA},
2870 * {@link #GET_PERMISSIONS}, {@link #GET_PROVIDERS},
2871 * {@link #GET_RECEIVERS}, {@link #GET_SERVICES},
2872 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #GET_SIGNATURES},
2873 * {@link #GET_URI_PERMISSION_PATTERNS}, {@link #GET_UNINSTALLED_PACKAGES},
2874 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
2875 * {@link #MATCH_UNINSTALLED_PACKAGES}
2876 * to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002877 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002878 * @return A List of PackageInfo objects, one for each installed package,
2879 * containing information about the package. In the unlikely case
2880 * there are no installed packages, an empty list is returned. If
2881 * flag {@code MATCH_UNINSTALLED_PACKAGES} is set, the package
2882 * information is retrieved from the list of uninstalled
2883 * applications (which includes installed applications as well as
2884 * applications with data directory i.e. applications which had been
2885 * deleted with {@code DONT_DELETE_DATA} flag set).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002886 *
2887 * @see #GET_ACTIVITIES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002888 * @see #GET_CONFIGURATIONS
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002889 * @see #GET_GIDS
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002890 * @see #GET_INSTRUMENTATION
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002891 * @see #GET_INTENT_FILTERS
2892 * @see #GET_META_DATA
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002893 * @see #GET_PERMISSIONS
2894 * @see #GET_PROVIDERS
2895 * @see #GET_RECEIVERS
2896 * @see #GET_SERVICES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002897 * @see #GET_SHARED_LIBRARY_FILES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002898 * @see #GET_SIGNATURES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002899 * @see #GET_URI_PERMISSION_PATTERNS
2900 * @see #MATCH_DISABLED_COMPONENTS
2901 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
2902 * @see #MATCH_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002903 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07002904 public abstract List<PackageInfo> getInstalledPackages(@PackageInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002905
2906 /**
Dianne Hackborne7991752013-01-16 17:56:46 -08002907 * Return a List of all installed packages that are currently
2908 * holding any of the given permissions.
2909 *
2910 * @param flags Additional option flags. Use any combination of
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002911 * {@link #GET_ACTIVITIES}, {@link #GET_CONFIGURATIONS},
2912 * {@link #GET_GIDS}, {@link #GET_INSTRUMENTATION},
2913 * {@link #GET_INTENT_FILTERS}, {@link #GET_META_DATA},
2914 * {@link #GET_PERMISSIONS}, {@link #GET_PROVIDERS},
2915 * {@link #GET_RECEIVERS}, {@link #GET_SERVICES},
2916 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #GET_SIGNATURES},
2917 * {@link #GET_URI_PERMISSION_PATTERNS}, {@link #GET_UNINSTALLED_PACKAGES},
2918 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
2919 * {@link #MATCH_UNINSTALLED_PACKAGES}
2920 * to modify the data returned.
Dianne Hackborne7991752013-01-16 17:56:46 -08002921 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002922 * @return A List of PackageInfo objects, one for each installed package
2923 * that holds any of the permissions that were provided, containing
2924 * information about the package. If no installed packages hold any
2925 * of the permissions, an empty list is returned. If flag
2926 * {@code MATCH_UNINSTALLED_PACKAGES} is set, the package information
2927 * is retrieved from the list of uninstalled applications (which
2928 * includes installed applications as well as applications with data
2929 * directory i.e. applications which had been deleted with
2930 * {@code DONT_DELETE_DATA} flag set).
Dianne Hackborne7991752013-01-16 17:56:46 -08002931 *
2932 * @see #GET_ACTIVITIES
Dianne Hackborne7991752013-01-16 17:56:46 -08002933 * @see #GET_CONFIGURATIONS
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002934 * @see #GET_GIDS
Dianne Hackborne7991752013-01-16 17:56:46 -08002935 * @see #GET_INSTRUMENTATION
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002936 * @see #GET_INTENT_FILTERS
2937 * @see #GET_META_DATA
Dianne Hackborne7991752013-01-16 17:56:46 -08002938 * @see #GET_PERMISSIONS
2939 * @see #GET_PROVIDERS
2940 * @see #GET_RECEIVERS
2941 * @see #GET_SERVICES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002942 * @see #GET_SHARED_LIBRARY_FILES
Dianne Hackborne7991752013-01-16 17:56:46 -08002943 * @see #GET_SIGNATURES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002944 * @see #GET_URI_PERMISSION_PATTERNS
2945 * @see #MATCH_DISABLED_COMPONENTS
2946 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
2947 * @see #MATCH_UNINSTALLED_PACKAGES
Dianne Hackborne7991752013-01-16 17:56:46 -08002948 */
2949 public abstract List<PackageInfo> getPackagesHoldingPermissions(
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07002950 String[] permissions, @PackageInfoFlags int flags);
Dianne Hackborne7991752013-01-16 17:56:46 -08002951
2952 /**
Amith Yamasani151ec4c2012-09-07 19:25:16 -07002953 * Return a List of all packages that are installed on the device, for a specific user.
2954 * Requesting a list of installed packages for another user
2955 * will require the permission INTERACT_ACROSS_USERS_FULL.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002956 *
Amith Yamasani151ec4c2012-09-07 19:25:16 -07002957 * @param flags Additional option flags. Use any combination of
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002958 * {@link #GET_ACTIVITIES}, {@link #GET_CONFIGURATIONS},
2959 * {@link #GET_GIDS}, {@link #GET_INSTRUMENTATION},
2960 * {@link #GET_INTENT_FILTERS}, {@link #GET_META_DATA},
2961 * {@link #GET_PERMISSIONS}, {@link #GET_PROVIDERS},
2962 * {@link #GET_RECEIVERS}, {@link #GET_SERVICES},
2963 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #GET_SIGNATURES},
2964 * {@link #GET_URI_PERMISSION_PATTERNS}, {@link #GET_UNINSTALLED_PACKAGES},
2965 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
2966 * {@link #MATCH_UNINSTALLED_PACKAGES}
2967 * to modify the data returned.
Amith Yamasani151ec4c2012-09-07 19:25:16 -07002968 * @param userId The user for whom the installed packages are to be listed
2969 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002970 * @return A List of PackageInfo objects, one for each installed package,
2971 * containing information about the package. In the unlikely case
2972 * there are no installed packages, an empty list is returned. If
2973 * flag {@code MATCH_UNINSTALLED_PACKAGES} is set, the package
2974 * information is retrieved from the list of uninstalled
2975 * applications (which includes installed applications as well as
2976 * applications with data directory i.e. applications which had been
2977 * deleted with {@code DONT_DELETE_DATA} flag set).
Amith Yamasani151ec4c2012-09-07 19:25:16 -07002978 *
2979 * @see #GET_ACTIVITIES
Amith Yamasani151ec4c2012-09-07 19:25:16 -07002980 * @see #GET_CONFIGURATIONS
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002981 * @see #GET_GIDS
Amith Yamasani151ec4c2012-09-07 19:25:16 -07002982 * @see #GET_INSTRUMENTATION
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002983 * @see #GET_INTENT_FILTERS
2984 * @see #GET_META_DATA
Amith Yamasani151ec4c2012-09-07 19:25:16 -07002985 * @see #GET_PERMISSIONS
2986 * @see #GET_PROVIDERS
2987 * @see #GET_RECEIVERS
2988 * @see #GET_SERVICES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002989 * @see #GET_SHARED_LIBRARY_FILES
Amith Yamasani151ec4c2012-09-07 19:25:16 -07002990 * @see #GET_SIGNATURES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002991 * @see #GET_URI_PERMISSION_PATTERNS
2992 * @see #MATCH_DISABLED_COMPONENTS
2993 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
2994 * @see #MATCH_UNINSTALLED_PACKAGES
Amith Yamasani151ec4c2012-09-07 19:25:16 -07002995 *
2996 * @hide
2997 */
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07002998 public abstract List<PackageInfo> getInstalledPackagesAsUser(@PackageInfoFlags int flags,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002999 @UserIdInt int userId);
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003000
3001 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003002 * Check whether a particular package has been granted a particular
3003 * permission.
3004 *
Svet Ganovad3b2972015-07-07 22:49:17 -07003005 * @param permName The name of the permission you are checking for.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003006 * @param pkgName The name of the package you are checking against.
3007 *
3008 * @return If the package has the permission, PERMISSION_GRANTED is
3009 * returned. If it does not have the permission, PERMISSION_DENIED
3010 * is returned.
3011 *
3012 * @see #PERMISSION_GRANTED
3013 * @see #PERMISSION_DENIED
3014 */
Tor Norbye1c2bf032015-03-02 10:57:08 -08003015 @CheckResult
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003016 public abstract int checkPermission(String permName, String pkgName);
3017
3018 /**
Svet Ganovad3b2972015-07-07 22:49:17 -07003019 * Checks whether a particular permissions has been revoked for a
3020 * package by policy. Typically the device owner or the profile owner
3021 * may apply such a policy. The user cannot grant policy revoked
3022 * permissions, hence the only way for an app to get such a permission
3023 * is by a policy change.
3024 *
3025 * @param permName The name of the permission you are checking for.
3026 * @param pkgName The name of the package you are checking against.
3027 *
3028 * @return Whether the permission is restricted by policy.
3029 */
3030 @CheckResult
Svet Ganovf1b7f202015-07-29 08:33:42 -07003031 public abstract boolean isPermissionRevokedByPolicy(@NonNull String permName,
3032 @NonNull String pkgName);
3033
3034 /**
3035 * Gets the package name of the component controlling runtime permissions.
3036 *
3037 * @return The package name.
3038 *
3039 * @hide
3040 */
3041 public abstract String getPermissionControllerPackageName();
Svet Ganovad3b2972015-07-07 22:49:17 -07003042
3043 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003044 * Add a new dynamic permission to the system. For this to work, your
3045 * package must have defined a permission tree through the
3046 * {@link android.R.styleable#AndroidManifestPermissionTree
3047 * &lt;permission-tree&gt;} tag in its manifest. A package can only add
3048 * permissions to trees that were defined by either its own package or
3049 * another with the same user id; a permission is in a tree if it
3050 * matches the name of the permission tree + ".": for example,
3051 * "com.foo.bar" is a member of the permission tree "com.foo".
3052 *
3053 * <p>It is good to make your permission tree name descriptive, because you
3054 * are taking possession of that entire set of permission names. Thus, it
3055 * must be under a domain you control, with a suffix that will not match
3056 * any normal permissions that may be declared in any applications that
3057 * are part of that domain.
3058 *
3059 * <p>New permissions must be added before
3060 * any .apks are installed that use those permissions. Permissions you
3061 * add through this method are remembered across reboots of the device.
3062 * If the given permission already exists, the info you supply here
3063 * will be used to update it.
3064 *
3065 * @param info Description of the permission to be added.
3066 *
3067 * @return Returns true if a new permission was created, false if an
3068 * existing one was updated.
3069 *
3070 * @throws SecurityException if you are not allowed to add the
3071 * given permission name.
3072 *
3073 * @see #removePermission(String)
3074 */
3075 public abstract boolean addPermission(PermissionInfo info);
3076
3077 /**
Dianne Hackbornd7c09682010-03-30 10:42:20 -07003078 * Like {@link #addPermission(PermissionInfo)} but asynchronously
3079 * persists the package manager state after returning from the call,
3080 * allowing it to return quicker and batch a series of adds at the
3081 * expense of no guarantee the added permission will be retained if
3082 * the device is rebooted before it is written.
3083 */
3084 public abstract boolean addPermissionAsync(PermissionInfo info);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003085
Dianne Hackbornd7c09682010-03-30 10:42:20 -07003086 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003087 * Removes a permission that was previously added with
3088 * {@link #addPermission(PermissionInfo)}. The same ownership rules apply
3089 * -- you are only allowed to remove permissions that you are allowed
3090 * to add.
3091 *
3092 * @param name The name of the permission to remove.
3093 *
3094 * @throws SecurityException if you are not allowed to remove the
3095 * given permission name.
3096 *
3097 * @see #addPermission(PermissionInfo)
3098 */
3099 public abstract void removePermission(String name);
3100
Svet Ganov8c7f7002015-05-07 10:48:44 -07003101
3102 /**
3103 * Permission flags set when granting or revoking a permission.
3104 *
3105 * @hide
3106 */
3107 @SystemApi
3108 @IntDef({FLAG_PERMISSION_USER_SET,
3109 FLAG_PERMISSION_USER_FIXED,
3110 FLAG_PERMISSION_POLICY_FIXED,
Svet Ganovb3f22b42015-05-12 11:01:24 -07003111 FLAG_PERMISSION_REVOKE_ON_UPGRADE,
Svet Ganov77ab6a82015-07-03 12:03:02 -07003112 FLAG_PERMISSION_SYSTEM_FIXED,
3113 FLAG_PERMISSION_GRANTED_BY_DEFAULT})
Svet Ganov8c7f7002015-05-07 10:48:44 -07003114 @Retention(RetentionPolicy.SOURCE)
3115 public @interface PermissionFlags {}
3116
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003117 /**
Svetoslavc6d1c342015-02-26 14:44:43 -08003118 * Grant a runtime permission to an application which the application does not
3119 * already have. The permission must have been requested by the application.
3120 * If the application is not allowed to hold the permission, a {@link
3121 * java.lang.SecurityException} is thrown.
3122 * <p>
3123 * <strong>Note: </strong>Using this API requires holding
3124 * android.permission.GRANT_REVOKE_PERMISSIONS and if the user id is
3125 * not the current user android.permission.INTERACT_ACROSS_USERS_FULL.
3126 * </p>
Nick Kralevich035f80d2013-03-27 15:20:08 -07003127 *
Svetoslavc6d1c342015-02-26 14:44:43 -08003128 * @param packageName The package to which to grant the permission.
3129 * @param permissionName The permission name to grant.
3130 * @param user The user for which to grant the permission.
3131 *
Svet Ganov8c7f7002015-05-07 10:48:44 -07003132 * @see #revokeRuntimePermission(String, String, android.os.UserHandle)
3133 * @see android.content.pm.PackageManager.PermissionFlags
Svetoslavc6d1c342015-02-26 14:44:43 -08003134 *
3135 * @hide
Nick Kralevich035f80d2013-03-27 15:20:08 -07003136 */
Svetoslavc6d1c342015-02-26 14:44:43 -08003137 @SystemApi
Svet Ganov8c7f7002015-05-07 10:48:44 -07003138 public abstract void grantRuntimePermission(@NonNull String packageName,
Svetoslavc6d1c342015-02-26 14:44:43 -08003139 @NonNull String permissionName, @NonNull UserHandle user);
Nick Kralevich035f80d2013-03-27 15:20:08 -07003140
Svetoslavc6d1c342015-02-26 14:44:43 -08003141 /**
3142 * Revoke a runtime permission that was previously granted by {@link
Svet Ganov8c7f7002015-05-07 10:48:44 -07003143 * #grantRuntimePermission(String, String, android.os.UserHandle)}. The
3144 * permission must have been requested by and granted to the application.
3145 * If the application is not allowed to hold the permission, a {@link
Svetoslavc6d1c342015-02-26 14:44:43 -08003146 * java.lang.SecurityException} is thrown.
3147 * <p>
3148 * <strong>Note: </strong>Using this API requires holding
3149 * android.permission.GRANT_REVOKE_PERMISSIONS and if the user id is
3150 * not the current user android.permission.INTERACT_ACROSS_USERS_FULL.
3151 * </p>
3152 *
3153 * @param packageName The package from which to revoke the permission.
3154 * @param permissionName The permission name to revoke.
3155 * @param user The user for which to revoke the permission.
3156 *
Svet Ganov8c7f7002015-05-07 10:48:44 -07003157 * @see #grantRuntimePermission(String, String, android.os.UserHandle)
3158 * @see android.content.pm.PackageManager.PermissionFlags
Svetoslavc6d1c342015-02-26 14:44:43 -08003159 *
3160 * @hide
3161 */
3162 @SystemApi
Svet Ganov8c7f7002015-05-07 10:48:44 -07003163 public abstract void revokeRuntimePermission(@NonNull String packageName,
Svetoslavc6d1c342015-02-26 14:44:43 -08003164 @NonNull String permissionName, @NonNull UserHandle user);
3165
3166 /**
Svet Ganov8c7f7002015-05-07 10:48:44 -07003167 * Gets the state flags associated with a permission.
3168 *
3169 * @param permissionName The permission for which to get the flags.
3170 * @param packageName The package name for which to get the flags.
3171 * @param user The user for which to get permission flags.
3172 * @return The permission flags.
3173 *
3174 * @hide
3175 */
3176 @SystemApi
3177 public abstract @PermissionFlags int getPermissionFlags(String permissionName,
3178 String packageName, @NonNull UserHandle user);
3179
3180 /**
3181 * Updates the flags associated with a permission by replacing the flags in
3182 * the specified mask with the provided flag values.
3183 *
3184 * @param permissionName The permission for which to update the flags.
3185 * @param packageName The package name for which to update the flags.
3186 * @param flagMask The flags which to replace.
3187 * @param flagValues The flags with which to replace.
3188 * @param user The user for which to update the permission flags.
3189 *
3190 * @hide
3191 */
3192 @SystemApi
3193 public abstract void updatePermissionFlags(String permissionName,
3194 String packageName, @PermissionFlags int flagMask, int flagValues,
3195 @NonNull UserHandle user);
3196
3197 /**
Svetoslav20770dd2015-05-29 15:43:04 -07003198 * Gets whether you should show UI with rationale for requesting a permission.
3199 * You should do this only if you do not have the permission and the context in
3200 * which the permission is requested does not clearly communicate to the user
3201 * what would be the benefit from grating this permission.
3202 *
3203 * @param permission A permission your app wants to request.
3204 * @return Whether you can show permission rationale UI.
3205 *
3206 * @hide
3207 */
3208 public abstract boolean shouldShowRequestPermissionRationale(String permission);
3209
3210 /**
Svetoslavc6d1c342015-02-26 14:44:43 -08003211 * Returns an {@link android.content.Intent} suitable for passing to
3212 * {@link android.app.Activity#startActivityForResult(android.content.Intent, int)}
3213 * which prompts the user to grant permissions to this application.
3214 *
3215 * @throws NullPointerException if {@code permissions} is {@code null} or empty.
3216 *
3217 * @hide
3218 */
3219 public Intent buildRequestPermissionsIntent(@NonNull String[] permissions) {
3220 if (ArrayUtils.isEmpty(permissions)) {
Svet Ganovf66381c2016-02-18 20:02:36 -08003221 throw new IllegalArgumentException("permission cannot be null or empty");
Svetoslavc6d1c342015-02-26 14:44:43 -08003222 }
3223 Intent intent = new Intent(ACTION_REQUEST_PERMISSIONS);
3224 intent.putExtra(EXTRA_REQUEST_PERMISSIONS_NAMES, permissions);
Svet Ganovf1b7f202015-07-29 08:33:42 -07003225 intent.setPackage(getPermissionControllerPackageName());
Svetoslavc6d1c342015-02-26 14:44:43 -08003226 return intent;
Nick Kralevich035f80d2013-03-27 15:20:08 -07003227 }
3228
3229 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003230 * Compare the signatures of two packages to determine if the same
3231 * signature appears in both of them. If they do contain the same
3232 * signature, then they are allowed special privileges when working
3233 * with each other: they can share the same user-id, run instrumentation
3234 * against each other, etc.
3235 *
3236 * @param pkg1 First package name whose signature will be compared.
3237 * @param pkg2 Second package name whose signature will be compared.
Chris Palmer09f33602010-09-13 14:27:18 -07003238 *
3239 * @return Returns an integer indicating whether all signatures on the
3240 * two packages match. The value is >= 0 ({@link #SIGNATURE_MATCH}) if
3241 * all signatures match or < 0 if there is not a match ({@link
3242 * #SIGNATURE_NO_MATCH} or {@link #SIGNATURE_UNKNOWN_PACKAGE}).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003243 *
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07003244 * @see #checkSignatures(int, int)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003245 * @see #SIGNATURE_MATCH
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003246 * @see #SIGNATURE_NO_MATCH
3247 * @see #SIGNATURE_UNKNOWN_PACKAGE
3248 */
Tor Norbye1c2bf032015-03-02 10:57:08 -08003249 @CheckResult
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003250 public abstract int checkSignatures(String pkg1, String pkg2);
3251
3252 /**
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07003253 * Like {@link #checkSignatures(String, String)}, but takes UIDs of
3254 * the two packages to be checked. This can be useful, for example,
3255 * when doing the check in an IPC, where the UID is the only identity
3256 * available. It is functionally identical to determining the package
3257 * associated with the UIDs and checking their signatures.
3258 *
Joe Onorato25660ec2009-08-12 22:40:37 -07003259 * @param uid1 First UID whose signature will be compared.
3260 * @param uid2 Second UID whose signature will be compared.
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07003261 *
Chris Palmer09f33602010-09-13 14:27:18 -07003262 * @return Returns an integer indicating whether all signatures on the
3263 * two packages match. The value is >= 0 ({@link #SIGNATURE_MATCH}) if
3264 * all signatures match or < 0 if there is not a match ({@link
3265 * #SIGNATURE_NO_MATCH} or {@link #SIGNATURE_UNKNOWN_PACKAGE}).
3266 *
3267 * @see #checkSignatures(String, String)
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07003268 * @see #SIGNATURE_MATCH
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07003269 * @see #SIGNATURE_NO_MATCH
3270 * @see #SIGNATURE_UNKNOWN_PACKAGE
3271 */
Tor Norbye1c2bf032015-03-02 10:57:08 -08003272 @CheckResult
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07003273 public abstract int checkSignatures(int uid1, int uid2);
3274
3275 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003276 * Retrieve the names of all packages that are associated with a particular
3277 * user id. In most cases, this will be a single package name, the package
3278 * that has been assigned that user id. Where there are multiple packages
3279 * sharing the same user id through the "sharedUserId" mechanism, all
3280 * packages with that id will be returned.
3281 *
3282 * @param uid The user id for which you would like to retrieve the
3283 * associated packages.
3284 *
3285 * @return Returns an array of one or more packages assigned to the user
3286 * id, or null if there are no known packages with the given id.
3287 */
Jeff Sharkey377ded0f2016-01-10 13:15:41 -07003288 public abstract @Nullable String[] getPackagesForUid(int uid);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003289
3290 /**
3291 * Retrieve the official name associated with a user id. This name is
Jonathan Basseri7ea3a332015-05-12 19:39:22 -07003292 * guaranteed to never change, though it is possible for the underlying
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003293 * user id to be changed. That is, if you are storing information about
3294 * user ids in persistent storage, you should use the string returned
3295 * by this function instead of the raw user-id.
3296 *
3297 * @param uid The user id for which you would like to retrieve a name.
3298 * @return Returns a unique name for the given user id, or null if the
3299 * user id is not currently assigned.
3300 */
Jeff Sharkey377ded0f2016-01-10 13:15:41 -07003301 public abstract @Nullable String getNameForUid(int uid);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003302
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003303 /**
3304 * Return the user id associated with a shared user name. Multiple
3305 * applications can specify a shared user name in their manifest and thus
3306 * end up using a common uid. This might be used for new applications
3307 * that use an existing shared user name and need to know the uid of the
3308 * shared user.
3309 *
3310 * @param sharedUserName The shared user name whose uid is to be retrieved.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003311 * @return Returns the UID associated with the shared user.
3312 * @throws NameNotFoundException if a package with the given name cannot be
3313 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003314 * @hide
3315 */
3316 public abstract int getUidForSharedUser(String sharedUserName)
3317 throws NameNotFoundException;
3318
3319 /**
3320 * Return a List of all application packages that are installed on the
3321 * device. If flag GET_UNINSTALLED_PACKAGES has been set, a list of all
kmccormick30498b42013-03-27 17:39:17 -07003322 * applications including those deleted with {@code DONT_DELETE_DATA} (partially
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003323 * installed apps with data directory) will be returned.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003324 *
3325 * @param flags Additional option flags. Use any combination of
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003326 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003327 * {@link #MATCH_SYSTEM_ONLY}, {@link #MATCH_UNINSTALLED_PACKAGES}
3328 * to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003329 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003330 * @return A List of ApplicationInfo objects, one for each installed application.
3331 * In the unlikely case there are no installed packages, an empty list
3332 * is returned. If flag {@code MATCH_UNINSTALLED_PACKAGES} is set, the
3333 * application information is retrieved from the list of uninstalled
3334 * applications (which includes installed applications as well as
3335 * applications with data directory i.e. applications which had been
3336 * deleted with {@code DONT_DELETE_DATA} flag set).
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003337 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003338 * @see #GET_META_DATA
3339 * @see #GET_SHARED_LIBRARY_FILES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003340 * @see #MATCH_SYSTEM_ONLY
3341 * @see #MATCH_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003342 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003343 public abstract List<ApplicationInfo> getInstalledApplications(@ApplicationInfoFlags int flags);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003344
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003345 /**
Svet Ganov2acf0632015-11-24 19:10:59 -08003346 * Gets the ephemeral applications the user recently used. Requires
3347 * holding "android.permission.ACCESS_EPHEMERAL_APPS".
3348 *
3349 * @return The ephemeral app list.
3350 *
3351 * @hide
3352 */
3353 @RequiresPermission(Manifest.permission.ACCESS_EPHEMERAL_APPS)
3354 public abstract List<EphemeralApplicationInfo> getEphemeralApplications();
3355
3356 /**
3357 * Gets the icon for an ephemeral application.
3358 *
3359 * @param packageName The app package name.
3360 *
3361 * @hide
3362 */
3363 public abstract Drawable getEphemeralApplicationIcon(String packageName);
3364
3365 /**
3366 * Gets whether the caller is an ephemeral app.
3367 *
3368 * @return Whether caller is an ephemeral app.
3369 *
3370 * @see #setEphemeralCookie(byte[])
3371 * @see #getEphemeralCookie()
3372 * @see #getEphemeralCookieMaxSizeBytes()
Todd Kennedy12705132016-01-05 15:17:57 -08003373 *
3374 * @hide
Svet Ganov2acf0632015-11-24 19:10:59 -08003375 */
3376 public abstract boolean isEphemeralApplication();
3377
3378 /**
3379 * Gets the maximum size in bytes of the cookie data an ephemeral app
3380 * can store on the device.
3381 *
3382 * @return The max cookie size in bytes.
3383 *
3384 * @see #isEphemeralApplication()
3385 * @see #setEphemeralCookie(byte[])
3386 * @see #getEphemeralCookie()
Todd Kennedy12705132016-01-05 15:17:57 -08003387 *
3388 * @hide
Svet Ganov2acf0632015-11-24 19:10:59 -08003389 */
3390 public abstract int getEphemeralCookieMaxSizeBytes();
3391
3392 /**
3393 * Gets the ephemeral application cookie for this app. Non
3394 * ephemeral apps and apps that were ephemeral but were upgraded
3395 * to non-ephemeral can still access this API. For ephemeral apps
3396 * this cooke is cached for some time after uninstall while for
3397 * normal apps the cookie is deleted after the app is uninstalled.
3398 * The cookie is always present while the app is installed.
3399 *
3400 * @return The cookie.
3401 *
3402 * @see #isEphemeralApplication()
3403 * @see #setEphemeralCookie(byte[])
3404 * @see #getEphemeralCookieMaxSizeBytes()
Todd Kennedy12705132016-01-05 15:17:57 -08003405 *
3406 * @hide
Svet Ganov2acf0632015-11-24 19:10:59 -08003407 */
3408 public abstract @NonNull byte[] getEphemeralCookie();
3409
3410 /**
3411 * Sets the ephemeral application cookie for the calling app. Non
3412 * ephemeral apps and apps that were ephemeral but were upgraded
3413 * to non-ephemeral can still access this API. For ephemeral apps
3414 * this cooke is cached for some time after uninstall while for
3415 * normal apps the cookie is deleted after the app is uninstalled.
3416 * The cookie is always present while the app is installed. The
3417 * cookie size is limited by {@link #getEphemeralCookieMaxSizeBytes()}.
3418 *
3419 * @param cookie The cookie data.
3420 * @return True if the cookie was set.
3421 *
3422 * @see #isEphemeralApplication()
3423 * @see #getEphemeralCookieMaxSizeBytes()
Jeff Sharkey5aa86932016-01-08 19:07:49 -07003424 * @see #getEphemeralCookie()
Todd Kennedy12705132016-01-05 15:17:57 -08003425 *
3426 * @hide
Svet Ganov2acf0632015-11-24 19:10:59 -08003427 */
3428 public abstract boolean setEphemeralCookie(@NonNull byte[] cookie);
3429
3430 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003431 * Get a list of shared libraries that are available on the
3432 * system.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003433 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003434 * @return An array of shared library names that are
3435 * available on the system, or null if none are installed.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003436 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003437 */
3438 public abstract String[] getSystemSharedLibraryNames();
3439
3440 /**
Svet Ganovd7b1f4112016-02-09 18:49:23 -08003441 * Get the name of the package hosting the services shared library.
3442 *
3443 * @return The library host package.
3444 *
3445 * @hide
3446 */
3447 public abstract @Nullable String getServicesSystemSharedLibraryPackageName();
3448
3449 /**
Dianne Hackborn49237342009-08-27 20:08:01 -07003450 * Get a list of features that are available on the
3451 * system.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003452 *
Dianne Hackborn49237342009-08-27 20:08:01 -07003453 * @return An array of FeatureInfo classes describing the features
3454 * that are available on the system, or null if there are none(!!).
Dianne Hackborn49237342009-08-27 20:08:01 -07003455 */
3456 public abstract FeatureInfo[] getSystemAvailableFeatures();
3457
3458 /**
Jeff Sharkey115d2c12016-02-15 17:25:57 -07003459 * Check whether the given feature name is one of the available features as
3460 * returned by {@link #getSystemAvailableFeatures()}. This tests for the
3461 * presence of <em>any</em> version of the given feature name; use
3462 * {@link #hasSystemFeature(String, int)} to check for a minimum version.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003463 *
Jeff Sharkey115d2c12016-02-15 17:25:57 -07003464 * @return Returns true if the devices supports the feature, else false.
Dianne Hackborn039c68e2009-09-26 16:39:23 -07003465 */
3466 public abstract boolean hasSystemFeature(String name);
3467
3468 /**
Jeff Sharkey115d2c12016-02-15 17:25:57 -07003469 * Check whether the given feature name and version is one of the available
3470 * features as returned by {@link #getSystemAvailableFeatures()}. Since
3471 * features are defined to always be backwards compatible, this returns true
3472 * if the available feature version is greater than or equal to the
3473 * requested version.
3474 *
3475 * @return Returns true if the devices supports the feature, else false.
3476 */
3477 public abstract boolean hasSystemFeature(String name, int version);
3478
3479 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003480 * Determine the best action to perform for a given Intent. This is how
3481 * {@link Intent#resolveActivity} finds an activity if a class has not
3482 * been explicitly specified.
3483 *
Scott Mainef6b3052011-03-23 14:23:02 -07003484 * <p><em>Note:</em> if using an implicit Intent (without an explicit ComponentName
Dianne Hackborn4d023d212010-10-01 13:41:04 -07003485 * specified), be sure to consider whether to set the {@link #MATCH_DEFAULT_ONLY}
3486 * only flag. You need to do so to resolve the activity in the same way
3487 * that {@link android.content.Context#startActivity(Intent)} and
3488 * {@link android.content.Intent#resolveActivity(PackageManager)
3489 * Intent.resolveActivity(PackageManager)} do.</p>
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003490 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003491 * @param intent An intent containing all of the desired specification
3492 * (action, data, type, category, and/or component).
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003493 * @param flags Additional option flags. Use any combination of
3494 * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER},
3495 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL},
3496 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
3497 * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_ENCRYPTION_AWARE},
3498 * {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE}, {@link #MATCH_ENCRYPTION_UNAWARE},
3499 * {@link #MATCH_SYSTEM_ONLY}, {@link #MATCH_UNINSTALLED_PACKAGES}
3500 * to modify the data returned. The most important is
3501 * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only
3502 * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003503 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003504 * @return Returns a ResolveInfo object containing the final activity intent
3505 * that was determined to be the best action. Returns null if no
Mike LeBeaubd3f5272010-02-18 19:27:17 -08003506 * matching activity was found. If multiple matching activities are
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003507 * found and there is no default set, returns a ResolveInfo object
Mike LeBeaubd3f5272010-02-18 19:27:17 -08003508 * containing something else, such as the activity resolver.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003509 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003510 * @see #GET_META_DATA
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003511 * @see #GET_RESOLVED_FILTER
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003512 * @see #GET_SHARED_LIBRARY_FILES
3513 * @see #MATCH_ALL
3514 * @see #MATCH_DISABLED_COMPONENTS
3515 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
3516 * @see #MATCH_DEFAULT_ONLY
3517 * @see #MATCH_ENCRYPTION_AWARE
3518 * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE
3519 * @see #MATCH_ENCRYPTION_UNAWARE
3520 * @see #MATCH_SYSTEM_ONLY
3521 * @see #MATCH_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003522 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003523 public abstract ResolveInfo resolveActivity(Intent intent, @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003524
3525 /**
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07003526 * Determine the best action to perform for a given Intent for a given user. This
3527 * is how {@link Intent#resolveActivity} finds an activity if a class has not
3528 * been explicitly specified.
3529 *
3530 * <p><em>Note:</em> if using an implicit Intent (without an explicit ComponentName
3531 * specified), be sure to consider whether to set the {@link #MATCH_DEFAULT_ONLY}
3532 * only flag. You need to do so to resolve the activity in the same way
3533 * that {@link android.content.Context#startActivity(Intent)} and
3534 * {@link android.content.Intent#resolveActivity(PackageManager)
3535 * Intent.resolveActivity(PackageManager)} do.</p>
3536 *
3537 * @param intent An intent containing all of the desired specification
3538 * (action, data, type, category, and/or component).
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003539 * @param flags Additional option flags. Use any combination of
3540 * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER},
3541 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL},
3542 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
3543 * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_ENCRYPTION_AWARE},
3544 * {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE}, {@link #MATCH_ENCRYPTION_UNAWARE},
3545 * {@link #MATCH_SYSTEM_ONLY}, {@link #MATCH_UNINSTALLED_PACKAGES}
3546 * to modify the data returned. The most important is
3547 * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only
3548 * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}.
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07003549 * @param userId The user id.
3550 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003551 * @return Returns a ResolveInfo object containing the final activity intent
3552 * that was determined to be the best action. Returns null if no
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07003553 * matching activity was found. If multiple matching activities are
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003554 * found and there is no default set, returns a ResolveInfo object
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07003555 * containing something else, such as the activity resolver.
3556 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003557 * @see #GET_META_DATA
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07003558 * @see #GET_RESOLVED_FILTER
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003559 * @see #GET_SHARED_LIBRARY_FILES
3560 * @see #MATCH_ALL
3561 * @see #MATCH_DISABLED_COMPONENTS
3562 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
3563 * @see #MATCH_DEFAULT_ONLY
3564 * @see #MATCH_ENCRYPTION_AWARE
3565 * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE
3566 * @see #MATCH_ENCRYPTION_UNAWARE
3567 * @see #MATCH_SYSTEM_ONLY
3568 * @see #MATCH_UNINSTALLED_PACKAGES
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07003569 *
3570 * @hide
3571 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003572 public abstract ResolveInfo resolveActivityAsUser(Intent intent, @ResolveInfoFlags int flags,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003573 @UserIdInt int userId);
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07003574
3575 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003576 * Retrieve all activities that can be performed for the given intent.
3577 *
3578 * @param intent The desired intent as per resolveActivity().
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003579 * @param flags Additional option flags. Use any combination of
3580 * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER},
3581 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL},
3582 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
3583 * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_ENCRYPTION_AWARE},
3584 * {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE}, {@link #MATCH_ENCRYPTION_UNAWARE},
3585 * {@link #MATCH_SYSTEM_ONLY}, {@link #MATCH_UNINSTALLED_PACKAGES}
3586 * to modify the data returned. The most important is
3587 * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only
3588 * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}.
3589 * Or, set {@link #MATCH_ALL} to prevent any filtering of the results.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003590 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003591 * @return Returns a List of ResolveInfo objects containing one entry for each
3592 * matching activity, ordered from best to worst. In other words, the
3593 * first item is what would be returned by {@link #resolveActivity}.
3594 * If there are no matching activities, an empty list is returned.
Fabrice Di Meglio9f7e39f2015-04-10 20:40:16 -07003595 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003596 * @see #GET_META_DATA
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003597 * @see #GET_RESOLVED_FILTER
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003598 * @see #GET_SHARED_LIBRARY_FILES
3599 * @see #MATCH_ALL
3600 * @see #MATCH_DISABLED_COMPONENTS
3601 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
3602 * @see #MATCH_DEFAULT_ONLY
3603 * @see #MATCH_ENCRYPTION_AWARE
3604 * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE
3605 * @see #MATCH_ENCRYPTION_UNAWARE
3606 * @see #MATCH_SYSTEM_ONLY
3607 * @see #MATCH_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003608 */
3609 public abstract List<ResolveInfo> queryIntentActivities(Intent intent,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003610 @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003611
3612 /**
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003613 * Retrieve all activities that can be performed for the given intent, for a specific user.
3614 *
3615 * @param intent The desired intent as per resolveActivity().
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003616 * @param flags Additional option flags. Use any combination of
3617 * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER},
3618 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL},
3619 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
3620 * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_ENCRYPTION_AWARE},
3621 * {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE}, {@link #MATCH_ENCRYPTION_UNAWARE},
3622 * {@link #MATCH_SYSTEM_ONLY}, {@link #MATCH_UNINSTALLED_PACKAGES}
3623 * to modify the data returned. The most important is
3624 * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only
3625 * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}.
3626 * Or, set {@link #MATCH_ALL} to prevent any filtering of the results.
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003627 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003628 * @return Returns a List of ResolveInfo objects containing one entry for each
3629 * matching activity, ordered from best to worst. In other words, the
3630 * first item is what would be returned by {@link #resolveActivity}.
3631 * If there are no matching activities, an empty list is returned.
Fabrice Di Meglio9f7e39f2015-04-10 20:40:16 -07003632 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003633 * @see #GET_META_DATA
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003634 * @see #GET_RESOLVED_FILTER
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003635 * @see #GET_SHARED_LIBRARY_FILES
3636 * @see #MATCH_ALL
3637 * @see #MATCH_DISABLED_COMPONENTS
3638 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
3639 * @see #MATCH_DEFAULT_ONLY
3640 * @see #MATCH_ENCRYPTION_AWARE
3641 * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE
3642 * @see #MATCH_ENCRYPTION_UNAWARE
3643 * @see #MATCH_SYSTEM_ONLY
3644 * @see #MATCH_UNINSTALLED_PACKAGES
3645 *
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003646 * @hide
3647 */
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07003648 public abstract List<ResolveInfo> queryIntentActivitiesAsUser(Intent intent,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003649 @ResolveInfoFlags int flags, @UserIdInt int userId);
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003650
3651 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003652 * Retrieve a set of activities that should be presented to the user as
3653 * similar options. This is like {@link #queryIntentActivities}, except it
3654 * also allows you to supply a list of more explicit Intents that you would
3655 * like to resolve to particular options, and takes care of returning the
3656 * final ResolveInfo list in a reasonable order, with no duplicates, based
3657 * on those inputs.
3658 *
3659 * @param caller The class name of the activity that is making the
3660 * request. This activity will never appear in the output
3661 * list. Can be null.
3662 * @param specifics An array of Intents that should be resolved to the
3663 * first specific results. Can be null.
3664 * @param intent The desired intent as per resolveActivity().
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003665 * @param flags Additional option flags. Use any combination of
3666 * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER},
3667 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL},
3668 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
3669 * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_ENCRYPTION_AWARE},
3670 * {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE}, {@link #MATCH_ENCRYPTION_UNAWARE},
3671 * {@link #MATCH_SYSTEM_ONLY}, {@link #MATCH_UNINSTALLED_PACKAGES}
3672 * to modify the data returned. The most important is
3673 * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only
3674 * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003675 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003676 * @return Returns a List of ResolveInfo objects containing one entry for each
3677 * matching activity. The list is ordered first by all of the intents resolved
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003678 * in <var>specifics</var> and then any additional activities that
3679 * can handle <var>intent</var> but did not get included by one of
3680 * the <var>specifics</var> intents. If there are no matching
3681 * activities, an empty list is returned.
3682 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003683 * @see #GET_META_DATA
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003684 * @see #GET_RESOLVED_FILTER
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003685 * @see #GET_SHARED_LIBRARY_FILES
3686 * @see #MATCH_ALL
3687 * @see #MATCH_DISABLED_COMPONENTS
3688 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
3689 * @see #MATCH_DEFAULT_ONLY
3690 * @see #MATCH_ENCRYPTION_AWARE
3691 * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE
3692 * @see #MATCH_ENCRYPTION_UNAWARE
3693 * @see #MATCH_SYSTEM_ONLY
3694 * @see #MATCH_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003695 */
3696 public abstract List<ResolveInfo> queryIntentActivityOptions(
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003697 ComponentName caller, Intent[] specifics, Intent intent, @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003698
3699 /**
3700 * Retrieve all receivers that can handle a broadcast of the given intent.
3701 *
3702 * @param intent The desired intent as per resolveActivity().
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003703 * @param flags Additional option flags. Use any combination of
3704 * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER},
3705 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL},
3706 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
3707 * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_ENCRYPTION_AWARE},
3708 * {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE}, {@link #MATCH_ENCRYPTION_UNAWARE},
3709 * {@link #MATCH_SYSTEM_ONLY}, {@link #MATCH_UNINSTALLED_PACKAGES}
3710 * to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003711 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003712 * @return Returns a List of ResolveInfo objects containing one entry for each
3713 * matching receiver, ordered from best to worst. If there are no matching
3714 * receivers, an empty list or null is returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003715 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003716 * @see #GET_META_DATA
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003717 * @see #GET_RESOLVED_FILTER
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003718 * @see #GET_SHARED_LIBRARY_FILES
3719 * @see #MATCH_ALL
3720 * @see #MATCH_DISABLED_COMPONENTS
3721 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
3722 * @see #MATCH_DEFAULT_ONLY
3723 * @see #MATCH_ENCRYPTION_AWARE
3724 * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE
3725 * @see #MATCH_ENCRYPTION_UNAWARE
3726 * @see #MATCH_SYSTEM_ONLY
3727 * @see #MATCH_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003728 */
3729 public abstract List<ResolveInfo> queryBroadcastReceivers(Intent intent,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003730 @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003731
3732 /**
Amith Yamasanif203aee2012-08-29 18:41:53 -07003733 * Retrieve all receivers that can handle a broadcast of the given intent, for a specific
3734 * user.
3735 *
3736 * @param intent The desired intent as per resolveActivity().
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003737 * @param flags Additional option flags. Use any combination of
3738 * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER},
3739 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL},
3740 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
3741 * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_ENCRYPTION_AWARE},
3742 * {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE}, {@link #MATCH_ENCRYPTION_UNAWARE},
3743 * {@link #MATCH_SYSTEM_ONLY}, {@link #MATCH_UNINSTALLED_PACKAGES}
3744 * to modify the data returned.
Fyodor Kupolov940e8572016-01-26 12:03:51 -08003745 * @param userHandle UserHandle of the user being queried.
Amith Yamasanif203aee2012-08-29 18:41:53 -07003746 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003747 * @return Returns a List of ResolveInfo objects containing one entry for each
3748 * matching receiver, ordered from best to worst. If there are no matching
3749 * receivers, an empty list or null is returned.
Amith Yamasanif203aee2012-08-29 18:41:53 -07003750 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003751 * @see #GET_META_DATA
Amith Yamasanif203aee2012-08-29 18:41:53 -07003752 * @see #GET_RESOLVED_FILTER
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003753 * @see #GET_SHARED_LIBRARY_FILES
3754 * @see #MATCH_ALL
3755 * @see #MATCH_DISABLED_COMPONENTS
3756 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
3757 * @see #MATCH_DEFAULT_ONLY
3758 * @see #MATCH_ENCRYPTION_AWARE
3759 * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE
3760 * @see #MATCH_ENCRYPTION_UNAWARE
3761 * @see #MATCH_SYSTEM_ONLY
3762 * @see #MATCH_UNINSTALLED_PACKAGES
3763 *
Amith Yamasanif203aee2012-08-29 18:41:53 -07003764 * @hide
3765 */
Fyodor Kupolov940e8572016-01-26 12:03:51 -08003766 @SystemApi
3767 public List<ResolveInfo> queryBroadcastReceiversAsUser(Intent intent,
3768 @ResolveInfoFlags int flags, UserHandle userHandle) {
3769 return queryBroadcastReceiversAsUser(intent, flags, userHandle.getIdentifier());
3770 }
3771
3772 /**
3773 * @hide
3774 */
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07003775 public abstract List<ResolveInfo> queryBroadcastReceiversAsUser(Intent intent,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003776 @ResolveInfoFlags int flags, @UserIdInt int userId);
Amith Yamasanif203aee2012-08-29 18:41:53 -07003777
Fyodor Kupolov940e8572016-01-26 12:03:51 -08003778
Jeff Sharkeybd940222016-01-08 11:07:13 -07003779 /** {@hide} */
3780 @Deprecated
3781 public List<ResolveInfo> queryBroadcastReceivers(Intent intent,
3782 @ResolveInfoFlags int flags, @UserIdInt int userId) {
3783 Log.w(TAG, "STAHP USING HIDDEN APIS KTHX");
3784 return queryBroadcastReceiversAsUser(intent, flags, userId);
3785 }
3786
Amith Yamasanif203aee2012-08-29 18:41:53 -07003787 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003788 * Determine the best service to handle for a given Intent.
3789 *
3790 * @param intent An intent containing all of the desired specification
3791 * (action, data, type, category, and/or component).
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003792 * @param flags Additional option flags. Use any combination of
3793 * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER},
3794 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL},
3795 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
3796 * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_ENCRYPTION_AWARE},
3797 * {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE}, {@link #MATCH_ENCRYPTION_UNAWARE},
3798 * {@link #MATCH_SYSTEM_ONLY}, {@link #MATCH_UNINSTALLED_PACKAGES}
3799 * to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003800 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003801 * @return Returns a ResolveInfo object containing the final service intent
3802 * that was determined to be the best action. Returns null if no
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003803 * matching service was found.
3804 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003805 * @see #GET_META_DATA
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003806 * @see #GET_RESOLVED_FILTER
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003807 * @see #GET_SHARED_LIBRARY_FILES
3808 * @see #MATCH_ALL
3809 * @see #MATCH_DISABLED_COMPONENTS
3810 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
3811 * @see #MATCH_DEFAULT_ONLY
3812 * @see #MATCH_ENCRYPTION_AWARE
3813 * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE
3814 * @see #MATCH_ENCRYPTION_UNAWARE
3815 * @see #MATCH_SYSTEM_ONLY
3816 * @see #MATCH_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003817 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003818 public abstract ResolveInfo resolveService(Intent intent, @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003819
3820 /**
3821 * Retrieve all services that can match the given intent.
3822 *
3823 * @param intent The desired intent as per resolveService().
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003824 * @param flags Additional option flags. Use any combination of
3825 * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER},
3826 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL},
3827 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
3828 * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_ENCRYPTION_AWARE},
3829 * {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE}, {@link #MATCH_ENCRYPTION_UNAWARE},
3830 * {@link #MATCH_SYSTEM_ONLY}, {@link #MATCH_UNINSTALLED_PACKAGES}
3831 * to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003832 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003833 * @return Returns a List of ResolveInfo objects containing one entry for each
3834 * matching service, ordered from best to worst. In other words, the first
Amith Yamasani2b60ca42016-01-08 17:53:18 -08003835 * item is what would be returned by {@link #resolveService}. If there are
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003836 * no matching services, an empty list or null is returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003837 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003838 * @see #GET_META_DATA
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003839 * @see #GET_RESOLVED_FILTER
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003840 * @see #GET_SHARED_LIBRARY_FILES
3841 * @see #MATCH_ALL
3842 * @see #MATCH_DISABLED_COMPONENTS
3843 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
3844 * @see #MATCH_DEFAULT_ONLY
3845 * @see #MATCH_ENCRYPTION_AWARE
3846 * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE
3847 * @see #MATCH_ENCRYPTION_UNAWARE
3848 * @see #MATCH_SYSTEM_ONLY
3849 * @see #MATCH_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003850 */
3851 public abstract List<ResolveInfo> queryIntentServices(Intent intent,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003852 @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003853
3854 /**
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07003855 * Retrieve all services that can match the given intent for a given user.
3856 *
3857 * @param intent The desired intent as per resolveService().
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003858 * @param flags Additional option flags. Use any combination of
3859 * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER},
3860 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL},
3861 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
3862 * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_ENCRYPTION_AWARE},
3863 * {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE}, {@link #MATCH_ENCRYPTION_UNAWARE},
3864 * {@link #MATCH_SYSTEM_ONLY}, {@link #MATCH_UNINSTALLED_PACKAGES}
3865 * to modify the data returned.
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07003866 * @param userId The user id.
3867 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003868 * @return Returns a List of ResolveInfo objects containing one entry for each
3869 * matching service, ordered from best to worst. In other words, the first
Amith Yamasani2b60ca42016-01-08 17:53:18 -08003870 * item is what would be returned by {@link #resolveService}. If there are
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003871 * no matching services, an empty list or null is returned.
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07003872 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003873 * @see #GET_META_DATA
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07003874 * @see #GET_RESOLVED_FILTER
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003875 * @see #GET_SHARED_LIBRARY_FILES
3876 * @see #MATCH_ALL
3877 * @see #MATCH_DISABLED_COMPONENTS
3878 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
3879 * @see #MATCH_DEFAULT_ONLY
3880 * @see #MATCH_ENCRYPTION_AWARE
3881 * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE
3882 * @see #MATCH_ENCRYPTION_UNAWARE
3883 * @see #MATCH_SYSTEM_ONLY
3884 * @see #MATCH_UNINSTALLED_PACKAGES
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07003885 *
3886 * @hide
3887 */
3888 public abstract List<ResolveInfo> queryIntentServicesAsUser(Intent intent,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003889 @ResolveInfoFlags int flags, @UserIdInt int userId);
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07003890
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003891 /**
3892 * Retrieve all providers that can match the given intent.
3893 *
3894 * @param intent An intent containing all of the desired specification
3895 * (action, data, type, category, and/or component).
3896 * @param flags Additional option flags. Use any combination of
3897 * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER},
3898 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL},
3899 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
3900 * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_ENCRYPTION_AWARE},
3901 * {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE}, {@link #MATCH_ENCRYPTION_UNAWARE},
3902 * {@link #MATCH_SYSTEM_ONLY}, {@link #MATCH_UNINSTALLED_PACKAGES}
3903 * to modify the data returned.
3904 * @param userId The user id.
3905 *
3906 * @return Returns a List of ResolveInfo objects containing one entry for each
3907 * matching provider, ordered from best to worst. If there are no
3908 * matching services, an empty list or null is returned.
3909 *
3910 * @see #GET_META_DATA
3911 * @see #GET_RESOLVED_FILTER
3912 * @see #GET_SHARED_LIBRARY_FILES
3913 * @see #MATCH_ALL
3914 * @see #MATCH_DISABLED_COMPONENTS
3915 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
3916 * @see #MATCH_DEFAULT_ONLY
3917 * @see #MATCH_ENCRYPTION_AWARE
3918 * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE
3919 * @see #MATCH_ENCRYPTION_UNAWARE
3920 * @see #MATCH_SYSTEM_ONLY
3921 * @see #MATCH_UNINSTALLED_PACKAGES
3922 *
3923 * @hide
3924 */
Jeff Sharkey85f5f812013-10-07 10:16:12 -07003925 public abstract List<ResolveInfo> queryIntentContentProvidersAsUser(
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003926 Intent intent, @ResolveInfoFlags int flags, @UserIdInt int userId);
Jeff Sharkey85f5f812013-10-07 10:16:12 -07003927
3928 /**
3929 * Retrieve all providers that can match the given intent.
3930 *
3931 * @param intent An intent containing all of the desired specification
3932 * (action, data, type, category, and/or component).
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003933 * @param flags Additional option flags. Use any combination of
3934 * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER},
3935 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL},
3936 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
3937 * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_ENCRYPTION_AWARE},
3938 * {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE}, {@link #MATCH_ENCRYPTION_UNAWARE},
3939 * {@link #MATCH_SYSTEM_ONLY}, {@link #MATCH_UNINSTALLED_PACKAGES}
3940 * to modify the data returned.
3941 *
3942 * @return Returns a List of ResolveInfo objects containing one entry for each
3943 * matching provider, ordered from best to worst. If there are no
3944 * matching services, an empty list or null is returned.
3945 *
3946 * @see #GET_META_DATA
Jeff Sharkey85f5f812013-10-07 10:16:12 -07003947 * @see #GET_RESOLVED_FILTER
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003948 * @see #GET_SHARED_LIBRARY_FILES
3949 * @see #MATCH_ALL
3950 * @see #MATCH_DISABLED_COMPONENTS
3951 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
3952 * @see #MATCH_DEFAULT_ONLY
3953 * @see #MATCH_ENCRYPTION_AWARE
3954 * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE
3955 * @see #MATCH_ENCRYPTION_UNAWARE
3956 * @see #MATCH_SYSTEM_ONLY
3957 * @see #MATCH_UNINSTALLED_PACKAGES
Jeff Sharkey85f5f812013-10-07 10:16:12 -07003958 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003959 public abstract List<ResolveInfo> queryIntentContentProviders(Intent intent,
3960 @ResolveInfoFlags int flags);
Jeff Sharkey85f5f812013-10-07 10:16:12 -07003961
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07003962 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003963 * Find a single content provider by its base path name.
3964 *
3965 * @param name The name of the provider to find.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003966 * @param flags Additional option flags. Use any combination of
3967 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
3968 * {@link #MATCH_ALL}, {@link #MATCH_DEFAULT_ONLY},
3969 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
3970 * {@link #MATCH_ENCRYPTION_AWARE}, {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE},
3971 * {@link #MATCH_ENCRYPTION_UNAWARE}, {@link #MATCH_SYSTEM_ONLY}
3972 * {@link #MATCH_UNINSTALLED_PACKAGES}
3973 * to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003974 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003975 * @return A {@link ProviderInfo} object containing information about the provider.
3976 * If a provider was not found, returns null.
3977 *
3978 * @see #GET_META_DATA
3979 * @see #GET_SHARED_LIBRARY_FILES
3980 * @see #MATCH_ALL
3981 * @see #MATCH_DEBUG_TRIAGED_MISSING
3982 * @see #MATCH_DEFAULT_ONLY
3983 * @see #MATCH_DISABLED_COMPONENTS
3984 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
3985 * @see #MATCH_ENCRYPTION_AWARE
3986 * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE
3987 * @see #MATCH_ENCRYPTION_UNAWARE
3988 * @see #MATCH_SYSTEM_ONLY
3989 * @see #MATCH_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003990 */
3991 public abstract ProviderInfo resolveContentProvider(String name,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003992 @ComponentInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003993
3994 /**
Alexandra Gherghina0363c3e2014-06-23 13:34:59 +01003995 * Find a single content provider by its base path name.
3996 *
3997 * @param name The name of the provider to find.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003998 * @param flags Additional option flags. Use any combination of
3999 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
4000 * {@link #MATCH_ALL}, {@link #MATCH_DEFAULT_ONLY},
4001 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
4002 * {@link #MATCH_ENCRYPTION_AWARE}, {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE},
4003 * {@link #MATCH_ENCRYPTION_UNAWARE}, {@link #MATCH_SYSTEM_ONLY}
4004 * {@link #MATCH_UNINSTALLED_PACKAGES}
4005 * to modify the data returned.
Alexandra Gherghina0363c3e2014-06-23 13:34:59 +01004006 * @param userId The user id.
4007 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004008 * @return A {@link ProviderInfo} object containing information about the provider.
4009 * If a provider was not found, returns null.
4010 *
4011 * @see #GET_META_DATA
4012 * @see #GET_SHARED_LIBRARY_FILES
4013 * @see #MATCH_ALL
4014 * @see #MATCH_DEBUG_TRIAGED_MISSING
4015 * @see #MATCH_DEFAULT_ONLY
4016 * @see #MATCH_DISABLED_COMPONENTS
4017 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
4018 * @see #MATCH_ENCRYPTION_AWARE
4019 * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE
4020 * @see #MATCH_ENCRYPTION_UNAWARE
4021 * @see #MATCH_SYSTEM_ONLY
4022 * @see #MATCH_UNINSTALLED_PACKAGES
4023 *
Alexandra Gherghina0363c3e2014-06-23 13:34:59 +01004024 * @hide
4025 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004026 public abstract ProviderInfo resolveContentProviderAsUser(String name,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004027 @ComponentInfoFlags int flags, @UserIdInt int userId);
Alexandra Gherghina0363c3e2014-06-23 13:34:59 +01004028
4029 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004030 * Retrieve content provider information.
4031 *
4032 * <p><em>Note: unlike most other methods, an empty result set is indicated
4033 * by a null return instead of an empty list.</em>
4034 *
4035 * @param processName If non-null, limits the returned providers to only
4036 * those that are hosted by the given process. If null,
4037 * all content providers are returned.
4038 * @param uid If <var>processName</var> is non-null, this is the required
4039 * uid owning the requested content providers.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004040 * @param flags Additional option flags. Use any combination of
4041 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
4042 * {@link #MATCH_ALL}, {@link #MATCH_DEFAULT_ONLY},
4043 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
4044 * {@link #MATCH_ENCRYPTION_AWARE}, {@link #MATCH_ENCRYPTION_AWARE_AND_UNAWARE},
4045 * {@link #MATCH_ENCRYPTION_UNAWARE}, {@link #MATCH_SYSTEM_ONLY}
4046 * {@link #MATCH_UNINSTALLED_PACKAGES}
4047 * to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004048 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004049 * @return A list of {@link ProviderInfo} objects containing one entry for
4050 * each provider either matching <var>processName</var> or, if
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004051 * <var>processName</var> is null, all known content providers.
4052 * <em>If there are no matching providers, null is returned.</em>
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004053 *
4054 * @see #GET_META_DATA
4055 * @see #GET_SHARED_LIBRARY_FILES
4056 * @see #MATCH_ALL
4057 * @see #MATCH_DEBUG_TRIAGED_MISSING
4058 * @see #MATCH_DEFAULT_ONLY
4059 * @see #MATCH_DISABLED_COMPONENTS
4060 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
4061 * @see #MATCH_ENCRYPTION_AWARE
4062 * @see #MATCH_ENCRYPTION_AWARE_AND_UNAWARE
4063 * @see #MATCH_ENCRYPTION_UNAWARE
4064 * @see #MATCH_SYSTEM_ONLY
4065 * @see #MATCH_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004066 */
4067 public abstract List<ProviderInfo> queryContentProviders(
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004068 String processName, int uid, @ComponentInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004069
4070 /**
4071 * Retrieve all of the information we know about a particular
4072 * instrumentation class.
4073 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004074 * @param className The full name (i.e.
4075 * com.google.apps.contacts.InstrumentList) of an
4076 * Instrumentation class.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004077 * @param flags Additional option flags. Use any combination of
4078 * {@link #GET_META_DATA}
4079 * to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004080 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004081 * @return An {@link InstrumentationInfo} object containing information about the
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004082 * instrumentation.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004083 * @throws NameNotFoundException if a package with the given name cannot be
4084 * found on the system.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004085 *
4086 * @see #GET_META_DATA
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004087 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004088 public abstract InstrumentationInfo getInstrumentationInfo(ComponentName className,
4089 @InstrumentationInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004090
4091 /**
4092 * Retrieve information about available instrumentation code. May be used
4093 * to retrieve either all instrumentation code, or only the code targeting
4094 * a particular package.
4095 *
4096 * @param targetPackage If null, all instrumentation is returned; only the
4097 * instrumentation targeting this package name is
4098 * returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004099 * @param flags Additional option flags. Use any combination of
4100 * {@link #GET_META_DATA}
4101 * to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004102 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004103 * @return A list of {@link InstrumentationInfo} objects containing one
4104 * entry for each matching instrumentation. If there are no
Jesse Hallf77a34f2016-02-04 18:41:33 -08004105 * instrumentation available, returns an empty list.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004106 *
4107 * @see #GET_META_DATA
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004108 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004109 public abstract List<InstrumentationInfo> queryInstrumentation(String targetPackage,
4110 @InstrumentationInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004111
4112 /**
4113 * Retrieve an image from a package. This is a low-level API used by
4114 * the various package manager info structures (such as
4115 * {@link ComponentInfo} to implement retrieval of their associated
4116 * icon.
4117 *
4118 * @param packageName The name of the package that this icon is coming from.
kmccormick30498b42013-03-27 17:39:17 -07004119 * Cannot be null.
4120 * @param resid The resource identifier of the desired image. Cannot be 0.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004121 * @param appInfo Overall information about <var>packageName</var>. This
4122 * may be null, in which case the application information will be retrieved
4123 * for you if needed; if you already have this information around, it can
4124 * be much more efficient to supply it here.
4125 *
4126 * @return Returns a Drawable holding the requested image. Returns null if
4127 * an image could not be found for any reason.
4128 */
Tor Norbye7b9c9122013-05-30 16:48:33 -07004129 public abstract Drawable getDrawable(String packageName, @DrawableRes int resid,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004130 ApplicationInfo appInfo);
4131
4132 /**
4133 * Retrieve the icon associated with an activity. Given the full name of
4134 * an activity, retrieves the information about it and calls
4135 * {@link ComponentInfo#loadIcon ComponentInfo.loadIcon()} to return its icon.
kmccormick30498b42013-03-27 17:39:17 -07004136 * If the activity cannot be found, NameNotFoundException is thrown.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004137 *
4138 * @param activityName Name of the activity whose icon is to be retrieved.
4139 *
4140 * @return Returns the image of the icon, or the default activity icon if
4141 * it could not be found. Does not return null.
4142 * @throws NameNotFoundException Thrown if the resources for the given
4143 * activity could not be loaded.
4144 *
4145 * @see #getActivityIcon(Intent)
4146 */
4147 public abstract Drawable getActivityIcon(ComponentName activityName)
4148 throws NameNotFoundException;
4149
4150 /**
4151 * Retrieve the icon associated with an Intent. If intent.getClassName() is
4152 * set, this simply returns the result of
4153 * getActivityIcon(intent.getClassName()). Otherwise it resolves the intent's
4154 * component and returns the icon associated with the resolved component.
kmccormick30498b42013-03-27 17:39:17 -07004155 * If intent.getClassName() cannot be found or the Intent cannot be resolved
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004156 * to a component, NameNotFoundException is thrown.
4157 *
4158 * @param intent The intent for which you would like to retrieve an icon.
4159 *
4160 * @return Returns the image of the icon, or the default activity icon if
4161 * it could not be found. Does not return null.
4162 * @throws NameNotFoundException Thrown if the resources for application
4163 * matching the given intent could not be loaded.
4164 *
4165 * @see #getActivityIcon(ComponentName)
4166 */
4167 public abstract Drawable getActivityIcon(Intent intent)
4168 throws NameNotFoundException;
4169
4170 /**
Jose Limaf78e3122014-03-06 12:13:15 -08004171 * Retrieve the banner associated with an activity. Given the full name of
4172 * an activity, retrieves the information about it and calls
4173 * {@link ComponentInfo#loadIcon ComponentInfo.loadIcon()} to return its
4174 * banner. If the activity cannot be found, NameNotFoundException is thrown.
4175 *
4176 * @param activityName Name of the activity whose banner is to be retrieved.
4177 * @return Returns the image of the banner, or null if the activity has no
4178 * banner specified.
4179 * @throws NameNotFoundException Thrown if the resources for the given
4180 * activity could not be loaded.
4181 * @see #getActivityBanner(Intent)
4182 */
4183 public abstract Drawable getActivityBanner(ComponentName activityName)
4184 throws NameNotFoundException;
4185
4186 /**
4187 * Retrieve the banner associated with an Intent. If intent.getClassName()
4188 * is set, this simply returns the result of
4189 * getActivityBanner(intent.getClassName()). Otherwise it resolves the
4190 * intent's component and returns the banner associated with the resolved
4191 * component. If intent.getClassName() cannot be found or the Intent cannot
4192 * be resolved to a component, NameNotFoundException is thrown.
4193 *
4194 * @param intent The intent for which you would like to retrieve a banner.
4195 * @return Returns the image of the banner, or null if the activity has no
4196 * banner specified.
4197 * @throws NameNotFoundException Thrown if the resources for application
4198 * matching the given intent could not be loaded.
4199 * @see #getActivityBanner(ComponentName)
4200 */
4201 public abstract Drawable getActivityBanner(Intent intent)
4202 throws NameNotFoundException;
4203
4204 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004205 * Return the generic icon for an activity that is used when no specific
4206 * icon is defined.
Adam Connors23cc04e2014-04-01 12:12:20 +01004207 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004208 * @return Drawable Image of the icon.
4209 */
4210 public abstract Drawable getDefaultActivityIcon();
4211
4212 /**
4213 * Retrieve the icon associated with an application. If it has not defined
4214 * an icon, the default app icon is returned. Does not return null.
4215 *
4216 * @param info Information about application being queried.
4217 *
4218 * @return Returns the image of the icon, or the default application icon
4219 * if it could not be found.
4220 *
4221 * @see #getApplicationIcon(String)
4222 */
4223 public abstract Drawable getApplicationIcon(ApplicationInfo info);
4224
4225 /**
4226 * Retrieve the icon associated with an application. Given the name of the
4227 * application's package, retrieves the information about it and calls
kmccormick30498b42013-03-27 17:39:17 -07004228 * getApplicationIcon() to return its icon. If the application cannot be
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004229 * found, NameNotFoundException is thrown.
4230 *
4231 * @param packageName Name of the package whose application icon is to be
4232 * retrieved.
4233 *
4234 * @return Returns the image of the icon, or the default application icon
4235 * if it could not be found. Does not return null.
4236 * @throws NameNotFoundException Thrown if the resources for the given
4237 * application could not be loaded.
4238 *
4239 * @see #getApplicationIcon(ApplicationInfo)
4240 */
4241 public abstract Drawable getApplicationIcon(String packageName)
4242 throws NameNotFoundException;
4243
4244 /**
Jose Limaf78e3122014-03-06 12:13:15 -08004245 * Retrieve the banner associated with an application.
4246 *
4247 * @param info Information about application being queried.
4248 * @return Returns the image of the banner or null if the application has no
4249 * banner specified.
4250 * @see #getApplicationBanner(String)
4251 */
4252 public abstract Drawable getApplicationBanner(ApplicationInfo info);
4253
4254 /**
4255 * Retrieve the banner associated with an application. Given the name of the
4256 * application's package, retrieves the information about it and calls
4257 * getApplicationIcon() to return its banner. If the application cannot be
4258 * found, NameNotFoundException is thrown.
4259 *
4260 * @param packageName Name of the package whose application banner is to be
4261 * retrieved.
4262 * @return Returns the image of the banner or null if the application has no
4263 * banner specified.
4264 * @throws NameNotFoundException Thrown if the resources for the given
4265 * application could not be loaded.
4266 * @see #getApplicationBanner(ApplicationInfo)
4267 */
4268 public abstract Drawable getApplicationBanner(String packageName)
4269 throws NameNotFoundException;
4270
4271 /**
4272 * Retrieve the logo associated with an activity. Given the full name of an
4273 * activity, retrieves the information about it and calls
4274 * {@link ComponentInfo#loadLogo ComponentInfo.loadLogo()} to return its
4275 * logo. If the activity cannot be found, NameNotFoundException is thrown.
Adam Powell81cd2e92010-04-21 16:35:18 -07004276 *
4277 * @param activityName Name of the activity whose logo is to be retrieved.
Jose Limaf78e3122014-03-06 12:13:15 -08004278 * @return Returns the image of the logo or null if the activity has no logo
4279 * specified.
Adam Powell81cd2e92010-04-21 16:35:18 -07004280 * @throws NameNotFoundException Thrown if the resources for the given
Jose Limaf78e3122014-03-06 12:13:15 -08004281 * activity could not be loaded.
Adam Powell81cd2e92010-04-21 16:35:18 -07004282 * @see #getActivityLogo(Intent)
4283 */
4284 public abstract Drawable getActivityLogo(ComponentName activityName)
4285 throws NameNotFoundException;
4286
4287 /**
4288 * Retrieve the logo associated with an Intent. If intent.getClassName() is
4289 * set, this simply returns the result of
4290 * getActivityLogo(intent.getClassName()). Otherwise it resolves the intent's
4291 * component and returns the logo associated with the resolved component.
kmccormick30498b42013-03-27 17:39:17 -07004292 * If intent.getClassName() cannot be found or the Intent cannot be resolved
Adam Powell81cd2e92010-04-21 16:35:18 -07004293 * to a component, NameNotFoundException is thrown.
4294 *
4295 * @param intent The intent for which you would like to retrieve a logo.
4296 *
4297 * @return Returns the image of the logo, or null if the activity has no
4298 * logo specified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004299 *
Adam Powell81cd2e92010-04-21 16:35:18 -07004300 * @throws NameNotFoundException Thrown if the resources for application
4301 * matching the given intent could not be loaded.
4302 *
4303 * @see #getActivityLogo(ComponentName)
4304 */
4305 public abstract Drawable getActivityLogo(Intent intent)
4306 throws NameNotFoundException;
4307
4308 /**
4309 * Retrieve the logo associated with an application. If it has not specified
4310 * a logo, this method returns null.
4311 *
4312 * @param info Information about application being queried.
4313 *
4314 * @return Returns the image of the logo, or null if no logo is specified
4315 * by the application.
4316 *
4317 * @see #getApplicationLogo(String)
4318 */
4319 public abstract Drawable getApplicationLogo(ApplicationInfo info);
4320
4321 /**
4322 * Retrieve the logo associated with an application. Given the name of the
4323 * application's package, retrieves the information about it and calls
kmccormick30498b42013-03-27 17:39:17 -07004324 * getApplicationLogo() to return its logo. If the application cannot be
Adam Powell81cd2e92010-04-21 16:35:18 -07004325 * found, NameNotFoundException is thrown.
4326 *
4327 * @param packageName Name of the package whose application logo is to be
4328 * retrieved.
4329 *
4330 * @return Returns the image of the logo, or null if no application logo
4331 * has been specified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004332 *
Adam Powell81cd2e92010-04-21 16:35:18 -07004333 * @throws NameNotFoundException Thrown if the resources for the given
4334 * application could not be loaded.
4335 *
4336 * @see #getApplicationLogo(ApplicationInfo)
4337 */
4338 public abstract Drawable getApplicationLogo(String packageName)
4339 throws NameNotFoundException;
4340
4341 /**
Vadim Tryshev9f68f412016-02-18 15:41:21 -08004342 * Returns a managed-user-style badged copy of the given drawable allowing the user to
4343 * distinguish it from the original drawable.
4344 * The caller can specify the location in the bounds of the drawable to be
4345 * badged where the badge should be applied as well as the density of the
4346 * badge to be used.
4347 * <p>
4348 * If the original drawable is a BitmapDrawable and the backing bitmap is
4349 * mutable as per {@link android.graphics.Bitmap#isMutable()}, the bading
4350 * is performed in place and the original drawable is returned.
4351 * </p>
4352 *
4353 * @param drawable The drawable to badge.
4354 * @param badgeLocation Where in the bounds of the badged drawable to place
4355 * the badge. If not provided, the badge is applied on top of the entire
4356 * drawable being badged.
4357 * @param badgeDensity The optional desired density for the badge as per
4358 * {@link android.util.DisplayMetrics#densityDpi}. If not provided,
4359 * the density of the display is used.
4360 * @return A drawable that combines the original drawable and a badge as
4361 * determined by the system.
4362 * @hide
4363 */
4364 public abstract Drawable getManagedUserBadgedDrawableForDensity(Drawable drawable,
4365 Rect badgeLocation, int badgeDensity);
4366
4367 /**
Kenny Guydf77d712015-05-29 17:02:22 +01004368 * If the target user is a managed profile of the calling user or if the
4369 * target user is the caller and is itself a managed profile, then this
4370 * returns a badged copy of the given icon to be able to distinguish it from
4371 * the original icon. For badging an arbitrary drawable use
4372 * {@link #getUserBadgedDrawableForDensity(
Svetoslavc7d62f02014-09-04 15:39:54 -07004373 * android.graphics.drawable.Drawable, UserHandle, android.graphics.Rect, int)}.
4374 * <p>
4375 * If the original drawable is a BitmapDrawable and the backing bitmap is
4376 * mutable as per {@link android.graphics.Bitmap#isMutable()}, the badging
4377 * is performed in place and the original drawable is returned.
4378 * </p>
4379 *
4380 * @param icon The icon to badge.
4381 * @param user The target user.
4382 * @return A drawable that combines the original icon and a badge as
4383 * determined by the system.
4384 */
4385 public abstract Drawable getUserBadgedIcon(Drawable icon, UserHandle user);
4386
4387 /**
4388 * If the target user is a managed profile of the calling user or the caller
4389 * is itself a managed profile, then this returns a badged copy of the given
4390 * drawable allowing the user to distinguish it from the original drawable.
4391 * The caller can specify the location in the bounds of the drawable to be
4392 * badged where the badge should be applied as well as the density of the
4393 * badge to be used.
4394 * <p>
4395 * If the original drawable is a BitmapDrawable and the backing bitmap is
4396 * mutable as per {@link android.graphics.Bitmap#isMutable()}, the bading
4397 * is performed in place and the original drawable is returned.
4398 * </p>
4399 *
4400 * @param drawable The drawable to badge.
4401 * @param user The target user.
4402 * @param badgeLocation Where in the bounds of the badged drawable to place
4403 * the badge. If not provided, the badge is applied on top of the entire
4404 * drawable being badged.
4405 * @param badgeDensity The optional desired density for the badge as per
4406 * {@link android.util.DisplayMetrics#densityDpi}. If not provided,
4407 * the density of the display is used.
4408 * @return A drawable that combines the original drawable and a badge as
4409 * determined by the system.
4410 */
4411 public abstract Drawable getUserBadgedDrawableForDensity(Drawable drawable,
4412 UserHandle user, Rect badgeLocation, int badgeDensity);
4413
4414 /**
4415 * If the target user is a managed profile of the calling user or the caller
4416 * is itself a managed profile, then this returns a drawable to use as a small
4417 * icon to include in a view to distinguish it from the original icon.
4418 *
4419 * @param user The target user.
4420 * @param density The optional desired density for the badge as per
4421 * {@link android.util.DisplayMetrics#densityDpi}. If not provided
4422 * the density of the current display is used.
4423 * @return the drawable or null if no drawable is required.
4424 * @hide
4425 */
4426 public abstract Drawable getUserBadgeForDensity(UserHandle user, int density);
4427
4428 /**
4429 * If the target user is a managed profile of the calling user or the caller
Selim Cineke6ff9462016-01-15 15:07:06 -08004430 * is itself a managed profile, then this returns a drawable to use as a small
4431 * icon to include in a view to distinguish it from the original icon. This version
4432 * doesn't have background protection and should be used over a light background instead of
4433 * a badge.
4434 *
4435 * @param user The target user.
4436 * @param density The optional desired density for the badge as per
4437 * {@link android.util.DisplayMetrics#densityDpi}. If not provided
4438 * the density of the current display is used.
4439 * @return the drawable or null if no drawable is required.
4440 * @hide
4441 */
4442 public abstract Drawable getUserBadgeForDensityNoBackground(UserHandle user, int density);
4443
4444 /**
4445 * If the target user is a managed profile of the calling user or the caller
Svetoslavc7d62f02014-09-04 15:39:54 -07004446 * is itself a managed profile, then this returns a copy of the label with
4447 * badging for accessibility services like talkback. E.g. passing in "Email"
4448 * and it might return "Work Email" for Email in the work profile.
4449 *
4450 * @param label The label to change.
4451 * @param user The target user.
4452 * @return A label that combines the original label and a badge as
4453 * determined by the system.
4454 */
4455 public abstract CharSequence getUserBadgedLabel(CharSequence label, UserHandle user);
4456
4457 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004458 * Retrieve text from a package. This is a low-level API used by
4459 * the various package manager info structures (such as
4460 * {@link ComponentInfo} to implement retrieval of their associated
4461 * labels and other text.
4462 *
4463 * @param packageName The name of the package that this text is coming from.
kmccormick30498b42013-03-27 17:39:17 -07004464 * Cannot be null.
4465 * @param resid The resource identifier of the desired text. Cannot be 0.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004466 * @param appInfo Overall information about <var>packageName</var>. This
4467 * may be null, in which case the application information will be retrieved
4468 * for you if needed; if you already have this information around, it can
4469 * be much more efficient to supply it here.
4470 *
4471 * @return Returns a CharSequence holding the requested text. Returns null
4472 * if the text could not be found for any reason.
4473 */
Tor Norbye7b9c9122013-05-30 16:48:33 -07004474 public abstract CharSequence getText(String packageName, @StringRes int resid,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004475 ApplicationInfo appInfo);
4476
4477 /**
4478 * Retrieve an XML file from a package. This is a low-level API used to
4479 * retrieve XML meta data.
4480 *
4481 * @param packageName The name of the package that this xml is coming from.
kmccormick30498b42013-03-27 17:39:17 -07004482 * Cannot be null.
4483 * @param resid The resource identifier of the desired xml. Cannot be 0.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004484 * @param appInfo Overall information about <var>packageName</var>. This
4485 * may be null, in which case the application information will be retrieved
4486 * for you if needed; if you already have this information around, it can
4487 * be much more efficient to supply it here.
4488 *
4489 * @return Returns an XmlPullParser allowing you to parse out the XML
4490 * data. Returns null if the xml resource could not be found for any
4491 * reason.
4492 */
Tor Norbye7b9c9122013-05-30 16:48:33 -07004493 public abstract XmlResourceParser getXml(String packageName, @XmlRes int resid,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004494 ApplicationInfo appInfo);
4495
4496 /**
4497 * Return the label to use for this application.
4498 *
4499 * @return Returns the label associated with this application, or null if
4500 * it could not be found for any reason.
kmccormick30498b42013-03-27 17:39:17 -07004501 * @param info The application to get the label of.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004502 */
4503 public abstract CharSequence getApplicationLabel(ApplicationInfo info);
4504
4505 /**
4506 * Retrieve the resources associated with an activity. Given the full
4507 * name of an activity, retrieves the information about it and calls
4508 * getResources() to return its application's resources. If the activity
kmccormick30498b42013-03-27 17:39:17 -07004509 * cannot be found, NameNotFoundException is thrown.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004510 *
4511 * @param activityName Name of the activity whose resources are to be
4512 * retrieved.
4513 *
4514 * @return Returns the application's Resources.
4515 * @throws NameNotFoundException Thrown if the resources for the given
4516 * application could not be loaded.
4517 *
4518 * @see #getResourcesForApplication(ApplicationInfo)
4519 */
4520 public abstract Resources getResourcesForActivity(ComponentName activityName)
4521 throws NameNotFoundException;
4522
4523 /**
4524 * Retrieve the resources for an application. Throws NameNotFoundException
4525 * if the package is no longer installed.
4526 *
4527 * @param app Information about the desired application.
4528 *
4529 * @return Returns the application's Resources.
4530 * @throws NameNotFoundException Thrown if the resources for the given
4531 * application could not be loaded (most likely because it was uninstalled).
4532 */
4533 public abstract Resources getResourcesForApplication(ApplicationInfo app)
4534 throws NameNotFoundException;
4535
4536 /**
4537 * Retrieve the resources associated with an application. Given the full
4538 * package name of an application, retrieves the information about it and
4539 * calls getResources() to return its application's resources. If the
kmccormick30498b42013-03-27 17:39:17 -07004540 * appPackageName cannot be found, NameNotFoundException is thrown.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004541 *
4542 * @param appPackageName Package name of the application whose resources
4543 * are to be retrieved.
4544 *
4545 * @return Returns the application's Resources.
4546 * @throws NameNotFoundException Thrown if the resources for the given
4547 * application could not be loaded.
4548 *
4549 * @see #getResourcesForApplication(ApplicationInfo)
4550 */
4551 public abstract Resources getResourcesForApplication(String appPackageName)
4552 throws NameNotFoundException;
4553
Amith Yamasani98edc952012-09-25 14:09:27 -07004554 /** @hide */
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004555 public abstract Resources getResourcesForApplicationAsUser(String appPackageName,
4556 @UserIdInt int userId) throws NameNotFoundException;
Amith Yamasani98edc952012-09-25 14:09:27 -07004557
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004558 /**
4559 * Retrieve overall information about an application package defined
4560 * in a package archive file
4561 *
4562 * @param archiveFilePath The path to the archive file
4563 * @param flags Additional option flags. Use any combination of
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004564 * {@link #GET_ACTIVITIES}, {@link #GET_CONFIGURATIONS},
4565 * {@link #GET_GIDS}, {@link #GET_INSTRUMENTATION},
4566 * {@link #GET_INTENT_FILTERS}, {@link #GET_META_DATA},
4567 * {@link #GET_PERMISSIONS}, {@link #GET_PROVIDERS},
4568 * {@link #GET_RECEIVERS}, {@link #GET_SERVICES},
4569 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #GET_SIGNATURES},
4570 * {@link #GET_URI_PERMISSION_PATTERNS}, {@link #GET_UNINSTALLED_PACKAGES},
4571 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
4572 * {@link #MATCH_UNINSTALLED_PACKAGES}
4573 * to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004574 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004575 * @return A PackageInfo object containing information about the
4576 * package archive. If the package could not be parsed,
4577 * returns null.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004578 *
4579 * @see #GET_ACTIVITIES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004580 * @see #GET_CONFIGURATIONS
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004581 * @see #GET_GIDS
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004582 * @see #GET_INSTRUMENTATION
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004583 * @see #GET_INTENT_FILTERS
4584 * @see #GET_META_DATA
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004585 * @see #GET_PERMISSIONS
4586 * @see #GET_PROVIDERS
4587 * @see #GET_RECEIVERS
4588 * @see #GET_SERVICES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004589 * @see #GET_SHARED_LIBRARY_FILES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004590 * @see #GET_SIGNATURES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004591 * @see #GET_URI_PERMISSION_PATTERNS
4592 * @see #MATCH_DISABLED_COMPONENTS
4593 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
4594 * @see #MATCH_UNINSTALLED_PACKAGES
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004595 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004596 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004597 public PackageInfo getPackageArchiveInfo(String archiveFilePath, @PackageInfoFlags int flags) {
Jeff Sharkey275e0852014-06-17 18:18:49 -07004598 final PackageParser parser = new PackageParser();
4599 final File apkFile = new File(archiveFilePath);
Jeff Sharkeyc4858a22014-06-16 10:51:20 -07004600 try {
Jeff Sharkeyc3132512016-01-12 14:06:58 -07004601 if ((flags & (MATCH_ENCRYPTION_UNAWARE | MATCH_ENCRYPTION_AWARE)) != 0) {
4602 // Caller expressed an explicit opinion about what encryption
4603 // aware/unaware components they want to see, so fall through and
4604 // give them what they want
4605 } else {
4606 // Caller expressed no opinion, so match everything
4607 flags |= MATCH_ENCRYPTION_AWARE_AND_UNAWARE;
4608 }
4609
Jeff Sharkey275e0852014-06-17 18:18:49 -07004610 PackageParser.Package pkg = parser.parseMonolithicPackage(apkFile, 0);
Jeff Sharkeyc4858a22014-06-16 10:51:20 -07004611 if ((flags & GET_SIGNATURES) != 0) {
Svet Ganov354cd3c2015-12-17 11:35:04 -08004612 PackageParser.collectCertificates(pkg, 0);
Jeff Sharkeyc4858a22014-06-16 10:51:20 -07004613 }
4614 PackageUserState state = new PackageUserState();
4615 return PackageParser.generatePackageInfo(pkg, null, flags, 0, 0, null, state);
4616 } catch (PackageParserException e) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004617 return null;
4618 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004619 }
4620
4621 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07004622 * @deprecated replaced by {@link PackageInstaller}
4623 * @hide
Jacek Surazski65e13172009-04-28 15:26:38 +02004624 */
Jeff Sharkey5aa86932016-01-08 19:07:49 -07004625 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004626 public abstract void installPackage(
Todd Kennedya6793232016-02-24 22:46:00 +00004627 Uri packageURI,
4628 IPackageInstallObserver observer,
4629 @InstallFlags int flags,
Jacek Surazski65e13172009-04-28 15:26:38 +02004630 String installerPackageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004631 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07004632 * @deprecated replaced by {@link PackageInstaller}
Christopher Tateab8a5012014-03-24 16:25:51 -07004633 * @hide
Christopher Tateab8a5012014-03-24 16:25:51 -07004634 */
Jeff Sharkey5aa86932016-01-08 19:07:49 -07004635 @Deprecated
Todd Kennedya6793232016-02-24 22:46:00 +00004636 public abstract void installPackage(
4637 Uri packageURI,
4638 PackageInstallObserver observer,
4639 @InstallFlags int flags,
4640 String installerPackageName);
Christopher Tateab8a5012014-03-24 16:25:51 -07004641
rich cannings706e8ba2012-08-20 13:20:14 -07004642 /**
Dianne Hackborn7767eac2012-08-23 18:25:40 -07004643 * If there is already an application with the given package name installed
4644 * on the system for other users, also install it for the calling user.
4645 * @hide
4646 */
Nicolas Prevot9a80e532015-09-23 15:49:28 +01004647 public abstract int installExistingPackage(String packageName) throws NameNotFoundException;
4648
4649 /**
4650 * If there is already an application with the given package name installed
4651 * on the system for other users, also install it for the specified user.
4652 * @hide
4653 */
4654 @RequiresPermission(anyOf = {
4655 Manifest.permission.INSTALL_PACKAGES,
4656 Manifest.permission.INTERACT_ACROSS_USERS_FULL})
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004657 public abstract int installExistingPackageAsUser(String packageName, @UserIdInt int userId)
Dianne Hackborn7767eac2012-08-23 18:25:40 -07004658 throws NameNotFoundException;
4659
4660 /**
Kenny Root5ab21572011-07-27 11:11:19 -07004661 * Allows a package listening to the
4662 * {@link Intent#ACTION_PACKAGE_NEEDS_VERIFICATION package verification
Kenny Root3a9b5fb2011-09-20 14:15:38 -07004663 * broadcast} to respond to the package manager. The response must include
4664 * the {@code verificationCode} which is one of
4665 * {@link PackageManager#VERIFICATION_ALLOW} or
4666 * {@link PackageManager#VERIFICATION_REJECT}.
Kenny Root5ab21572011-07-27 11:11:19 -07004667 *
4668 * @param id pending package identifier as passed via the
kmccormick30498b42013-03-27 17:39:17 -07004669 * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra.
Kenny Root3a9b5fb2011-09-20 14:15:38 -07004670 * @param verificationCode either {@link PackageManager#VERIFICATION_ALLOW}
4671 * or {@link PackageManager#VERIFICATION_REJECT}.
rich cannings7e671512012-08-27 14:44:16 -07004672 * @throws SecurityException if the caller does not have the
Dianne Hackborn8832c182012-09-17 17:20:24 -07004673 * PACKAGE_VERIFICATION_AGENT permission.
Kenny Root5ab21572011-07-27 11:11:19 -07004674 */
Kenny Root3a9b5fb2011-09-20 14:15:38 -07004675 public abstract void verifyPendingInstall(int id, int verificationCode);
Kenny Root5ab21572011-07-27 11:11:19 -07004676
4677 /**
rich canningsd9ef3e52012-08-22 14:28:05 -07004678 * Allows a package listening to the
4679 * {@link Intent#ACTION_PACKAGE_NEEDS_VERIFICATION package verification
4680 * broadcast} to extend the default timeout for a response and declare what
4681 * action to perform after the timeout occurs. The response must include
4682 * the {@code verificationCodeAtTimeout} which is one of
4683 * {@link PackageManager#VERIFICATION_ALLOW} or
4684 * {@link PackageManager#VERIFICATION_REJECT}.
4685 *
4686 * This method may only be called once per package id. Additional calls
4687 * will have no effect.
4688 *
4689 * @param id pending package identifier as passed via the
kmccormick30498b42013-03-27 17:39:17 -07004690 * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra.
rich canningsd9ef3e52012-08-22 14:28:05 -07004691 * @param verificationCodeAtTimeout either
4692 * {@link PackageManager#VERIFICATION_ALLOW} or
rich canningsd1b5cfc2012-08-29 14:49:51 -07004693 * {@link PackageManager#VERIFICATION_REJECT}. If
4694 * {@code verificationCodeAtTimeout} is neither
4695 * {@link PackageManager#VERIFICATION_ALLOW} or
4696 * {@link PackageManager#VERIFICATION_REJECT}, then
4697 * {@code verificationCodeAtTimeout} will default to
rich canningsd9ef3e52012-08-22 14:28:05 -07004698 * {@link PackageManager#VERIFICATION_REJECT}.
4699 * @param millisecondsToDelay the amount of time requested for the timeout.
4700 * Must be positive and less than
rich canningsd1b5cfc2012-08-29 14:49:51 -07004701 * {@link PackageManager#MAXIMUM_VERIFICATION_TIMEOUT}. If
4702 * {@code millisecondsToDelay} is out of bounds,
4703 * {@code millisecondsToDelay} will be set to the closest in
4704 * bounds value; namely, 0 or
rich canningsd9ef3e52012-08-22 14:28:05 -07004705 * {@link PackageManager#MAXIMUM_VERIFICATION_TIMEOUT}.
rich cannings7e671512012-08-27 14:44:16 -07004706 * @throws SecurityException if the caller does not have the
Dianne Hackborn8832c182012-09-17 17:20:24 -07004707 * PACKAGE_VERIFICATION_AGENT permission.
rich canningsd9ef3e52012-08-22 14:28:05 -07004708 */
4709 public abstract void extendVerificationTimeout(int id,
4710 int verificationCodeAtTimeout, long millisecondsToDelay);
4711
4712 /**
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004713 * Allows a package listening to the
4714 * {@link Intent#ACTION_INTENT_FILTER_NEEDS_VERIFICATION intent filter verification
4715 * broadcast} to respond to the package manager. The response must include
4716 * the {@code verificationCode} which is one of
4717 * {@link PackageManager#INTENT_FILTER_VERIFICATION_SUCCESS} or
4718 * {@link PackageManager#INTENT_FILTER_VERIFICATION_FAILURE}.
4719 *
4720 * @param verificationId pending package identifier as passed via the
4721 * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra.
4722 * @param verificationCode either {@link PackageManager#INTENT_FILTER_VERIFICATION_SUCCESS}
4723 * or {@link PackageManager#INTENT_FILTER_VERIFICATION_FAILURE}.
4724 * @param outFailedDomains a list of failed domains if the verificationCode is
4725 * {@link PackageManager#INTENT_FILTER_VERIFICATION_FAILURE}, otherwise null;
4726 * @throws SecurityException if the caller does not have the
4727 * INTENT_FILTER_VERIFICATION_AGENT permission.
4728 *
4729 * @hide
4730 */
Fabrice Di Meglioef741da2015-05-12 16:31:38 -07004731 @SystemApi
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004732 public abstract void verifyIntentFilter(int verificationId, int verificationCode,
4733 List<String> outFailedDomains);
4734
4735 /**
4736 * Get the status of a Domain Verification Result for an IntentFilter. This is
4737 * related to the {@link android.content.IntentFilter#setAutoVerify(boolean)} and
4738 * {@link android.content.IntentFilter#getAutoVerify()}
4739 *
4740 * This is used by the ResolverActivity to change the status depending on what the User select
4741 * in the Disambiguation Dialog and also used by the Settings App for changing the default App
4742 * for a domain.
4743 *
4744 * @param packageName The package name of the Activity associated with the IntentFilter.
4745 * @param userId The user id.
4746 *
4747 * @return The status to set to. This can be
4748 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK} or
4749 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS} or
4750 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER} or
4751 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED}
4752 *
4753 * @hide
4754 */
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004755 public abstract int getIntentVerificationStatusAsUser(String packageName, @UserIdInt int userId);
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004756
4757 /**
4758 * Allow to change the status of a Intent Verification status for all IntentFilter of an App.
4759 * This is related to the {@link android.content.IntentFilter#setAutoVerify(boolean)} and
4760 * {@link android.content.IntentFilter#getAutoVerify()}
4761 *
4762 * This is used by the ResolverActivity to change the status depending on what the User select
4763 * in the Disambiguation Dialog and also used by the Settings App for changing the default App
4764 * for a domain.
4765 *
4766 * @param packageName The package name of the Activity associated with the IntentFilter.
4767 * @param status The status to set to. This can be
4768 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK} or
4769 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS} or
4770 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER}
4771 * @param userId The user id.
4772 *
4773 * @return true if the status has been set. False otherwise.
4774 *
4775 * @hide
4776 */
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07004777 public abstract boolean updateIntentVerificationStatusAsUser(String packageName, int status,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004778 @UserIdInt int userId);
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004779
4780 /**
4781 * Get the list of IntentFilterVerificationInfo for a specific package and User.
4782 *
4783 * @param packageName the package name. When this parameter is set to a non null value,
4784 * the results will be filtered by the package name provided.
4785 * Otherwise, there will be no filtering and it will return a list
Fabrice Di Meglio07885952015-04-06 19:41:28 -07004786 * corresponding for all packages
4787 *
4788 * @return a list of IntentFilterVerificationInfo for a specific package.
4789 *
4790 * @hide
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004791 */
4792 public abstract List<IntentFilterVerificationInfo> getIntentFilterVerifications(
4793 String packageName);
4794
4795 /**
Fabrice Di Meglio07885952015-04-06 19:41:28 -07004796 * Get the list of IntentFilter for a specific package.
4797 *
4798 * @param packageName the package name. This parameter is set to a non null value,
4799 * the list will contain all the IntentFilter for that package.
4800 * Otherwise, the list will be empty.
4801 *
4802 * @return a list of IntentFilter for a specific package.
4803 *
4804 * @hide
4805 */
4806 public abstract List<IntentFilter> getAllIntentFilters(String packageName);
4807
4808 /**
Fabrice Di Meglio62271722015-04-10 17:24:02 -07004809 * Get the default Browser package name for a specific user.
4810 *
4811 * @param userId The user id.
4812 *
4813 * @return the package name of the default Browser for the specified user. If the user id passed
4814 * is -1 (all users) it will return a null value.
4815 *
4816 * @hide
4817 */
Jeff Sharkeya73b8fd2016-01-06 17:02:08 -07004818 @TestApi
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004819 public abstract String getDefaultBrowserPackageNameAsUser(@UserIdInt int userId);
Fabrice Di Meglio62271722015-04-10 17:24:02 -07004820
4821 /**
4822 * Set the default Browser package name for a specific user.
4823 *
4824 * @param packageName The package name of the default Browser.
4825 * @param userId The user id.
4826 *
4827 * @return true if the default Browser for the specified user has been set,
4828 * otherwise return false. If the user id passed is -1 (all users) this call will not
4829 * do anything and just return false.
4830 *
4831 * @hide
4832 */
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004833 public abstract boolean setDefaultBrowserPackageNameAsUser(String packageName,
4834 @UserIdInt int userId);
Fabrice Di Meglio62271722015-04-10 17:24:02 -07004835
4836 /**
Dianne Hackborn880119b2010-11-18 22:26:40 -08004837 * Change the installer associated with a given package. There are limitations
4838 * on how the installer package can be changed; in particular:
4839 * <ul>
4840 * <li> A SecurityException will be thrown if <var>installerPackageName</var>
4841 * is not signed with the same certificate as the calling application.
4842 * <li> A SecurityException will be thrown if <var>targetPackage</var> already
4843 * has an installer package, and that installer package is not signed with
4844 * the same certificate as the calling application.
4845 * </ul>
4846 *
4847 * @param targetPackage The installed package whose installer will be changed.
4848 * @param installerPackageName The package name of the new installer. May be
4849 * null to clear the association.
4850 */
4851 public abstract void setInstallerPackageName(String targetPackage,
4852 String installerPackageName);
4853
4854 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07004855 * Attempts to delete a package. Since this may take a little while, the
4856 * result will be posted back to the given observer. A deletion will fail if
4857 * the calling context lacks the
4858 * {@link android.Manifest.permission#DELETE_PACKAGES} permission, if the
4859 * named package cannot be found, or if the named package is a system
4860 * package.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004861 *
4862 * @param packageName The name of the package to delete
Jeff Sharkey5aa86932016-01-08 19:07:49 -07004863 * @param observer An observer callback to get notified when the package
4864 * deletion is complete.
4865 * {@link android.content.pm.IPackageDeleteObserver#packageDeleted}
4866 * will be called when that happens. observer may be null to
4867 * indicate that no callback is desired.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004868 * @hide
4869 */
Jeff Sharkey5aa86932016-01-08 19:07:49 -07004870 public abstract void deletePackage(String packageName, IPackageDeleteObserver observer,
4871 @DeleteFlags int flags);
Jacek Surazski65e13172009-04-28 15:26:38 +02004872
4873 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07004874 * Attempts to delete a package. Since this may take a little while, the
4875 * result will be posted back to the given observer. A deletion will fail if
4876 * the named package cannot be found, or if the named package is a system
4877 * package.
Nicolas Prevot9a80e532015-09-23 15:49:28 +01004878 *
4879 * @param packageName The name of the package to delete
Jeff Sharkey5aa86932016-01-08 19:07:49 -07004880 * @param observer An observer callback to get notified when the package
4881 * deletion is complete.
4882 * {@link android.content.pm.IPackageDeleteObserver#packageDeleted}
4883 * will be called when that happens. observer may be null to
4884 * indicate that no callback is desired.
Nicolas Prevot9a80e532015-09-23 15:49:28 +01004885 * @param userId The user Id
Nicolas Prevot9a80e532015-09-23 15:49:28 +01004886 * @hide
4887 */
4888 @RequiresPermission(anyOf = {
4889 Manifest.permission.DELETE_PACKAGES,
4890 Manifest.permission.INTERACT_ACROSS_USERS_FULL})
Jeff Sharkey5aa86932016-01-08 19:07:49 -07004891 public abstract void deletePackageAsUser(String packageName, IPackageDeleteObserver observer,
4892 @DeleteFlags int flags, @UserIdInt int userId);
Nicolas Prevot9a80e532015-09-23 15:49:28 +01004893
4894 /**
Jacek Surazski65e13172009-04-28 15:26:38 +02004895 * Retrieve the package name of the application that installed a package. This identifies
4896 * which market the package came from.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004897 *
Jacek Surazski65e13172009-04-28 15:26:38 +02004898 * @param packageName The name of the package to query
4899 */
4900 public abstract String getInstallerPackageName(String packageName);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004901
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004902 /**
4903 * Attempts to clear the user data directory of an application.
4904 * Since this may take a little while, the result will
4905 * be posted back to the given observer. A deletion will fail if the
4906 * named package cannot be found, or if the named package is a "system package".
4907 *
4908 * @param packageName The name of the package
4909 * @param observer An observer callback to get notified when the operation is finished
4910 * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)}
4911 * will be called when that happens. observer may be null to indicate that
4912 * no callback is desired.
4913 *
4914 * @hide
4915 */
4916 public abstract void clearApplicationUserData(String packageName,
4917 IPackageDataObserver observer);
4918 /**
4919 * Attempts to delete the cache files associated with an application.
4920 * Since this may take a little while, the result will
4921 * be posted back to the given observer. A deletion will fail if the calling context
4922 * lacks the {@link android.Manifest.permission#DELETE_CACHE_FILES} permission, if the
4923 * named package cannot be found, or if the named package is a "system package".
4924 *
4925 * @param packageName The name of the package to delete
4926 * @param observer An observer callback to get notified when the cache file deletion
4927 * is complete.
4928 * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)}
4929 * will be called when that happens. observer may be null to indicate that
4930 * no callback is desired.
4931 *
4932 * @hide
4933 */
4934 public abstract void deleteApplicationCacheFiles(String packageName,
4935 IPackageDataObserver observer);
4936
4937 /**
4938 * Free storage by deleting LRU sorted list of cache files across
4939 * all applications. If the currently available free storage
4940 * on the device is greater than or equal to the requested
4941 * free storage, no cache files are cleared. If the currently
4942 * available storage on the device is less than the requested
4943 * free storage, some or all of the cache files across
4944 * all applications are deleted (based on last accessed time)
4945 * to increase the free storage space on the device to
4946 * the requested value. There is no guarantee that clearing all
4947 * the cache files from all applications will clear up
4948 * enough storage to achieve the desired value.
4949 * @param freeStorageSize The number of bytes of storage to be
4950 * freed by the system. Say if freeStorageSize is XX,
4951 * and the current free storage is YY,
4952 * if XX is less than YY, just return. if not free XX-YY number
4953 * of bytes if possible.
4954 * @param observer call back used to notify when
4955 * the operation is completed
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004956 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004957 * @hide
4958 */
Jeff Sharkey529f91f2015-04-18 20:23:13 -07004959 public void freeStorageAndNotify(long freeStorageSize, IPackageDataObserver observer) {
4960 freeStorageAndNotify(null, freeStorageSize, observer);
4961 }
4962
4963 /** {@hide} */
4964 public abstract void freeStorageAndNotify(String volumeUuid, long freeStorageSize,
4965 IPackageDataObserver observer);
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -07004966
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004967 /**
4968 * Free storage by deleting LRU sorted list of cache files across
4969 * all applications. If the currently available free storage
4970 * on the device is greater than or equal to the requested
4971 * free storage, no cache files are cleared. If the currently
4972 * available storage on the device is less than the requested
4973 * free storage, some or all of the cache files across
4974 * all applications are deleted (based on last accessed time)
4975 * to increase the free storage space on the device to
4976 * the requested value. There is no guarantee that clearing all
4977 * the cache files from all applications will clear up
4978 * enough storage to achieve the desired value.
4979 * @param freeStorageSize The number of bytes of storage to be
4980 * freed by the system. Say if freeStorageSize is XX,
4981 * and the current free storage is YY,
4982 * if XX is less than YY, just return. if not free XX-YY number
4983 * of bytes if possible.
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -07004984 * @param pi IntentSender call back used to
4985 * notify when the operation is completed.May be null
4986 * to indicate that no call back is desired.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004987 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004988 * @hide
4989 */
Jeff Sharkey529f91f2015-04-18 20:23:13 -07004990 public void freeStorage(long freeStorageSize, IntentSender pi) {
4991 freeStorage(null, freeStorageSize, pi);
4992 }
4993
4994 /** {@hide} */
4995 public abstract void freeStorage(String volumeUuid, long freeStorageSize, IntentSender pi);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004996
4997 /**
4998 * Retrieve the size information for a package.
4999 * Since this may take a little while, the result will
5000 * be posted back to the given observer. The calling context
5001 * should have the {@link android.Manifest.permission#GET_PACKAGE_SIZE} permission.
5002 *
5003 * @param packageName The name of the package whose size information is to be retrieved
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07005004 * @param userId The user whose size information should be retrieved.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005005 * @param observer An observer callback to get notified when the operation
5006 * is complete.
5007 * {@link android.content.pm.IPackageStatsObserver#onGetStatsCompleted(PackageStats, boolean)}
5008 * The observer's callback is invoked with a PackageStats object(containing the
5009 * code, data and cache sizes of the package) and a boolean value representing
5010 * the status of the operation. observer may be null to indicate that
5011 * no callback is desired.
5012 *
5013 * @hide
5014 */
Jeff Sharkey8588bc12016-01-06 16:47:42 -07005015 public abstract void getPackageSizeInfoAsUser(String packageName, @UserIdInt int userId,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005016 IPackageStatsObserver observer);
5017
5018 /**
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07005019 * Like {@link #getPackageSizeInfoAsUser(String, int, IPackageStatsObserver)}, but
Dianne Hackborn0c380492012-08-20 17:23:30 -07005020 * returns the size for the calling user.
5021 *
5022 * @hide
5023 */
5024 public void getPackageSizeInfo(String packageName, IPackageStatsObserver observer) {
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07005025 getPackageSizeInfoAsUser(packageName, UserHandle.myUserId(), observer);
Dianne Hackborn0c380492012-08-20 17:23:30 -07005026 }
5027
5028 /**
Dianne Hackborna7ca0e52009-12-01 14:31:55 -08005029 * @deprecated This function no longer does anything; it was an old
kmccormickac66b852013-03-28 15:17:15 -07005030 * approach to managing preferred activities, which has been superseded
5031 * by (and conflicts with) the modern activity-based preferences.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005032 */
Dianne Hackborna7ca0e52009-12-01 14:31:55 -08005033 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005034 public abstract void addPackageToPreferred(String packageName);
5035
5036 /**
Dianne Hackborna7ca0e52009-12-01 14:31:55 -08005037 * @deprecated This function no longer does anything; it was an old
kmccormickac66b852013-03-28 15:17:15 -07005038 * approach to managing preferred activities, which has been superseded
5039 * by (and conflicts with) the modern activity-based preferences.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005040 */
Dianne Hackborna7ca0e52009-12-01 14:31:55 -08005041 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005042 public abstract void removePackageFromPreferred(String packageName);
5043
5044 /**
Jeff Sharkey629f9842016-01-08 16:36:54 -07005045 * Retrieve the list of all currently configured preferred packages. The
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005046 * first package on the list is the most preferred, the last is the
5047 * least preferred.
5048 *
5049 * @param flags Additional option flags. Use any combination of
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08005050 * {@link #GET_ACTIVITIES}, {@link #GET_CONFIGURATIONS},
5051 * {@link #GET_GIDS}, {@link #GET_INSTRUMENTATION},
5052 * {@link #GET_INTENT_FILTERS}, {@link #GET_META_DATA},
5053 * {@link #GET_PERMISSIONS}, {@link #GET_PROVIDERS},
5054 * {@link #GET_RECEIVERS}, {@link #GET_SERVICES},
5055 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #GET_SIGNATURES},
5056 * {@link #GET_URI_PERMISSION_PATTERNS}, {@link #GET_UNINSTALLED_PACKAGES},
5057 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
5058 * {@link #MATCH_UNINSTALLED_PACKAGES}
5059 * to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005060 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08005061 * @return A List of PackageInfo objects, one for each preferred application,
5062 * in order of preference.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005063 *
5064 * @see #GET_ACTIVITIES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005065 * @see #GET_CONFIGURATIONS
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08005066 * @see #GET_GIDS
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005067 * @see #GET_INSTRUMENTATION
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08005068 * @see #GET_INTENT_FILTERS
5069 * @see #GET_META_DATA
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005070 * @see #GET_PERMISSIONS
5071 * @see #GET_PROVIDERS
5072 * @see #GET_RECEIVERS
5073 * @see #GET_SERVICES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08005074 * @see #GET_SHARED_LIBRARY_FILES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005075 * @see #GET_SIGNATURES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08005076 * @see #GET_URI_PERMISSION_PATTERNS
5077 * @see #MATCH_DISABLED_COMPONENTS
5078 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
5079 * @see #MATCH_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005080 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07005081 public abstract List<PackageInfo> getPreferredPackages(@PackageInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005082
5083 /**
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08005084 * @deprecated This is a protected API that should not have been available
5085 * to third party applications. It is the platform's responsibility for
kmccormick30498b42013-03-27 17:39:17 -07005086 * assigning preferred activities and this cannot be directly modified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005087 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005088 * Add a new preferred activity mapping to the system. This will be used
5089 * to automatically select the given activity component when
5090 * {@link Context#startActivity(Intent) Context.startActivity()} finds
5091 * multiple matching activities and also matches the given filter.
5092 *
5093 * @param filter The set of intents under which this activity will be
5094 * made preferred.
5095 * @param match The IntentFilter match category that this preference
5096 * applies to.
5097 * @param set The set of activities that the user was picking from when
5098 * this preference was made.
5099 * @param activity The component name of the activity that is to be
5100 * preferred.
5101 */
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08005102 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005103 public abstract void addPreferredActivity(IntentFilter filter, int match,
5104 ComponentName[] set, ComponentName activity);
5105
5106 /**
Amith Yamasania3f133a2012-08-09 17:11:28 -07005107 * Same as {@link #addPreferredActivity(IntentFilter, int,
5108 ComponentName[], ComponentName)}, but with a specific userId to apply the preference
5109 to.
5110 * @hide
5111 */
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07005112 public void addPreferredActivityAsUser(IntentFilter filter, int match,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07005113 ComponentName[] set, ComponentName activity, @UserIdInt int userId) {
Amith Yamasania3f133a2012-08-09 17:11:28 -07005114 throw new RuntimeException("Not implemented. Must override in a subclass.");
5115 }
5116
5117 /**
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08005118 * @deprecated This is a protected API that should not have been available
5119 * to third party applications. It is the platform's responsibility for
kmccormick30498b42013-03-27 17:39:17 -07005120 * assigning preferred activities and this cannot be directly modified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005121 *
Satish Sampath8dbe6122009-06-02 23:35:54 +01005122 * Replaces an existing preferred activity mapping to the system, and if that were not present
5123 * adds a new preferred activity. This will be used
5124 * to automatically select the given activity component when
5125 * {@link Context#startActivity(Intent) Context.startActivity()} finds
5126 * multiple matching activities and also matches the given filter.
5127 *
5128 * @param filter The set of intents under which this activity will be
5129 * made preferred.
5130 * @param match The IntentFilter match category that this preference
5131 * applies to.
5132 * @param set The set of activities that the user was picking from when
5133 * this preference was made.
5134 * @param activity The component name of the activity that is to be
5135 * preferred.
5136 * @hide
5137 */
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08005138 @Deprecated
Satish Sampath8dbe6122009-06-02 23:35:54 +01005139 public abstract void replacePreferredActivity(IntentFilter filter, int match,
5140 ComponentName[] set, ComponentName activity);
5141
5142 /**
Amith Yamasani41c1ded2014-08-05 11:15:05 -07005143 * @hide
5144 */
5145 @Deprecated
5146 public void replacePreferredActivityAsUser(IntentFilter filter, int match,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07005147 ComponentName[] set, ComponentName activity, @UserIdInt int userId) {
Amith Yamasani41c1ded2014-08-05 11:15:05 -07005148 throw new RuntimeException("Not implemented. Must override in a subclass.");
5149 }
5150
5151 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005152 * Remove all preferred activity mappings, previously added with
5153 * {@link #addPreferredActivity}, from the
5154 * system whose activities are implemented in the given package name.
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08005155 * An application can only clear its own package(s).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005156 *
5157 * @param packageName The name of the package whose preferred activity
5158 * mappings are to be removed.
5159 */
5160 public abstract void clearPackagePreferredActivities(String packageName);
5161
5162 /**
5163 * Retrieve all preferred activities, previously added with
5164 * {@link #addPreferredActivity}, that are
5165 * currently registered with the system.
5166 *
John Spurlock38e64252015-03-18 12:09:32 -04005167 * @param outFilters A required list in which to place the filters of all of the
5168 * preferred activities.
5169 * @param outActivities A required list in which to place the component names of
5170 * all of the preferred activities.
5171 * @param packageName An optional package in which you would like to limit
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005172 * the list. If null, all activities will be returned; if non-null, only
5173 * those activities in the given package are returned.
5174 *
5175 * @return Returns the total number of registered preferred activities
5176 * (the number of distinct IntentFilter records, not the number of unique
5177 * activity components) that were found.
5178 */
John Spurlock38e64252015-03-18 12:09:32 -04005179 public abstract int getPreferredActivities(@NonNull List<IntentFilter> outFilters,
5180 @NonNull List<ComponentName> outActivities, String packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005181
5182 /**
Christopher Tatea2a0850d2013-09-05 16:38:58 -07005183 * Ask for the set of available 'home' activities and the current explicit
5184 * default, if any.
5185 * @hide
5186 */
5187 public abstract ComponentName getHomeActivities(List<ResolveInfo> outActivities);
5188
5189 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005190 * Set the enabled setting for a package component (activity, receiver, service, provider).
5191 * This setting will override any enabled state which may have been set by the component in its
5192 * manifest.
5193 *
5194 * @param componentName The component to enable
5195 * @param newState The new enabled state for the component. The legal values for this state
5196 * are:
5197 * {@link #COMPONENT_ENABLED_STATE_ENABLED},
5198 * {@link #COMPONENT_ENABLED_STATE_DISABLED}
5199 * and
5200 * {@link #COMPONENT_ENABLED_STATE_DEFAULT}
5201 * The last one removes the setting, thereby restoring the component's state to
5202 * whatever was set in it's manifest (or enabled, by default).
5203 * @param flags Optional behavior flags: {@link #DONT_KILL_APP} or 0.
5204 */
5205 public abstract void setComponentEnabledSetting(ComponentName componentName,
5206 int newState, int flags);
5207
5208
5209 /**
Amaury Medeirosdde24262014-06-03 20:06:41 -03005210 * Return the enabled setting for a package component (activity,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005211 * receiver, service, provider). This returns the last value set by
5212 * {@link #setComponentEnabledSetting(ComponentName, int, int)}; in most
5213 * cases this value will be {@link #COMPONENT_ENABLED_STATE_DEFAULT} since
5214 * the value originally specified in the manifest has not been modified.
5215 *
5216 * @param componentName The component to retrieve.
5217 * @return Returns the current enabled state for the component. May
5218 * be one of {@link #COMPONENT_ENABLED_STATE_ENABLED},
5219 * {@link #COMPONENT_ENABLED_STATE_DISABLED}, or
5220 * {@link #COMPONENT_ENABLED_STATE_DEFAULT}. The last one means the
5221 * component's enabled state is based on the original information in
5222 * the manifest as found in {@link ComponentInfo}.
5223 */
5224 public abstract int getComponentEnabledSetting(ComponentName componentName);
5225
5226 /**
5227 * Set the enabled setting for an application
5228 * This setting will override any enabled state which may have been set by the application in
5229 * its manifest. It also overrides the enabled state set in the manifest for any of the
5230 * application's components. It does not override any enabled state set by
5231 * {@link #setComponentEnabledSetting} for any of the application's components.
5232 *
5233 * @param packageName The package name of the application to enable
5234 * @param newState The new enabled state for the component. The legal values for this state
5235 * are:
5236 * {@link #COMPONENT_ENABLED_STATE_ENABLED},
5237 * {@link #COMPONENT_ENABLED_STATE_DISABLED}
5238 * and
5239 * {@link #COMPONENT_ENABLED_STATE_DEFAULT}
5240 * The last one removes the setting, thereby restoring the applications's state to
5241 * whatever was set in its manifest (or enabled, by default).
5242 * @param flags Optional behavior flags: {@link #DONT_KILL_APP} or 0.
5243 */
5244 public abstract void setApplicationEnabledSetting(String packageName,
5245 int newState, int flags);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005246
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005247 /**
Amaury Medeirosdde24262014-06-03 20:06:41 -03005248 * Return the enabled setting for an application. This returns
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005249 * the last value set by
5250 * {@link #setApplicationEnabledSetting(String, int, int)}; in most
5251 * cases this value will be {@link #COMPONENT_ENABLED_STATE_DEFAULT} since
5252 * the value originally specified in the manifest has not been modified.
5253 *
Amaury Medeirosdde24262014-06-03 20:06:41 -03005254 * @param packageName The package name of the application to retrieve.
5255 * @return Returns the current enabled state for the application. May
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005256 * be one of {@link #COMPONENT_ENABLED_STATE_ENABLED},
5257 * {@link #COMPONENT_ENABLED_STATE_DISABLED}, or
5258 * {@link #COMPONENT_ENABLED_STATE_DEFAULT}. The last one means the
5259 * application's enabled state is based on the original information in
5260 * the manifest as found in {@link ComponentInfo}.
Mathew Inwood1b9f8d92011-09-26 13:23:56 +01005261 * @throws IllegalArgumentException if the named package does not exist.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005262 */
5263 public abstract int getApplicationEnabledSetting(String packageName);
5264
5265 /**
Amith Yamasanie5bcff62014-07-19 15:44:09 -07005266 * Puts the package in a hidden state, which is almost like an uninstalled state,
Amith Yamasani655d0e22013-06-12 14:19:10 -07005267 * making the package unavailable, but it doesn't remove the data or the actual
Amith Yamasanie5bcff62014-07-19 15:44:09 -07005268 * package file. Application can be unhidden by either resetting the hidden state
5269 * or by installing it, such as with {@link #installExistingPackage(String)}
Amith Yamasani655d0e22013-06-12 14:19:10 -07005270 * @hide
5271 */
Amith Yamasanie5bcff62014-07-19 15:44:09 -07005272 public abstract boolean setApplicationHiddenSettingAsUser(String packageName, boolean hidden,
Amith Yamasani655d0e22013-06-12 14:19:10 -07005273 UserHandle userHandle);
5274
5275 /**
Amith Yamasanie5bcff62014-07-19 15:44:09 -07005276 * Returns the hidden state of a package.
5277 * @see #setApplicationHiddenSettingAsUser(String, boolean, UserHandle)
Amith Yamasani655d0e22013-06-12 14:19:10 -07005278 * @hide
5279 */
Amith Yamasanie5bcff62014-07-19 15:44:09 -07005280 public abstract boolean getApplicationHiddenSettingAsUser(String packageName,
Amith Yamasani655d0e22013-06-12 14:19:10 -07005281 UserHandle userHandle);
5282
5283 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005284 * Return whether the device has been booted into safe mode.
5285 */
5286 public abstract boolean isSafeMode();
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08005287
5288 /**
Svetoslavf7c06eb2015-06-10 18:43:22 -07005289 * Adds a listener for permission changes for installed packages.
5290 *
5291 * @param listener The listener to add.
5292 *
5293 * @hide
5294 */
5295 @SystemApi
5296 @RequiresPermission(Manifest.permission.OBSERVE_GRANT_REVOKE_PERMISSIONS)
5297 public abstract void addOnPermissionsChangeListener(OnPermissionsChangedListener listener);
5298
5299 /**
5300 * Remvoes a listener for permission changes for installed packages.
5301 *
5302 * @param listener The listener to remove.
5303 *
5304 * @hide
5305 */
5306 @SystemApi
5307 public abstract void removeOnPermissionsChangeListener(OnPermissionsChangedListener listener);
5308
5309 /**
dcashman9d2f4412014-06-09 09:27:54 -07005310 * Return the {@link KeySet} associated with the String alias for this
5311 * application.
5312 *
5313 * @param alias The alias for a given {@link KeySet} as defined in the
5314 * application's AndroidManifest.xml.
dcashmanc6f22492014-08-14 09:54:51 -07005315 * @hide
dcashman9d2f4412014-06-09 09:27:54 -07005316 */
5317 public abstract KeySet getKeySetByAlias(String packageName, String alias);
5318
Ihab Awad1ec68882014-09-12 11:09:01 -07005319 /** Return the signing {@link KeySet} for this application.
dcashmanc6f22492014-08-14 09:54:51 -07005320 * @hide
5321 */
dcashman9d2f4412014-06-09 09:27:54 -07005322 public abstract KeySet getSigningKeySet(String packageName);
5323
5324 /**
5325 * Return whether the package denoted by packageName has been signed by all
5326 * of the keys specified by the {@link KeySet} ks. This will return true if
5327 * the package has been signed by additional keys (a superset) as well.
5328 * Compare to {@link #isSignedByExactly(String packageName, KeySet ks)}.
dcashmanc6f22492014-08-14 09:54:51 -07005329 * @hide
dcashman9d2f4412014-06-09 09:27:54 -07005330 */
5331 public abstract boolean isSignedBy(String packageName, KeySet ks);
5332
5333 /**
5334 * Return whether the package denoted by packageName has been signed by all
5335 * of, and only, the keys specified by the {@link KeySet} ks. Compare to
5336 * {@link #isSignedBy(String packageName, KeySet ks)}.
dcashmanc6f22492014-08-14 09:54:51 -07005337 * @hide
dcashman9d2f4412014-06-09 09:27:54 -07005338 */
5339 public abstract boolean isSignedByExactly(String packageName, KeySet ks);
5340
5341 /**
Andrei Stingaceanueb84b182016-01-26 18:39:55 +00005342 * Puts the package in a suspended state, where attempts at starting activities are denied.
Andrei Stingaceanu1e283912015-11-26 15:26:28 +00005343 *
Andrei Stingaceanueb84b182016-01-26 18:39:55 +00005344 * <p>It doesn't remove the data or the actual package file. The application notifications
5345 * will be hidden, the application will not show up in recents, will not be able to show
5346 * toasts or dialogs or ring the device.
5347 *
5348 * @param packageNames The names of the packages to set the suspended status.
5349 * @param suspended If set to {@code true} than the packages will be suspended, if set to
5350 * {@code false} the packages will be unsuspended.
Andrei Stingaceanu1e283912015-11-26 15:26:28 +00005351 * @param userId The user id.
5352 *
Andrei Stingaceanueb84b182016-01-26 18:39:55 +00005353 * @return an array of package names for which the suspended status is not set as requested in
5354 * this method.
5355 *
Andrei Stingaceanu1e283912015-11-26 15:26:28 +00005356 * @hide
5357 */
Andrei Stingaceanueb84b182016-01-26 18:39:55 +00005358 public abstract String[] setPackagesSuspendedAsUser(
5359 String[] packageNames, boolean suspended, @UserIdInt int userId);
Andrei Stingaceanu1e283912015-11-26 15:26:28 +00005360
Andrei Stingaceanu355b2322016-02-12 16:43:51 +00005361 /**
5362 * @see #setPackageSuspendedAsUser(String, boolean, int)
5363 * @param packageName The name of the package to get the suspended status of.
5364 * @param userId The user id.
5365 * @return {@code true} if the package is suspended or {@code false} if the package is not
5366 * suspended or could not be found.
5367 * @hide
5368 */
5369 public abstract boolean isPackageSuspendedForUser(String packageName, int userId);
5370
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -07005371 /** {@hide} */
Jeff Sharkey620b32b2015-04-23 19:36:02 -07005372 public static boolean isMoveStatusFinished(int status) {
5373 return (status < 0 || status > 100);
5374 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005375
Jeff Sharkeye2d45be2015-04-15 17:14:12 -07005376 /** {@hide} */
Jeff Sharkey620b32b2015-04-23 19:36:02 -07005377 public static abstract class MoveCallback {
Jeff Sharkey50a05452015-04-29 11:24:52 -07005378 public void onCreated(int moveId, Bundle extras) {}
5379 public abstract void onStatusChanged(int moveId, int status, long estMillis);
Jeff Sharkey620b32b2015-04-23 19:36:02 -07005380 }
Jeff Sharkeye2d45be2015-04-15 17:14:12 -07005381
5382 /** {@hide} */
Jeff Sharkey620b32b2015-04-23 19:36:02 -07005383 public abstract int getMoveStatus(int moveId);
5384
5385 /** {@hide} */
5386 public abstract void registerMoveCallback(MoveCallback callback, Handler handler);
5387 /** {@hide} */
5388 public abstract void unregisterMoveCallback(MoveCallback callback);
5389
5390 /** {@hide} */
5391 public abstract int movePackage(String packageName, VolumeInfo vol);
5392 /** {@hide} */
5393 public abstract @Nullable VolumeInfo getPackageCurrentVolume(ApplicationInfo app);
5394 /** {@hide} */
5395 public abstract @NonNull List<VolumeInfo> getPackageCandidateVolumes(ApplicationInfo app);
5396
5397 /** {@hide} */
5398 public abstract int movePrimaryStorage(VolumeInfo vol);
5399 /** {@hide} */
5400 public abstract @Nullable VolumeInfo getPrimaryStorageCurrentVolume();
5401 /** {@hide} */
5402 public abstract @NonNull List<VolumeInfo> getPrimaryStorageCandidateVolumes();
Jeff Sharkeye2d45be2015-04-15 17:14:12 -07005403
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005404 /**
Amith Yamasani13593602012-03-22 16:16:17 -07005405 * Returns the device identity that verifiers can use to associate their scheme to a particular
5406 * device. This should not be used by anything other than a package verifier.
Aravind Akella068b0c02013-10-12 17:39:15 -07005407 *
Kenny Root0aaa0d92011-09-12 16:42:55 -07005408 * @return identity that uniquely identifies current device
5409 * @hide
5410 */
5411 public abstract VerifierDeviceIdentity getVerifierDeviceIdentity();
Amith Yamasani742a6712011-05-04 14:49:28 -07005412
Jeff Sharkey6c833e02014-07-14 22:44:30 -07005413 /**
Jeff Hao9f60c082014-10-28 18:51:07 -07005414 * Returns true if the device is upgrading, such as first boot after OTA.
5415 *
5416 * @hide
5417 */
5418 public abstract boolean isUpgrade();
5419
5420 /**
Jeff Sharkey6c833e02014-07-14 22:44:30 -07005421 * Return interface that offers the ability to install, upgrade, and remove
5422 * applications on the device.
5423 */
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005424 public abstract @NonNull PackageInstaller getPackageInstaller();
Jeff Sharkey3a44f3f2014-04-28 17:36:31 -07005425
Amith Yamasani742a6712011-05-04 14:49:28 -07005426 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005427 * Adds a {@code CrossProfileIntentFilter}. After calling this method all
5428 * intents sent from the user with id sourceUserId can also be be resolved
5429 * by activities in the user with id targetUserId if they match the
5430 * specified intent filter.
5431 *
Nicolas Prevot3f7777f2014-07-24 15:58:39 +01005432 * @param filter The {@link IntentFilter} the intent has to match
5433 * @param sourceUserId The source user id.
5434 * @param targetUserId The target user id.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005435 * @param flags The possible values are {@link #SKIP_CURRENT_PROFILE} and
5436 * {@link #ONLY_IF_NO_MATCH_FOUND}.
Nicolas Prevotc79586e2014-05-06 12:47:57 +01005437 * @hide
5438 */
Nicolas Prevot63798c52014-05-27 13:22:38 +01005439 public abstract void addCrossProfileIntentFilter(IntentFilter filter, int sourceUserId,
5440 int targetUserId, int flags);
Nicolas Prevotc79586e2014-05-06 12:47:57 +01005441
5442 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005443 * Clearing {@code CrossProfileIntentFilter}s which have the specified user
5444 * as their source, and have been set by the app calling this method.
5445 *
Nicolas Prevot3f7777f2014-07-24 15:58:39 +01005446 * @param sourceUserId The source user id.
Nicolas Prevotc79586e2014-05-06 12:47:57 +01005447 * @hide
5448 */
Nicolas Prevot81948992014-05-16 18:25:26 +01005449 public abstract void clearCrossProfileIntentFilters(int sourceUserId);
Alexandra Gherghina6e2ae252014-06-12 16:03:58 +01005450
5451 /**
Nicolas Prevot88cc3462014-05-14 14:51:48 +01005452 * @hide
5453 */
Nicolas Prevot7f7b0c72014-06-23 15:59:38 +01005454 public abstract Drawable loadItemIcon(PackageItemInfo itemInfo, ApplicationInfo appInfo);
Jeff Sharkey6c833e02014-07-14 22:44:30 -07005455
Benjamin Franzec2d48b2014-10-01 15:38:43 +01005456 /**
5457 * @hide
5458 */
5459 public abstract Drawable loadUnbadgedItemIcon(PackageItemInfo itemInfo, ApplicationInfo appInfo);
5460
Jeff Sharkey6c833e02014-07-14 22:44:30 -07005461 /** {@hide} */
5462 public abstract boolean isPackageAvailable(String packageName);
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005463
5464 /** {@hide} */
Jeff Sharkeya0907432014-08-15 10:23:11 -07005465 public static String installStatusToString(int status, String msg) {
5466 final String str = installStatusToString(status);
5467 if (msg != null) {
5468 return str + ": " + msg;
5469 } else {
5470 return str;
5471 }
5472 }
5473
5474 /** {@hide} */
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005475 public static String installStatusToString(int status) {
5476 switch (status) {
5477 case INSTALL_SUCCEEDED: return "INSTALL_SUCCEEDED";
5478 case INSTALL_FAILED_ALREADY_EXISTS: return "INSTALL_FAILED_ALREADY_EXISTS";
5479 case INSTALL_FAILED_INVALID_APK: return "INSTALL_FAILED_INVALID_APK";
5480 case INSTALL_FAILED_INVALID_URI: return "INSTALL_FAILED_INVALID_URI";
5481 case INSTALL_FAILED_INSUFFICIENT_STORAGE: return "INSTALL_FAILED_INSUFFICIENT_STORAGE";
5482 case INSTALL_FAILED_DUPLICATE_PACKAGE: return "INSTALL_FAILED_DUPLICATE_PACKAGE";
5483 case INSTALL_FAILED_NO_SHARED_USER: return "INSTALL_FAILED_NO_SHARED_USER";
5484 case INSTALL_FAILED_UPDATE_INCOMPATIBLE: return "INSTALL_FAILED_UPDATE_INCOMPATIBLE";
5485 case INSTALL_FAILED_SHARED_USER_INCOMPATIBLE: return "INSTALL_FAILED_SHARED_USER_INCOMPATIBLE";
5486 case INSTALL_FAILED_MISSING_SHARED_LIBRARY: return "INSTALL_FAILED_MISSING_SHARED_LIBRARY";
5487 case INSTALL_FAILED_REPLACE_COULDNT_DELETE: return "INSTALL_FAILED_REPLACE_COULDNT_DELETE";
5488 case INSTALL_FAILED_DEXOPT: return "INSTALL_FAILED_DEXOPT";
5489 case INSTALL_FAILED_OLDER_SDK: return "INSTALL_FAILED_OLDER_SDK";
5490 case INSTALL_FAILED_CONFLICTING_PROVIDER: return "INSTALL_FAILED_CONFLICTING_PROVIDER";
5491 case INSTALL_FAILED_NEWER_SDK: return "INSTALL_FAILED_NEWER_SDK";
5492 case INSTALL_FAILED_TEST_ONLY: return "INSTALL_FAILED_TEST_ONLY";
5493 case INSTALL_FAILED_CPU_ABI_INCOMPATIBLE: return "INSTALL_FAILED_CPU_ABI_INCOMPATIBLE";
5494 case INSTALL_FAILED_MISSING_FEATURE: return "INSTALL_FAILED_MISSING_FEATURE";
5495 case INSTALL_FAILED_CONTAINER_ERROR: return "INSTALL_FAILED_CONTAINER_ERROR";
5496 case INSTALL_FAILED_INVALID_INSTALL_LOCATION: return "INSTALL_FAILED_INVALID_INSTALL_LOCATION";
5497 case INSTALL_FAILED_MEDIA_UNAVAILABLE: return "INSTALL_FAILED_MEDIA_UNAVAILABLE";
5498 case INSTALL_FAILED_VERIFICATION_TIMEOUT: return "INSTALL_FAILED_VERIFICATION_TIMEOUT";
5499 case INSTALL_FAILED_VERIFICATION_FAILURE: return "INSTALL_FAILED_VERIFICATION_FAILURE";
5500 case INSTALL_FAILED_PACKAGE_CHANGED: return "INSTALL_FAILED_PACKAGE_CHANGED";
5501 case INSTALL_FAILED_UID_CHANGED: return "INSTALL_FAILED_UID_CHANGED";
5502 case INSTALL_FAILED_VERSION_DOWNGRADE: return "INSTALL_FAILED_VERSION_DOWNGRADE";
5503 case INSTALL_PARSE_FAILED_NOT_APK: return "INSTALL_PARSE_FAILED_NOT_APK";
5504 case INSTALL_PARSE_FAILED_BAD_MANIFEST: return "INSTALL_PARSE_FAILED_BAD_MANIFEST";
5505 case INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION: return "INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION";
5506 case INSTALL_PARSE_FAILED_NO_CERTIFICATES: return "INSTALL_PARSE_FAILED_NO_CERTIFICATES";
5507 case INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES: return "INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES";
5508 case INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING: return "INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING";
5509 case INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME: return "INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME";
5510 case INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID: return "INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID";
5511 case INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: return "INSTALL_PARSE_FAILED_MANIFEST_MALFORMED";
5512 case INSTALL_PARSE_FAILED_MANIFEST_EMPTY: return "INSTALL_PARSE_FAILED_MANIFEST_EMPTY";
5513 case INSTALL_FAILED_INTERNAL_ERROR: return "INSTALL_FAILED_INTERNAL_ERROR";
5514 case INSTALL_FAILED_USER_RESTRICTED: return "INSTALL_FAILED_USER_RESTRICTED";
5515 case INSTALL_FAILED_DUPLICATE_PERMISSION: return "INSTALL_FAILED_DUPLICATE_PERMISSION";
5516 case INSTALL_FAILED_NO_MATCHING_ABIS: return "INSTALL_FAILED_NO_MATCHING_ABIS";
Jeff Sharkeyf0600952014-08-07 17:31:53 -07005517 case INSTALL_FAILED_ABORTED: return "INSTALL_FAILED_ABORTED";
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005518 default: return Integer.toString(status);
5519 }
5520 }
5521
5522 /** {@hide} */
Jeff Sharkeya0907432014-08-15 10:23:11 -07005523 public static int installStatusToPublicStatus(int status) {
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005524 switch (status) {
Jeff Sharkeya0907432014-08-15 10:23:11 -07005525 case INSTALL_SUCCEEDED: return PackageInstaller.STATUS_SUCCESS;
5526 case INSTALL_FAILED_ALREADY_EXISTS: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5527 case INSTALL_FAILED_INVALID_APK: return PackageInstaller.STATUS_FAILURE_INVALID;
5528 case INSTALL_FAILED_INVALID_URI: return PackageInstaller.STATUS_FAILURE_INVALID;
5529 case INSTALL_FAILED_INSUFFICIENT_STORAGE: return PackageInstaller.STATUS_FAILURE_STORAGE;
5530 case INSTALL_FAILED_DUPLICATE_PACKAGE: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5531 case INSTALL_FAILED_NO_SHARED_USER: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5532 case INSTALL_FAILED_UPDATE_INCOMPATIBLE: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5533 case INSTALL_FAILED_SHARED_USER_INCOMPATIBLE: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5534 case INSTALL_FAILED_MISSING_SHARED_LIBRARY: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5535 case INSTALL_FAILED_REPLACE_COULDNT_DELETE: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5536 case INSTALL_FAILED_DEXOPT: return PackageInstaller.STATUS_FAILURE_INVALID;
5537 case INSTALL_FAILED_OLDER_SDK: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5538 case INSTALL_FAILED_CONFLICTING_PROVIDER: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5539 case INSTALL_FAILED_NEWER_SDK: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5540 case INSTALL_FAILED_TEST_ONLY: return PackageInstaller.STATUS_FAILURE_INVALID;
5541 case INSTALL_FAILED_CPU_ABI_INCOMPATIBLE: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5542 case INSTALL_FAILED_MISSING_FEATURE: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5543 case INSTALL_FAILED_CONTAINER_ERROR: return PackageInstaller.STATUS_FAILURE_STORAGE;
5544 case INSTALL_FAILED_INVALID_INSTALL_LOCATION: return PackageInstaller.STATUS_FAILURE_STORAGE;
5545 case INSTALL_FAILED_MEDIA_UNAVAILABLE: return PackageInstaller.STATUS_FAILURE_STORAGE;
5546 case INSTALL_FAILED_VERIFICATION_TIMEOUT: return PackageInstaller.STATUS_FAILURE_ABORTED;
5547 case INSTALL_FAILED_VERIFICATION_FAILURE: return PackageInstaller.STATUS_FAILURE_ABORTED;
5548 case INSTALL_FAILED_PACKAGE_CHANGED: return PackageInstaller.STATUS_FAILURE_INVALID;
5549 case INSTALL_FAILED_UID_CHANGED: return PackageInstaller.STATUS_FAILURE_INVALID;
5550 case INSTALL_FAILED_VERSION_DOWNGRADE: return PackageInstaller.STATUS_FAILURE_INVALID;
Svetoslavd9653702015-05-13 18:02:46 -07005551 case INSTALL_FAILED_PERMISSION_MODEL_DOWNGRADE: return PackageInstaller.STATUS_FAILURE_INVALID;
Jeff Sharkeya0907432014-08-15 10:23:11 -07005552 case INSTALL_PARSE_FAILED_NOT_APK: return PackageInstaller.STATUS_FAILURE_INVALID;
5553 case INSTALL_PARSE_FAILED_BAD_MANIFEST: return PackageInstaller.STATUS_FAILURE_INVALID;
5554 case INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION: return PackageInstaller.STATUS_FAILURE_INVALID;
5555 case INSTALL_PARSE_FAILED_NO_CERTIFICATES: return PackageInstaller.STATUS_FAILURE_INVALID;
5556 case INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES: return PackageInstaller.STATUS_FAILURE_INVALID;
5557 case INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING: return PackageInstaller.STATUS_FAILURE_INVALID;
5558 case INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME: return PackageInstaller.STATUS_FAILURE_INVALID;
5559 case INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID: return PackageInstaller.STATUS_FAILURE_INVALID;
5560 case INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: return PackageInstaller.STATUS_FAILURE_INVALID;
5561 case INSTALL_PARSE_FAILED_MANIFEST_EMPTY: return PackageInstaller.STATUS_FAILURE_INVALID;
5562 case INSTALL_FAILED_INTERNAL_ERROR: return PackageInstaller.STATUS_FAILURE;
5563 case INSTALL_FAILED_USER_RESTRICTED: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5564 case INSTALL_FAILED_DUPLICATE_PERMISSION: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5565 case INSTALL_FAILED_NO_MATCHING_ABIS: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5566 case INSTALL_FAILED_ABORTED: return PackageInstaller.STATUS_FAILURE_ABORTED;
5567 default: return PackageInstaller.STATUS_FAILURE;
5568 }
5569 }
5570
5571 /** {@hide} */
5572 public static String deleteStatusToString(int status, String msg) {
5573 final String str = deleteStatusToString(status);
5574 if (msg != null) {
5575 return str + ": " + msg;
5576 } else {
5577 return str;
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005578 }
5579 }
5580
5581 /** {@hide} */
5582 public static String deleteStatusToString(int status) {
5583 switch (status) {
5584 case DELETE_SUCCEEDED: return "DELETE_SUCCEEDED";
5585 case DELETE_FAILED_INTERNAL_ERROR: return "DELETE_FAILED_INTERNAL_ERROR";
5586 case DELETE_FAILED_DEVICE_POLICY_MANAGER: return "DELETE_FAILED_DEVICE_POLICY_MANAGER";
5587 case DELETE_FAILED_USER_RESTRICTED: return "DELETE_FAILED_USER_RESTRICTED";
5588 case DELETE_FAILED_OWNER_BLOCKED: return "DELETE_FAILED_OWNER_BLOCKED";
Jeff Sharkeyf0600952014-08-07 17:31:53 -07005589 case DELETE_FAILED_ABORTED: return "DELETE_FAILED_ABORTED";
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005590 default: return Integer.toString(status);
5591 }
5592 }
Jeff Sharkeyf0600952014-08-07 17:31:53 -07005593
5594 /** {@hide} */
Jeff Sharkeya0907432014-08-15 10:23:11 -07005595 public static int deleteStatusToPublicStatus(int status) {
Jeff Sharkeyf0600952014-08-07 17:31:53 -07005596 switch (status) {
Jeff Sharkeya0907432014-08-15 10:23:11 -07005597 case DELETE_SUCCEEDED: return PackageInstaller.STATUS_SUCCESS;
5598 case DELETE_FAILED_INTERNAL_ERROR: return PackageInstaller.STATUS_FAILURE;
5599 case DELETE_FAILED_DEVICE_POLICY_MANAGER: return PackageInstaller.STATUS_FAILURE_BLOCKED;
5600 case DELETE_FAILED_USER_RESTRICTED: return PackageInstaller.STATUS_FAILURE_BLOCKED;
5601 case DELETE_FAILED_OWNER_BLOCKED: return PackageInstaller.STATUS_FAILURE_BLOCKED;
5602 case DELETE_FAILED_ABORTED: return PackageInstaller.STATUS_FAILURE_ABORTED;
5603 default: return PackageInstaller.STATUS_FAILURE;
Jeff Sharkeyf0600952014-08-07 17:31:53 -07005604 }
5605 }
Jeff Sharkey6c0b9da2014-08-07 22:07:11 -07005606
5607 /** {@hide} */
Svet Ganov77ab6a82015-07-03 12:03:02 -07005608 public static String permissionFlagToString(int flag) {
5609 switch (flag) {
Svetoslav4a5f4a22015-07-07 18:18:15 -07005610 case FLAG_PERMISSION_GRANTED_BY_DEFAULT: return "GRANTED_BY_DEFAULT";
5611 case FLAG_PERMISSION_POLICY_FIXED: return "POLICY_FIXED";
5612 case FLAG_PERMISSION_SYSTEM_FIXED: return "SYSTEM_FIXED";
5613 case FLAG_PERMISSION_USER_SET: return "USER_SET";
5614 case FLAG_PERMISSION_REVOKE_ON_UPGRADE: return "REVOKE_ON_UPGRADE";
5615 case FLAG_PERMISSION_USER_FIXED: return "USER_FIXED";
Svet Ganov9c165d72015-12-01 19:52:26 -08005616 case FLAG_PERMISSION_REVIEW_REQUIRED: return "REVIEW_REQUIRED";
Svet Ganov77ab6a82015-07-03 12:03:02 -07005617 default: return Integer.toString(flag);
5618 }
5619 }
5620
5621 /** {@hide} */
Jeff Sharkey6c0b9da2014-08-07 22:07:11 -07005622 public static class LegacyPackageInstallObserver extends PackageInstallObserver {
5623 private final IPackageInstallObserver mLegacy;
5624
5625 public LegacyPackageInstallObserver(IPackageInstallObserver legacy) {
5626 mLegacy = legacy;
5627 }
5628
5629 @Override
5630 public void onPackageInstalled(String basePackageName, int returnCode, String msg,
5631 Bundle extras) {
5632 if (mLegacy == null) return;
5633 try {
5634 mLegacy.packageInstalled(basePackageName, returnCode);
5635 } catch (RemoteException ignored) {
5636 }
5637 }
5638 }
5639
5640 /** {@hide} */
5641 public static class LegacyPackageDeleteObserver extends PackageDeleteObserver {
5642 private final IPackageDeleteObserver mLegacy;
5643
5644 public LegacyPackageDeleteObserver(IPackageDeleteObserver legacy) {
5645 mLegacy = legacy;
5646 }
5647
5648 @Override
5649 public void onPackageDeleted(String basePackageName, int returnCode, String msg) {
5650 if (mLegacy == null) return;
5651 try {
5652 mLegacy.packageDeleted(basePackageName, returnCode);
5653 } catch (RemoteException ignored) {
5654 }
5655 }
5656 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005657}