blob: e89cbd7091ae64f427c46f3b8264b7af7b56e8bc [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.content.pm;
18
Svetoslavf7c06eb2015-06-10 18:43:22 -070019import android.Manifest;
Tor Norbye1c2bf032015-03-02 10:57:08 -080020import android.annotation.CheckResult;
Tor Norbye7b9c9122013-05-30 16:48:33 -070021import android.annotation.DrawableRes;
Tor Norbyed9273d62013-05-30 15:59:53 -070022import android.annotation.IntDef;
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -070023import android.annotation.NonNull;
Jeff Sharkeye2d45be2015-04-15 17:14:12 -070024import android.annotation.Nullable;
Svetoslavf7c06eb2015-06-10 18:43:22 -070025import android.annotation.RequiresPermission;
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -080026import android.annotation.SdkConstant;
27import android.annotation.SdkConstant.SdkConstantType;
Tor Norbye7b9c9122013-05-30 16:48:33 -070028import android.annotation.StringRes;
Jeff Sharkeybb580672014-07-10 12:10:25 -070029import android.annotation.SystemApi;
Jeff Sharkeya73b8fd2016-01-06 17:02:08 -070030import android.annotation.TestApi;
Jeff Sharkeybd940222016-01-08 11:07:13 -070031import android.annotation.UserIdInt;
Tor Norbye7b9c9122013-05-30 16:48:33 -070032import android.annotation.XmlRes;
Jeff Sharkey6c0b9da2014-08-07 22:07:11 -070033import android.app.PackageDeleteObserver;
Christopher Tatef1977b42014-03-24 16:25:51 -070034import android.app.PackageInstallObserver;
Amith Yamasani1d653272014-09-11 17:56:05 -070035import android.app.admin.DevicePolicyManager;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080036import android.content.ComponentName;
37import android.content.Context;
38import android.content.Intent;
39import android.content.IntentFilter;
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -070040import android.content.IntentSender;
Jeff Sharkeyc4858a22014-06-16 10:51:20 -070041import android.content.pm.PackageParser.PackageParserException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080042import android.content.res.Resources;
43import android.content.res.XmlResourceParser;
Svetoslavc7d62f02014-09-04 15:39:54 -070044import android.graphics.Rect;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080045import android.graphics.drawable.Drawable;
46import android.net.Uri;
Jeff Sharkeybb580672014-07-10 12:10:25 -070047import android.os.Bundle;
Jeff Sharkey620b32b2015-04-23 19:36:02 -070048import android.os.Handler;
Jeff Sharkey6c0b9da2014-08-07 22:07:11 -070049import android.os.RemoteException;
Dianne Hackborn0c380492012-08-20 17:23:30 -070050import android.os.UserHandle;
Jeff Sharkey8a372a02016-03-16 16:25:45 -060051import android.os.UserManager;
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -070052import android.os.storage.VolumeInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080053import android.util.AndroidException;
Jeff Sharkeybd940222016-01-08 11:07:13 -070054import android.util.Log;
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -070055
Svetoslavc6d1c342015-02-26 14:44:43 -080056import com.android.internal.util.ArrayUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080057
58import java.io.File;
Tor Norbyed9273d62013-05-30 15:59:53 -070059import java.lang.annotation.Retention;
60import java.lang.annotation.RetentionPolicy;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080061import java.util.List;
62
63/**
64 * Class for retrieving various kinds of information related to the application
65 * packages that are currently installed on the device.
66 *
67 * You can find this class through {@link Context#getPackageManager}.
68 */
69public abstract class PackageManager {
Jeff Sharkeybd940222016-01-08 11:07:13 -070070 private static final String TAG = "PackageManager";
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080071
Jeff Sharkeye4697132016-02-06 19:46:15 -070072 /** {@hide} */
Jeff Sharkey8a372a02016-03-16 16:25:45 -060073 public static final boolean APPLY_DEFAULT_TO_DEVICE_PROTECTED_STORAGE = true;
Jeff Sharkeye4697132016-02-06 19:46:15 -070074
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080075 /**
76 * This exception is thrown when a given package, application, or component
kmccormick30498b42013-03-27 17:39:17 -070077 * name cannot be found.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080078 */
79 public static class NameNotFoundException extends AndroidException {
80 public NameNotFoundException() {
81 }
82
83 public NameNotFoundException(String name) {
84 super(name);
85 }
86 }
87
88 /**
Svetoslavf7c06eb2015-06-10 18:43:22 -070089 * Listener for changes in permissions granted to a UID.
90 *
91 * @hide
92 */
93 @SystemApi
94 public interface OnPermissionsChangedListener {
95
96 /**
97 * Called when the permissions for a UID change.
98 * @param uid The UID with a change.
99 */
100 public void onPermissionsChanged(int uid);
101 }
102
103 /**
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700104 * As a guiding principle:
105 * <p>
106 * {@code GET_} flags are used to request additional data that may have been
107 * elided to save wire space.
108 * <p>
109 * {@code MATCH_} flags are used to include components or packages that
110 * would have otherwise been omitted from a result set by current system
111 * state.
112 */
113
114 /** @hide */
115 @IntDef(flag = true, value = {
116 GET_ACTIVITIES,
Todd Kennedy6b9bfa12016-01-08 13:44:51 -0800117 GET_CONFIGURATIONS,
118 GET_GIDS,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700119 GET_INSTRUMENTATION,
120 GET_INTENT_FILTERS,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700121 GET_META_DATA,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700122 GET_PERMISSIONS,
Todd Kennedy6b9bfa12016-01-08 13:44:51 -0800123 GET_PROVIDERS,
124 GET_RECEIVERS,
125 GET_SERVICES,
126 GET_SHARED_LIBRARY_FILES,
127 GET_SIGNATURES,
128 GET_URI_PERMISSION_PATTERNS,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700129 MATCH_UNINSTALLED_PACKAGES,
130 MATCH_DISABLED_COMPONENTS,
131 MATCH_DISABLED_UNTIL_USED_COMPONENTS,
Jeff Sharkeyc5967e92016-01-07 18:50:29 -0700132 MATCH_SYSTEM_ONLY,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700133 MATCH_DEBUG_TRIAGED_MISSING,
134 })
135 @Retention(RetentionPolicy.SOURCE)
136 public @interface PackageInfoFlags {}
137
138 /** @hide */
139 @IntDef(flag = true, value = {
140 GET_META_DATA,
141 GET_SHARED_LIBRARY_FILES,
142 MATCH_UNINSTALLED_PACKAGES,
143 MATCH_SYSTEM_ONLY,
144 MATCH_DEBUG_TRIAGED_MISSING,
145 })
146 @Retention(RetentionPolicy.SOURCE)
147 public @interface ApplicationInfoFlags {}
148
149 /** @hide */
150 @IntDef(flag = true, value = {
151 GET_META_DATA,
152 GET_SHARED_LIBRARY_FILES,
Todd Kennedy6b9bfa12016-01-08 13:44:51 -0800153 MATCH_ALL,
154 MATCH_DEBUG_TRIAGED_MISSING,
155 MATCH_DEFAULT_ONLY,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700156 MATCH_DISABLED_COMPONENTS,
157 MATCH_DISABLED_UNTIL_USED_COMPONENTS,
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600158 MATCH_DIRECT_BOOT_AWARE,
159 MATCH_DIRECT_BOOT_UNAWARE,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700160 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,
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600176 MATCH_DIRECT_BOOT_AWARE,
177 MATCH_DIRECT_BOOT_UNAWARE,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700178 MATCH_SYSTEM_ONLY,
Todd Kennedy6b9bfa12016-01-08 13:44:51 -0800179 MATCH_UNINSTALLED_PACKAGES,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700180 })
181 @Retention(RetentionPolicy.SOURCE)
182 public @interface ResolveInfoFlags {}
183
184 /** @hide */
185 @IntDef(flag = true, value = {
186 GET_META_DATA,
187 })
188 @Retention(RetentionPolicy.SOURCE)
189 public @interface PermissionInfoFlags {}
190
191 /** @hide */
192 @IntDef(flag = true, value = {
193 GET_META_DATA,
194 })
195 @Retention(RetentionPolicy.SOURCE)
196 public @interface PermissionGroupInfoFlags {}
197
198 /** @hide */
199 @IntDef(flag = true, value = {
200 GET_META_DATA,
201 })
202 @Retention(RetentionPolicy.SOURCE)
203 public @interface InstrumentationInfoFlags {}
204
205 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800206 * {@link PackageInfo} flag: return information about
207 * activities in the package in {@link PackageInfo#activities}.
208 */
209 public static final int GET_ACTIVITIES = 0x00000001;
210
211 /**
212 * {@link PackageInfo} flag: return information about
213 * intent receivers in the package in
214 * {@link PackageInfo#receivers}.
215 */
216 public static final int GET_RECEIVERS = 0x00000002;
217
218 /**
219 * {@link PackageInfo} flag: return information about
220 * services in the package in {@link PackageInfo#services}.
221 */
222 public static final int GET_SERVICES = 0x00000004;
223
224 /**
225 * {@link PackageInfo} flag: return information about
226 * content providers in the package in
227 * {@link PackageInfo#providers}.
228 */
229 public static final int GET_PROVIDERS = 0x00000008;
230
231 /**
232 * {@link PackageInfo} flag: return information about
233 * instrumentation in the package in
234 * {@link PackageInfo#instrumentation}.
235 */
236 public static final int GET_INSTRUMENTATION = 0x00000010;
237
238 /**
239 * {@link PackageInfo} flag: return information about the
240 * intent filters supported by the activity.
241 */
242 public static final int GET_INTENT_FILTERS = 0x00000020;
243
244 /**
245 * {@link PackageInfo} flag: return information about the
246 * signatures included in the package.
247 */
248 public static final int GET_SIGNATURES = 0x00000040;
249
250 /**
251 * {@link ResolveInfo} flag: return the IntentFilter that
252 * was matched for a particular ResolveInfo in
253 * {@link ResolveInfo#filter}.
254 */
255 public static final int GET_RESOLVED_FILTER = 0x00000040;
256
257 /**
258 * {@link ComponentInfo} flag: return the {@link ComponentInfo#metaData}
259 * data {@link android.os.Bundle}s that are associated with a component.
260 * This applies for any API returning a ComponentInfo subclass.
261 */
262 public static final int GET_META_DATA = 0x00000080;
263
264 /**
265 * {@link PackageInfo} flag: return the
266 * {@link PackageInfo#gids group ids} that are associated with an
267 * application.
Ken Wakasaf76a50c2012-03-09 19:56:35 +0900268 * This applies for any API returning a PackageInfo class, either
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800269 * directly or nested inside of another.
270 */
271 public static final int GET_GIDS = 0x00000100;
272
273 /**
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700274 * @deprecated replaced with {@link #MATCH_DISABLED_COMPONENTS}
275 */
276 @Deprecated
277 public static final int GET_DISABLED_COMPONENTS = 0x00000200;
278
279 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800280 * {@link PackageInfo} flag: include disabled components in the returned info.
281 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700282 public static final int MATCH_DISABLED_COMPONENTS = 0x00000200;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800283
284 /**
285 * {@link ApplicationInfo} flag: return the
286 * {@link ApplicationInfo#sharedLibraryFiles paths to the shared libraries}
287 * that are associated with an application.
288 * This applies for any API returning an ApplicationInfo class, either
289 * directly or nested inside of another.
290 */
291 public static final int GET_SHARED_LIBRARY_FILES = 0x00000400;
292
293 /**
294 * {@link ProviderInfo} flag: return the
295 * {@link ProviderInfo#uriPermissionPatterns URI permission patterns}
296 * that are associated with a content provider.
Ken Wakasaf76a50c2012-03-09 19:56:35 +0900297 * This applies for any API returning a ProviderInfo class, either
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800298 * directly or nested inside of another.
299 */
300 public static final int GET_URI_PERMISSION_PATTERNS = 0x00000800;
301 /**
302 * {@link PackageInfo} flag: return information about
303 * permissions in the package in
304 * {@link PackageInfo#permissions}.
305 */
306 public static final int GET_PERMISSIONS = 0x00001000;
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700307
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800308 /**
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700309 * @deprecated replaced with {@link #MATCH_UNINSTALLED_PACKAGES}
310 */
311 @Deprecated
312 public static final int GET_UNINSTALLED_PACKAGES = 0x00002000;
313
314 /**
Kenny Root685f4902011-11-03 10:13:29 -0700315 * Flag parameter to retrieve some information about all applications (even
316 * uninstalled ones) which have data directories. This state could have
317 * resulted if applications have been deleted with flag
318 * {@code DONT_DELETE_DATA} with a possibility of being replaced or
319 * reinstalled in future.
320 * <p>
321 * Note: this flag may cause less information about currently installed
322 * applications to be returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800323 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700324 public static final int MATCH_UNINSTALLED_PACKAGES = 0x00002000;
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700325
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800326 /**
327 * {@link PackageInfo} flag: return information about
Dianne Hackborn49237342009-08-27 20:08:01 -0700328 * hardware preferences in
Adam Lesinskid3edfde2014-08-08 17:32:44 -0700329 * {@link PackageInfo#configPreferences PackageInfo.configPreferences},
330 * and requested features in {@link PackageInfo#reqFeatures} and
331 * {@link PackageInfo#featureGroups}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800332 */
333 public static final int GET_CONFIGURATIONS = 0x00004000;
334
335 /**
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700336 * @deprecated replaced with {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}.
337 */
338 @Deprecated
339 public static final int GET_DISABLED_UNTIL_USED_COMPONENTS = 0x00008000;
340
341 /**
Dianne Hackbornfd7aded2013-01-22 17:10:23 -0800342 * {@link PackageInfo} flag: include disabled components which are in
343 * that state only because of {@link #COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED}
344 * in the returned info. Note that if you set this flag, applications
345 * that are in this disabled state will be reported as enabled.
346 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700347 public static final int MATCH_DISABLED_UNTIL_USED_COMPONENTS = 0x00008000;
Dianne Hackbornfd7aded2013-01-22 17:10:23 -0800348
349 /**
Dianne Hackborn1655be42009-05-08 14:29:01 -0700350 * Resolution and querying flag: if set, only filters that support the
351 * {@link android.content.Intent#CATEGORY_DEFAULT} will be considered for
352 * matching. This is a synonym for including the CATEGORY_DEFAULT in your
353 * supplied Intent.
354 */
Fabrice Di Meglio9f7e39f2015-04-10 20:40:16 -0700355 public static final int MATCH_DEFAULT_ONLY = 0x00010000;
356
357 /**
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700358 * Querying flag: if set and if the platform is doing any filtering of the
359 * results, then the filtering will not happen. This is a synonym for saying
360 * that all results should be returned.
361 * <p>
362 * <em>This flag should be used with extreme care.</em>
Fabrice Di Meglio9f7e39f2015-04-10 20:40:16 -0700363 */
364 public static final int MATCH_ALL = 0x00020000;
Dianne Hackborn1655be42009-05-08 14:29:01 -0700365
Nicolas Prevot63798c52014-05-27 13:22:38 +0100366 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600367 * Querying flag: match components which are direct boot <em>unaware</em> in
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700368 * the returned info, regardless of the current user state.
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600369 * <p>
370 * When neither {@link #MATCH_DIRECT_BOOT_AWARE} nor
371 * {@link #MATCH_DIRECT_BOOT_UNAWARE} are specified, the default behavior is
372 * to match only runnable components based on the user state. For example,
373 * when a user is started but credentials have not been presented yet, the
374 * user is running "locked" and only {@link #MATCH_DIRECT_BOOT_AWARE}
375 * components are returned. Once the user credentials have been presented,
376 * the user is running "unlocked" and both {@link #MATCH_DIRECT_BOOT_AWARE}
377 * and {@link #MATCH_DIRECT_BOOT_UNAWARE} components are returned.
378 *
379 * @see UserManager#isUserUnlocked()
Jeff Sharkeye17ac152015-11-06 22:40:29 -0800380 */
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600381 public static final int MATCH_DIRECT_BOOT_UNAWARE = 0x00040000;
382
383 /**
384 * Querying flag: match components which are direct boot <em>aware</em> in
385 * the returned info, regardless of the current user state.
386 * <p>
387 * When neither {@link #MATCH_DIRECT_BOOT_AWARE} nor
388 * {@link #MATCH_DIRECT_BOOT_UNAWARE} are specified, the default behavior is
389 * to match only runnable components based on the user state. For example,
390 * when a user is started but credentials have not been presented yet, the
391 * user is running "locked" and only {@link #MATCH_DIRECT_BOOT_AWARE}
392 * components are returned. Once the user credentials have been presented,
393 * the user is running "unlocked" and both {@link #MATCH_DIRECT_BOOT_AWARE}
394 * and {@link #MATCH_DIRECT_BOOT_UNAWARE} components are returned.
395 *
396 * @see UserManager#isUserUnlocked()
397 */
398 public static final int MATCH_DIRECT_BOOT_AWARE = 0x00080000;
399
400 /** @removed */
401 @Deprecated
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700402 public static final int MATCH_ENCRYPTION_UNAWARE = 0x00040000;
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600403 /** @removed */
404 @Deprecated
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700405 public static final int MATCH_ENCRYPTION_AWARE = 0x00080000;
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600406 /** @removed */
407 @Deprecated
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700408 public static final int MATCH_ENCRYPTION_AWARE_AND_UNAWARE = MATCH_ENCRYPTION_AWARE
409 | MATCH_ENCRYPTION_UNAWARE;
Jeff Sharkey2a9e3f82015-12-18 10:57:58 -0700410
411 /**
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700412 * Querying flag: include only components from applications that are marked
413 * with {@link ApplicationInfo#FLAG_SYSTEM}.
Jeff Sharkey5217cac2015-12-20 15:34:01 -0700414 */
415 public static final int MATCH_SYSTEM_ONLY = 0x00100000;
416
417 /**
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700418 * Internal flag used to indicate that a system component has done their
419 * homework and verified that they correctly handle packages and components
420 * that come and go over time. In particular:
421 * <ul>
422 * <li>Apps installed on external storage, which will appear to be
423 * uninstalled while the the device is ejected.
424 * <li>Apps with encryption unaware components, which will appear to not
425 * exist while the device is locked.
426 * </ul>
Jeff Sharkeye17ac152015-11-06 22:40:29 -0800427 *
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700428 * @see #MATCH_UNINSTALLED_PACKAGES
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600429 * @see #MATCH_DIRECT_BOOT_AWARE
430 * @see #MATCH_DIRECT_BOOT_UNAWARE
Jeff Sharkeye17ac152015-11-06 22:40:29 -0800431 * @hide
432 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700433 public static final int MATCH_DEBUG_TRIAGED_MISSING = 0x10000000;
Jeff Sharkeye17ac152015-11-06 22:40:29 -0800434
435 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700436 * Flag for {@link #addCrossProfileIntentFilter}: if this flag is set: when
437 * resolving an intent that matches the {@code CrossProfileIntentFilter},
438 * the current profile will be skipped. Only activities in the target user
439 * can respond to the intent.
440 *
Nicolas Prevot63798c52014-05-27 13:22:38 +0100441 * @hide
442 */
443 public static final int SKIP_CURRENT_PROFILE = 0x00000002;
444
Tony Mak807e01c2015-12-01 20:19:03 +0000445 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700446 * Flag for {@link #addCrossProfileIntentFilter}: if this flag is set:
Tony Mak807e01c2015-12-01 20:19:03 +0000447 * activities in the other profiles can respond to the intent only if no activity with
448 * non-negative priority in current profile can respond to the intent.
449 * @hide
450 */
451 public static final int ONLY_IF_NO_MATCH_FOUND = 0x00000004;
452
Tor Norbyed9273d62013-05-30 15:59:53 -0700453 /** @hide */
454 @IntDef({PERMISSION_GRANTED, PERMISSION_DENIED})
455 @Retention(RetentionPolicy.SOURCE)
456 public @interface PermissionResult {}
457
Dianne Hackborn1655be42009-05-08 14:29:01 -0700458 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800459 * Permission check result: this is returned by {@link #checkPermission}
460 * if the permission has been granted to the given package.
461 */
462 public static final int PERMISSION_GRANTED = 0;
463
464 /**
465 * Permission check result: this is returned by {@link #checkPermission}
466 * if the permission has not been granted to the given package.
467 */
468 public static final int PERMISSION_DENIED = -1;
469
470 /**
471 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700472 * if all signatures on the two packages match.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800473 */
474 public static final int SIGNATURE_MATCH = 0;
475
476 /**
477 * Signature check result: this is returned by {@link #checkSignatures}
478 * if neither of the two packages is signed.
479 */
480 public static final int SIGNATURE_NEITHER_SIGNED = 1;
481
482 /**
483 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700484 * if the first package is not signed but the second is.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800485 */
486 public static final int SIGNATURE_FIRST_NOT_SIGNED = -1;
487
488 /**
489 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700490 * if the second package is not signed but the first is.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800491 */
492 public static final int SIGNATURE_SECOND_NOT_SIGNED = -2;
493
494 /**
495 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700496 * if not all signatures on both packages match.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800497 */
498 public static final int SIGNATURE_NO_MATCH = -3;
499
500 /**
501 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700502 * if either of the packages are not valid.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800503 */
504 public static final int SIGNATURE_UNKNOWN_PACKAGE = -4;
505
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700506 /**
507 * Flag for {@link #setApplicationEnabledSetting(String, int, int)}
508 * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This
509 * component or application is in its default enabled state (as specified
510 * in its manifest).
511 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800512 public static final int COMPONENT_ENABLED_STATE_DEFAULT = 0;
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700513
514 /**
515 * Flag for {@link #setApplicationEnabledSetting(String, int, int)}
516 * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This
517 * component or application has been explictily enabled, regardless of
518 * what it has specified in its manifest.
519 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800520 public static final int COMPONENT_ENABLED_STATE_ENABLED = 1;
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700521
522 /**
523 * Flag for {@link #setApplicationEnabledSetting(String, int, int)}
524 * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This
525 * component or application has been explicitly disabled, regardless of
526 * what it has specified in its manifest.
527 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800528 public static final int COMPONENT_ENABLED_STATE_DISABLED = 2;
529
530 /**
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700531 * Flag for {@link #setApplicationEnabledSetting(String, int, int)} only: The
532 * user has explicitly disabled the application, regardless of what it has
533 * specified in its manifest. Because this is due to the user's request,
534 * they may re-enable it if desired through the appropriate system UI. This
kmccormick30498b42013-03-27 17:39:17 -0700535 * option currently <strong>cannot</strong> be used with
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700536 * {@link #setComponentEnabledSetting(ComponentName, int, int)}.
537 */
538 public static final int COMPONENT_ENABLED_STATE_DISABLED_USER = 3;
539
540 /**
Dianne Hackbornfd7aded2013-01-22 17:10:23 -0800541 * Flag for {@link #setApplicationEnabledSetting(String, int, int)} only: This
542 * application should be considered, until the point where the user actually
543 * wants to use it. This means that it will not normally show up to the user
544 * (such as in the launcher), but various parts of the user interface can
545 * use {@link #GET_DISABLED_UNTIL_USED_COMPONENTS} to still see it and allow
546 * the user to select it (as for example an IME, device admin, etc). Such code,
547 * once the user has selected the app, should at that point also make it enabled.
548 * This option currently <strong>can not</strong> be used with
549 * {@link #setComponentEnabledSetting(ComponentName, int, int)}.
550 */
551 public static final int COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED = 4;
552
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700553 /** @hide */
554 @IntDef(flag = true, value = {
555 INSTALL_FORWARD_LOCK,
556 INSTALL_REPLACE_EXISTING,
557 INSTALL_ALLOW_TEST,
558 INSTALL_EXTERNAL,
559 INSTALL_INTERNAL,
560 INSTALL_FROM_ADB,
561 INSTALL_ALL_USERS,
562 INSTALL_ALLOW_DOWNGRADE,
563 INSTALL_GRANT_RUNTIME_PERMISSIONS,
564 INSTALL_FORCE_VOLUME_UUID,
565 INSTALL_FORCE_PERMISSION_PROMPT,
566 INSTALL_EPHEMERAL,
Todd Kennedy39bfee52016-02-24 10:28:21 -0800567 INSTALL_DONT_KILL_APP,
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700568 })
569 @Retention(RetentionPolicy.SOURCE)
570 public @interface InstallFlags {}
571
Dianne Hackbornfd7aded2013-01-22 17:10:23 -0800572 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700573 * Flag parameter for {@link #installPackage} to indicate that this package
574 * should be installed as forward locked, i.e. only the app itself should
575 * have access to its code and non-resource assets.
576 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700577 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800578 */
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700579 public static final int INSTALL_FORWARD_LOCK = 0x00000001;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800580
581 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700582 * Flag parameter for {@link #installPackage} to indicate that you want to
583 * replace an already installed package, if one exists.
584 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700585 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800586 */
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700587 public static final int INSTALL_REPLACE_EXISTING = 0x00000002;
588
589 /**
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700590 * Flag parameter for {@link #installPackage} to indicate that you want to
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700591 * allow test packages (those that have set android:testOnly in their
592 * manifest) to be installed.
593 * @hide
594 */
595 public static final int INSTALL_ALLOW_TEST = 0x00000004;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800596
597 /**
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -0700598 * Flag parameter for {@link #installPackage} to indicate that this package
599 * must be installed to an ASEC on a {@link VolumeInfo#TYPE_PUBLIC}.
600 *
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800601 * @hide
602 */
Suchi Amalapurapu5b993ce2010-02-12 09:43:29 -0800603 public static final int INSTALL_EXTERNAL = 0x00000008;
Oscar Montemayor539d3c42010-01-29 15:27:00 -0800604
605 /**
Kenny Root5ab21572011-07-27 11:11:19 -0700606 * Flag parameter for {@link #installPackage} to indicate that this package
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -0700607 * must be installed to internal storage.
608 *
Kenny Root5ab21572011-07-27 11:11:19 -0700609 * @hide
610 */
611 public static final int INSTALL_INTERNAL = 0x00000010;
612
613 /**
614 * Flag parameter for {@link #installPackage} to indicate that this install
615 * was initiated via ADB.
616 *
617 * @hide
618 */
619 public static final int INSTALL_FROM_ADB = 0x00000020;
Suchi Amalapurapu14b6abd2010-03-17 08:37:04 -0700620
621 /**
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700622 * Flag parameter for {@link #installPackage} to indicate that this install
623 * should immediately be visible to all users.
624 *
625 * @hide
626 */
627 public static final int INSTALL_ALL_USERS = 0x00000040;
628
629 /**
630 * Flag parameter for {@link #installPackage} to indicate that it is okay
631 * to install an update to an app where the newly installed app has a lower
Alex Klyubin921dd752016-02-24 13:21:41 -0800632 * version code than the currently installed app. This is permitted only if
633 * the currently installed app is marked debuggable.
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700634 *
635 * @hide
636 */
637 public static final int INSTALL_ALLOW_DOWNGRADE = 0x00000080;
638
639 /**
Svet Ganov95c1ade2015-03-19 09:38:52 -0700640 * Flag parameter for {@link #installPackage} to indicate that all runtime
641 * permissions should be granted to the package. If {@link #INSTALL_ALL_USERS}
642 * is set the runtime permissions will be granted to all users, otherwise
643 * only to the owner.
644 *
645 * @hide
646 */
647 public static final int INSTALL_GRANT_RUNTIME_PERMISSIONS = 0x00000100;
648
Jeff Sharkeyab234092015-06-09 21:42:22 -0700649 /** {@hide} */
650 public static final int INSTALL_FORCE_VOLUME_UUID = 0x00000200;
651
Svet Ganov95c1ade2015-03-19 09:38:52 -0700652 /**
Todd Kennedya1d12cf2015-09-29 15:43:00 -0700653 * Flag parameter for {@link #installPackage} to indicate that we always want to force
654 * the prompt for permission approval. This overrides any special behaviour for internal
655 * components.
656 *
657 * @hide
658 */
659 public static final int INSTALL_FORCE_PERMISSION_PROMPT = 0x00000400;
660
661 /**
Todd Kennedy27c24fb2015-09-17 16:49:25 -0700662 * Flag parameter for {@link #installPackage} to indicate that this package is
Todd Kennedy2699f062015-11-20 13:07:17 -0800663 * to be installed as a lightweight "ephemeral" app.
664 *
665 * @hide
666 */
Todd Kennedy373f0b42015-12-16 14:45:14 -0800667 public static final int INSTALL_EPHEMERAL = 0x00000800;
Todd Kennedy2699f062015-11-20 13:07:17 -0800668
669 /**
Todd Kennedy39bfee52016-02-24 10:28:21 -0800670 * Flag parameter for {@link #installPackage} to indicate that this package contains
671 * a feature split to an existing application and the existing application should not
672 * be killed during the installation process.
673 *
674 * @hide
675 */
676 public static final int INSTALL_DONT_KILL_APP = 0x00001000;
677
678 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800679 * Flag parameter for
680 * {@link #setComponentEnabledSetting(android.content.ComponentName, int, int)} to indicate
681 * that you don't want to kill the app containing the component. Be careful when you set this
682 * since changing component states can make the containing application's behavior unpredictable.
683 */
684 public static final int DONT_KILL_APP = 0x00000001;
685
686 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700687 * Installation return code: this is passed to the
688 * {@link IPackageInstallObserver} on success.
689 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700690 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800691 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700692 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800693 public static final int INSTALL_SUCCEEDED = 1;
694
695 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700696 * Installation return code: this is passed to the
697 * {@link IPackageInstallObserver} if the package is already installed.
698 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700699 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800700 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700701 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800702 public static final int INSTALL_FAILED_ALREADY_EXISTS = -1;
703
704 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700705 * Installation return code: this is passed to the
706 * {@link IPackageInstallObserver} if the package archive file is invalid.
707 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700708 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800709 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700710 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800711 public static final int INSTALL_FAILED_INVALID_APK = -2;
712
713 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700714 * Installation return code: this is passed to the
715 * {@link IPackageInstallObserver} if the URI passed in is invalid.
716 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700717 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800718 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700719 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800720 public static final int INSTALL_FAILED_INVALID_URI = -3;
721
722 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700723 * Installation return code: this is passed to the
724 * {@link IPackageInstallObserver} if the package manager service found that
725 * the device didn't have enough storage space to install the app.
726 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700727 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800728 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700729 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800730 public static final int INSTALL_FAILED_INSUFFICIENT_STORAGE = -4;
731
732 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700733 * Installation return code: this is passed to the
734 * {@link IPackageInstallObserver} if a package is already installed with
735 * the same name.
736 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700737 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800738 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700739 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800740 public static final int INSTALL_FAILED_DUPLICATE_PACKAGE = -5;
741
742 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700743 * Installation return code: this is passed to the
744 * {@link IPackageInstallObserver} if the requested shared user does not
745 * exist.
746 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700747 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800748 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700749 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800750 public static final int INSTALL_FAILED_NO_SHARED_USER = -6;
751
752 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700753 * Installation return code: this is passed to the
754 * {@link IPackageInstallObserver} if a previously installed package of the
755 * same name has a different signature than the new package (and the old
756 * package's data was not removed).
757 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700758 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800759 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700760 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800761 public static final int INSTALL_FAILED_UPDATE_INCOMPATIBLE = -7;
762
763 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700764 * Installation return code: this is passed to the
765 * {@link IPackageInstallObserver} if the new package is requested a shared
766 * user which is already installed on the device and does not have matching
767 * signature.
768 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700769 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800770 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700771 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800772 public static final int INSTALL_FAILED_SHARED_USER_INCOMPATIBLE = -8;
773
774 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700775 * Installation return code: this is passed to the
776 * {@link IPackageInstallObserver} if the new package uses a shared library
777 * that is not available.
778 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700779 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800780 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700781 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800782 public static final int INSTALL_FAILED_MISSING_SHARED_LIBRARY = -9;
783
784 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700785 * Installation return code: this is passed to the
786 * {@link IPackageInstallObserver} if the new package uses a shared library
787 * that is not available.
788 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700789 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800790 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700791 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800792 public static final int INSTALL_FAILED_REPLACE_COULDNT_DELETE = -10;
793
794 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700795 * Installation return code: this is passed to the
796 * {@link IPackageInstallObserver} if the new package failed while
797 * optimizing and validating its dex files, either because there was not
798 * enough storage or the validation failed.
799 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700800 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800801 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700802 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800803 public static final int INSTALL_FAILED_DEXOPT = -11;
804
805 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700806 * Installation return code: this is passed to the
807 * {@link IPackageInstallObserver} if the new package failed because the
808 * current SDK version is older than that required by the package.
809 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700810 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800811 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700812 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800813 public static final int INSTALL_FAILED_OLDER_SDK = -12;
814
815 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700816 * Installation return code: this is passed to the
817 * {@link IPackageInstallObserver} if the new package failed because it
818 * contains a content provider with the same authority as a provider already
819 * installed in the system.
820 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700821 * @hide
The Android Open Source Project10592532009-03-18 17:39:46 -0700822 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700823 @SystemApi
The Android Open Source Project10592532009-03-18 17:39:46 -0700824 public static final int INSTALL_FAILED_CONFLICTING_PROVIDER = -13;
825
826 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700827 * Installation return code: this is passed to the
828 * {@link IPackageInstallObserver} if the new package failed because the
829 * current SDK version is newer than that required by the package.
830 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700831 * @hide
Dianne Hackborn851a5412009-05-08 12:06:44 -0700832 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700833 @SystemApi
Dianne Hackborn851a5412009-05-08 12:06:44 -0700834 public static final int INSTALL_FAILED_NEWER_SDK = -14;
835
836 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700837 * Installation return code: this is passed to the
838 * {@link IPackageInstallObserver} if the new package failed because it has
839 * specified that it is a test-only package and the caller has not supplied
840 * the {@link #INSTALL_ALLOW_TEST} flag.
841 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700842 * @hide
843 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700844 @SystemApi
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700845 public static final int INSTALL_FAILED_TEST_ONLY = -15;
846
847 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700848 * Installation return code: this is passed to the
849 * {@link IPackageInstallObserver} if the package being installed contains
850 * native code, but none that is compatible with the device's CPU_ABI.
851 *
Dianne Hackbornb1811182009-05-21 15:45:42 -0700852 * @hide
853 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700854 @SystemApi
Dianne Hackbornb1811182009-05-21 15:45:42 -0700855 public static final int INSTALL_FAILED_CPU_ABI_INCOMPATIBLE = -16;
856
857 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700858 * Installation return code: this is passed to the
859 * {@link IPackageInstallObserver} if the new package uses a feature that is
860 * not available.
861 *
Dianne Hackborn49237342009-08-27 20:08:01 -0700862 * @hide
863 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700864 @SystemApi
Dianne Hackborn49237342009-08-27 20:08:01 -0700865 public static final int INSTALL_FAILED_MISSING_FEATURE = -17;
866
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800867 // ------ Errors related to sdcard
868 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700869 * Installation return code: this is passed to the
870 * {@link IPackageInstallObserver} if a secure container mount point
871 * couldn't be accessed on external media.
872 *
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800873 * @hide
874 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700875 @SystemApi
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800876 public static final int INSTALL_FAILED_CONTAINER_ERROR = -18;
877
Dianne Hackborn49237342009-08-27 20:08:01 -0700878 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700879 * Installation return code: this is passed to the
880 * {@link IPackageInstallObserver} if the new package couldn't be installed
881 * in the specified install location.
882 *
Suchi Amalapurapub56ae202010-02-04 22:51:07 -0800883 * @hide
884 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700885 @SystemApi
Suchi Amalapurapub56ae202010-02-04 22:51:07 -0800886 public static final int INSTALL_FAILED_INVALID_INSTALL_LOCATION = -19;
887
888 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700889 * Installation return code: this is passed to the
890 * {@link IPackageInstallObserver} if the new package couldn't be installed
891 * in the specified install location because the media is not available.
892 *
Suchi Amalapurapu8a9ab242010-03-11 16:49:16 -0800893 * @hide
894 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700895 @SystemApi
Suchi Amalapurapu8a9ab242010-03-11 16:49:16 -0800896 public static final int INSTALL_FAILED_MEDIA_UNAVAILABLE = -20;
897
898 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700899 * Installation return code: this is passed to the
900 * {@link IPackageInstallObserver} if the new package couldn't be installed
901 * because the verification timed out.
902 *
Kenny Root5ab21572011-07-27 11:11:19 -0700903 * @hide
904 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700905 @SystemApi
Kenny Root5ab21572011-07-27 11:11:19 -0700906 public static final int INSTALL_FAILED_VERIFICATION_TIMEOUT = -21;
907
908 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700909 * Installation return code: this is passed to the
910 * {@link IPackageInstallObserver} if the new package couldn't be installed
911 * because the verification did not succeed.
912 *
Kenny Root5ab21572011-07-27 11:11:19 -0700913 * @hide
914 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700915 @SystemApi
Kenny Root5ab21572011-07-27 11:11:19 -0700916 public static final int INSTALL_FAILED_VERIFICATION_FAILURE = -22;
917
918 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700919 * Installation return code: this is passed to the
920 * {@link IPackageInstallObserver} if the package changed from what the
921 * calling program expected.
922 *
Kenny Root5ab21572011-07-27 11:11:19 -0700923 * @hide
924 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700925 @SystemApi
Kenny Root5ab21572011-07-27 11:11:19 -0700926 public static final int INSTALL_FAILED_PACKAGE_CHANGED = -23;
927
928 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700929 * Installation return code: this is passed to the
930 * {@link IPackageInstallObserver} if the new package is assigned a
931 * different UID than it previously held.
932 *
Dianne Hackbornd0c5f512012-06-07 16:53:59 -0700933 * @hide
934 */
935 public static final int INSTALL_FAILED_UID_CHANGED = -24;
936
937 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700938 * Installation return code: this is passed to the
939 * {@link IPackageInstallObserver} if the new package has an older version
940 * code than the currently installed package.
941 *
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700942 * @hide
943 */
944 public static final int INSTALL_FAILED_VERSION_DOWNGRADE = -25;
945
946 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700947 * Installation return code: this is passed to the
948 * {@link IPackageInstallObserver} if the old package has target SDK high
949 * enough to support runtime permission and the new package has target SDK
950 * low enough to not support runtime permissions.
951 *
Svetoslavd9653702015-05-13 18:02:46 -0700952 * @hide
953 */
954 @SystemApi
955 public static final int INSTALL_FAILED_PERMISSION_MODEL_DOWNGRADE = -26;
956
957 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700958 * Installation parse return code: this is passed to the
959 * {@link IPackageInstallObserver} if the parser was given a path that is
960 * not a file, or does not end with the expected '.apk' extension.
961 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700962 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800963 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700964 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800965 public static final int INSTALL_PARSE_FAILED_NOT_APK = -100;
966
967 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700968 * Installation parse return code: this is passed to the
969 * {@link IPackageInstallObserver} if the parser was unable to retrieve the
970 * AndroidManifest.xml file.
971 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700972 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800973 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700974 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800975 public static final int INSTALL_PARSE_FAILED_BAD_MANIFEST = -101;
976
977 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700978 * Installation parse return code: this is passed to the
979 * {@link IPackageInstallObserver} if the parser encountered an unexpected
980 * exception.
981 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700982 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800983 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700984 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800985 public static final int INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION = -102;
986
987 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700988 * Installation parse return code: this is passed to the
989 * {@link IPackageInstallObserver} if the parser did not find any
990 * certificates in the .apk.
991 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700992 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800993 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700994 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800995 public static final int INSTALL_PARSE_FAILED_NO_CERTIFICATES = -103;
996
997 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700998 * Installation parse return code: this is passed to the
999 * {@link IPackageInstallObserver} if the parser found inconsistent
1000 * certificates on the files in the .apk.
1001 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001002 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001003 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001004 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001005 public static final int INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES = -104;
1006
1007 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001008 * Installation parse return code: this is passed to the
1009 * {@link IPackageInstallObserver} if the parser encountered a
1010 * CertificateEncodingException in one of the files in the .apk.
1011 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001012 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001013 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001014 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001015 public static final int INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING = -105;
1016
1017 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001018 * Installation parse return code: this is passed to the
1019 * {@link IPackageInstallObserver} if the parser encountered a bad or
1020 * missing package name in the manifest.
1021 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001022 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001023 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001024 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001025 public static final int INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME = -106;
1026
1027 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001028 * Installation parse return code: this is passed to the
1029 * {@link IPackageInstallObserver} if the parser encountered a bad shared
1030 * user id name in the manifest.
1031 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001032 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001033 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001034 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001035 public static final int INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID = -107;
1036
1037 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001038 * Installation parse return code: this is passed to the
1039 * {@link IPackageInstallObserver} if the parser encountered some structural
1040 * problem in the manifest.
1041 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001042 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001043 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001044 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001045 public static final int INSTALL_PARSE_FAILED_MANIFEST_MALFORMED = -108;
1046
1047 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001048 * Installation parse return code: this is passed to the
1049 * {@link IPackageInstallObserver} if the parser did not find any actionable
1050 * tags (instrumentation or application) in the manifest.
1051 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001052 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001053 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001054 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001055 public static final int INSTALL_PARSE_FAILED_MANIFEST_EMPTY = -109;
1056
1057 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001058 * Installation failed return code: this is passed to the
1059 * {@link IPackageInstallObserver} if the system failed to install the
1060 * package because of system issues.
1061 *
Suchi Amalapurapu5b993ce2010-02-12 09:43:29 -08001062 * @hide
1063 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001064 @SystemApi
Suchi Amalapurapu5b993ce2010-02-12 09:43:29 -08001065 public static final int INSTALL_FAILED_INTERNAL_ERROR = -110;
1066
1067 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001068 * Installation failed return code: this is passed to the
1069 * {@link IPackageInstallObserver} if the system failed to install the
1070 * package because the user is restricted from installing apps.
1071 *
Amith Yamasanie4cf7342012-12-17 11:12:09 -08001072 * @hide
1073 */
1074 public static final int INSTALL_FAILED_USER_RESTRICTED = -111;
1075
1076 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001077 * Installation failed return code: this is passed to the
1078 * {@link IPackageInstallObserver} if the system failed to install the
1079 * package because it is attempting to define a permission that is already
1080 * defined by some existing package.
1081 * <p>
1082 * The package name of the app which has already defined the permission is
1083 * passed to a {@link PackageInstallObserver}, if any, as the
1084 * {@link #EXTRA_FAILURE_EXISTING_PACKAGE} string extra; and the name of the
1085 * permission being redefined is passed in the
1086 * {@link #EXTRA_FAILURE_EXISTING_PERMISSION} string extra.
Christopher Tatef1977b42014-03-24 16:25:51 -07001087 *
Christopher Tatef1977b42014-03-24 16:25:51 -07001088 * @hide
1089 */
1090 public static final int INSTALL_FAILED_DUPLICATE_PERMISSION = -112;
1091
1092 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001093 * Installation failed return code: this is passed to the
1094 * {@link IPackageInstallObserver} if the system failed to install the
1095 * package because its packaged native code did not match any of the ABIs
1096 * supported by the system.
Ramin Zaghi1378aba2014-02-28 15:03:19 +00001097 *
1098 * @hide
1099 */
Narayan Kamathd11f2232014-04-10 10:37:17 +01001100 public static final int INSTALL_FAILED_NO_MATCHING_ABIS = -113;
Ramin Zaghi1378aba2014-02-28 15:03:19 +00001101
1102 /**
1103 * Internal return code for NativeLibraryHelper methods to indicate that the package
1104 * being processed did not contain any native code. This is placed here only so that
1105 * it can belong to the same value space as the other install failure codes.
1106 *
1107 * @hide
1108 */
Narayan Kamathd11f2232014-04-10 10:37:17 +01001109 public static final int NO_NATIVE_LIBRARIES = -114;
Ramin Zaghi1378aba2014-02-28 15:03:19 +00001110
Jeff Sharkey7328a1b2014-08-07 14:01:43 -07001111 /** {@hide} */
Jeff Sharkeyf0600952014-08-07 17:31:53 -07001112 public static final int INSTALL_FAILED_ABORTED = -115;
Jeff Sharkey7328a1b2014-08-07 14:01:43 -07001113
Ramin Zaghi1378aba2014-02-28 15:03:19 +00001114 /**
Todd Kennedy2699f062015-11-20 13:07:17 -08001115 * Installation failed return code: ephemeral app installs are incompatible with some
1116 * other installation flags supplied for the operation; or other circumstances such
1117 * as trying to upgrade a system app via an ephemeral install.
1118 * @hide
1119 */
1120 public static final int INSTALL_FAILED_EPHEMERAL_INVALID = -116;
1121
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001122 /** @hide */
1123 @IntDef(flag = true, value = {
1124 DELETE_KEEP_DATA,
1125 DELETE_ALL_USERS,
1126 DELETE_SYSTEM_APP,
Todd Kennedy39bfee52016-02-24 10:28:21 -08001127 DELETE_DONT_KILL_APP,
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001128 })
1129 @Retention(RetentionPolicy.SOURCE)
1130 public @interface DeleteFlags {}
1131
Todd Kennedy2699f062015-11-20 13:07:17 -08001132 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001133 * Flag parameter for {@link #deletePackage} to indicate that you don't want to delete the
1134 * package's data directory.
1135 *
1136 * @hide
1137 */
Dianne Hackborn7767eac2012-08-23 18:25:40 -07001138 public static final int DELETE_KEEP_DATA = 0x00000001;
1139
1140 /**
1141 * Flag parameter for {@link #deletePackage} to indicate that you want the
1142 * package deleted for all users.
1143 *
1144 * @hide
1145 */
1146 public static final int DELETE_ALL_USERS = 0x00000002;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001147
1148 /**
Dianne Hackbornc895be72013-03-11 17:48:43 -07001149 * Flag parameter for {@link #deletePackage} to indicate that, if you are calling
1150 * uninstall on a system that has been updated, then don't do the normal process
1151 * of uninstalling the update and rolling back to the older system version (which
1152 * needs to happen for all users); instead, just mark the app as uninstalled for
1153 * the current user.
1154 *
1155 * @hide
1156 */
1157 public static final int DELETE_SYSTEM_APP = 0x00000004;
1158
1159 /**
Todd Kennedy39bfee52016-02-24 10:28:21 -08001160 * Flag parameter for {@link #deletePackage} to indicate that, if you are calling
1161 * uninstall on a package that is replaced to provide new feature splits, the
1162 * existing application should not be killed during the removal process.
1163 *
1164 * @hide
1165 */
1166 public static final int DELETE_DONT_KILL_APP = 0x00000008;
1167
1168 /**
Kenny Rootc39bb4a2011-02-28 13:27:19 -08001169 * Return code for when package deletion succeeds. This is passed to the
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001170 * {@link IPackageDeleteObserver} if the system succeeded in deleting the
1171 * package.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001172 *
Kenny Rootc39bb4a2011-02-28 13:27:19 -08001173 * @hide
1174 */
1175 public static final int DELETE_SUCCEEDED = 1;
1176
1177 /**
1178 * Deletion failed return code: this is passed to the
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001179 * {@link IPackageDeleteObserver} if the system failed to delete the package
1180 * for an unspecified reason.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001181 *
Kenny Rootc39bb4a2011-02-28 13:27:19 -08001182 * @hide
1183 */
1184 public static final int DELETE_FAILED_INTERNAL_ERROR = -1;
1185
1186 /**
1187 * Deletion failed return code: this is passed to the
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001188 * {@link IPackageDeleteObserver} if the system failed to delete the package
1189 * because it is the active DevicePolicy manager.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001190 *
Kenny Rootc39bb4a2011-02-28 13:27:19 -08001191 * @hide
1192 */
1193 public static final int DELETE_FAILED_DEVICE_POLICY_MANAGER = -2;
1194
1195 /**
Amith Yamasanie4cf7342012-12-17 11:12:09 -08001196 * Deletion failed return code: this is passed to the
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001197 * {@link IPackageDeleteObserver} if the system failed to delete the package
1198 * since the user is restricted.
Amith Yamasanie4cf7342012-12-17 11:12:09 -08001199 *
1200 * @hide
1201 */
1202 public static final int DELETE_FAILED_USER_RESTRICTED = -3;
1203
1204 /**
Kenny Guy1b88da52014-07-10 16:33:49 +01001205 * Deletion failed return code: this is passed to the
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001206 * {@link IPackageDeleteObserver} if the system failed to delete the package
1207 * because a profile or device owner has marked the package as
1208 * uninstallable.
Kenny Guyc13053b2014-05-29 14:17:17 +01001209 *
1210 * @hide
1211 */
Jeff Sharkeyf0600952014-08-07 17:31:53 -07001212 public static final int DELETE_FAILED_OWNER_BLOCKED = -4;
1213
1214 /** {@hide} */
1215 public static final int DELETE_FAILED_ABORTED = -5;
Kenny Guyc13053b2014-05-29 14:17:17 +01001216
1217 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001218 * Return code that is passed to the {@link IPackageMoveObserver} when the
Kenny Rootc39bb4a2011-02-28 13:27:19 -08001219 * package has been successfully moved by the system.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001220 *
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001221 * @hide
1222 */
Jeff Sharkey620b32b2015-04-23 19:36:02 -07001223 public static final int MOVE_SUCCEEDED = -100;
1224
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001225 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001226 * Error code that is passed to the {@link IPackageMoveObserver} when the
1227 * package hasn't been successfully moved by the system because of
1228 * insufficient memory on specified media.
1229 *
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001230 * @hide
1231 */
1232 public static final int MOVE_FAILED_INSUFFICIENT_STORAGE = -1;
1233
1234 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001235 * Error code that is passed to the {@link IPackageMoveObserver} if the
1236 * specified package doesn't exist.
1237 *
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001238 * @hide
1239 */
1240 public static final int MOVE_FAILED_DOESNT_EXIST = -2;
1241
1242 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001243 * Error code that is passed to the {@link IPackageMoveObserver} if the
1244 * specified package cannot be moved since its a system package.
1245 *
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001246 * @hide
1247 */
1248 public static final int MOVE_FAILED_SYSTEM_PACKAGE = -3;
1249
1250 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001251 * Error code that is passed to the {@link IPackageMoveObserver} if the
1252 * specified package cannot be moved since its forward locked.
1253 *
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001254 * @hide
1255 */
1256 public static final int MOVE_FAILED_FORWARD_LOCKED = -4;
1257
1258 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001259 * Error code that is passed to the {@link IPackageMoveObserver} if the
1260 * specified package cannot be moved to the specified location.
1261 *
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001262 * @hide
1263 */
1264 public static final int MOVE_FAILED_INVALID_LOCATION = -5;
1265
1266 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001267 * Error code that is passed to the {@link IPackageMoveObserver} if the
1268 * specified package cannot be moved to the specified location.
1269 *
Suchi Amalapurapu8a9ab242010-03-11 16:49:16 -08001270 * @hide
1271 */
1272 public static final int MOVE_FAILED_INTERNAL_ERROR = -6;
1273
1274 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001275 * Error code that is passed to the {@link IPackageMoveObserver} if the
1276 * specified package already has an operation pending in the queue.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001277 *
Kenny Rootdeb11262010-08-02 11:36:21 -07001278 * @hide
1279 */
1280 public static final int MOVE_FAILED_OPERATION_PENDING = -7;
1281
1282 /**
Makoto Onukif34db0a2016-02-17 11:17:15 -08001283 * Error code that is passed to the {@link IPackageMoveObserver} if the
1284 * specified package cannot be moved since it contains a device admin.
1285 *
1286 * @hide
1287 */
1288 public static final int MOVE_FAILED_DEVICE_ADMIN = -8;
1289
1290 /**
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001291 * Flag parameter for {@link #movePackage} to indicate that
1292 * the package should be moved to internal storage if its
1293 * been installed on external media.
1294 * @hide
1295 */
Jeff Sharkey620b32b2015-04-23 19:36:02 -07001296 @Deprecated
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001297 public static final int MOVE_INTERNAL = 0x00000001;
1298
1299 /**
1300 * Flag parameter for {@link #movePackage} to indicate that
1301 * the package should be moved to external media.
1302 * @hide
1303 */
Jeff Sharkey620b32b2015-04-23 19:36:02 -07001304 @Deprecated
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001305 public static final int MOVE_EXTERNAL_MEDIA = 0x00000002;
1306
Jeff Sharkey620b32b2015-04-23 19:36:02 -07001307 /** {@hide} */
1308 public static final String EXTRA_MOVE_ID = "android.content.pm.extra.MOVE_ID";
1309
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001310 /**
Kenny Root05ca4c92011-09-15 10:36:25 -07001311 * Usable by the required verifier as the {@code verificationCode} argument
1312 * for {@link PackageManager#verifyPendingInstall} to indicate that it will
1313 * allow the installation to proceed without any of the optional verifiers
1314 * needing to vote.
1315 *
1316 * @hide
1317 */
1318 public static final int VERIFICATION_ALLOW_WITHOUT_SUFFICIENT = 2;
1319
1320 /**
Kenny Root3a9b5fb2011-09-20 14:15:38 -07001321 * Used as the {@code verificationCode} argument for
1322 * {@link PackageManager#verifyPendingInstall} to indicate that the calling
1323 * package verifier allows the installation to proceed.
1324 */
1325 public static final int VERIFICATION_ALLOW = 1;
1326
1327 /**
1328 * Used as the {@code verificationCode} argument for
1329 * {@link PackageManager#verifyPendingInstall} to indicate the calling
1330 * package verifier does not vote to allow the installation to proceed.
1331 */
1332 public static final int VERIFICATION_REJECT = -1;
1333
1334 /**
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001335 * Used as the {@code verificationCode} argument for
1336 * {@link PackageManager#verifyIntentFilter} to indicate that the calling
1337 * IntentFilter Verifier confirms that the IntentFilter is verified.
1338 *
1339 * @hide
1340 */
Todd Kennedydfa93ab2016-03-03 15:24:33 -08001341 @SystemApi
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001342 public static final int INTENT_FILTER_VERIFICATION_SUCCESS = 1;
1343
1344 /**
1345 * Used as the {@code verificationCode} argument for
1346 * {@link PackageManager#verifyIntentFilter} to indicate that the calling
1347 * IntentFilter Verifier confirms that the IntentFilter is NOT verified.
1348 *
1349 * @hide
1350 */
Todd Kennedydfa93ab2016-03-03 15:24:33 -08001351 @SystemApi
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001352 public static final int INTENT_FILTER_VERIFICATION_FAILURE = -1;
1353
1354 /**
1355 * Internal status code to indicate that an IntentFilter verification result is not specified.
1356 *
1357 * @hide
1358 */
1359 public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED = 0;
1360
1361 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001362 * Used as the {@code status} argument for
1363 * {@link #updateIntentVerificationStatusAsUser} to indicate that the User
1364 * will always be prompted the Intent Disambiguation Dialog if there are two
1365 * or more Intent resolved for the IntentFilter's domain(s).
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001366 *
1367 * @hide
1368 */
1369 public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK = 1;
1370
1371 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001372 * Used as the {@code status} argument for
1373 * {@link #updateIntentVerificationStatusAsUser} to indicate that the User
1374 * will never be prompted the Intent Disambiguation Dialog if there are two
1375 * or more resolution of the Intent. The default App for the domain(s)
1376 * specified in the IntentFilter will also ALWAYS be used.
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001377 *
1378 * @hide
1379 */
1380 public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS = 2;
1381
1382 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001383 * Used as the {@code status} argument for
1384 * {@link #updateIntentVerificationStatusAsUser} to indicate that the User
1385 * may be prompted the Intent Disambiguation Dialog if there are two or more
1386 * Intent resolved. The default App for the domain(s) specified in the
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001387 * IntentFilter will also NEVER be presented to the User.
1388 *
1389 * @hide
1390 */
1391 public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER = 3;
1392
1393 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001394 * Used as the {@code status} argument for
1395 * {@link #updateIntentVerificationStatusAsUser} to indicate that this app
1396 * should always be considered as an ambiguous candidate for handling the
1397 * matching Intent even if there are other candidate apps in the "always"
1398 * state. Put another way: if there are any 'always ask' apps in a set of
1399 * more than one candidate app, then a disambiguation is *always* presented
1400 * even if there is another candidate app with the 'always' state.
Christopher Tate56f0ff32015-08-13 16:29:33 -07001401 *
1402 * @hide
1403 */
1404 public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS_ASK = 4;
1405
1406 /**
rich canningsd9ef3e52012-08-22 14:28:05 -07001407 * Can be used as the {@code millisecondsToDelay} argument for
1408 * {@link PackageManager#extendVerificationTimeout}. This is the
1409 * maximum time {@code PackageManager} waits for the verification
1410 * agent to return (in milliseconds).
1411 */
1412 public static final long MAXIMUM_VERIFICATION_TIMEOUT = 60*60*1000;
1413
1414 /**
Amith Yamasani0b285492011-04-14 17:35:23 -07001415 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: The device's
1416 * audio pipeline is low-latency, more suitable for audio applications sensitive to delays or
1417 * lag in sound input or output.
Dan Morrill898e1e82010-09-26 17:28:30 -07001418 */
1419 @SdkConstant(SdkConstantType.FEATURE)
1420 public static final String FEATURE_AUDIO_LOW_LATENCY = "android.hardware.audio.low_latency";
1421
1422 /**
1423 * Feature for {@link #getSystemAvailableFeatures} and
Unsuk Jung50909f62014-09-02 18:25:49 -07001424 * {@link #hasSystemFeature}: The device includes at least one form of audio
1425 * output, such as speakers, audio jack or streaming over bluetooth
1426 */
1427 @SdkConstant(SdkConstantType.FEATURE)
1428 public static final String FEATURE_AUDIO_OUTPUT = "android.hardware.audio.output";
1429
1430 /**
Glenn Kastencdcb5772015-05-06 15:54:49 -07001431 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Glenn Kasten7587edc2015-10-30 17:45:52 -07001432 * The device has professional audio level of functionality and performance.
Glenn Kastencdcb5772015-05-06 15:54:49 -07001433 */
1434 @SdkConstant(SdkConstantType.FEATURE)
1435 public static final String FEATURE_AUDIO_PRO = "android.hardware.audio.pro";
1436
1437 /**
Unsuk Jung50909f62014-09-02 18:25:49 -07001438 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001439 * {@link #hasSystemFeature}: The device is capable of communicating with
1440 * other devices via Bluetooth.
1441 */
1442 @SdkConstant(SdkConstantType.FEATURE)
1443 public static final String FEATURE_BLUETOOTH = "android.hardware.bluetooth";
1444
1445 /**
1446 * Feature for {@link #getSystemAvailableFeatures} and
Matthew Xiea7227722013-04-18 15:25:59 -07001447 * {@link #hasSystemFeature}: The device is capable of communicating with
1448 * other devices via Bluetooth Low Energy radio.
1449 */
1450 @SdkConstant(SdkConstantType.FEATURE)
1451 public static final String FEATURE_BLUETOOTH_LE = "android.hardware.bluetooth_le";
1452
1453 /**
1454 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001455 * {@link #hasSystemFeature}: The device has a camera facing away
1456 * from the screen.
1457 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001458 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001459 public static final String FEATURE_CAMERA = "android.hardware.camera";
Dan Morrill50ab63f2010-03-05 16:16:19 -08001460
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001461 /**
1462 * Feature for {@link #getSystemAvailableFeatures} and
1463 * {@link #hasSystemFeature}: The device's camera supports auto-focus.
1464 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001465 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001466 public static final String FEATURE_CAMERA_AUTOFOCUS = "android.hardware.camera.autofocus";
Dan Morrill50ab63f2010-03-05 16:16:19 -08001467
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001468 /**
1469 * Feature for {@link #getSystemAvailableFeatures} and
Eino-Ville Talvala752af832012-09-18 14:45:37 -07001470 * {@link #hasSystemFeature}: The device has at least one camera pointing in
Eino-Ville Talvala9131da22014-05-08 11:39:53 -07001471 * some direction, or can support an external camera being connected to it.
Eino-Ville Talvala752af832012-09-18 14:45:37 -07001472 */
1473 @SdkConstant(SdkConstantType.FEATURE)
1474 public static final String FEATURE_CAMERA_ANY = "android.hardware.camera.any";
1475
1476 /**
1477 * Feature for {@link #getSystemAvailableFeatures} and
Eino-Ville Talvala9131da22014-05-08 11:39:53 -07001478 * {@link #hasSystemFeature}: The device can support having an external camera connected to it.
1479 * The external camera may not always be connected or available to applications to use.
1480 */
1481 @SdkConstant(SdkConstantType.FEATURE)
1482 public static final String FEATURE_CAMERA_EXTERNAL = "android.hardware.camera.external";
1483
1484 /**
1485 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001486 * {@link #hasSystemFeature}: The device's camera supports flash.
1487 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001488 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001489 public static final String FEATURE_CAMERA_FLASH = "android.hardware.camera.flash";
Dan Morrill50ab63f2010-03-05 16:16:19 -08001490
1491 /**
1492 * Feature for {@link #getSystemAvailableFeatures} and
Chih-Chung Changde1057c2010-06-14 19:15:00 +08001493 * {@link #hasSystemFeature}: The device has a front facing camera.
1494 */
1495 @SdkConstant(SdkConstantType.FEATURE)
1496 public static final String FEATURE_CAMERA_FRONT = "android.hardware.camera.front";
1497
1498 /**
Eino-Ville Talvala611fece2014-07-10 17:29:38 -07001499 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one
1500 * of the cameras on the device supports the
1501 * {@link android.hardware.camera2.CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL full hardware}
1502 * capability level.
1503 */
1504 @SdkConstant(SdkConstantType.FEATURE)
1505 public static final String FEATURE_CAMERA_LEVEL_FULL = "android.hardware.camera.level.full";
1506
1507 /**
1508 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one
1509 * of the cameras on the device supports the
1510 * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR manual sensor}
1511 * capability level.
1512 */
1513 @SdkConstant(SdkConstantType.FEATURE)
1514 public static final String FEATURE_CAMERA_CAPABILITY_MANUAL_SENSOR =
1515 "android.hardware.camera.capability.manual_sensor";
1516
1517 /**
1518 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one
1519 * of the cameras on the device supports the
1520 * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MANUAL_POST_PROCESSING manual post-processing}
1521 * capability level.
1522 */
1523 @SdkConstant(SdkConstantType.FEATURE)
1524 public static final String FEATURE_CAMERA_CAPABILITY_MANUAL_POST_PROCESSING =
1525 "android.hardware.camera.capability.manual_post_processing";
1526
1527 /**
1528 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one
1529 * of the cameras on the device supports the
1530 * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_RAW RAW}
1531 * capability level.
1532 */
1533 @SdkConstant(SdkConstantType.FEATURE)
1534 public static final String FEATURE_CAMERA_CAPABILITY_RAW =
1535 "android.hardware.camera.capability.raw";
1536
1537 /**
Chih-Chung Changde1057c2010-06-14 19:15:00 +08001538 * Feature for {@link #getSystemAvailableFeatures} and
Alex Ray0c9d61f2013-10-03 12:17:54 -07001539 * {@link #hasSystemFeature}: The device is capable of communicating with
1540 * consumer IR devices.
1541 */
1542 @SdkConstant(SdkConstantType.FEATURE)
1543 public static final String FEATURE_CONSUMER_IR = "android.hardware.consumerir";
1544
1545 /**
1546 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001547 * {@link #hasSystemFeature}: The device supports one or more methods of
1548 * reporting current location.
1549 */
1550 @SdkConstant(SdkConstantType.FEATURE)
1551 public static final String FEATURE_LOCATION = "android.hardware.location";
1552
1553 /**
1554 * Feature for {@link #getSystemAvailableFeatures} and
1555 * {@link #hasSystemFeature}: The device has a Global Positioning System
1556 * receiver and can report precise location.
1557 */
1558 @SdkConstant(SdkConstantType.FEATURE)
1559 public static final String FEATURE_LOCATION_GPS = "android.hardware.location.gps";
1560
1561 /**
1562 * Feature for {@link #getSystemAvailableFeatures} and
1563 * {@link #hasSystemFeature}: The device can report location with coarse
1564 * accuracy using a network-based geolocation system.
1565 */
1566 @SdkConstant(SdkConstantType.FEATURE)
1567 public static final String FEATURE_LOCATION_NETWORK = "android.hardware.location.network";
1568
1569 /**
1570 * Feature for {@link #getSystemAvailableFeatures} and
1571 * {@link #hasSystemFeature}: The device can record audio via a
1572 * microphone.
1573 */
1574 @SdkConstant(SdkConstantType.FEATURE)
1575 public static final String FEATURE_MICROPHONE = "android.hardware.microphone";
1576
1577 /**
1578 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill76437d32010-09-01 11:17:20 -07001579 * {@link #hasSystemFeature}: The device can communicate using Near-Field
1580 * Communications (NFC).
1581 */
1582 @SdkConstant(SdkConstantType.FEATURE)
1583 public static final String FEATURE_NFC = "android.hardware.nfc";
1584
1585 /**
1586 * Feature for {@link #getSystemAvailableFeatures} and
Martijn Coenenf4bf1582013-07-22 12:01:19 -07001587 * {@link #hasSystemFeature}: The device supports host-
1588 * based NFC card emulation.
Martijn Coenendf4d1d62013-08-28 11:18:58 -07001589 *
1590 * TODO remove when depending apps have moved to new constant.
1591 * @hide
1592 * @deprecated
Martijn Coenenf4bf1582013-07-22 12:01:19 -07001593 */
Jose Lima970417c2014-04-10 10:42:19 -07001594 @Deprecated
Martijn Coenenf4bf1582013-07-22 12:01:19 -07001595 @SdkConstant(SdkConstantType.FEATURE)
1596 public static final String FEATURE_NFC_HCE = "android.hardware.nfc.hce";
1597
1598 /**
1599 * Feature for {@link #getSystemAvailableFeatures} and
Martijn Coenendf4d1d62013-08-28 11:18:58 -07001600 * {@link #hasSystemFeature}: The device supports host-
1601 * based NFC card emulation.
1602 */
1603 @SdkConstant(SdkConstantType.FEATURE)
1604 public static final String FEATURE_NFC_HOST_CARD_EMULATION = "android.hardware.nfc.hce";
1605
1606 /**
1607 * Feature for {@link #getSystemAvailableFeatures} and
Yoshinobu Itoc52adfe2016-01-22 18:14:18 +09001608 * {@link #hasSystemFeature}: The device supports host-
1609 * based NFC-F card emulation.
1610 */
1611 @SdkConstant(SdkConstantType.FEATURE)
1612 public static final String FEATURE_NFC_HOST_CARD_EMULATION_NFCF = "android.hardware.nfc.hcef";
1613
1614 /**
1615 * Feature for {@link #getSystemAvailableFeatures} and
Jesse Hall7f517062014-07-18 11:54:41 -07001616 * {@link #hasSystemFeature}: The device supports the OpenGL ES
1617 * <a href="http://www.khronos.org/registry/gles/extensions/ANDROID/ANDROID_extension_pack_es31a.txt">
1618 * Android Extension Pack</a>.
1619 */
1620 @SdkConstant(SdkConstantType.FEATURE)
1621 public static final String FEATURE_OPENGLES_EXTENSION_PACK = "android.hardware.opengles.aep";
1622
1623 /**
1624 * Feature for {@link #getSystemAvailableFeatures} and
Jesse Hall39ceeb52016-03-10 09:04:26 -08001625 * {@link #hasSystemFeature(String, int)}: If this feature is supported, the Vulkan native API
1626 * will enumerate at least one {@code VkPhysicalDevice}, and the feature version will indicate
1627 * what level of optional hardware features limits it supports.
Jesse Hallf77a34f2016-02-04 18:41:33 -08001628 * <p>
1629 * Level 0 includes the base Vulkan requirements as well as:
1630 * <ul><li>{@code VkPhysicalDeviceFeatures::textureCompressionETC2}</li></ul>
1631 * <p>
1632 * Level 1 additionally includes:
1633 * <ul>
1634 * <li>{@code VkPhysicalDeviceFeatures::fullDrawIndexUint32}</li>
1635 * <li>{@code VkPhysicalDeviceFeatures::imageCubeArray}</li>
1636 * <li>{@code VkPhysicalDeviceFeatures::independentBlend}</li>
1637 * <li>{@code VkPhysicalDeviceFeatures::geometryShader}</li>
1638 * <li>{@code VkPhysicalDeviceFeatures::tessellationShader}</li>
1639 * <li>{@code VkPhysicalDeviceFeatures::sampleRateShading}</li>
1640 * <li>{@code VkPhysicalDeviceFeatures::textureCompressionASTC_LDR}</li>
1641 * <li>{@code VkPhysicalDeviceFeatures::fragmentStoresAndAtomics}</li>
1642 * <li>{@code VkPhysicalDeviceFeatures::shaderImageGatherExtended}</li>
1643 * <li>{@code VkPhysicalDeviceFeatures::shaderUniformBufferArrayDynamicIndexing}</li>
1644 * <li>{@code VkPhysicalDeviceFeatures::shaderSampledImageArrayDynamicIndexing}</li>
1645 * </ul>
1646 */
1647 @SdkConstant(SdkConstantType.FEATURE)
1648 public static final String FEATURE_VULKAN_HARDWARE_LEVEL = "android.hardware.vulkan.level";
1649
1650 /**
1651 * Feature for {@link #getSystemAvailableFeatures} and
Jesse Hall39ceeb52016-03-10 09:04:26 -08001652 * {@link #hasSystemFeature(String, int)}: The version of this feature indicates the highest
Jesse Hallf77a34f2016-02-04 18:41:33 -08001653 * {@code VkPhysicalDeviceProperties::apiVersion} supported by the physical devices that support
1654 * the hardware level indicated by {@link #FEATURE_VULKAN_HARDWARE_LEVEL}. The feature version
1655 * uses the same encoding as Vulkan version numbers:
1656 * <ul>
1657 * <li>Major version number in bits 31-22</li>
1658 * <li>Minor version number in bits 21-12</li>
1659 * <li>Patch version number in bits 11-0</li>
1660 * </ul>
1661 */
1662 @SdkConstant(SdkConstantType.FEATURE)
1663 public static final String FEATURE_VULKAN_HARDWARE_VERSION = "android.hardware.vulkan.version";
1664
1665 /**
1666 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill5744bb42010-09-01 19:18:57 -07001667 * {@link #hasSystemFeature}: The device includes an accelerometer.
1668 */
1669 @SdkConstant(SdkConstantType.FEATURE)
1670 public static final String FEATURE_SENSOR_ACCELEROMETER = "android.hardware.sensor.accelerometer";
1671
1672 /**
1673 * Feature for {@link #getSystemAvailableFeatures} and
1674 * {@link #hasSystemFeature}: The device includes a barometer (air
1675 * pressure sensor.)
1676 */
1677 @SdkConstant(SdkConstantType.FEATURE)
1678 public static final String FEATURE_SENSOR_BAROMETER = "android.hardware.sensor.barometer";
1679
1680 /**
1681 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001682 * {@link #hasSystemFeature}: The device includes a magnetometer (compass).
1683 */
1684 @SdkConstant(SdkConstantType.FEATURE)
1685 public static final String FEATURE_SENSOR_COMPASS = "android.hardware.sensor.compass";
1686
1687 /**
1688 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill5744bb42010-09-01 19:18:57 -07001689 * {@link #hasSystemFeature}: The device includes a gyroscope.
Dan Morrill50ab63f2010-03-05 16:16:19 -08001690 */
1691 @SdkConstant(SdkConstantType.FEATURE)
Dan Morrill5744bb42010-09-01 19:18:57 -07001692 public static final String FEATURE_SENSOR_GYROSCOPE = "android.hardware.sensor.gyroscope";
Dan Morrill50ab63f2010-03-05 16:16:19 -08001693
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001694 /**
1695 * Feature for {@link #getSystemAvailableFeatures} and
1696 * {@link #hasSystemFeature}: The device includes a light sensor.
1697 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001698 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001699 public static final String FEATURE_SENSOR_LIGHT = "android.hardware.sensor.light";
Dan Morrill50ab63f2010-03-05 16:16:19 -08001700
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001701 /**
1702 * Feature for {@link #getSystemAvailableFeatures} and
1703 * {@link #hasSystemFeature}: The device includes a proximity sensor.
1704 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001705 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001706 public static final String FEATURE_SENSOR_PROXIMITY = "android.hardware.sensor.proximity";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001707
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001708 /**
1709 * Feature for {@link #getSystemAvailableFeatures} and
Aravind Akella068b0c02013-10-12 17:39:15 -07001710 * {@link #hasSystemFeature}: The device includes a hardware step counter.
1711 */
1712 @SdkConstant(SdkConstantType.FEATURE)
1713 public static final String FEATURE_SENSOR_STEP_COUNTER = "android.hardware.sensor.stepcounter";
1714
1715 /**
1716 * Feature for {@link #getSystemAvailableFeatures} and
1717 * {@link #hasSystemFeature}: The device includes a hardware step detector.
1718 */
1719 @SdkConstant(SdkConstantType.FEATURE)
1720 public static final String FEATURE_SENSOR_STEP_DETECTOR = "android.hardware.sensor.stepdetector";
1721
1722 /**
1723 * Feature for {@link #getSystemAvailableFeatures} and
Vinod Krishnan8afb23c2014-04-30 11:11:39 -07001724 * {@link #hasSystemFeature}: The device includes a heart rate monitor.
1725 */
1726 @SdkConstant(SdkConstantType.FEATURE)
1727 public static final String FEATURE_SENSOR_HEART_RATE = "android.hardware.sensor.heartrate";
1728
1729 /**
1730 * Feature for {@link #getSystemAvailableFeatures} and
Vinod Krishnan1ab76892014-08-20 11:11:55 -07001731 * {@link #hasSystemFeature}: The heart rate sensor on this device is an Electrocargiogram.
1732 */
1733 @SdkConstant(SdkConstantType.FEATURE)
1734 public static final String FEATURE_SENSOR_HEART_RATE_ECG =
1735 "android.hardware.sensor.heartrate.ecg";
1736
1737 /**
1738 * Feature for {@link #getSystemAvailableFeatures} and
Aravind Akella8b8e74b2014-07-09 11:52:39 -07001739 * {@link #hasSystemFeature}: The device includes a relative humidity sensor.
1740 */
1741 @SdkConstant(SdkConstantType.FEATURE)
1742 public static final String FEATURE_SENSOR_RELATIVE_HUMIDITY =
1743 "android.hardware.sensor.relative_humidity";
1744
1745 /**
1746 * Feature for {@link #getSystemAvailableFeatures} and
1747 * {@link #hasSystemFeature}: The device includes an ambient temperature sensor.
1748 */
1749 @SdkConstant(SdkConstantType.FEATURE)
1750 public static final String FEATURE_SENSOR_AMBIENT_TEMPERATURE =
1751 "android.hardware.sensor.ambient_temperature";
1752
1753 /**
1754 * Feature for {@link #getSystemAvailableFeatures} and
Ashutosh Joshieae371b2015-04-09 10:30:07 -07001755 * {@link #hasSystemFeature}: The device supports high fidelity sensor processing
1756 * capabilities.
1757 */
1758 @SdkConstant(SdkConstantType.FEATURE)
1759 public static final String FEATURE_HIFI_SENSORS =
1760 "android.hardware.sensor.hifi_sensors";
1761
1762 /**
1763 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001764 * {@link #hasSystemFeature}: The device has a telephony radio with data
1765 * communication support.
1766 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001767 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001768 public static final String FEATURE_TELEPHONY = "android.hardware.telephony";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001769
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001770 /**
1771 * Feature for {@link #getSystemAvailableFeatures} and
1772 * {@link #hasSystemFeature}: The device has a CDMA telephony stack.
1773 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001774 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001775 public static final String FEATURE_TELEPHONY_CDMA = "android.hardware.telephony.cdma";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001776
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001777 /**
1778 * Feature for {@link #getSystemAvailableFeatures} and
1779 * {@link #hasSystemFeature}: The device has a GSM telephony stack.
1780 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001781 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001782 public static final String FEATURE_TELEPHONY_GSM = "android.hardware.telephony.gsm";
Hung-ying Tyan3424c022010-08-27 18:08:19 +08001783
1784 /**
1785 * Feature for {@link #getSystemAvailableFeatures} and
Mike Lockwoodf4ca2472011-02-27 11:23:25 -08001786 * {@link #hasSystemFeature}: The device supports connecting to USB devices
1787 * as the USB host.
1788 */
1789 @SdkConstant(SdkConstantType.FEATURE)
1790 public static final String FEATURE_USB_HOST = "android.hardware.usb.host";
1791
1792 /**
1793 * Feature for {@link #getSystemAvailableFeatures} and
1794 * {@link #hasSystemFeature}: The device supports connecting to USB accessories.
1795 */
1796 @SdkConstant(SdkConstantType.FEATURE)
1797 public static final String FEATURE_USB_ACCESSORY = "android.hardware.usb.accessory";
1798
1799 /**
1800 * Feature for {@link #getSystemAvailableFeatures} and
Hung-ying Tyan3424c022010-08-27 18:08:19 +08001801 * {@link #hasSystemFeature}: The SIP API is enabled on the device.
1802 */
1803 @SdkConstant(SdkConstantType.FEATURE)
1804 public static final String FEATURE_SIP = "android.software.sip";
1805
1806 /**
1807 * Feature for {@link #getSystemAvailableFeatures} and
1808 * {@link #hasSystemFeature}: The device supports SIP-based VOIP.
1809 */
1810 @SdkConstant(SdkConstantType.FEATURE)
1811 public static final String FEATURE_SIP_VOIP = "android.software.sip.voip";
1812
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001813 /**
1814 * Feature for {@link #getSystemAvailableFeatures} and
Ihab Awad1ec68882014-09-12 11:09:01 -07001815 * {@link #hasSystemFeature}: The Connection Service API is enabled on the device.
1816 */
1817 @SdkConstant(SdkConstantType.FEATURE)
1818 public static final String FEATURE_CONNECTION_SERVICE = "android.software.connectionservice";
1819
1820 /**
1821 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrillb0fe0332010-04-05 14:43:58 -07001822 * {@link #hasSystemFeature}: The device's display has a touch screen.
1823 */
1824 @SdkConstant(SdkConstantType.FEATURE)
1825 public static final String FEATURE_TOUCHSCREEN = "android.hardware.touchscreen";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001826
Dan Morrillb0fe0332010-04-05 14:43:58 -07001827 /**
1828 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001829 * {@link #hasSystemFeature}: The device's touch screen supports
1830 * multitouch sufficient for basic two-finger gesture detection.
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001831 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001832 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001833 public static final String FEATURE_TOUCHSCREEN_MULTITOUCH = "android.hardware.touchscreen.multitouch";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001834
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001835 /**
1836 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001837 * {@link #hasSystemFeature}: The device's touch screen is capable of
1838 * tracking two or more fingers fully independently.
1839 */
1840 @SdkConstant(SdkConstantType.FEATURE)
1841 public static final String FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT = "android.hardware.touchscreen.multitouch.distinct";
1842
1843 /**
1844 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill6993d3d2010-09-03 14:30:14 -07001845 * {@link #hasSystemFeature}: The device's touch screen is capable of
1846 * tracking a full hand of fingers fully independently -- that is, 5 or
1847 * more simultaneous independent pointers.
1848 */
1849 @SdkConstant(SdkConstantType.FEATURE)
1850 public static final String FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND = "android.hardware.touchscreen.multitouch.jazzhand";
1851
1852 /**
1853 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrilla5376872011-01-23 13:15:53 -08001854 * {@link #hasSystemFeature}: The device does not have a touch screen, but
1855 * does support touch emulation for basic events. For instance, the
1856 * device might use a mouse or remote control to drive a cursor, and
1857 * emulate basic touch pointer events like down, up, drag, etc. All
1858 * devices that support android.hardware.touchscreen or a sub-feature are
1859 * presumed to also support faketouch.
1860 */
1861 @SdkConstant(SdkConstantType.FEATURE)
1862 public static final String FEATURE_FAKETOUCH = "android.hardware.faketouch";
1863
1864 /**
1865 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborne22fe932011-06-08 20:24:29 -07001866 * {@link #hasSystemFeature}: The device does not have a touch screen, but
1867 * does support touch emulation for basic events that supports distinct
1868 * tracking of two or more fingers. This is an extension of
1869 * {@link #FEATURE_FAKETOUCH} for input devices with this capability. Note
1870 * that unlike a distinct multitouch screen as defined by
1871 * {@link #FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT}, these kinds of input
1872 * devices will not actually provide full two-finger gestures since the
1873 * input is being transformed to cursor movement on the screen. That is,
1874 * single finger gestures will move a cursor; two-finger swipes will
1875 * result in single-finger touch events; other two-finger gestures will
1876 * result in the corresponding two-finger touch event.
1877 */
1878 @SdkConstant(SdkConstantType.FEATURE)
1879 public static final String FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT = "android.hardware.faketouch.multitouch.distinct";
1880
1881 /**
1882 * Feature for {@link #getSystemAvailableFeatures} and
1883 * {@link #hasSystemFeature}: The device does not have a touch screen, but
1884 * does support touch emulation for basic events that supports tracking
1885 * a hand of fingers (5 or more fingers) fully independently.
1886 * This is an extension of
1887 * {@link #FEATURE_FAKETOUCH} for input devices with this capability. Note
1888 * that unlike a multitouch screen as defined by
1889 * {@link #FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND}, not all two finger
1890 * gestures can be detected due to the limitations described for
1891 * {@link #FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT}.
1892 */
1893 @SdkConstant(SdkConstantType.FEATURE)
1894 public static final String FEATURE_FAKETOUCH_MULTITOUCH_JAZZHAND = "android.hardware.faketouch.multitouch.jazzhand";
1895
1896 /**
1897 * Feature for {@link #getSystemAvailableFeatures} and
Jim Millerd9b9d412015-07-22 19:51:40 -07001898 * {@link #hasSystemFeature}: The device has biometric hardware to detect a fingerprint.
1899 */
1900 @SdkConstant(SdkConstantType.FEATURE)
1901 public static final String FEATURE_FINGERPRINT = "android.hardware.fingerprint";
1902
1903 /**
1904 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborne289bff2011-06-13 19:33:22 -07001905 * {@link #hasSystemFeature}: The device supports portrait orientation
1906 * screens. For backwards compatibility, you can assume that if neither
1907 * this nor {@link #FEATURE_SCREEN_LANDSCAPE} is set then the device supports
1908 * both portrait and landscape.
1909 */
1910 @SdkConstant(SdkConstantType.FEATURE)
1911 public static final String FEATURE_SCREEN_PORTRAIT = "android.hardware.screen.portrait";
1912
1913 /**
1914 * Feature for {@link #getSystemAvailableFeatures} and
1915 * {@link #hasSystemFeature}: The device supports landscape orientation
1916 * screens. For backwards compatibility, you can assume that if neither
1917 * this nor {@link #FEATURE_SCREEN_PORTRAIT} is set then the device supports
1918 * both portrait and landscape.
1919 */
1920 @SdkConstant(SdkConstantType.FEATURE)
1921 public static final String FEATURE_SCREEN_LANDSCAPE = "android.hardware.screen.landscape";
1922
1923 /**
1924 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001925 * {@link #hasSystemFeature}: The device supports live wallpapers.
1926 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001927 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001928 public static final String FEATURE_LIVE_WALLPAPER = "android.software.live_wallpaper";
Oscar Montemayor1228d0a2010-01-28 12:01:44 -08001929 /**
Dan Morrill50ab63f2010-03-05 16:16:19 -08001930 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn119bbc32013-03-22 17:27:25 -07001931 * {@link #hasSystemFeature}: The device supports app widgets.
1932 */
1933 @SdkConstant(SdkConstantType.FEATURE)
1934 public static final String FEATURE_APP_WIDGETS = "android.software.app_widgets";
1935
1936 /**
Dianne Hackborn91097de2014-04-04 18:02:06 -07001937 * @hide
1938 * Feature for {@link #getSystemAvailableFeatures} and
1939 * {@link #hasSystemFeature}: The device supports
1940 * {@link android.service.voice.VoiceInteractionService} and
1941 * {@link android.app.VoiceInteractor}.
1942 */
1943 @SdkConstant(SdkConstantType.FEATURE)
1944 public static final String FEATURE_VOICE_RECOGNIZERS = "android.software.voice_recognizers";
1945
1946
1947 /**
Dianne Hackborn119bbc32013-03-22 17:27:25 -07001948 * Feature for {@link #getSystemAvailableFeatures} and
1949 * {@link #hasSystemFeature}: The device supports a home screen that is replaceable
1950 * by third party applications.
1951 */
1952 @SdkConstant(SdkConstantType.FEATURE)
1953 public static final String FEATURE_HOME_SCREEN = "android.software.home_screen";
1954
1955 /**
1956 * Feature for {@link #getSystemAvailableFeatures} and
1957 * {@link #hasSystemFeature}: The device supports adding new input methods implemented
1958 * with the {@link android.inputmethodservice.InputMethodService} API.
1959 */
1960 @SdkConstant(SdkConstantType.FEATURE)
1961 public static final String FEATURE_INPUT_METHODS = "android.software.input_methods";
1962
1963 /**
1964 * Feature for {@link #getSystemAvailableFeatures} and
Amith Yamasani44a01b72013-09-16 10:44:57 -07001965 * {@link #hasSystemFeature}: The device supports device policy enforcement via device admins.
1966 */
1967 @SdkConstant(SdkConstantType.FEATURE)
1968 public static final String FEATURE_DEVICE_ADMIN = "android.software.device_admin";
1969
1970 /**
1971 * Feature for {@link #getSystemAvailableFeatures} and
Tim Kilbournf94b6a92014-03-07 15:13:48 -08001972 * {@link #hasSystemFeature}: The device supports leanback UI. This is
1973 * typically used in a living room television experience, but is a software
1974 * feature unlike {@link #FEATURE_TELEVISION}. Devices running with this
1975 * feature will use resources associated with the "television" UI mode.
1976 */
1977 @SdkConstant(SdkConstantType.FEATURE)
1978 public static final String FEATURE_LEANBACK = "android.software.leanback";
1979
1980 /**
1981 * Feature for {@link #getSystemAvailableFeatures} and
1982 * {@link #hasSystemFeature}: The device supports only leanback UI. Only
1983 * applications designed for this experience should be run, though this is
1984 * not enforced by the system.
1985 * @hide
1986 */
1987 @SdkConstant(SdkConstantType.FEATURE)
1988 public static final String FEATURE_LEANBACK_ONLY = "android.software.leanback_only";
1989
1990 /**
1991 * Feature for {@link #getSystemAvailableFeatures} and
Jae Seocfd861e2014-08-27 14:02:15 -07001992 * {@link #hasSystemFeature}: The device supports live TV and can display
1993 * contents from TV inputs implemented with the
1994 * {@link android.media.tv.TvInputService} API.
1995 */
1996 @SdkConstant(SdkConstantType.FEATURE)
1997 public static final String FEATURE_LIVE_TV = "android.software.live_tv";
1998
1999 /**
2000 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08002001 * {@link #hasSystemFeature}: The device supports WiFi (802.11) networking.
2002 */
2003 @SdkConstant(SdkConstantType.FEATURE)
2004 public static final String FEATURE_WIFI = "android.hardware.wifi";
2005
2006 /**
Irfan Sheriff45b8b462011-09-07 11:24:16 -07002007 * Feature for {@link #getSystemAvailableFeatures} and
2008 * {@link #hasSystemFeature}: The device supports Wi-Fi Direct networking.
2009 */
2010 @SdkConstant(SdkConstantType.FEATURE)
2011 public static final String FEATURE_WIFI_DIRECT = "android.hardware.wifi.direct";
2012
2013 /**
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07002014 * Feature for {@link #getSystemAvailableFeatures} and
Etan Cohen20d329b2015-09-29 13:49:02 -07002015 * {@link #hasSystemFeature}: The device supports Wi-Fi Aware (NAN)
2016 * networking.
2017 *
2018 * @hide PROPOSED_NAN_API
2019 */
2020 @SdkConstant(SdkConstantType.FEATURE)
2021 public static final String FEATURE_WIFI_NAN = "android.hardware.wifi.nan";
2022
2023 /**
2024 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07002025 * {@link #hasSystemFeature}: This is a device dedicated to showing UI
Todd Kennedy7f95a002015-04-22 14:28:25 -07002026 * on a vehicle headunit. A headunit here is defined to be inside a
2027 * vehicle that may or may not be moving. A headunit uses either a
2028 * primary display in the center console and/or additional displays in
2029 * the instrument cluster or elsewhere in the vehicle. Headunit display(s)
2030 * have limited size and resolution. The user will likely be focused on
2031 * driving so limiting driver distraction is a primary concern. User input
2032 * can be a variety of hard buttons, touch, rotary controllers and even mouse-
2033 * like interfaces.
2034 */
2035 @SdkConstant(SdkConstantType.FEATURE)
2036 public static final String FEATURE_AUTOMOTIVE = "android.hardware.type.automotive";
2037
2038 /**
2039 * Feature for {@link #getSystemAvailableFeatures} and
2040 * {@link #hasSystemFeature}: This is a device dedicated to showing UI
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07002041 * on a television. Television here is defined to be a typical living
2042 * room television experience: displayed on a big screen, where the user
2043 * is sitting far away from it, and the dominant form of input will be
2044 * something like a DPAD, not through touch or mouse.
Tim Kilbournf94b6a92014-03-07 15:13:48 -08002045 * @deprecated use {@link #FEATURE_LEANBACK} instead.
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07002046 */
Jose Lima970417c2014-04-10 10:42:19 -07002047 @Deprecated
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07002048 @SdkConstant(SdkConstantType.FEATURE)
2049 public static final String FEATURE_TELEVISION = "android.hardware.type.television";
2050
2051 /**
Justin Kohb5731f091c2014-02-13 16:06:59 -08002052 * Feature for {@link #getSystemAvailableFeatures} and
2053 * {@link #hasSystemFeature}: This is a device dedicated to showing UI
2054 * on a watch. A watch here is defined to be a device worn on the body, perhaps on
2055 * the wrist. The user is very close when interacting with the device.
2056 */
2057 @SdkConstant(SdkConstantType.FEATURE)
2058 public static final String FEATURE_WATCH = "android.hardware.type.watch";
2059
2060 /**
Adam Lesinski3d9bcb92014-02-18 14:05:14 -08002061 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2062 * The device supports printing.
2063 */
2064 @SdkConstant(SdkConstantType.FEATURE)
2065 public static final String FEATURE_PRINTING = "android.software.print";
2066
2067 /**
2068 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2069 * The device can perform backup and restore operations on installed applications.
2070 */
2071 @SdkConstant(SdkConstantType.FEATURE)
2072 public static final String FEATURE_BACKUP = "android.software.backup";
2073
2074 /**
Vladislav Kaznacheevd303b252015-10-27 17:30:58 -07002075 * Feature for {@link #getSystemAvailableFeatures} and
2076 * {@link #hasSystemFeature}: The device supports freeform window management.
2077 * Windows have title bars and can be moved and resized.
2078 */
Filip Gruszczynski811dc3b2015-11-23 12:34:22 -08002079 // If this feature is present, you also need to set
2080 // com.android.internal.R.config_freeformWindowManagement to true in your configuration overlay.
Vladislav Kaznacheevd303b252015-10-27 17:30:58 -07002081 @SdkConstant(SdkConstantType.FEATURE)
2082 public static final String FEATURE_FREEFORM_WINDOW_MANAGEMENT
2083 = "android.software.freeform_window_management";
2084
2085 /**
Adam Connors23cc04e2014-04-01 12:12:20 +01002086 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Wale Ogunwalefbe12c42015-12-06 16:23:50 -08002087 * The device supports picture-in-picture multi-window mode.
2088 */
2089 @SdkConstant(SdkConstantType.FEATURE)
2090 public static final String FEATURE_PICTURE_IN_PICTURE = "android.software.picture_in_picture";
2091
2092 /**
2093 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Amith Yamasani1d653272014-09-11 17:56:05 -07002094 * The device supports creating secondary users and managed profiles via
2095 * {@link DevicePolicyManager}.
Adam Connors23cc04e2014-04-01 12:12:20 +01002096 */
2097 @SdkConstant(SdkConstantType.FEATURE)
Amith Yamasani1d653272014-09-11 17:56:05 -07002098 public static final String FEATURE_MANAGED_USERS = "android.software.managed_users";
2099
2100 /**
2101 * @hide
2102 * TODO: Remove after dependencies updated b/17392243
2103 */
2104 public static final String FEATURE_MANAGED_PROFILES = "android.software.managed_users";
Adam Connors23cc04e2014-04-01 12:12:20 +01002105
2106 /**
Ben Murdochf564c7f2014-05-20 18:58:06 +01002107 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Adam Connors19ccb5f2014-09-08 17:31:50 +01002108 * The device supports verified boot.
2109 */
2110 @SdkConstant(SdkConstantType.FEATURE)
2111 public static final String FEATURE_VERIFIED_BOOT = "android.software.verified_boot";
2112
2113 /**
2114 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2115 * The device supports secure removal of users. When a user is deleted the data associated
2116 * with that user is securely deleted and no longer available.
2117 */
2118 @SdkConstant(SdkConstantType.FEATURE)
2119 public static final String FEATURE_SECURELY_REMOVES_USERS
2120 = "android.software.securely_removes_users";
2121
Jeff Sharkeyb92b05b2016-01-28 09:50:00 -07002122 /** {@hide} */
2123 @SdkConstant(SdkConstantType.FEATURE)
2124 public static final String FEATURE_FILE_BASED_ENCRYPTION
2125 = "android.software.file_based_encryption";
2126
Adam Connors19ccb5f2014-09-08 17:31:50 +01002127 /**
2128 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Ben Murdoch422c7a52014-05-16 13:45:47 +01002129 * The device has a full implementation of the android.webkit.* APIs. Devices
2130 * lacking this feature will not have a functioning WebView implementation.
2131 */
2132 @SdkConstant(SdkConstantType.FEATURE)
2133 public static final String FEATURE_WEBVIEW = "android.software.webview";
2134
2135 /**
Joe LaPenna4bb015d2014-07-04 17:15:54 -07002136 * Feature for {@link #getSystemAvailableFeatures} and
2137 * {@link #hasSystemFeature}: This device supports ethernet.
Joe LaPenna4bb015d2014-07-04 17:15:54 -07002138 */
2139 @SdkConstant(SdkConstantType.FEATURE)
2140 public static final String FEATURE_ETHERNET = "android.hardware.ethernet";
2141
2142 /**
Yuncheol Heoa0c4a062014-07-10 20:49:27 +09002143 * Feature for {@link #getSystemAvailableFeatures} and
2144 * {@link #hasSystemFeature}: This device supports HDMI-CEC.
2145 * @hide
2146 */
2147 @SdkConstant(SdkConstantType.FEATURE)
2148 public static final String FEATURE_HDMI_CEC = "android.hardware.hdmi.cec";
2149
2150 /**
Michael Wright6faa6752014-09-05 17:57:44 -07002151 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2152 * The device has all of the inputs necessary to be considered a compatible game controller, or
2153 * includes a compatible game controller in the box.
2154 */
2155 @SdkConstant(SdkConstantType.FEATURE)
2156 public static final String FEATURE_GAMEPAD = "android.hardware.gamepad";
2157
Mike Lockwood5781cd52015-03-27 13:23:41 -07002158 /**
2159 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2160 * The device has a full implementation of the android.media.midi.* APIs.
2161 */
2162 @SdkConstant(SdkConstantType.FEATURE)
2163 public static final String FEATURE_MIDI = "android.software.midi";
Michael Wright6faa6752014-09-05 17:57:44 -07002164
2165 /**
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08002166 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2167 * The device implements a an optimized mode for virtual reality (VR) applications that handles
2168 * stereoscopic rendering of notifications, and may potentially also include optimizations to
Ruben Brunk31d80ea2016-01-25 20:14:08 -08002169 * reduce latency in the graphics, display, and sensor stacks.
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08002170 */
2171 @SdkConstant(SdkConstantType.FEATURE)
2172 public static final String FEATURE_VR_MODE = "android.software.vr.mode";
2173
2174 /**
Ruben Brunk31d80ea2016-01-25 20:14:08 -08002175 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2176 * The device implements {@link #FEATURE_VR_MODE} but additionally meets all CTS requirements
2177 * to be certified as a "VR Ready" device, which guarantees that the device is capable of
2178 * delivering consistent performance at a high framerate over an extended period of time for
2179 * typical VR application CPU/GPU workloads with a minimal number of frame drops, implements
2180 * {@link #FEATURE_HIFI_SENSORS} with a low sensor latency, implements an optimized render path
2181 * to minimize latency to draw to the device's main display, and includes optimizations to
2182 * lower display persistence to an acceptable level.
2183 */
2184 @SdkConstant(SdkConstantType.FEATURE)
2185 public static final String FEATURE_VR_MODE_HIGH_PERFORMANCE
2186 = "android.hardware.vr.high_performance";
2187
2188 /**
Dianne Hackborne83cefce2010-02-04 17:38:14 -08002189 * Action to external storage service to clean out removed apps.
2190 * @hide
2191 */
2192 public static final String ACTION_CLEAN_EXTERNAL_STORAGE
2193 = "android.content.pm.CLEAN_EXTERNAL_STORAGE";
Oscar Montemayor1228d0a2010-01-28 12:01:44 -08002194
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002195 /**
Kenny Root5ab21572011-07-27 11:11:19 -07002196 * Extra field name for the URI to a verification file. Passed to a package
2197 * verifier.
2198 *
2199 * @hide
2200 */
2201 public static final String EXTRA_VERIFICATION_URI = "android.content.pm.extra.VERIFICATION_URI";
2202
2203 /**
2204 * Extra field name for the ID of a package pending verification. Passed to
2205 * a package verifier and is used to call back to
Kenny Root3a9b5fb2011-09-20 14:15:38 -07002206 * {@link PackageManager#verifyPendingInstall(int, int)}
Kenny Root5ab21572011-07-27 11:11:19 -07002207 */
2208 public static final String EXTRA_VERIFICATION_ID = "android.content.pm.extra.VERIFICATION_ID";
2209
2210 /**
2211 * Extra field name for the package identifier which is trying to install
2212 * the package.
2213 *
2214 * @hide
2215 */
2216 public static final String EXTRA_VERIFICATION_INSTALLER_PACKAGE
2217 = "android.content.pm.extra.VERIFICATION_INSTALLER_PACKAGE";
2218
2219 /**
2220 * Extra field name for the requested install flags for a package pending
2221 * verification. Passed to a package verifier.
2222 *
2223 * @hide
2224 */
2225 public static final String EXTRA_VERIFICATION_INSTALL_FLAGS
2226 = "android.content.pm.extra.VERIFICATION_INSTALL_FLAGS";
2227
2228 /**
rich cannings13d428e2012-09-13 13:43:07 -07002229 * Extra field name for the uid of who is requesting to install
2230 * the package.
2231 *
2232 * @hide
2233 */
2234 public static final String EXTRA_VERIFICATION_INSTALLER_UID
2235 = "android.content.pm.extra.VERIFICATION_INSTALLER_UID";
2236
2237 /**
2238 * Extra field name for the package name of a package pending verification.
2239 *
2240 * @hide
2241 */
2242 public static final String EXTRA_VERIFICATION_PACKAGE_NAME
2243 = "android.content.pm.extra.VERIFICATION_PACKAGE_NAME";
2244 /**
rich canningsd1b5cfc2012-08-29 14:49:51 -07002245 * Extra field name for the result of a verification, either
2246 * {@link #VERIFICATION_ALLOW}, or {@link #VERIFICATION_REJECT}.
2247 * Passed to package verifiers after a package is verified.
2248 */
2249 public static final String EXTRA_VERIFICATION_RESULT
2250 = "android.content.pm.extra.VERIFICATION_RESULT";
2251
2252 /**
rich cannings13d428e2012-09-13 13:43:07 -07002253 * Extra field name for the version code of a package pending verification.
2254 *
2255 * @hide
2256 */
2257 public static final String EXTRA_VERIFICATION_VERSION_CODE
2258 = "android.content.pm.extra.VERIFICATION_VERSION_CODE";
2259
2260 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07002261 * Extra field name for the ID of a intent filter pending verification.
2262 * Passed to an intent filter verifier and is used to call back to
2263 * {@link #verifyIntentFilter}
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08002264 *
2265 * @hide
2266 */
2267 public static final String EXTRA_INTENT_FILTER_VERIFICATION_ID
2268 = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_ID";
2269
2270 /**
2271 * Extra field name for the scheme used for an intent filter pending verification. Passed to
2272 * an intent filter verifier and is used to construct the URI to verify against.
2273 *
2274 * Usually this is "https"
2275 *
2276 * @hide
2277 */
2278 public static final String EXTRA_INTENT_FILTER_VERIFICATION_URI_SCHEME
2279 = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_URI_SCHEME";
2280
2281 /**
2282 * Extra field name for the host names to be used for an intent filter pending verification.
2283 * Passed to an intent filter verifier and is used to construct the URI to verify the
2284 * intent filter.
2285 *
2286 * This is a space delimited list of hosts.
2287 *
2288 * @hide
2289 */
2290 public static final String EXTRA_INTENT_FILTER_VERIFICATION_HOSTS
2291 = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_HOSTS";
2292
2293 /**
2294 * Extra field name for the package name to be used for an intent filter pending verification.
2295 * Passed to an intent filter verifier and is used to check the verification responses coming
2296 * from the hosts. Each host response will need to include the package name of APK containing
2297 * the intent filter.
2298 *
2299 * @hide
2300 */
2301 public static final String EXTRA_INTENT_FILTER_VERIFICATION_PACKAGE_NAME
2302 = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_PACKAGE_NAME";
2303
2304 /**
2305 * The action used to request that the user approve a permission request
2306 * from the application.
Nick Kralevich035f80d2013-03-27 15:20:08 -07002307 *
2308 * @hide
2309 */
Svetoslavc6d1c342015-02-26 14:44:43 -08002310 @SystemApi
2311 public static final String ACTION_REQUEST_PERMISSIONS =
2312 "android.content.pm.action.REQUEST_PERMISSIONS";
Nick Kralevich035f80d2013-03-27 15:20:08 -07002313
2314 /**
Svetoslavc6d1c342015-02-26 14:44:43 -08002315 * The names of the requested permissions.
2316 * <p>
2317 * <strong>Type:</strong> String[]
2318 * </p>
2319 *
2320 * @hide
2321 */
2322 @SystemApi
2323 public static final String EXTRA_REQUEST_PERMISSIONS_NAMES =
2324 "android.content.pm.extra.REQUEST_PERMISSIONS_NAMES";
2325
2326 /**
2327 * The results from the permissions request.
2328 * <p>
2329 * <strong>Type:</strong> int[] of #PermissionResult
2330 * </p>
2331 *
2332 * @hide
2333 */
2334 @SystemApi
2335 public static final String EXTRA_REQUEST_PERMISSIONS_RESULTS
2336 = "android.content.pm.extra.REQUEST_PERMISSIONS_RESULTS";
Nick Kralevich035f80d2013-03-27 15:20:08 -07002337
2338 /**
Jeff Sharkeybb580672014-07-10 12:10:25 -07002339 * String extra for {@link PackageInstallObserver} in the 'extras' Bundle in case of
Christopher Tatef1977b42014-03-24 16:25:51 -07002340 * {@link #INSTALL_FAILED_DUPLICATE_PERMISSION}. This extra names the package which provides
2341 * the existing definition for the permission.
2342 * @hide
2343 */
2344 public static final String EXTRA_FAILURE_EXISTING_PACKAGE
2345 = "android.content.pm.extra.FAILURE_EXISTING_PACKAGE";
2346
2347 /**
Jeff Sharkeybb580672014-07-10 12:10:25 -07002348 * String extra for {@link PackageInstallObserver} in the 'extras' Bundle in case of
Christopher Tatef1977b42014-03-24 16:25:51 -07002349 * {@link #INSTALL_FAILED_DUPLICATE_PERMISSION}. This extra names the permission that is
2350 * being redundantly defined by the package being installed.
2351 * @hide
2352 */
2353 public static final String EXTRA_FAILURE_EXISTING_PERMISSION
2354 = "android.content.pm.extra.FAILURE_EXISTING_PERMISSION";
2355
Svet Ganov8c7f7002015-05-07 10:48:44 -07002356 /**
2357 * Permission flag: The permission is set in its current state
2358 * by the user and apps can still request it at runtime.
2359 *
2360 * @hide
2361 */
Svet Ganov8c7f7002015-05-07 10:48:44 -07002362 public static final int FLAG_PERMISSION_USER_SET = 1 << 0;
2363
2364 /**
2365 * Permission flag: The permission is set in its current state
2366 * by the user and it is fixed, i.e. apps can no longer request
2367 * this permission.
2368 *
2369 * @hide
2370 */
Svet Ganov8c7f7002015-05-07 10:48:44 -07002371 public static final int FLAG_PERMISSION_USER_FIXED = 1 << 1;
2372
2373 /**
2374 * Permission flag: The permission is set in its current state
2375 * by device policy and neither apps nor the user can change
2376 * its state.
2377 *
2378 * @hide
2379 */
Svet Ganov8c7f7002015-05-07 10:48:44 -07002380 public static final int FLAG_PERMISSION_POLICY_FIXED = 1 << 2;
2381
2382 /**
2383 * Permission flag: The permission is set in a granted state but
2384 * access to resources it guards is restricted by other means to
2385 * enable revoking a permission on legacy apps that do not support
2386 * runtime permissions. If this permission is upgraded to runtime
2387 * because the app was updated to support runtime permissions, the
2388 * the permission will be revoked in the upgrade process.
2389 *
2390 * @hide
2391 */
Svet Ganov8c7f7002015-05-07 10:48:44 -07002392 public static final int FLAG_PERMISSION_REVOKE_ON_UPGRADE = 1 << 3;
2393
Svet Ganovb3f22b42015-05-12 11:01:24 -07002394 /**
2395 * Permission flag: The permission is set in its current state
2396 * because the app is a component that is a part of the system.
2397 *
2398 * @hide
2399 */
Svet Ganovb3f22b42015-05-12 11:01:24 -07002400 public static final int FLAG_PERMISSION_SYSTEM_FIXED = 1 << 4;
Svet Ganov8c7f7002015-05-07 10:48:44 -07002401
Svet Ganov77ab6a82015-07-03 12:03:02 -07002402 /**
2403 * Permission flag: The permission is granted by default because it
2404 * enables app functionality that is expected to work out-of-the-box
2405 * for providing a smooth user experience. For example, the phone app
2406 * is expected to have the phone permission.
2407 *
2408 * @hide
2409 */
2410 public static final int FLAG_PERMISSION_GRANTED_BY_DEFAULT = 1 << 5;
2411
Svet Ganov8c7f7002015-05-07 10:48:44 -07002412 /**
Svet Ganov9c165d72015-12-01 19:52:26 -08002413 * Permission flag: The permission has to be reviewed before any of
2414 * the app components can run.
2415 *
2416 * @hide
2417 */
2418 public static final int FLAG_PERMISSION_REVIEW_REQUIRED = 1 << 6;
2419
2420 /**
Svet Ganov8c7f7002015-05-07 10:48:44 -07002421 * Mask for all permission flags.
2422 *
2423 * @hide
2424 */
2425 @SystemApi
Svet Ganovb3f22b42015-05-12 11:01:24 -07002426 public static final int MASK_PERMISSION_FLAGS = 0xFF;
Svet Ganov8c7f7002015-05-07 10:48:44 -07002427
Christopher Tatef1977b42014-03-24 16:25:51 -07002428 /**
Svet Ganovd7b1f4112016-02-09 18:49:23 -08002429 * This is a library that contains components apps can invoke. For
2430 * example, a services for apps to bind to, or standard chooser UI,
2431 * etc. This library is versioned and backwards compatible. Clients
2432 * should check its version via {@link android.ext.services.Version
2433 * #getVersionCode()} and avoid calling APIs added in later versions.
2434 *
2435 * @hide
2436 */
2437 public static final String SYSTEM_SHARED_LIBRARY_SERVICES = "android.ext.services";
2438
2439 /**
2440 * This is a library that contains components apps can dynamically
2441 * load. For example, new widgets, helper classes, etc. This library
2442 * is versioned and backwards compatible. Clients should check its
2443 * version via {@link android.ext.shared.Version#getVersionCode()}
2444 * and avoid calling APIs added in later versions.
2445 *
2446 * @hide
2447 */
2448 public static final String SYSTEM_SHARED_LIBRARY_SHARED = "android.ext.shared";
2449
2450 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002451 * Retrieve overall information about an application package that is
2452 * installed on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002453 *
2454 * @param packageName The full name (i.e. com.google.apps.contacts) of the
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002455 * desired package.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002456 * @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.
2467 *
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002468 * @return A PackageInfo object containing information about the
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002469 * package. If flag {@code MATCH_UNINSTALLED_PACKAGES} is set and if the
Kenny Root5ab21572011-07-27 11:11:19 -07002470 * package is not found in the list of installed applications, the
2471 * package information is retrieved from the list of uninstalled
kmccormick30498b42013-03-27 17:39:17 -07002472 * applications (which includes installed applications as well as
2473 * applications with data directory i.e. applications which had been
2474 * deleted with {@code DONT_DELETE_DATA} flag set).
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002475 * @throws NameNotFoundException if a package with the given name cannot be
2476 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002477 * @see #GET_ACTIVITIES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002478 * @see #GET_CONFIGURATIONS
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002479 * @see #GET_GIDS
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002480 * @see #GET_INSTRUMENTATION
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002481 * @see #GET_INTENT_FILTERS
2482 * @see #GET_META_DATA
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002483 * @see #GET_PERMISSIONS
2484 * @see #GET_PROVIDERS
2485 * @see #GET_RECEIVERS
2486 * @see #GET_SERVICES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002487 * @see #GET_SHARED_LIBRARY_FILES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002488 * @see #GET_SIGNATURES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002489 * @see #GET_URI_PERMISSION_PATTERNS
2490 * @see #MATCH_DISABLED_COMPONENTS
2491 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
2492 * @see #MATCH_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002493 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07002494 public abstract PackageInfo getPackageInfo(String packageName, @PackageInfoFlags int flags)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002495 throws NameNotFoundException;
2496
2497 /**
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002498 * @hide
2499 * Retrieve overall information about an application package that is
2500 * installed on the system.
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002501 *
2502 * @param packageName The full name (i.e. com.google.apps.contacts) of the
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002503 * desired package.
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002504 * @param flags Additional option flags. Use any combination of
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002505 * {@link #GET_ACTIVITIES}, {@link #GET_CONFIGURATIONS},
2506 * {@link #GET_GIDS}, {@link #GET_INSTRUMENTATION},
2507 * {@link #GET_INTENT_FILTERS}, {@link #GET_META_DATA},
2508 * {@link #GET_PERMISSIONS}, {@link #GET_PROVIDERS},
2509 * {@link #GET_RECEIVERS}, {@link #GET_SERVICES},
2510 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #GET_SIGNATURES},
2511 * {@link #GET_URI_PERMISSION_PATTERNS}, {@link #GET_UNINSTALLED_PACKAGES},
2512 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
2513 * {@link #MATCH_UNINSTALLED_PACKAGES}
2514 * to modify the data returned.
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002515 * @param userId The user id.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002516 *
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002517 * @return A PackageInfo object containing information about the
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002518 * package. If flag {@code MATCH_UNINSTALLED_PACKAGES} is set and if the
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002519 * package is not found in the list of installed applications, the
2520 * package information is retrieved from the list of uninstalled
2521 * applications (which includes installed applications as well as
2522 * applications with data directory i.e. applications which had been
2523 * deleted with {@code DONT_DELETE_DATA} flag set).
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002524 * @throws NameNotFoundException if a package with the given name cannot be
2525 * found on the system.
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002526 * @see #GET_ACTIVITIES
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002527 * @see #GET_CONFIGURATIONS
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002528 * @see #GET_GIDS
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002529 * @see #GET_INSTRUMENTATION
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002530 * @see #GET_INTENT_FILTERS
2531 * @see #GET_META_DATA
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002532 * @see #GET_PERMISSIONS
2533 * @see #GET_PROVIDERS
2534 * @see #GET_RECEIVERS
2535 * @see #GET_SERVICES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002536 * @see #GET_SHARED_LIBRARY_FILES
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002537 * @see #GET_SIGNATURES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002538 * @see #GET_URI_PERMISSION_PATTERNS
2539 * @see #MATCH_DISABLED_COMPONENTS
2540 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
2541 * @see #MATCH_UNINSTALLED_PACKAGES
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002542 */
2543 @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS)
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07002544 public abstract PackageInfo getPackageInfoAsUser(String packageName,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002545 @PackageInfoFlags int flags, @UserIdInt int userId) throws NameNotFoundException;
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002546
2547 /**
Dianne Hackborn47096932010-02-11 15:57:09 -08002548 * Map from the current package names in use on the device to whatever
2549 * the current canonical name of that package is.
2550 * @param names Array of current names to be mapped.
2551 * @return Returns an array of the same size as the original, containing
2552 * the canonical name for each package.
2553 */
2554 public abstract String[] currentToCanonicalPackageNames(String[] names);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002555
Dianne Hackborn47096932010-02-11 15:57:09 -08002556 /**
2557 * Map from a packages canonical name to the current name in use on the device.
2558 * @param names Array of new names to be mapped.
2559 * @return Returns an array of the same size as the original, containing
2560 * the current name for each package.
2561 */
2562 public abstract String[] canonicalToCurrentPackageNames(String[] names);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002563
Dianne Hackborn47096932010-02-11 15:57:09 -08002564 /**
Andrew Solovay5ae13352014-06-06 12:23:09 -07002565 * Returns a "good" intent to launch a front-door activity in a package.
2566 * This is used, for example, to implement an "open" button when browsing
2567 * through packages. The current implementation looks first for a main
2568 * activity in the category {@link Intent#CATEGORY_INFO}, and next for a
2569 * main activity in the category {@link Intent#CATEGORY_LAUNCHER}. Returns
2570 * <code>null</code> if neither are found.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002571 *
2572 * @param packageName The name of the package to inspect.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002573 *
Andrew Solovay5ae13352014-06-06 12:23:09 -07002574 * @return A fully-qualified {@link Intent} that can be used to launch the
2575 * main activity in the package. Returns <code>null</code> if the package
2576 * does not contain such an activity, or if <em>packageName</em> is not
Ihab Awad1ec68882014-09-12 11:09:01 -07002577 * recognized.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002578 */
Mihai Predaeae850c2009-05-13 10:13:48 +02002579 public abstract Intent getLaunchIntentForPackage(String packageName);
2580
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002581 /**
Jose Lima970417c2014-04-10 10:42:19 -07002582 * Return a "good" intent to launch a front-door Leanback activity in a
2583 * package, for use for example to implement an "open" button when browsing
2584 * through packages. The current implementation will look for a main
2585 * activity in the category {@link Intent#CATEGORY_LEANBACK_LAUNCHER}, or
2586 * return null if no main leanback activities are found.
Adam Connors551c0782014-06-05 12:13:03 +01002587 *
Jose Lima970417c2014-04-10 10:42:19 -07002588 * @param packageName The name of the package to inspect.
2589 * @return Returns either a fully-qualified Intent that can be used to launch
2590 * the main Leanback activity in the package, or null if the package
2591 * does not contain such an activity.
2592 */
2593 public abstract Intent getLeanbackLaunchIntentForPackage(String packageName);
2594
2595 /**
Jeff Sharkeycf3f0a12016-03-17 19:57:58 -06002596 * Return an array of all of the POSIX secondary group IDs that have been
2597 * assigned to the given package.
2598 * <p>
2599 * Note that the same package may have different GIDs under different
2600 * {@link UserHandle} on the same device.
Adam Connors551c0782014-06-05 12:13:03 +01002601 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002602 * @param packageName The full name (i.e. com.google.apps.contacts) of the
Jeff Sharkeycf3f0a12016-03-17 19:57:58 -06002603 * desired package.
2604 * @return Returns an int array of the assigned GIDs, or null if there are
Jose Lima970417c2014-04-10 10:42:19 -07002605 * none.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002606 * @throws NameNotFoundException if a package with the given name cannot be
2607 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002608 */
2609 public abstract int[] getPackageGids(String packageName)
2610 throws NameNotFoundException;
2611
2612 /**
Jeff Sharkeycf3f0a12016-03-17 19:57:58 -06002613 * Return an array of all of the POSIX secondary group IDs that have been
2614 * assigned to the given package.
2615 * <p>
2616 * Note that the same package may have different GIDs under different
2617 * {@link UserHandle} on the same device.
Dianne Hackborna06de0f2012-12-11 16:34:47 -08002618 *
2619 * @param packageName The full name (i.e. com.google.apps.contacts) of the
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002620 * desired package.
2621 * @return Returns an int array of the assigned gids, or null if there are
2622 * none.
2623 * @throws NameNotFoundException if a package with the given name cannot be
2624 * found on the system.
Dianne Hackborna06de0f2012-12-11 16:34:47 -08002625 */
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002626 public abstract int[] getPackageGids(String packageName, @PackageInfoFlags int flags)
Dianne Hackborna06de0f2012-12-11 16:34:47 -08002627 throws NameNotFoundException;
2628
2629 /**
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002630 * Return the UID associated with the given package name.
Jeff Sharkeycf3f0a12016-03-17 19:57:58 -06002631 * <p>
2632 * Note that the same package will have different UIDs under different
2633 * {@link UserHandle} on the same device.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002634 *
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002635 * @param packageName The full name (i.e. com.google.apps.contacts) of the
2636 * desired package.
2637 * @return Returns an integer UID who owns the given package name.
2638 * @throws NameNotFoundException if a package with the given name can not be
2639 * found on the system.
2640 */
2641 public abstract int getPackageUid(String packageName, @PackageInfoFlags int flags)
2642 throws NameNotFoundException;
2643
2644 /**
2645 * Return the UID associated with the given package name.
Jeff Sharkeycf3f0a12016-03-17 19:57:58 -06002646 * <p>
2647 * Note that the same package will have different UIDs under different
2648 * {@link UserHandle} on the same device.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002649 *
2650 * @param packageName The full name (i.e. com.google.apps.contacts) of the
2651 * desired package.
2652 * @param userId The user handle identifier to look up the package under.
2653 * @return Returns an integer UID who owns the given package name.
2654 * @throws NameNotFoundException if a package with the given name can not be
2655 * found on the system.
2656 * @hide
2657 */
2658 public abstract int getPackageUidAsUser(String packageName, @UserIdInt int userId)
2659 throws NameNotFoundException;
2660
2661 /**
2662 * Return the UID associated with the given package name.
Jeff Sharkeycf3f0a12016-03-17 19:57:58 -06002663 * <p>
2664 * Note that the same package will have different UIDs under different
2665 * {@link UserHandle} on the same device.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002666 *
2667 * @param packageName The full name (i.e. com.google.apps.contacts) of the
2668 * desired package.
2669 * @param userId The user handle identifier to look up the package under.
2670 * @return Returns an integer UID who owns the given package name.
2671 * @throws NameNotFoundException if a package with the given name can not be
2672 * found on the system.
2673 * @hide
2674 */
2675 public abstract int getPackageUidAsUser(String packageName, @PackageInfoFlags int flags,
2676 @UserIdInt int userId) throws NameNotFoundException;
2677
2678 /**
2679 * Retrieve all of the information we know about a particular permission.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002680 *
2681 * @param name The fully qualified name (i.e. com.google.permission.LOGIN)
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002682 * of the permission you are interested in.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002683 * @param flags Additional option flags. Use {@link #GET_META_DATA} to
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002684 * retrieve any meta-data associated with the permission.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002685 *
2686 * @return Returns a {@link PermissionInfo} containing information about the
2687 * permission.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002688 * @throws NameNotFoundException if a package with the given name cannot be
2689 * found on the system.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002690 *
2691 * @see #GET_META_DATA
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002692 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07002693 public abstract PermissionInfo getPermissionInfo(String name, @PermissionInfoFlags int flags)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002694 throws NameNotFoundException;
2695
2696 /**
2697 * Query for all of the permissions associated with a particular group.
2698 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002699 * @param group The fully qualified name (i.e. com.google.permission.LOGIN)
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002700 * of the permission group you are interested in. Use null to
2701 * find all of the permissions not associated with a group.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002702 * @param flags Additional option flags. Use {@link #GET_META_DATA} to
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002703 * retrieve any meta-data associated with the permissions.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002704 *
2705 * @return Returns a list of {@link PermissionInfo} containing information
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002706 * about all of the permissions in the given group.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002707 * @throws NameNotFoundException if a package with the given name cannot be
2708 * found on the system.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002709 *
2710 * @see #GET_META_DATA
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002711 */
2712 public abstract List<PermissionInfo> queryPermissionsByGroup(String group,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07002713 @PermissionInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002714
2715 /**
2716 * Retrieve all of the information we know about a particular group of
2717 * permissions.
2718 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002719 * @param name The fully qualified name (i.e. com.google.permission_group.APPS)
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002720 * of the permission you are interested in.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002721 * @param flags Additional option flags. Use {@link #GET_META_DATA} to
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002722 * retrieve any meta-data associated with the permission group.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002723 *
2724 * @return Returns a {@link PermissionGroupInfo} containing information
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002725 * about the permission.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002726 * @throws NameNotFoundException if a package with the given name cannot be
2727 * found on the system.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002728 *
2729 * @see #GET_META_DATA
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002730 */
2731 public abstract PermissionGroupInfo getPermissionGroupInfo(String name,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07002732 @PermissionGroupInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002733
2734 /**
2735 * Retrieve all of the known permission groups in the system.
2736 *
2737 * @param flags Additional option flags. Use {@link #GET_META_DATA} to
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002738 * retrieve any meta-data associated with the permission group.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002739 *
2740 * @return Returns a list of {@link PermissionGroupInfo} containing
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002741 * information about all of the known permission groups.
2742 *
2743 * @see #GET_META_DATA
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002744 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07002745 public abstract List<PermissionGroupInfo> getAllPermissionGroups(
2746 @PermissionGroupInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002747
2748 /**
2749 * Retrieve all of the information we know about a particular
2750 * package/application.
2751 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002752 * @param packageName The full name (i.e. com.google.apps.contacts) of an
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002753 * application.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002754 * @param flags Additional option flags. Use any combination of
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002755 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
2756 * {@link #MATCH_SYSTEM_ONLY}, {@link #MATCH_UNINSTALLED_PACKAGES}
2757 * to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002758 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002759 * @return An {@link ApplicationInfo} containing information about the
2760 * package. If flag {@code MATCH_UNINSTALLED_PACKAGES} is set and if the
2761 * package is not found in the list of installed applications, the
2762 * application information is retrieved from the list of uninstalled
2763 * applications (which includes installed applications as well as
2764 * applications with data directory i.e. applications which had been
kmccormick30498b42013-03-27 17:39:17 -07002765 * deleted with {@code DONT_DELETE_DATA} flag set).
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002766 * @throws NameNotFoundException if a package with the given name cannot be
2767 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002768 *
2769 * @see #GET_META_DATA
2770 * @see #GET_SHARED_LIBRARY_FILES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002771 * @see #MATCH_SYSTEM_ONLY
2772 * @see #MATCH_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002773 */
2774 public abstract ApplicationInfo getApplicationInfo(String packageName,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07002775 @ApplicationInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002776
Jeff Sharkeycd654482016-01-08 17:42:11 -07002777 /** {@hide} */
2778 public abstract ApplicationInfo getApplicationInfoAsUser(String packageName,
2779 @ApplicationInfoFlags int flags, @UserIdInt int userId) throws NameNotFoundException;
2780
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002781 /**
2782 * Retrieve all of the information we know about a particular activity
2783 * class.
2784 *
Dianne Hackborn361199b2010-08-30 17:42:07 -07002785 * @param component The full component name (i.e.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06002786 * com.google.apps.contacts/com.google.apps.contacts.
2787 * ContactsList) of an Activity class.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002788 * @param flags Additional option flags. Use any combination of
Jeff Sharkey8a372a02016-03-16 16:25:45 -06002789 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
2790 * {@link #MATCH_ALL}, {@link #MATCH_DEFAULT_ONLY},
2791 * {@link #MATCH_DISABLED_COMPONENTS},
2792 * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
2793 * {@link #MATCH_DIRECT_BOOT_AWARE},
2794 * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY}
2795 * {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data
2796 * returned.
2797 * @return An {@link ActivityInfo} containing information about the
2798 * activity.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002799 * @throws NameNotFoundException if a package with the given name cannot be
2800 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002801 * @see #GET_META_DATA
2802 * @see #GET_SHARED_LIBRARY_FILES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002803 * @see #MATCH_ALL
2804 * @see #MATCH_DEBUG_TRIAGED_MISSING
2805 * @see #MATCH_DEFAULT_ONLY
2806 * @see #MATCH_DISABLED_COMPONENTS
2807 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
Jeff Sharkey8a372a02016-03-16 16:25:45 -06002808 * @see #MATCH_DIRECT_BOOT_AWARE
2809 * @see #MATCH_DIRECT_BOOT_UNAWARE
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002810 * @see #MATCH_SYSTEM_ONLY
2811 * @see #MATCH_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002812 */
Dianne Hackborn361199b2010-08-30 17:42:07 -07002813 public abstract ActivityInfo getActivityInfo(ComponentName component,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07002814 @ComponentInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002815
2816 /**
2817 * Retrieve all of the information we know about a particular receiver
2818 * class.
2819 *
Dianne Hackborn361199b2010-08-30 17:42:07 -07002820 * @param component The full component name (i.e.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06002821 * com.google.apps.calendar/com.google.apps.calendar.
2822 * CalendarAlarm) of a Receiver class.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002823 * @param flags Additional option flags. Use any combination of
Jeff Sharkey8a372a02016-03-16 16:25:45 -06002824 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
2825 * {@link #MATCH_ALL}, {@link #MATCH_DEFAULT_ONLY},
2826 * {@link #MATCH_DISABLED_COMPONENTS},
2827 * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
2828 * {@link #MATCH_DIRECT_BOOT_AWARE},
2829 * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY}
2830 * {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data
2831 * returned.
2832 * @return An {@link ActivityInfo} containing information about the
2833 * receiver.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002834 * @throws NameNotFoundException if a package with the given name cannot be
2835 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002836 * @see #GET_META_DATA
2837 * @see #GET_SHARED_LIBRARY_FILES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002838 * @see #MATCH_ALL
2839 * @see #MATCH_DEBUG_TRIAGED_MISSING
2840 * @see #MATCH_DEFAULT_ONLY
2841 * @see #MATCH_DISABLED_COMPONENTS
2842 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
Jeff Sharkey8a372a02016-03-16 16:25:45 -06002843 * @see #MATCH_DIRECT_BOOT_AWARE
2844 * @see #MATCH_DIRECT_BOOT_UNAWARE
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002845 * @see #MATCH_SYSTEM_ONLY
2846 * @see #MATCH_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002847 */
Dianne Hackborn361199b2010-08-30 17:42:07 -07002848 public abstract ActivityInfo getReceiverInfo(ComponentName component,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07002849 @ComponentInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002850
2851 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -06002852 * Retrieve all of the information we know about a particular service class.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002853 *
Dianne Hackborn361199b2010-08-30 17:42:07 -07002854 * @param component The full component name (i.e.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06002855 * com.google.apps.media/com.google.apps.media.
2856 * BackgroundPlayback) of a Service class.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002857 * @param flags Additional option flags. Use any combination of
Jeff Sharkey8a372a02016-03-16 16:25:45 -06002858 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
2859 * {@link #MATCH_ALL}, {@link #MATCH_DEFAULT_ONLY},
2860 * {@link #MATCH_DISABLED_COMPONENTS},
2861 * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
2862 * {@link #MATCH_DIRECT_BOOT_AWARE},
2863 * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY}
2864 * {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data
2865 * returned.
2866 * @return A {@link ServiceInfo} object containing information about the
2867 * service.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002868 * @throws NameNotFoundException if a package with the given name cannot be
2869 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002870 * @see #GET_META_DATA
2871 * @see #GET_SHARED_LIBRARY_FILES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002872 * @see #MATCH_ALL
2873 * @see #MATCH_DEBUG_TRIAGED_MISSING
2874 * @see #MATCH_DEFAULT_ONLY
2875 * @see #MATCH_DISABLED_COMPONENTS
2876 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
Jeff Sharkey8a372a02016-03-16 16:25:45 -06002877 * @see #MATCH_DIRECT_BOOT_AWARE
2878 * @see #MATCH_DIRECT_BOOT_UNAWARE
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002879 * @see #MATCH_SYSTEM_ONLY
2880 * @see #MATCH_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002881 */
Dianne Hackborn361199b2010-08-30 17:42:07 -07002882 public abstract ServiceInfo getServiceInfo(ComponentName component,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07002883 @ComponentInfoFlags int flags) throws NameNotFoundException;
Dianne Hackborn361199b2010-08-30 17:42:07 -07002884
2885 /**
2886 * Retrieve all of the information we know about a particular content
2887 * provider class.
2888 *
Dianne Hackborn361199b2010-08-30 17:42:07 -07002889 * @param component The full component name (i.e.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06002890 * com.google.providers.media/com.google.providers.media.
2891 * MediaProvider) of a ContentProvider class.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002892 * @param flags Additional option flags. Use any combination of
Jeff Sharkey8a372a02016-03-16 16:25:45 -06002893 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
2894 * {@link #MATCH_ALL}, {@link #MATCH_DEFAULT_ONLY},
2895 * {@link #MATCH_DISABLED_COMPONENTS},
2896 * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
2897 * {@link #MATCH_DIRECT_BOOT_AWARE},
2898 * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY}
2899 * {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data
2900 * returned.
2901 * @return A {@link ProviderInfo} object containing information about the
2902 * provider.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002903 * @throws NameNotFoundException if a package with the given name cannot be
2904 * found on the system.
Dianne Hackborn361199b2010-08-30 17:42:07 -07002905 * @see #GET_META_DATA
2906 * @see #GET_SHARED_LIBRARY_FILES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002907 * @see #MATCH_ALL
2908 * @see #MATCH_DEBUG_TRIAGED_MISSING
2909 * @see #MATCH_DEFAULT_ONLY
2910 * @see #MATCH_DISABLED_COMPONENTS
2911 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
Jeff Sharkey8a372a02016-03-16 16:25:45 -06002912 * @see #MATCH_DIRECT_BOOT_AWARE
2913 * @see #MATCH_DIRECT_BOOT_UNAWARE
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002914 * @see #MATCH_SYSTEM_ONLY
2915 * @see #MATCH_UNINSTALLED_PACKAGES
Dianne Hackborn361199b2010-08-30 17:42:07 -07002916 */
2917 public abstract ProviderInfo getProviderInfo(ComponentName component,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07002918 @ComponentInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002919
2920 /**
2921 * Return a List of all packages that are installed
2922 * on the device.
2923 *
2924 * @param flags Additional option flags. Use any combination of
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002925 * {@link #GET_ACTIVITIES}, {@link #GET_CONFIGURATIONS},
2926 * {@link #GET_GIDS}, {@link #GET_INSTRUMENTATION},
2927 * {@link #GET_INTENT_FILTERS}, {@link #GET_META_DATA},
2928 * {@link #GET_PERMISSIONS}, {@link #GET_PROVIDERS},
2929 * {@link #GET_RECEIVERS}, {@link #GET_SERVICES},
2930 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #GET_SIGNATURES},
2931 * {@link #GET_URI_PERMISSION_PATTERNS}, {@link #GET_UNINSTALLED_PACKAGES},
2932 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
2933 * {@link #MATCH_UNINSTALLED_PACKAGES}
2934 * to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002935 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002936 * @return A List of PackageInfo objects, one for each installed package,
2937 * containing information about the package. In the unlikely case
2938 * there are no installed packages, an empty list is returned. If
2939 * flag {@code MATCH_UNINSTALLED_PACKAGES} is set, the package
2940 * information is retrieved from the list of uninstalled
2941 * applications (which includes installed applications as well as
2942 * applications with data directory i.e. applications which had been
2943 * deleted with {@code DONT_DELETE_DATA} flag set).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002944 *
2945 * @see #GET_ACTIVITIES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002946 * @see #GET_CONFIGURATIONS
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002947 * @see #GET_GIDS
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002948 * @see #GET_INSTRUMENTATION
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002949 * @see #GET_INTENT_FILTERS
2950 * @see #GET_META_DATA
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002951 * @see #GET_PERMISSIONS
2952 * @see #GET_PROVIDERS
2953 * @see #GET_RECEIVERS
2954 * @see #GET_SERVICES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002955 * @see #GET_SHARED_LIBRARY_FILES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002956 * @see #GET_SIGNATURES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002957 * @see #GET_URI_PERMISSION_PATTERNS
2958 * @see #MATCH_DISABLED_COMPONENTS
2959 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
2960 * @see #MATCH_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002961 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07002962 public abstract List<PackageInfo> getInstalledPackages(@PackageInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002963
2964 /**
Dianne Hackborne7991752013-01-16 17:56:46 -08002965 * Return a List of all installed packages that are currently
2966 * holding any of the given permissions.
2967 *
2968 * @param flags Additional option flags. Use any combination of
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002969 * {@link #GET_ACTIVITIES}, {@link #GET_CONFIGURATIONS},
2970 * {@link #GET_GIDS}, {@link #GET_INSTRUMENTATION},
2971 * {@link #GET_INTENT_FILTERS}, {@link #GET_META_DATA},
2972 * {@link #GET_PERMISSIONS}, {@link #GET_PROVIDERS},
2973 * {@link #GET_RECEIVERS}, {@link #GET_SERVICES},
2974 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #GET_SIGNATURES},
2975 * {@link #GET_URI_PERMISSION_PATTERNS}, {@link #GET_UNINSTALLED_PACKAGES},
2976 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
2977 * {@link #MATCH_UNINSTALLED_PACKAGES}
2978 * to modify the data returned.
Dianne Hackborne7991752013-01-16 17:56:46 -08002979 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002980 * @return A List of PackageInfo objects, one for each installed package
2981 * that holds any of the permissions that were provided, containing
2982 * information about the package. If no installed packages hold any
2983 * of the permissions, an empty list is returned. If flag
2984 * {@code MATCH_UNINSTALLED_PACKAGES} is set, the package information
2985 * is retrieved from the list of uninstalled applications (which
2986 * includes installed applications as well as applications with data
2987 * directory i.e. applications which had been deleted with
2988 * {@code DONT_DELETE_DATA} flag set).
Dianne Hackborne7991752013-01-16 17:56:46 -08002989 *
2990 * @see #GET_ACTIVITIES
Dianne Hackborne7991752013-01-16 17:56:46 -08002991 * @see #GET_CONFIGURATIONS
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002992 * @see #GET_GIDS
Dianne Hackborne7991752013-01-16 17:56:46 -08002993 * @see #GET_INSTRUMENTATION
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08002994 * @see #GET_INTENT_FILTERS
2995 * @see #GET_META_DATA
Dianne Hackborne7991752013-01-16 17:56:46 -08002996 * @see #GET_PERMISSIONS
2997 * @see #GET_PROVIDERS
2998 * @see #GET_RECEIVERS
2999 * @see #GET_SERVICES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003000 * @see #GET_SHARED_LIBRARY_FILES
Dianne Hackborne7991752013-01-16 17:56:46 -08003001 * @see #GET_SIGNATURES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003002 * @see #GET_URI_PERMISSION_PATTERNS
3003 * @see #MATCH_DISABLED_COMPONENTS
3004 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
3005 * @see #MATCH_UNINSTALLED_PACKAGES
Dianne Hackborne7991752013-01-16 17:56:46 -08003006 */
3007 public abstract List<PackageInfo> getPackagesHoldingPermissions(
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003008 String[] permissions, @PackageInfoFlags int flags);
Dianne Hackborne7991752013-01-16 17:56:46 -08003009
3010 /**
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003011 * Return a List of all packages that are installed on the device, for a specific user.
3012 * Requesting a list of installed packages for another user
3013 * will require the permission INTERACT_ACROSS_USERS_FULL.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003014 *
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003015 * @param flags Additional option flags. Use any combination of
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003016 * {@link #GET_ACTIVITIES}, {@link #GET_CONFIGURATIONS},
3017 * {@link #GET_GIDS}, {@link #GET_INSTRUMENTATION},
3018 * {@link #GET_INTENT_FILTERS}, {@link #GET_META_DATA},
3019 * {@link #GET_PERMISSIONS}, {@link #GET_PROVIDERS},
3020 * {@link #GET_RECEIVERS}, {@link #GET_SERVICES},
3021 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #GET_SIGNATURES},
3022 * {@link #GET_URI_PERMISSION_PATTERNS}, {@link #GET_UNINSTALLED_PACKAGES},
3023 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
3024 * {@link #MATCH_UNINSTALLED_PACKAGES}
3025 * to modify the data returned.
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003026 * @param userId The user for whom the installed packages are to be listed
3027 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003028 * @return A List of PackageInfo objects, one for each installed package,
3029 * containing information about the package. In the unlikely case
3030 * there are no installed packages, an empty list is returned. If
3031 * flag {@code MATCH_UNINSTALLED_PACKAGES} is set, the package
3032 * information is retrieved from the list of uninstalled
3033 * applications (which includes installed applications as well as
3034 * applications with data directory i.e. applications which had been
3035 * deleted with {@code DONT_DELETE_DATA} flag set).
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003036 *
3037 * @see #GET_ACTIVITIES
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003038 * @see #GET_CONFIGURATIONS
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003039 * @see #GET_GIDS
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003040 * @see #GET_INSTRUMENTATION
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003041 * @see #GET_INTENT_FILTERS
3042 * @see #GET_META_DATA
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003043 * @see #GET_PERMISSIONS
3044 * @see #GET_PROVIDERS
3045 * @see #GET_RECEIVERS
3046 * @see #GET_SERVICES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003047 * @see #GET_SHARED_LIBRARY_FILES
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003048 * @see #GET_SIGNATURES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003049 * @see #GET_URI_PERMISSION_PATTERNS
3050 * @see #MATCH_DISABLED_COMPONENTS
3051 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
3052 * @see #MATCH_UNINSTALLED_PACKAGES
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003053 *
3054 * @hide
3055 */
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07003056 public abstract List<PackageInfo> getInstalledPackagesAsUser(@PackageInfoFlags int flags,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003057 @UserIdInt int userId);
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003058
3059 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003060 * Check whether a particular package has been granted a particular
3061 * permission.
3062 *
Svet Ganovad3b2972015-07-07 22:49:17 -07003063 * @param permName The name of the permission you are checking for.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003064 * @param pkgName The name of the package you are checking against.
3065 *
3066 * @return If the package has the permission, PERMISSION_GRANTED is
3067 * returned. If it does not have the permission, PERMISSION_DENIED
3068 * is returned.
3069 *
3070 * @see #PERMISSION_GRANTED
3071 * @see #PERMISSION_DENIED
3072 */
Tor Norbye1c2bf032015-03-02 10:57:08 -08003073 @CheckResult
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003074 public abstract int checkPermission(String permName, String pkgName);
3075
3076 /**
Svet Ganovad3b2972015-07-07 22:49:17 -07003077 * Checks whether a particular permissions has been revoked for a
3078 * package by policy. Typically the device owner or the profile owner
3079 * may apply such a policy. The user cannot grant policy revoked
3080 * permissions, hence the only way for an app to get such a permission
3081 * is by a policy change.
3082 *
3083 * @param permName The name of the permission you are checking for.
3084 * @param pkgName The name of the package you are checking against.
3085 *
3086 * @return Whether the permission is restricted by policy.
3087 */
3088 @CheckResult
Svet Ganovf1b7f202015-07-29 08:33:42 -07003089 public abstract boolean isPermissionRevokedByPolicy(@NonNull String permName,
3090 @NonNull String pkgName);
3091
3092 /**
3093 * Gets the package name of the component controlling runtime permissions.
3094 *
3095 * @return The package name.
3096 *
3097 * @hide
3098 */
3099 public abstract String getPermissionControllerPackageName();
Svet Ganovad3b2972015-07-07 22:49:17 -07003100
3101 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003102 * Add a new dynamic permission to the system. For this to work, your
3103 * package must have defined a permission tree through the
3104 * {@link android.R.styleable#AndroidManifestPermissionTree
3105 * &lt;permission-tree&gt;} tag in its manifest. A package can only add
3106 * permissions to trees that were defined by either its own package or
3107 * another with the same user id; a permission is in a tree if it
3108 * matches the name of the permission tree + ".": for example,
3109 * "com.foo.bar" is a member of the permission tree "com.foo".
3110 *
3111 * <p>It is good to make your permission tree name descriptive, because you
3112 * are taking possession of that entire set of permission names. Thus, it
3113 * must be under a domain you control, with a suffix that will not match
3114 * any normal permissions that may be declared in any applications that
3115 * are part of that domain.
3116 *
3117 * <p>New permissions must be added before
3118 * any .apks are installed that use those permissions. Permissions you
3119 * add through this method are remembered across reboots of the device.
3120 * If the given permission already exists, the info you supply here
3121 * will be used to update it.
3122 *
3123 * @param info Description of the permission to be added.
3124 *
3125 * @return Returns true if a new permission was created, false if an
3126 * existing one was updated.
3127 *
3128 * @throws SecurityException if you are not allowed to add the
3129 * given permission name.
3130 *
3131 * @see #removePermission(String)
3132 */
3133 public abstract boolean addPermission(PermissionInfo info);
3134
3135 /**
Dianne Hackbornd7c09682010-03-30 10:42:20 -07003136 * Like {@link #addPermission(PermissionInfo)} but asynchronously
3137 * persists the package manager state after returning from the call,
3138 * allowing it to return quicker and batch a series of adds at the
3139 * expense of no guarantee the added permission will be retained if
3140 * the device is rebooted before it is written.
3141 */
3142 public abstract boolean addPermissionAsync(PermissionInfo info);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003143
Dianne Hackbornd7c09682010-03-30 10:42:20 -07003144 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003145 * Removes a permission that was previously added with
3146 * {@link #addPermission(PermissionInfo)}. The same ownership rules apply
3147 * -- you are only allowed to remove permissions that you are allowed
3148 * to add.
3149 *
3150 * @param name The name of the permission to remove.
3151 *
3152 * @throws SecurityException if you are not allowed to remove the
3153 * given permission name.
3154 *
3155 * @see #addPermission(PermissionInfo)
3156 */
3157 public abstract void removePermission(String name);
3158
Svet Ganov8c7f7002015-05-07 10:48:44 -07003159
3160 /**
3161 * Permission flags set when granting or revoking a permission.
3162 *
3163 * @hide
3164 */
3165 @SystemApi
3166 @IntDef({FLAG_PERMISSION_USER_SET,
3167 FLAG_PERMISSION_USER_FIXED,
3168 FLAG_PERMISSION_POLICY_FIXED,
Svet Ganovb3f22b42015-05-12 11:01:24 -07003169 FLAG_PERMISSION_REVOKE_ON_UPGRADE,
Svet Ganov77ab6a82015-07-03 12:03:02 -07003170 FLAG_PERMISSION_SYSTEM_FIXED,
3171 FLAG_PERMISSION_GRANTED_BY_DEFAULT})
Svet Ganov8c7f7002015-05-07 10:48:44 -07003172 @Retention(RetentionPolicy.SOURCE)
3173 public @interface PermissionFlags {}
3174
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003175 /**
Svetoslavc6d1c342015-02-26 14:44:43 -08003176 * Grant a runtime permission to an application which the application does not
3177 * already have. The permission must have been requested by the application.
3178 * If the application is not allowed to hold the permission, a {@link
3179 * java.lang.SecurityException} is thrown.
3180 * <p>
3181 * <strong>Note: </strong>Using this API requires holding
3182 * android.permission.GRANT_REVOKE_PERMISSIONS and if the user id is
3183 * not the current user android.permission.INTERACT_ACROSS_USERS_FULL.
3184 * </p>
Nick Kralevich035f80d2013-03-27 15:20:08 -07003185 *
Svetoslavc6d1c342015-02-26 14:44:43 -08003186 * @param packageName The package to which to grant the permission.
3187 * @param permissionName The permission name to grant.
3188 * @param user The user for which to grant the permission.
3189 *
Svet Ganov8c7f7002015-05-07 10:48:44 -07003190 * @see #revokeRuntimePermission(String, String, android.os.UserHandle)
3191 * @see android.content.pm.PackageManager.PermissionFlags
Svetoslavc6d1c342015-02-26 14:44:43 -08003192 *
3193 * @hide
Nick Kralevich035f80d2013-03-27 15:20:08 -07003194 */
Svetoslavc6d1c342015-02-26 14:44:43 -08003195 @SystemApi
Svet Ganov8c7f7002015-05-07 10:48:44 -07003196 public abstract void grantRuntimePermission(@NonNull String packageName,
Svetoslavc6d1c342015-02-26 14:44:43 -08003197 @NonNull String permissionName, @NonNull UserHandle user);
Nick Kralevich035f80d2013-03-27 15:20:08 -07003198
Svetoslavc6d1c342015-02-26 14:44:43 -08003199 /**
3200 * Revoke a runtime permission that was previously granted by {@link
Svet Ganov8c7f7002015-05-07 10:48:44 -07003201 * #grantRuntimePermission(String, String, android.os.UserHandle)}. The
3202 * permission must have been requested by and granted to the application.
3203 * If the application is not allowed to hold the permission, a {@link
Svetoslavc6d1c342015-02-26 14:44:43 -08003204 * java.lang.SecurityException} is thrown.
3205 * <p>
3206 * <strong>Note: </strong>Using this API requires holding
3207 * android.permission.GRANT_REVOKE_PERMISSIONS and if the user id is
3208 * not the current user android.permission.INTERACT_ACROSS_USERS_FULL.
3209 * </p>
3210 *
3211 * @param packageName The package from which to revoke the permission.
3212 * @param permissionName The permission name to revoke.
3213 * @param user The user for which to revoke the permission.
3214 *
Svet Ganov8c7f7002015-05-07 10:48:44 -07003215 * @see #grantRuntimePermission(String, String, android.os.UserHandle)
3216 * @see android.content.pm.PackageManager.PermissionFlags
Svetoslavc6d1c342015-02-26 14:44:43 -08003217 *
3218 * @hide
3219 */
3220 @SystemApi
Svet Ganov8c7f7002015-05-07 10:48:44 -07003221 public abstract void revokeRuntimePermission(@NonNull String packageName,
Svetoslavc6d1c342015-02-26 14:44:43 -08003222 @NonNull String permissionName, @NonNull UserHandle user);
3223
3224 /**
Svet Ganov8c7f7002015-05-07 10:48:44 -07003225 * Gets the state flags associated with a permission.
3226 *
3227 * @param permissionName The permission for which to get the flags.
3228 * @param packageName The package name for which to get the flags.
3229 * @param user The user for which to get permission flags.
3230 * @return The permission flags.
3231 *
3232 * @hide
3233 */
3234 @SystemApi
3235 public abstract @PermissionFlags int getPermissionFlags(String permissionName,
3236 String packageName, @NonNull UserHandle user);
3237
3238 /**
3239 * Updates the flags associated with a permission by replacing the flags in
3240 * the specified mask with the provided flag values.
3241 *
3242 * @param permissionName The permission for which to update the flags.
3243 * @param packageName The package name for which to update the flags.
3244 * @param flagMask The flags which to replace.
3245 * @param flagValues The flags with which to replace.
3246 * @param user The user for which to update the permission flags.
3247 *
3248 * @hide
3249 */
3250 @SystemApi
3251 public abstract void updatePermissionFlags(String permissionName,
3252 String packageName, @PermissionFlags int flagMask, int flagValues,
3253 @NonNull UserHandle user);
3254
3255 /**
Svetoslav20770dd2015-05-29 15:43:04 -07003256 * Gets whether you should show UI with rationale for requesting a permission.
3257 * You should do this only if you do not have the permission and the context in
3258 * which the permission is requested does not clearly communicate to the user
3259 * what would be the benefit from grating this permission.
3260 *
3261 * @param permission A permission your app wants to request.
3262 * @return Whether you can show permission rationale UI.
3263 *
3264 * @hide
3265 */
3266 public abstract boolean shouldShowRequestPermissionRationale(String permission);
3267
3268 /**
Svetoslavc6d1c342015-02-26 14:44:43 -08003269 * Returns an {@link android.content.Intent} suitable for passing to
3270 * {@link android.app.Activity#startActivityForResult(android.content.Intent, int)}
3271 * which prompts the user to grant permissions to this application.
3272 *
3273 * @throws NullPointerException if {@code permissions} is {@code null} or empty.
3274 *
3275 * @hide
3276 */
3277 public Intent buildRequestPermissionsIntent(@NonNull String[] permissions) {
3278 if (ArrayUtils.isEmpty(permissions)) {
Svet Ganovf66381c2016-02-18 20:02:36 -08003279 throw new IllegalArgumentException("permission cannot be null or empty");
Svetoslavc6d1c342015-02-26 14:44:43 -08003280 }
3281 Intent intent = new Intent(ACTION_REQUEST_PERMISSIONS);
3282 intent.putExtra(EXTRA_REQUEST_PERMISSIONS_NAMES, permissions);
Svet Ganovf1b7f202015-07-29 08:33:42 -07003283 intent.setPackage(getPermissionControllerPackageName());
Svetoslavc6d1c342015-02-26 14:44:43 -08003284 return intent;
Nick Kralevich035f80d2013-03-27 15:20:08 -07003285 }
3286
3287 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003288 * Compare the signatures of two packages to determine if the same
3289 * signature appears in both of them. If they do contain the same
3290 * signature, then they are allowed special privileges when working
3291 * with each other: they can share the same user-id, run instrumentation
3292 * against each other, etc.
3293 *
3294 * @param pkg1 First package name whose signature will be compared.
3295 * @param pkg2 Second package name whose signature will be compared.
Chris Palmer09f33602010-09-13 14:27:18 -07003296 *
3297 * @return Returns an integer indicating whether all signatures on the
3298 * two packages match. The value is >= 0 ({@link #SIGNATURE_MATCH}) if
3299 * all signatures match or < 0 if there is not a match ({@link
3300 * #SIGNATURE_NO_MATCH} or {@link #SIGNATURE_UNKNOWN_PACKAGE}).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003301 *
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07003302 * @see #checkSignatures(int, int)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003303 * @see #SIGNATURE_MATCH
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003304 * @see #SIGNATURE_NO_MATCH
3305 * @see #SIGNATURE_UNKNOWN_PACKAGE
3306 */
Tor Norbye1c2bf032015-03-02 10:57:08 -08003307 @CheckResult
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003308 public abstract int checkSignatures(String pkg1, String pkg2);
3309
3310 /**
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07003311 * Like {@link #checkSignatures(String, String)}, but takes UIDs of
3312 * the two packages to be checked. This can be useful, for example,
3313 * when doing the check in an IPC, where the UID is the only identity
3314 * available. It is functionally identical to determining the package
3315 * associated with the UIDs and checking their signatures.
3316 *
Joe Onorato25660ec2009-08-12 22:40:37 -07003317 * @param uid1 First UID whose signature will be compared.
3318 * @param uid2 Second UID whose signature will be compared.
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07003319 *
Chris Palmer09f33602010-09-13 14:27:18 -07003320 * @return Returns an integer indicating whether all signatures on the
3321 * two packages match. The value is >= 0 ({@link #SIGNATURE_MATCH}) if
3322 * all signatures match or < 0 if there is not a match ({@link
3323 * #SIGNATURE_NO_MATCH} or {@link #SIGNATURE_UNKNOWN_PACKAGE}).
3324 *
3325 * @see #checkSignatures(String, String)
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07003326 * @see #SIGNATURE_MATCH
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07003327 * @see #SIGNATURE_NO_MATCH
3328 * @see #SIGNATURE_UNKNOWN_PACKAGE
3329 */
Tor Norbye1c2bf032015-03-02 10:57:08 -08003330 @CheckResult
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07003331 public abstract int checkSignatures(int uid1, int uid2);
3332
3333 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003334 * Retrieve the names of all packages that are associated with a particular
3335 * user id. In most cases, this will be a single package name, the package
3336 * that has been assigned that user id. Where there are multiple packages
3337 * sharing the same user id through the "sharedUserId" mechanism, all
3338 * packages with that id will be returned.
3339 *
3340 * @param uid The user id for which you would like to retrieve the
3341 * associated packages.
3342 *
3343 * @return Returns an array of one or more packages assigned to the user
3344 * id, or null if there are no known packages with the given id.
3345 */
Jeff Sharkey377ded0f2016-01-10 13:15:41 -07003346 public abstract @Nullable String[] getPackagesForUid(int uid);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003347
3348 /**
3349 * Retrieve the official name associated with a user id. This name is
Jonathan Basseri7ea3a332015-05-12 19:39:22 -07003350 * guaranteed to never change, though it is possible for the underlying
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003351 * user id to be changed. That is, if you are storing information about
3352 * user ids in persistent storage, you should use the string returned
3353 * by this function instead of the raw user-id.
3354 *
3355 * @param uid The user id for which you would like to retrieve a name.
3356 * @return Returns a unique name for the given user id, or null if the
3357 * user id is not currently assigned.
3358 */
Jeff Sharkey377ded0f2016-01-10 13:15:41 -07003359 public abstract @Nullable String getNameForUid(int uid);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003360
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003361 /**
3362 * Return the user id associated with a shared user name. Multiple
3363 * applications can specify a shared user name in their manifest and thus
3364 * end up using a common uid. This might be used for new applications
3365 * that use an existing shared user name and need to know the uid of the
3366 * shared user.
3367 *
3368 * @param sharedUserName The shared user name whose uid is to be retrieved.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003369 * @return Returns the UID associated with the shared user.
3370 * @throws NameNotFoundException if a package with the given name cannot be
3371 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003372 * @hide
3373 */
3374 public abstract int getUidForSharedUser(String sharedUserName)
3375 throws NameNotFoundException;
3376
3377 /**
3378 * Return a List of all application packages that are installed on the
3379 * device. If flag GET_UNINSTALLED_PACKAGES has been set, a list of all
kmccormick30498b42013-03-27 17:39:17 -07003380 * applications including those deleted with {@code DONT_DELETE_DATA} (partially
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003381 * installed apps with data directory) will be returned.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003382 *
3383 * @param flags Additional option flags. Use any combination of
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003384 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003385 * {@link #MATCH_SYSTEM_ONLY}, {@link #MATCH_UNINSTALLED_PACKAGES}
3386 * to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003387 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003388 * @return A List of ApplicationInfo objects, one for each installed application.
3389 * In the unlikely case there are no installed packages, an empty list
3390 * is returned. If flag {@code MATCH_UNINSTALLED_PACKAGES} is set, the
3391 * application information is retrieved from the list of uninstalled
3392 * applications (which includes installed applications as well as
3393 * applications with data directory i.e. applications which had been
3394 * deleted with {@code DONT_DELETE_DATA} flag set).
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003395 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003396 * @see #GET_META_DATA
3397 * @see #GET_SHARED_LIBRARY_FILES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003398 * @see #MATCH_SYSTEM_ONLY
3399 * @see #MATCH_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003400 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003401 public abstract List<ApplicationInfo> getInstalledApplications(@ApplicationInfoFlags int flags);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003402
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003403 /**
Svet Ganov2acf0632015-11-24 19:10:59 -08003404 * Gets the ephemeral applications the user recently used. Requires
3405 * holding "android.permission.ACCESS_EPHEMERAL_APPS".
3406 *
3407 * @return The ephemeral app list.
3408 *
3409 * @hide
3410 */
3411 @RequiresPermission(Manifest.permission.ACCESS_EPHEMERAL_APPS)
3412 public abstract List<EphemeralApplicationInfo> getEphemeralApplications();
3413
3414 /**
3415 * Gets the icon for an ephemeral application.
3416 *
3417 * @param packageName The app package name.
3418 *
3419 * @hide
3420 */
3421 public abstract Drawable getEphemeralApplicationIcon(String packageName);
3422
3423 /**
3424 * Gets whether the caller is an ephemeral app.
3425 *
3426 * @return Whether caller is an ephemeral app.
3427 *
3428 * @see #setEphemeralCookie(byte[])
3429 * @see #getEphemeralCookie()
3430 * @see #getEphemeralCookieMaxSizeBytes()
Todd Kennedy12705132016-01-05 15:17:57 -08003431 *
3432 * @hide
Svet Ganov2acf0632015-11-24 19:10:59 -08003433 */
3434 public abstract boolean isEphemeralApplication();
3435
3436 /**
3437 * Gets the maximum size in bytes of the cookie data an ephemeral app
3438 * can store on the device.
3439 *
3440 * @return The max cookie size in bytes.
3441 *
3442 * @see #isEphemeralApplication()
3443 * @see #setEphemeralCookie(byte[])
3444 * @see #getEphemeralCookie()
Todd Kennedy12705132016-01-05 15:17:57 -08003445 *
3446 * @hide
Svet Ganov2acf0632015-11-24 19:10:59 -08003447 */
3448 public abstract int getEphemeralCookieMaxSizeBytes();
3449
3450 /**
3451 * Gets the ephemeral application cookie for this app. Non
3452 * ephemeral apps and apps that were ephemeral but were upgraded
3453 * to non-ephemeral can still access this API. For ephemeral apps
3454 * this cooke is cached for some time after uninstall while for
3455 * normal apps the cookie is deleted after the app is uninstalled.
3456 * The cookie is always present while the app is installed.
3457 *
3458 * @return The cookie.
3459 *
3460 * @see #isEphemeralApplication()
3461 * @see #setEphemeralCookie(byte[])
3462 * @see #getEphemeralCookieMaxSizeBytes()
Todd Kennedy12705132016-01-05 15:17:57 -08003463 *
3464 * @hide
Svet Ganov2acf0632015-11-24 19:10:59 -08003465 */
3466 public abstract @NonNull byte[] getEphemeralCookie();
3467
3468 /**
3469 * Sets the ephemeral application cookie for the calling app. Non
3470 * ephemeral apps and apps that were ephemeral but were upgraded
3471 * to non-ephemeral can still access this API. For ephemeral apps
3472 * this cooke is cached for some time after uninstall while for
3473 * normal apps the cookie is deleted after the app is uninstalled.
3474 * The cookie is always present while the app is installed. The
3475 * cookie size is limited by {@link #getEphemeralCookieMaxSizeBytes()}.
3476 *
3477 * @param cookie The cookie data.
3478 * @return True if the cookie was set.
3479 *
3480 * @see #isEphemeralApplication()
3481 * @see #getEphemeralCookieMaxSizeBytes()
Jeff Sharkey5aa86932016-01-08 19:07:49 -07003482 * @see #getEphemeralCookie()
Todd Kennedy12705132016-01-05 15:17:57 -08003483 *
3484 * @hide
Svet Ganov2acf0632015-11-24 19:10:59 -08003485 */
3486 public abstract boolean setEphemeralCookie(@NonNull byte[] cookie);
3487
3488 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003489 * Get a list of shared libraries that are available on the
3490 * system.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003491 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003492 * @return An array of shared library names that are
3493 * available on the system, or null if none are installed.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003494 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003495 */
3496 public abstract String[] getSystemSharedLibraryNames();
3497
3498 /**
Svet Ganovd7b1f4112016-02-09 18:49:23 -08003499 * Get the name of the package hosting the services shared library.
3500 *
3501 * @return The library host package.
3502 *
3503 * @hide
3504 */
3505 public abstract @Nullable String getServicesSystemSharedLibraryPackageName();
3506
3507 /**
Dianne Hackborn49237342009-08-27 20:08:01 -07003508 * Get a list of features that are available on the
3509 * system.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003510 *
Dianne Hackborn49237342009-08-27 20:08:01 -07003511 * @return An array of FeatureInfo classes describing the features
3512 * that are available on the system, or null if there are none(!!).
Dianne Hackborn49237342009-08-27 20:08:01 -07003513 */
3514 public abstract FeatureInfo[] getSystemAvailableFeatures();
3515
3516 /**
Jeff Sharkey115d2c12016-02-15 17:25:57 -07003517 * Check whether the given feature name is one of the available features as
3518 * returned by {@link #getSystemAvailableFeatures()}. This tests for the
3519 * presence of <em>any</em> version of the given feature name; use
3520 * {@link #hasSystemFeature(String, int)} to check for a minimum version.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003521 *
Jeff Sharkey115d2c12016-02-15 17:25:57 -07003522 * @return Returns true if the devices supports the feature, else false.
Dianne Hackborn039c68e2009-09-26 16:39:23 -07003523 */
3524 public abstract boolean hasSystemFeature(String name);
3525
3526 /**
Jeff Sharkey115d2c12016-02-15 17:25:57 -07003527 * Check whether the given feature name and version is one of the available
3528 * features as returned by {@link #getSystemAvailableFeatures()}. Since
3529 * features are defined to always be backwards compatible, this returns true
3530 * if the available feature version is greater than or equal to the
3531 * requested version.
3532 *
3533 * @return Returns true if the devices supports the feature, else false.
3534 */
3535 public abstract boolean hasSystemFeature(String name, int version);
3536
3537 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003538 * Determine the best action to perform for a given Intent. This is how
3539 * {@link Intent#resolveActivity} finds an activity if a class has not been
3540 * explicitly specified.
3541 * <p>
3542 * <em>Note:</em> if using an implicit Intent (without an explicit
3543 * ComponentName specified), be sure to consider whether to set the
3544 * {@link #MATCH_DEFAULT_ONLY} only flag. You need to do so to resolve the
3545 * activity in the same way that
3546 * {@link android.content.Context#startActivity(Intent)} and
Dianne Hackborn4d023d212010-10-01 13:41:04 -07003547 * {@link android.content.Intent#resolveActivity(PackageManager)
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003548 * Intent.resolveActivity(PackageManager)} do.
3549 * </p>
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003550 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003551 * @param intent An intent containing all of the desired specification
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003552 * (action, data, type, category, and/or component).
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003553 * @param flags Additional option flags. Use any combination of
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003554 * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER},
3555 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL},
3556 * {@link #MATCH_DISABLED_COMPONENTS},
3557 * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
3558 * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_DIRECT_BOOT_AWARE},
3559 * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY}
3560 * or {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data
3561 * returned. The most important is {@link #MATCH_DEFAULT_ONLY},
3562 * to limit the resolution to only those activities that support
3563 * the {@link android.content.Intent#CATEGORY_DEFAULT}.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003564 * @return Returns a ResolveInfo object containing the final activity intent
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003565 * that was determined to be the best action. Returns null if no
Mike LeBeaubd3f5272010-02-18 19:27:17 -08003566 * matching activity was found. If multiple matching activities are
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003567 * found and there is no default set, returns a ResolveInfo object
Mike LeBeaubd3f5272010-02-18 19:27:17 -08003568 * containing something else, such as the activity resolver.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003569 * @see #GET_META_DATA
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003570 * @see #GET_RESOLVED_FILTER
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003571 * @see #GET_SHARED_LIBRARY_FILES
3572 * @see #MATCH_ALL
3573 * @see #MATCH_DISABLED_COMPONENTS
3574 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
3575 * @see #MATCH_DEFAULT_ONLY
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003576 * @see #MATCH_DIRECT_BOOT_AWARE
3577 * @see #MATCH_DIRECT_BOOT_UNAWARE
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003578 * @see #MATCH_SYSTEM_ONLY
3579 * @see #MATCH_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003580 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003581 public abstract ResolveInfo resolveActivity(Intent intent, @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003582
3583 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003584 * Determine the best action to perform for a given Intent for a given user.
3585 * This is how {@link Intent#resolveActivity} finds an activity if a class
3586 * has not been explicitly specified.
3587 * <p>
3588 * <em>Note:</em> if using an implicit Intent (without an explicit
3589 * ComponentName specified), be sure to consider whether to set the
3590 * {@link #MATCH_DEFAULT_ONLY} only flag. You need to do so to resolve the
3591 * activity in the same way that
3592 * {@link android.content.Context#startActivity(Intent)} and
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07003593 * {@link android.content.Intent#resolveActivity(PackageManager)
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003594 * Intent.resolveActivity(PackageManager)} do.
3595 * </p>
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07003596 *
3597 * @param intent An intent containing all of the desired specification
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003598 * (action, data, type, category, and/or component).
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003599 * @param flags Additional option flags. Use any combination of
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003600 * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER},
3601 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL},
3602 * {@link #MATCH_DISABLED_COMPONENTS},
3603 * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
3604 * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_DIRECT_BOOT_AWARE},
3605 * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY}
3606 * or {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data
3607 * returned. The most important is {@link #MATCH_DEFAULT_ONLY},
3608 * to limit the resolution to only those activities that support
3609 * the {@link android.content.Intent#CATEGORY_DEFAULT}.
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07003610 * @param userId The user id.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003611 * @return Returns a ResolveInfo object containing the final activity intent
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003612 * that was determined to be the best action. Returns null if no
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07003613 * matching activity was found. If multiple matching activities are
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003614 * found and there is no default set, returns a ResolveInfo object
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07003615 * containing something else, such as the activity resolver.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003616 * @see #GET_META_DATA
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07003617 * @see #GET_RESOLVED_FILTER
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003618 * @see #GET_SHARED_LIBRARY_FILES
3619 * @see #MATCH_ALL
3620 * @see #MATCH_DISABLED_COMPONENTS
3621 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
3622 * @see #MATCH_DEFAULT_ONLY
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003623 * @see #MATCH_DIRECT_BOOT_AWARE
3624 * @see #MATCH_DIRECT_BOOT_UNAWARE
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003625 * @see #MATCH_SYSTEM_ONLY
3626 * @see #MATCH_UNINSTALLED_PACKAGES
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07003627 * @hide
3628 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003629 public abstract ResolveInfo resolveActivityAsUser(Intent intent, @ResolveInfoFlags int flags,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003630 @UserIdInt int userId);
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07003631
3632 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003633 * Retrieve all activities that can be performed for the given intent.
3634 *
3635 * @param intent The desired intent as per resolveActivity().
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003636 * @param flags Additional option flags. Use any combination of
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003637 * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER},
3638 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL},
3639 * {@link #MATCH_DISABLED_COMPONENTS},
3640 * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
3641 * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_DIRECT_BOOT_AWARE},
3642 * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY}
3643 * or {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data
3644 * returned. The most important is {@link #MATCH_DEFAULT_ONLY},
3645 * to limit the resolution to only those activities that support
3646 * the {@link android.content.Intent#CATEGORY_DEFAULT}. Or, set
3647 * {@link #MATCH_ALL} to prevent any filtering of the results.
3648 * @return Returns a List of ResolveInfo objects containing one entry for
3649 * each matching activity, ordered from best to worst. In other
3650 * words, the first item is what would be returned by
3651 * {@link #resolveActivity}. If there are no matching activities, an
3652 * empty list is returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003653 * @see #GET_META_DATA
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003654 * @see #GET_RESOLVED_FILTER
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003655 * @see #GET_SHARED_LIBRARY_FILES
3656 * @see #MATCH_ALL
3657 * @see #MATCH_DISABLED_COMPONENTS
3658 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
3659 * @see #MATCH_DEFAULT_ONLY
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003660 * @see #MATCH_DIRECT_BOOT_AWARE
3661 * @see #MATCH_DIRECT_BOOT_UNAWARE
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003662 * @see #MATCH_SYSTEM_ONLY
3663 * @see #MATCH_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003664 */
3665 public abstract List<ResolveInfo> queryIntentActivities(Intent intent,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003666 @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003667
3668 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003669 * Retrieve all activities that can be performed for the given intent, for a
3670 * specific user.
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003671 *
3672 * @param intent The desired intent as per resolveActivity().
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003673 * @param flags Additional option flags. Use any combination of
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003674 * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER},
3675 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL},
3676 * {@link #MATCH_DISABLED_COMPONENTS},
3677 * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
3678 * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_DIRECT_BOOT_AWARE},
3679 * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY}
3680 * or {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data
3681 * returned. The most important is {@link #MATCH_DEFAULT_ONLY},
3682 * to limit the resolution to only those activities that support
3683 * the {@link android.content.Intent#CATEGORY_DEFAULT}. Or, set
3684 * {@link #MATCH_ALL} to prevent any filtering of the results.
3685 * @return Returns a List of ResolveInfo objects containing one entry for
3686 * each matching activity, ordered from best to worst. In other
3687 * words, the first item is what would be returned by
3688 * {@link #resolveActivity}. If there are no matching activities, an
3689 * empty list is returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003690 * @see #GET_META_DATA
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003691 * @see #GET_RESOLVED_FILTER
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003692 * @see #GET_SHARED_LIBRARY_FILES
3693 * @see #MATCH_ALL
3694 * @see #MATCH_DISABLED_COMPONENTS
3695 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
3696 * @see #MATCH_DEFAULT_ONLY
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003697 * @see #MATCH_DIRECT_BOOT_AWARE
3698 * @see #MATCH_DIRECT_BOOT_UNAWARE
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003699 * @see #MATCH_SYSTEM_ONLY
3700 * @see #MATCH_UNINSTALLED_PACKAGES
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003701 * @hide
3702 */
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07003703 public abstract List<ResolveInfo> queryIntentActivitiesAsUser(Intent intent,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003704 @ResolveInfoFlags int flags, @UserIdInt int userId);
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003705
3706 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003707 * Retrieve a set of activities that should be presented to the user as
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003708 * similar options. This is like {@link #queryIntentActivities}, except it
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003709 * also allows you to supply a list of more explicit Intents that you would
3710 * like to resolve to particular options, and takes care of returning the
3711 * final ResolveInfo list in a reasonable order, with no duplicates, based
3712 * on those inputs.
3713 *
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003714 * @param caller The class name of the activity that is making the request.
3715 * This activity will never appear in the output list. Can be
3716 * null.
3717 * @param specifics An array of Intents that should be resolved to the first
3718 * specific results. Can be null.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003719 * @param intent The desired intent as per resolveActivity().
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003720 * @param flags Additional option flags. Use any combination of
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003721 * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER},
3722 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL},
3723 * {@link #MATCH_DISABLED_COMPONENTS},
3724 * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
3725 * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_DIRECT_BOOT_AWARE},
3726 * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY}
3727 * or {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data
3728 * returned. The most important is {@link #MATCH_DEFAULT_ONLY},
3729 * to limit the resolution to only those activities that support
3730 * the {@link android.content.Intent#CATEGORY_DEFAULT}.
3731 * @return Returns a List of ResolveInfo objects containing one entry for
3732 * each matching activity. The list is ordered first by all of the
3733 * intents resolved in <var>specifics</var> and then any additional
3734 * activities that can handle <var>intent</var> but did not get
3735 * included by one of the <var>specifics</var> intents. If there are
3736 * no matching activities, an empty list is returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003737 * @see #GET_META_DATA
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003738 * @see #GET_RESOLVED_FILTER
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003739 * @see #GET_SHARED_LIBRARY_FILES
3740 * @see #MATCH_ALL
3741 * @see #MATCH_DISABLED_COMPONENTS
3742 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
3743 * @see #MATCH_DEFAULT_ONLY
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003744 * @see #MATCH_DIRECT_BOOT_AWARE
3745 * @see #MATCH_DIRECT_BOOT_UNAWARE
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003746 * @see #MATCH_SYSTEM_ONLY
3747 * @see #MATCH_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003748 */
3749 public abstract List<ResolveInfo> queryIntentActivityOptions(
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003750 ComponentName caller, Intent[] specifics, Intent intent, @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003751
3752 /**
3753 * Retrieve all receivers that can handle a broadcast of the given intent.
3754 *
3755 * @param intent The desired intent as per resolveActivity().
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003756 * @param flags Additional option flags. Use any combination of
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003757 * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER},
3758 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL},
3759 * {@link #MATCH_DISABLED_COMPONENTS},
3760 * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
3761 * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_DIRECT_BOOT_AWARE},
3762 * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY}
3763 * or {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data
3764 * returned.
3765 * @return Returns a List of ResolveInfo objects containing one entry for
3766 * each matching receiver, ordered from best to worst. If there are
3767 * no matching receivers, an empty list or null is returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003768 * @see #GET_META_DATA
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003769 * @see #GET_RESOLVED_FILTER
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003770 * @see #GET_SHARED_LIBRARY_FILES
3771 * @see #MATCH_ALL
3772 * @see #MATCH_DISABLED_COMPONENTS
3773 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
3774 * @see #MATCH_DEFAULT_ONLY
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003775 * @see #MATCH_DIRECT_BOOT_AWARE
3776 * @see #MATCH_DIRECT_BOOT_UNAWARE
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003777 * @see #MATCH_SYSTEM_ONLY
3778 * @see #MATCH_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003779 */
3780 public abstract List<ResolveInfo> queryBroadcastReceivers(Intent intent,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003781 @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003782
3783 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003784 * Retrieve all receivers that can handle a broadcast of the given intent,
3785 * for a specific user.
Amith Yamasanif203aee2012-08-29 18:41:53 -07003786 *
3787 * @param intent The desired intent as per resolveActivity().
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003788 * @param flags Additional option flags. Use any combination of
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003789 * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER},
3790 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL},
3791 * {@link #MATCH_DISABLED_COMPONENTS},
3792 * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
3793 * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_DIRECT_BOOT_AWARE},
3794 * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY}
3795 * or {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data
3796 * returned.
Fyodor Kupolov940e8572016-01-26 12:03:51 -08003797 * @param userHandle UserHandle of the user being queried.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003798 * @return Returns a List of ResolveInfo objects containing one entry for
3799 * each matching receiver, ordered from best to worst. If there are
3800 * no matching receivers, an empty list or null is returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003801 * @see #GET_META_DATA
Amith Yamasanif203aee2012-08-29 18:41:53 -07003802 * @see #GET_RESOLVED_FILTER
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003803 * @see #GET_SHARED_LIBRARY_FILES
3804 * @see #MATCH_ALL
3805 * @see #MATCH_DISABLED_COMPONENTS
3806 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
3807 * @see #MATCH_DEFAULT_ONLY
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003808 * @see #MATCH_DIRECT_BOOT_AWARE
3809 * @see #MATCH_DIRECT_BOOT_UNAWARE
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003810 * @see #MATCH_SYSTEM_ONLY
3811 * @see #MATCH_UNINSTALLED_PACKAGES
Amith Yamasanif203aee2012-08-29 18:41:53 -07003812 * @hide
3813 */
Fyodor Kupolov940e8572016-01-26 12:03:51 -08003814 @SystemApi
3815 public List<ResolveInfo> queryBroadcastReceiversAsUser(Intent intent,
3816 @ResolveInfoFlags int flags, UserHandle userHandle) {
3817 return queryBroadcastReceiversAsUser(intent, flags, userHandle.getIdentifier());
3818 }
3819
3820 /**
3821 * @hide
3822 */
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07003823 public abstract List<ResolveInfo> queryBroadcastReceiversAsUser(Intent intent,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003824 @ResolveInfoFlags int flags, @UserIdInt int userId);
Amith Yamasanif203aee2012-08-29 18:41:53 -07003825
Fyodor Kupolov940e8572016-01-26 12:03:51 -08003826
Jeff Sharkeybd940222016-01-08 11:07:13 -07003827 /** {@hide} */
3828 @Deprecated
3829 public List<ResolveInfo> queryBroadcastReceivers(Intent intent,
3830 @ResolveInfoFlags int flags, @UserIdInt int userId) {
3831 Log.w(TAG, "STAHP USING HIDDEN APIS KTHX");
3832 return queryBroadcastReceiversAsUser(intent, flags, userId);
3833 }
3834
Amith Yamasanif203aee2012-08-29 18:41:53 -07003835 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003836 * Determine the best service to handle for a given Intent.
3837 *
3838 * @param intent An intent containing all of the desired specification
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003839 * (action, data, type, category, and/or component).
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003840 * @param flags Additional option flags. Use any combination of
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003841 * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER},
3842 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL},
3843 * {@link #MATCH_DISABLED_COMPONENTS},
3844 * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
3845 * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_DIRECT_BOOT_AWARE},
3846 * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY}
3847 * or {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data
3848 * returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003849 * @return Returns a ResolveInfo object containing the final service intent
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003850 * that was determined to be the best action. Returns null if no
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003851 * matching service was found.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003852 * @see #GET_META_DATA
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003853 * @see #GET_RESOLVED_FILTER
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003854 * @see #GET_SHARED_LIBRARY_FILES
3855 * @see #MATCH_ALL
3856 * @see #MATCH_DISABLED_COMPONENTS
3857 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
3858 * @see #MATCH_DEFAULT_ONLY
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003859 * @see #MATCH_DIRECT_BOOT_AWARE
3860 * @see #MATCH_DIRECT_BOOT_UNAWARE
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003861 * @see #MATCH_SYSTEM_ONLY
3862 * @see #MATCH_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003863 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003864 public abstract ResolveInfo resolveService(Intent intent, @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003865
3866 /**
3867 * Retrieve all services that can match the given intent.
3868 *
3869 * @param intent The desired intent as per resolveService().
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003870 * @param flags Additional option flags. Use any combination of
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003871 * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER},
3872 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL},
3873 * {@link #MATCH_DISABLED_COMPONENTS},
3874 * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
3875 * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_DIRECT_BOOT_AWARE},
3876 * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY}
3877 * or {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data
3878 * returned.
3879 * @return Returns a List of ResolveInfo objects containing one entry for
3880 * each matching service, ordered from best to worst. In other
3881 * words, the first item is what would be returned by
3882 * {@link #resolveService}. If there are no matching services, an
3883 * empty list or null is returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003884 * @see #GET_META_DATA
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003885 * @see #GET_RESOLVED_FILTER
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003886 * @see #GET_SHARED_LIBRARY_FILES
3887 * @see #MATCH_ALL
3888 * @see #MATCH_DISABLED_COMPONENTS
3889 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
3890 * @see #MATCH_DEFAULT_ONLY
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003891 * @see #MATCH_DIRECT_BOOT_AWARE
3892 * @see #MATCH_DIRECT_BOOT_UNAWARE
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003893 * @see #MATCH_SYSTEM_ONLY
3894 * @see #MATCH_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003895 */
3896 public abstract List<ResolveInfo> queryIntentServices(Intent intent,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003897 @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003898
3899 /**
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07003900 * Retrieve all services that can match the given intent for a given user.
3901 *
3902 * @param intent The desired intent as per resolveService().
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003903 * @param flags Additional option flags. Use any combination of
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003904 * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER},
3905 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL},
3906 * {@link #MATCH_DISABLED_COMPONENTS},
3907 * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
3908 * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_DIRECT_BOOT_AWARE},
3909 * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY}
3910 * or {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data
3911 * returned.
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07003912 * @param userId The user id.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003913 * @return Returns a List of ResolveInfo objects containing one entry for
3914 * each matching service, ordered from best to worst. In other
3915 * words, the first item is what would be returned by
3916 * {@link #resolveService}. If there are no matching services, an
3917 * empty list or null is returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003918 * @see #GET_META_DATA
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07003919 * @see #GET_RESOLVED_FILTER
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003920 * @see #GET_SHARED_LIBRARY_FILES
3921 * @see #MATCH_ALL
3922 * @see #MATCH_DISABLED_COMPONENTS
3923 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
3924 * @see #MATCH_DEFAULT_ONLY
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003925 * @see #MATCH_DIRECT_BOOT_AWARE
3926 * @see #MATCH_DIRECT_BOOT_UNAWARE
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003927 * @see #MATCH_SYSTEM_ONLY
3928 * @see #MATCH_UNINSTALLED_PACKAGES
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07003929 * @hide
3930 */
3931 public abstract List<ResolveInfo> queryIntentServicesAsUser(Intent intent,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003932 @ResolveInfoFlags int flags, @UserIdInt int userId);
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07003933
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003934 /**
3935 * Retrieve all providers that can match the given intent.
3936 *
3937 * @param intent An intent containing all of the desired specification
3938 * (action, data, type, category, and/or component).
3939 * @param flags Additional option flags. Use any combination of
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003940 * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER},
3941 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL},
3942 * {@link #MATCH_DISABLED_COMPONENTS},
3943 * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
3944 * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_DIRECT_BOOT_AWARE},
3945 * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY}
3946 * or {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data
3947 * returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003948 * @param userId The user id.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003949 * @return Returns a List of ResolveInfo objects containing one entry for
3950 * each matching provider, ordered from best to worst. If there are
3951 * no matching services, an empty list or null is returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003952 * @see #GET_META_DATA
3953 * @see #GET_RESOLVED_FILTER
3954 * @see #GET_SHARED_LIBRARY_FILES
3955 * @see #MATCH_ALL
3956 * @see #MATCH_DISABLED_COMPONENTS
3957 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
3958 * @see #MATCH_DEFAULT_ONLY
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003959 * @see #MATCH_DIRECT_BOOT_AWARE
3960 * @see #MATCH_DIRECT_BOOT_UNAWARE
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003961 * @see #MATCH_SYSTEM_ONLY
3962 * @see #MATCH_UNINSTALLED_PACKAGES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003963 * @hide
3964 */
Jeff Sharkey85f5f812013-10-07 10:16:12 -07003965 public abstract List<ResolveInfo> queryIntentContentProvidersAsUser(
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003966 Intent intent, @ResolveInfoFlags int flags, @UserIdInt int userId);
Jeff Sharkey85f5f812013-10-07 10:16:12 -07003967
3968 /**
3969 * Retrieve all providers that can match the given intent.
3970 *
3971 * @param intent An intent containing all of the desired specification
3972 * (action, data, type, category, and/or component).
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003973 * @param flags Additional option flags. Use any combination of
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003974 * {@link #GET_META_DATA}, {@link #GET_RESOLVED_FILTER},
3975 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #MATCH_ALL},
3976 * {@link #MATCH_DISABLED_COMPONENTS},
3977 * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
3978 * {@link #MATCH_DEFAULT_ONLY}, {@link #MATCH_DIRECT_BOOT_AWARE},
3979 * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY}
3980 * or {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data
3981 * returned.
3982 * @return Returns a List of ResolveInfo objects containing one entry for
3983 * each matching provider, ordered from best to worst. If there are
3984 * no matching services, an empty list or null is returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003985 * @see #GET_META_DATA
Jeff Sharkey85f5f812013-10-07 10:16:12 -07003986 * @see #GET_RESOLVED_FILTER
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003987 * @see #GET_SHARED_LIBRARY_FILES
3988 * @see #MATCH_ALL
3989 * @see #MATCH_DISABLED_COMPONENTS
3990 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
3991 * @see #MATCH_DEFAULT_ONLY
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003992 * @see #MATCH_DIRECT_BOOT_AWARE
3993 * @see #MATCH_DIRECT_BOOT_UNAWARE
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003994 * @see #MATCH_SYSTEM_ONLY
3995 * @see #MATCH_UNINSTALLED_PACKAGES
Jeff Sharkey85f5f812013-10-07 10:16:12 -07003996 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003997 public abstract List<ResolveInfo> queryIntentContentProviders(Intent intent,
3998 @ResolveInfoFlags int flags);
Jeff Sharkey85f5f812013-10-07 10:16:12 -07003999
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004000 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004001 * Find a single content provider by its base path name.
4002 *
4003 * @param name The name of the provider to find.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004004 * @param flags Additional option flags. Use any combination of
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004005 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
4006 * {@link #MATCH_ALL}, {@link #MATCH_DEFAULT_ONLY},
4007 * {@link #MATCH_DISABLED_COMPONENTS},
4008 * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
4009 * {@link #MATCH_DIRECT_BOOT_AWARE},
4010 * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY}
4011 * or {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data
4012 * returned.
4013 * @return A {@link ProviderInfo} object containing information about the
4014 * provider. If a provider was not found, returns null.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004015 * @see #GET_META_DATA
4016 * @see #GET_SHARED_LIBRARY_FILES
4017 * @see #MATCH_ALL
4018 * @see #MATCH_DEBUG_TRIAGED_MISSING
4019 * @see #MATCH_DEFAULT_ONLY
4020 * @see #MATCH_DISABLED_COMPONENTS
4021 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004022 * @see #MATCH_DIRECT_BOOT_AWARE
4023 * @see #MATCH_DIRECT_BOOT_UNAWARE
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004024 * @see #MATCH_SYSTEM_ONLY
4025 * @see #MATCH_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004026 */
4027 public abstract ProviderInfo resolveContentProvider(String name,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004028 @ComponentInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004029
4030 /**
Alexandra Gherghina0363c3e2014-06-23 13:34:59 +01004031 * Find a single content provider by its base path name.
4032 *
4033 * @param name The name of the provider to find.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004034 * @param flags Additional option flags. Use any combination of
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004035 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
4036 * {@link #MATCH_ALL}, {@link #MATCH_DEFAULT_ONLY},
4037 * {@link #MATCH_DISABLED_COMPONENTS},
4038 * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
4039 * {@link #MATCH_DIRECT_BOOT_AWARE},
4040 * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY}
4041 * or {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data
4042 * returned.
Alexandra Gherghina0363c3e2014-06-23 13:34:59 +01004043 * @param userId The user id.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004044 * @return A {@link ProviderInfo} object containing information about the
4045 * provider. If a provider was not found, returns null.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004046 * @see #GET_META_DATA
4047 * @see #GET_SHARED_LIBRARY_FILES
4048 * @see #MATCH_ALL
4049 * @see #MATCH_DEBUG_TRIAGED_MISSING
4050 * @see #MATCH_DEFAULT_ONLY
4051 * @see #MATCH_DISABLED_COMPONENTS
4052 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004053 * @see #MATCH_DIRECT_BOOT_AWARE
4054 * @see #MATCH_DIRECT_BOOT_UNAWARE
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004055 * @see #MATCH_SYSTEM_ONLY
4056 * @see #MATCH_UNINSTALLED_PACKAGES
Alexandra Gherghina0363c3e2014-06-23 13:34:59 +01004057 * @hide
4058 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004059 public abstract ProviderInfo resolveContentProviderAsUser(String name,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004060 @ComponentInfoFlags int flags, @UserIdInt int userId);
Alexandra Gherghina0363c3e2014-06-23 13:34:59 +01004061
4062 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004063 * Retrieve content provider information.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004064 * <p>
4065 * <em>Note: unlike most other methods, an empty result set is indicated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004066 * by a null return instead of an empty list.</em>
4067 *
4068 * @param processName If non-null, limits the returned providers to only
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004069 * those that are hosted by the given process. If null, all
4070 * content providers are returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004071 * @param uid If <var>processName</var> is non-null, this is the required
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004072 * uid owning the requested content providers.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004073 * @param flags Additional option flags. Use any combination of
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004074 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
4075 * {@link #MATCH_ALL}, {@link #MATCH_DEFAULT_ONLY},
4076 * {@link #MATCH_DISABLED_COMPONENTS},
4077 * {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
4078 * {@link #MATCH_DIRECT_BOOT_AWARE},
4079 * {@link #MATCH_DIRECT_BOOT_UNAWARE}, {@link #MATCH_SYSTEM_ONLY}
4080 * or {@link #MATCH_UNINSTALLED_PACKAGES} to modify the data
4081 * returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004082 * @return A list of {@link ProviderInfo} objects containing one entry for
4083 * each provider either matching <var>processName</var> or, if
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004084 * <var>processName</var> is null, all known content providers.
4085 * <em>If there are no matching providers, null is returned.</em>
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004086 * @see #GET_META_DATA
4087 * @see #GET_SHARED_LIBRARY_FILES
4088 * @see #MATCH_ALL
4089 * @see #MATCH_DEBUG_TRIAGED_MISSING
4090 * @see #MATCH_DEFAULT_ONLY
4091 * @see #MATCH_DISABLED_COMPONENTS
4092 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004093 * @see #MATCH_DIRECT_BOOT_AWARE
4094 * @see #MATCH_DIRECT_BOOT_UNAWARE
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004095 * @see #MATCH_SYSTEM_ONLY
4096 * @see #MATCH_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004097 */
4098 public abstract List<ProviderInfo> queryContentProviders(
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004099 String processName, int uid, @ComponentInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004100
4101 /**
4102 * Retrieve all of the information we know about a particular
4103 * instrumentation class.
4104 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004105 * @param className The full name (i.e.
4106 * com.google.apps.contacts.InstrumentList) of an
4107 * Instrumentation class.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004108 * @param flags Additional option flags. Use any combination of
4109 * {@link #GET_META_DATA}
4110 * to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004111 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004112 * @return An {@link InstrumentationInfo} object containing information about the
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004113 * instrumentation.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004114 * @throws NameNotFoundException if a package with the given name cannot be
4115 * found on the system.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004116 *
4117 * @see #GET_META_DATA
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004118 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004119 public abstract InstrumentationInfo getInstrumentationInfo(ComponentName className,
4120 @InstrumentationInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004121
4122 /**
4123 * Retrieve information about available instrumentation code. May be used
4124 * to retrieve either all instrumentation code, or only the code targeting
4125 * a particular package.
4126 *
4127 * @param targetPackage If null, all instrumentation is returned; only the
4128 * instrumentation targeting this package name is
4129 * returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004130 * @param flags Additional option flags. Use any combination of
4131 * {@link #GET_META_DATA}
4132 * to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004133 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004134 * @return A list of {@link InstrumentationInfo} objects containing one
4135 * entry for each matching instrumentation. If there are no
Jesse Hallf77a34f2016-02-04 18:41:33 -08004136 * instrumentation available, returns an empty list.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004137 *
4138 * @see #GET_META_DATA
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004139 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004140 public abstract List<InstrumentationInfo> queryInstrumentation(String targetPackage,
4141 @InstrumentationInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004142
4143 /**
4144 * Retrieve an image from a package. This is a low-level API used by
4145 * the various package manager info structures (such as
4146 * {@link ComponentInfo} to implement retrieval of their associated
4147 * icon.
4148 *
4149 * @param packageName The name of the package that this icon is coming from.
kmccormick30498b42013-03-27 17:39:17 -07004150 * Cannot be null.
4151 * @param resid The resource identifier of the desired image. Cannot be 0.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004152 * @param appInfo Overall information about <var>packageName</var>. This
4153 * may be null, in which case the application information will be retrieved
4154 * for you if needed; if you already have this information around, it can
4155 * be much more efficient to supply it here.
4156 *
4157 * @return Returns a Drawable holding the requested image. Returns null if
4158 * an image could not be found for any reason.
4159 */
Tor Norbye7b9c9122013-05-30 16:48:33 -07004160 public abstract Drawable getDrawable(String packageName, @DrawableRes int resid,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004161 ApplicationInfo appInfo);
4162
4163 /**
4164 * Retrieve the icon associated with an activity. Given the full name of
4165 * an activity, retrieves the information about it and calls
4166 * {@link ComponentInfo#loadIcon ComponentInfo.loadIcon()} to return its icon.
kmccormick30498b42013-03-27 17:39:17 -07004167 * If the activity cannot be found, NameNotFoundException is thrown.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004168 *
4169 * @param activityName Name of the activity whose icon is to be retrieved.
4170 *
4171 * @return Returns the image of the icon, or the default activity icon if
4172 * it could not be found. Does not return null.
4173 * @throws NameNotFoundException Thrown if the resources for the given
4174 * activity could not be loaded.
4175 *
4176 * @see #getActivityIcon(Intent)
4177 */
4178 public abstract Drawable getActivityIcon(ComponentName activityName)
4179 throws NameNotFoundException;
4180
4181 /**
4182 * Retrieve the icon associated with an Intent. If intent.getClassName() is
4183 * set, this simply returns the result of
4184 * getActivityIcon(intent.getClassName()). Otherwise it resolves the intent's
4185 * component and returns the icon associated with the resolved component.
kmccormick30498b42013-03-27 17:39:17 -07004186 * If intent.getClassName() cannot be found or the Intent cannot be resolved
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004187 * to a component, NameNotFoundException is thrown.
4188 *
4189 * @param intent The intent for which you would like to retrieve an icon.
4190 *
4191 * @return Returns the image of the icon, or the default activity icon if
4192 * it could not be found. Does not return null.
4193 * @throws NameNotFoundException Thrown if the resources for application
4194 * matching the given intent could not be loaded.
4195 *
4196 * @see #getActivityIcon(ComponentName)
4197 */
4198 public abstract Drawable getActivityIcon(Intent intent)
4199 throws NameNotFoundException;
4200
4201 /**
Jose Limaf78e3122014-03-06 12:13:15 -08004202 * Retrieve the banner associated with an activity. Given the full name of
4203 * an activity, retrieves the information about it and calls
4204 * {@link ComponentInfo#loadIcon ComponentInfo.loadIcon()} to return its
4205 * banner. If the activity cannot be found, NameNotFoundException is thrown.
4206 *
4207 * @param activityName Name of the activity whose banner is to be retrieved.
4208 * @return Returns the image of the banner, or null if the activity has no
4209 * banner specified.
4210 * @throws NameNotFoundException Thrown if the resources for the given
4211 * activity could not be loaded.
4212 * @see #getActivityBanner(Intent)
4213 */
4214 public abstract Drawable getActivityBanner(ComponentName activityName)
4215 throws NameNotFoundException;
4216
4217 /**
4218 * Retrieve the banner associated with an Intent. If intent.getClassName()
4219 * is set, this simply returns the result of
4220 * getActivityBanner(intent.getClassName()). Otherwise it resolves the
4221 * intent's component and returns the banner associated with the resolved
4222 * component. If intent.getClassName() cannot be found or the Intent cannot
4223 * be resolved to a component, NameNotFoundException is thrown.
4224 *
4225 * @param intent The intent for which you would like to retrieve a banner.
4226 * @return Returns the image of the banner, or null if the activity has no
4227 * banner specified.
4228 * @throws NameNotFoundException Thrown if the resources for application
4229 * matching the given intent could not be loaded.
4230 * @see #getActivityBanner(ComponentName)
4231 */
4232 public abstract Drawable getActivityBanner(Intent intent)
4233 throws NameNotFoundException;
4234
4235 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004236 * Return the generic icon for an activity that is used when no specific
4237 * icon is defined.
Adam Connors23cc04e2014-04-01 12:12:20 +01004238 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004239 * @return Drawable Image of the icon.
4240 */
4241 public abstract Drawable getDefaultActivityIcon();
4242
4243 /**
4244 * Retrieve the icon associated with an application. If it has not defined
4245 * an icon, the default app icon is returned. Does not return null.
4246 *
4247 * @param info Information about application being queried.
4248 *
4249 * @return Returns the image of the icon, or the default application icon
4250 * if it could not be found.
4251 *
4252 * @see #getApplicationIcon(String)
4253 */
4254 public abstract Drawable getApplicationIcon(ApplicationInfo info);
4255
4256 /**
4257 * Retrieve the icon associated with an application. Given the name of the
4258 * application's package, retrieves the information about it and calls
kmccormick30498b42013-03-27 17:39:17 -07004259 * getApplicationIcon() to return its icon. If the application cannot be
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004260 * found, NameNotFoundException is thrown.
4261 *
4262 * @param packageName Name of the package whose application icon is to be
4263 * retrieved.
4264 *
4265 * @return Returns the image of the icon, or the default application icon
4266 * if it could not be found. Does not return null.
4267 * @throws NameNotFoundException Thrown if the resources for the given
4268 * application could not be loaded.
4269 *
4270 * @see #getApplicationIcon(ApplicationInfo)
4271 */
4272 public abstract Drawable getApplicationIcon(String packageName)
4273 throws NameNotFoundException;
4274
4275 /**
Jose Limaf78e3122014-03-06 12:13:15 -08004276 * Retrieve the banner associated with an application.
4277 *
4278 * @param info Information about application being queried.
4279 * @return Returns the image of the banner or null if the application has no
4280 * banner specified.
4281 * @see #getApplicationBanner(String)
4282 */
4283 public abstract Drawable getApplicationBanner(ApplicationInfo info);
4284
4285 /**
4286 * Retrieve the banner associated with an application. Given the name of the
4287 * application's package, retrieves the information about it and calls
4288 * getApplicationIcon() to return its banner. If the application cannot be
4289 * found, NameNotFoundException is thrown.
4290 *
4291 * @param packageName Name of the package whose application banner is to be
4292 * retrieved.
4293 * @return Returns the image of the banner or null if the application has no
4294 * banner specified.
4295 * @throws NameNotFoundException Thrown if the resources for the given
4296 * application could not be loaded.
4297 * @see #getApplicationBanner(ApplicationInfo)
4298 */
4299 public abstract Drawable getApplicationBanner(String packageName)
4300 throws NameNotFoundException;
4301
4302 /**
4303 * Retrieve the logo associated with an activity. Given the full name of an
4304 * activity, retrieves the information about it and calls
4305 * {@link ComponentInfo#loadLogo ComponentInfo.loadLogo()} to return its
4306 * logo. If the activity cannot be found, NameNotFoundException is thrown.
Adam Powell81cd2e92010-04-21 16:35:18 -07004307 *
4308 * @param activityName Name of the activity whose logo is to be retrieved.
Jose Limaf78e3122014-03-06 12:13:15 -08004309 * @return Returns the image of the logo or null if the activity has no logo
4310 * specified.
Adam Powell81cd2e92010-04-21 16:35:18 -07004311 * @throws NameNotFoundException Thrown if the resources for the given
Jose Limaf78e3122014-03-06 12:13:15 -08004312 * activity could not be loaded.
Adam Powell81cd2e92010-04-21 16:35:18 -07004313 * @see #getActivityLogo(Intent)
4314 */
4315 public abstract Drawable getActivityLogo(ComponentName activityName)
4316 throws NameNotFoundException;
4317
4318 /**
4319 * Retrieve the logo associated with an Intent. If intent.getClassName() is
4320 * set, this simply returns the result of
4321 * getActivityLogo(intent.getClassName()). Otherwise it resolves the intent's
4322 * component and returns the logo associated with the resolved component.
kmccormick30498b42013-03-27 17:39:17 -07004323 * If intent.getClassName() cannot be found or the Intent cannot be resolved
Adam Powell81cd2e92010-04-21 16:35:18 -07004324 * to a component, NameNotFoundException is thrown.
4325 *
4326 * @param intent The intent for which you would like to retrieve a logo.
4327 *
4328 * @return Returns the image of the logo, or null if the activity has no
4329 * logo specified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004330 *
Adam Powell81cd2e92010-04-21 16:35:18 -07004331 * @throws NameNotFoundException Thrown if the resources for application
4332 * matching the given intent could not be loaded.
4333 *
4334 * @see #getActivityLogo(ComponentName)
4335 */
4336 public abstract Drawable getActivityLogo(Intent intent)
4337 throws NameNotFoundException;
4338
4339 /**
4340 * Retrieve the logo associated with an application. If it has not specified
4341 * a logo, this method returns null.
4342 *
4343 * @param info Information about application being queried.
4344 *
4345 * @return Returns the image of the logo, or null if no logo is specified
4346 * by the application.
4347 *
4348 * @see #getApplicationLogo(String)
4349 */
4350 public abstract Drawable getApplicationLogo(ApplicationInfo info);
4351
4352 /**
4353 * Retrieve the logo associated with an application. Given the name of the
4354 * application's package, retrieves the information about it and calls
kmccormick30498b42013-03-27 17:39:17 -07004355 * getApplicationLogo() to return its logo. If the application cannot be
Adam Powell81cd2e92010-04-21 16:35:18 -07004356 * found, NameNotFoundException is thrown.
4357 *
4358 * @param packageName Name of the package whose application logo is to be
4359 * retrieved.
4360 *
4361 * @return Returns the image of the logo, or null if no application logo
4362 * has been specified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004363 *
Adam Powell81cd2e92010-04-21 16:35:18 -07004364 * @throws NameNotFoundException Thrown if the resources for the given
4365 * application could not be loaded.
4366 *
4367 * @see #getApplicationLogo(ApplicationInfo)
4368 */
4369 public abstract Drawable getApplicationLogo(String packageName)
4370 throws NameNotFoundException;
4371
4372 /**
Vadim Tryshev66ae66a2016-02-18 15:41:21 -08004373 * Returns a managed-user-style badged copy of the given drawable allowing the user to
4374 * distinguish it from the original drawable.
4375 * The caller can specify the location in the bounds of the drawable to be
4376 * badged where the badge should be applied as well as the density of the
4377 * badge to be used.
4378 * <p>
4379 * If the original drawable is a BitmapDrawable and the backing bitmap is
4380 * mutable as per {@link android.graphics.Bitmap#isMutable()}, the badging
4381 * is performed in place and the original drawable is returned.
4382 * </p>
4383 *
4384 * @param drawable The drawable to badge.
4385 * @param badgeLocation Where in the bounds of the badged drawable to place
4386 * the badge. If it's {@code null}, the badge is applied on top of the entire
4387 * drawable being badged.
4388 * @param badgeDensity The optional desired density for the badge as per
4389 * {@link android.util.DisplayMetrics#densityDpi}. If it's not positive,
4390 * the density of the display is used.
4391 * @return A drawable that combines the original drawable and a badge as
4392 * determined by the system.
4393 * @hide
4394 */
4395 public abstract Drawable getManagedUserBadgedDrawable(Drawable drawable, Rect badgeLocation,
4396 int badgeDensity);
4397
4398 /**
Tony Mak4dc008c2016-03-16 10:46:49 +00004399 * If the target user is a managed profile, then this returns a badged copy of the given icon
4400 * to be able to distinguish it from the original icon. For badging an arbitrary drawable use
Kenny Guydf77d712015-05-29 17:02:22 +01004401 * {@link #getUserBadgedDrawableForDensity(
Svetoslavc7d62f02014-09-04 15:39:54 -07004402 * android.graphics.drawable.Drawable, UserHandle, android.graphics.Rect, int)}.
4403 * <p>
4404 * If the original drawable is a BitmapDrawable and the backing bitmap is
4405 * mutable as per {@link android.graphics.Bitmap#isMutable()}, the badging
4406 * is performed in place and the original drawable is returned.
4407 * </p>
4408 *
4409 * @param icon The icon to badge.
4410 * @param user The target user.
4411 * @return A drawable that combines the original icon and a badge as
4412 * determined by the system.
4413 */
4414 public abstract Drawable getUserBadgedIcon(Drawable icon, UserHandle user);
4415
4416 /**
4417 * If the target user is a managed profile of the calling user or the caller
4418 * is itself a managed profile, then this returns a badged copy of the given
4419 * drawable allowing the user to distinguish it from the original drawable.
4420 * The caller can specify the location in the bounds of the drawable to be
4421 * badged where the badge should be applied as well as the density of the
4422 * badge to be used.
4423 * <p>
4424 * If the original drawable is a BitmapDrawable and the backing bitmap is
Vadim Tryshev66ae66a2016-02-18 15:41:21 -08004425 * mutable as per {@link android.graphics.Bitmap#isMutable()}, the badging
Svetoslavc7d62f02014-09-04 15:39:54 -07004426 * is performed in place and the original drawable is returned.
4427 * </p>
4428 *
4429 * @param drawable The drawable to badge.
4430 * @param user The target user.
4431 * @param badgeLocation Where in the bounds of the badged drawable to place
Vadim Tryshev66ae66a2016-02-18 15:41:21 -08004432 * the badge. If it's {@code null}, the badge is applied on top of the entire
Svetoslavc7d62f02014-09-04 15:39:54 -07004433 * drawable being badged.
4434 * @param badgeDensity The optional desired density for the badge as per
Vadim Tryshev66ae66a2016-02-18 15:41:21 -08004435 * {@link android.util.DisplayMetrics#densityDpi}. If it's not positive,
Svetoslavc7d62f02014-09-04 15:39:54 -07004436 * the density of the display is used.
4437 * @return A drawable that combines the original drawable and a badge as
4438 * determined by the system.
4439 */
4440 public abstract Drawable getUserBadgedDrawableForDensity(Drawable drawable,
4441 UserHandle user, Rect badgeLocation, int badgeDensity);
4442
4443 /**
4444 * If the target user is a managed profile of the calling user or the caller
4445 * is itself a managed profile, then this returns a drawable to use as a small
4446 * icon to include in a view to distinguish it from the original icon.
4447 *
4448 * @param user The target user.
4449 * @param density The optional desired density for the badge as per
4450 * {@link android.util.DisplayMetrics#densityDpi}. If not provided
4451 * the density of the current display is used.
4452 * @return the drawable or null if no drawable is required.
4453 * @hide
4454 */
4455 public abstract Drawable getUserBadgeForDensity(UserHandle user, int density);
4456
4457 /**
4458 * If the target user is a managed profile of the calling user or the caller
Selim Cineke6ff9462016-01-15 15:07:06 -08004459 * is itself a managed profile, then this returns a drawable to use as a small
4460 * icon to include in a view to distinguish it from the original icon. This version
4461 * doesn't have background protection and should be used over a light background instead of
4462 * a badge.
4463 *
4464 * @param user The target user.
4465 * @param density The optional desired density for the badge as per
4466 * {@link android.util.DisplayMetrics#densityDpi}. If not provided
4467 * the density of the current display is used.
4468 * @return the drawable or null if no drawable is required.
4469 * @hide
4470 */
4471 public abstract Drawable getUserBadgeForDensityNoBackground(UserHandle user, int density);
4472
4473 /**
4474 * If the target user is a managed profile of the calling user or the caller
Svetoslavc7d62f02014-09-04 15:39:54 -07004475 * is itself a managed profile, then this returns a copy of the label with
4476 * badging for accessibility services like talkback. E.g. passing in "Email"
4477 * and it might return "Work Email" for Email in the work profile.
4478 *
4479 * @param label The label to change.
4480 * @param user The target user.
4481 * @return A label that combines the original label and a badge as
4482 * determined by the system.
4483 */
4484 public abstract CharSequence getUserBadgedLabel(CharSequence label, UserHandle user);
4485
4486 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004487 * Retrieve text from a package. This is a low-level API used by
4488 * the various package manager info structures (such as
4489 * {@link ComponentInfo} to implement retrieval of their associated
4490 * labels and other text.
4491 *
4492 * @param packageName The name of the package that this text is coming from.
kmccormick30498b42013-03-27 17:39:17 -07004493 * Cannot be null.
4494 * @param resid The resource identifier of the desired text. Cannot be 0.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004495 * @param appInfo Overall information about <var>packageName</var>. This
4496 * may be null, in which case the application information will be retrieved
4497 * for you if needed; if you already have this information around, it can
4498 * be much more efficient to supply it here.
4499 *
4500 * @return Returns a CharSequence holding the requested text. Returns null
4501 * if the text could not be found for any reason.
4502 */
Tor Norbye7b9c9122013-05-30 16:48:33 -07004503 public abstract CharSequence getText(String packageName, @StringRes int resid,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004504 ApplicationInfo appInfo);
4505
4506 /**
4507 * Retrieve an XML file from a package. This is a low-level API used to
4508 * retrieve XML meta data.
4509 *
4510 * @param packageName The name of the package that this xml is coming from.
kmccormick30498b42013-03-27 17:39:17 -07004511 * Cannot be null.
4512 * @param resid The resource identifier of the desired xml. Cannot be 0.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004513 * @param appInfo Overall information about <var>packageName</var>. This
4514 * may be null, in which case the application information will be retrieved
4515 * for you if needed; if you already have this information around, it can
4516 * be much more efficient to supply it here.
4517 *
4518 * @return Returns an XmlPullParser allowing you to parse out the XML
4519 * data. Returns null if the xml resource could not be found for any
4520 * reason.
4521 */
Tor Norbye7b9c9122013-05-30 16:48:33 -07004522 public abstract XmlResourceParser getXml(String packageName, @XmlRes int resid,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004523 ApplicationInfo appInfo);
4524
4525 /**
4526 * Return the label to use for this application.
4527 *
4528 * @return Returns the label associated with this application, or null if
4529 * it could not be found for any reason.
kmccormick30498b42013-03-27 17:39:17 -07004530 * @param info The application to get the label of.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004531 */
4532 public abstract CharSequence getApplicationLabel(ApplicationInfo info);
4533
4534 /**
4535 * Retrieve the resources associated with an activity. Given the full
4536 * name of an activity, retrieves the information about it and calls
4537 * getResources() to return its application's resources. If the activity
kmccormick30498b42013-03-27 17:39:17 -07004538 * cannot be found, NameNotFoundException is thrown.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004539 *
4540 * @param activityName Name of the activity whose resources are to be
4541 * retrieved.
4542 *
4543 * @return Returns the application's Resources.
4544 * @throws NameNotFoundException Thrown if the resources for the given
4545 * application could not be loaded.
4546 *
4547 * @see #getResourcesForApplication(ApplicationInfo)
4548 */
4549 public abstract Resources getResourcesForActivity(ComponentName activityName)
4550 throws NameNotFoundException;
4551
4552 /**
4553 * Retrieve the resources for an application. Throws NameNotFoundException
4554 * if the package is no longer installed.
4555 *
4556 * @param app Information about the desired application.
4557 *
4558 * @return Returns the application's Resources.
4559 * @throws NameNotFoundException Thrown if the resources for the given
4560 * application could not be loaded (most likely because it was uninstalled).
4561 */
4562 public abstract Resources getResourcesForApplication(ApplicationInfo app)
4563 throws NameNotFoundException;
4564
4565 /**
4566 * Retrieve the resources associated with an application. Given the full
4567 * package name of an application, retrieves the information about it and
4568 * calls getResources() to return its application's resources. If the
kmccormick30498b42013-03-27 17:39:17 -07004569 * appPackageName cannot be found, NameNotFoundException is thrown.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004570 *
4571 * @param appPackageName Package name of the application whose resources
4572 * are to be retrieved.
4573 *
4574 * @return Returns the application's Resources.
4575 * @throws NameNotFoundException Thrown if the resources for the given
4576 * application could not be loaded.
4577 *
4578 * @see #getResourcesForApplication(ApplicationInfo)
4579 */
4580 public abstract Resources getResourcesForApplication(String appPackageName)
4581 throws NameNotFoundException;
4582
Amith Yamasani98edc952012-09-25 14:09:27 -07004583 /** @hide */
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004584 public abstract Resources getResourcesForApplicationAsUser(String appPackageName,
4585 @UserIdInt int userId) throws NameNotFoundException;
Amith Yamasani98edc952012-09-25 14:09:27 -07004586
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004587 /**
4588 * Retrieve overall information about an application package defined
4589 * in a package archive file
4590 *
4591 * @param archiveFilePath The path to the archive file
4592 * @param flags Additional option flags. Use any combination of
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004593 * {@link #GET_ACTIVITIES}, {@link #GET_CONFIGURATIONS},
4594 * {@link #GET_GIDS}, {@link #GET_INSTRUMENTATION},
4595 * {@link #GET_INTENT_FILTERS}, {@link #GET_META_DATA},
4596 * {@link #GET_PERMISSIONS}, {@link #GET_PROVIDERS},
4597 * {@link #GET_RECEIVERS}, {@link #GET_SERVICES},
4598 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #GET_SIGNATURES},
4599 * {@link #GET_URI_PERMISSION_PATTERNS}, {@link #GET_UNINSTALLED_PACKAGES},
4600 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
4601 * {@link #MATCH_UNINSTALLED_PACKAGES}
4602 * to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004603 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004604 * @return A PackageInfo object containing information about the
4605 * package archive. If the package could not be parsed,
4606 * returns null.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004607 *
4608 * @see #GET_ACTIVITIES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004609 * @see #GET_CONFIGURATIONS
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004610 * @see #GET_GIDS
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004611 * @see #GET_INSTRUMENTATION
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004612 * @see #GET_INTENT_FILTERS
4613 * @see #GET_META_DATA
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004614 * @see #GET_PERMISSIONS
4615 * @see #GET_PROVIDERS
4616 * @see #GET_RECEIVERS
4617 * @see #GET_SERVICES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004618 * @see #GET_SHARED_LIBRARY_FILES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004619 * @see #GET_SIGNATURES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004620 * @see #GET_URI_PERMISSION_PATTERNS
4621 * @see #MATCH_DISABLED_COMPONENTS
4622 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
4623 * @see #MATCH_UNINSTALLED_PACKAGES
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004624 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004625 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004626 public PackageInfo getPackageArchiveInfo(String archiveFilePath, @PackageInfoFlags int flags) {
Jeff Sharkey275e0852014-06-17 18:18:49 -07004627 final PackageParser parser = new PackageParser();
4628 final File apkFile = new File(archiveFilePath);
Jeff Sharkeyc4858a22014-06-16 10:51:20 -07004629 try {
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004630 if ((flags & (MATCH_DIRECT_BOOT_UNAWARE | MATCH_DIRECT_BOOT_AWARE)) != 0) {
Jeff Sharkeyc3132512016-01-12 14:06:58 -07004631 // Caller expressed an explicit opinion about what encryption
4632 // aware/unaware components they want to see, so fall through and
4633 // give them what they want
4634 } else {
4635 // Caller expressed no opinion, so match everything
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004636 flags |= MATCH_DIRECT_BOOT_AWARE | MATCH_DIRECT_BOOT_UNAWARE;
Jeff Sharkeyc3132512016-01-12 14:06:58 -07004637 }
4638
Jeff Sharkey275e0852014-06-17 18:18:49 -07004639 PackageParser.Package pkg = parser.parseMonolithicPackage(apkFile, 0);
Jeff Sharkeyc4858a22014-06-16 10:51:20 -07004640 if ((flags & GET_SIGNATURES) != 0) {
Svet Ganov354cd3c2015-12-17 11:35:04 -08004641 PackageParser.collectCertificates(pkg, 0);
Jeff Sharkeyc4858a22014-06-16 10:51:20 -07004642 }
4643 PackageUserState state = new PackageUserState();
4644 return PackageParser.generatePackageInfo(pkg, null, flags, 0, 0, null, state);
4645 } catch (PackageParserException e) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004646 return null;
4647 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004648 }
4649
4650 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07004651 * @deprecated replaced by {@link PackageInstaller}
4652 * @hide
Jacek Surazski65e13172009-04-28 15:26:38 +02004653 */
Jeff Sharkey5aa86932016-01-08 19:07:49 -07004654 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004655 public abstract void installPackage(
Todd Kennedya6793232016-02-24 22:46:00 +00004656 Uri packageURI,
4657 IPackageInstallObserver observer,
4658 @InstallFlags int flags,
Jacek Surazski65e13172009-04-28 15:26:38 +02004659 String installerPackageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004660 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07004661 * @deprecated replaced by {@link PackageInstaller}
Christopher Tateab8a5012014-03-24 16:25:51 -07004662 * @hide
Christopher Tateab8a5012014-03-24 16:25:51 -07004663 */
Jeff Sharkey5aa86932016-01-08 19:07:49 -07004664 @Deprecated
Todd Kennedya6793232016-02-24 22:46:00 +00004665 public abstract void installPackage(
4666 Uri packageURI,
4667 PackageInstallObserver observer,
4668 @InstallFlags int flags,
4669 String installerPackageName);
Christopher Tateab8a5012014-03-24 16:25:51 -07004670
rich cannings706e8ba2012-08-20 13:20:14 -07004671 /**
Dianne Hackborn7767eac2012-08-23 18:25:40 -07004672 * If there is already an application with the given package name installed
4673 * on the system for other users, also install it for the calling user.
4674 * @hide
4675 */
Nicolas Prevot9a80e532015-09-23 15:49:28 +01004676 public abstract int installExistingPackage(String packageName) throws NameNotFoundException;
4677
4678 /**
4679 * If there is already an application with the given package name installed
4680 * on the system for other users, also install it for the specified user.
4681 * @hide
4682 */
4683 @RequiresPermission(anyOf = {
4684 Manifest.permission.INSTALL_PACKAGES,
4685 Manifest.permission.INTERACT_ACROSS_USERS_FULL})
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004686 public abstract int installExistingPackageAsUser(String packageName, @UserIdInt int userId)
Dianne Hackborn7767eac2012-08-23 18:25:40 -07004687 throws NameNotFoundException;
4688
4689 /**
Kenny Root5ab21572011-07-27 11:11:19 -07004690 * Allows a package listening to the
4691 * {@link Intent#ACTION_PACKAGE_NEEDS_VERIFICATION package verification
Kenny Root3a9b5fb2011-09-20 14:15:38 -07004692 * broadcast} to respond to the package manager. The response must include
4693 * the {@code verificationCode} which is one of
4694 * {@link PackageManager#VERIFICATION_ALLOW} or
4695 * {@link PackageManager#VERIFICATION_REJECT}.
Kenny Root5ab21572011-07-27 11:11:19 -07004696 *
4697 * @param id pending package identifier as passed via the
kmccormick30498b42013-03-27 17:39:17 -07004698 * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra.
Kenny Root3a9b5fb2011-09-20 14:15:38 -07004699 * @param verificationCode either {@link PackageManager#VERIFICATION_ALLOW}
4700 * or {@link PackageManager#VERIFICATION_REJECT}.
rich cannings7e671512012-08-27 14:44:16 -07004701 * @throws SecurityException if the caller does not have the
Dianne Hackborn8832c182012-09-17 17:20:24 -07004702 * PACKAGE_VERIFICATION_AGENT permission.
Kenny Root5ab21572011-07-27 11:11:19 -07004703 */
Kenny Root3a9b5fb2011-09-20 14:15:38 -07004704 public abstract void verifyPendingInstall(int id, int verificationCode);
Kenny Root5ab21572011-07-27 11:11:19 -07004705
4706 /**
rich canningsd9ef3e52012-08-22 14:28:05 -07004707 * Allows a package listening to the
4708 * {@link Intent#ACTION_PACKAGE_NEEDS_VERIFICATION package verification
4709 * broadcast} to extend the default timeout for a response and declare what
4710 * action to perform after the timeout occurs. The response must include
4711 * the {@code verificationCodeAtTimeout} which is one of
4712 * {@link PackageManager#VERIFICATION_ALLOW} or
4713 * {@link PackageManager#VERIFICATION_REJECT}.
4714 *
4715 * This method may only be called once per package id. Additional calls
4716 * will have no effect.
4717 *
4718 * @param id pending package identifier as passed via the
kmccormick30498b42013-03-27 17:39:17 -07004719 * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra.
rich canningsd9ef3e52012-08-22 14:28:05 -07004720 * @param verificationCodeAtTimeout either
4721 * {@link PackageManager#VERIFICATION_ALLOW} or
rich canningsd1b5cfc2012-08-29 14:49:51 -07004722 * {@link PackageManager#VERIFICATION_REJECT}. If
4723 * {@code verificationCodeAtTimeout} is neither
4724 * {@link PackageManager#VERIFICATION_ALLOW} or
4725 * {@link PackageManager#VERIFICATION_REJECT}, then
4726 * {@code verificationCodeAtTimeout} will default to
rich canningsd9ef3e52012-08-22 14:28:05 -07004727 * {@link PackageManager#VERIFICATION_REJECT}.
4728 * @param millisecondsToDelay the amount of time requested for the timeout.
4729 * Must be positive and less than
rich canningsd1b5cfc2012-08-29 14:49:51 -07004730 * {@link PackageManager#MAXIMUM_VERIFICATION_TIMEOUT}. If
4731 * {@code millisecondsToDelay} is out of bounds,
4732 * {@code millisecondsToDelay} will be set to the closest in
4733 * bounds value; namely, 0 or
rich canningsd9ef3e52012-08-22 14:28:05 -07004734 * {@link PackageManager#MAXIMUM_VERIFICATION_TIMEOUT}.
rich cannings7e671512012-08-27 14:44:16 -07004735 * @throws SecurityException if the caller does not have the
Dianne Hackborn8832c182012-09-17 17:20:24 -07004736 * PACKAGE_VERIFICATION_AGENT permission.
rich canningsd9ef3e52012-08-22 14:28:05 -07004737 */
4738 public abstract void extendVerificationTimeout(int id,
4739 int verificationCodeAtTimeout, long millisecondsToDelay);
4740
4741 /**
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004742 * Allows a package listening to the
Todd Kennedydfa93ab2016-03-03 15:24:33 -08004743 * {@link Intent#ACTION_INTENT_FILTER_NEEDS_VERIFICATION} intent filter verification
4744 * broadcast to respond to the package manager. The response must include
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004745 * the {@code verificationCode} which is one of
4746 * {@link PackageManager#INTENT_FILTER_VERIFICATION_SUCCESS} or
4747 * {@link PackageManager#INTENT_FILTER_VERIFICATION_FAILURE}.
4748 *
4749 * @param verificationId pending package identifier as passed via the
4750 * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra.
4751 * @param verificationCode either {@link PackageManager#INTENT_FILTER_VERIFICATION_SUCCESS}
4752 * or {@link PackageManager#INTENT_FILTER_VERIFICATION_FAILURE}.
Todd Kennedydfa93ab2016-03-03 15:24:33 -08004753 * @param failedDomains a list of failed domains if the verificationCode is
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004754 * {@link PackageManager#INTENT_FILTER_VERIFICATION_FAILURE}, otherwise null;
4755 * @throws SecurityException if the caller does not have the
4756 * INTENT_FILTER_VERIFICATION_AGENT permission.
4757 *
4758 * @hide
4759 */
Fabrice Di Meglioef741da2015-05-12 16:31:38 -07004760 @SystemApi
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004761 public abstract void verifyIntentFilter(int verificationId, int verificationCode,
Todd Kennedydfa93ab2016-03-03 15:24:33 -08004762 List<String> failedDomains);
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004763
4764 /**
4765 * Get the status of a Domain Verification Result for an IntentFilter. This is
4766 * related to the {@link android.content.IntentFilter#setAutoVerify(boolean)} and
4767 * {@link android.content.IntentFilter#getAutoVerify()}
4768 *
4769 * This is used by the ResolverActivity to change the status depending on what the User select
4770 * in the Disambiguation Dialog and also used by the Settings App for changing the default App
4771 * for a domain.
4772 *
4773 * @param packageName The package name of the Activity associated with the IntentFilter.
4774 * @param userId The user id.
4775 *
4776 * @return The status to set to. This can be
4777 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK} or
4778 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS} or
4779 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER} or
4780 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED}
4781 *
4782 * @hide
4783 */
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004784 public abstract int getIntentVerificationStatusAsUser(String packageName, @UserIdInt int userId);
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004785
4786 /**
4787 * Allow to change the status of a Intent Verification status for all IntentFilter of an App.
4788 * This is related to the {@link android.content.IntentFilter#setAutoVerify(boolean)} and
4789 * {@link android.content.IntentFilter#getAutoVerify()}
4790 *
4791 * This is used by the ResolverActivity to change the status depending on what the User select
4792 * in the Disambiguation Dialog and also used by the Settings App for changing the default App
4793 * for a domain.
4794 *
4795 * @param packageName The package name of the Activity associated with the IntentFilter.
4796 * @param status The status to set to. This can be
4797 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK} or
4798 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS} or
4799 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER}
4800 * @param userId The user id.
4801 *
4802 * @return true if the status has been set. False otherwise.
4803 *
4804 * @hide
4805 */
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07004806 public abstract boolean updateIntentVerificationStatusAsUser(String packageName, int status,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004807 @UserIdInt int userId);
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004808
4809 /**
4810 * Get the list of IntentFilterVerificationInfo for a specific package and User.
4811 *
4812 * @param packageName the package name. When this parameter is set to a non null value,
4813 * the results will be filtered by the package name provided.
4814 * Otherwise, there will be no filtering and it will return a list
Fabrice Di Meglio07885952015-04-06 19:41:28 -07004815 * corresponding for all packages
4816 *
4817 * @return a list of IntentFilterVerificationInfo for a specific package.
4818 *
4819 * @hide
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004820 */
4821 public abstract List<IntentFilterVerificationInfo> getIntentFilterVerifications(
4822 String packageName);
4823
4824 /**
Fabrice Di Meglio07885952015-04-06 19:41:28 -07004825 * Get the list of IntentFilter for a specific package.
4826 *
4827 * @param packageName the package name. This parameter is set to a non null value,
4828 * the list will contain all the IntentFilter for that package.
4829 * Otherwise, the list will be empty.
4830 *
4831 * @return a list of IntentFilter for a specific package.
4832 *
4833 * @hide
4834 */
4835 public abstract List<IntentFilter> getAllIntentFilters(String packageName);
4836
4837 /**
Fabrice Di Meglio62271722015-04-10 17:24:02 -07004838 * Get the default Browser package name for a specific user.
4839 *
4840 * @param userId The user id.
4841 *
4842 * @return the package name of the default Browser for the specified user. If the user id passed
4843 * is -1 (all users) it will return a null value.
4844 *
4845 * @hide
4846 */
Jeff Sharkeya73b8fd2016-01-06 17:02:08 -07004847 @TestApi
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004848 public abstract String getDefaultBrowserPackageNameAsUser(@UserIdInt int userId);
Fabrice Di Meglio62271722015-04-10 17:24:02 -07004849
4850 /**
4851 * Set the default Browser package name for a specific user.
4852 *
4853 * @param packageName The package name of the default Browser.
4854 * @param userId The user id.
4855 *
4856 * @return true if the default Browser for the specified user has been set,
4857 * otherwise return false. If the user id passed is -1 (all users) this call will not
4858 * do anything and just return false.
4859 *
4860 * @hide
4861 */
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004862 public abstract boolean setDefaultBrowserPackageNameAsUser(String packageName,
4863 @UserIdInt int userId);
Fabrice Di Meglio62271722015-04-10 17:24:02 -07004864
4865 /**
Dianne Hackborn880119b2010-11-18 22:26:40 -08004866 * Change the installer associated with a given package. There are limitations
4867 * on how the installer package can be changed; in particular:
4868 * <ul>
4869 * <li> A SecurityException will be thrown if <var>installerPackageName</var>
4870 * is not signed with the same certificate as the calling application.
4871 * <li> A SecurityException will be thrown if <var>targetPackage</var> already
4872 * has an installer package, and that installer package is not signed with
4873 * the same certificate as the calling application.
4874 * </ul>
4875 *
4876 * @param targetPackage The installed package whose installer will be changed.
4877 * @param installerPackageName The package name of the new installer. May be
4878 * null to clear the association.
4879 */
4880 public abstract void setInstallerPackageName(String targetPackage,
4881 String installerPackageName);
4882
4883 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07004884 * Attempts to delete a package. Since this may take a little while, the
4885 * result will be posted back to the given observer. A deletion will fail if
4886 * the calling context lacks the
4887 * {@link android.Manifest.permission#DELETE_PACKAGES} permission, if the
4888 * named package cannot be found, or if the named package is a system
4889 * package.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004890 *
4891 * @param packageName The name of the package to delete
Jeff Sharkey5aa86932016-01-08 19:07:49 -07004892 * @param observer An observer callback to get notified when the package
4893 * deletion is complete.
4894 * {@link android.content.pm.IPackageDeleteObserver#packageDeleted}
4895 * will be called when that happens. observer may be null to
4896 * indicate that no callback is desired.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004897 * @hide
4898 */
Jeff Sharkey5aa86932016-01-08 19:07:49 -07004899 public abstract void deletePackage(String packageName, IPackageDeleteObserver observer,
4900 @DeleteFlags int flags);
Jacek Surazski65e13172009-04-28 15:26:38 +02004901
4902 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07004903 * Attempts to delete a package. Since this may take a little while, the
4904 * result will be posted back to the given observer. A deletion will fail if
4905 * the named package cannot be found, or if the named package is a system
4906 * package.
Nicolas Prevot9a80e532015-09-23 15:49:28 +01004907 *
4908 * @param packageName The name of the package to delete
Jeff Sharkey5aa86932016-01-08 19:07:49 -07004909 * @param observer An observer callback to get notified when the package
4910 * deletion is complete.
4911 * {@link android.content.pm.IPackageDeleteObserver#packageDeleted}
4912 * will be called when that happens. observer may be null to
4913 * indicate that no callback is desired.
Nicolas Prevot9a80e532015-09-23 15:49:28 +01004914 * @param userId The user Id
Nicolas Prevot9a80e532015-09-23 15:49:28 +01004915 * @hide
4916 */
4917 @RequiresPermission(anyOf = {
4918 Manifest.permission.DELETE_PACKAGES,
4919 Manifest.permission.INTERACT_ACROSS_USERS_FULL})
Jeff Sharkey5aa86932016-01-08 19:07:49 -07004920 public abstract void deletePackageAsUser(String packageName, IPackageDeleteObserver observer,
4921 @DeleteFlags int flags, @UserIdInt int userId);
Nicolas Prevot9a80e532015-09-23 15:49:28 +01004922
4923 /**
Jacek Surazski65e13172009-04-28 15:26:38 +02004924 * Retrieve the package name of the application that installed a package. This identifies
4925 * which market the package came from.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004926 *
Jacek Surazski65e13172009-04-28 15:26:38 +02004927 * @param packageName The name of the package to query
4928 */
4929 public abstract String getInstallerPackageName(String packageName);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004930
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004931 /**
4932 * Attempts to clear the user data directory of an application.
4933 * Since this may take a little while, the result will
4934 * be posted back to the given observer. A deletion will fail if the
4935 * named package cannot be found, or if the named package is a "system package".
4936 *
4937 * @param packageName The name of the package
4938 * @param observer An observer callback to get notified when the operation is finished
4939 * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)}
4940 * will be called when that happens. observer may be null to indicate that
4941 * no callback is desired.
4942 *
4943 * @hide
4944 */
4945 public abstract void clearApplicationUserData(String packageName,
4946 IPackageDataObserver observer);
4947 /**
4948 * Attempts to delete the cache files associated with an application.
4949 * Since this may take a little while, the result will
4950 * be posted back to the given observer. A deletion will fail if the calling context
4951 * lacks the {@link android.Manifest.permission#DELETE_CACHE_FILES} permission, if the
4952 * named package cannot be found, or if the named package is a "system package".
4953 *
4954 * @param packageName The name of the package to delete
4955 * @param observer An observer callback to get notified when the cache file deletion
4956 * is complete.
4957 * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)}
4958 * will be called when that happens. observer may be null to indicate that
4959 * no callback is desired.
4960 *
4961 * @hide
4962 */
4963 public abstract void deleteApplicationCacheFiles(String packageName,
4964 IPackageDataObserver observer);
4965
4966 /**
4967 * Free storage by deleting LRU sorted list of cache files across
4968 * all applications. If the currently available free storage
4969 * on the device is greater than or equal to the requested
4970 * free storage, no cache files are cleared. If the currently
4971 * available storage on the device is less than the requested
4972 * free storage, some or all of the cache files across
4973 * all applications are deleted (based on last accessed time)
4974 * to increase the free storage space on the device to
4975 * the requested value. There is no guarantee that clearing all
4976 * the cache files from all applications will clear up
4977 * enough storage to achieve the desired value.
4978 * @param freeStorageSize The number of bytes of storage to be
4979 * freed by the system. Say if freeStorageSize is XX,
4980 * and the current free storage is YY,
4981 * if XX is less than YY, just return. if not free XX-YY number
4982 * of bytes if possible.
4983 * @param observer call back used to notify when
4984 * the operation is completed
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004985 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004986 * @hide
4987 */
Jeff Sharkey529f91f2015-04-18 20:23:13 -07004988 public void freeStorageAndNotify(long freeStorageSize, IPackageDataObserver observer) {
4989 freeStorageAndNotify(null, freeStorageSize, observer);
4990 }
4991
4992 /** {@hide} */
4993 public abstract void freeStorageAndNotify(String volumeUuid, long freeStorageSize,
4994 IPackageDataObserver observer);
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -07004995
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004996 /**
4997 * Free storage by deleting LRU sorted list of cache files across
4998 * all applications. If the currently available free storage
4999 * on the device is greater than or equal to the requested
5000 * free storage, no cache files are cleared. If the currently
5001 * available storage on the device is less than the requested
5002 * free storage, some or all of the cache files across
5003 * all applications are deleted (based on last accessed time)
5004 * to increase the free storage space on the device to
5005 * the requested value. There is no guarantee that clearing all
5006 * the cache files from all applications will clear up
5007 * enough storage to achieve the desired value.
5008 * @param freeStorageSize The number of bytes of storage to be
5009 * freed by the system. Say if freeStorageSize is XX,
5010 * and the current free storage is YY,
5011 * if XX is less than YY, just return. if not free XX-YY number
5012 * of bytes if possible.
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -07005013 * @param pi IntentSender call back used to
5014 * notify when the operation is completed.May be null
5015 * to indicate that no call back is desired.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005016 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005017 * @hide
5018 */
Jeff Sharkey529f91f2015-04-18 20:23:13 -07005019 public void freeStorage(long freeStorageSize, IntentSender pi) {
5020 freeStorage(null, freeStorageSize, pi);
5021 }
5022
5023 /** {@hide} */
5024 public abstract void freeStorage(String volumeUuid, long freeStorageSize, IntentSender pi);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005025
5026 /**
5027 * Retrieve the size information for a package.
5028 * Since this may take a little while, the result will
5029 * be posted back to the given observer. The calling context
5030 * should have the {@link android.Manifest.permission#GET_PACKAGE_SIZE} permission.
5031 *
5032 * @param packageName The name of the package whose size information is to be retrieved
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07005033 * @param userId The user whose size information should be retrieved.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005034 * @param observer An observer callback to get notified when the operation
5035 * is complete.
5036 * {@link android.content.pm.IPackageStatsObserver#onGetStatsCompleted(PackageStats, boolean)}
5037 * The observer's callback is invoked with a PackageStats object(containing the
5038 * code, data and cache sizes of the package) and a boolean value representing
5039 * the status of the operation. observer may be null to indicate that
5040 * no callback is desired.
5041 *
5042 * @hide
5043 */
Jeff Sharkey8588bc12016-01-06 16:47:42 -07005044 public abstract void getPackageSizeInfoAsUser(String packageName, @UserIdInt int userId,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005045 IPackageStatsObserver observer);
5046
5047 /**
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07005048 * Like {@link #getPackageSizeInfoAsUser(String, int, IPackageStatsObserver)}, but
Dianne Hackborn0c380492012-08-20 17:23:30 -07005049 * returns the size for the calling user.
5050 *
5051 * @hide
5052 */
5053 public void getPackageSizeInfo(String packageName, IPackageStatsObserver observer) {
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07005054 getPackageSizeInfoAsUser(packageName, UserHandle.myUserId(), observer);
Dianne Hackborn0c380492012-08-20 17:23:30 -07005055 }
5056
5057 /**
Dianne Hackborna7ca0e52009-12-01 14:31:55 -08005058 * @deprecated This function no longer does anything; it was an old
kmccormickac66b852013-03-28 15:17:15 -07005059 * approach to managing preferred activities, which has been superseded
5060 * by (and conflicts with) the modern activity-based preferences.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005061 */
Dianne Hackborna7ca0e52009-12-01 14:31:55 -08005062 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005063 public abstract void addPackageToPreferred(String packageName);
5064
5065 /**
Dianne Hackborna7ca0e52009-12-01 14:31:55 -08005066 * @deprecated This function no longer does anything; it was an old
kmccormickac66b852013-03-28 15:17:15 -07005067 * approach to managing preferred activities, which has been superseded
5068 * by (and conflicts with) the modern activity-based preferences.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005069 */
Dianne Hackborna7ca0e52009-12-01 14:31:55 -08005070 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005071 public abstract void removePackageFromPreferred(String packageName);
5072
5073 /**
Jeff Sharkey629f9842016-01-08 16:36:54 -07005074 * Retrieve the list of all currently configured preferred packages. The
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005075 * first package on the list is the most preferred, the last is the
5076 * least preferred.
5077 *
5078 * @param flags Additional option flags. Use any combination of
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08005079 * {@link #GET_ACTIVITIES}, {@link #GET_CONFIGURATIONS},
5080 * {@link #GET_GIDS}, {@link #GET_INSTRUMENTATION},
5081 * {@link #GET_INTENT_FILTERS}, {@link #GET_META_DATA},
5082 * {@link #GET_PERMISSIONS}, {@link #GET_PROVIDERS},
5083 * {@link #GET_RECEIVERS}, {@link #GET_SERVICES},
5084 * {@link #GET_SHARED_LIBRARY_FILES}, {@link #GET_SIGNATURES},
5085 * {@link #GET_URI_PERMISSION_PATTERNS}, {@link #GET_UNINSTALLED_PACKAGES},
5086 * {@link #MATCH_DISABLED_COMPONENTS}, {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS},
5087 * {@link #MATCH_UNINSTALLED_PACKAGES}
5088 * to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005089 *
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08005090 * @return A List of PackageInfo objects, one for each preferred application,
5091 * in order of preference.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005092 *
5093 * @see #GET_ACTIVITIES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005094 * @see #GET_CONFIGURATIONS
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08005095 * @see #GET_GIDS
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005096 * @see #GET_INSTRUMENTATION
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08005097 * @see #GET_INTENT_FILTERS
5098 * @see #GET_META_DATA
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005099 * @see #GET_PERMISSIONS
5100 * @see #GET_PROVIDERS
5101 * @see #GET_RECEIVERS
5102 * @see #GET_SERVICES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08005103 * @see #GET_SHARED_LIBRARY_FILES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005104 * @see #GET_SIGNATURES
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08005105 * @see #GET_URI_PERMISSION_PATTERNS
5106 * @see #MATCH_DISABLED_COMPONENTS
5107 * @see #MATCH_DISABLED_UNTIL_USED_COMPONENTS
5108 * @see #MATCH_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005109 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07005110 public abstract List<PackageInfo> getPreferredPackages(@PackageInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005111
5112 /**
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08005113 * @deprecated This is a protected API that should not have been available
5114 * to third party applications. It is the platform's responsibility for
kmccormick30498b42013-03-27 17:39:17 -07005115 * assigning preferred activities and this cannot be directly modified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005116 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005117 * Add a new preferred activity mapping to the system. This will be used
5118 * to automatically select the given activity component when
5119 * {@link Context#startActivity(Intent) Context.startActivity()} finds
5120 * multiple matching activities and also matches the given filter.
5121 *
5122 * @param filter The set of intents under which this activity will be
5123 * made preferred.
5124 * @param match The IntentFilter match category that this preference
5125 * applies to.
5126 * @param set The set of activities that the user was picking from when
5127 * this preference was made.
5128 * @param activity The component name of the activity that is to be
5129 * preferred.
5130 */
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08005131 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005132 public abstract void addPreferredActivity(IntentFilter filter, int match,
5133 ComponentName[] set, ComponentName activity);
5134
5135 /**
Amith Yamasania3f133a2012-08-09 17:11:28 -07005136 * Same as {@link #addPreferredActivity(IntentFilter, int,
5137 ComponentName[], ComponentName)}, but with a specific userId to apply the preference
5138 to.
5139 * @hide
5140 */
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07005141 public void addPreferredActivityAsUser(IntentFilter filter, int match,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07005142 ComponentName[] set, ComponentName activity, @UserIdInt int userId) {
Amith Yamasania3f133a2012-08-09 17:11:28 -07005143 throw new RuntimeException("Not implemented. Must override in a subclass.");
5144 }
5145
5146 /**
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08005147 * @deprecated This is a protected API that should not have been available
5148 * to third party applications. It is the platform's responsibility for
kmccormick30498b42013-03-27 17:39:17 -07005149 * assigning preferred activities and this cannot be directly modified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005150 *
Satish Sampath8dbe6122009-06-02 23:35:54 +01005151 * Replaces an existing preferred activity mapping to the system, and if that were not present
5152 * adds a new preferred activity. This will be used
5153 * to automatically select the given activity component when
5154 * {@link Context#startActivity(Intent) Context.startActivity()} finds
5155 * multiple matching activities and also matches the given filter.
5156 *
5157 * @param filter The set of intents under which this activity will be
5158 * made preferred.
5159 * @param match The IntentFilter match category that this preference
5160 * applies to.
5161 * @param set The set of activities that the user was picking from when
5162 * this preference was made.
5163 * @param activity The component name of the activity that is to be
5164 * preferred.
5165 * @hide
5166 */
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08005167 @Deprecated
Satish Sampath8dbe6122009-06-02 23:35:54 +01005168 public abstract void replacePreferredActivity(IntentFilter filter, int match,
5169 ComponentName[] set, ComponentName activity);
5170
5171 /**
Amith Yamasani41c1ded2014-08-05 11:15:05 -07005172 * @hide
5173 */
5174 @Deprecated
5175 public void replacePreferredActivityAsUser(IntentFilter filter, int match,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07005176 ComponentName[] set, ComponentName activity, @UserIdInt int userId) {
Amith Yamasani41c1ded2014-08-05 11:15:05 -07005177 throw new RuntimeException("Not implemented. Must override in a subclass.");
5178 }
5179
5180 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005181 * Remove all preferred activity mappings, previously added with
5182 * {@link #addPreferredActivity}, from the
5183 * system whose activities are implemented in the given package name.
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08005184 * An application can only clear its own package(s).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005185 *
5186 * @param packageName The name of the package whose preferred activity
5187 * mappings are to be removed.
5188 */
5189 public abstract void clearPackagePreferredActivities(String packageName);
5190
5191 /**
5192 * Retrieve all preferred activities, previously added with
5193 * {@link #addPreferredActivity}, that are
5194 * currently registered with the system.
5195 *
John Spurlock38e64252015-03-18 12:09:32 -04005196 * @param outFilters A required list in which to place the filters of all of the
5197 * preferred activities.
5198 * @param outActivities A required list in which to place the component names of
5199 * all of the preferred activities.
5200 * @param packageName An optional package in which you would like to limit
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005201 * the list. If null, all activities will be returned; if non-null, only
5202 * those activities in the given package are returned.
5203 *
5204 * @return Returns the total number of registered preferred activities
5205 * (the number of distinct IntentFilter records, not the number of unique
5206 * activity components) that were found.
5207 */
John Spurlock38e64252015-03-18 12:09:32 -04005208 public abstract int getPreferredActivities(@NonNull List<IntentFilter> outFilters,
5209 @NonNull List<ComponentName> outActivities, String packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005210
5211 /**
Christopher Tatea2a0850d2013-09-05 16:38:58 -07005212 * Ask for the set of available 'home' activities and the current explicit
5213 * default, if any.
5214 * @hide
5215 */
5216 public abstract ComponentName getHomeActivities(List<ResolveInfo> outActivities);
5217
5218 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005219 * Set the enabled setting for a package component (activity, receiver, service, provider).
5220 * This setting will override any enabled state which may have been set by the component in its
5221 * manifest.
5222 *
5223 * @param componentName The component to enable
5224 * @param newState The new enabled state for the component. The legal values for this state
5225 * are:
5226 * {@link #COMPONENT_ENABLED_STATE_ENABLED},
5227 * {@link #COMPONENT_ENABLED_STATE_DISABLED}
5228 * and
5229 * {@link #COMPONENT_ENABLED_STATE_DEFAULT}
5230 * The last one removes the setting, thereby restoring the component's state to
5231 * whatever was set in it's manifest (or enabled, by default).
5232 * @param flags Optional behavior flags: {@link #DONT_KILL_APP} or 0.
5233 */
5234 public abstract void setComponentEnabledSetting(ComponentName componentName,
5235 int newState, int flags);
5236
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005237 /**
Amaury Medeirosdde24262014-06-03 20:06:41 -03005238 * Return the enabled setting for a package component (activity,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005239 * receiver, service, provider). This returns the last value set by
5240 * {@link #setComponentEnabledSetting(ComponentName, int, int)}; in most
5241 * cases this value will be {@link #COMPONENT_ENABLED_STATE_DEFAULT} since
5242 * the value originally specified in the manifest has not been modified.
5243 *
5244 * @param componentName The component to retrieve.
5245 * @return Returns the current enabled state for the component. May
5246 * be one of {@link #COMPONENT_ENABLED_STATE_ENABLED},
5247 * {@link #COMPONENT_ENABLED_STATE_DISABLED}, or
5248 * {@link #COMPONENT_ENABLED_STATE_DEFAULT}. The last one means the
5249 * component's enabled state is based on the original information in
5250 * the manifest as found in {@link ComponentInfo}.
5251 */
5252 public abstract int getComponentEnabledSetting(ComponentName componentName);
5253
5254 /**
5255 * Set the enabled setting for an application
5256 * This setting will override any enabled state which may have been set by the application in
5257 * its manifest. It also overrides the enabled state set in the manifest for any of the
5258 * application's components. It does not override any enabled state set by
5259 * {@link #setComponentEnabledSetting} for any of the application's components.
5260 *
5261 * @param packageName The package name of the application to enable
5262 * @param newState The new enabled state for the component. The legal values for this state
5263 * are:
5264 * {@link #COMPONENT_ENABLED_STATE_ENABLED},
5265 * {@link #COMPONENT_ENABLED_STATE_DISABLED}
5266 * and
5267 * {@link #COMPONENT_ENABLED_STATE_DEFAULT}
5268 * The last one removes the setting, thereby restoring the applications's state to
5269 * whatever was set in its manifest (or enabled, by default).
5270 * @param flags Optional behavior flags: {@link #DONT_KILL_APP} or 0.
5271 */
5272 public abstract void setApplicationEnabledSetting(String packageName,
5273 int newState, int flags);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005274
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005275 /**
Amaury Medeirosdde24262014-06-03 20:06:41 -03005276 * Return the enabled setting for an application. This returns
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005277 * the last value set by
5278 * {@link #setApplicationEnabledSetting(String, int, int)}; in most
5279 * cases this value will be {@link #COMPONENT_ENABLED_STATE_DEFAULT} since
5280 * the value originally specified in the manifest has not been modified.
5281 *
Amaury Medeirosdde24262014-06-03 20:06:41 -03005282 * @param packageName The package name of the application to retrieve.
5283 * @return Returns the current enabled state for the application. May
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005284 * be one of {@link #COMPONENT_ENABLED_STATE_ENABLED},
5285 * {@link #COMPONENT_ENABLED_STATE_DISABLED}, or
5286 * {@link #COMPONENT_ENABLED_STATE_DEFAULT}. The last one means the
5287 * application's enabled state is based on the original information in
5288 * the manifest as found in {@link ComponentInfo}.
Mathew Inwood1b9f8d92011-09-26 13:23:56 +01005289 * @throws IllegalArgumentException if the named package does not exist.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005290 */
5291 public abstract int getApplicationEnabledSetting(String packageName);
5292
5293 /**
Sudheer Shankabbb3ff22015-07-09 15:39:23 +01005294 * Flush the package restrictions for a given user to disk. This forces the package restrictions
5295 * like component and package enabled settings to be written to disk and avoids the delay that
5296 * is otherwise present when changing those settings.
5297 *
5298 * @param userId Ther userId of the user whose restrictions are to be flushed.
5299 * @hide
5300 */
5301 public abstract void flushPackageRestrictionsAsUser(int userId);
5302
5303 /**
Amith Yamasanie5bcff62014-07-19 15:44:09 -07005304 * Puts the package in a hidden state, which is almost like an uninstalled state,
Amith Yamasani655d0e22013-06-12 14:19:10 -07005305 * making the package unavailable, but it doesn't remove the data or the actual
Amith Yamasanie5bcff62014-07-19 15:44:09 -07005306 * package file. Application can be unhidden by either resetting the hidden state
5307 * or by installing it, such as with {@link #installExistingPackage(String)}
Amith Yamasani655d0e22013-06-12 14:19:10 -07005308 * @hide
5309 */
Amith Yamasanie5bcff62014-07-19 15:44:09 -07005310 public abstract boolean setApplicationHiddenSettingAsUser(String packageName, boolean hidden,
Amith Yamasani655d0e22013-06-12 14:19:10 -07005311 UserHandle userHandle);
5312
5313 /**
Amith Yamasanie5bcff62014-07-19 15:44:09 -07005314 * Returns the hidden state of a package.
5315 * @see #setApplicationHiddenSettingAsUser(String, boolean, UserHandle)
Amith Yamasani655d0e22013-06-12 14:19:10 -07005316 * @hide
5317 */
Amith Yamasanie5bcff62014-07-19 15:44:09 -07005318 public abstract boolean getApplicationHiddenSettingAsUser(String packageName,
Amith Yamasani655d0e22013-06-12 14:19:10 -07005319 UserHandle userHandle);
5320
5321 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005322 * Return whether the device has been booted into safe mode.
5323 */
5324 public abstract boolean isSafeMode();
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08005325
5326 /**
Svetoslavf7c06eb2015-06-10 18:43:22 -07005327 * Adds a listener for permission changes for installed packages.
5328 *
5329 * @param listener The listener to add.
5330 *
5331 * @hide
5332 */
5333 @SystemApi
5334 @RequiresPermission(Manifest.permission.OBSERVE_GRANT_REVOKE_PERMISSIONS)
5335 public abstract void addOnPermissionsChangeListener(OnPermissionsChangedListener listener);
5336
5337 /**
5338 * Remvoes a listener for permission changes for installed packages.
5339 *
5340 * @param listener The listener to remove.
5341 *
5342 * @hide
5343 */
5344 @SystemApi
5345 public abstract void removeOnPermissionsChangeListener(OnPermissionsChangedListener listener);
5346
5347 /**
dcashman9d2f4412014-06-09 09:27:54 -07005348 * Return the {@link KeySet} associated with the String alias for this
5349 * application.
5350 *
5351 * @param alias The alias for a given {@link KeySet} as defined in the
5352 * application's AndroidManifest.xml.
dcashmanc6f22492014-08-14 09:54:51 -07005353 * @hide
dcashman9d2f4412014-06-09 09:27:54 -07005354 */
5355 public abstract KeySet getKeySetByAlias(String packageName, String alias);
5356
Ihab Awad1ec68882014-09-12 11:09:01 -07005357 /** Return the signing {@link KeySet} for this application.
dcashmanc6f22492014-08-14 09:54:51 -07005358 * @hide
5359 */
dcashman9d2f4412014-06-09 09:27:54 -07005360 public abstract KeySet getSigningKeySet(String packageName);
5361
5362 /**
5363 * Return whether the package denoted by packageName has been signed by all
5364 * of the keys specified by the {@link KeySet} ks. This will return true if
5365 * the package has been signed by additional keys (a superset) as well.
5366 * Compare to {@link #isSignedByExactly(String packageName, KeySet ks)}.
dcashmanc6f22492014-08-14 09:54:51 -07005367 * @hide
dcashman9d2f4412014-06-09 09:27:54 -07005368 */
5369 public abstract boolean isSignedBy(String packageName, KeySet ks);
5370
5371 /**
5372 * Return whether the package denoted by packageName has been signed by all
5373 * of, and only, the keys specified by the {@link KeySet} ks. Compare to
5374 * {@link #isSignedBy(String packageName, KeySet ks)}.
dcashmanc6f22492014-08-14 09:54:51 -07005375 * @hide
dcashman9d2f4412014-06-09 09:27:54 -07005376 */
5377 public abstract boolean isSignedByExactly(String packageName, KeySet ks);
5378
5379 /**
Andrei Stingaceanueb84b182016-01-26 18:39:55 +00005380 * Puts the package in a suspended state, where attempts at starting activities are denied.
Andrei Stingaceanu1e283912015-11-26 15:26:28 +00005381 *
Andrei Stingaceanueb84b182016-01-26 18:39:55 +00005382 * <p>It doesn't remove the data or the actual package file. The application notifications
5383 * will be hidden, the application will not show up in recents, will not be able to show
5384 * toasts or dialogs or ring the device.
5385 *
Kenny Guy871f3eb2016-03-09 20:06:16 +00005386 * <p>The package must already be installed. If the package is uninstalled while suspended
5387 * the package will no longer be suspended.
5388 *
Andrei Stingaceanueb84b182016-01-26 18:39:55 +00005389 * @param packageNames The names of the packages to set the suspended status.
5390 * @param suspended If set to {@code true} than the packages will be suspended, if set to
5391 * {@code false} the packages will be unsuspended.
Andrei Stingaceanu1e283912015-11-26 15:26:28 +00005392 * @param userId The user id.
5393 *
Andrei Stingaceanueb84b182016-01-26 18:39:55 +00005394 * @return an array of package names for which the suspended status is not set as requested in
5395 * this method.
5396 *
Andrei Stingaceanu1e283912015-11-26 15:26:28 +00005397 * @hide
5398 */
Andrei Stingaceanueb84b182016-01-26 18:39:55 +00005399 public abstract String[] setPackagesSuspendedAsUser(
5400 String[] packageNames, boolean suspended, @UserIdInt int userId);
Andrei Stingaceanu1e283912015-11-26 15:26:28 +00005401
Andrei Stingaceanu355b2322016-02-12 16:43:51 +00005402 /**
5403 * @see #setPackageSuspendedAsUser(String, boolean, int)
5404 * @param packageName The name of the package to get the suspended status of.
5405 * @param userId The user id.
5406 * @return {@code true} if the package is suspended or {@code false} if the package is not
5407 * suspended or could not be found.
5408 * @hide
5409 */
5410 public abstract boolean isPackageSuspendedForUser(String packageName, int userId);
5411
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -07005412 /** {@hide} */
Jeff Sharkey620b32b2015-04-23 19:36:02 -07005413 public static boolean isMoveStatusFinished(int status) {
5414 return (status < 0 || status > 100);
5415 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005416
Jeff Sharkeye2d45be2015-04-15 17:14:12 -07005417 /** {@hide} */
Jeff Sharkey620b32b2015-04-23 19:36:02 -07005418 public static abstract class MoveCallback {
Jeff Sharkey50a05452015-04-29 11:24:52 -07005419 public void onCreated(int moveId, Bundle extras) {}
5420 public abstract void onStatusChanged(int moveId, int status, long estMillis);
Jeff Sharkey620b32b2015-04-23 19:36:02 -07005421 }
Jeff Sharkeye2d45be2015-04-15 17:14:12 -07005422
5423 /** {@hide} */
Jeff Sharkey620b32b2015-04-23 19:36:02 -07005424 public abstract int getMoveStatus(int moveId);
5425
5426 /** {@hide} */
5427 public abstract void registerMoveCallback(MoveCallback callback, Handler handler);
5428 /** {@hide} */
5429 public abstract void unregisterMoveCallback(MoveCallback callback);
5430
5431 /** {@hide} */
5432 public abstract int movePackage(String packageName, VolumeInfo vol);
5433 /** {@hide} */
5434 public abstract @Nullable VolumeInfo getPackageCurrentVolume(ApplicationInfo app);
5435 /** {@hide} */
5436 public abstract @NonNull List<VolumeInfo> getPackageCandidateVolumes(ApplicationInfo app);
5437
5438 /** {@hide} */
5439 public abstract int movePrimaryStorage(VolumeInfo vol);
5440 /** {@hide} */
5441 public abstract @Nullable VolumeInfo getPrimaryStorageCurrentVolume();
5442 /** {@hide} */
5443 public abstract @NonNull List<VolumeInfo> getPrimaryStorageCandidateVolumes();
Jeff Sharkeye2d45be2015-04-15 17:14:12 -07005444
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005445 /**
Amith Yamasani13593602012-03-22 16:16:17 -07005446 * Returns the device identity that verifiers can use to associate their scheme to a particular
5447 * device. This should not be used by anything other than a package verifier.
Aravind Akella068b0c02013-10-12 17:39:15 -07005448 *
Kenny Root0aaa0d92011-09-12 16:42:55 -07005449 * @return identity that uniquely identifies current device
5450 * @hide
5451 */
5452 public abstract VerifierDeviceIdentity getVerifierDeviceIdentity();
Amith Yamasani742a6712011-05-04 14:49:28 -07005453
Jeff Sharkey6c833e02014-07-14 22:44:30 -07005454 /**
Jeff Hao9f60c082014-10-28 18:51:07 -07005455 * Returns true if the device is upgrading, such as first boot after OTA.
5456 *
5457 * @hide
5458 */
5459 public abstract boolean isUpgrade();
5460
5461 /**
Jeff Sharkey6c833e02014-07-14 22:44:30 -07005462 * Return interface that offers the ability to install, upgrade, and remove
5463 * applications on the device.
5464 */
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005465 public abstract @NonNull PackageInstaller getPackageInstaller();
Jeff Sharkey3a44f3f2014-04-28 17:36:31 -07005466
Amith Yamasani742a6712011-05-04 14:49:28 -07005467 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005468 * Adds a {@code CrossProfileIntentFilter}. After calling this method all
5469 * intents sent from the user with id sourceUserId can also be be resolved
5470 * by activities in the user with id targetUserId if they match the
5471 * specified intent filter.
5472 *
Nicolas Prevot3f7777f2014-07-24 15:58:39 +01005473 * @param filter The {@link IntentFilter} the intent has to match
5474 * @param sourceUserId The source user id.
5475 * @param targetUserId The target user id.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005476 * @param flags The possible values are {@link #SKIP_CURRENT_PROFILE} and
5477 * {@link #ONLY_IF_NO_MATCH_FOUND}.
Nicolas Prevotc79586e2014-05-06 12:47:57 +01005478 * @hide
5479 */
Nicolas Prevot63798c52014-05-27 13:22:38 +01005480 public abstract void addCrossProfileIntentFilter(IntentFilter filter, int sourceUserId,
5481 int targetUserId, int flags);
Nicolas Prevotc79586e2014-05-06 12:47:57 +01005482
5483 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005484 * Clearing {@code CrossProfileIntentFilter}s which have the specified user
5485 * as their source, and have been set by the app calling this method.
5486 *
Nicolas Prevot3f7777f2014-07-24 15:58:39 +01005487 * @param sourceUserId The source user id.
Nicolas Prevotc79586e2014-05-06 12:47:57 +01005488 * @hide
5489 */
Nicolas Prevot81948992014-05-16 18:25:26 +01005490 public abstract void clearCrossProfileIntentFilters(int sourceUserId);
Alexandra Gherghina6e2ae252014-06-12 16:03:58 +01005491
5492 /**
Nicolas Prevot88cc3462014-05-14 14:51:48 +01005493 * @hide
5494 */
Nicolas Prevot7f7b0c72014-06-23 15:59:38 +01005495 public abstract Drawable loadItemIcon(PackageItemInfo itemInfo, ApplicationInfo appInfo);
Jeff Sharkey6c833e02014-07-14 22:44:30 -07005496
Benjamin Franzec2d48b2014-10-01 15:38:43 +01005497 /**
5498 * @hide
5499 */
5500 public abstract Drawable loadUnbadgedItemIcon(PackageItemInfo itemInfo, ApplicationInfo appInfo);
5501
Jeff Sharkey6c833e02014-07-14 22:44:30 -07005502 /** {@hide} */
5503 public abstract boolean isPackageAvailable(String packageName);
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005504
5505 /** {@hide} */
Jeff Sharkeya0907432014-08-15 10:23:11 -07005506 public static String installStatusToString(int status, String msg) {
5507 final String str = installStatusToString(status);
5508 if (msg != null) {
5509 return str + ": " + msg;
5510 } else {
5511 return str;
5512 }
5513 }
5514
5515 /** {@hide} */
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005516 public static String installStatusToString(int status) {
5517 switch (status) {
5518 case INSTALL_SUCCEEDED: return "INSTALL_SUCCEEDED";
5519 case INSTALL_FAILED_ALREADY_EXISTS: return "INSTALL_FAILED_ALREADY_EXISTS";
5520 case INSTALL_FAILED_INVALID_APK: return "INSTALL_FAILED_INVALID_APK";
5521 case INSTALL_FAILED_INVALID_URI: return "INSTALL_FAILED_INVALID_URI";
5522 case INSTALL_FAILED_INSUFFICIENT_STORAGE: return "INSTALL_FAILED_INSUFFICIENT_STORAGE";
5523 case INSTALL_FAILED_DUPLICATE_PACKAGE: return "INSTALL_FAILED_DUPLICATE_PACKAGE";
5524 case INSTALL_FAILED_NO_SHARED_USER: return "INSTALL_FAILED_NO_SHARED_USER";
5525 case INSTALL_FAILED_UPDATE_INCOMPATIBLE: return "INSTALL_FAILED_UPDATE_INCOMPATIBLE";
5526 case INSTALL_FAILED_SHARED_USER_INCOMPATIBLE: return "INSTALL_FAILED_SHARED_USER_INCOMPATIBLE";
5527 case INSTALL_FAILED_MISSING_SHARED_LIBRARY: return "INSTALL_FAILED_MISSING_SHARED_LIBRARY";
5528 case INSTALL_FAILED_REPLACE_COULDNT_DELETE: return "INSTALL_FAILED_REPLACE_COULDNT_DELETE";
5529 case INSTALL_FAILED_DEXOPT: return "INSTALL_FAILED_DEXOPT";
5530 case INSTALL_FAILED_OLDER_SDK: return "INSTALL_FAILED_OLDER_SDK";
5531 case INSTALL_FAILED_CONFLICTING_PROVIDER: return "INSTALL_FAILED_CONFLICTING_PROVIDER";
5532 case INSTALL_FAILED_NEWER_SDK: return "INSTALL_FAILED_NEWER_SDK";
5533 case INSTALL_FAILED_TEST_ONLY: return "INSTALL_FAILED_TEST_ONLY";
5534 case INSTALL_FAILED_CPU_ABI_INCOMPATIBLE: return "INSTALL_FAILED_CPU_ABI_INCOMPATIBLE";
5535 case INSTALL_FAILED_MISSING_FEATURE: return "INSTALL_FAILED_MISSING_FEATURE";
5536 case INSTALL_FAILED_CONTAINER_ERROR: return "INSTALL_FAILED_CONTAINER_ERROR";
5537 case INSTALL_FAILED_INVALID_INSTALL_LOCATION: return "INSTALL_FAILED_INVALID_INSTALL_LOCATION";
5538 case INSTALL_FAILED_MEDIA_UNAVAILABLE: return "INSTALL_FAILED_MEDIA_UNAVAILABLE";
5539 case INSTALL_FAILED_VERIFICATION_TIMEOUT: return "INSTALL_FAILED_VERIFICATION_TIMEOUT";
5540 case INSTALL_FAILED_VERIFICATION_FAILURE: return "INSTALL_FAILED_VERIFICATION_FAILURE";
5541 case INSTALL_FAILED_PACKAGE_CHANGED: return "INSTALL_FAILED_PACKAGE_CHANGED";
5542 case INSTALL_FAILED_UID_CHANGED: return "INSTALL_FAILED_UID_CHANGED";
5543 case INSTALL_FAILED_VERSION_DOWNGRADE: return "INSTALL_FAILED_VERSION_DOWNGRADE";
5544 case INSTALL_PARSE_FAILED_NOT_APK: return "INSTALL_PARSE_FAILED_NOT_APK";
5545 case INSTALL_PARSE_FAILED_BAD_MANIFEST: return "INSTALL_PARSE_FAILED_BAD_MANIFEST";
5546 case INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION: return "INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION";
5547 case INSTALL_PARSE_FAILED_NO_CERTIFICATES: return "INSTALL_PARSE_FAILED_NO_CERTIFICATES";
5548 case INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES: return "INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES";
5549 case INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING: return "INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING";
5550 case INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME: return "INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME";
5551 case INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID: return "INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID";
5552 case INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: return "INSTALL_PARSE_FAILED_MANIFEST_MALFORMED";
5553 case INSTALL_PARSE_FAILED_MANIFEST_EMPTY: return "INSTALL_PARSE_FAILED_MANIFEST_EMPTY";
5554 case INSTALL_FAILED_INTERNAL_ERROR: return "INSTALL_FAILED_INTERNAL_ERROR";
5555 case INSTALL_FAILED_USER_RESTRICTED: return "INSTALL_FAILED_USER_RESTRICTED";
5556 case INSTALL_FAILED_DUPLICATE_PERMISSION: return "INSTALL_FAILED_DUPLICATE_PERMISSION";
5557 case INSTALL_FAILED_NO_MATCHING_ABIS: return "INSTALL_FAILED_NO_MATCHING_ABIS";
Jeff Sharkeyf0600952014-08-07 17:31:53 -07005558 case INSTALL_FAILED_ABORTED: return "INSTALL_FAILED_ABORTED";
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005559 default: return Integer.toString(status);
5560 }
5561 }
5562
5563 /** {@hide} */
Jeff Sharkeya0907432014-08-15 10:23:11 -07005564 public static int installStatusToPublicStatus(int status) {
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005565 switch (status) {
Jeff Sharkeya0907432014-08-15 10:23:11 -07005566 case INSTALL_SUCCEEDED: return PackageInstaller.STATUS_SUCCESS;
5567 case INSTALL_FAILED_ALREADY_EXISTS: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5568 case INSTALL_FAILED_INVALID_APK: return PackageInstaller.STATUS_FAILURE_INVALID;
5569 case INSTALL_FAILED_INVALID_URI: return PackageInstaller.STATUS_FAILURE_INVALID;
5570 case INSTALL_FAILED_INSUFFICIENT_STORAGE: return PackageInstaller.STATUS_FAILURE_STORAGE;
5571 case INSTALL_FAILED_DUPLICATE_PACKAGE: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5572 case INSTALL_FAILED_NO_SHARED_USER: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5573 case INSTALL_FAILED_UPDATE_INCOMPATIBLE: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5574 case INSTALL_FAILED_SHARED_USER_INCOMPATIBLE: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5575 case INSTALL_FAILED_MISSING_SHARED_LIBRARY: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5576 case INSTALL_FAILED_REPLACE_COULDNT_DELETE: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5577 case INSTALL_FAILED_DEXOPT: return PackageInstaller.STATUS_FAILURE_INVALID;
5578 case INSTALL_FAILED_OLDER_SDK: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5579 case INSTALL_FAILED_CONFLICTING_PROVIDER: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5580 case INSTALL_FAILED_NEWER_SDK: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5581 case INSTALL_FAILED_TEST_ONLY: return PackageInstaller.STATUS_FAILURE_INVALID;
5582 case INSTALL_FAILED_CPU_ABI_INCOMPATIBLE: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5583 case INSTALL_FAILED_MISSING_FEATURE: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5584 case INSTALL_FAILED_CONTAINER_ERROR: return PackageInstaller.STATUS_FAILURE_STORAGE;
5585 case INSTALL_FAILED_INVALID_INSTALL_LOCATION: return PackageInstaller.STATUS_FAILURE_STORAGE;
5586 case INSTALL_FAILED_MEDIA_UNAVAILABLE: return PackageInstaller.STATUS_FAILURE_STORAGE;
5587 case INSTALL_FAILED_VERIFICATION_TIMEOUT: return PackageInstaller.STATUS_FAILURE_ABORTED;
5588 case INSTALL_FAILED_VERIFICATION_FAILURE: return PackageInstaller.STATUS_FAILURE_ABORTED;
5589 case INSTALL_FAILED_PACKAGE_CHANGED: return PackageInstaller.STATUS_FAILURE_INVALID;
5590 case INSTALL_FAILED_UID_CHANGED: return PackageInstaller.STATUS_FAILURE_INVALID;
5591 case INSTALL_FAILED_VERSION_DOWNGRADE: return PackageInstaller.STATUS_FAILURE_INVALID;
Svetoslavd9653702015-05-13 18:02:46 -07005592 case INSTALL_FAILED_PERMISSION_MODEL_DOWNGRADE: return PackageInstaller.STATUS_FAILURE_INVALID;
Jeff Sharkeya0907432014-08-15 10:23:11 -07005593 case INSTALL_PARSE_FAILED_NOT_APK: return PackageInstaller.STATUS_FAILURE_INVALID;
5594 case INSTALL_PARSE_FAILED_BAD_MANIFEST: return PackageInstaller.STATUS_FAILURE_INVALID;
5595 case INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION: return PackageInstaller.STATUS_FAILURE_INVALID;
5596 case INSTALL_PARSE_FAILED_NO_CERTIFICATES: return PackageInstaller.STATUS_FAILURE_INVALID;
5597 case INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES: return PackageInstaller.STATUS_FAILURE_INVALID;
5598 case INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING: return PackageInstaller.STATUS_FAILURE_INVALID;
5599 case INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME: return PackageInstaller.STATUS_FAILURE_INVALID;
5600 case INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID: return PackageInstaller.STATUS_FAILURE_INVALID;
5601 case INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: return PackageInstaller.STATUS_FAILURE_INVALID;
5602 case INSTALL_PARSE_FAILED_MANIFEST_EMPTY: return PackageInstaller.STATUS_FAILURE_INVALID;
5603 case INSTALL_FAILED_INTERNAL_ERROR: return PackageInstaller.STATUS_FAILURE;
5604 case INSTALL_FAILED_USER_RESTRICTED: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5605 case INSTALL_FAILED_DUPLICATE_PERMISSION: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5606 case INSTALL_FAILED_NO_MATCHING_ABIS: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5607 case INSTALL_FAILED_ABORTED: return PackageInstaller.STATUS_FAILURE_ABORTED;
5608 default: return PackageInstaller.STATUS_FAILURE;
5609 }
5610 }
5611
5612 /** {@hide} */
5613 public static String deleteStatusToString(int status, String msg) {
5614 final String str = deleteStatusToString(status);
5615 if (msg != null) {
5616 return str + ": " + msg;
5617 } else {
5618 return str;
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005619 }
5620 }
5621
5622 /** {@hide} */
5623 public static String deleteStatusToString(int status) {
5624 switch (status) {
5625 case DELETE_SUCCEEDED: return "DELETE_SUCCEEDED";
5626 case DELETE_FAILED_INTERNAL_ERROR: return "DELETE_FAILED_INTERNAL_ERROR";
5627 case DELETE_FAILED_DEVICE_POLICY_MANAGER: return "DELETE_FAILED_DEVICE_POLICY_MANAGER";
5628 case DELETE_FAILED_USER_RESTRICTED: return "DELETE_FAILED_USER_RESTRICTED";
5629 case DELETE_FAILED_OWNER_BLOCKED: return "DELETE_FAILED_OWNER_BLOCKED";
Jeff Sharkeyf0600952014-08-07 17:31:53 -07005630 case DELETE_FAILED_ABORTED: return "DELETE_FAILED_ABORTED";
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005631 default: return Integer.toString(status);
5632 }
5633 }
Jeff Sharkeyf0600952014-08-07 17:31:53 -07005634
5635 /** {@hide} */
Jeff Sharkeya0907432014-08-15 10:23:11 -07005636 public static int deleteStatusToPublicStatus(int status) {
Jeff Sharkeyf0600952014-08-07 17:31:53 -07005637 switch (status) {
Jeff Sharkeya0907432014-08-15 10:23:11 -07005638 case DELETE_SUCCEEDED: return PackageInstaller.STATUS_SUCCESS;
5639 case DELETE_FAILED_INTERNAL_ERROR: return PackageInstaller.STATUS_FAILURE;
5640 case DELETE_FAILED_DEVICE_POLICY_MANAGER: return PackageInstaller.STATUS_FAILURE_BLOCKED;
5641 case DELETE_FAILED_USER_RESTRICTED: return PackageInstaller.STATUS_FAILURE_BLOCKED;
5642 case DELETE_FAILED_OWNER_BLOCKED: return PackageInstaller.STATUS_FAILURE_BLOCKED;
5643 case DELETE_FAILED_ABORTED: return PackageInstaller.STATUS_FAILURE_ABORTED;
5644 default: return PackageInstaller.STATUS_FAILURE;
Jeff Sharkeyf0600952014-08-07 17:31:53 -07005645 }
5646 }
Jeff Sharkey6c0b9da2014-08-07 22:07:11 -07005647
5648 /** {@hide} */
Svet Ganov77ab6a82015-07-03 12:03:02 -07005649 public static String permissionFlagToString(int flag) {
5650 switch (flag) {
Svetoslav4a5f4a22015-07-07 18:18:15 -07005651 case FLAG_PERMISSION_GRANTED_BY_DEFAULT: return "GRANTED_BY_DEFAULT";
5652 case FLAG_PERMISSION_POLICY_FIXED: return "POLICY_FIXED";
5653 case FLAG_PERMISSION_SYSTEM_FIXED: return "SYSTEM_FIXED";
5654 case FLAG_PERMISSION_USER_SET: return "USER_SET";
5655 case FLAG_PERMISSION_REVOKE_ON_UPGRADE: return "REVOKE_ON_UPGRADE";
5656 case FLAG_PERMISSION_USER_FIXED: return "USER_FIXED";
Svet Ganov9c165d72015-12-01 19:52:26 -08005657 case FLAG_PERMISSION_REVIEW_REQUIRED: return "REVIEW_REQUIRED";
Svet Ganov77ab6a82015-07-03 12:03:02 -07005658 default: return Integer.toString(flag);
5659 }
5660 }
5661
5662 /** {@hide} */
Jeff Sharkey6c0b9da2014-08-07 22:07:11 -07005663 public static class LegacyPackageInstallObserver extends PackageInstallObserver {
5664 private final IPackageInstallObserver mLegacy;
5665
5666 public LegacyPackageInstallObserver(IPackageInstallObserver legacy) {
5667 mLegacy = legacy;
5668 }
5669
5670 @Override
5671 public void onPackageInstalled(String basePackageName, int returnCode, String msg,
5672 Bundle extras) {
5673 if (mLegacy == null) return;
5674 try {
5675 mLegacy.packageInstalled(basePackageName, returnCode);
5676 } catch (RemoteException ignored) {
5677 }
5678 }
5679 }
5680
5681 /** {@hide} */
5682 public static class LegacyPackageDeleteObserver extends PackageDeleteObserver {
5683 private final IPackageDeleteObserver mLegacy;
5684
5685 public LegacyPackageDeleteObserver(IPackageDeleteObserver legacy) {
5686 mLegacy = legacy;
5687 }
5688
5689 @Override
5690 public void onPackageDeleted(String basePackageName, int returnCode, String msg) {
5691 if (mLegacy == null) return;
5692 try {
5693 mLegacy.packageDeleted(basePackageName, returnCode);
5694 } catch (RemoteException ignored) {
5695 }
5696 }
5697 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005698}