blob: 486c86cedba32e865d1c309579d6de9f3cc55cc4 [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,
Daniel Cashman5cdda342018-01-19 07:22:52 -0800136 GET_SIGNING_CERTIFICATES,
Todd Kennedy6b9bfa12016-01-08 13:44:51 -0800137 GET_URI_PERMISSION_PATTERNS,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700138 MATCH_UNINSTALLED_PACKAGES,
139 MATCH_DISABLED_COMPONENTS,
140 MATCH_DISABLED_UNTIL_USED_COMPONENTS,
Jeff Sharkeyc5967e92016-01-07 18:50:29 -0700141 MATCH_SYSTEM_ONLY,
Todd Kennedyd6ee0ba2016-03-31 15:11:11 -0700142 MATCH_FACTORY_ONLY,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700143 MATCH_DEBUG_TRIAGED_MISSING,
Todd Kennedy9c9fdf22017-03-06 10:58:27 -0800144 MATCH_INSTANT,
Todd Kennedy1f397f42016-06-28 12:14:11 -0700145 GET_DISABLED_COMPONENTS,
146 GET_DISABLED_UNTIL_USED_COMPONENTS,
147 GET_UNINSTALLED_PACKAGES,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700148 })
149 @Retention(RetentionPolicy.SOURCE)
150 public @interface PackageInfoFlags {}
151
152 /** @hide */
Jeff Sharkey4347f812017-04-21 12:08:39 -0600153 @IntDef(flag = true, prefix = { "GET_", "MATCH_" }, value = {
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700154 GET_META_DATA,
155 GET_SHARED_LIBRARY_FILES,
156 MATCH_UNINSTALLED_PACKAGES,
157 MATCH_SYSTEM_ONLY,
158 MATCH_DEBUG_TRIAGED_MISSING,
Todd Kennedy24522022017-03-27 16:32:20 -0700159 MATCH_DISABLED_COMPONENTS,
Todd Kennedy5a32c6c2016-07-07 14:29:06 -0700160 MATCH_DISABLED_UNTIL_USED_COMPONENTS,
Todd Kennedy9c9fdf22017-03-06 10:58:27 -0800161 MATCH_INSTANT,
Svet Ganov9e779772017-05-11 14:36:50 -0700162 MATCH_STATIC_SHARED_LIBRARIES,
Todd Kennedy5a32c6c2016-07-07 14:29:06 -0700163 GET_DISABLED_UNTIL_USED_COMPONENTS,
Todd Kennedy1f397f42016-06-28 12:14:11 -0700164 GET_UNINSTALLED_PACKAGES,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700165 })
166 @Retention(RetentionPolicy.SOURCE)
167 public @interface ApplicationInfoFlags {}
168
169 /** @hide */
Jeff Sharkey4347f812017-04-21 12:08:39 -0600170 @IntDef(flag = true, prefix = { "GET_", "MATCH_" }, value = {
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700171 GET_META_DATA,
172 GET_SHARED_LIBRARY_FILES,
Todd Kennedy6b9bfa12016-01-08 13:44:51 -0800173 MATCH_ALL,
174 MATCH_DEBUG_TRIAGED_MISSING,
175 MATCH_DEFAULT_ONLY,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700176 MATCH_DISABLED_COMPONENTS,
177 MATCH_DISABLED_UNTIL_USED_COMPONENTS,
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600178 MATCH_DIRECT_BOOT_AWARE,
179 MATCH_DIRECT_BOOT_UNAWARE,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700180 MATCH_SYSTEM_ONLY,
Todd Kennedy6b9bfa12016-01-08 13:44:51 -0800181 MATCH_UNINSTALLED_PACKAGES,
Todd Kennedy9c9fdf22017-03-06 10:58:27 -0800182 MATCH_INSTANT,
Svet Ganov9e779772017-05-11 14:36:50 -0700183 MATCH_STATIC_SHARED_LIBRARIES,
Todd Kennedy1f397f42016-06-28 12:14:11 -0700184 GET_DISABLED_COMPONENTS,
185 GET_DISABLED_UNTIL_USED_COMPONENTS,
186 GET_UNINSTALLED_PACKAGES,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700187 })
188 @Retention(RetentionPolicy.SOURCE)
189 public @interface ComponentInfoFlags {}
190
191 /** @hide */
Jeff Sharkey4347f812017-04-21 12:08:39 -0600192 @IntDef(flag = true, prefix = { "GET_", "MATCH_" }, value = {
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700193 GET_META_DATA,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700194 GET_RESOLVED_FILTER,
Todd Kennedy6b9bfa12016-01-08 13:44:51 -0800195 GET_SHARED_LIBRARY_FILES,
196 MATCH_ALL,
197 MATCH_DEBUG_TRIAGED_MISSING,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700198 MATCH_DISABLED_COMPONENTS,
199 MATCH_DISABLED_UNTIL_USED_COMPONENTS,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700200 MATCH_DEFAULT_ONLY,
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600201 MATCH_DIRECT_BOOT_AWARE,
202 MATCH_DIRECT_BOOT_UNAWARE,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700203 MATCH_SYSTEM_ONLY,
Todd Kennedy6b9bfa12016-01-08 13:44:51 -0800204 MATCH_UNINSTALLED_PACKAGES,
Todd Kennedy9c9fdf22017-03-06 10:58:27 -0800205 MATCH_INSTANT,
Todd Kennedy1f397f42016-06-28 12:14:11 -0700206 GET_DISABLED_COMPONENTS,
207 GET_DISABLED_UNTIL_USED_COMPONENTS,
208 GET_UNINSTALLED_PACKAGES,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700209 })
210 @Retention(RetentionPolicy.SOURCE)
211 public @interface ResolveInfoFlags {}
212
213 /** @hide */
Jeff Sharkey4347f812017-04-21 12:08:39 -0600214 @IntDef(flag = true, prefix = { "GET_", "MATCH_" }, value = {
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700215 GET_META_DATA,
216 })
217 @Retention(RetentionPolicy.SOURCE)
218 public @interface PermissionInfoFlags {}
219
220 /** @hide */
Jeff Sharkey4347f812017-04-21 12:08:39 -0600221 @IntDef(flag = true, prefix = { "GET_", "MATCH_" }, value = {
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700222 GET_META_DATA,
223 })
224 @Retention(RetentionPolicy.SOURCE)
225 public @interface PermissionGroupInfoFlags {}
226
227 /** @hide */
Jeff Sharkey4347f812017-04-21 12:08:39 -0600228 @IntDef(flag = true, prefix = { "GET_", "MATCH_" }, value = {
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700229 GET_META_DATA,
230 })
231 @Retention(RetentionPolicy.SOURCE)
232 public @interface InstrumentationInfoFlags {}
233
234 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800235 * {@link PackageInfo} flag: return information about
236 * activities in the package in {@link PackageInfo#activities}.
237 */
238 public static final int GET_ACTIVITIES = 0x00000001;
239
240 /**
241 * {@link PackageInfo} flag: return information about
242 * intent receivers in the package in
243 * {@link PackageInfo#receivers}.
244 */
245 public static final int GET_RECEIVERS = 0x00000002;
246
247 /**
248 * {@link PackageInfo} flag: return information about
249 * services in the package in {@link PackageInfo#services}.
250 */
251 public static final int GET_SERVICES = 0x00000004;
252
253 /**
254 * {@link PackageInfo} flag: return information about
255 * content providers in the package in
256 * {@link PackageInfo#providers}.
257 */
258 public static final int GET_PROVIDERS = 0x00000008;
259
260 /**
261 * {@link PackageInfo} flag: return information about
262 * instrumentation in the package in
263 * {@link PackageInfo#instrumentation}.
264 */
265 public static final int GET_INSTRUMENTATION = 0x00000010;
266
267 /**
268 * {@link PackageInfo} flag: return information about the
269 * intent filters supported by the activity.
270 */
271 public static final int GET_INTENT_FILTERS = 0x00000020;
272
273 /**
274 * {@link PackageInfo} flag: return information about the
275 * signatures included in the package.
Daniel Cashman5cdda342018-01-19 07:22:52 -0800276 *
277 * @deprecated use {@code GET_SIGNING_CERTIFICATES} instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800278 */
Daniel Cashman5cdda342018-01-19 07:22:52 -0800279 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800280 public static final int GET_SIGNATURES = 0x00000040;
281
282 /**
283 * {@link ResolveInfo} flag: return the IntentFilter that
284 * was matched for a particular ResolveInfo in
285 * {@link ResolveInfo#filter}.
286 */
287 public static final int GET_RESOLVED_FILTER = 0x00000040;
288
289 /**
290 * {@link ComponentInfo} flag: return the {@link ComponentInfo#metaData}
291 * data {@link android.os.Bundle}s that are associated with a component.
292 * This applies for any API returning a ComponentInfo subclass.
293 */
294 public static final int GET_META_DATA = 0x00000080;
295
296 /**
297 * {@link PackageInfo} flag: return the
298 * {@link PackageInfo#gids group ids} that are associated with an
299 * application.
Ken Wakasaf76a50c2012-03-09 19:56:35 +0900300 * This applies for any API returning a PackageInfo class, either
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800301 * directly or nested inside of another.
302 */
303 public static final int GET_GIDS = 0x00000100;
304
305 /**
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700306 * @deprecated replaced with {@link #MATCH_DISABLED_COMPONENTS}
307 */
308 @Deprecated
309 public static final int GET_DISABLED_COMPONENTS = 0x00000200;
310
311 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800312 * {@link PackageInfo} flag: include disabled components in the returned info.
313 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700314 public static final int MATCH_DISABLED_COMPONENTS = 0x00000200;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800315
316 /**
317 * {@link ApplicationInfo} flag: return the
318 * {@link ApplicationInfo#sharedLibraryFiles paths to the shared libraries}
319 * that are associated with an application.
320 * This applies for any API returning an ApplicationInfo class, either
321 * directly or nested inside of another.
322 */
323 public static final int GET_SHARED_LIBRARY_FILES = 0x00000400;
324
325 /**
326 * {@link ProviderInfo} flag: return the
327 * {@link ProviderInfo#uriPermissionPatterns URI permission patterns}
328 * that are associated with a content provider.
Ken Wakasaf76a50c2012-03-09 19:56:35 +0900329 * This applies for any API returning a ProviderInfo class, either
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800330 * directly or nested inside of another.
331 */
332 public static final int GET_URI_PERMISSION_PATTERNS = 0x00000800;
333 /**
334 * {@link PackageInfo} flag: return information about
335 * permissions in the package in
336 * {@link PackageInfo#permissions}.
337 */
338 public static final int GET_PERMISSIONS = 0x00001000;
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700339
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800340 /**
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700341 * @deprecated replaced with {@link #MATCH_UNINSTALLED_PACKAGES}
342 */
343 @Deprecated
344 public static final int GET_UNINSTALLED_PACKAGES = 0x00002000;
345
346 /**
Kenny Root685f4902011-11-03 10:13:29 -0700347 * Flag parameter to retrieve some information about all applications (even
348 * uninstalled ones) which have data directories. This state could have
349 * resulted if applications have been deleted with flag
350 * {@code DONT_DELETE_DATA} with a possibility of being replaced or
351 * reinstalled in future.
352 * <p>
353 * Note: this flag may cause less information about currently installed
354 * applications to be returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800355 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700356 public static final int MATCH_UNINSTALLED_PACKAGES = 0x00002000;
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700357
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800358 /**
359 * {@link PackageInfo} flag: return information about
Dianne Hackborn49237342009-08-27 20:08:01 -0700360 * hardware preferences in
Adam Lesinskid3edfde2014-08-08 17:32:44 -0700361 * {@link PackageInfo#configPreferences PackageInfo.configPreferences},
362 * and requested features in {@link PackageInfo#reqFeatures} and
363 * {@link PackageInfo#featureGroups}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800364 */
365 public static final int GET_CONFIGURATIONS = 0x00004000;
366
367 /**
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700368 * @deprecated replaced with {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}.
369 */
370 @Deprecated
371 public static final int GET_DISABLED_UNTIL_USED_COMPONENTS = 0x00008000;
372
373 /**
Dianne Hackbornfd7aded2013-01-22 17:10:23 -0800374 * {@link PackageInfo} flag: include disabled components which are in
375 * that state only because of {@link #COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED}
376 * in the returned info. Note that if you set this flag, applications
377 * that are in this disabled state will be reported as enabled.
378 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700379 public static final int MATCH_DISABLED_UNTIL_USED_COMPONENTS = 0x00008000;
Dianne Hackbornfd7aded2013-01-22 17:10:23 -0800380
381 /**
Dianne Hackborn1655be42009-05-08 14:29:01 -0700382 * Resolution and querying flag: if set, only filters that support the
383 * {@link android.content.Intent#CATEGORY_DEFAULT} will be considered for
384 * matching. This is a synonym for including the CATEGORY_DEFAULT in your
385 * supplied Intent.
386 */
Fabrice Di Meglio9f7e39f2015-04-10 20:40:16 -0700387 public static final int MATCH_DEFAULT_ONLY = 0x00010000;
388
389 /**
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700390 * Querying flag: if set and if the platform is doing any filtering of the
391 * results, then the filtering will not happen. This is a synonym for saying
392 * that all results should be returned.
393 * <p>
394 * <em>This flag should be used with extreme care.</em>
Fabrice Di Meglio9f7e39f2015-04-10 20:40:16 -0700395 */
396 public static final int MATCH_ALL = 0x00020000;
Dianne Hackborn1655be42009-05-08 14:29:01 -0700397
Nicolas Prevot63798c52014-05-27 13:22:38 +0100398 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600399 * Querying flag: match components which are direct boot <em>unaware</em> in
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700400 * the returned info, regardless of the current user state.
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600401 * <p>
402 * When neither {@link #MATCH_DIRECT_BOOT_AWARE} nor
403 * {@link #MATCH_DIRECT_BOOT_UNAWARE} are specified, the default behavior is
404 * to match only runnable components based on the user state. For example,
405 * when a user is started but credentials have not been presented yet, the
406 * user is running "locked" and only {@link #MATCH_DIRECT_BOOT_AWARE}
407 * components are returned. Once the user credentials have been presented,
408 * the user is running "unlocked" and both {@link #MATCH_DIRECT_BOOT_AWARE}
409 * and {@link #MATCH_DIRECT_BOOT_UNAWARE} components are returned.
410 *
411 * @see UserManager#isUserUnlocked()
Jeff Sharkeye17ac152015-11-06 22:40:29 -0800412 */
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600413 public static final int MATCH_DIRECT_BOOT_UNAWARE = 0x00040000;
414
415 /**
416 * Querying flag: match components which are direct boot <em>aware</em> in
417 * the returned info, regardless of the current user state.
418 * <p>
419 * When neither {@link #MATCH_DIRECT_BOOT_AWARE} nor
420 * {@link #MATCH_DIRECT_BOOT_UNAWARE} are specified, the default behavior is
421 * to match only runnable components based on the user state. For example,
422 * when a user is started but credentials have not been presented yet, the
423 * user is running "locked" and only {@link #MATCH_DIRECT_BOOT_AWARE}
424 * components are returned. Once the user credentials have been presented,
425 * the user is running "unlocked" and both {@link #MATCH_DIRECT_BOOT_AWARE}
426 * and {@link #MATCH_DIRECT_BOOT_UNAWARE} components are returned.
427 *
428 * @see UserManager#isUserUnlocked()
429 */
430 public static final int MATCH_DIRECT_BOOT_AWARE = 0x00080000;
431
Jeff Sharkey2a9e3f82015-12-18 10:57:58 -0700432 /**
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700433 * Querying flag: include only components from applications that are marked
434 * with {@link ApplicationInfo#FLAG_SYSTEM}.
Jeff Sharkey5217cac2015-12-20 15:34:01 -0700435 */
436 public static final int MATCH_SYSTEM_ONLY = 0x00100000;
437
438 /**
Todd Kennedyd6ee0ba2016-03-31 15:11:11 -0700439 * Internal {@link PackageInfo} flag: include only components on the system image.
440 * This will not return information on any unbundled update to system components.
441 * @hide
442 */
Todd Kennedy49084962017-03-27 16:20:37 -0700443 @SystemApi
Fyodor Kupolove5698042018-01-26 14:24:37 -0800444 @TestApi
Todd Kennedyd6ee0ba2016-03-31 15:11:11 -0700445 public static final int MATCH_FACTORY_ONLY = 0x00200000;
446
447 /**
Amith Yamasani0d1fd8d2016-10-12 14:21:51 -0700448 * Allows querying of packages installed for any user, not just the specific one. This flag
Amith Yamasani475f9a32016-12-08 09:46:15 -0800449 * is only meant for use by apps that have INTERACT_ACROSS_USERS permission.
Amith Yamasani0d1fd8d2016-10-12 14:21:51 -0700450 * @hide
451 */
Amith Yamasani475f9a32016-12-08 09:46:15 -0800452 @SystemApi
Amith Yamasani0d1fd8d2016-10-12 14:21:51 -0700453 public static final int MATCH_ANY_USER = 0x00400000;
454
455 /**
456 * Combination of MATCH_ANY_USER and MATCH_UNINSTALLED_PACKAGES to mean any known
457 * package.
458 * @hide
459 */
460 public static final int MATCH_KNOWN_PACKAGES = MATCH_UNINSTALLED_PACKAGES | MATCH_ANY_USER;
461
462 /**
Todd Kennedy7bc3a702016-12-08 14:54:48 -0800463 * Internal {@link PackageInfo} flag: include components that are part of an
Todd Kennedybe0b8892017-02-15 14:13:52 -0800464 * instant app. By default, instant app components are not matched.
Todd Kennedy7bc3a702016-12-08 14:54:48 -0800465 * @hide
466 */
Todd Kennedy9c9fdf22017-03-06 10:58:27 -0800467 @SystemApi
Todd Kennedybe0b8892017-02-15 14:13:52 -0800468 public static final int MATCH_INSTANT = 0x00800000;
Todd Kennedy7bc3a702016-12-08 14:54:48 -0800469
470 /**
471 * Internal {@link PackageInfo} flag: include only components that are exposed to
Todd Kennedyc05f5d12017-04-25 11:11:40 -0700472 * instant apps. Matched components may have been either explicitly or implicitly
473 * exposed.
Todd Kennedy7bc3a702016-12-08 14:54:48 -0800474 * @hide
475 */
Todd Kennedybe0b8892017-02-15 14:13:52 -0800476 public static final int MATCH_VISIBLE_TO_INSTANT_APP_ONLY = 0x01000000;
Todd Kennedy7bc3a702016-12-08 14:54:48 -0800477
478 /**
Todd Kennedyc05f5d12017-04-25 11:11:40 -0700479 * Internal {@link PackageInfo} flag: include only components that have been
480 * explicitly exposed to instant apps.
481 * @hide
482 */
483 public static final int MATCH_EXPLICITLY_VISIBLE_ONLY = 0x02000000;
484
485 /**
Svet Ganov9e779772017-05-11 14:36:50 -0700486 * Internal {@link PackageInfo} flag: include static shared libraries.
487 * Apps that depend on static shared libs can always access the version
488 * of the lib they depend on. System/shell/root can access all shared
489 * libs regardless of dependency but need to explicitly ask for them
490 * via this flag.
491 * @hide
492 */
493 public static final int MATCH_STATIC_SHARED_LIBRARIES = 0x04000000;
494
495 /**
Daniel Cashman5cdda342018-01-19 07:22:52 -0800496 * {@link PackageInfo} flag: return the signing certificates associated with
497 * this package. Each entry is a signing certificate that the package
498 * has proven it is authorized to use, usually a past signing certificate from
499 * which it has rotated.
500 */
501 public static final int GET_SIGNING_CERTIFICATES = 0x08000000;
502
503 /**
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700504 * Internal flag used to indicate that a system component has done their
505 * homework and verified that they correctly handle packages and components
506 * that come and go over time. In particular:
507 * <ul>
508 * <li>Apps installed on external storage, which will appear to be
509 * uninstalled while the the device is ejected.
510 * <li>Apps with encryption unaware components, which will appear to not
511 * exist while the device is locked.
512 * </ul>
Jeff Sharkeye17ac152015-11-06 22:40:29 -0800513 *
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700514 * @see #MATCH_UNINSTALLED_PACKAGES
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600515 * @see #MATCH_DIRECT_BOOT_AWARE
516 * @see #MATCH_DIRECT_BOOT_UNAWARE
Jeff Sharkeye17ac152015-11-06 22:40:29 -0800517 * @hide
518 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700519 public static final int MATCH_DEBUG_TRIAGED_MISSING = 0x10000000;
Jeff Sharkeye17ac152015-11-06 22:40:29 -0800520
521 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700522 * Flag for {@link #addCrossProfileIntentFilter}: if this flag is set: when
523 * resolving an intent that matches the {@code CrossProfileIntentFilter},
524 * the current profile will be skipped. Only activities in the target user
525 * can respond to the intent.
526 *
Nicolas Prevot63798c52014-05-27 13:22:38 +0100527 * @hide
528 */
529 public static final int SKIP_CURRENT_PROFILE = 0x00000002;
530
Tony Mak807e01c2015-12-01 20:19:03 +0000531 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700532 * Flag for {@link #addCrossProfileIntentFilter}: if this flag is set:
Tony Mak807e01c2015-12-01 20:19:03 +0000533 * activities in the other profiles can respond to the intent only if no activity with
534 * non-negative priority in current profile can respond to the intent.
535 * @hide
536 */
537 public static final int ONLY_IF_NO_MATCH_FOUND = 0x00000004;
538
Tor Norbyed9273d62013-05-30 15:59:53 -0700539 /** @hide */
Jeff Sharkey4347f812017-04-21 12:08:39 -0600540 @IntDef(prefix = { "PERMISSION_" }, value = {
541 PERMISSION_GRANTED,
542 PERMISSION_DENIED
543 })
Tor Norbyed9273d62013-05-30 15:59:53 -0700544 @Retention(RetentionPolicy.SOURCE)
545 public @interface PermissionResult {}
546
Dianne Hackborn1655be42009-05-08 14:29:01 -0700547 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800548 * Permission check result: this is returned by {@link #checkPermission}
549 * if the permission has been granted to the given package.
550 */
551 public static final int PERMISSION_GRANTED = 0;
552
553 /**
554 * Permission check result: this is returned by {@link #checkPermission}
555 * if the permission has not been granted to the given package.
556 */
557 public static final int PERMISSION_DENIED = -1;
558
Jeff Sharkey30e06bb2017-04-24 11:18:03 -0600559 /** @hide */
560 @IntDef(prefix = { "SIGNATURE_" }, value = {
561 SIGNATURE_MATCH,
562 SIGNATURE_NEITHER_SIGNED,
563 SIGNATURE_FIRST_NOT_SIGNED,
564 SIGNATURE_SECOND_NOT_SIGNED,
565 SIGNATURE_NO_MATCH,
566 SIGNATURE_UNKNOWN_PACKAGE,
567 })
568 @Retention(RetentionPolicy.SOURCE)
569 public @interface SignatureResult {}
570
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800571 /**
572 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700573 * if all signatures on the two packages match.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800574 */
575 public static final int SIGNATURE_MATCH = 0;
576
577 /**
578 * Signature check result: this is returned by {@link #checkSignatures}
579 * if neither of the two packages is signed.
580 */
581 public static final int SIGNATURE_NEITHER_SIGNED = 1;
582
583 /**
584 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700585 * if the first package is not signed but the second is.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800586 */
587 public static final int SIGNATURE_FIRST_NOT_SIGNED = -1;
588
589 /**
590 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700591 * if the second package is not signed but the first is.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800592 */
593 public static final int SIGNATURE_SECOND_NOT_SIGNED = -2;
594
595 /**
596 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700597 * if not all signatures on both packages match.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800598 */
599 public static final int SIGNATURE_NO_MATCH = -3;
600
601 /**
602 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700603 * if either of the packages are not valid.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800604 */
605 public static final int SIGNATURE_UNKNOWN_PACKAGE = -4;
606
Jeff Sharkey30e06bb2017-04-24 11:18:03 -0600607 /** @hide */
608 @IntDef(prefix = { "COMPONENT_ENABLED_STATE_" }, value = {
609 COMPONENT_ENABLED_STATE_DEFAULT,
610 COMPONENT_ENABLED_STATE_ENABLED,
611 COMPONENT_ENABLED_STATE_DISABLED,
612 COMPONENT_ENABLED_STATE_DISABLED_USER,
613 COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED,
614 })
615 @Retention(RetentionPolicy.SOURCE)
616 public @interface EnabledState {}
617
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700618 /**
Jeff Sharkey30e06bb2017-04-24 11:18:03 -0600619 * Flag for {@link #setApplicationEnabledSetting(String, int, int)} and
620 * {@link #setComponentEnabledSetting(ComponentName, int, int)}: This
621 * component or application is in its default enabled state (as specified in
622 * its manifest).
623 * <p>
624 * Explicitly setting the component state to this value restores it's
625 * enabled state to whatever is set in the manifest.
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700626 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800627 public static final int COMPONENT_ENABLED_STATE_DEFAULT = 0;
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700628
629 /**
630 * Flag for {@link #setApplicationEnabledSetting(String, int, int)}
631 * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This
632 * component or application has been explictily enabled, regardless of
633 * what it has specified in its manifest.
634 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800635 public static final int COMPONENT_ENABLED_STATE_ENABLED = 1;
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700636
637 /**
638 * Flag for {@link #setApplicationEnabledSetting(String, int, int)}
639 * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This
640 * component or application has been explicitly disabled, regardless of
641 * what it has specified in its manifest.
642 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800643 public static final int COMPONENT_ENABLED_STATE_DISABLED = 2;
644
645 /**
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700646 * Flag for {@link #setApplicationEnabledSetting(String, int, int)} only: The
647 * user has explicitly disabled the application, regardless of what it has
648 * specified in its manifest. Because this is due to the user's request,
649 * they may re-enable it if desired through the appropriate system UI. This
kmccormick30498b42013-03-27 17:39:17 -0700650 * option currently <strong>cannot</strong> be used with
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700651 * {@link #setComponentEnabledSetting(ComponentName, int, int)}.
652 */
653 public static final int COMPONENT_ENABLED_STATE_DISABLED_USER = 3;
654
655 /**
Dianne Hackbornfd7aded2013-01-22 17:10:23 -0800656 * Flag for {@link #setApplicationEnabledSetting(String, int, int)} only: This
657 * application should be considered, until the point where the user actually
658 * wants to use it. This means that it will not normally show up to the user
659 * (such as in the launcher), but various parts of the user interface can
660 * use {@link #GET_DISABLED_UNTIL_USED_COMPONENTS} to still see it and allow
661 * the user to select it (as for example an IME, device admin, etc). Such code,
662 * once the user has selected the app, should at that point also make it enabled.
663 * This option currently <strong>can not</strong> be used with
664 * {@link #setComponentEnabledSetting(ComponentName, int, int)}.
665 */
666 public static final int COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED = 4;
667
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700668 /** @hide */
Jeff Sharkey4347f812017-04-21 12:08:39 -0600669 @IntDef(flag = true, prefix = { "INSTALL_" }, value = {
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700670 INSTALL_FORWARD_LOCK,
671 INSTALL_REPLACE_EXISTING,
672 INSTALL_ALLOW_TEST,
673 INSTALL_EXTERNAL,
674 INSTALL_INTERNAL,
675 INSTALL_FROM_ADB,
676 INSTALL_ALL_USERS,
677 INSTALL_ALLOW_DOWNGRADE,
678 INSTALL_GRANT_RUNTIME_PERMISSIONS,
679 INSTALL_FORCE_VOLUME_UUID,
680 INSTALL_FORCE_PERMISSION_PROMPT,
Todd Kennedybe0b8892017-02-15 14:13:52 -0800681 INSTALL_INSTANT_APP,
Todd Kennedy39bfee52016-02-24 10:28:21 -0800682 INSTALL_DONT_KILL_APP,
Jeff Sharkey683bcd32017-03-18 17:54:51 -0600683 INSTALL_FORCE_SDK,
684 INSTALL_FULL_APP,
685 INSTALL_ALLOCATE_AGGRESSIVE,
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700686 })
687 @Retention(RetentionPolicy.SOURCE)
688 public @interface InstallFlags {}
689
Dianne Hackbornfd7aded2013-01-22 17:10:23 -0800690 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700691 * Flag parameter for {@link #installPackage} to indicate that this package
692 * should be installed as forward locked, i.e. only the app itself should
693 * have access to its code and non-resource assets.
694 *
Jeff Sharkey8c61e392017-02-24 09:22:48 -0700695 * @deprecated new installs into ASEC containers are no longer supported.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700696 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800697 */
Jeff Sharkey8c61e392017-02-24 09:22:48 -0700698 @Deprecated
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700699 public static final int INSTALL_FORWARD_LOCK = 0x00000001;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800700
701 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700702 * Flag parameter for {@link #installPackage} to indicate that you want to
703 * replace an already installed package, if one exists.
704 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700705 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800706 */
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700707 public static final int INSTALL_REPLACE_EXISTING = 0x00000002;
708
709 /**
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700710 * Flag parameter for {@link #installPackage} to indicate that you want to
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700711 * allow test packages (those that have set android:testOnly in their
712 * manifest) to be installed.
713 * @hide
714 */
715 public static final int INSTALL_ALLOW_TEST = 0x00000004;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800716
717 /**
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -0700718 * Flag parameter for {@link #installPackage} to indicate that this package
719 * must be installed to an ASEC on a {@link VolumeInfo#TYPE_PUBLIC}.
720 *
Jeff Sharkey8c61e392017-02-24 09:22:48 -0700721 * @deprecated new installs into ASEC containers are no longer supported;
722 * use adoptable storage instead.
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800723 * @hide
724 */
Jeff Sharkey8c61e392017-02-24 09:22:48 -0700725 @Deprecated
Suchi Amalapurapu5b993ce2010-02-12 09:43:29 -0800726 public static final int INSTALL_EXTERNAL = 0x00000008;
Oscar Montemayor539d3c42010-01-29 15:27:00 -0800727
728 /**
Kenny Root5ab21572011-07-27 11:11:19 -0700729 * Flag parameter for {@link #installPackage} to indicate that this package
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -0700730 * must be installed to internal storage.
731 *
Kenny Root5ab21572011-07-27 11:11:19 -0700732 * @hide
733 */
734 public static final int INSTALL_INTERNAL = 0x00000010;
735
736 /**
737 * Flag parameter for {@link #installPackage} to indicate that this install
738 * was initiated via ADB.
739 *
740 * @hide
741 */
742 public static final int INSTALL_FROM_ADB = 0x00000020;
Suchi Amalapurapu14b6abd2010-03-17 08:37:04 -0700743
744 /**
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700745 * Flag parameter for {@link #installPackage} to indicate that this install
746 * should immediately be visible to all users.
747 *
748 * @hide
749 */
750 public static final int INSTALL_ALL_USERS = 0x00000040;
751
752 /**
753 * Flag parameter for {@link #installPackage} to indicate that it is okay
754 * to install an update to an app where the newly installed app has a lower
Alex Klyubin921dd752016-02-24 13:21:41 -0800755 * version code than the currently installed app. This is permitted only if
756 * the currently installed app is marked debuggable.
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700757 *
758 * @hide
759 */
760 public static final int INSTALL_ALLOW_DOWNGRADE = 0x00000080;
761
762 /**
Svet Ganov95c1ade2015-03-19 09:38:52 -0700763 * Flag parameter for {@link #installPackage} to indicate that all runtime
764 * permissions should be granted to the package. If {@link #INSTALL_ALL_USERS}
765 * is set the runtime permissions will be granted to all users, otherwise
766 * only to the owner.
767 *
768 * @hide
769 */
770 public static final int INSTALL_GRANT_RUNTIME_PERMISSIONS = 0x00000100;
771
Jeff Sharkeyab234092015-06-09 21:42:22 -0700772 /** {@hide} */
773 public static final int INSTALL_FORCE_VOLUME_UUID = 0x00000200;
774
Svet Ganov95c1ade2015-03-19 09:38:52 -0700775 /**
Todd Kennedya1d12cf2015-09-29 15:43:00 -0700776 * Flag parameter for {@link #installPackage} to indicate that we always want to force
777 * the prompt for permission approval. This overrides any special behaviour for internal
778 * components.
779 *
780 * @hide
781 */
782 public static final int INSTALL_FORCE_PERMISSION_PROMPT = 0x00000400;
783
784 /**
Todd Kennedy27c24fb2015-09-17 16:49:25 -0700785 * Flag parameter for {@link #installPackage} to indicate that this package is
Todd Kennedy2699f062015-11-20 13:07:17 -0800786 * to be installed as a lightweight "ephemeral" app.
787 *
788 * @hide
789 */
Todd Kennedybe0b8892017-02-15 14:13:52 -0800790 public static final int INSTALL_INSTANT_APP = 0x00000800;
791
792 /**
Todd Kennedy39bfee52016-02-24 10:28:21 -0800793 * Flag parameter for {@link #installPackage} to indicate that this package contains
794 * a feature split to an existing application and the existing application should not
795 * be killed during the installation process.
796 *
797 * @hide
798 */
799 public static final int INSTALL_DONT_KILL_APP = 0x00001000;
800
801 /**
Todd Kennedyb1072712016-04-26 15:41:20 -0700802 * Flag parameter for {@link #installPackage} to indicate that this package is an
Patrick Baumannccb20b82018-01-08 13:22:46 -0800803 * upgrade to a package that refers to the SDK via release letter or is targeting an SDK via
804 * release letter that the current build does not support.
Todd Kennedyb1072712016-04-26 15:41:20 -0700805 *
806 * @hide
807 */
808 public static final int INSTALL_FORCE_SDK = 0x00002000;
809
810 /**
Jeff Sharkey683bcd32017-03-18 17:54:51 -0600811 * Flag parameter for {@link #installPackage} to indicate that this package is
812 * to be installed as a heavy weight app. This is fundamentally the opposite of
813 * {@link #INSTALL_INSTANT_APP}.
814 *
815 * @hide
816 */
817 public static final int INSTALL_FULL_APP = 0x00004000;
818
819 /**
820 * Flag parameter for {@link #installPackage} to indicate that this package
821 * is critical to system health or security, meaning the system should use
822 * {@link StorageManager#FLAG_ALLOCATE_AGGRESSIVE} internally.
823 *
824 * @hide
825 */
826 public static final int INSTALL_ALLOCATE_AGGRESSIVE = 0x00008000;
827
Todd Kennedy78a72502017-07-19 12:49:30 -0700828 /**
829 * Flag parameter for {@link #installPackage} to indicate that this package
830 * is a virtual preload.
831 *
832 * @hide
833 */
834 public static final int INSTALL_VIRTUAL_PRELOAD = 0x00010000;
835
Jeff Sharkey30e06bb2017-04-24 11:18:03 -0600836 /** @hide */
837 @IntDef(flag = true, prefix = { "DONT_KILL_APP" }, value = {
838 DONT_KILL_APP
839 })
840 @Retention(RetentionPolicy.SOURCE)
841 public @interface EnabledFlags {}
842
Jeff Sharkey683bcd32017-03-18 17:54:51 -0600843 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800844 * Flag parameter for
845 * {@link #setComponentEnabledSetting(android.content.ComponentName, int, int)} to indicate
846 * that you don't want to kill the app containing the component. Be careful when you set this
847 * since changing component states can make the containing application's behavior unpredictable.
848 */
849 public static final int DONT_KILL_APP = 0x00000001;
850
Bartosz Fabianowskia34f53f2017-01-11 18:08:47 +0100851 /** @hide */
Jeff Sharkey4347f812017-04-21 12:08:39 -0600852 @IntDef(prefix = { "INSTALL_REASON_" }, value = {
853 INSTALL_REASON_UNKNOWN,
854 INSTALL_REASON_POLICY,
855 INSTALL_REASON_DEVICE_RESTORE,
856 INSTALL_REASON_DEVICE_SETUP,
857 INSTALL_REASON_USER
858 })
Bartosz Fabianowskia34f53f2017-01-11 18:08:47 +0100859 @Retention(RetentionPolicy.SOURCE)
860 public @interface InstallReason {}
861
862 /**
863 * Code indicating that the reason for installing this package is unknown.
864 */
865 public static final int INSTALL_REASON_UNKNOWN = 0;
866
867 /**
868 * Code indicating that this package was installed due to enterprise policy.
869 */
870 public static final int INSTALL_REASON_POLICY = 1;
871
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800872 /**
Sunny Goyal80af6a22017-03-02 08:32:33 -0800873 * Code indicating that this package was installed as part of restoring from another device.
874 */
875 public static final int INSTALL_REASON_DEVICE_RESTORE = 2;
876
877 /**
878 * Code indicating that this package was installed as part of device setup.
879 */
880 public static final int INSTALL_REASON_DEVICE_SETUP = 3;
881
882 /**
883 * Code indicating that the package installation was initiated by the user.
884 */
885 public static final int INSTALL_REASON_USER = 4;
886
887 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800888 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
889 * on success.
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700890 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700891 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800892 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700893 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800894 public static final int INSTALL_SUCCEEDED = 1;
895
896 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800897 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
898 * if the package is already installed.
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700899 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700900 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800901 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700902 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800903 public static final int INSTALL_FAILED_ALREADY_EXISTS = -1;
904
905 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800906 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
907 * if the package archive file is invalid.
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700908 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700909 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800910 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700911 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800912 public static final int INSTALL_FAILED_INVALID_APK = -2;
913
914 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800915 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
916 * if the URI passed in is invalid.
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700917 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700918 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800919 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700920 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800921 public static final int INSTALL_FAILED_INVALID_URI = -3;
922
923 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800924 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
925 * if the package manager service found that the device didn't have enough storage space to
926 * install the app.
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700927 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700928 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800929 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700930 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800931 public static final int INSTALL_FAILED_INSUFFICIENT_STORAGE = -4;
932
933 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800934 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
935 * if a package is already installed with the same name.
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700936 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700937 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800938 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700939 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800940 public static final int INSTALL_FAILED_DUPLICATE_PACKAGE = -5;
941
942 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800943 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
944 * if the requested shared user does not exist.
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700945 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700946 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800947 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700948 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800949 public static final int INSTALL_FAILED_NO_SHARED_USER = -6;
950
951 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800952 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
953 * if a previously installed package of the same name has a different signature than the new
954 * package (and the old package's data was not removed).
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700955 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700956 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800957 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700958 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800959 public static final int INSTALL_FAILED_UPDATE_INCOMPATIBLE = -7;
960
961 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800962 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
963 * if the new package is requested a shared user which is already installed on the device and
964 * does not have matching signature.
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700965 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700966 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800967 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700968 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800969 public static final int INSTALL_FAILED_SHARED_USER_INCOMPATIBLE = -8;
970
971 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800972 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
973 * if the new package uses a shared library that is not available.
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700974 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700975 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800976 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700977 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800978 public static final int INSTALL_FAILED_MISSING_SHARED_LIBRARY = -9;
979
980 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800981 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
982 * if the new package uses a shared library that is not available.
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700983 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700984 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800985 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700986 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800987 public static final int INSTALL_FAILED_REPLACE_COULDNT_DELETE = -10;
988
989 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800990 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
991 * if the new package failed while optimizing and validating its dex files, either because there
992 * was not enough storage or the validation failed.
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700993 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700994 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800995 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700996 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800997 public static final int INSTALL_FAILED_DEXOPT = -11;
998
999 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001000 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1001 * if the new package failed because the current SDK version is older than that required by the
1002 * package.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001003 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001004 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001005 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001006 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001007 public static final int INSTALL_FAILED_OLDER_SDK = -12;
1008
1009 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001010 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1011 * if the new package failed because it contains a content provider with the same authority as a
1012 * provider already installed in the system.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001013 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001014 * @hide
The Android Open Source Project10592532009-03-18 17:39:46 -07001015 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001016 @SystemApi
The Android Open Source Project10592532009-03-18 17:39:46 -07001017 public static final int INSTALL_FAILED_CONFLICTING_PROVIDER = -13;
1018
1019 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001020 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1021 * if the new package failed because the current SDK version is newer than that required by the
1022 * package.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001023 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001024 * @hide
Dianne Hackborn851a5412009-05-08 12:06:44 -07001025 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001026 @SystemApi
Dianne Hackborn851a5412009-05-08 12:06:44 -07001027 public static final int INSTALL_FAILED_NEWER_SDK = -14;
1028
1029 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001030 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1031 * if the new package failed because it has specified that it is a test-only package and the
1032 * caller has not supplied the {@link #INSTALL_ALLOW_TEST} flag.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001033 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001034 * @hide
1035 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001036 @SystemApi
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001037 public static final int INSTALL_FAILED_TEST_ONLY = -15;
1038
1039 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001040 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1041 * if the package being installed contains native code, but none that is compatible with the
1042 * device's CPU_ABI.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001043 *
Dianne Hackbornb1811182009-05-21 15:45:42 -07001044 * @hide
1045 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001046 @SystemApi
Dianne Hackbornb1811182009-05-21 15:45:42 -07001047 public static final int INSTALL_FAILED_CPU_ABI_INCOMPATIBLE = -16;
1048
1049 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001050 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1051 * if the new package uses a feature that is not available.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001052 *
Dianne Hackborn49237342009-08-27 20:08:01 -07001053 * @hide
1054 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001055 @SystemApi
Dianne Hackborn49237342009-08-27 20:08:01 -07001056 public static final int INSTALL_FAILED_MISSING_FEATURE = -17;
1057
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -08001058 // ------ Errors related to sdcard
1059 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001060 * Installation return code: this is passed in the
1061 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if a secure container mount point couldn't be
1062 * accessed on external media.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001063 *
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -08001064 * @hide
1065 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001066 @SystemApi
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -08001067 public static final int INSTALL_FAILED_CONTAINER_ERROR = -18;
1068
Dianne Hackborn49237342009-08-27 20:08:01 -07001069 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001070 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1071 * if the new package couldn't be installed in the specified install location.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001072 *
Suchi Amalapurapub56ae202010-02-04 22:51:07 -08001073 * @hide
1074 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001075 @SystemApi
Suchi Amalapurapub56ae202010-02-04 22:51:07 -08001076 public static final int INSTALL_FAILED_INVALID_INSTALL_LOCATION = -19;
1077
1078 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001079 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1080 * if the new package couldn't be installed in the specified install location because the media
1081 * is not available.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001082 *
Suchi Amalapurapu8a9ab242010-03-11 16:49:16 -08001083 * @hide
1084 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001085 @SystemApi
Suchi Amalapurapu8a9ab242010-03-11 16:49:16 -08001086 public static final int INSTALL_FAILED_MEDIA_UNAVAILABLE = -20;
1087
1088 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001089 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1090 * if the new package couldn't be installed because the verification timed out.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001091 *
Kenny Root5ab21572011-07-27 11:11:19 -07001092 * @hide
1093 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001094 @SystemApi
Kenny Root5ab21572011-07-27 11:11:19 -07001095 public static final int INSTALL_FAILED_VERIFICATION_TIMEOUT = -21;
1096
1097 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001098 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1099 * if the new package couldn't be installed because the verification did not succeed.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001100 *
Kenny Root5ab21572011-07-27 11:11:19 -07001101 * @hide
1102 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001103 @SystemApi
Kenny Root5ab21572011-07-27 11:11:19 -07001104 public static final int INSTALL_FAILED_VERIFICATION_FAILURE = -22;
1105
1106 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001107 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1108 * if the package changed from what the calling program expected.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001109 *
Kenny Root5ab21572011-07-27 11:11:19 -07001110 * @hide
1111 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001112 @SystemApi
Kenny Root5ab21572011-07-27 11:11:19 -07001113 public static final int INSTALL_FAILED_PACKAGE_CHANGED = -23;
1114
1115 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001116 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1117 * if the new package is assigned a different UID than it previously held.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001118 *
Dianne Hackbornd0c5f512012-06-07 16:53:59 -07001119 * @hide
1120 */
1121 public static final int INSTALL_FAILED_UID_CHANGED = -24;
1122
1123 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001124 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1125 * if the new package has an older version code than the currently installed package.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001126 *
Dianne Hackborn7767eac2012-08-23 18:25:40 -07001127 * @hide
1128 */
1129 public static final int INSTALL_FAILED_VERSION_DOWNGRADE = -25;
1130
1131 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001132 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1133 * if the old package has target SDK high enough to support runtime permission and the new
1134 * package has target SDK low enough to not support runtime permissions.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001135 *
Svetoslavd9653702015-05-13 18:02:46 -07001136 * @hide
1137 */
1138 @SystemApi
1139 public static final int INSTALL_FAILED_PERMISSION_MODEL_DOWNGRADE = -26;
1140
1141 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001142 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1143 * if the new package attempts to downgrade the target sandbox version of the app.
Chad Brubaker34573b22017-03-07 15:27:35 -08001144 *
1145 * @hide
1146 */
1147 @SystemApi
1148 public static final int INSTALL_FAILED_SANDBOX_VERSION_DOWNGRADE = -27;
1149
1150 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001151 * Installation parse return code: this is passed in the
1152 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser was given a path that is not a
1153 * file, or does not end with the expected '.apk' extension.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001154 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001155 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001156 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001157 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001158 public static final int INSTALL_PARSE_FAILED_NOT_APK = -100;
1159
1160 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001161 * Installation parse return code: this is passed in the
1162 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser was unable to retrieve the
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001163 * AndroidManifest.xml file.
1164 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001165 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001166 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001167 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001168 public static final int INSTALL_PARSE_FAILED_BAD_MANIFEST = -101;
1169
1170 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001171 * Installation parse return code: this is passed in the
1172 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser encountered an unexpected
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001173 * exception.
1174 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001175 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001176 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001177 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001178 public static final int INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION = -102;
1179
1180 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001181 * Installation parse return code: this is passed in the
1182 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser did not find any certificates in
1183 * the .apk.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001184 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001185 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001186 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001187 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001188 public static final int INSTALL_PARSE_FAILED_NO_CERTIFICATES = -103;
1189
1190 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001191 * Installation parse return code: this is passed in the
1192 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser found inconsistent certificates on
1193 * the files in the .apk.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001194 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001195 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001196 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001197 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001198 public static final int INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES = -104;
1199
1200 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001201 * Installation parse return code: this is passed in the
1202 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser encountered a
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001203 * CertificateEncodingException in one of the files in the .apk.
1204 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001205 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001206 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001207 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001208 public static final int INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING = -105;
1209
1210 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001211 * Installation parse return code: this is passed in the
1212 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser encountered a bad or missing
1213 * package name in the manifest.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001214 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001215 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001216 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001217 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001218 public static final int INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME = -106;
1219
1220 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001221 * Installation parse return code: tthis is passed in the
1222 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser encountered a bad shared user id
1223 * name in the manifest.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001224 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001225 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001226 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001227 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001228 public static final int INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID = -107;
1229
1230 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001231 * Installation parse return code: this is passed in the
1232 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser encountered some structural
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001233 * problem in the manifest.
1234 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001235 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001236 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001237 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001238 public static final int INSTALL_PARSE_FAILED_MANIFEST_MALFORMED = -108;
1239
1240 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001241 * Installation parse return code: this is passed in the
1242 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser did not find any actionable tags
1243 * (instrumentation or application) in the manifest.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001244 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001245 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001246 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001247 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001248 public static final int INSTALL_PARSE_FAILED_MANIFEST_EMPTY = -109;
1249
1250 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001251 * Installation failed return code: this is passed in the
1252 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the system failed to install the package
1253 * because of system issues.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001254 *
Suchi Amalapurapu5b993ce2010-02-12 09:43:29 -08001255 * @hide
1256 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001257 @SystemApi
Suchi Amalapurapu5b993ce2010-02-12 09:43:29 -08001258 public static final int INSTALL_FAILED_INTERNAL_ERROR = -110;
1259
1260 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001261 * Installation failed return code: this is passed in the
1262 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the system failed to install the package
1263 * because the user is restricted from installing apps.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001264 *
Amith Yamasanie4cf7342012-12-17 11:12:09 -08001265 * @hide
1266 */
1267 public static final int INSTALL_FAILED_USER_RESTRICTED = -111;
1268
1269 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001270 * Installation failed return code: this is passed in the
1271 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the system failed to install the package
1272 * because it is attempting to define a permission that is already defined by some existing
1273 * package.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001274 * <p>
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001275 * The package name of the app which has already defined the permission is passed to a
1276 * {@link PackageInstallObserver}, if any, as the {@link #EXTRA_FAILURE_EXISTING_PACKAGE} string
1277 * extra; and the name of the permission being redefined is passed in the
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001278 * {@link #EXTRA_FAILURE_EXISTING_PERMISSION} string extra.
Christopher Tatef1977b42014-03-24 16:25:51 -07001279 *
Christopher Tatef1977b42014-03-24 16:25:51 -07001280 * @hide
1281 */
1282 public static final int INSTALL_FAILED_DUPLICATE_PERMISSION = -112;
1283
1284 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001285 * Installation failed return code: this is passed in the
1286 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the system failed to install the package
1287 * because its packaged native code did not match any of the ABIs supported by the system.
Ramin Zaghi1378aba2014-02-28 15:03:19 +00001288 *
1289 * @hide
1290 */
Narayan Kamathd11f2232014-04-10 10:37:17 +01001291 public static final int INSTALL_FAILED_NO_MATCHING_ABIS = -113;
Ramin Zaghi1378aba2014-02-28 15:03:19 +00001292
1293 /**
1294 * Internal return code for NativeLibraryHelper methods to indicate that the package
1295 * being processed did not contain any native code. This is placed here only so that
1296 * it can belong to the same value space as the other install failure codes.
1297 *
1298 * @hide
1299 */
Narayan Kamathd11f2232014-04-10 10:37:17 +01001300 public static final int NO_NATIVE_LIBRARIES = -114;
Ramin Zaghi1378aba2014-02-28 15:03:19 +00001301
Jeff Sharkey7328a1b2014-08-07 14:01:43 -07001302 /** {@hide} */
Jeff Sharkeyf0600952014-08-07 17:31:53 -07001303 public static final int INSTALL_FAILED_ABORTED = -115;
Jeff Sharkey7328a1b2014-08-07 14:01:43 -07001304
Ramin Zaghi1378aba2014-02-28 15:03:19 +00001305 /**
Todd Kennedybe0b8892017-02-15 14:13:52 -08001306 * Installation failed return code: instant app installs are incompatible with some
Todd Kennedy2699f062015-11-20 13:07:17 -08001307 * other installation flags supplied for the operation; or other circumstances such
Todd Kennedybe0b8892017-02-15 14:13:52 -08001308 * as trying to upgrade a system app via an instant app install.
Todd Kennedy2699f062015-11-20 13:07:17 -08001309 * @hide
1310 */
Todd Kennedybe0b8892017-02-15 14:13:52 -08001311 public static final int INSTALL_FAILED_INSTANT_APP_INVALID = -116;
Todd Kennedy2699f062015-11-20 13:07:17 -08001312
Calin Juravle3fc56c32017-12-11 18:26:13 -08001313 /**
1314 * Installation parse return code: this is passed in the
1315 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the dex metadata file is invalid or
1316 * if there was no matching apk file for a dex metadata file.
1317 *
1318 * @hide
1319 */
1320 public static final int INSTALL_FAILED_BAD_DEX_METADATA = -117;
1321
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001322 /** @hide */
Jeff Sharkey4347f812017-04-21 12:08:39 -06001323 @IntDef(flag = true, prefix = { "DELETE_" }, value = {
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001324 DELETE_KEEP_DATA,
1325 DELETE_ALL_USERS,
1326 DELETE_SYSTEM_APP,
Todd Kennedy39bfee52016-02-24 10:28:21 -08001327 DELETE_DONT_KILL_APP,
Todd Kennedy232d29e2017-11-06 14:45:53 -08001328 DELETE_CHATTY,
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001329 })
1330 @Retention(RetentionPolicy.SOURCE)
1331 public @interface DeleteFlags {}
1332
Todd Kennedy2699f062015-11-20 13:07:17 -08001333 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001334 * Flag parameter for {@link #deletePackage} to indicate that you don't want to delete the
1335 * package's data directory.
1336 *
1337 * @hide
1338 */
Dianne Hackborn7767eac2012-08-23 18:25:40 -07001339 public static final int DELETE_KEEP_DATA = 0x00000001;
1340
1341 /**
1342 * Flag parameter for {@link #deletePackage} to indicate that you want the
1343 * package deleted for all users.
1344 *
1345 * @hide
1346 */
1347 public static final int DELETE_ALL_USERS = 0x00000002;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001348
1349 /**
Dianne Hackbornc895be72013-03-11 17:48:43 -07001350 * Flag parameter for {@link #deletePackage} to indicate that, if you are calling
1351 * uninstall on a system that has been updated, then don't do the normal process
1352 * of uninstalling the update and rolling back to the older system version (which
1353 * needs to happen for all users); instead, just mark the app as uninstalled for
1354 * the current user.
1355 *
1356 * @hide
1357 */
1358 public static final int DELETE_SYSTEM_APP = 0x00000004;
1359
1360 /**
Todd Kennedy39bfee52016-02-24 10:28:21 -08001361 * Flag parameter for {@link #deletePackage} to indicate that, if you are calling
1362 * uninstall on a package that is replaced to provide new feature splits, the
1363 * existing application should not be killed during the removal process.
1364 *
1365 * @hide
1366 */
1367 public static final int DELETE_DONT_KILL_APP = 0x00000008;
1368
1369 /**
Todd Kennedy232d29e2017-11-06 14:45:53 -08001370 * Flag parameter for {@link #deletePackage} to indicate that package deletion
1371 * should be chatty.
1372 *
1373 * @hide
1374 */
1375 public static final int DELETE_CHATTY = 0x80000000;
1376
1377 /**
Kenny Rootc39bb4a2011-02-28 13:27:19 -08001378 * Return code for when package deletion succeeds. This is passed to the
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001379 * {@link IPackageDeleteObserver} if the system succeeded in deleting the
1380 * package.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001381 *
Kenny Rootc39bb4a2011-02-28 13:27:19 -08001382 * @hide
1383 */
1384 public static final int DELETE_SUCCEEDED = 1;
1385
1386 /**
1387 * Deletion failed return code: this is passed to the
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001388 * {@link IPackageDeleteObserver} if the system failed to delete the package
1389 * for an unspecified reason.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001390 *
Kenny Rootc39bb4a2011-02-28 13:27:19 -08001391 * @hide
1392 */
1393 public static final int DELETE_FAILED_INTERNAL_ERROR = -1;
1394
1395 /**
1396 * Deletion failed return code: this is passed to the
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001397 * {@link IPackageDeleteObserver} if the system failed to delete the package
1398 * because it is the active DevicePolicy manager.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001399 *
Kenny Rootc39bb4a2011-02-28 13:27:19 -08001400 * @hide
1401 */
1402 public static final int DELETE_FAILED_DEVICE_POLICY_MANAGER = -2;
1403
1404 /**
Amith Yamasanie4cf7342012-12-17 11:12:09 -08001405 * Deletion failed return code: this is passed to the
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001406 * {@link IPackageDeleteObserver} if the system failed to delete the package
1407 * since the user is restricted.
Amith Yamasanie4cf7342012-12-17 11:12:09 -08001408 *
1409 * @hide
1410 */
1411 public static final int DELETE_FAILED_USER_RESTRICTED = -3;
1412
1413 /**
Kenny Guy1b88da52014-07-10 16:33:49 +01001414 * Deletion failed return code: this is passed to the
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001415 * {@link IPackageDeleteObserver} if the system failed to delete the package
1416 * because a profile or device owner has marked the package as
1417 * uninstallable.
Kenny Guyc13053b2014-05-29 14:17:17 +01001418 *
1419 * @hide
1420 */
Jeff Sharkeyf0600952014-08-07 17:31:53 -07001421 public static final int DELETE_FAILED_OWNER_BLOCKED = -4;
1422
1423 /** {@hide} */
1424 public static final int DELETE_FAILED_ABORTED = -5;
Kenny Guyc13053b2014-05-29 14:17:17 +01001425
1426 /**
Svet Ganov67882122016-12-11 16:36:34 -08001427 * Deletion failed return code: this is passed to the
1428 * {@link IPackageDeleteObserver} if the system failed to delete the package
1429 * because the packge is a shared library used by other installed packages.
1430 * {@hide} */
1431 public static final int DELETE_FAILED_USED_SHARED_LIBRARY = -6;
1432
1433 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001434 * Return code that is passed to the {@link IPackageMoveObserver} when the
Kenny Rootc39bb4a2011-02-28 13:27:19 -08001435 * package has been successfully moved by the system.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001436 *
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001437 * @hide
1438 */
Jeff Sharkey620b32b2015-04-23 19:36:02 -07001439 public static final int MOVE_SUCCEEDED = -100;
1440
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001441 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001442 * Error code that is passed to the {@link IPackageMoveObserver} when the
1443 * package hasn't been successfully moved by the system because of
1444 * insufficient memory on specified media.
1445 *
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001446 * @hide
1447 */
1448 public static final int MOVE_FAILED_INSUFFICIENT_STORAGE = -1;
1449
1450 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001451 * Error code that is passed to the {@link IPackageMoveObserver} if the
1452 * specified package doesn't exist.
1453 *
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001454 * @hide
1455 */
1456 public static final int MOVE_FAILED_DOESNT_EXIST = -2;
1457
1458 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001459 * Error code that is passed to the {@link IPackageMoveObserver} if the
1460 * specified package cannot be moved since its a system package.
1461 *
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001462 * @hide
1463 */
1464 public static final int MOVE_FAILED_SYSTEM_PACKAGE = -3;
1465
1466 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001467 * Error code that is passed to the {@link IPackageMoveObserver} if the
1468 * specified package cannot be moved since its forward locked.
1469 *
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001470 * @hide
1471 */
1472 public static final int MOVE_FAILED_FORWARD_LOCKED = -4;
1473
1474 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001475 * Error code that is passed to the {@link IPackageMoveObserver} if the
1476 * specified package cannot be moved to the specified location.
1477 *
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001478 * @hide
1479 */
1480 public static final int MOVE_FAILED_INVALID_LOCATION = -5;
1481
1482 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001483 * Error code that is passed to the {@link IPackageMoveObserver} if the
1484 * specified package cannot be moved to the specified location.
1485 *
Suchi Amalapurapu8a9ab242010-03-11 16:49:16 -08001486 * @hide
1487 */
1488 public static final int MOVE_FAILED_INTERNAL_ERROR = -6;
1489
1490 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001491 * Error code that is passed to the {@link IPackageMoveObserver} if the
1492 * specified package already has an operation pending in the queue.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001493 *
Kenny Rootdeb11262010-08-02 11:36:21 -07001494 * @hide
1495 */
1496 public static final int MOVE_FAILED_OPERATION_PENDING = -7;
1497
1498 /**
Makoto Onukif34db0a2016-02-17 11:17:15 -08001499 * Error code that is passed to the {@link IPackageMoveObserver} if the
1500 * specified package cannot be moved since it contains a device admin.
1501 *
1502 * @hide
1503 */
1504 public static final int MOVE_FAILED_DEVICE_ADMIN = -8;
1505
1506 /**
Yao Chen022b8ea2016-12-16 11:03:28 -08001507 * Error code that is passed to the {@link IPackageMoveObserver} if system does not allow
1508 * non-system apps to be moved to internal storage.
1509 *
1510 * @hide
1511 */
1512 public static final int MOVE_FAILED_3RD_PARTY_NOT_ALLOWED_ON_INTERNAL = -9;
1513
Jeff Sharkeya65e6492017-06-21 13:45:11 -06001514 /** @hide */
1515 public static final int MOVE_FAILED_LOCKED_USER = -10;
1516
Yao Chen022b8ea2016-12-16 11:03:28 -08001517 /**
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001518 * Flag parameter for {@link #movePackage} to indicate that
1519 * the package should be moved to internal storage if its
1520 * been installed on external media.
1521 * @hide
1522 */
Jeff Sharkey620b32b2015-04-23 19:36:02 -07001523 @Deprecated
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001524 public static final int MOVE_INTERNAL = 0x00000001;
1525
1526 /**
1527 * Flag parameter for {@link #movePackage} to indicate that
1528 * the package should be moved to external media.
1529 * @hide
1530 */
Jeff Sharkey620b32b2015-04-23 19:36:02 -07001531 @Deprecated
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001532 public static final int MOVE_EXTERNAL_MEDIA = 0x00000002;
1533
Jeff Sharkey620b32b2015-04-23 19:36:02 -07001534 /** {@hide} */
1535 public static final String EXTRA_MOVE_ID = "android.content.pm.extra.MOVE_ID";
1536
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001537 /**
Kenny Root05ca4c92011-09-15 10:36:25 -07001538 * Usable by the required verifier as the {@code verificationCode} argument
1539 * for {@link PackageManager#verifyPendingInstall} to indicate that it will
1540 * allow the installation to proceed without any of the optional verifiers
1541 * needing to vote.
1542 *
1543 * @hide
1544 */
1545 public static final int VERIFICATION_ALLOW_WITHOUT_SUFFICIENT = 2;
1546
1547 /**
Kenny Root3a9b5fb2011-09-20 14:15:38 -07001548 * Used as the {@code verificationCode} argument for
1549 * {@link PackageManager#verifyPendingInstall} to indicate that the calling
1550 * package verifier allows the installation to proceed.
1551 */
1552 public static final int VERIFICATION_ALLOW = 1;
1553
1554 /**
1555 * Used as the {@code verificationCode} argument for
1556 * {@link PackageManager#verifyPendingInstall} to indicate the calling
1557 * package verifier does not vote to allow the installation to proceed.
1558 */
1559 public static final int VERIFICATION_REJECT = -1;
1560
1561 /**
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001562 * Used as the {@code verificationCode} argument for
1563 * {@link PackageManager#verifyIntentFilter} to indicate that the calling
1564 * IntentFilter Verifier confirms that the IntentFilter is verified.
1565 *
1566 * @hide
1567 */
Todd Kennedydfa93ab2016-03-03 15:24:33 -08001568 @SystemApi
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001569 public static final int INTENT_FILTER_VERIFICATION_SUCCESS = 1;
1570
1571 /**
1572 * Used as the {@code verificationCode} argument for
1573 * {@link PackageManager#verifyIntentFilter} to indicate that the calling
1574 * IntentFilter Verifier confirms that the IntentFilter is NOT verified.
1575 *
1576 * @hide
1577 */
Todd Kennedydfa93ab2016-03-03 15:24:33 -08001578 @SystemApi
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001579 public static final int INTENT_FILTER_VERIFICATION_FAILURE = -1;
1580
1581 /**
1582 * Internal status code to indicate that an IntentFilter verification result is not specified.
1583 *
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_UNDEFINED = 0;
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 * will always be prompted the Intent Disambiguation Dialog if there are two
1593 * or more Intent resolved for the IntentFilter's domain(s).
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001594 *
1595 * @hide
1596 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08001597 @SystemApi
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001598 public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK = 1;
1599
1600 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001601 * Used as the {@code status} argument for
1602 * {@link #updateIntentVerificationStatusAsUser} to indicate that the User
1603 * will never be prompted the Intent Disambiguation Dialog if there are two
1604 * or more resolution of the Intent. The default App for the domain(s)
1605 * specified in the IntentFilter will also ALWAYS be used.
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001606 *
1607 * @hide
1608 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08001609 @SystemApi
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001610 public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS = 2;
1611
1612 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001613 * Used as the {@code status} argument for
1614 * {@link #updateIntentVerificationStatusAsUser} to indicate that the User
1615 * may be prompted the Intent Disambiguation Dialog if there are two or more
1616 * Intent resolved. The default App for the domain(s) specified in the
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001617 * IntentFilter will also NEVER be presented to the User.
1618 *
1619 * @hide
1620 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08001621 @SystemApi
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001622 public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER = 3;
1623
1624 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001625 * Used as the {@code status} argument for
1626 * {@link #updateIntentVerificationStatusAsUser} to indicate that this app
1627 * should always be considered as an ambiguous candidate for handling the
1628 * matching Intent even if there are other candidate apps in the "always"
1629 * state. Put another way: if there are any 'always ask' apps in a set of
1630 * more than one candidate app, then a disambiguation is *always* presented
1631 * even if there is another candidate app with the 'always' state.
Christopher Tate56f0ff32015-08-13 16:29:33 -07001632 *
1633 * @hide
1634 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08001635 @SystemApi
Christopher Tate56f0ff32015-08-13 16:29:33 -07001636 public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS_ASK = 4;
1637
1638 /**
rich canningsd9ef3e52012-08-22 14:28:05 -07001639 * Can be used as the {@code millisecondsToDelay} argument for
1640 * {@link PackageManager#extendVerificationTimeout}. This is the
1641 * maximum time {@code PackageManager} waits for the verification
1642 * agent to return (in milliseconds).
1643 */
1644 public static final long MAXIMUM_VERIFICATION_TIMEOUT = 60*60*1000;
1645
1646 /**
Amith Yamasani0b285492011-04-14 17:35:23 -07001647 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: The device's
1648 * audio pipeline is low-latency, more suitable for audio applications sensitive to delays or
1649 * lag in sound input or output.
Dan Morrill898e1e82010-09-26 17:28:30 -07001650 */
1651 @SdkConstant(SdkConstantType.FEATURE)
1652 public static final String FEATURE_AUDIO_LOW_LATENCY = "android.hardware.audio.low_latency";
1653
1654 /**
1655 * Feature for {@link #getSystemAvailableFeatures} and
Unsuk Jung50909f62014-09-02 18:25:49 -07001656 * {@link #hasSystemFeature}: The device includes at least one form of audio
1657 * output, such as speakers, audio jack or streaming over bluetooth
1658 */
1659 @SdkConstant(SdkConstantType.FEATURE)
1660 public static final String FEATURE_AUDIO_OUTPUT = "android.hardware.audio.output";
1661
1662 /**
Glenn Kastencdcb5772015-05-06 15:54:49 -07001663 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Glenn Kasten7587edc2015-10-30 17:45:52 -07001664 * The device has professional audio level of functionality and performance.
Glenn Kastencdcb5772015-05-06 15:54:49 -07001665 */
1666 @SdkConstant(SdkConstantType.FEATURE)
1667 public static final String FEATURE_AUDIO_PRO = "android.hardware.audio.pro";
1668
1669 /**
Unsuk Jung50909f62014-09-02 18:25:49 -07001670 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001671 * {@link #hasSystemFeature}: The device is capable of communicating with
1672 * other devices via Bluetooth.
1673 */
1674 @SdkConstant(SdkConstantType.FEATURE)
1675 public static final String FEATURE_BLUETOOTH = "android.hardware.bluetooth";
1676
1677 /**
1678 * Feature for {@link #getSystemAvailableFeatures} and
Matthew Xiea7227722013-04-18 15:25:59 -07001679 * {@link #hasSystemFeature}: The device is capable of communicating with
1680 * other devices via Bluetooth Low Energy radio.
1681 */
1682 @SdkConstant(SdkConstantType.FEATURE)
1683 public static final String FEATURE_BLUETOOTH_LE = "android.hardware.bluetooth_le";
1684
1685 /**
1686 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001687 * {@link #hasSystemFeature}: The device has a camera facing away
1688 * from the screen.
1689 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001690 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001691 public static final String FEATURE_CAMERA = "android.hardware.camera";
Dan Morrill50ab63f2010-03-05 16:16:19 -08001692
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001693 /**
1694 * Feature for {@link #getSystemAvailableFeatures} and
1695 * {@link #hasSystemFeature}: The device's camera supports auto-focus.
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_AUTOFOCUS = "android.hardware.camera.autofocus";
Dan Morrill50ab63f2010-03-05 16:16:19 -08001699
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001700 /**
1701 * Feature for {@link #getSystemAvailableFeatures} and
Eino-Ville Talvala752af832012-09-18 14:45:37 -07001702 * {@link #hasSystemFeature}: The device has at least one camera pointing in
Eino-Ville Talvala9131da22014-05-08 11:39:53 -07001703 * some direction, or can support an external camera being connected to it.
Eino-Ville Talvala752af832012-09-18 14:45:37 -07001704 */
1705 @SdkConstant(SdkConstantType.FEATURE)
1706 public static final String FEATURE_CAMERA_ANY = "android.hardware.camera.any";
1707
1708 /**
1709 * Feature for {@link #getSystemAvailableFeatures} and
Eino-Ville Talvala9131da22014-05-08 11:39:53 -07001710 * {@link #hasSystemFeature}: The device can support having an external camera connected to it.
1711 * The external camera may not always be connected or available to applications to use.
1712 */
1713 @SdkConstant(SdkConstantType.FEATURE)
1714 public static final String FEATURE_CAMERA_EXTERNAL = "android.hardware.camera.external";
1715
1716 /**
1717 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001718 * {@link #hasSystemFeature}: The device's camera supports flash.
1719 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001720 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001721 public static final String FEATURE_CAMERA_FLASH = "android.hardware.camera.flash";
Dan Morrill50ab63f2010-03-05 16:16:19 -08001722
1723 /**
1724 * Feature for {@link #getSystemAvailableFeatures} and
Chih-Chung Changde1057c2010-06-14 19:15:00 +08001725 * {@link #hasSystemFeature}: The device has a front facing camera.
1726 */
1727 @SdkConstant(SdkConstantType.FEATURE)
1728 public static final String FEATURE_CAMERA_FRONT = "android.hardware.camera.front";
1729
1730 /**
Eino-Ville Talvala611fece2014-07-10 17:29:38 -07001731 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one
1732 * of the cameras on the device supports the
1733 * {@link android.hardware.camera2.CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL full hardware}
1734 * capability level.
1735 */
1736 @SdkConstant(SdkConstantType.FEATURE)
1737 public static final String FEATURE_CAMERA_LEVEL_FULL = "android.hardware.camera.level.full";
1738
1739 /**
1740 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one
1741 * of the cameras on the device supports the
1742 * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR manual sensor}
1743 * capability level.
1744 */
1745 @SdkConstant(SdkConstantType.FEATURE)
1746 public static final String FEATURE_CAMERA_CAPABILITY_MANUAL_SENSOR =
1747 "android.hardware.camera.capability.manual_sensor";
1748
1749 /**
1750 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one
1751 * of the cameras on the device supports the
1752 * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MANUAL_POST_PROCESSING manual post-processing}
1753 * capability level.
1754 */
1755 @SdkConstant(SdkConstantType.FEATURE)
1756 public static final String FEATURE_CAMERA_CAPABILITY_MANUAL_POST_PROCESSING =
1757 "android.hardware.camera.capability.manual_post_processing";
1758
1759 /**
1760 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one
1761 * of the cameras on the device supports the
1762 * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_RAW RAW}
1763 * capability level.
1764 */
1765 @SdkConstant(SdkConstantType.FEATURE)
1766 public static final String FEATURE_CAMERA_CAPABILITY_RAW =
1767 "android.hardware.camera.capability.raw";
1768
1769 /**
Eino-Ville Talvaladfa0c2a2018-01-10 12:01:08 -08001770 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one
1771 * of the cameras on the device supports the
1772 * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MOTION_TRACKING
1773 * MOTION_TRACKING} capability level.
1774 */
1775 @SdkConstant(SdkConstantType.FEATURE)
1776 public static final String FEATURE_CAMERA_AR =
1777 "android.hardware.camera.ar";
1778
1779 /**
Chih-Chung Changde1057c2010-06-14 19:15:00 +08001780 * Feature for {@link #getSystemAvailableFeatures} and
Alex Ray0c9d61f2013-10-03 12:17:54 -07001781 * {@link #hasSystemFeature}: The device is capable of communicating with
1782 * consumer IR devices.
1783 */
1784 @SdkConstant(SdkConstantType.FEATURE)
1785 public static final String FEATURE_CONSUMER_IR = "android.hardware.consumerir";
1786
Sam Lin90e258b2017-04-03 20:57:45 -07001787 /** {@hide} */
1788 @SdkConstant(SdkConstantType.FEATURE)
1789 public static final String FEATURE_CTS = "android.software.cts";
1790
Alex Ray0c9d61f2013-10-03 12:17:54 -07001791 /**
1792 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001793 * {@link #hasSystemFeature}: The device supports one or more methods of
1794 * reporting current location.
1795 */
1796 @SdkConstant(SdkConstantType.FEATURE)
1797 public static final String FEATURE_LOCATION = "android.hardware.location";
1798
1799 /**
1800 * Feature for {@link #getSystemAvailableFeatures} and
1801 * {@link #hasSystemFeature}: The device has a Global Positioning System
1802 * receiver and can report precise location.
1803 */
1804 @SdkConstant(SdkConstantType.FEATURE)
1805 public static final String FEATURE_LOCATION_GPS = "android.hardware.location.gps";
1806
1807 /**
1808 * Feature for {@link #getSystemAvailableFeatures} and
1809 * {@link #hasSystemFeature}: The device can report location with coarse
1810 * accuracy using a network-based geolocation system.
1811 */
1812 @SdkConstant(SdkConstantType.FEATURE)
1813 public static final String FEATURE_LOCATION_NETWORK = "android.hardware.location.network";
1814
1815 /**
1816 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn2a103f12017-08-08 15:50:31 -07001817 * {@link #hasSystemFeature}: The device's
1818 * {@link ActivityManager#isLowRamDevice() ActivityManager.isLowRamDevice()} method returns
1819 * true.
1820 */
1821 @SdkConstant(SdkConstantType.FEATURE)
1822 public static final String FEATURE_RAM_LOW = "android.hardware.ram.low";
1823
1824 /**
1825 * Feature for {@link #getSystemAvailableFeatures} and
1826 * {@link #hasSystemFeature}: The device's
1827 * {@link ActivityManager#isLowRamDevice() ActivityManager.isLowRamDevice()} method returns
1828 * false.
1829 */
1830 @SdkConstant(SdkConstantType.FEATURE)
1831 public static final String FEATURE_RAM_NORMAL = "android.hardware.ram.normal";
1832
1833 /**
1834 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001835 * {@link #hasSystemFeature}: The device can record audio via a
1836 * microphone.
1837 */
1838 @SdkConstant(SdkConstantType.FEATURE)
1839 public static final String FEATURE_MICROPHONE = "android.hardware.microphone";
1840
1841 /**
1842 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill76437d32010-09-01 11:17:20 -07001843 * {@link #hasSystemFeature}: The device can communicate using Near-Field
1844 * Communications (NFC).
1845 */
1846 @SdkConstant(SdkConstantType.FEATURE)
1847 public static final String FEATURE_NFC = "android.hardware.nfc";
1848
1849 /**
1850 * Feature for {@link #getSystemAvailableFeatures} and
Martijn Coenenf4bf1582013-07-22 12:01:19 -07001851 * {@link #hasSystemFeature}: The device supports host-
1852 * based NFC card emulation.
Martijn Coenendf4d1d62013-08-28 11:18:58 -07001853 *
1854 * TODO remove when depending apps have moved to new constant.
1855 * @hide
1856 * @deprecated
Martijn Coenenf4bf1582013-07-22 12:01:19 -07001857 */
Jose Lima970417c2014-04-10 10:42:19 -07001858 @Deprecated
Martijn Coenenf4bf1582013-07-22 12:01:19 -07001859 @SdkConstant(SdkConstantType.FEATURE)
1860 public static final String FEATURE_NFC_HCE = "android.hardware.nfc.hce";
1861
1862 /**
1863 * Feature for {@link #getSystemAvailableFeatures} and
Martijn Coenendf4d1d62013-08-28 11:18:58 -07001864 * {@link #hasSystemFeature}: The device supports host-
1865 * based NFC card emulation.
1866 */
1867 @SdkConstant(SdkConstantType.FEATURE)
1868 public static final String FEATURE_NFC_HOST_CARD_EMULATION = "android.hardware.nfc.hce";
1869
1870 /**
1871 * Feature for {@link #getSystemAvailableFeatures} and
Yoshinobu Itoc52adfe2016-01-22 18:14:18 +09001872 * {@link #hasSystemFeature}: The device supports host-
1873 * based NFC-F card emulation.
1874 */
1875 @SdkConstant(SdkConstantType.FEATURE)
1876 public static final String FEATURE_NFC_HOST_CARD_EMULATION_NFCF = "android.hardware.nfc.hcef";
1877
1878 /**
1879 * Feature for {@link #getSystemAvailableFeatures} and
Martijn Coenen441d61b2017-04-12 13:52:40 -07001880 * {@link #hasSystemFeature}: The device supports any
1881 * one of the {@link #FEATURE_NFC}, {@link #FEATURE_NFC_HOST_CARD_EMULATION},
1882 * or {@link #FEATURE_NFC_HOST_CARD_EMULATION_NFCF} features.
1883 *
1884 * @hide
1885 */
1886 @SdkConstant(SdkConstantType.FEATURE)
1887 public static final String FEATURE_NFC_ANY = "android.hardware.nfc.any";
1888
1889 /**
1890 * Feature for {@link #getSystemAvailableFeatures} and
Jesse Hall7f517062014-07-18 11:54:41 -07001891 * {@link #hasSystemFeature}: The device supports the OpenGL ES
1892 * <a href="http://www.khronos.org/registry/gles/extensions/ANDROID/ANDROID_extension_pack_es31a.txt">
1893 * Android Extension Pack</a>.
1894 */
1895 @SdkConstant(SdkConstantType.FEATURE)
1896 public static final String FEATURE_OPENGLES_EXTENSION_PACK = "android.hardware.opengles.aep";
1897
1898 /**
1899 * Feature for {@link #getSystemAvailableFeatures} and
Jesse Hall39ceeb52016-03-10 09:04:26 -08001900 * {@link #hasSystemFeature(String, int)}: If this feature is supported, the Vulkan native API
1901 * will enumerate at least one {@code VkPhysicalDevice}, and the feature version will indicate
1902 * what level of optional hardware features limits it supports.
Jesse Hallf77a34f2016-02-04 18:41:33 -08001903 * <p>
1904 * Level 0 includes the base Vulkan requirements as well as:
1905 * <ul><li>{@code VkPhysicalDeviceFeatures::textureCompressionETC2}</li></ul>
1906 * <p>
1907 * Level 1 additionally includes:
1908 * <ul>
1909 * <li>{@code VkPhysicalDeviceFeatures::fullDrawIndexUint32}</li>
1910 * <li>{@code VkPhysicalDeviceFeatures::imageCubeArray}</li>
1911 * <li>{@code VkPhysicalDeviceFeatures::independentBlend}</li>
1912 * <li>{@code VkPhysicalDeviceFeatures::geometryShader}</li>
1913 * <li>{@code VkPhysicalDeviceFeatures::tessellationShader}</li>
1914 * <li>{@code VkPhysicalDeviceFeatures::sampleRateShading}</li>
1915 * <li>{@code VkPhysicalDeviceFeatures::textureCompressionASTC_LDR}</li>
1916 * <li>{@code VkPhysicalDeviceFeatures::fragmentStoresAndAtomics}</li>
1917 * <li>{@code VkPhysicalDeviceFeatures::shaderImageGatherExtended}</li>
1918 * <li>{@code VkPhysicalDeviceFeatures::shaderUniformBufferArrayDynamicIndexing}</li>
1919 * <li>{@code VkPhysicalDeviceFeatures::shaderSampledImageArrayDynamicIndexing}</li>
1920 * </ul>
1921 */
1922 @SdkConstant(SdkConstantType.FEATURE)
1923 public static final String FEATURE_VULKAN_HARDWARE_LEVEL = "android.hardware.vulkan.level";
1924
1925 /**
1926 * Feature for {@link #getSystemAvailableFeatures} and
Jesse Hall1cd7e932017-02-05 19:58:15 -08001927 * {@link #hasSystemFeature(String, int)}: If this feature is supported, the Vulkan native API
1928 * will enumerate at least one {@code VkPhysicalDevice}, and the feature version will indicate
Jesse Hall54fc6092017-08-22 07:19:56 -07001929 * what level of optional compute features that device supports beyond the Vulkan 1.0
1930 * requirements.
Jesse Hall1cd7e932017-02-05 19:58:15 -08001931 * <p>
Jesse Hall54fc6092017-08-22 07:19:56 -07001932 * Compute level 0 indicates:
1933 * <ul>
1934 * <li>The {@code VK_KHR_variable_pointers} extension and
1935 * {@code VkPhysicalDeviceVariablePointerFeaturesKHR::variablePointers} feature are
1936 supported.</li>
1937 * <li>{@code VkPhysicalDeviceLimits::maxPerStageDescriptorStorageBuffers} is at least 16.</li>
1938 * </ul>
Jesse Hall1cd7e932017-02-05 19:58:15 -08001939 */
1940 @SdkConstant(SdkConstantType.FEATURE)
1941 public static final String FEATURE_VULKAN_HARDWARE_COMPUTE = "android.hardware.vulkan.compute";
1942
1943 /**
1944 * Feature for {@link #getSystemAvailableFeatures} and
Jesse Hall39ceeb52016-03-10 09:04:26 -08001945 * {@link #hasSystemFeature(String, int)}: The version of this feature indicates the highest
Jesse Hallf77a34f2016-02-04 18:41:33 -08001946 * {@code VkPhysicalDeviceProperties::apiVersion} supported by the physical devices that support
1947 * the hardware level indicated by {@link #FEATURE_VULKAN_HARDWARE_LEVEL}. The feature version
1948 * uses the same encoding as Vulkan version numbers:
1949 * <ul>
1950 * <li>Major version number in bits 31-22</li>
1951 * <li>Minor version number in bits 21-12</li>
1952 * <li>Patch version number in bits 11-0</li>
1953 * </ul>
Jesse Hall239373f2018-01-26 11:35:10 +08001954 * A version of 1.1.0 or higher also indicates:
1955 * <ul>
1956 * <li>The {@code VK_ANDROID_external_memory_android_hardware_buffer} extension is
1957 * supported.</li>
1958 * <li>{@code SYNC_FD} external semaphore and fence handles are supported.</li>
1959 * <li>{@code VkPhysicalDeviceSamplerYcbcrConversionFeatures::samplerYcbcrConversion} is
1960 * supported.</li>
1961 * </ul>
Jesse Hallf77a34f2016-02-04 18:41:33 -08001962 */
1963 @SdkConstant(SdkConstantType.FEATURE)
1964 public static final String FEATURE_VULKAN_HARDWARE_VERSION = "android.hardware.vulkan.version";
1965
1966 /**
Tomasz Wasilczyk05392d62017-07-10 19:33:22 -07001967 * Feature for {@link #getSystemAvailableFeatures} and
1968 * {@link #hasSystemFeature}: The device includes broadcast radio tuner.
1969 * @hide
Tomasz Wasilczyk347192e2017-04-04 11:13:44 -07001970 */
Tomasz Wasilczyk05392d62017-07-10 19:33:22 -07001971 @SystemApi
Tomasz Wasilczyk347192e2017-04-04 11:13:44 -07001972 @SdkConstant(SdkConstantType.FEATURE)
Tomasz Wasilczyk05392d62017-07-10 19:33:22 -07001973 public static final String FEATURE_BROADCAST_RADIO = "android.hardware.broadcastradio";
Tomasz Wasilczyk347192e2017-04-04 11:13:44 -07001974
1975 /**
Jesse Hallf77a34f2016-02-04 18:41:33 -08001976 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill5744bb42010-09-01 19:18:57 -07001977 * {@link #hasSystemFeature}: The device includes an accelerometer.
1978 */
1979 @SdkConstant(SdkConstantType.FEATURE)
1980 public static final String FEATURE_SENSOR_ACCELEROMETER = "android.hardware.sensor.accelerometer";
1981
1982 /**
1983 * Feature for {@link #getSystemAvailableFeatures} and
1984 * {@link #hasSystemFeature}: The device includes a barometer (air
1985 * pressure sensor.)
1986 */
1987 @SdkConstant(SdkConstantType.FEATURE)
1988 public static final String FEATURE_SENSOR_BAROMETER = "android.hardware.sensor.barometer";
1989
1990 /**
1991 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001992 * {@link #hasSystemFeature}: The device includes a magnetometer (compass).
1993 */
1994 @SdkConstant(SdkConstantType.FEATURE)
1995 public static final String FEATURE_SENSOR_COMPASS = "android.hardware.sensor.compass";
1996
1997 /**
1998 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill5744bb42010-09-01 19:18:57 -07001999 * {@link #hasSystemFeature}: The device includes a gyroscope.
Dan Morrill50ab63f2010-03-05 16:16:19 -08002000 */
2001 @SdkConstant(SdkConstantType.FEATURE)
Dan Morrill5744bb42010-09-01 19:18:57 -07002002 public static final String FEATURE_SENSOR_GYROSCOPE = "android.hardware.sensor.gyroscope";
Dan Morrill50ab63f2010-03-05 16:16:19 -08002003
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002004 /**
2005 * Feature for {@link #getSystemAvailableFeatures} and
2006 * {@link #hasSystemFeature}: The device includes a light sensor.
2007 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08002008 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002009 public static final String FEATURE_SENSOR_LIGHT = "android.hardware.sensor.light";
Dan Morrill50ab63f2010-03-05 16:16:19 -08002010
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002011 /**
2012 * Feature for {@link #getSystemAvailableFeatures} and
2013 * {@link #hasSystemFeature}: The device includes a proximity sensor.
2014 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08002015 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002016 public static final String FEATURE_SENSOR_PROXIMITY = "android.hardware.sensor.proximity";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002017
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002018 /**
2019 * Feature for {@link #getSystemAvailableFeatures} and
Aravind Akella068b0c02013-10-12 17:39:15 -07002020 * {@link #hasSystemFeature}: The device includes a hardware step counter.
2021 */
2022 @SdkConstant(SdkConstantType.FEATURE)
2023 public static final String FEATURE_SENSOR_STEP_COUNTER = "android.hardware.sensor.stepcounter";
2024
2025 /**
2026 * Feature for {@link #getSystemAvailableFeatures} and
2027 * {@link #hasSystemFeature}: The device includes a hardware step detector.
2028 */
2029 @SdkConstant(SdkConstantType.FEATURE)
2030 public static final String FEATURE_SENSOR_STEP_DETECTOR = "android.hardware.sensor.stepdetector";
2031
2032 /**
2033 * Feature for {@link #getSystemAvailableFeatures} and
Vinod Krishnan8afb23c2014-04-30 11:11:39 -07002034 * {@link #hasSystemFeature}: The device includes a heart rate monitor.
2035 */
2036 @SdkConstant(SdkConstantType.FEATURE)
2037 public static final String FEATURE_SENSOR_HEART_RATE = "android.hardware.sensor.heartrate";
2038
2039 /**
2040 * Feature for {@link #getSystemAvailableFeatures} and
Trevor Johns682c24e2016-04-12 10:13:47 -07002041 * {@link #hasSystemFeature}: The heart rate sensor on this device is an Electrocardiogram.
Vinod Krishnan1ab76892014-08-20 11:11:55 -07002042 */
2043 @SdkConstant(SdkConstantType.FEATURE)
2044 public static final String FEATURE_SENSOR_HEART_RATE_ECG =
2045 "android.hardware.sensor.heartrate.ecg";
2046
2047 /**
2048 * Feature for {@link #getSystemAvailableFeatures} and
Aravind Akella8b8e74b2014-07-09 11:52:39 -07002049 * {@link #hasSystemFeature}: The device includes a relative humidity sensor.
2050 */
2051 @SdkConstant(SdkConstantType.FEATURE)
2052 public static final String FEATURE_SENSOR_RELATIVE_HUMIDITY =
2053 "android.hardware.sensor.relative_humidity";
2054
2055 /**
2056 * Feature for {@link #getSystemAvailableFeatures} and
2057 * {@link #hasSystemFeature}: The device includes an ambient temperature sensor.
2058 */
2059 @SdkConstant(SdkConstantType.FEATURE)
2060 public static final String FEATURE_SENSOR_AMBIENT_TEMPERATURE =
2061 "android.hardware.sensor.ambient_temperature";
2062
2063 /**
2064 * Feature for {@link #getSystemAvailableFeatures} and
Ashutosh Joshieae371b2015-04-09 10:30:07 -07002065 * {@link #hasSystemFeature}: The device supports high fidelity sensor processing
2066 * capabilities.
2067 */
2068 @SdkConstant(SdkConstantType.FEATURE)
2069 public static final String FEATURE_HIFI_SENSORS =
2070 "android.hardware.sensor.hifi_sensors";
2071
2072 /**
2073 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002074 * {@link #hasSystemFeature}: The device has a telephony radio with data
2075 * communication support.
2076 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08002077 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002078 public static final String FEATURE_TELEPHONY = "android.hardware.telephony";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002079
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002080 /**
2081 * Feature for {@link #getSystemAvailableFeatures} and
2082 * {@link #hasSystemFeature}: The device has a CDMA telephony stack.
2083 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08002084 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002085 public static final String FEATURE_TELEPHONY_CDMA = "android.hardware.telephony.cdma";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002086
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002087 /**
2088 * Feature for {@link #getSystemAvailableFeatures} and
2089 * {@link #hasSystemFeature}: The device has a GSM telephony stack.
2090 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08002091 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002092 public static final String FEATURE_TELEPHONY_GSM = "android.hardware.telephony.gsm";
Hung-ying Tyan3424c022010-08-27 18:08:19 +08002093
2094 /**
Polina Bondarenko80909ce2017-01-12 21:10:38 +01002095 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2096 * The device supports telephony carrier restriction mechanism.
2097 *
2098 * <p>Devices declaring this feature must have an implementation of the
2099 * {@link android.telephony.TelephonyManager#getAllowedCarriers} and
2100 * {@link android.telephony.TelephonyManager#setAllowedCarriers}.
2101 * @hide
2102 */
2103 @SystemApi
2104 @SdkConstant(SdkConstantType.FEATURE)
2105 public static final String FEATURE_TELEPHONY_CARRIERLOCK =
2106 "android.hardware.telephony.carrierlock";
2107
2108 /**
Jeff Davidson35cda392017-02-27 09:46:00 -08002109 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: The device
2110 * supports embedded subscriptions on eUICCs.
Jiuyu Sund3bb4ae2018-02-08 16:38:26 +00002111 * TODO(b/35851809): Make this public.
2112 * @hide
Jeff Davidson35cda392017-02-27 09:46:00 -08002113 */
2114 @SdkConstant(SdkConstantType.FEATURE)
2115 public static final String FEATURE_TELEPHONY_EUICC = "android.hardware.telephony.euicc";
2116
2117 /**
Hall Liuc6703d92017-11-17 11:31:57 -08002118 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: The device
2119 * supports cell-broadcast reception using the MBMS APIs.
2120 */
2121 @SdkConstant(SdkConstantType.FEATURE)
2122 public static final String FEATURE_TELEPHONY_MBMS = "android.hardware.telephony.mbms";
2123
2124 /**
Hung-ying Tyan3424c022010-08-27 18:08:19 +08002125 * Feature for {@link #getSystemAvailableFeatures} and
Mike Lockwoodf4ca2472011-02-27 11:23:25 -08002126 * {@link #hasSystemFeature}: The device supports connecting to USB devices
2127 * as the USB host.
2128 */
2129 @SdkConstant(SdkConstantType.FEATURE)
2130 public static final String FEATURE_USB_HOST = "android.hardware.usb.host";
2131
2132 /**
2133 * Feature for {@link #getSystemAvailableFeatures} and
2134 * {@link #hasSystemFeature}: The device supports connecting to USB accessories.
2135 */
2136 @SdkConstant(SdkConstantType.FEATURE)
2137 public static final String FEATURE_USB_ACCESSORY = "android.hardware.usb.accessory";
2138
2139 /**
2140 * Feature for {@link #getSystemAvailableFeatures} and
Hung-ying Tyan3424c022010-08-27 18:08:19 +08002141 * {@link #hasSystemFeature}: The SIP API is enabled on the device.
2142 */
2143 @SdkConstant(SdkConstantType.FEATURE)
2144 public static final String FEATURE_SIP = "android.software.sip";
2145
2146 /**
2147 * Feature for {@link #getSystemAvailableFeatures} and
2148 * {@link #hasSystemFeature}: The device supports SIP-based VOIP.
2149 */
2150 @SdkConstant(SdkConstantType.FEATURE)
2151 public static final String FEATURE_SIP_VOIP = "android.software.sip.voip";
2152
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002153 /**
2154 * Feature for {@link #getSystemAvailableFeatures} and
Ihab Awad1ec68882014-09-12 11:09:01 -07002155 * {@link #hasSystemFeature}: The Connection Service API is enabled on the device.
2156 */
2157 @SdkConstant(SdkConstantType.FEATURE)
2158 public static final String FEATURE_CONNECTION_SERVICE = "android.software.connectionservice";
2159
2160 /**
2161 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrillb0fe0332010-04-05 14:43:58 -07002162 * {@link #hasSystemFeature}: The device's display has a touch screen.
2163 */
2164 @SdkConstant(SdkConstantType.FEATURE)
2165 public static final String FEATURE_TOUCHSCREEN = "android.hardware.touchscreen";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002166
Dan Morrillb0fe0332010-04-05 14:43:58 -07002167 /**
2168 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08002169 * {@link #hasSystemFeature}: The device's touch screen supports
2170 * multitouch sufficient for basic two-finger gesture detection.
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002171 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08002172 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002173 public static final String FEATURE_TOUCHSCREEN_MULTITOUCH = "android.hardware.touchscreen.multitouch";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002174
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002175 /**
2176 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08002177 * {@link #hasSystemFeature}: The device's touch screen is capable of
2178 * tracking two or more fingers fully independently.
2179 */
2180 @SdkConstant(SdkConstantType.FEATURE)
2181 public static final String FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT = "android.hardware.touchscreen.multitouch.distinct";
2182
2183 /**
2184 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill6993d3d2010-09-03 14:30:14 -07002185 * {@link #hasSystemFeature}: The device's touch screen is capable of
2186 * tracking a full hand of fingers fully independently -- that is, 5 or
2187 * more simultaneous independent pointers.
2188 */
2189 @SdkConstant(SdkConstantType.FEATURE)
2190 public static final String FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND = "android.hardware.touchscreen.multitouch.jazzhand";
2191
2192 /**
2193 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrilla5376872011-01-23 13:15:53 -08002194 * {@link #hasSystemFeature}: The device does not have a touch screen, but
2195 * does support touch emulation for basic events. For instance, the
2196 * device might use a mouse or remote control to drive a cursor, and
2197 * emulate basic touch pointer events like down, up, drag, etc. All
2198 * devices that support android.hardware.touchscreen or a sub-feature are
2199 * presumed to also support faketouch.
2200 */
2201 @SdkConstant(SdkConstantType.FEATURE)
2202 public static final String FEATURE_FAKETOUCH = "android.hardware.faketouch";
2203
2204 /**
2205 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborne22fe932011-06-08 20:24:29 -07002206 * {@link #hasSystemFeature}: The device does not have a touch screen, but
2207 * does support touch emulation for basic events that supports distinct
2208 * tracking of two or more fingers. This is an extension of
2209 * {@link #FEATURE_FAKETOUCH} for input devices with this capability. Note
2210 * that unlike a distinct multitouch screen as defined by
2211 * {@link #FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT}, these kinds of input
2212 * devices will not actually provide full two-finger gestures since the
2213 * input is being transformed to cursor movement on the screen. That is,
2214 * single finger gestures will move a cursor; two-finger swipes will
2215 * result in single-finger touch events; other two-finger gestures will
2216 * result in the corresponding two-finger touch event.
2217 */
2218 @SdkConstant(SdkConstantType.FEATURE)
2219 public static final String FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT = "android.hardware.faketouch.multitouch.distinct";
2220
2221 /**
2222 * Feature for {@link #getSystemAvailableFeatures} and
2223 * {@link #hasSystemFeature}: The device does not have a touch screen, but
2224 * does support touch emulation for basic events that supports tracking
2225 * a hand of fingers (5 or more fingers) fully independently.
2226 * This is an extension of
2227 * {@link #FEATURE_FAKETOUCH} for input devices with this capability. Note
2228 * that unlike a multitouch screen as defined by
2229 * {@link #FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND}, not all two finger
2230 * gestures can be detected due to the limitations described for
2231 * {@link #FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT}.
2232 */
2233 @SdkConstant(SdkConstantType.FEATURE)
2234 public static final String FEATURE_FAKETOUCH_MULTITOUCH_JAZZHAND = "android.hardware.faketouch.multitouch.jazzhand";
2235
2236 /**
2237 * Feature for {@link #getSystemAvailableFeatures} and
Jim Millerd9b9d412015-07-22 19:51:40 -07002238 * {@link #hasSystemFeature}: The device has biometric hardware to detect a fingerprint.
2239 */
2240 @SdkConstant(SdkConstantType.FEATURE)
2241 public static final String FEATURE_FINGERPRINT = "android.hardware.fingerprint";
2242
2243 /**
2244 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborne289bff2011-06-13 19:33:22 -07002245 * {@link #hasSystemFeature}: The device supports portrait orientation
2246 * screens. For backwards compatibility, you can assume that if neither
2247 * this nor {@link #FEATURE_SCREEN_LANDSCAPE} is set then the device supports
2248 * both portrait and landscape.
2249 */
2250 @SdkConstant(SdkConstantType.FEATURE)
2251 public static final String FEATURE_SCREEN_PORTRAIT = "android.hardware.screen.portrait";
2252
2253 /**
2254 * Feature for {@link #getSystemAvailableFeatures} and
2255 * {@link #hasSystemFeature}: The device supports landscape orientation
2256 * screens. For backwards compatibility, you can assume that if neither
2257 * this nor {@link #FEATURE_SCREEN_PORTRAIT} is set then the device supports
2258 * both portrait and landscape.
2259 */
2260 @SdkConstant(SdkConstantType.FEATURE)
2261 public static final String FEATURE_SCREEN_LANDSCAPE = "android.hardware.screen.landscape";
2262
2263 /**
2264 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002265 * {@link #hasSystemFeature}: The device supports live wallpapers.
2266 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08002267 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002268 public static final String FEATURE_LIVE_WALLPAPER = "android.software.live_wallpaper";
Oscar Montemayor1228d0a2010-01-28 12:01:44 -08002269 /**
Dan Morrill50ab63f2010-03-05 16:16:19 -08002270 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn119bbc32013-03-22 17:27:25 -07002271 * {@link #hasSystemFeature}: The device supports app widgets.
2272 */
2273 @SdkConstant(SdkConstantType.FEATURE)
2274 public static final String FEATURE_APP_WIDGETS = "android.software.app_widgets";
2275
2276 /**
Dianne Hackborn91097de2014-04-04 18:02:06 -07002277 * @hide
2278 * Feature for {@link #getSystemAvailableFeatures} and
2279 * {@link #hasSystemFeature}: The device supports
2280 * {@link android.service.voice.VoiceInteractionService} and
2281 * {@link android.app.VoiceInteractor}.
2282 */
2283 @SdkConstant(SdkConstantType.FEATURE)
2284 public static final String FEATURE_VOICE_RECOGNIZERS = "android.software.voice_recognizers";
2285
2286
2287 /**
Dianne Hackborn119bbc32013-03-22 17:27:25 -07002288 * Feature for {@link #getSystemAvailableFeatures} and
2289 * {@link #hasSystemFeature}: The device supports a home screen that is replaceable
2290 * by third party applications.
2291 */
2292 @SdkConstant(SdkConstantType.FEATURE)
2293 public static final String FEATURE_HOME_SCREEN = "android.software.home_screen";
2294
2295 /**
2296 * Feature for {@link #getSystemAvailableFeatures} and
2297 * {@link #hasSystemFeature}: The device supports adding new input methods implemented
2298 * with the {@link android.inputmethodservice.InputMethodService} API.
2299 */
2300 @SdkConstant(SdkConstantType.FEATURE)
2301 public static final String FEATURE_INPUT_METHODS = "android.software.input_methods";
2302
2303 /**
2304 * Feature for {@link #getSystemAvailableFeatures} and
Amith Yamasani44a01b72013-09-16 10:44:57 -07002305 * {@link #hasSystemFeature}: The device supports device policy enforcement via device admins.
2306 */
2307 @SdkConstant(SdkConstantType.FEATURE)
2308 public static final String FEATURE_DEVICE_ADMIN = "android.software.device_admin";
2309
2310 /**
2311 * Feature for {@link #getSystemAvailableFeatures} and
Tim Kilbournf94b6a92014-03-07 15:13:48 -08002312 * {@link #hasSystemFeature}: The device supports leanback UI. This is
2313 * typically used in a living room television experience, but is a software
2314 * feature unlike {@link #FEATURE_TELEVISION}. Devices running with this
2315 * feature will use resources associated with the "television" UI mode.
2316 */
2317 @SdkConstant(SdkConstantType.FEATURE)
2318 public static final String FEATURE_LEANBACK = "android.software.leanback";
2319
2320 /**
2321 * Feature for {@link #getSystemAvailableFeatures} and
2322 * {@link #hasSystemFeature}: The device supports only leanback UI. Only
2323 * applications designed for this experience should be run, though this is
2324 * not enforced by the system.
Tim Kilbournf94b6a92014-03-07 15:13:48 -08002325 */
2326 @SdkConstant(SdkConstantType.FEATURE)
2327 public static final String FEATURE_LEANBACK_ONLY = "android.software.leanback_only";
2328
2329 /**
2330 * Feature for {@link #getSystemAvailableFeatures} and
Jae Seocfd861e2014-08-27 14:02:15 -07002331 * {@link #hasSystemFeature}: The device supports live TV and can display
2332 * contents from TV inputs implemented with the
2333 * {@link android.media.tv.TvInputService} API.
2334 */
2335 @SdkConstant(SdkConstantType.FEATURE)
2336 public static final String FEATURE_LIVE_TV = "android.software.live_tv";
2337
2338 /**
2339 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08002340 * {@link #hasSystemFeature}: The device supports WiFi (802.11) networking.
2341 */
2342 @SdkConstant(SdkConstantType.FEATURE)
2343 public static final String FEATURE_WIFI = "android.hardware.wifi";
2344
2345 /**
Irfan Sheriff45b8b462011-09-07 11:24:16 -07002346 * Feature for {@link #getSystemAvailableFeatures} and
2347 * {@link #hasSystemFeature}: The device supports Wi-Fi Direct networking.
2348 */
2349 @SdkConstant(SdkConstantType.FEATURE)
2350 public static final String FEATURE_WIFI_DIRECT = "android.hardware.wifi.direct";
2351
2352 /**
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07002353 * Feature for {@link #getSystemAvailableFeatures} and
Etan Cohen04133272016-10-26 11:22:06 -07002354 * {@link #hasSystemFeature}: The device supports Wi-Fi Aware.
Etan Cohen20d329b2015-09-29 13:49:02 -07002355 */
2356 @SdkConstant(SdkConstantType.FEATURE)
Etan Cohen04133272016-10-26 11:22:06 -07002357 public static final String FEATURE_WIFI_AWARE = "android.hardware.wifi.aware";
Etan Cohen20d329b2015-09-29 13:49:02 -07002358
2359 /**
2360 * Feature for {@link #getSystemAvailableFeatures} and
Peter Qiu3d615e42017-08-07 20:13:32 +00002361 * {@link #hasSystemFeature}: The device supports Wi-Fi Passpoint and all
2362 * Passpoint related APIs in {@link WifiManager} are supported. Refer to
2363 * {@link WifiManager#addOrUpdatePasspointConfiguration} for more info.
Peter Qiub99fe312017-05-05 13:48:47 -07002364 */
2365 @SdkConstant(SdkConstantType.FEATURE)
2366 public static final String FEATURE_WIFI_PASSPOINT = "android.hardware.wifi.passpoint";
2367
2368 /**
2369 * Feature for {@link #getSystemAvailableFeatures} and
Etan Cohen692e68e2017-09-14 15:42:01 -07002370 * {@link #hasSystemFeature}: The device supports Wi-Fi RTT (IEEE 802.11mc).
Etan Cohen692e68e2017-09-14 15:42:01 -07002371 */
2372 @SdkConstant(SdkConstantType.FEATURE)
2373 public static final String FEATURE_WIFI_RTT = "android.hardware.wifi.rtt";
2374
2375
2376 /**
2377 * Feature for {@link #getSystemAvailableFeatures} and
Robert Quattlebaum87a71042017-05-15 15:45:20 -07002378 * {@link #hasSystemFeature}: The device supports LoWPAN networking.
2379 * @hide
2380 */
2381 @SdkConstant(SdkConstantType.FEATURE)
2382 public static final String FEATURE_LOWPAN = "android.hardware.lowpan";
2383
2384 /**
2385 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07002386 * {@link #hasSystemFeature}: This is a device dedicated to showing UI
Todd Kennedy7f95a002015-04-22 14:28:25 -07002387 * on a vehicle headunit. A headunit here is defined to be inside a
2388 * vehicle that may or may not be moving. A headunit uses either a
2389 * primary display in the center console and/or additional displays in
2390 * the instrument cluster or elsewhere in the vehicle. Headunit display(s)
2391 * have limited size and resolution. The user will likely be focused on
2392 * driving so limiting driver distraction is a primary concern. User input
2393 * can be a variety of hard buttons, touch, rotary controllers and even mouse-
2394 * like interfaces.
2395 */
2396 @SdkConstant(SdkConstantType.FEATURE)
2397 public static final String FEATURE_AUTOMOTIVE = "android.hardware.type.automotive";
2398
2399 /**
2400 * Feature for {@link #getSystemAvailableFeatures} and
2401 * {@link #hasSystemFeature}: This is a device dedicated to showing UI
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07002402 * on a television. Television here is defined to be a typical living
2403 * room television experience: displayed on a big screen, where the user
2404 * is sitting far away from it, and the dominant form of input will be
2405 * something like a DPAD, not through touch or mouse.
Tim Kilbournf94b6a92014-03-07 15:13:48 -08002406 * @deprecated use {@link #FEATURE_LEANBACK} instead.
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07002407 */
Jose Lima970417c2014-04-10 10:42:19 -07002408 @Deprecated
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07002409 @SdkConstant(SdkConstantType.FEATURE)
2410 public static final String FEATURE_TELEVISION = "android.hardware.type.television";
2411
2412 /**
Justin Kohb5731f091c2014-02-13 16:06:59 -08002413 * Feature for {@link #getSystemAvailableFeatures} and
2414 * {@link #hasSystemFeature}: This is a device dedicated to showing UI
2415 * on a watch. A watch here is defined to be a device worn on the body, perhaps on
2416 * the wrist. The user is very close when interacting with the device.
2417 */
2418 @SdkConstant(SdkConstantType.FEATURE)
2419 public static final String FEATURE_WATCH = "android.hardware.type.watch";
2420
2421 /**
Ralph Nathanb8e0dee2017-01-24 15:24:59 -08002422 * Feature for {@link #getSystemAvailableFeatures} and
2423 * {@link #hasSystemFeature}: This is a device for IoT and may not have an UI. An embedded
2424 * device is defined as a full stack Android device with or without a display and no
2425 * user-installable apps.
2426 */
2427 @SdkConstant(SdkConstantType.FEATURE)
2428 public static final String FEATURE_EMBEDDED = "android.hardware.type.embedded";
2429
2430 /**
Dennis Kempin7345ed52017-04-14 16:40:56 -07002431 * Feature for {@link #getSystemAvailableFeatures} and
2432 * {@link #hasSystemFeature}: This is a device dedicated to be primarily used
2433 * with keyboard, mouse or touchpad. This includes traditional desktop
2434 * computers, laptops and variants such as convertibles or detachables.
2435 * Due to the larger screen, the device will most likely use the
2436 * {@link #FEATURE_FREEFORM_WINDOW_MANAGEMENT} feature as well.
2437 */
2438 @SdkConstant(SdkConstantType.FEATURE)
2439 public static final String FEATURE_PC = "android.hardware.type.pc";
2440
2441 /**
Adam Lesinski3d9bcb92014-02-18 14:05:14 -08002442 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2443 * The device supports printing.
2444 */
2445 @SdkConstant(SdkConstantType.FEATURE)
2446 public static final String FEATURE_PRINTING = "android.software.print";
2447
2448 /**
2449 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Eugene Susla7c3eef22017-03-10 14:25:58 -08002450 * The device supports {@link android.companion.CompanionDeviceManager#associate associating}
2451 * with devices via {@link android.companion.CompanionDeviceManager}.
2452 */
2453 @SdkConstant(SdkConstantType.FEATURE)
2454 public static final String FEATURE_COMPANION_DEVICE_SETUP
2455 = "android.software.companion_device_setup";
2456
2457 /**
2458 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Adam Lesinski3d9bcb92014-02-18 14:05:14 -08002459 * The device can perform backup and restore operations on installed applications.
2460 */
2461 @SdkConstant(SdkConstantType.FEATURE)
2462 public static final String FEATURE_BACKUP = "android.software.backup";
2463
2464 /**
Vladislav Kaznacheevd303b252015-10-27 17:30:58 -07002465 * Feature for {@link #getSystemAvailableFeatures} and
2466 * {@link #hasSystemFeature}: The device supports freeform window management.
2467 * Windows have title bars and can be moved and resized.
2468 */
Filip Gruszczynski811dc3b2015-11-23 12:34:22 -08002469 // If this feature is present, you also need to set
2470 // com.android.internal.R.config_freeformWindowManagement to true in your configuration overlay.
Vladislav Kaznacheevd303b252015-10-27 17:30:58 -07002471 @SdkConstant(SdkConstantType.FEATURE)
2472 public static final String FEATURE_FREEFORM_WINDOW_MANAGEMENT
2473 = "android.software.freeform_window_management";
2474
2475 /**
Adam Connors23cc04e2014-04-01 12:12:20 +01002476 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Wale Ogunwalefbe12c42015-12-06 16:23:50 -08002477 * The device supports picture-in-picture multi-window mode.
2478 */
2479 @SdkConstant(SdkConstantType.FEATURE)
2480 public static final String FEATURE_PICTURE_IN_PICTURE = "android.software.picture_in_picture";
2481
2482 /**
2483 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Andrii Kulian1981f5f2017-04-07 16:23:12 -07002484 * The device supports running activities on secondary displays.
2485 */
2486 @SdkConstant(SdkConstantType.FEATURE)
2487 public static final String FEATURE_ACTIVITIES_ON_SECONDARY_DISPLAYS
2488 = "android.software.activities_on_secondary_displays";
2489
2490 /**
2491 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Amith Yamasani1d653272014-09-11 17:56:05 -07002492 * The device supports creating secondary users and managed profiles via
2493 * {@link DevicePolicyManager}.
Adam Connors23cc04e2014-04-01 12:12:20 +01002494 */
2495 @SdkConstant(SdkConstantType.FEATURE)
Amith Yamasani1d653272014-09-11 17:56:05 -07002496 public static final String FEATURE_MANAGED_USERS = "android.software.managed_users";
2497
2498 /**
2499 * @hide
2500 * TODO: Remove after dependencies updated b/17392243
2501 */
2502 public static final String FEATURE_MANAGED_PROFILES = "android.software.managed_users";
Adam Connors23cc04e2014-04-01 12:12:20 +01002503
2504 /**
Ben Murdochf564c7f2014-05-20 18:58:06 +01002505 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Adam Connors19ccb5f2014-09-08 17:31:50 +01002506 * The device supports verified boot.
2507 */
2508 @SdkConstant(SdkConstantType.FEATURE)
2509 public static final String FEATURE_VERIFIED_BOOT = "android.software.verified_boot";
2510
2511 /**
2512 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2513 * The device supports secure removal of users. When a user is deleted the data associated
2514 * with that user is securely deleted and no longer available.
2515 */
2516 @SdkConstant(SdkConstantType.FEATURE)
2517 public static final String FEATURE_SECURELY_REMOVES_USERS
2518 = "android.software.securely_removes_users";
2519
Jeff Sharkeyb92b05b2016-01-28 09:50:00 -07002520 /** {@hide} */
Jeff Sharkey8eb783b2018-01-04 16:46:48 -07002521 @TestApi
Jeff Sharkeyb92b05b2016-01-28 09:50:00 -07002522 @SdkConstant(SdkConstantType.FEATURE)
2523 public static final String FEATURE_FILE_BASED_ENCRYPTION
2524 = "android.software.file_based_encryption";
2525
Jeff Sharkey8eb783b2018-01-04 16:46:48 -07002526 /** {@hide} */
2527 @TestApi
2528 @SdkConstant(SdkConstantType.FEATURE)
2529 public static final String FEATURE_ADOPTABLE_STORAGE
2530 = "android.software.adoptable_storage";
2531
Adam Connors19ccb5f2014-09-08 17:31:50 +01002532 /**
2533 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Ben Murdoch422c7a52014-05-16 13:45:47 +01002534 * The device has a full implementation of the android.webkit.* APIs. Devices
2535 * lacking this feature will not have a functioning WebView implementation.
2536 */
2537 @SdkConstant(SdkConstantType.FEATURE)
2538 public static final String FEATURE_WEBVIEW = "android.software.webview";
2539
2540 /**
Joe LaPenna4bb015d2014-07-04 17:15:54 -07002541 * Feature for {@link #getSystemAvailableFeatures} and
2542 * {@link #hasSystemFeature}: This device supports ethernet.
Joe LaPenna4bb015d2014-07-04 17:15:54 -07002543 */
2544 @SdkConstant(SdkConstantType.FEATURE)
2545 public static final String FEATURE_ETHERNET = "android.hardware.ethernet";
2546
2547 /**
Yuncheol Heoa0c4a062014-07-10 20:49:27 +09002548 * Feature for {@link #getSystemAvailableFeatures} and
2549 * {@link #hasSystemFeature}: This device supports HDMI-CEC.
2550 * @hide
2551 */
2552 @SdkConstant(SdkConstantType.FEATURE)
2553 public static final String FEATURE_HDMI_CEC = "android.hardware.hdmi.cec";
2554
2555 /**
Michael Wright6faa6752014-09-05 17:57:44 -07002556 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2557 * The device has all of the inputs necessary to be considered a compatible game controller, or
2558 * includes a compatible game controller in the box.
2559 */
2560 @SdkConstant(SdkConstantType.FEATURE)
2561 public static final String FEATURE_GAMEPAD = "android.hardware.gamepad";
2562
Mike Lockwood5781cd52015-03-27 13:23:41 -07002563 /**
2564 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2565 * The device has a full implementation of the android.media.midi.* APIs.
2566 */
2567 @SdkConstant(SdkConstantType.FEATURE)
2568 public static final String FEATURE_MIDI = "android.software.midi";
Michael Wright6faa6752014-09-05 17:57:44 -07002569
2570 /**
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08002571 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Ruben Brunk927d3452016-05-02 19:30:51 -07002572 * The device implements an optimized mode for virtual reality (VR) applications that handles
2573 * stereoscopic rendering of notifications, and disables most monocular system UI components
2574 * while a VR application has user focus.
2575 * Devices declaring this feature must include an application implementing a
2576 * {@link android.service.vr.VrListenerService} that can be targeted by VR applications via
2577 * {@link android.app.Activity#setVrModeEnabled}.
Craig Donnerc6f9c852017-12-27 17:15:19 -08002578 * @deprecated use {@link #FEATURE_VR_MODE_HIGH_PERFORMANCE} instead.
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08002579 */
Craig Donnerc6f9c852017-12-27 17:15:19 -08002580 @Deprecated
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08002581 @SdkConstant(SdkConstantType.FEATURE)
2582 public static final String FEATURE_VR_MODE = "android.software.vr.mode";
2583
2584 /**
Ruben Brunk31d80ea2016-01-25 20:14:08 -08002585 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Craig Donnerc6f9c852017-12-27 17:15:19 -08002586 * The device implements an optimized mode for virtual reality (VR) applications that handles
2587 * stereoscopic rendering of notifications, disables most monocular system UI components
2588 * while a VR application has user focus and meets extra CDD requirements to provide a
2589 * high-quality VR experience.
2590 * Devices declaring this feature must include an application implementing a
2591 * {@link android.service.vr.VrListenerService} that can be targeted by VR applications via
2592 * {@link android.app.Activity#setVrModeEnabled}.
2593 * and must meet CDD requirements to provide a high-quality VR experience.
Ruben Brunk31d80ea2016-01-25 20:14:08 -08002594 */
2595 @SdkConstant(SdkConstantType.FEATURE)
2596 public static final String FEATURE_VR_MODE_HIGH_PERFORMANCE
2597 = "android.hardware.vr.high_performance";
2598
2599 /**
Craig Donner279dd662017-03-15 17:10:50 -07002600 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Svet Ganov43574b02017-04-12 09:25:20 -07002601 * The device supports autofill of user credentials, addresses, credit cards, etc
2602 * via integration with {@link android.service.autofill.AutofillService autofill
2603 * providers}.
2604 */
2605 @SdkConstant(SdkConstantType.FEATURE)
2606 public static final String FEATURE_AUTOFILL = "android.software.autofill";
2607
2608 /**
2609 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Craig Donner279dd662017-03-15 17:10:50 -07002610 * The device implements headtracking suitable for a VR device.
2611 */
2612 @SdkConstant(SdkConstantType.FEATURE)
2613 public static final String FEATURE_VR_HEADTRACKING = "android.hardware.vr.headtracking";
2614
2615 /**
Frank Salimea5e0382018-01-23 22:42:29 -08002616 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2617 * The device has a StrongBox hardware-backed Keystore.
2618 */
2619 @SdkConstant(SdkConstantType.FEATURE)
2620 public static final String FEATURE_STRONGBOX_KEYSTORE =
2621 "android.hardware.strongbox_keystore";
2622
2623 /**
Dianne Hackborne83cefce2010-02-04 17:38:14 -08002624 * Action to external storage service to clean out removed apps.
2625 * @hide
2626 */
2627 public static final String ACTION_CLEAN_EXTERNAL_STORAGE
2628 = "android.content.pm.CLEAN_EXTERNAL_STORAGE";
Oscar Montemayor1228d0a2010-01-28 12:01:44 -08002629
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002630 /**
Kenny Root5ab21572011-07-27 11:11:19 -07002631 * Extra field name for the URI to a verification file. Passed to a package
2632 * verifier.
2633 *
2634 * @hide
2635 */
2636 public static final String EXTRA_VERIFICATION_URI = "android.content.pm.extra.VERIFICATION_URI";
2637
2638 /**
2639 * Extra field name for the ID of a package pending verification. Passed to
2640 * a package verifier and is used to call back to
Kenny Root3a9b5fb2011-09-20 14:15:38 -07002641 * {@link PackageManager#verifyPendingInstall(int, int)}
Kenny Root5ab21572011-07-27 11:11:19 -07002642 */
2643 public static final String EXTRA_VERIFICATION_ID = "android.content.pm.extra.VERIFICATION_ID";
2644
2645 /**
2646 * Extra field name for the package identifier which is trying to install
2647 * the package.
2648 *
2649 * @hide
2650 */
2651 public static final String EXTRA_VERIFICATION_INSTALLER_PACKAGE
2652 = "android.content.pm.extra.VERIFICATION_INSTALLER_PACKAGE";
2653
2654 /**
2655 * Extra field name for the requested install flags for a package pending
2656 * verification. Passed to a package verifier.
2657 *
2658 * @hide
2659 */
2660 public static final String EXTRA_VERIFICATION_INSTALL_FLAGS
2661 = "android.content.pm.extra.VERIFICATION_INSTALL_FLAGS";
2662
2663 /**
rich cannings13d428e2012-09-13 13:43:07 -07002664 * Extra field name for the uid of who is requesting to install
2665 * the package.
2666 *
2667 * @hide
2668 */
2669 public static final String EXTRA_VERIFICATION_INSTALLER_UID
2670 = "android.content.pm.extra.VERIFICATION_INSTALLER_UID";
2671
2672 /**
2673 * Extra field name for the package name of a package pending verification.
2674 *
2675 * @hide
2676 */
2677 public static final String EXTRA_VERIFICATION_PACKAGE_NAME
2678 = "android.content.pm.extra.VERIFICATION_PACKAGE_NAME";
2679 /**
rich canningsd1b5cfc2012-08-29 14:49:51 -07002680 * Extra field name for the result of a verification, either
2681 * {@link #VERIFICATION_ALLOW}, or {@link #VERIFICATION_REJECT}.
2682 * Passed to package verifiers after a package is verified.
2683 */
2684 public static final String EXTRA_VERIFICATION_RESULT
2685 = "android.content.pm.extra.VERIFICATION_RESULT";
2686
2687 /**
rich cannings13d428e2012-09-13 13:43:07 -07002688 * Extra field name for the version code of a package pending verification.
Dianne Hackborn3accca02013-09-20 09:32:11 -07002689 * @deprecated Use {@link #EXTRA_VERIFICATION_LONG_VERSION_CODE} instead.
2690 * @hide
2691 */
2692 @Deprecated
2693 public static final String EXTRA_VERIFICATION_VERSION_CODE
2694 = "android.content.pm.extra.VERIFICATION_VERSION_CODE";
2695
2696 /**
2697 * Extra field name for the long version code of a package pending verification.
rich cannings13d428e2012-09-13 13:43:07 -07002698 *
2699 * @hide
2700 */
Dianne Hackborn3accca02013-09-20 09:32:11 -07002701 public static final String EXTRA_VERIFICATION_LONG_VERSION_CODE =
2702 "android.content.pm.extra.VERIFICATION_LONG_VERSION_CODE";
rich cannings13d428e2012-09-13 13:43:07 -07002703
2704 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07002705 * Extra field name for the ID of a intent filter pending verification.
2706 * Passed to an intent filter verifier and is used to call back to
2707 * {@link #verifyIntentFilter}
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08002708 *
2709 * @hide
2710 */
2711 public static final String EXTRA_INTENT_FILTER_VERIFICATION_ID
2712 = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_ID";
2713
2714 /**
2715 * Extra field name for the scheme used for an intent filter pending verification. Passed to
2716 * an intent filter verifier and is used to construct the URI to verify against.
2717 *
2718 * Usually this is "https"
2719 *
2720 * @hide
2721 */
2722 public static final String EXTRA_INTENT_FILTER_VERIFICATION_URI_SCHEME
2723 = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_URI_SCHEME";
2724
2725 /**
2726 * Extra field name for the host names to be used for an intent filter pending verification.
2727 * Passed to an intent filter verifier and is used to construct the URI to verify the
2728 * intent filter.
2729 *
2730 * This is a space delimited list of hosts.
2731 *
2732 * @hide
2733 */
2734 public static final String EXTRA_INTENT_FILTER_VERIFICATION_HOSTS
2735 = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_HOSTS";
2736
2737 /**
2738 * Extra field name for the package name to be used for an intent filter pending verification.
2739 * Passed to an intent filter verifier and is used to check the verification responses coming
2740 * from the hosts. Each host response will need to include the package name of APK containing
2741 * the intent filter.
2742 *
2743 * @hide
2744 */
2745 public static final String EXTRA_INTENT_FILTER_VERIFICATION_PACKAGE_NAME
2746 = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_PACKAGE_NAME";
2747
2748 /**
2749 * The action used to request that the user approve a permission request
2750 * from the application.
Nick Kralevich035f80d2013-03-27 15:20:08 -07002751 *
2752 * @hide
2753 */
Svetoslavc6d1c342015-02-26 14:44:43 -08002754 @SystemApi
2755 public static final String ACTION_REQUEST_PERMISSIONS =
2756 "android.content.pm.action.REQUEST_PERMISSIONS";
Nick Kralevich035f80d2013-03-27 15:20:08 -07002757
2758 /**
Svetoslavc6d1c342015-02-26 14:44:43 -08002759 * The names of the requested permissions.
2760 * <p>
2761 * <strong>Type:</strong> String[]
2762 * </p>
2763 *
2764 * @hide
2765 */
2766 @SystemApi
2767 public static final String EXTRA_REQUEST_PERMISSIONS_NAMES =
2768 "android.content.pm.extra.REQUEST_PERMISSIONS_NAMES";
2769
2770 /**
2771 * The results from the permissions request.
2772 * <p>
2773 * <strong>Type:</strong> int[] of #PermissionResult
2774 * </p>
2775 *
2776 * @hide
2777 */
2778 @SystemApi
2779 public static final String EXTRA_REQUEST_PERMISSIONS_RESULTS
2780 = "android.content.pm.extra.REQUEST_PERMISSIONS_RESULTS";
Nick Kralevich035f80d2013-03-27 15:20:08 -07002781
2782 /**
Jeff Sharkeybb580672014-07-10 12:10:25 -07002783 * String extra for {@link PackageInstallObserver} in the 'extras' Bundle in case of
Christopher Tatef1977b42014-03-24 16:25:51 -07002784 * {@link #INSTALL_FAILED_DUPLICATE_PERMISSION}. This extra names the package which provides
2785 * the existing definition for the permission.
2786 * @hide
2787 */
2788 public static final String EXTRA_FAILURE_EXISTING_PACKAGE
2789 = "android.content.pm.extra.FAILURE_EXISTING_PACKAGE";
2790
2791 /**
Jeff Sharkeybb580672014-07-10 12:10:25 -07002792 * String extra for {@link PackageInstallObserver} in the 'extras' Bundle in case of
Christopher Tatef1977b42014-03-24 16:25:51 -07002793 * {@link #INSTALL_FAILED_DUPLICATE_PERMISSION}. This extra names the permission that is
2794 * being redundantly defined by the package being installed.
2795 * @hide
2796 */
2797 public static final String EXTRA_FAILURE_EXISTING_PERMISSION
2798 = "android.content.pm.extra.FAILURE_EXISTING_PERMISSION";
2799
Svet Ganov8c7f7002015-05-07 10:48:44 -07002800 /**
2801 * Permission flag: The permission is set in its current state
2802 * by the user and apps can still request it at runtime.
2803 *
2804 * @hide
2805 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08002806 @SystemApi
Svet Ganov8c7f7002015-05-07 10:48:44 -07002807 public static final int FLAG_PERMISSION_USER_SET = 1 << 0;
2808
2809 /**
2810 * Permission flag: The permission is set in its current state
2811 * by the user and it is fixed, i.e. apps can no longer request
2812 * this permission.
2813 *
2814 * @hide
2815 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08002816 @SystemApi
Svet Ganov8c7f7002015-05-07 10:48:44 -07002817 public static final int FLAG_PERMISSION_USER_FIXED = 1 << 1;
2818
2819 /**
2820 * Permission flag: The permission is set in its current state
2821 * by device policy and neither apps nor the user can change
2822 * its state.
2823 *
2824 * @hide
2825 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08002826 @SystemApi
Svet Ganov8c7f7002015-05-07 10:48:44 -07002827 public static final int FLAG_PERMISSION_POLICY_FIXED = 1 << 2;
2828
2829 /**
2830 * Permission flag: The permission is set in a granted state but
2831 * access to resources it guards is restricted by other means to
2832 * enable revoking a permission on legacy apps that do not support
2833 * runtime permissions. If this permission is upgraded to runtime
2834 * because the app was updated to support runtime permissions, the
2835 * the permission will be revoked in the upgrade process.
2836 *
2837 * @hide
2838 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08002839 @SystemApi
Svet Ganov8c7f7002015-05-07 10:48:44 -07002840 public static final int FLAG_PERMISSION_REVOKE_ON_UPGRADE = 1 << 3;
2841
Svet Ganovb3f22b42015-05-12 11:01:24 -07002842 /**
2843 * Permission flag: The permission is set in its current state
2844 * because the app is a component that is a part of the system.
2845 *
2846 * @hide
2847 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08002848 @SystemApi
Svet Ganovb3f22b42015-05-12 11:01:24 -07002849 public static final int FLAG_PERMISSION_SYSTEM_FIXED = 1 << 4;
Svet Ganov8c7f7002015-05-07 10:48:44 -07002850
Svet Ganov77ab6a82015-07-03 12:03:02 -07002851 /**
2852 * Permission flag: The permission is granted by default because it
2853 * enables app functionality that is expected to work out-of-the-box
2854 * for providing a smooth user experience. For example, the phone app
2855 * is expected to have the phone permission.
2856 *
2857 * @hide
2858 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08002859 @SystemApi
Svet Ganov77ab6a82015-07-03 12:03:02 -07002860 public static final int FLAG_PERMISSION_GRANTED_BY_DEFAULT = 1 << 5;
2861
Svet Ganov8c7f7002015-05-07 10:48:44 -07002862 /**
Svet Ganov9c165d72015-12-01 19:52:26 -08002863 * Permission flag: The permission has to be reviewed before any of
2864 * the app components can run.
2865 *
2866 * @hide
2867 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08002868 @SystemApi
Svet Ganov9c165d72015-12-01 19:52:26 -08002869 public static final int FLAG_PERMISSION_REVIEW_REQUIRED = 1 << 6;
2870
2871 /**
Svet Ganov8c7f7002015-05-07 10:48:44 -07002872 * Mask for all permission flags.
2873 *
2874 * @hide
2875 */
2876 @SystemApi
Svet Ganovb3f22b42015-05-12 11:01:24 -07002877 public static final int MASK_PERMISSION_FLAGS = 0xFF;
Svet Ganov8c7f7002015-05-07 10:48:44 -07002878
Christopher Tatef1977b42014-03-24 16:25:51 -07002879 /**
Svet Ganovd7b1f4112016-02-09 18:49:23 -08002880 * This is a library that contains components apps can invoke. For
2881 * example, a services for apps to bind to, or standard chooser UI,
2882 * etc. This library is versioned and backwards compatible. Clients
2883 * should check its version via {@link android.ext.services.Version
2884 * #getVersionCode()} and avoid calling APIs added in later versions.
2885 *
2886 * @hide
2887 */
2888 public static final String SYSTEM_SHARED_LIBRARY_SERVICES = "android.ext.services";
2889
2890 /**
2891 * This is a library that contains components apps can dynamically
2892 * load. For example, new widgets, helper classes, etc. This library
2893 * is versioned and backwards compatible. Clients should check its
2894 * version via {@link android.ext.shared.Version#getVersionCode()}
2895 * and avoid calling APIs added in later versions.
2896 *
2897 * @hide
2898 */
2899 public static final String SYSTEM_SHARED_LIBRARY_SHARED = "android.ext.shared";
2900
2901 /**
Brian Carlstromca82e612016-04-19 23:16:08 -07002902 * Used when starting a process for an Activity.
2903 *
2904 * @hide
2905 */
2906 public static final int NOTIFY_PACKAGE_USE_ACTIVITY = 0;
2907
2908 /**
2909 * Used when starting a process for a Service.
2910 *
2911 * @hide
2912 */
2913 public static final int NOTIFY_PACKAGE_USE_SERVICE = 1;
2914
2915 /**
2916 * Used when moving a Service to the foreground.
2917 *
2918 * @hide
2919 */
2920 public static final int NOTIFY_PACKAGE_USE_FOREGROUND_SERVICE = 2;
2921
2922 /**
2923 * Used when starting a process for a BroadcastReceiver.
2924 *
2925 * @hide
2926 */
2927 public static final int NOTIFY_PACKAGE_USE_BROADCAST_RECEIVER = 3;
2928
2929 /**
2930 * Used when starting a process for a ContentProvider.
2931 *
2932 * @hide
2933 */
2934 public static final int NOTIFY_PACKAGE_USE_CONTENT_PROVIDER = 4;
2935
2936 /**
2937 * Used when starting a process for a BroadcastReceiver.
2938 *
2939 * @hide
2940 */
2941 public static final int NOTIFY_PACKAGE_USE_BACKUP = 5;
2942
2943 /**
2944 * Used with Context.getClassLoader() across Android packages.
2945 *
2946 * @hide
2947 */
2948 public static final int NOTIFY_PACKAGE_USE_CROSS_PACKAGE = 6;
2949
2950 /**
2951 * Used when starting a package within a process for Instrumentation.
2952 *
2953 * @hide
2954 */
2955 public static final int NOTIFY_PACKAGE_USE_INSTRUMENTATION = 7;
2956
2957 /**
2958 * Total number of usage reasons.
2959 *
2960 * @hide
2961 */
2962 public static final int NOTIFY_PACKAGE_USE_REASONS_COUNT = 8;
2963
2964 /**
Svet Ganov67882122016-12-11 16:36:34 -08002965 * Constant for specifying the highest installed package version code.
2966 */
2967 public static final int VERSION_CODE_HIGHEST = -1;
2968
Jeff Sharkeyad357d12018-02-02 13:25:31 -07002969 /** {@hide} */
2970 public int getUserId() {
2971 return UserHandle.myUserId();
2972 }
2973
Svet Ganov67882122016-12-11 16:36:34 -08002974 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002975 * Retrieve overall information about an application package that is
2976 * installed on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002977 *
2978 * @param packageName The full name (i.e. com.google.apps.contacts) of the
Jeff Sharkey4347f812017-04-21 12:08:39 -06002979 * desired package.
2980 * @param flags Additional option flags to modify the data returned.
2981 * @return A PackageInfo object containing information about the package. If
2982 * flag {@code MATCH_UNINSTALLED_PACKAGES} is set and if the package
2983 * is not found in the list of installed applications, the package
2984 * information is retrieved from the list of uninstalled
kmccormick30498b42013-03-27 17:39:17 -07002985 * applications (which includes installed applications as well as
2986 * applications with data directory i.e. applications which had been
2987 * deleted with {@code DONT_DELETE_DATA} flag set).
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002988 * @throws NameNotFoundException if a package with the given name cannot be
2989 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002990 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07002991 public abstract PackageInfo getPackageInfo(String packageName, @PackageInfoFlags int flags)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002992 throws NameNotFoundException;
2993
2994 /**
Svet Ganov67882122016-12-11 16:36:34 -08002995 * Retrieve overall information about an application package that is
2996 * installed on the system. This method can be used for retrieving
Jeff Sharkey4347f812017-04-21 12:08:39 -06002997 * information about packages for which multiple versions can be installed
2998 * at the time. Currently only packages hosting static shared libraries can
2999 * have multiple installed versions. The method can also be used to get info
3000 * for a package that has a single version installed by passing
3001 * {@link #VERSION_CODE_HIGHEST} in the {@link VersionedPackage}
Svet Ganov67882122016-12-11 16:36:34 -08003002 * constructor.
3003 *
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003004 * @param versionedPackage The versioned package for which to query.
Jeff Sharkey4347f812017-04-21 12:08:39 -06003005 * @param flags Additional option flags to modify the data returned.
3006 * @return A PackageInfo object containing information about the package. If
3007 * flag {@code MATCH_UNINSTALLED_PACKAGES} is set and if the package
3008 * is not found in the list of installed applications, the package
3009 * information is retrieved from the list of uninstalled
Svet Ganov67882122016-12-11 16:36:34 -08003010 * applications (which includes installed applications as well as
3011 * applications with data directory i.e. applications which had been
3012 * deleted with {@code DONT_DELETE_DATA} flag set).
3013 * @throws NameNotFoundException if a package with the given name cannot be
3014 * found on the system.
Svet Ganov67882122016-12-11 16:36:34 -08003015 */
3016 public abstract PackageInfo getPackageInfo(VersionedPackage versionedPackage,
3017 @PackageInfoFlags int flags) throws NameNotFoundException;
3018
3019 /**
Nicolas Prevot9a80e532015-09-23 15:49:28 +01003020 * Retrieve overall information about an application package that is
3021 * installed on the system.
Nicolas Prevot9a80e532015-09-23 15:49:28 +01003022 *
3023 * @param packageName The full name (i.e. com.google.apps.contacts) of the
Jeff Sharkey4347f812017-04-21 12:08:39 -06003024 * desired package.
3025 * @param flags Additional option flags to modify the data returned.
Nicolas Prevot9a80e532015-09-23 15:49:28 +01003026 * @param userId The user id.
Jeff Sharkey4347f812017-04-21 12:08:39 -06003027 * @return A PackageInfo object containing information about the package. If
3028 * flag {@code MATCH_UNINSTALLED_PACKAGES} is set and if the package
3029 * is not found in the list of installed applications, the package
3030 * information is retrieved from the list of uninstalled
Nicolas Prevot9a80e532015-09-23 15:49:28 +01003031 * applications (which includes installed applications as well as
3032 * applications with data directory i.e. applications which had been
3033 * deleted with {@code DONT_DELETE_DATA} flag set).
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003034 * @throws NameNotFoundException if a package with the given name cannot be
3035 * found on the system.
Svet Ganov67882122016-12-11 16:36:34 -08003036 * @hide
Nicolas Prevot9a80e532015-09-23 15:49:28 +01003037 */
3038 @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS)
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003039 public abstract PackageInfo getPackageInfoAsUser(String packageName,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003040 @PackageInfoFlags int flags, @UserIdInt int userId) throws NameNotFoundException;
Nicolas Prevot9a80e532015-09-23 15:49:28 +01003041
3042 /**
Dianne Hackborn47096932010-02-11 15:57:09 -08003043 * Map from the current package names in use on the device to whatever
3044 * the current canonical name of that package is.
3045 * @param names Array of current names to be mapped.
3046 * @return Returns an array of the same size as the original, containing
3047 * the canonical name for each package.
3048 */
3049 public abstract String[] currentToCanonicalPackageNames(String[] names);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003050
Dianne Hackborn47096932010-02-11 15:57:09 -08003051 /**
3052 * Map from a packages canonical name to the current name in use on the device.
3053 * @param names Array of new names to be mapped.
3054 * @return Returns an array of the same size as the original, containing
3055 * the current name for each package.
3056 */
3057 public abstract String[] canonicalToCurrentPackageNames(String[] names);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003058
Dianne Hackborn47096932010-02-11 15:57:09 -08003059 /**
Andrew Solovay5ae13352014-06-06 12:23:09 -07003060 * Returns a "good" intent to launch a front-door activity in a package.
3061 * This is used, for example, to implement an "open" button when browsing
3062 * through packages. The current implementation looks first for a main
3063 * activity in the category {@link Intent#CATEGORY_INFO}, and next for a
3064 * main activity in the category {@link Intent#CATEGORY_LAUNCHER}. Returns
3065 * <code>null</code> if neither are found.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003066 *
3067 * @param packageName The name of the package to inspect.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003068 *
Andrew Solovay5ae13352014-06-06 12:23:09 -07003069 * @return A fully-qualified {@link Intent} that can be used to launch the
3070 * main activity in the package. Returns <code>null</code> if the package
3071 * does not contain such an activity, or if <em>packageName</em> is not
Ihab Awad1ec68882014-09-12 11:09:01 -07003072 * recognized.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003073 */
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06003074 public abstract @Nullable Intent getLaunchIntentForPackage(@NonNull String packageName);
Mihai Predaeae850c2009-05-13 10:13:48 +02003075
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003076 /**
Jose Lima970417c2014-04-10 10:42:19 -07003077 * Return a "good" intent to launch a front-door Leanback activity in a
3078 * package, for use for example to implement an "open" button when browsing
3079 * through packages. The current implementation will look for a main
3080 * activity in the category {@link Intent#CATEGORY_LEANBACK_LAUNCHER}, or
3081 * return null if no main leanback activities are found.
Adam Connors551c0782014-06-05 12:13:03 +01003082 *
Jose Lima970417c2014-04-10 10:42:19 -07003083 * @param packageName The name of the package to inspect.
3084 * @return Returns either a fully-qualified Intent that can be used to launch
3085 * the main Leanback activity in the package, or null if the package
3086 * does not contain such an activity.
3087 */
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06003088 public abstract @Nullable Intent getLeanbackLaunchIntentForPackage(@NonNull String packageName);
Jose Lima970417c2014-04-10 10:42:19 -07003089
3090 /**
Roberto Perez7ee1a7a2017-12-04 17:14:33 -08003091 * Return a "good" intent to launch a front-door Car activity in a
3092 * package, for use for example to implement an "open" button when browsing
3093 * through packages. The current implementation will look for a main
3094 * activity in the category {@link Intent#CATEGORY_CAR_LAUNCHER}, or
3095 * return null if no main car activities are found.
3096 *
3097 * @param packageName The name of the package to inspect.
3098 * @return Returns either a fully-qualified Intent that can be used to launch
3099 * the main Car activity in the package, or null if the package
3100 * does not contain such an activity.
3101 * @hide
3102 */
3103 public abstract @Nullable Intent getCarLaunchIntentForPackage(@NonNull String packageName);
3104
3105 /**
Jeff Sharkeycf3f0a12016-03-17 19:57:58 -06003106 * Return an array of all of the POSIX secondary group IDs that have been
3107 * assigned to the given package.
3108 * <p>
3109 * Note that the same package may have different GIDs under different
3110 * {@link UserHandle} on the same device.
Adam Connors551c0782014-06-05 12:13:03 +01003111 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003112 * @param packageName The full name (i.e. com.google.apps.contacts) of the
Jeff Sharkeycf3f0a12016-03-17 19:57:58 -06003113 * desired package.
3114 * @return Returns an int array of the assigned GIDs, or null if there are
Jose Lima970417c2014-04-10 10:42:19 -07003115 * none.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003116 * @throws NameNotFoundException if a package with the given name cannot be
3117 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003118 */
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06003119 public abstract int[] getPackageGids(@NonNull String packageName)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003120 throws NameNotFoundException;
3121
3122 /**
Jeff Sharkeycf3f0a12016-03-17 19:57:58 -06003123 * Return an array of all of the POSIX secondary group IDs that have been
3124 * assigned to the given package.
3125 * <p>
3126 * Note that the same package may have different GIDs under different
3127 * {@link UserHandle} on the same device.
Dianne Hackborna06de0f2012-12-11 16:34:47 -08003128 *
3129 * @param packageName The full name (i.e. com.google.apps.contacts) of the
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003130 * desired package.
3131 * @return Returns an int array of the assigned gids, or null if there are
3132 * none.
3133 * @throws NameNotFoundException if a package with the given name cannot be
3134 * found on the system.
Dianne Hackborna06de0f2012-12-11 16:34:47 -08003135 */
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003136 public abstract int[] getPackageGids(String packageName, @PackageInfoFlags int flags)
Dianne Hackborna06de0f2012-12-11 16:34:47 -08003137 throws NameNotFoundException;
3138
3139 /**
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003140 * Return the UID associated with the given package name.
Jeff Sharkeycf3f0a12016-03-17 19:57:58 -06003141 * <p>
3142 * Note that the same package will have different UIDs under different
3143 * {@link UserHandle} on the same device.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003144 *
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003145 * @param packageName The full name (i.e. com.google.apps.contacts) of the
3146 * desired package.
3147 * @return Returns an integer UID who owns the given package name.
3148 * @throws NameNotFoundException if a package with the given name can not be
3149 * found on the system.
3150 */
3151 public abstract int getPackageUid(String packageName, @PackageInfoFlags int flags)
3152 throws NameNotFoundException;
3153
3154 /**
3155 * Return the UID associated with the given package name.
Jeff Sharkeycf3f0a12016-03-17 19:57:58 -06003156 * <p>
3157 * Note that the same package will have different UIDs under different
3158 * {@link UserHandle} on the same device.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003159 *
3160 * @param packageName The full name (i.e. com.google.apps.contacts) of the
3161 * desired package.
3162 * @param userId The user handle identifier to look up the package under.
3163 * @return Returns an integer UID who owns the given package name.
3164 * @throws NameNotFoundException if a package with the given name can not be
3165 * found on the system.
3166 * @hide
3167 */
3168 public abstract int getPackageUidAsUser(String packageName, @UserIdInt int userId)
3169 throws NameNotFoundException;
3170
3171 /**
3172 * Return the UID associated with the given package name.
Jeff Sharkeycf3f0a12016-03-17 19:57:58 -06003173 * <p>
3174 * Note that the same package will have different UIDs under different
3175 * {@link UserHandle} on the same device.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003176 *
3177 * @param packageName The full name (i.e. com.google.apps.contacts) of the
3178 * desired package.
3179 * @param userId The user handle identifier to look up the package under.
3180 * @return Returns an integer UID who owns the given package name.
3181 * @throws NameNotFoundException if a package with the given name can not be
3182 * found on the system.
3183 * @hide
3184 */
3185 public abstract int getPackageUidAsUser(String packageName, @PackageInfoFlags int flags,
3186 @UserIdInt int userId) throws NameNotFoundException;
3187
3188 /**
3189 * Retrieve all of the information we know about a particular permission.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003190 *
3191 * @param name The fully qualified name (i.e. com.google.permission.LOGIN)
Jeff Sharkey4347f812017-04-21 12:08:39 -06003192 * of the permission you are interested in.
3193 * @param flags Additional option flags to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003194 * @return Returns a {@link PermissionInfo} containing information about the
3195 * permission.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003196 * @throws NameNotFoundException if a package with the given name cannot be
3197 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003198 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003199 public abstract PermissionInfo getPermissionInfo(String name, @PermissionInfoFlags int flags)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003200 throws NameNotFoundException;
3201
3202 /**
3203 * Query for all of the permissions associated with a particular group.
3204 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003205 * @param group The fully qualified name (i.e. com.google.permission.LOGIN)
Jeff Sharkey4347f812017-04-21 12:08:39 -06003206 * of the permission group you are interested in. Use null to
3207 * find all of the permissions not associated with a group.
3208 * @param flags Additional option flags to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003209 * @return Returns a list of {@link PermissionInfo} containing information
Jeff Sharkey4347f812017-04-21 12:08:39 -06003210 * about all of the permissions in the given group.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003211 * @throws NameNotFoundException if a package with the given name cannot be
3212 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003213 */
3214 public abstract List<PermissionInfo> queryPermissionsByGroup(String group,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003215 @PermissionInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003216
3217 /**
Paul Navin7b89a7b2017-01-26 23:56:08 +00003218 * Returns true if Permission Review Mode is enabled, false otherwise.
3219 *
3220 * @hide
3221 */
3222 @TestApi
3223 public abstract boolean isPermissionReviewModeEnabled();
3224
3225 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003226 * Retrieve all of the information we know about a particular group of
3227 * permissions.
3228 *
Jeff Sharkey4347f812017-04-21 12:08:39 -06003229 * @param name The fully qualified name (i.e.
3230 * com.google.permission_group.APPS) of the permission you are
3231 * interested in.
3232 * @param flags Additional option flags to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003233 * @return Returns a {@link PermissionGroupInfo} containing information
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003234 * about the permission.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003235 * @throws NameNotFoundException if a package with the given name cannot be
3236 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003237 */
3238 public abstract PermissionGroupInfo getPermissionGroupInfo(String name,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003239 @PermissionGroupInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003240
3241 /**
3242 * Retrieve all of the known permission groups in the system.
3243 *
Jeff Sharkey4347f812017-04-21 12:08:39 -06003244 * @param flags Additional option flags to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003245 * @return Returns a list of {@link PermissionGroupInfo} containing
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003246 * information about all of the known permission groups.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003247 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003248 public abstract List<PermissionGroupInfo> getAllPermissionGroups(
3249 @PermissionGroupInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003250
3251 /**
3252 * Retrieve all of the information we know about a particular
3253 * package/application.
3254 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003255 * @param packageName The full name (i.e. com.google.apps.contacts) of an
Jeff Sharkey4347f812017-04-21 12:08:39 -06003256 * application.
3257 * @param flags Additional option flags to modify the data returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003258 * @return An {@link ApplicationInfo} containing information about the
Jeff Sharkey4347f812017-04-21 12:08:39 -06003259 * package. If flag {@code MATCH_UNINSTALLED_PACKAGES} is set and if
3260 * the package is not found in the list of installed applications,
3261 * the application information is retrieved from the list of
3262 * uninstalled applications (which includes installed applications
3263 * as well as applications with data directory i.e. applications
3264 * which had been deleted with {@code DONT_DELETE_DATA} flag set).
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003265 * @throws NameNotFoundException if a package with the given name cannot be
3266 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003267 */
3268 public abstract ApplicationInfo getApplicationInfo(String packageName,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003269 @ApplicationInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003270
Jeff Sharkeycd654482016-01-08 17:42:11 -07003271 /** {@hide} */
3272 public abstract ApplicationInfo getApplicationInfoAsUser(String packageName,
3273 @ApplicationInfoFlags int flags, @UserIdInt int userId) throws NameNotFoundException;
3274
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003275 /**
3276 * Retrieve all of the information we know about a particular activity
3277 * class.
3278 *
Dianne Hackborn361199b2010-08-30 17:42:07 -07003279 * @param component The full component name (i.e.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003280 * com.google.apps.contacts/com.google.apps.contacts.
3281 * ContactsList) of an Activity class.
Jeff Sharkey4347f812017-04-21 12:08:39 -06003282 * @param flags Additional option flags to modify the data returned.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003283 * @return An {@link ActivityInfo} containing information about the
3284 * activity.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003285 * @throws NameNotFoundException if a package with the given name cannot be
3286 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003287 */
Dianne Hackborn361199b2010-08-30 17:42:07 -07003288 public abstract ActivityInfo getActivityInfo(ComponentName component,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003289 @ComponentInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003290
3291 /**
3292 * Retrieve all of the information we know about a particular receiver
3293 * class.
3294 *
Dianne Hackborn361199b2010-08-30 17:42:07 -07003295 * @param component The full component name (i.e.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003296 * com.google.apps.calendar/com.google.apps.calendar.
3297 * CalendarAlarm) of a Receiver class.
Jeff Sharkey4347f812017-04-21 12:08:39 -06003298 * @param flags Additional option flags to modify the data returned.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003299 * @return An {@link ActivityInfo} containing information about the
3300 * receiver.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003301 * @throws NameNotFoundException if a package with the given name cannot be
3302 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003303 */
Dianne Hackborn361199b2010-08-30 17:42:07 -07003304 public abstract ActivityInfo getReceiverInfo(ComponentName component,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003305 @ComponentInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003306
3307 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003308 * Retrieve all of the information we know about a particular service class.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003309 *
Dianne Hackborn361199b2010-08-30 17:42:07 -07003310 * @param component The full component name (i.e.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003311 * com.google.apps.media/com.google.apps.media.
3312 * BackgroundPlayback) of a Service class.
Jeff Sharkey4347f812017-04-21 12:08:39 -06003313 * @param flags Additional option flags to modify the data returned.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003314 * @return A {@link ServiceInfo} object containing information about the
3315 * service.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003316 * @throws NameNotFoundException if a package with the given name cannot be
3317 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003318 */
Dianne Hackborn361199b2010-08-30 17:42:07 -07003319 public abstract ServiceInfo getServiceInfo(ComponentName component,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003320 @ComponentInfoFlags int flags) throws NameNotFoundException;
Dianne Hackborn361199b2010-08-30 17:42:07 -07003321
3322 /**
3323 * Retrieve all of the information we know about a particular content
3324 * provider class.
3325 *
Dianne Hackborn361199b2010-08-30 17:42:07 -07003326 * @param component The full component name (i.e.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003327 * com.google.providers.media/com.google.providers.media.
3328 * MediaProvider) of a ContentProvider class.
Jeff Sharkey4347f812017-04-21 12:08:39 -06003329 * @param flags Additional option flags to modify the data returned.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003330 * @return A {@link ProviderInfo} object containing information about the
3331 * provider.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003332 * @throws NameNotFoundException if a package with the given name cannot be
3333 * found on the system.
Dianne Hackborn361199b2010-08-30 17:42:07 -07003334 */
3335 public abstract ProviderInfo getProviderInfo(ComponentName component,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003336 @ComponentInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003337
3338 /**
Jeff Sharkey4347f812017-04-21 12:08:39 -06003339 * Return a List of all packages that are installed on the device.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003340 *
Jeff Sharkey4347f812017-04-21 12:08:39 -06003341 * @param flags Additional option flags to modify the data returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003342 * @return A List of PackageInfo objects, one for each installed package,
Jeff Sharkey4347f812017-04-21 12:08:39 -06003343 * containing information about the package. In the unlikely case
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003344 * there are no installed packages, an empty list is returned. If
3345 * flag {@code MATCH_UNINSTALLED_PACKAGES} is set, the package
3346 * information is retrieved from the list of uninstalled
3347 * applications (which includes installed applications as well as
3348 * applications with data directory i.e. applications which had been
3349 * deleted with {@code DONT_DELETE_DATA} flag set).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003350 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003351 public abstract List<PackageInfo> getInstalledPackages(@PackageInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003352
3353 /**
Jeff Sharkey4347f812017-04-21 12:08:39 -06003354 * Return a List of all installed packages that are currently holding any of
3355 * the given permissions.
Dianne Hackborne7991752013-01-16 17:56:46 -08003356 *
Jeff Sharkey4347f812017-04-21 12:08:39 -06003357 * @param flags Additional option flags to modify the data returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003358 * @return A List of PackageInfo objects, one for each installed package
3359 * that holds any of the permissions that were provided, containing
3360 * information about the package. If no installed packages hold any
3361 * of the permissions, an empty list is returned. If flag
Jeff Sharkey4347f812017-04-21 12:08:39 -06003362 * {@code MATCH_UNINSTALLED_PACKAGES} is set, the package
3363 * information is retrieved from the list of uninstalled
3364 * applications (which includes installed applications as well as
3365 * applications with data directory i.e. applications which had been
3366 * deleted with {@code DONT_DELETE_DATA} flag set).
Dianne Hackborne7991752013-01-16 17:56:46 -08003367 */
3368 public abstract List<PackageInfo> getPackagesHoldingPermissions(
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003369 String[] permissions, @PackageInfoFlags int flags);
Dianne Hackborne7991752013-01-16 17:56:46 -08003370
3371 /**
Jeff Sharkey4347f812017-04-21 12:08:39 -06003372 * Return a List of all packages that are installed on the device, for a
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06003373 * specific user.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003374 *
Jeff Sharkey4347f812017-04-21 12:08:39 -06003375 * @param flags Additional option flags to modify the data returned.
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003376 * @param userId The user for whom the installed packages are to be listed
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003377 * @return A List of PackageInfo objects, one for each installed package,
Jeff Sharkey4347f812017-04-21 12:08:39 -06003378 * containing information about the package. In the unlikely case
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003379 * there are no installed packages, an empty list is returned. If
3380 * flag {@code MATCH_UNINSTALLED_PACKAGES} is set, the package
3381 * information is retrieved from the list of uninstalled
3382 * applications (which includes installed applications as well as
3383 * applications with data directory i.e. applications which had been
3384 * deleted with {@code DONT_DELETE_DATA} flag set).
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003385 * @hide
3386 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08003387 @SystemApi
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06003388 @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS_FULL)
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07003389 public abstract List<PackageInfo> getInstalledPackagesAsUser(@PackageInfoFlags int flags,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003390 @UserIdInt int userId);
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003391
3392 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003393 * Check whether a particular package has been granted a particular
3394 * permission.
3395 *
Svet Ganovad3b2972015-07-07 22:49:17 -07003396 * @param permName The name of the permission you are checking for.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003397 * @param pkgName The name of the package you are checking against.
3398 *
3399 * @return If the package has the permission, PERMISSION_GRANTED is
3400 * returned. If it does not have the permission, PERMISSION_DENIED
3401 * is returned.
3402 *
3403 * @see #PERMISSION_GRANTED
3404 * @see #PERMISSION_DENIED
3405 */
Tor Norbye1c2bf032015-03-02 10:57:08 -08003406 @CheckResult
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06003407 public abstract @PermissionResult int checkPermission(String permName, String pkgName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003408
3409 /**
Svet Ganovad3b2972015-07-07 22:49:17 -07003410 * Checks whether a particular permissions has been revoked for a
3411 * package by policy. Typically the device owner or the profile owner
3412 * may apply such a policy. The user cannot grant policy revoked
3413 * permissions, hence the only way for an app to get such a permission
3414 * is by a policy change.
3415 *
3416 * @param permName The name of the permission you are checking for.
3417 * @param pkgName The name of the package you are checking against.
3418 *
3419 * @return Whether the permission is restricted by policy.
3420 */
3421 @CheckResult
Svet Ganovf1b7f202015-07-29 08:33:42 -07003422 public abstract boolean isPermissionRevokedByPolicy(@NonNull String permName,
3423 @NonNull String pkgName);
3424
3425 /**
3426 * Gets the package name of the component controlling runtime permissions.
3427 *
3428 * @return The package name.
3429 *
3430 * @hide
3431 */
Philip P. Moltmanneb0a0ae2017-06-30 10:55:51 -07003432 @TestApi
Svet Ganovf1b7f202015-07-29 08:33:42 -07003433 public abstract String getPermissionControllerPackageName();
Svet Ganovad3b2972015-07-07 22:49:17 -07003434
3435 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003436 * Add a new dynamic permission to the system. For this to work, your
3437 * package must have defined a permission tree through the
3438 * {@link android.R.styleable#AndroidManifestPermissionTree
3439 * &lt;permission-tree&gt;} tag in its manifest. A package can only add
3440 * permissions to trees that were defined by either its own package or
3441 * another with the same user id; a permission is in a tree if it
3442 * matches the name of the permission tree + ".": for example,
3443 * "com.foo.bar" is a member of the permission tree "com.foo".
3444 *
3445 * <p>It is good to make your permission tree name descriptive, because you
3446 * are taking possession of that entire set of permission names. Thus, it
3447 * must be under a domain you control, with a suffix that will not match
3448 * any normal permissions that may be declared in any applications that
3449 * are part of that domain.
3450 *
3451 * <p>New permissions must be added before
3452 * any .apks are installed that use those permissions. Permissions you
3453 * add through this method are remembered across reboots of the device.
3454 * If the given permission already exists, the info you supply here
3455 * will be used to update it.
3456 *
3457 * @param info Description of the permission to be added.
3458 *
3459 * @return Returns true if a new permission was created, false if an
3460 * existing one was updated.
3461 *
3462 * @throws SecurityException if you are not allowed to add the
3463 * given permission name.
3464 *
3465 * @see #removePermission(String)
3466 */
3467 public abstract boolean addPermission(PermissionInfo info);
3468
3469 /**
Dianne Hackbornd7c09682010-03-30 10:42:20 -07003470 * Like {@link #addPermission(PermissionInfo)} but asynchronously
3471 * persists the package manager state after returning from the call,
3472 * allowing it to return quicker and batch a series of adds at the
3473 * expense of no guarantee the added permission will be retained if
3474 * the device is rebooted before it is written.
3475 */
3476 public abstract boolean addPermissionAsync(PermissionInfo info);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003477
Dianne Hackbornd7c09682010-03-30 10:42:20 -07003478 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003479 * Removes a permission that was previously added with
3480 * {@link #addPermission(PermissionInfo)}. The same ownership rules apply
3481 * -- you are only allowed to remove permissions that you are allowed
3482 * to add.
3483 *
3484 * @param name The name of the permission to remove.
3485 *
3486 * @throws SecurityException if you are not allowed to remove the
3487 * given permission name.
3488 *
3489 * @see #addPermission(PermissionInfo)
3490 */
3491 public abstract void removePermission(String name);
3492
Svet Ganov8c7f7002015-05-07 10:48:44 -07003493 /**
3494 * Permission flags set when granting or revoking a permission.
3495 *
3496 * @hide
3497 */
3498 @SystemApi
Jeff Sharkey4347f812017-04-21 12:08:39 -06003499 @IntDef(prefix = { "FLAG_PERMISSION_" }, value = {
3500 FLAG_PERMISSION_USER_SET,
Svet Ganov8c7f7002015-05-07 10:48:44 -07003501 FLAG_PERMISSION_USER_FIXED,
3502 FLAG_PERMISSION_POLICY_FIXED,
Svet Ganovb3f22b42015-05-12 11:01:24 -07003503 FLAG_PERMISSION_REVOKE_ON_UPGRADE,
Svet Ganov77ab6a82015-07-03 12:03:02 -07003504 FLAG_PERMISSION_SYSTEM_FIXED,
Jeff Sharkey4347f812017-04-21 12:08:39 -06003505 FLAG_PERMISSION_GRANTED_BY_DEFAULT
3506 })
Svet Ganov8c7f7002015-05-07 10:48:44 -07003507 @Retention(RetentionPolicy.SOURCE)
3508 public @interface PermissionFlags {}
3509
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003510 /**
Svetoslavc6d1c342015-02-26 14:44:43 -08003511 * Grant a runtime permission to an application which the application does not
3512 * already have. The permission must have been requested by the application.
3513 * If the application is not allowed to hold the permission, a {@link
Ruben Brunk12ab5e12016-11-10 15:27:30 -08003514 * java.lang.SecurityException} is thrown. If the package or permission is
3515 * invalid, a {@link java.lang.IllegalArgumentException} is thrown.
Svetoslavc6d1c342015-02-26 14:44:43 -08003516 * <p>
3517 * <strong>Note: </strong>Using this API requires holding
Todd Kennedya8eb6a82016-07-28 16:35:42 -07003518 * android.permission.GRANT_RUNTIME_PERMISSIONS and if the user id is
Svetoslavc6d1c342015-02-26 14:44:43 -08003519 * not the current user android.permission.INTERACT_ACROSS_USERS_FULL.
3520 * </p>
Nick Kralevich035f80d2013-03-27 15:20:08 -07003521 *
Svetoslavc6d1c342015-02-26 14:44:43 -08003522 * @param packageName The package to which to grant the permission.
3523 * @param permissionName The permission name to grant.
3524 * @param user The user for which to grant the permission.
3525 *
Svet Ganov8c7f7002015-05-07 10:48:44 -07003526 * @see #revokeRuntimePermission(String, String, android.os.UserHandle)
Svetoslavc6d1c342015-02-26 14:44:43 -08003527 *
3528 * @hide
Nick Kralevich035f80d2013-03-27 15:20:08 -07003529 */
Svetoslavc6d1c342015-02-26 14:44:43 -08003530 @SystemApi
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06003531 @RequiresPermission(android.Manifest.permission.GRANT_RUNTIME_PERMISSIONS)
Svet Ganov8c7f7002015-05-07 10:48:44 -07003532 public abstract void grantRuntimePermission(@NonNull String packageName,
Svetoslavc6d1c342015-02-26 14:44:43 -08003533 @NonNull String permissionName, @NonNull UserHandle user);
Nick Kralevich035f80d2013-03-27 15:20:08 -07003534
Svetoslavc6d1c342015-02-26 14:44:43 -08003535 /**
3536 * Revoke a runtime permission that was previously granted by {@link
Svet Ganov8c7f7002015-05-07 10:48:44 -07003537 * #grantRuntimePermission(String, String, android.os.UserHandle)}. The
3538 * permission must have been requested by and granted to the application.
3539 * If the application is not allowed to hold the permission, a {@link
Ruben Brunk12ab5e12016-11-10 15:27:30 -08003540 * java.lang.SecurityException} is thrown. If the package or permission is
3541 * invalid, a {@link java.lang.IllegalArgumentException} is thrown.
Svetoslavc6d1c342015-02-26 14:44:43 -08003542 * <p>
3543 * <strong>Note: </strong>Using this API requires holding
Todd Kennedya8eb6a82016-07-28 16:35:42 -07003544 * android.permission.REVOKE_RUNTIME_PERMISSIONS and if the user id is
Svetoslavc6d1c342015-02-26 14:44:43 -08003545 * not the current user android.permission.INTERACT_ACROSS_USERS_FULL.
3546 * </p>
3547 *
3548 * @param packageName The package from which to revoke the permission.
3549 * @param permissionName The permission name to revoke.
3550 * @param user The user for which to revoke the permission.
3551 *
Svet Ganov8c7f7002015-05-07 10:48:44 -07003552 * @see #grantRuntimePermission(String, String, android.os.UserHandle)
Svetoslavc6d1c342015-02-26 14:44:43 -08003553 *
3554 * @hide
3555 */
3556 @SystemApi
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06003557 @RequiresPermission(android.Manifest.permission.REVOKE_RUNTIME_PERMISSIONS)
Svet Ganov8c7f7002015-05-07 10:48:44 -07003558 public abstract void revokeRuntimePermission(@NonNull String packageName,
Svetoslavc6d1c342015-02-26 14:44:43 -08003559 @NonNull String permissionName, @NonNull UserHandle user);
3560
3561 /**
Svet Ganov8c7f7002015-05-07 10:48:44 -07003562 * Gets the state flags associated with a permission.
3563 *
3564 * @param permissionName The permission for which to get the flags.
3565 * @param packageName The package name for which to get the flags.
3566 * @param user The user for which to get permission flags.
3567 * @return The permission flags.
3568 *
3569 * @hide
3570 */
3571 @SystemApi
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06003572 @RequiresPermission(anyOf = {
3573 android.Manifest.permission.GRANT_RUNTIME_PERMISSIONS,
3574 android.Manifest.permission.REVOKE_RUNTIME_PERMISSIONS
3575 })
Svet Ganov8c7f7002015-05-07 10:48:44 -07003576 public abstract @PermissionFlags int getPermissionFlags(String permissionName,
3577 String packageName, @NonNull UserHandle user);
3578
3579 /**
3580 * Updates the flags associated with a permission by replacing the flags in
3581 * the specified mask with the provided flag values.
3582 *
3583 * @param permissionName The permission for which to update the flags.
3584 * @param packageName The package name for which to update the flags.
3585 * @param flagMask The flags which to replace.
3586 * @param flagValues The flags with which to replace.
3587 * @param user The user for which to update the permission flags.
3588 *
3589 * @hide
3590 */
3591 @SystemApi
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06003592 @RequiresPermission(anyOf = {
3593 android.Manifest.permission.GRANT_RUNTIME_PERMISSIONS,
3594 android.Manifest.permission.REVOKE_RUNTIME_PERMISSIONS
3595 })
Svet Ganov8c7f7002015-05-07 10:48:44 -07003596 public abstract void updatePermissionFlags(String permissionName,
Jeff Sharkey4347f812017-04-21 12:08:39 -06003597 String packageName, @PermissionFlags int flagMask, @PermissionFlags int flagValues,
Svet Ganov8c7f7002015-05-07 10:48:44 -07003598 @NonNull UserHandle user);
3599
3600 /**
Svetoslav20770dd2015-05-29 15:43:04 -07003601 * Gets whether you should show UI with rationale for requesting a permission.
3602 * You should do this only if you do not have the permission and the context in
3603 * which the permission is requested does not clearly communicate to the user
3604 * what would be the benefit from grating this permission.
3605 *
3606 * @param permission A permission your app wants to request.
3607 * @return Whether you can show permission rationale UI.
3608 *
3609 * @hide
3610 */
3611 public abstract boolean shouldShowRequestPermissionRationale(String permission);
3612
3613 /**
Svetoslavc6d1c342015-02-26 14:44:43 -08003614 * Returns an {@link android.content.Intent} suitable for passing to
3615 * {@link android.app.Activity#startActivityForResult(android.content.Intent, int)}
3616 * which prompts the user to grant permissions to this application.
3617 *
3618 * @throws NullPointerException if {@code permissions} is {@code null} or empty.
3619 *
3620 * @hide
3621 */
3622 public Intent buildRequestPermissionsIntent(@NonNull String[] permissions) {
3623 if (ArrayUtils.isEmpty(permissions)) {
Svet Ganovf66381c2016-02-18 20:02:36 -08003624 throw new IllegalArgumentException("permission cannot be null or empty");
Svetoslavc6d1c342015-02-26 14:44:43 -08003625 }
3626 Intent intent = new Intent(ACTION_REQUEST_PERMISSIONS);
3627 intent.putExtra(EXTRA_REQUEST_PERMISSIONS_NAMES, permissions);
Svet Ganovf1b7f202015-07-29 08:33:42 -07003628 intent.setPackage(getPermissionControllerPackageName());
Svetoslavc6d1c342015-02-26 14:44:43 -08003629 return intent;
Nick Kralevich035f80d2013-03-27 15:20:08 -07003630 }
3631
3632 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003633 * Compare the signatures of two packages to determine if the same
3634 * signature appears in both of them. If they do contain the same
3635 * signature, then they are allowed special privileges when working
3636 * with each other: they can share the same user-id, run instrumentation
3637 * against each other, etc.
3638 *
3639 * @param pkg1 First package name whose signature will be compared.
3640 * @param pkg2 Second package name whose signature will be compared.
Chris Palmer09f33602010-09-13 14:27:18 -07003641 *
3642 * @return Returns an integer indicating whether all signatures on the
3643 * two packages match. The value is >= 0 ({@link #SIGNATURE_MATCH}) if
3644 * all signatures match or < 0 if there is not a match ({@link
3645 * #SIGNATURE_NO_MATCH} or {@link #SIGNATURE_UNKNOWN_PACKAGE}).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003646 *
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07003647 * @see #checkSignatures(int, int)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003648 */
Tor Norbye1c2bf032015-03-02 10:57:08 -08003649 @CheckResult
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06003650 public abstract @SignatureResult int checkSignatures(String pkg1, String pkg2);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003651
3652 /**
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07003653 * Like {@link #checkSignatures(String, String)}, but takes UIDs of
3654 * the two packages to be checked. This can be useful, for example,
3655 * when doing the check in an IPC, where the UID is the only identity
3656 * available. It is functionally identical to determining the package
3657 * associated with the UIDs and checking their signatures.
3658 *
Joe Onorato25660ec2009-08-12 22:40:37 -07003659 * @param uid1 First UID whose signature will be compared.
3660 * @param uid2 Second UID whose signature will be compared.
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07003661 *
Chris Palmer09f33602010-09-13 14:27:18 -07003662 * @return Returns an integer indicating whether all signatures on the
3663 * two packages match. The value is >= 0 ({@link #SIGNATURE_MATCH}) if
3664 * all signatures match or < 0 if there is not a match ({@link
3665 * #SIGNATURE_NO_MATCH} or {@link #SIGNATURE_UNKNOWN_PACKAGE}).
3666 *
3667 * @see #checkSignatures(String, String)
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07003668 */
Tor Norbye1c2bf032015-03-02 10:57:08 -08003669 @CheckResult
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06003670 public abstract @SignatureResult int checkSignatures(int uid1, int uid2);
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07003671
3672 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003673 * Retrieve the names of all packages that are associated with a particular
3674 * user id. In most cases, this will be a single package name, the package
3675 * that has been assigned that user id. Where there are multiple packages
3676 * sharing the same user id through the "sharedUserId" mechanism, all
3677 * packages with that id will be returned.
3678 *
3679 * @param uid The user id for which you would like to retrieve the
3680 * associated packages.
3681 *
3682 * @return Returns an array of one or more packages assigned to the user
3683 * id, or null if there are no known packages with the given id.
3684 */
Jeff Sharkey377ded0f2016-01-10 13:15:41 -07003685 public abstract @Nullable String[] getPackagesForUid(int uid);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003686
3687 /**
Michal Karpinskicb67dc92016-12-13 18:20:23 +00003688 * Retrieve the official name associated with a uid. This name is
Jonathan Basseri7ea3a332015-05-12 19:39:22 -07003689 * guaranteed to never change, though it is possible for the underlying
Michal Karpinskicb67dc92016-12-13 18:20:23 +00003690 * uid to be changed. That is, if you are storing information about
3691 * uids in persistent storage, you should use the string returned
3692 * by this function instead of the raw uid.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003693 *
Michal Karpinskicb67dc92016-12-13 18:20:23 +00003694 * @param uid The uid for which you would like to retrieve a name.
3695 * @return Returns a unique name for the given uid, or null if the
3696 * uid is not currently assigned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003697 */
Jeff Sharkey377ded0f2016-01-10 13:15:41 -07003698 public abstract @Nullable String getNameForUid(int uid);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003699
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003700 /**
Todd Kennedy9da8b8a72017-07-25 15:38:39 -07003701 * Retrieves the official names associated with each given uid.
3702 * @see #getNameForUid(int)
3703 *
3704 * @hide
3705 */
3706 public abstract @Nullable String[] getNamesForUids(int[] uids);
3707
3708 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003709 * Return the user id associated with a shared user name. Multiple
3710 * applications can specify a shared user name in their manifest and thus
3711 * end up using a common uid. This might be used for new applications
3712 * that use an existing shared user name and need to know the uid of the
3713 * shared user.
3714 *
3715 * @param sharedUserName The shared user name whose uid is to be retrieved.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003716 * @return Returns the UID associated with the shared user.
3717 * @throws NameNotFoundException if a package with the given name cannot be
3718 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003719 * @hide
3720 */
3721 public abstract int getUidForSharedUser(String sharedUserName)
3722 throws NameNotFoundException;
3723
3724 /**
3725 * Return a List of all application packages that are installed on the
3726 * device. If flag GET_UNINSTALLED_PACKAGES has been set, a list of all
Jeff Sharkey4347f812017-04-21 12:08:39 -06003727 * applications including those deleted with {@code DONT_DELETE_DATA}
3728 * (partially installed apps with data directory) will be returned.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003729 *
Jeff Sharkey4347f812017-04-21 12:08:39 -06003730 * @param flags Additional option flags to modify the data returned.
3731 * @return A List of ApplicationInfo objects, one for each installed
3732 * application. In the unlikely case there are no installed
3733 * packages, an empty list is returned. If flag
3734 * {@code MATCH_UNINSTALLED_PACKAGES} is set, the application
3735 * information is retrieved from the list of uninstalled
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003736 * applications (which includes installed applications as well as
3737 * applications with data directory i.e. applications which had been
3738 * deleted with {@code DONT_DELETE_DATA} flag set).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003739 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003740 public abstract List<ApplicationInfo> getInstalledApplications(@ApplicationInfoFlags int flags);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003741
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003742 /**
Jeff Sharkey4347f812017-04-21 12:08:39 -06003743 * Return a List of all application packages that are installed on the
3744 * device, for a specific user. If flag GET_UNINSTALLED_PACKAGES has been
3745 * set, a list of all applications including those deleted with
3746 * {@code DONT_DELETE_DATA} (partially installed apps with data directory)
Bartosz Fabianowski11334242016-11-17 20:49:16 +01003747 * will be returned.
3748 *
Jeff Sharkey4347f812017-04-21 12:08:39 -06003749 * @param flags Additional option flags to modify the data returned.
3750 * @param userId The user for whom the installed applications are to be
3751 * listed
3752 * @return A List of ApplicationInfo objects, one for each installed
3753 * application. In the unlikely case there are no installed
3754 * packages, an empty list is returned. If flag
3755 * {@code MATCH_UNINSTALLED_PACKAGES} is set, the application
3756 * information is retrieved from the list of uninstalled
Bartosz Fabianowski11334242016-11-17 20:49:16 +01003757 * applications (which includes installed applications as well as
3758 * applications with data directory i.e. applications which had been
3759 * deleted with {@code DONT_DELETE_DATA} flag set).
3760 * @hide
Bartosz Fabianowski11334242016-11-17 20:49:16 +01003761 */
3762 public abstract List<ApplicationInfo> getInstalledApplicationsAsUser(
3763 @ApplicationInfoFlags int flags, @UserIdInt int userId);
3764
3765 /**
Jeff Sharkey910e0812017-04-21 16:29:27 -06003766 * Gets the instant applications the user recently used.
Svet Ganov2acf0632015-11-24 19:10:59 -08003767 *
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003768 * @return The instant app list.
Svet Ganov2acf0632015-11-24 19:10:59 -08003769 *
3770 * @hide
3771 */
Todd Kennedy9c9fdf22017-03-06 10:58:27 -08003772 @SystemApi
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003773 @RequiresPermission(Manifest.permission.ACCESS_INSTANT_APPS)
3774 public abstract @NonNull List<InstantAppInfo> getInstantApps();
Svet Ganov2acf0632015-11-24 19:10:59 -08003775
3776 /**
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003777 * Gets the icon for an instant application.
Svet Ganov2acf0632015-11-24 19:10:59 -08003778 *
3779 * @param packageName The app package name.
3780 *
3781 * @hide
3782 */
Todd Kennedy9c9fdf22017-03-06 10:58:27 -08003783 @SystemApi
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003784 @RequiresPermission(Manifest.permission.ACCESS_INSTANT_APPS)
3785 public abstract @Nullable Drawable getInstantAppIcon(String packageName);
Svet Ganov2acf0632015-11-24 19:10:59 -08003786
3787 /**
David Christie31a16552017-03-01 15:08:45 -08003788 * Gets whether this application is an instant app.
Svet Ganov2acf0632015-11-24 19:10:59 -08003789 *
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003790 * @return Whether caller is an instant app.
Svet Ganov2acf0632015-11-24 19:10:59 -08003791 *
David Christie31a16552017-03-01 15:08:45 -08003792 * @see #isInstantApp(String)
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003793 * @see #updateInstantAppCookie(byte[])
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003794 * @see #getInstantAppCookie()
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003795 * @see #getInstantAppCookieMaxBytes()
Svet Ganov2acf0632015-11-24 19:10:59 -08003796 */
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003797 public abstract boolean isInstantApp();
Svet Ganov2acf0632015-11-24 19:10:59 -08003798
3799 /**
David Christie31a16552017-03-01 15:08:45 -08003800 * Gets whether the given package is an instant app.
3801 *
3802 * @param packageName The package to check
3803 * @return Whether the given package is an instant app.
3804 *
3805 * @see #isInstantApp()
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003806 * @see #updateInstantAppCookie(byte[])
David Christie31a16552017-03-01 15:08:45 -08003807 * @see #getInstantAppCookie()
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003808 * @see #getInstantAppCookieMaxBytes()
3809 * @see #clearInstantAppCookie()
David Christie31a16552017-03-01 15:08:45 -08003810 */
3811 public abstract boolean isInstantApp(String packageName);
3812
3813 /**
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003814 * Gets the maximum size in bytes of the cookie data an instant app
Svet Ganov2acf0632015-11-24 19:10:59 -08003815 * can store on the device.
3816 *
3817 * @return The max cookie size in bytes.
3818 *
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003819 * @see #isInstantApp()
David Christie31a16552017-03-01 15:08:45 -08003820 * @see #isInstantApp(String)
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003821 * @see #updateInstantAppCookie(byte[])
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003822 * @see #getInstantAppCookie()
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003823 * @see #clearInstantAppCookie()
3824 */
3825 public abstract int getInstantAppCookieMaxBytes();
3826
3827 /**
Daniel Cashman5cdda342018-01-19 07:22:52 -08003828 * deprecated
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003829 * @hide
Svet Ganov2acf0632015-11-24 19:10:59 -08003830 */
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003831 public abstract int getInstantAppCookieMaxSize();
Svet Ganov2acf0632015-11-24 19:10:59 -08003832
3833 /**
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003834 * Gets the instant application cookie for this app. Non
3835 * instant apps and apps that were instant but were upgraded
3836 * to normal apps can still access this API. For instant apps
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003837 * this cookie is cached for some time after uninstall while for
Svet Ganov2acf0632015-11-24 19:10:59 -08003838 * normal apps the cookie is deleted after the app is uninstalled.
3839 * The cookie is always present while the app is installed.
3840 *
3841 * @return The cookie.
3842 *
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003843 * @see #isInstantApp()
David Christie31a16552017-03-01 15:08:45 -08003844 * @see #isInstantApp(String)
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003845 * @see #updateInstantAppCookie(byte[])
3846 * @see #getInstantAppCookieMaxBytes()
3847 * @see #clearInstantAppCookie()
Svet Ganov2acf0632015-11-24 19:10:59 -08003848 */
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003849 public abstract @NonNull byte[] getInstantAppCookie();
Svet Ganov2acf0632015-11-24 19:10:59 -08003850
3851 /**
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003852 * Clears the instant application cookie for the calling app.
Svet Ganov2acf0632015-11-24 19:10:59 -08003853 *
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003854 * @see #isInstantApp()
David Christie31a16552017-03-01 15:08:45 -08003855 * @see #isInstantApp(String)
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003856 * @see #getInstantAppCookieMaxBytes()
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003857 * @see #getInstantAppCookie()
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003858 * @see #clearInstantAppCookie()
3859 */
3860 public abstract void clearInstantAppCookie();
3861
3862 /**
3863 * Updates the instant application cookie for the calling app. Non
3864 * instant apps and apps that were instant but were upgraded
3865 * to normal apps can still access this API. For instant apps
3866 * this cookie is cached for some time after uninstall while for
3867 * normal apps the cookie is deleted after the app is uninstalled.
3868 * The cookie is always present while the app is installed. The
3869 * cookie size is limited by {@link #getInstantAppCookieMaxBytes()}.
3870 * Passing <code>null</code> or an empty array clears the cookie.
3871 * </p>
3872 *
3873 * @param cookie The cookie data.
3874 *
3875 * @see #isInstantApp()
3876 * @see #isInstantApp(String)
3877 * @see #getInstantAppCookieMaxBytes()
3878 * @see #getInstantAppCookie()
3879 * @see #clearInstantAppCookie()
3880 *
3881 * @throws IllegalArgumentException if the array exceeds max cookie size.
3882 */
3883 public abstract void updateInstantAppCookie(@Nullable byte[] cookie);
3884
3885 /**
3886 * @removed
Svet Ganov2acf0632015-11-24 19:10:59 -08003887 */
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003888 public abstract boolean setInstantAppCookie(@Nullable byte[] cookie);
Svet Ganov2acf0632015-11-24 19:10:59 -08003889
3890 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003891 * Get a list of shared libraries that are available on the
3892 * system.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003893 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003894 * @return An array of shared library names that are
3895 * available on the system, or null if none are installed.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003896 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003897 */
3898 public abstract String[] getSystemSharedLibraryNames();
3899
3900 /**
Svet Ganov67882122016-12-11 16:36:34 -08003901 * Get a list of shared libraries on the device.
3902 *
3903 * @param flags To filter the libraries to return.
3904 * @return The shared library list.
3905 *
Svet Ganov67882122016-12-11 16:36:34 -08003906 * @see #MATCH_UNINSTALLED_PACKAGES
3907 */
3908 public abstract @NonNull List<SharedLibraryInfo> getSharedLibraries(
3909 @InstallFlags int flags);
3910
3911 /**
3912 * Get a list of shared libraries on the device.
3913 *
3914 * @param flags To filter the libraries to return.
3915 * @param userId The user to query for.
3916 * @return The shared library list.
3917 *
3918 * @see #MATCH_FACTORY_ONLY
3919 * @see #MATCH_KNOWN_PACKAGES
3920 * @see #MATCH_ANY_USER
3921 * @see #MATCH_UNINSTALLED_PACKAGES
3922 *
3923 * @hide
3924 */
3925 public abstract @NonNull List<SharedLibraryInfo> getSharedLibrariesAsUser(
3926 @InstallFlags int flags, @UserIdInt int userId);
3927
3928 /**
Svet Ganovd7b1f4112016-02-09 18:49:23 -08003929 * Get the name of the package hosting the services shared library.
3930 *
3931 * @return The library host package.
3932 *
3933 * @hide
3934 */
Svetoslav Ganova9c25002016-04-13 19:25:56 -07003935 public abstract @NonNull String getServicesSystemSharedLibraryPackageName();
3936
3937 /**
3938 * Get the name of the package hosting the shared components shared library.
3939 *
3940 * @return The library host package.
3941 *
3942 * @hide
3943 */
3944 public abstract @NonNull String getSharedSystemSharedLibraryPackageName();
Svet Ganovd7b1f4112016-02-09 18:49:23 -08003945
3946 /**
Todd Kennedy9106c642017-02-08 14:16:53 -08003947 * Returns the names of the packages that have been changed
3948 * [eg. added, removed or updated] since the given sequence
3949 * number.
3950 * <p>If no packages have been changed, returns <code>null</code>.
3951 * <p>The sequence number starts at <code>0</code> and is
3952 * reset every boot.
Todd Kennedy8fddf9d2017-04-17 15:16:12 -07003953 * @param sequenceNumber The first sequence number for which to retrieve package changes.
3954 * @see Settings.Global#BOOT_COUNT
Todd Kennedy9106c642017-02-08 14:16:53 -08003955 */
3956 public abstract @Nullable ChangedPackages getChangedPackages(
3957 @IntRange(from=0) int sequenceNumber);
3958
3959 /**
Dianne Hackborn49237342009-08-27 20:08:01 -07003960 * Get a list of features that are available on the
3961 * system.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003962 *
Dianne Hackborn49237342009-08-27 20:08:01 -07003963 * @return An array of FeatureInfo classes describing the features
3964 * that are available on the system, or null if there are none(!!).
Dianne Hackborn49237342009-08-27 20:08:01 -07003965 */
3966 public abstract FeatureInfo[] getSystemAvailableFeatures();
3967
3968 /**
Jeff Sharkey115d2c12016-02-15 17:25:57 -07003969 * Check whether the given feature name is one of the available features as
3970 * returned by {@link #getSystemAvailableFeatures()}. This tests for the
3971 * presence of <em>any</em> version of the given feature name; use
3972 * {@link #hasSystemFeature(String, int)} to check for a minimum version.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003973 *
Jeff Sharkey115d2c12016-02-15 17:25:57 -07003974 * @return Returns true if the devices supports the feature, else false.
Dianne Hackborn039c68e2009-09-26 16:39:23 -07003975 */
3976 public abstract boolean hasSystemFeature(String name);
3977
3978 /**
Jeff Sharkey115d2c12016-02-15 17:25:57 -07003979 * Check whether the given feature name and version is one of the available
3980 * features as returned by {@link #getSystemAvailableFeatures()}. Since
3981 * features are defined to always be backwards compatible, this returns true
3982 * if the available feature version is greater than or equal to the
3983 * requested version.
3984 *
3985 * @return Returns true if the devices supports the feature, else false.
3986 */
3987 public abstract boolean hasSystemFeature(String name, int version);
3988
3989 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003990 * Determine the best action to perform for a given Intent. This is how
3991 * {@link Intent#resolveActivity} finds an activity if a class has not been
3992 * explicitly specified.
3993 * <p>
3994 * <em>Note:</em> if using an implicit Intent (without an explicit
3995 * ComponentName specified), be sure to consider whether to set the
3996 * {@link #MATCH_DEFAULT_ONLY} only flag. You need to do so to resolve the
3997 * activity in the same way that
3998 * {@link android.content.Context#startActivity(Intent)} and
Dianne Hackborn4d023d212010-10-01 13:41:04 -07003999 * {@link android.content.Intent#resolveActivity(PackageManager)
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004000 * Intent.resolveActivity(PackageManager)} do.
4001 * </p>
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004002 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004003 * @param intent An intent containing all of the desired specification
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004004 * (action, data, type, category, and/or component).
Jeff Sharkey4347f812017-04-21 12:08:39 -06004005 * @param flags Additional option flags to modify the data returned. The
4006 * most important is {@link #MATCH_DEFAULT_ONLY}, to limit the
4007 * resolution to only those activities that support the
4008 * {@link android.content.Intent#CATEGORY_DEFAULT}.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004009 * @return Returns a ResolveInfo object containing the final activity intent
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004010 * that was determined to be the best action. Returns null if no
Mike LeBeaubd3f5272010-02-18 19:27:17 -08004011 * matching activity was found. If multiple matching activities are
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004012 * found and there is no default set, returns a ResolveInfo object
Mike LeBeaubd3f5272010-02-18 19:27:17 -08004013 * containing something else, such as the activity resolver.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004014 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004015 public abstract ResolveInfo resolveActivity(Intent intent, @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004016
4017 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004018 * Determine the best action to perform for a given Intent for a given user.
4019 * This is how {@link Intent#resolveActivity} finds an activity if a class
4020 * has not been explicitly specified.
4021 * <p>
4022 * <em>Note:</em> if using an implicit Intent (without an explicit
4023 * ComponentName specified), be sure to consider whether to set the
4024 * {@link #MATCH_DEFAULT_ONLY} only flag. You need to do so to resolve the
4025 * activity in the same way that
4026 * {@link android.content.Context#startActivity(Intent)} and
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004027 * {@link android.content.Intent#resolveActivity(PackageManager)
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004028 * Intent.resolveActivity(PackageManager)} do.
4029 * </p>
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004030 *
4031 * @param intent An intent containing all of the desired specification
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004032 * (action, data, type, category, and/or component).
Jeff Sharkey4347f812017-04-21 12:08:39 -06004033 * @param flags Additional option flags to modify the data returned. The
4034 * most important is {@link #MATCH_DEFAULT_ONLY}, to limit the
4035 * resolution to only those activities that support the
4036 * {@link android.content.Intent#CATEGORY_DEFAULT}.
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004037 * @param userId The user id.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004038 * @return Returns a ResolveInfo object containing the final activity intent
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004039 * that was determined to be the best action. Returns null if no
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004040 * matching activity was found. If multiple matching activities are
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004041 * found and there is no default set, returns a ResolveInfo object
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004042 * containing something else, such as the activity resolver.
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004043 * @hide
4044 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004045 public abstract ResolveInfo resolveActivityAsUser(Intent intent, @ResolveInfoFlags int flags,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004046 @UserIdInt int userId);
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004047
4048 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004049 * Retrieve all activities that can be performed for the given intent.
4050 *
4051 * @param intent The desired intent as per resolveActivity().
Jeff Sharkey4347f812017-04-21 12:08:39 -06004052 * @param flags Additional option flags to modify the data returned. The
4053 * most important is {@link #MATCH_DEFAULT_ONLY}, to limit the
4054 * resolution to only those activities that support the
4055 * {@link android.content.Intent#CATEGORY_DEFAULT}. Or, set
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004056 * {@link #MATCH_ALL} to prevent any filtering of the results.
4057 * @return Returns a List of ResolveInfo objects containing one entry for
4058 * each matching activity, ordered from best to worst. In other
4059 * words, the first item is what would be returned by
4060 * {@link #resolveActivity}. If there are no matching activities, an
4061 * empty list is returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004062 */
4063 public abstract List<ResolveInfo> queryIntentActivities(Intent intent,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004064 @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004065
4066 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004067 * Retrieve all activities that can be performed for the given intent, for a
4068 * specific user.
Amith Yamasani151ec4c2012-09-07 19:25:16 -07004069 *
4070 * @param intent The desired intent as per resolveActivity().
Jeff Sharkey4347f812017-04-21 12:08:39 -06004071 * @param flags Additional option flags to modify the data returned. The
4072 * most important is {@link #MATCH_DEFAULT_ONLY}, to limit the
4073 * resolution to only those activities that support the
4074 * {@link android.content.Intent#CATEGORY_DEFAULT}. Or, set
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004075 * {@link #MATCH_ALL} to prevent any filtering of the results.
4076 * @return Returns a List of ResolveInfo objects containing one entry for
4077 * each matching activity, ordered from best to worst. In other
4078 * words, the first item is what would be returned by
4079 * {@link #resolveActivity}. If there are no matching activities, an
4080 * empty list is returned.
Amith Yamasani151ec4c2012-09-07 19:25:16 -07004081 * @hide
4082 */
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004083 public abstract List<ResolveInfo> queryIntentActivitiesAsUser(Intent intent,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004084 @ResolveInfoFlags int flags, @UserIdInt int userId);
Amith Yamasani151ec4c2012-09-07 19:25:16 -07004085
4086 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004087 * Retrieve a set of activities that should be presented to the user as
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004088 * similar options. This is like {@link #queryIntentActivities}, except it
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004089 * also allows you to supply a list of more explicit Intents that you would
4090 * like to resolve to particular options, and takes care of returning the
4091 * final ResolveInfo list in a reasonable order, with no duplicates, based
4092 * on those inputs.
4093 *
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004094 * @param caller The class name of the activity that is making the request.
4095 * This activity will never appear in the output list. Can be
4096 * null.
4097 * @param specifics An array of Intents that should be resolved to the first
4098 * specific results. Can be null.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004099 * @param intent The desired intent as per resolveActivity().
Jeff Sharkey4347f812017-04-21 12:08:39 -06004100 * @param flags Additional option flags to modify the data returned. The
4101 * most important is {@link #MATCH_DEFAULT_ONLY}, to limit the
4102 * resolution to only those activities that support the
4103 * {@link android.content.Intent#CATEGORY_DEFAULT}.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004104 * @return Returns a List of ResolveInfo objects containing one entry for
4105 * each matching activity. The list is ordered first by all of the
4106 * intents resolved in <var>specifics</var> and then any additional
4107 * activities that can handle <var>intent</var> but did not get
4108 * included by one of the <var>specifics</var> intents. If there are
4109 * no matching activities, an empty list is returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004110 */
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06004111 public abstract List<ResolveInfo> queryIntentActivityOptions(@Nullable ComponentName caller,
4112 @Nullable Intent[] specifics, Intent intent, @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004113
4114 /**
4115 * Retrieve all receivers that can handle a broadcast of the given intent.
4116 *
4117 * @param intent The desired intent as per resolveActivity().
Jeff Sharkey4347f812017-04-21 12:08:39 -06004118 * @param flags Additional option flags to modify the data returned.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004119 * @return Returns a List of ResolveInfo objects containing one entry for
4120 * each matching receiver, ordered from best to worst. If there are
4121 * no matching receivers, an empty list or null is returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004122 */
4123 public abstract List<ResolveInfo> queryBroadcastReceivers(Intent intent,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004124 @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004125
4126 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004127 * Retrieve all receivers that can handle a broadcast of the given intent,
4128 * for a specific user.
Amith Yamasanif203aee2012-08-29 18:41:53 -07004129 *
4130 * @param intent The desired intent as per resolveActivity().
Jeff Sharkey4347f812017-04-21 12:08:39 -06004131 * @param flags Additional option flags to modify the data returned.
Fyodor Kupolov940e8572016-01-26 12:03:51 -08004132 * @param userHandle UserHandle of the user being queried.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004133 * @return Returns a List of ResolveInfo objects containing one entry for
4134 * each matching receiver, ordered from best to worst. If there are
4135 * no matching receivers, an empty list or null is returned.
Amith Yamasanif203aee2012-08-29 18:41:53 -07004136 * @hide
4137 */
Fyodor Kupolov940e8572016-01-26 12:03:51 -08004138 @SystemApi
Todd Kennedydbaef6d2017-07-24 11:28:00 -07004139 @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS)
Fyodor Kupolov940e8572016-01-26 12:03:51 -08004140 public List<ResolveInfo> queryBroadcastReceiversAsUser(Intent intent,
4141 @ResolveInfoFlags int flags, UserHandle userHandle) {
4142 return queryBroadcastReceiversAsUser(intent, flags, userHandle.getIdentifier());
4143 }
4144
4145 /**
4146 * @hide
4147 */
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07004148 public abstract List<ResolveInfo> queryBroadcastReceiversAsUser(Intent intent,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004149 @ResolveInfoFlags int flags, @UserIdInt int userId);
Amith Yamasanif203aee2012-08-29 18:41:53 -07004150
Fyodor Kupolov940e8572016-01-26 12:03:51 -08004151
Jeff Sharkeybd940222016-01-08 11:07:13 -07004152 /** {@hide} */
4153 @Deprecated
4154 public List<ResolveInfo> queryBroadcastReceivers(Intent intent,
4155 @ResolveInfoFlags int flags, @UserIdInt int userId) {
Jeff Sharkey6f4b2a32017-03-21 14:13:41 -06004156 final String msg = "Shame on you for calling the hidden API "
4157 + "queryBroadcastReceivers(). Shame!";
4158 if (VMRuntime.getRuntime().getTargetSdkVersion() >= Build.VERSION_CODES.O) {
4159 throw new UnsupportedOperationException(msg);
4160 } else {
4161 Log.d(TAG, msg);
4162 return queryBroadcastReceiversAsUser(intent, flags, userId);
4163 }
Jeff Sharkeybd940222016-01-08 11:07:13 -07004164 }
4165
Amith Yamasanif203aee2012-08-29 18:41:53 -07004166 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004167 * Determine the best service to handle for a given Intent.
4168 *
4169 * @param intent An intent containing all of the desired specification
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004170 * (action, data, type, category, and/or component).
Jeff Sharkey4347f812017-04-21 12:08:39 -06004171 * @param flags Additional option flags to modify the data returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004172 * @return Returns a ResolveInfo object containing the final service intent
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004173 * that was determined to be the best action. Returns null if no
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004174 * matching service was found.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004175 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004176 public abstract ResolveInfo resolveService(Intent intent, @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004177
4178 /**
4179 * Retrieve all services that can match the given intent.
4180 *
4181 * @param intent The desired intent as per resolveService().
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 Returns a List of ResolveInfo objects containing one entry for
4184 * each matching service, ordered from best to worst. In other
4185 * words, the first item is what would be returned by
4186 * {@link #resolveService}. If there are no matching services, an
4187 * empty list or null is returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004188 */
4189 public abstract List<ResolveInfo> queryIntentServices(Intent intent,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004190 @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004191
4192 /**
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004193 * Retrieve all services that can match the given intent for a given user.
4194 *
4195 * @param intent The desired intent as per resolveService().
Jeff Sharkey4347f812017-04-21 12:08:39 -06004196 * @param flags Additional option flags to modify the data returned.
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004197 * @param userId The user id.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004198 * @return Returns a List of ResolveInfo objects containing one entry for
4199 * each matching service, ordered from best to worst. In other
4200 * words, the first item is what would be returned by
4201 * {@link #resolveService}. If there are no matching services, an
4202 * empty list or null is returned.
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004203 * @hide
4204 */
4205 public abstract List<ResolveInfo> queryIntentServicesAsUser(Intent intent,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004206 @ResolveInfoFlags int flags, @UserIdInt int userId);
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004207
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004208 /**
4209 * Retrieve all providers that can match the given intent.
4210 *
4211 * @param intent An intent containing all of the desired specification
4212 * (action, data, type, category, and/or component).
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 * @param userId The user id.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004215 * @return Returns a List of ResolveInfo objects containing one entry for
4216 * each matching provider, ordered from best to worst. If there are
4217 * no matching services, an empty list or null is returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004218 * @hide
4219 */
Jeff Sharkey85f5f812013-10-07 10:16:12 -07004220 public abstract List<ResolveInfo> queryIntentContentProvidersAsUser(
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004221 Intent intent, @ResolveInfoFlags int flags, @UserIdInt int userId);
Jeff Sharkey85f5f812013-10-07 10:16:12 -07004222
4223 /**
4224 * Retrieve all providers that can match the given intent.
4225 *
4226 * @param intent An intent containing all of the desired specification
4227 * (action, data, type, category, and/or component).
Jeff Sharkey4347f812017-04-21 12:08:39 -06004228 * @param flags Additional option flags to modify the data returned.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004229 * @return Returns a List of ResolveInfo objects containing one entry for
4230 * each matching provider, ordered from best to worst. If there are
4231 * no matching services, an empty list or null is returned.
Jeff Sharkey85f5f812013-10-07 10:16:12 -07004232 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004233 public abstract List<ResolveInfo> queryIntentContentProviders(Intent intent,
4234 @ResolveInfoFlags int flags);
Jeff Sharkey85f5f812013-10-07 10:16:12 -07004235
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004236 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004237 * Find a single content provider by its base path name.
4238 *
4239 * @param name The name of the provider to find.
Jeff Sharkey4347f812017-04-21 12:08:39 -06004240 * @param flags Additional option flags to modify the data returned.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004241 * @return A {@link ProviderInfo} object containing information about the
4242 * provider. If a provider was not found, returns null.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004243 */
4244 public abstract ProviderInfo resolveContentProvider(String name,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004245 @ComponentInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004246
4247 /**
Alexandra Gherghina0363c3e2014-06-23 13:34:59 +01004248 * Find a single content provider by its base path name.
4249 *
4250 * @param name The name of the provider to find.
Jeff Sharkey4347f812017-04-21 12:08:39 -06004251 * @param flags Additional option flags to modify the data returned.
Alexandra Gherghina0363c3e2014-06-23 13:34:59 +01004252 * @param userId The user id.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004253 * @return A {@link ProviderInfo} object containing information about the
4254 * provider. If a provider was not found, returns null.
Alexandra Gherghina0363c3e2014-06-23 13:34:59 +01004255 * @hide
4256 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004257 public abstract ProviderInfo resolveContentProviderAsUser(String name,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004258 @ComponentInfoFlags int flags, @UserIdInt int userId);
Alexandra Gherghina0363c3e2014-06-23 13:34:59 +01004259
4260 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004261 * Retrieve content provider information.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004262 * <p>
4263 * <em>Note: unlike most other methods, an empty result set is indicated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004264 * by a null return instead of an empty list.</em>
4265 *
4266 * @param processName If non-null, limits the returned providers to only
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004267 * those that are hosted by the given process. If null, all
4268 * content providers are returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004269 * @param uid If <var>processName</var> is non-null, this is the required
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004270 * uid owning the requested content providers.
Jeff Sharkey4347f812017-04-21 12:08:39 -06004271 * @param flags Additional option flags to modify the data returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004272 * @return A list of {@link ProviderInfo} objects containing one entry for
4273 * each provider either matching <var>processName</var> or, if
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004274 * <var>processName</var> is null, all known content providers.
4275 * <em>If there are no matching providers, null is returned.</em>
4276 */
4277 public abstract List<ProviderInfo> queryContentProviders(
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004278 String processName, int uid, @ComponentInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004279
4280 /**
Makoto Onuki32757292017-02-22 14:36:59 -08004281 * Same as {@link #queryContentProviders}, except when {@code metaDataKey} is not null,
4282 * it only returns providers which have metadata with the {@code metaDataKey} key.
4283 *
4284 * <p>DO NOT USE the {@code metaDataKey} parameter, unless you're the contacts provider.
4285 * You really shouldn't need it. Other apps should use {@link #queryIntentContentProviders}
4286 * instead.
4287 *
4288 * <p>The {@code metaDataKey} parameter was added to allow the contacts provider to quickly
4289 * scan the GAL providers on the device. Unfortunately the discovery protocol used metadata
4290 * to mark GAL providers, rather than intent filters, so we can't use
4291 * {@link #queryIntentContentProviders} for that.
4292 *
4293 * @hide
4294 */
4295 public List<ProviderInfo> queryContentProviders(
4296 String processName, int uid, @ComponentInfoFlags int flags, String metaDataKey) {
4297 // Provide the default implementation for mocks.
4298 return queryContentProviders(processName, uid, flags);
4299 }
4300
4301 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004302 * Retrieve all of the information we know about a particular
4303 * instrumentation class.
4304 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004305 * @param className The full name (i.e.
Jeff Sharkey4347f812017-04-21 12:08:39 -06004306 * com.google.apps.contacts.InstrumentList) of an Instrumentation
4307 * class.
4308 * @param flags Additional option flags to modify the data returned.
4309 * @return An {@link InstrumentationInfo} object containing information
4310 * about the instrumentation.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004311 * @throws NameNotFoundException if a package with the given name cannot be
4312 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004313 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004314 public abstract InstrumentationInfo getInstrumentationInfo(ComponentName className,
4315 @InstrumentationInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004316
4317 /**
Jeff Sharkey4347f812017-04-21 12:08:39 -06004318 * Retrieve information about available instrumentation code. May be used to
4319 * retrieve either all instrumentation code, or only the code targeting a
4320 * particular package.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004321 *
4322 * @param targetPackage If null, all instrumentation is returned; only the
Jeff Sharkey4347f812017-04-21 12:08:39 -06004323 * instrumentation targeting this package name is returned.
4324 * @param flags Additional option flags to modify the data returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004325 * @return A list of {@link InstrumentationInfo} objects containing one
4326 * entry for each matching instrumentation. If there are no
Jesse Hallf77a34f2016-02-04 18:41:33 -08004327 * instrumentation available, returns an empty list.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004328 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004329 public abstract List<InstrumentationInfo> queryInstrumentation(String targetPackage,
4330 @InstrumentationInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004331
4332 /**
4333 * Retrieve an image from a package. This is a low-level API used by
4334 * the various package manager info structures (such as
4335 * {@link ComponentInfo} to implement retrieval of their associated
4336 * icon.
4337 *
4338 * @param packageName The name of the package that this icon is coming from.
kmccormick30498b42013-03-27 17:39:17 -07004339 * Cannot be null.
4340 * @param resid The resource identifier of the desired image. Cannot be 0.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004341 * @param appInfo Overall information about <var>packageName</var>. This
4342 * may be null, in which case the application information will be retrieved
4343 * for you if needed; if you already have this information around, it can
4344 * be much more efficient to supply it here.
4345 *
4346 * @return Returns a Drawable holding the requested image. Returns null if
4347 * an image could not be found for any reason.
4348 */
Tor Norbye7b9c9122013-05-30 16:48:33 -07004349 public abstract Drawable getDrawable(String packageName, @DrawableRes int resid,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004350 ApplicationInfo appInfo);
4351
4352 /**
4353 * Retrieve the icon associated with an activity. Given the full name of
4354 * an activity, retrieves the information about it and calls
4355 * {@link ComponentInfo#loadIcon ComponentInfo.loadIcon()} to return its icon.
kmccormick30498b42013-03-27 17:39:17 -07004356 * If the activity cannot be found, NameNotFoundException is thrown.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004357 *
4358 * @param activityName Name of the activity whose icon is to be retrieved.
4359 *
4360 * @return Returns the image of the icon, or the default activity icon if
4361 * it could not be found. Does not return null.
4362 * @throws NameNotFoundException Thrown if the resources for the given
4363 * activity could not be loaded.
4364 *
4365 * @see #getActivityIcon(Intent)
4366 */
4367 public abstract Drawable getActivityIcon(ComponentName activityName)
4368 throws NameNotFoundException;
4369
4370 /**
4371 * Retrieve the icon associated with an Intent. If intent.getClassName() is
4372 * set, this simply returns the result of
4373 * getActivityIcon(intent.getClassName()). Otherwise it resolves the intent's
4374 * component and returns the icon associated with the resolved component.
kmccormick30498b42013-03-27 17:39:17 -07004375 * If intent.getClassName() cannot be found or the Intent cannot be resolved
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004376 * to a component, NameNotFoundException is thrown.
4377 *
4378 * @param intent The intent for which you would like to retrieve an icon.
4379 *
4380 * @return Returns the image of the icon, or the default activity icon if
4381 * it could not be found. Does not return null.
4382 * @throws NameNotFoundException Thrown if the resources for application
4383 * matching the given intent could not be loaded.
4384 *
4385 * @see #getActivityIcon(ComponentName)
4386 */
4387 public abstract Drawable getActivityIcon(Intent intent)
4388 throws NameNotFoundException;
4389
4390 /**
Jose Limaf78e3122014-03-06 12:13:15 -08004391 * Retrieve the banner associated with an activity. Given the full name of
4392 * an activity, retrieves the information about it and calls
4393 * {@link ComponentInfo#loadIcon ComponentInfo.loadIcon()} to return its
4394 * banner. If the activity cannot be found, NameNotFoundException is thrown.
4395 *
4396 * @param activityName Name of the activity whose banner is to be retrieved.
4397 * @return Returns the image of the banner, or null if the activity has no
4398 * banner specified.
4399 * @throws NameNotFoundException Thrown if the resources for the given
4400 * activity could not be loaded.
4401 * @see #getActivityBanner(Intent)
4402 */
4403 public abstract Drawable getActivityBanner(ComponentName activityName)
4404 throws NameNotFoundException;
4405
4406 /**
4407 * Retrieve the banner associated with an Intent. If intent.getClassName()
4408 * is set, this simply returns the result of
4409 * getActivityBanner(intent.getClassName()). Otherwise it resolves the
4410 * intent's component and returns the banner associated with the resolved
4411 * component. If intent.getClassName() cannot be found or the Intent cannot
4412 * be resolved to a component, NameNotFoundException is thrown.
4413 *
4414 * @param intent The intent for which you would like to retrieve a banner.
4415 * @return Returns the image of the banner, or null if the activity has no
4416 * banner specified.
4417 * @throws NameNotFoundException Thrown if the resources for application
4418 * matching the given intent could not be loaded.
4419 * @see #getActivityBanner(ComponentName)
4420 */
4421 public abstract Drawable getActivityBanner(Intent intent)
4422 throws NameNotFoundException;
4423
4424 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004425 * Return the generic icon for an activity that is used when no specific
4426 * icon is defined.
Adam Connors23cc04e2014-04-01 12:12:20 +01004427 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004428 * @return Drawable Image of the icon.
4429 */
4430 public abstract Drawable getDefaultActivityIcon();
4431
4432 /**
4433 * Retrieve the icon associated with an application. If it has not defined
4434 * an icon, the default app icon is returned. Does not return null.
4435 *
4436 * @param info Information about application being queried.
4437 *
4438 * @return Returns the image of the icon, or the default application icon
4439 * if it could not be found.
4440 *
4441 * @see #getApplicationIcon(String)
4442 */
4443 public abstract Drawable getApplicationIcon(ApplicationInfo info);
4444
4445 /**
4446 * Retrieve the icon associated with an application. Given the name of the
4447 * application's package, retrieves the information about it and calls
kmccormick30498b42013-03-27 17:39:17 -07004448 * getApplicationIcon() to return its icon. If the application cannot be
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004449 * found, NameNotFoundException is thrown.
4450 *
4451 * @param packageName Name of the package whose application icon is to be
4452 * retrieved.
4453 *
4454 * @return Returns the image of the icon, or the default application icon
4455 * if it could not be found. Does not return null.
4456 * @throws NameNotFoundException Thrown if the resources for the given
4457 * application could not be loaded.
4458 *
4459 * @see #getApplicationIcon(ApplicationInfo)
4460 */
4461 public abstract Drawable getApplicationIcon(String packageName)
4462 throws NameNotFoundException;
4463
4464 /**
Jose Limaf78e3122014-03-06 12:13:15 -08004465 * Retrieve the banner associated with an application.
4466 *
4467 * @param info Information about application being queried.
4468 * @return Returns the image of the banner or null if the application has no
4469 * banner specified.
4470 * @see #getApplicationBanner(String)
4471 */
4472 public abstract Drawable getApplicationBanner(ApplicationInfo info);
4473
4474 /**
4475 * Retrieve the banner associated with an application. Given the name of the
4476 * application's package, retrieves the information about it and calls
4477 * getApplicationIcon() to return its banner. If the application cannot be
4478 * found, NameNotFoundException is thrown.
4479 *
4480 * @param packageName Name of the package whose application banner is to be
4481 * retrieved.
4482 * @return Returns the image of the banner or null if the application has no
4483 * banner specified.
4484 * @throws NameNotFoundException Thrown if the resources for the given
4485 * application could not be loaded.
4486 * @see #getApplicationBanner(ApplicationInfo)
4487 */
4488 public abstract Drawable getApplicationBanner(String packageName)
4489 throws NameNotFoundException;
4490
4491 /**
4492 * Retrieve the logo associated with an activity. Given the full name of an
4493 * activity, retrieves the information about it and calls
4494 * {@link ComponentInfo#loadLogo ComponentInfo.loadLogo()} to return its
4495 * logo. If the activity cannot be found, NameNotFoundException is thrown.
Adam Powell81cd2e92010-04-21 16:35:18 -07004496 *
4497 * @param activityName Name of the activity whose logo is to be retrieved.
Jose Limaf78e3122014-03-06 12:13:15 -08004498 * @return Returns the image of the logo or null if the activity has no logo
4499 * specified.
Adam Powell81cd2e92010-04-21 16:35:18 -07004500 * @throws NameNotFoundException Thrown if the resources for the given
Jose Limaf78e3122014-03-06 12:13:15 -08004501 * activity could not be loaded.
Adam Powell81cd2e92010-04-21 16:35:18 -07004502 * @see #getActivityLogo(Intent)
4503 */
4504 public abstract Drawable getActivityLogo(ComponentName activityName)
4505 throws NameNotFoundException;
4506
4507 /**
4508 * Retrieve the logo associated with an Intent. If intent.getClassName() is
4509 * set, this simply returns the result of
4510 * getActivityLogo(intent.getClassName()). Otherwise it resolves the intent's
4511 * component and returns the logo associated with the resolved component.
kmccormick30498b42013-03-27 17:39:17 -07004512 * If intent.getClassName() cannot be found or the Intent cannot be resolved
Adam Powell81cd2e92010-04-21 16:35:18 -07004513 * to a component, NameNotFoundException is thrown.
4514 *
4515 * @param intent The intent for which you would like to retrieve a logo.
4516 *
4517 * @return Returns the image of the logo, or null if the activity has no
4518 * logo specified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004519 *
Adam Powell81cd2e92010-04-21 16:35:18 -07004520 * @throws NameNotFoundException Thrown if the resources for application
4521 * matching the given intent could not be loaded.
4522 *
4523 * @see #getActivityLogo(ComponentName)
4524 */
4525 public abstract Drawable getActivityLogo(Intent intent)
4526 throws NameNotFoundException;
4527
4528 /**
4529 * Retrieve the logo associated with an application. If it has not specified
4530 * a logo, this method returns null.
4531 *
4532 * @param info Information about application being queried.
4533 *
4534 * @return Returns the image of the logo, or null if no logo is specified
4535 * by the application.
4536 *
4537 * @see #getApplicationLogo(String)
4538 */
4539 public abstract Drawable getApplicationLogo(ApplicationInfo info);
4540
4541 /**
4542 * Retrieve the logo associated with an application. Given the name of the
4543 * application's package, retrieves the information about it and calls
kmccormick30498b42013-03-27 17:39:17 -07004544 * getApplicationLogo() to return its logo. If the application cannot be
Adam Powell81cd2e92010-04-21 16:35:18 -07004545 * found, NameNotFoundException is thrown.
4546 *
4547 * @param packageName Name of the package whose application logo is to be
4548 * retrieved.
4549 *
4550 * @return Returns the image of the logo, or null if no application logo
4551 * has been specified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004552 *
Adam Powell81cd2e92010-04-21 16:35:18 -07004553 * @throws NameNotFoundException Thrown if the resources for the given
4554 * application could not be loaded.
4555 *
4556 * @see #getApplicationLogo(ApplicationInfo)
4557 */
4558 public abstract Drawable getApplicationLogo(String packageName)
4559 throws NameNotFoundException;
4560
4561 /**
Tony Mak4dc008c2016-03-16 10:46:49 +00004562 * If the target user is a managed profile, then this returns a badged copy of the given icon
4563 * to be able to distinguish it from the original icon. For badging an arbitrary drawable use
Kenny Guydf77d712015-05-29 17:02:22 +01004564 * {@link #getUserBadgedDrawableForDensity(
Svetoslavc7d62f02014-09-04 15:39:54 -07004565 * android.graphics.drawable.Drawable, UserHandle, android.graphics.Rect, int)}.
4566 * <p>
4567 * If the original drawable is a BitmapDrawable and the backing bitmap is
4568 * mutable as per {@link android.graphics.Bitmap#isMutable()}, the badging
4569 * is performed in place and the original drawable is returned.
4570 * </p>
4571 *
4572 * @param icon The icon to badge.
4573 * @param user The target user.
4574 * @return A drawable that combines the original icon and a badge as
4575 * determined by the system.
4576 */
4577 public abstract Drawable getUserBadgedIcon(Drawable icon, UserHandle user);
4578
4579 /**
4580 * If the target user is a managed profile of the calling user or the caller
4581 * is itself a managed profile, then this returns a badged copy of the given
4582 * drawable allowing the user to distinguish it from the original drawable.
4583 * The caller can specify the location in the bounds of the drawable to be
4584 * badged where the badge should be applied as well as the density of the
4585 * badge to be used.
4586 * <p>
4587 * If the original drawable is a BitmapDrawable and the backing bitmap is
Vadim Tryshev66ae66a2016-02-18 15:41:21 -08004588 * mutable as per {@link android.graphics.Bitmap#isMutable()}, the badging
Svetoslavc7d62f02014-09-04 15:39:54 -07004589 * is performed in place and the original drawable is returned.
4590 * </p>
4591 *
4592 * @param drawable The drawable to badge.
4593 * @param user The target user.
4594 * @param badgeLocation Where in the bounds of the badged drawable to place
Vadim Tryshev66ae66a2016-02-18 15:41:21 -08004595 * the badge. If it's {@code null}, the badge is applied on top of the entire
Svetoslavc7d62f02014-09-04 15:39:54 -07004596 * drawable being badged.
4597 * @param badgeDensity The optional desired density for the badge as per
Vadim Tryshev66ae66a2016-02-18 15:41:21 -08004598 * {@link android.util.DisplayMetrics#densityDpi}. If it's not positive,
Svetoslavc7d62f02014-09-04 15:39:54 -07004599 * the density of the display is used.
4600 * @return A drawable that combines the original drawable and a badge as
4601 * determined by the system.
4602 */
4603 public abstract Drawable getUserBadgedDrawableForDensity(Drawable drawable,
4604 UserHandle user, Rect badgeLocation, int badgeDensity);
4605
4606 /**
4607 * If the target user is a managed profile of the calling user or the caller
4608 * is itself a managed profile, then this returns a drawable to use as a small
4609 * icon to include in a view to distinguish it from the original icon.
4610 *
4611 * @param user The target user.
4612 * @param density The optional desired density for the badge as per
4613 * {@link android.util.DisplayMetrics#densityDpi}. If not provided
4614 * the density of the current display is used.
4615 * @return the drawable or null if no drawable is required.
4616 * @hide
4617 */
4618 public abstract Drawable getUserBadgeForDensity(UserHandle user, int density);
4619
4620 /**
4621 * If the target user is a managed profile of the calling user or the caller
Selim Cineke6ff9462016-01-15 15:07:06 -08004622 * is itself a managed profile, then this returns a drawable to use as a small
4623 * icon to include in a view to distinguish it from the original icon. This version
4624 * doesn't have background protection and should be used over a light background instead of
4625 * a badge.
4626 *
4627 * @param user The target user.
4628 * @param density The optional desired density for the badge as per
4629 * {@link android.util.DisplayMetrics#densityDpi}. If not provided
4630 * the density of the current display is used.
4631 * @return the drawable or null if no drawable is required.
4632 * @hide
4633 */
4634 public abstract Drawable getUserBadgeForDensityNoBackground(UserHandle user, int density);
4635
4636 /**
4637 * If the target user is a managed profile of the calling user or the caller
Svetoslavc7d62f02014-09-04 15:39:54 -07004638 * is itself a managed profile, then this returns a copy of the label with
4639 * badging for accessibility services like talkback. E.g. passing in "Email"
4640 * and it might return "Work Email" for Email in the work profile.
4641 *
4642 * @param label The label to change.
4643 * @param user The target user.
4644 * @return A label that combines the original label and a badge as
4645 * determined by the system.
4646 */
4647 public abstract CharSequence getUserBadgedLabel(CharSequence label, UserHandle user);
4648
4649 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004650 * Retrieve text from a package. This is a low-level API used by
4651 * the various package manager info structures (such as
4652 * {@link ComponentInfo} to implement retrieval of their associated
4653 * labels and other text.
4654 *
4655 * @param packageName The name of the package that this text is coming from.
kmccormick30498b42013-03-27 17:39:17 -07004656 * Cannot be null.
4657 * @param resid The resource identifier of the desired text. Cannot be 0.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004658 * @param appInfo Overall information about <var>packageName</var>. This
4659 * may be null, in which case the application information will be retrieved
4660 * for you if needed; if you already have this information around, it can
4661 * be much more efficient to supply it here.
4662 *
4663 * @return Returns a CharSequence holding the requested text. Returns null
4664 * if the text could not be found for any reason.
4665 */
Tor Norbye7b9c9122013-05-30 16:48:33 -07004666 public abstract CharSequence getText(String packageName, @StringRes int resid,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004667 ApplicationInfo appInfo);
4668
4669 /**
4670 * Retrieve an XML file from a package. This is a low-level API used to
4671 * retrieve XML meta data.
4672 *
4673 * @param packageName The name of the package that this xml is coming from.
kmccormick30498b42013-03-27 17:39:17 -07004674 * Cannot be null.
4675 * @param resid The resource identifier of the desired xml. Cannot be 0.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004676 * @param appInfo Overall information about <var>packageName</var>. This
4677 * may be null, in which case the application information will be retrieved
4678 * for you if needed; if you already have this information around, it can
4679 * be much more efficient to supply it here.
4680 *
4681 * @return Returns an XmlPullParser allowing you to parse out the XML
4682 * data. Returns null if the xml resource could not be found for any
4683 * reason.
4684 */
Tor Norbye7b9c9122013-05-30 16:48:33 -07004685 public abstract XmlResourceParser getXml(String packageName, @XmlRes int resid,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004686 ApplicationInfo appInfo);
4687
4688 /**
4689 * Return the label to use for this application.
4690 *
4691 * @return Returns the label associated with this application, or null if
4692 * it could not be found for any reason.
kmccormick30498b42013-03-27 17:39:17 -07004693 * @param info The application to get the label of.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004694 */
4695 public abstract CharSequence getApplicationLabel(ApplicationInfo info);
4696
4697 /**
4698 * Retrieve the resources associated with an activity. Given the full
4699 * name of an activity, retrieves the information about it and calls
4700 * getResources() to return its application's resources. If the activity
kmccormick30498b42013-03-27 17:39:17 -07004701 * cannot be found, NameNotFoundException is thrown.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004702 *
4703 * @param activityName Name of the activity whose resources are to be
4704 * retrieved.
4705 *
4706 * @return Returns the application's Resources.
4707 * @throws NameNotFoundException Thrown if the resources for the given
4708 * application could not be loaded.
4709 *
4710 * @see #getResourcesForApplication(ApplicationInfo)
4711 */
4712 public abstract Resources getResourcesForActivity(ComponentName activityName)
4713 throws NameNotFoundException;
4714
4715 /**
4716 * Retrieve the resources for an application. Throws NameNotFoundException
4717 * if the package is no longer installed.
4718 *
4719 * @param app Information about the desired application.
4720 *
4721 * @return Returns the application's Resources.
4722 * @throws NameNotFoundException Thrown if the resources for the given
4723 * application could not be loaded (most likely because it was uninstalled).
4724 */
4725 public abstract Resources getResourcesForApplication(ApplicationInfo app)
4726 throws NameNotFoundException;
4727
4728 /**
4729 * Retrieve the resources associated with an application. Given the full
4730 * package name of an application, retrieves the information about it and
4731 * calls getResources() to return its application's resources. If the
kmccormick30498b42013-03-27 17:39:17 -07004732 * appPackageName cannot be found, NameNotFoundException is thrown.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004733 *
4734 * @param appPackageName Package name of the application whose resources
4735 * are to be retrieved.
4736 *
4737 * @return Returns the application's Resources.
4738 * @throws NameNotFoundException Thrown if the resources for the given
4739 * application could not be loaded.
4740 *
4741 * @see #getResourcesForApplication(ApplicationInfo)
4742 */
4743 public abstract Resources getResourcesForApplication(String appPackageName)
4744 throws NameNotFoundException;
4745
Amith Yamasani98edc952012-09-25 14:09:27 -07004746 /** @hide */
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004747 public abstract Resources getResourcesForApplicationAsUser(String appPackageName,
4748 @UserIdInt int userId) throws NameNotFoundException;
Amith Yamasani98edc952012-09-25 14:09:27 -07004749
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004750 /**
Jeff Sharkey4347f812017-04-21 12:08:39 -06004751 * Retrieve overall information about an application package defined in a
4752 * package archive file
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004753 *
4754 * @param archiveFilePath The path to the archive file
Jeff Sharkey4347f812017-04-21 12:08:39 -06004755 * @param flags Additional option flags to modify the data returned.
4756 * @return A PackageInfo object containing information about the package
4757 * archive. If the package could not be parsed, returns null.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004758 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004759 public PackageInfo getPackageArchiveInfo(String archiveFilePath, @PackageInfoFlags int flags) {
Jeff Sharkey275e0852014-06-17 18:18:49 -07004760 final PackageParser parser = new PackageParser();
Dianne Hackborncd154e92017-02-28 17:37:35 -08004761 parser.setCallback(new PackageParser.CallbackImpl(this));
Jeff Sharkey275e0852014-06-17 18:18:49 -07004762 final File apkFile = new File(archiveFilePath);
Jeff Sharkeyc4858a22014-06-16 10:51:20 -07004763 try {
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004764 if ((flags & (MATCH_DIRECT_BOOT_UNAWARE | MATCH_DIRECT_BOOT_AWARE)) != 0) {
Jeff Sharkeyc3132512016-01-12 14:06:58 -07004765 // Caller expressed an explicit opinion about what encryption
4766 // aware/unaware components they want to see, so fall through and
4767 // give them what they want
4768 } else {
4769 // Caller expressed no opinion, so match everything
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004770 flags |= MATCH_DIRECT_BOOT_AWARE | MATCH_DIRECT_BOOT_UNAWARE;
Jeff Sharkeyc3132512016-01-12 14:06:58 -07004771 }
4772
Jeff Sharkey275e0852014-06-17 18:18:49 -07004773 PackageParser.Package pkg = parser.parseMonolithicPackage(apkFile, 0);
Jeff Sharkeyc4858a22014-06-16 10:51:20 -07004774 if ((flags & GET_SIGNATURES) != 0) {
Victor Hsieh5f761242018-01-20 10:30:12 -08004775 PackageParser.collectCertificates(pkg, false /* skipVerify */);
Jeff Sharkeyc4858a22014-06-16 10:51:20 -07004776 }
4777 PackageUserState state = new PackageUserState();
4778 return PackageParser.generatePackageInfo(pkg, null, flags, 0, 0, null, state);
4779 } catch (PackageParserException e) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004780 return null;
4781 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004782 }
4783
4784 /**
Dianne Hackborn7767eac2012-08-23 18:25:40 -07004785 * If there is already an application with the given package name installed
4786 * on the system for other users, also install it for the calling user.
4787 * @hide
4788 */
Sunny Goyal07f41fb2017-08-09 02:56:34 -07004789 @SystemApi
Nicolas Prevot9a80e532015-09-23 15:49:28 +01004790 public abstract int installExistingPackage(String packageName) throws NameNotFoundException;
4791
4792 /**
4793 * If there is already an application with the given package name installed
Sunny Goyala31a74b2017-05-11 15:59:19 -07004794 * on the system for other users, also install it for the calling user.
4795 * @hide
4796 */
Sunny Goyal07f41fb2017-08-09 02:56:34 -07004797 @SystemApi
Sunny Goyala31a74b2017-05-11 15:59:19 -07004798 public abstract int installExistingPackage(String packageName, @InstallReason int installReason)
4799 throws NameNotFoundException;
4800
4801 /**
4802 * If there is already an application with the given package name installed
Nicolas Prevot9a80e532015-09-23 15:49:28 +01004803 * on the system for other users, also install it for the specified user.
4804 * @hide
4805 */
4806 @RequiresPermission(anyOf = {
4807 Manifest.permission.INSTALL_PACKAGES,
4808 Manifest.permission.INTERACT_ACROSS_USERS_FULL})
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004809 public abstract int installExistingPackageAsUser(String packageName, @UserIdInt int userId)
Dianne Hackborn7767eac2012-08-23 18:25:40 -07004810 throws NameNotFoundException;
4811
4812 /**
Kenny Root5ab21572011-07-27 11:11:19 -07004813 * Allows a package listening to the
4814 * {@link Intent#ACTION_PACKAGE_NEEDS_VERIFICATION package verification
Kenny Root3a9b5fb2011-09-20 14:15:38 -07004815 * broadcast} to respond to the package manager. The response must include
4816 * the {@code verificationCode} which is one of
4817 * {@link PackageManager#VERIFICATION_ALLOW} or
4818 * {@link PackageManager#VERIFICATION_REJECT}.
Kenny Root5ab21572011-07-27 11:11:19 -07004819 *
4820 * @param id pending package identifier as passed via the
kmccormick30498b42013-03-27 17:39:17 -07004821 * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra.
Kenny Root3a9b5fb2011-09-20 14:15:38 -07004822 * @param verificationCode either {@link PackageManager#VERIFICATION_ALLOW}
4823 * or {@link PackageManager#VERIFICATION_REJECT}.
rich cannings7e671512012-08-27 14:44:16 -07004824 * @throws SecurityException if the caller does not have the
Dianne Hackborn8832c182012-09-17 17:20:24 -07004825 * PACKAGE_VERIFICATION_AGENT permission.
Kenny Root5ab21572011-07-27 11:11:19 -07004826 */
Kenny Root3a9b5fb2011-09-20 14:15:38 -07004827 public abstract void verifyPendingInstall(int id, int verificationCode);
Kenny Root5ab21572011-07-27 11:11:19 -07004828
4829 /**
rich canningsd9ef3e52012-08-22 14:28:05 -07004830 * Allows a package listening to the
4831 * {@link Intent#ACTION_PACKAGE_NEEDS_VERIFICATION package verification
4832 * broadcast} to extend the default timeout for a response and declare what
4833 * action to perform after the timeout occurs. The response must include
4834 * the {@code verificationCodeAtTimeout} which is one of
4835 * {@link PackageManager#VERIFICATION_ALLOW} or
4836 * {@link PackageManager#VERIFICATION_REJECT}.
4837 *
4838 * This method may only be called once per package id. Additional calls
4839 * will have no effect.
4840 *
4841 * @param id pending package identifier as passed via the
kmccormick30498b42013-03-27 17:39:17 -07004842 * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra.
rich canningsd9ef3e52012-08-22 14:28:05 -07004843 * @param verificationCodeAtTimeout either
4844 * {@link PackageManager#VERIFICATION_ALLOW} or
rich canningsd1b5cfc2012-08-29 14:49:51 -07004845 * {@link PackageManager#VERIFICATION_REJECT}. If
4846 * {@code verificationCodeAtTimeout} is neither
4847 * {@link PackageManager#VERIFICATION_ALLOW} or
4848 * {@link PackageManager#VERIFICATION_REJECT}, then
4849 * {@code verificationCodeAtTimeout} will default to
rich canningsd9ef3e52012-08-22 14:28:05 -07004850 * {@link PackageManager#VERIFICATION_REJECT}.
4851 * @param millisecondsToDelay the amount of time requested for the timeout.
4852 * Must be positive and less than
rich canningsd1b5cfc2012-08-29 14:49:51 -07004853 * {@link PackageManager#MAXIMUM_VERIFICATION_TIMEOUT}. If
4854 * {@code millisecondsToDelay} is out of bounds,
4855 * {@code millisecondsToDelay} will be set to the closest in
4856 * bounds value; namely, 0 or
rich canningsd9ef3e52012-08-22 14:28:05 -07004857 * {@link PackageManager#MAXIMUM_VERIFICATION_TIMEOUT}.
rich cannings7e671512012-08-27 14:44:16 -07004858 * @throws SecurityException if the caller does not have the
Dianne Hackborn8832c182012-09-17 17:20:24 -07004859 * PACKAGE_VERIFICATION_AGENT permission.
rich canningsd9ef3e52012-08-22 14:28:05 -07004860 */
4861 public abstract void extendVerificationTimeout(int id,
4862 int verificationCodeAtTimeout, long millisecondsToDelay);
4863
4864 /**
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004865 * Allows a package listening to the
Todd Kennedydfa93ab2016-03-03 15:24:33 -08004866 * {@link Intent#ACTION_INTENT_FILTER_NEEDS_VERIFICATION} intent filter verification
4867 * broadcast to respond to the package manager. The response must include
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004868 * the {@code verificationCode} which is one of
4869 * {@link PackageManager#INTENT_FILTER_VERIFICATION_SUCCESS} or
4870 * {@link PackageManager#INTENT_FILTER_VERIFICATION_FAILURE}.
4871 *
4872 * @param verificationId pending package identifier as passed via the
4873 * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra.
4874 * @param verificationCode either {@link PackageManager#INTENT_FILTER_VERIFICATION_SUCCESS}
4875 * or {@link PackageManager#INTENT_FILTER_VERIFICATION_FAILURE}.
Todd Kennedydfa93ab2016-03-03 15:24:33 -08004876 * @param failedDomains a list of failed domains if the verificationCode is
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004877 * {@link PackageManager#INTENT_FILTER_VERIFICATION_FAILURE}, otherwise null;
4878 * @throws SecurityException if the caller does not have the
4879 * INTENT_FILTER_VERIFICATION_AGENT permission.
4880 *
4881 * @hide
4882 */
Fabrice Di Meglioef741da2015-05-12 16:31:38 -07004883 @SystemApi
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06004884 @RequiresPermission(android.Manifest.permission.INTENT_FILTER_VERIFICATION_AGENT)
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004885 public abstract void verifyIntentFilter(int verificationId, int verificationCode,
Todd Kennedydfa93ab2016-03-03 15:24:33 -08004886 List<String> failedDomains);
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004887
4888 /**
4889 * Get the status of a Domain Verification Result for an IntentFilter. This is
4890 * related to the {@link android.content.IntentFilter#setAutoVerify(boolean)} and
4891 * {@link android.content.IntentFilter#getAutoVerify()}
4892 *
4893 * This is used by the ResolverActivity to change the status depending on what the User select
4894 * in the Disambiguation Dialog and also used by the Settings App for changing the default App
4895 * for a domain.
4896 *
4897 * @param packageName The package name of the Activity associated with the IntentFilter.
4898 * @param userId The user id.
4899 *
4900 * @return The status to set to. This can be
4901 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK} or
4902 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS} or
4903 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER} or
4904 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED}
4905 *
4906 * @hide
4907 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08004908 @SystemApi
Todd Kennedydbaef6d2017-07-24 11:28:00 -07004909 @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS_FULL)
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004910 public abstract int getIntentVerificationStatusAsUser(String packageName, @UserIdInt int userId);
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004911
4912 /**
4913 * Allow to change the status of a Intent Verification status for all IntentFilter of an App.
4914 * This is related to the {@link android.content.IntentFilter#setAutoVerify(boolean)} and
4915 * {@link android.content.IntentFilter#getAutoVerify()}
4916 *
4917 * This is used by the ResolverActivity to change the status depending on what the User select
4918 * in the Disambiguation Dialog and also used by the Settings App for changing the default App
4919 * for a domain.
4920 *
4921 * @param packageName The package name of the Activity associated with the IntentFilter.
4922 * @param status The status to set to. This can be
4923 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK} or
4924 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS} or
4925 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER}
4926 * @param userId The user id.
4927 *
4928 * @return true if the status has been set. False otherwise.
4929 *
4930 * @hide
4931 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08004932 @SystemApi
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06004933 @RequiresPermission(android.Manifest.permission.SET_PREFERRED_APPLICATIONS)
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07004934 public abstract boolean updateIntentVerificationStatusAsUser(String packageName, int status,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004935 @UserIdInt int userId);
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004936
4937 /**
4938 * Get the list of IntentFilterVerificationInfo for a specific package and User.
4939 *
4940 * @param packageName the package name. When this parameter is set to a non null value,
4941 * the results will be filtered by the package name provided.
4942 * Otherwise, there will be no filtering and it will return a list
Fabrice Di Meglio07885952015-04-06 19:41:28 -07004943 * corresponding for all packages
4944 *
4945 * @return a list of IntentFilterVerificationInfo for a specific package.
4946 *
4947 * @hide
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004948 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08004949 @SystemApi
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004950 public abstract List<IntentFilterVerificationInfo> getIntentFilterVerifications(
4951 String packageName);
4952
4953 /**
Fabrice Di Meglio07885952015-04-06 19:41:28 -07004954 * Get the list of IntentFilter for a specific package.
4955 *
4956 * @param packageName the package name. This parameter is set to a non null value,
4957 * the list will contain all the IntentFilter for that package.
4958 * Otherwise, the list will be empty.
4959 *
4960 * @return a list of IntentFilter for a specific package.
4961 *
4962 * @hide
4963 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08004964 @SystemApi
Fabrice Di Meglio07885952015-04-06 19:41:28 -07004965 public abstract List<IntentFilter> getAllIntentFilters(String packageName);
4966
4967 /**
Fabrice Di Meglio62271722015-04-10 17:24:02 -07004968 * Get the default Browser package name for a specific user.
4969 *
4970 * @param userId The user id.
4971 *
4972 * @return the package name of the default Browser for the specified user. If the user id passed
4973 * is -1 (all users) it will return a null value.
4974 *
4975 * @hide
4976 */
Jeff Sharkeya73b8fd2016-01-06 17:02:08 -07004977 @TestApi
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08004978 @SystemApi
Todd Kennedydbaef6d2017-07-24 11:28:00 -07004979 @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS_FULL)
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004980 public abstract String getDefaultBrowserPackageNameAsUser(@UserIdInt int userId);
Fabrice Di Meglio62271722015-04-10 17:24:02 -07004981
4982 /**
4983 * Set the default Browser package name for a specific user.
4984 *
4985 * @param packageName The package name of the default Browser.
4986 * @param userId The user id.
4987 *
4988 * @return true if the default Browser for the specified user has been set,
4989 * otherwise return false. If the user id passed is -1 (all users) this call will not
4990 * do anything and just return false.
4991 *
4992 * @hide
4993 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08004994 @SystemApi
Todd Kennedydbaef6d2017-07-24 11:28:00 -07004995 @RequiresPermission(allOf = {
4996 Manifest.permission.SET_PREFERRED_APPLICATIONS,
4997 Manifest.permission.INTERACT_ACROSS_USERS_FULL})
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004998 public abstract boolean setDefaultBrowserPackageNameAsUser(String packageName,
4999 @UserIdInt int userId);
Fabrice Di Meglio62271722015-04-10 17:24:02 -07005000
5001 /**
Dianne Hackborn880119b2010-11-18 22:26:40 -08005002 * Change the installer associated with a given package. There are limitations
5003 * on how the installer package can be changed; in particular:
5004 * <ul>
5005 * <li> A SecurityException will be thrown if <var>installerPackageName</var>
5006 * is not signed with the same certificate as the calling application.
5007 * <li> A SecurityException will be thrown if <var>targetPackage</var> already
5008 * has an installer package, and that installer package is not signed with
5009 * the same certificate as the calling application.
5010 * </ul>
5011 *
5012 * @param targetPackage The installed package whose installer will be changed.
5013 * @param installerPackageName The package name of the new installer. May be
5014 * null to clear the association.
5015 */
5016 public abstract void setInstallerPackageName(String targetPackage,
5017 String installerPackageName);
5018
Todd Kennedyab532892017-03-08 14:19:49 -08005019 /** @hide */
5020 @SystemApi
5021 @RequiresPermission(Manifest.permission.INSTALL_PACKAGES)
5022 public abstract void setUpdateAvailable(String packageName, boolean updateAvaialble);
5023
Dianne Hackborn880119b2010-11-18 22:26:40 -08005024 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005025 * Attempts to delete a package. Since this may take a little while, the
5026 * result will be posted back to the given observer. A deletion will fail if
5027 * the calling context lacks the
5028 * {@link android.Manifest.permission#DELETE_PACKAGES} permission, if the
5029 * named package cannot be found, or if the named package is a system
5030 * package.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005031 *
5032 * @param packageName The name of the package to delete
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005033 * @param observer An observer callback to get notified when the package
5034 * deletion is complete.
5035 * {@link android.content.pm.IPackageDeleteObserver#packageDeleted}
5036 * will be called when that happens. observer may be null to
5037 * indicate that no callback is desired.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005038 * @hide
5039 */
Svet Ganov67882122016-12-11 16:36:34 -08005040 @RequiresPermission(Manifest.permission.DELETE_PACKAGES)
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005041 public abstract void deletePackage(String packageName, IPackageDeleteObserver observer,
5042 @DeleteFlags int flags);
Jacek Surazski65e13172009-04-28 15:26:38 +02005043
5044 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005045 * Attempts to delete a package. Since this may take a little while, the
5046 * result will be posted back to the given observer. A deletion will fail if
5047 * the named package cannot be found, or if the named package is a system
5048 * package.
Nicolas Prevot9a80e532015-09-23 15:49:28 +01005049 *
5050 * @param packageName The name of the package to delete
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005051 * @param observer An observer callback to get notified when the package
5052 * deletion is complete.
5053 * {@link android.content.pm.IPackageDeleteObserver#packageDeleted}
5054 * will be called when that happens. observer may be null to
5055 * indicate that no callback is desired.
Nicolas Prevot9a80e532015-09-23 15:49:28 +01005056 * @param userId The user Id
Nicolas Prevot9a80e532015-09-23 15:49:28 +01005057 * @hide
5058 */
Svet Ganov67882122016-12-11 16:36:34 -08005059 @RequiresPermission(anyOf = {
Nicolas Prevot9a80e532015-09-23 15:49:28 +01005060 Manifest.permission.DELETE_PACKAGES,
5061 Manifest.permission.INTERACT_ACROSS_USERS_FULL})
Svet Ganov67882122016-12-11 16:36:34 -08005062 public abstract void deletePackageAsUser(@NonNull String packageName,
5063 IPackageDeleteObserver observer, @DeleteFlags int flags, @UserIdInt int userId);
Nicolas Prevot9a80e532015-09-23 15:49:28 +01005064
5065 /**
Jacek Surazski65e13172009-04-28 15:26:38 +02005066 * Retrieve the package name of the application that installed a package. This identifies
5067 * which market the package came from.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005068 *
Jacek Surazski65e13172009-04-28 15:26:38 +02005069 * @param packageName The name of the package to query
5070 */
5071 public abstract String getInstallerPackageName(String packageName);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005072
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005073 /**
5074 * Attempts to clear the user data directory of an application.
5075 * Since this may take a little while, the result will
5076 * be posted back to the given observer. A deletion will fail if the
5077 * named package cannot be found, or if the named package is a "system package".
5078 *
5079 * @param packageName The name of the package
5080 * @param observer An observer callback to get notified when the operation is finished
5081 * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)}
5082 * will be called when that happens. observer may be null to indicate that
5083 * no callback is desired.
5084 *
5085 * @hide
5086 */
5087 public abstract void clearApplicationUserData(String packageName,
5088 IPackageDataObserver observer);
5089 /**
5090 * Attempts to delete the cache files associated with an application.
5091 * Since this may take a little while, the result will
5092 * be posted back to the given observer. A deletion will fail if the calling context
5093 * lacks the {@link android.Manifest.permission#DELETE_CACHE_FILES} permission, if the
5094 * named package cannot be found, or if the named package is a "system package".
5095 *
5096 * @param packageName The name of the package to delete
5097 * @param observer An observer callback to get notified when the cache file deletion
5098 * is complete.
5099 * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)}
5100 * will be called when that happens. observer may be null to indicate that
5101 * no callback is desired.
5102 *
5103 * @hide
5104 */
5105 public abstract void deleteApplicationCacheFiles(String packageName,
5106 IPackageDataObserver observer);
5107
5108 /**
Suprabh Shukla78c9eb82016-04-12 15:51:35 -07005109 * Attempts to delete the cache files associated with an application for a given user. Since
5110 * this may take a little while, the result will be posted back to the given observer. A
5111 * deletion will fail if the calling context lacks the
5112 * {@link android.Manifest.permission#DELETE_CACHE_FILES} permission, if the named package
5113 * cannot be found, or if the named package is a "system package". If {@code userId} does not
5114 * belong to the calling user, the caller must have
5115 * {@link android.Manifest.permission#INTERACT_ACROSS_USERS} permission.
5116 *
5117 * @param packageName The name of the package to delete
5118 * @param userId the user for which the cache files needs to be deleted
5119 * @param observer An observer callback to get notified when the cache file deletion is
5120 * complete.
5121 * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)}
5122 * will be called when that happens. observer may be null to indicate that no
5123 * callback is desired.
5124 * @hide
5125 */
5126 public abstract void deleteApplicationCacheFilesAsUser(String packageName, int userId,
5127 IPackageDataObserver observer);
5128
5129 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005130 * Free storage by deleting LRU sorted list of cache files across
5131 * all applications. If the currently available free storage
5132 * on the device is greater than or equal to the requested
5133 * free storage, no cache files are cleared. If the currently
5134 * available storage on the device is less than the requested
5135 * free storage, some or all of the cache files across
5136 * all applications are deleted (based on last accessed time)
5137 * to increase the free storage space on the device to
5138 * the requested value. There is no guarantee that clearing all
5139 * the cache files from all applications will clear up
5140 * enough storage to achieve the desired value.
5141 * @param freeStorageSize The number of bytes of storage to be
5142 * freed by the system. Say if freeStorageSize is XX,
5143 * and the current free storage is YY,
5144 * if XX is less than YY, just return. if not free XX-YY number
5145 * of bytes if possible.
5146 * @param observer call back used to notify when
5147 * the operation is completed
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005148 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005149 * @hide
5150 */
Jeff Sharkey529f91f2015-04-18 20:23:13 -07005151 public void freeStorageAndNotify(long freeStorageSize, IPackageDataObserver observer) {
5152 freeStorageAndNotify(null, freeStorageSize, observer);
5153 }
5154
5155 /** {@hide} */
5156 public abstract void freeStorageAndNotify(String volumeUuid, long freeStorageSize,
5157 IPackageDataObserver observer);
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -07005158
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005159 /**
5160 * Free storage by deleting LRU sorted list of cache files across
5161 * all applications. If the currently available free storage
5162 * on the device is greater than or equal to the requested
5163 * free storage, no cache files are cleared. If the currently
5164 * available storage on the device is less than the requested
5165 * free storage, some or all of the cache files across
5166 * all applications are deleted (based on last accessed time)
5167 * to increase the free storage space on the device to
5168 * the requested value. There is no guarantee that clearing all
5169 * the cache files from all applications will clear up
5170 * enough storage to achieve the desired value.
5171 * @param freeStorageSize The number of bytes of storage to be
5172 * freed by the system. Say if freeStorageSize is XX,
5173 * and the current free storage is YY,
5174 * if XX is less than YY, just return. if not free XX-YY number
5175 * of bytes if possible.
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -07005176 * @param pi IntentSender call back used to
5177 * notify when the operation is completed.May be null
5178 * to indicate that no call back is desired.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005179 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005180 * @hide
5181 */
Jeff Sharkey529f91f2015-04-18 20:23:13 -07005182 public void freeStorage(long freeStorageSize, IntentSender pi) {
5183 freeStorage(null, freeStorageSize, pi);
5184 }
5185
5186 /** {@hide} */
5187 public abstract void freeStorage(String volumeUuid, long freeStorageSize, IntentSender pi);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005188
5189 /**
5190 * Retrieve the size information for a package.
5191 * Since this may take a little while, the result will
5192 * be posted back to the given observer. The calling context
5193 * should have the {@link android.Manifest.permission#GET_PACKAGE_SIZE} permission.
5194 *
5195 * @param packageName The name of the package whose size information is to be retrieved
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07005196 * @param userId The user whose size information should be retrieved.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005197 * @param observer An observer callback to get notified when the operation
5198 * is complete.
5199 * {@link android.content.pm.IPackageStatsObserver#onGetStatsCompleted(PackageStats, boolean)}
5200 * The observer's callback is invoked with a PackageStats object(containing the
5201 * code, data and cache sizes of the package) and a boolean value representing
5202 * the status of the operation. observer may be null to indicate that
5203 * no callback is desired.
5204 *
Jeff Sharkey60f95aa2017-03-08 13:57:15 -07005205 * @deprecated use {@link StorageStatsManager} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005206 * @hide
5207 */
Jeff Sharkey60f95aa2017-03-08 13:57:15 -07005208 @Deprecated
Jeff Sharkey8588bc12016-01-06 16:47:42 -07005209 public abstract void getPackageSizeInfoAsUser(String packageName, @UserIdInt int userId,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005210 IPackageStatsObserver observer);
5211
5212 /**
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07005213 * Like {@link #getPackageSizeInfoAsUser(String, int, IPackageStatsObserver)}, but
Dianne Hackborn0c380492012-08-20 17:23:30 -07005214 * returns the size for the calling user.
5215 *
Jeff Sharkey60f95aa2017-03-08 13:57:15 -07005216 * @deprecated use {@link StorageStatsManager} instead.
Dianne Hackborn0c380492012-08-20 17:23:30 -07005217 * @hide
5218 */
Jeff Sharkey60f95aa2017-03-08 13:57:15 -07005219 @Deprecated
Dianne Hackborn0c380492012-08-20 17:23:30 -07005220 public void getPackageSizeInfo(String packageName, IPackageStatsObserver observer) {
Jeff Sharkeyad357d12018-02-02 13:25:31 -07005221 getPackageSizeInfoAsUser(packageName, getUserId(), observer);
Dianne Hackborn0c380492012-08-20 17:23:30 -07005222 }
5223
5224 /**
Dianne Hackborna7ca0e52009-12-01 14:31:55 -08005225 * @deprecated This function no longer does anything; it was an old
kmccormickac66b852013-03-28 15:17:15 -07005226 * approach to managing preferred activities, which has been superseded
5227 * by (and conflicts with) the modern activity-based preferences.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005228 */
Dianne Hackborna7ca0e52009-12-01 14:31:55 -08005229 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005230 public abstract void addPackageToPreferred(String packageName);
5231
5232 /**
Dianne Hackborna7ca0e52009-12-01 14:31:55 -08005233 * @deprecated This function no longer does anything; it was an old
kmccormickac66b852013-03-28 15:17:15 -07005234 * approach to managing preferred activities, which has been superseded
5235 * by (and conflicts with) the modern activity-based preferences.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005236 */
Dianne Hackborna7ca0e52009-12-01 14:31:55 -08005237 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005238 public abstract void removePackageFromPreferred(String packageName);
5239
5240 /**
Jeff Sharkey4347f812017-04-21 12:08:39 -06005241 * Retrieve the list of all currently configured preferred packages. The
5242 * first package on the list is the most preferred, the last is the least
5243 * preferred.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005244 *
Jeff Sharkey4347f812017-04-21 12:08:39 -06005245 * @param flags Additional option flags to modify the data returned.
5246 * @return A List of PackageInfo objects, one for each preferred
5247 * application, in order of preference.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005248 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07005249 public abstract List<PackageInfo> getPreferredPackages(@PackageInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005250
5251 /**
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08005252 * @deprecated This is a protected API that should not have been available
5253 * to third party applications. It is the platform's responsibility for
kmccormick30498b42013-03-27 17:39:17 -07005254 * assigning preferred activities and this cannot be directly modified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005255 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005256 * Add a new preferred activity mapping to the system. This will be used
5257 * to automatically select the given activity component when
5258 * {@link Context#startActivity(Intent) Context.startActivity()} finds
5259 * multiple matching activities and also matches the given filter.
5260 *
5261 * @param filter The set of intents under which this activity will be
5262 * made preferred.
5263 * @param match The IntentFilter match category that this preference
5264 * applies to.
5265 * @param set The set of activities that the user was picking from when
5266 * this preference was made.
5267 * @param activity The component name of the activity that is to be
5268 * preferred.
5269 */
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08005270 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005271 public abstract void addPreferredActivity(IntentFilter filter, int match,
5272 ComponentName[] set, ComponentName activity);
5273
5274 /**
Amith Yamasania3f133a2012-08-09 17:11:28 -07005275 * Same as {@link #addPreferredActivity(IntentFilter, int,
5276 ComponentName[], ComponentName)}, but with a specific userId to apply the preference
5277 to.
5278 * @hide
5279 */
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07005280 public void addPreferredActivityAsUser(IntentFilter filter, int match,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07005281 ComponentName[] set, ComponentName activity, @UserIdInt int userId) {
Amith Yamasania3f133a2012-08-09 17:11:28 -07005282 throw new RuntimeException("Not implemented. Must override in a subclass.");
5283 }
5284
5285 /**
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08005286 * @deprecated This is a protected API that should not have been available
5287 * to third party applications. It is the platform's responsibility for
kmccormick30498b42013-03-27 17:39:17 -07005288 * assigning preferred activities and this cannot be directly modified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005289 *
Satish Sampath8dbe6122009-06-02 23:35:54 +01005290 * Replaces an existing preferred activity mapping to the system, and if that were not present
5291 * adds a new preferred activity. This will be used
5292 * to automatically select the given activity component when
5293 * {@link Context#startActivity(Intent) Context.startActivity()} finds
5294 * multiple matching activities and also matches the given filter.
5295 *
5296 * @param filter The set of intents under which this activity will be
5297 * made preferred.
5298 * @param match The IntentFilter match category that this preference
5299 * applies to.
5300 * @param set The set of activities that the user was picking from when
5301 * this preference was made.
5302 * @param activity The component name of the activity that is to be
5303 * preferred.
5304 * @hide
5305 */
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08005306 @Deprecated
Satish Sampath8dbe6122009-06-02 23:35:54 +01005307 public abstract void replacePreferredActivity(IntentFilter filter, int match,
5308 ComponentName[] set, ComponentName activity);
5309
5310 /**
Amith Yamasani41c1ded2014-08-05 11:15:05 -07005311 * @hide
5312 */
5313 @Deprecated
5314 public void replacePreferredActivityAsUser(IntentFilter filter, int match,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07005315 ComponentName[] set, ComponentName activity, @UserIdInt int userId) {
Amith Yamasani41c1ded2014-08-05 11:15:05 -07005316 throw new RuntimeException("Not implemented. Must override in a subclass.");
5317 }
5318
5319 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005320 * Remove all preferred activity mappings, previously added with
5321 * {@link #addPreferredActivity}, from the
5322 * system whose activities are implemented in the given package name.
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08005323 * An application can only clear its own package(s).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005324 *
5325 * @param packageName The name of the package whose preferred activity
5326 * mappings are to be removed.
5327 */
5328 public abstract void clearPackagePreferredActivities(String packageName);
5329
5330 /**
5331 * Retrieve all preferred activities, previously added with
5332 * {@link #addPreferredActivity}, that are
5333 * currently registered with the system.
5334 *
John Spurlock38e64252015-03-18 12:09:32 -04005335 * @param outFilters A required list in which to place the filters of all of the
5336 * preferred activities.
5337 * @param outActivities A required list in which to place the component names of
5338 * all of the preferred activities.
5339 * @param packageName An optional package in which you would like to limit
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005340 * the list. If null, all activities will be returned; if non-null, only
5341 * those activities in the given package are returned.
5342 *
5343 * @return Returns the total number of registered preferred activities
5344 * (the number of distinct IntentFilter records, not the number of unique
5345 * activity components) that were found.
5346 */
John Spurlock38e64252015-03-18 12:09:32 -04005347 public abstract int getPreferredActivities(@NonNull List<IntentFilter> outFilters,
5348 @NonNull List<ComponentName> outActivities, String packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005349
5350 /**
Christopher Tatea2a0850d2013-09-05 16:38:58 -07005351 * Ask for the set of available 'home' activities and the current explicit
5352 * default, if any.
5353 * @hide
5354 */
5355 public abstract ComponentName getHomeActivities(List<ResolveInfo> outActivities);
5356
5357 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005358 * Set the enabled setting for a package component (activity, receiver, service, provider).
5359 * This setting will override any enabled state which may have been set by the component in its
5360 * manifest.
5361 *
5362 * @param componentName The component to enable
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06005363 * @param newState The new enabled state for the component.
5364 * @param flags Optional behavior flags.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005365 */
5366 public abstract void setComponentEnabledSetting(ComponentName componentName,
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06005367 @EnabledState int newState, @EnabledFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005368
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005369 /**
Amaury Medeirosdde24262014-06-03 20:06:41 -03005370 * Return the enabled setting for a package component (activity,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005371 * receiver, service, provider). This returns the last value set by
5372 * {@link #setComponentEnabledSetting(ComponentName, int, int)}; in most
5373 * cases this value will be {@link #COMPONENT_ENABLED_STATE_DEFAULT} since
5374 * the value originally specified in the manifest has not been modified.
5375 *
5376 * @param componentName The component to retrieve.
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06005377 * @return Returns the current enabled state for the component.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005378 */
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06005379 public abstract @EnabledState int getComponentEnabledSetting(
5380 ComponentName componentName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005381
5382 /**
5383 * Set the enabled setting for an application
5384 * This setting will override any enabled state which may have been set by the application in
5385 * its manifest. It also overrides the enabled state set in the manifest for any of the
5386 * application's components. It does not override any enabled state set by
5387 * {@link #setComponentEnabledSetting} for any of the application's components.
5388 *
5389 * @param packageName The package name of the application to enable
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06005390 * @param newState The new enabled state for the application.
5391 * @param flags Optional behavior flags.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005392 */
5393 public abstract void setApplicationEnabledSetting(String packageName,
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06005394 @EnabledState int newState, @EnabledFlags int flags);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005395
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005396 /**
Amaury Medeirosdde24262014-06-03 20:06:41 -03005397 * Return the enabled setting for an application. This returns
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005398 * the last value set by
5399 * {@link #setApplicationEnabledSetting(String, int, int)}; in most
5400 * cases this value will be {@link #COMPONENT_ENABLED_STATE_DEFAULT} since
5401 * the value originally specified in the manifest has not been modified.
5402 *
Amaury Medeirosdde24262014-06-03 20:06:41 -03005403 * @param packageName The package name of the application to retrieve.
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06005404 * @return Returns the current enabled state for the application.
Mathew Inwood1b9f8d92011-09-26 13:23:56 +01005405 * @throws IllegalArgumentException if the named package does not exist.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005406 */
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06005407 public abstract @EnabledState int getApplicationEnabledSetting(String packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005408
5409 /**
Sudheer Shankabbb3ff22015-07-09 15:39:23 +01005410 * Flush the package restrictions for a given user to disk. This forces the package restrictions
5411 * like component and package enabled settings to be written to disk and avoids the delay that
5412 * is otherwise present when changing those settings.
5413 *
5414 * @param userId Ther userId of the user whose restrictions are to be flushed.
5415 * @hide
5416 */
5417 public abstract void flushPackageRestrictionsAsUser(int userId);
5418
5419 /**
Amith Yamasanie5bcff62014-07-19 15:44:09 -07005420 * Puts the package in a hidden state, which is almost like an uninstalled state,
Amith Yamasani655d0e22013-06-12 14:19:10 -07005421 * making the package unavailable, but it doesn't remove the data or the actual
Amith Yamasanie5bcff62014-07-19 15:44:09 -07005422 * package file. Application can be unhidden by either resetting the hidden state
5423 * or by installing it, such as with {@link #installExistingPackage(String)}
Amith Yamasani655d0e22013-06-12 14:19:10 -07005424 * @hide
5425 */
Amith Yamasanie5bcff62014-07-19 15:44:09 -07005426 public abstract boolean setApplicationHiddenSettingAsUser(String packageName, boolean hidden,
Amith Yamasani655d0e22013-06-12 14:19:10 -07005427 UserHandle userHandle);
5428
5429 /**
Amith Yamasanie5bcff62014-07-19 15:44:09 -07005430 * Returns the hidden state of a package.
5431 * @see #setApplicationHiddenSettingAsUser(String, boolean, UserHandle)
Amith Yamasani655d0e22013-06-12 14:19:10 -07005432 * @hide
5433 */
Amith Yamasanie5bcff62014-07-19 15:44:09 -07005434 public abstract boolean getApplicationHiddenSettingAsUser(String packageName,
Amith Yamasani655d0e22013-06-12 14:19:10 -07005435 UserHandle userHandle);
5436
5437 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005438 * Return whether the device has been booted into safe mode.
5439 */
5440 public abstract boolean isSafeMode();
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08005441
5442 /**
Svetoslavf7c06eb2015-06-10 18:43:22 -07005443 * Adds a listener for permission changes for installed packages.
5444 *
5445 * @param listener The listener to add.
5446 *
5447 * @hide
5448 */
5449 @SystemApi
5450 @RequiresPermission(Manifest.permission.OBSERVE_GRANT_REVOKE_PERMISSIONS)
5451 public abstract void addOnPermissionsChangeListener(OnPermissionsChangedListener listener);
5452
5453 /**
5454 * Remvoes a listener for permission changes for installed packages.
5455 *
5456 * @param listener The listener to remove.
5457 *
5458 * @hide
5459 */
5460 @SystemApi
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06005461 @RequiresPermission(Manifest.permission.OBSERVE_GRANT_REVOKE_PERMISSIONS)
Svetoslavf7c06eb2015-06-10 18:43:22 -07005462 public abstract void removeOnPermissionsChangeListener(OnPermissionsChangedListener listener);
5463
5464 /**
dcashman9d2f4412014-06-09 09:27:54 -07005465 * Return the {@link KeySet} associated with the String alias for this
5466 * application.
5467 *
5468 * @param alias The alias for a given {@link KeySet} as defined in the
5469 * application's AndroidManifest.xml.
dcashmanc6f22492014-08-14 09:54:51 -07005470 * @hide
dcashman9d2f4412014-06-09 09:27:54 -07005471 */
5472 public abstract KeySet getKeySetByAlias(String packageName, String alias);
5473
Ihab Awad1ec68882014-09-12 11:09:01 -07005474 /** Return the signing {@link KeySet} for this application.
dcashmanc6f22492014-08-14 09:54:51 -07005475 * @hide
5476 */
dcashman9d2f4412014-06-09 09:27:54 -07005477 public abstract KeySet getSigningKeySet(String packageName);
5478
5479 /**
5480 * Return whether the package denoted by packageName has been signed by all
5481 * of the keys specified by the {@link KeySet} ks. This will return true if
5482 * the package has been signed by additional keys (a superset) as well.
5483 * Compare to {@link #isSignedByExactly(String packageName, KeySet ks)}.
dcashmanc6f22492014-08-14 09:54:51 -07005484 * @hide
dcashman9d2f4412014-06-09 09:27:54 -07005485 */
5486 public abstract boolean isSignedBy(String packageName, KeySet ks);
5487
5488 /**
5489 * Return whether the package denoted by packageName has been signed by all
5490 * of, and only, the keys specified by the {@link KeySet} ks. Compare to
5491 * {@link #isSignedBy(String packageName, KeySet ks)}.
dcashmanc6f22492014-08-14 09:54:51 -07005492 * @hide
dcashman9d2f4412014-06-09 09:27:54 -07005493 */
5494 public abstract boolean isSignedByExactly(String packageName, KeySet ks);
5495
5496 /**
Andrei Stingaceanueb84b182016-01-26 18:39:55 +00005497 * Puts the package in a suspended state, where attempts at starting activities are denied.
Andrei Stingaceanu1e283912015-11-26 15:26:28 +00005498 *
Andrei Stingaceanueb84b182016-01-26 18:39:55 +00005499 * <p>It doesn't remove the data or the actual package file. The application notifications
5500 * will be hidden, the application will not show up in recents, will not be able to show
5501 * toasts or dialogs or ring the device.
5502 *
Kenny Guy871f3eb2016-03-09 20:06:16 +00005503 * <p>The package must already be installed. If the package is uninstalled while suspended
5504 * the package will no longer be suspended.
5505 *
Andrei Stingaceanueb84b182016-01-26 18:39:55 +00005506 * @param packageNames The names of the packages to set the suspended status.
5507 * @param suspended If set to {@code true} than the packages will be suspended, if set to
5508 * {@code false} the packages will be unsuspended.
Andrei Stingaceanu1e283912015-11-26 15:26:28 +00005509 * @param userId The user id.
5510 *
Andrei Stingaceanueb84b182016-01-26 18:39:55 +00005511 * @return an array of package names for which the suspended status is not set as requested in
5512 * this method.
5513 *
Andrei Stingaceanu1e283912015-11-26 15:26:28 +00005514 * @hide
5515 */
Andrei Stingaceanueb84b182016-01-26 18:39:55 +00005516 public abstract String[] setPackagesSuspendedAsUser(
5517 String[] packageNames, boolean suspended, @UserIdInt int userId);
Andrei Stingaceanu1e283912015-11-26 15:26:28 +00005518
Andrei Stingaceanu355b2322016-02-12 16:43:51 +00005519 /**
5520 * @see #setPackageSuspendedAsUser(String, boolean, int)
5521 * @param packageName The name of the package to get the suspended status of.
5522 * @param userId The user id.
5523 * @return {@code true} if the package is suspended or {@code false} if the package is not
5524 * suspended or could not be found.
5525 * @hide
5526 */
5527 public abstract boolean isPackageSuspendedForUser(String packageName, int userId);
5528
Jeff Sharkey9bc89af2017-01-11 11:25:50 -07005529 /**
5530 * Provide a hint of what the {@link ApplicationInfo#category} value should
5531 * be for the given package.
5532 * <p>
5533 * This hint can only be set by the app which installed this package, as
5534 * determined by {@link #getInstallerPackageName(String)}.
Jeff Sharkey60a82cd2017-04-18 18:19:16 -06005535 *
5536 * @param packageName the package to change the category hint for.
Jeff Sharkey4347f812017-04-21 12:08:39 -06005537 * @param categoryHint the category hint to set.
Jeff Sharkey9bc89af2017-01-11 11:25:50 -07005538 */
Jeff Sharkey60a82cd2017-04-18 18:19:16 -06005539 public abstract void setApplicationCategoryHint(@NonNull String packageName,
Jeff Sharkey9bc89af2017-01-11 11:25:50 -07005540 @ApplicationInfo.Category int categoryHint);
5541
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -07005542 /** {@hide} */
Jeff Sharkey620b32b2015-04-23 19:36:02 -07005543 public static boolean isMoveStatusFinished(int status) {
5544 return (status < 0 || status > 100);
5545 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005546
Jeff Sharkeye2d45be2015-04-15 17:14:12 -07005547 /** {@hide} */
Jeff Sharkey620b32b2015-04-23 19:36:02 -07005548 public static abstract class MoveCallback {
Jeff Sharkey50a05452015-04-29 11:24:52 -07005549 public void onCreated(int moveId, Bundle extras) {}
5550 public abstract void onStatusChanged(int moveId, int status, long estMillis);
Jeff Sharkey620b32b2015-04-23 19:36:02 -07005551 }
Jeff Sharkeye2d45be2015-04-15 17:14:12 -07005552
5553 /** {@hide} */
Jeff Sharkey620b32b2015-04-23 19:36:02 -07005554 public abstract int getMoveStatus(int moveId);
5555
5556 /** {@hide} */
5557 public abstract void registerMoveCallback(MoveCallback callback, Handler handler);
5558 /** {@hide} */
5559 public abstract void unregisterMoveCallback(MoveCallback callback);
5560
5561 /** {@hide} */
5562 public abstract int movePackage(String packageName, VolumeInfo vol);
5563 /** {@hide} */
5564 public abstract @Nullable VolumeInfo getPackageCurrentVolume(ApplicationInfo app);
5565 /** {@hide} */
5566 public abstract @NonNull List<VolumeInfo> getPackageCandidateVolumes(ApplicationInfo app);
5567
5568 /** {@hide} */
5569 public abstract int movePrimaryStorage(VolumeInfo vol);
5570 /** {@hide} */
5571 public abstract @Nullable VolumeInfo getPrimaryStorageCurrentVolume();
5572 /** {@hide} */
5573 public abstract @NonNull List<VolumeInfo> getPrimaryStorageCandidateVolumes();
Jeff Sharkeye2d45be2015-04-15 17:14:12 -07005574
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005575 /**
Amith Yamasani13593602012-03-22 16:16:17 -07005576 * Returns the device identity that verifiers can use to associate their scheme to a particular
5577 * device. This should not be used by anything other than a package verifier.
Aravind Akella068b0c02013-10-12 17:39:15 -07005578 *
Kenny Root0aaa0d92011-09-12 16:42:55 -07005579 * @return identity that uniquely identifies current device
5580 * @hide
5581 */
5582 public abstract VerifierDeviceIdentity getVerifierDeviceIdentity();
Amith Yamasani742a6712011-05-04 14:49:28 -07005583
Jeff Sharkey6c833e02014-07-14 22:44:30 -07005584 /**
Jeff Hao9f60c082014-10-28 18:51:07 -07005585 * Returns true if the device is upgrading, such as first boot after OTA.
5586 *
5587 * @hide
5588 */
5589 public abstract boolean isUpgrade();
5590
5591 /**
Jeff Sharkey6c833e02014-07-14 22:44:30 -07005592 * Return interface that offers the ability to install, upgrade, and remove
5593 * applications on the device.
5594 */
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005595 public abstract @NonNull PackageInstaller getPackageInstaller();
Jeff Sharkey3a44f3f2014-04-28 17:36:31 -07005596
Amith Yamasani742a6712011-05-04 14:49:28 -07005597 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005598 * Adds a {@code CrossProfileIntentFilter}. After calling this method all
5599 * intents sent from the user with id sourceUserId can also be be resolved
5600 * by activities in the user with id targetUserId if they match the
5601 * specified intent filter.
5602 *
Nicolas Prevot3f7777f2014-07-24 15:58:39 +01005603 * @param filter The {@link IntentFilter} the intent has to match
5604 * @param sourceUserId The source user id.
5605 * @param targetUserId The target user id.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005606 * @param flags The possible values are {@link #SKIP_CURRENT_PROFILE} and
5607 * {@link #ONLY_IF_NO_MATCH_FOUND}.
Nicolas Prevotc79586e2014-05-06 12:47:57 +01005608 * @hide
5609 */
Nicolas Prevot63798c52014-05-27 13:22:38 +01005610 public abstract void addCrossProfileIntentFilter(IntentFilter filter, int sourceUserId,
5611 int targetUserId, int flags);
Nicolas Prevotc79586e2014-05-06 12:47:57 +01005612
5613 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005614 * Clearing {@code CrossProfileIntentFilter}s which have the specified user
5615 * as their source, and have been set by the app calling this method.
5616 *
Nicolas Prevot3f7777f2014-07-24 15:58:39 +01005617 * @param sourceUserId The source user id.
Nicolas Prevotc79586e2014-05-06 12:47:57 +01005618 * @hide
5619 */
Nicolas Prevot81948992014-05-16 18:25:26 +01005620 public abstract void clearCrossProfileIntentFilters(int sourceUserId);
Alexandra Gherghina6e2ae252014-06-12 16:03:58 +01005621
5622 /**
Nicolas Prevot88cc3462014-05-14 14:51:48 +01005623 * @hide
5624 */
Nicolas Prevot7f7b0c72014-06-23 15:59:38 +01005625 public abstract Drawable loadItemIcon(PackageItemInfo itemInfo, ApplicationInfo appInfo);
Jeff Sharkey6c833e02014-07-14 22:44:30 -07005626
Benjamin Franzec2d48b2014-10-01 15:38:43 +01005627 /**
5628 * @hide
5629 */
5630 public abstract Drawable loadUnbadgedItemIcon(PackageItemInfo itemInfo, ApplicationInfo appInfo);
5631
Jeff Sharkey6c833e02014-07-14 22:44:30 -07005632 /** {@hide} */
5633 public abstract boolean isPackageAvailable(String packageName);
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005634
5635 /** {@hide} */
Jeff Sharkeya0907432014-08-15 10:23:11 -07005636 public static String installStatusToString(int status, String msg) {
5637 final String str = installStatusToString(status);
5638 if (msg != null) {
5639 return str + ": " + msg;
5640 } else {
5641 return str;
5642 }
5643 }
5644
5645 /** {@hide} */
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005646 public static String installStatusToString(int status) {
5647 switch (status) {
5648 case INSTALL_SUCCEEDED: return "INSTALL_SUCCEEDED";
5649 case INSTALL_FAILED_ALREADY_EXISTS: return "INSTALL_FAILED_ALREADY_EXISTS";
5650 case INSTALL_FAILED_INVALID_APK: return "INSTALL_FAILED_INVALID_APK";
5651 case INSTALL_FAILED_INVALID_URI: return "INSTALL_FAILED_INVALID_URI";
5652 case INSTALL_FAILED_INSUFFICIENT_STORAGE: return "INSTALL_FAILED_INSUFFICIENT_STORAGE";
5653 case INSTALL_FAILED_DUPLICATE_PACKAGE: return "INSTALL_FAILED_DUPLICATE_PACKAGE";
5654 case INSTALL_FAILED_NO_SHARED_USER: return "INSTALL_FAILED_NO_SHARED_USER";
5655 case INSTALL_FAILED_UPDATE_INCOMPATIBLE: return "INSTALL_FAILED_UPDATE_INCOMPATIBLE";
5656 case INSTALL_FAILED_SHARED_USER_INCOMPATIBLE: return "INSTALL_FAILED_SHARED_USER_INCOMPATIBLE";
5657 case INSTALL_FAILED_MISSING_SHARED_LIBRARY: return "INSTALL_FAILED_MISSING_SHARED_LIBRARY";
5658 case INSTALL_FAILED_REPLACE_COULDNT_DELETE: return "INSTALL_FAILED_REPLACE_COULDNT_DELETE";
5659 case INSTALL_FAILED_DEXOPT: return "INSTALL_FAILED_DEXOPT";
5660 case INSTALL_FAILED_OLDER_SDK: return "INSTALL_FAILED_OLDER_SDK";
5661 case INSTALL_FAILED_CONFLICTING_PROVIDER: return "INSTALL_FAILED_CONFLICTING_PROVIDER";
5662 case INSTALL_FAILED_NEWER_SDK: return "INSTALL_FAILED_NEWER_SDK";
5663 case INSTALL_FAILED_TEST_ONLY: return "INSTALL_FAILED_TEST_ONLY";
5664 case INSTALL_FAILED_CPU_ABI_INCOMPATIBLE: return "INSTALL_FAILED_CPU_ABI_INCOMPATIBLE";
5665 case INSTALL_FAILED_MISSING_FEATURE: return "INSTALL_FAILED_MISSING_FEATURE";
5666 case INSTALL_FAILED_CONTAINER_ERROR: return "INSTALL_FAILED_CONTAINER_ERROR";
5667 case INSTALL_FAILED_INVALID_INSTALL_LOCATION: return "INSTALL_FAILED_INVALID_INSTALL_LOCATION";
5668 case INSTALL_FAILED_MEDIA_UNAVAILABLE: return "INSTALL_FAILED_MEDIA_UNAVAILABLE";
5669 case INSTALL_FAILED_VERIFICATION_TIMEOUT: return "INSTALL_FAILED_VERIFICATION_TIMEOUT";
5670 case INSTALL_FAILED_VERIFICATION_FAILURE: return "INSTALL_FAILED_VERIFICATION_FAILURE";
5671 case INSTALL_FAILED_PACKAGE_CHANGED: return "INSTALL_FAILED_PACKAGE_CHANGED";
5672 case INSTALL_FAILED_UID_CHANGED: return "INSTALL_FAILED_UID_CHANGED";
5673 case INSTALL_FAILED_VERSION_DOWNGRADE: return "INSTALL_FAILED_VERSION_DOWNGRADE";
5674 case INSTALL_PARSE_FAILED_NOT_APK: return "INSTALL_PARSE_FAILED_NOT_APK";
5675 case INSTALL_PARSE_FAILED_BAD_MANIFEST: return "INSTALL_PARSE_FAILED_BAD_MANIFEST";
5676 case INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION: return "INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION";
5677 case INSTALL_PARSE_FAILED_NO_CERTIFICATES: return "INSTALL_PARSE_FAILED_NO_CERTIFICATES";
5678 case INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES: return "INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES";
5679 case INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING: return "INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING";
5680 case INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME: return "INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME";
5681 case INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID: return "INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID";
5682 case INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: return "INSTALL_PARSE_FAILED_MANIFEST_MALFORMED";
5683 case INSTALL_PARSE_FAILED_MANIFEST_EMPTY: return "INSTALL_PARSE_FAILED_MANIFEST_EMPTY";
5684 case INSTALL_FAILED_INTERNAL_ERROR: return "INSTALL_FAILED_INTERNAL_ERROR";
5685 case INSTALL_FAILED_USER_RESTRICTED: return "INSTALL_FAILED_USER_RESTRICTED";
5686 case INSTALL_FAILED_DUPLICATE_PERMISSION: return "INSTALL_FAILED_DUPLICATE_PERMISSION";
5687 case INSTALL_FAILED_NO_MATCHING_ABIS: return "INSTALL_FAILED_NO_MATCHING_ABIS";
Jeff Sharkeyf0600952014-08-07 17:31:53 -07005688 case INSTALL_FAILED_ABORTED: return "INSTALL_FAILED_ABORTED";
Calin Juravle3fc56c32017-12-11 18:26:13 -08005689 case INSTALL_FAILED_BAD_DEX_METADATA:
5690 return "INSTALL_FAILED_BAD_DEX_METADATA";
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005691 default: return Integer.toString(status);
5692 }
5693 }
5694
5695 /** {@hide} */
Jeff Sharkeya0907432014-08-15 10:23:11 -07005696 public static int installStatusToPublicStatus(int status) {
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005697 switch (status) {
Jeff Sharkeya0907432014-08-15 10:23:11 -07005698 case INSTALL_SUCCEEDED: return PackageInstaller.STATUS_SUCCESS;
5699 case INSTALL_FAILED_ALREADY_EXISTS: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5700 case INSTALL_FAILED_INVALID_APK: return PackageInstaller.STATUS_FAILURE_INVALID;
5701 case INSTALL_FAILED_INVALID_URI: return PackageInstaller.STATUS_FAILURE_INVALID;
5702 case INSTALL_FAILED_INSUFFICIENT_STORAGE: return PackageInstaller.STATUS_FAILURE_STORAGE;
5703 case INSTALL_FAILED_DUPLICATE_PACKAGE: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5704 case INSTALL_FAILED_NO_SHARED_USER: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5705 case INSTALL_FAILED_UPDATE_INCOMPATIBLE: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5706 case INSTALL_FAILED_SHARED_USER_INCOMPATIBLE: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5707 case INSTALL_FAILED_MISSING_SHARED_LIBRARY: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5708 case INSTALL_FAILED_REPLACE_COULDNT_DELETE: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5709 case INSTALL_FAILED_DEXOPT: return PackageInstaller.STATUS_FAILURE_INVALID;
5710 case INSTALL_FAILED_OLDER_SDK: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5711 case INSTALL_FAILED_CONFLICTING_PROVIDER: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5712 case INSTALL_FAILED_NEWER_SDK: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5713 case INSTALL_FAILED_TEST_ONLY: return PackageInstaller.STATUS_FAILURE_INVALID;
5714 case INSTALL_FAILED_CPU_ABI_INCOMPATIBLE: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5715 case INSTALL_FAILED_MISSING_FEATURE: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5716 case INSTALL_FAILED_CONTAINER_ERROR: return PackageInstaller.STATUS_FAILURE_STORAGE;
5717 case INSTALL_FAILED_INVALID_INSTALL_LOCATION: return PackageInstaller.STATUS_FAILURE_STORAGE;
5718 case INSTALL_FAILED_MEDIA_UNAVAILABLE: return PackageInstaller.STATUS_FAILURE_STORAGE;
5719 case INSTALL_FAILED_VERIFICATION_TIMEOUT: return PackageInstaller.STATUS_FAILURE_ABORTED;
5720 case INSTALL_FAILED_VERIFICATION_FAILURE: return PackageInstaller.STATUS_FAILURE_ABORTED;
5721 case INSTALL_FAILED_PACKAGE_CHANGED: return PackageInstaller.STATUS_FAILURE_INVALID;
5722 case INSTALL_FAILED_UID_CHANGED: return PackageInstaller.STATUS_FAILURE_INVALID;
5723 case INSTALL_FAILED_VERSION_DOWNGRADE: return PackageInstaller.STATUS_FAILURE_INVALID;
Svetoslavd9653702015-05-13 18:02:46 -07005724 case INSTALL_FAILED_PERMISSION_MODEL_DOWNGRADE: return PackageInstaller.STATUS_FAILURE_INVALID;
Jeff Sharkeya0907432014-08-15 10:23:11 -07005725 case INSTALL_PARSE_FAILED_NOT_APK: return PackageInstaller.STATUS_FAILURE_INVALID;
5726 case INSTALL_PARSE_FAILED_BAD_MANIFEST: return PackageInstaller.STATUS_FAILURE_INVALID;
5727 case INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION: return PackageInstaller.STATUS_FAILURE_INVALID;
5728 case INSTALL_PARSE_FAILED_NO_CERTIFICATES: return PackageInstaller.STATUS_FAILURE_INVALID;
5729 case INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES: return PackageInstaller.STATUS_FAILURE_INVALID;
5730 case INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING: return PackageInstaller.STATUS_FAILURE_INVALID;
5731 case INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME: return PackageInstaller.STATUS_FAILURE_INVALID;
5732 case INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID: return PackageInstaller.STATUS_FAILURE_INVALID;
5733 case INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: return PackageInstaller.STATUS_FAILURE_INVALID;
5734 case INSTALL_PARSE_FAILED_MANIFEST_EMPTY: return PackageInstaller.STATUS_FAILURE_INVALID;
Calin Juravle3fc56c32017-12-11 18:26:13 -08005735 case INSTALL_FAILED_BAD_DEX_METADATA: return PackageInstaller.STATUS_FAILURE_INVALID;
Jeff Sharkeya0907432014-08-15 10:23:11 -07005736 case INSTALL_FAILED_INTERNAL_ERROR: return PackageInstaller.STATUS_FAILURE;
5737 case INSTALL_FAILED_USER_RESTRICTED: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5738 case INSTALL_FAILED_DUPLICATE_PERMISSION: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5739 case INSTALL_FAILED_NO_MATCHING_ABIS: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5740 case INSTALL_FAILED_ABORTED: return PackageInstaller.STATUS_FAILURE_ABORTED;
5741 default: return PackageInstaller.STATUS_FAILURE;
5742 }
5743 }
5744
5745 /** {@hide} */
5746 public static String deleteStatusToString(int status, String msg) {
5747 final String str = deleteStatusToString(status);
5748 if (msg != null) {
5749 return str + ": " + msg;
5750 } else {
5751 return str;
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005752 }
5753 }
5754
5755 /** {@hide} */
5756 public static String deleteStatusToString(int status) {
5757 switch (status) {
5758 case DELETE_SUCCEEDED: return "DELETE_SUCCEEDED";
5759 case DELETE_FAILED_INTERNAL_ERROR: return "DELETE_FAILED_INTERNAL_ERROR";
5760 case DELETE_FAILED_DEVICE_POLICY_MANAGER: return "DELETE_FAILED_DEVICE_POLICY_MANAGER";
5761 case DELETE_FAILED_USER_RESTRICTED: return "DELETE_FAILED_USER_RESTRICTED";
5762 case DELETE_FAILED_OWNER_BLOCKED: return "DELETE_FAILED_OWNER_BLOCKED";
Jeff Sharkeyf0600952014-08-07 17:31:53 -07005763 case DELETE_FAILED_ABORTED: return "DELETE_FAILED_ABORTED";
Svet Ganov67882122016-12-11 16:36:34 -08005764 case DELETE_FAILED_USED_SHARED_LIBRARY: return "DELETE_FAILED_USED_SHARED_LIBRARY";
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005765 default: return Integer.toString(status);
5766 }
5767 }
Jeff Sharkeyf0600952014-08-07 17:31:53 -07005768
5769 /** {@hide} */
Jeff Sharkeya0907432014-08-15 10:23:11 -07005770 public static int deleteStatusToPublicStatus(int status) {
Jeff Sharkeyf0600952014-08-07 17:31:53 -07005771 switch (status) {
Jeff Sharkeya0907432014-08-15 10:23:11 -07005772 case DELETE_SUCCEEDED: return PackageInstaller.STATUS_SUCCESS;
5773 case DELETE_FAILED_INTERNAL_ERROR: return PackageInstaller.STATUS_FAILURE;
5774 case DELETE_FAILED_DEVICE_POLICY_MANAGER: return PackageInstaller.STATUS_FAILURE_BLOCKED;
5775 case DELETE_FAILED_USER_RESTRICTED: return PackageInstaller.STATUS_FAILURE_BLOCKED;
5776 case DELETE_FAILED_OWNER_BLOCKED: return PackageInstaller.STATUS_FAILURE_BLOCKED;
5777 case DELETE_FAILED_ABORTED: return PackageInstaller.STATUS_FAILURE_ABORTED;
Svet Ganov67882122016-12-11 16:36:34 -08005778 case DELETE_FAILED_USED_SHARED_LIBRARY: return PackageInstaller.STATUS_FAILURE_CONFLICT;
Jeff Sharkeya0907432014-08-15 10:23:11 -07005779 default: return PackageInstaller.STATUS_FAILURE;
Jeff Sharkeyf0600952014-08-07 17:31:53 -07005780 }
5781 }
Jeff Sharkey6c0b9da2014-08-07 22:07:11 -07005782
5783 /** {@hide} */
Svet Ganov77ab6a82015-07-03 12:03:02 -07005784 public static String permissionFlagToString(int flag) {
5785 switch (flag) {
Svetoslav4a5f4a22015-07-07 18:18:15 -07005786 case FLAG_PERMISSION_GRANTED_BY_DEFAULT: return "GRANTED_BY_DEFAULT";
5787 case FLAG_PERMISSION_POLICY_FIXED: return "POLICY_FIXED";
5788 case FLAG_PERMISSION_SYSTEM_FIXED: return "SYSTEM_FIXED";
5789 case FLAG_PERMISSION_USER_SET: return "USER_SET";
5790 case FLAG_PERMISSION_REVOKE_ON_UPGRADE: return "REVOKE_ON_UPGRADE";
5791 case FLAG_PERMISSION_USER_FIXED: return "USER_FIXED";
Svet Ganov9c165d72015-12-01 19:52:26 -08005792 case FLAG_PERMISSION_REVIEW_REQUIRED: return "REVIEW_REQUIRED";
Svet Ganov77ab6a82015-07-03 12:03:02 -07005793 default: return Integer.toString(flag);
5794 }
5795 }
5796
5797 /** {@hide} */
Jeff Sharkey6c0b9da2014-08-07 22:07:11 -07005798 public static class LegacyPackageDeleteObserver extends PackageDeleteObserver {
5799 private final IPackageDeleteObserver mLegacy;
5800
5801 public LegacyPackageDeleteObserver(IPackageDeleteObserver legacy) {
5802 mLegacy = legacy;
5803 }
5804
5805 @Override
5806 public void onPackageDeleted(String basePackageName, int returnCode, String msg) {
5807 if (mLegacy == null) return;
5808 try {
5809 mLegacy.packageDeleted(basePackageName, returnCode);
5810 } catch (RemoteException ignored) {
5811 }
5812 }
5813 }
Bartosz Fabianowskia34f53f2017-01-11 18:08:47 +01005814
5815 /**
Jeff Sharkey4347f812017-04-21 12:08:39 -06005816 * Return the install reason that was recorded when a package was first
5817 * installed for a specific user. Requesting the install reason for another
5818 * user will require the permission INTERACT_ACROSS_USERS_FULL.
Bartosz Fabianowskia34f53f2017-01-11 18:08:47 +01005819 *
5820 * @param packageName The package for which to retrieve the install reason
5821 * @param user The user for whom to retrieve the install reason
Jeff Sharkey4347f812017-04-21 12:08:39 -06005822 * @return The install reason. If the package is not installed for the given
5823 * user, {@code INSTALL_REASON_UNKNOWN} is returned.
Bartosz Fabianowskia34f53f2017-01-11 18:08:47 +01005824 * @hide
5825 */
5826 @TestApi
5827 public abstract @InstallReason int getInstallReason(String packageName,
5828 @NonNull UserHandle user);
Suprabh Shuklaaef25132017-01-23 18:09:03 -08005829
5830 /**
5831 * Checks whether the calling package is allowed to request package installs through package
Suprabh Shukla57528472017-04-14 19:22:45 -07005832 * installer. Apps are encouraged to call this API before launching the package installer via
Suprabh Shuklaaef25132017-01-23 18:09:03 -08005833 * intent {@link android.content.Intent#ACTION_INSTALL_PACKAGE}. Starting from Android O, the
5834 * user can explicitly choose what external sources they trust to install apps on the device.
Suprabh Shukla57528472017-04-14 19:22:45 -07005835 * If this API returns false, the install request will be blocked by the package installer and
Suprabh Shuklaaef25132017-01-23 18:09:03 -08005836 * a dialog will be shown to the user with an option to launch settings to change their
5837 * preference. An application must target Android O or higher and declare permission
Suprabh Shukla57528472017-04-14 19:22:45 -07005838 * {@link android.Manifest.permission#REQUEST_INSTALL_PACKAGES} in order to use this API.
Suprabh Shuklaaef25132017-01-23 18:09:03 -08005839 *
5840 * @return true if the calling package is trusted by the user to request install packages on
5841 * the device, false otherwise.
Suprabh Shukla57528472017-04-14 19:22:45 -07005842 * @see android.content.Intent#ACTION_INSTALL_PACKAGE
5843 * @see android.provider.Settings#ACTION_MANAGE_UNKNOWN_APP_SOURCES
Suprabh Shuklaaef25132017-01-23 18:09:03 -08005844 */
5845 public abstract boolean canRequestPackageInstalls();
Chad Brubakeraa49cb82017-03-24 15:53:09 -07005846
5847 /**
5848 * Return the {@link ComponentName} of the activity providing Settings for the Instant App
5849 * resolver.
5850 *
Todd Kennedy801e6592017-04-12 14:10:12 -07005851 * @see {@link android.content.Intent#ACTION_INSTANT_APP_RESOLVER_SETTINGS}
Chad Brubakeraa49cb82017-03-24 15:53:09 -07005852 * @hide
5853 */
5854 @SystemApi
5855 public abstract ComponentName getInstantAppResolverSettingsComponent();
Todd Kennedy801e6592017-04-12 14:10:12 -07005856
5857 /**
5858 * Return the {@link ComponentName} of the activity responsible for installing instant
5859 * applications.
5860 *
5861 * @see {@link android.content.Intent#ACTION_INSTALL_INSTANT_APP_PACKAGE}
5862 * @hide
5863 */
5864 @SystemApi
5865 public abstract ComponentName getInstantAppInstallerComponent();
Chad Brubaker0d277a72017-04-12 16:56:53 -07005866
5867 /**
5868 * Return the Android Id for a given Instant App.
5869 *
5870 * @see {@link android.provider.Settings.Secure#ANDROID_ID}
5871 * @hide
5872 */
5873 public abstract String getInstantAppAndroidId(String packageName, @NonNull UserHandle user);
Calin Juravle3d2af7f2017-04-19 19:56:21 -07005874
5875 /**
5876 * Callback use to notify the callers of module registration that the operation
5877 * has finished.
5878 *
5879 * @hide
5880 */
Jeff Sharkey90396362017-06-12 16:26:53 -06005881 @SystemApi
Calin Juravle3d2af7f2017-04-19 19:56:21 -07005882 public static abstract class DexModuleRegisterCallback {
5883 public abstract void onDexModuleRegistered(String dexModulePath, boolean success,
5884 String message);
5885 }
5886
5887 /**
5888 * Register an application dex module with the package manager.
5889 * The package manager will keep track of the given module for future optimizations.
5890 *
5891 * Dex module optimizations will disable the classpath checking at runtime. The client bares
5892 * the responsibility to ensure that the static assumptions on classes in the optimized code
5893 * hold at runtime (e.g. there's no duplicate classes in the classpath).
5894 *
5895 * Note that the package manager already keeps track of dex modules loaded with
5896 * {@link dalvik.system.DexClassLoader} and {@link dalvik.system.PathClassLoader}.
5897 * This can be called for an eager registration.
5898 *
5899 * The call might take a while and the results will be posted on the main thread, using
5900 * the given callback.
5901 *
5902 * If the module is intended to be shared with other apps, make sure that the file
5903 * permissions allow for it.
5904 * If at registration time the permissions allow for others to read it, the module would
5905 * be marked as a shared module which might undergo a different optimization strategy.
5906 * (usually shared modules will generated larger optimizations artifacts,
5907 * taking more disk space).
5908 *
5909 * @param dexModulePath the absolute path of the dex module.
5910 * @param callback if not null, {@link DexModuleRegisterCallback#onDexModuleRegistered} will
5911 * be called once the registration finishes.
5912 *
5913 * @hide
5914 */
Jeff Sharkey90396362017-06-12 16:26:53 -06005915 @SystemApi
Calin Juravle3d2af7f2017-04-19 19:56:21 -07005916 public abstract void registerDexModule(String dexModulePath,
5917 @Nullable DexModuleRegisterCallback callback);
Calin Juravle45f8b292017-11-07 18:49:43 -08005918
5919 /**
5920 * Returns the {@link ArtManager} associated with this package manager.
5921 *
5922 * @hide
5923 */
5924 @SystemApi
5925 public @NonNull ArtManager getArtManager() {
5926 throw new UnsupportedOperationException("getArtManager not implemented in subclass");
5927 }
Ben Gruver1ab3d6e2017-12-07 13:45:08 -08005928
5929 /**
5930 * Sets or clears the harmful app warning details for the given app.
5931 *
5932 * When set, any attempt to launch an activity in this package will be intercepted and a
5933 * warning dialog will be shown to the user instead, with the given warning. The user
5934 * will have the option to proceed with the activity launch, or to uninstall the application.
5935 *
5936 * @param packageName The full name of the package to warn on.
5937 * @param warning A warning string to display to the user describing the threat posed by the
5938 * application, or null to clear the warning.
5939 *
5940 * @hide
5941 */
5942 @RequiresPermission(Manifest.permission.SET_HARMFUL_APP_WARNINGS)
5943 @SystemApi
5944 public void setHarmfulAppWarning(@NonNull String packageName, @Nullable CharSequence warning) {
5945 throw new UnsupportedOperationException("setHarmfulAppWarning not implemented in subclass");
5946 }
5947
5948 /**
5949 * Returns the harmful app warning string for the given app, or null if there is none set.
5950 *
5951 * @param packageName The full name of the desired package.
5952 *
5953 * @hide
5954 */
5955 @RequiresPermission(Manifest.permission.SET_HARMFUL_APP_WARNINGS)
5956 @Nullable
5957 @SystemApi
5958 public CharSequence getHarmfulAppWarning(@NonNull String packageName) {
5959 throw new UnsupportedOperationException("getHarmfulAppWarning not implemented in subclass");
5960 }
Daniel Cashman5cdda342018-01-19 07:22:52 -08005961
5962 /** @hide */
5963 @IntDef(prefix = { "CERT_INPUT_" }, value = {
5964 CERT_INPUT_RAW_X509,
5965 CERT_INPUT_SHA256
5966 })
5967 @Retention(RetentionPolicy.SOURCE)
5968 public @interface CertificateInputType {}
5969
5970 /**
5971 * Certificate input bytes: the input bytes represent an encoded X.509 Certificate which could
5972 * be generated using an {@code CertificateFactory}
5973 */
5974 public static final int CERT_INPUT_RAW_X509 = 0;
5975
5976 /**
5977 * Certificate input bytes: the input bytes represent the SHA256 output of an encoded X.509
5978 * Certificate.
5979 */
5980 public static final int CERT_INPUT_SHA256 = 1;
5981
5982 /**
5983 * Searches the set of signing certificates by which the given package has proven to have been
5984 * signed. This should be used instead of {@code getPackageInfo} with {@code GET_SIGNATURES}
5985 * since it takes into account the possibility of signing certificate rotation, except in the
5986 * case of packages that are signed by multiple certificates, for which signing certificate
5987 * rotation is not supported.
5988 *
5989 * @param packageName package whose signing certificates to check
5990 * @param certificate signing certificate for which to search
5991 * @param type representation of the {@code certificate}
5992 * @return true if this package was or is signed by exactly the certificate {@code certificate}
5993 */
5994 public boolean hasSigningCertificate(
5995 String packageName, byte[] certificate, @CertificateInputType int type) {
5996 throw new UnsupportedOperationException(
5997 "hasSigningCertificate not implemented in subclass");
5998 }
5999
6000 /**
6001 * Searches the set of signing certificates by which the given uid has proven to have been
6002 * signed. This should be used instead of {@code getPackageInfo} with {@code GET_SIGNATURES}
6003 * since it takes into account the possibility of signing certificate rotation, except in the
6004 * case of packages that are signed by multiple certificates, for which signing certificate
6005 * rotation is not supported.
6006 *
6007 * @param uid package whose signing certificates to check
6008 * @param certificate signing certificate for which to search
6009 * @param type representation of the {@code certificate}
6010 * @return true if this package was or is signed by exactly the certificate {@code certificate}
6011 */
6012 public boolean hasSigningCertificate(
6013 int uid, byte[] certificate, @CertificateInputType int type) {
6014 throw new UnsupportedOperationException(
6015 "hasSigningCertificate not implemented in subclass");
6016 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08006017}