blob: bd7961fffca8dfe26a75fcbd1a212ff95a1ff8a0 [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 /**
Philip Quinnb6bd3012018-02-09 17:56:40 -08002073 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2074 * The device supports a hardware mechanism for invoking an assist gesture.
2075 * @see android.provider.Settings.Secure#ASSIST_GESTURE_ENABLED
2076 * @hide
2077 */
2078 @SdkConstant(SdkConstantType.FEATURE)
2079 public static final String FEATURE_ASSIST_GESTURE = "android.hardware.sensor.assist";
2080
2081 /**
Ashutosh Joshieae371b2015-04-09 10:30:07 -07002082 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002083 * {@link #hasSystemFeature}: The device has a telephony radio with data
2084 * communication support.
2085 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08002086 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002087 public static final String FEATURE_TELEPHONY = "android.hardware.telephony";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002088
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002089 /**
2090 * Feature for {@link #getSystemAvailableFeatures} and
2091 * {@link #hasSystemFeature}: The device has a CDMA telephony stack.
2092 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08002093 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002094 public static final String FEATURE_TELEPHONY_CDMA = "android.hardware.telephony.cdma";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002095
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002096 /**
2097 * Feature for {@link #getSystemAvailableFeatures} and
2098 * {@link #hasSystemFeature}: The device has a GSM telephony stack.
2099 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08002100 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002101 public static final String FEATURE_TELEPHONY_GSM = "android.hardware.telephony.gsm";
Hung-ying Tyan3424c022010-08-27 18:08:19 +08002102
2103 /**
Polina Bondarenko80909ce2017-01-12 21:10:38 +01002104 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2105 * The device supports telephony carrier restriction mechanism.
2106 *
2107 * <p>Devices declaring this feature must have an implementation of the
2108 * {@link android.telephony.TelephonyManager#getAllowedCarriers} and
2109 * {@link android.telephony.TelephonyManager#setAllowedCarriers}.
2110 * @hide
2111 */
2112 @SystemApi
2113 @SdkConstant(SdkConstantType.FEATURE)
2114 public static final String FEATURE_TELEPHONY_CARRIERLOCK =
2115 "android.hardware.telephony.carrierlock";
2116
2117 /**
Jeff Davidson35cda392017-02-27 09:46:00 -08002118 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: The device
2119 * supports embedded subscriptions on eUICCs.
Jeff Davidson35cda392017-02-27 09:46:00 -08002120 */
2121 @SdkConstant(SdkConstantType.FEATURE)
2122 public static final String FEATURE_TELEPHONY_EUICC = "android.hardware.telephony.euicc";
2123
2124 /**
Hall Liuc6703d92017-11-17 11:31:57 -08002125 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: The device
2126 * supports cell-broadcast reception using the MBMS APIs.
2127 */
2128 @SdkConstant(SdkConstantType.FEATURE)
2129 public static final String FEATURE_TELEPHONY_MBMS = "android.hardware.telephony.mbms";
2130
2131 /**
Hung-ying Tyan3424c022010-08-27 18:08:19 +08002132 * Feature for {@link #getSystemAvailableFeatures} and
Mike Lockwoodf4ca2472011-02-27 11:23:25 -08002133 * {@link #hasSystemFeature}: The device supports connecting to USB devices
2134 * as the USB host.
2135 */
2136 @SdkConstant(SdkConstantType.FEATURE)
2137 public static final String FEATURE_USB_HOST = "android.hardware.usb.host";
2138
2139 /**
2140 * Feature for {@link #getSystemAvailableFeatures} and
2141 * {@link #hasSystemFeature}: The device supports connecting to USB accessories.
2142 */
2143 @SdkConstant(SdkConstantType.FEATURE)
2144 public static final String FEATURE_USB_ACCESSORY = "android.hardware.usb.accessory";
2145
2146 /**
2147 * Feature for {@link #getSystemAvailableFeatures} and
Hung-ying Tyan3424c022010-08-27 18:08:19 +08002148 * {@link #hasSystemFeature}: The SIP API is enabled on the device.
2149 */
2150 @SdkConstant(SdkConstantType.FEATURE)
2151 public static final String FEATURE_SIP = "android.software.sip";
2152
2153 /**
2154 * Feature for {@link #getSystemAvailableFeatures} and
2155 * {@link #hasSystemFeature}: The device supports SIP-based VOIP.
2156 */
2157 @SdkConstant(SdkConstantType.FEATURE)
2158 public static final String FEATURE_SIP_VOIP = "android.software.sip.voip";
2159
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002160 /**
2161 * Feature for {@link #getSystemAvailableFeatures} and
Ihab Awad1ec68882014-09-12 11:09:01 -07002162 * {@link #hasSystemFeature}: The Connection Service API is enabled on the device.
2163 */
2164 @SdkConstant(SdkConstantType.FEATURE)
2165 public static final String FEATURE_CONNECTION_SERVICE = "android.software.connectionservice";
2166
2167 /**
2168 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrillb0fe0332010-04-05 14:43:58 -07002169 * {@link #hasSystemFeature}: The device's display has a touch screen.
2170 */
2171 @SdkConstant(SdkConstantType.FEATURE)
2172 public static final String FEATURE_TOUCHSCREEN = "android.hardware.touchscreen";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002173
Dan Morrillb0fe0332010-04-05 14:43:58 -07002174 /**
2175 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08002176 * {@link #hasSystemFeature}: The device's touch screen supports
2177 * multitouch sufficient for basic two-finger gesture detection.
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002178 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08002179 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002180 public static final String FEATURE_TOUCHSCREEN_MULTITOUCH = "android.hardware.touchscreen.multitouch";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002181
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002182 /**
2183 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08002184 * {@link #hasSystemFeature}: The device's touch screen is capable of
2185 * tracking two or more fingers fully independently.
2186 */
2187 @SdkConstant(SdkConstantType.FEATURE)
2188 public static final String FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT = "android.hardware.touchscreen.multitouch.distinct";
2189
2190 /**
2191 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill6993d3d2010-09-03 14:30:14 -07002192 * {@link #hasSystemFeature}: The device's touch screen is capable of
2193 * tracking a full hand of fingers fully independently -- that is, 5 or
2194 * more simultaneous independent pointers.
2195 */
2196 @SdkConstant(SdkConstantType.FEATURE)
2197 public static final String FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND = "android.hardware.touchscreen.multitouch.jazzhand";
2198
2199 /**
2200 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrilla5376872011-01-23 13:15:53 -08002201 * {@link #hasSystemFeature}: The device does not have a touch screen, but
2202 * does support touch emulation for basic events. For instance, the
2203 * device might use a mouse or remote control to drive a cursor, and
2204 * emulate basic touch pointer events like down, up, drag, etc. All
2205 * devices that support android.hardware.touchscreen or a sub-feature are
2206 * presumed to also support faketouch.
2207 */
2208 @SdkConstant(SdkConstantType.FEATURE)
2209 public static final String FEATURE_FAKETOUCH = "android.hardware.faketouch";
2210
2211 /**
2212 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborne22fe932011-06-08 20:24:29 -07002213 * {@link #hasSystemFeature}: The device does not have a touch screen, but
2214 * does support touch emulation for basic events that supports distinct
2215 * tracking of two or more fingers. This is an extension of
2216 * {@link #FEATURE_FAKETOUCH} for input devices with this capability. Note
2217 * that unlike a distinct multitouch screen as defined by
2218 * {@link #FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT}, these kinds of input
2219 * devices will not actually provide full two-finger gestures since the
2220 * input is being transformed to cursor movement on the screen. That is,
2221 * single finger gestures will move a cursor; two-finger swipes will
2222 * result in single-finger touch events; other two-finger gestures will
2223 * result in the corresponding two-finger touch event.
2224 */
2225 @SdkConstant(SdkConstantType.FEATURE)
2226 public static final String FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT = "android.hardware.faketouch.multitouch.distinct";
2227
2228 /**
2229 * Feature for {@link #getSystemAvailableFeatures} and
2230 * {@link #hasSystemFeature}: The device does not have a touch screen, but
2231 * does support touch emulation for basic events that supports tracking
2232 * a hand of fingers (5 or more fingers) fully independently.
2233 * This is an extension of
2234 * {@link #FEATURE_FAKETOUCH} for input devices with this capability. Note
2235 * that unlike a multitouch screen as defined by
2236 * {@link #FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND}, not all two finger
2237 * gestures can be detected due to the limitations described for
2238 * {@link #FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT}.
2239 */
2240 @SdkConstant(SdkConstantType.FEATURE)
2241 public static final String FEATURE_FAKETOUCH_MULTITOUCH_JAZZHAND = "android.hardware.faketouch.multitouch.jazzhand";
2242
2243 /**
2244 * Feature for {@link #getSystemAvailableFeatures} and
Jim Millerd9b9d412015-07-22 19:51:40 -07002245 * {@link #hasSystemFeature}: The device has biometric hardware to detect a fingerprint.
2246 */
2247 @SdkConstant(SdkConstantType.FEATURE)
2248 public static final String FEATURE_FINGERPRINT = "android.hardware.fingerprint";
2249
2250 /**
2251 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborne289bff2011-06-13 19:33:22 -07002252 * {@link #hasSystemFeature}: The device supports portrait orientation
2253 * screens. For backwards compatibility, you can assume that if neither
2254 * this nor {@link #FEATURE_SCREEN_LANDSCAPE} is set then the device supports
2255 * both portrait and landscape.
2256 */
2257 @SdkConstant(SdkConstantType.FEATURE)
2258 public static final String FEATURE_SCREEN_PORTRAIT = "android.hardware.screen.portrait";
2259
2260 /**
2261 * Feature for {@link #getSystemAvailableFeatures} and
2262 * {@link #hasSystemFeature}: The device supports landscape orientation
2263 * screens. For backwards compatibility, you can assume that if neither
2264 * this nor {@link #FEATURE_SCREEN_PORTRAIT} is set then the device supports
2265 * both portrait and landscape.
2266 */
2267 @SdkConstant(SdkConstantType.FEATURE)
2268 public static final String FEATURE_SCREEN_LANDSCAPE = "android.hardware.screen.landscape";
2269
2270 /**
2271 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002272 * {@link #hasSystemFeature}: The device supports live wallpapers.
2273 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08002274 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002275 public static final String FEATURE_LIVE_WALLPAPER = "android.software.live_wallpaper";
Oscar Montemayor1228d0a2010-01-28 12:01:44 -08002276 /**
Dan Morrill50ab63f2010-03-05 16:16:19 -08002277 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn119bbc32013-03-22 17:27:25 -07002278 * {@link #hasSystemFeature}: The device supports app widgets.
2279 */
2280 @SdkConstant(SdkConstantType.FEATURE)
2281 public static final String FEATURE_APP_WIDGETS = "android.software.app_widgets";
2282
2283 /**
Dianne Hackborn91097de2014-04-04 18:02:06 -07002284 * @hide
2285 * Feature for {@link #getSystemAvailableFeatures} and
2286 * {@link #hasSystemFeature}: The device supports
2287 * {@link android.service.voice.VoiceInteractionService} and
2288 * {@link android.app.VoiceInteractor}.
2289 */
2290 @SdkConstant(SdkConstantType.FEATURE)
2291 public static final String FEATURE_VOICE_RECOGNIZERS = "android.software.voice_recognizers";
2292
2293
2294 /**
Dianne Hackborn119bbc32013-03-22 17:27:25 -07002295 * Feature for {@link #getSystemAvailableFeatures} and
2296 * {@link #hasSystemFeature}: The device supports a home screen that is replaceable
2297 * by third party applications.
2298 */
2299 @SdkConstant(SdkConstantType.FEATURE)
2300 public static final String FEATURE_HOME_SCREEN = "android.software.home_screen";
2301
2302 /**
2303 * Feature for {@link #getSystemAvailableFeatures} and
2304 * {@link #hasSystemFeature}: The device supports adding new input methods implemented
2305 * with the {@link android.inputmethodservice.InputMethodService} API.
2306 */
2307 @SdkConstant(SdkConstantType.FEATURE)
2308 public static final String FEATURE_INPUT_METHODS = "android.software.input_methods";
2309
2310 /**
2311 * Feature for {@link #getSystemAvailableFeatures} and
Amith Yamasani44a01b72013-09-16 10:44:57 -07002312 * {@link #hasSystemFeature}: The device supports device policy enforcement via device admins.
2313 */
2314 @SdkConstant(SdkConstantType.FEATURE)
2315 public static final String FEATURE_DEVICE_ADMIN = "android.software.device_admin";
2316
2317 /**
2318 * Feature for {@link #getSystemAvailableFeatures} and
Tim Kilbournf94b6a92014-03-07 15:13:48 -08002319 * {@link #hasSystemFeature}: The device supports leanback UI. This is
2320 * typically used in a living room television experience, but is a software
2321 * feature unlike {@link #FEATURE_TELEVISION}. Devices running with this
2322 * feature will use resources associated with the "television" UI mode.
2323 */
2324 @SdkConstant(SdkConstantType.FEATURE)
2325 public static final String FEATURE_LEANBACK = "android.software.leanback";
2326
2327 /**
2328 * Feature for {@link #getSystemAvailableFeatures} and
2329 * {@link #hasSystemFeature}: The device supports only leanback UI. Only
2330 * applications designed for this experience should be run, though this is
2331 * not enforced by the system.
Tim Kilbournf94b6a92014-03-07 15:13:48 -08002332 */
2333 @SdkConstant(SdkConstantType.FEATURE)
2334 public static final String FEATURE_LEANBACK_ONLY = "android.software.leanback_only";
2335
2336 /**
2337 * Feature for {@link #getSystemAvailableFeatures} and
Jae Seocfd861e2014-08-27 14:02:15 -07002338 * {@link #hasSystemFeature}: The device supports live TV and can display
2339 * contents from TV inputs implemented with the
2340 * {@link android.media.tv.TvInputService} API.
2341 */
2342 @SdkConstant(SdkConstantType.FEATURE)
2343 public static final String FEATURE_LIVE_TV = "android.software.live_tv";
2344
2345 /**
2346 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08002347 * {@link #hasSystemFeature}: The device supports WiFi (802.11) networking.
2348 */
2349 @SdkConstant(SdkConstantType.FEATURE)
2350 public static final String FEATURE_WIFI = "android.hardware.wifi";
2351
2352 /**
Irfan Sheriff45b8b462011-09-07 11:24:16 -07002353 * Feature for {@link #getSystemAvailableFeatures} and
2354 * {@link #hasSystemFeature}: The device supports Wi-Fi Direct networking.
2355 */
2356 @SdkConstant(SdkConstantType.FEATURE)
2357 public static final String FEATURE_WIFI_DIRECT = "android.hardware.wifi.direct";
2358
2359 /**
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07002360 * Feature for {@link #getSystemAvailableFeatures} and
Etan Cohen04133272016-10-26 11:22:06 -07002361 * {@link #hasSystemFeature}: The device supports Wi-Fi Aware.
Etan Cohen20d329b2015-09-29 13:49:02 -07002362 */
2363 @SdkConstant(SdkConstantType.FEATURE)
Etan Cohen04133272016-10-26 11:22:06 -07002364 public static final String FEATURE_WIFI_AWARE = "android.hardware.wifi.aware";
Etan Cohen20d329b2015-09-29 13:49:02 -07002365
2366 /**
2367 * Feature for {@link #getSystemAvailableFeatures} and
Peter Qiu3d615e42017-08-07 20:13:32 +00002368 * {@link #hasSystemFeature}: The device supports Wi-Fi Passpoint and all
2369 * Passpoint related APIs in {@link WifiManager} are supported. Refer to
2370 * {@link WifiManager#addOrUpdatePasspointConfiguration} for more info.
Peter Qiub99fe312017-05-05 13:48:47 -07002371 */
2372 @SdkConstant(SdkConstantType.FEATURE)
2373 public static final String FEATURE_WIFI_PASSPOINT = "android.hardware.wifi.passpoint";
2374
2375 /**
2376 * Feature for {@link #getSystemAvailableFeatures} and
Etan Cohen692e68e2017-09-14 15:42:01 -07002377 * {@link #hasSystemFeature}: The device supports Wi-Fi RTT (IEEE 802.11mc).
Etan Cohen692e68e2017-09-14 15:42:01 -07002378 */
2379 @SdkConstant(SdkConstantType.FEATURE)
2380 public static final String FEATURE_WIFI_RTT = "android.hardware.wifi.rtt";
2381
2382
2383 /**
2384 * Feature for {@link #getSystemAvailableFeatures} and
Robert Quattlebaum87a71042017-05-15 15:45:20 -07002385 * {@link #hasSystemFeature}: The device supports LoWPAN networking.
2386 * @hide
2387 */
2388 @SdkConstant(SdkConstantType.FEATURE)
2389 public static final String FEATURE_LOWPAN = "android.hardware.lowpan";
2390
2391 /**
2392 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07002393 * {@link #hasSystemFeature}: This is a device dedicated to showing UI
Todd Kennedy7f95a002015-04-22 14:28:25 -07002394 * on a vehicle headunit. A headunit here is defined to be inside a
2395 * vehicle that may or may not be moving. A headunit uses either a
2396 * primary display in the center console and/or additional displays in
2397 * the instrument cluster or elsewhere in the vehicle. Headunit display(s)
2398 * have limited size and resolution. The user will likely be focused on
2399 * driving so limiting driver distraction is a primary concern. User input
2400 * can be a variety of hard buttons, touch, rotary controllers and even mouse-
2401 * like interfaces.
2402 */
2403 @SdkConstant(SdkConstantType.FEATURE)
2404 public static final String FEATURE_AUTOMOTIVE = "android.hardware.type.automotive";
2405
2406 /**
2407 * Feature for {@link #getSystemAvailableFeatures} and
2408 * {@link #hasSystemFeature}: This is a device dedicated to showing UI
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07002409 * on a television. Television here is defined to be a typical living
2410 * room television experience: displayed on a big screen, where the user
2411 * is sitting far away from it, and the dominant form of input will be
2412 * something like a DPAD, not through touch or mouse.
Tim Kilbournf94b6a92014-03-07 15:13:48 -08002413 * @deprecated use {@link #FEATURE_LEANBACK} instead.
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07002414 */
Jose Lima970417c2014-04-10 10:42:19 -07002415 @Deprecated
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07002416 @SdkConstant(SdkConstantType.FEATURE)
2417 public static final String FEATURE_TELEVISION = "android.hardware.type.television";
2418
2419 /**
Justin Kohb5731f091c2014-02-13 16:06:59 -08002420 * Feature for {@link #getSystemAvailableFeatures} and
2421 * {@link #hasSystemFeature}: This is a device dedicated to showing UI
2422 * on a watch. A watch here is defined to be a device worn on the body, perhaps on
2423 * the wrist. The user is very close when interacting with the device.
2424 */
2425 @SdkConstant(SdkConstantType.FEATURE)
2426 public static final String FEATURE_WATCH = "android.hardware.type.watch";
2427
2428 /**
Ralph Nathanb8e0dee2017-01-24 15:24:59 -08002429 * Feature for {@link #getSystemAvailableFeatures} and
2430 * {@link #hasSystemFeature}: This is a device for IoT and may not have an UI. An embedded
2431 * device is defined as a full stack Android device with or without a display and no
2432 * user-installable apps.
2433 */
2434 @SdkConstant(SdkConstantType.FEATURE)
2435 public static final String FEATURE_EMBEDDED = "android.hardware.type.embedded";
2436
2437 /**
Dennis Kempin7345ed52017-04-14 16:40:56 -07002438 * Feature for {@link #getSystemAvailableFeatures} and
2439 * {@link #hasSystemFeature}: This is a device dedicated to be primarily used
2440 * with keyboard, mouse or touchpad. This includes traditional desktop
2441 * computers, laptops and variants such as convertibles or detachables.
2442 * Due to the larger screen, the device will most likely use the
2443 * {@link #FEATURE_FREEFORM_WINDOW_MANAGEMENT} feature as well.
2444 */
2445 @SdkConstant(SdkConstantType.FEATURE)
2446 public static final String FEATURE_PC = "android.hardware.type.pc";
2447
2448 /**
Adam Lesinski3d9bcb92014-02-18 14:05:14 -08002449 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2450 * The device supports printing.
2451 */
2452 @SdkConstant(SdkConstantType.FEATURE)
2453 public static final String FEATURE_PRINTING = "android.software.print";
2454
2455 /**
2456 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Eugene Susla7c3eef22017-03-10 14:25:58 -08002457 * The device supports {@link android.companion.CompanionDeviceManager#associate associating}
2458 * with devices via {@link android.companion.CompanionDeviceManager}.
2459 */
2460 @SdkConstant(SdkConstantType.FEATURE)
2461 public static final String FEATURE_COMPANION_DEVICE_SETUP
2462 = "android.software.companion_device_setup";
2463
2464 /**
2465 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Adam Lesinski3d9bcb92014-02-18 14:05:14 -08002466 * The device can perform backup and restore operations on installed applications.
2467 */
2468 @SdkConstant(SdkConstantType.FEATURE)
2469 public static final String FEATURE_BACKUP = "android.software.backup";
2470
2471 /**
Vladislav Kaznacheevd303b252015-10-27 17:30:58 -07002472 * Feature for {@link #getSystemAvailableFeatures} and
2473 * {@link #hasSystemFeature}: The device supports freeform window management.
2474 * Windows have title bars and can be moved and resized.
2475 */
Filip Gruszczynski811dc3b2015-11-23 12:34:22 -08002476 // If this feature is present, you also need to set
2477 // com.android.internal.R.config_freeformWindowManagement to true in your configuration overlay.
Vladislav Kaznacheevd303b252015-10-27 17:30:58 -07002478 @SdkConstant(SdkConstantType.FEATURE)
2479 public static final String FEATURE_FREEFORM_WINDOW_MANAGEMENT
2480 = "android.software.freeform_window_management";
2481
2482 /**
Adam Connors23cc04e2014-04-01 12:12:20 +01002483 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Wale Ogunwalefbe12c42015-12-06 16:23:50 -08002484 * The device supports picture-in-picture multi-window mode.
2485 */
2486 @SdkConstant(SdkConstantType.FEATURE)
2487 public static final String FEATURE_PICTURE_IN_PICTURE = "android.software.picture_in_picture";
2488
2489 /**
2490 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Andrii Kulian1981f5f2017-04-07 16:23:12 -07002491 * The device supports running activities on secondary displays.
2492 */
2493 @SdkConstant(SdkConstantType.FEATURE)
2494 public static final String FEATURE_ACTIVITIES_ON_SECONDARY_DISPLAYS
2495 = "android.software.activities_on_secondary_displays";
2496
2497 /**
2498 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Amith Yamasani1d653272014-09-11 17:56:05 -07002499 * The device supports creating secondary users and managed profiles via
2500 * {@link DevicePolicyManager}.
Adam Connors23cc04e2014-04-01 12:12:20 +01002501 */
2502 @SdkConstant(SdkConstantType.FEATURE)
Amith Yamasani1d653272014-09-11 17:56:05 -07002503 public static final String FEATURE_MANAGED_USERS = "android.software.managed_users";
2504
2505 /**
2506 * @hide
2507 * TODO: Remove after dependencies updated b/17392243
2508 */
2509 public static final String FEATURE_MANAGED_PROFILES = "android.software.managed_users";
Adam Connors23cc04e2014-04-01 12:12:20 +01002510
2511 /**
Ben Murdochf564c7f2014-05-20 18:58:06 +01002512 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Adam Connors19ccb5f2014-09-08 17:31:50 +01002513 * The device supports verified boot.
2514 */
2515 @SdkConstant(SdkConstantType.FEATURE)
2516 public static final String FEATURE_VERIFIED_BOOT = "android.software.verified_boot";
2517
2518 /**
2519 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2520 * The device supports secure removal of users. When a user is deleted the data associated
2521 * with that user is securely deleted and no longer available.
2522 */
2523 @SdkConstant(SdkConstantType.FEATURE)
2524 public static final String FEATURE_SECURELY_REMOVES_USERS
2525 = "android.software.securely_removes_users";
2526
Jeff Sharkeyb92b05b2016-01-28 09:50:00 -07002527 /** {@hide} */
Jeff Sharkey8eb783b2018-01-04 16:46:48 -07002528 @TestApi
Jeff Sharkeyb92b05b2016-01-28 09:50:00 -07002529 @SdkConstant(SdkConstantType.FEATURE)
2530 public static final String FEATURE_FILE_BASED_ENCRYPTION
2531 = "android.software.file_based_encryption";
2532
Jeff Sharkey8eb783b2018-01-04 16:46:48 -07002533 /** {@hide} */
2534 @TestApi
2535 @SdkConstant(SdkConstantType.FEATURE)
2536 public static final String FEATURE_ADOPTABLE_STORAGE
2537 = "android.software.adoptable_storage";
2538
Adam Connors19ccb5f2014-09-08 17:31:50 +01002539 /**
2540 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Ben Murdoch422c7a52014-05-16 13:45:47 +01002541 * The device has a full implementation of the android.webkit.* APIs. Devices
2542 * lacking this feature will not have a functioning WebView implementation.
2543 */
2544 @SdkConstant(SdkConstantType.FEATURE)
2545 public static final String FEATURE_WEBVIEW = "android.software.webview";
2546
2547 /**
Joe LaPenna4bb015d2014-07-04 17:15:54 -07002548 * Feature for {@link #getSystemAvailableFeatures} and
2549 * {@link #hasSystemFeature}: This device supports ethernet.
Joe LaPenna4bb015d2014-07-04 17:15:54 -07002550 */
2551 @SdkConstant(SdkConstantType.FEATURE)
2552 public static final String FEATURE_ETHERNET = "android.hardware.ethernet";
2553
2554 /**
Yuncheol Heoa0c4a062014-07-10 20:49:27 +09002555 * Feature for {@link #getSystemAvailableFeatures} and
2556 * {@link #hasSystemFeature}: This device supports HDMI-CEC.
2557 * @hide
2558 */
2559 @SdkConstant(SdkConstantType.FEATURE)
2560 public static final String FEATURE_HDMI_CEC = "android.hardware.hdmi.cec";
2561
2562 /**
Michael Wright6faa6752014-09-05 17:57:44 -07002563 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2564 * The device has all of the inputs necessary to be considered a compatible game controller, or
2565 * includes a compatible game controller in the box.
2566 */
2567 @SdkConstant(SdkConstantType.FEATURE)
2568 public static final String FEATURE_GAMEPAD = "android.hardware.gamepad";
2569
Mike Lockwood5781cd52015-03-27 13:23:41 -07002570 /**
2571 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2572 * The device has a full implementation of the android.media.midi.* APIs.
2573 */
2574 @SdkConstant(SdkConstantType.FEATURE)
2575 public static final String FEATURE_MIDI = "android.software.midi";
Michael Wright6faa6752014-09-05 17:57:44 -07002576
2577 /**
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08002578 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Ruben Brunk927d3452016-05-02 19:30:51 -07002579 * The device implements an optimized mode for virtual reality (VR) applications that handles
2580 * stereoscopic rendering of notifications, and disables most monocular system UI components
2581 * while a VR application has user focus.
2582 * Devices declaring this feature must include an application implementing a
2583 * {@link android.service.vr.VrListenerService} that can be targeted by VR applications via
2584 * {@link android.app.Activity#setVrModeEnabled}.
Craig Donnerc6f9c852017-12-27 17:15:19 -08002585 * @deprecated use {@link #FEATURE_VR_MODE_HIGH_PERFORMANCE} instead.
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08002586 */
Craig Donnerc6f9c852017-12-27 17:15:19 -08002587 @Deprecated
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08002588 @SdkConstant(SdkConstantType.FEATURE)
2589 public static final String FEATURE_VR_MODE = "android.software.vr.mode";
2590
2591 /**
Ruben Brunk31d80ea2016-01-25 20:14:08 -08002592 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Craig Donnerc6f9c852017-12-27 17:15:19 -08002593 * The device implements an optimized mode for virtual reality (VR) applications that handles
2594 * stereoscopic rendering of notifications, disables most monocular system UI components
2595 * while a VR application has user focus and meets extra CDD requirements to provide a
2596 * high-quality VR experience.
2597 * Devices declaring this feature must include an application implementing a
2598 * {@link android.service.vr.VrListenerService} that can be targeted by VR applications via
2599 * {@link android.app.Activity#setVrModeEnabled}.
2600 * and must meet CDD requirements to provide a high-quality VR experience.
Ruben Brunk31d80ea2016-01-25 20:14:08 -08002601 */
2602 @SdkConstant(SdkConstantType.FEATURE)
2603 public static final String FEATURE_VR_MODE_HIGH_PERFORMANCE
2604 = "android.hardware.vr.high_performance";
2605
2606 /**
Craig Donner279dd662017-03-15 17:10:50 -07002607 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Svet Ganov43574b02017-04-12 09:25:20 -07002608 * The device supports autofill of user credentials, addresses, credit cards, etc
2609 * via integration with {@link android.service.autofill.AutofillService autofill
2610 * providers}.
2611 */
2612 @SdkConstant(SdkConstantType.FEATURE)
2613 public static final String FEATURE_AUTOFILL = "android.software.autofill";
2614
2615 /**
2616 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Craig Donner279dd662017-03-15 17:10:50 -07002617 * The device implements headtracking suitable for a VR device.
2618 */
2619 @SdkConstant(SdkConstantType.FEATURE)
2620 public static final String FEATURE_VR_HEADTRACKING = "android.hardware.vr.headtracking";
2621
2622 /**
Frank Salimea5e0382018-01-23 22:42:29 -08002623 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2624 * The device has a StrongBox hardware-backed Keystore.
2625 */
2626 @SdkConstant(SdkConstantType.FEATURE)
2627 public static final String FEATURE_STRONGBOX_KEYSTORE =
2628 "android.hardware.strongbox_keystore";
2629
2630 /**
Dianne Hackborne83cefce2010-02-04 17:38:14 -08002631 * Action to external storage service to clean out removed apps.
2632 * @hide
2633 */
2634 public static final String ACTION_CLEAN_EXTERNAL_STORAGE
2635 = "android.content.pm.CLEAN_EXTERNAL_STORAGE";
Oscar Montemayor1228d0a2010-01-28 12:01:44 -08002636
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002637 /**
Kenny Root5ab21572011-07-27 11:11:19 -07002638 * Extra field name for the URI to a verification file. Passed to a package
2639 * verifier.
2640 *
2641 * @hide
2642 */
2643 public static final String EXTRA_VERIFICATION_URI = "android.content.pm.extra.VERIFICATION_URI";
2644
2645 /**
2646 * Extra field name for the ID of a package pending verification. Passed to
2647 * a package verifier and is used to call back to
Kenny Root3a9b5fb2011-09-20 14:15:38 -07002648 * {@link PackageManager#verifyPendingInstall(int, int)}
Kenny Root5ab21572011-07-27 11:11:19 -07002649 */
2650 public static final String EXTRA_VERIFICATION_ID = "android.content.pm.extra.VERIFICATION_ID";
2651
2652 /**
2653 * Extra field name for the package identifier which is trying to install
2654 * the package.
2655 *
2656 * @hide
2657 */
2658 public static final String EXTRA_VERIFICATION_INSTALLER_PACKAGE
2659 = "android.content.pm.extra.VERIFICATION_INSTALLER_PACKAGE";
2660
2661 /**
2662 * Extra field name for the requested install flags for a package pending
2663 * verification. Passed to a package verifier.
2664 *
2665 * @hide
2666 */
2667 public static final String EXTRA_VERIFICATION_INSTALL_FLAGS
2668 = "android.content.pm.extra.VERIFICATION_INSTALL_FLAGS";
2669
2670 /**
rich cannings13d428e2012-09-13 13:43:07 -07002671 * Extra field name for the uid of who is requesting to install
2672 * the package.
2673 *
2674 * @hide
2675 */
2676 public static final String EXTRA_VERIFICATION_INSTALLER_UID
2677 = "android.content.pm.extra.VERIFICATION_INSTALLER_UID";
2678
2679 /**
2680 * Extra field name for the package name of a package pending verification.
2681 *
2682 * @hide
2683 */
2684 public static final String EXTRA_VERIFICATION_PACKAGE_NAME
2685 = "android.content.pm.extra.VERIFICATION_PACKAGE_NAME";
2686 /**
rich canningsd1b5cfc2012-08-29 14:49:51 -07002687 * Extra field name for the result of a verification, either
2688 * {@link #VERIFICATION_ALLOW}, or {@link #VERIFICATION_REJECT}.
2689 * Passed to package verifiers after a package is verified.
2690 */
2691 public static final String EXTRA_VERIFICATION_RESULT
2692 = "android.content.pm.extra.VERIFICATION_RESULT";
2693
2694 /**
rich cannings13d428e2012-09-13 13:43:07 -07002695 * Extra field name for the version code of a package pending verification.
Dianne Hackborn3accca02013-09-20 09:32:11 -07002696 * @deprecated Use {@link #EXTRA_VERIFICATION_LONG_VERSION_CODE} instead.
2697 * @hide
2698 */
2699 @Deprecated
2700 public static final String EXTRA_VERIFICATION_VERSION_CODE
2701 = "android.content.pm.extra.VERIFICATION_VERSION_CODE";
2702
2703 /**
2704 * Extra field name for the long version code of a package pending verification.
rich cannings13d428e2012-09-13 13:43:07 -07002705 *
2706 * @hide
2707 */
Dianne Hackborn3accca02013-09-20 09:32:11 -07002708 public static final String EXTRA_VERIFICATION_LONG_VERSION_CODE =
2709 "android.content.pm.extra.VERIFICATION_LONG_VERSION_CODE";
rich cannings13d428e2012-09-13 13:43:07 -07002710
2711 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07002712 * Extra field name for the ID of a intent filter pending verification.
2713 * Passed to an intent filter verifier and is used to call back to
2714 * {@link #verifyIntentFilter}
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08002715 *
2716 * @hide
2717 */
2718 public static final String EXTRA_INTENT_FILTER_VERIFICATION_ID
2719 = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_ID";
2720
2721 /**
2722 * Extra field name for the scheme used for an intent filter pending verification. Passed to
2723 * an intent filter verifier and is used to construct the URI to verify against.
2724 *
2725 * Usually this is "https"
2726 *
2727 * @hide
2728 */
2729 public static final String EXTRA_INTENT_FILTER_VERIFICATION_URI_SCHEME
2730 = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_URI_SCHEME";
2731
2732 /**
2733 * Extra field name for the host names to be used for an intent filter pending verification.
2734 * Passed to an intent filter verifier and is used to construct the URI to verify the
2735 * intent filter.
2736 *
2737 * This is a space delimited list of hosts.
2738 *
2739 * @hide
2740 */
2741 public static final String EXTRA_INTENT_FILTER_VERIFICATION_HOSTS
2742 = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_HOSTS";
2743
2744 /**
2745 * Extra field name for the package name to be used for an intent filter pending verification.
2746 * Passed to an intent filter verifier and is used to check the verification responses coming
2747 * from the hosts. Each host response will need to include the package name of APK containing
2748 * the intent filter.
2749 *
2750 * @hide
2751 */
2752 public static final String EXTRA_INTENT_FILTER_VERIFICATION_PACKAGE_NAME
2753 = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_PACKAGE_NAME";
2754
2755 /**
2756 * The action used to request that the user approve a permission request
2757 * from the application.
Nick Kralevich035f80d2013-03-27 15:20:08 -07002758 *
2759 * @hide
2760 */
Svetoslavc6d1c342015-02-26 14:44:43 -08002761 @SystemApi
2762 public static final String ACTION_REQUEST_PERMISSIONS =
2763 "android.content.pm.action.REQUEST_PERMISSIONS";
Nick Kralevich035f80d2013-03-27 15:20:08 -07002764
2765 /**
Svetoslavc6d1c342015-02-26 14:44:43 -08002766 * The names of the requested permissions.
2767 * <p>
2768 * <strong>Type:</strong> String[]
2769 * </p>
2770 *
2771 * @hide
2772 */
2773 @SystemApi
2774 public static final String EXTRA_REQUEST_PERMISSIONS_NAMES =
2775 "android.content.pm.extra.REQUEST_PERMISSIONS_NAMES";
2776
2777 /**
2778 * The results from the permissions request.
2779 * <p>
2780 * <strong>Type:</strong> int[] of #PermissionResult
2781 * </p>
2782 *
2783 * @hide
2784 */
2785 @SystemApi
2786 public static final String EXTRA_REQUEST_PERMISSIONS_RESULTS
2787 = "android.content.pm.extra.REQUEST_PERMISSIONS_RESULTS";
Nick Kralevich035f80d2013-03-27 15:20:08 -07002788
2789 /**
Jeff Sharkeybb580672014-07-10 12:10:25 -07002790 * String extra for {@link PackageInstallObserver} in the 'extras' Bundle in case of
Christopher Tatef1977b42014-03-24 16:25:51 -07002791 * {@link #INSTALL_FAILED_DUPLICATE_PERMISSION}. This extra names the package which provides
2792 * the existing definition for the permission.
2793 * @hide
2794 */
2795 public static final String EXTRA_FAILURE_EXISTING_PACKAGE
2796 = "android.content.pm.extra.FAILURE_EXISTING_PACKAGE";
2797
2798 /**
Jeff Sharkeybb580672014-07-10 12:10:25 -07002799 * String extra for {@link PackageInstallObserver} in the 'extras' Bundle in case of
Christopher Tatef1977b42014-03-24 16:25:51 -07002800 * {@link #INSTALL_FAILED_DUPLICATE_PERMISSION}. This extra names the permission that is
2801 * being redundantly defined by the package being installed.
2802 * @hide
2803 */
2804 public static final String EXTRA_FAILURE_EXISTING_PERMISSION
2805 = "android.content.pm.extra.FAILURE_EXISTING_PERMISSION";
2806
Svet Ganov8c7f7002015-05-07 10:48:44 -07002807 /**
2808 * Permission flag: The permission is set in its current state
2809 * by the user and apps can still request it at runtime.
2810 *
2811 * @hide
2812 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08002813 @SystemApi
Svet Ganov8c7f7002015-05-07 10:48:44 -07002814 public static final int FLAG_PERMISSION_USER_SET = 1 << 0;
2815
2816 /**
2817 * Permission flag: The permission is set in its current state
2818 * by the user and it is fixed, i.e. apps can no longer request
2819 * this permission.
2820 *
2821 * @hide
2822 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08002823 @SystemApi
Svet Ganov8c7f7002015-05-07 10:48:44 -07002824 public static final int FLAG_PERMISSION_USER_FIXED = 1 << 1;
2825
2826 /**
2827 * Permission flag: The permission is set in its current state
2828 * by device policy and neither apps nor the user can change
2829 * its state.
2830 *
2831 * @hide
2832 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08002833 @SystemApi
Svet Ganov8c7f7002015-05-07 10:48:44 -07002834 public static final int FLAG_PERMISSION_POLICY_FIXED = 1 << 2;
2835
2836 /**
2837 * Permission flag: The permission is set in a granted state but
2838 * access to resources it guards is restricted by other means to
2839 * enable revoking a permission on legacy apps that do not support
2840 * runtime permissions. If this permission is upgraded to runtime
2841 * because the app was updated to support runtime permissions, the
2842 * the permission will be revoked in the upgrade process.
2843 *
2844 * @hide
2845 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08002846 @SystemApi
Svet Ganov8c7f7002015-05-07 10:48:44 -07002847 public static final int FLAG_PERMISSION_REVOKE_ON_UPGRADE = 1 << 3;
2848
Svet Ganovb3f22b42015-05-12 11:01:24 -07002849 /**
2850 * Permission flag: The permission is set in its current state
2851 * because the app is a component that is a part of the system.
2852 *
2853 * @hide
2854 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08002855 @SystemApi
Svet Ganovb3f22b42015-05-12 11:01:24 -07002856 public static final int FLAG_PERMISSION_SYSTEM_FIXED = 1 << 4;
Svet Ganov8c7f7002015-05-07 10:48:44 -07002857
Svet Ganov77ab6a82015-07-03 12:03:02 -07002858 /**
2859 * Permission flag: The permission is granted by default because it
2860 * enables app functionality that is expected to work out-of-the-box
2861 * for providing a smooth user experience. For example, the phone app
2862 * is expected to have the phone permission.
2863 *
2864 * @hide
2865 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08002866 @SystemApi
Svet Ganov77ab6a82015-07-03 12:03:02 -07002867 public static final int FLAG_PERMISSION_GRANTED_BY_DEFAULT = 1 << 5;
2868
Svet Ganov8c7f7002015-05-07 10:48:44 -07002869 /**
Svet Ganov9c165d72015-12-01 19:52:26 -08002870 * Permission flag: The permission has to be reviewed before any of
2871 * the app components can run.
2872 *
2873 * @hide
2874 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08002875 @SystemApi
Svet Ganov9c165d72015-12-01 19:52:26 -08002876 public static final int FLAG_PERMISSION_REVIEW_REQUIRED = 1 << 6;
2877
2878 /**
Svet Ganov8c7f7002015-05-07 10:48:44 -07002879 * Mask for all permission flags.
2880 *
2881 * @hide
2882 */
2883 @SystemApi
Svet Ganovb3f22b42015-05-12 11:01:24 -07002884 public static final int MASK_PERMISSION_FLAGS = 0xFF;
Svet Ganov8c7f7002015-05-07 10:48:44 -07002885
Christopher Tatef1977b42014-03-24 16:25:51 -07002886 /**
Svet Ganovd7b1f4112016-02-09 18:49:23 -08002887 * This is a library that contains components apps can invoke. For
2888 * example, a services for apps to bind to, or standard chooser UI,
2889 * etc. This library is versioned and backwards compatible. Clients
2890 * should check its version via {@link android.ext.services.Version
2891 * #getVersionCode()} and avoid calling APIs added in later versions.
2892 *
2893 * @hide
2894 */
2895 public static final String SYSTEM_SHARED_LIBRARY_SERVICES = "android.ext.services";
2896
2897 /**
2898 * This is a library that contains components apps can dynamically
2899 * load. For example, new widgets, helper classes, etc. This library
2900 * is versioned and backwards compatible. Clients should check its
2901 * version via {@link android.ext.shared.Version#getVersionCode()}
2902 * and avoid calling APIs added in later versions.
2903 *
2904 * @hide
2905 */
2906 public static final String SYSTEM_SHARED_LIBRARY_SHARED = "android.ext.shared";
2907
2908 /**
Brian Carlstromca82e612016-04-19 23:16:08 -07002909 * Used when starting a process for an Activity.
2910 *
2911 * @hide
2912 */
2913 public static final int NOTIFY_PACKAGE_USE_ACTIVITY = 0;
2914
2915 /**
2916 * Used when starting a process for a Service.
2917 *
2918 * @hide
2919 */
2920 public static final int NOTIFY_PACKAGE_USE_SERVICE = 1;
2921
2922 /**
2923 * Used when moving a Service to the foreground.
2924 *
2925 * @hide
2926 */
2927 public static final int NOTIFY_PACKAGE_USE_FOREGROUND_SERVICE = 2;
2928
2929 /**
2930 * Used when starting a process for a BroadcastReceiver.
2931 *
2932 * @hide
2933 */
2934 public static final int NOTIFY_PACKAGE_USE_BROADCAST_RECEIVER = 3;
2935
2936 /**
2937 * Used when starting a process for a ContentProvider.
2938 *
2939 * @hide
2940 */
2941 public static final int NOTIFY_PACKAGE_USE_CONTENT_PROVIDER = 4;
2942
2943 /**
2944 * Used when starting a process for a BroadcastReceiver.
2945 *
2946 * @hide
2947 */
2948 public static final int NOTIFY_PACKAGE_USE_BACKUP = 5;
2949
2950 /**
2951 * Used with Context.getClassLoader() across Android packages.
2952 *
2953 * @hide
2954 */
2955 public static final int NOTIFY_PACKAGE_USE_CROSS_PACKAGE = 6;
2956
2957 /**
2958 * Used when starting a package within a process for Instrumentation.
2959 *
2960 * @hide
2961 */
2962 public static final int NOTIFY_PACKAGE_USE_INSTRUMENTATION = 7;
2963
2964 /**
2965 * Total number of usage reasons.
2966 *
2967 * @hide
2968 */
2969 public static final int NOTIFY_PACKAGE_USE_REASONS_COUNT = 8;
2970
2971 /**
Svet Ganov67882122016-12-11 16:36:34 -08002972 * Constant for specifying the highest installed package version code.
2973 */
2974 public static final int VERSION_CODE_HIGHEST = -1;
2975
Jeff Sharkeyad357d12018-02-02 13:25:31 -07002976 /** {@hide} */
2977 public int getUserId() {
2978 return UserHandle.myUserId();
2979 }
2980
Svet Ganov67882122016-12-11 16:36:34 -08002981 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002982 * Retrieve overall information about an application package that is
2983 * installed on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002984 *
2985 * @param packageName The full name (i.e. com.google.apps.contacts) of the
Jeff Sharkey4347f812017-04-21 12:08:39 -06002986 * desired package.
2987 * @param flags Additional option flags to modify the data returned.
2988 * @return A PackageInfo object containing information about the package. If
2989 * flag {@code MATCH_UNINSTALLED_PACKAGES} is set and if the package
2990 * is not found in the list of installed applications, the package
2991 * information is retrieved from the list of uninstalled
kmccormick30498b42013-03-27 17:39:17 -07002992 * applications (which includes installed applications as well as
2993 * applications with data directory i.e. applications which had been
2994 * deleted with {@code DONT_DELETE_DATA} flag set).
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002995 * @throws NameNotFoundException if a package with the given name cannot be
2996 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002997 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07002998 public abstract PackageInfo getPackageInfo(String packageName, @PackageInfoFlags int flags)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002999 throws NameNotFoundException;
3000
3001 /**
Svet Ganov67882122016-12-11 16:36:34 -08003002 * Retrieve overall information about an application package that is
3003 * installed on the system. This method can be used for retrieving
Jeff Sharkey4347f812017-04-21 12:08:39 -06003004 * information about packages for which multiple versions can be installed
3005 * at the time. Currently only packages hosting static shared libraries can
3006 * have multiple installed versions. The method can also be used to get info
3007 * for a package that has a single version installed by passing
3008 * {@link #VERSION_CODE_HIGHEST} in the {@link VersionedPackage}
Svet Ganov67882122016-12-11 16:36:34 -08003009 * constructor.
3010 *
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003011 * @param versionedPackage The versioned package for which to query.
Jeff Sharkey4347f812017-04-21 12:08:39 -06003012 * @param flags Additional option flags to modify the data returned.
3013 * @return A PackageInfo object containing information about the package. If
3014 * flag {@code MATCH_UNINSTALLED_PACKAGES} is set and if the package
3015 * is not found in the list of installed applications, the package
3016 * information is retrieved from the list of uninstalled
Svet Ganov67882122016-12-11 16:36:34 -08003017 * applications (which includes installed applications as well as
3018 * applications with data directory i.e. applications which had been
3019 * deleted with {@code DONT_DELETE_DATA} flag set).
3020 * @throws NameNotFoundException if a package with the given name cannot be
3021 * found on the system.
Svet Ganov67882122016-12-11 16:36:34 -08003022 */
3023 public abstract PackageInfo getPackageInfo(VersionedPackage versionedPackage,
3024 @PackageInfoFlags int flags) throws NameNotFoundException;
3025
3026 /**
Nicolas Prevot9a80e532015-09-23 15:49:28 +01003027 * Retrieve overall information about an application package that is
3028 * installed on the system.
Nicolas Prevot9a80e532015-09-23 15:49:28 +01003029 *
3030 * @param packageName The full name (i.e. com.google.apps.contacts) of the
Jeff Sharkey4347f812017-04-21 12:08:39 -06003031 * desired package.
3032 * @param flags Additional option flags to modify the data returned.
Nicolas Prevot9a80e532015-09-23 15:49:28 +01003033 * @param userId The user id.
Jeff Sharkey4347f812017-04-21 12:08:39 -06003034 * @return A PackageInfo object containing information about the package. If
3035 * flag {@code MATCH_UNINSTALLED_PACKAGES} is set and if the package
3036 * is not found in the list of installed applications, the package
3037 * information is retrieved from the list of uninstalled
Nicolas Prevot9a80e532015-09-23 15:49:28 +01003038 * applications (which includes installed applications as well as
3039 * applications with data directory i.e. applications which had been
3040 * deleted with {@code DONT_DELETE_DATA} flag set).
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003041 * @throws NameNotFoundException if a package with the given name cannot be
3042 * found on the system.
Svet Ganov67882122016-12-11 16:36:34 -08003043 * @hide
Nicolas Prevot9a80e532015-09-23 15:49:28 +01003044 */
3045 @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS)
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003046 public abstract PackageInfo getPackageInfoAsUser(String packageName,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003047 @PackageInfoFlags int flags, @UserIdInt int userId) throws NameNotFoundException;
Nicolas Prevot9a80e532015-09-23 15:49:28 +01003048
3049 /**
Dianne Hackborn47096932010-02-11 15:57:09 -08003050 * Map from the current package names in use on the device to whatever
3051 * the current canonical name of that package is.
3052 * @param names Array of current names to be mapped.
3053 * @return Returns an array of the same size as the original, containing
3054 * the canonical name for each package.
3055 */
3056 public abstract String[] currentToCanonicalPackageNames(String[] names);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003057
Dianne Hackborn47096932010-02-11 15:57:09 -08003058 /**
3059 * Map from a packages canonical name to the current name in use on the device.
3060 * @param names Array of new names to be mapped.
3061 * @return Returns an array of the same size as the original, containing
3062 * the current name for each package.
3063 */
3064 public abstract String[] canonicalToCurrentPackageNames(String[] names);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003065
Dianne Hackborn47096932010-02-11 15:57:09 -08003066 /**
Andrew Solovay5ae13352014-06-06 12:23:09 -07003067 * Returns a "good" intent to launch a front-door activity in a package.
3068 * This is used, for example, to implement an "open" button when browsing
3069 * through packages. The current implementation looks first for a main
3070 * activity in the category {@link Intent#CATEGORY_INFO}, and next for a
3071 * main activity in the category {@link Intent#CATEGORY_LAUNCHER}. Returns
3072 * <code>null</code> if neither are found.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003073 *
3074 * @param packageName The name of the package to inspect.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003075 *
Andrew Solovay5ae13352014-06-06 12:23:09 -07003076 * @return A fully-qualified {@link Intent} that can be used to launch the
3077 * main activity in the package. Returns <code>null</code> if the package
3078 * does not contain such an activity, or if <em>packageName</em> is not
Ihab Awad1ec68882014-09-12 11:09:01 -07003079 * recognized.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003080 */
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06003081 public abstract @Nullable Intent getLaunchIntentForPackage(@NonNull String packageName);
Mihai Predaeae850c2009-05-13 10:13:48 +02003082
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003083 /**
Jose Lima970417c2014-04-10 10:42:19 -07003084 * Return a "good" intent to launch a front-door Leanback activity in a
3085 * package, for use for example to implement an "open" button when browsing
3086 * through packages. The current implementation will look for a main
3087 * activity in the category {@link Intent#CATEGORY_LEANBACK_LAUNCHER}, or
3088 * return null if no main leanback activities are found.
Adam Connors551c0782014-06-05 12:13:03 +01003089 *
Jose Lima970417c2014-04-10 10:42:19 -07003090 * @param packageName The name of the package to inspect.
3091 * @return Returns either a fully-qualified Intent that can be used to launch
3092 * the main Leanback activity in the package, or null if the package
3093 * does not contain such an activity.
3094 */
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06003095 public abstract @Nullable Intent getLeanbackLaunchIntentForPackage(@NonNull String packageName);
Jose Lima970417c2014-04-10 10:42:19 -07003096
3097 /**
Roberto Perez7ee1a7a2017-12-04 17:14:33 -08003098 * Return a "good" intent to launch a front-door Car activity in a
3099 * package, for use for example to implement an "open" button when browsing
3100 * through packages. The current implementation will look for a main
3101 * activity in the category {@link Intent#CATEGORY_CAR_LAUNCHER}, or
3102 * return null if no main car activities are found.
3103 *
3104 * @param packageName The name of the package to inspect.
3105 * @return Returns either a fully-qualified Intent that can be used to launch
3106 * the main Car activity in the package, or null if the package
3107 * does not contain such an activity.
3108 * @hide
3109 */
3110 public abstract @Nullable Intent getCarLaunchIntentForPackage(@NonNull String packageName);
3111
3112 /**
Jeff Sharkeycf3f0a12016-03-17 19:57:58 -06003113 * Return an array of all of the POSIX secondary group IDs that have been
3114 * assigned to the given package.
3115 * <p>
3116 * Note that the same package may have different GIDs under different
3117 * {@link UserHandle} on the same device.
Adam Connors551c0782014-06-05 12:13:03 +01003118 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003119 * @param packageName The full name (i.e. com.google.apps.contacts) of the
Jeff Sharkeycf3f0a12016-03-17 19:57:58 -06003120 * desired package.
3121 * @return Returns an int array of the assigned GIDs, or null if there are
Jose Lima970417c2014-04-10 10:42:19 -07003122 * none.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003123 * @throws NameNotFoundException if a package with the given name cannot be
3124 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003125 */
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06003126 public abstract int[] getPackageGids(@NonNull String packageName)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003127 throws NameNotFoundException;
3128
3129 /**
Jeff Sharkeycf3f0a12016-03-17 19:57:58 -06003130 * Return an array of all of the POSIX secondary group IDs that have been
3131 * assigned to the given package.
3132 * <p>
3133 * Note that the same package may have different GIDs under different
3134 * {@link UserHandle} on the same device.
Dianne Hackborna06de0f2012-12-11 16:34:47 -08003135 *
3136 * @param packageName The full name (i.e. com.google.apps.contacts) of the
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003137 * desired package.
3138 * @return Returns an int array of the assigned gids, or null if there are
3139 * none.
3140 * @throws NameNotFoundException if a package with the given name cannot be
3141 * found on the system.
Dianne Hackborna06de0f2012-12-11 16:34:47 -08003142 */
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003143 public abstract int[] getPackageGids(String packageName, @PackageInfoFlags int flags)
Dianne Hackborna06de0f2012-12-11 16:34:47 -08003144 throws NameNotFoundException;
3145
3146 /**
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003147 * Return the UID associated with the given package name.
Jeff Sharkeycf3f0a12016-03-17 19:57:58 -06003148 * <p>
3149 * Note that the same package will have different UIDs under different
3150 * {@link UserHandle} on the same device.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003151 *
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003152 * @param packageName The full name (i.e. com.google.apps.contacts) of the
3153 * desired package.
3154 * @return Returns an integer UID who owns the given package name.
3155 * @throws NameNotFoundException if a package with the given name can not be
3156 * found on the system.
3157 */
3158 public abstract int getPackageUid(String packageName, @PackageInfoFlags int flags)
3159 throws NameNotFoundException;
3160
3161 /**
3162 * Return the UID associated with the given package name.
Jeff Sharkeycf3f0a12016-03-17 19:57:58 -06003163 * <p>
3164 * Note that the same package will have different UIDs under different
3165 * {@link UserHandle} on the same device.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003166 *
3167 * @param packageName The full name (i.e. com.google.apps.contacts) of the
3168 * desired package.
3169 * @param userId The user handle identifier to look up the package under.
3170 * @return Returns an integer UID who owns the given package name.
3171 * @throws NameNotFoundException if a package with the given name can not be
3172 * found on the system.
3173 * @hide
3174 */
3175 public abstract int getPackageUidAsUser(String packageName, @UserIdInt int userId)
3176 throws NameNotFoundException;
3177
3178 /**
3179 * Return the UID associated with the given package name.
Jeff Sharkeycf3f0a12016-03-17 19:57:58 -06003180 * <p>
3181 * Note that the same package will have different UIDs under different
3182 * {@link UserHandle} on the same device.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003183 *
3184 * @param packageName The full name (i.e. com.google.apps.contacts) of the
3185 * desired package.
3186 * @param userId The user handle identifier to look up the package under.
3187 * @return Returns an integer UID who owns the given package name.
3188 * @throws NameNotFoundException if a package with the given name can not be
3189 * found on the system.
3190 * @hide
3191 */
3192 public abstract int getPackageUidAsUser(String packageName, @PackageInfoFlags int flags,
3193 @UserIdInt int userId) throws NameNotFoundException;
3194
3195 /**
3196 * Retrieve all of the information we know about a particular permission.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003197 *
3198 * @param name The fully qualified name (i.e. com.google.permission.LOGIN)
Jeff Sharkey4347f812017-04-21 12:08:39 -06003199 * of the permission you are interested in.
3200 * @param flags Additional option flags to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003201 * @return Returns a {@link PermissionInfo} containing information about the
3202 * permission.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003203 * @throws NameNotFoundException if a package with the given name cannot be
3204 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003205 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003206 public abstract PermissionInfo getPermissionInfo(String name, @PermissionInfoFlags int flags)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003207 throws NameNotFoundException;
3208
3209 /**
3210 * Query for all of the permissions associated with a particular group.
3211 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003212 * @param group The fully qualified name (i.e. com.google.permission.LOGIN)
Jeff Sharkey4347f812017-04-21 12:08:39 -06003213 * of the permission group you are interested in. Use null to
3214 * find all of the permissions not associated with a group.
3215 * @param flags Additional option flags to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003216 * @return Returns a list of {@link PermissionInfo} containing information
Jeff Sharkey4347f812017-04-21 12:08:39 -06003217 * about all of the permissions in the given group.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003218 * @throws NameNotFoundException if a package with the given name cannot be
3219 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003220 */
3221 public abstract List<PermissionInfo> queryPermissionsByGroup(String group,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003222 @PermissionInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003223
3224 /**
Paul Navin7b89a7b2017-01-26 23:56:08 +00003225 * Returns true if Permission Review Mode is enabled, false otherwise.
3226 *
3227 * @hide
3228 */
3229 @TestApi
3230 public abstract boolean isPermissionReviewModeEnabled();
3231
3232 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003233 * Retrieve all of the information we know about a particular group of
3234 * permissions.
3235 *
Jeff Sharkey4347f812017-04-21 12:08:39 -06003236 * @param name The fully qualified name (i.e.
3237 * com.google.permission_group.APPS) of the permission you are
3238 * interested in.
3239 * @param flags Additional option flags to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003240 * @return Returns a {@link PermissionGroupInfo} containing information
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003241 * about the permission.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003242 * @throws NameNotFoundException if a package with the given name cannot be
3243 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003244 */
3245 public abstract PermissionGroupInfo getPermissionGroupInfo(String name,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003246 @PermissionGroupInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003247
3248 /**
3249 * Retrieve all of the known permission groups in the system.
3250 *
Jeff Sharkey4347f812017-04-21 12:08:39 -06003251 * @param flags Additional option flags to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003252 * @return Returns a list of {@link PermissionGroupInfo} containing
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003253 * information about all of the known permission groups.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003254 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003255 public abstract List<PermissionGroupInfo> getAllPermissionGroups(
3256 @PermissionGroupInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003257
3258 /**
3259 * Retrieve all of the information we know about a particular
3260 * package/application.
3261 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003262 * @param packageName The full name (i.e. com.google.apps.contacts) of an
Jeff Sharkey4347f812017-04-21 12:08:39 -06003263 * application.
3264 * @param flags Additional option flags to modify the data returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003265 * @return An {@link ApplicationInfo} containing information about the
Jeff Sharkey4347f812017-04-21 12:08:39 -06003266 * package. If flag {@code MATCH_UNINSTALLED_PACKAGES} is set and if
3267 * the package is not found in the list of installed applications,
3268 * the application information is retrieved from the list of
3269 * uninstalled applications (which includes installed applications
3270 * as well as applications with data directory i.e. applications
3271 * which had been deleted with {@code DONT_DELETE_DATA} flag set).
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003272 * @throws NameNotFoundException if a package with the given name cannot be
3273 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003274 */
3275 public abstract ApplicationInfo getApplicationInfo(String packageName,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003276 @ApplicationInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003277
Jeff Sharkeycd654482016-01-08 17:42:11 -07003278 /** {@hide} */
3279 public abstract ApplicationInfo getApplicationInfoAsUser(String packageName,
3280 @ApplicationInfoFlags int flags, @UserIdInt int userId) throws NameNotFoundException;
3281
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003282 /**
3283 * Retrieve all of the information we know about a particular activity
3284 * class.
3285 *
Dianne Hackborn361199b2010-08-30 17:42:07 -07003286 * @param component The full component name (i.e.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003287 * com.google.apps.contacts/com.google.apps.contacts.
3288 * ContactsList) of an Activity class.
Jeff Sharkey4347f812017-04-21 12:08:39 -06003289 * @param flags Additional option flags to modify the data returned.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003290 * @return An {@link ActivityInfo} containing information about the
3291 * activity.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003292 * @throws NameNotFoundException if a package with the given name cannot be
3293 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003294 */
Dianne Hackborn361199b2010-08-30 17:42:07 -07003295 public abstract ActivityInfo getActivityInfo(ComponentName component,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003296 @ComponentInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003297
3298 /**
3299 * Retrieve all of the information we know about a particular receiver
3300 * class.
3301 *
Dianne Hackborn361199b2010-08-30 17:42:07 -07003302 * @param component The full component name (i.e.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003303 * com.google.apps.calendar/com.google.apps.calendar.
3304 * CalendarAlarm) of a Receiver class.
Jeff Sharkey4347f812017-04-21 12:08:39 -06003305 * @param flags Additional option flags to modify the data returned.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003306 * @return An {@link ActivityInfo} containing information about the
3307 * receiver.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003308 * @throws NameNotFoundException if a package with the given name cannot be
3309 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003310 */
Dianne Hackborn361199b2010-08-30 17:42:07 -07003311 public abstract ActivityInfo getReceiverInfo(ComponentName component,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003312 @ComponentInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003313
3314 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003315 * Retrieve all of the information we know about a particular service class.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003316 *
Dianne Hackborn361199b2010-08-30 17:42:07 -07003317 * @param component The full component name (i.e.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003318 * com.google.apps.media/com.google.apps.media.
3319 * BackgroundPlayback) of a Service class.
Jeff Sharkey4347f812017-04-21 12:08:39 -06003320 * @param flags Additional option flags to modify the data returned.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003321 * @return A {@link ServiceInfo} object containing information about the
3322 * service.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003323 * @throws NameNotFoundException if a package with the given name cannot be
3324 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003325 */
Dianne Hackborn361199b2010-08-30 17:42:07 -07003326 public abstract ServiceInfo getServiceInfo(ComponentName component,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003327 @ComponentInfoFlags int flags) throws NameNotFoundException;
Dianne Hackborn361199b2010-08-30 17:42:07 -07003328
3329 /**
3330 * Retrieve all of the information we know about a particular content
3331 * provider class.
3332 *
Dianne Hackborn361199b2010-08-30 17:42:07 -07003333 * @param component The full component name (i.e.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003334 * com.google.providers.media/com.google.providers.media.
3335 * MediaProvider) of a ContentProvider class.
Jeff Sharkey4347f812017-04-21 12:08:39 -06003336 * @param flags Additional option flags to modify the data returned.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003337 * @return A {@link ProviderInfo} object containing information about the
3338 * provider.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003339 * @throws NameNotFoundException if a package with the given name cannot be
3340 * found on the system.
Dianne Hackborn361199b2010-08-30 17:42:07 -07003341 */
3342 public abstract ProviderInfo getProviderInfo(ComponentName component,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003343 @ComponentInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003344
3345 /**
Jeff Sharkey4347f812017-04-21 12:08:39 -06003346 * Return a List of all packages that are installed on the device.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003347 *
Jeff Sharkey4347f812017-04-21 12:08:39 -06003348 * @param flags Additional option flags to modify the data returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003349 * @return A List of PackageInfo objects, one for each installed package,
Jeff Sharkey4347f812017-04-21 12:08:39 -06003350 * containing information about the package. In the unlikely case
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003351 * there are no installed packages, an empty list is returned. If
3352 * flag {@code MATCH_UNINSTALLED_PACKAGES} is set, the package
3353 * information is retrieved from the list of uninstalled
3354 * applications (which includes installed applications as well as
3355 * applications with data directory i.e. applications which had been
3356 * deleted with {@code DONT_DELETE_DATA} flag set).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003357 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003358 public abstract List<PackageInfo> getInstalledPackages(@PackageInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003359
3360 /**
Jeff Sharkey4347f812017-04-21 12:08:39 -06003361 * Return a List of all installed packages that are currently holding any of
3362 * the given permissions.
Dianne Hackborne7991752013-01-16 17:56:46 -08003363 *
Jeff Sharkey4347f812017-04-21 12:08:39 -06003364 * @param flags Additional option flags to modify the data returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003365 * @return A List of PackageInfo objects, one for each installed package
3366 * that holds any of the permissions that were provided, containing
3367 * information about the package. If no installed packages hold any
3368 * of the permissions, an empty list is returned. If flag
Jeff Sharkey4347f812017-04-21 12:08:39 -06003369 * {@code MATCH_UNINSTALLED_PACKAGES} is set, the package
3370 * information is retrieved from the list of uninstalled
3371 * applications (which includes installed applications as well as
3372 * applications with data directory i.e. applications which had been
3373 * deleted with {@code DONT_DELETE_DATA} flag set).
Dianne Hackborne7991752013-01-16 17:56:46 -08003374 */
3375 public abstract List<PackageInfo> getPackagesHoldingPermissions(
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003376 String[] permissions, @PackageInfoFlags int flags);
Dianne Hackborne7991752013-01-16 17:56:46 -08003377
3378 /**
Jeff Sharkey4347f812017-04-21 12:08:39 -06003379 * Return a List of all packages that are installed on the device, for a
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06003380 * specific user.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003381 *
Jeff Sharkey4347f812017-04-21 12:08:39 -06003382 * @param flags Additional option flags to modify the data returned.
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003383 * @param userId The user for whom the installed packages are to be listed
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003384 * @return A List of PackageInfo objects, one for each installed package,
Jeff Sharkey4347f812017-04-21 12:08:39 -06003385 * containing information about the package. In the unlikely case
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003386 * there are no installed packages, an empty list is returned. If
3387 * flag {@code MATCH_UNINSTALLED_PACKAGES} is set, the package
3388 * information is retrieved from the list of uninstalled
3389 * applications (which includes installed applications as well as
3390 * applications with data directory i.e. applications which had been
3391 * deleted with {@code DONT_DELETE_DATA} flag set).
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003392 * @hide
3393 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08003394 @SystemApi
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06003395 @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS_FULL)
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07003396 public abstract List<PackageInfo> getInstalledPackagesAsUser(@PackageInfoFlags int flags,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003397 @UserIdInt int userId);
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003398
3399 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003400 * Check whether a particular package has been granted a particular
3401 * permission.
3402 *
Svet Ganovad3b2972015-07-07 22:49:17 -07003403 * @param permName The name of the permission you are checking for.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003404 * @param pkgName The name of the package you are checking against.
3405 *
3406 * @return If the package has the permission, PERMISSION_GRANTED is
3407 * returned. If it does not have the permission, PERMISSION_DENIED
3408 * is returned.
3409 *
3410 * @see #PERMISSION_GRANTED
3411 * @see #PERMISSION_DENIED
3412 */
Tor Norbye1c2bf032015-03-02 10:57:08 -08003413 @CheckResult
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06003414 public abstract @PermissionResult int checkPermission(String permName, String pkgName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003415
3416 /**
Svet Ganovad3b2972015-07-07 22:49:17 -07003417 * Checks whether a particular permissions has been revoked for a
3418 * package by policy. Typically the device owner or the profile owner
3419 * may apply such a policy. The user cannot grant policy revoked
3420 * permissions, hence the only way for an app to get such a permission
3421 * is by a policy change.
3422 *
3423 * @param permName The name of the permission you are checking for.
3424 * @param pkgName The name of the package you are checking against.
3425 *
3426 * @return Whether the permission is restricted by policy.
3427 */
3428 @CheckResult
Svet Ganovf1b7f202015-07-29 08:33:42 -07003429 public abstract boolean isPermissionRevokedByPolicy(@NonNull String permName,
3430 @NonNull String pkgName);
3431
3432 /**
3433 * Gets the package name of the component controlling runtime permissions.
3434 *
3435 * @return The package name.
3436 *
3437 * @hide
3438 */
Philip P. Moltmanneb0a0ae2017-06-30 10:55:51 -07003439 @TestApi
Svet Ganovf1b7f202015-07-29 08:33:42 -07003440 public abstract String getPermissionControllerPackageName();
Svet Ganovad3b2972015-07-07 22:49:17 -07003441
3442 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003443 * Add a new dynamic permission to the system. For this to work, your
3444 * package must have defined a permission tree through the
3445 * {@link android.R.styleable#AndroidManifestPermissionTree
3446 * &lt;permission-tree&gt;} tag in its manifest. A package can only add
3447 * permissions to trees that were defined by either its own package or
3448 * another with the same user id; a permission is in a tree if it
3449 * matches the name of the permission tree + ".": for example,
3450 * "com.foo.bar" is a member of the permission tree "com.foo".
3451 *
3452 * <p>It is good to make your permission tree name descriptive, because you
3453 * are taking possession of that entire set of permission names. Thus, it
3454 * must be under a domain you control, with a suffix that will not match
3455 * any normal permissions that may be declared in any applications that
3456 * are part of that domain.
3457 *
3458 * <p>New permissions must be added before
3459 * any .apks are installed that use those permissions. Permissions you
3460 * add through this method are remembered across reboots of the device.
3461 * If the given permission already exists, the info you supply here
3462 * will be used to update it.
3463 *
3464 * @param info Description of the permission to be added.
3465 *
3466 * @return Returns true if a new permission was created, false if an
3467 * existing one was updated.
3468 *
3469 * @throws SecurityException if you are not allowed to add the
3470 * given permission name.
3471 *
3472 * @see #removePermission(String)
3473 */
3474 public abstract boolean addPermission(PermissionInfo info);
3475
3476 /**
Dianne Hackbornd7c09682010-03-30 10:42:20 -07003477 * Like {@link #addPermission(PermissionInfo)} but asynchronously
3478 * persists the package manager state after returning from the call,
3479 * allowing it to return quicker and batch a series of adds at the
3480 * expense of no guarantee the added permission will be retained if
3481 * the device is rebooted before it is written.
3482 */
3483 public abstract boolean addPermissionAsync(PermissionInfo info);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003484
Dianne Hackbornd7c09682010-03-30 10:42:20 -07003485 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003486 * Removes a permission that was previously added with
3487 * {@link #addPermission(PermissionInfo)}. The same ownership rules apply
3488 * -- you are only allowed to remove permissions that you are allowed
3489 * to add.
3490 *
3491 * @param name The name of the permission to remove.
3492 *
3493 * @throws SecurityException if you are not allowed to remove the
3494 * given permission name.
3495 *
3496 * @see #addPermission(PermissionInfo)
3497 */
3498 public abstract void removePermission(String name);
3499
Svet Ganov8c7f7002015-05-07 10:48:44 -07003500 /**
3501 * Permission flags set when granting or revoking a permission.
3502 *
3503 * @hide
3504 */
3505 @SystemApi
Jeff Sharkey4347f812017-04-21 12:08:39 -06003506 @IntDef(prefix = { "FLAG_PERMISSION_" }, value = {
3507 FLAG_PERMISSION_USER_SET,
Svet Ganov8c7f7002015-05-07 10:48:44 -07003508 FLAG_PERMISSION_USER_FIXED,
3509 FLAG_PERMISSION_POLICY_FIXED,
Svet Ganovb3f22b42015-05-12 11:01:24 -07003510 FLAG_PERMISSION_REVOKE_ON_UPGRADE,
Svet Ganov77ab6a82015-07-03 12:03:02 -07003511 FLAG_PERMISSION_SYSTEM_FIXED,
Jeff Sharkey4347f812017-04-21 12:08:39 -06003512 FLAG_PERMISSION_GRANTED_BY_DEFAULT
3513 })
Svet Ganov8c7f7002015-05-07 10:48:44 -07003514 @Retention(RetentionPolicy.SOURCE)
3515 public @interface PermissionFlags {}
3516
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003517 /**
Svetoslavc6d1c342015-02-26 14:44:43 -08003518 * Grant a runtime permission to an application which the application does not
3519 * already have. The permission must have been requested by the application.
3520 * If the application is not allowed to hold the permission, a {@link
Ruben Brunk12ab5e12016-11-10 15:27:30 -08003521 * java.lang.SecurityException} is thrown. If the package or permission is
3522 * invalid, a {@link java.lang.IllegalArgumentException} is thrown.
Svetoslavc6d1c342015-02-26 14:44:43 -08003523 * <p>
3524 * <strong>Note: </strong>Using this API requires holding
Todd Kennedya8eb6a82016-07-28 16:35:42 -07003525 * android.permission.GRANT_RUNTIME_PERMISSIONS and if the user id is
Svetoslavc6d1c342015-02-26 14:44:43 -08003526 * not the current user android.permission.INTERACT_ACROSS_USERS_FULL.
3527 * </p>
Nick Kralevich035f80d2013-03-27 15:20:08 -07003528 *
Svetoslavc6d1c342015-02-26 14:44:43 -08003529 * @param packageName The package to which to grant the permission.
3530 * @param permissionName The permission name to grant.
3531 * @param user The user for which to grant the permission.
3532 *
Svet Ganov8c7f7002015-05-07 10:48:44 -07003533 * @see #revokeRuntimePermission(String, String, android.os.UserHandle)
Svetoslavc6d1c342015-02-26 14:44:43 -08003534 *
3535 * @hide
Nick Kralevich035f80d2013-03-27 15:20:08 -07003536 */
Svetoslavc6d1c342015-02-26 14:44:43 -08003537 @SystemApi
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06003538 @RequiresPermission(android.Manifest.permission.GRANT_RUNTIME_PERMISSIONS)
Svet Ganov8c7f7002015-05-07 10:48:44 -07003539 public abstract void grantRuntimePermission(@NonNull String packageName,
Svetoslavc6d1c342015-02-26 14:44:43 -08003540 @NonNull String permissionName, @NonNull UserHandle user);
Nick Kralevich035f80d2013-03-27 15:20:08 -07003541
Svetoslavc6d1c342015-02-26 14:44:43 -08003542 /**
3543 * Revoke a runtime permission that was previously granted by {@link
Svet Ganov8c7f7002015-05-07 10:48:44 -07003544 * #grantRuntimePermission(String, String, android.os.UserHandle)}. The
3545 * permission must have been requested by and granted to the application.
3546 * If the application is not allowed to hold the permission, a {@link
Ruben Brunk12ab5e12016-11-10 15:27:30 -08003547 * java.lang.SecurityException} is thrown. If the package or permission is
3548 * invalid, a {@link java.lang.IllegalArgumentException} is thrown.
Svetoslavc6d1c342015-02-26 14:44:43 -08003549 * <p>
3550 * <strong>Note: </strong>Using this API requires holding
Todd Kennedya8eb6a82016-07-28 16:35:42 -07003551 * android.permission.REVOKE_RUNTIME_PERMISSIONS and if the user id is
Svetoslavc6d1c342015-02-26 14:44:43 -08003552 * not the current user android.permission.INTERACT_ACROSS_USERS_FULL.
3553 * </p>
3554 *
3555 * @param packageName The package from which to revoke the permission.
3556 * @param permissionName The permission name to revoke.
3557 * @param user The user for which to revoke the permission.
3558 *
Svet Ganov8c7f7002015-05-07 10:48:44 -07003559 * @see #grantRuntimePermission(String, String, android.os.UserHandle)
Svetoslavc6d1c342015-02-26 14:44:43 -08003560 *
3561 * @hide
3562 */
3563 @SystemApi
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06003564 @RequiresPermission(android.Manifest.permission.REVOKE_RUNTIME_PERMISSIONS)
Svet Ganov8c7f7002015-05-07 10:48:44 -07003565 public abstract void revokeRuntimePermission(@NonNull String packageName,
Svetoslavc6d1c342015-02-26 14:44:43 -08003566 @NonNull String permissionName, @NonNull UserHandle user);
3567
3568 /**
Svet Ganov8c7f7002015-05-07 10:48:44 -07003569 * Gets the state flags associated with a permission.
3570 *
3571 * @param permissionName The permission for which to get the flags.
3572 * @param packageName The package name for which to get the flags.
3573 * @param user The user for which to get permission flags.
3574 * @return The permission flags.
3575 *
3576 * @hide
3577 */
3578 @SystemApi
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06003579 @RequiresPermission(anyOf = {
3580 android.Manifest.permission.GRANT_RUNTIME_PERMISSIONS,
3581 android.Manifest.permission.REVOKE_RUNTIME_PERMISSIONS
3582 })
Svet Ganov8c7f7002015-05-07 10:48:44 -07003583 public abstract @PermissionFlags int getPermissionFlags(String permissionName,
3584 String packageName, @NonNull UserHandle user);
3585
3586 /**
3587 * Updates the flags associated with a permission by replacing the flags in
3588 * the specified mask with the provided flag values.
3589 *
3590 * @param permissionName The permission for which to update the flags.
3591 * @param packageName The package name for which to update the flags.
3592 * @param flagMask The flags which to replace.
3593 * @param flagValues The flags with which to replace.
3594 * @param user The user for which to update the permission flags.
3595 *
3596 * @hide
3597 */
3598 @SystemApi
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06003599 @RequiresPermission(anyOf = {
3600 android.Manifest.permission.GRANT_RUNTIME_PERMISSIONS,
3601 android.Manifest.permission.REVOKE_RUNTIME_PERMISSIONS
3602 })
Svet Ganov8c7f7002015-05-07 10:48:44 -07003603 public abstract void updatePermissionFlags(String permissionName,
Jeff Sharkey4347f812017-04-21 12:08:39 -06003604 String packageName, @PermissionFlags int flagMask, @PermissionFlags int flagValues,
Svet Ganov8c7f7002015-05-07 10:48:44 -07003605 @NonNull UserHandle user);
3606
3607 /**
Svetoslav20770dd2015-05-29 15:43:04 -07003608 * Gets whether you should show UI with rationale for requesting a permission.
3609 * You should do this only if you do not have the permission and the context in
3610 * which the permission is requested does not clearly communicate to the user
3611 * what would be the benefit from grating this permission.
3612 *
3613 * @param permission A permission your app wants to request.
3614 * @return Whether you can show permission rationale UI.
3615 *
3616 * @hide
3617 */
3618 public abstract boolean shouldShowRequestPermissionRationale(String permission);
3619
3620 /**
Svetoslavc6d1c342015-02-26 14:44:43 -08003621 * Returns an {@link android.content.Intent} suitable for passing to
3622 * {@link android.app.Activity#startActivityForResult(android.content.Intent, int)}
3623 * which prompts the user to grant permissions to this application.
3624 *
3625 * @throws NullPointerException if {@code permissions} is {@code null} or empty.
3626 *
3627 * @hide
3628 */
3629 public Intent buildRequestPermissionsIntent(@NonNull String[] permissions) {
3630 if (ArrayUtils.isEmpty(permissions)) {
Svet Ganovf66381c2016-02-18 20:02:36 -08003631 throw new IllegalArgumentException("permission cannot be null or empty");
Svetoslavc6d1c342015-02-26 14:44:43 -08003632 }
3633 Intent intent = new Intent(ACTION_REQUEST_PERMISSIONS);
3634 intent.putExtra(EXTRA_REQUEST_PERMISSIONS_NAMES, permissions);
Svet Ganovf1b7f202015-07-29 08:33:42 -07003635 intent.setPackage(getPermissionControllerPackageName());
Svetoslavc6d1c342015-02-26 14:44:43 -08003636 return intent;
Nick Kralevich035f80d2013-03-27 15:20:08 -07003637 }
3638
3639 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003640 * Compare the signatures of two packages to determine if the same
3641 * signature appears in both of them. If they do contain the same
3642 * signature, then they are allowed special privileges when working
3643 * with each other: they can share the same user-id, run instrumentation
3644 * against each other, etc.
3645 *
3646 * @param pkg1 First package name whose signature will be compared.
3647 * @param pkg2 Second package name whose signature will be compared.
Chris Palmer09f33602010-09-13 14:27:18 -07003648 *
3649 * @return Returns an integer indicating whether all signatures on the
3650 * two packages match. The value is >= 0 ({@link #SIGNATURE_MATCH}) if
3651 * all signatures match or < 0 if there is not a match ({@link
3652 * #SIGNATURE_NO_MATCH} or {@link #SIGNATURE_UNKNOWN_PACKAGE}).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003653 *
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07003654 * @see #checkSignatures(int, int)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003655 */
Tor Norbye1c2bf032015-03-02 10:57:08 -08003656 @CheckResult
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06003657 public abstract @SignatureResult int checkSignatures(String pkg1, String pkg2);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003658
3659 /**
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07003660 * Like {@link #checkSignatures(String, String)}, but takes UIDs of
3661 * the two packages to be checked. This can be useful, for example,
3662 * when doing the check in an IPC, where the UID is the only identity
3663 * available. It is functionally identical to determining the package
3664 * associated with the UIDs and checking their signatures.
3665 *
Joe Onorato25660ec2009-08-12 22:40:37 -07003666 * @param uid1 First UID whose signature will be compared.
3667 * @param uid2 Second UID whose signature will be compared.
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07003668 *
Chris Palmer09f33602010-09-13 14:27:18 -07003669 * @return Returns an integer indicating whether all signatures on the
3670 * two packages match. The value is >= 0 ({@link #SIGNATURE_MATCH}) if
3671 * all signatures match or < 0 if there is not a match ({@link
3672 * #SIGNATURE_NO_MATCH} or {@link #SIGNATURE_UNKNOWN_PACKAGE}).
3673 *
3674 * @see #checkSignatures(String, String)
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07003675 */
Tor Norbye1c2bf032015-03-02 10:57:08 -08003676 @CheckResult
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06003677 public abstract @SignatureResult int checkSignatures(int uid1, int uid2);
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07003678
3679 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003680 * Retrieve the names of all packages that are associated with a particular
3681 * user id. In most cases, this will be a single package name, the package
3682 * that has been assigned that user id. Where there are multiple packages
3683 * sharing the same user id through the "sharedUserId" mechanism, all
3684 * packages with that id will be returned.
3685 *
3686 * @param uid The user id for which you would like to retrieve the
3687 * associated packages.
3688 *
3689 * @return Returns an array of one or more packages assigned to the user
3690 * id, or null if there are no known packages with the given id.
3691 */
Jeff Sharkey377ded0f2016-01-10 13:15:41 -07003692 public abstract @Nullable String[] getPackagesForUid(int uid);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003693
3694 /**
Michal Karpinskicb67dc92016-12-13 18:20:23 +00003695 * Retrieve the official name associated with a uid. This name is
Jonathan Basseri7ea3a332015-05-12 19:39:22 -07003696 * guaranteed to never change, though it is possible for the underlying
Michal Karpinskicb67dc92016-12-13 18:20:23 +00003697 * uid to be changed. That is, if you are storing information about
3698 * uids in persistent storage, you should use the string returned
3699 * by this function instead of the raw uid.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003700 *
Michal Karpinskicb67dc92016-12-13 18:20:23 +00003701 * @param uid The uid for which you would like to retrieve a name.
3702 * @return Returns a unique name for the given uid, or null if the
3703 * uid is not currently assigned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003704 */
Jeff Sharkey377ded0f2016-01-10 13:15:41 -07003705 public abstract @Nullable String getNameForUid(int uid);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003706
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003707 /**
Todd Kennedy9da8b8a72017-07-25 15:38:39 -07003708 * Retrieves the official names associated with each given uid.
3709 * @see #getNameForUid(int)
3710 *
3711 * @hide
3712 */
3713 public abstract @Nullable String[] getNamesForUids(int[] uids);
3714
3715 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003716 * Return the user id associated with a shared user name. Multiple
3717 * applications can specify a shared user name in their manifest and thus
3718 * end up using a common uid. This might be used for new applications
3719 * that use an existing shared user name and need to know the uid of the
3720 * shared user.
3721 *
3722 * @param sharedUserName The shared user name whose uid is to be retrieved.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003723 * @return Returns the UID associated with the shared user.
3724 * @throws NameNotFoundException if a package with the given name cannot be
3725 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003726 * @hide
3727 */
3728 public abstract int getUidForSharedUser(String sharedUserName)
3729 throws NameNotFoundException;
3730
3731 /**
3732 * Return a List of all application packages that are installed on the
3733 * device. If flag GET_UNINSTALLED_PACKAGES has been set, a list of all
Jeff Sharkey4347f812017-04-21 12:08:39 -06003734 * applications including those deleted with {@code DONT_DELETE_DATA}
3735 * (partially installed apps with data directory) will be returned.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003736 *
Jeff Sharkey4347f812017-04-21 12:08:39 -06003737 * @param flags Additional option flags to modify the data returned.
3738 * @return A List of ApplicationInfo objects, one for each installed
3739 * application. In the unlikely case there are no installed
3740 * packages, an empty list is returned. If flag
3741 * {@code MATCH_UNINSTALLED_PACKAGES} is set, the application
3742 * information is retrieved from the list of uninstalled
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003743 * applications (which includes installed applications as well as
3744 * applications with data directory i.e. applications which had been
3745 * deleted with {@code DONT_DELETE_DATA} flag set).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003746 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003747 public abstract List<ApplicationInfo> getInstalledApplications(@ApplicationInfoFlags int flags);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003748
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003749 /**
Jeff Sharkey4347f812017-04-21 12:08:39 -06003750 * Return a List of all application packages that are installed on the
3751 * device, for a specific user. If flag GET_UNINSTALLED_PACKAGES has been
3752 * set, a list of all applications including those deleted with
3753 * {@code DONT_DELETE_DATA} (partially installed apps with data directory)
Bartosz Fabianowski11334242016-11-17 20:49:16 +01003754 * will be returned.
3755 *
Jeff Sharkey4347f812017-04-21 12:08:39 -06003756 * @param flags Additional option flags to modify the data returned.
3757 * @param userId The user for whom the installed applications are to be
3758 * listed
3759 * @return A List of ApplicationInfo objects, one for each installed
3760 * application. In the unlikely case there are no installed
3761 * packages, an empty list is returned. If flag
3762 * {@code MATCH_UNINSTALLED_PACKAGES} is set, the application
3763 * information is retrieved from the list of uninstalled
Bartosz Fabianowski11334242016-11-17 20:49:16 +01003764 * applications (which includes installed applications as well as
3765 * applications with data directory i.e. applications which had been
3766 * deleted with {@code DONT_DELETE_DATA} flag set).
3767 * @hide
Bartosz Fabianowski11334242016-11-17 20:49:16 +01003768 */
3769 public abstract List<ApplicationInfo> getInstalledApplicationsAsUser(
3770 @ApplicationInfoFlags int flags, @UserIdInt int userId);
3771
3772 /**
Jeff Sharkey910e0812017-04-21 16:29:27 -06003773 * Gets the instant applications the user recently used.
Svet Ganov2acf0632015-11-24 19:10:59 -08003774 *
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003775 * @return The instant app list.
Svet Ganov2acf0632015-11-24 19:10:59 -08003776 *
3777 * @hide
3778 */
Todd Kennedy9c9fdf22017-03-06 10:58:27 -08003779 @SystemApi
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003780 @RequiresPermission(Manifest.permission.ACCESS_INSTANT_APPS)
3781 public abstract @NonNull List<InstantAppInfo> getInstantApps();
Svet Ganov2acf0632015-11-24 19:10:59 -08003782
3783 /**
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003784 * Gets the icon for an instant application.
Svet Ganov2acf0632015-11-24 19:10:59 -08003785 *
3786 * @param packageName The app package name.
3787 *
3788 * @hide
3789 */
Todd Kennedy9c9fdf22017-03-06 10:58:27 -08003790 @SystemApi
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003791 @RequiresPermission(Manifest.permission.ACCESS_INSTANT_APPS)
3792 public abstract @Nullable Drawable getInstantAppIcon(String packageName);
Svet Ganov2acf0632015-11-24 19:10:59 -08003793
3794 /**
David Christie31a16552017-03-01 15:08:45 -08003795 * Gets whether this application is an instant app.
Svet Ganov2acf0632015-11-24 19:10:59 -08003796 *
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003797 * @return Whether caller is an instant app.
Svet Ganov2acf0632015-11-24 19:10:59 -08003798 *
David Christie31a16552017-03-01 15:08:45 -08003799 * @see #isInstantApp(String)
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003800 * @see #updateInstantAppCookie(byte[])
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003801 * @see #getInstantAppCookie()
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003802 * @see #getInstantAppCookieMaxBytes()
Svet Ganov2acf0632015-11-24 19:10:59 -08003803 */
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003804 public abstract boolean isInstantApp();
Svet Ganov2acf0632015-11-24 19:10:59 -08003805
3806 /**
David Christie31a16552017-03-01 15:08:45 -08003807 * Gets whether the given package is an instant app.
3808 *
3809 * @param packageName The package to check
3810 * @return Whether the given package is an instant app.
3811 *
3812 * @see #isInstantApp()
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003813 * @see #updateInstantAppCookie(byte[])
David Christie31a16552017-03-01 15:08:45 -08003814 * @see #getInstantAppCookie()
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003815 * @see #getInstantAppCookieMaxBytes()
3816 * @see #clearInstantAppCookie()
David Christie31a16552017-03-01 15:08:45 -08003817 */
3818 public abstract boolean isInstantApp(String packageName);
3819
3820 /**
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003821 * Gets the maximum size in bytes of the cookie data an instant app
Svet Ganov2acf0632015-11-24 19:10:59 -08003822 * can store on the device.
3823 *
3824 * @return The max cookie size in bytes.
3825 *
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003826 * @see #isInstantApp()
David Christie31a16552017-03-01 15:08:45 -08003827 * @see #isInstantApp(String)
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003828 * @see #updateInstantAppCookie(byte[])
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003829 * @see #getInstantAppCookie()
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003830 * @see #clearInstantAppCookie()
3831 */
3832 public abstract int getInstantAppCookieMaxBytes();
3833
3834 /**
Daniel Cashman5cdda342018-01-19 07:22:52 -08003835 * deprecated
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003836 * @hide
Svet Ganov2acf0632015-11-24 19:10:59 -08003837 */
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003838 public abstract int getInstantAppCookieMaxSize();
Svet Ganov2acf0632015-11-24 19:10:59 -08003839
3840 /**
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003841 * Gets the instant application cookie for this app. Non
3842 * instant apps and apps that were instant but were upgraded
3843 * to normal apps can still access this API. For instant apps
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003844 * this cookie is cached for some time after uninstall while for
Svet Ganov2acf0632015-11-24 19:10:59 -08003845 * normal apps the cookie is deleted after the app is uninstalled.
3846 * The cookie is always present while the app is installed.
3847 *
3848 * @return The cookie.
3849 *
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003850 * @see #isInstantApp()
David Christie31a16552017-03-01 15:08:45 -08003851 * @see #isInstantApp(String)
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003852 * @see #updateInstantAppCookie(byte[])
3853 * @see #getInstantAppCookieMaxBytes()
3854 * @see #clearInstantAppCookie()
Svet Ganov2acf0632015-11-24 19:10:59 -08003855 */
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003856 public abstract @NonNull byte[] getInstantAppCookie();
Svet Ganov2acf0632015-11-24 19:10:59 -08003857
3858 /**
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003859 * Clears the instant application cookie for the calling app.
Svet Ganov2acf0632015-11-24 19:10:59 -08003860 *
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003861 * @see #isInstantApp()
David Christie31a16552017-03-01 15:08:45 -08003862 * @see #isInstantApp(String)
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003863 * @see #getInstantAppCookieMaxBytes()
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003864 * @see #getInstantAppCookie()
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003865 * @see #clearInstantAppCookie()
3866 */
3867 public abstract void clearInstantAppCookie();
3868
3869 /**
3870 * Updates the instant application cookie for the calling app. Non
3871 * instant apps and apps that were instant but were upgraded
3872 * to normal apps can still access this API. For instant apps
3873 * this cookie is cached for some time after uninstall while for
3874 * normal apps the cookie is deleted after the app is uninstalled.
3875 * The cookie is always present while the app is installed. The
3876 * cookie size is limited by {@link #getInstantAppCookieMaxBytes()}.
3877 * Passing <code>null</code> or an empty array clears the cookie.
3878 * </p>
3879 *
3880 * @param cookie The cookie data.
3881 *
3882 * @see #isInstantApp()
3883 * @see #isInstantApp(String)
3884 * @see #getInstantAppCookieMaxBytes()
3885 * @see #getInstantAppCookie()
3886 * @see #clearInstantAppCookie()
3887 *
3888 * @throws IllegalArgumentException if the array exceeds max cookie size.
3889 */
3890 public abstract void updateInstantAppCookie(@Nullable byte[] cookie);
3891
3892 /**
3893 * @removed
Svet Ganov2acf0632015-11-24 19:10:59 -08003894 */
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003895 public abstract boolean setInstantAppCookie(@Nullable byte[] cookie);
Svet Ganov2acf0632015-11-24 19:10:59 -08003896
3897 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003898 * Get a list of shared libraries that are available on the
3899 * system.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003900 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003901 * @return An array of shared library names that are
3902 * available on the system, or null if none are installed.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003903 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003904 */
3905 public abstract String[] getSystemSharedLibraryNames();
3906
3907 /**
Svet Ganov67882122016-12-11 16:36:34 -08003908 * Get a list of shared libraries on the device.
3909 *
3910 * @param flags To filter the libraries to return.
3911 * @return The shared library list.
3912 *
Svet Ganov67882122016-12-11 16:36:34 -08003913 * @see #MATCH_UNINSTALLED_PACKAGES
3914 */
3915 public abstract @NonNull List<SharedLibraryInfo> getSharedLibraries(
3916 @InstallFlags int flags);
3917
3918 /**
3919 * Get a list of shared libraries on the device.
3920 *
3921 * @param flags To filter the libraries to return.
3922 * @param userId The user to query for.
3923 * @return The shared library list.
3924 *
3925 * @see #MATCH_FACTORY_ONLY
3926 * @see #MATCH_KNOWN_PACKAGES
3927 * @see #MATCH_ANY_USER
3928 * @see #MATCH_UNINSTALLED_PACKAGES
3929 *
3930 * @hide
3931 */
3932 public abstract @NonNull List<SharedLibraryInfo> getSharedLibrariesAsUser(
3933 @InstallFlags int flags, @UserIdInt int userId);
3934
3935 /**
Svet Ganovd7b1f4112016-02-09 18:49:23 -08003936 * Get the name of the package hosting the services shared library.
3937 *
3938 * @return The library host package.
3939 *
3940 * @hide
3941 */
Svetoslav Ganova9c25002016-04-13 19:25:56 -07003942 public abstract @NonNull String getServicesSystemSharedLibraryPackageName();
3943
3944 /**
3945 * Get the name of the package hosting the shared components shared library.
3946 *
3947 * @return The library host package.
3948 *
3949 * @hide
3950 */
3951 public abstract @NonNull String getSharedSystemSharedLibraryPackageName();
Svet Ganovd7b1f4112016-02-09 18:49:23 -08003952
3953 /**
Todd Kennedy9106c642017-02-08 14:16:53 -08003954 * Returns the names of the packages that have been changed
3955 * [eg. added, removed or updated] since the given sequence
3956 * number.
3957 * <p>If no packages have been changed, returns <code>null</code>.
3958 * <p>The sequence number starts at <code>0</code> and is
3959 * reset every boot.
Todd Kennedy8fddf9d2017-04-17 15:16:12 -07003960 * @param sequenceNumber The first sequence number for which to retrieve package changes.
3961 * @see Settings.Global#BOOT_COUNT
Todd Kennedy9106c642017-02-08 14:16:53 -08003962 */
3963 public abstract @Nullable ChangedPackages getChangedPackages(
3964 @IntRange(from=0) int sequenceNumber);
3965
3966 /**
Dianne Hackborn49237342009-08-27 20:08:01 -07003967 * Get a list of features that are available on the
3968 * system.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003969 *
Dianne Hackborn49237342009-08-27 20:08:01 -07003970 * @return An array of FeatureInfo classes describing the features
3971 * that are available on the system, or null if there are none(!!).
Dianne Hackborn49237342009-08-27 20:08:01 -07003972 */
3973 public abstract FeatureInfo[] getSystemAvailableFeatures();
3974
3975 /**
Jeff Sharkey115d2c12016-02-15 17:25:57 -07003976 * Check whether the given feature name is one of the available features as
3977 * returned by {@link #getSystemAvailableFeatures()}. This tests for the
3978 * presence of <em>any</em> version of the given feature name; use
3979 * {@link #hasSystemFeature(String, int)} to check for a minimum version.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003980 *
Jeff Sharkey115d2c12016-02-15 17:25:57 -07003981 * @return Returns true if the devices supports the feature, else false.
Dianne Hackborn039c68e2009-09-26 16:39:23 -07003982 */
3983 public abstract boolean hasSystemFeature(String name);
3984
3985 /**
Jeff Sharkey115d2c12016-02-15 17:25:57 -07003986 * Check whether the given feature name and version is one of the available
3987 * features as returned by {@link #getSystemAvailableFeatures()}. Since
3988 * features are defined to always be backwards compatible, this returns true
3989 * if the available feature version is greater than or equal to the
3990 * requested version.
3991 *
3992 * @return Returns true if the devices supports the feature, else false.
3993 */
3994 public abstract boolean hasSystemFeature(String name, int version);
3995
3996 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003997 * Determine the best action to perform for a given Intent. This is how
3998 * {@link Intent#resolveActivity} finds an activity if a class has not been
3999 * explicitly specified.
4000 * <p>
4001 * <em>Note:</em> if using an implicit Intent (without an explicit
4002 * ComponentName specified), be sure to consider whether to set the
4003 * {@link #MATCH_DEFAULT_ONLY} only flag. You need to do so to resolve the
4004 * activity in the same way that
4005 * {@link android.content.Context#startActivity(Intent)} and
Dianne Hackborn4d023d212010-10-01 13:41:04 -07004006 * {@link android.content.Intent#resolveActivity(PackageManager)
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004007 * Intent.resolveActivity(PackageManager)} do.
4008 * </p>
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004009 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004010 * @param intent An intent containing all of the desired specification
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004011 * (action, data, type, category, and/or component).
Jeff Sharkey4347f812017-04-21 12:08:39 -06004012 * @param flags Additional option flags to modify the data returned. The
4013 * most important is {@link #MATCH_DEFAULT_ONLY}, to limit the
4014 * resolution to only those activities that support the
4015 * {@link android.content.Intent#CATEGORY_DEFAULT}.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004016 * @return Returns a ResolveInfo object containing the final activity intent
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004017 * that was determined to be the best action. Returns null if no
Mike LeBeaubd3f5272010-02-18 19:27:17 -08004018 * matching activity was found. If multiple matching activities are
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004019 * found and there is no default set, returns a ResolveInfo object
Mike LeBeaubd3f5272010-02-18 19:27:17 -08004020 * containing something else, such as the activity resolver.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004021 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004022 public abstract ResolveInfo resolveActivity(Intent intent, @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004023
4024 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004025 * Determine the best action to perform for a given Intent for a given user.
4026 * This is how {@link Intent#resolveActivity} finds an activity if a class
4027 * has not been explicitly specified.
4028 * <p>
4029 * <em>Note:</em> if using an implicit Intent (without an explicit
4030 * ComponentName specified), be sure to consider whether to set the
4031 * {@link #MATCH_DEFAULT_ONLY} only flag. You need to do so to resolve the
4032 * activity in the same way that
4033 * {@link android.content.Context#startActivity(Intent)} and
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004034 * {@link android.content.Intent#resolveActivity(PackageManager)
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004035 * Intent.resolveActivity(PackageManager)} do.
4036 * </p>
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004037 *
4038 * @param intent An intent containing all of the desired specification
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004039 * (action, data, type, category, and/or component).
Jeff Sharkey4347f812017-04-21 12:08:39 -06004040 * @param flags Additional option flags to modify the data returned. The
4041 * most important is {@link #MATCH_DEFAULT_ONLY}, to limit the
4042 * resolution to only those activities that support the
4043 * {@link android.content.Intent#CATEGORY_DEFAULT}.
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004044 * @param userId The user id.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004045 * @return Returns a ResolveInfo object containing the final activity intent
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004046 * that was determined to be the best action. Returns null if no
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004047 * matching activity was found. If multiple matching activities are
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004048 * found and there is no default set, returns a ResolveInfo object
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004049 * containing something else, such as the activity resolver.
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004050 * @hide
4051 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004052 public abstract ResolveInfo resolveActivityAsUser(Intent intent, @ResolveInfoFlags int flags,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004053 @UserIdInt int userId);
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004054
4055 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004056 * Retrieve all activities that can be performed for the given intent.
4057 *
4058 * @param intent The desired intent as per resolveActivity().
Jeff Sharkey4347f812017-04-21 12:08:39 -06004059 * @param flags Additional option flags to modify the data returned. The
4060 * most important is {@link #MATCH_DEFAULT_ONLY}, to limit the
4061 * resolution to only those activities that support the
4062 * {@link android.content.Intent#CATEGORY_DEFAULT}. Or, set
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004063 * {@link #MATCH_ALL} to prevent any filtering of the results.
4064 * @return Returns a List of ResolveInfo objects containing one entry for
4065 * each matching activity, ordered from best to worst. In other
4066 * words, the first item is what would be returned by
4067 * {@link #resolveActivity}. If there are no matching activities, an
4068 * empty list is returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004069 */
4070 public abstract List<ResolveInfo> queryIntentActivities(Intent intent,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004071 @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004072
4073 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004074 * Retrieve all activities that can be performed for the given intent, for a
4075 * specific user.
Amith Yamasani151ec4c2012-09-07 19:25:16 -07004076 *
4077 * @param intent The desired intent as per resolveActivity().
Jeff Sharkey4347f812017-04-21 12:08:39 -06004078 * @param flags Additional option flags to modify the data returned. The
4079 * most important is {@link #MATCH_DEFAULT_ONLY}, to limit the
4080 * resolution to only those activities that support the
4081 * {@link android.content.Intent#CATEGORY_DEFAULT}. Or, set
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004082 * {@link #MATCH_ALL} to prevent any filtering of the results.
4083 * @return Returns a List of ResolveInfo objects containing one entry for
4084 * each matching activity, ordered from best to worst. In other
4085 * words, the first item is what would be returned by
4086 * {@link #resolveActivity}. If there are no matching activities, an
4087 * empty list is returned.
Amith Yamasani151ec4c2012-09-07 19:25:16 -07004088 * @hide
4089 */
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004090 public abstract List<ResolveInfo> queryIntentActivitiesAsUser(Intent intent,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004091 @ResolveInfoFlags int flags, @UserIdInt int userId);
Amith Yamasani151ec4c2012-09-07 19:25:16 -07004092
4093 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004094 * Retrieve a set of activities that should be presented to the user as
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004095 * similar options. This is like {@link #queryIntentActivities}, except it
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004096 * also allows you to supply a list of more explicit Intents that you would
4097 * like to resolve to particular options, and takes care of returning the
4098 * final ResolveInfo list in a reasonable order, with no duplicates, based
4099 * on those inputs.
4100 *
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004101 * @param caller The class name of the activity that is making the request.
4102 * This activity will never appear in the output list. Can be
4103 * null.
4104 * @param specifics An array of Intents that should be resolved to the first
4105 * specific results. Can be null.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004106 * @param intent The desired intent as per resolveActivity().
Jeff Sharkey4347f812017-04-21 12:08:39 -06004107 * @param flags Additional option flags to modify the data returned. The
4108 * most important is {@link #MATCH_DEFAULT_ONLY}, to limit the
4109 * resolution to only those activities that support the
4110 * {@link android.content.Intent#CATEGORY_DEFAULT}.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004111 * @return Returns a List of ResolveInfo objects containing one entry for
4112 * each matching activity. The list is ordered first by all of the
4113 * intents resolved in <var>specifics</var> and then any additional
4114 * activities that can handle <var>intent</var> but did not get
4115 * included by one of the <var>specifics</var> intents. If there are
4116 * no matching activities, an empty list is returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004117 */
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06004118 public abstract List<ResolveInfo> queryIntentActivityOptions(@Nullable ComponentName caller,
4119 @Nullable Intent[] specifics, Intent intent, @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004120
4121 /**
4122 * Retrieve all receivers that can handle a broadcast of the given intent.
4123 *
4124 * @param intent The desired intent as per resolveActivity().
Jeff Sharkey4347f812017-04-21 12:08:39 -06004125 * @param flags Additional option flags to modify the data returned.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004126 * @return Returns a List of ResolveInfo objects containing one entry for
4127 * each matching receiver, ordered from best to worst. If there are
4128 * no matching receivers, an empty list or null is returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004129 */
4130 public abstract List<ResolveInfo> queryBroadcastReceivers(Intent intent,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004131 @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004132
4133 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004134 * Retrieve all receivers that can handle a broadcast of the given intent,
4135 * for a specific user.
Amith Yamasanif203aee2012-08-29 18:41:53 -07004136 *
4137 * @param intent The desired intent as per resolveActivity().
Jeff Sharkey4347f812017-04-21 12:08:39 -06004138 * @param flags Additional option flags to modify the data returned.
Fyodor Kupolov940e8572016-01-26 12:03:51 -08004139 * @param userHandle UserHandle of the user being queried.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004140 * @return Returns a List of ResolveInfo objects containing one entry for
4141 * each matching receiver, ordered from best to worst. If there are
4142 * no matching receivers, an empty list or null is returned.
Amith Yamasanif203aee2012-08-29 18:41:53 -07004143 * @hide
4144 */
Fyodor Kupolov940e8572016-01-26 12:03:51 -08004145 @SystemApi
Todd Kennedydbaef6d2017-07-24 11:28:00 -07004146 @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS)
Fyodor Kupolov940e8572016-01-26 12:03:51 -08004147 public List<ResolveInfo> queryBroadcastReceiversAsUser(Intent intent,
4148 @ResolveInfoFlags int flags, UserHandle userHandle) {
4149 return queryBroadcastReceiversAsUser(intent, flags, userHandle.getIdentifier());
4150 }
4151
4152 /**
4153 * @hide
4154 */
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07004155 public abstract List<ResolveInfo> queryBroadcastReceiversAsUser(Intent intent,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004156 @ResolveInfoFlags int flags, @UserIdInt int userId);
Amith Yamasanif203aee2012-08-29 18:41:53 -07004157
Fyodor Kupolov940e8572016-01-26 12:03:51 -08004158
Jeff Sharkeybd940222016-01-08 11:07:13 -07004159 /** {@hide} */
4160 @Deprecated
4161 public List<ResolveInfo> queryBroadcastReceivers(Intent intent,
4162 @ResolveInfoFlags int flags, @UserIdInt int userId) {
Jeff Sharkey6f4b2a32017-03-21 14:13:41 -06004163 final String msg = "Shame on you for calling the hidden API "
4164 + "queryBroadcastReceivers(). Shame!";
4165 if (VMRuntime.getRuntime().getTargetSdkVersion() >= Build.VERSION_CODES.O) {
4166 throw new UnsupportedOperationException(msg);
4167 } else {
4168 Log.d(TAG, msg);
4169 return queryBroadcastReceiversAsUser(intent, flags, userId);
4170 }
Jeff Sharkeybd940222016-01-08 11:07:13 -07004171 }
4172
Amith Yamasanif203aee2012-08-29 18:41:53 -07004173 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004174 * Determine the best service to handle for a given Intent.
4175 *
4176 * @param intent An intent containing all of the desired specification
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004177 * (action, data, type, category, and/or component).
Jeff Sharkey4347f812017-04-21 12:08:39 -06004178 * @param flags Additional option flags to modify the data returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004179 * @return Returns a ResolveInfo object containing the final service intent
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004180 * that was determined to be the best action. Returns null if no
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004181 * matching service was found.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004182 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004183 public abstract ResolveInfo resolveService(Intent intent, @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004184
4185 /**
4186 * Retrieve all services that can match the given intent.
4187 *
4188 * @param intent The desired intent as per resolveService().
Jeff Sharkey4347f812017-04-21 12:08:39 -06004189 * @param flags Additional option flags to modify the data returned.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004190 * @return Returns a List of ResolveInfo objects containing one entry for
4191 * each matching service, ordered from best to worst. In other
4192 * words, the first item is what would be returned by
4193 * {@link #resolveService}. If there are no matching services, an
4194 * empty list or null is returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004195 */
4196 public abstract List<ResolveInfo> queryIntentServices(Intent intent,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004197 @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004198
4199 /**
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004200 * Retrieve all services that can match the given intent for a given user.
4201 *
4202 * @param intent The desired intent as per resolveService().
Jeff Sharkey4347f812017-04-21 12:08:39 -06004203 * @param flags Additional option flags to modify the data returned.
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004204 * @param userId The user id.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004205 * @return Returns a List of ResolveInfo objects containing one entry for
4206 * each matching service, ordered from best to worst. In other
4207 * words, the first item is what would be returned by
4208 * {@link #resolveService}. If there are no matching services, an
4209 * empty list or null is returned.
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004210 * @hide
4211 */
4212 public abstract List<ResolveInfo> queryIntentServicesAsUser(Intent intent,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004213 @ResolveInfoFlags int flags, @UserIdInt int userId);
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004214
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004215 /**
4216 * Retrieve all providers that can match the given intent.
4217 *
4218 * @param intent An intent containing all of the desired specification
4219 * (action, data, type, category, and/or component).
Jeff Sharkey4347f812017-04-21 12:08:39 -06004220 * @param flags Additional option flags to modify the data returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004221 * @param userId The user id.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004222 * @return Returns a List of ResolveInfo objects containing one entry for
4223 * each matching provider, ordered from best to worst. If there are
4224 * no matching services, an empty list or null is returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004225 * @hide
4226 */
Jeff Sharkey85f5f812013-10-07 10:16:12 -07004227 public abstract List<ResolveInfo> queryIntentContentProvidersAsUser(
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004228 Intent intent, @ResolveInfoFlags int flags, @UserIdInt int userId);
Jeff Sharkey85f5f812013-10-07 10:16:12 -07004229
4230 /**
4231 * Retrieve all providers that can match the given intent.
4232 *
4233 * @param intent An intent containing all of the desired specification
4234 * (action, data, type, category, and/or component).
Jeff Sharkey4347f812017-04-21 12:08:39 -06004235 * @param flags Additional option flags to modify the data returned.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004236 * @return Returns a List of ResolveInfo objects containing one entry for
4237 * each matching provider, ordered from best to worst. If there are
4238 * no matching services, an empty list or null is returned.
Jeff Sharkey85f5f812013-10-07 10:16:12 -07004239 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004240 public abstract List<ResolveInfo> queryIntentContentProviders(Intent intent,
4241 @ResolveInfoFlags int flags);
Jeff Sharkey85f5f812013-10-07 10:16:12 -07004242
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004243 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004244 * Find a single content provider by its base path name.
4245 *
4246 * @param name The name of the provider to find.
Jeff Sharkey4347f812017-04-21 12:08:39 -06004247 * @param flags Additional option flags to modify the data returned.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004248 * @return A {@link ProviderInfo} object containing information about the
4249 * provider. If a provider was not found, returns null.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004250 */
4251 public abstract ProviderInfo resolveContentProvider(String name,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004252 @ComponentInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004253
4254 /**
Alexandra Gherghina0363c3e2014-06-23 13:34:59 +01004255 * Find a single content provider by its base path name.
4256 *
4257 * @param name The name of the provider to find.
Jeff Sharkey4347f812017-04-21 12:08:39 -06004258 * @param flags Additional option flags to modify the data returned.
Alexandra Gherghina0363c3e2014-06-23 13:34:59 +01004259 * @param userId The user id.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004260 * @return A {@link ProviderInfo} object containing information about the
4261 * provider. If a provider was not found, returns null.
Alexandra Gherghina0363c3e2014-06-23 13:34:59 +01004262 * @hide
4263 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004264 public abstract ProviderInfo resolveContentProviderAsUser(String name,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004265 @ComponentInfoFlags int flags, @UserIdInt int userId);
Alexandra Gherghina0363c3e2014-06-23 13:34:59 +01004266
4267 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004268 * Retrieve content provider information.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004269 * <p>
4270 * <em>Note: unlike most other methods, an empty result set is indicated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004271 * by a null return instead of an empty list.</em>
4272 *
4273 * @param processName If non-null, limits the returned providers to only
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004274 * those that are hosted by the given process. If null, all
4275 * content providers are returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004276 * @param uid If <var>processName</var> is non-null, this is the required
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004277 * uid owning the requested content providers.
Jeff Sharkey4347f812017-04-21 12:08:39 -06004278 * @param flags Additional option flags to modify the data returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004279 * @return A list of {@link ProviderInfo} objects containing one entry for
4280 * each provider either matching <var>processName</var> or, if
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004281 * <var>processName</var> is null, all known content providers.
4282 * <em>If there are no matching providers, null is returned.</em>
4283 */
4284 public abstract List<ProviderInfo> queryContentProviders(
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004285 String processName, int uid, @ComponentInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004286
4287 /**
Makoto Onuki32757292017-02-22 14:36:59 -08004288 * Same as {@link #queryContentProviders}, except when {@code metaDataKey} is not null,
4289 * it only returns providers which have metadata with the {@code metaDataKey} key.
4290 *
4291 * <p>DO NOT USE the {@code metaDataKey} parameter, unless you're the contacts provider.
4292 * You really shouldn't need it. Other apps should use {@link #queryIntentContentProviders}
4293 * instead.
4294 *
4295 * <p>The {@code metaDataKey} parameter was added to allow the contacts provider to quickly
4296 * scan the GAL providers on the device. Unfortunately the discovery protocol used metadata
4297 * to mark GAL providers, rather than intent filters, so we can't use
4298 * {@link #queryIntentContentProviders} for that.
4299 *
4300 * @hide
4301 */
4302 public List<ProviderInfo> queryContentProviders(
4303 String processName, int uid, @ComponentInfoFlags int flags, String metaDataKey) {
4304 // Provide the default implementation for mocks.
4305 return queryContentProviders(processName, uid, flags);
4306 }
4307
4308 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004309 * Retrieve all of the information we know about a particular
4310 * instrumentation class.
4311 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004312 * @param className The full name (i.e.
Jeff Sharkey4347f812017-04-21 12:08:39 -06004313 * com.google.apps.contacts.InstrumentList) of an Instrumentation
4314 * class.
4315 * @param flags Additional option flags to modify the data returned.
4316 * @return An {@link InstrumentationInfo} object containing information
4317 * about the instrumentation.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004318 * @throws NameNotFoundException if a package with the given name cannot be
4319 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004320 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004321 public abstract InstrumentationInfo getInstrumentationInfo(ComponentName className,
4322 @InstrumentationInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004323
4324 /**
Jeff Sharkey4347f812017-04-21 12:08:39 -06004325 * Retrieve information about available instrumentation code. May be used to
4326 * retrieve either all instrumentation code, or only the code targeting a
4327 * particular package.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004328 *
4329 * @param targetPackage If null, all instrumentation is returned; only the
Jeff Sharkey4347f812017-04-21 12:08:39 -06004330 * instrumentation targeting this package name is returned.
4331 * @param flags Additional option flags to modify the data returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004332 * @return A list of {@link InstrumentationInfo} objects containing one
4333 * entry for each matching instrumentation. If there are no
Jesse Hallf77a34f2016-02-04 18:41:33 -08004334 * instrumentation available, returns an empty list.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004335 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004336 public abstract List<InstrumentationInfo> queryInstrumentation(String targetPackage,
4337 @InstrumentationInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004338
4339 /**
4340 * Retrieve an image from a package. This is a low-level API used by
4341 * the various package manager info structures (such as
4342 * {@link ComponentInfo} to implement retrieval of their associated
4343 * icon.
4344 *
4345 * @param packageName The name of the package that this icon is coming from.
kmccormick30498b42013-03-27 17:39:17 -07004346 * Cannot be null.
4347 * @param resid The resource identifier of the desired image. Cannot be 0.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004348 * @param appInfo Overall information about <var>packageName</var>. This
4349 * may be null, in which case the application information will be retrieved
4350 * for you if needed; if you already have this information around, it can
4351 * be much more efficient to supply it here.
4352 *
4353 * @return Returns a Drawable holding the requested image. Returns null if
4354 * an image could not be found for any reason.
4355 */
Tor Norbye7b9c9122013-05-30 16:48:33 -07004356 public abstract Drawable getDrawable(String packageName, @DrawableRes int resid,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004357 ApplicationInfo appInfo);
4358
4359 /**
4360 * Retrieve the icon associated with an activity. Given the full name of
4361 * an activity, retrieves the information about it and calls
4362 * {@link ComponentInfo#loadIcon ComponentInfo.loadIcon()} to return its icon.
kmccormick30498b42013-03-27 17:39:17 -07004363 * If the activity cannot be found, NameNotFoundException is thrown.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004364 *
4365 * @param activityName Name of the activity whose icon is to be retrieved.
4366 *
4367 * @return Returns the image of the icon, or the default activity icon if
4368 * it could not be found. Does not return null.
4369 * @throws NameNotFoundException Thrown if the resources for the given
4370 * activity could not be loaded.
4371 *
4372 * @see #getActivityIcon(Intent)
4373 */
4374 public abstract Drawable getActivityIcon(ComponentName activityName)
4375 throws NameNotFoundException;
4376
4377 /**
4378 * Retrieve the icon associated with an Intent. If intent.getClassName() is
4379 * set, this simply returns the result of
4380 * getActivityIcon(intent.getClassName()). Otherwise it resolves the intent's
4381 * component and returns the icon associated with the resolved component.
kmccormick30498b42013-03-27 17:39:17 -07004382 * If intent.getClassName() cannot be found or the Intent cannot be resolved
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004383 * to a component, NameNotFoundException is thrown.
4384 *
4385 * @param intent The intent for which you would like to retrieve an icon.
4386 *
4387 * @return Returns the image of the icon, or the default activity icon if
4388 * it could not be found. Does not return null.
4389 * @throws NameNotFoundException Thrown if the resources for application
4390 * matching the given intent could not be loaded.
4391 *
4392 * @see #getActivityIcon(ComponentName)
4393 */
4394 public abstract Drawable getActivityIcon(Intent intent)
4395 throws NameNotFoundException;
4396
4397 /**
Jose Limaf78e3122014-03-06 12:13:15 -08004398 * Retrieve the banner associated with an activity. Given the full name of
4399 * an activity, retrieves the information about it and calls
4400 * {@link ComponentInfo#loadIcon ComponentInfo.loadIcon()} to return its
4401 * banner. If the activity cannot be found, NameNotFoundException is thrown.
4402 *
4403 * @param activityName Name of the activity whose banner is to be retrieved.
4404 * @return Returns the image of the banner, or null if the activity has no
4405 * banner specified.
4406 * @throws NameNotFoundException Thrown if the resources for the given
4407 * activity could not be loaded.
4408 * @see #getActivityBanner(Intent)
4409 */
4410 public abstract Drawable getActivityBanner(ComponentName activityName)
4411 throws NameNotFoundException;
4412
4413 /**
4414 * Retrieve the banner associated with an Intent. If intent.getClassName()
4415 * is set, this simply returns the result of
4416 * getActivityBanner(intent.getClassName()). Otherwise it resolves the
4417 * intent's component and returns the banner associated with the resolved
4418 * component. If intent.getClassName() cannot be found or the Intent cannot
4419 * be resolved to a component, NameNotFoundException is thrown.
4420 *
4421 * @param intent The intent for which you would like to retrieve a banner.
4422 * @return Returns the image of the banner, or null if the activity has no
4423 * banner specified.
4424 * @throws NameNotFoundException Thrown if the resources for application
4425 * matching the given intent could not be loaded.
4426 * @see #getActivityBanner(ComponentName)
4427 */
4428 public abstract Drawable getActivityBanner(Intent intent)
4429 throws NameNotFoundException;
4430
4431 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004432 * Return the generic icon for an activity that is used when no specific
4433 * icon is defined.
Adam Connors23cc04e2014-04-01 12:12:20 +01004434 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004435 * @return Drawable Image of the icon.
4436 */
4437 public abstract Drawable getDefaultActivityIcon();
4438
4439 /**
4440 * Retrieve the icon associated with an application. If it has not defined
4441 * an icon, the default app icon is returned. Does not return null.
4442 *
4443 * @param info Information about application being queried.
4444 *
4445 * @return Returns the image of the icon, or the default application icon
4446 * if it could not be found.
4447 *
4448 * @see #getApplicationIcon(String)
4449 */
4450 public abstract Drawable getApplicationIcon(ApplicationInfo info);
4451
4452 /**
4453 * Retrieve the icon associated with an application. Given the name of the
4454 * application's package, retrieves the information about it and calls
kmccormick30498b42013-03-27 17:39:17 -07004455 * getApplicationIcon() to return its icon. If the application cannot be
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004456 * found, NameNotFoundException is thrown.
4457 *
4458 * @param packageName Name of the package whose application icon is to be
4459 * retrieved.
4460 *
4461 * @return Returns the image of the icon, or the default application icon
4462 * if it could not be found. Does not return null.
4463 * @throws NameNotFoundException Thrown if the resources for the given
4464 * application could not be loaded.
4465 *
4466 * @see #getApplicationIcon(ApplicationInfo)
4467 */
4468 public abstract Drawable getApplicationIcon(String packageName)
4469 throws NameNotFoundException;
4470
4471 /**
Jose Limaf78e3122014-03-06 12:13:15 -08004472 * Retrieve the banner associated with an application.
4473 *
4474 * @param info Information about application being queried.
4475 * @return Returns the image of the banner or null if the application has no
4476 * banner specified.
4477 * @see #getApplicationBanner(String)
4478 */
4479 public abstract Drawable getApplicationBanner(ApplicationInfo info);
4480
4481 /**
4482 * Retrieve the banner associated with an application. Given the name of the
4483 * application's package, retrieves the information about it and calls
4484 * getApplicationIcon() to return its banner. If the application cannot be
4485 * found, NameNotFoundException is thrown.
4486 *
4487 * @param packageName Name of the package whose application banner is to be
4488 * retrieved.
4489 * @return Returns the image of the banner or null if the application has no
4490 * banner specified.
4491 * @throws NameNotFoundException Thrown if the resources for the given
4492 * application could not be loaded.
4493 * @see #getApplicationBanner(ApplicationInfo)
4494 */
4495 public abstract Drawable getApplicationBanner(String packageName)
4496 throws NameNotFoundException;
4497
4498 /**
4499 * Retrieve the logo associated with an activity. Given the full name of an
4500 * activity, retrieves the information about it and calls
4501 * {@link ComponentInfo#loadLogo ComponentInfo.loadLogo()} to return its
4502 * logo. If the activity cannot be found, NameNotFoundException is thrown.
Adam Powell81cd2e92010-04-21 16:35:18 -07004503 *
4504 * @param activityName Name of the activity whose logo is to be retrieved.
Jose Limaf78e3122014-03-06 12:13:15 -08004505 * @return Returns the image of the logo or null if the activity has no logo
4506 * specified.
Adam Powell81cd2e92010-04-21 16:35:18 -07004507 * @throws NameNotFoundException Thrown if the resources for the given
Jose Limaf78e3122014-03-06 12:13:15 -08004508 * activity could not be loaded.
Adam Powell81cd2e92010-04-21 16:35:18 -07004509 * @see #getActivityLogo(Intent)
4510 */
4511 public abstract Drawable getActivityLogo(ComponentName activityName)
4512 throws NameNotFoundException;
4513
4514 /**
4515 * Retrieve the logo associated with an Intent. If intent.getClassName() is
4516 * set, this simply returns the result of
4517 * getActivityLogo(intent.getClassName()). Otherwise it resolves the intent's
4518 * component and returns the logo associated with the resolved component.
kmccormick30498b42013-03-27 17:39:17 -07004519 * If intent.getClassName() cannot be found or the Intent cannot be resolved
Adam Powell81cd2e92010-04-21 16:35:18 -07004520 * to a component, NameNotFoundException is thrown.
4521 *
4522 * @param intent The intent for which you would like to retrieve a logo.
4523 *
4524 * @return Returns the image of the logo, or null if the activity has no
4525 * logo specified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004526 *
Adam Powell81cd2e92010-04-21 16:35:18 -07004527 * @throws NameNotFoundException Thrown if the resources for application
4528 * matching the given intent could not be loaded.
4529 *
4530 * @see #getActivityLogo(ComponentName)
4531 */
4532 public abstract Drawable getActivityLogo(Intent intent)
4533 throws NameNotFoundException;
4534
4535 /**
4536 * Retrieve the logo associated with an application. If it has not specified
4537 * a logo, this method returns null.
4538 *
4539 * @param info Information about application being queried.
4540 *
4541 * @return Returns the image of the logo, or null if no logo is specified
4542 * by the application.
4543 *
4544 * @see #getApplicationLogo(String)
4545 */
4546 public abstract Drawable getApplicationLogo(ApplicationInfo info);
4547
4548 /**
4549 * Retrieve the logo associated with an application. Given the name of the
4550 * application's package, retrieves the information about it and calls
kmccormick30498b42013-03-27 17:39:17 -07004551 * getApplicationLogo() to return its logo. If the application cannot be
Adam Powell81cd2e92010-04-21 16:35:18 -07004552 * found, NameNotFoundException is thrown.
4553 *
4554 * @param packageName Name of the package whose application logo is to be
4555 * retrieved.
4556 *
4557 * @return Returns the image of the logo, or null if no application logo
4558 * has been specified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004559 *
Adam Powell81cd2e92010-04-21 16:35:18 -07004560 * @throws NameNotFoundException Thrown if the resources for the given
4561 * application could not be loaded.
4562 *
4563 * @see #getApplicationLogo(ApplicationInfo)
4564 */
4565 public abstract Drawable getApplicationLogo(String packageName)
4566 throws NameNotFoundException;
4567
4568 /**
Tony Mak4dc008c2016-03-16 10:46:49 +00004569 * If the target user is a managed profile, then this returns a badged copy of the given icon
4570 * to be able to distinguish it from the original icon. For badging an arbitrary drawable use
Kenny Guydf77d712015-05-29 17:02:22 +01004571 * {@link #getUserBadgedDrawableForDensity(
Svetoslavc7d62f02014-09-04 15:39:54 -07004572 * android.graphics.drawable.Drawable, UserHandle, android.graphics.Rect, int)}.
4573 * <p>
4574 * If the original drawable is a BitmapDrawable and the backing bitmap is
4575 * mutable as per {@link android.graphics.Bitmap#isMutable()}, the badging
4576 * is performed in place and the original drawable is returned.
4577 * </p>
4578 *
4579 * @param icon The icon to badge.
4580 * @param user The target user.
4581 * @return A drawable that combines the original icon and a badge as
4582 * determined by the system.
4583 */
4584 public abstract Drawable getUserBadgedIcon(Drawable icon, UserHandle user);
4585
4586 /**
4587 * If the target user is a managed profile of the calling user or the caller
4588 * is itself a managed profile, then this returns a badged copy of the given
4589 * drawable allowing the user to distinguish it from the original drawable.
4590 * The caller can specify the location in the bounds of the drawable to be
4591 * badged where the badge should be applied as well as the density of the
4592 * badge to be used.
4593 * <p>
4594 * If the original drawable is a BitmapDrawable and the backing bitmap is
Vadim Tryshev66ae66a2016-02-18 15:41:21 -08004595 * mutable as per {@link android.graphics.Bitmap#isMutable()}, the badging
Svetoslavc7d62f02014-09-04 15:39:54 -07004596 * is performed in place and the original drawable is returned.
4597 * </p>
4598 *
4599 * @param drawable The drawable to badge.
4600 * @param user The target user.
4601 * @param badgeLocation Where in the bounds of the badged drawable to place
Vadim Tryshev66ae66a2016-02-18 15:41:21 -08004602 * the badge. If it's {@code null}, the badge is applied on top of the entire
Svetoslavc7d62f02014-09-04 15:39:54 -07004603 * drawable being badged.
4604 * @param badgeDensity The optional desired density for the badge as per
Vadim Tryshev66ae66a2016-02-18 15:41:21 -08004605 * {@link android.util.DisplayMetrics#densityDpi}. If it's not positive,
Svetoslavc7d62f02014-09-04 15:39:54 -07004606 * the density of the display is used.
4607 * @return A drawable that combines the original drawable and a badge as
4608 * determined by the system.
4609 */
4610 public abstract Drawable getUserBadgedDrawableForDensity(Drawable drawable,
4611 UserHandle user, Rect badgeLocation, int badgeDensity);
4612
4613 /**
4614 * If the target user is a managed profile of the calling user or the caller
4615 * is itself a managed profile, then this returns a drawable to use as a small
4616 * icon to include in a view to distinguish it from the original icon.
4617 *
4618 * @param user The target user.
4619 * @param density The optional desired density for the badge as per
4620 * {@link android.util.DisplayMetrics#densityDpi}. If not provided
4621 * the density of the current display is used.
4622 * @return the drawable or null if no drawable is required.
4623 * @hide
4624 */
4625 public abstract Drawable getUserBadgeForDensity(UserHandle user, int density);
4626
4627 /**
4628 * If the target user is a managed profile of the calling user or the caller
Selim Cineke6ff9462016-01-15 15:07:06 -08004629 * is itself a managed profile, then this returns a drawable to use as a small
4630 * icon to include in a view to distinguish it from the original icon. This version
4631 * doesn't have background protection and should be used over a light background instead of
4632 * a badge.
4633 *
4634 * @param user The target user.
4635 * @param density The optional desired density for the badge as per
4636 * {@link android.util.DisplayMetrics#densityDpi}. If not provided
4637 * the density of the current display is used.
4638 * @return the drawable or null if no drawable is required.
4639 * @hide
4640 */
4641 public abstract Drawable getUserBadgeForDensityNoBackground(UserHandle user, int density);
4642
4643 /**
4644 * If the target user is a managed profile of the calling user or the caller
Svetoslavc7d62f02014-09-04 15:39:54 -07004645 * is itself a managed profile, then this returns a copy of the label with
4646 * badging for accessibility services like talkback. E.g. passing in "Email"
4647 * and it might return "Work Email" for Email in the work profile.
4648 *
4649 * @param label The label to change.
4650 * @param user The target user.
4651 * @return A label that combines the original label and a badge as
4652 * determined by the system.
4653 */
4654 public abstract CharSequence getUserBadgedLabel(CharSequence label, UserHandle user);
4655
4656 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004657 * Retrieve text from a package. This is a low-level API used by
4658 * the various package manager info structures (such as
4659 * {@link ComponentInfo} to implement retrieval of their associated
4660 * labels and other text.
4661 *
4662 * @param packageName The name of the package that this text is coming from.
kmccormick30498b42013-03-27 17:39:17 -07004663 * Cannot be null.
4664 * @param resid The resource identifier of the desired text. Cannot be 0.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004665 * @param appInfo Overall information about <var>packageName</var>. This
4666 * may be null, in which case the application information will be retrieved
4667 * for you if needed; if you already have this information around, it can
4668 * be much more efficient to supply it here.
4669 *
4670 * @return Returns a CharSequence holding the requested text. Returns null
4671 * if the text could not be found for any reason.
4672 */
Tor Norbye7b9c9122013-05-30 16:48:33 -07004673 public abstract CharSequence getText(String packageName, @StringRes int resid,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004674 ApplicationInfo appInfo);
4675
4676 /**
4677 * Retrieve an XML file from a package. This is a low-level API used to
4678 * retrieve XML meta data.
4679 *
4680 * @param packageName The name of the package that this xml is coming from.
kmccormick30498b42013-03-27 17:39:17 -07004681 * Cannot be null.
4682 * @param resid The resource identifier of the desired xml. Cannot be 0.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004683 * @param appInfo Overall information about <var>packageName</var>. This
4684 * may be null, in which case the application information will be retrieved
4685 * for you if needed; if you already have this information around, it can
4686 * be much more efficient to supply it here.
4687 *
4688 * @return Returns an XmlPullParser allowing you to parse out the XML
4689 * data. Returns null if the xml resource could not be found for any
4690 * reason.
4691 */
Tor Norbye7b9c9122013-05-30 16:48:33 -07004692 public abstract XmlResourceParser getXml(String packageName, @XmlRes int resid,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004693 ApplicationInfo appInfo);
4694
4695 /**
4696 * Return the label to use for this application.
4697 *
4698 * @return Returns the label associated with this application, or null if
4699 * it could not be found for any reason.
kmccormick30498b42013-03-27 17:39:17 -07004700 * @param info The application to get the label of.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004701 */
4702 public abstract CharSequence getApplicationLabel(ApplicationInfo info);
4703
4704 /**
4705 * Retrieve the resources associated with an activity. Given the full
4706 * name of an activity, retrieves the information about it and calls
4707 * getResources() to return its application's resources. If the activity
kmccormick30498b42013-03-27 17:39:17 -07004708 * cannot be found, NameNotFoundException is thrown.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004709 *
4710 * @param activityName Name of the activity whose resources are to be
4711 * retrieved.
4712 *
4713 * @return Returns the application's Resources.
4714 * @throws NameNotFoundException Thrown if the resources for the given
4715 * application could not be loaded.
4716 *
4717 * @see #getResourcesForApplication(ApplicationInfo)
4718 */
4719 public abstract Resources getResourcesForActivity(ComponentName activityName)
4720 throws NameNotFoundException;
4721
4722 /**
4723 * Retrieve the resources for an application. Throws NameNotFoundException
4724 * if the package is no longer installed.
4725 *
4726 * @param app Information about the desired application.
4727 *
4728 * @return Returns the application's Resources.
4729 * @throws NameNotFoundException Thrown if the resources for the given
4730 * application could not be loaded (most likely because it was uninstalled).
4731 */
4732 public abstract Resources getResourcesForApplication(ApplicationInfo app)
4733 throws NameNotFoundException;
4734
4735 /**
4736 * Retrieve the resources associated with an application. Given the full
4737 * package name of an application, retrieves the information about it and
4738 * calls getResources() to return its application's resources. If the
kmccormick30498b42013-03-27 17:39:17 -07004739 * appPackageName cannot be found, NameNotFoundException is thrown.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004740 *
4741 * @param appPackageName Package name of the application whose resources
4742 * are to be retrieved.
4743 *
4744 * @return Returns the application's Resources.
4745 * @throws NameNotFoundException Thrown if the resources for the given
4746 * application could not be loaded.
4747 *
4748 * @see #getResourcesForApplication(ApplicationInfo)
4749 */
4750 public abstract Resources getResourcesForApplication(String appPackageName)
4751 throws NameNotFoundException;
4752
Amith Yamasani98edc952012-09-25 14:09:27 -07004753 /** @hide */
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004754 public abstract Resources getResourcesForApplicationAsUser(String appPackageName,
4755 @UserIdInt int userId) throws NameNotFoundException;
Amith Yamasani98edc952012-09-25 14:09:27 -07004756
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004757 /**
Jeff Sharkey4347f812017-04-21 12:08:39 -06004758 * Retrieve overall information about an application package defined in a
4759 * package archive file
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004760 *
4761 * @param archiveFilePath The path to the archive file
Jeff Sharkey4347f812017-04-21 12:08:39 -06004762 * @param flags Additional option flags to modify the data returned.
4763 * @return A PackageInfo object containing information about the package
4764 * archive. If the package could not be parsed, returns null.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004765 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004766 public PackageInfo getPackageArchiveInfo(String archiveFilePath, @PackageInfoFlags int flags) {
Jeff Sharkey275e0852014-06-17 18:18:49 -07004767 final PackageParser parser = new PackageParser();
Dianne Hackborncd154e92017-02-28 17:37:35 -08004768 parser.setCallback(new PackageParser.CallbackImpl(this));
Jeff Sharkey275e0852014-06-17 18:18:49 -07004769 final File apkFile = new File(archiveFilePath);
Jeff Sharkeyc4858a22014-06-16 10:51:20 -07004770 try {
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004771 if ((flags & (MATCH_DIRECT_BOOT_UNAWARE | MATCH_DIRECT_BOOT_AWARE)) != 0) {
Jeff Sharkeyc3132512016-01-12 14:06:58 -07004772 // Caller expressed an explicit opinion about what encryption
4773 // aware/unaware components they want to see, so fall through and
4774 // give them what they want
4775 } else {
4776 // Caller expressed no opinion, so match everything
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004777 flags |= MATCH_DIRECT_BOOT_AWARE | MATCH_DIRECT_BOOT_UNAWARE;
Jeff Sharkeyc3132512016-01-12 14:06:58 -07004778 }
4779
Jeff Sharkey275e0852014-06-17 18:18:49 -07004780 PackageParser.Package pkg = parser.parseMonolithicPackage(apkFile, 0);
Jeff Sharkeyc4858a22014-06-16 10:51:20 -07004781 if ((flags & GET_SIGNATURES) != 0) {
Victor Hsieh5f761242018-01-20 10:30:12 -08004782 PackageParser.collectCertificates(pkg, false /* skipVerify */);
Jeff Sharkeyc4858a22014-06-16 10:51:20 -07004783 }
4784 PackageUserState state = new PackageUserState();
4785 return PackageParser.generatePackageInfo(pkg, null, flags, 0, 0, null, state);
4786 } catch (PackageParserException e) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004787 return null;
4788 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004789 }
4790
4791 /**
Dianne Hackborn7767eac2012-08-23 18:25:40 -07004792 * If there is already an application with the given package name installed
4793 * on the system for other users, also install it for the calling user.
4794 * @hide
4795 */
Sunny Goyal07f41fb2017-08-09 02:56:34 -07004796 @SystemApi
Nicolas Prevot9a80e532015-09-23 15:49:28 +01004797 public abstract int installExistingPackage(String packageName) throws NameNotFoundException;
4798
4799 /**
4800 * If there is already an application with the given package name installed
Sunny Goyala31a74b2017-05-11 15:59:19 -07004801 * on the system for other users, also install it for the calling user.
4802 * @hide
4803 */
Sunny Goyal07f41fb2017-08-09 02:56:34 -07004804 @SystemApi
Sunny Goyala31a74b2017-05-11 15:59:19 -07004805 public abstract int installExistingPackage(String packageName, @InstallReason int installReason)
4806 throws NameNotFoundException;
4807
4808 /**
4809 * If there is already an application with the given package name installed
Nicolas Prevot9a80e532015-09-23 15:49:28 +01004810 * on the system for other users, also install it for the specified user.
4811 * @hide
4812 */
4813 @RequiresPermission(anyOf = {
4814 Manifest.permission.INSTALL_PACKAGES,
4815 Manifest.permission.INTERACT_ACROSS_USERS_FULL})
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004816 public abstract int installExistingPackageAsUser(String packageName, @UserIdInt int userId)
Dianne Hackborn7767eac2012-08-23 18:25:40 -07004817 throws NameNotFoundException;
4818
4819 /**
Kenny Root5ab21572011-07-27 11:11:19 -07004820 * Allows a package listening to the
4821 * {@link Intent#ACTION_PACKAGE_NEEDS_VERIFICATION package verification
Kenny Root3a9b5fb2011-09-20 14:15:38 -07004822 * broadcast} to respond to the package manager. The response must include
4823 * the {@code verificationCode} which is one of
4824 * {@link PackageManager#VERIFICATION_ALLOW} or
4825 * {@link PackageManager#VERIFICATION_REJECT}.
Kenny Root5ab21572011-07-27 11:11:19 -07004826 *
4827 * @param id pending package identifier as passed via the
kmccormick30498b42013-03-27 17:39:17 -07004828 * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra.
Kenny Root3a9b5fb2011-09-20 14:15:38 -07004829 * @param verificationCode either {@link PackageManager#VERIFICATION_ALLOW}
4830 * or {@link PackageManager#VERIFICATION_REJECT}.
rich cannings7e671512012-08-27 14:44:16 -07004831 * @throws SecurityException if the caller does not have the
Dianne Hackborn8832c182012-09-17 17:20:24 -07004832 * PACKAGE_VERIFICATION_AGENT permission.
Kenny Root5ab21572011-07-27 11:11:19 -07004833 */
Kenny Root3a9b5fb2011-09-20 14:15:38 -07004834 public abstract void verifyPendingInstall(int id, int verificationCode);
Kenny Root5ab21572011-07-27 11:11:19 -07004835
4836 /**
rich canningsd9ef3e52012-08-22 14:28:05 -07004837 * Allows a package listening to the
4838 * {@link Intent#ACTION_PACKAGE_NEEDS_VERIFICATION package verification
4839 * broadcast} to extend the default timeout for a response and declare what
4840 * action to perform after the timeout occurs. The response must include
4841 * the {@code verificationCodeAtTimeout} which is one of
4842 * {@link PackageManager#VERIFICATION_ALLOW} or
4843 * {@link PackageManager#VERIFICATION_REJECT}.
4844 *
4845 * This method may only be called once per package id. Additional calls
4846 * will have no effect.
4847 *
4848 * @param id pending package identifier as passed via the
kmccormick30498b42013-03-27 17:39:17 -07004849 * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra.
rich canningsd9ef3e52012-08-22 14:28:05 -07004850 * @param verificationCodeAtTimeout either
4851 * {@link PackageManager#VERIFICATION_ALLOW} or
rich canningsd1b5cfc2012-08-29 14:49:51 -07004852 * {@link PackageManager#VERIFICATION_REJECT}. If
4853 * {@code verificationCodeAtTimeout} is neither
4854 * {@link PackageManager#VERIFICATION_ALLOW} or
4855 * {@link PackageManager#VERIFICATION_REJECT}, then
4856 * {@code verificationCodeAtTimeout} will default to
rich canningsd9ef3e52012-08-22 14:28:05 -07004857 * {@link PackageManager#VERIFICATION_REJECT}.
4858 * @param millisecondsToDelay the amount of time requested for the timeout.
4859 * Must be positive and less than
rich canningsd1b5cfc2012-08-29 14:49:51 -07004860 * {@link PackageManager#MAXIMUM_VERIFICATION_TIMEOUT}. If
4861 * {@code millisecondsToDelay} is out of bounds,
4862 * {@code millisecondsToDelay} will be set to the closest in
4863 * bounds value; namely, 0 or
rich canningsd9ef3e52012-08-22 14:28:05 -07004864 * {@link PackageManager#MAXIMUM_VERIFICATION_TIMEOUT}.
rich cannings7e671512012-08-27 14:44:16 -07004865 * @throws SecurityException if the caller does not have the
Dianne Hackborn8832c182012-09-17 17:20:24 -07004866 * PACKAGE_VERIFICATION_AGENT permission.
rich canningsd9ef3e52012-08-22 14:28:05 -07004867 */
4868 public abstract void extendVerificationTimeout(int id,
4869 int verificationCodeAtTimeout, long millisecondsToDelay);
4870
4871 /**
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004872 * Allows a package listening to the
Todd Kennedydfa93ab2016-03-03 15:24:33 -08004873 * {@link Intent#ACTION_INTENT_FILTER_NEEDS_VERIFICATION} intent filter verification
4874 * broadcast to respond to the package manager. The response must include
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004875 * the {@code verificationCode} which is one of
4876 * {@link PackageManager#INTENT_FILTER_VERIFICATION_SUCCESS} or
4877 * {@link PackageManager#INTENT_FILTER_VERIFICATION_FAILURE}.
4878 *
4879 * @param verificationId pending package identifier as passed via the
4880 * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra.
4881 * @param verificationCode either {@link PackageManager#INTENT_FILTER_VERIFICATION_SUCCESS}
4882 * or {@link PackageManager#INTENT_FILTER_VERIFICATION_FAILURE}.
Todd Kennedydfa93ab2016-03-03 15:24:33 -08004883 * @param failedDomains a list of failed domains if the verificationCode is
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004884 * {@link PackageManager#INTENT_FILTER_VERIFICATION_FAILURE}, otherwise null;
4885 * @throws SecurityException if the caller does not have the
4886 * INTENT_FILTER_VERIFICATION_AGENT permission.
4887 *
4888 * @hide
4889 */
Fabrice Di Meglioef741da2015-05-12 16:31:38 -07004890 @SystemApi
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06004891 @RequiresPermission(android.Manifest.permission.INTENT_FILTER_VERIFICATION_AGENT)
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004892 public abstract void verifyIntentFilter(int verificationId, int verificationCode,
Todd Kennedydfa93ab2016-03-03 15:24:33 -08004893 List<String> failedDomains);
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004894
4895 /**
4896 * Get the status of a Domain Verification Result for an IntentFilter. This is
4897 * related to the {@link android.content.IntentFilter#setAutoVerify(boolean)} and
4898 * {@link android.content.IntentFilter#getAutoVerify()}
4899 *
4900 * This is used by the ResolverActivity to change the status depending on what the User select
4901 * in the Disambiguation Dialog and also used by the Settings App for changing the default App
4902 * for a domain.
4903 *
4904 * @param packageName The package name of the Activity associated with the IntentFilter.
4905 * @param userId The user id.
4906 *
4907 * @return The status to set to. This can be
4908 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK} or
4909 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS} or
4910 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER} or
4911 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED}
4912 *
4913 * @hide
4914 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08004915 @SystemApi
Todd Kennedydbaef6d2017-07-24 11:28:00 -07004916 @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS_FULL)
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004917 public abstract int getIntentVerificationStatusAsUser(String packageName, @UserIdInt int userId);
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004918
4919 /**
4920 * Allow to change the status of a Intent Verification status for all IntentFilter of an App.
4921 * This is related to the {@link android.content.IntentFilter#setAutoVerify(boolean)} and
4922 * {@link android.content.IntentFilter#getAutoVerify()}
4923 *
4924 * This is used by the ResolverActivity to change the status depending on what the User select
4925 * in the Disambiguation Dialog and also used by the Settings App for changing the default App
4926 * for a domain.
4927 *
4928 * @param packageName The package name of the Activity associated with the IntentFilter.
4929 * @param status The status to set to. This can be
4930 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK} or
4931 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS} or
4932 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER}
4933 * @param userId The user id.
4934 *
4935 * @return true if the status has been set. False otherwise.
4936 *
4937 * @hide
4938 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08004939 @SystemApi
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06004940 @RequiresPermission(android.Manifest.permission.SET_PREFERRED_APPLICATIONS)
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07004941 public abstract boolean updateIntentVerificationStatusAsUser(String packageName, int status,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004942 @UserIdInt int userId);
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004943
4944 /**
4945 * Get the list of IntentFilterVerificationInfo for a specific package and User.
4946 *
4947 * @param packageName the package name. When this parameter is set to a non null value,
4948 * the results will be filtered by the package name provided.
4949 * Otherwise, there will be no filtering and it will return a list
Fabrice Di Meglio07885952015-04-06 19:41:28 -07004950 * corresponding for all packages
4951 *
4952 * @return a list of IntentFilterVerificationInfo for a specific package.
4953 *
4954 * @hide
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004955 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08004956 @SystemApi
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004957 public abstract List<IntentFilterVerificationInfo> getIntentFilterVerifications(
4958 String packageName);
4959
4960 /**
Fabrice Di Meglio07885952015-04-06 19:41:28 -07004961 * Get the list of IntentFilter for a specific package.
4962 *
4963 * @param packageName the package name. This parameter is set to a non null value,
4964 * the list will contain all the IntentFilter for that package.
4965 * Otherwise, the list will be empty.
4966 *
4967 * @return a list of IntentFilter for a specific package.
4968 *
4969 * @hide
4970 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08004971 @SystemApi
Fabrice Di Meglio07885952015-04-06 19:41:28 -07004972 public abstract List<IntentFilter> getAllIntentFilters(String packageName);
4973
4974 /**
Fabrice Di Meglio62271722015-04-10 17:24:02 -07004975 * Get the default Browser package name for a specific user.
4976 *
4977 * @param userId The user id.
4978 *
4979 * @return the package name of the default Browser for the specified user. If the user id passed
4980 * is -1 (all users) it will return a null value.
4981 *
4982 * @hide
4983 */
Jeff Sharkeya73b8fd2016-01-06 17:02:08 -07004984 @TestApi
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08004985 @SystemApi
Todd Kennedydbaef6d2017-07-24 11:28:00 -07004986 @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS_FULL)
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004987 public abstract String getDefaultBrowserPackageNameAsUser(@UserIdInt int userId);
Fabrice Di Meglio62271722015-04-10 17:24:02 -07004988
4989 /**
4990 * Set the default Browser package name for a specific user.
4991 *
4992 * @param packageName The package name of the default Browser.
4993 * @param userId The user id.
4994 *
4995 * @return true if the default Browser for the specified user has been set,
4996 * otherwise return false. If the user id passed is -1 (all users) this call will not
4997 * do anything and just return false.
4998 *
4999 * @hide
5000 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08005001 @SystemApi
Todd Kennedydbaef6d2017-07-24 11:28:00 -07005002 @RequiresPermission(allOf = {
5003 Manifest.permission.SET_PREFERRED_APPLICATIONS,
5004 Manifest.permission.INTERACT_ACROSS_USERS_FULL})
Jeff Sharkey8588bc12016-01-06 16:47:42 -07005005 public abstract boolean setDefaultBrowserPackageNameAsUser(String packageName,
5006 @UserIdInt int userId);
Fabrice Di Meglio62271722015-04-10 17:24:02 -07005007
5008 /**
Dianne Hackborn880119b2010-11-18 22:26:40 -08005009 * Change the installer associated with a given package. There are limitations
5010 * on how the installer package can be changed; in particular:
5011 * <ul>
5012 * <li> A SecurityException will be thrown if <var>installerPackageName</var>
5013 * is not signed with the same certificate as the calling application.
5014 * <li> A SecurityException will be thrown if <var>targetPackage</var> already
5015 * has an installer package, and that installer package is not signed with
5016 * the same certificate as the calling application.
5017 * </ul>
5018 *
5019 * @param targetPackage The installed package whose installer will be changed.
5020 * @param installerPackageName The package name of the new installer. May be
5021 * null to clear the association.
5022 */
5023 public abstract void setInstallerPackageName(String targetPackage,
5024 String installerPackageName);
5025
Todd Kennedyab532892017-03-08 14:19:49 -08005026 /** @hide */
5027 @SystemApi
5028 @RequiresPermission(Manifest.permission.INSTALL_PACKAGES)
5029 public abstract void setUpdateAvailable(String packageName, boolean updateAvaialble);
5030
Dianne Hackborn880119b2010-11-18 22:26:40 -08005031 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005032 * Attempts to delete a package. Since this may take a little while, the
5033 * result will be posted back to the given observer. A deletion will fail if
5034 * the calling context lacks the
5035 * {@link android.Manifest.permission#DELETE_PACKAGES} permission, if the
5036 * named package cannot be found, or if the named package is a system
5037 * package.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005038 *
5039 * @param packageName The name of the package to delete
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005040 * @param observer An observer callback to get notified when the package
5041 * deletion is complete.
5042 * {@link android.content.pm.IPackageDeleteObserver#packageDeleted}
5043 * will be called when that happens. observer may be null to
5044 * indicate that no callback is desired.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005045 * @hide
5046 */
Svet Ganov67882122016-12-11 16:36:34 -08005047 @RequiresPermission(Manifest.permission.DELETE_PACKAGES)
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005048 public abstract void deletePackage(String packageName, IPackageDeleteObserver observer,
5049 @DeleteFlags int flags);
Jacek Surazski65e13172009-04-28 15:26:38 +02005050
5051 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005052 * Attempts to delete a package. Since this may take a little while, the
5053 * result will be posted back to the given observer. A deletion will fail if
5054 * the named package cannot be found, or if the named package is a system
5055 * package.
Nicolas Prevot9a80e532015-09-23 15:49:28 +01005056 *
5057 * @param packageName The name of the package to delete
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005058 * @param observer An observer callback to get notified when the package
5059 * deletion is complete.
5060 * {@link android.content.pm.IPackageDeleteObserver#packageDeleted}
5061 * will be called when that happens. observer may be null to
5062 * indicate that no callback is desired.
Nicolas Prevot9a80e532015-09-23 15:49:28 +01005063 * @param userId The user Id
Nicolas Prevot9a80e532015-09-23 15:49:28 +01005064 * @hide
5065 */
Svet Ganov67882122016-12-11 16:36:34 -08005066 @RequiresPermission(anyOf = {
Nicolas Prevot9a80e532015-09-23 15:49:28 +01005067 Manifest.permission.DELETE_PACKAGES,
5068 Manifest.permission.INTERACT_ACROSS_USERS_FULL})
Svet Ganov67882122016-12-11 16:36:34 -08005069 public abstract void deletePackageAsUser(@NonNull String packageName,
5070 IPackageDeleteObserver observer, @DeleteFlags int flags, @UserIdInt int userId);
Nicolas Prevot9a80e532015-09-23 15:49:28 +01005071
5072 /**
Jacek Surazski65e13172009-04-28 15:26:38 +02005073 * Retrieve the package name of the application that installed a package. This identifies
5074 * which market the package came from.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005075 *
Jacek Surazski65e13172009-04-28 15:26:38 +02005076 * @param packageName The name of the package to query
Todd Kennedy9db65632018-02-13 11:12:35 -08005077 * @throws IllegalArgumentException if the given package name is not installed
Jacek Surazski65e13172009-04-28 15:26:38 +02005078 */
5079 public abstract String getInstallerPackageName(String packageName);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005080
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005081 /**
5082 * Attempts to clear the user data directory of an application.
5083 * Since this may take a little while, the result will
5084 * be posted back to the given observer. A deletion will fail if the
5085 * named package cannot be found, or if the named package is a "system package".
5086 *
5087 * @param packageName The name of the package
5088 * @param observer An observer callback to get notified when the operation is finished
5089 * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)}
5090 * will be called when that happens. observer may be null to indicate that
5091 * no callback is desired.
5092 *
5093 * @hide
5094 */
5095 public abstract void clearApplicationUserData(String packageName,
5096 IPackageDataObserver observer);
5097 /**
5098 * Attempts to delete the cache files associated with an application.
5099 * Since this may take a little while, the result will
5100 * be posted back to the given observer. A deletion will fail if the calling context
5101 * lacks the {@link android.Manifest.permission#DELETE_CACHE_FILES} permission, if the
5102 * named package cannot be found, or if the named package is a "system package".
5103 *
5104 * @param packageName The name of the package to delete
5105 * @param observer An observer callback to get notified when the cache file deletion
5106 * is complete.
5107 * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)}
5108 * will be called when that happens. observer may be null to indicate that
5109 * no callback is desired.
5110 *
5111 * @hide
5112 */
5113 public abstract void deleteApplicationCacheFiles(String packageName,
5114 IPackageDataObserver observer);
5115
5116 /**
Suprabh Shukla78c9eb82016-04-12 15:51:35 -07005117 * Attempts to delete the cache files associated with an application for a given user. Since
5118 * this may take a little while, the result will be posted back to the given observer. A
5119 * deletion will fail if the calling context lacks the
5120 * {@link android.Manifest.permission#DELETE_CACHE_FILES} permission, if the named package
5121 * cannot be found, or if the named package is a "system package". If {@code userId} does not
5122 * belong to the calling user, the caller must have
5123 * {@link android.Manifest.permission#INTERACT_ACROSS_USERS} permission.
5124 *
5125 * @param packageName The name of the package to delete
5126 * @param userId the user for which the cache files needs to be deleted
5127 * @param observer An observer callback to get notified when the cache file deletion is
5128 * complete.
5129 * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)}
5130 * will be called when that happens. observer may be null to indicate that no
5131 * callback is desired.
5132 * @hide
5133 */
5134 public abstract void deleteApplicationCacheFilesAsUser(String packageName, int userId,
5135 IPackageDataObserver observer);
5136
5137 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005138 * Free storage by deleting LRU sorted list of cache files across
5139 * all applications. If the currently available free storage
5140 * on the device is greater than or equal to the requested
5141 * free storage, no cache files are cleared. If the currently
5142 * available storage on the device is less than the requested
5143 * free storage, some or all of the cache files across
5144 * all applications are deleted (based on last accessed time)
5145 * to increase the free storage space on the device to
5146 * the requested value. There is no guarantee that clearing all
5147 * the cache files from all applications will clear up
5148 * enough storage to achieve the desired value.
5149 * @param freeStorageSize The number of bytes of storage to be
5150 * freed by the system. Say if freeStorageSize is XX,
5151 * and the current free storage is YY,
5152 * if XX is less than YY, just return. if not free XX-YY number
5153 * of bytes if possible.
5154 * @param observer call back used to notify when
5155 * the operation is completed
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005156 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005157 * @hide
5158 */
Jeff Sharkey529f91f2015-04-18 20:23:13 -07005159 public void freeStorageAndNotify(long freeStorageSize, IPackageDataObserver observer) {
5160 freeStorageAndNotify(null, freeStorageSize, observer);
5161 }
5162
5163 /** {@hide} */
5164 public abstract void freeStorageAndNotify(String volumeUuid, long freeStorageSize,
5165 IPackageDataObserver observer);
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -07005166
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005167 /**
5168 * Free storage by deleting LRU sorted list of cache files across
5169 * all applications. If the currently available free storage
5170 * on the device is greater than or equal to the requested
5171 * free storage, no cache files are cleared. If the currently
5172 * available storage on the device is less than the requested
5173 * free storage, some or all of the cache files across
5174 * all applications are deleted (based on last accessed time)
5175 * to increase the free storage space on the device to
5176 * the requested value. There is no guarantee that clearing all
5177 * the cache files from all applications will clear up
5178 * enough storage to achieve the desired value.
5179 * @param freeStorageSize The number of bytes of storage to be
5180 * freed by the system. Say if freeStorageSize is XX,
5181 * and the current free storage is YY,
5182 * if XX is less than YY, just return. if not free XX-YY number
5183 * of bytes if possible.
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -07005184 * @param pi IntentSender call back used to
5185 * notify when the operation is completed.May be null
5186 * to indicate that no call back is desired.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005187 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005188 * @hide
5189 */
Jeff Sharkey529f91f2015-04-18 20:23:13 -07005190 public void freeStorage(long freeStorageSize, IntentSender pi) {
5191 freeStorage(null, freeStorageSize, pi);
5192 }
5193
5194 /** {@hide} */
5195 public abstract void freeStorage(String volumeUuid, long freeStorageSize, IntentSender pi);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005196
5197 /**
5198 * Retrieve the size information for a package.
5199 * Since this may take a little while, the result will
5200 * be posted back to the given observer. The calling context
5201 * should have the {@link android.Manifest.permission#GET_PACKAGE_SIZE} permission.
5202 *
5203 * @param packageName The name of the package whose size information is to be retrieved
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07005204 * @param userId The user whose size information should be retrieved.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005205 * @param observer An observer callback to get notified when the operation
5206 * is complete.
5207 * {@link android.content.pm.IPackageStatsObserver#onGetStatsCompleted(PackageStats, boolean)}
5208 * The observer's callback is invoked with a PackageStats object(containing the
5209 * code, data and cache sizes of the package) and a boolean value representing
5210 * the status of the operation. observer may be null to indicate that
5211 * no callback is desired.
5212 *
Jeff Sharkey60f95aa2017-03-08 13:57:15 -07005213 * @deprecated use {@link StorageStatsManager} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005214 * @hide
5215 */
Jeff Sharkey60f95aa2017-03-08 13:57:15 -07005216 @Deprecated
Jeff Sharkey8588bc12016-01-06 16:47:42 -07005217 public abstract void getPackageSizeInfoAsUser(String packageName, @UserIdInt int userId,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005218 IPackageStatsObserver observer);
5219
5220 /**
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07005221 * Like {@link #getPackageSizeInfoAsUser(String, int, IPackageStatsObserver)}, but
Dianne Hackborn0c380492012-08-20 17:23:30 -07005222 * returns the size for the calling user.
5223 *
Jeff Sharkey60f95aa2017-03-08 13:57:15 -07005224 * @deprecated use {@link StorageStatsManager} instead.
Dianne Hackborn0c380492012-08-20 17:23:30 -07005225 * @hide
5226 */
Jeff Sharkey60f95aa2017-03-08 13:57:15 -07005227 @Deprecated
Dianne Hackborn0c380492012-08-20 17:23:30 -07005228 public void getPackageSizeInfo(String packageName, IPackageStatsObserver observer) {
Jeff Sharkeyad357d12018-02-02 13:25:31 -07005229 getPackageSizeInfoAsUser(packageName, getUserId(), observer);
Dianne Hackborn0c380492012-08-20 17:23:30 -07005230 }
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 addPackageToPreferred(String packageName);
5239
5240 /**
Dianne Hackborna7ca0e52009-12-01 14:31:55 -08005241 * @deprecated This function no longer does anything; it was an old
kmccormickac66b852013-03-28 15:17:15 -07005242 * approach to managing preferred activities, which has been superseded
5243 * by (and conflicts with) the modern activity-based preferences.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005244 */
Dianne Hackborna7ca0e52009-12-01 14:31:55 -08005245 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005246 public abstract void removePackageFromPreferred(String packageName);
5247
5248 /**
Jeff Sharkey4347f812017-04-21 12:08:39 -06005249 * Retrieve the list of all currently configured preferred packages. The
5250 * first package on the list is the most preferred, the last is the least
5251 * preferred.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005252 *
Jeff Sharkey4347f812017-04-21 12:08:39 -06005253 * @param flags Additional option flags to modify the data returned.
5254 * @return A List of PackageInfo objects, one for each preferred
5255 * application, in order of preference.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005256 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07005257 public abstract List<PackageInfo> getPreferredPackages(@PackageInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005258
5259 /**
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08005260 * @deprecated This is a protected API that should not have been available
5261 * to third party applications. It is the platform's responsibility for
kmccormick30498b42013-03-27 17:39:17 -07005262 * assigning preferred activities and this cannot be directly modified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005263 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005264 * Add a new preferred activity mapping to the system. This will be used
5265 * to automatically select the given activity component when
5266 * {@link Context#startActivity(Intent) Context.startActivity()} finds
5267 * multiple matching activities and also matches the given filter.
5268 *
5269 * @param filter The set of intents under which this activity will be
5270 * made preferred.
5271 * @param match The IntentFilter match category that this preference
5272 * applies to.
5273 * @param set The set of activities that the user was picking from when
5274 * this preference was made.
5275 * @param activity The component name of the activity that is to be
5276 * preferred.
5277 */
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08005278 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005279 public abstract void addPreferredActivity(IntentFilter filter, int match,
5280 ComponentName[] set, ComponentName activity);
5281
5282 /**
Amith Yamasania3f133a2012-08-09 17:11:28 -07005283 * Same as {@link #addPreferredActivity(IntentFilter, int,
5284 ComponentName[], ComponentName)}, but with a specific userId to apply the preference
5285 to.
5286 * @hide
5287 */
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07005288 public void addPreferredActivityAsUser(IntentFilter filter, int match,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07005289 ComponentName[] set, ComponentName activity, @UserIdInt int userId) {
Amith Yamasania3f133a2012-08-09 17:11:28 -07005290 throw new RuntimeException("Not implemented. Must override in a subclass.");
5291 }
5292
5293 /**
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08005294 * @deprecated This is a protected API that should not have been available
5295 * to third party applications. It is the platform's responsibility for
kmccormick30498b42013-03-27 17:39:17 -07005296 * assigning preferred activities and this cannot be directly modified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005297 *
Satish Sampath8dbe6122009-06-02 23:35:54 +01005298 * Replaces an existing preferred activity mapping to the system, and if that were not present
5299 * adds a new preferred activity. This will be used
5300 * to automatically select the given activity component when
5301 * {@link Context#startActivity(Intent) Context.startActivity()} finds
5302 * multiple matching activities and also matches the given filter.
5303 *
5304 * @param filter The set of intents under which this activity will be
5305 * made preferred.
5306 * @param match The IntentFilter match category that this preference
5307 * applies to.
5308 * @param set The set of activities that the user was picking from when
5309 * this preference was made.
5310 * @param activity The component name of the activity that is to be
5311 * preferred.
5312 * @hide
5313 */
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08005314 @Deprecated
Satish Sampath8dbe6122009-06-02 23:35:54 +01005315 public abstract void replacePreferredActivity(IntentFilter filter, int match,
5316 ComponentName[] set, ComponentName activity);
5317
5318 /**
Amith Yamasani41c1ded2014-08-05 11:15:05 -07005319 * @hide
5320 */
5321 @Deprecated
5322 public void replacePreferredActivityAsUser(IntentFilter filter, int match,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07005323 ComponentName[] set, ComponentName activity, @UserIdInt int userId) {
Amith Yamasani41c1ded2014-08-05 11:15:05 -07005324 throw new RuntimeException("Not implemented. Must override in a subclass.");
5325 }
5326
5327 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005328 * Remove all preferred activity mappings, previously added with
5329 * {@link #addPreferredActivity}, from the
5330 * system whose activities are implemented in the given package name.
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08005331 * An application can only clear its own package(s).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005332 *
5333 * @param packageName The name of the package whose preferred activity
5334 * mappings are to be removed.
5335 */
5336 public abstract void clearPackagePreferredActivities(String packageName);
5337
5338 /**
5339 * Retrieve all preferred activities, previously added with
5340 * {@link #addPreferredActivity}, that are
5341 * currently registered with the system.
5342 *
John Spurlock38e64252015-03-18 12:09:32 -04005343 * @param outFilters A required list in which to place the filters of all of the
5344 * preferred activities.
5345 * @param outActivities A required list in which to place the component names of
5346 * all of the preferred activities.
5347 * @param packageName An optional package in which you would like to limit
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005348 * the list. If null, all activities will be returned; if non-null, only
5349 * those activities in the given package are returned.
5350 *
5351 * @return Returns the total number of registered preferred activities
5352 * (the number of distinct IntentFilter records, not the number of unique
5353 * activity components) that were found.
5354 */
John Spurlock38e64252015-03-18 12:09:32 -04005355 public abstract int getPreferredActivities(@NonNull List<IntentFilter> outFilters,
5356 @NonNull List<ComponentName> outActivities, String packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005357
5358 /**
Christopher Tatea2a0850d2013-09-05 16:38:58 -07005359 * Ask for the set of available 'home' activities and the current explicit
5360 * default, if any.
5361 * @hide
5362 */
5363 public abstract ComponentName getHomeActivities(List<ResolveInfo> outActivities);
5364
5365 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005366 * Set the enabled setting for a package component (activity, receiver, service, provider).
5367 * This setting will override any enabled state which may have been set by the component in its
5368 * manifest.
5369 *
5370 * @param componentName The component to enable
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06005371 * @param newState The new enabled state for the component.
5372 * @param flags Optional behavior flags.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005373 */
5374 public abstract void setComponentEnabledSetting(ComponentName componentName,
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06005375 @EnabledState int newState, @EnabledFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005376
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005377 /**
Amaury Medeirosdde24262014-06-03 20:06:41 -03005378 * Return the enabled setting for a package component (activity,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005379 * receiver, service, provider). This returns the last value set by
5380 * {@link #setComponentEnabledSetting(ComponentName, int, int)}; in most
5381 * cases this value will be {@link #COMPONENT_ENABLED_STATE_DEFAULT} since
5382 * the value originally specified in the manifest has not been modified.
5383 *
5384 * @param componentName The component to retrieve.
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06005385 * @return Returns the current enabled state for the component.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005386 */
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06005387 public abstract @EnabledState int getComponentEnabledSetting(
5388 ComponentName componentName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005389
5390 /**
5391 * Set the enabled setting for an application
5392 * This setting will override any enabled state which may have been set by the application in
5393 * its manifest. It also overrides the enabled state set in the manifest for any of the
5394 * application's components. It does not override any enabled state set by
5395 * {@link #setComponentEnabledSetting} for any of the application's components.
5396 *
5397 * @param packageName The package name of the application to enable
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06005398 * @param newState The new enabled state for the application.
5399 * @param flags Optional behavior flags.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005400 */
5401 public abstract void setApplicationEnabledSetting(String packageName,
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06005402 @EnabledState int newState, @EnabledFlags int flags);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005403
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005404 /**
Amaury Medeirosdde24262014-06-03 20:06:41 -03005405 * Return the enabled setting for an application. This returns
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005406 * the last value set by
5407 * {@link #setApplicationEnabledSetting(String, int, int)}; in most
5408 * cases this value will be {@link #COMPONENT_ENABLED_STATE_DEFAULT} since
5409 * the value originally specified in the manifest has not been modified.
5410 *
Amaury Medeirosdde24262014-06-03 20:06:41 -03005411 * @param packageName The package name of the application to retrieve.
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06005412 * @return Returns the current enabled state for the application.
Mathew Inwood1b9f8d92011-09-26 13:23:56 +01005413 * @throws IllegalArgumentException if the named package does not exist.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005414 */
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06005415 public abstract @EnabledState int getApplicationEnabledSetting(String packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005416
5417 /**
Sudheer Shankabbb3ff22015-07-09 15:39:23 +01005418 * Flush the package restrictions for a given user to disk. This forces the package restrictions
5419 * like component and package enabled settings to be written to disk and avoids the delay that
5420 * is otherwise present when changing those settings.
5421 *
5422 * @param userId Ther userId of the user whose restrictions are to be flushed.
5423 * @hide
5424 */
5425 public abstract void flushPackageRestrictionsAsUser(int userId);
5426
5427 /**
Amith Yamasanie5bcff62014-07-19 15:44:09 -07005428 * Puts the package in a hidden state, which is almost like an uninstalled state,
Amith Yamasani655d0e22013-06-12 14:19:10 -07005429 * making the package unavailable, but it doesn't remove the data or the actual
Amith Yamasanie5bcff62014-07-19 15:44:09 -07005430 * package file. Application can be unhidden by either resetting the hidden state
5431 * or by installing it, such as with {@link #installExistingPackage(String)}
Amith Yamasani655d0e22013-06-12 14:19:10 -07005432 * @hide
5433 */
Amith Yamasanie5bcff62014-07-19 15:44:09 -07005434 public abstract boolean setApplicationHiddenSettingAsUser(String packageName, boolean hidden,
Amith Yamasani655d0e22013-06-12 14:19:10 -07005435 UserHandle userHandle);
5436
5437 /**
Amith Yamasanie5bcff62014-07-19 15:44:09 -07005438 * Returns the hidden state of a package.
5439 * @see #setApplicationHiddenSettingAsUser(String, boolean, UserHandle)
Amith Yamasani655d0e22013-06-12 14:19:10 -07005440 * @hide
5441 */
Amith Yamasanie5bcff62014-07-19 15:44:09 -07005442 public abstract boolean getApplicationHiddenSettingAsUser(String packageName,
Amith Yamasani655d0e22013-06-12 14:19:10 -07005443 UserHandle userHandle);
5444
5445 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005446 * Return whether the device has been booted into safe mode.
5447 */
5448 public abstract boolean isSafeMode();
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08005449
5450 /**
Svetoslavf7c06eb2015-06-10 18:43:22 -07005451 * Adds a listener for permission changes for installed packages.
5452 *
5453 * @param listener The listener to add.
5454 *
5455 * @hide
5456 */
5457 @SystemApi
5458 @RequiresPermission(Manifest.permission.OBSERVE_GRANT_REVOKE_PERMISSIONS)
5459 public abstract void addOnPermissionsChangeListener(OnPermissionsChangedListener listener);
5460
5461 /**
5462 * Remvoes a listener for permission changes for installed packages.
5463 *
5464 * @param listener The listener to remove.
5465 *
5466 * @hide
5467 */
5468 @SystemApi
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06005469 @RequiresPermission(Manifest.permission.OBSERVE_GRANT_REVOKE_PERMISSIONS)
Svetoslavf7c06eb2015-06-10 18:43:22 -07005470 public abstract void removeOnPermissionsChangeListener(OnPermissionsChangedListener listener);
5471
5472 /**
dcashman9d2f4412014-06-09 09:27:54 -07005473 * Return the {@link KeySet} associated with the String alias for this
5474 * application.
5475 *
5476 * @param alias The alias for a given {@link KeySet} as defined in the
5477 * application's AndroidManifest.xml.
dcashmanc6f22492014-08-14 09:54:51 -07005478 * @hide
dcashman9d2f4412014-06-09 09:27:54 -07005479 */
5480 public abstract KeySet getKeySetByAlias(String packageName, String alias);
5481
Ihab Awad1ec68882014-09-12 11:09:01 -07005482 /** Return the signing {@link KeySet} for this application.
dcashmanc6f22492014-08-14 09:54:51 -07005483 * @hide
5484 */
dcashman9d2f4412014-06-09 09:27:54 -07005485 public abstract KeySet getSigningKeySet(String packageName);
5486
5487 /**
5488 * Return whether the package denoted by packageName has been signed by all
5489 * of the keys specified by the {@link KeySet} ks. This will return true if
5490 * the package has been signed by additional keys (a superset) as well.
5491 * Compare to {@link #isSignedByExactly(String packageName, KeySet ks)}.
dcashmanc6f22492014-08-14 09:54:51 -07005492 * @hide
dcashman9d2f4412014-06-09 09:27:54 -07005493 */
5494 public abstract boolean isSignedBy(String packageName, KeySet ks);
5495
5496 /**
5497 * Return whether the package denoted by packageName has been signed by all
5498 * of, and only, the keys specified by the {@link KeySet} ks. Compare to
5499 * {@link #isSignedBy(String packageName, KeySet ks)}.
dcashmanc6f22492014-08-14 09:54:51 -07005500 * @hide
dcashman9d2f4412014-06-09 09:27:54 -07005501 */
5502 public abstract boolean isSignedByExactly(String packageName, KeySet ks);
5503
5504 /**
Andrei Stingaceanueb84b182016-01-26 18:39:55 +00005505 * Puts the package in a suspended state, where attempts at starting activities are denied.
Andrei Stingaceanu1e283912015-11-26 15:26:28 +00005506 *
Andrei Stingaceanueb84b182016-01-26 18:39:55 +00005507 * <p>It doesn't remove the data or the actual package file. The application notifications
5508 * will be hidden, the application will not show up in recents, will not be able to show
5509 * toasts or dialogs or ring the device.
5510 *
Kenny Guy871f3eb2016-03-09 20:06:16 +00005511 * <p>The package must already be installed. If the package is uninstalled while suspended
5512 * the package will no longer be suspended.
5513 *
Andrei Stingaceanueb84b182016-01-26 18:39:55 +00005514 * @param packageNames The names of the packages to set the suspended status.
5515 * @param suspended If set to {@code true} than the packages will be suspended, if set to
5516 * {@code false} the packages will be unsuspended.
Andrei Stingaceanu1e283912015-11-26 15:26:28 +00005517 * @param userId The user id.
5518 *
Andrei Stingaceanueb84b182016-01-26 18:39:55 +00005519 * @return an array of package names for which the suspended status is not set as requested in
5520 * this method.
5521 *
Andrei Stingaceanu1e283912015-11-26 15:26:28 +00005522 * @hide
5523 */
Andrei Stingaceanueb84b182016-01-26 18:39:55 +00005524 public abstract String[] setPackagesSuspendedAsUser(
5525 String[] packageNames, boolean suspended, @UserIdInt int userId);
Andrei Stingaceanu1e283912015-11-26 15:26:28 +00005526
Andrei Stingaceanu355b2322016-02-12 16:43:51 +00005527 /**
5528 * @see #setPackageSuspendedAsUser(String, boolean, int)
5529 * @param packageName The name of the package to get the suspended status of.
5530 * @param userId The user id.
5531 * @return {@code true} if the package is suspended or {@code false} if the package is not
5532 * suspended or could not be found.
5533 * @hide
5534 */
5535 public abstract boolean isPackageSuspendedForUser(String packageName, int userId);
5536
Jeff Sharkey9bc89af2017-01-11 11:25:50 -07005537 /**
5538 * Provide a hint of what the {@link ApplicationInfo#category} value should
5539 * be for the given package.
5540 * <p>
5541 * This hint can only be set by the app which installed this package, as
5542 * determined by {@link #getInstallerPackageName(String)}.
Jeff Sharkey60a82cd2017-04-18 18:19:16 -06005543 *
5544 * @param packageName the package to change the category hint for.
Jeff Sharkey4347f812017-04-21 12:08:39 -06005545 * @param categoryHint the category hint to set.
Jeff Sharkey9bc89af2017-01-11 11:25:50 -07005546 */
Jeff Sharkey60a82cd2017-04-18 18:19:16 -06005547 public abstract void setApplicationCategoryHint(@NonNull String packageName,
Jeff Sharkey9bc89af2017-01-11 11:25:50 -07005548 @ApplicationInfo.Category int categoryHint);
5549
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -07005550 /** {@hide} */
Jeff Sharkey620b32b2015-04-23 19:36:02 -07005551 public static boolean isMoveStatusFinished(int status) {
5552 return (status < 0 || status > 100);
5553 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005554
Jeff Sharkeye2d45be2015-04-15 17:14:12 -07005555 /** {@hide} */
Jeff Sharkey620b32b2015-04-23 19:36:02 -07005556 public static abstract class MoveCallback {
Jeff Sharkey50a05452015-04-29 11:24:52 -07005557 public void onCreated(int moveId, Bundle extras) {}
5558 public abstract void onStatusChanged(int moveId, int status, long estMillis);
Jeff Sharkey620b32b2015-04-23 19:36:02 -07005559 }
Jeff Sharkeye2d45be2015-04-15 17:14:12 -07005560
5561 /** {@hide} */
Jeff Sharkey620b32b2015-04-23 19:36:02 -07005562 public abstract int getMoveStatus(int moveId);
5563
5564 /** {@hide} */
5565 public abstract void registerMoveCallback(MoveCallback callback, Handler handler);
5566 /** {@hide} */
5567 public abstract void unregisterMoveCallback(MoveCallback callback);
5568
5569 /** {@hide} */
5570 public abstract int movePackage(String packageName, VolumeInfo vol);
5571 /** {@hide} */
5572 public abstract @Nullable VolumeInfo getPackageCurrentVolume(ApplicationInfo app);
5573 /** {@hide} */
5574 public abstract @NonNull List<VolumeInfo> getPackageCandidateVolumes(ApplicationInfo app);
5575
5576 /** {@hide} */
5577 public abstract int movePrimaryStorage(VolumeInfo vol);
5578 /** {@hide} */
5579 public abstract @Nullable VolumeInfo getPrimaryStorageCurrentVolume();
5580 /** {@hide} */
5581 public abstract @NonNull List<VolumeInfo> getPrimaryStorageCandidateVolumes();
Jeff Sharkeye2d45be2015-04-15 17:14:12 -07005582
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005583 /**
Amith Yamasani13593602012-03-22 16:16:17 -07005584 * Returns the device identity that verifiers can use to associate their scheme to a particular
5585 * device. This should not be used by anything other than a package verifier.
Aravind Akella068b0c02013-10-12 17:39:15 -07005586 *
Kenny Root0aaa0d92011-09-12 16:42:55 -07005587 * @return identity that uniquely identifies current device
5588 * @hide
5589 */
5590 public abstract VerifierDeviceIdentity getVerifierDeviceIdentity();
Amith Yamasani742a6712011-05-04 14:49:28 -07005591
Jeff Sharkey6c833e02014-07-14 22:44:30 -07005592 /**
Jeff Hao9f60c082014-10-28 18:51:07 -07005593 * Returns true if the device is upgrading, such as first boot after OTA.
5594 *
5595 * @hide
5596 */
5597 public abstract boolean isUpgrade();
5598
5599 /**
Jeff Sharkey6c833e02014-07-14 22:44:30 -07005600 * Return interface that offers the ability to install, upgrade, and remove
5601 * applications on the device.
5602 */
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005603 public abstract @NonNull PackageInstaller getPackageInstaller();
Jeff Sharkey3a44f3f2014-04-28 17:36:31 -07005604
Amith Yamasani742a6712011-05-04 14:49:28 -07005605 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005606 * Adds a {@code CrossProfileIntentFilter}. After calling this method all
5607 * intents sent from the user with id sourceUserId can also be be resolved
5608 * by activities in the user with id targetUserId if they match the
5609 * specified intent filter.
5610 *
Nicolas Prevot3f7777f2014-07-24 15:58:39 +01005611 * @param filter The {@link IntentFilter} the intent has to match
5612 * @param sourceUserId The source user id.
5613 * @param targetUserId The target user id.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005614 * @param flags The possible values are {@link #SKIP_CURRENT_PROFILE} and
5615 * {@link #ONLY_IF_NO_MATCH_FOUND}.
Nicolas Prevotc79586e2014-05-06 12:47:57 +01005616 * @hide
5617 */
Nicolas Prevot63798c52014-05-27 13:22:38 +01005618 public abstract void addCrossProfileIntentFilter(IntentFilter filter, int sourceUserId,
5619 int targetUserId, int flags);
Nicolas Prevotc79586e2014-05-06 12:47:57 +01005620
5621 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005622 * Clearing {@code CrossProfileIntentFilter}s which have the specified user
5623 * as their source, and have been set by the app calling this method.
5624 *
Nicolas Prevot3f7777f2014-07-24 15:58:39 +01005625 * @param sourceUserId The source user id.
Nicolas Prevotc79586e2014-05-06 12:47:57 +01005626 * @hide
5627 */
Nicolas Prevot81948992014-05-16 18:25:26 +01005628 public abstract void clearCrossProfileIntentFilters(int sourceUserId);
Alexandra Gherghina6e2ae252014-06-12 16:03:58 +01005629
5630 /**
Nicolas Prevot88cc3462014-05-14 14:51:48 +01005631 * @hide
5632 */
Nicolas Prevot7f7b0c72014-06-23 15:59:38 +01005633 public abstract Drawable loadItemIcon(PackageItemInfo itemInfo, ApplicationInfo appInfo);
Jeff Sharkey6c833e02014-07-14 22:44:30 -07005634
Benjamin Franzec2d48b2014-10-01 15:38:43 +01005635 /**
5636 * @hide
5637 */
5638 public abstract Drawable loadUnbadgedItemIcon(PackageItemInfo itemInfo, ApplicationInfo appInfo);
5639
Jeff Sharkey6c833e02014-07-14 22:44:30 -07005640 /** {@hide} */
5641 public abstract boolean isPackageAvailable(String packageName);
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005642
5643 /** {@hide} */
Jeff Sharkeya0907432014-08-15 10:23:11 -07005644 public static String installStatusToString(int status, String msg) {
5645 final String str = installStatusToString(status);
5646 if (msg != null) {
5647 return str + ": " + msg;
5648 } else {
5649 return str;
5650 }
5651 }
5652
5653 /** {@hide} */
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005654 public static String installStatusToString(int status) {
5655 switch (status) {
5656 case INSTALL_SUCCEEDED: return "INSTALL_SUCCEEDED";
5657 case INSTALL_FAILED_ALREADY_EXISTS: return "INSTALL_FAILED_ALREADY_EXISTS";
5658 case INSTALL_FAILED_INVALID_APK: return "INSTALL_FAILED_INVALID_APK";
5659 case INSTALL_FAILED_INVALID_URI: return "INSTALL_FAILED_INVALID_URI";
5660 case INSTALL_FAILED_INSUFFICIENT_STORAGE: return "INSTALL_FAILED_INSUFFICIENT_STORAGE";
5661 case INSTALL_FAILED_DUPLICATE_PACKAGE: return "INSTALL_FAILED_DUPLICATE_PACKAGE";
5662 case INSTALL_FAILED_NO_SHARED_USER: return "INSTALL_FAILED_NO_SHARED_USER";
5663 case INSTALL_FAILED_UPDATE_INCOMPATIBLE: return "INSTALL_FAILED_UPDATE_INCOMPATIBLE";
5664 case INSTALL_FAILED_SHARED_USER_INCOMPATIBLE: return "INSTALL_FAILED_SHARED_USER_INCOMPATIBLE";
5665 case INSTALL_FAILED_MISSING_SHARED_LIBRARY: return "INSTALL_FAILED_MISSING_SHARED_LIBRARY";
5666 case INSTALL_FAILED_REPLACE_COULDNT_DELETE: return "INSTALL_FAILED_REPLACE_COULDNT_DELETE";
5667 case INSTALL_FAILED_DEXOPT: return "INSTALL_FAILED_DEXOPT";
5668 case INSTALL_FAILED_OLDER_SDK: return "INSTALL_FAILED_OLDER_SDK";
5669 case INSTALL_FAILED_CONFLICTING_PROVIDER: return "INSTALL_FAILED_CONFLICTING_PROVIDER";
5670 case INSTALL_FAILED_NEWER_SDK: return "INSTALL_FAILED_NEWER_SDK";
5671 case INSTALL_FAILED_TEST_ONLY: return "INSTALL_FAILED_TEST_ONLY";
5672 case INSTALL_FAILED_CPU_ABI_INCOMPATIBLE: return "INSTALL_FAILED_CPU_ABI_INCOMPATIBLE";
5673 case INSTALL_FAILED_MISSING_FEATURE: return "INSTALL_FAILED_MISSING_FEATURE";
5674 case INSTALL_FAILED_CONTAINER_ERROR: return "INSTALL_FAILED_CONTAINER_ERROR";
5675 case INSTALL_FAILED_INVALID_INSTALL_LOCATION: return "INSTALL_FAILED_INVALID_INSTALL_LOCATION";
5676 case INSTALL_FAILED_MEDIA_UNAVAILABLE: return "INSTALL_FAILED_MEDIA_UNAVAILABLE";
5677 case INSTALL_FAILED_VERIFICATION_TIMEOUT: return "INSTALL_FAILED_VERIFICATION_TIMEOUT";
5678 case INSTALL_FAILED_VERIFICATION_FAILURE: return "INSTALL_FAILED_VERIFICATION_FAILURE";
5679 case INSTALL_FAILED_PACKAGE_CHANGED: return "INSTALL_FAILED_PACKAGE_CHANGED";
5680 case INSTALL_FAILED_UID_CHANGED: return "INSTALL_FAILED_UID_CHANGED";
5681 case INSTALL_FAILED_VERSION_DOWNGRADE: return "INSTALL_FAILED_VERSION_DOWNGRADE";
5682 case INSTALL_PARSE_FAILED_NOT_APK: return "INSTALL_PARSE_FAILED_NOT_APK";
5683 case INSTALL_PARSE_FAILED_BAD_MANIFEST: return "INSTALL_PARSE_FAILED_BAD_MANIFEST";
5684 case INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION: return "INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION";
5685 case INSTALL_PARSE_FAILED_NO_CERTIFICATES: return "INSTALL_PARSE_FAILED_NO_CERTIFICATES";
5686 case INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES: return "INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES";
5687 case INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING: return "INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING";
5688 case INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME: return "INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME";
5689 case INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID: return "INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID";
5690 case INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: return "INSTALL_PARSE_FAILED_MANIFEST_MALFORMED";
5691 case INSTALL_PARSE_FAILED_MANIFEST_EMPTY: return "INSTALL_PARSE_FAILED_MANIFEST_EMPTY";
5692 case INSTALL_FAILED_INTERNAL_ERROR: return "INSTALL_FAILED_INTERNAL_ERROR";
5693 case INSTALL_FAILED_USER_RESTRICTED: return "INSTALL_FAILED_USER_RESTRICTED";
5694 case INSTALL_FAILED_DUPLICATE_PERMISSION: return "INSTALL_FAILED_DUPLICATE_PERMISSION";
5695 case INSTALL_FAILED_NO_MATCHING_ABIS: return "INSTALL_FAILED_NO_MATCHING_ABIS";
Jeff Sharkeyf0600952014-08-07 17:31:53 -07005696 case INSTALL_FAILED_ABORTED: return "INSTALL_FAILED_ABORTED";
Calin Juravle3fc56c32017-12-11 18:26:13 -08005697 case INSTALL_FAILED_BAD_DEX_METADATA:
5698 return "INSTALL_FAILED_BAD_DEX_METADATA";
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005699 default: return Integer.toString(status);
5700 }
5701 }
5702
5703 /** {@hide} */
Jeff Sharkeya0907432014-08-15 10:23:11 -07005704 public static int installStatusToPublicStatus(int status) {
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005705 switch (status) {
Jeff Sharkeya0907432014-08-15 10:23:11 -07005706 case INSTALL_SUCCEEDED: return PackageInstaller.STATUS_SUCCESS;
5707 case INSTALL_FAILED_ALREADY_EXISTS: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5708 case INSTALL_FAILED_INVALID_APK: return PackageInstaller.STATUS_FAILURE_INVALID;
5709 case INSTALL_FAILED_INVALID_URI: return PackageInstaller.STATUS_FAILURE_INVALID;
5710 case INSTALL_FAILED_INSUFFICIENT_STORAGE: return PackageInstaller.STATUS_FAILURE_STORAGE;
5711 case INSTALL_FAILED_DUPLICATE_PACKAGE: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5712 case INSTALL_FAILED_NO_SHARED_USER: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5713 case INSTALL_FAILED_UPDATE_INCOMPATIBLE: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5714 case INSTALL_FAILED_SHARED_USER_INCOMPATIBLE: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5715 case INSTALL_FAILED_MISSING_SHARED_LIBRARY: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5716 case INSTALL_FAILED_REPLACE_COULDNT_DELETE: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5717 case INSTALL_FAILED_DEXOPT: return PackageInstaller.STATUS_FAILURE_INVALID;
5718 case INSTALL_FAILED_OLDER_SDK: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5719 case INSTALL_FAILED_CONFLICTING_PROVIDER: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5720 case INSTALL_FAILED_NEWER_SDK: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5721 case INSTALL_FAILED_TEST_ONLY: return PackageInstaller.STATUS_FAILURE_INVALID;
5722 case INSTALL_FAILED_CPU_ABI_INCOMPATIBLE: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5723 case INSTALL_FAILED_MISSING_FEATURE: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5724 case INSTALL_FAILED_CONTAINER_ERROR: return PackageInstaller.STATUS_FAILURE_STORAGE;
5725 case INSTALL_FAILED_INVALID_INSTALL_LOCATION: return PackageInstaller.STATUS_FAILURE_STORAGE;
5726 case INSTALL_FAILED_MEDIA_UNAVAILABLE: return PackageInstaller.STATUS_FAILURE_STORAGE;
5727 case INSTALL_FAILED_VERIFICATION_TIMEOUT: return PackageInstaller.STATUS_FAILURE_ABORTED;
5728 case INSTALL_FAILED_VERIFICATION_FAILURE: return PackageInstaller.STATUS_FAILURE_ABORTED;
5729 case INSTALL_FAILED_PACKAGE_CHANGED: return PackageInstaller.STATUS_FAILURE_INVALID;
5730 case INSTALL_FAILED_UID_CHANGED: return PackageInstaller.STATUS_FAILURE_INVALID;
5731 case INSTALL_FAILED_VERSION_DOWNGRADE: return PackageInstaller.STATUS_FAILURE_INVALID;
Svetoslavd9653702015-05-13 18:02:46 -07005732 case INSTALL_FAILED_PERMISSION_MODEL_DOWNGRADE: return PackageInstaller.STATUS_FAILURE_INVALID;
Jeff Sharkeya0907432014-08-15 10:23:11 -07005733 case INSTALL_PARSE_FAILED_NOT_APK: return PackageInstaller.STATUS_FAILURE_INVALID;
5734 case INSTALL_PARSE_FAILED_BAD_MANIFEST: return PackageInstaller.STATUS_FAILURE_INVALID;
5735 case INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION: return PackageInstaller.STATUS_FAILURE_INVALID;
5736 case INSTALL_PARSE_FAILED_NO_CERTIFICATES: return PackageInstaller.STATUS_FAILURE_INVALID;
5737 case INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES: return PackageInstaller.STATUS_FAILURE_INVALID;
5738 case INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING: return PackageInstaller.STATUS_FAILURE_INVALID;
5739 case INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME: return PackageInstaller.STATUS_FAILURE_INVALID;
5740 case INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID: return PackageInstaller.STATUS_FAILURE_INVALID;
5741 case INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: return PackageInstaller.STATUS_FAILURE_INVALID;
5742 case INSTALL_PARSE_FAILED_MANIFEST_EMPTY: return PackageInstaller.STATUS_FAILURE_INVALID;
Calin Juravle3fc56c32017-12-11 18:26:13 -08005743 case INSTALL_FAILED_BAD_DEX_METADATA: return PackageInstaller.STATUS_FAILURE_INVALID;
Jeff Sharkeya0907432014-08-15 10:23:11 -07005744 case INSTALL_FAILED_INTERNAL_ERROR: return PackageInstaller.STATUS_FAILURE;
5745 case INSTALL_FAILED_USER_RESTRICTED: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5746 case INSTALL_FAILED_DUPLICATE_PERMISSION: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5747 case INSTALL_FAILED_NO_MATCHING_ABIS: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5748 case INSTALL_FAILED_ABORTED: return PackageInstaller.STATUS_FAILURE_ABORTED;
5749 default: return PackageInstaller.STATUS_FAILURE;
5750 }
5751 }
5752
5753 /** {@hide} */
5754 public static String deleteStatusToString(int status, String msg) {
5755 final String str = deleteStatusToString(status);
5756 if (msg != null) {
5757 return str + ": " + msg;
5758 } else {
5759 return str;
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005760 }
5761 }
5762
5763 /** {@hide} */
5764 public static String deleteStatusToString(int status) {
5765 switch (status) {
5766 case DELETE_SUCCEEDED: return "DELETE_SUCCEEDED";
5767 case DELETE_FAILED_INTERNAL_ERROR: return "DELETE_FAILED_INTERNAL_ERROR";
5768 case DELETE_FAILED_DEVICE_POLICY_MANAGER: return "DELETE_FAILED_DEVICE_POLICY_MANAGER";
5769 case DELETE_FAILED_USER_RESTRICTED: return "DELETE_FAILED_USER_RESTRICTED";
5770 case DELETE_FAILED_OWNER_BLOCKED: return "DELETE_FAILED_OWNER_BLOCKED";
Jeff Sharkeyf0600952014-08-07 17:31:53 -07005771 case DELETE_FAILED_ABORTED: return "DELETE_FAILED_ABORTED";
Svet Ganov67882122016-12-11 16:36:34 -08005772 case DELETE_FAILED_USED_SHARED_LIBRARY: return "DELETE_FAILED_USED_SHARED_LIBRARY";
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005773 default: return Integer.toString(status);
5774 }
5775 }
Jeff Sharkeyf0600952014-08-07 17:31:53 -07005776
5777 /** {@hide} */
Jeff Sharkeya0907432014-08-15 10:23:11 -07005778 public static int deleteStatusToPublicStatus(int status) {
Jeff Sharkeyf0600952014-08-07 17:31:53 -07005779 switch (status) {
Jeff Sharkeya0907432014-08-15 10:23:11 -07005780 case DELETE_SUCCEEDED: return PackageInstaller.STATUS_SUCCESS;
5781 case DELETE_FAILED_INTERNAL_ERROR: return PackageInstaller.STATUS_FAILURE;
5782 case DELETE_FAILED_DEVICE_POLICY_MANAGER: return PackageInstaller.STATUS_FAILURE_BLOCKED;
5783 case DELETE_FAILED_USER_RESTRICTED: return PackageInstaller.STATUS_FAILURE_BLOCKED;
5784 case DELETE_FAILED_OWNER_BLOCKED: return PackageInstaller.STATUS_FAILURE_BLOCKED;
5785 case DELETE_FAILED_ABORTED: return PackageInstaller.STATUS_FAILURE_ABORTED;
Svet Ganov67882122016-12-11 16:36:34 -08005786 case DELETE_FAILED_USED_SHARED_LIBRARY: return PackageInstaller.STATUS_FAILURE_CONFLICT;
Jeff Sharkeya0907432014-08-15 10:23:11 -07005787 default: return PackageInstaller.STATUS_FAILURE;
Jeff Sharkeyf0600952014-08-07 17:31:53 -07005788 }
5789 }
Jeff Sharkey6c0b9da2014-08-07 22:07:11 -07005790
5791 /** {@hide} */
Svet Ganov77ab6a82015-07-03 12:03:02 -07005792 public static String permissionFlagToString(int flag) {
5793 switch (flag) {
Svetoslav4a5f4a22015-07-07 18:18:15 -07005794 case FLAG_PERMISSION_GRANTED_BY_DEFAULT: return "GRANTED_BY_DEFAULT";
5795 case FLAG_PERMISSION_POLICY_FIXED: return "POLICY_FIXED";
5796 case FLAG_PERMISSION_SYSTEM_FIXED: return "SYSTEM_FIXED";
5797 case FLAG_PERMISSION_USER_SET: return "USER_SET";
5798 case FLAG_PERMISSION_REVOKE_ON_UPGRADE: return "REVOKE_ON_UPGRADE";
5799 case FLAG_PERMISSION_USER_FIXED: return "USER_FIXED";
Svet Ganov9c165d72015-12-01 19:52:26 -08005800 case FLAG_PERMISSION_REVIEW_REQUIRED: return "REVIEW_REQUIRED";
Svet Ganov77ab6a82015-07-03 12:03:02 -07005801 default: return Integer.toString(flag);
5802 }
5803 }
5804
5805 /** {@hide} */
Jeff Sharkey6c0b9da2014-08-07 22:07:11 -07005806 public static class LegacyPackageDeleteObserver extends PackageDeleteObserver {
5807 private final IPackageDeleteObserver mLegacy;
5808
5809 public LegacyPackageDeleteObserver(IPackageDeleteObserver legacy) {
5810 mLegacy = legacy;
5811 }
5812
5813 @Override
5814 public void onPackageDeleted(String basePackageName, int returnCode, String msg) {
5815 if (mLegacy == null) return;
5816 try {
5817 mLegacy.packageDeleted(basePackageName, returnCode);
5818 } catch (RemoteException ignored) {
5819 }
5820 }
5821 }
Bartosz Fabianowskia34f53f2017-01-11 18:08:47 +01005822
5823 /**
Jeff Sharkey4347f812017-04-21 12:08:39 -06005824 * Return the install reason that was recorded when a package was first
5825 * installed for a specific user. Requesting the install reason for another
5826 * user will require the permission INTERACT_ACROSS_USERS_FULL.
Bartosz Fabianowskia34f53f2017-01-11 18:08:47 +01005827 *
5828 * @param packageName The package for which to retrieve the install reason
5829 * @param user The user for whom to retrieve the install reason
Jeff Sharkey4347f812017-04-21 12:08:39 -06005830 * @return The install reason. If the package is not installed for the given
5831 * user, {@code INSTALL_REASON_UNKNOWN} is returned.
Bartosz Fabianowskia34f53f2017-01-11 18:08:47 +01005832 * @hide
5833 */
5834 @TestApi
5835 public abstract @InstallReason int getInstallReason(String packageName,
5836 @NonNull UserHandle user);
Suprabh Shuklaaef25132017-01-23 18:09:03 -08005837
5838 /**
5839 * Checks whether the calling package is allowed to request package installs through package
Suprabh Shukla57528472017-04-14 19:22:45 -07005840 * installer. Apps are encouraged to call this API before launching the package installer via
Suprabh Shuklaaef25132017-01-23 18:09:03 -08005841 * intent {@link android.content.Intent#ACTION_INSTALL_PACKAGE}. Starting from Android O, the
5842 * user can explicitly choose what external sources they trust to install apps on the device.
Suprabh Shukla57528472017-04-14 19:22:45 -07005843 * If this API returns false, the install request will be blocked by the package installer and
Suprabh Shuklaaef25132017-01-23 18:09:03 -08005844 * a dialog will be shown to the user with an option to launch settings to change their
5845 * preference. An application must target Android O or higher and declare permission
Suprabh Shukla57528472017-04-14 19:22:45 -07005846 * {@link android.Manifest.permission#REQUEST_INSTALL_PACKAGES} in order to use this API.
Suprabh Shuklaaef25132017-01-23 18:09:03 -08005847 *
5848 * @return true if the calling package is trusted by the user to request install packages on
5849 * the device, false otherwise.
Suprabh Shukla57528472017-04-14 19:22:45 -07005850 * @see android.content.Intent#ACTION_INSTALL_PACKAGE
5851 * @see android.provider.Settings#ACTION_MANAGE_UNKNOWN_APP_SOURCES
Suprabh Shuklaaef25132017-01-23 18:09:03 -08005852 */
5853 public abstract boolean canRequestPackageInstalls();
Chad Brubakeraa49cb82017-03-24 15:53:09 -07005854
5855 /**
5856 * Return the {@link ComponentName} of the activity providing Settings for the Instant App
5857 * resolver.
5858 *
Todd Kennedy801e6592017-04-12 14:10:12 -07005859 * @see {@link android.content.Intent#ACTION_INSTANT_APP_RESOLVER_SETTINGS}
Chad Brubakeraa49cb82017-03-24 15:53:09 -07005860 * @hide
5861 */
5862 @SystemApi
5863 public abstract ComponentName getInstantAppResolverSettingsComponent();
Todd Kennedy801e6592017-04-12 14:10:12 -07005864
5865 /**
5866 * Return the {@link ComponentName} of the activity responsible for installing instant
5867 * applications.
5868 *
5869 * @see {@link android.content.Intent#ACTION_INSTALL_INSTANT_APP_PACKAGE}
5870 * @hide
5871 */
5872 @SystemApi
5873 public abstract ComponentName getInstantAppInstallerComponent();
Chad Brubaker0d277a72017-04-12 16:56:53 -07005874
5875 /**
5876 * Return the Android Id for a given Instant App.
5877 *
5878 * @see {@link android.provider.Settings.Secure#ANDROID_ID}
5879 * @hide
5880 */
5881 public abstract String getInstantAppAndroidId(String packageName, @NonNull UserHandle user);
Calin Juravle3d2af7f2017-04-19 19:56:21 -07005882
5883 /**
5884 * Callback use to notify the callers of module registration that the operation
5885 * has finished.
5886 *
5887 * @hide
5888 */
Jeff Sharkey90396362017-06-12 16:26:53 -06005889 @SystemApi
Calin Juravle3d2af7f2017-04-19 19:56:21 -07005890 public static abstract class DexModuleRegisterCallback {
5891 public abstract void onDexModuleRegistered(String dexModulePath, boolean success,
5892 String message);
5893 }
5894
5895 /**
5896 * Register an application dex module with the package manager.
5897 * The package manager will keep track of the given module for future optimizations.
5898 *
5899 * Dex module optimizations will disable the classpath checking at runtime. The client bares
5900 * the responsibility to ensure that the static assumptions on classes in the optimized code
5901 * hold at runtime (e.g. there's no duplicate classes in the classpath).
5902 *
5903 * Note that the package manager already keeps track of dex modules loaded with
5904 * {@link dalvik.system.DexClassLoader} and {@link dalvik.system.PathClassLoader}.
5905 * This can be called for an eager registration.
5906 *
5907 * The call might take a while and the results will be posted on the main thread, using
5908 * the given callback.
5909 *
5910 * If the module is intended to be shared with other apps, make sure that the file
5911 * permissions allow for it.
5912 * If at registration time the permissions allow for others to read it, the module would
5913 * be marked as a shared module which might undergo a different optimization strategy.
5914 * (usually shared modules will generated larger optimizations artifacts,
5915 * taking more disk space).
5916 *
5917 * @param dexModulePath the absolute path of the dex module.
5918 * @param callback if not null, {@link DexModuleRegisterCallback#onDexModuleRegistered} will
5919 * be called once the registration finishes.
5920 *
5921 * @hide
5922 */
Jeff Sharkey90396362017-06-12 16:26:53 -06005923 @SystemApi
Calin Juravle3d2af7f2017-04-19 19:56:21 -07005924 public abstract void registerDexModule(String dexModulePath,
5925 @Nullable DexModuleRegisterCallback callback);
Calin Juravle45f8b292017-11-07 18:49:43 -08005926
5927 /**
5928 * Returns the {@link ArtManager} associated with this package manager.
5929 *
5930 * @hide
5931 */
5932 @SystemApi
5933 public @NonNull ArtManager getArtManager() {
5934 throw new UnsupportedOperationException("getArtManager not implemented in subclass");
5935 }
Ben Gruver1ab3d6e2017-12-07 13:45:08 -08005936
5937 /**
5938 * Sets or clears the harmful app warning details for the given app.
5939 *
5940 * When set, any attempt to launch an activity in this package will be intercepted and a
5941 * warning dialog will be shown to the user instead, with the given warning. The user
5942 * will have the option to proceed with the activity launch, or to uninstall the application.
5943 *
5944 * @param packageName The full name of the package to warn on.
5945 * @param warning A warning string to display to the user describing the threat posed by the
5946 * application, or null to clear the warning.
5947 *
5948 * @hide
5949 */
5950 @RequiresPermission(Manifest.permission.SET_HARMFUL_APP_WARNINGS)
5951 @SystemApi
5952 public void setHarmfulAppWarning(@NonNull String packageName, @Nullable CharSequence warning) {
5953 throw new UnsupportedOperationException("setHarmfulAppWarning not implemented in subclass");
5954 }
5955
5956 /**
5957 * Returns the harmful app warning string for the given app, or null if there is none set.
5958 *
5959 * @param packageName The full name of the desired package.
5960 *
5961 * @hide
5962 */
5963 @RequiresPermission(Manifest.permission.SET_HARMFUL_APP_WARNINGS)
5964 @Nullable
5965 @SystemApi
5966 public CharSequence getHarmfulAppWarning(@NonNull String packageName) {
5967 throw new UnsupportedOperationException("getHarmfulAppWarning not implemented in subclass");
5968 }
Daniel Cashman5cdda342018-01-19 07:22:52 -08005969
5970 /** @hide */
5971 @IntDef(prefix = { "CERT_INPUT_" }, value = {
5972 CERT_INPUT_RAW_X509,
5973 CERT_INPUT_SHA256
5974 })
5975 @Retention(RetentionPolicy.SOURCE)
5976 public @interface CertificateInputType {}
5977
5978 /**
5979 * Certificate input bytes: the input bytes represent an encoded X.509 Certificate which could
5980 * be generated using an {@code CertificateFactory}
5981 */
5982 public static final int CERT_INPUT_RAW_X509 = 0;
5983
5984 /**
5985 * Certificate input bytes: the input bytes represent the SHA256 output of an encoded X.509
5986 * Certificate.
5987 */
5988 public static final int CERT_INPUT_SHA256 = 1;
5989
5990 /**
5991 * Searches the set of signing certificates by which the given package has proven to have been
5992 * signed. This should be used instead of {@code getPackageInfo} with {@code GET_SIGNATURES}
5993 * since it takes into account the possibility of signing certificate rotation, except in the
5994 * case of packages that are signed by multiple certificates, for which signing certificate
5995 * rotation is not supported.
5996 *
5997 * @param packageName package whose signing certificates to check
5998 * @param certificate signing certificate for which to search
5999 * @param type representation of the {@code certificate}
6000 * @return true if this package was or is signed by exactly the certificate {@code certificate}
6001 */
6002 public boolean hasSigningCertificate(
6003 String packageName, byte[] certificate, @CertificateInputType int type) {
6004 throw new UnsupportedOperationException(
6005 "hasSigningCertificate not implemented in subclass");
6006 }
6007
6008 /**
6009 * Searches the set of signing certificates by which the given uid has proven to have been
6010 * signed. This should be used instead of {@code getPackageInfo} with {@code GET_SIGNATURES}
6011 * since it takes into account the possibility of signing certificate rotation, except in the
6012 * case of packages that are signed by multiple certificates, for which signing certificate
6013 * rotation is not supported.
6014 *
6015 * @param uid package whose signing certificates to check
6016 * @param certificate signing certificate for which to search
6017 * @param type representation of the {@code certificate}
6018 * @return true if this package was or is signed by exactly the certificate {@code certificate}
6019 */
6020 public boolean hasSigningCertificate(
6021 int uid, byte[] certificate, @CertificateInputType int type) {
6022 throw new UnsupportedOperationException(
6023 "hasSigningCertificate not implemented in subclass");
6024 }
Makoto Onuki700feef2018-02-15 10:59:41 -08006025
6026 /**
6027 * @return the system defined text classifier package name, or null if there's none.
6028 *
6029 * @hide
6030 */
6031 public String getSystemTextClassifierPackageName() {
6032 throw new UnsupportedOperationException(
6033 "getSystemTextClassifierPackageName not implemented in subclass");
6034 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08006035}