blob: 5f82c2a76a18fa889d08d13053a8b7f377b65dfb [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;
Todd Kennedy9106c642017-02-08 14:16:53 -080023import android.annotation.IntRange;
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -070024import android.annotation.NonNull;
Jeff Sharkeye2d45be2015-04-15 17:14:12 -070025import android.annotation.Nullable;
Svetoslavf7c06eb2015-06-10 18:43:22 -070026import android.annotation.RequiresPermission;
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -080027import android.annotation.SdkConstant;
28import android.annotation.SdkConstant.SdkConstantType;
Tor Norbye7b9c9122013-05-30 16:48:33 -070029import android.annotation.StringRes;
Jeff Sharkeybb580672014-07-10 12:10:25 -070030import android.annotation.SystemApi;
Jeff Sharkeya73b8fd2016-01-06 17:02:08 -070031import android.annotation.TestApi;
Jeff Sharkeybd940222016-01-08 11:07:13 -070032import android.annotation.UserIdInt;
Tor Norbye7b9c9122013-05-30 16:48:33 -070033import android.annotation.XmlRes;
Dianne Hackborn2a103f12017-08-08 15:50:31 -070034import android.app.ActivityManager;
Jeff Sharkey6c0b9da2014-08-07 22:07:11 -070035import android.app.PackageDeleteObserver;
Christopher Tatef1977b42014-03-24 16:25:51 -070036import android.app.PackageInstallObserver;
Amith Yamasani1d653272014-09-11 17:56:05 -070037import android.app.admin.DevicePolicyManager;
Jeff Sharkey60f95aa2017-03-08 13:57:15 -070038import android.app.usage.StorageStatsManager;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080039import android.content.ComponentName;
40import android.content.Context;
41import android.content.Intent;
42import android.content.IntentFilter;
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -070043import android.content.IntentSender;
Jeff Sharkeyc4858a22014-06-16 10:51:20 -070044import android.content.pm.PackageParser.PackageParserException;
Calin Juravle45f8b292017-11-07 18:49:43 -080045import android.content.pm.dex.ArtManager;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080046import android.content.res.Resources;
47import android.content.res.XmlResourceParser;
Svetoslavc7d62f02014-09-04 15:39:54 -070048import android.graphics.Rect;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080049import android.graphics.drawable.Drawable;
Peter Qiu3d615e42017-08-07 20:13:32 +000050import android.net.wifi.WifiManager;
Jeff Sharkey6f4b2a32017-03-21 14:13:41 -060051import android.os.Build;
Jeff Sharkeybb580672014-07-10 12:10:25 -070052import android.os.Bundle;
Jeff Sharkey620b32b2015-04-23 19:36:02 -070053import android.os.Handler;
Jeff Sharkey6c0b9da2014-08-07 22:07:11 -070054import android.os.RemoteException;
Dianne Hackborn0c380492012-08-20 17:23:30 -070055import android.os.UserHandle;
Jeff Sharkey8a372a02016-03-16 16:25:45 -060056import android.os.UserManager;
Jeff Sharkey683bcd32017-03-18 17:54:51 -060057import android.os.storage.StorageManager;
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -070058import android.os.storage.VolumeInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080059import android.util.AndroidException;
Jeff Sharkeybd940222016-01-08 11:07:13 -070060import android.util.Log;
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -070061
Svetoslavc6d1c342015-02-26 14:44:43 -080062import com.android.internal.util.ArrayUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080063
Jeff Sharkey6f4b2a32017-03-21 14:13:41 -060064import dalvik.system.VMRuntime;
65
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080066import java.io.File;
Tor Norbyed9273d62013-05-30 15:59:53 -070067import java.lang.annotation.Retention;
68import java.lang.annotation.RetentionPolicy;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080069import java.util.List;
70
71/**
72 * Class for retrieving various kinds of information related to the application
73 * packages that are currently installed on the device.
74 *
75 * You can find this class through {@link Context#getPackageManager}.
76 */
77public abstract class PackageManager {
Jeff Sharkeybd940222016-01-08 11:07:13 -070078 private static final String TAG = "PackageManager";
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080079
Jeff Sharkeye4697132016-02-06 19:46:15 -070080 /** {@hide} */
Jeff Sharkey8a372a02016-03-16 16:25:45 -060081 public static final boolean APPLY_DEFAULT_TO_DEVICE_PROTECTED_STORAGE = true;
Jeff Sharkeye4697132016-02-06 19:46:15 -070082
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080083 /**
84 * This exception is thrown when a given package, application, or component
kmccormick30498b42013-03-27 17:39:17 -070085 * name cannot be found.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080086 */
87 public static class NameNotFoundException extends AndroidException {
88 public NameNotFoundException() {
89 }
90
91 public NameNotFoundException(String name) {
92 super(name);
93 }
94 }
95
96 /**
Svetoslavf7c06eb2015-06-10 18:43:22 -070097 * Listener for changes in permissions granted to a UID.
98 *
99 * @hide
100 */
101 @SystemApi
102 public interface OnPermissionsChangedListener {
103
104 /**
105 * Called when the permissions for a UID change.
106 * @param uid The UID with a change.
107 */
108 public void onPermissionsChanged(int uid);
109 }
110
111 /**
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700112 * As a guiding principle:
113 * <p>
114 * {@code GET_} flags are used to request additional data that may have been
115 * elided to save wire space.
116 * <p>
117 * {@code MATCH_} flags are used to include components or packages that
118 * would have otherwise been omitted from a result set by current system
119 * state.
120 */
121
122 /** @hide */
Jeff Sharkey4347f812017-04-21 12:08:39 -0600123 @IntDef(flag = true, prefix = { "GET_", "MATCH_" }, value = {
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700124 GET_ACTIVITIES,
Todd Kennedy6b9bfa12016-01-08 13:44:51 -0800125 GET_CONFIGURATIONS,
126 GET_GIDS,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700127 GET_INSTRUMENTATION,
128 GET_INTENT_FILTERS,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700129 GET_META_DATA,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700130 GET_PERMISSIONS,
Todd Kennedy6b9bfa12016-01-08 13:44:51 -0800131 GET_PROVIDERS,
132 GET_RECEIVERS,
133 GET_SERVICES,
134 GET_SHARED_LIBRARY_FILES,
135 GET_SIGNATURES,
136 GET_URI_PERMISSION_PATTERNS,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700137 MATCH_UNINSTALLED_PACKAGES,
138 MATCH_DISABLED_COMPONENTS,
139 MATCH_DISABLED_UNTIL_USED_COMPONENTS,
Jeff Sharkeyc5967e92016-01-07 18:50:29 -0700140 MATCH_SYSTEM_ONLY,
Todd Kennedyd6ee0ba2016-03-31 15:11:11 -0700141 MATCH_FACTORY_ONLY,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700142 MATCH_DEBUG_TRIAGED_MISSING,
Todd Kennedy9c9fdf22017-03-06 10:58:27 -0800143 MATCH_INSTANT,
Todd Kennedy1f397f42016-06-28 12:14:11 -0700144 GET_DISABLED_COMPONENTS,
145 GET_DISABLED_UNTIL_USED_COMPONENTS,
146 GET_UNINSTALLED_PACKAGES,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700147 })
148 @Retention(RetentionPolicy.SOURCE)
149 public @interface PackageInfoFlags {}
150
151 /** @hide */
Jeff Sharkey4347f812017-04-21 12:08:39 -0600152 @IntDef(flag = true, prefix = { "GET_", "MATCH_" }, value = {
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700153 GET_META_DATA,
154 GET_SHARED_LIBRARY_FILES,
155 MATCH_UNINSTALLED_PACKAGES,
156 MATCH_SYSTEM_ONLY,
157 MATCH_DEBUG_TRIAGED_MISSING,
Todd Kennedy24522022017-03-27 16:32:20 -0700158 MATCH_DISABLED_COMPONENTS,
Todd Kennedy5a32c6c2016-07-07 14:29:06 -0700159 MATCH_DISABLED_UNTIL_USED_COMPONENTS,
Todd Kennedy9c9fdf22017-03-06 10:58:27 -0800160 MATCH_INSTANT,
Svet Ganov9e779772017-05-11 14:36:50 -0700161 MATCH_STATIC_SHARED_LIBRARIES,
Todd Kennedy5a32c6c2016-07-07 14:29:06 -0700162 GET_DISABLED_UNTIL_USED_COMPONENTS,
Todd Kennedy1f397f42016-06-28 12:14:11 -0700163 GET_UNINSTALLED_PACKAGES,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700164 })
165 @Retention(RetentionPolicy.SOURCE)
166 public @interface ApplicationInfoFlags {}
167
168 /** @hide */
Jeff Sharkey4347f812017-04-21 12:08:39 -0600169 @IntDef(flag = true, prefix = { "GET_", "MATCH_" }, value = {
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700170 GET_META_DATA,
171 GET_SHARED_LIBRARY_FILES,
Todd Kennedy6b9bfa12016-01-08 13:44:51 -0800172 MATCH_ALL,
173 MATCH_DEBUG_TRIAGED_MISSING,
174 MATCH_DEFAULT_ONLY,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700175 MATCH_DISABLED_COMPONENTS,
176 MATCH_DISABLED_UNTIL_USED_COMPONENTS,
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600177 MATCH_DIRECT_BOOT_AWARE,
178 MATCH_DIRECT_BOOT_UNAWARE,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700179 MATCH_SYSTEM_ONLY,
Todd Kennedy6b9bfa12016-01-08 13:44:51 -0800180 MATCH_UNINSTALLED_PACKAGES,
Todd Kennedy9c9fdf22017-03-06 10:58:27 -0800181 MATCH_INSTANT,
Svet Ganov9e779772017-05-11 14:36:50 -0700182 MATCH_STATIC_SHARED_LIBRARIES,
Todd Kennedy1f397f42016-06-28 12:14:11 -0700183 GET_DISABLED_COMPONENTS,
184 GET_DISABLED_UNTIL_USED_COMPONENTS,
185 GET_UNINSTALLED_PACKAGES,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700186 })
187 @Retention(RetentionPolicy.SOURCE)
188 public @interface ComponentInfoFlags {}
189
190 /** @hide */
Jeff Sharkey4347f812017-04-21 12:08:39 -0600191 @IntDef(flag = true, prefix = { "GET_", "MATCH_" }, value = {
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700192 GET_META_DATA,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700193 GET_RESOLVED_FILTER,
Todd Kennedy6b9bfa12016-01-08 13:44:51 -0800194 GET_SHARED_LIBRARY_FILES,
195 MATCH_ALL,
196 MATCH_DEBUG_TRIAGED_MISSING,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700197 MATCH_DISABLED_COMPONENTS,
198 MATCH_DISABLED_UNTIL_USED_COMPONENTS,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700199 MATCH_DEFAULT_ONLY,
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600200 MATCH_DIRECT_BOOT_AWARE,
201 MATCH_DIRECT_BOOT_UNAWARE,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700202 MATCH_SYSTEM_ONLY,
Todd Kennedy6b9bfa12016-01-08 13:44:51 -0800203 MATCH_UNINSTALLED_PACKAGES,
Todd Kennedy9c9fdf22017-03-06 10:58:27 -0800204 MATCH_INSTANT,
Todd Kennedy1f397f42016-06-28 12:14:11 -0700205 GET_DISABLED_COMPONENTS,
206 GET_DISABLED_UNTIL_USED_COMPONENTS,
207 GET_UNINSTALLED_PACKAGES,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700208 })
209 @Retention(RetentionPolicy.SOURCE)
210 public @interface ResolveInfoFlags {}
211
212 /** @hide */
Jeff Sharkey4347f812017-04-21 12:08:39 -0600213 @IntDef(flag = true, prefix = { "GET_", "MATCH_" }, value = {
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700214 GET_META_DATA,
215 })
216 @Retention(RetentionPolicy.SOURCE)
217 public @interface PermissionInfoFlags {}
218
219 /** @hide */
Jeff Sharkey4347f812017-04-21 12:08:39 -0600220 @IntDef(flag = true, prefix = { "GET_", "MATCH_" }, value = {
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700221 GET_META_DATA,
222 })
223 @Retention(RetentionPolicy.SOURCE)
224 public @interface PermissionGroupInfoFlags {}
225
226 /** @hide */
Jeff Sharkey4347f812017-04-21 12:08:39 -0600227 @IntDef(flag = true, prefix = { "GET_", "MATCH_" }, value = {
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700228 GET_META_DATA,
229 })
230 @Retention(RetentionPolicy.SOURCE)
231 public @interface InstrumentationInfoFlags {}
232
233 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800234 * {@link PackageInfo} flag: return information about
235 * activities in the package in {@link PackageInfo#activities}.
236 */
237 public static final int GET_ACTIVITIES = 0x00000001;
238
239 /**
240 * {@link PackageInfo} flag: return information about
241 * intent receivers in the package in
242 * {@link PackageInfo#receivers}.
243 */
244 public static final int GET_RECEIVERS = 0x00000002;
245
246 /**
247 * {@link PackageInfo} flag: return information about
248 * services in the package in {@link PackageInfo#services}.
249 */
250 public static final int GET_SERVICES = 0x00000004;
251
252 /**
253 * {@link PackageInfo} flag: return information about
254 * content providers in the package in
255 * {@link PackageInfo#providers}.
256 */
257 public static final int GET_PROVIDERS = 0x00000008;
258
259 /**
260 * {@link PackageInfo} flag: return information about
261 * instrumentation in the package in
262 * {@link PackageInfo#instrumentation}.
263 */
264 public static final int GET_INSTRUMENTATION = 0x00000010;
265
266 /**
267 * {@link PackageInfo} flag: return information about the
268 * intent filters supported by the activity.
269 */
270 public static final int GET_INTENT_FILTERS = 0x00000020;
271
272 /**
273 * {@link PackageInfo} flag: return information about the
274 * signatures included in the package.
275 */
276 public static final int GET_SIGNATURES = 0x00000040;
277
278 /**
279 * {@link ResolveInfo} flag: return the IntentFilter that
280 * was matched for a particular ResolveInfo in
281 * {@link ResolveInfo#filter}.
282 */
283 public static final int GET_RESOLVED_FILTER = 0x00000040;
284
285 /**
286 * {@link ComponentInfo} flag: return the {@link ComponentInfo#metaData}
287 * data {@link android.os.Bundle}s that are associated with a component.
288 * This applies for any API returning a ComponentInfo subclass.
289 */
290 public static final int GET_META_DATA = 0x00000080;
291
292 /**
293 * {@link PackageInfo} flag: return the
294 * {@link PackageInfo#gids group ids} that are associated with an
295 * application.
Ken Wakasaf76a50c2012-03-09 19:56:35 +0900296 * This applies for any API returning a PackageInfo class, either
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800297 * directly or nested inside of another.
298 */
299 public static final int GET_GIDS = 0x00000100;
300
301 /**
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700302 * @deprecated replaced with {@link #MATCH_DISABLED_COMPONENTS}
303 */
304 @Deprecated
305 public static final int GET_DISABLED_COMPONENTS = 0x00000200;
306
307 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800308 * {@link PackageInfo} flag: include disabled components in the returned info.
309 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700310 public static final int MATCH_DISABLED_COMPONENTS = 0x00000200;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800311
312 /**
313 * {@link ApplicationInfo} flag: return the
314 * {@link ApplicationInfo#sharedLibraryFiles paths to the shared libraries}
315 * that are associated with an application.
316 * This applies for any API returning an ApplicationInfo class, either
317 * directly or nested inside of another.
318 */
319 public static final int GET_SHARED_LIBRARY_FILES = 0x00000400;
320
321 /**
322 * {@link ProviderInfo} flag: return the
323 * {@link ProviderInfo#uriPermissionPatterns URI permission patterns}
324 * that are associated with a content provider.
Ken Wakasaf76a50c2012-03-09 19:56:35 +0900325 * This applies for any API returning a ProviderInfo class, either
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800326 * directly or nested inside of another.
327 */
328 public static final int GET_URI_PERMISSION_PATTERNS = 0x00000800;
329 /**
330 * {@link PackageInfo} flag: return information about
331 * permissions in the package in
332 * {@link PackageInfo#permissions}.
333 */
334 public static final int GET_PERMISSIONS = 0x00001000;
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700335
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800336 /**
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700337 * @deprecated replaced with {@link #MATCH_UNINSTALLED_PACKAGES}
338 */
339 @Deprecated
340 public static final int GET_UNINSTALLED_PACKAGES = 0x00002000;
341
342 /**
Kenny Root685f4902011-11-03 10:13:29 -0700343 * Flag parameter to retrieve some information about all applications (even
344 * uninstalled ones) which have data directories. This state could have
345 * resulted if applications have been deleted with flag
346 * {@code DONT_DELETE_DATA} with a possibility of being replaced or
347 * reinstalled in future.
348 * <p>
349 * Note: this flag may cause less information about currently installed
350 * applications to be returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800351 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700352 public static final int MATCH_UNINSTALLED_PACKAGES = 0x00002000;
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700353
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800354 /**
355 * {@link PackageInfo} flag: return information about
Dianne Hackborn49237342009-08-27 20:08:01 -0700356 * hardware preferences in
Adam Lesinskid3edfde2014-08-08 17:32:44 -0700357 * {@link PackageInfo#configPreferences PackageInfo.configPreferences},
358 * and requested features in {@link PackageInfo#reqFeatures} and
359 * {@link PackageInfo#featureGroups}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800360 */
361 public static final int GET_CONFIGURATIONS = 0x00004000;
362
363 /**
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700364 * @deprecated replaced with {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}.
365 */
366 @Deprecated
367 public static final int GET_DISABLED_UNTIL_USED_COMPONENTS = 0x00008000;
368
369 /**
Dianne Hackbornfd7aded2013-01-22 17:10:23 -0800370 * {@link PackageInfo} flag: include disabled components which are in
371 * that state only because of {@link #COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED}
372 * in the returned info. Note that if you set this flag, applications
373 * that are in this disabled state will be reported as enabled.
374 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700375 public static final int MATCH_DISABLED_UNTIL_USED_COMPONENTS = 0x00008000;
Dianne Hackbornfd7aded2013-01-22 17:10:23 -0800376
377 /**
Dianne Hackborn1655be42009-05-08 14:29:01 -0700378 * Resolution and querying flag: if set, only filters that support the
379 * {@link android.content.Intent#CATEGORY_DEFAULT} will be considered for
380 * matching. This is a synonym for including the CATEGORY_DEFAULT in your
381 * supplied Intent.
382 */
Fabrice Di Meglio9f7e39f2015-04-10 20:40:16 -0700383 public static final int MATCH_DEFAULT_ONLY = 0x00010000;
384
385 /**
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700386 * Querying flag: if set and if the platform is doing any filtering of the
387 * results, then the filtering will not happen. This is a synonym for saying
388 * that all results should be returned.
389 * <p>
390 * <em>This flag should be used with extreme care.</em>
Fabrice Di Meglio9f7e39f2015-04-10 20:40:16 -0700391 */
392 public static final int MATCH_ALL = 0x00020000;
Dianne Hackborn1655be42009-05-08 14:29:01 -0700393
Nicolas Prevot63798c52014-05-27 13:22:38 +0100394 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600395 * Querying flag: match components which are direct boot <em>unaware</em> in
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700396 * the returned info, regardless of the current user state.
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600397 * <p>
398 * When neither {@link #MATCH_DIRECT_BOOT_AWARE} nor
399 * {@link #MATCH_DIRECT_BOOT_UNAWARE} are specified, the default behavior is
400 * to match only runnable components based on the user state. For example,
401 * when a user is started but credentials have not been presented yet, the
402 * user is running "locked" and only {@link #MATCH_DIRECT_BOOT_AWARE}
403 * components are returned. Once the user credentials have been presented,
404 * the user is running "unlocked" and both {@link #MATCH_DIRECT_BOOT_AWARE}
405 * and {@link #MATCH_DIRECT_BOOT_UNAWARE} components are returned.
406 *
407 * @see UserManager#isUserUnlocked()
Jeff Sharkeye17ac152015-11-06 22:40:29 -0800408 */
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600409 public static final int MATCH_DIRECT_BOOT_UNAWARE = 0x00040000;
410
411 /**
412 * Querying flag: match components which are direct boot <em>aware</em> in
413 * the returned info, regardless of the current user state.
414 * <p>
415 * When neither {@link #MATCH_DIRECT_BOOT_AWARE} nor
416 * {@link #MATCH_DIRECT_BOOT_UNAWARE} are specified, the default behavior is
417 * to match only runnable components based on the user state. For example,
418 * when a user is started but credentials have not been presented yet, the
419 * user is running "locked" and only {@link #MATCH_DIRECT_BOOT_AWARE}
420 * components are returned. Once the user credentials have been presented,
421 * the user is running "unlocked" and both {@link #MATCH_DIRECT_BOOT_AWARE}
422 * and {@link #MATCH_DIRECT_BOOT_UNAWARE} components are returned.
423 *
424 * @see UserManager#isUserUnlocked()
425 */
426 public static final int MATCH_DIRECT_BOOT_AWARE = 0x00080000;
427
Jeff Sharkey2a9e3f82015-12-18 10:57:58 -0700428 /**
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700429 * Querying flag: include only components from applications that are marked
430 * with {@link ApplicationInfo#FLAG_SYSTEM}.
Jeff Sharkey5217cac2015-12-20 15:34:01 -0700431 */
432 public static final int MATCH_SYSTEM_ONLY = 0x00100000;
433
434 /**
Todd Kennedyd6ee0ba2016-03-31 15:11:11 -0700435 * Internal {@link PackageInfo} flag: include only components on the system image.
436 * This will not return information on any unbundled update to system components.
437 * @hide
438 */
Todd Kennedy49084962017-03-27 16:20:37 -0700439 @SystemApi
Todd Kennedyd6ee0ba2016-03-31 15:11:11 -0700440 public static final int MATCH_FACTORY_ONLY = 0x00200000;
441
442 /**
Amith Yamasani0d1fd8d2016-10-12 14:21:51 -0700443 * Allows querying of packages installed for any user, not just the specific one. This flag
Amith Yamasani475f9a32016-12-08 09:46:15 -0800444 * is only meant for use by apps that have INTERACT_ACROSS_USERS permission.
Amith Yamasani0d1fd8d2016-10-12 14:21:51 -0700445 * @hide
446 */
Amith Yamasani475f9a32016-12-08 09:46:15 -0800447 @SystemApi
Amith Yamasani0d1fd8d2016-10-12 14:21:51 -0700448 public static final int MATCH_ANY_USER = 0x00400000;
449
450 /**
451 * Combination of MATCH_ANY_USER and MATCH_UNINSTALLED_PACKAGES to mean any known
452 * package.
453 * @hide
454 */
455 public static final int MATCH_KNOWN_PACKAGES = MATCH_UNINSTALLED_PACKAGES | MATCH_ANY_USER;
456
457 /**
Todd Kennedy7bc3a702016-12-08 14:54:48 -0800458 * Internal {@link PackageInfo} flag: include components that are part of an
Todd Kennedybe0b8892017-02-15 14:13:52 -0800459 * instant app. By default, instant app components are not matched.
Todd Kennedy7bc3a702016-12-08 14:54:48 -0800460 * @hide
461 */
Todd Kennedy9c9fdf22017-03-06 10:58:27 -0800462 @SystemApi
Todd Kennedybe0b8892017-02-15 14:13:52 -0800463 public static final int MATCH_INSTANT = 0x00800000;
Todd Kennedy7bc3a702016-12-08 14:54:48 -0800464
465 /**
466 * Internal {@link PackageInfo} flag: include only components that are exposed to
Todd Kennedyc05f5d12017-04-25 11:11:40 -0700467 * instant apps. Matched components may have been either explicitly or implicitly
468 * exposed.
Todd Kennedy7bc3a702016-12-08 14:54:48 -0800469 * @hide
470 */
Todd Kennedybe0b8892017-02-15 14:13:52 -0800471 public static final int MATCH_VISIBLE_TO_INSTANT_APP_ONLY = 0x01000000;
Todd Kennedy7bc3a702016-12-08 14:54:48 -0800472
473 /**
Todd Kennedyc05f5d12017-04-25 11:11:40 -0700474 * Internal {@link PackageInfo} flag: include only components that have been
475 * explicitly exposed to instant apps.
476 * @hide
477 */
478 public static final int MATCH_EXPLICITLY_VISIBLE_ONLY = 0x02000000;
479
480 /**
Svet Ganov9e779772017-05-11 14:36:50 -0700481 * Internal {@link PackageInfo} flag: include static shared libraries.
482 * Apps that depend on static shared libs can always access the version
483 * of the lib they depend on. System/shell/root can access all shared
484 * libs regardless of dependency but need to explicitly ask for them
485 * via this flag.
486 * @hide
487 */
488 public static final int MATCH_STATIC_SHARED_LIBRARIES = 0x04000000;
489
490 /**
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700491 * Internal flag used to indicate that a system component has done their
492 * homework and verified that they correctly handle packages and components
493 * that come and go over time. In particular:
494 * <ul>
495 * <li>Apps installed on external storage, which will appear to be
496 * uninstalled while the the device is ejected.
497 * <li>Apps with encryption unaware components, which will appear to not
498 * exist while the device is locked.
499 * </ul>
Jeff Sharkeye17ac152015-11-06 22:40:29 -0800500 *
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700501 * @see #MATCH_UNINSTALLED_PACKAGES
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600502 * @see #MATCH_DIRECT_BOOT_AWARE
503 * @see #MATCH_DIRECT_BOOT_UNAWARE
Jeff Sharkeye17ac152015-11-06 22:40:29 -0800504 * @hide
505 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700506 public static final int MATCH_DEBUG_TRIAGED_MISSING = 0x10000000;
Jeff Sharkeye17ac152015-11-06 22:40:29 -0800507
508 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700509 * Flag for {@link #addCrossProfileIntentFilter}: if this flag is set: when
510 * resolving an intent that matches the {@code CrossProfileIntentFilter},
511 * the current profile will be skipped. Only activities in the target user
512 * can respond to the intent.
513 *
Nicolas Prevot63798c52014-05-27 13:22:38 +0100514 * @hide
515 */
516 public static final int SKIP_CURRENT_PROFILE = 0x00000002;
517
Tony Mak807e01c2015-12-01 20:19:03 +0000518 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700519 * Flag for {@link #addCrossProfileIntentFilter}: if this flag is set:
Tony Mak807e01c2015-12-01 20:19:03 +0000520 * activities in the other profiles can respond to the intent only if no activity with
521 * non-negative priority in current profile can respond to the intent.
522 * @hide
523 */
524 public static final int ONLY_IF_NO_MATCH_FOUND = 0x00000004;
525
Tor Norbyed9273d62013-05-30 15:59:53 -0700526 /** @hide */
Jeff Sharkey4347f812017-04-21 12:08:39 -0600527 @IntDef(prefix = { "PERMISSION_" }, value = {
528 PERMISSION_GRANTED,
529 PERMISSION_DENIED
530 })
Tor Norbyed9273d62013-05-30 15:59:53 -0700531 @Retention(RetentionPolicy.SOURCE)
532 public @interface PermissionResult {}
533
Dianne Hackborn1655be42009-05-08 14:29:01 -0700534 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800535 * Permission check result: this is returned by {@link #checkPermission}
536 * if the permission has been granted to the given package.
537 */
538 public static final int PERMISSION_GRANTED = 0;
539
540 /**
541 * Permission check result: this is returned by {@link #checkPermission}
542 * if the permission has not been granted to the given package.
543 */
544 public static final int PERMISSION_DENIED = -1;
545
Jeff Sharkey30e06bb2017-04-24 11:18:03 -0600546 /** @hide */
547 @IntDef(prefix = { "SIGNATURE_" }, value = {
548 SIGNATURE_MATCH,
549 SIGNATURE_NEITHER_SIGNED,
550 SIGNATURE_FIRST_NOT_SIGNED,
551 SIGNATURE_SECOND_NOT_SIGNED,
552 SIGNATURE_NO_MATCH,
553 SIGNATURE_UNKNOWN_PACKAGE,
554 })
555 @Retention(RetentionPolicy.SOURCE)
556 public @interface SignatureResult {}
557
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800558 /**
559 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700560 * if all signatures on the two packages match.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800561 */
562 public static final int SIGNATURE_MATCH = 0;
563
564 /**
565 * Signature check result: this is returned by {@link #checkSignatures}
566 * if neither of the two packages is signed.
567 */
568 public static final int SIGNATURE_NEITHER_SIGNED = 1;
569
570 /**
571 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700572 * if the first package is not signed but the second is.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800573 */
574 public static final int SIGNATURE_FIRST_NOT_SIGNED = -1;
575
576 /**
577 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700578 * if the second package is not signed but the first is.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800579 */
580 public static final int SIGNATURE_SECOND_NOT_SIGNED = -2;
581
582 /**
583 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700584 * if not all signatures on both packages match.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800585 */
586 public static final int SIGNATURE_NO_MATCH = -3;
587
588 /**
589 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700590 * if either of the packages are not valid.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800591 */
592 public static final int SIGNATURE_UNKNOWN_PACKAGE = -4;
593
Jeff Sharkey30e06bb2017-04-24 11:18:03 -0600594 /** @hide */
595 @IntDef(prefix = { "COMPONENT_ENABLED_STATE_" }, value = {
596 COMPONENT_ENABLED_STATE_DEFAULT,
597 COMPONENT_ENABLED_STATE_ENABLED,
598 COMPONENT_ENABLED_STATE_DISABLED,
599 COMPONENT_ENABLED_STATE_DISABLED_USER,
600 COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED,
601 })
602 @Retention(RetentionPolicy.SOURCE)
603 public @interface EnabledState {}
604
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700605 /**
Jeff Sharkey30e06bb2017-04-24 11:18:03 -0600606 * Flag for {@link #setApplicationEnabledSetting(String, int, int)} and
607 * {@link #setComponentEnabledSetting(ComponentName, int, int)}: This
608 * component or application is in its default enabled state (as specified in
609 * its manifest).
610 * <p>
611 * Explicitly setting the component state to this value restores it's
612 * enabled state to whatever is set in the manifest.
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700613 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800614 public static final int COMPONENT_ENABLED_STATE_DEFAULT = 0;
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700615
616 /**
617 * Flag for {@link #setApplicationEnabledSetting(String, int, int)}
618 * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This
619 * component or application has been explictily enabled, regardless of
620 * what it has specified in its manifest.
621 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800622 public static final int COMPONENT_ENABLED_STATE_ENABLED = 1;
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700623
624 /**
625 * Flag for {@link #setApplicationEnabledSetting(String, int, int)}
626 * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This
627 * component or application has been explicitly disabled, regardless of
628 * what it has specified in its manifest.
629 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800630 public static final int COMPONENT_ENABLED_STATE_DISABLED = 2;
631
632 /**
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700633 * Flag for {@link #setApplicationEnabledSetting(String, int, int)} only: The
634 * user has explicitly disabled the application, regardless of what it has
635 * specified in its manifest. Because this is due to the user's request,
636 * they may re-enable it if desired through the appropriate system UI. This
kmccormick30498b42013-03-27 17:39:17 -0700637 * option currently <strong>cannot</strong> be used with
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700638 * {@link #setComponentEnabledSetting(ComponentName, int, int)}.
639 */
640 public static final int COMPONENT_ENABLED_STATE_DISABLED_USER = 3;
641
642 /**
Dianne Hackbornfd7aded2013-01-22 17:10:23 -0800643 * Flag for {@link #setApplicationEnabledSetting(String, int, int)} only: This
644 * application should be considered, until the point where the user actually
645 * wants to use it. This means that it will not normally show up to the user
646 * (such as in the launcher), but various parts of the user interface can
647 * use {@link #GET_DISABLED_UNTIL_USED_COMPONENTS} to still see it and allow
648 * the user to select it (as for example an IME, device admin, etc). Such code,
649 * once the user has selected the app, should at that point also make it enabled.
650 * This option currently <strong>can not</strong> be used with
651 * {@link #setComponentEnabledSetting(ComponentName, int, int)}.
652 */
653 public static final int COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED = 4;
654
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700655 /** @hide */
Jeff Sharkey4347f812017-04-21 12:08:39 -0600656 @IntDef(flag = true, prefix = { "INSTALL_" }, value = {
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700657 INSTALL_FORWARD_LOCK,
658 INSTALL_REPLACE_EXISTING,
659 INSTALL_ALLOW_TEST,
660 INSTALL_EXTERNAL,
661 INSTALL_INTERNAL,
662 INSTALL_FROM_ADB,
663 INSTALL_ALL_USERS,
664 INSTALL_ALLOW_DOWNGRADE,
665 INSTALL_GRANT_RUNTIME_PERMISSIONS,
666 INSTALL_FORCE_VOLUME_UUID,
667 INSTALL_FORCE_PERMISSION_PROMPT,
Todd Kennedybe0b8892017-02-15 14:13:52 -0800668 INSTALL_INSTANT_APP,
Todd Kennedy39bfee52016-02-24 10:28:21 -0800669 INSTALL_DONT_KILL_APP,
Jeff Sharkey683bcd32017-03-18 17:54:51 -0600670 INSTALL_FORCE_SDK,
671 INSTALL_FULL_APP,
672 INSTALL_ALLOCATE_AGGRESSIVE,
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700673 })
674 @Retention(RetentionPolicy.SOURCE)
675 public @interface InstallFlags {}
676
Dianne Hackbornfd7aded2013-01-22 17:10:23 -0800677 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700678 * Flag parameter for {@link #installPackage} to indicate that this package
679 * should be installed as forward locked, i.e. only the app itself should
680 * have access to its code and non-resource assets.
681 *
Jeff Sharkey8c61e392017-02-24 09:22:48 -0700682 * @deprecated new installs into ASEC containers are no longer supported.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700683 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800684 */
Jeff Sharkey8c61e392017-02-24 09:22:48 -0700685 @Deprecated
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700686 public static final int INSTALL_FORWARD_LOCK = 0x00000001;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800687
688 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700689 * Flag parameter for {@link #installPackage} to indicate that you want to
690 * replace an already installed package, if one exists.
691 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700692 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800693 */
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700694 public static final int INSTALL_REPLACE_EXISTING = 0x00000002;
695
696 /**
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700697 * Flag parameter for {@link #installPackage} to indicate that you want to
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700698 * allow test packages (those that have set android:testOnly in their
699 * manifest) to be installed.
700 * @hide
701 */
702 public static final int INSTALL_ALLOW_TEST = 0x00000004;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800703
704 /**
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -0700705 * Flag parameter for {@link #installPackage} to indicate that this package
706 * must be installed to an ASEC on a {@link VolumeInfo#TYPE_PUBLIC}.
707 *
Jeff Sharkey8c61e392017-02-24 09:22:48 -0700708 * @deprecated new installs into ASEC containers are no longer supported;
709 * use adoptable storage instead.
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800710 * @hide
711 */
Jeff Sharkey8c61e392017-02-24 09:22:48 -0700712 @Deprecated
Suchi Amalapurapu5b993ce2010-02-12 09:43:29 -0800713 public static final int INSTALL_EXTERNAL = 0x00000008;
Oscar Montemayor539d3c42010-01-29 15:27:00 -0800714
715 /**
Kenny Root5ab21572011-07-27 11:11:19 -0700716 * Flag parameter for {@link #installPackage} to indicate that this package
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -0700717 * must be installed to internal storage.
718 *
Kenny Root5ab21572011-07-27 11:11:19 -0700719 * @hide
720 */
721 public static final int INSTALL_INTERNAL = 0x00000010;
722
723 /**
724 * Flag parameter for {@link #installPackage} to indicate that this install
725 * was initiated via ADB.
726 *
727 * @hide
728 */
729 public static final int INSTALL_FROM_ADB = 0x00000020;
Suchi Amalapurapu14b6abd2010-03-17 08:37:04 -0700730
731 /**
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700732 * Flag parameter for {@link #installPackage} to indicate that this install
733 * should immediately be visible to all users.
734 *
735 * @hide
736 */
737 public static final int INSTALL_ALL_USERS = 0x00000040;
738
739 /**
740 * Flag parameter for {@link #installPackage} to indicate that it is okay
741 * to install an update to an app where the newly installed app has a lower
Alex Klyubin921dd752016-02-24 13:21:41 -0800742 * version code than the currently installed app. This is permitted only if
743 * the currently installed app is marked debuggable.
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700744 *
745 * @hide
746 */
747 public static final int INSTALL_ALLOW_DOWNGRADE = 0x00000080;
748
749 /**
Svet Ganov95c1ade2015-03-19 09:38:52 -0700750 * Flag parameter for {@link #installPackage} to indicate that all runtime
751 * permissions should be granted to the package. If {@link #INSTALL_ALL_USERS}
752 * is set the runtime permissions will be granted to all users, otherwise
753 * only to the owner.
754 *
755 * @hide
756 */
757 public static final int INSTALL_GRANT_RUNTIME_PERMISSIONS = 0x00000100;
758
Jeff Sharkeyab234092015-06-09 21:42:22 -0700759 /** {@hide} */
760 public static final int INSTALL_FORCE_VOLUME_UUID = 0x00000200;
761
Svet Ganov95c1ade2015-03-19 09:38:52 -0700762 /**
Todd Kennedya1d12cf2015-09-29 15:43:00 -0700763 * Flag parameter for {@link #installPackage} to indicate that we always want to force
764 * the prompt for permission approval. This overrides any special behaviour for internal
765 * components.
766 *
767 * @hide
768 */
769 public static final int INSTALL_FORCE_PERMISSION_PROMPT = 0x00000400;
770
771 /**
Todd Kennedy27c24fb2015-09-17 16:49:25 -0700772 * Flag parameter for {@link #installPackage} to indicate that this package is
Todd Kennedy2699f062015-11-20 13:07:17 -0800773 * to be installed as a lightweight "ephemeral" app.
774 *
775 * @hide
776 */
Todd Kennedybe0b8892017-02-15 14:13:52 -0800777 public static final int INSTALL_INSTANT_APP = 0x00000800;
778
779 /**
Todd Kennedy39bfee52016-02-24 10:28:21 -0800780 * Flag parameter for {@link #installPackage} to indicate that this package contains
781 * a feature split to an existing application and the existing application should not
782 * be killed during the installation process.
783 *
784 * @hide
785 */
786 public static final int INSTALL_DONT_KILL_APP = 0x00001000;
787
788 /**
Todd Kennedyb1072712016-04-26 15:41:20 -0700789 * Flag parameter for {@link #installPackage} to indicate that this package is an
790 * upgrade to a package that refers to the SDK via release letter.
791 *
792 * @hide
793 */
794 public static final int INSTALL_FORCE_SDK = 0x00002000;
795
796 /**
Jeff Sharkey683bcd32017-03-18 17:54:51 -0600797 * Flag parameter for {@link #installPackage} to indicate that this package is
798 * to be installed as a heavy weight app. This is fundamentally the opposite of
799 * {@link #INSTALL_INSTANT_APP}.
800 *
801 * @hide
802 */
803 public static final int INSTALL_FULL_APP = 0x00004000;
804
805 /**
806 * Flag parameter for {@link #installPackage} to indicate that this package
807 * is critical to system health or security, meaning the system should use
808 * {@link StorageManager#FLAG_ALLOCATE_AGGRESSIVE} internally.
809 *
810 * @hide
811 */
812 public static final int INSTALL_ALLOCATE_AGGRESSIVE = 0x00008000;
813
Todd Kennedy78a72502017-07-19 12:49:30 -0700814 /**
815 * Flag parameter for {@link #installPackage} to indicate that this package
816 * is a virtual preload.
817 *
818 * @hide
819 */
820 public static final int INSTALL_VIRTUAL_PRELOAD = 0x00010000;
821
Jeff Sharkey30e06bb2017-04-24 11:18:03 -0600822 /** @hide */
823 @IntDef(flag = true, prefix = { "DONT_KILL_APP" }, value = {
824 DONT_KILL_APP
825 })
826 @Retention(RetentionPolicy.SOURCE)
827 public @interface EnabledFlags {}
828
Jeff Sharkey683bcd32017-03-18 17:54:51 -0600829 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800830 * Flag parameter for
831 * {@link #setComponentEnabledSetting(android.content.ComponentName, int, int)} to indicate
832 * that you don't want to kill the app containing the component. Be careful when you set this
833 * since changing component states can make the containing application's behavior unpredictable.
834 */
835 public static final int DONT_KILL_APP = 0x00000001;
836
Bartosz Fabianowskia34f53f2017-01-11 18:08:47 +0100837 /** @hide */
Jeff Sharkey4347f812017-04-21 12:08:39 -0600838 @IntDef(prefix = { "INSTALL_REASON_" }, value = {
839 INSTALL_REASON_UNKNOWN,
840 INSTALL_REASON_POLICY,
841 INSTALL_REASON_DEVICE_RESTORE,
842 INSTALL_REASON_DEVICE_SETUP,
843 INSTALL_REASON_USER
844 })
Bartosz Fabianowskia34f53f2017-01-11 18:08:47 +0100845 @Retention(RetentionPolicy.SOURCE)
846 public @interface InstallReason {}
847
848 /**
849 * Code indicating that the reason for installing this package is unknown.
850 */
851 public static final int INSTALL_REASON_UNKNOWN = 0;
852
853 /**
854 * Code indicating that this package was installed due to enterprise policy.
855 */
856 public static final int INSTALL_REASON_POLICY = 1;
857
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800858 /**
Sunny Goyal80af6a22017-03-02 08:32:33 -0800859 * Code indicating that this package was installed as part of restoring from another device.
860 */
861 public static final int INSTALL_REASON_DEVICE_RESTORE = 2;
862
863 /**
864 * Code indicating that this package was installed as part of device setup.
865 */
866 public static final int INSTALL_REASON_DEVICE_SETUP = 3;
867
868 /**
869 * Code indicating that the package installation was initiated by the user.
870 */
871 public static final int INSTALL_REASON_USER = 4;
872
873 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800874 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
875 * on success.
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700876 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700877 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800878 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700879 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800880 public static final int INSTALL_SUCCEEDED = 1;
881
882 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800883 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
884 * if the package is already installed.
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700885 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700886 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800887 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700888 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800889 public static final int INSTALL_FAILED_ALREADY_EXISTS = -1;
890
891 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800892 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
893 * if the package archive file is invalid.
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700894 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700895 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800896 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700897 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800898 public static final int INSTALL_FAILED_INVALID_APK = -2;
899
900 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800901 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
902 * if the URI passed in is invalid.
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700903 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700904 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800905 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700906 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800907 public static final int INSTALL_FAILED_INVALID_URI = -3;
908
909 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800910 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
911 * if the package manager service found that the device didn't have enough storage space to
912 * install the app.
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700913 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700914 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800915 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700916 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800917 public static final int INSTALL_FAILED_INSUFFICIENT_STORAGE = -4;
918
919 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800920 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
921 * if a package is already installed with the same name.
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700922 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700923 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800924 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700925 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800926 public static final int INSTALL_FAILED_DUPLICATE_PACKAGE = -5;
927
928 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800929 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
930 * if the requested shared user does not exist.
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700931 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700932 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800933 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700934 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800935 public static final int INSTALL_FAILED_NO_SHARED_USER = -6;
936
937 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800938 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
939 * if a previously installed package of the same name has a different signature than the new
940 * package (and the old package's data was not removed).
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700941 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700942 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800943 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700944 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800945 public static final int INSTALL_FAILED_UPDATE_INCOMPATIBLE = -7;
946
947 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800948 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
949 * if the new package is requested a shared user which is already installed on the device and
950 * does not have matching signature.
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700951 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700952 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800953 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700954 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800955 public static final int INSTALL_FAILED_SHARED_USER_INCOMPATIBLE = -8;
956
957 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800958 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
959 * if the new package uses a shared library that is not available.
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700960 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700961 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800962 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700963 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800964 public static final int INSTALL_FAILED_MISSING_SHARED_LIBRARY = -9;
965
966 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800967 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
968 * if the new package uses a shared library that is not available.
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700969 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700970 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800971 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700972 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800973 public static final int INSTALL_FAILED_REPLACE_COULDNT_DELETE = -10;
974
975 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800976 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
977 * if the new package failed while optimizing and validating its dex files, either because there
978 * was not enough storage or the validation failed.
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700979 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700980 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800981 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700982 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800983 public static final int INSTALL_FAILED_DEXOPT = -11;
984
985 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800986 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
987 * if the new package failed because the current SDK version is older than that required by the
988 * package.
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700989 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700990 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800991 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700992 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800993 public static final int INSTALL_FAILED_OLDER_SDK = -12;
994
995 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800996 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
997 * if the new package failed because it contains a content provider with the same authority as a
998 * provider already installed in the system.
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700999 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001000 * @hide
The Android Open Source Project10592532009-03-18 17:39:46 -07001001 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001002 @SystemApi
The Android Open Source Project10592532009-03-18 17:39:46 -07001003 public static final int INSTALL_FAILED_CONFLICTING_PROVIDER = -13;
1004
1005 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001006 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1007 * if the new package failed because the current SDK version is newer than that required by the
1008 * package.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001009 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001010 * @hide
Dianne Hackborn851a5412009-05-08 12:06:44 -07001011 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001012 @SystemApi
Dianne Hackborn851a5412009-05-08 12:06:44 -07001013 public static final int INSTALL_FAILED_NEWER_SDK = -14;
1014
1015 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001016 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1017 * if the new package failed because it has specified that it is a test-only package and the
1018 * caller has not supplied the {@link #INSTALL_ALLOW_TEST} flag.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001019 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001020 * @hide
1021 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001022 @SystemApi
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001023 public static final int INSTALL_FAILED_TEST_ONLY = -15;
1024
1025 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001026 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1027 * if the package being installed contains native code, but none that is compatible with the
1028 * device's CPU_ABI.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001029 *
Dianne Hackbornb1811182009-05-21 15:45:42 -07001030 * @hide
1031 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001032 @SystemApi
Dianne Hackbornb1811182009-05-21 15:45:42 -07001033 public static final int INSTALL_FAILED_CPU_ABI_INCOMPATIBLE = -16;
1034
1035 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001036 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1037 * if the new package uses a feature that is not available.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001038 *
Dianne Hackborn49237342009-08-27 20:08:01 -07001039 * @hide
1040 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001041 @SystemApi
Dianne Hackborn49237342009-08-27 20:08:01 -07001042 public static final int INSTALL_FAILED_MISSING_FEATURE = -17;
1043
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -08001044 // ------ Errors related to sdcard
1045 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001046 * Installation return code: this is passed in the
1047 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if a secure container mount point couldn't be
1048 * accessed on external media.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001049 *
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -08001050 * @hide
1051 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001052 @SystemApi
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -08001053 public static final int INSTALL_FAILED_CONTAINER_ERROR = -18;
1054
Dianne Hackborn49237342009-08-27 20:08:01 -07001055 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001056 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1057 * if the new package couldn't be installed in the specified install location.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001058 *
Suchi Amalapurapub56ae202010-02-04 22:51:07 -08001059 * @hide
1060 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001061 @SystemApi
Suchi Amalapurapub56ae202010-02-04 22:51:07 -08001062 public static final int INSTALL_FAILED_INVALID_INSTALL_LOCATION = -19;
1063
1064 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001065 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1066 * if the new package couldn't be installed in the specified install location because the media
1067 * is not available.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001068 *
Suchi Amalapurapu8a9ab242010-03-11 16:49:16 -08001069 * @hide
1070 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001071 @SystemApi
Suchi Amalapurapu8a9ab242010-03-11 16:49:16 -08001072 public static final int INSTALL_FAILED_MEDIA_UNAVAILABLE = -20;
1073
1074 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001075 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1076 * if the new package couldn't be installed because the verification timed out.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001077 *
Kenny Root5ab21572011-07-27 11:11:19 -07001078 * @hide
1079 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001080 @SystemApi
Kenny Root5ab21572011-07-27 11:11:19 -07001081 public static final int INSTALL_FAILED_VERIFICATION_TIMEOUT = -21;
1082
1083 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001084 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1085 * if the new package couldn't be installed because the verification did not succeed.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001086 *
Kenny Root5ab21572011-07-27 11:11:19 -07001087 * @hide
1088 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001089 @SystemApi
Kenny Root5ab21572011-07-27 11:11:19 -07001090 public static final int INSTALL_FAILED_VERIFICATION_FAILURE = -22;
1091
1092 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001093 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1094 * if the package changed from what the calling program expected.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001095 *
Kenny Root5ab21572011-07-27 11:11:19 -07001096 * @hide
1097 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001098 @SystemApi
Kenny Root5ab21572011-07-27 11:11:19 -07001099 public static final int INSTALL_FAILED_PACKAGE_CHANGED = -23;
1100
1101 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001102 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1103 * if the new package is assigned a different UID than it previously held.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001104 *
Dianne Hackbornd0c5f512012-06-07 16:53:59 -07001105 * @hide
1106 */
1107 public static final int INSTALL_FAILED_UID_CHANGED = -24;
1108
1109 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001110 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1111 * if the new package has an older version code than the currently installed package.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001112 *
Dianne Hackborn7767eac2012-08-23 18:25:40 -07001113 * @hide
1114 */
1115 public static final int INSTALL_FAILED_VERSION_DOWNGRADE = -25;
1116
1117 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001118 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1119 * if the old package has target SDK high enough to support runtime permission and the new
1120 * package has target SDK low enough to not support runtime permissions.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001121 *
Svetoslavd9653702015-05-13 18:02:46 -07001122 * @hide
1123 */
1124 @SystemApi
1125 public static final int INSTALL_FAILED_PERMISSION_MODEL_DOWNGRADE = -26;
1126
1127 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001128 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1129 * if the new package attempts to downgrade the target sandbox version of the app.
Chad Brubaker34573b22017-03-07 15:27:35 -08001130 *
1131 * @hide
1132 */
1133 @SystemApi
1134 public static final int INSTALL_FAILED_SANDBOX_VERSION_DOWNGRADE = -27;
1135
1136 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001137 * Installation parse return code: this is passed in the
1138 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser was given a path that is not a
1139 * file, or does not end with the expected '.apk' extension.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001140 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001141 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001142 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001143 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001144 public static final int INSTALL_PARSE_FAILED_NOT_APK = -100;
1145
1146 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001147 * Installation parse return code: this is passed in the
1148 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser was unable to retrieve the
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001149 * AndroidManifest.xml file.
1150 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001151 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001152 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001153 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001154 public static final int INSTALL_PARSE_FAILED_BAD_MANIFEST = -101;
1155
1156 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001157 * Installation parse return code: this is passed in the
1158 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser encountered an unexpected
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001159 * exception.
1160 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001161 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001162 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001163 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001164 public static final int INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION = -102;
1165
1166 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001167 * Installation parse return code: this is passed in the
1168 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser did not find any certificates in
1169 * the .apk.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001170 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001171 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001172 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001173 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001174 public static final int INSTALL_PARSE_FAILED_NO_CERTIFICATES = -103;
1175
1176 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001177 * Installation parse return code: this is passed in the
1178 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser found inconsistent certificates on
1179 * the files in the .apk.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001180 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001181 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001182 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001183 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001184 public static final int INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES = -104;
1185
1186 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001187 * Installation parse return code: this is passed in the
1188 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser encountered a
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001189 * CertificateEncodingException in one of the files in the .apk.
1190 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001191 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001192 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001193 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001194 public static final int INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING = -105;
1195
1196 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001197 * Installation parse return code: this is passed in the
1198 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser encountered a bad or missing
1199 * package name in the manifest.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001200 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001201 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001202 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001203 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001204 public static final int INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME = -106;
1205
1206 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001207 * Installation parse return code: tthis is passed in the
1208 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser encountered a bad shared user id
1209 * name in the manifest.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001210 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001211 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001212 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001213 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001214 public static final int INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID = -107;
1215
1216 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001217 * Installation parse return code: this is passed in the
1218 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser encountered some structural
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001219 * problem in the manifest.
1220 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001221 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001222 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001223 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001224 public static final int INSTALL_PARSE_FAILED_MANIFEST_MALFORMED = -108;
1225
1226 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001227 * Installation parse return code: this is passed in the
1228 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser did not find any actionable tags
1229 * (instrumentation or application) in the manifest.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001230 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001231 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001232 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001233 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001234 public static final int INSTALL_PARSE_FAILED_MANIFEST_EMPTY = -109;
1235
1236 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001237 * Installation failed return code: this is passed in the
1238 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the system failed to install the package
1239 * because of system issues.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001240 *
Suchi Amalapurapu5b993ce2010-02-12 09:43:29 -08001241 * @hide
1242 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001243 @SystemApi
Suchi Amalapurapu5b993ce2010-02-12 09:43:29 -08001244 public static final int INSTALL_FAILED_INTERNAL_ERROR = -110;
1245
1246 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001247 * Installation failed return code: this is passed in the
1248 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the system failed to install the package
1249 * because the user is restricted from installing apps.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001250 *
Amith Yamasanie4cf7342012-12-17 11:12:09 -08001251 * @hide
1252 */
1253 public static final int INSTALL_FAILED_USER_RESTRICTED = -111;
1254
1255 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001256 * Installation failed return code: this is passed in the
1257 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the system failed to install the package
1258 * because it is attempting to define a permission that is already defined by some existing
1259 * package.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001260 * <p>
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001261 * The package name of the app which has already defined the permission is passed to a
1262 * {@link PackageInstallObserver}, if any, as the {@link #EXTRA_FAILURE_EXISTING_PACKAGE} string
1263 * extra; and the name of the permission being redefined is passed in the
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001264 * {@link #EXTRA_FAILURE_EXISTING_PERMISSION} string extra.
Christopher Tatef1977b42014-03-24 16:25:51 -07001265 *
Christopher Tatef1977b42014-03-24 16:25:51 -07001266 * @hide
1267 */
1268 public static final int INSTALL_FAILED_DUPLICATE_PERMISSION = -112;
1269
1270 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001271 * Installation failed return code: this is passed in the
1272 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the system failed to install the package
1273 * because its packaged native code did not match any of the ABIs supported by the system.
Ramin Zaghi1378aba2014-02-28 15:03:19 +00001274 *
1275 * @hide
1276 */
Narayan Kamathd11f2232014-04-10 10:37:17 +01001277 public static final int INSTALL_FAILED_NO_MATCHING_ABIS = -113;
Ramin Zaghi1378aba2014-02-28 15:03:19 +00001278
1279 /**
1280 * Internal return code for NativeLibraryHelper methods to indicate that the package
1281 * being processed did not contain any native code. This is placed here only so that
1282 * it can belong to the same value space as the other install failure codes.
1283 *
1284 * @hide
1285 */
Narayan Kamathd11f2232014-04-10 10:37:17 +01001286 public static final int NO_NATIVE_LIBRARIES = -114;
Ramin Zaghi1378aba2014-02-28 15:03:19 +00001287
Jeff Sharkey7328a1b2014-08-07 14:01:43 -07001288 /** {@hide} */
Jeff Sharkeyf0600952014-08-07 17:31:53 -07001289 public static final int INSTALL_FAILED_ABORTED = -115;
Jeff Sharkey7328a1b2014-08-07 14:01:43 -07001290
Ramin Zaghi1378aba2014-02-28 15:03:19 +00001291 /**
Todd Kennedybe0b8892017-02-15 14:13:52 -08001292 * Installation failed return code: instant app installs are incompatible with some
Todd Kennedy2699f062015-11-20 13:07:17 -08001293 * other installation flags supplied for the operation; or other circumstances such
Todd Kennedybe0b8892017-02-15 14:13:52 -08001294 * as trying to upgrade a system app via an instant app install.
Todd Kennedy2699f062015-11-20 13:07:17 -08001295 * @hide
1296 */
Todd Kennedybe0b8892017-02-15 14:13:52 -08001297 public static final int INSTALL_FAILED_INSTANT_APP_INVALID = -116;
Todd Kennedy2699f062015-11-20 13:07:17 -08001298
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001299 /** @hide */
Jeff Sharkey4347f812017-04-21 12:08:39 -06001300 @IntDef(flag = true, prefix = { "DELETE_" }, value = {
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001301 DELETE_KEEP_DATA,
1302 DELETE_ALL_USERS,
1303 DELETE_SYSTEM_APP,
Todd Kennedy39bfee52016-02-24 10:28:21 -08001304 DELETE_DONT_KILL_APP,
Todd Kennedy232d29e2017-11-06 14:45:53 -08001305 DELETE_CHATTY,
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001306 })
1307 @Retention(RetentionPolicy.SOURCE)
1308 public @interface DeleteFlags {}
1309
Todd Kennedy2699f062015-11-20 13:07:17 -08001310 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001311 * Flag parameter for {@link #deletePackage} to indicate that you don't want to delete the
1312 * package's data directory.
1313 *
1314 * @hide
1315 */
Dianne Hackborn7767eac2012-08-23 18:25:40 -07001316 public static final int DELETE_KEEP_DATA = 0x00000001;
1317
1318 /**
1319 * Flag parameter for {@link #deletePackage} to indicate that you want the
1320 * package deleted for all users.
1321 *
1322 * @hide
1323 */
1324 public static final int DELETE_ALL_USERS = 0x00000002;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001325
1326 /**
Dianne Hackbornc895be72013-03-11 17:48:43 -07001327 * Flag parameter for {@link #deletePackage} to indicate that, if you are calling
1328 * uninstall on a system that has been updated, then don't do the normal process
1329 * of uninstalling the update and rolling back to the older system version (which
1330 * needs to happen for all users); instead, just mark the app as uninstalled for
1331 * the current user.
1332 *
1333 * @hide
1334 */
1335 public static final int DELETE_SYSTEM_APP = 0x00000004;
1336
1337 /**
Todd Kennedy39bfee52016-02-24 10:28:21 -08001338 * Flag parameter for {@link #deletePackage} to indicate that, if you are calling
1339 * uninstall on a package that is replaced to provide new feature splits, the
1340 * existing application should not be killed during the removal process.
1341 *
1342 * @hide
1343 */
1344 public static final int DELETE_DONT_KILL_APP = 0x00000008;
1345
1346 /**
Todd Kennedy232d29e2017-11-06 14:45:53 -08001347 * Flag parameter for {@link #deletePackage} to indicate that package deletion
1348 * should be chatty.
1349 *
1350 * @hide
1351 */
1352 public static final int DELETE_CHATTY = 0x80000000;
1353
1354 /**
Kenny Rootc39bb4a2011-02-28 13:27:19 -08001355 * Return code for when package deletion succeeds. This is passed to the
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001356 * {@link IPackageDeleteObserver} if the system succeeded in deleting the
1357 * package.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001358 *
Kenny Rootc39bb4a2011-02-28 13:27:19 -08001359 * @hide
1360 */
1361 public static final int DELETE_SUCCEEDED = 1;
1362
1363 /**
1364 * Deletion failed return code: this is passed to the
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001365 * {@link IPackageDeleteObserver} if the system failed to delete the package
1366 * for an unspecified reason.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001367 *
Kenny Rootc39bb4a2011-02-28 13:27:19 -08001368 * @hide
1369 */
1370 public static final int DELETE_FAILED_INTERNAL_ERROR = -1;
1371
1372 /**
1373 * Deletion failed return code: this is passed to the
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001374 * {@link IPackageDeleteObserver} if the system failed to delete the package
1375 * because it is the active DevicePolicy manager.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001376 *
Kenny Rootc39bb4a2011-02-28 13:27:19 -08001377 * @hide
1378 */
1379 public static final int DELETE_FAILED_DEVICE_POLICY_MANAGER = -2;
1380
1381 /**
Amith Yamasanie4cf7342012-12-17 11:12:09 -08001382 * Deletion failed return code: this is passed to the
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001383 * {@link IPackageDeleteObserver} if the system failed to delete the package
1384 * since the user is restricted.
Amith Yamasanie4cf7342012-12-17 11:12:09 -08001385 *
1386 * @hide
1387 */
1388 public static final int DELETE_FAILED_USER_RESTRICTED = -3;
1389
1390 /**
Kenny Guy1b88da52014-07-10 16:33:49 +01001391 * Deletion failed return code: this is passed to the
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001392 * {@link IPackageDeleteObserver} if the system failed to delete the package
1393 * because a profile or device owner has marked the package as
1394 * uninstallable.
Kenny Guyc13053b2014-05-29 14:17:17 +01001395 *
1396 * @hide
1397 */
Jeff Sharkeyf0600952014-08-07 17:31:53 -07001398 public static final int DELETE_FAILED_OWNER_BLOCKED = -4;
1399
1400 /** {@hide} */
1401 public static final int DELETE_FAILED_ABORTED = -5;
Kenny Guyc13053b2014-05-29 14:17:17 +01001402
1403 /**
Svet Ganov67882122016-12-11 16:36:34 -08001404 * Deletion failed return code: this is passed to the
1405 * {@link IPackageDeleteObserver} if the system failed to delete the package
1406 * because the packge is a shared library used by other installed packages.
1407 * {@hide} */
1408 public static final int DELETE_FAILED_USED_SHARED_LIBRARY = -6;
1409
1410 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001411 * Return code that is passed to the {@link IPackageMoveObserver} when the
Kenny Rootc39bb4a2011-02-28 13:27:19 -08001412 * package has been successfully moved by the system.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001413 *
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001414 * @hide
1415 */
Jeff Sharkey620b32b2015-04-23 19:36:02 -07001416 public static final int MOVE_SUCCEEDED = -100;
1417
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001418 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001419 * Error code that is passed to the {@link IPackageMoveObserver} when the
1420 * package hasn't been successfully moved by the system because of
1421 * insufficient memory on specified media.
1422 *
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001423 * @hide
1424 */
1425 public static final int MOVE_FAILED_INSUFFICIENT_STORAGE = -1;
1426
1427 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001428 * Error code that is passed to the {@link IPackageMoveObserver} if the
1429 * specified package doesn't exist.
1430 *
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001431 * @hide
1432 */
1433 public static final int MOVE_FAILED_DOESNT_EXIST = -2;
1434
1435 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001436 * Error code that is passed to the {@link IPackageMoveObserver} if the
1437 * specified package cannot be moved since its a system package.
1438 *
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001439 * @hide
1440 */
1441 public static final int MOVE_FAILED_SYSTEM_PACKAGE = -3;
1442
1443 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001444 * Error code that is passed to the {@link IPackageMoveObserver} if the
1445 * specified package cannot be moved since its forward locked.
1446 *
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001447 * @hide
1448 */
1449 public static final int MOVE_FAILED_FORWARD_LOCKED = -4;
1450
1451 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001452 * Error code that is passed to the {@link IPackageMoveObserver} if the
1453 * specified package cannot be moved to the specified location.
1454 *
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001455 * @hide
1456 */
1457 public static final int MOVE_FAILED_INVALID_LOCATION = -5;
1458
1459 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001460 * Error code that is passed to the {@link IPackageMoveObserver} if the
1461 * specified package cannot be moved to the specified location.
1462 *
Suchi Amalapurapu8a9ab242010-03-11 16:49:16 -08001463 * @hide
1464 */
1465 public static final int MOVE_FAILED_INTERNAL_ERROR = -6;
1466
1467 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001468 * Error code that is passed to the {@link IPackageMoveObserver} if the
1469 * specified package already has an operation pending in the queue.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001470 *
Kenny Rootdeb11262010-08-02 11:36:21 -07001471 * @hide
1472 */
1473 public static final int MOVE_FAILED_OPERATION_PENDING = -7;
1474
1475 /**
Makoto Onukif34db0a2016-02-17 11:17:15 -08001476 * Error code that is passed to the {@link IPackageMoveObserver} if the
1477 * specified package cannot be moved since it contains a device admin.
1478 *
1479 * @hide
1480 */
1481 public static final int MOVE_FAILED_DEVICE_ADMIN = -8;
1482
1483 /**
Yao Chen022b8ea2016-12-16 11:03:28 -08001484 * Error code that is passed to the {@link IPackageMoveObserver} if system does not allow
1485 * non-system apps to be moved to internal storage.
1486 *
1487 * @hide
1488 */
1489 public static final int MOVE_FAILED_3RD_PARTY_NOT_ALLOWED_ON_INTERNAL = -9;
1490
Jeff Sharkeya65e6492017-06-21 13:45:11 -06001491 /** @hide */
1492 public static final int MOVE_FAILED_LOCKED_USER = -10;
1493
Yao Chen022b8ea2016-12-16 11:03:28 -08001494 /**
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001495 * Flag parameter for {@link #movePackage} to indicate that
1496 * the package should be moved to internal storage if its
1497 * been installed on external media.
1498 * @hide
1499 */
Jeff Sharkey620b32b2015-04-23 19:36:02 -07001500 @Deprecated
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001501 public static final int MOVE_INTERNAL = 0x00000001;
1502
1503 /**
1504 * Flag parameter for {@link #movePackage} to indicate that
1505 * the package should be moved to external media.
1506 * @hide
1507 */
Jeff Sharkey620b32b2015-04-23 19:36:02 -07001508 @Deprecated
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001509 public static final int MOVE_EXTERNAL_MEDIA = 0x00000002;
1510
Jeff Sharkey620b32b2015-04-23 19:36:02 -07001511 /** {@hide} */
1512 public static final String EXTRA_MOVE_ID = "android.content.pm.extra.MOVE_ID";
1513
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001514 /**
Kenny Root05ca4c92011-09-15 10:36:25 -07001515 * Usable by the required verifier as the {@code verificationCode} argument
1516 * for {@link PackageManager#verifyPendingInstall} to indicate that it will
1517 * allow the installation to proceed without any of the optional verifiers
1518 * needing to vote.
1519 *
1520 * @hide
1521 */
1522 public static final int VERIFICATION_ALLOW_WITHOUT_SUFFICIENT = 2;
1523
1524 /**
Kenny Root3a9b5fb2011-09-20 14:15:38 -07001525 * Used as the {@code verificationCode} argument for
1526 * {@link PackageManager#verifyPendingInstall} to indicate that the calling
1527 * package verifier allows the installation to proceed.
1528 */
1529 public static final int VERIFICATION_ALLOW = 1;
1530
1531 /**
1532 * Used as the {@code verificationCode} argument for
1533 * {@link PackageManager#verifyPendingInstall} to indicate the calling
1534 * package verifier does not vote to allow the installation to proceed.
1535 */
1536 public static final int VERIFICATION_REJECT = -1;
1537
1538 /**
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001539 * Used as the {@code verificationCode} argument for
1540 * {@link PackageManager#verifyIntentFilter} to indicate that the calling
1541 * IntentFilter Verifier confirms that the IntentFilter is verified.
1542 *
1543 * @hide
1544 */
Todd Kennedydfa93ab2016-03-03 15:24:33 -08001545 @SystemApi
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001546 public static final int INTENT_FILTER_VERIFICATION_SUCCESS = 1;
1547
1548 /**
1549 * Used as the {@code verificationCode} argument for
1550 * {@link PackageManager#verifyIntentFilter} to indicate that the calling
1551 * IntentFilter Verifier confirms that the IntentFilter is NOT verified.
1552 *
1553 * @hide
1554 */
Todd Kennedydfa93ab2016-03-03 15:24:33 -08001555 @SystemApi
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001556 public static final int INTENT_FILTER_VERIFICATION_FAILURE = -1;
1557
1558 /**
1559 * Internal status code to indicate that an IntentFilter verification result is not specified.
1560 *
1561 * @hide
1562 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08001563 @SystemApi
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001564 public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED = 0;
1565
1566 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001567 * Used as the {@code status} argument for
1568 * {@link #updateIntentVerificationStatusAsUser} to indicate that the User
1569 * will always be prompted the Intent Disambiguation Dialog if there are two
1570 * or more Intent resolved for the IntentFilter's domain(s).
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001571 *
1572 * @hide
1573 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08001574 @SystemApi
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001575 public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK = 1;
1576
1577 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001578 * Used as the {@code status} argument for
1579 * {@link #updateIntentVerificationStatusAsUser} to indicate that the User
1580 * will never be prompted the Intent Disambiguation Dialog if there are two
1581 * or more resolution of the Intent. The default App for the domain(s)
1582 * specified in the IntentFilter will also ALWAYS be used.
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001583 *
1584 * @hide
1585 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08001586 @SystemApi
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001587 public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS = 2;
1588
1589 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001590 * Used as the {@code status} argument for
1591 * {@link #updateIntentVerificationStatusAsUser} to indicate that the User
1592 * may be prompted the Intent Disambiguation Dialog if there are two or more
1593 * Intent resolved. The default App for the domain(s) specified in the
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001594 * IntentFilter will also NEVER be presented to the User.
1595 *
1596 * @hide
1597 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08001598 @SystemApi
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001599 public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER = 3;
1600
1601 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001602 * Used as the {@code status} argument for
1603 * {@link #updateIntentVerificationStatusAsUser} to indicate that this app
1604 * should always be considered as an ambiguous candidate for handling the
1605 * matching Intent even if there are other candidate apps in the "always"
1606 * state. Put another way: if there are any 'always ask' apps in a set of
1607 * more than one candidate app, then a disambiguation is *always* presented
1608 * even if there is another candidate app with the 'always' state.
Christopher Tate56f0ff32015-08-13 16:29:33 -07001609 *
1610 * @hide
1611 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08001612 @SystemApi
Christopher Tate56f0ff32015-08-13 16:29:33 -07001613 public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS_ASK = 4;
1614
1615 /**
rich canningsd9ef3e52012-08-22 14:28:05 -07001616 * Can be used as the {@code millisecondsToDelay} argument for
1617 * {@link PackageManager#extendVerificationTimeout}. This is the
1618 * maximum time {@code PackageManager} waits for the verification
1619 * agent to return (in milliseconds).
1620 */
1621 public static final long MAXIMUM_VERIFICATION_TIMEOUT = 60*60*1000;
1622
1623 /**
Amith Yamasani0b285492011-04-14 17:35:23 -07001624 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: The device's
1625 * audio pipeline is low-latency, more suitable for audio applications sensitive to delays or
1626 * lag in sound input or output.
Dan Morrill898e1e82010-09-26 17:28:30 -07001627 */
1628 @SdkConstant(SdkConstantType.FEATURE)
1629 public static final String FEATURE_AUDIO_LOW_LATENCY = "android.hardware.audio.low_latency";
1630
1631 /**
1632 * Feature for {@link #getSystemAvailableFeatures} and
Unsuk Jung50909f62014-09-02 18:25:49 -07001633 * {@link #hasSystemFeature}: The device includes at least one form of audio
1634 * output, such as speakers, audio jack or streaming over bluetooth
1635 */
1636 @SdkConstant(SdkConstantType.FEATURE)
1637 public static final String FEATURE_AUDIO_OUTPUT = "android.hardware.audio.output";
1638
1639 /**
Glenn Kastencdcb5772015-05-06 15:54:49 -07001640 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Glenn Kasten7587edc2015-10-30 17:45:52 -07001641 * The device has professional audio level of functionality and performance.
Glenn Kastencdcb5772015-05-06 15:54:49 -07001642 */
1643 @SdkConstant(SdkConstantType.FEATURE)
1644 public static final String FEATURE_AUDIO_PRO = "android.hardware.audio.pro";
1645
1646 /**
Unsuk Jung50909f62014-09-02 18:25:49 -07001647 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001648 * {@link #hasSystemFeature}: The device is capable of communicating with
1649 * other devices via Bluetooth.
1650 */
1651 @SdkConstant(SdkConstantType.FEATURE)
1652 public static final String FEATURE_BLUETOOTH = "android.hardware.bluetooth";
1653
1654 /**
1655 * Feature for {@link #getSystemAvailableFeatures} and
Matthew Xiea7227722013-04-18 15:25:59 -07001656 * {@link #hasSystemFeature}: The device is capable of communicating with
1657 * other devices via Bluetooth Low Energy radio.
1658 */
1659 @SdkConstant(SdkConstantType.FEATURE)
1660 public static final String FEATURE_BLUETOOTH_LE = "android.hardware.bluetooth_le";
1661
1662 /**
1663 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001664 * {@link #hasSystemFeature}: The device has a camera facing away
1665 * from the screen.
1666 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001667 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001668 public static final String FEATURE_CAMERA = "android.hardware.camera";
Dan Morrill50ab63f2010-03-05 16:16:19 -08001669
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001670 /**
1671 * Feature for {@link #getSystemAvailableFeatures} and
1672 * {@link #hasSystemFeature}: The device's camera supports auto-focus.
1673 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001674 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001675 public static final String FEATURE_CAMERA_AUTOFOCUS = "android.hardware.camera.autofocus";
Dan Morrill50ab63f2010-03-05 16:16:19 -08001676
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001677 /**
1678 * Feature for {@link #getSystemAvailableFeatures} and
Eino-Ville Talvala752af832012-09-18 14:45:37 -07001679 * {@link #hasSystemFeature}: The device has at least one camera pointing in
Eino-Ville Talvala9131da22014-05-08 11:39:53 -07001680 * some direction, or can support an external camera being connected to it.
Eino-Ville Talvala752af832012-09-18 14:45:37 -07001681 */
1682 @SdkConstant(SdkConstantType.FEATURE)
1683 public static final String FEATURE_CAMERA_ANY = "android.hardware.camera.any";
1684
1685 /**
1686 * Feature for {@link #getSystemAvailableFeatures} and
Eino-Ville Talvala9131da22014-05-08 11:39:53 -07001687 * {@link #hasSystemFeature}: The device can support having an external camera connected to it.
1688 * The external camera may not always be connected or available to applications to use.
1689 */
1690 @SdkConstant(SdkConstantType.FEATURE)
1691 public static final String FEATURE_CAMERA_EXTERNAL = "android.hardware.camera.external";
1692
1693 /**
1694 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001695 * {@link #hasSystemFeature}: The device's camera supports flash.
1696 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001697 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001698 public static final String FEATURE_CAMERA_FLASH = "android.hardware.camera.flash";
Dan Morrill50ab63f2010-03-05 16:16:19 -08001699
1700 /**
1701 * Feature for {@link #getSystemAvailableFeatures} and
Chih-Chung Changde1057c2010-06-14 19:15:00 +08001702 * {@link #hasSystemFeature}: The device has a front facing camera.
1703 */
1704 @SdkConstant(SdkConstantType.FEATURE)
1705 public static final String FEATURE_CAMERA_FRONT = "android.hardware.camera.front";
1706
1707 /**
Eino-Ville Talvala611fece2014-07-10 17:29:38 -07001708 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one
1709 * of the cameras on the device supports the
1710 * {@link android.hardware.camera2.CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL full hardware}
1711 * capability level.
1712 */
1713 @SdkConstant(SdkConstantType.FEATURE)
1714 public static final String FEATURE_CAMERA_LEVEL_FULL = "android.hardware.camera.level.full";
1715
1716 /**
1717 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one
1718 * of the cameras on the device supports the
1719 * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR manual sensor}
1720 * capability level.
1721 */
1722 @SdkConstant(SdkConstantType.FEATURE)
1723 public static final String FEATURE_CAMERA_CAPABILITY_MANUAL_SENSOR =
1724 "android.hardware.camera.capability.manual_sensor";
1725
1726 /**
1727 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one
1728 * of the cameras on the device supports the
1729 * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MANUAL_POST_PROCESSING manual post-processing}
1730 * capability level.
1731 */
1732 @SdkConstant(SdkConstantType.FEATURE)
1733 public static final String FEATURE_CAMERA_CAPABILITY_MANUAL_POST_PROCESSING =
1734 "android.hardware.camera.capability.manual_post_processing";
1735
1736 /**
1737 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one
1738 * of the cameras on the device supports the
1739 * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_RAW RAW}
1740 * capability level.
1741 */
1742 @SdkConstant(SdkConstantType.FEATURE)
1743 public static final String FEATURE_CAMERA_CAPABILITY_RAW =
1744 "android.hardware.camera.capability.raw";
1745
1746 /**
Chih-Chung Changde1057c2010-06-14 19:15:00 +08001747 * Feature for {@link #getSystemAvailableFeatures} and
Alex Ray0c9d61f2013-10-03 12:17:54 -07001748 * {@link #hasSystemFeature}: The device is capable of communicating with
1749 * consumer IR devices.
1750 */
1751 @SdkConstant(SdkConstantType.FEATURE)
1752 public static final String FEATURE_CONSUMER_IR = "android.hardware.consumerir";
1753
Sam Lin90e258b2017-04-03 20:57:45 -07001754 /** {@hide} */
1755 @SdkConstant(SdkConstantType.FEATURE)
1756 public static final String FEATURE_CTS = "android.software.cts";
1757
Alex Ray0c9d61f2013-10-03 12:17:54 -07001758 /**
1759 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001760 * {@link #hasSystemFeature}: The device supports one or more methods of
1761 * reporting current location.
1762 */
1763 @SdkConstant(SdkConstantType.FEATURE)
1764 public static final String FEATURE_LOCATION = "android.hardware.location";
1765
1766 /**
1767 * Feature for {@link #getSystemAvailableFeatures} and
1768 * {@link #hasSystemFeature}: The device has a Global Positioning System
1769 * receiver and can report precise location.
1770 */
1771 @SdkConstant(SdkConstantType.FEATURE)
1772 public static final String FEATURE_LOCATION_GPS = "android.hardware.location.gps";
1773
1774 /**
1775 * Feature for {@link #getSystemAvailableFeatures} and
1776 * {@link #hasSystemFeature}: The device can report location with coarse
1777 * accuracy using a network-based geolocation system.
1778 */
1779 @SdkConstant(SdkConstantType.FEATURE)
1780 public static final String FEATURE_LOCATION_NETWORK = "android.hardware.location.network";
1781
1782 /**
1783 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn2a103f12017-08-08 15:50:31 -07001784 * {@link #hasSystemFeature}: The device's
1785 * {@link ActivityManager#isLowRamDevice() ActivityManager.isLowRamDevice()} method returns
1786 * true.
1787 */
1788 @SdkConstant(SdkConstantType.FEATURE)
1789 public static final String FEATURE_RAM_LOW = "android.hardware.ram.low";
1790
1791 /**
1792 * Feature for {@link #getSystemAvailableFeatures} and
1793 * {@link #hasSystemFeature}: The device's
1794 * {@link ActivityManager#isLowRamDevice() ActivityManager.isLowRamDevice()} method returns
1795 * false.
1796 */
1797 @SdkConstant(SdkConstantType.FEATURE)
1798 public static final String FEATURE_RAM_NORMAL = "android.hardware.ram.normal";
1799
1800 /**
1801 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001802 * {@link #hasSystemFeature}: The device can record audio via a
1803 * microphone.
1804 */
1805 @SdkConstant(SdkConstantType.FEATURE)
1806 public static final String FEATURE_MICROPHONE = "android.hardware.microphone";
1807
1808 /**
1809 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill76437d32010-09-01 11:17:20 -07001810 * {@link #hasSystemFeature}: The device can communicate using Near-Field
1811 * Communications (NFC).
1812 */
1813 @SdkConstant(SdkConstantType.FEATURE)
1814 public static final String FEATURE_NFC = "android.hardware.nfc";
1815
1816 /**
1817 * Feature for {@link #getSystemAvailableFeatures} and
Martijn Coenenf4bf1582013-07-22 12:01:19 -07001818 * {@link #hasSystemFeature}: The device supports host-
1819 * based NFC card emulation.
Martijn Coenendf4d1d62013-08-28 11:18:58 -07001820 *
1821 * TODO remove when depending apps have moved to new constant.
1822 * @hide
1823 * @deprecated
Martijn Coenenf4bf1582013-07-22 12:01:19 -07001824 */
Jose Lima970417c2014-04-10 10:42:19 -07001825 @Deprecated
Martijn Coenenf4bf1582013-07-22 12:01:19 -07001826 @SdkConstant(SdkConstantType.FEATURE)
1827 public static final String FEATURE_NFC_HCE = "android.hardware.nfc.hce";
1828
1829 /**
1830 * Feature for {@link #getSystemAvailableFeatures} and
Martijn Coenendf4d1d62013-08-28 11:18:58 -07001831 * {@link #hasSystemFeature}: The device supports host-
1832 * based NFC card emulation.
1833 */
1834 @SdkConstant(SdkConstantType.FEATURE)
1835 public static final String FEATURE_NFC_HOST_CARD_EMULATION = "android.hardware.nfc.hce";
1836
1837 /**
1838 * Feature for {@link #getSystemAvailableFeatures} and
Yoshinobu Itoc52adfe2016-01-22 18:14:18 +09001839 * {@link #hasSystemFeature}: The device supports host-
1840 * based NFC-F card emulation.
1841 */
1842 @SdkConstant(SdkConstantType.FEATURE)
1843 public static final String FEATURE_NFC_HOST_CARD_EMULATION_NFCF = "android.hardware.nfc.hcef";
1844
1845 /**
1846 * Feature for {@link #getSystemAvailableFeatures} and
Martijn Coenen441d61b2017-04-12 13:52:40 -07001847 * {@link #hasSystemFeature}: The device supports any
1848 * one of the {@link #FEATURE_NFC}, {@link #FEATURE_NFC_HOST_CARD_EMULATION},
1849 * or {@link #FEATURE_NFC_HOST_CARD_EMULATION_NFCF} features.
1850 *
1851 * @hide
1852 */
1853 @SdkConstant(SdkConstantType.FEATURE)
1854 public static final String FEATURE_NFC_ANY = "android.hardware.nfc.any";
1855
1856 /**
1857 * Feature for {@link #getSystemAvailableFeatures} and
Jesse Hall7f517062014-07-18 11:54:41 -07001858 * {@link #hasSystemFeature}: The device supports the OpenGL ES
1859 * <a href="http://www.khronos.org/registry/gles/extensions/ANDROID/ANDROID_extension_pack_es31a.txt">
1860 * Android Extension Pack</a>.
1861 */
1862 @SdkConstant(SdkConstantType.FEATURE)
1863 public static final String FEATURE_OPENGLES_EXTENSION_PACK = "android.hardware.opengles.aep";
1864
1865 /**
1866 * Feature for {@link #getSystemAvailableFeatures} and
Jesse Hall39ceeb52016-03-10 09:04:26 -08001867 * {@link #hasSystemFeature(String, int)}: If this feature is supported, the Vulkan native API
1868 * will enumerate at least one {@code VkPhysicalDevice}, and the feature version will indicate
1869 * what level of optional hardware features limits it supports.
Jesse Hallf77a34f2016-02-04 18:41:33 -08001870 * <p>
1871 * Level 0 includes the base Vulkan requirements as well as:
1872 * <ul><li>{@code VkPhysicalDeviceFeatures::textureCompressionETC2}</li></ul>
1873 * <p>
1874 * Level 1 additionally includes:
1875 * <ul>
1876 * <li>{@code VkPhysicalDeviceFeatures::fullDrawIndexUint32}</li>
1877 * <li>{@code VkPhysicalDeviceFeatures::imageCubeArray}</li>
1878 * <li>{@code VkPhysicalDeviceFeatures::independentBlend}</li>
1879 * <li>{@code VkPhysicalDeviceFeatures::geometryShader}</li>
1880 * <li>{@code VkPhysicalDeviceFeatures::tessellationShader}</li>
1881 * <li>{@code VkPhysicalDeviceFeatures::sampleRateShading}</li>
1882 * <li>{@code VkPhysicalDeviceFeatures::textureCompressionASTC_LDR}</li>
1883 * <li>{@code VkPhysicalDeviceFeatures::fragmentStoresAndAtomics}</li>
1884 * <li>{@code VkPhysicalDeviceFeatures::shaderImageGatherExtended}</li>
1885 * <li>{@code VkPhysicalDeviceFeatures::shaderUniformBufferArrayDynamicIndexing}</li>
1886 * <li>{@code VkPhysicalDeviceFeatures::shaderSampledImageArrayDynamicIndexing}</li>
1887 * </ul>
1888 */
1889 @SdkConstant(SdkConstantType.FEATURE)
1890 public static final String FEATURE_VULKAN_HARDWARE_LEVEL = "android.hardware.vulkan.level";
1891
1892 /**
1893 * Feature for {@link #getSystemAvailableFeatures} and
Jesse Hall1cd7e932017-02-05 19:58:15 -08001894 * {@link #hasSystemFeature(String, int)}: If this feature is supported, the Vulkan native API
1895 * will enumerate at least one {@code VkPhysicalDevice}, and the feature version will indicate
Jesse Hall54fc6092017-08-22 07:19:56 -07001896 * what level of optional compute features that device supports beyond the Vulkan 1.0
1897 * requirements.
Jesse Hall1cd7e932017-02-05 19:58:15 -08001898 * <p>
Jesse Hall54fc6092017-08-22 07:19:56 -07001899 * Compute level 0 indicates:
1900 * <ul>
1901 * <li>The {@code VK_KHR_variable_pointers} extension and
1902 * {@code VkPhysicalDeviceVariablePointerFeaturesKHR::variablePointers} feature are
1903 supported.</li>
1904 * <li>{@code VkPhysicalDeviceLimits::maxPerStageDescriptorStorageBuffers} is at least 16.</li>
1905 * </ul>
Jesse Hall1cd7e932017-02-05 19:58:15 -08001906 */
1907 @SdkConstant(SdkConstantType.FEATURE)
1908 public static final String FEATURE_VULKAN_HARDWARE_COMPUTE = "android.hardware.vulkan.compute";
1909
1910 /**
1911 * Feature for {@link #getSystemAvailableFeatures} and
Jesse Hall39ceeb52016-03-10 09:04:26 -08001912 * {@link #hasSystemFeature(String, int)}: The version of this feature indicates the highest
Jesse Hallf77a34f2016-02-04 18:41:33 -08001913 * {@code VkPhysicalDeviceProperties::apiVersion} supported by the physical devices that support
1914 * the hardware level indicated by {@link #FEATURE_VULKAN_HARDWARE_LEVEL}. The feature version
1915 * uses the same encoding as Vulkan version numbers:
1916 * <ul>
1917 * <li>Major version number in bits 31-22</li>
1918 * <li>Minor version number in bits 21-12</li>
1919 * <li>Patch version number in bits 11-0</li>
1920 * </ul>
1921 */
1922 @SdkConstant(SdkConstantType.FEATURE)
1923 public static final String FEATURE_VULKAN_HARDWARE_VERSION = "android.hardware.vulkan.version";
1924
1925 /**
Tomasz Wasilczyk05392d62017-07-10 19:33:22 -07001926 * Feature for {@link #getSystemAvailableFeatures} and
1927 * {@link #hasSystemFeature}: The device includes broadcast radio tuner.
1928 * @hide
Tomasz Wasilczyk347192e2017-04-04 11:13:44 -07001929 */
Tomasz Wasilczyk05392d62017-07-10 19:33:22 -07001930 @SystemApi
Tomasz Wasilczyk347192e2017-04-04 11:13:44 -07001931 @SdkConstant(SdkConstantType.FEATURE)
Tomasz Wasilczyk05392d62017-07-10 19:33:22 -07001932 public static final String FEATURE_BROADCAST_RADIO = "android.hardware.broadcastradio";
Tomasz Wasilczyk347192e2017-04-04 11:13:44 -07001933
1934 /**
Jesse Hallf77a34f2016-02-04 18:41:33 -08001935 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill5744bb42010-09-01 19:18:57 -07001936 * {@link #hasSystemFeature}: The device includes an accelerometer.
1937 */
1938 @SdkConstant(SdkConstantType.FEATURE)
1939 public static final String FEATURE_SENSOR_ACCELEROMETER = "android.hardware.sensor.accelerometer";
1940
1941 /**
1942 * Feature for {@link #getSystemAvailableFeatures} and
1943 * {@link #hasSystemFeature}: The device includes a barometer (air
1944 * pressure sensor.)
1945 */
1946 @SdkConstant(SdkConstantType.FEATURE)
1947 public static final String FEATURE_SENSOR_BAROMETER = "android.hardware.sensor.barometer";
1948
1949 /**
1950 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001951 * {@link #hasSystemFeature}: The device includes a magnetometer (compass).
1952 */
1953 @SdkConstant(SdkConstantType.FEATURE)
1954 public static final String FEATURE_SENSOR_COMPASS = "android.hardware.sensor.compass";
1955
1956 /**
1957 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill5744bb42010-09-01 19:18:57 -07001958 * {@link #hasSystemFeature}: The device includes a gyroscope.
Dan Morrill50ab63f2010-03-05 16:16:19 -08001959 */
1960 @SdkConstant(SdkConstantType.FEATURE)
Dan Morrill5744bb42010-09-01 19:18:57 -07001961 public static final String FEATURE_SENSOR_GYROSCOPE = "android.hardware.sensor.gyroscope";
Dan Morrill50ab63f2010-03-05 16:16:19 -08001962
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001963 /**
1964 * Feature for {@link #getSystemAvailableFeatures} and
1965 * {@link #hasSystemFeature}: The device includes a light sensor.
1966 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001967 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001968 public static final String FEATURE_SENSOR_LIGHT = "android.hardware.sensor.light";
Dan Morrill50ab63f2010-03-05 16:16:19 -08001969
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001970 /**
1971 * Feature for {@link #getSystemAvailableFeatures} and
1972 * {@link #hasSystemFeature}: The device includes a proximity sensor.
1973 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001974 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001975 public static final String FEATURE_SENSOR_PROXIMITY = "android.hardware.sensor.proximity";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001976
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001977 /**
1978 * Feature for {@link #getSystemAvailableFeatures} and
Aravind Akella068b0c02013-10-12 17:39:15 -07001979 * {@link #hasSystemFeature}: The device includes a hardware step counter.
1980 */
1981 @SdkConstant(SdkConstantType.FEATURE)
1982 public static final String FEATURE_SENSOR_STEP_COUNTER = "android.hardware.sensor.stepcounter";
1983
1984 /**
1985 * Feature for {@link #getSystemAvailableFeatures} and
1986 * {@link #hasSystemFeature}: The device includes a hardware step detector.
1987 */
1988 @SdkConstant(SdkConstantType.FEATURE)
1989 public static final String FEATURE_SENSOR_STEP_DETECTOR = "android.hardware.sensor.stepdetector";
1990
1991 /**
1992 * Feature for {@link #getSystemAvailableFeatures} and
Vinod Krishnan8afb23c2014-04-30 11:11:39 -07001993 * {@link #hasSystemFeature}: The device includes a heart rate monitor.
1994 */
1995 @SdkConstant(SdkConstantType.FEATURE)
1996 public static final String FEATURE_SENSOR_HEART_RATE = "android.hardware.sensor.heartrate";
1997
1998 /**
1999 * Feature for {@link #getSystemAvailableFeatures} and
Trevor Johns682c24e2016-04-12 10:13:47 -07002000 * {@link #hasSystemFeature}: The heart rate sensor on this device is an Electrocardiogram.
Vinod Krishnan1ab76892014-08-20 11:11:55 -07002001 */
2002 @SdkConstant(SdkConstantType.FEATURE)
2003 public static final String FEATURE_SENSOR_HEART_RATE_ECG =
2004 "android.hardware.sensor.heartrate.ecg";
2005
2006 /**
2007 * Feature for {@link #getSystemAvailableFeatures} and
Aravind Akella8b8e74b2014-07-09 11:52:39 -07002008 * {@link #hasSystemFeature}: The device includes a relative humidity sensor.
2009 */
2010 @SdkConstant(SdkConstantType.FEATURE)
2011 public static final String FEATURE_SENSOR_RELATIVE_HUMIDITY =
2012 "android.hardware.sensor.relative_humidity";
2013
2014 /**
2015 * Feature for {@link #getSystemAvailableFeatures} and
2016 * {@link #hasSystemFeature}: The device includes an ambient temperature sensor.
2017 */
2018 @SdkConstant(SdkConstantType.FEATURE)
2019 public static final String FEATURE_SENSOR_AMBIENT_TEMPERATURE =
2020 "android.hardware.sensor.ambient_temperature";
2021
2022 /**
2023 * Feature for {@link #getSystemAvailableFeatures} and
Ashutosh Joshieae371b2015-04-09 10:30:07 -07002024 * {@link #hasSystemFeature}: The device supports high fidelity sensor processing
2025 * capabilities.
2026 */
2027 @SdkConstant(SdkConstantType.FEATURE)
2028 public static final String FEATURE_HIFI_SENSORS =
2029 "android.hardware.sensor.hifi_sensors";
2030
2031 /**
2032 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002033 * {@link #hasSystemFeature}: The device has a telephony radio with data
2034 * communication support.
2035 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08002036 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002037 public static final String FEATURE_TELEPHONY = "android.hardware.telephony";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002038
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002039 /**
2040 * Feature for {@link #getSystemAvailableFeatures} and
2041 * {@link #hasSystemFeature}: The device has a CDMA telephony stack.
2042 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08002043 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002044 public static final String FEATURE_TELEPHONY_CDMA = "android.hardware.telephony.cdma";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002045
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002046 /**
2047 * Feature for {@link #getSystemAvailableFeatures} and
2048 * {@link #hasSystemFeature}: The device has a GSM telephony stack.
2049 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08002050 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002051 public static final String FEATURE_TELEPHONY_GSM = "android.hardware.telephony.gsm";
Hung-ying Tyan3424c022010-08-27 18:08:19 +08002052
2053 /**
Polina Bondarenko80909ce2017-01-12 21:10:38 +01002054 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2055 * The device supports telephony carrier restriction mechanism.
2056 *
2057 * <p>Devices declaring this feature must have an implementation of the
2058 * {@link android.telephony.TelephonyManager#getAllowedCarriers} and
2059 * {@link android.telephony.TelephonyManager#setAllowedCarriers}.
2060 * @hide
2061 */
2062 @SystemApi
2063 @SdkConstant(SdkConstantType.FEATURE)
2064 public static final String FEATURE_TELEPHONY_CARRIERLOCK =
2065 "android.hardware.telephony.carrierlock";
2066
2067 /**
Jeff Davidson35cda392017-02-27 09:46:00 -08002068 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: The device
2069 * supports embedded subscriptions on eUICCs.
2070 * TODO(b/35851809): Make this public.
2071 * @hide
2072 */
2073 @SdkConstant(SdkConstantType.FEATURE)
2074 public static final String FEATURE_TELEPHONY_EUICC = "android.hardware.telephony.euicc";
2075
2076 /**
Hall Liuc6703d92017-11-17 11:31:57 -08002077 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: The device
2078 * supports cell-broadcast reception using the MBMS APIs.
2079 */
2080 @SdkConstant(SdkConstantType.FEATURE)
2081 public static final String FEATURE_TELEPHONY_MBMS = "android.hardware.telephony.mbms";
2082
2083 /**
Hung-ying Tyan3424c022010-08-27 18:08:19 +08002084 * Feature for {@link #getSystemAvailableFeatures} and
Mike Lockwoodf4ca2472011-02-27 11:23:25 -08002085 * {@link #hasSystemFeature}: The device supports connecting to USB devices
2086 * as the USB host.
2087 */
2088 @SdkConstant(SdkConstantType.FEATURE)
2089 public static final String FEATURE_USB_HOST = "android.hardware.usb.host";
2090
2091 /**
2092 * Feature for {@link #getSystemAvailableFeatures} and
2093 * {@link #hasSystemFeature}: The device supports connecting to USB accessories.
2094 */
2095 @SdkConstant(SdkConstantType.FEATURE)
2096 public static final String FEATURE_USB_ACCESSORY = "android.hardware.usb.accessory";
2097
2098 /**
2099 * Feature for {@link #getSystemAvailableFeatures} and
Hung-ying Tyan3424c022010-08-27 18:08:19 +08002100 * {@link #hasSystemFeature}: The SIP API is enabled on the device.
2101 */
2102 @SdkConstant(SdkConstantType.FEATURE)
2103 public static final String FEATURE_SIP = "android.software.sip";
2104
2105 /**
2106 * Feature for {@link #getSystemAvailableFeatures} and
2107 * {@link #hasSystemFeature}: The device supports SIP-based VOIP.
2108 */
2109 @SdkConstant(SdkConstantType.FEATURE)
2110 public static final String FEATURE_SIP_VOIP = "android.software.sip.voip";
2111
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002112 /**
2113 * Feature for {@link #getSystemAvailableFeatures} and
Ihab Awad1ec68882014-09-12 11:09:01 -07002114 * {@link #hasSystemFeature}: The Connection Service API is enabled on the device.
2115 */
2116 @SdkConstant(SdkConstantType.FEATURE)
2117 public static final String FEATURE_CONNECTION_SERVICE = "android.software.connectionservice";
2118
2119 /**
2120 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrillb0fe0332010-04-05 14:43:58 -07002121 * {@link #hasSystemFeature}: The device's display has a touch screen.
2122 */
2123 @SdkConstant(SdkConstantType.FEATURE)
2124 public static final String FEATURE_TOUCHSCREEN = "android.hardware.touchscreen";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002125
Dan Morrillb0fe0332010-04-05 14:43:58 -07002126 /**
2127 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08002128 * {@link #hasSystemFeature}: The device's touch screen supports
2129 * multitouch sufficient for basic two-finger gesture detection.
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002130 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08002131 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002132 public static final String FEATURE_TOUCHSCREEN_MULTITOUCH = "android.hardware.touchscreen.multitouch";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002133
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002134 /**
2135 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08002136 * {@link #hasSystemFeature}: The device's touch screen is capable of
2137 * tracking two or more fingers fully independently.
2138 */
2139 @SdkConstant(SdkConstantType.FEATURE)
2140 public static final String FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT = "android.hardware.touchscreen.multitouch.distinct";
2141
2142 /**
2143 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill6993d3d2010-09-03 14:30:14 -07002144 * {@link #hasSystemFeature}: The device's touch screen is capable of
2145 * tracking a full hand of fingers fully independently -- that is, 5 or
2146 * more simultaneous independent pointers.
2147 */
2148 @SdkConstant(SdkConstantType.FEATURE)
2149 public static final String FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND = "android.hardware.touchscreen.multitouch.jazzhand";
2150
2151 /**
2152 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrilla5376872011-01-23 13:15:53 -08002153 * {@link #hasSystemFeature}: The device does not have a touch screen, but
2154 * does support touch emulation for basic events. For instance, the
2155 * device might use a mouse or remote control to drive a cursor, and
2156 * emulate basic touch pointer events like down, up, drag, etc. All
2157 * devices that support android.hardware.touchscreen or a sub-feature are
2158 * presumed to also support faketouch.
2159 */
2160 @SdkConstant(SdkConstantType.FEATURE)
2161 public static final String FEATURE_FAKETOUCH = "android.hardware.faketouch";
2162
2163 /**
2164 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborne22fe932011-06-08 20:24:29 -07002165 * {@link #hasSystemFeature}: The device does not have a touch screen, but
2166 * does support touch emulation for basic events that supports distinct
2167 * tracking of two or more fingers. This is an extension of
2168 * {@link #FEATURE_FAKETOUCH} for input devices with this capability. Note
2169 * that unlike a distinct multitouch screen as defined by
2170 * {@link #FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT}, these kinds of input
2171 * devices will not actually provide full two-finger gestures since the
2172 * input is being transformed to cursor movement on the screen. That is,
2173 * single finger gestures will move a cursor; two-finger swipes will
2174 * result in single-finger touch events; other two-finger gestures will
2175 * result in the corresponding two-finger touch event.
2176 */
2177 @SdkConstant(SdkConstantType.FEATURE)
2178 public static final String FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT = "android.hardware.faketouch.multitouch.distinct";
2179
2180 /**
2181 * Feature for {@link #getSystemAvailableFeatures} and
2182 * {@link #hasSystemFeature}: The device does not have a touch screen, but
2183 * does support touch emulation for basic events that supports tracking
2184 * a hand of fingers (5 or more fingers) fully independently.
2185 * This is an extension of
2186 * {@link #FEATURE_FAKETOUCH} for input devices with this capability. Note
2187 * that unlike a multitouch screen as defined by
2188 * {@link #FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND}, not all two finger
2189 * gestures can be detected due to the limitations described for
2190 * {@link #FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT}.
2191 */
2192 @SdkConstant(SdkConstantType.FEATURE)
2193 public static final String FEATURE_FAKETOUCH_MULTITOUCH_JAZZHAND = "android.hardware.faketouch.multitouch.jazzhand";
2194
2195 /**
2196 * Feature for {@link #getSystemAvailableFeatures} and
Jim Millerd9b9d412015-07-22 19:51:40 -07002197 * {@link #hasSystemFeature}: The device has biometric hardware to detect a fingerprint.
2198 */
2199 @SdkConstant(SdkConstantType.FEATURE)
2200 public static final String FEATURE_FINGERPRINT = "android.hardware.fingerprint";
2201
2202 /**
2203 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborne289bff2011-06-13 19:33:22 -07002204 * {@link #hasSystemFeature}: The device supports portrait orientation
2205 * screens. For backwards compatibility, you can assume that if neither
2206 * this nor {@link #FEATURE_SCREEN_LANDSCAPE} is set then the device supports
2207 * both portrait and landscape.
2208 */
2209 @SdkConstant(SdkConstantType.FEATURE)
2210 public static final String FEATURE_SCREEN_PORTRAIT = "android.hardware.screen.portrait";
2211
2212 /**
2213 * Feature for {@link #getSystemAvailableFeatures} and
2214 * {@link #hasSystemFeature}: The device supports landscape orientation
2215 * screens. For backwards compatibility, you can assume that if neither
2216 * this nor {@link #FEATURE_SCREEN_PORTRAIT} is set then the device supports
2217 * both portrait and landscape.
2218 */
2219 @SdkConstant(SdkConstantType.FEATURE)
2220 public static final String FEATURE_SCREEN_LANDSCAPE = "android.hardware.screen.landscape";
2221
2222 /**
2223 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002224 * {@link #hasSystemFeature}: The device supports live wallpapers.
2225 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08002226 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002227 public static final String FEATURE_LIVE_WALLPAPER = "android.software.live_wallpaper";
Oscar Montemayor1228d0a2010-01-28 12:01:44 -08002228 /**
Dan Morrill50ab63f2010-03-05 16:16:19 -08002229 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn119bbc32013-03-22 17:27:25 -07002230 * {@link #hasSystemFeature}: The device supports app widgets.
2231 */
2232 @SdkConstant(SdkConstantType.FEATURE)
2233 public static final String FEATURE_APP_WIDGETS = "android.software.app_widgets";
2234
2235 /**
Dianne Hackborn91097de2014-04-04 18:02:06 -07002236 * @hide
2237 * Feature for {@link #getSystemAvailableFeatures} and
2238 * {@link #hasSystemFeature}: The device supports
2239 * {@link android.service.voice.VoiceInteractionService} and
2240 * {@link android.app.VoiceInteractor}.
2241 */
2242 @SdkConstant(SdkConstantType.FEATURE)
2243 public static final String FEATURE_VOICE_RECOGNIZERS = "android.software.voice_recognizers";
2244
2245
2246 /**
Dianne Hackborn119bbc32013-03-22 17:27:25 -07002247 * Feature for {@link #getSystemAvailableFeatures} and
2248 * {@link #hasSystemFeature}: The device supports a home screen that is replaceable
2249 * by third party applications.
2250 */
2251 @SdkConstant(SdkConstantType.FEATURE)
2252 public static final String FEATURE_HOME_SCREEN = "android.software.home_screen";
2253
2254 /**
2255 * Feature for {@link #getSystemAvailableFeatures} and
2256 * {@link #hasSystemFeature}: The device supports adding new input methods implemented
2257 * with the {@link android.inputmethodservice.InputMethodService} API.
2258 */
2259 @SdkConstant(SdkConstantType.FEATURE)
2260 public static final String FEATURE_INPUT_METHODS = "android.software.input_methods";
2261
2262 /**
2263 * Feature for {@link #getSystemAvailableFeatures} and
Amith Yamasani44a01b72013-09-16 10:44:57 -07002264 * {@link #hasSystemFeature}: The device supports device policy enforcement via device admins.
2265 */
2266 @SdkConstant(SdkConstantType.FEATURE)
2267 public static final String FEATURE_DEVICE_ADMIN = "android.software.device_admin";
2268
2269 /**
2270 * Feature for {@link #getSystemAvailableFeatures} and
Tim Kilbournf94b6a92014-03-07 15:13:48 -08002271 * {@link #hasSystemFeature}: The device supports leanback UI. This is
2272 * typically used in a living room television experience, but is a software
2273 * feature unlike {@link #FEATURE_TELEVISION}. Devices running with this
2274 * feature will use resources associated with the "television" UI mode.
2275 */
2276 @SdkConstant(SdkConstantType.FEATURE)
2277 public static final String FEATURE_LEANBACK = "android.software.leanback";
2278
2279 /**
2280 * Feature for {@link #getSystemAvailableFeatures} and
2281 * {@link #hasSystemFeature}: The device supports only leanback UI. Only
2282 * applications designed for this experience should be run, though this is
2283 * not enforced by the system.
Tim Kilbournf94b6a92014-03-07 15:13:48 -08002284 */
2285 @SdkConstant(SdkConstantType.FEATURE)
2286 public static final String FEATURE_LEANBACK_ONLY = "android.software.leanback_only";
2287
2288 /**
2289 * Feature for {@link #getSystemAvailableFeatures} and
Jae Seocfd861e2014-08-27 14:02:15 -07002290 * {@link #hasSystemFeature}: The device supports live TV and can display
2291 * contents from TV inputs implemented with the
2292 * {@link android.media.tv.TvInputService} API.
2293 */
2294 @SdkConstant(SdkConstantType.FEATURE)
2295 public static final String FEATURE_LIVE_TV = "android.software.live_tv";
2296
2297 /**
2298 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08002299 * {@link #hasSystemFeature}: The device supports WiFi (802.11) networking.
2300 */
2301 @SdkConstant(SdkConstantType.FEATURE)
2302 public static final String FEATURE_WIFI = "android.hardware.wifi";
2303
2304 /**
Irfan Sheriff45b8b462011-09-07 11:24:16 -07002305 * Feature for {@link #getSystemAvailableFeatures} and
2306 * {@link #hasSystemFeature}: The device supports Wi-Fi Direct networking.
2307 */
2308 @SdkConstant(SdkConstantType.FEATURE)
2309 public static final String FEATURE_WIFI_DIRECT = "android.hardware.wifi.direct";
2310
2311 /**
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07002312 * Feature for {@link #getSystemAvailableFeatures} and
Etan Cohen04133272016-10-26 11:22:06 -07002313 * {@link #hasSystemFeature}: The device supports Wi-Fi Aware.
Etan Cohen20d329b2015-09-29 13:49:02 -07002314 */
2315 @SdkConstant(SdkConstantType.FEATURE)
Etan Cohen04133272016-10-26 11:22:06 -07002316 public static final String FEATURE_WIFI_AWARE = "android.hardware.wifi.aware";
Etan Cohen20d329b2015-09-29 13:49:02 -07002317
2318 /**
2319 * Feature for {@link #getSystemAvailableFeatures} and
Peter Qiu3d615e42017-08-07 20:13:32 +00002320 * {@link #hasSystemFeature}: The device supports Wi-Fi Passpoint and all
2321 * Passpoint related APIs in {@link WifiManager} are supported. Refer to
2322 * {@link WifiManager#addOrUpdatePasspointConfiguration} for more info.
Peter Qiub99fe312017-05-05 13:48:47 -07002323 */
2324 @SdkConstant(SdkConstantType.FEATURE)
2325 public static final String FEATURE_WIFI_PASSPOINT = "android.hardware.wifi.passpoint";
2326
2327 /**
2328 * Feature for {@link #getSystemAvailableFeatures} and
Etan Cohen692e68e2017-09-14 15:42:01 -07002329 * {@link #hasSystemFeature}: The device supports Wi-Fi RTT (IEEE 802.11mc).
2330 *
2331 * @hide RTT_API
2332 */
2333 @SdkConstant(SdkConstantType.FEATURE)
2334 public static final String FEATURE_WIFI_RTT = "android.hardware.wifi.rtt";
2335
2336
2337 /**
2338 * Feature for {@link #getSystemAvailableFeatures} and
Robert Quattlebaum87a71042017-05-15 15:45:20 -07002339 * {@link #hasSystemFeature}: The device supports LoWPAN networking.
2340 * @hide
2341 */
2342 @SdkConstant(SdkConstantType.FEATURE)
2343 public static final String FEATURE_LOWPAN = "android.hardware.lowpan";
2344
2345 /**
2346 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07002347 * {@link #hasSystemFeature}: This is a device dedicated to showing UI
Todd Kennedy7f95a002015-04-22 14:28:25 -07002348 * on a vehicle headunit. A headunit here is defined to be inside a
2349 * vehicle that may or may not be moving. A headunit uses either a
2350 * primary display in the center console and/or additional displays in
2351 * the instrument cluster or elsewhere in the vehicle. Headunit display(s)
2352 * have limited size and resolution. The user will likely be focused on
2353 * driving so limiting driver distraction is a primary concern. User input
2354 * can be a variety of hard buttons, touch, rotary controllers and even mouse-
2355 * like interfaces.
2356 */
2357 @SdkConstant(SdkConstantType.FEATURE)
2358 public static final String FEATURE_AUTOMOTIVE = "android.hardware.type.automotive";
2359
2360 /**
2361 * Feature for {@link #getSystemAvailableFeatures} and
2362 * {@link #hasSystemFeature}: This is a device dedicated to showing UI
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07002363 * on a television. Television here is defined to be a typical living
2364 * room television experience: displayed on a big screen, where the user
2365 * is sitting far away from it, and the dominant form of input will be
2366 * something like a DPAD, not through touch or mouse.
Tim Kilbournf94b6a92014-03-07 15:13:48 -08002367 * @deprecated use {@link #FEATURE_LEANBACK} instead.
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07002368 */
Jose Lima970417c2014-04-10 10:42:19 -07002369 @Deprecated
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07002370 @SdkConstant(SdkConstantType.FEATURE)
2371 public static final String FEATURE_TELEVISION = "android.hardware.type.television";
2372
2373 /**
Justin Kohb5731f091c2014-02-13 16:06:59 -08002374 * Feature for {@link #getSystemAvailableFeatures} and
2375 * {@link #hasSystemFeature}: This is a device dedicated to showing UI
2376 * on a watch. A watch here is defined to be a device worn on the body, perhaps on
2377 * the wrist. The user is very close when interacting with the device.
2378 */
2379 @SdkConstant(SdkConstantType.FEATURE)
2380 public static final String FEATURE_WATCH = "android.hardware.type.watch";
2381
2382 /**
Ralph Nathanb8e0dee2017-01-24 15:24:59 -08002383 * Feature for {@link #getSystemAvailableFeatures} and
2384 * {@link #hasSystemFeature}: This is a device for IoT and may not have an UI. An embedded
2385 * device is defined as a full stack Android device with or without a display and no
2386 * user-installable apps.
2387 */
2388 @SdkConstant(SdkConstantType.FEATURE)
2389 public static final String FEATURE_EMBEDDED = "android.hardware.type.embedded";
2390
2391 /**
Dennis Kempin7345ed52017-04-14 16:40:56 -07002392 * Feature for {@link #getSystemAvailableFeatures} and
2393 * {@link #hasSystemFeature}: This is a device dedicated to be primarily used
2394 * with keyboard, mouse or touchpad. This includes traditional desktop
2395 * computers, laptops and variants such as convertibles or detachables.
2396 * Due to the larger screen, the device will most likely use the
2397 * {@link #FEATURE_FREEFORM_WINDOW_MANAGEMENT} feature as well.
2398 */
2399 @SdkConstant(SdkConstantType.FEATURE)
2400 public static final String FEATURE_PC = "android.hardware.type.pc";
2401
2402 /**
Adam Lesinski3d9bcb92014-02-18 14:05:14 -08002403 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2404 * The device supports printing.
2405 */
2406 @SdkConstant(SdkConstantType.FEATURE)
2407 public static final String FEATURE_PRINTING = "android.software.print";
2408
2409 /**
2410 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Eugene Susla7c3eef22017-03-10 14:25:58 -08002411 * The device supports {@link android.companion.CompanionDeviceManager#associate associating}
2412 * with devices via {@link android.companion.CompanionDeviceManager}.
2413 */
2414 @SdkConstant(SdkConstantType.FEATURE)
2415 public static final String FEATURE_COMPANION_DEVICE_SETUP
2416 = "android.software.companion_device_setup";
2417
2418 /**
2419 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Adam Lesinski3d9bcb92014-02-18 14:05:14 -08002420 * The device can perform backup and restore operations on installed applications.
2421 */
2422 @SdkConstant(SdkConstantType.FEATURE)
2423 public static final String FEATURE_BACKUP = "android.software.backup";
2424
2425 /**
Vladislav Kaznacheevd303b252015-10-27 17:30:58 -07002426 * Feature for {@link #getSystemAvailableFeatures} and
2427 * {@link #hasSystemFeature}: The device supports freeform window management.
2428 * Windows have title bars and can be moved and resized.
2429 */
Filip Gruszczynski811dc3b2015-11-23 12:34:22 -08002430 // If this feature is present, you also need to set
2431 // com.android.internal.R.config_freeformWindowManagement to true in your configuration overlay.
Vladislav Kaznacheevd303b252015-10-27 17:30:58 -07002432 @SdkConstant(SdkConstantType.FEATURE)
2433 public static final String FEATURE_FREEFORM_WINDOW_MANAGEMENT
2434 = "android.software.freeform_window_management";
2435
2436 /**
Adam Connors23cc04e2014-04-01 12:12:20 +01002437 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Wale Ogunwalefbe12c42015-12-06 16:23:50 -08002438 * The device supports picture-in-picture multi-window mode.
2439 */
2440 @SdkConstant(SdkConstantType.FEATURE)
2441 public static final String FEATURE_PICTURE_IN_PICTURE = "android.software.picture_in_picture";
2442
2443 /**
2444 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Andrii Kulian1981f5f2017-04-07 16:23:12 -07002445 * The device supports running activities on secondary displays.
2446 */
2447 @SdkConstant(SdkConstantType.FEATURE)
2448 public static final String FEATURE_ACTIVITIES_ON_SECONDARY_DISPLAYS
2449 = "android.software.activities_on_secondary_displays";
2450
2451 /**
2452 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Amith Yamasani1d653272014-09-11 17:56:05 -07002453 * The device supports creating secondary users and managed profiles via
2454 * {@link DevicePolicyManager}.
Adam Connors23cc04e2014-04-01 12:12:20 +01002455 */
2456 @SdkConstant(SdkConstantType.FEATURE)
Amith Yamasani1d653272014-09-11 17:56:05 -07002457 public static final String FEATURE_MANAGED_USERS = "android.software.managed_users";
2458
2459 /**
2460 * @hide
2461 * TODO: Remove after dependencies updated b/17392243
2462 */
2463 public static final String FEATURE_MANAGED_PROFILES = "android.software.managed_users";
Adam Connors23cc04e2014-04-01 12:12:20 +01002464
2465 /**
Ben Murdochf564c7f2014-05-20 18:58:06 +01002466 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Adam Connors19ccb5f2014-09-08 17:31:50 +01002467 * The device supports verified boot.
2468 */
2469 @SdkConstant(SdkConstantType.FEATURE)
2470 public static final String FEATURE_VERIFIED_BOOT = "android.software.verified_boot";
2471
2472 /**
2473 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2474 * The device supports secure removal of users. When a user is deleted the data associated
2475 * with that user is securely deleted and no longer available.
2476 */
2477 @SdkConstant(SdkConstantType.FEATURE)
2478 public static final String FEATURE_SECURELY_REMOVES_USERS
2479 = "android.software.securely_removes_users";
2480
Jeff Sharkeyb92b05b2016-01-28 09:50:00 -07002481 /** {@hide} */
Jeff Sharkey8eb783b2018-01-04 16:46:48 -07002482 @TestApi
Jeff Sharkeyb92b05b2016-01-28 09:50:00 -07002483 @SdkConstant(SdkConstantType.FEATURE)
2484 public static final String FEATURE_FILE_BASED_ENCRYPTION
2485 = "android.software.file_based_encryption";
2486
Jeff Sharkey8eb783b2018-01-04 16:46:48 -07002487 /** {@hide} */
2488 @TestApi
2489 @SdkConstant(SdkConstantType.FEATURE)
2490 public static final String FEATURE_ADOPTABLE_STORAGE
2491 = "android.software.adoptable_storage";
2492
Adam Connors19ccb5f2014-09-08 17:31:50 +01002493 /**
2494 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Ben Murdoch422c7a52014-05-16 13:45:47 +01002495 * The device has a full implementation of the android.webkit.* APIs. Devices
2496 * lacking this feature will not have a functioning WebView implementation.
2497 */
2498 @SdkConstant(SdkConstantType.FEATURE)
2499 public static final String FEATURE_WEBVIEW = "android.software.webview";
2500
2501 /**
Joe LaPenna4bb015d2014-07-04 17:15:54 -07002502 * Feature for {@link #getSystemAvailableFeatures} and
2503 * {@link #hasSystemFeature}: This device supports ethernet.
Joe LaPenna4bb015d2014-07-04 17:15:54 -07002504 */
2505 @SdkConstant(SdkConstantType.FEATURE)
2506 public static final String FEATURE_ETHERNET = "android.hardware.ethernet";
2507
2508 /**
Yuncheol Heoa0c4a062014-07-10 20:49:27 +09002509 * Feature for {@link #getSystemAvailableFeatures} and
2510 * {@link #hasSystemFeature}: This device supports HDMI-CEC.
2511 * @hide
2512 */
2513 @SdkConstant(SdkConstantType.FEATURE)
2514 public static final String FEATURE_HDMI_CEC = "android.hardware.hdmi.cec";
2515
2516 /**
Michael Wright6faa6752014-09-05 17:57:44 -07002517 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2518 * The device has all of the inputs necessary to be considered a compatible game controller, or
2519 * includes a compatible game controller in the box.
2520 */
2521 @SdkConstant(SdkConstantType.FEATURE)
2522 public static final String FEATURE_GAMEPAD = "android.hardware.gamepad";
2523
Mike Lockwood5781cd52015-03-27 13:23:41 -07002524 /**
2525 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2526 * The device has a full implementation of the android.media.midi.* APIs.
2527 */
2528 @SdkConstant(SdkConstantType.FEATURE)
2529 public static final String FEATURE_MIDI = "android.software.midi";
Michael Wright6faa6752014-09-05 17:57:44 -07002530
2531 /**
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08002532 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Ruben Brunk927d3452016-05-02 19:30:51 -07002533 * The device implements an optimized mode for virtual reality (VR) applications that handles
2534 * stereoscopic rendering of notifications, and disables most monocular system UI components
2535 * while a VR application has user focus.
2536 * Devices declaring this feature must include an application implementing a
2537 * {@link android.service.vr.VrListenerService} that can be targeted by VR applications via
2538 * {@link android.app.Activity#setVrModeEnabled}.
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08002539 */
2540 @SdkConstant(SdkConstantType.FEATURE)
2541 public static final String FEATURE_VR_MODE = "android.software.vr.mode";
2542
2543 /**
Ruben Brunk31d80ea2016-01-25 20:14:08 -08002544 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Ruben Brunk927d3452016-05-02 19:30:51 -07002545 * The device implements {@link #FEATURE_VR_MODE} but additionally meets extra CDD requirements
2546 * to provide a high-quality VR experience. In general, devices declaring this feature will
2547 * additionally:
2548 * <ul>
2549 * <li>Deliver consistent performance at a high framerate over an extended period of time
2550 * for typical VR application CPU/GPU workloads with a minimal number of frame drops for VR
2551 * applications that have called
2552 * {@link android.view.Window#setSustainedPerformanceMode}.</li>
2553 * <li>Implement {@link #FEATURE_HIFI_SENSORS} and have a low sensor latency.</li>
2554 * <li>Include optimizations to lower display persistence while running VR applications.</li>
2555 * <li>Implement an optimized render path to minimize latency to draw to the device's main
2556 * display.</li>
2557 * <li>Include the following EGL extensions: EGL_ANDROID_create_native_client_buffer,
2558 * EGL_ANDROID_front_buffer_auto_refresh, EGL_EXT_protected_content,
2559 * EGL_KHR_mutable_render_buffer, EGL_KHR_reusable_sync, and EGL_KHR_wait_sync.</li>
2560 * <li>Provide at least one CPU core that is reserved for use solely by the top, foreground
2561 * VR application process for critical render threads while such an application is
2562 * running.</li>
2563 * </ul>
Ruben Brunk31d80ea2016-01-25 20:14:08 -08002564 */
2565 @SdkConstant(SdkConstantType.FEATURE)
2566 public static final String FEATURE_VR_MODE_HIGH_PERFORMANCE
2567 = "android.hardware.vr.high_performance";
2568
2569 /**
Craig Donner279dd662017-03-15 17:10:50 -07002570 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Svet Ganov43574b02017-04-12 09:25:20 -07002571 * The device supports autofill of user credentials, addresses, credit cards, etc
2572 * via integration with {@link android.service.autofill.AutofillService autofill
2573 * providers}.
2574 */
2575 @SdkConstant(SdkConstantType.FEATURE)
2576 public static final String FEATURE_AUTOFILL = "android.software.autofill";
2577
2578 /**
2579 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Craig Donner279dd662017-03-15 17:10:50 -07002580 * The device implements headtracking suitable for a VR device.
2581 */
2582 @SdkConstant(SdkConstantType.FEATURE)
2583 public static final String FEATURE_VR_HEADTRACKING = "android.hardware.vr.headtracking";
2584
2585 /**
Dianne Hackborne83cefce2010-02-04 17:38:14 -08002586 * Action to external storage service to clean out removed apps.
2587 * @hide
2588 */
2589 public static final String ACTION_CLEAN_EXTERNAL_STORAGE
2590 = "android.content.pm.CLEAN_EXTERNAL_STORAGE";
Oscar Montemayor1228d0a2010-01-28 12:01:44 -08002591
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002592 /**
Kenny Root5ab21572011-07-27 11:11:19 -07002593 * Extra field name for the URI to a verification file. Passed to a package
2594 * verifier.
2595 *
2596 * @hide
2597 */
2598 public static final String EXTRA_VERIFICATION_URI = "android.content.pm.extra.VERIFICATION_URI";
2599
2600 /**
2601 * Extra field name for the ID of a package pending verification. Passed to
2602 * a package verifier and is used to call back to
Kenny Root3a9b5fb2011-09-20 14:15:38 -07002603 * {@link PackageManager#verifyPendingInstall(int, int)}
Kenny Root5ab21572011-07-27 11:11:19 -07002604 */
2605 public static final String EXTRA_VERIFICATION_ID = "android.content.pm.extra.VERIFICATION_ID";
2606
2607 /**
2608 * Extra field name for the package identifier which is trying to install
2609 * the package.
2610 *
2611 * @hide
2612 */
2613 public static final String EXTRA_VERIFICATION_INSTALLER_PACKAGE
2614 = "android.content.pm.extra.VERIFICATION_INSTALLER_PACKAGE";
2615
2616 /**
2617 * Extra field name for the requested install flags for a package pending
2618 * verification. Passed to a package verifier.
2619 *
2620 * @hide
2621 */
2622 public static final String EXTRA_VERIFICATION_INSTALL_FLAGS
2623 = "android.content.pm.extra.VERIFICATION_INSTALL_FLAGS";
2624
2625 /**
rich cannings13d428e2012-09-13 13:43:07 -07002626 * Extra field name for the uid of who is requesting to install
2627 * the package.
2628 *
2629 * @hide
2630 */
2631 public static final String EXTRA_VERIFICATION_INSTALLER_UID
2632 = "android.content.pm.extra.VERIFICATION_INSTALLER_UID";
2633
2634 /**
2635 * Extra field name for the package name of a package pending verification.
2636 *
2637 * @hide
2638 */
2639 public static final String EXTRA_VERIFICATION_PACKAGE_NAME
2640 = "android.content.pm.extra.VERIFICATION_PACKAGE_NAME";
2641 /**
rich canningsd1b5cfc2012-08-29 14:49:51 -07002642 * Extra field name for the result of a verification, either
2643 * {@link #VERIFICATION_ALLOW}, or {@link #VERIFICATION_REJECT}.
2644 * Passed to package verifiers after a package is verified.
2645 */
2646 public static final String EXTRA_VERIFICATION_RESULT
2647 = "android.content.pm.extra.VERIFICATION_RESULT";
2648
2649 /**
rich cannings13d428e2012-09-13 13:43:07 -07002650 * Extra field name for the version code of a package pending verification.
Dianne Hackborn3accca02013-09-20 09:32:11 -07002651 * @deprecated Use {@link #EXTRA_VERIFICATION_LONG_VERSION_CODE} instead.
2652 * @hide
2653 */
2654 @Deprecated
2655 public static final String EXTRA_VERIFICATION_VERSION_CODE
2656 = "android.content.pm.extra.VERIFICATION_VERSION_CODE";
2657
2658 /**
2659 * Extra field name for the long version code of a package pending verification.
rich cannings13d428e2012-09-13 13:43:07 -07002660 *
2661 * @hide
2662 */
Dianne Hackborn3accca02013-09-20 09:32:11 -07002663 public static final String EXTRA_VERIFICATION_LONG_VERSION_CODE =
2664 "android.content.pm.extra.VERIFICATION_LONG_VERSION_CODE";
rich cannings13d428e2012-09-13 13:43:07 -07002665
2666 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07002667 * Extra field name for the ID of a intent filter pending verification.
2668 * Passed to an intent filter verifier and is used to call back to
2669 * {@link #verifyIntentFilter}
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08002670 *
2671 * @hide
2672 */
2673 public static final String EXTRA_INTENT_FILTER_VERIFICATION_ID
2674 = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_ID";
2675
2676 /**
2677 * Extra field name for the scheme used for an intent filter pending verification. Passed to
2678 * an intent filter verifier and is used to construct the URI to verify against.
2679 *
2680 * Usually this is "https"
2681 *
2682 * @hide
2683 */
2684 public static final String EXTRA_INTENT_FILTER_VERIFICATION_URI_SCHEME
2685 = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_URI_SCHEME";
2686
2687 /**
2688 * Extra field name for the host names to be used for an intent filter pending verification.
2689 * Passed to an intent filter verifier and is used to construct the URI to verify the
2690 * intent filter.
2691 *
2692 * This is a space delimited list of hosts.
2693 *
2694 * @hide
2695 */
2696 public static final String EXTRA_INTENT_FILTER_VERIFICATION_HOSTS
2697 = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_HOSTS";
2698
2699 /**
2700 * Extra field name for the package name to be used for an intent filter pending verification.
2701 * Passed to an intent filter verifier and is used to check the verification responses coming
2702 * from the hosts. Each host response will need to include the package name of APK containing
2703 * the intent filter.
2704 *
2705 * @hide
2706 */
2707 public static final String EXTRA_INTENT_FILTER_VERIFICATION_PACKAGE_NAME
2708 = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_PACKAGE_NAME";
2709
2710 /**
2711 * The action used to request that the user approve a permission request
2712 * from the application.
Nick Kralevich035f80d2013-03-27 15:20:08 -07002713 *
2714 * @hide
2715 */
Svetoslavc6d1c342015-02-26 14:44:43 -08002716 @SystemApi
2717 public static final String ACTION_REQUEST_PERMISSIONS =
2718 "android.content.pm.action.REQUEST_PERMISSIONS";
Nick Kralevich035f80d2013-03-27 15:20:08 -07002719
2720 /**
Svetoslavc6d1c342015-02-26 14:44:43 -08002721 * The names of the requested permissions.
2722 * <p>
2723 * <strong>Type:</strong> String[]
2724 * </p>
2725 *
2726 * @hide
2727 */
2728 @SystemApi
2729 public static final String EXTRA_REQUEST_PERMISSIONS_NAMES =
2730 "android.content.pm.extra.REQUEST_PERMISSIONS_NAMES";
2731
2732 /**
2733 * The results from the permissions request.
2734 * <p>
2735 * <strong>Type:</strong> int[] of #PermissionResult
2736 * </p>
2737 *
2738 * @hide
2739 */
2740 @SystemApi
2741 public static final String EXTRA_REQUEST_PERMISSIONS_RESULTS
2742 = "android.content.pm.extra.REQUEST_PERMISSIONS_RESULTS";
Nick Kralevich035f80d2013-03-27 15:20:08 -07002743
2744 /**
Jeff Sharkeybb580672014-07-10 12:10:25 -07002745 * String extra for {@link PackageInstallObserver} in the 'extras' Bundle in case of
Christopher Tatef1977b42014-03-24 16:25:51 -07002746 * {@link #INSTALL_FAILED_DUPLICATE_PERMISSION}. This extra names the package which provides
2747 * the existing definition for the permission.
2748 * @hide
2749 */
2750 public static final String EXTRA_FAILURE_EXISTING_PACKAGE
2751 = "android.content.pm.extra.FAILURE_EXISTING_PACKAGE";
2752
2753 /**
Jeff Sharkeybb580672014-07-10 12:10:25 -07002754 * String extra for {@link PackageInstallObserver} in the 'extras' Bundle in case of
Christopher Tatef1977b42014-03-24 16:25:51 -07002755 * {@link #INSTALL_FAILED_DUPLICATE_PERMISSION}. This extra names the permission that is
2756 * being redundantly defined by the package being installed.
2757 * @hide
2758 */
2759 public static final String EXTRA_FAILURE_EXISTING_PERMISSION
2760 = "android.content.pm.extra.FAILURE_EXISTING_PERMISSION";
2761
Svet Ganov8c7f7002015-05-07 10:48:44 -07002762 /**
2763 * Permission flag: The permission is set in its current state
2764 * by the user and apps can still request it at runtime.
2765 *
2766 * @hide
2767 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08002768 @SystemApi
Svet Ganov8c7f7002015-05-07 10:48:44 -07002769 public static final int FLAG_PERMISSION_USER_SET = 1 << 0;
2770
2771 /**
2772 * Permission flag: The permission is set in its current state
2773 * by the user and it is fixed, i.e. apps can no longer request
2774 * this permission.
2775 *
2776 * @hide
2777 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08002778 @SystemApi
Svet Ganov8c7f7002015-05-07 10:48:44 -07002779 public static final int FLAG_PERMISSION_USER_FIXED = 1 << 1;
2780
2781 /**
2782 * Permission flag: The permission is set in its current state
2783 * by device policy and neither apps nor the user can change
2784 * its state.
2785 *
2786 * @hide
2787 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08002788 @SystemApi
Svet Ganov8c7f7002015-05-07 10:48:44 -07002789 public static final int FLAG_PERMISSION_POLICY_FIXED = 1 << 2;
2790
2791 /**
2792 * Permission flag: The permission is set in a granted state but
2793 * access to resources it guards is restricted by other means to
2794 * enable revoking a permission on legacy apps that do not support
2795 * runtime permissions. If this permission is upgraded to runtime
2796 * because the app was updated to support runtime permissions, the
2797 * the permission will be revoked in the upgrade process.
2798 *
2799 * @hide
2800 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08002801 @SystemApi
Svet Ganov8c7f7002015-05-07 10:48:44 -07002802 public static final int FLAG_PERMISSION_REVOKE_ON_UPGRADE = 1 << 3;
2803
Svet Ganovb3f22b42015-05-12 11:01:24 -07002804 /**
2805 * Permission flag: The permission is set in its current state
2806 * because the app is a component that is a part of the system.
2807 *
2808 * @hide
2809 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08002810 @SystemApi
Svet Ganovb3f22b42015-05-12 11:01:24 -07002811 public static final int FLAG_PERMISSION_SYSTEM_FIXED = 1 << 4;
Svet Ganov8c7f7002015-05-07 10:48:44 -07002812
Svet Ganov77ab6a82015-07-03 12:03:02 -07002813 /**
2814 * Permission flag: The permission is granted by default because it
2815 * enables app functionality that is expected to work out-of-the-box
2816 * for providing a smooth user experience. For example, the phone app
2817 * is expected to have the phone permission.
2818 *
2819 * @hide
2820 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08002821 @SystemApi
Svet Ganov77ab6a82015-07-03 12:03:02 -07002822 public static final int FLAG_PERMISSION_GRANTED_BY_DEFAULT = 1 << 5;
2823
Svet Ganov8c7f7002015-05-07 10:48:44 -07002824 /**
Svet Ganov9c165d72015-12-01 19:52:26 -08002825 * Permission flag: The permission has to be reviewed before any of
2826 * the app components can run.
2827 *
2828 * @hide
2829 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08002830 @SystemApi
Svet Ganov9c165d72015-12-01 19:52:26 -08002831 public static final int FLAG_PERMISSION_REVIEW_REQUIRED = 1 << 6;
2832
2833 /**
Svet Ganov8c7f7002015-05-07 10:48:44 -07002834 * Mask for all permission flags.
2835 *
2836 * @hide
2837 */
2838 @SystemApi
Svet Ganovb3f22b42015-05-12 11:01:24 -07002839 public static final int MASK_PERMISSION_FLAGS = 0xFF;
Svet Ganov8c7f7002015-05-07 10:48:44 -07002840
Christopher Tatef1977b42014-03-24 16:25:51 -07002841 /**
Svet Ganovd7b1f4112016-02-09 18:49:23 -08002842 * This is a library that contains components apps can invoke. For
2843 * example, a services for apps to bind to, or standard chooser UI,
2844 * etc. This library is versioned and backwards compatible. Clients
2845 * should check its version via {@link android.ext.services.Version
2846 * #getVersionCode()} and avoid calling APIs added in later versions.
2847 *
2848 * @hide
2849 */
2850 public static final String SYSTEM_SHARED_LIBRARY_SERVICES = "android.ext.services";
2851
2852 /**
2853 * This is a library that contains components apps can dynamically
2854 * load. For example, new widgets, helper classes, etc. This library
2855 * is versioned and backwards compatible. Clients should check its
2856 * version via {@link android.ext.shared.Version#getVersionCode()}
2857 * and avoid calling APIs added in later versions.
2858 *
2859 * @hide
2860 */
2861 public static final String SYSTEM_SHARED_LIBRARY_SHARED = "android.ext.shared";
2862
2863 /**
Brian Carlstromca82e612016-04-19 23:16:08 -07002864 * Used when starting a process for an Activity.
2865 *
2866 * @hide
2867 */
2868 public static final int NOTIFY_PACKAGE_USE_ACTIVITY = 0;
2869
2870 /**
2871 * Used when starting a process for a Service.
2872 *
2873 * @hide
2874 */
2875 public static final int NOTIFY_PACKAGE_USE_SERVICE = 1;
2876
2877 /**
2878 * Used when moving a Service to the foreground.
2879 *
2880 * @hide
2881 */
2882 public static final int NOTIFY_PACKAGE_USE_FOREGROUND_SERVICE = 2;
2883
2884 /**
2885 * Used when starting a process for a BroadcastReceiver.
2886 *
2887 * @hide
2888 */
2889 public static final int NOTIFY_PACKAGE_USE_BROADCAST_RECEIVER = 3;
2890
2891 /**
2892 * Used when starting a process for a ContentProvider.
2893 *
2894 * @hide
2895 */
2896 public static final int NOTIFY_PACKAGE_USE_CONTENT_PROVIDER = 4;
2897
2898 /**
2899 * Used when starting a process for a BroadcastReceiver.
2900 *
2901 * @hide
2902 */
2903 public static final int NOTIFY_PACKAGE_USE_BACKUP = 5;
2904
2905 /**
2906 * Used with Context.getClassLoader() across Android packages.
2907 *
2908 * @hide
2909 */
2910 public static final int NOTIFY_PACKAGE_USE_CROSS_PACKAGE = 6;
2911
2912 /**
2913 * Used when starting a package within a process for Instrumentation.
2914 *
2915 * @hide
2916 */
2917 public static final int NOTIFY_PACKAGE_USE_INSTRUMENTATION = 7;
2918
2919 /**
2920 * Total number of usage reasons.
2921 *
2922 * @hide
2923 */
2924 public static final int NOTIFY_PACKAGE_USE_REASONS_COUNT = 8;
2925
2926 /**
Svet Ganov67882122016-12-11 16:36:34 -08002927 * Constant for specifying the highest installed package version code.
2928 */
2929 public static final int VERSION_CODE_HIGHEST = -1;
2930
2931 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002932 * Retrieve overall information about an application package that is
2933 * installed on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002934 *
2935 * @param packageName The full name (i.e. com.google.apps.contacts) of the
Jeff Sharkey4347f812017-04-21 12:08:39 -06002936 * desired package.
2937 * @param flags Additional option flags to modify the data returned.
2938 * @return A PackageInfo object containing information about the package. If
2939 * flag {@code MATCH_UNINSTALLED_PACKAGES} is set and if the package
2940 * is not found in the list of installed applications, the package
2941 * information is retrieved from the list of uninstalled
kmccormick30498b42013-03-27 17:39:17 -07002942 * applications (which includes installed applications as well as
2943 * applications with data directory i.e. applications which had been
2944 * deleted with {@code DONT_DELETE_DATA} flag set).
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002945 * @throws NameNotFoundException if a package with the given name cannot be
2946 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002947 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07002948 public abstract PackageInfo getPackageInfo(String packageName, @PackageInfoFlags int flags)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002949 throws NameNotFoundException;
2950
2951 /**
Svet Ganov67882122016-12-11 16:36:34 -08002952 * Retrieve overall information about an application package that is
2953 * installed on the system. This method can be used for retrieving
Jeff Sharkey4347f812017-04-21 12:08:39 -06002954 * information about packages for which multiple versions can be installed
2955 * at the time. Currently only packages hosting static shared libraries can
2956 * have multiple installed versions. The method can also be used to get info
2957 * for a package that has a single version installed by passing
2958 * {@link #VERSION_CODE_HIGHEST} in the {@link VersionedPackage}
Svet Ganov67882122016-12-11 16:36:34 -08002959 * constructor.
2960 *
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07002961 * @param versionedPackage The versioned package for which to query.
Jeff Sharkey4347f812017-04-21 12:08:39 -06002962 * @param flags Additional option flags to modify the data returned.
2963 * @return A PackageInfo object containing information about the package. If
2964 * flag {@code MATCH_UNINSTALLED_PACKAGES} is set and if the package
2965 * is not found in the list of installed applications, the package
2966 * information is retrieved from the list of uninstalled
Svet Ganov67882122016-12-11 16:36:34 -08002967 * applications (which includes installed applications as well as
2968 * applications with data directory i.e. applications which had been
2969 * deleted with {@code DONT_DELETE_DATA} flag set).
2970 * @throws NameNotFoundException if a package with the given name cannot be
2971 * found on the system.
Svet Ganov67882122016-12-11 16:36:34 -08002972 */
2973 public abstract PackageInfo getPackageInfo(VersionedPackage versionedPackage,
2974 @PackageInfoFlags int flags) throws NameNotFoundException;
2975
2976 /**
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002977 * Retrieve overall information about an application package that is
2978 * installed on the system.
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002979 *
2980 * @param packageName The full name (i.e. com.google.apps.contacts) of the
Jeff Sharkey4347f812017-04-21 12:08:39 -06002981 * desired package.
2982 * @param flags Additional option flags to modify the data returned.
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002983 * @param userId The user id.
Jeff Sharkey4347f812017-04-21 12:08:39 -06002984 * @return A PackageInfo object containing information about the package. If
2985 * flag {@code MATCH_UNINSTALLED_PACKAGES} is set and if the package
2986 * is not found in the list of installed applications, the package
2987 * information is retrieved from the list of uninstalled
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002988 * applications (which includes installed applications as well as
2989 * applications with data directory i.e. applications which had been
2990 * deleted with {@code DONT_DELETE_DATA} flag set).
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002991 * @throws NameNotFoundException if a package with the given name cannot be
2992 * found on the system.
Svet Ganov67882122016-12-11 16:36:34 -08002993 * @hide
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002994 */
2995 @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS)
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07002996 public abstract PackageInfo getPackageInfoAsUser(String packageName,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002997 @PackageInfoFlags int flags, @UserIdInt int userId) throws NameNotFoundException;
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002998
2999 /**
Dianne Hackborn47096932010-02-11 15:57:09 -08003000 * Map from the current package names in use on the device to whatever
3001 * the current canonical name of that package is.
3002 * @param names Array of current names to be mapped.
3003 * @return Returns an array of the same size as the original, containing
3004 * the canonical name for each package.
3005 */
3006 public abstract String[] currentToCanonicalPackageNames(String[] names);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003007
Dianne Hackborn47096932010-02-11 15:57:09 -08003008 /**
3009 * Map from a packages canonical name to the current name in use on the device.
3010 * @param names Array of new names to be mapped.
3011 * @return Returns an array of the same size as the original, containing
3012 * the current name for each package.
3013 */
3014 public abstract String[] canonicalToCurrentPackageNames(String[] names);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003015
Dianne Hackborn47096932010-02-11 15:57:09 -08003016 /**
Andrew Solovay5ae13352014-06-06 12:23:09 -07003017 * Returns a "good" intent to launch a front-door activity in a package.
3018 * This is used, for example, to implement an "open" button when browsing
3019 * through packages. The current implementation looks first for a main
3020 * activity in the category {@link Intent#CATEGORY_INFO}, and next for a
3021 * main activity in the category {@link Intent#CATEGORY_LAUNCHER}. Returns
3022 * <code>null</code> if neither are found.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003023 *
3024 * @param packageName The name of the package to inspect.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003025 *
Andrew Solovay5ae13352014-06-06 12:23:09 -07003026 * @return A fully-qualified {@link Intent} that can be used to launch the
3027 * main activity in the package. Returns <code>null</code> if the package
3028 * does not contain such an activity, or if <em>packageName</em> is not
Ihab Awad1ec68882014-09-12 11:09:01 -07003029 * recognized.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003030 */
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06003031 public abstract @Nullable Intent getLaunchIntentForPackage(@NonNull String packageName);
Mihai Predaeae850c2009-05-13 10:13:48 +02003032
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003033 /**
Jose Lima970417c2014-04-10 10:42:19 -07003034 * Return a "good" intent to launch a front-door Leanback activity in a
3035 * package, for use for example to implement an "open" button when browsing
3036 * through packages. The current implementation will look for a main
3037 * activity in the category {@link Intent#CATEGORY_LEANBACK_LAUNCHER}, or
3038 * return null if no main leanback activities are found.
Adam Connors551c0782014-06-05 12:13:03 +01003039 *
Jose Lima970417c2014-04-10 10:42:19 -07003040 * @param packageName The name of the package to inspect.
3041 * @return Returns either a fully-qualified Intent that can be used to launch
3042 * the main Leanback activity in the package, or null if the package
3043 * does not contain such an activity.
3044 */
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06003045 public abstract @Nullable Intent getLeanbackLaunchIntentForPackage(@NonNull String packageName);
Jose Lima970417c2014-04-10 10:42:19 -07003046
3047 /**
Jeff Sharkeycf3f0a12016-03-17 19:57:58 -06003048 * Return an array of all of the POSIX secondary group IDs that have been
3049 * assigned to the given package.
3050 * <p>
3051 * Note that the same package may have different GIDs under different
3052 * {@link UserHandle} on the same device.
Adam Connors551c0782014-06-05 12:13:03 +01003053 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003054 * @param packageName The full name (i.e. com.google.apps.contacts) of the
Jeff Sharkeycf3f0a12016-03-17 19:57:58 -06003055 * desired package.
3056 * @return Returns an int array of the assigned GIDs, or null if there are
Jose Lima970417c2014-04-10 10:42:19 -07003057 * none.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003058 * @throws NameNotFoundException if a package with the given name cannot be
3059 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003060 */
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06003061 public abstract int[] getPackageGids(@NonNull String packageName)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003062 throws NameNotFoundException;
3063
3064 /**
Jeff Sharkeycf3f0a12016-03-17 19:57:58 -06003065 * Return an array of all of the POSIX secondary group IDs that have been
3066 * assigned to the given package.
3067 * <p>
3068 * Note that the same package may have different GIDs under different
3069 * {@link UserHandle} on the same device.
Dianne Hackborna06de0f2012-12-11 16:34:47 -08003070 *
3071 * @param packageName The full name (i.e. com.google.apps.contacts) of the
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003072 * desired package.
3073 * @return Returns an int array of the assigned gids, or null if there are
3074 * none.
3075 * @throws NameNotFoundException if a package with the given name cannot be
3076 * found on the system.
Dianne Hackborna06de0f2012-12-11 16:34:47 -08003077 */
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003078 public abstract int[] getPackageGids(String packageName, @PackageInfoFlags int flags)
Dianne Hackborna06de0f2012-12-11 16:34:47 -08003079 throws NameNotFoundException;
3080
3081 /**
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003082 * Return the UID associated with the given package name.
Jeff Sharkeycf3f0a12016-03-17 19:57:58 -06003083 * <p>
3084 * Note that the same package will have different UIDs under different
3085 * {@link UserHandle} on the same device.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003086 *
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003087 * @param packageName The full name (i.e. com.google.apps.contacts) of the
3088 * desired package.
3089 * @return Returns an integer UID who owns the given package name.
3090 * @throws NameNotFoundException if a package with the given name can not be
3091 * found on the system.
3092 */
3093 public abstract int getPackageUid(String packageName, @PackageInfoFlags int flags)
3094 throws NameNotFoundException;
3095
3096 /**
3097 * Return the UID associated with the given package name.
Jeff Sharkeycf3f0a12016-03-17 19:57:58 -06003098 * <p>
3099 * Note that the same package will have different UIDs under different
3100 * {@link UserHandle} on the same device.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003101 *
3102 * @param packageName The full name (i.e. com.google.apps.contacts) of the
3103 * desired package.
3104 * @param userId The user handle identifier to look up the package under.
3105 * @return Returns an integer UID who owns the given package name.
3106 * @throws NameNotFoundException if a package with the given name can not be
3107 * found on the system.
3108 * @hide
3109 */
3110 public abstract int getPackageUidAsUser(String packageName, @UserIdInt int userId)
3111 throws NameNotFoundException;
3112
3113 /**
3114 * Return the UID associated with the given package name.
Jeff Sharkeycf3f0a12016-03-17 19:57:58 -06003115 * <p>
3116 * Note that the same package will have different UIDs under different
3117 * {@link UserHandle} on the same device.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003118 *
3119 * @param packageName The full name (i.e. com.google.apps.contacts) of the
3120 * desired package.
3121 * @param userId The user handle identifier to look up the package under.
3122 * @return Returns an integer UID who owns the given package name.
3123 * @throws NameNotFoundException if a package with the given name can not be
3124 * found on the system.
3125 * @hide
3126 */
3127 public abstract int getPackageUidAsUser(String packageName, @PackageInfoFlags int flags,
3128 @UserIdInt int userId) throws NameNotFoundException;
3129
3130 /**
3131 * Retrieve all of the information we know about a particular permission.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003132 *
3133 * @param name The fully qualified name (i.e. com.google.permission.LOGIN)
Jeff Sharkey4347f812017-04-21 12:08:39 -06003134 * of the permission you are interested in.
3135 * @param flags Additional option flags to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003136 * @return Returns a {@link PermissionInfo} containing information about the
3137 * permission.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003138 * @throws NameNotFoundException if a package with the given name cannot be
3139 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003140 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003141 public abstract PermissionInfo getPermissionInfo(String name, @PermissionInfoFlags int flags)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003142 throws NameNotFoundException;
3143
3144 /**
3145 * Query for all of the permissions associated with a particular group.
3146 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003147 * @param group The fully qualified name (i.e. com.google.permission.LOGIN)
Jeff Sharkey4347f812017-04-21 12:08:39 -06003148 * of the permission group you are interested in. Use null to
3149 * find all of the permissions not associated with a group.
3150 * @param flags Additional option flags to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003151 * @return Returns a list of {@link PermissionInfo} containing information
Jeff Sharkey4347f812017-04-21 12:08:39 -06003152 * about all of the permissions in the given group.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003153 * @throws NameNotFoundException if a package with the given name cannot be
3154 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003155 */
3156 public abstract List<PermissionInfo> queryPermissionsByGroup(String group,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003157 @PermissionInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003158
3159 /**
Paul Navin7b89a7b2017-01-26 23:56:08 +00003160 * Returns true if Permission Review Mode is enabled, false otherwise.
3161 *
3162 * @hide
3163 */
3164 @TestApi
3165 public abstract boolean isPermissionReviewModeEnabled();
3166
3167 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003168 * Retrieve all of the information we know about a particular group of
3169 * permissions.
3170 *
Jeff Sharkey4347f812017-04-21 12:08:39 -06003171 * @param name The fully qualified name (i.e.
3172 * com.google.permission_group.APPS) of the permission you are
3173 * interested in.
3174 * @param flags Additional option flags to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003175 * @return Returns a {@link PermissionGroupInfo} containing information
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003176 * about the permission.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003177 * @throws NameNotFoundException if a package with the given name cannot be
3178 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003179 */
3180 public abstract PermissionGroupInfo getPermissionGroupInfo(String name,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003181 @PermissionGroupInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003182
3183 /**
3184 * Retrieve all of the known permission groups in the system.
3185 *
Jeff Sharkey4347f812017-04-21 12:08:39 -06003186 * @param flags Additional option flags to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003187 * @return Returns a list of {@link PermissionGroupInfo} containing
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003188 * information about all of the known permission groups.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003189 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003190 public abstract List<PermissionGroupInfo> getAllPermissionGroups(
3191 @PermissionGroupInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003192
3193 /**
3194 * Retrieve all of the information we know about a particular
3195 * package/application.
3196 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003197 * @param packageName The full name (i.e. com.google.apps.contacts) of an
Jeff Sharkey4347f812017-04-21 12:08:39 -06003198 * application.
3199 * @param flags Additional option flags to modify the data returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003200 * @return An {@link ApplicationInfo} containing information about the
Jeff Sharkey4347f812017-04-21 12:08:39 -06003201 * package. If flag {@code MATCH_UNINSTALLED_PACKAGES} is set and if
3202 * the package is not found in the list of installed applications,
3203 * the application information is retrieved from the list of
3204 * uninstalled applications (which includes installed applications
3205 * as well as applications with data directory i.e. applications
3206 * which had been deleted with {@code DONT_DELETE_DATA} flag set).
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003207 * @throws NameNotFoundException if a package with the given name cannot be
3208 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003209 */
3210 public abstract ApplicationInfo getApplicationInfo(String packageName,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003211 @ApplicationInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003212
Jeff Sharkeycd654482016-01-08 17:42:11 -07003213 /** {@hide} */
3214 public abstract ApplicationInfo getApplicationInfoAsUser(String packageName,
3215 @ApplicationInfoFlags int flags, @UserIdInt int userId) throws NameNotFoundException;
3216
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003217 /**
3218 * Retrieve all of the information we know about a particular activity
3219 * class.
3220 *
Dianne Hackborn361199b2010-08-30 17:42:07 -07003221 * @param component The full component name (i.e.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003222 * com.google.apps.contacts/com.google.apps.contacts.
3223 * ContactsList) of an Activity class.
Jeff Sharkey4347f812017-04-21 12:08:39 -06003224 * @param flags Additional option flags to modify the data returned.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003225 * @return An {@link ActivityInfo} containing information about the
3226 * activity.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003227 * @throws NameNotFoundException if a package with the given name cannot be
3228 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003229 */
Dianne Hackborn361199b2010-08-30 17:42:07 -07003230 public abstract ActivityInfo getActivityInfo(ComponentName component,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003231 @ComponentInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003232
3233 /**
3234 * Retrieve all of the information we know about a particular receiver
3235 * class.
3236 *
Dianne Hackborn361199b2010-08-30 17:42:07 -07003237 * @param component The full component name (i.e.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003238 * com.google.apps.calendar/com.google.apps.calendar.
3239 * CalendarAlarm) of a Receiver class.
Jeff Sharkey4347f812017-04-21 12:08:39 -06003240 * @param flags Additional option flags to modify the data returned.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003241 * @return An {@link ActivityInfo} containing information about the
3242 * receiver.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003243 * @throws NameNotFoundException if a package with the given name cannot be
3244 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003245 */
Dianne Hackborn361199b2010-08-30 17:42:07 -07003246 public abstract ActivityInfo getReceiverInfo(ComponentName component,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003247 @ComponentInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003248
3249 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003250 * Retrieve all of the information we know about a particular service class.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003251 *
Dianne Hackborn361199b2010-08-30 17:42:07 -07003252 * @param component The full component name (i.e.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003253 * com.google.apps.media/com.google.apps.media.
3254 * BackgroundPlayback) of a Service class.
Jeff Sharkey4347f812017-04-21 12:08:39 -06003255 * @param flags Additional option flags to modify the data returned.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003256 * @return A {@link ServiceInfo} object containing information about the
3257 * service.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003258 * @throws NameNotFoundException if a package with the given name cannot be
3259 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003260 */
Dianne Hackborn361199b2010-08-30 17:42:07 -07003261 public abstract ServiceInfo getServiceInfo(ComponentName component,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003262 @ComponentInfoFlags int flags) throws NameNotFoundException;
Dianne Hackborn361199b2010-08-30 17:42:07 -07003263
3264 /**
3265 * Retrieve all of the information we know about a particular content
3266 * provider class.
3267 *
Dianne Hackborn361199b2010-08-30 17:42:07 -07003268 * @param component The full component name (i.e.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003269 * com.google.providers.media/com.google.providers.media.
3270 * MediaProvider) of a ContentProvider class.
Jeff Sharkey4347f812017-04-21 12:08:39 -06003271 * @param flags Additional option flags to modify the data returned.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003272 * @return A {@link ProviderInfo} object containing information about the
3273 * provider.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003274 * @throws NameNotFoundException if a package with the given name cannot be
3275 * found on the system.
Dianne Hackborn361199b2010-08-30 17:42:07 -07003276 */
3277 public abstract ProviderInfo getProviderInfo(ComponentName component,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003278 @ComponentInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003279
3280 /**
Jeff Sharkey4347f812017-04-21 12:08:39 -06003281 * Return a List of all packages that are installed on the device.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003282 *
Jeff Sharkey4347f812017-04-21 12:08:39 -06003283 * @param flags Additional option flags to modify the data returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003284 * @return A List of PackageInfo objects, one for each installed package,
Jeff Sharkey4347f812017-04-21 12:08:39 -06003285 * containing information about the package. In the unlikely case
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003286 * there are no installed packages, an empty list is returned. If
3287 * flag {@code MATCH_UNINSTALLED_PACKAGES} is set, the package
3288 * information is retrieved from the list of uninstalled
3289 * applications (which includes installed applications as well as
3290 * applications with data directory i.e. applications which had been
3291 * deleted with {@code DONT_DELETE_DATA} flag set).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003292 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003293 public abstract List<PackageInfo> getInstalledPackages(@PackageInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003294
3295 /**
Jeff Sharkey4347f812017-04-21 12:08:39 -06003296 * Return a List of all installed packages that are currently holding any of
3297 * the given permissions.
Dianne Hackborne7991752013-01-16 17:56:46 -08003298 *
Jeff Sharkey4347f812017-04-21 12:08:39 -06003299 * @param flags Additional option flags to modify the data returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003300 * @return A List of PackageInfo objects, one for each installed package
3301 * that holds any of the permissions that were provided, containing
3302 * information about the package. If no installed packages hold any
3303 * of the permissions, an empty list is returned. If flag
Jeff Sharkey4347f812017-04-21 12:08:39 -06003304 * {@code MATCH_UNINSTALLED_PACKAGES} is set, the package
3305 * information is retrieved from the list of uninstalled
3306 * applications (which includes installed applications as well as
3307 * applications with data directory i.e. applications which had been
3308 * deleted with {@code DONT_DELETE_DATA} flag set).
Dianne Hackborne7991752013-01-16 17:56:46 -08003309 */
3310 public abstract List<PackageInfo> getPackagesHoldingPermissions(
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003311 String[] permissions, @PackageInfoFlags int flags);
Dianne Hackborne7991752013-01-16 17:56:46 -08003312
3313 /**
Jeff Sharkey4347f812017-04-21 12:08:39 -06003314 * Return a List of all packages that are installed on the device, for a
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06003315 * specific user.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003316 *
Jeff Sharkey4347f812017-04-21 12:08:39 -06003317 * @param flags Additional option flags to modify the data returned.
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003318 * @param userId The user for whom the installed packages are to be listed
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003319 * @return A List of PackageInfo objects, one for each installed package,
Jeff Sharkey4347f812017-04-21 12:08:39 -06003320 * containing information about the package. In the unlikely case
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003321 * there are no installed packages, an empty list is returned. If
3322 * flag {@code MATCH_UNINSTALLED_PACKAGES} is set, the package
3323 * information is retrieved from the list of uninstalled
3324 * applications (which includes installed applications as well as
3325 * applications with data directory i.e. applications which had been
3326 * deleted with {@code DONT_DELETE_DATA} flag set).
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003327 * @hide
3328 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08003329 @SystemApi
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06003330 @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS_FULL)
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07003331 public abstract List<PackageInfo> getInstalledPackagesAsUser(@PackageInfoFlags int flags,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003332 @UserIdInt int userId);
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003333
3334 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003335 * Check whether a particular package has been granted a particular
3336 * permission.
3337 *
Svet Ganovad3b2972015-07-07 22:49:17 -07003338 * @param permName The name of the permission you are checking for.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003339 * @param pkgName The name of the package you are checking against.
3340 *
3341 * @return If the package has the permission, PERMISSION_GRANTED is
3342 * returned. If it does not have the permission, PERMISSION_DENIED
3343 * is returned.
3344 *
3345 * @see #PERMISSION_GRANTED
3346 * @see #PERMISSION_DENIED
3347 */
Tor Norbye1c2bf032015-03-02 10:57:08 -08003348 @CheckResult
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06003349 public abstract @PermissionResult int checkPermission(String permName, String pkgName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003350
3351 /**
Svet Ganovad3b2972015-07-07 22:49:17 -07003352 * Checks whether a particular permissions has been revoked for a
3353 * package by policy. Typically the device owner or the profile owner
3354 * may apply such a policy. The user cannot grant policy revoked
3355 * permissions, hence the only way for an app to get such a permission
3356 * is by a policy change.
3357 *
3358 * @param permName The name of the permission you are checking for.
3359 * @param pkgName The name of the package you are checking against.
3360 *
3361 * @return Whether the permission is restricted by policy.
3362 */
3363 @CheckResult
Svet Ganovf1b7f202015-07-29 08:33:42 -07003364 public abstract boolean isPermissionRevokedByPolicy(@NonNull String permName,
3365 @NonNull String pkgName);
3366
3367 /**
3368 * Gets the package name of the component controlling runtime permissions.
3369 *
3370 * @return The package name.
3371 *
3372 * @hide
3373 */
Philip P. Moltmanneb0a0ae2017-06-30 10:55:51 -07003374 @TestApi
Svet Ganovf1b7f202015-07-29 08:33:42 -07003375 public abstract String getPermissionControllerPackageName();
Svet Ganovad3b2972015-07-07 22:49:17 -07003376
3377 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003378 * Add a new dynamic permission to the system. For this to work, your
3379 * package must have defined a permission tree through the
3380 * {@link android.R.styleable#AndroidManifestPermissionTree
3381 * &lt;permission-tree&gt;} tag in its manifest. A package can only add
3382 * permissions to trees that were defined by either its own package or
3383 * another with the same user id; a permission is in a tree if it
3384 * matches the name of the permission tree + ".": for example,
3385 * "com.foo.bar" is a member of the permission tree "com.foo".
3386 *
3387 * <p>It is good to make your permission tree name descriptive, because you
3388 * are taking possession of that entire set of permission names. Thus, it
3389 * must be under a domain you control, with a suffix that will not match
3390 * any normal permissions that may be declared in any applications that
3391 * are part of that domain.
3392 *
3393 * <p>New permissions must be added before
3394 * any .apks are installed that use those permissions. Permissions you
3395 * add through this method are remembered across reboots of the device.
3396 * If the given permission already exists, the info you supply here
3397 * will be used to update it.
3398 *
3399 * @param info Description of the permission to be added.
3400 *
3401 * @return Returns true if a new permission was created, false if an
3402 * existing one was updated.
3403 *
3404 * @throws SecurityException if you are not allowed to add the
3405 * given permission name.
3406 *
3407 * @see #removePermission(String)
3408 */
3409 public abstract boolean addPermission(PermissionInfo info);
3410
3411 /**
Dianne Hackbornd7c09682010-03-30 10:42:20 -07003412 * Like {@link #addPermission(PermissionInfo)} but asynchronously
3413 * persists the package manager state after returning from the call,
3414 * allowing it to return quicker and batch a series of adds at the
3415 * expense of no guarantee the added permission will be retained if
3416 * the device is rebooted before it is written.
3417 */
3418 public abstract boolean addPermissionAsync(PermissionInfo info);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003419
Dianne Hackbornd7c09682010-03-30 10:42:20 -07003420 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003421 * Removes a permission that was previously added with
3422 * {@link #addPermission(PermissionInfo)}. The same ownership rules apply
3423 * -- you are only allowed to remove permissions that you are allowed
3424 * to add.
3425 *
3426 * @param name The name of the permission to remove.
3427 *
3428 * @throws SecurityException if you are not allowed to remove the
3429 * given permission name.
3430 *
3431 * @see #addPermission(PermissionInfo)
3432 */
3433 public abstract void removePermission(String name);
3434
Svet Ganov8c7f7002015-05-07 10:48:44 -07003435 /**
3436 * Permission flags set when granting or revoking a permission.
3437 *
3438 * @hide
3439 */
3440 @SystemApi
Jeff Sharkey4347f812017-04-21 12:08:39 -06003441 @IntDef(prefix = { "FLAG_PERMISSION_" }, value = {
3442 FLAG_PERMISSION_USER_SET,
Svet Ganov8c7f7002015-05-07 10:48:44 -07003443 FLAG_PERMISSION_USER_FIXED,
3444 FLAG_PERMISSION_POLICY_FIXED,
Svet Ganovb3f22b42015-05-12 11:01:24 -07003445 FLAG_PERMISSION_REVOKE_ON_UPGRADE,
Svet Ganov77ab6a82015-07-03 12:03:02 -07003446 FLAG_PERMISSION_SYSTEM_FIXED,
Jeff Sharkey4347f812017-04-21 12:08:39 -06003447 FLAG_PERMISSION_GRANTED_BY_DEFAULT
3448 })
Svet Ganov8c7f7002015-05-07 10:48:44 -07003449 @Retention(RetentionPolicy.SOURCE)
3450 public @interface PermissionFlags {}
3451
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003452 /**
Svetoslavc6d1c342015-02-26 14:44:43 -08003453 * Grant a runtime permission to an application which the application does not
3454 * already have. The permission must have been requested by the application.
3455 * If the application is not allowed to hold the permission, a {@link
Ruben Brunk12ab5e12016-11-10 15:27:30 -08003456 * java.lang.SecurityException} is thrown. If the package or permission is
3457 * invalid, a {@link java.lang.IllegalArgumentException} is thrown.
Svetoslavc6d1c342015-02-26 14:44:43 -08003458 * <p>
3459 * <strong>Note: </strong>Using this API requires holding
Todd Kennedya8eb6a82016-07-28 16:35:42 -07003460 * android.permission.GRANT_RUNTIME_PERMISSIONS and if the user id is
Svetoslavc6d1c342015-02-26 14:44:43 -08003461 * not the current user android.permission.INTERACT_ACROSS_USERS_FULL.
3462 * </p>
Nick Kralevich035f80d2013-03-27 15:20:08 -07003463 *
Svetoslavc6d1c342015-02-26 14:44:43 -08003464 * @param packageName The package to which to grant the permission.
3465 * @param permissionName The permission name to grant.
3466 * @param user The user for which to grant the permission.
3467 *
Svet Ganov8c7f7002015-05-07 10:48:44 -07003468 * @see #revokeRuntimePermission(String, String, android.os.UserHandle)
Svetoslavc6d1c342015-02-26 14:44:43 -08003469 *
3470 * @hide
Nick Kralevich035f80d2013-03-27 15:20:08 -07003471 */
Svetoslavc6d1c342015-02-26 14:44:43 -08003472 @SystemApi
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06003473 @RequiresPermission(android.Manifest.permission.GRANT_RUNTIME_PERMISSIONS)
Svet Ganov8c7f7002015-05-07 10:48:44 -07003474 public abstract void grantRuntimePermission(@NonNull String packageName,
Svetoslavc6d1c342015-02-26 14:44:43 -08003475 @NonNull String permissionName, @NonNull UserHandle user);
Nick Kralevich035f80d2013-03-27 15:20:08 -07003476
Svetoslavc6d1c342015-02-26 14:44:43 -08003477 /**
3478 * Revoke a runtime permission that was previously granted by {@link
Svet Ganov8c7f7002015-05-07 10:48:44 -07003479 * #grantRuntimePermission(String, String, android.os.UserHandle)}. The
3480 * permission must have been requested by and granted to the application.
3481 * If the application is not allowed to hold the permission, a {@link
Ruben Brunk12ab5e12016-11-10 15:27:30 -08003482 * java.lang.SecurityException} is thrown. If the package or permission is
3483 * invalid, a {@link java.lang.IllegalArgumentException} is thrown.
Svetoslavc6d1c342015-02-26 14:44:43 -08003484 * <p>
3485 * <strong>Note: </strong>Using this API requires holding
Todd Kennedya8eb6a82016-07-28 16:35:42 -07003486 * android.permission.REVOKE_RUNTIME_PERMISSIONS and if the user id is
Svetoslavc6d1c342015-02-26 14:44:43 -08003487 * not the current user android.permission.INTERACT_ACROSS_USERS_FULL.
3488 * </p>
3489 *
3490 * @param packageName The package from which to revoke the permission.
3491 * @param permissionName The permission name to revoke.
3492 * @param user The user for which to revoke the permission.
3493 *
Svet Ganov8c7f7002015-05-07 10:48:44 -07003494 * @see #grantRuntimePermission(String, String, android.os.UserHandle)
Svetoslavc6d1c342015-02-26 14:44:43 -08003495 *
3496 * @hide
3497 */
3498 @SystemApi
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06003499 @RequiresPermission(android.Manifest.permission.REVOKE_RUNTIME_PERMISSIONS)
Svet Ganov8c7f7002015-05-07 10:48:44 -07003500 public abstract void revokeRuntimePermission(@NonNull String packageName,
Svetoslavc6d1c342015-02-26 14:44:43 -08003501 @NonNull String permissionName, @NonNull UserHandle user);
3502
3503 /**
Svet Ganov8c7f7002015-05-07 10:48:44 -07003504 * Gets the state flags associated with a permission.
3505 *
3506 * @param permissionName The permission for which to get the flags.
3507 * @param packageName The package name for which to get the flags.
3508 * @param user The user for which to get permission flags.
3509 * @return The permission flags.
3510 *
3511 * @hide
3512 */
3513 @SystemApi
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06003514 @RequiresPermission(anyOf = {
3515 android.Manifest.permission.GRANT_RUNTIME_PERMISSIONS,
3516 android.Manifest.permission.REVOKE_RUNTIME_PERMISSIONS
3517 })
Svet Ganov8c7f7002015-05-07 10:48:44 -07003518 public abstract @PermissionFlags int getPermissionFlags(String permissionName,
3519 String packageName, @NonNull UserHandle user);
3520
3521 /**
3522 * Updates the flags associated with a permission by replacing the flags in
3523 * the specified mask with the provided flag values.
3524 *
3525 * @param permissionName The permission for which to update the flags.
3526 * @param packageName The package name for which to update the flags.
3527 * @param flagMask The flags which to replace.
3528 * @param flagValues The flags with which to replace.
3529 * @param user The user for which to update the permission flags.
3530 *
3531 * @hide
3532 */
3533 @SystemApi
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06003534 @RequiresPermission(anyOf = {
3535 android.Manifest.permission.GRANT_RUNTIME_PERMISSIONS,
3536 android.Manifest.permission.REVOKE_RUNTIME_PERMISSIONS
3537 })
Svet Ganov8c7f7002015-05-07 10:48:44 -07003538 public abstract void updatePermissionFlags(String permissionName,
Jeff Sharkey4347f812017-04-21 12:08:39 -06003539 String packageName, @PermissionFlags int flagMask, @PermissionFlags int flagValues,
Svet Ganov8c7f7002015-05-07 10:48:44 -07003540 @NonNull UserHandle user);
3541
3542 /**
Svetoslav20770dd2015-05-29 15:43:04 -07003543 * Gets whether you should show UI with rationale for requesting a permission.
3544 * You should do this only if you do not have the permission and the context in
3545 * which the permission is requested does not clearly communicate to the user
3546 * what would be the benefit from grating this permission.
3547 *
3548 * @param permission A permission your app wants to request.
3549 * @return Whether you can show permission rationale UI.
3550 *
3551 * @hide
3552 */
3553 public abstract boolean shouldShowRequestPermissionRationale(String permission);
3554
3555 /**
Svetoslavc6d1c342015-02-26 14:44:43 -08003556 * Returns an {@link android.content.Intent} suitable for passing to
3557 * {@link android.app.Activity#startActivityForResult(android.content.Intent, int)}
3558 * which prompts the user to grant permissions to this application.
3559 *
3560 * @throws NullPointerException if {@code permissions} is {@code null} or empty.
3561 *
3562 * @hide
3563 */
3564 public Intent buildRequestPermissionsIntent(@NonNull String[] permissions) {
3565 if (ArrayUtils.isEmpty(permissions)) {
Svet Ganovf66381c2016-02-18 20:02:36 -08003566 throw new IllegalArgumentException("permission cannot be null or empty");
Svetoslavc6d1c342015-02-26 14:44:43 -08003567 }
3568 Intent intent = new Intent(ACTION_REQUEST_PERMISSIONS);
3569 intent.putExtra(EXTRA_REQUEST_PERMISSIONS_NAMES, permissions);
Svet Ganovf1b7f202015-07-29 08:33:42 -07003570 intent.setPackage(getPermissionControllerPackageName());
Svetoslavc6d1c342015-02-26 14:44:43 -08003571 return intent;
Nick Kralevich035f80d2013-03-27 15:20:08 -07003572 }
3573
3574 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003575 * Compare the signatures of two packages to determine if the same
3576 * signature appears in both of them. If they do contain the same
3577 * signature, then they are allowed special privileges when working
3578 * with each other: they can share the same user-id, run instrumentation
3579 * against each other, etc.
3580 *
3581 * @param pkg1 First package name whose signature will be compared.
3582 * @param pkg2 Second package name whose signature will be compared.
Chris Palmer09f33602010-09-13 14:27:18 -07003583 *
3584 * @return Returns an integer indicating whether all signatures on the
3585 * two packages match. The value is >= 0 ({@link #SIGNATURE_MATCH}) if
3586 * all signatures match or < 0 if there is not a match ({@link
3587 * #SIGNATURE_NO_MATCH} or {@link #SIGNATURE_UNKNOWN_PACKAGE}).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003588 *
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07003589 * @see #checkSignatures(int, int)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003590 */
Tor Norbye1c2bf032015-03-02 10:57:08 -08003591 @CheckResult
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06003592 public abstract @SignatureResult int checkSignatures(String pkg1, String pkg2);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003593
3594 /**
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07003595 * Like {@link #checkSignatures(String, String)}, but takes UIDs of
3596 * the two packages to be checked. This can be useful, for example,
3597 * when doing the check in an IPC, where the UID is the only identity
3598 * available. It is functionally identical to determining the package
3599 * associated with the UIDs and checking their signatures.
3600 *
Joe Onorato25660ec2009-08-12 22:40:37 -07003601 * @param uid1 First UID whose signature will be compared.
3602 * @param uid2 Second UID whose signature will be compared.
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07003603 *
Chris Palmer09f33602010-09-13 14:27:18 -07003604 * @return Returns an integer indicating whether all signatures on the
3605 * two packages match. The value is >= 0 ({@link #SIGNATURE_MATCH}) if
3606 * all signatures match or < 0 if there is not a match ({@link
3607 * #SIGNATURE_NO_MATCH} or {@link #SIGNATURE_UNKNOWN_PACKAGE}).
3608 *
3609 * @see #checkSignatures(String, String)
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07003610 */
Tor Norbye1c2bf032015-03-02 10:57:08 -08003611 @CheckResult
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06003612 public abstract @SignatureResult int checkSignatures(int uid1, int uid2);
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07003613
3614 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003615 * Retrieve the names of all packages that are associated with a particular
3616 * user id. In most cases, this will be a single package name, the package
3617 * that has been assigned that user id. Where there are multiple packages
3618 * sharing the same user id through the "sharedUserId" mechanism, all
3619 * packages with that id will be returned.
3620 *
3621 * @param uid The user id for which you would like to retrieve the
3622 * associated packages.
3623 *
3624 * @return Returns an array of one or more packages assigned to the user
3625 * id, or null if there are no known packages with the given id.
3626 */
Jeff Sharkey377ded0f2016-01-10 13:15:41 -07003627 public abstract @Nullable String[] getPackagesForUid(int uid);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003628
3629 /**
Michal Karpinskicb67dc92016-12-13 18:20:23 +00003630 * Retrieve the official name associated with a uid. This name is
Jonathan Basseri7ea3a332015-05-12 19:39:22 -07003631 * guaranteed to never change, though it is possible for the underlying
Michal Karpinskicb67dc92016-12-13 18:20:23 +00003632 * uid to be changed. That is, if you are storing information about
3633 * uids in persistent storage, you should use the string returned
3634 * by this function instead of the raw uid.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003635 *
Michal Karpinskicb67dc92016-12-13 18:20:23 +00003636 * @param uid The uid for which you would like to retrieve a name.
3637 * @return Returns a unique name for the given uid, or null if the
3638 * uid is not currently assigned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003639 */
Jeff Sharkey377ded0f2016-01-10 13:15:41 -07003640 public abstract @Nullable String getNameForUid(int uid);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003641
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003642 /**
Todd Kennedy9da8b8a72017-07-25 15:38:39 -07003643 * Retrieves the official names associated with each given uid.
3644 * @see #getNameForUid(int)
3645 *
3646 * @hide
3647 */
3648 public abstract @Nullable String[] getNamesForUids(int[] uids);
3649
3650 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003651 * Return the user id associated with a shared user name. Multiple
3652 * applications can specify a shared user name in their manifest and thus
3653 * end up using a common uid. This might be used for new applications
3654 * that use an existing shared user name and need to know the uid of the
3655 * shared user.
3656 *
3657 * @param sharedUserName The shared user name whose uid is to be retrieved.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003658 * @return Returns the UID associated with the shared user.
3659 * @throws NameNotFoundException if a package with the given name cannot be
3660 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003661 * @hide
3662 */
3663 public abstract int getUidForSharedUser(String sharedUserName)
3664 throws NameNotFoundException;
3665
3666 /**
3667 * Return a List of all application packages that are installed on the
3668 * device. If flag GET_UNINSTALLED_PACKAGES has been set, a list of all
Jeff Sharkey4347f812017-04-21 12:08:39 -06003669 * applications including those deleted with {@code DONT_DELETE_DATA}
3670 * (partially installed apps with data directory) will be returned.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003671 *
Jeff Sharkey4347f812017-04-21 12:08:39 -06003672 * @param flags Additional option flags to modify the data returned.
3673 * @return A List of ApplicationInfo objects, one for each installed
3674 * application. In the unlikely case there are no installed
3675 * packages, an empty list is returned. If flag
3676 * {@code MATCH_UNINSTALLED_PACKAGES} is set, the application
3677 * information is retrieved from the list of uninstalled
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003678 * applications (which includes installed applications as well as
3679 * applications with data directory i.e. applications which had been
3680 * deleted with {@code DONT_DELETE_DATA} flag set).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003681 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003682 public abstract List<ApplicationInfo> getInstalledApplications(@ApplicationInfoFlags int flags);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003683
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003684 /**
Jeff Sharkey4347f812017-04-21 12:08:39 -06003685 * Return a List of all application packages that are installed on the
3686 * device, for a specific user. If flag GET_UNINSTALLED_PACKAGES has been
3687 * set, a list of all applications including those deleted with
3688 * {@code DONT_DELETE_DATA} (partially installed apps with data directory)
Bartosz Fabianowski11334242016-11-17 20:49:16 +01003689 * will be returned.
3690 *
Jeff Sharkey4347f812017-04-21 12:08:39 -06003691 * @param flags Additional option flags to modify the data returned.
3692 * @param userId The user for whom the installed applications are to be
3693 * listed
3694 * @return A List of ApplicationInfo objects, one for each installed
3695 * application. In the unlikely case there are no installed
3696 * packages, an empty list is returned. If flag
3697 * {@code MATCH_UNINSTALLED_PACKAGES} is set, the application
3698 * information is retrieved from the list of uninstalled
Bartosz Fabianowski11334242016-11-17 20:49:16 +01003699 * applications (which includes installed applications as well as
3700 * applications with data directory i.e. applications which had been
3701 * deleted with {@code DONT_DELETE_DATA} flag set).
3702 * @hide
Bartosz Fabianowski11334242016-11-17 20:49:16 +01003703 */
3704 public abstract List<ApplicationInfo> getInstalledApplicationsAsUser(
3705 @ApplicationInfoFlags int flags, @UserIdInt int userId);
3706
3707 /**
Jeff Sharkey910e0812017-04-21 16:29:27 -06003708 * Gets the instant applications the user recently used.
Svet Ganov2acf0632015-11-24 19:10:59 -08003709 *
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003710 * @return The instant app list.
Svet Ganov2acf0632015-11-24 19:10:59 -08003711 *
3712 * @hide
3713 */
Todd Kennedy9c9fdf22017-03-06 10:58:27 -08003714 @SystemApi
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003715 @RequiresPermission(Manifest.permission.ACCESS_INSTANT_APPS)
3716 public abstract @NonNull List<InstantAppInfo> getInstantApps();
Svet Ganov2acf0632015-11-24 19:10:59 -08003717
3718 /**
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003719 * Gets the icon for an instant application.
Svet Ganov2acf0632015-11-24 19:10:59 -08003720 *
3721 * @param packageName The app package name.
3722 *
3723 * @hide
3724 */
Todd Kennedy9c9fdf22017-03-06 10:58:27 -08003725 @SystemApi
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003726 @RequiresPermission(Manifest.permission.ACCESS_INSTANT_APPS)
3727 public abstract @Nullable Drawable getInstantAppIcon(String packageName);
Svet Ganov2acf0632015-11-24 19:10:59 -08003728
3729 /**
David Christie31a16552017-03-01 15:08:45 -08003730 * Gets whether this application is an instant app.
Svet Ganov2acf0632015-11-24 19:10:59 -08003731 *
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003732 * @return Whether caller is an instant app.
Svet Ganov2acf0632015-11-24 19:10:59 -08003733 *
David Christie31a16552017-03-01 15:08:45 -08003734 * @see #isInstantApp(String)
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003735 * @see #updateInstantAppCookie(byte[])
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003736 * @see #getInstantAppCookie()
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003737 * @see #getInstantAppCookieMaxBytes()
Svet Ganov2acf0632015-11-24 19:10:59 -08003738 */
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003739 public abstract boolean isInstantApp();
Svet Ganov2acf0632015-11-24 19:10:59 -08003740
3741 /**
David Christie31a16552017-03-01 15:08:45 -08003742 * Gets whether the given package is an instant app.
3743 *
3744 * @param packageName The package to check
3745 * @return Whether the given package is an instant app.
3746 *
3747 * @see #isInstantApp()
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003748 * @see #updateInstantAppCookie(byte[])
David Christie31a16552017-03-01 15:08:45 -08003749 * @see #getInstantAppCookie()
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003750 * @see #getInstantAppCookieMaxBytes()
3751 * @see #clearInstantAppCookie()
David Christie31a16552017-03-01 15:08:45 -08003752 */
3753 public abstract boolean isInstantApp(String packageName);
3754
3755 /**
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003756 * Gets the maximum size in bytes of the cookie data an instant app
Svet Ganov2acf0632015-11-24 19:10:59 -08003757 * can store on the device.
3758 *
3759 * @return The max cookie size in bytes.
3760 *
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003761 * @see #isInstantApp()
David Christie31a16552017-03-01 15:08:45 -08003762 * @see #isInstantApp(String)
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003763 * @see #updateInstantAppCookie(byte[])
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003764 * @see #getInstantAppCookie()
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003765 * @see #clearInstantAppCookie()
3766 */
3767 public abstract int getInstantAppCookieMaxBytes();
3768
3769 /**
3770 * @deprecated
3771 * @hide
Svet Ganov2acf0632015-11-24 19:10:59 -08003772 */
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003773 public abstract int getInstantAppCookieMaxSize();
Svet Ganov2acf0632015-11-24 19:10:59 -08003774
3775 /**
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003776 * Gets the instant application cookie for this app. Non
3777 * instant apps and apps that were instant but were upgraded
3778 * to normal apps can still access this API. For instant apps
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003779 * this cookie is cached for some time after uninstall while for
Svet Ganov2acf0632015-11-24 19:10:59 -08003780 * normal apps the cookie is deleted after the app is uninstalled.
3781 * The cookie is always present while the app is installed.
3782 *
3783 * @return The cookie.
3784 *
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003785 * @see #isInstantApp()
David Christie31a16552017-03-01 15:08:45 -08003786 * @see #isInstantApp(String)
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003787 * @see #updateInstantAppCookie(byte[])
3788 * @see #getInstantAppCookieMaxBytes()
3789 * @see #clearInstantAppCookie()
Svet Ganov2acf0632015-11-24 19:10:59 -08003790 */
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003791 public abstract @NonNull byte[] getInstantAppCookie();
Svet Ganov2acf0632015-11-24 19:10:59 -08003792
3793 /**
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003794 * Clears the instant application cookie for the calling app.
Svet Ganov2acf0632015-11-24 19:10:59 -08003795 *
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003796 * @see #isInstantApp()
David Christie31a16552017-03-01 15:08:45 -08003797 * @see #isInstantApp(String)
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003798 * @see #getInstantAppCookieMaxBytes()
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003799 * @see #getInstantAppCookie()
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003800 * @see #clearInstantAppCookie()
3801 */
3802 public abstract void clearInstantAppCookie();
3803
3804 /**
3805 * Updates the instant application cookie for the calling app. Non
3806 * instant apps and apps that were instant but were upgraded
3807 * to normal apps can still access this API. For instant apps
3808 * this cookie is cached for some time after uninstall while for
3809 * normal apps the cookie is deleted after the app is uninstalled.
3810 * The cookie is always present while the app is installed. The
3811 * cookie size is limited by {@link #getInstantAppCookieMaxBytes()}.
3812 * Passing <code>null</code> or an empty array clears the cookie.
3813 * </p>
3814 *
3815 * @param cookie The cookie data.
3816 *
3817 * @see #isInstantApp()
3818 * @see #isInstantApp(String)
3819 * @see #getInstantAppCookieMaxBytes()
3820 * @see #getInstantAppCookie()
3821 * @see #clearInstantAppCookie()
3822 *
3823 * @throws IllegalArgumentException if the array exceeds max cookie size.
3824 */
3825 public abstract void updateInstantAppCookie(@Nullable byte[] cookie);
3826
3827 /**
3828 * @removed
Svet Ganov2acf0632015-11-24 19:10:59 -08003829 */
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003830 public abstract boolean setInstantAppCookie(@Nullable byte[] cookie);
Svet Ganov2acf0632015-11-24 19:10:59 -08003831
3832 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003833 * Get a list of shared libraries that are available on the
3834 * system.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003835 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003836 * @return An array of shared library names that are
3837 * available on the system, or null if none are installed.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003838 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003839 */
3840 public abstract String[] getSystemSharedLibraryNames();
3841
3842 /**
Svet Ganov67882122016-12-11 16:36:34 -08003843 * Get a list of shared libraries on the device.
3844 *
3845 * @param flags To filter the libraries to return.
3846 * @return The shared library list.
3847 *
Svet Ganov67882122016-12-11 16:36:34 -08003848 * @see #MATCH_UNINSTALLED_PACKAGES
3849 */
3850 public abstract @NonNull List<SharedLibraryInfo> getSharedLibraries(
3851 @InstallFlags int flags);
3852
3853 /**
3854 * Get a list of shared libraries on the device.
3855 *
3856 * @param flags To filter the libraries to return.
3857 * @param userId The user to query for.
3858 * @return The shared library list.
3859 *
3860 * @see #MATCH_FACTORY_ONLY
3861 * @see #MATCH_KNOWN_PACKAGES
3862 * @see #MATCH_ANY_USER
3863 * @see #MATCH_UNINSTALLED_PACKAGES
3864 *
3865 * @hide
3866 */
3867 public abstract @NonNull List<SharedLibraryInfo> getSharedLibrariesAsUser(
3868 @InstallFlags int flags, @UserIdInt int userId);
3869
3870 /**
Svet Ganovd7b1f4112016-02-09 18:49:23 -08003871 * Get the name of the package hosting the services shared library.
3872 *
3873 * @return The library host package.
3874 *
3875 * @hide
3876 */
Svetoslav Ganova9c25002016-04-13 19:25:56 -07003877 public abstract @NonNull String getServicesSystemSharedLibraryPackageName();
3878
3879 /**
3880 * Get the name of the package hosting the shared components shared library.
3881 *
3882 * @return The library host package.
3883 *
3884 * @hide
3885 */
3886 public abstract @NonNull String getSharedSystemSharedLibraryPackageName();
Svet Ganovd7b1f4112016-02-09 18:49:23 -08003887
3888 /**
Todd Kennedy9106c642017-02-08 14:16:53 -08003889 * Returns the names of the packages that have been changed
3890 * [eg. added, removed or updated] since the given sequence
3891 * number.
3892 * <p>If no packages have been changed, returns <code>null</code>.
3893 * <p>The sequence number starts at <code>0</code> and is
3894 * reset every boot.
Todd Kennedy8fddf9d2017-04-17 15:16:12 -07003895 * @param sequenceNumber The first sequence number for which to retrieve package changes.
3896 * @see Settings.Global#BOOT_COUNT
Todd Kennedy9106c642017-02-08 14:16:53 -08003897 */
3898 public abstract @Nullable ChangedPackages getChangedPackages(
3899 @IntRange(from=0) int sequenceNumber);
3900
3901 /**
Dianne Hackborn49237342009-08-27 20:08:01 -07003902 * Get a list of features that are available on the
3903 * system.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003904 *
Dianne Hackborn49237342009-08-27 20:08:01 -07003905 * @return An array of FeatureInfo classes describing the features
3906 * that are available on the system, or null if there are none(!!).
Dianne Hackborn49237342009-08-27 20:08:01 -07003907 */
3908 public abstract FeatureInfo[] getSystemAvailableFeatures();
3909
3910 /**
Jeff Sharkey115d2c12016-02-15 17:25:57 -07003911 * Check whether the given feature name is one of the available features as
3912 * returned by {@link #getSystemAvailableFeatures()}. This tests for the
3913 * presence of <em>any</em> version of the given feature name; use
3914 * {@link #hasSystemFeature(String, int)} to check for a minimum version.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003915 *
Jeff Sharkey115d2c12016-02-15 17:25:57 -07003916 * @return Returns true if the devices supports the feature, else false.
Dianne Hackborn039c68e2009-09-26 16:39:23 -07003917 */
3918 public abstract boolean hasSystemFeature(String name);
3919
3920 /**
Jeff Sharkey115d2c12016-02-15 17:25:57 -07003921 * Check whether the given feature name and version is one of the available
3922 * features as returned by {@link #getSystemAvailableFeatures()}. Since
3923 * features are defined to always be backwards compatible, this returns true
3924 * if the available feature version is greater than or equal to the
3925 * requested version.
3926 *
3927 * @return Returns true if the devices supports the feature, else false.
3928 */
3929 public abstract boolean hasSystemFeature(String name, int version);
3930
3931 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003932 * Determine the best action to perform for a given Intent. This is how
3933 * {@link Intent#resolveActivity} finds an activity if a class has not been
3934 * explicitly specified.
3935 * <p>
3936 * <em>Note:</em> if using an implicit Intent (without an explicit
3937 * ComponentName specified), be sure to consider whether to set the
3938 * {@link #MATCH_DEFAULT_ONLY} only flag. You need to do so to resolve the
3939 * activity in the same way that
3940 * {@link android.content.Context#startActivity(Intent)} and
Dianne Hackborn4d023d212010-10-01 13:41:04 -07003941 * {@link android.content.Intent#resolveActivity(PackageManager)
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003942 * Intent.resolveActivity(PackageManager)} do.
3943 * </p>
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003944 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003945 * @param intent An intent containing all of the desired specification
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003946 * (action, data, type, category, and/or component).
Jeff Sharkey4347f812017-04-21 12:08:39 -06003947 * @param flags Additional option flags to modify the data returned. The
3948 * most important is {@link #MATCH_DEFAULT_ONLY}, to limit the
3949 * resolution to only those activities that support the
3950 * {@link android.content.Intent#CATEGORY_DEFAULT}.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003951 * @return Returns a ResolveInfo object containing the final activity intent
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003952 * that was determined to be the best action. Returns null if no
Mike LeBeaubd3f5272010-02-18 19:27:17 -08003953 * matching activity was found. If multiple matching activities are
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003954 * found and there is no default set, returns a ResolveInfo object
Mike LeBeaubd3f5272010-02-18 19:27:17 -08003955 * containing something else, such as the activity resolver.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003956 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003957 public abstract ResolveInfo resolveActivity(Intent intent, @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003958
3959 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003960 * Determine the best action to perform for a given Intent for a given user.
3961 * This is how {@link Intent#resolveActivity} finds an activity if a class
3962 * has not been explicitly specified.
3963 * <p>
3964 * <em>Note:</em> if using an implicit Intent (without an explicit
3965 * ComponentName specified), be sure to consider whether to set the
3966 * {@link #MATCH_DEFAULT_ONLY} only flag. You need to do so to resolve the
3967 * activity in the same way that
3968 * {@link android.content.Context#startActivity(Intent)} and
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07003969 * {@link android.content.Intent#resolveActivity(PackageManager)
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003970 * Intent.resolveActivity(PackageManager)} do.
3971 * </p>
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07003972 *
3973 * @param intent An intent containing all of the desired specification
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003974 * (action, data, type, category, and/or component).
Jeff Sharkey4347f812017-04-21 12:08:39 -06003975 * @param flags Additional option flags to modify the data returned. The
3976 * most important is {@link #MATCH_DEFAULT_ONLY}, to limit the
3977 * resolution to only those activities that support the
3978 * {@link android.content.Intent#CATEGORY_DEFAULT}.
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07003979 * @param userId The user id.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003980 * @return Returns a ResolveInfo object containing the final activity intent
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003981 * that was determined to be the best action. Returns null if no
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07003982 * matching activity was found. If multiple matching activities are
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003983 * found and there is no default set, returns a ResolveInfo object
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07003984 * containing something else, such as the activity resolver.
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07003985 * @hide
3986 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003987 public abstract ResolveInfo resolveActivityAsUser(Intent intent, @ResolveInfoFlags int flags,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003988 @UserIdInt int userId);
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07003989
3990 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003991 * Retrieve all activities that can be performed for the given intent.
3992 *
3993 * @param intent The desired intent as per resolveActivity().
Jeff Sharkey4347f812017-04-21 12:08:39 -06003994 * @param flags Additional option flags to modify the data returned. The
3995 * most important is {@link #MATCH_DEFAULT_ONLY}, to limit the
3996 * resolution to only those activities that support the
3997 * {@link android.content.Intent#CATEGORY_DEFAULT}. Or, set
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003998 * {@link #MATCH_ALL} to prevent any filtering of the results.
3999 * @return Returns a List of ResolveInfo objects containing one entry for
4000 * each matching activity, ordered from best to worst. In other
4001 * words, the first item is what would be returned by
4002 * {@link #resolveActivity}. If there are no matching activities, an
4003 * empty list is returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004004 */
4005 public abstract List<ResolveInfo> queryIntentActivities(Intent intent,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004006 @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004007
4008 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004009 * Retrieve all activities that can be performed for the given intent, for a
4010 * specific user.
Amith Yamasani151ec4c2012-09-07 19:25:16 -07004011 *
4012 * @param intent The desired intent as per resolveActivity().
Jeff Sharkey4347f812017-04-21 12:08:39 -06004013 * @param flags Additional option flags to modify the data returned. The
4014 * most important is {@link #MATCH_DEFAULT_ONLY}, to limit the
4015 * resolution to only those activities that support the
4016 * {@link android.content.Intent#CATEGORY_DEFAULT}. Or, set
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004017 * {@link #MATCH_ALL} to prevent any filtering of the results.
4018 * @return Returns a List of ResolveInfo objects containing one entry for
4019 * each matching activity, ordered from best to worst. In other
4020 * words, the first item is what would be returned by
4021 * {@link #resolveActivity}. If there are no matching activities, an
4022 * empty list is returned.
Amith Yamasani151ec4c2012-09-07 19:25:16 -07004023 * @hide
4024 */
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004025 public abstract List<ResolveInfo> queryIntentActivitiesAsUser(Intent intent,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004026 @ResolveInfoFlags int flags, @UserIdInt int userId);
Amith Yamasani151ec4c2012-09-07 19:25:16 -07004027
4028 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004029 * Retrieve a set of activities that should be presented to the user as
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004030 * similar options. This is like {@link #queryIntentActivities}, except it
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004031 * also allows you to supply a list of more explicit Intents that you would
4032 * like to resolve to particular options, and takes care of returning the
4033 * final ResolveInfo list in a reasonable order, with no duplicates, based
4034 * on those inputs.
4035 *
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004036 * @param caller The class name of the activity that is making the request.
4037 * This activity will never appear in the output list. Can be
4038 * null.
4039 * @param specifics An array of Intents that should be resolved to the first
4040 * specific results. Can be null.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004041 * @param intent The desired intent as per resolveActivity().
Jeff Sharkey4347f812017-04-21 12:08:39 -06004042 * @param flags Additional option flags to modify the data returned. The
4043 * most important is {@link #MATCH_DEFAULT_ONLY}, to limit the
4044 * resolution to only those activities that support the
4045 * {@link android.content.Intent#CATEGORY_DEFAULT}.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004046 * @return Returns a List of ResolveInfo objects containing one entry for
4047 * each matching activity. The list is ordered first by all of the
4048 * intents resolved in <var>specifics</var> and then any additional
4049 * activities that can handle <var>intent</var> but did not get
4050 * included by one of the <var>specifics</var> intents. If there are
4051 * no matching activities, an empty list is returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004052 */
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06004053 public abstract List<ResolveInfo> queryIntentActivityOptions(@Nullable ComponentName caller,
4054 @Nullable Intent[] specifics, Intent intent, @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004055
4056 /**
4057 * Retrieve all receivers that can handle a broadcast of the given intent.
4058 *
4059 * @param intent The desired intent as per resolveActivity().
Jeff Sharkey4347f812017-04-21 12:08:39 -06004060 * @param flags Additional option flags to modify the data returned.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004061 * @return Returns a List of ResolveInfo objects containing one entry for
4062 * each matching receiver, ordered from best to worst. If there are
4063 * no matching receivers, an empty list or null is returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004064 */
4065 public abstract List<ResolveInfo> queryBroadcastReceivers(Intent intent,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004066 @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004067
4068 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004069 * Retrieve all receivers that can handle a broadcast of the given intent,
4070 * for a specific user.
Amith Yamasanif203aee2012-08-29 18:41:53 -07004071 *
4072 * @param intent The desired intent as per resolveActivity().
Jeff Sharkey4347f812017-04-21 12:08:39 -06004073 * @param flags Additional option flags to modify the data returned.
Fyodor Kupolov940e8572016-01-26 12:03:51 -08004074 * @param userHandle UserHandle of the user being queried.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004075 * @return Returns a List of ResolveInfo objects containing one entry for
4076 * each matching receiver, ordered from best to worst. If there are
4077 * no matching receivers, an empty list or null is returned.
Amith Yamasanif203aee2012-08-29 18:41:53 -07004078 * @hide
4079 */
Fyodor Kupolov940e8572016-01-26 12:03:51 -08004080 @SystemApi
Todd Kennedydbaef6d2017-07-24 11:28:00 -07004081 @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS)
Fyodor Kupolov940e8572016-01-26 12:03:51 -08004082 public List<ResolveInfo> queryBroadcastReceiversAsUser(Intent intent,
4083 @ResolveInfoFlags int flags, UserHandle userHandle) {
4084 return queryBroadcastReceiversAsUser(intent, flags, userHandle.getIdentifier());
4085 }
4086
4087 /**
4088 * @hide
4089 */
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07004090 public abstract List<ResolveInfo> queryBroadcastReceiversAsUser(Intent intent,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004091 @ResolveInfoFlags int flags, @UserIdInt int userId);
Amith Yamasanif203aee2012-08-29 18:41:53 -07004092
Fyodor Kupolov940e8572016-01-26 12:03:51 -08004093
Jeff Sharkeybd940222016-01-08 11:07:13 -07004094 /** {@hide} */
4095 @Deprecated
4096 public List<ResolveInfo> queryBroadcastReceivers(Intent intent,
4097 @ResolveInfoFlags int flags, @UserIdInt int userId) {
Jeff Sharkey6f4b2a32017-03-21 14:13:41 -06004098 final String msg = "Shame on you for calling the hidden API "
4099 + "queryBroadcastReceivers(). Shame!";
4100 if (VMRuntime.getRuntime().getTargetSdkVersion() >= Build.VERSION_CODES.O) {
4101 throw new UnsupportedOperationException(msg);
4102 } else {
4103 Log.d(TAG, msg);
4104 return queryBroadcastReceiversAsUser(intent, flags, userId);
4105 }
Jeff Sharkeybd940222016-01-08 11:07:13 -07004106 }
4107
Amith Yamasanif203aee2012-08-29 18:41:53 -07004108 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004109 * Determine the best service to handle for a given Intent.
4110 *
4111 * @param intent An intent containing all of the desired specification
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004112 * (action, data, type, category, and/or component).
Jeff Sharkey4347f812017-04-21 12:08:39 -06004113 * @param flags Additional option flags to modify the data returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004114 * @return Returns a ResolveInfo object containing the final service intent
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004115 * that was determined to be the best action. Returns null if no
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004116 * matching service was found.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004117 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004118 public abstract ResolveInfo resolveService(Intent intent, @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004119
4120 /**
4121 * Retrieve all services that can match the given intent.
4122 *
4123 * @param intent The desired intent as per resolveService().
Jeff Sharkey4347f812017-04-21 12:08:39 -06004124 * @param flags Additional option flags to modify the data returned.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004125 * @return Returns a List of ResolveInfo objects containing one entry for
4126 * each matching service, ordered from best to worst. In other
4127 * words, the first item is what would be returned by
4128 * {@link #resolveService}. If there are no matching services, an
4129 * empty list or null is returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004130 */
4131 public abstract List<ResolveInfo> queryIntentServices(Intent intent,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004132 @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004133
4134 /**
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004135 * Retrieve all services that can match the given intent for a given user.
4136 *
4137 * @param intent The desired intent as per resolveService().
Jeff Sharkey4347f812017-04-21 12:08:39 -06004138 * @param flags Additional option flags to modify the data returned.
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004139 * @param userId The user id.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004140 * @return Returns a List of ResolveInfo objects containing one entry for
4141 * each matching service, ordered from best to worst. In other
4142 * words, the first item is what would be returned by
4143 * {@link #resolveService}. If there are no matching services, an
4144 * empty list or null is returned.
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004145 * @hide
4146 */
4147 public abstract List<ResolveInfo> queryIntentServicesAsUser(Intent intent,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004148 @ResolveInfoFlags int flags, @UserIdInt int userId);
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004149
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004150 /**
4151 * Retrieve all providers that can match the given intent.
4152 *
4153 * @param intent An intent containing all of the desired specification
4154 * (action, data, type, category, and/or component).
Jeff Sharkey4347f812017-04-21 12:08:39 -06004155 * @param flags Additional option flags to modify the data returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004156 * @param userId The user id.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004157 * @return Returns a List of ResolveInfo objects containing one entry for
4158 * each matching provider, ordered from best to worst. If there are
4159 * no matching services, an empty list or null is returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004160 * @hide
4161 */
Jeff Sharkey85f5f812013-10-07 10:16:12 -07004162 public abstract List<ResolveInfo> queryIntentContentProvidersAsUser(
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004163 Intent intent, @ResolveInfoFlags int flags, @UserIdInt int userId);
Jeff Sharkey85f5f812013-10-07 10:16:12 -07004164
4165 /**
4166 * Retrieve all providers that can match the given intent.
4167 *
4168 * @param intent An intent containing all of the desired specification
4169 * (action, data, type, category, and/or component).
Jeff Sharkey4347f812017-04-21 12:08:39 -06004170 * @param flags Additional option flags to modify the data returned.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004171 * @return Returns a List of ResolveInfo objects containing one entry for
4172 * each matching provider, ordered from best to worst. If there are
4173 * no matching services, an empty list or null is returned.
Jeff Sharkey85f5f812013-10-07 10:16:12 -07004174 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004175 public abstract List<ResolveInfo> queryIntentContentProviders(Intent intent,
4176 @ResolveInfoFlags int flags);
Jeff Sharkey85f5f812013-10-07 10:16:12 -07004177
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004178 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004179 * Find a single content provider by its base path name.
4180 *
4181 * @param name The name of the provider to find.
Jeff Sharkey4347f812017-04-21 12:08:39 -06004182 * @param flags Additional option flags to modify the data returned.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004183 * @return A {@link ProviderInfo} object containing information about the
4184 * provider. If a provider was not found, returns null.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004185 */
4186 public abstract ProviderInfo resolveContentProvider(String name,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004187 @ComponentInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004188
4189 /**
Alexandra Gherghina0363c3e2014-06-23 13:34:59 +01004190 * Find a single content provider by its base path name.
4191 *
4192 * @param name The name of the provider to find.
Jeff Sharkey4347f812017-04-21 12:08:39 -06004193 * @param flags Additional option flags to modify the data returned.
Alexandra Gherghina0363c3e2014-06-23 13:34:59 +01004194 * @param userId The user id.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004195 * @return A {@link ProviderInfo} object containing information about the
4196 * provider. If a provider was not found, returns null.
Alexandra Gherghina0363c3e2014-06-23 13:34:59 +01004197 * @hide
4198 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004199 public abstract ProviderInfo resolveContentProviderAsUser(String name,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004200 @ComponentInfoFlags int flags, @UserIdInt int userId);
Alexandra Gherghina0363c3e2014-06-23 13:34:59 +01004201
4202 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004203 * Retrieve content provider information.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004204 * <p>
4205 * <em>Note: unlike most other methods, an empty result set is indicated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004206 * by a null return instead of an empty list.</em>
4207 *
4208 * @param processName If non-null, limits the returned providers to only
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004209 * those that are hosted by the given process. If null, all
4210 * content providers are returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004211 * @param uid If <var>processName</var> is non-null, this is the required
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004212 * uid owning the requested content providers.
Jeff Sharkey4347f812017-04-21 12:08:39 -06004213 * @param flags Additional option flags to modify the data returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004214 * @return A list of {@link ProviderInfo} objects containing one entry for
4215 * each provider either matching <var>processName</var> or, if
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004216 * <var>processName</var> is null, all known content providers.
4217 * <em>If there are no matching providers, null is returned.</em>
4218 */
4219 public abstract List<ProviderInfo> queryContentProviders(
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004220 String processName, int uid, @ComponentInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004221
4222 /**
Makoto Onuki32757292017-02-22 14:36:59 -08004223 * Same as {@link #queryContentProviders}, except when {@code metaDataKey} is not null,
4224 * it only returns providers which have metadata with the {@code metaDataKey} key.
4225 *
4226 * <p>DO NOT USE the {@code metaDataKey} parameter, unless you're the contacts provider.
4227 * You really shouldn't need it. Other apps should use {@link #queryIntentContentProviders}
4228 * instead.
4229 *
4230 * <p>The {@code metaDataKey} parameter was added to allow the contacts provider to quickly
4231 * scan the GAL providers on the device. Unfortunately the discovery protocol used metadata
4232 * to mark GAL providers, rather than intent filters, so we can't use
4233 * {@link #queryIntentContentProviders} for that.
4234 *
4235 * @hide
4236 */
4237 public List<ProviderInfo> queryContentProviders(
4238 String processName, int uid, @ComponentInfoFlags int flags, String metaDataKey) {
4239 // Provide the default implementation for mocks.
4240 return queryContentProviders(processName, uid, flags);
4241 }
4242
4243 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004244 * Retrieve all of the information we know about a particular
4245 * instrumentation class.
4246 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004247 * @param className The full name (i.e.
Jeff Sharkey4347f812017-04-21 12:08:39 -06004248 * com.google.apps.contacts.InstrumentList) of an Instrumentation
4249 * class.
4250 * @param flags Additional option flags to modify the data returned.
4251 * @return An {@link InstrumentationInfo} object containing information
4252 * about the instrumentation.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004253 * @throws NameNotFoundException if a package with the given name cannot be
4254 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004255 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004256 public abstract InstrumentationInfo getInstrumentationInfo(ComponentName className,
4257 @InstrumentationInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004258
4259 /**
Jeff Sharkey4347f812017-04-21 12:08:39 -06004260 * Retrieve information about available instrumentation code. May be used to
4261 * retrieve either all instrumentation code, or only the code targeting a
4262 * particular package.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004263 *
4264 * @param targetPackage If null, all instrumentation is returned; only the
Jeff Sharkey4347f812017-04-21 12:08:39 -06004265 * instrumentation targeting this package name is returned.
4266 * @param flags Additional option flags to modify the data returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004267 * @return A list of {@link InstrumentationInfo} objects containing one
4268 * entry for each matching instrumentation. If there are no
Jesse Hallf77a34f2016-02-04 18:41:33 -08004269 * instrumentation available, returns an empty list.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004270 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004271 public abstract List<InstrumentationInfo> queryInstrumentation(String targetPackage,
4272 @InstrumentationInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004273
4274 /**
4275 * Retrieve an image from a package. This is a low-level API used by
4276 * the various package manager info structures (such as
4277 * {@link ComponentInfo} to implement retrieval of their associated
4278 * icon.
4279 *
4280 * @param packageName The name of the package that this icon is coming from.
kmccormick30498b42013-03-27 17:39:17 -07004281 * Cannot be null.
4282 * @param resid The resource identifier of the desired image. Cannot be 0.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004283 * @param appInfo Overall information about <var>packageName</var>. This
4284 * may be null, in which case the application information will be retrieved
4285 * for you if needed; if you already have this information around, it can
4286 * be much more efficient to supply it here.
4287 *
4288 * @return Returns a Drawable holding the requested image. Returns null if
4289 * an image could not be found for any reason.
4290 */
Tor Norbye7b9c9122013-05-30 16:48:33 -07004291 public abstract Drawable getDrawable(String packageName, @DrawableRes int resid,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004292 ApplicationInfo appInfo);
4293
4294 /**
4295 * Retrieve the icon associated with an activity. Given the full name of
4296 * an activity, retrieves the information about it and calls
4297 * {@link ComponentInfo#loadIcon ComponentInfo.loadIcon()} to return its icon.
kmccormick30498b42013-03-27 17:39:17 -07004298 * If the activity cannot be found, NameNotFoundException is thrown.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004299 *
4300 * @param activityName Name of the activity whose icon is to be retrieved.
4301 *
4302 * @return Returns the image of the icon, or the default activity icon if
4303 * it could not be found. Does not return null.
4304 * @throws NameNotFoundException Thrown if the resources for the given
4305 * activity could not be loaded.
4306 *
4307 * @see #getActivityIcon(Intent)
4308 */
4309 public abstract Drawable getActivityIcon(ComponentName activityName)
4310 throws NameNotFoundException;
4311
4312 /**
4313 * Retrieve the icon associated with an Intent. If intent.getClassName() is
4314 * set, this simply returns the result of
4315 * getActivityIcon(intent.getClassName()). Otherwise it resolves the intent's
4316 * component and returns the icon associated with the resolved component.
kmccormick30498b42013-03-27 17:39:17 -07004317 * If intent.getClassName() cannot be found or the Intent cannot be resolved
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004318 * to a component, NameNotFoundException is thrown.
4319 *
4320 * @param intent The intent for which you would like to retrieve an icon.
4321 *
4322 * @return Returns the image of the icon, or the default activity icon if
4323 * it could not be found. Does not return null.
4324 * @throws NameNotFoundException Thrown if the resources for application
4325 * matching the given intent could not be loaded.
4326 *
4327 * @see #getActivityIcon(ComponentName)
4328 */
4329 public abstract Drawable getActivityIcon(Intent intent)
4330 throws NameNotFoundException;
4331
4332 /**
Jose Limaf78e3122014-03-06 12:13:15 -08004333 * Retrieve the banner associated with an activity. Given the full name of
4334 * an activity, retrieves the information about it and calls
4335 * {@link ComponentInfo#loadIcon ComponentInfo.loadIcon()} to return its
4336 * banner. If the activity cannot be found, NameNotFoundException is thrown.
4337 *
4338 * @param activityName Name of the activity whose banner is to be retrieved.
4339 * @return Returns the image of the banner, or null if the activity has no
4340 * banner specified.
4341 * @throws NameNotFoundException Thrown if the resources for the given
4342 * activity could not be loaded.
4343 * @see #getActivityBanner(Intent)
4344 */
4345 public abstract Drawable getActivityBanner(ComponentName activityName)
4346 throws NameNotFoundException;
4347
4348 /**
4349 * Retrieve the banner associated with an Intent. If intent.getClassName()
4350 * is set, this simply returns the result of
4351 * getActivityBanner(intent.getClassName()). Otherwise it resolves the
4352 * intent's component and returns the banner associated with the resolved
4353 * component. If intent.getClassName() cannot be found or the Intent cannot
4354 * be resolved to a component, NameNotFoundException is thrown.
4355 *
4356 * @param intent The intent for which you would like to retrieve a banner.
4357 * @return Returns the image of the banner, or null if the activity has no
4358 * banner specified.
4359 * @throws NameNotFoundException Thrown if the resources for application
4360 * matching the given intent could not be loaded.
4361 * @see #getActivityBanner(ComponentName)
4362 */
4363 public abstract Drawable getActivityBanner(Intent intent)
4364 throws NameNotFoundException;
4365
4366 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004367 * Return the generic icon for an activity that is used when no specific
4368 * icon is defined.
Adam Connors23cc04e2014-04-01 12:12:20 +01004369 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004370 * @return Drawable Image of the icon.
4371 */
4372 public abstract Drawable getDefaultActivityIcon();
4373
4374 /**
4375 * Retrieve the icon associated with an application. If it has not defined
4376 * an icon, the default app icon is returned. Does not return null.
4377 *
4378 * @param info Information about application being queried.
4379 *
4380 * @return Returns the image of the icon, or the default application icon
4381 * if it could not be found.
4382 *
4383 * @see #getApplicationIcon(String)
4384 */
4385 public abstract Drawable getApplicationIcon(ApplicationInfo info);
4386
4387 /**
4388 * Retrieve the icon associated with an application. Given the name of the
4389 * application's package, retrieves the information about it and calls
kmccormick30498b42013-03-27 17:39:17 -07004390 * getApplicationIcon() to return its icon. If the application cannot be
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004391 * found, NameNotFoundException is thrown.
4392 *
4393 * @param packageName Name of the package whose application icon is to be
4394 * retrieved.
4395 *
4396 * @return Returns the image of the icon, or the default application icon
4397 * if it could not be found. Does not return null.
4398 * @throws NameNotFoundException Thrown if the resources for the given
4399 * application could not be loaded.
4400 *
4401 * @see #getApplicationIcon(ApplicationInfo)
4402 */
4403 public abstract Drawable getApplicationIcon(String packageName)
4404 throws NameNotFoundException;
4405
4406 /**
Jose Limaf78e3122014-03-06 12:13:15 -08004407 * Retrieve the banner associated with an application.
4408 *
4409 * @param info Information about application being queried.
4410 * @return Returns the image of the banner or null if the application has no
4411 * banner specified.
4412 * @see #getApplicationBanner(String)
4413 */
4414 public abstract Drawable getApplicationBanner(ApplicationInfo info);
4415
4416 /**
4417 * Retrieve the banner associated with an application. Given the name of the
4418 * application's package, retrieves the information about it and calls
4419 * getApplicationIcon() to return its banner. If the application cannot be
4420 * found, NameNotFoundException is thrown.
4421 *
4422 * @param packageName Name of the package whose application banner is to be
4423 * retrieved.
4424 * @return Returns the image of the banner or null if the application has no
4425 * banner specified.
4426 * @throws NameNotFoundException Thrown if the resources for the given
4427 * application could not be loaded.
4428 * @see #getApplicationBanner(ApplicationInfo)
4429 */
4430 public abstract Drawable getApplicationBanner(String packageName)
4431 throws NameNotFoundException;
4432
4433 /**
4434 * Retrieve the logo associated with an activity. Given the full name of an
4435 * activity, retrieves the information about it and calls
4436 * {@link ComponentInfo#loadLogo ComponentInfo.loadLogo()} to return its
4437 * logo. If the activity cannot be found, NameNotFoundException is thrown.
Adam Powell81cd2e92010-04-21 16:35:18 -07004438 *
4439 * @param activityName Name of the activity whose logo is to be retrieved.
Jose Limaf78e3122014-03-06 12:13:15 -08004440 * @return Returns the image of the logo or null if the activity has no logo
4441 * specified.
Adam Powell81cd2e92010-04-21 16:35:18 -07004442 * @throws NameNotFoundException Thrown if the resources for the given
Jose Limaf78e3122014-03-06 12:13:15 -08004443 * activity could not be loaded.
Adam Powell81cd2e92010-04-21 16:35:18 -07004444 * @see #getActivityLogo(Intent)
4445 */
4446 public abstract Drawable getActivityLogo(ComponentName activityName)
4447 throws NameNotFoundException;
4448
4449 /**
4450 * Retrieve the logo associated with an Intent. If intent.getClassName() is
4451 * set, this simply returns the result of
4452 * getActivityLogo(intent.getClassName()). Otherwise it resolves the intent's
4453 * component and returns the logo associated with the resolved component.
kmccormick30498b42013-03-27 17:39:17 -07004454 * If intent.getClassName() cannot be found or the Intent cannot be resolved
Adam Powell81cd2e92010-04-21 16:35:18 -07004455 * to a component, NameNotFoundException is thrown.
4456 *
4457 * @param intent The intent for which you would like to retrieve a logo.
4458 *
4459 * @return Returns the image of the logo, or null if the activity has no
4460 * logo specified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004461 *
Adam Powell81cd2e92010-04-21 16:35:18 -07004462 * @throws NameNotFoundException Thrown if the resources for application
4463 * matching the given intent could not be loaded.
4464 *
4465 * @see #getActivityLogo(ComponentName)
4466 */
4467 public abstract Drawable getActivityLogo(Intent intent)
4468 throws NameNotFoundException;
4469
4470 /**
4471 * Retrieve the logo associated with an application. If it has not specified
4472 * a logo, this method returns null.
4473 *
4474 * @param info Information about application being queried.
4475 *
4476 * @return Returns the image of the logo, or null if no logo is specified
4477 * by the application.
4478 *
4479 * @see #getApplicationLogo(String)
4480 */
4481 public abstract Drawable getApplicationLogo(ApplicationInfo info);
4482
4483 /**
4484 * Retrieve the logo associated with an application. Given the name of the
4485 * application's package, retrieves the information about it and calls
kmccormick30498b42013-03-27 17:39:17 -07004486 * getApplicationLogo() to return its logo. If the application cannot be
Adam Powell81cd2e92010-04-21 16:35:18 -07004487 * found, NameNotFoundException is thrown.
4488 *
4489 * @param packageName Name of the package whose application logo is to be
4490 * retrieved.
4491 *
4492 * @return Returns the image of the logo, or null if no application logo
4493 * has been specified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004494 *
Adam Powell81cd2e92010-04-21 16:35:18 -07004495 * @throws NameNotFoundException Thrown if the resources for the given
4496 * application could not be loaded.
4497 *
4498 * @see #getApplicationLogo(ApplicationInfo)
4499 */
4500 public abstract Drawable getApplicationLogo(String packageName)
4501 throws NameNotFoundException;
4502
4503 /**
Tony Mak4dc008c2016-03-16 10:46:49 +00004504 * If the target user is a managed profile, then this returns a badged copy of the given icon
4505 * to be able to distinguish it from the original icon. For badging an arbitrary drawable use
Kenny Guydf77d712015-05-29 17:02:22 +01004506 * {@link #getUserBadgedDrawableForDensity(
Svetoslavc7d62f02014-09-04 15:39:54 -07004507 * android.graphics.drawable.Drawable, UserHandle, android.graphics.Rect, int)}.
4508 * <p>
4509 * If the original drawable is a BitmapDrawable and the backing bitmap is
4510 * mutable as per {@link android.graphics.Bitmap#isMutable()}, the badging
4511 * is performed in place and the original drawable is returned.
4512 * </p>
4513 *
4514 * @param icon The icon to badge.
4515 * @param user The target user.
4516 * @return A drawable that combines the original icon and a badge as
4517 * determined by the system.
4518 */
4519 public abstract Drawable getUserBadgedIcon(Drawable icon, UserHandle user);
4520
4521 /**
4522 * If the target user is a managed profile of the calling user or the caller
4523 * is itself a managed profile, then this returns a badged copy of the given
4524 * drawable allowing the user to distinguish it from the original drawable.
4525 * The caller can specify the location in the bounds of the drawable to be
4526 * badged where the badge should be applied as well as the density of the
4527 * badge to be used.
4528 * <p>
4529 * If the original drawable is a BitmapDrawable and the backing bitmap is
Vadim Tryshev66ae66a2016-02-18 15:41:21 -08004530 * mutable as per {@link android.graphics.Bitmap#isMutable()}, the badging
Svetoslavc7d62f02014-09-04 15:39:54 -07004531 * is performed in place and the original drawable is returned.
4532 * </p>
4533 *
4534 * @param drawable The drawable to badge.
4535 * @param user The target user.
4536 * @param badgeLocation Where in the bounds of the badged drawable to place
Vadim Tryshev66ae66a2016-02-18 15:41:21 -08004537 * the badge. If it's {@code null}, the badge is applied on top of the entire
Svetoslavc7d62f02014-09-04 15:39:54 -07004538 * drawable being badged.
4539 * @param badgeDensity The optional desired density for the badge as per
Vadim Tryshev66ae66a2016-02-18 15:41:21 -08004540 * {@link android.util.DisplayMetrics#densityDpi}. If it's not positive,
Svetoslavc7d62f02014-09-04 15:39:54 -07004541 * the density of the display is used.
4542 * @return A drawable that combines the original drawable and a badge as
4543 * determined by the system.
4544 */
4545 public abstract Drawable getUserBadgedDrawableForDensity(Drawable drawable,
4546 UserHandle user, Rect badgeLocation, int badgeDensity);
4547
4548 /**
4549 * If the target user is a managed profile of the calling user or the caller
4550 * is itself a managed profile, then this returns a drawable to use as a small
4551 * icon to include in a view to distinguish it from the original icon.
4552 *
4553 * @param user The target user.
4554 * @param density The optional desired density for the badge as per
4555 * {@link android.util.DisplayMetrics#densityDpi}. If not provided
4556 * the density of the current display is used.
4557 * @return the drawable or null if no drawable is required.
4558 * @hide
4559 */
4560 public abstract Drawable getUserBadgeForDensity(UserHandle user, int density);
4561
4562 /**
4563 * If the target user is a managed profile of the calling user or the caller
Selim Cineke6ff9462016-01-15 15:07:06 -08004564 * is itself a managed profile, then this returns a drawable to use as a small
4565 * icon to include in a view to distinguish it from the original icon. This version
4566 * doesn't have background protection and should be used over a light background instead of
4567 * a badge.
4568 *
4569 * @param user The target user.
4570 * @param density The optional desired density for the badge as per
4571 * {@link android.util.DisplayMetrics#densityDpi}. If not provided
4572 * the density of the current display is used.
4573 * @return the drawable or null if no drawable is required.
4574 * @hide
4575 */
4576 public abstract Drawable getUserBadgeForDensityNoBackground(UserHandle user, int density);
4577
4578 /**
4579 * If the target user is a managed profile of the calling user or the caller
Svetoslavc7d62f02014-09-04 15:39:54 -07004580 * is itself a managed profile, then this returns a copy of the label with
4581 * badging for accessibility services like talkback. E.g. passing in "Email"
4582 * and it might return "Work Email" for Email in the work profile.
4583 *
4584 * @param label The label to change.
4585 * @param user The target user.
4586 * @return A label that combines the original label and a badge as
4587 * determined by the system.
4588 */
4589 public abstract CharSequence getUserBadgedLabel(CharSequence label, UserHandle user);
4590
4591 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004592 * Retrieve text from a package. This is a low-level API used by
4593 * the various package manager info structures (such as
4594 * {@link ComponentInfo} to implement retrieval of their associated
4595 * labels and other text.
4596 *
4597 * @param packageName The name of the package that this text is coming from.
kmccormick30498b42013-03-27 17:39:17 -07004598 * Cannot be null.
4599 * @param resid The resource identifier of the desired text. Cannot be 0.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004600 * @param appInfo Overall information about <var>packageName</var>. This
4601 * may be null, in which case the application information will be retrieved
4602 * for you if needed; if you already have this information around, it can
4603 * be much more efficient to supply it here.
4604 *
4605 * @return Returns a CharSequence holding the requested text. Returns null
4606 * if the text could not be found for any reason.
4607 */
Tor Norbye7b9c9122013-05-30 16:48:33 -07004608 public abstract CharSequence getText(String packageName, @StringRes int resid,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004609 ApplicationInfo appInfo);
4610
4611 /**
4612 * Retrieve an XML file from a package. This is a low-level API used to
4613 * retrieve XML meta data.
4614 *
4615 * @param packageName The name of the package that this xml is coming from.
kmccormick30498b42013-03-27 17:39:17 -07004616 * Cannot be null.
4617 * @param resid The resource identifier of the desired xml. Cannot be 0.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004618 * @param appInfo Overall information about <var>packageName</var>. This
4619 * may be null, in which case the application information will be retrieved
4620 * for you if needed; if you already have this information around, it can
4621 * be much more efficient to supply it here.
4622 *
4623 * @return Returns an XmlPullParser allowing you to parse out the XML
4624 * data. Returns null if the xml resource could not be found for any
4625 * reason.
4626 */
Tor Norbye7b9c9122013-05-30 16:48:33 -07004627 public abstract XmlResourceParser getXml(String packageName, @XmlRes int resid,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004628 ApplicationInfo appInfo);
4629
4630 /**
4631 * Return the label to use for this application.
4632 *
4633 * @return Returns the label associated with this application, or null if
4634 * it could not be found for any reason.
kmccormick30498b42013-03-27 17:39:17 -07004635 * @param info The application to get the label of.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004636 */
4637 public abstract CharSequence getApplicationLabel(ApplicationInfo info);
4638
4639 /**
4640 * Retrieve the resources associated with an activity. Given the full
4641 * name of an activity, retrieves the information about it and calls
4642 * getResources() to return its application's resources. If the activity
kmccormick30498b42013-03-27 17:39:17 -07004643 * cannot be found, NameNotFoundException is thrown.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004644 *
4645 * @param activityName Name of the activity whose resources are to be
4646 * retrieved.
4647 *
4648 * @return Returns the application's Resources.
4649 * @throws NameNotFoundException Thrown if the resources for the given
4650 * application could not be loaded.
4651 *
4652 * @see #getResourcesForApplication(ApplicationInfo)
4653 */
4654 public abstract Resources getResourcesForActivity(ComponentName activityName)
4655 throws NameNotFoundException;
4656
4657 /**
4658 * Retrieve the resources for an application. Throws NameNotFoundException
4659 * if the package is no longer installed.
4660 *
4661 * @param app Information about the desired application.
4662 *
4663 * @return Returns the application's Resources.
4664 * @throws NameNotFoundException Thrown if the resources for the given
4665 * application could not be loaded (most likely because it was uninstalled).
4666 */
4667 public abstract Resources getResourcesForApplication(ApplicationInfo app)
4668 throws NameNotFoundException;
4669
4670 /**
4671 * Retrieve the resources associated with an application. Given the full
4672 * package name of an application, retrieves the information about it and
4673 * calls getResources() to return its application's resources. If the
kmccormick30498b42013-03-27 17:39:17 -07004674 * appPackageName cannot be found, NameNotFoundException is thrown.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004675 *
4676 * @param appPackageName Package name of the application whose resources
4677 * are to be retrieved.
4678 *
4679 * @return Returns the application's Resources.
4680 * @throws NameNotFoundException Thrown if the resources for the given
4681 * application could not be loaded.
4682 *
4683 * @see #getResourcesForApplication(ApplicationInfo)
4684 */
4685 public abstract Resources getResourcesForApplication(String appPackageName)
4686 throws NameNotFoundException;
4687
Amith Yamasani98edc952012-09-25 14:09:27 -07004688 /** @hide */
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004689 public abstract Resources getResourcesForApplicationAsUser(String appPackageName,
4690 @UserIdInt int userId) throws NameNotFoundException;
Amith Yamasani98edc952012-09-25 14:09:27 -07004691
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004692 /**
Jeff Sharkey4347f812017-04-21 12:08:39 -06004693 * Retrieve overall information about an application package defined in a
4694 * package archive file
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004695 *
4696 * @param archiveFilePath The path to the archive file
Jeff Sharkey4347f812017-04-21 12:08:39 -06004697 * @param flags Additional option flags to modify the data returned.
4698 * @return A PackageInfo object containing information about the package
4699 * archive. If the package could not be parsed, returns null.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004700 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004701 public PackageInfo getPackageArchiveInfo(String archiveFilePath, @PackageInfoFlags int flags) {
Jeff Sharkey275e0852014-06-17 18:18:49 -07004702 final PackageParser parser = new PackageParser();
Dianne Hackborncd154e92017-02-28 17:37:35 -08004703 parser.setCallback(new PackageParser.CallbackImpl(this));
Jeff Sharkey275e0852014-06-17 18:18:49 -07004704 final File apkFile = new File(archiveFilePath);
Jeff Sharkeyc4858a22014-06-16 10:51:20 -07004705 try {
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004706 if ((flags & (MATCH_DIRECT_BOOT_UNAWARE | MATCH_DIRECT_BOOT_AWARE)) != 0) {
Jeff Sharkeyc3132512016-01-12 14:06:58 -07004707 // Caller expressed an explicit opinion about what encryption
4708 // aware/unaware components they want to see, so fall through and
4709 // give them what they want
4710 } else {
4711 // Caller expressed no opinion, so match everything
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004712 flags |= MATCH_DIRECT_BOOT_AWARE | MATCH_DIRECT_BOOT_UNAWARE;
Jeff Sharkeyc3132512016-01-12 14:06:58 -07004713 }
4714
Jeff Sharkey275e0852014-06-17 18:18:49 -07004715 PackageParser.Package pkg = parser.parseMonolithicPackage(apkFile, 0);
Jeff Sharkeyc4858a22014-06-16 10:51:20 -07004716 if ((flags & GET_SIGNATURES) != 0) {
Svet Ganov354cd3c2015-12-17 11:35:04 -08004717 PackageParser.collectCertificates(pkg, 0);
Jeff Sharkeyc4858a22014-06-16 10:51:20 -07004718 }
4719 PackageUserState state = new PackageUserState();
4720 return PackageParser.generatePackageInfo(pkg, null, flags, 0, 0, null, state);
4721 } catch (PackageParserException e) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004722 return null;
4723 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004724 }
4725
4726 /**
Dianne Hackborn7767eac2012-08-23 18:25:40 -07004727 * If there is already an application with the given package name installed
4728 * on the system for other users, also install it for the calling user.
4729 * @hide
4730 */
Sunny Goyal07f41fb2017-08-09 02:56:34 -07004731 @SystemApi
Nicolas Prevot9a80e532015-09-23 15:49:28 +01004732 public abstract int installExistingPackage(String packageName) throws NameNotFoundException;
4733
4734 /**
4735 * If there is already an application with the given package name installed
Sunny Goyala31a74b2017-05-11 15:59:19 -07004736 * on the system for other users, also install it for the calling user.
4737 * @hide
4738 */
Sunny Goyal07f41fb2017-08-09 02:56:34 -07004739 @SystemApi
Sunny Goyala31a74b2017-05-11 15:59:19 -07004740 public abstract int installExistingPackage(String packageName, @InstallReason int installReason)
4741 throws NameNotFoundException;
4742
4743 /**
4744 * If there is already an application with the given package name installed
Nicolas Prevot9a80e532015-09-23 15:49:28 +01004745 * on the system for other users, also install it for the specified user.
4746 * @hide
4747 */
4748 @RequiresPermission(anyOf = {
4749 Manifest.permission.INSTALL_PACKAGES,
4750 Manifest.permission.INTERACT_ACROSS_USERS_FULL})
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004751 public abstract int installExistingPackageAsUser(String packageName, @UserIdInt int userId)
Dianne Hackborn7767eac2012-08-23 18:25:40 -07004752 throws NameNotFoundException;
4753
4754 /**
Kenny Root5ab21572011-07-27 11:11:19 -07004755 * Allows a package listening to the
4756 * {@link Intent#ACTION_PACKAGE_NEEDS_VERIFICATION package verification
Kenny Root3a9b5fb2011-09-20 14:15:38 -07004757 * broadcast} to respond to the package manager. The response must include
4758 * the {@code verificationCode} which is one of
4759 * {@link PackageManager#VERIFICATION_ALLOW} or
4760 * {@link PackageManager#VERIFICATION_REJECT}.
Kenny Root5ab21572011-07-27 11:11:19 -07004761 *
4762 * @param id pending package identifier as passed via the
kmccormick30498b42013-03-27 17:39:17 -07004763 * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra.
Kenny Root3a9b5fb2011-09-20 14:15:38 -07004764 * @param verificationCode either {@link PackageManager#VERIFICATION_ALLOW}
4765 * or {@link PackageManager#VERIFICATION_REJECT}.
rich cannings7e671512012-08-27 14:44:16 -07004766 * @throws SecurityException if the caller does not have the
Dianne Hackborn8832c182012-09-17 17:20:24 -07004767 * PACKAGE_VERIFICATION_AGENT permission.
Kenny Root5ab21572011-07-27 11:11:19 -07004768 */
Kenny Root3a9b5fb2011-09-20 14:15:38 -07004769 public abstract void verifyPendingInstall(int id, int verificationCode);
Kenny Root5ab21572011-07-27 11:11:19 -07004770
4771 /**
rich canningsd9ef3e52012-08-22 14:28:05 -07004772 * Allows a package listening to the
4773 * {@link Intent#ACTION_PACKAGE_NEEDS_VERIFICATION package verification
4774 * broadcast} to extend the default timeout for a response and declare what
4775 * action to perform after the timeout occurs. The response must include
4776 * the {@code verificationCodeAtTimeout} which is one of
4777 * {@link PackageManager#VERIFICATION_ALLOW} or
4778 * {@link PackageManager#VERIFICATION_REJECT}.
4779 *
4780 * This method may only be called once per package id. Additional calls
4781 * will have no effect.
4782 *
4783 * @param id pending package identifier as passed via the
kmccormick30498b42013-03-27 17:39:17 -07004784 * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra.
rich canningsd9ef3e52012-08-22 14:28:05 -07004785 * @param verificationCodeAtTimeout either
4786 * {@link PackageManager#VERIFICATION_ALLOW} or
rich canningsd1b5cfc2012-08-29 14:49:51 -07004787 * {@link PackageManager#VERIFICATION_REJECT}. If
4788 * {@code verificationCodeAtTimeout} is neither
4789 * {@link PackageManager#VERIFICATION_ALLOW} or
4790 * {@link PackageManager#VERIFICATION_REJECT}, then
4791 * {@code verificationCodeAtTimeout} will default to
rich canningsd9ef3e52012-08-22 14:28:05 -07004792 * {@link PackageManager#VERIFICATION_REJECT}.
4793 * @param millisecondsToDelay the amount of time requested for the timeout.
4794 * Must be positive and less than
rich canningsd1b5cfc2012-08-29 14:49:51 -07004795 * {@link PackageManager#MAXIMUM_VERIFICATION_TIMEOUT}. If
4796 * {@code millisecondsToDelay} is out of bounds,
4797 * {@code millisecondsToDelay} will be set to the closest in
4798 * bounds value; namely, 0 or
rich canningsd9ef3e52012-08-22 14:28:05 -07004799 * {@link PackageManager#MAXIMUM_VERIFICATION_TIMEOUT}.
rich cannings7e671512012-08-27 14:44:16 -07004800 * @throws SecurityException if the caller does not have the
Dianne Hackborn8832c182012-09-17 17:20:24 -07004801 * PACKAGE_VERIFICATION_AGENT permission.
rich canningsd9ef3e52012-08-22 14:28:05 -07004802 */
4803 public abstract void extendVerificationTimeout(int id,
4804 int verificationCodeAtTimeout, long millisecondsToDelay);
4805
4806 /**
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004807 * Allows a package listening to the
Todd Kennedydfa93ab2016-03-03 15:24:33 -08004808 * {@link Intent#ACTION_INTENT_FILTER_NEEDS_VERIFICATION} intent filter verification
4809 * broadcast to respond to the package manager. The response must include
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004810 * the {@code verificationCode} which is one of
4811 * {@link PackageManager#INTENT_FILTER_VERIFICATION_SUCCESS} or
4812 * {@link PackageManager#INTENT_FILTER_VERIFICATION_FAILURE}.
4813 *
4814 * @param verificationId pending package identifier as passed via the
4815 * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra.
4816 * @param verificationCode either {@link PackageManager#INTENT_FILTER_VERIFICATION_SUCCESS}
4817 * or {@link PackageManager#INTENT_FILTER_VERIFICATION_FAILURE}.
Todd Kennedydfa93ab2016-03-03 15:24:33 -08004818 * @param failedDomains a list of failed domains if the verificationCode is
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004819 * {@link PackageManager#INTENT_FILTER_VERIFICATION_FAILURE}, otherwise null;
4820 * @throws SecurityException if the caller does not have the
4821 * INTENT_FILTER_VERIFICATION_AGENT permission.
4822 *
4823 * @hide
4824 */
Fabrice Di Meglioef741da2015-05-12 16:31:38 -07004825 @SystemApi
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06004826 @RequiresPermission(android.Manifest.permission.INTENT_FILTER_VERIFICATION_AGENT)
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004827 public abstract void verifyIntentFilter(int verificationId, int verificationCode,
Todd Kennedydfa93ab2016-03-03 15:24:33 -08004828 List<String> failedDomains);
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004829
4830 /**
4831 * Get the status of a Domain Verification Result for an IntentFilter. This is
4832 * related to the {@link android.content.IntentFilter#setAutoVerify(boolean)} and
4833 * {@link android.content.IntentFilter#getAutoVerify()}
4834 *
4835 * This is used by the ResolverActivity to change the status depending on what the User select
4836 * in the Disambiguation Dialog and also used by the Settings App for changing the default App
4837 * for a domain.
4838 *
4839 * @param packageName The package name of the Activity associated with the IntentFilter.
4840 * @param userId The user id.
4841 *
4842 * @return The status to set to. This can be
4843 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK} or
4844 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS} or
4845 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER} or
4846 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED}
4847 *
4848 * @hide
4849 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08004850 @SystemApi
Todd Kennedydbaef6d2017-07-24 11:28:00 -07004851 @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS_FULL)
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004852 public abstract int getIntentVerificationStatusAsUser(String packageName, @UserIdInt int userId);
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004853
4854 /**
4855 * Allow to change the status of a Intent Verification status for all IntentFilter of an App.
4856 * This is related to the {@link android.content.IntentFilter#setAutoVerify(boolean)} and
4857 * {@link android.content.IntentFilter#getAutoVerify()}
4858 *
4859 * This is used by the ResolverActivity to change the status depending on what the User select
4860 * in the Disambiguation Dialog and also used by the Settings App for changing the default App
4861 * for a domain.
4862 *
4863 * @param packageName The package name of the Activity associated with the IntentFilter.
4864 * @param status The status to set to. This can be
4865 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK} or
4866 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS} or
4867 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER}
4868 * @param userId The user id.
4869 *
4870 * @return true if the status has been set. False otherwise.
4871 *
4872 * @hide
4873 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08004874 @SystemApi
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06004875 @RequiresPermission(android.Manifest.permission.SET_PREFERRED_APPLICATIONS)
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07004876 public abstract boolean updateIntentVerificationStatusAsUser(String packageName, int status,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004877 @UserIdInt int userId);
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004878
4879 /**
4880 * Get the list of IntentFilterVerificationInfo for a specific package and User.
4881 *
4882 * @param packageName the package name. When this parameter is set to a non null value,
4883 * the results will be filtered by the package name provided.
4884 * Otherwise, there will be no filtering and it will return a list
Fabrice Di Meglio07885952015-04-06 19:41:28 -07004885 * corresponding for all packages
4886 *
4887 * @return a list of IntentFilterVerificationInfo for a specific package.
4888 *
4889 * @hide
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004890 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08004891 @SystemApi
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004892 public abstract List<IntentFilterVerificationInfo> getIntentFilterVerifications(
4893 String packageName);
4894
4895 /**
Fabrice Di Meglio07885952015-04-06 19:41:28 -07004896 * Get the list of IntentFilter for a specific package.
4897 *
4898 * @param packageName the package name. This parameter is set to a non null value,
4899 * the list will contain all the IntentFilter for that package.
4900 * Otherwise, the list will be empty.
4901 *
4902 * @return a list of IntentFilter for a specific package.
4903 *
4904 * @hide
4905 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08004906 @SystemApi
Fabrice Di Meglio07885952015-04-06 19:41:28 -07004907 public abstract List<IntentFilter> getAllIntentFilters(String packageName);
4908
4909 /**
Fabrice Di Meglio62271722015-04-10 17:24:02 -07004910 * Get the default Browser package name for a specific user.
4911 *
4912 * @param userId The user id.
4913 *
4914 * @return the package name of the default Browser for the specified user. If the user id passed
4915 * is -1 (all users) it will return a null value.
4916 *
4917 * @hide
4918 */
Jeff Sharkeya73b8fd2016-01-06 17:02:08 -07004919 @TestApi
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08004920 @SystemApi
Todd Kennedydbaef6d2017-07-24 11:28:00 -07004921 @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS_FULL)
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004922 public abstract String getDefaultBrowserPackageNameAsUser(@UserIdInt int userId);
Fabrice Di Meglio62271722015-04-10 17:24:02 -07004923
4924 /**
4925 * Set the default Browser package name for a specific user.
4926 *
4927 * @param packageName The package name of the default Browser.
4928 * @param userId The user id.
4929 *
4930 * @return true if the default Browser for the specified user has been set,
4931 * otherwise return false. If the user id passed is -1 (all users) this call will not
4932 * do anything and just return false.
4933 *
4934 * @hide
4935 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08004936 @SystemApi
Todd Kennedydbaef6d2017-07-24 11:28:00 -07004937 @RequiresPermission(allOf = {
4938 Manifest.permission.SET_PREFERRED_APPLICATIONS,
4939 Manifest.permission.INTERACT_ACROSS_USERS_FULL})
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004940 public abstract boolean setDefaultBrowserPackageNameAsUser(String packageName,
4941 @UserIdInt int userId);
Fabrice Di Meglio62271722015-04-10 17:24:02 -07004942
4943 /**
Dianne Hackborn880119b2010-11-18 22:26:40 -08004944 * Change the installer associated with a given package. There are limitations
4945 * on how the installer package can be changed; in particular:
4946 * <ul>
4947 * <li> A SecurityException will be thrown if <var>installerPackageName</var>
4948 * is not signed with the same certificate as the calling application.
4949 * <li> A SecurityException will be thrown if <var>targetPackage</var> already
4950 * has an installer package, and that installer package is not signed with
4951 * the same certificate as the calling application.
4952 * </ul>
4953 *
4954 * @param targetPackage The installed package whose installer will be changed.
4955 * @param installerPackageName The package name of the new installer. May be
4956 * null to clear the association.
4957 */
4958 public abstract void setInstallerPackageName(String targetPackage,
4959 String installerPackageName);
4960
Todd Kennedyab532892017-03-08 14:19:49 -08004961 /** @hide */
4962 @SystemApi
4963 @RequiresPermission(Manifest.permission.INSTALL_PACKAGES)
4964 public abstract void setUpdateAvailable(String packageName, boolean updateAvaialble);
4965
Dianne Hackborn880119b2010-11-18 22:26:40 -08004966 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07004967 * Attempts to delete a package. Since this may take a little while, the
4968 * result will be posted back to the given observer. A deletion will fail if
4969 * the calling context lacks the
4970 * {@link android.Manifest.permission#DELETE_PACKAGES} permission, if the
4971 * named package cannot be found, or if the named package is a system
4972 * package.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004973 *
4974 * @param packageName The name of the package to delete
Jeff Sharkey5aa86932016-01-08 19:07:49 -07004975 * @param observer An observer callback to get notified when the package
4976 * deletion is complete.
4977 * {@link android.content.pm.IPackageDeleteObserver#packageDeleted}
4978 * will be called when that happens. observer may be null to
4979 * indicate that no callback is desired.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004980 * @hide
4981 */
Svet Ganov67882122016-12-11 16:36:34 -08004982 @RequiresPermission(Manifest.permission.DELETE_PACKAGES)
Jeff Sharkey5aa86932016-01-08 19:07:49 -07004983 public abstract void deletePackage(String packageName, IPackageDeleteObserver observer,
4984 @DeleteFlags int flags);
Jacek Surazski65e13172009-04-28 15:26:38 +02004985
4986 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07004987 * Attempts to delete a package. Since this may take a little while, the
4988 * result will be posted back to the given observer. A deletion will fail if
4989 * the named package cannot be found, or if the named package is a system
4990 * package.
Nicolas Prevot9a80e532015-09-23 15:49:28 +01004991 *
4992 * @param packageName The name of the package to delete
Jeff Sharkey5aa86932016-01-08 19:07:49 -07004993 * @param observer An observer callback to get notified when the package
4994 * deletion is complete.
4995 * {@link android.content.pm.IPackageDeleteObserver#packageDeleted}
4996 * will be called when that happens. observer may be null to
4997 * indicate that no callback is desired.
Nicolas Prevot9a80e532015-09-23 15:49:28 +01004998 * @param userId The user Id
Nicolas Prevot9a80e532015-09-23 15:49:28 +01004999 * @hide
5000 */
Svet Ganov67882122016-12-11 16:36:34 -08005001 @RequiresPermission(anyOf = {
Nicolas Prevot9a80e532015-09-23 15:49:28 +01005002 Manifest.permission.DELETE_PACKAGES,
5003 Manifest.permission.INTERACT_ACROSS_USERS_FULL})
Svet Ganov67882122016-12-11 16:36:34 -08005004 public abstract void deletePackageAsUser(@NonNull String packageName,
5005 IPackageDeleteObserver observer, @DeleteFlags int flags, @UserIdInt int userId);
Nicolas Prevot9a80e532015-09-23 15:49:28 +01005006
5007 /**
Jacek Surazski65e13172009-04-28 15:26:38 +02005008 * Retrieve the package name of the application that installed a package. This identifies
5009 * which market the package came from.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005010 *
Jacek Surazski65e13172009-04-28 15:26:38 +02005011 * @param packageName The name of the package to query
5012 */
5013 public abstract String getInstallerPackageName(String packageName);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005014
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005015 /**
5016 * Attempts to clear the user data directory of an application.
5017 * Since this may take a little while, the result will
5018 * be posted back to the given observer. A deletion will fail if the
5019 * named package cannot be found, or if the named package is a "system package".
5020 *
5021 * @param packageName The name of the package
5022 * @param observer An observer callback to get notified when the operation is finished
5023 * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)}
5024 * will be called when that happens. observer may be null to indicate that
5025 * no callback is desired.
5026 *
5027 * @hide
5028 */
5029 public abstract void clearApplicationUserData(String packageName,
5030 IPackageDataObserver observer);
5031 /**
5032 * Attempts to delete the cache files associated with an application.
5033 * Since this may take a little while, the result will
5034 * be posted back to the given observer. A deletion will fail if the calling context
5035 * lacks the {@link android.Manifest.permission#DELETE_CACHE_FILES} permission, if the
5036 * named package cannot be found, or if the named package is a "system package".
5037 *
5038 * @param packageName The name of the package to delete
5039 * @param observer An observer callback to get notified when the cache file deletion
5040 * is complete.
5041 * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)}
5042 * will be called when that happens. observer may be null to indicate that
5043 * no callback is desired.
5044 *
5045 * @hide
5046 */
5047 public abstract void deleteApplicationCacheFiles(String packageName,
5048 IPackageDataObserver observer);
5049
5050 /**
Suprabh Shukla78c9eb82016-04-12 15:51:35 -07005051 * Attempts to delete the cache files associated with an application for a given user. Since
5052 * this may take a little while, the result will be posted back to the given observer. A
5053 * deletion will fail if the calling context lacks the
5054 * {@link android.Manifest.permission#DELETE_CACHE_FILES} permission, if the named package
5055 * cannot be found, or if the named package is a "system package". If {@code userId} does not
5056 * belong to the calling user, the caller must have
5057 * {@link android.Manifest.permission#INTERACT_ACROSS_USERS} permission.
5058 *
5059 * @param packageName The name of the package to delete
5060 * @param userId the user for which the cache files needs to be deleted
5061 * @param observer An observer callback to get notified when the cache file deletion is
5062 * complete.
5063 * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)}
5064 * will be called when that happens. observer may be null to indicate that no
5065 * callback is desired.
5066 * @hide
5067 */
5068 public abstract void deleteApplicationCacheFilesAsUser(String packageName, int userId,
5069 IPackageDataObserver observer);
5070
5071 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005072 * Free storage by deleting LRU sorted list of cache files across
5073 * all applications. If the currently available free storage
5074 * on the device is greater than or equal to the requested
5075 * free storage, no cache files are cleared. If the currently
5076 * available storage on the device is less than the requested
5077 * free storage, some or all of the cache files across
5078 * all applications are deleted (based on last accessed time)
5079 * to increase the free storage space on the device to
5080 * the requested value. There is no guarantee that clearing all
5081 * the cache files from all applications will clear up
5082 * enough storage to achieve the desired value.
5083 * @param freeStorageSize The number of bytes of storage to be
5084 * freed by the system. Say if freeStorageSize is XX,
5085 * and the current free storage is YY,
5086 * if XX is less than YY, just return. if not free XX-YY number
5087 * of bytes if possible.
5088 * @param observer call back used to notify when
5089 * the operation is completed
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005090 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005091 * @hide
5092 */
Jeff Sharkey529f91f2015-04-18 20:23:13 -07005093 public void freeStorageAndNotify(long freeStorageSize, IPackageDataObserver observer) {
5094 freeStorageAndNotify(null, freeStorageSize, observer);
5095 }
5096
5097 /** {@hide} */
5098 public abstract void freeStorageAndNotify(String volumeUuid, long freeStorageSize,
5099 IPackageDataObserver observer);
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -07005100
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005101 /**
5102 * Free storage by deleting LRU sorted list of cache files across
5103 * all applications. If the currently available free storage
5104 * on the device is greater than or equal to the requested
5105 * free storage, no cache files are cleared. If the currently
5106 * available storage on the device is less than the requested
5107 * free storage, some or all of the cache files across
5108 * all applications are deleted (based on last accessed time)
5109 * to increase the free storage space on the device to
5110 * the requested value. There is no guarantee that clearing all
5111 * the cache files from all applications will clear up
5112 * enough storage to achieve the desired value.
5113 * @param freeStorageSize The number of bytes of storage to be
5114 * freed by the system. Say if freeStorageSize is XX,
5115 * and the current free storage is YY,
5116 * if XX is less than YY, just return. if not free XX-YY number
5117 * of bytes if possible.
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -07005118 * @param pi IntentSender call back used to
5119 * notify when the operation is completed.May be null
5120 * to indicate that no call back is desired.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005121 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005122 * @hide
5123 */
Jeff Sharkey529f91f2015-04-18 20:23:13 -07005124 public void freeStorage(long freeStorageSize, IntentSender pi) {
5125 freeStorage(null, freeStorageSize, pi);
5126 }
5127
5128 /** {@hide} */
5129 public abstract void freeStorage(String volumeUuid, long freeStorageSize, IntentSender pi);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005130
5131 /**
5132 * Retrieve the size information for a package.
5133 * Since this may take a little while, the result will
5134 * be posted back to the given observer. The calling context
5135 * should have the {@link android.Manifest.permission#GET_PACKAGE_SIZE} permission.
5136 *
5137 * @param packageName The name of the package whose size information is to be retrieved
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07005138 * @param userId The user whose size information should be retrieved.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005139 * @param observer An observer callback to get notified when the operation
5140 * is complete.
5141 * {@link android.content.pm.IPackageStatsObserver#onGetStatsCompleted(PackageStats, boolean)}
5142 * The observer's callback is invoked with a PackageStats object(containing the
5143 * code, data and cache sizes of the package) and a boolean value representing
5144 * the status of the operation. observer may be null to indicate that
5145 * no callback is desired.
5146 *
Jeff Sharkey60f95aa2017-03-08 13:57:15 -07005147 * @deprecated use {@link StorageStatsManager} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005148 * @hide
5149 */
Jeff Sharkey60f95aa2017-03-08 13:57:15 -07005150 @Deprecated
Jeff Sharkey8588bc12016-01-06 16:47:42 -07005151 public abstract void getPackageSizeInfoAsUser(String packageName, @UserIdInt int userId,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005152 IPackageStatsObserver observer);
5153
5154 /**
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07005155 * Like {@link #getPackageSizeInfoAsUser(String, int, IPackageStatsObserver)}, but
Dianne Hackborn0c380492012-08-20 17:23:30 -07005156 * returns the size for the calling user.
5157 *
Jeff Sharkey60f95aa2017-03-08 13:57:15 -07005158 * @deprecated use {@link StorageStatsManager} instead.
Dianne Hackborn0c380492012-08-20 17:23:30 -07005159 * @hide
5160 */
Jeff Sharkey60f95aa2017-03-08 13:57:15 -07005161 @Deprecated
Dianne Hackborn0c380492012-08-20 17:23:30 -07005162 public void getPackageSizeInfo(String packageName, IPackageStatsObserver observer) {
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07005163 getPackageSizeInfoAsUser(packageName, UserHandle.myUserId(), observer);
Dianne Hackborn0c380492012-08-20 17:23:30 -07005164 }
5165
5166 /**
Dianne Hackborna7ca0e52009-12-01 14:31:55 -08005167 * @deprecated This function no longer does anything; it was an old
kmccormickac66b852013-03-28 15:17:15 -07005168 * approach to managing preferred activities, which has been superseded
5169 * by (and conflicts with) the modern activity-based preferences.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005170 */
Dianne Hackborna7ca0e52009-12-01 14:31:55 -08005171 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005172 public abstract void addPackageToPreferred(String packageName);
5173
5174 /**
Dianne Hackborna7ca0e52009-12-01 14:31:55 -08005175 * @deprecated This function no longer does anything; it was an old
kmccormickac66b852013-03-28 15:17:15 -07005176 * approach to managing preferred activities, which has been superseded
5177 * by (and conflicts with) the modern activity-based preferences.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005178 */
Dianne Hackborna7ca0e52009-12-01 14:31:55 -08005179 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005180 public abstract void removePackageFromPreferred(String packageName);
5181
5182 /**
Jeff Sharkey4347f812017-04-21 12:08:39 -06005183 * Retrieve the list of all currently configured preferred packages. The
5184 * first package on the list is the most preferred, the last is the least
5185 * preferred.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005186 *
Jeff Sharkey4347f812017-04-21 12:08:39 -06005187 * @param flags Additional option flags to modify the data returned.
5188 * @return A List of PackageInfo objects, one for each preferred
5189 * application, in order of preference.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005190 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07005191 public abstract List<PackageInfo> getPreferredPackages(@PackageInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005192
5193 /**
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08005194 * @deprecated This is a protected API that should not have been available
5195 * to third party applications. It is the platform's responsibility for
kmccormick30498b42013-03-27 17:39:17 -07005196 * assigning preferred activities and this cannot be directly modified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005197 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005198 * Add a new preferred activity mapping to the system. This will be used
5199 * to automatically select the given activity component when
5200 * {@link Context#startActivity(Intent) Context.startActivity()} finds
5201 * multiple matching activities and also matches the given filter.
5202 *
5203 * @param filter The set of intents under which this activity will be
5204 * made preferred.
5205 * @param match The IntentFilter match category that this preference
5206 * applies to.
5207 * @param set The set of activities that the user was picking from when
5208 * this preference was made.
5209 * @param activity The component name of the activity that is to be
5210 * preferred.
5211 */
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08005212 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005213 public abstract void addPreferredActivity(IntentFilter filter, int match,
5214 ComponentName[] set, ComponentName activity);
5215
5216 /**
Amith Yamasania3f133a2012-08-09 17:11:28 -07005217 * Same as {@link #addPreferredActivity(IntentFilter, int,
5218 ComponentName[], ComponentName)}, but with a specific userId to apply the preference
5219 to.
5220 * @hide
5221 */
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07005222 public void addPreferredActivityAsUser(IntentFilter filter, int match,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07005223 ComponentName[] set, ComponentName activity, @UserIdInt int userId) {
Amith Yamasania3f133a2012-08-09 17:11:28 -07005224 throw new RuntimeException("Not implemented. Must override in a subclass.");
5225 }
5226
5227 /**
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08005228 * @deprecated This is a protected API that should not have been available
5229 * to third party applications. It is the platform's responsibility for
kmccormick30498b42013-03-27 17:39:17 -07005230 * assigning preferred activities and this cannot be directly modified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005231 *
Satish Sampath8dbe6122009-06-02 23:35:54 +01005232 * Replaces an existing preferred activity mapping to the system, and if that were not present
5233 * adds a new preferred activity. This will be used
5234 * to automatically select the given activity component when
5235 * {@link Context#startActivity(Intent) Context.startActivity()} finds
5236 * multiple matching activities and also matches the given filter.
5237 *
5238 * @param filter The set of intents under which this activity will be
5239 * made preferred.
5240 * @param match The IntentFilter match category that this preference
5241 * applies to.
5242 * @param set The set of activities that the user was picking from when
5243 * this preference was made.
5244 * @param activity The component name of the activity that is to be
5245 * preferred.
5246 * @hide
5247 */
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08005248 @Deprecated
Satish Sampath8dbe6122009-06-02 23:35:54 +01005249 public abstract void replacePreferredActivity(IntentFilter filter, int match,
5250 ComponentName[] set, ComponentName activity);
5251
5252 /**
Amith Yamasani41c1ded2014-08-05 11:15:05 -07005253 * @hide
5254 */
5255 @Deprecated
5256 public void replacePreferredActivityAsUser(IntentFilter filter, int match,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07005257 ComponentName[] set, ComponentName activity, @UserIdInt int userId) {
Amith Yamasani41c1ded2014-08-05 11:15:05 -07005258 throw new RuntimeException("Not implemented. Must override in a subclass.");
5259 }
5260
5261 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005262 * Remove all preferred activity mappings, previously added with
5263 * {@link #addPreferredActivity}, from the
5264 * system whose activities are implemented in the given package name.
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08005265 * An application can only clear its own package(s).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005266 *
5267 * @param packageName The name of the package whose preferred activity
5268 * mappings are to be removed.
5269 */
5270 public abstract void clearPackagePreferredActivities(String packageName);
5271
5272 /**
5273 * Retrieve all preferred activities, previously added with
5274 * {@link #addPreferredActivity}, that are
5275 * currently registered with the system.
5276 *
John Spurlock38e64252015-03-18 12:09:32 -04005277 * @param outFilters A required list in which to place the filters of all of the
5278 * preferred activities.
5279 * @param outActivities A required list in which to place the component names of
5280 * all of the preferred activities.
5281 * @param packageName An optional package in which you would like to limit
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005282 * the list. If null, all activities will be returned; if non-null, only
5283 * those activities in the given package are returned.
5284 *
5285 * @return Returns the total number of registered preferred activities
5286 * (the number of distinct IntentFilter records, not the number of unique
5287 * activity components) that were found.
5288 */
John Spurlock38e64252015-03-18 12:09:32 -04005289 public abstract int getPreferredActivities(@NonNull List<IntentFilter> outFilters,
5290 @NonNull List<ComponentName> outActivities, String packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005291
5292 /**
Christopher Tatea2a0850d2013-09-05 16:38:58 -07005293 * Ask for the set of available 'home' activities and the current explicit
5294 * default, if any.
5295 * @hide
5296 */
5297 public abstract ComponentName getHomeActivities(List<ResolveInfo> outActivities);
5298
5299 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005300 * Set the enabled setting for a package component (activity, receiver, service, provider).
5301 * This setting will override any enabled state which may have been set by the component in its
5302 * manifest.
5303 *
5304 * @param componentName The component to enable
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06005305 * @param newState The new enabled state for the component.
5306 * @param flags Optional behavior flags.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005307 */
5308 public abstract void setComponentEnabledSetting(ComponentName componentName,
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06005309 @EnabledState int newState, @EnabledFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005310
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005311 /**
Amaury Medeirosdde24262014-06-03 20:06:41 -03005312 * Return the enabled setting for a package component (activity,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005313 * receiver, service, provider). This returns the last value set by
5314 * {@link #setComponentEnabledSetting(ComponentName, int, int)}; in most
5315 * cases this value will be {@link #COMPONENT_ENABLED_STATE_DEFAULT} since
5316 * the value originally specified in the manifest has not been modified.
5317 *
5318 * @param componentName The component to retrieve.
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06005319 * @return Returns the current enabled state for the component.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005320 */
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06005321 public abstract @EnabledState int getComponentEnabledSetting(
5322 ComponentName componentName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005323
5324 /**
5325 * Set the enabled setting for an application
5326 * This setting will override any enabled state which may have been set by the application in
5327 * its manifest. It also overrides the enabled state set in the manifest for any of the
5328 * application's components. It does not override any enabled state set by
5329 * {@link #setComponentEnabledSetting} for any of the application's components.
5330 *
5331 * @param packageName The package name of the application to enable
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06005332 * @param newState The new enabled state for the application.
5333 * @param flags Optional behavior flags.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005334 */
5335 public abstract void setApplicationEnabledSetting(String packageName,
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06005336 @EnabledState int newState, @EnabledFlags int flags);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005337
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005338 /**
Amaury Medeirosdde24262014-06-03 20:06:41 -03005339 * Return the enabled setting for an application. This returns
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005340 * the last value set by
5341 * {@link #setApplicationEnabledSetting(String, int, int)}; in most
5342 * cases this value will be {@link #COMPONENT_ENABLED_STATE_DEFAULT} since
5343 * the value originally specified in the manifest has not been modified.
5344 *
Amaury Medeirosdde24262014-06-03 20:06:41 -03005345 * @param packageName The package name of the application to retrieve.
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06005346 * @return Returns the current enabled state for the application.
Mathew Inwood1b9f8d92011-09-26 13:23:56 +01005347 * @throws IllegalArgumentException if the named package does not exist.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005348 */
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06005349 public abstract @EnabledState int getApplicationEnabledSetting(String packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005350
5351 /**
Sudheer Shankabbb3ff22015-07-09 15:39:23 +01005352 * Flush the package restrictions for a given user to disk. This forces the package restrictions
5353 * like component and package enabled settings to be written to disk and avoids the delay that
5354 * is otherwise present when changing those settings.
5355 *
5356 * @param userId Ther userId of the user whose restrictions are to be flushed.
5357 * @hide
5358 */
5359 public abstract void flushPackageRestrictionsAsUser(int userId);
5360
5361 /**
Amith Yamasanie5bcff62014-07-19 15:44:09 -07005362 * Puts the package in a hidden state, which is almost like an uninstalled state,
Amith Yamasani655d0e22013-06-12 14:19:10 -07005363 * making the package unavailable, but it doesn't remove the data or the actual
Amith Yamasanie5bcff62014-07-19 15:44:09 -07005364 * package file. Application can be unhidden by either resetting the hidden state
5365 * or by installing it, such as with {@link #installExistingPackage(String)}
Amith Yamasani655d0e22013-06-12 14:19:10 -07005366 * @hide
5367 */
Amith Yamasanie5bcff62014-07-19 15:44:09 -07005368 public abstract boolean setApplicationHiddenSettingAsUser(String packageName, boolean hidden,
Amith Yamasani655d0e22013-06-12 14:19:10 -07005369 UserHandle userHandle);
5370
5371 /**
Amith Yamasanie5bcff62014-07-19 15:44:09 -07005372 * Returns the hidden state of a package.
5373 * @see #setApplicationHiddenSettingAsUser(String, boolean, UserHandle)
Amith Yamasani655d0e22013-06-12 14:19:10 -07005374 * @hide
5375 */
Amith Yamasanie5bcff62014-07-19 15:44:09 -07005376 public abstract boolean getApplicationHiddenSettingAsUser(String packageName,
Amith Yamasani655d0e22013-06-12 14:19:10 -07005377 UserHandle userHandle);
5378
5379 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005380 * Return whether the device has been booted into safe mode.
5381 */
5382 public abstract boolean isSafeMode();
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08005383
5384 /**
Svetoslavf7c06eb2015-06-10 18:43:22 -07005385 * Adds a listener for permission changes for installed packages.
5386 *
5387 * @param listener The listener to add.
5388 *
5389 * @hide
5390 */
5391 @SystemApi
5392 @RequiresPermission(Manifest.permission.OBSERVE_GRANT_REVOKE_PERMISSIONS)
5393 public abstract void addOnPermissionsChangeListener(OnPermissionsChangedListener listener);
5394
5395 /**
5396 * Remvoes a listener for permission changes for installed packages.
5397 *
5398 * @param listener The listener to remove.
5399 *
5400 * @hide
5401 */
5402 @SystemApi
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06005403 @RequiresPermission(Manifest.permission.OBSERVE_GRANT_REVOKE_PERMISSIONS)
Svetoslavf7c06eb2015-06-10 18:43:22 -07005404 public abstract void removeOnPermissionsChangeListener(OnPermissionsChangedListener listener);
5405
5406 /**
dcashman9d2f4412014-06-09 09:27:54 -07005407 * Return the {@link KeySet} associated with the String alias for this
5408 * application.
5409 *
5410 * @param alias The alias for a given {@link KeySet} as defined in the
5411 * application's AndroidManifest.xml.
dcashmanc6f22492014-08-14 09:54:51 -07005412 * @hide
dcashman9d2f4412014-06-09 09:27:54 -07005413 */
5414 public abstract KeySet getKeySetByAlias(String packageName, String alias);
5415
Ihab Awad1ec68882014-09-12 11:09:01 -07005416 /** Return the signing {@link KeySet} for this application.
dcashmanc6f22492014-08-14 09:54:51 -07005417 * @hide
5418 */
dcashman9d2f4412014-06-09 09:27:54 -07005419 public abstract KeySet getSigningKeySet(String packageName);
5420
5421 /**
5422 * Return whether the package denoted by packageName has been signed by all
5423 * of the keys specified by the {@link KeySet} ks. This will return true if
5424 * the package has been signed by additional keys (a superset) as well.
5425 * Compare to {@link #isSignedByExactly(String packageName, KeySet ks)}.
dcashmanc6f22492014-08-14 09:54:51 -07005426 * @hide
dcashman9d2f4412014-06-09 09:27:54 -07005427 */
5428 public abstract boolean isSignedBy(String packageName, KeySet ks);
5429
5430 /**
5431 * Return whether the package denoted by packageName has been signed by all
5432 * of, and only, the keys specified by the {@link KeySet} ks. Compare to
5433 * {@link #isSignedBy(String packageName, KeySet ks)}.
dcashmanc6f22492014-08-14 09:54:51 -07005434 * @hide
dcashman9d2f4412014-06-09 09:27:54 -07005435 */
5436 public abstract boolean isSignedByExactly(String packageName, KeySet ks);
5437
5438 /**
Andrei Stingaceanueb84b182016-01-26 18:39:55 +00005439 * Puts the package in a suspended state, where attempts at starting activities are denied.
Andrei Stingaceanu1e283912015-11-26 15:26:28 +00005440 *
Andrei Stingaceanueb84b182016-01-26 18:39:55 +00005441 * <p>It doesn't remove the data or the actual package file. The application notifications
5442 * will be hidden, the application will not show up in recents, will not be able to show
5443 * toasts or dialogs or ring the device.
5444 *
Kenny Guy871f3eb2016-03-09 20:06:16 +00005445 * <p>The package must already be installed. If the package is uninstalled while suspended
5446 * the package will no longer be suspended.
5447 *
Andrei Stingaceanueb84b182016-01-26 18:39:55 +00005448 * @param packageNames The names of the packages to set the suspended status.
5449 * @param suspended If set to {@code true} than the packages will be suspended, if set to
5450 * {@code false} the packages will be unsuspended.
Andrei Stingaceanu1e283912015-11-26 15:26:28 +00005451 * @param userId The user id.
5452 *
Andrei Stingaceanueb84b182016-01-26 18:39:55 +00005453 * @return an array of package names for which the suspended status is not set as requested in
5454 * this method.
5455 *
Andrei Stingaceanu1e283912015-11-26 15:26:28 +00005456 * @hide
5457 */
Andrei Stingaceanueb84b182016-01-26 18:39:55 +00005458 public abstract String[] setPackagesSuspendedAsUser(
5459 String[] packageNames, boolean suspended, @UserIdInt int userId);
Andrei Stingaceanu1e283912015-11-26 15:26:28 +00005460
Andrei Stingaceanu355b2322016-02-12 16:43:51 +00005461 /**
5462 * @see #setPackageSuspendedAsUser(String, boolean, int)
5463 * @param packageName The name of the package to get the suspended status of.
5464 * @param userId The user id.
5465 * @return {@code true} if the package is suspended or {@code false} if the package is not
5466 * suspended or could not be found.
5467 * @hide
5468 */
5469 public abstract boolean isPackageSuspendedForUser(String packageName, int userId);
5470
Jeff Sharkey9bc89af2017-01-11 11:25:50 -07005471 /**
5472 * Provide a hint of what the {@link ApplicationInfo#category} value should
5473 * be for the given package.
5474 * <p>
5475 * This hint can only be set by the app which installed this package, as
5476 * determined by {@link #getInstallerPackageName(String)}.
Jeff Sharkey60a82cd2017-04-18 18:19:16 -06005477 *
5478 * @param packageName the package to change the category hint for.
Jeff Sharkey4347f812017-04-21 12:08:39 -06005479 * @param categoryHint the category hint to set.
Jeff Sharkey9bc89af2017-01-11 11:25:50 -07005480 */
Jeff Sharkey60a82cd2017-04-18 18:19:16 -06005481 public abstract void setApplicationCategoryHint(@NonNull String packageName,
Jeff Sharkey9bc89af2017-01-11 11:25:50 -07005482 @ApplicationInfo.Category int categoryHint);
5483
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -07005484 /** {@hide} */
Jeff Sharkey620b32b2015-04-23 19:36:02 -07005485 public static boolean isMoveStatusFinished(int status) {
5486 return (status < 0 || status > 100);
5487 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005488
Jeff Sharkeye2d45be2015-04-15 17:14:12 -07005489 /** {@hide} */
Jeff Sharkey620b32b2015-04-23 19:36:02 -07005490 public static abstract class MoveCallback {
Jeff Sharkey50a05452015-04-29 11:24:52 -07005491 public void onCreated(int moveId, Bundle extras) {}
5492 public abstract void onStatusChanged(int moveId, int status, long estMillis);
Jeff Sharkey620b32b2015-04-23 19:36:02 -07005493 }
Jeff Sharkeye2d45be2015-04-15 17:14:12 -07005494
5495 /** {@hide} */
Jeff Sharkey620b32b2015-04-23 19:36:02 -07005496 public abstract int getMoveStatus(int moveId);
5497
5498 /** {@hide} */
5499 public abstract void registerMoveCallback(MoveCallback callback, Handler handler);
5500 /** {@hide} */
5501 public abstract void unregisterMoveCallback(MoveCallback callback);
5502
5503 /** {@hide} */
5504 public abstract int movePackage(String packageName, VolumeInfo vol);
5505 /** {@hide} */
5506 public abstract @Nullable VolumeInfo getPackageCurrentVolume(ApplicationInfo app);
5507 /** {@hide} */
5508 public abstract @NonNull List<VolumeInfo> getPackageCandidateVolumes(ApplicationInfo app);
5509
5510 /** {@hide} */
5511 public abstract int movePrimaryStorage(VolumeInfo vol);
5512 /** {@hide} */
5513 public abstract @Nullable VolumeInfo getPrimaryStorageCurrentVolume();
5514 /** {@hide} */
5515 public abstract @NonNull List<VolumeInfo> getPrimaryStorageCandidateVolumes();
Jeff Sharkeye2d45be2015-04-15 17:14:12 -07005516
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005517 /**
Amith Yamasani13593602012-03-22 16:16:17 -07005518 * Returns the device identity that verifiers can use to associate their scheme to a particular
5519 * device. This should not be used by anything other than a package verifier.
Aravind Akella068b0c02013-10-12 17:39:15 -07005520 *
Kenny Root0aaa0d92011-09-12 16:42:55 -07005521 * @return identity that uniquely identifies current device
5522 * @hide
5523 */
5524 public abstract VerifierDeviceIdentity getVerifierDeviceIdentity();
Amith Yamasani742a6712011-05-04 14:49:28 -07005525
Jeff Sharkey6c833e02014-07-14 22:44:30 -07005526 /**
Jeff Hao9f60c082014-10-28 18:51:07 -07005527 * Returns true if the device is upgrading, such as first boot after OTA.
5528 *
5529 * @hide
5530 */
5531 public abstract boolean isUpgrade();
5532
5533 /**
Jeff Sharkey6c833e02014-07-14 22:44:30 -07005534 * Return interface that offers the ability to install, upgrade, and remove
5535 * applications on the device.
5536 */
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005537 public abstract @NonNull PackageInstaller getPackageInstaller();
Jeff Sharkey3a44f3f2014-04-28 17:36:31 -07005538
Amith Yamasani742a6712011-05-04 14:49:28 -07005539 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005540 * Adds a {@code CrossProfileIntentFilter}. After calling this method all
5541 * intents sent from the user with id sourceUserId can also be be resolved
5542 * by activities in the user with id targetUserId if they match the
5543 * specified intent filter.
5544 *
Nicolas Prevot3f7777f2014-07-24 15:58:39 +01005545 * @param filter The {@link IntentFilter} the intent has to match
5546 * @param sourceUserId The source user id.
5547 * @param targetUserId The target user id.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005548 * @param flags The possible values are {@link #SKIP_CURRENT_PROFILE} and
5549 * {@link #ONLY_IF_NO_MATCH_FOUND}.
Nicolas Prevotc79586e2014-05-06 12:47:57 +01005550 * @hide
5551 */
Nicolas Prevot63798c52014-05-27 13:22:38 +01005552 public abstract void addCrossProfileIntentFilter(IntentFilter filter, int sourceUserId,
5553 int targetUserId, int flags);
Nicolas Prevotc79586e2014-05-06 12:47:57 +01005554
5555 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005556 * Clearing {@code CrossProfileIntentFilter}s which have the specified user
5557 * as their source, and have been set by the app calling this method.
5558 *
Nicolas Prevot3f7777f2014-07-24 15:58:39 +01005559 * @param sourceUserId The source user id.
Nicolas Prevotc79586e2014-05-06 12:47:57 +01005560 * @hide
5561 */
Nicolas Prevot81948992014-05-16 18:25:26 +01005562 public abstract void clearCrossProfileIntentFilters(int sourceUserId);
Alexandra Gherghina6e2ae252014-06-12 16:03:58 +01005563
5564 /**
Nicolas Prevot88cc3462014-05-14 14:51:48 +01005565 * @hide
5566 */
Nicolas Prevot7f7b0c72014-06-23 15:59:38 +01005567 public abstract Drawable loadItemIcon(PackageItemInfo itemInfo, ApplicationInfo appInfo);
Jeff Sharkey6c833e02014-07-14 22:44:30 -07005568
Benjamin Franzec2d48b2014-10-01 15:38:43 +01005569 /**
5570 * @hide
5571 */
5572 public abstract Drawable loadUnbadgedItemIcon(PackageItemInfo itemInfo, ApplicationInfo appInfo);
5573
Jeff Sharkey6c833e02014-07-14 22:44:30 -07005574 /** {@hide} */
5575 public abstract boolean isPackageAvailable(String packageName);
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005576
5577 /** {@hide} */
Jeff Sharkeya0907432014-08-15 10:23:11 -07005578 public static String installStatusToString(int status, String msg) {
5579 final String str = installStatusToString(status);
5580 if (msg != null) {
5581 return str + ": " + msg;
5582 } else {
5583 return str;
5584 }
5585 }
5586
5587 /** {@hide} */
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005588 public static String installStatusToString(int status) {
5589 switch (status) {
5590 case INSTALL_SUCCEEDED: return "INSTALL_SUCCEEDED";
5591 case INSTALL_FAILED_ALREADY_EXISTS: return "INSTALL_FAILED_ALREADY_EXISTS";
5592 case INSTALL_FAILED_INVALID_APK: return "INSTALL_FAILED_INVALID_APK";
5593 case INSTALL_FAILED_INVALID_URI: return "INSTALL_FAILED_INVALID_URI";
5594 case INSTALL_FAILED_INSUFFICIENT_STORAGE: return "INSTALL_FAILED_INSUFFICIENT_STORAGE";
5595 case INSTALL_FAILED_DUPLICATE_PACKAGE: return "INSTALL_FAILED_DUPLICATE_PACKAGE";
5596 case INSTALL_FAILED_NO_SHARED_USER: return "INSTALL_FAILED_NO_SHARED_USER";
5597 case INSTALL_FAILED_UPDATE_INCOMPATIBLE: return "INSTALL_FAILED_UPDATE_INCOMPATIBLE";
5598 case INSTALL_FAILED_SHARED_USER_INCOMPATIBLE: return "INSTALL_FAILED_SHARED_USER_INCOMPATIBLE";
5599 case INSTALL_FAILED_MISSING_SHARED_LIBRARY: return "INSTALL_FAILED_MISSING_SHARED_LIBRARY";
5600 case INSTALL_FAILED_REPLACE_COULDNT_DELETE: return "INSTALL_FAILED_REPLACE_COULDNT_DELETE";
5601 case INSTALL_FAILED_DEXOPT: return "INSTALL_FAILED_DEXOPT";
5602 case INSTALL_FAILED_OLDER_SDK: return "INSTALL_FAILED_OLDER_SDK";
5603 case INSTALL_FAILED_CONFLICTING_PROVIDER: return "INSTALL_FAILED_CONFLICTING_PROVIDER";
5604 case INSTALL_FAILED_NEWER_SDK: return "INSTALL_FAILED_NEWER_SDK";
5605 case INSTALL_FAILED_TEST_ONLY: return "INSTALL_FAILED_TEST_ONLY";
5606 case INSTALL_FAILED_CPU_ABI_INCOMPATIBLE: return "INSTALL_FAILED_CPU_ABI_INCOMPATIBLE";
5607 case INSTALL_FAILED_MISSING_FEATURE: return "INSTALL_FAILED_MISSING_FEATURE";
5608 case INSTALL_FAILED_CONTAINER_ERROR: return "INSTALL_FAILED_CONTAINER_ERROR";
5609 case INSTALL_FAILED_INVALID_INSTALL_LOCATION: return "INSTALL_FAILED_INVALID_INSTALL_LOCATION";
5610 case INSTALL_FAILED_MEDIA_UNAVAILABLE: return "INSTALL_FAILED_MEDIA_UNAVAILABLE";
5611 case INSTALL_FAILED_VERIFICATION_TIMEOUT: return "INSTALL_FAILED_VERIFICATION_TIMEOUT";
5612 case INSTALL_FAILED_VERIFICATION_FAILURE: return "INSTALL_FAILED_VERIFICATION_FAILURE";
5613 case INSTALL_FAILED_PACKAGE_CHANGED: return "INSTALL_FAILED_PACKAGE_CHANGED";
5614 case INSTALL_FAILED_UID_CHANGED: return "INSTALL_FAILED_UID_CHANGED";
5615 case INSTALL_FAILED_VERSION_DOWNGRADE: return "INSTALL_FAILED_VERSION_DOWNGRADE";
5616 case INSTALL_PARSE_FAILED_NOT_APK: return "INSTALL_PARSE_FAILED_NOT_APK";
5617 case INSTALL_PARSE_FAILED_BAD_MANIFEST: return "INSTALL_PARSE_FAILED_BAD_MANIFEST";
5618 case INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION: return "INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION";
5619 case INSTALL_PARSE_FAILED_NO_CERTIFICATES: return "INSTALL_PARSE_FAILED_NO_CERTIFICATES";
5620 case INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES: return "INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES";
5621 case INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING: return "INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING";
5622 case INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME: return "INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME";
5623 case INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID: return "INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID";
5624 case INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: return "INSTALL_PARSE_FAILED_MANIFEST_MALFORMED";
5625 case INSTALL_PARSE_FAILED_MANIFEST_EMPTY: return "INSTALL_PARSE_FAILED_MANIFEST_EMPTY";
5626 case INSTALL_FAILED_INTERNAL_ERROR: return "INSTALL_FAILED_INTERNAL_ERROR";
5627 case INSTALL_FAILED_USER_RESTRICTED: return "INSTALL_FAILED_USER_RESTRICTED";
5628 case INSTALL_FAILED_DUPLICATE_PERMISSION: return "INSTALL_FAILED_DUPLICATE_PERMISSION";
5629 case INSTALL_FAILED_NO_MATCHING_ABIS: return "INSTALL_FAILED_NO_MATCHING_ABIS";
Jeff Sharkeyf0600952014-08-07 17:31:53 -07005630 case INSTALL_FAILED_ABORTED: return "INSTALL_FAILED_ABORTED";
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005631 default: return Integer.toString(status);
5632 }
5633 }
5634
5635 /** {@hide} */
Jeff Sharkeya0907432014-08-15 10:23:11 -07005636 public static int installStatusToPublicStatus(int status) {
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005637 switch (status) {
Jeff Sharkeya0907432014-08-15 10:23:11 -07005638 case INSTALL_SUCCEEDED: return PackageInstaller.STATUS_SUCCESS;
5639 case INSTALL_FAILED_ALREADY_EXISTS: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5640 case INSTALL_FAILED_INVALID_APK: return PackageInstaller.STATUS_FAILURE_INVALID;
5641 case INSTALL_FAILED_INVALID_URI: return PackageInstaller.STATUS_FAILURE_INVALID;
5642 case INSTALL_FAILED_INSUFFICIENT_STORAGE: return PackageInstaller.STATUS_FAILURE_STORAGE;
5643 case INSTALL_FAILED_DUPLICATE_PACKAGE: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5644 case INSTALL_FAILED_NO_SHARED_USER: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5645 case INSTALL_FAILED_UPDATE_INCOMPATIBLE: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5646 case INSTALL_FAILED_SHARED_USER_INCOMPATIBLE: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5647 case INSTALL_FAILED_MISSING_SHARED_LIBRARY: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5648 case INSTALL_FAILED_REPLACE_COULDNT_DELETE: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5649 case INSTALL_FAILED_DEXOPT: return PackageInstaller.STATUS_FAILURE_INVALID;
5650 case INSTALL_FAILED_OLDER_SDK: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5651 case INSTALL_FAILED_CONFLICTING_PROVIDER: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5652 case INSTALL_FAILED_NEWER_SDK: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5653 case INSTALL_FAILED_TEST_ONLY: return PackageInstaller.STATUS_FAILURE_INVALID;
5654 case INSTALL_FAILED_CPU_ABI_INCOMPATIBLE: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5655 case INSTALL_FAILED_MISSING_FEATURE: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5656 case INSTALL_FAILED_CONTAINER_ERROR: return PackageInstaller.STATUS_FAILURE_STORAGE;
5657 case INSTALL_FAILED_INVALID_INSTALL_LOCATION: return PackageInstaller.STATUS_FAILURE_STORAGE;
5658 case INSTALL_FAILED_MEDIA_UNAVAILABLE: return PackageInstaller.STATUS_FAILURE_STORAGE;
5659 case INSTALL_FAILED_VERIFICATION_TIMEOUT: return PackageInstaller.STATUS_FAILURE_ABORTED;
5660 case INSTALL_FAILED_VERIFICATION_FAILURE: return PackageInstaller.STATUS_FAILURE_ABORTED;
5661 case INSTALL_FAILED_PACKAGE_CHANGED: return PackageInstaller.STATUS_FAILURE_INVALID;
5662 case INSTALL_FAILED_UID_CHANGED: return PackageInstaller.STATUS_FAILURE_INVALID;
5663 case INSTALL_FAILED_VERSION_DOWNGRADE: return PackageInstaller.STATUS_FAILURE_INVALID;
Svetoslavd9653702015-05-13 18:02:46 -07005664 case INSTALL_FAILED_PERMISSION_MODEL_DOWNGRADE: return PackageInstaller.STATUS_FAILURE_INVALID;
Jeff Sharkeya0907432014-08-15 10:23:11 -07005665 case INSTALL_PARSE_FAILED_NOT_APK: return PackageInstaller.STATUS_FAILURE_INVALID;
5666 case INSTALL_PARSE_FAILED_BAD_MANIFEST: return PackageInstaller.STATUS_FAILURE_INVALID;
5667 case INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION: return PackageInstaller.STATUS_FAILURE_INVALID;
5668 case INSTALL_PARSE_FAILED_NO_CERTIFICATES: return PackageInstaller.STATUS_FAILURE_INVALID;
5669 case INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES: return PackageInstaller.STATUS_FAILURE_INVALID;
5670 case INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING: return PackageInstaller.STATUS_FAILURE_INVALID;
5671 case INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME: return PackageInstaller.STATUS_FAILURE_INVALID;
5672 case INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID: return PackageInstaller.STATUS_FAILURE_INVALID;
5673 case INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: return PackageInstaller.STATUS_FAILURE_INVALID;
5674 case INSTALL_PARSE_FAILED_MANIFEST_EMPTY: return PackageInstaller.STATUS_FAILURE_INVALID;
5675 case INSTALL_FAILED_INTERNAL_ERROR: return PackageInstaller.STATUS_FAILURE;
5676 case INSTALL_FAILED_USER_RESTRICTED: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5677 case INSTALL_FAILED_DUPLICATE_PERMISSION: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5678 case INSTALL_FAILED_NO_MATCHING_ABIS: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5679 case INSTALL_FAILED_ABORTED: return PackageInstaller.STATUS_FAILURE_ABORTED;
5680 default: return PackageInstaller.STATUS_FAILURE;
5681 }
5682 }
5683
5684 /** {@hide} */
5685 public static String deleteStatusToString(int status, String msg) {
5686 final String str = deleteStatusToString(status);
5687 if (msg != null) {
5688 return str + ": " + msg;
5689 } else {
5690 return str;
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005691 }
5692 }
5693
5694 /** {@hide} */
5695 public static String deleteStatusToString(int status) {
5696 switch (status) {
5697 case DELETE_SUCCEEDED: return "DELETE_SUCCEEDED";
5698 case DELETE_FAILED_INTERNAL_ERROR: return "DELETE_FAILED_INTERNAL_ERROR";
5699 case DELETE_FAILED_DEVICE_POLICY_MANAGER: return "DELETE_FAILED_DEVICE_POLICY_MANAGER";
5700 case DELETE_FAILED_USER_RESTRICTED: return "DELETE_FAILED_USER_RESTRICTED";
5701 case DELETE_FAILED_OWNER_BLOCKED: return "DELETE_FAILED_OWNER_BLOCKED";
Jeff Sharkeyf0600952014-08-07 17:31:53 -07005702 case DELETE_FAILED_ABORTED: return "DELETE_FAILED_ABORTED";
Svet Ganov67882122016-12-11 16:36:34 -08005703 case DELETE_FAILED_USED_SHARED_LIBRARY: return "DELETE_FAILED_USED_SHARED_LIBRARY";
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005704 default: return Integer.toString(status);
5705 }
5706 }
Jeff Sharkeyf0600952014-08-07 17:31:53 -07005707
5708 /** {@hide} */
Jeff Sharkeya0907432014-08-15 10:23:11 -07005709 public static int deleteStatusToPublicStatus(int status) {
Jeff Sharkeyf0600952014-08-07 17:31:53 -07005710 switch (status) {
Jeff Sharkeya0907432014-08-15 10:23:11 -07005711 case DELETE_SUCCEEDED: return PackageInstaller.STATUS_SUCCESS;
5712 case DELETE_FAILED_INTERNAL_ERROR: return PackageInstaller.STATUS_FAILURE;
5713 case DELETE_FAILED_DEVICE_POLICY_MANAGER: return PackageInstaller.STATUS_FAILURE_BLOCKED;
5714 case DELETE_FAILED_USER_RESTRICTED: return PackageInstaller.STATUS_FAILURE_BLOCKED;
5715 case DELETE_FAILED_OWNER_BLOCKED: return PackageInstaller.STATUS_FAILURE_BLOCKED;
5716 case DELETE_FAILED_ABORTED: return PackageInstaller.STATUS_FAILURE_ABORTED;
Svet Ganov67882122016-12-11 16:36:34 -08005717 case DELETE_FAILED_USED_SHARED_LIBRARY: return PackageInstaller.STATUS_FAILURE_CONFLICT;
Jeff Sharkeya0907432014-08-15 10:23:11 -07005718 default: return PackageInstaller.STATUS_FAILURE;
Jeff Sharkeyf0600952014-08-07 17:31:53 -07005719 }
5720 }
Jeff Sharkey6c0b9da2014-08-07 22:07:11 -07005721
5722 /** {@hide} */
Svet Ganov77ab6a82015-07-03 12:03:02 -07005723 public static String permissionFlagToString(int flag) {
5724 switch (flag) {
Svetoslav4a5f4a22015-07-07 18:18:15 -07005725 case FLAG_PERMISSION_GRANTED_BY_DEFAULT: return "GRANTED_BY_DEFAULT";
5726 case FLAG_PERMISSION_POLICY_FIXED: return "POLICY_FIXED";
5727 case FLAG_PERMISSION_SYSTEM_FIXED: return "SYSTEM_FIXED";
5728 case FLAG_PERMISSION_USER_SET: return "USER_SET";
5729 case FLAG_PERMISSION_REVOKE_ON_UPGRADE: return "REVOKE_ON_UPGRADE";
5730 case FLAG_PERMISSION_USER_FIXED: return "USER_FIXED";
Svet Ganov9c165d72015-12-01 19:52:26 -08005731 case FLAG_PERMISSION_REVIEW_REQUIRED: return "REVIEW_REQUIRED";
Svet Ganov77ab6a82015-07-03 12:03:02 -07005732 default: return Integer.toString(flag);
5733 }
5734 }
5735
5736 /** {@hide} */
Jeff Sharkey6c0b9da2014-08-07 22:07:11 -07005737 public static class LegacyPackageDeleteObserver extends PackageDeleteObserver {
5738 private final IPackageDeleteObserver mLegacy;
5739
5740 public LegacyPackageDeleteObserver(IPackageDeleteObserver legacy) {
5741 mLegacy = legacy;
5742 }
5743
5744 @Override
5745 public void onPackageDeleted(String basePackageName, int returnCode, String msg) {
5746 if (mLegacy == null) return;
5747 try {
5748 mLegacy.packageDeleted(basePackageName, returnCode);
5749 } catch (RemoteException ignored) {
5750 }
5751 }
5752 }
Bartosz Fabianowskia34f53f2017-01-11 18:08:47 +01005753
5754 /**
Jeff Sharkey4347f812017-04-21 12:08:39 -06005755 * Return the install reason that was recorded when a package was first
5756 * installed for a specific user. Requesting the install reason for another
5757 * user will require the permission INTERACT_ACROSS_USERS_FULL.
Bartosz Fabianowskia34f53f2017-01-11 18:08:47 +01005758 *
5759 * @param packageName The package for which to retrieve the install reason
5760 * @param user The user for whom to retrieve the install reason
Jeff Sharkey4347f812017-04-21 12:08:39 -06005761 * @return The install reason. If the package is not installed for the given
5762 * user, {@code INSTALL_REASON_UNKNOWN} is returned.
Bartosz Fabianowskia34f53f2017-01-11 18:08:47 +01005763 * @hide
5764 */
5765 @TestApi
5766 public abstract @InstallReason int getInstallReason(String packageName,
5767 @NonNull UserHandle user);
Suprabh Shuklaaef25132017-01-23 18:09:03 -08005768
5769 /**
5770 * Checks whether the calling package is allowed to request package installs through package
Suprabh Shukla57528472017-04-14 19:22:45 -07005771 * installer. Apps are encouraged to call this API before launching the package installer via
Suprabh Shuklaaef25132017-01-23 18:09:03 -08005772 * intent {@link android.content.Intent#ACTION_INSTALL_PACKAGE}. Starting from Android O, the
5773 * user can explicitly choose what external sources they trust to install apps on the device.
Suprabh Shukla57528472017-04-14 19:22:45 -07005774 * If this API returns false, the install request will be blocked by the package installer and
Suprabh Shuklaaef25132017-01-23 18:09:03 -08005775 * a dialog will be shown to the user with an option to launch settings to change their
5776 * preference. An application must target Android O or higher and declare permission
Suprabh Shukla57528472017-04-14 19:22:45 -07005777 * {@link android.Manifest.permission#REQUEST_INSTALL_PACKAGES} in order to use this API.
Suprabh Shuklaaef25132017-01-23 18:09:03 -08005778 *
5779 * @return true if the calling package is trusted by the user to request install packages on
5780 * the device, false otherwise.
Suprabh Shukla57528472017-04-14 19:22:45 -07005781 * @see android.content.Intent#ACTION_INSTALL_PACKAGE
5782 * @see android.provider.Settings#ACTION_MANAGE_UNKNOWN_APP_SOURCES
Suprabh Shuklaaef25132017-01-23 18:09:03 -08005783 */
5784 public abstract boolean canRequestPackageInstalls();
Chad Brubakeraa49cb82017-03-24 15:53:09 -07005785
5786 /**
5787 * Return the {@link ComponentName} of the activity providing Settings for the Instant App
5788 * resolver.
5789 *
Todd Kennedy801e6592017-04-12 14:10:12 -07005790 * @see {@link android.content.Intent#ACTION_INSTANT_APP_RESOLVER_SETTINGS}
Chad Brubakeraa49cb82017-03-24 15:53:09 -07005791 * @hide
5792 */
5793 @SystemApi
5794 public abstract ComponentName getInstantAppResolverSettingsComponent();
Todd Kennedy801e6592017-04-12 14:10:12 -07005795
5796 /**
5797 * Return the {@link ComponentName} of the activity responsible for installing instant
5798 * applications.
5799 *
5800 * @see {@link android.content.Intent#ACTION_INSTALL_INSTANT_APP_PACKAGE}
5801 * @hide
5802 */
5803 @SystemApi
5804 public abstract ComponentName getInstantAppInstallerComponent();
Chad Brubaker0d277a72017-04-12 16:56:53 -07005805
5806 /**
5807 * Return the Android Id for a given Instant App.
5808 *
5809 * @see {@link android.provider.Settings.Secure#ANDROID_ID}
5810 * @hide
5811 */
5812 public abstract String getInstantAppAndroidId(String packageName, @NonNull UserHandle user);
Calin Juravle3d2af7f2017-04-19 19:56:21 -07005813
5814 /**
5815 * Callback use to notify the callers of module registration that the operation
5816 * has finished.
5817 *
5818 * @hide
5819 */
Jeff Sharkey90396362017-06-12 16:26:53 -06005820 @SystemApi
Calin Juravle3d2af7f2017-04-19 19:56:21 -07005821 public static abstract class DexModuleRegisterCallback {
5822 public abstract void onDexModuleRegistered(String dexModulePath, boolean success,
5823 String message);
5824 }
5825
5826 /**
5827 * Register an application dex module with the package manager.
5828 * The package manager will keep track of the given module for future optimizations.
5829 *
5830 * Dex module optimizations will disable the classpath checking at runtime. The client bares
5831 * the responsibility to ensure that the static assumptions on classes in the optimized code
5832 * hold at runtime (e.g. there's no duplicate classes in the classpath).
5833 *
5834 * Note that the package manager already keeps track of dex modules loaded with
5835 * {@link dalvik.system.DexClassLoader} and {@link dalvik.system.PathClassLoader}.
5836 * This can be called for an eager registration.
5837 *
5838 * The call might take a while and the results will be posted on the main thread, using
5839 * the given callback.
5840 *
5841 * If the module is intended to be shared with other apps, make sure that the file
5842 * permissions allow for it.
5843 * If at registration time the permissions allow for others to read it, the module would
5844 * be marked as a shared module which might undergo a different optimization strategy.
5845 * (usually shared modules will generated larger optimizations artifacts,
5846 * taking more disk space).
5847 *
5848 * @param dexModulePath the absolute path of the dex module.
5849 * @param callback if not null, {@link DexModuleRegisterCallback#onDexModuleRegistered} will
5850 * be called once the registration finishes.
5851 *
5852 * @hide
5853 */
Jeff Sharkey90396362017-06-12 16:26:53 -06005854 @SystemApi
Calin Juravle3d2af7f2017-04-19 19:56:21 -07005855 public abstract void registerDexModule(String dexModulePath,
5856 @Nullable DexModuleRegisterCallback callback);
Calin Juravle45f8b292017-11-07 18:49:43 -08005857
5858 /**
5859 * Returns the {@link ArtManager} associated with this package manager.
5860 *
5861 * @hide
5862 */
5863 @SystemApi
5864 public @NonNull ArtManager getArtManager() {
5865 throw new UnsupportedOperationException("getArtManager not implemented in subclass");
5866 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005867}