blob: 67c9584b01f750ea944e0d8f239c829fb0d1b467 [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
Todd Kennedyd6ee0ba2016-03-31 15:11:11 -0700444 public static final int MATCH_FACTORY_ONLY = 0x00200000;
445
446 /**
Amith Yamasani0d1fd8d2016-10-12 14:21:51 -0700447 * Allows querying of packages installed for any user, not just the specific one. This flag
Amith Yamasani475f9a32016-12-08 09:46:15 -0800448 * is only meant for use by apps that have INTERACT_ACROSS_USERS permission.
Amith Yamasani0d1fd8d2016-10-12 14:21:51 -0700449 * @hide
450 */
Amith Yamasani475f9a32016-12-08 09:46:15 -0800451 @SystemApi
Amith Yamasani0d1fd8d2016-10-12 14:21:51 -0700452 public static final int MATCH_ANY_USER = 0x00400000;
453
454 /**
455 * Combination of MATCH_ANY_USER and MATCH_UNINSTALLED_PACKAGES to mean any known
456 * package.
457 * @hide
458 */
459 public static final int MATCH_KNOWN_PACKAGES = MATCH_UNINSTALLED_PACKAGES | MATCH_ANY_USER;
460
461 /**
Todd Kennedy7bc3a702016-12-08 14:54:48 -0800462 * Internal {@link PackageInfo} flag: include components that are part of an
Todd Kennedybe0b8892017-02-15 14:13:52 -0800463 * instant app. By default, instant app components are not matched.
Todd Kennedy7bc3a702016-12-08 14:54:48 -0800464 * @hide
465 */
Todd Kennedy9c9fdf22017-03-06 10:58:27 -0800466 @SystemApi
Todd Kennedybe0b8892017-02-15 14:13:52 -0800467 public static final int MATCH_INSTANT = 0x00800000;
Todd Kennedy7bc3a702016-12-08 14:54:48 -0800468
469 /**
470 * Internal {@link PackageInfo} flag: include only components that are exposed to
Todd Kennedyc05f5d12017-04-25 11:11:40 -0700471 * instant apps. Matched components may have been either explicitly or implicitly
472 * exposed.
Todd Kennedy7bc3a702016-12-08 14:54:48 -0800473 * @hide
474 */
Todd Kennedybe0b8892017-02-15 14:13:52 -0800475 public static final int MATCH_VISIBLE_TO_INSTANT_APP_ONLY = 0x01000000;
Todd Kennedy7bc3a702016-12-08 14:54:48 -0800476
477 /**
Todd Kennedyc05f5d12017-04-25 11:11:40 -0700478 * Internal {@link PackageInfo} flag: include only components that have been
479 * explicitly exposed to instant apps.
480 * @hide
481 */
482 public static final int MATCH_EXPLICITLY_VISIBLE_ONLY = 0x02000000;
483
484 /**
Svet Ganov9e779772017-05-11 14:36:50 -0700485 * Internal {@link PackageInfo} flag: include static shared libraries.
486 * Apps that depend on static shared libs can always access the version
487 * of the lib they depend on. System/shell/root can access all shared
488 * libs regardless of dependency but need to explicitly ask for them
489 * via this flag.
490 * @hide
491 */
492 public static final int MATCH_STATIC_SHARED_LIBRARIES = 0x04000000;
493
494 /**
Daniel Cashman5cdda342018-01-19 07:22:52 -0800495 * {@link PackageInfo} flag: return the signing certificates associated with
496 * this package. Each entry is a signing certificate that the package
497 * has proven it is authorized to use, usually a past signing certificate from
498 * which it has rotated.
499 */
500 public static final int GET_SIGNING_CERTIFICATES = 0x08000000;
501
502 /**
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700503 * Internal flag used to indicate that a system component has done their
504 * homework and verified that they correctly handle packages and components
505 * that come and go over time. In particular:
506 * <ul>
507 * <li>Apps installed on external storage, which will appear to be
508 * uninstalled while the the device is ejected.
509 * <li>Apps with encryption unaware components, which will appear to not
510 * exist while the device is locked.
511 * </ul>
Jeff Sharkeye17ac152015-11-06 22:40:29 -0800512 *
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700513 * @see #MATCH_UNINSTALLED_PACKAGES
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600514 * @see #MATCH_DIRECT_BOOT_AWARE
515 * @see #MATCH_DIRECT_BOOT_UNAWARE
Jeff Sharkeye17ac152015-11-06 22:40:29 -0800516 * @hide
517 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700518 public static final int MATCH_DEBUG_TRIAGED_MISSING = 0x10000000;
Jeff Sharkeye17ac152015-11-06 22:40:29 -0800519
520 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700521 * Flag for {@link #addCrossProfileIntentFilter}: if this flag is set: when
522 * resolving an intent that matches the {@code CrossProfileIntentFilter},
523 * the current profile will be skipped. Only activities in the target user
524 * can respond to the intent.
525 *
Nicolas Prevot63798c52014-05-27 13:22:38 +0100526 * @hide
527 */
528 public static final int SKIP_CURRENT_PROFILE = 0x00000002;
529
Tony Mak807e01c2015-12-01 20:19:03 +0000530 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700531 * Flag for {@link #addCrossProfileIntentFilter}: if this flag is set:
Tony Mak807e01c2015-12-01 20:19:03 +0000532 * activities in the other profiles can respond to the intent only if no activity with
533 * non-negative priority in current profile can respond to the intent.
534 * @hide
535 */
536 public static final int ONLY_IF_NO_MATCH_FOUND = 0x00000004;
537
Tor Norbyed9273d62013-05-30 15:59:53 -0700538 /** @hide */
Jeff Sharkey4347f812017-04-21 12:08:39 -0600539 @IntDef(prefix = { "PERMISSION_" }, value = {
540 PERMISSION_GRANTED,
541 PERMISSION_DENIED
542 })
Tor Norbyed9273d62013-05-30 15:59:53 -0700543 @Retention(RetentionPolicy.SOURCE)
544 public @interface PermissionResult {}
545
Dianne Hackborn1655be42009-05-08 14:29:01 -0700546 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800547 * Permission check result: this is returned by {@link #checkPermission}
548 * if the permission has been granted to the given package.
549 */
550 public static final int PERMISSION_GRANTED = 0;
551
552 /**
553 * Permission check result: this is returned by {@link #checkPermission}
554 * if the permission has not been granted to the given package.
555 */
556 public static final int PERMISSION_DENIED = -1;
557
Jeff Sharkey30e06bb2017-04-24 11:18:03 -0600558 /** @hide */
559 @IntDef(prefix = { "SIGNATURE_" }, value = {
560 SIGNATURE_MATCH,
561 SIGNATURE_NEITHER_SIGNED,
562 SIGNATURE_FIRST_NOT_SIGNED,
563 SIGNATURE_SECOND_NOT_SIGNED,
564 SIGNATURE_NO_MATCH,
565 SIGNATURE_UNKNOWN_PACKAGE,
566 })
567 @Retention(RetentionPolicy.SOURCE)
568 public @interface SignatureResult {}
569
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800570 /**
571 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700572 * if all signatures on the two packages match.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800573 */
574 public static final int SIGNATURE_MATCH = 0;
575
576 /**
577 * Signature check result: this is returned by {@link #checkSignatures}
578 * if neither of the two packages is signed.
579 */
580 public static final int SIGNATURE_NEITHER_SIGNED = 1;
581
582 /**
583 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700584 * if the first package is not signed but the second is.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800585 */
586 public static final int SIGNATURE_FIRST_NOT_SIGNED = -1;
587
588 /**
589 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700590 * if the second package is not signed but the first is.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800591 */
592 public static final int SIGNATURE_SECOND_NOT_SIGNED = -2;
593
594 /**
595 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700596 * if not all signatures on both packages match.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800597 */
598 public static final int SIGNATURE_NO_MATCH = -3;
599
600 /**
601 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700602 * if either of the packages are not valid.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800603 */
604 public static final int SIGNATURE_UNKNOWN_PACKAGE = -4;
605
Jeff Sharkey30e06bb2017-04-24 11:18:03 -0600606 /** @hide */
607 @IntDef(prefix = { "COMPONENT_ENABLED_STATE_" }, value = {
608 COMPONENT_ENABLED_STATE_DEFAULT,
609 COMPONENT_ENABLED_STATE_ENABLED,
610 COMPONENT_ENABLED_STATE_DISABLED,
611 COMPONENT_ENABLED_STATE_DISABLED_USER,
612 COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED,
613 })
614 @Retention(RetentionPolicy.SOURCE)
615 public @interface EnabledState {}
616
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700617 /**
Jeff Sharkey30e06bb2017-04-24 11:18:03 -0600618 * Flag for {@link #setApplicationEnabledSetting(String, int, int)} and
619 * {@link #setComponentEnabledSetting(ComponentName, int, int)}: This
620 * component or application is in its default enabled state (as specified in
621 * its manifest).
622 * <p>
623 * Explicitly setting the component state to this value restores it's
624 * enabled state to whatever is set in the manifest.
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700625 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800626 public static final int COMPONENT_ENABLED_STATE_DEFAULT = 0;
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700627
628 /**
629 * Flag for {@link #setApplicationEnabledSetting(String, int, int)}
630 * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This
631 * component or application has been explictily enabled, regardless of
632 * what it has specified in its manifest.
633 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800634 public static final int COMPONENT_ENABLED_STATE_ENABLED = 1;
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700635
636 /**
637 * Flag for {@link #setApplicationEnabledSetting(String, int, int)}
638 * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This
639 * component or application has been explicitly disabled, regardless of
640 * what it has specified in its manifest.
641 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800642 public static final int COMPONENT_ENABLED_STATE_DISABLED = 2;
643
644 /**
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700645 * Flag for {@link #setApplicationEnabledSetting(String, int, int)} only: The
646 * user has explicitly disabled the application, regardless of what it has
647 * specified in its manifest. Because this is due to the user's request,
648 * they may re-enable it if desired through the appropriate system UI. This
kmccormick30498b42013-03-27 17:39:17 -0700649 * option currently <strong>cannot</strong> be used with
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700650 * {@link #setComponentEnabledSetting(ComponentName, int, int)}.
651 */
652 public static final int COMPONENT_ENABLED_STATE_DISABLED_USER = 3;
653
654 /**
Dianne Hackbornfd7aded2013-01-22 17:10:23 -0800655 * Flag for {@link #setApplicationEnabledSetting(String, int, int)} only: This
656 * application should be considered, until the point where the user actually
657 * wants to use it. This means that it will not normally show up to the user
658 * (such as in the launcher), but various parts of the user interface can
659 * use {@link #GET_DISABLED_UNTIL_USED_COMPONENTS} to still see it and allow
660 * the user to select it (as for example an IME, device admin, etc). Such code,
661 * once the user has selected the app, should at that point also make it enabled.
662 * This option currently <strong>can not</strong> be used with
663 * {@link #setComponentEnabledSetting(ComponentName, int, int)}.
664 */
665 public static final int COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED = 4;
666
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700667 /** @hide */
Jeff Sharkey4347f812017-04-21 12:08:39 -0600668 @IntDef(flag = true, prefix = { "INSTALL_" }, value = {
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700669 INSTALL_FORWARD_LOCK,
670 INSTALL_REPLACE_EXISTING,
671 INSTALL_ALLOW_TEST,
672 INSTALL_EXTERNAL,
673 INSTALL_INTERNAL,
674 INSTALL_FROM_ADB,
675 INSTALL_ALL_USERS,
676 INSTALL_ALLOW_DOWNGRADE,
677 INSTALL_GRANT_RUNTIME_PERMISSIONS,
678 INSTALL_FORCE_VOLUME_UUID,
679 INSTALL_FORCE_PERMISSION_PROMPT,
Todd Kennedybe0b8892017-02-15 14:13:52 -0800680 INSTALL_INSTANT_APP,
Todd Kennedy39bfee52016-02-24 10:28:21 -0800681 INSTALL_DONT_KILL_APP,
Jeff Sharkey683bcd32017-03-18 17:54:51 -0600682 INSTALL_FORCE_SDK,
683 INSTALL_FULL_APP,
684 INSTALL_ALLOCATE_AGGRESSIVE,
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700685 })
686 @Retention(RetentionPolicy.SOURCE)
687 public @interface InstallFlags {}
688
Dianne Hackbornfd7aded2013-01-22 17:10:23 -0800689 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700690 * Flag parameter for {@link #installPackage} to indicate that this package
691 * should be installed as forward locked, i.e. only the app itself should
692 * have access to its code and non-resource assets.
693 *
Jeff Sharkey8c61e392017-02-24 09:22:48 -0700694 * @deprecated new installs into ASEC containers are no longer supported.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700695 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800696 */
Jeff Sharkey8c61e392017-02-24 09:22:48 -0700697 @Deprecated
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700698 public static final int INSTALL_FORWARD_LOCK = 0x00000001;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800699
700 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700701 * Flag parameter for {@link #installPackage} to indicate that you want to
702 * replace an already installed package, if one exists.
703 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700704 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800705 */
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700706 public static final int INSTALL_REPLACE_EXISTING = 0x00000002;
707
708 /**
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700709 * Flag parameter for {@link #installPackage} to indicate that you want to
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700710 * allow test packages (those that have set android:testOnly in their
711 * manifest) to be installed.
712 * @hide
713 */
714 public static final int INSTALL_ALLOW_TEST = 0x00000004;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800715
716 /**
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -0700717 * Flag parameter for {@link #installPackage} to indicate that this package
718 * must be installed to an ASEC on a {@link VolumeInfo#TYPE_PUBLIC}.
719 *
Jeff Sharkey8c61e392017-02-24 09:22:48 -0700720 * @deprecated new installs into ASEC containers are no longer supported;
721 * use adoptable storage instead.
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800722 * @hide
723 */
Jeff Sharkey8c61e392017-02-24 09:22:48 -0700724 @Deprecated
Suchi Amalapurapu5b993ce2010-02-12 09:43:29 -0800725 public static final int INSTALL_EXTERNAL = 0x00000008;
Oscar Montemayor539d3c42010-01-29 15:27:00 -0800726
727 /**
Kenny Root5ab21572011-07-27 11:11:19 -0700728 * Flag parameter for {@link #installPackage} to indicate that this package
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -0700729 * must be installed to internal storage.
730 *
Kenny Root5ab21572011-07-27 11:11:19 -0700731 * @hide
732 */
733 public static final int INSTALL_INTERNAL = 0x00000010;
734
735 /**
736 * Flag parameter for {@link #installPackage} to indicate that this install
737 * was initiated via ADB.
738 *
739 * @hide
740 */
741 public static final int INSTALL_FROM_ADB = 0x00000020;
Suchi Amalapurapu14b6abd2010-03-17 08:37:04 -0700742
743 /**
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700744 * Flag parameter for {@link #installPackage} to indicate that this install
745 * should immediately be visible to all users.
746 *
747 * @hide
748 */
749 public static final int INSTALL_ALL_USERS = 0x00000040;
750
751 /**
752 * Flag parameter for {@link #installPackage} to indicate that it is okay
753 * to install an update to an app where the newly installed app has a lower
Alex Klyubin921dd752016-02-24 13:21:41 -0800754 * version code than the currently installed app. This is permitted only if
755 * the currently installed app is marked debuggable.
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700756 *
757 * @hide
758 */
759 public static final int INSTALL_ALLOW_DOWNGRADE = 0x00000080;
760
761 /**
Svet Ganov95c1ade2015-03-19 09:38:52 -0700762 * Flag parameter for {@link #installPackage} to indicate that all runtime
763 * permissions should be granted to the package. If {@link #INSTALL_ALL_USERS}
764 * is set the runtime permissions will be granted to all users, otherwise
765 * only to the owner.
766 *
767 * @hide
768 */
769 public static final int INSTALL_GRANT_RUNTIME_PERMISSIONS = 0x00000100;
770
Jeff Sharkeyab234092015-06-09 21:42:22 -0700771 /** {@hide} */
772 public static final int INSTALL_FORCE_VOLUME_UUID = 0x00000200;
773
Svet Ganov95c1ade2015-03-19 09:38:52 -0700774 /**
Todd Kennedya1d12cf2015-09-29 15:43:00 -0700775 * Flag parameter for {@link #installPackage} to indicate that we always want to force
776 * the prompt for permission approval. This overrides any special behaviour for internal
777 * components.
778 *
779 * @hide
780 */
781 public static final int INSTALL_FORCE_PERMISSION_PROMPT = 0x00000400;
782
783 /**
Todd Kennedy27c24fb2015-09-17 16:49:25 -0700784 * Flag parameter for {@link #installPackage} to indicate that this package is
Todd Kennedy2699f062015-11-20 13:07:17 -0800785 * to be installed as a lightweight "ephemeral" app.
786 *
787 * @hide
788 */
Todd Kennedybe0b8892017-02-15 14:13:52 -0800789 public static final int INSTALL_INSTANT_APP = 0x00000800;
790
791 /**
Todd Kennedy39bfee52016-02-24 10:28:21 -0800792 * Flag parameter for {@link #installPackage} to indicate that this package contains
793 * a feature split to an existing application and the existing application should not
794 * be killed during the installation process.
795 *
796 * @hide
797 */
798 public static final int INSTALL_DONT_KILL_APP = 0x00001000;
799
800 /**
Todd Kennedyb1072712016-04-26 15:41:20 -0700801 * Flag parameter for {@link #installPackage} to indicate that this package is an
Patrick Baumannccb20b82018-01-08 13:22:46 -0800802 * upgrade to a package that refers to the SDK via release letter or is targeting an SDK via
803 * release letter that the current build does not support.
Todd Kennedyb1072712016-04-26 15:41:20 -0700804 *
805 * @hide
806 */
807 public static final int INSTALL_FORCE_SDK = 0x00002000;
808
809 /**
Jeff Sharkey683bcd32017-03-18 17:54:51 -0600810 * Flag parameter for {@link #installPackage} to indicate that this package is
811 * to be installed as a heavy weight app. This is fundamentally the opposite of
812 * {@link #INSTALL_INSTANT_APP}.
813 *
814 * @hide
815 */
816 public static final int INSTALL_FULL_APP = 0x00004000;
817
818 /**
819 * Flag parameter for {@link #installPackage} to indicate that this package
820 * is critical to system health or security, meaning the system should use
821 * {@link StorageManager#FLAG_ALLOCATE_AGGRESSIVE} internally.
822 *
823 * @hide
824 */
825 public static final int INSTALL_ALLOCATE_AGGRESSIVE = 0x00008000;
826
Todd Kennedy78a72502017-07-19 12:49:30 -0700827 /**
828 * Flag parameter for {@link #installPackage} to indicate that this package
829 * is a virtual preload.
830 *
831 * @hide
832 */
833 public static final int INSTALL_VIRTUAL_PRELOAD = 0x00010000;
834
Jeff Sharkey30e06bb2017-04-24 11:18:03 -0600835 /** @hide */
836 @IntDef(flag = true, prefix = { "DONT_KILL_APP" }, value = {
837 DONT_KILL_APP
838 })
839 @Retention(RetentionPolicy.SOURCE)
840 public @interface EnabledFlags {}
841
Jeff Sharkey683bcd32017-03-18 17:54:51 -0600842 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800843 * Flag parameter for
844 * {@link #setComponentEnabledSetting(android.content.ComponentName, int, int)} to indicate
845 * that you don't want to kill the app containing the component. Be careful when you set this
846 * since changing component states can make the containing application's behavior unpredictable.
847 */
848 public static final int DONT_KILL_APP = 0x00000001;
849
Bartosz Fabianowskia34f53f2017-01-11 18:08:47 +0100850 /** @hide */
Jeff Sharkey4347f812017-04-21 12:08:39 -0600851 @IntDef(prefix = { "INSTALL_REASON_" }, value = {
852 INSTALL_REASON_UNKNOWN,
853 INSTALL_REASON_POLICY,
854 INSTALL_REASON_DEVICE_RESTORE,
855 INSTALL_REASON_DEVICE_SETUP,
856 INSTALL_REASON_USER
857 })
Bartosz Fabianowskia34f53f2017-01-11 18:08:47 +0100858 @Retention(RetentionPolicy.SOURCE)
859 public @interface InstallReason {}
860
861 /**
862 * Code indicating that the reason for installing this package is unknown.
863 */
864 public static final int INSTALL_REASON_UNKNOWN = 0;
865
866 /**
867 * Code indicating that this package was installed due to enterprise policy.
868 */
869 public static final int INSTALL_REASON_POLICY = 1;
870
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800871 /**
Sunny Goyal80af6a22017-03-02 08:32:33 -0800872 * Code indicating that this package was installed as part of restoring from another device.
873 */
874 public static final int INSTALL_REASON_DEVICE_RESTORE = 2;
875
876 /**
877 * Code indicating that this package was installed as part of device setup.
878 */
879 public static final int INSTALL_REASON_DEVICE_SETUP = 3;
880
881 /**
882 * Code indicating that the package installation was initiated by the user.
883 */
884 public static final int INSTALL_REASON_USER = 4;
885
886 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800887 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
888 * on success.
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700889 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700890 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800891 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700892 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800893 public static final int INSTALL_SUCCEEDED = 1;
894
895 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800896 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
897 * if the package is already installed.
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700898 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700899 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800900 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700901 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800902 public static final int INSTALL_FAILED_ALREADY_EXISTS = -1;
903
904 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800905 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
906 * if the package archive file is invalid.
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700907 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700908 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800909 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700910 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800911 public static final int INSTALL_FAILED_INVALID_APK = -2;
912
913 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800914 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
915 * if the URI passed in is invalid.
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700916 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700917 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800918 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700919 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800920 public static final int INSTALL_FAILED_INVALID_URI = -3;
921
922 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800923 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
924 * if the package manager service found that the device didn't have enough storage space to
925 * install the app.
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700926 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700927 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800928 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700929 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800930 public static final int INSTALL_FAILED_INSUFFICIENT_STORAGE = -4;
931
932 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800933 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
934 * if a package is already installed with the same name.
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700935 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700936 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800937 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700938 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800939 public static final int INSTALL_FAILED_DUPLICATE_PACKAGE = -5;
940
941 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800942 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
943 * if the requested shared user does not exist.
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700944 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700945 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800946 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700947 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800948 public static final int INSTALL_FAILED_NO_SHARED_USER = -6;
949
950 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800951 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
952 * if a previously installed package of the same name has a different signature than the new
953 * package (and the old package's data was not removed).
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700954 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700955 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800956 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700957 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800958 public static final int INSTALL_FAILED_UPDATE_INCOMPATIBLE = -7;
959
960 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800961 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
962 * if the new package is requested a shared user which is already installed on the device and
963 * does not have matching signature.
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700964 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700965 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800966 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700967 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800968 public static final int INSTALL_FAILED_SHARED_USER_INCOMPATIBLE = -8;
969
970 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800971 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
972 * if the new package uses a shared library that is not available.
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700973 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700974 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800975 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700976 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800977 public static final int INSTALL_FAILED_MISSING_SHARED_LIBRARY = -9;
978
979 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800980 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
981 * if the new package uses a shared library that is not available.
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700982 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700983 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800984 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700985 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800986 public static final int INSTALL_FAILED_REPLACE_COULDNT_DELETE = -10;
987
988 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800989 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
990 * if the new package failed while optimizing and validating its dex files, either because there
991 * was not enough storage or the validation failed.
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700992 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700993 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800994 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700995 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800996 public static final int INSTALL_FAILED_DEXOPT = -11;
997
998 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800999 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1000 * if the new package failed because the current SDK version is older than that required by the
1001 * package.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001002 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001003 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001004 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001005 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001006 public static final int INSTALL_FAILED_OLDER_SDK = -12;
1007
1008 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001009 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1010 * if the new package failed because it contains a content provider with the same authority as a
1011 * provider already installed in the system.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001012 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001013 * @hide
The Android Open Source Project10592532009-03-18 17:39:46 -07001014 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001015 @SystemApi
The Android Open Source Project10592532009-03-18 17:39:46 -07001016 public static final int INSTALL_FAILED_CONFLICTING_PROVIDER = -13;
1017
1018 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001019 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1020 * if the new package failed because the current SDK version is newer than that required by the
1021 * package.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001022 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001023 * @hide
Dianne Hackborn851a5412009-05-08 12:06:44 -07001024 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001025 @SystemApi
Dianne Hackborn851a5412009-05-08 12:06:44 -07001026 public static final int INSTALL_FAILED_NEWER_SDK = -14;
1027
1028 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001029 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1030 * if the new package failed because it has specified that it is a test-only package and the
1031 * caller has not supplied the {@link #INSTALL_ALLOW_TEST} flag.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001032 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001033 * @hide
1034 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001035 @SystemApi
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001036 public static final int INSTALL_FAILED_TEST_ONLY = -15;
1037
1038 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001039 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1040 * if the package being installed contains native code, but none that is compatible with the
1041 * device's CPU_ABI.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001042 *
Dianne Hackbornb1811182009-05-21 15:45:42 -07001043 * @hide
1044 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001045 @SystemApi
Dianne Hackbornb1811182009-05-21 15:45:42 -07001046 public static final int INSTALL_FAILED_CPU_ABI_INCOMPATIBLE = -16;
1047
1048 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001049 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1050 * if the new package uses a feature that is not available.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001051 *
Dianne Hackborn49237342009-08-27 20:08:01 -07001052 * @hide
1053 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001054 @SystemApi
Dianne Hackborn49237342009-08-27 20:08:01 -07001055 public static final int INSTALL_FAILED_MISSING_FEATURE = -17;
1056
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -08001057 // ------ Errors related to sdcard
1058 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001059 * Installation return code: this is passed in the
1060 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if a secure container mount point couldn't be
1061 * accessed on external media.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001062 *
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -08001063 * @hide
1064 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001065 @SystemApi
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -08001066 public static final int INSTALL_FAILED_CONTAINER_ERROR = -18;
1067
Dianne Hackborn49237342009-08-27 20:08:01 -07001068 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001069 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1070 * if the new package couldn't be installed in the specified install location.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001071 *
Suchi Amalapurapub56ae202010-02-04 22:51:07 -08001072 * @hide
1073 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001074 @SystemApi
Suchi Amalapurapub56ae202010-02-04 22:51:07 -08001075 public static final int INSTALL_FAILED_INVALID_INSTALL_LOCATION = -19;
1076
1077 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001078 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1079 * if the new package couldn't be installed in the specified install location because the media
1080 * is not available.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001081 *
Suchi Amalapurapu8a9ab242010-03-11 16:49:16 -08001082 * @hide
1083 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001084 @SystemApi
Suchi Amalapurapu8a9ab242010-03-11 16:49:16 -08001085 public static final int INSTALL_FAILED_MEDIA_UNAVAILABLE = -20;
1086
1087 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001088 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1089 * if the new package couldn't be installed because the verification timed out.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001090 *
Kenny Root5ab21572011-07-27 11:11:19 -07001091 * @hide
1092 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001093 @SystemApi
Kenny Root5ab21572011-07-27 11:11:19 -07001094 public static final int INSTALL_FAILED_VERIFICATION_TIMEOUT = -21;
1095
1096 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001097 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1098 * if the new package couldn't be installed because the verification did not succeed.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001099 *
Kenny Root5ab21572011-07-27 11:11:19 -07001100 * @hide
1101 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001102 @SystemApi
Kenny Root5ab21572011-07-27 11:11:19 -07001103 public static final int INSTALL_FAILED_VERIFICATION_FAILURE = -22;
1104
1105 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001106 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1107 * if the package changed from what the calling program expected.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001108 *
Kenny Root5ab21572011-07-27 11:11:19 -07001109 * @hide
1110 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001111 @SystemApi
Kenny Root5ab21572011-07-27 11:11:19 -07001112 public static final int INSTALL_FAILED_PACKAGE_CHANGED = -23;
1113
1114 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001115 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1116 * if the new package is assigned a different UID than it previously held.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001117 *
Dianne Hackbornd0c5f512012-06-07 16:53:59 -07001118 * @hide
1119 */
1120 public static final int INSTALL_FAILED_UID_CHANGED = -24;
1121
1122 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001123 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1124 * if the new package has an older version code than the currently installed package.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001125 *
Dianne Hackborn7767eac2012-08-23 18:25:40 -07001126 * @hide
1127 */
1128 public static final int INSTALL_FAILED_VERSION_DOWNGRADE = -25;
1129
1130 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001131 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1132 * if the old package has target SDK high enough to support runtime permission and the new
1133 * package has target SDK low enough to not support runtime permissions.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001134 *
Svetoslavd9653702015-05-13 18:02:46 -07001135 * @hide
1136 */
1137 @SystemApi
1138 public static final int INSTALL_FAILED_PERMISSION_MODEL_DOWNGRADE = -26;
1139
1140 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001141 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1142 * if the new package attempts to downgrade the target sandbox version of the app.
Chad Brubaker34573b22017-03-07 15:27:35 -08001143 *
1144 * @hide
1145 */
1146 @SystemApi
1147 public static final int INSTALL_FAILED_SANDBOX_VERSION_DOWNGRADE = -27;
1148
1149 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001150 * Installation parse return code: this is passed in the
1151 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser was given a path that is not a
1152 * file, or does not end with the expected '.apk' extension.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001153 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001154 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001155 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001156 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001157 public static final int INSTALL_PARSE_FAILED_NOT_APK = -100;
1158
1159 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001160 * Installation parse return code: this is passed in the
1161 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser was unable to retrieve the
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001162 * AndroidManifest.xml file.
1163 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001164 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001165 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001166 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001167 public static final int INSTALL_PARSE_FAILED_BAD_MANIFEST = -101;
1168
1169 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001170 * Installation parse return code: this is passed in the
1171 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser encountered an unexpected
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001172 * exception.
1173 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001174 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001175 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001176 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001177 public static final int INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION = -102;
1178
1179 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001180 * Installation parse return code: this is passed in the
1181 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser did not find any certificates in
1182 * the .apk.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001183 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001184 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001185 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001186 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001187 public static final int INSTALL_PARSE_FAILED_NO_CERTIFICATES = -103;
1188
1189 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001190 * Installation parse return code: this is passed in the
1191 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser found inconsistent certificates on
1192 * the files in the .apk.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001193 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001194 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001195 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001196 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001197 public static final int INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES = -104;
1198
1199 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001200 * Installation parse return code: this is passed in the
1201 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser encountered a
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001202 * CertificateEncodingException in one of the files in the .apk.
1203 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001204 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001205 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001206 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001207 public static final int INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING = -105;
1208
1209 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001210 * Installation parse return code: this is passed in the
1211 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser encountered a bad or missing
1212 * package name in the manifest.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001213 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001214 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001215 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001216 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001217 public static final int INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME = -106;
1218
1219 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001220 * Installation parse return code: tthis is passed in the
1221 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser encountered a bad shared user id
1222 * name in the manifest.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001223 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001224 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001225 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001226 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001227 public static final int INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID = -107;
1228
1229 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001230 * Installation parse return code: this is passed in the
1231 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser encountered some structural
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001232 * problem in the manifest.
1233 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001234 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001235 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001236 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001237 public static final int INSTALL_PARSE_FAILED_MANIFEST_MALFORMED = -108;
1238
1239 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001240 * Installation parse return code: this is passed in the
1241 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser did not find any actionable tags
1242 * (instrumentation or application) in the manifest.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001243 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001244 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001245 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001246 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001247 public static final int INSTALL_PARSE_FAILED_MANIFEST_EMPTY = -109;
1248
1249 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001250 * Installation failed return code: this is passed in the
1251 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the system failed to install the package
1252 * because of system issues.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001253 *
Suchi Amalapurapu5b993ce2010-02-12 09:43:29 -08001254 * @hide
1255 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001256 @SystemApi
Suchi Amalapurapu5b993ce2010-02-12 09:43:29 -08001257 public static final int INSTALL_FAILED_INTERNAL_ERROR = -110;
1258
1259 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001260 * Installation failed return code: this is passed in the
1261 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the system failed to install the package
1262 * because the user is restricted from installing apps.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001263 *
Amith Yamasanie4cf7342012-12-17 11:12:09 -08001264 * @hide
1265 */
1266 public static final int INSTALL_FAILED_USER_RESTRICTED = -111;
1267
1268 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001269 * Installation failed return code: this is passed in the
1270 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the system failed to install the package
1271 * because it is attempting to define a permission that is already defined by some existing
1272 * package.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001273 * <p>
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001274 * The package name of the app which has already defined the permission is passed to a
1275 * {@link PackageInstallObserver}, if any, as the {@link #EXTRA_FAILURE_EXISTING_PACKAGE} string
1276 * extra; and the name of the permission being redefined is passed in the
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001277 * {@link #EXTRA_FAILURE_EXISTING_PERMISSION} string extra.
Christopher Tatef1977b42014-03-24 16:25:51 -07001278 *
Christopher Tatef1977b42014-03-24 16:25:51 -07001279 * @hide
1280 */
1281 public static final int INSTALL_FAILED_DUPLICATE_PERMISSION = -112;
1282
1283 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001284 * Installation failed return code: this is passed in the
1285 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the system failed to install the package
1286 * because its packaged native code did not match any of the ABIs supported by the system.
Ramin Zaghi1378aba2014-02-28 15:03:19 +00001287 *
1288 * @hide
1289 */
Narayan Kamathd11f2232014-04-10 10:37:17 +01001290 public static final int INSTALL_FAILED_NO_MATCHING_ABIS = -113;
Ramin Zaghi1378aba2014-02-28 15:03:19 +00001291
1292 /**
1293 * Internal return code for NativeLibraryHelper methods to indicate that the package
1294 * being processed did not contain any native code. This is placed here only so that
1295 * it can belong to the same value space as the other install failure codes.
1296 *
1297 * @hide
1298 */
Narayan Kamathd11f2232014-04-10 10:37:17 +01001299 public static final int NO_NATIVE_LIBRARIES = -114;
Ramin Zaghi1378aba2014-02-28 15:03:19 +00001300
Jeff Sharkey7328a1b2014-08-07 14:01:43 -07001301 /** {@hide} */
Jeff Sharkeyf0600952014-08-07 17:31:53 -07001302 public static final int INSTALL_FAILED_ABORTED = -115;
Jeff Sharkey7328a1b2014-08-07 14:01:43 -07001303
Ramin Zaghi1378aba2014-02-28 15:03:19 +00001304 /**
Todd Kennedybe0b8892017-02-15 14:13:52 -08001305 * Installation failed return code: instant app installs are incompatible with some
Todd Kennedy2699f062015-11-20 13:07:17 -08001306 * other installation flags supplied for the operation; or other circumstances such
Todd Kennedybe0b8892017-02-15 14:13:52 -08001307 * as trying to upgrade a system app via an instant app install.
Todd Kennedy2699f062015-11-20 13:07:17 -08001308 * @hide
1309 */
Todd Kennedybe0b8892017-02-15 14:13:52 -08001310 public static final int INSTALL_FAILED_INSTANT_APP_INVALID = -116;
Todd Kennedy2699f062015-11-20 13:07:17 -08001311
Calin Juravle3fc56c32017-12-11 18:26:13 -08001312 /**
1313 * Installation parse return code: this is passed in the
1314 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the dex metadata file is invalid or
1315 * if there was no matching apk file for a dex metadata file.
1316 *
1317 * @hide
1318 */
1319 public static final int INSTALL_FAILED_BAD_DEX_METADATA = -117;
1320
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001321 /** @hide */
Jeff Sharkey4347f812017-04-21 12:08:39 -06001322 @IntDef(flag = true, prefix = { "DELETE_" }, value = {
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001323 DELETE_KEEP_DATA,
1324 DELETE_ALL_USERS,
1325 DELETE_SYSTEM_APP,
Todd Kennedy39bfee52016-02-24 10:28:21 -08001326 DELETE_DONT_KILL_APP,
Todd Kennedy232d29e2017-11-06 14:45:53 -08001327 DELETE_CHATTY,
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001328 })
1329 @Retention(RetentionPolicy.SOURCE)
1330 public @interface DeleteFlags {}
1331
Todd Kennedy2699f062015-11-20 13:07:17 -08001332 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001333 * Flag parameter for {@link #deletePackage} to indicate that you don't want to delete the
1334 * package's data directory.
1335 *
1336 * @hide
1337 */
Dianne Hackborn7767eac2012-08-23 18:25:40 -07001338 public static final int DELETE_KEEP_DATA = 0x00000001;
1339
1340 /**
1341 * Flag parameter for {@link #deletePackage} to indicate that you want the
1342 * package deleted for all users.
1343 *
1344 * @hide
1345 */
1346 public static final int DELETE_ALL_USERS = 0x00000002;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001347
1348 /**
Dianne Hackbornc895be72013-03-11 17:48:43 -07001349 * Flag parameter for {@link #deletePackage} to indicate that, if you are calling
1350 * uninstall on a system that has been updated, then don't do the normal process
1351 * of uninstalling the update and rolling back to the older system version (which
1352 * needs to happen for all users); instead, just mark the app as uninstalled for
1353 * the current user.
1354 *
1355 * @hide
1356 */
1357 public static final int DELETE_SYSTEM_APP = 0x00000004;
1358
1359 /**
Todd Kennedy39bfee52016-02-24 10:28:21 -08001360 * Flag parameter for {@link #deletePackage} to indicate that, if you are calling
1361 * uninstall on a package that is replaced to provide new feature splits, the
1362 * existing application should not be killed during the removal process.
1363 *
1364 * @hide
1365 */
1366 public static final int DELETE_DONT_KILL_APP = 0x00000008;
1367
1368 /**
Todd Kennedy232d29e2017-11-06 14:45:53 -08001369 * Flag parameter for {@link #deletePackage} to indicate that package deletion
1370 * should be chatty.
1371 *
1372 * @hide
1373 */
1374 public static final int DELETE_CHATTY = 0x80000000;
1375
1376 /**
Kenny Rootc39bb4a2011-02-28 13:27:19 -08001377 * Return code for when package deletion succeeds. This is passed to the
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001378 * {@link IPackageDeleteObserver} if the system succeeded in deleting the
1379 * package.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001380 *
Kenny Rootc39bb4a2011-02-28 13:27:19 -08001381 * @hide
1382 */
1383 public static final int DELETE_SUCCEEDED = 1;
1384
1385 /**
1386 * Deletion failed return code: this is passed to the
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001387 * {@link IPackageDeleteObserver} if the system failed to delete the package
1388 * for an unspecified reason.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001389 *
Kenny Rootc39bb4a2011-02-28 13:27:19 -08001390 * @hide
1391 */
1392 public static final int DELETE_FAILED_INTERNAL_ERROR = -1;
1393
1394 /**
1395 * Deletion failed return code: this is passed to the
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001396 * {@link IPackageDeleteObserver} if the system failed to delete the package
1397 * because it is the active DevicePolicy manager.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001398 *
Kenny Rootc39bb4a2011-02-28 13:27:19 -08001399 * @hide
1400 */
1401 public static final int DELETE_FAILED_DEVICE_POLICY_MANAGER = -2;
1402
1403 /**
Amith Yamasanie4cf7342012-12-17 11:12:09 -08001404 * Deletion failed return code: this is passed to the
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001405 * {@link IPackageDeleteObserver} if the system failed to delete the package
1406 * since the user is restricted.
Amith Yamasanie4cf7342012-12-17 11:12:09 -08001407 *
1408 * @hide
1409 */
1410 public static final int DELETE_FAILED_USER_RESTRICTED = -3;
1411
1412 /**
Kenny Guy1b88da52014-07-10 16:33:49 +01001413 * Deletion failed return code: this is passed to the
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001414 * {@link IPackageDeleteObserver} if the system failed to delete the package
1415 * because a profile or device owner has marked the package as
1416 * uninstallable.
Kenny Guyc13053b2014-05-29 14:17:17 +01001417 *
1418 * @hide
1419 */
Jeff Sharkeyf0600952014-08-07 17:31:53 -07001420 public static final int DELETE_FAILED_OWNER_BLOCKED = -4;
1421
1422 /** {@hide} */
1423 public static final int DELETE_FAILED_ABORTED = -5;
Kenny Guyc13053b2014-05-29 14:17:17 +01001424
1425 /**
Svet Ganov67882122016-12-11 16:36:34 -08001426 * Deletion failed return code: this is passed to the
1427 * {@link IPackageDeleteObserver} if the system failed to delete the package
1428 * because the packge is a shared library used by other installed packages.
1429 * {@hide} */
1430 public static final int DELETE_FAILED_USED_SHARED_LIBRARY = -6;
1431
1432 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001433 * Return code that is passed to the {@link IPackageMoveObserver} when the
Kenny Rootc39bb4a2011-02-28 13:27:19 -08001434 * package has been successfully moved by the system.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001435 *
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001436 * @hide
1437 */
Jeff Sharkey620b32b2015-04-23 19:36:02 -07001438 public static final int MOVE_SUCCEEDED = -100;
1439
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001440 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001441 * Error code that is passed to the {@link IPackageMoveObserver} when the
1442 * package hasn't been successfully moved by the system because of
1443 * insufficient memory on specified media.
1444 *
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001445 * @hide
1446 */
1447 public static final int MOVE_FAILED_INSUFFICIENT_STORAGE = -1;
1448
1449 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001450 * Error code that is passed to the {@link IPackageMoveObserver} if the
1451 * specified package doesn't exist.
1452 *
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001453 * @hide
1454 */
1455 public static final int MOVE_FAILED_DOESNT_EXIST = -2;
1456
1457 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001458 * Error code that is passed to the {@link IPackageMoveObserver} if the
1459 * specified package cannot be moved since its a system package.
1460 *
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001461 * @hide
1462 */
1463 public static final int MOVE_FAILED_SYSTEM_PACKAGE = -3;
1464
1465 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001466 * Error code that is passed to the {@link IPackageMoveObserver} if the
1467 * specified package cannot be moved since its forward locked.
1468 *
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001469 * @hide
1470 */
1471 public static final int MOVE_FAILED_FORWARD_LOCKED = -4;
1472
1473 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001474 * Error code that is passed to the {@link IPackageMoveObserver} if the
1475 * specified package cannot be moved to the specified location.
1476 *
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001477 * @hide
1478 */
1479 public static final int MOVE_FAILED_INVALID_LOCATION = -5;
1480
1481 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001482 * Error code that is passed to the {@link IPackageMoveObserver} if the
1483 * specified package cannot be moved to the specified location.
1484 *
Suchi Amalapurapu8a9ab242010-03-11 16:49:16 -08001485 * @hide
1486 */
1487 public static final int MOVE_FAILED_INTERNAL_ERROR = -6;
1488
1489 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001490 * Error code that is passed to the {@link IPackageMoveObserver} if the
1491 * specified package already has an operation pending in the queue.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001492 *
Kenny Rootdeb11262010-08-02 11:36:21 -07001493 * @hide
1494 */
1495 public static final int MOVE_FAILED_OPERATION_PENDING = -7;
1496
1497 /**
Makoto Onukif34db0a2016-02-17 11:17:15 -08001498 * Error code that is passed to the {@link IPackageMoveObserver} if the
1499 * specified package cannot be moved since it contains a device admin.
1500 *
1501 * @hide
1502 */
1503 public static final int MOVE_FAILED_DEVICE_ADMIN = -8;
1504
1505 /**
Yao Chen022b8ea2016-12-16 11:03:28 -08001506 * Error code that is passed to the {@link IPackageMoveObserver} if system does not allow
1507 * non-system apps to be moved to internal storage.
1508 *
1509 * @hide
1510 */
1511 public static final int MOVE_FAILED_3RD_PARTY_NOT_ALLOWED_ON_INTERNAL = -9;
1512
Jeff Sharkeya65e6492017-06-21 13:45:11 -06001513 /** @hide */
1514 public static final int MOVE_FAILED_LOCKED_USER = -10;
1515
Yao Chen022b8ea2016-12-16 11:03:28 -08001516 /**
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001517 * Flag parameter for {@link #movePackage} to indicate that
1518 * the package should be moved to internal storage if its
1519 * been installed on external media.
1520 * @hide
1521 */
Jeff Sharkey620b32b2015-04-23 19:36:02 -07001522 @Deprecated
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001523 public static final int MOVE_INTERNAL = 0x00000001;
1524
1525 /**
1526 * Flag parameter for {@link #movePackage} to indicate that
1527 * the package should be moved to external media.
1528 * @hide
1529 */
Jeff Sharkey620b32b2015-04-23 19:36:02 -07001530 @Deprecated
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001531 public static final int MOVE_EXTERNAL_MEDIA = 0x00000002;
1532
Jeff Sharkey620b32b2015-04-23 19:36:02 -07001533 /** {@hide} */
1534 public static final String EXTRA_MOVE_ID = "android.content.pm.extra.MOVE_ID";
1535
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001536 /**
Kenny Root05ca4c92011-09-15 10:36:25 -07001537 * Usable by the required verifier as the {@code verificationCode} argument
1538 * for {@link PackageManager#verifyPendingInstall} to indicate that it will
1539 * allow the installation to proceed without any of the optional verifiers
1540 * needing to vote.
1541 *
1542 * @hide
1543 */
1544 public static final int VERIFICATION_ALLOW_WITHOUT_SUFFICIENT = 2;
1545
1546 /**
Kenny Root3a9b5fb2011-09-20 14:15:38 -07001547 * Used as the {@code verificationCode} argument for
1548 * {@link PackageManager#verifyPendingInstall} to indicate that the calling
1549 * package verifier allows the installation to proceed.
1550 */
1551 public static final int VERIFICATION_ALLOW = 1;
1552
1553 /**
1554 * Used as the {@code verificationCode} argument for
1555 * {@link PackageManager#verifyPendingInstall} to indicate the calling
1556 * package verifier does not vote to allow the installation to proceed.
1557 */
1558 public static final int VERIFICATION_REJECT = -1;
1559
1560 /**
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001561 * Used as the {@code verificationCode} argument for
1562 * {@link PackageManager#verifyIntentFilter} to indicate that the calling
1563 * IntentFilter Verifier confirms that the IntentFilter is verified.
1564 *
1565 * @hide
1566 */
Todd Kennedydfa93ab2016-03-03 15:24:33 -08001567 @SystemApi
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001568 public static final int INTENT_FILTER_VERIFICATION_SUCCESS = 1;
1569
1570 /**
1571 * Used as the {@code verificationCode} argument for
1572 * {@link PackageManager#verifyIntentFilter} to indicate that the calling
1573 * IntentFilter Verifier confirms that the IntentFilter is NOT verified.
1574 *
1575 * @hide
1576 */
Todd Kennedydfa93ab2016-03-03 15:24:33 -08001577 @SystemApi
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001578 public static final int INTENT_FILTER_VERIFICATION_FAILURE = -1;
1579
1580 /**
1581 * Internal status code to indicate that an IntentFilter verification result is not specified.
1582 *
1583 * @hide
1584 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08001585 @SystemApi
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001586 public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED = 0;
1587
1588 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001589 * Used as the {@code status} argument for
1590 * {@link #updateIntentVerificationStatusAsUser} to indicate that the User
1591 * will always be prompted the Intent Disambiguation Dialog if there are two
1592 * or more Intent resolved for the IntentFilter's domain(s).
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001593 *
1594 * @hide
1595 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08001596 @SystemApi
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001597 public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK = 1;
1598
1599 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001600 * Used as the {@code status} argument for
1601 * {@link #updateIntentVerificationStatusAsUser} to indicate that the User
1602 * will never be prompted the Intent Disambiguation Dialog if there are two
1603 * or more resolution of the Intent. The default App for the domain(s)
1604 * specified in the IntentFilter will also ALWAYS be used.
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001605 *
1606 * @hide
1607 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08001608 @SystemApi
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001609 public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS = 2;
1610
1611 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001612 * Used as the {@code status} argument for
1613 * {@link #updateIntentVerificationStatusAsUser} to indicate that the User
1614 * may be prompted the Intent Disambiguation Dialog if there are two or more
1615 * Intent resolved. The default App for the domain(s) specified in the
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001616 * IntentFilter will also NEVER be presented to the User.
1617 *
1618 * @hide
1619 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08001620 @SystemApi
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001621 public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER = 3;
1622
1623 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001624 * Used as the {@code status} argument for
1625 * {@link #updateIntentVerificationStatusAsUser} to indicate that this app
1626 * should always be considered as an ambiguous candidate for handling the
1627 * matching Intent even if there are other candidate apps in the "always"
1628 * state. Put another way: if there are any 'always ask' apps in a set of
1629 * more than one candidate app, then a disambiguation is *always* presented
1630 * even if there is another candidate app with the 'always' state.
Christopher Tate56f0ff32015-08-13 16:29:33 -07001631 *
1632 * @hide
1633 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08001634 @SystemApi
Christopher Tate56f0ff32015-08-13 16:29:33 -07001635 public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS_ASK = 4;
1636
1637 /**
rich canningsd9ef3e52012-08-22 14:28:05 -07001638 * Can be used as the {@code millisecondsToDelay} argument for
1639 * {@link PackageManager#extendVerificationTimeout}. This is the
1640 * maximum time {@code PackageManager} waits for the verification
1641 * agent to return (in milliseconds).
1642 */
1643 public static final long MAXIMUM_VERIFICATION_TIMEOUT = 60*60*1000;
1644
1645 /**
Amith Yamasani0b285492011-04-14 17:35:23 -07001646 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: The device's
1647 * audio pipeline is low-latency, more suitable for audio applications sensitive to delays or
1648 * lag in sound input or output.
Dan Morrill898e1e82010-09-26 17:28:30 -07001649 */
1650 @SdkConstant(SdkConstantType.FEATURE)
1651 public static final String FEATURE_AUDIO_LOW_LATENCY = "android.hardware.audio.low_latency";
1652
1653 /**
1654 * Feature for {@link #getSystemAvailableFeatures} and
Unsuk Jung50909f62014-09-02 18:25:49 -07001655 * {@link #hasSystemFeature}: The device includes at least one form of audio
1656 * output, such as speakers, audio jack or streaming over bluetooth
1657 */
1658 @SdkConstant(SdkConstantType.FEATURE)
1659 public static final String FEATURE_AUDIO_OUTPUT = "android.hardware.audio.output";
1660
1661 /**
Glenn Kastencdcb5772015-05-06 15:54:49 -07001662 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Glenn Kasten7587edc2015-10-30 17:45:52 -07001663 * The device has professional audio level of functionality and performance.
Glenn Kastencdcb5772015-05-06 15:54:49 -07001664 */
1665 @SdkConstant(SdkConstantType.FEATURE)
1666 public static final String FEATURE_AUDIO_PRO = "android.hardware.audio.pro";
1667
1668 /**
Unsuk Jung50909f62014-09-02 18:25:49 -07001669 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001670 * {@link #hasSystemFeature}: The device is capable of communicating with
1671 * other devices via Bluetooth.
1672 */
1673 @SdkConstant(SdkConstantType.FEATURE)
1674 public static final String FEATURE_BLUETOOTH = "android.hardware.bluetooth";
1675
1676 /**
1677 * Feature for {@link #getSystemAvailableFeatures} and
Matthew Xiea7227722013-04-18 15:25:59 -07001678 * {@link #hasSystemFeature}: The device is capable of communicating with
1679 * other devices via Bluetooth Low Energy radio.
1680 */
1681 @SdkConstant(SdkConstantType.FEATURE)
1682 public static final String FEATURE_BLUETOOTH_LE = "android.hardware.bluetooth_le";
1683
1684 /**
1685 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001686 * {@link #hasSystemFeature}: The device has a camera facing away
1687 * from the screen.
1688 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001689 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001690 public static final String FEATURE_CAMERA = "android.hardware.camera";
Dan Morrill50ab63f2010-03-05 16:16:19 -08001691
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001692 /**
1693 * Feature for {@link #getSystemAvailableFeatures} and
1694 * {@link #hasSystemFeature}: The device's camera supports auto-focus.
1695 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001696 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001697 public static final String FEATURE_CAMERA_AUTOFOCUS = "android.hardware.camera.autofocus";
Dan Morrill50ab63f2010-03-05 16:16:19 -08001698
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001699 /**
1700 * Feature for {@link #getSystemAvailableFeatures} and
Eino-Ville Talvala752af832012-09-18 14:45:37 -07001701 * {@link #hasSystemFeature}: The device has at least one camera pointing in
Eino-Ville Talvala9131da22014-05-08 11:39:53 -07001702 * some direction, or can support an external camera being connected to it.
Eino-Ville Talvala752af832012-09-18 14:45:37 -07001703 */
1704 @SdkConstant(SdkConstantType.FEATURE)
1705 public static final String FEATURE_CAMERA_ANY = "android.hardware.camera.any";
1706
1707 /**
1708 * Feature for {@link #getSystemAvailableFeatures} and
Eino-Ville Talvala9131da22014-05-08 11:39:53 -07001709 * {@link #hasSystemFeature}: The device can support having an external camera connected to it.
1710 * The external camera may not always be connected or available to applications to use.
1711 */
1712 @SdkConstant(SdkConstantType.FEATURE)
1713 public static final String FEATURE_CAMERA_EXTERNAL = "android.hardware.camera.external";
1714
1715 /**
1716 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001717 * {@link #hasSystemFeature}: The device's camera supports flash.
1718 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001719 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001720 public static final String FEATURE_CAMERA_FLASH = "android.hardware.camera.flash";
Dan Morrill50ab63f2010-03-05 16:16:19 -08001721
1722 /**
1723 * Feature for {@link #getSystemAvailableFeatures} and
Chih-Chung Changde1057c2010-06-14 19:15:00 +08001724 * {@link #hasSystemFeature}: The device has a front facing camera.
1725 */
1726 @SdkConstant(SdkConstantType.FEATURE)
1727 public static final String FEATURE_CAMERA_FRONT = "android.hardware.camera.front";
1728
1729 /**
Eino-Ville Talvala611fece2014-07-10 17:29:38 -07001730 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one
1731 * of the cameras on the device supports the
1732 * {@link android.hardware.camera2.CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL full hardware}
1733 * capability level.
1734 */
1735 @SdkConstant(SdkConstantType.FEATURE)
1736 public static final String FEATURE_CAMERA_LEVEL_FULL = "android.hardware.camera.level.full";
1737
1738 /**
1739 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one
1740 * of the cameras on the device supports the
1741 * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR manual sensor}
1742 * capability level.
1743 */
1744 @SdkConstant(SdkConstantType.FEATURE)
1745 public static final String FEATURE_CAMERA_CAPABILITY_MANUAL_SENSOR =
1746 "android.hardware.camera.capability.manual_sensor";
1747
1748 /**
1749 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one
1750 * of the cameras on the device supports the
1751 * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MANUAL_POST_PROCESSING manual post-processing}
1752 * capability level.
1753 */
1754 @SdkConstant(SdkConstantType.FEATURE)
1755 public static final String FEATURE_CAMERA_CAPABILITY_MANUAL_POST_PROCESSING =
1756 "android.hardware.camera.capability.manual_post_processing";
1757
1758 /**
1759 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one
1760 * of the cameras on the device supports the
1761 * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_RAW RAW}
1762 * capability level.
1763 */
1764 @SdkConstant(SdkConstantType.FEATURE)
1765 public static final String FEATURE_CAMERA_CAPABILITY_RAW =
1766 "android.hardware.camera.capability.raw";
1767
1768 /**
Chih-Chung Changde1057c2010-06-14 19:15:00 +08001769 * Feature for {@link #getSystemAvailableFeatures} and
Alex Ray0c9d61f2013-10-03 12:17:54 -07001770 * {@link #hasSystemFeature}: The device is capable of communicating with
1771 * consumer IR devices.
1772 */
1773 @SdkConstant(SdkConstantType.FEATURE)
1774 public static final String FEATURE_CONSUMER_IR = "android.hardware.consumerir";
1775
Sam Lin90e258b2017-04-03 20:57:45 -07001776 /** {@hide} */
1777 @SdkConstant(SdkConstantType.FEATURE)
1778 public static final String FEATURE_CTS = "android.software.cts";
1779
Alex Ray0c9d61f2013-10-03 12:17:54 -07001780 /**
1781 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001782 * {@link #hasSystemFeature}: The device supports one or more methods of
1783 * reporting current location.
1784 */
1785 @SdkConstant(SdkConstantType.FEATURE)
1786 public static final String FEATURE_LOCATION = "android.hardware.location";
1787
1788 /**
1789 * Feature for {@link #getSystemAvailableFeatures} and
1790 * {@link #hasSystemFeature}: The device has a Global Positioning System
1791 * receiver and can report precise location.
1792 */
1793 @SdkConstant(SdkConstantType.FEATURE)
1794 public static final String FEATURE_LOCATION_GPS = "android.hardware.location.gps";
1795
1796 /**
1797 * Feature for {@link #getSystemAvailableFeatures} and
1798 * {@link #hasSystemFeature}: The device can report location with coarse
1799 * accuracy using a network-based geolocation system.
1800 */
1801 @SdkConstant(SdkConstantType.FEATURE)
1802 public static final String FEATURE_LOCATION_NETWORK = "android.hardware.location.network";
1803
1804 /**
1805 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn2a103f12017-08-08 15:50:31 -07001806 * {@link #hasSystemFeature}: The device's
1807 * {@link ActivityManager#isLowRamDevice() ActivityManager.isLowRamDevice()} method returns
1808 * true.
1809 */
1810 @SdkConstant(SdkConstantType.FEATURE)
1811 public static final String FEATURE_RAM_LOW = "android.hardware.ram.low";
1812
1813 /**
1814 * Feature for {@link #getSystemAvailableFeatures} and
1815 * {@link #hasSystemFeature}: The device's
1816 * {@link ActivityManager#isLowRamDevice() ActivityManager.isLowRamDevice()} method returns
1817 * false.
1818 */
1819 @SdkConstant(SdkConstantType.FEATURE)
1820 public static final String FEATURE_RAM_NORMAL = "android.hardware.ram.normal";
1821
1822 /**
1823 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001824 * {@link #hasSystemFeature}: The device can record audio via a
1825 * microphone.
1826 */
1827 @SdkConstant(SdkConstantType.FEATURE)
1828 public static final String FEATURE_MICROPHONE = "android.hardware.microphone";
1829
1830 /**
1831 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill76437d32010-09-01 11:17:20 -07001832 * {@link #hasSystemFeature}: The device can communicate using Near-Field
1833 * Communications (NFC).
1834 */
1835 @SdkConstant(SdkConstantType.FEATURE)
1836 public static final String FEATURE_NFC = "android.hardware.nfc";
1837
1838 /**
1839 * Feature for {@link #getSystemAvailableFeatures} and
Martijn Coenenf4bf1582013-07-22 12:01:19 -07001840 * {@link #hasSystemFeature}: The device supports host-
1841 * based NFC card emulation.
Martijn Coenendf4d1d62013-08-28 11:18:58 -07001842 *
1843 * TODO remove when depending apps have moved to new constant.
1844 * @hide
1845 * @deprecated
Martijn Coenenf4bf1582013-07-22 12:01:19 -07001846 */
Jose Lima970417c2014-04-10 10:42:19 -07001847 @Deprecated
Martijn Coenenf4bf1582013-07-22 12:01:19 -07001848 @SdkConstant(SdkConstantType.FEATURE)
1849 public static final String FEATURE_NFC_HCE = "android.hardware.nfc.hce";
1850
1851 /**
1852 * Feature for {@link #getSystemAvailableFeatures} and
Martijn Coenendf4d1d62013-08-28 11:18:58 -07001853 * {@link #hasSystemFeature}: The device supports host-
1854 * based NFC card emulation.
1855 */
1856 @SdkConstant(SdkConstantType.FEATURE)
1857 public static final String FEATURE_NFC_HOST_CARD_EMULATION = "android.hardware.nfc.hce";
1858
1859 /**
1860 * Feature for {@link #getSystemAvailableFeatures} and
Yoshinobu Itoc52adfe2016-01-22 18:14:18 +09001861 * {@link #hasSystemFeature}: The device supports host-
1862 * based NFC-F card emulation.
1863 */
1864 @SdkConstant(SdkConstantType.FEATURE)
1865 public static final String FEATURE_NFC_HOST_CARD_EMULATION_NFCF = "android.hardware.nfc.hcef";
1866
1867 /**
1868 * Feature for {@link #getSystemAvailableFeatures} and
Martijn Coenen441d61b2017-04-12 13:52:40 -07001869 * {@link #hasSystemFeature}: The device supports any
1870 * one of the {@link #FEATURE_NFC}, {@link #FEATURE_NFC_HOST_CARD_EMULATION},
1871 * or {@link #FEATURE_NFC_HOST_CARD_EMULATION_NFCF} features.
1872 *
1873 * @hide
1874 */
1875 @SdkConstant(SdkConstantType.FEATURE)
1876 public static final String FEATURE_NFC_ANY = "android.hardware.nfc.any";
1877
1878 /**
1879 * Feature for {@link #getSystemAvailableFeatures} and
Jesse Hall7f517062014-07-18 11:54:41 -07001880 * {@link #hasSystemFeature}: The device supports the OpenGL ES
1881 * <a href="http://www.khronos.org/registry/gles/extensions/ANDROID/ANDROID_extension_pack_es31a.txt">
1882 * Android Extension Pack</a>.
1883 */
1884 @SdkConstant(SdkConstantType.FEATURE)
1885 public static final String FEATURE_OPENGLES_EXTENSION_PACK = "android.hardware.opengles.aep";
1886
1887 /**
1888 * Feature for {@link #getSystemAvailableFeatures} and
Jesse Hall39ceeb52016-03-10 09:04:26 -08001889 * {@link #hasSystemFeature(String, int)}: If this feature is supported, the Vulkan native API
1890 * will enumerate at least one {@code VkPhysicalDevice}, and the feature version will indicate
1891 * what level of optional hardware features limits it supports.
Jesse Hallf77a34f2016-02-04 18:41:33 -08001892 * <p>
1893 * Level 0 includes the base Vulkan requirements as well as:
1894 * <ul><li>{@code VkPhysicalDeviceFeatures::textureCompressionETC2}</li></ul>
1895 * <p>
1896 * Level 1 additionally includes:
1897 * <ul>
1898 * <li>{@code VkPhysicalDeviceFeatures::fullDrawIndexUint32}</li>
1899 * <li>{@code VkPhysicalDeviceFeatures::imageCubeArray}</li>
1900 * <li>{@code VkPhysicalDeviceFeatures::independentBlend}</li>
1901 * <li>{@code VkPhysicalDeviceFeatures::geometryShader}</li>
1902 * <li>{@code VkPhysicalDeviceFeatures::tessellationShader}</li>
1903 * <li>{@code VkPhysicalDeviceFeatures::sampleRateShading}</li>
1904 * <li>{@code VkPhysicalDeviceFeatures::textureCompressionASTC_LDR}</li>
1905 * <li>{@code VkPhysicalDeviceFeatures::fragmentStoresAndAtomics}</li>
1906 * <li>{@code VkPhysicalDeviceFeatures::shaderImageGatherExtended}</li>
1907 * <li>{@code VkPhysicalDeviceFeatures::shaderUniformBufferArrayDynamicIndexing}</li>
1908 * <li>{@code VkPhysicalDeviceFeatures::shaderSampledImageArrayDynamicIndexing}</li>
1909 * </ul>
1910 */
1911 @SdkConstant(SdkConstantType.FEATURE)
1912 public static final String FEATURE_VULKAN_HARDWARE_LEVEL = "android.hardware.vulkan.level";
1913
1914 /**
1915 * Feature for {@link #getSystemAvailableFeatures} and
Jesse Hall1cd7e932017-02-05 19:58:15 -08001916 * {@link #hasSystemFeature(String, int)}: If this feature is supported, the Vulkan native API
1917 * will enumerate at least one {@code VkPhysicalDevice}, and the feature version will indicate
Jesse Hall54fc6092017-08-22 07:19:56 -07001918 * what level of optional compute features that device supports beyond the Vulkan 1.0
1919 * requirements.
Jesse Hall1cd7e932017-02-05 19:58:15 -08001920 * <p>
Jesse Hall54fc6092017-08-22 07:19:56 -07001921 * Compute level 0 indicates:
1922 * <ul>
1923 * <li>The {@code VK_KHR_variable_pointers} extension and
1924 * {@code VkPhysicalDeviceVariablePointerFeaturesKHR::variablePointers} feature are
1925 supported.</li>
1926 * <li>{@code VkPhysicalDeviceLimits::maxPerStageDescriptorStorageBuffers} is at least 16.</li>
1927 * </ul>
Jesse Hall1cd7e932017-02-05 19:58:15 -08001928 */
1929 @SdkConstant(SdkConstantType.FEATURE)
1930 public static final String FEATURE_VULKAN_HARDWARE_COMPUTE = "android.hardware.vulkan.compute";
1931
1932 /**
1933 * Feature for {@link #getSystemAvailableFeatures} and
Jesse Hall39ceeb52016-03-10 09:04:26 -08001934 * {@link #hasSystemFeature(String, int)}: The version of this feature indicates the highest
Jesse Hallf77a34f2016-02-04 18:41:33 -08001935 * {@code VkPhysicalDeviceProperties::apiVersion} supported by the physical devices that support
1936 * the hardware level indicated by {@link #FEATURE_VULKAN_HARDWARE_LEVEL}. The feature version
1937 * uses the same encoding as Vulkan version numbers:
1938 * <ul>
1939 * <li>Major version number in bits 31-22</li>
1940 * <li>Minor version number in bits 21-12</li>
1941 * <li>Patch version number in bits 11-0</li>
1942 * </ul>
1943 */
1944 @SdkConstant(SdkConstantType.FEATURE)
1945 public static final String FEATURE_VULKAN_HARDWARE_VERSION = "android.hardware.vulkan.version";
1946
1947 /**
Tomasz Wasilczyk05392d62017-07-10 19:33:22 -07001948 * Feature for {@link #getSystemAvailableFeatures} and
1949 * {@link #hasSystemFeature}: The device includes broadcast radio tuner.
1950 * @hide
Tomasz Wasilczyk347192e2017-04-04 11:13:44 -07001951 */
Tomasz Wasilczyk05392d62017-07-10 19:33:22 -07001952 @SystemApi
Tomasz Wasilczyk347192e2017-04-04 11:13:44 -07001953 @SdkConstant(SdkConstantType.FEATURE)
Tomasz Wasilczyk05392d62017-07-10 19:33:22 -07001954 public static final String FEATURE_BROADCAST_RADIO = "android.hardware.broadcastradio";
Tomasz Wasilczyk347192e2017-04-04 11:13:44 -07001955
1956 /**
Jesse Hallf77a34f2016-02-04 18:41:33 -08001957 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill5744bb42010-09-01 19:18:57 -07001958 * {@link #hasSystemFeature}: The device includes an accelerometer.
1959 */
1960 @SdkConstant(SdkConstantType.FEATURE)
1961 public static final String FEATURE_SENSOR_ACCELEROMETER = "android.hardware.sensor.accelerometer";
1962
1963 /**
1964 * Feature for {@link #getSystemAvailableFeatures} and
1965 * {@link #hasSystemFeature}: The device includes a barometer (air
1966 * pressure sensor.)
1967 */
1968 @SdkConstant(SdkConstantType.FEATURE)
1969 public static final String FEATURE_SENSOR_BAROMETER = "android.hardware.sensor.barometer";
1970
1971 /**
1972 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001973 * {@link #hasSystemFeature}: The device includes a magnetometer (compass).
1974 */
1975 @SdkConstant(SdkConstantType.FEATURE)
1976 public static final String FEATURE_SENSOR_COMPASS = "android.hardware.sensor.compass";
1977
1978 /**
1979 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill5744bb42010-09-01 19:18:57 -07001980 * {@link #hasSystemFeature}: The device includes a gyroscope.
Dan Morrill50ab63f2010-03-05 16:16:19 -08001981 */
1982 @SdkConstant(SdkConstantType.FEATURE)
Dan Morrill5744bb42010-09-01 19:18:57 -07001983 public static final String FEATURE_SENSOR_GYROSCOPE = "android.hardware.sensor.gyroscope";
Dan Morrill50ab63f2010-03-05 16:16:19 -08001984
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001985 /**
1986 * Feature for {@link #getSystemAvailableFeatures} and
1987 * {@link #hasSystemFeature}: The device includes a light sensor.
1988 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001989 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001990 public static final String FEATURE_SENSOR_LIGHT = "android.hardware.sensor.light";
Dan Morrill50ab63f2010-03-05 16:16:19 -08001991
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001992 /**
1993 * Feature for {@link #getSystemAvailableFeatures} and
1994 * {@link #hasSystemFeature}: The device includes a proximity sensor.
1995 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001996 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001997 public static final String FEATURE_SENSOR_PROXIMITY = "android.hardware.sensor.proximity";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001998
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001999 /**
2000 * Feature for {@link #getSystemAvailableFeatures} and
Aravind Akella068b0c02013-10-12 17:39:15 -07002001 * {@link #hasSystemFeature}: The device includes a hardware step counter.
2002 */
2003 @SdkConstant(SdkConstantType.FEATURE)
2004 public static final String FEATURE_SENSOR_STEP_COUNTER = "android.hardware.sensor.stepcounter";
2005
2006 /**
2007 * Feature for {@link #getSystemAvailableFeatures} and
2008 * {@link #hasSystemFeature}: The device includes a hardware step detector.
2009 */
2010 @SdkConstant(SdkConstantType.FEATURE)
2011 public static final String FEATURE_SENSOR_STEP_DETECTOR = "android.hardware.sensor.stepdetector";
2012
2013 /**
2014 * Feature for {@link #getSystemAvailableFeatures} and
Vinod Krishnan8afb23c2014-04-30 11:11:39 -07002015 * {@link #hasSystemFeature}: The device includes a heart rate monitor.
2016 */
2017 @SdkConstant(SdkConstantType.FEATURE)
2018 public static final String FEATURE_SENSOR_HEART_RATE = "android.hardware.sensor.heartrate";
2019
2020 /**
2021 * Feature for {@link #getSystemAvailableFeatures} and
Trevor Johns682c24e2016-04-12 10:13:47 -07002022 * {@link #hasSystemFeature}: The heart rate sensor on this device is an Electrocardiogram.
Vinod Krishnan1ab76892014-08-20 11:11:55 -07002023 */
2024 @SdkConstant(SdkConstantType.FEATURE)
2025 public static final String FEATURE_SENSOR_HEART_RATE_ECG =
2026 "android.hardware.sensor.heartrate.ecg";
2027
2028 /**
2029 * Feature for {@link #getSystemAvailableFeatures} and
Aravind Akella8b8e74b2014-07-09 11:52:39 -07002030 * {@link #hasSystemFeature}: The device includes a relative humidity sensor.
2031 */
2032 @SdkConstant(SdkConstantType.FEATURE)
2033 public static final String FEATURE_SENSOR_RELATIVE_HUMIDITY =
2034 "android.hardware.sensor.relative_humidity";
2035
2036 /**
2037 * Feature for {@link #getSystemAvailableFeatures} and
2038 * {@link #hasSystemFeature}: The device includes an ambient temperature sensor.
2039 */
2040 @SdkConstant(SdkConstantType.FEATURE)
2041 public static final String FEATURE_SENSOR_AMBIENT_TEMPERATURE =
2042 "android.hardware.sensor.ambient_temperature";
2043
2044 /**
2045 * Feature for {@link #getSystemAvailableFeatures} and
Ashutosh Joshieae371b2015-04-09 10:30:07 -07002046 * {@link #hasSystemFeature}: The device supports high fidelity sensor processing
2047 * capabilities.
2048 */
2049 @SdkConstant(SdkConstantType.FEATURE)
2050 public static final String FEATURE_HIFI_SENSORS =
2051 "android.hardware.sensor.hifi_sensors";
2052
2053 /**
2054 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002055 * {@link #hasSystemFeature}: The device has a telephony radio with data
2056 * communication support.
2057 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08002058 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002059 public static final String FEATURE_TELEPHONY = "android.hardware.telephony";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002060
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002061 /**
2062 * Feature for {@link #getSystemAvailableFeatures} and
2063 * {@link #hasSystemFeature}: The device has a CDMA telephony stack.
2064 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08002065 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002066 public static final String FEATURE_TELEPHONY_CDMA = "android.hardware.telephony.cdma";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002067
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002068 /**
2069 * Feature for {@link #getSystemAvailableFeatures} and
2070 * {@link #hasSystemFeature}: The device has a GSM telephony stack.
2071 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08002072 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002073 public static final String FEATURE_TELEPHONY_GSM = "android.hardware.telephony.gsm";
Hung-ying Tyan3424c022010-08-27 18:08:19 +08002074
2075 /**
Polina Bondarenko80909ce2017-01-12 21:10:38 +01002076 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2077 * The device supports telephony carrier restriction mechanism.
2078 *
2079 * <p>Devices declaring this feature must have an implementation of the
2080 * {@link android.telephony.TelephonyManager#getAllowedCarriers} and
2081 * {@link android.telephony.TelephonyManager#setAllowedCarriers}.
2082 * @hide
2083 */
2084 @SystemApi
2085 @SdkConstant(SdkConstantType.FEATURE)
2086 public static final String FEATURE_TELEPHONY_CARRIERLOCK =
2087 "android.hardware.telephony.carrierlock";
2088
2089 /**
Jeff Davidson35cda392017-02-27 09:46:00 -08002090 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: The device
2091 * supports embedded subscriptions on eUICCs.
2092 * TODO(b/35851809): Make this public.
2093 * @hide
2094 */
2095 @SdkConstant(SdkConstantType.FEATURE)
2096 public static final String FEATURE_TELEPHONY_EUICC = "android.hardware.telephony.euicc";
2097
2098 /**
Hall Liuc6703d92017-11-17 11:31:57 -08002099 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: The device
2100 * supports cell-broadcast reception using the MBMS APIs.
2101 */
2102 @SdkConstant(SdkConstantType.FEATURE)
2103 public static final String FEATURE_TELEPHONY_MBMS = "android.hardware.telephony.mbms";
2104
2105 /**
Hung-ying Tyan3424c022010-08-27 18:08:19 +08002106 * Feature for {@link #getSystemAvailableFeatures} and
Mike Lockwoodf4ca2472011-02-27 11:23:25 -08002107 * {@link #hasSystemFeature}: The device supports connecting to USB devices
2108 * as the USB host.
2109 */
2110 @SdkConstant(SdkConstantType.FEATURE)
2111 public static final String FEATURE_USB_HOST = "android.hardware.usb.host";
2112
2113 /**
2114 * Feature for {@link #getSystemAvailableFeatures} and
2115 * {@link #hasSystemFeature}: The device supports connecting to USB accessories.
2116 */
2117 @SdkConstant(SdkConstantType.FEATURE)
2118 public static final String FEATURE_USB_ACCESSORY = "android.hardware.usb.accessory";
2119
2120 /**
2121 * Feature for {@link #getSystemAvailableFeatures} and
Hung-ying Tyan3424c022010-08-27 18:08:19 +08002122 * {@link #hasSystemFeature}: The SIP API is enabled on the device.
2123 */
2124 @SdkConstant(SdkConstantType.FEATURE)
2125 public static final String FEATURE_SIP = "android.software.sip";
2126
2127 /**
2128 * Feature for {@link #getSystemAvailableFeatures} and
2129 * {@link #hasSystemFeature}: The device supports SIP-based VOIP.
2130 */
2131 @SdkConstant(SdkConstantType.FEATURE)
2132 public static final String FEATURE_SIP_VOIP = "android.software.sip.voip";
2133
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002134 /**
2135 * Feature for {@link #getSystemAvailableFeatures} and
Ihab Awad1ec68882014-09-12 11:09:01 -07002136 * {@link #hasSystemFeature}: The Connection Service API is enabled on the device.
2137 */
2138 @SdkConstant(SdkConstantType.FEATURE)
2139 public static final String FEATURE_CONNECTION_SERVICE = "android.software.connectionservice";
2140
2141 /**
2142 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrillb0fe0332010-04-05 14:43:58 -07002143 * {@link #hasSystemFeature}: The device's display has a touch screen.
2144 */
2145 @SdkConstant(SdkConstantType.FEATURE)
2146 public static final String FEATURE_TOUCHSCREEN = "android.hardware.touchscreen";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002147
Dan Morrillb0fe0332010-04-05 14:43:58 -07002148 /**
2149 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08002150 * {@link #hasSystemFeature}: The device's touch screen supports
2151 * multitouch sufficient for basic two-finger gesture detection.
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002152 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08002153 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002154 public static final String FEATURE_TOUCHSCREEN_MULTITOUCH = "android.hardware.touchscreen.multitouch";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002155
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002156 /**
2157 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08002158 * {@link #hasSystemFeature}: The device's touch screen is capable of
2159 * tracking two or more fingers fully independently.
2160 */
2161 @SdkConstant(SdkConstantType.FEATURE)
2162 public static final String FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT = "android.hardware.touchscreen.multitouch.distinct";
2163
2164 /**
2165 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill6993d3d2010-09-03 14:30:14 -07002166 * {@link #hasSystemFeature}: The device's touch screen is capable of
2167 * tracking a full hand of fingers fully independently -- that is, 5 or
2168 * more simultaneous independent pointers.
2169 */
2170 @SdkConstant(SdkConstantType.FEATURE)
2171 public static final String FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND = "android.hardware.touchscreen.multitouch.jazzhand";
2172
2173 /**
2174 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrilla5376872011-01-23 13:15:53 -08002175 * {@link #hasSystemFeature}: The device does not have a touch screen, but
2176 * does support touch emulation for basic events. For instance, the
2177 * device might use a mouse or remote control to drive a cursor, and
2178 * emulate basic touch pointer events like down, up, drag, etc. All
2179 * devices that support android.hardware.touchscreen or a sub-feature are
2180 * presumed to also support faketouch.
2181 */
2182 @SdkConstant(SdkConstantType.FEATURE)
2183 public static final String FEATURE_FAKETOUCH = "android.hardware.faketouch";
2184
2185 /**
2186 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborne22fe932011-06-08 20:24:29 -07002187 * {@link #hasSystemFeature}: The device does not have a touch screen, but
2188 * does support touch emulation for basic events that supports distinct
2189 * tracking of two or more fingers. This is an extension of
2190 * {@link #FEATURE_FAKETOUCH} for input devices with this capability. Note
2191 * that unlike a distinct multitouch screen as defined by
2192 * {@link #FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT}, these kinds of input
2193 * devices will not actually provide full two-finger gestures since the
2194 * input is being transformed to cursor movement on the screen. That is,
2195 * single finger gestures will move a cursor; two-finger swipes will
2196 * result in single-finger touch events; other two-finger gestures will
2197 * result in the corresponding two-finger touch event.
2198 */
2199 @SdkConstant(SdkConstantType.FEATURE)
2200 public static final String FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT = "android.hardware.faketouch.multitouch.distinct";
2201
2202 /**
2203 * Feature for {@link #getSystemAvailableFeatures} and
2204 * {@link #hasSystemFeature}: The device does not have a touch screen, but
2205 * does support touch emulation for basic events that supports tracking
2206 * a hand of fingers (5 or more fingers) fully independently.
2207 * This is an extension of
2208 * {@link #FEATURE_FAKETOUCH} for input devices with this capability. Note
2209 * that unlike a multitouch screen as defined by
2210 * {@link #FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND}, not all two finger
2211 * gestures can be detected due to the limitations described for
2212 * {@link #FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT}.
2213 */
2214 @SdkConstant(SdkConstantType.FEATURE)
2215 public static final String FEATURE_FAKETOUCH_MULTITOUCH_JAZZHAND = "android.hardware.faketouch.multitouch.jazzhand";
2216
2217 /**
2218 * Feature for {@link #getSystemAvailableFeatures} and
Jim Millerd9b9d412015-07-22 19:51:40 -07002219 * {@link #hasSystemFeature}: The device has biometric hardware to detect a fingerprint.
2220 */
2221 @SdkConstant(SdkConstantType.FEATURE)
2222 public static final String FEATURE_FINGERPRINT = "android.hardware.fingerprint";
2223
2224 /**
2225 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborne289bff2011-06-13 19:33:22 -07002226 * {@link #hasSystemFeature}: The device supports portrait orientation
2227 * screens. For backwards compatibility, you can assume that if neither
2228 * this nor {@link #FEATURE_SCREEN_LANDSCAPE} is set then the device supports
2229 * both portrait and landscape.
2230 */
2231 @SdkConstant(SdkConstantType.FEATURE)
2232 public static final String FEATURE_SCREEN_PORTRAIT = "android.hardware.screen.portrait";
2233
2234 /**
2235 * Feature for {@link #getSystemAvailableFeatures} and
2236 * {@link #hasSystemFeature}: The device supports landscape orientation
2237 * screens. For backwards compatibility, you can assume that if neither
2238 * this nor {@link #FEATURE_SCREEN_PORTRAIT} is set then the device supports
2239 * both portrait and landscape.
2240 */
2241 @SdkConstant(SdkConstantType.FEATURE)
2242 public static final String FEATURE_SCREEN_LANDSCAPE = "android.hardware.screen.landscape";
2243
2244 /**
2245 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002246 * {@link #hasSystemFeature}: The device supports live wallpapers.
2247 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08002248 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002249 public static final String FEATURE_LIVE_WALLPAPER = "android.software.live_wallpaper";
Oscar Montemayor1228d0a2010-01-28 12:01:44 -08002250 /**
Dan Morrill50ab63f2010-03-05 16:16:19 -08002251 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn119bbc32013-03-22 17:27:25 -07002252 * {@link #hasSystemFeature}: The device supports app widgets.
2253 */
2254 @SdkConstant(SdkConstantType.FEATURE)
2255 public static final String FEATURE_APP_WIDGETS = "android.software.app_widgets";
2256
2257 /**
Dianne Hackborn91097de2014-04-04 18:02:06 -07002258 * @hide
2259 * Feature for {@link #getSystemAvailableFeatures} and
2260 * {@link #hasSystemFeature}: The device supports
2261 * {@link android.service.voice.VoiceInteractionService} and
2262 * {@link android.app.VoiceInteractor}.
2263 */
2264 @SdkConstant(SdkConstantType.FEATURE)
2265 public static final String FEATURE_VOICE_RECOGNIZERS = "android.software.voice_recognizers";
2266
2267
2268 /**
Dianne Hackborn119bbc32013-03-22 17:27:25 -07002269 * Feature for {@link #getSystemAvailableFeatures} and
2270 * {@link #hasSystemFeature}: The device supports a home screen that is replaceable
2271 * by third party applications.
2272 */
2273 @SdkConstant(SdkConstantType.FEATURE)
2274 public static final String FEATURE_HOME_SCREEN = "android.software.home_screen";
2275
2276 /**
2277 * Feature for {@link #getSystemAvailableFeatures} and
2278 * {@link #hasSystemFeature}: The device supports adding new input methods implemented
2279 * with the {@link android.inputmethodservice.InputMethodService} API.
2280 */
2281 @SdkConstant(SdkConstantType.FEATURE)
2282 public static final String FEATURE_INPUT_METHODS = "android.software.input_methods";
2283
2284 /**
2285 * Feature for {@link #getSystemAvailableFeatures} and
Amith Yamasani44a01b72013-09-16 10:44:57 -07002286 * {@link #hasSystemFeature}: The device supports device policy enforcement via device admins.
2287 */
2288 @SdkConstant(SdkConstantType.FEATURE)
2289 public static final String FEATURE_DEVICE_ADMIN = "android.software.device_admin";
2290
2291 /**
2292 * Feature for {@link #getSystemAvailableFeatures} and
Tim Kilbournf94b6a92014-03-07 15:13:48 -08002293 * {@link #hasSystemFeature}: The device supports leanback UI. This is
2294 * typically used in a living room television experience, but is a software
2295 * feature unlike {@link #FEATURE_TELEVISION}. Devices running with this
2296 * feature will use resources associated with the "television" UI mode.
2297 */
2298 @SdkConstant(SdkConstantType.FEATURE)
2299 public static final String FEATURE_LEANBACK = "android.software.leanback";
2300
2301 /**
2302 * Feature for {@link #getSystemAvailableFeatures} and
2303 * {@link #hasSystemFeature}: The device supports only leanback UI. Only
2304 * applications designed for this experience should be run, though this is
2305 * not enforced by the system.
Tim Kilbournf94b6a92014-03-07 15:13:48 -08002306 */
2307 @SdkConstant(SdkConstantType.FEATURE)
2308 public static final String FEATURE_LEANBACK_ONLY = "android.software.leanback_only";
2309
2310 /**
2311 * Feature for {@link #getSystemAvailableFeatures} and
Jae Seocfd861e2014-08-27 14:02:15 -07002312 * {@link #hasSystemFeature}: The device supports live TV and can display
2313 * contents from TV inputs implemented with the
2314 * {@link android.media.tv.TvInputService} API.
2315 */
2316 @SdkConstant(SdkConstantType.FEATURE)
2317 public static final String FEATURE_LIVE_TV = "android.software.live_tv";
2318
2319 /**
2320 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08002321 * {@link #hasSystemFeature}: The device supports WiFi (802.11) networking.
2322 */
2323 @SdkConstant(SdkConstantType.FEATURE)
2324 public static final String FEATURE_WIFI = "android.hardware.wifi";
2325
2326 /**
Irfan Sheriff45b8b462011-09-07 11:24:16 -07002327 * Feature for {@link #getSystemAvailableFeatures} and
2328 * {@link #hasSystemFeature}: The device supports Wi-Fi Direct networking.
2329 */
2330 @SdkConstant(SdkConstantType.FEATURE)
2331 public static final String FEATURE_WIFI_DIRECT = "android.hardware.wifi.direct";
2332
2333 /**
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07002334 * Feature for {@link #getSystemAvailableFeatures} and
Etan Cohen04133272016-10-26 11:22:06 -07002335 * {@link #hasSystemFeature}: The device supports Wi-Fi Aware.
Etan Cohen20d329b2015-09-29 13:49:02 -07002336 */
2337 @SdkConstant(SdkConstantType.FEATURE)
Etan Cohen04133272016-10-26 11:22:06 -07002338 public static final String FEATURE_WIFI_AWARE = "android.hardware.wifi.aware";
Etan Cohen20d329b2015-09-29 13:49:02 -07002339
2340 /**
2341 * Feature for {@link #getSystemAvailableFeatures} and
Peter Qiu3d615e42017-08-07 20:13:32 +00002342 * {@link #hasSystemFeature}: The device supports Wi-Fi Passpoint and all
2343 * Passpoint related APIs in {@link WifiManager} are supported. Refer to
2344 * {@link WifiManager#addOrUpdatePasspointConfiguration} for more info.
Peter Qiub99fe312017-05-05 13:48:47 -07002345 */
2346 @SdkConstant(SdkConstantType.FEATURE)
2347 public static final String FEATURE_WIFI_PASSPOINT = "android.hardware.wifi.passpoint";
2348
2349 /**
2350 * Feature for {@link #getSystemAvailableFeatures} and
Etan Cohen692e68e2017-09-14 15:42:01 -07002351 * {@link #hasSystemFeature}: The device supports Wi-Fi RTT (IEEE 802.11mc).
Etan Cohen692e68e2017-09-14 15:42:01 -07002352 */
2353 @SdkConstant(SdkConstantType.FEATURE)
2354 public static final String FEATURE_WIFI_RTT = "android.hardware.wifi.rtt";
2355
2356
2357 /**
2358 * Feature for {@link #getSystemAvailableFeatures} and
Robert Quattlebaum87a71042017-05-15 15:45:20 -07002359 * {@link #hasSystemFeature}: The device supports LoWPAN networking.
2360 * @hide
2361 */
2362 @SdkConstant(SdkConstantType.FEATURE)
2363 public static final String FEATURE_LOWPAN = "android.hardware.lowpan";
2364
2365 /**
2366 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07002367 * {@link #hasSystemFeature}: This is a device dedicated to showing UI
Todd Kennedy7f95a002015-04-22 14:28:25 -07002368 * on a vehicle headunit. A headunit here is defined to be inside a
2369 * vehicle that may or may not be moving. A headunit uses either a
2370 * primary display in the center console and/or additional displays in
2371 * the instrument cluster or elsewhere in the vehicle. Headunit display(s)
2372 * have limited size and resolution. The user will likely be focused on
2373 * driving so limiting driver distraction is a primary concern. User input
2374 * can be a variety of hard buttons, touch, rotary controllers and even mouse-
2375 * like interfaces.
2376 */
2377 @SdkConstant(SdkConstantType.FEATURE)
2378 public static final String FEATURE_AUTOMOTIVE = "android.hardware.type.automotive";
2379
2380 /**
2381 * Feature for {@link #getSystemAvailableFeatures} and
2382 * {@link #hasSystemFeature}: This is a device dedicated to showing UI
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07002383 * on a television. Television here is defined to be a typical living
2384 * room television experience: displayed on a big screen, where the user
2385 * is sitting far away from it, and the dominant form of input will be
2386 * something like a DPAD, not through touch or mouse.
Tim Kilbournf94b6a92014-03-07 15:13:48 -08002387 * @deprecated use {@link #FEATURE_LEANBACK} instead.
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07002388 */
Jose Lima970417c2014-04-10 10:42:19 -07002389 @Deprecated
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07002390 @SdkConstant(SdkConstantType.FEATURE)
2391 public static final String FEATURE_TELEVISION = "android.hardware.type.television";
2392
2393 /**
Justin Kohb5731f091c2014-02-13 16:06:59 -08002394 * Feature for {@link #getSystemAvailableFeatures} and
2395 * {@link #hasSystemFeature}: This is a device dedicated to showing UI
2396 * on a watch. A watch here is defined to be a device worn on the body, perhaps on
2397 * the wrist. The user is very close when interacting with the device.
2398 */
2399 @SdkConstant(SdkConstantType.FEATURE)
2400 public static final String FEATURE_WATCH = "android.hardware.type.watch";
2401
2402 /**
Ralph Nathanb8e0dee2017-01-24 15:24:59 -08002403 * Feature for {@link #getSystemAvailableFeatures} and
2404 * {@link #hasSystemFeature}: This is a device for IoT and may not have an UI. An embedded
2405 * device is defined as a full stack Android device with or without a display and no
2406 * user-installable apps.
2407 */
2408 @SdkConstant(SdkConstantType.FEATURE)
2409 public static final String FEATURE_EMBEDDED = "android.hardware.type.embedded";
2410
2411 /**
Dennis Kempin7345ed52017-04-14 16:40:56 -07002412 * Feature for {@link #getSystemAvailableFeatures} and
2413 * {@link #hasSystemFeature}: This is a device dedicated to be primarily used
2414 * with keyboard, mouse or touchpad. This includes traditional desktop
2415 * computers, laptops and variants such as convertibles or detachables.
2416 * Due to the larger screen, the device will most likely use the
2417 * {@link #FEATURE_FREEFORM_WINDOW_MANAGEMENT} feature as well.
2418 */
2419 @SdkConstant(SdkConstantType.FEATURE)
2420 public static final String FEATURE_PC = "android.hardware.type.pc";
2421
2422 /**
Adam Lesinski3d9bcb92014-02-18 14:05:14 -08002423 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2424 * The device supports printing.
2425 */
2426 @SdkConstant(SdkConstantType.FEATURE)
2427 public static final String FEATURE_PRINTING = "android.software.print";
2428
2429 /**
2430 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Eugene Susla7c3eef22017-03-10 14:25:58 -08002431 * The device supports {@link android.companion.CompanionDeviceManager#associate associating}
2432 * with devices via {@link android.companion.CompanionDeviceManager}.
2433 */
2434 @SdkConstant(SdkConstantType.FEATURE)
2435 public static final String FEATURE_COMPANION_DEVICE_SETUP
2436 = "android.software.companion_device_setup";
2437
2438 /**
2439 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Adam Lesinski3d9bcb92014-02-18 14:05:14 -08002440 * The device can perform backup and restore operations on installed applications.
2441 */
2442 @SdkConstant(SdkConstantType.FEATURE)
2443 public static final String FEATURE_BACKUP = "android.software.backup";
2444
2445 /**
Vladislav Kaznacheevd303b252015-10-27 17:30:58 -07002446 * Feature for {@link #getSystemAvailableFeatures} and
2447 * {@link #hasSystemFeature}: The device supports freeform window management.
2448 * Windows have title bars and can be moved and resized.
2449 */
Filip Gruszczynski811dc3b2015-11-23 12:34:22 -08002450 // If this feature is present, you also need to set
2451 // com.android.internal.R.config_freeformWindowManagement to true in your configuration overlay.
Vladislav Kaznacheevd303b252015-10-27 17:30:58 -07002452 @SdkConstant(SdkConstantType.FEATURE)
2453 public static final String FEATURE_FREEFORM_WINDOW_MANAGEMENT
2454 = "android.software.freeform_window_management";
2455
2456 /**
Adam Connors23cc04e2014-04-01 12:12:20 +01002457 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Wale Ogunwalefbe12c42015-12-06 16:23:50 -08002458 * The device supports picture-in-picture multi-window mode.
2459 */
2460 @SdkConstant(SdkConstantType.FEATURE)
2461 public static final String FEATURE_PICTURE_IN_PICTURE = "android.software.picture_in_picture";
2462
2463 /**
2464 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Andrii Kulian1981f5f2017-04-07 16:23:12 -07002465 * The device supports running activities on secondary displays.
2466 */
2467 @SdkConstant(SdkConstantType.FEATURE)
2468 public static final String FEATURE_ACTIVITIES_ON_SECONDARY_DISPLAYS
2469 = "android.software.activities_on_secondary_displays";
2470
2471 /**
2472 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Amith Yamasani1d653272014-09-11 17:56:05 -07002473 * The device supports creating secondary users and managed profiles via
2474 * {@link DevicePolicyManager}.
Adam Connors23cc04e2014-04-01 12:12:20 +01002475 */
2476 @SdkConstant(SdkConstantType.FEATURE)
Amith Yamasani1d653272014-09-11 17:56:05 -07002477 public static final String FEATURE_MANAGED_USERS = "android.software.managed_users";
2478
2479 /**
2480 * @hide
2481 * TODO: Remove after dependencies updated b/17392243
2482 */
2483 public static final String FEATURE_MANAGED_PROFILES = "android.software.managed_users";
Adam Connors23cc04e2014-04-01 12:12:20 +01002484
2485 /**
Ben Murdochf564c7f2014-05-20 18:58:06 +01002486 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Adam Connors19ccb5f2014-09-08 17:31:50 +01002487 * The device supports verified boot.
2488 */
2489 @SdkConstant(SdkConstantType.FEATURE)
2490 public static final String FEATURE_VERIFIED_BOOT = "android.software.verified_boot";
2491
2492 /**
2493 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2494 * The device supports secure removal of users. When a user is deleted the data associated
2495 * with that user is securely deleted and no longer available.
2496 */
2497 @SdkConstant(SdkConstantType.FEATURE)
2498 public static final String FEATURE_SECURELY_REMOVES_USERS
2499 = "android.software.securely_removes_users";
2500
Jeff Sharkeyb92b05b2016-01-28 09:50:00 -07002501 /** {@hide} */
Jeff Sharkey8eb783b2018-01-04 16:46:48 -07002502 @TestApi
Jeff Sharkeyb92b05b2016-01-28 09:50:00 -07002503 @SdkConstant(SdkConstantType.FEATURE)
2504 public static final String FEATURE_FILE_BASED_ENCRYPTION
2505 = "android.software.file_based_encryption";
2506
Jeff Sharkey8eb783b2018-01-04 16:46:48 -07002507 /** {@hide} */
2508 @TestApi
2509 @SdkConstant(SdkConstantType.FEATURE)
2510 public static final String FEATURE_ADOPTABLE_STORAGE
2511 = "android.software.adoptable_storage";
2512
Adam Connors19ccb5f2014-09-08 17:31:50 +01002513 /**
2514 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Ben Murdoch422c7a52014-05-16 13:45:47 +01002515 * The device has a full implementation of the android.webkit.* APIs. Devices
2516 * lacking this feature will not have a functioning WebView implementation.
2517 */
2518 @SdkConstant(SdkConstantType.FEATURE)
2519 public static final String FEATURE_WEBVIEW = "android.software.webview";
2520
2521 /**
Joe LaPenna4bb015d2014-07-04 17:15:54 -07002522 * Feature for {@link #getSystemAvailableFeatures} and
2523 * {@link #hasSystemFeature}: This device supports ethernet.
Joe LaPenna4bb015d2014-07-04 17:15:54 -07002524 */
2525 @SdkConstant(SdkConstantType.FEATURE)
2526 public static final String FEATURE_ETHERNET = "android.hardware.ethernet";
2527
2528 /**
Yuncheol Heoa0c4a062014-07-10 20:49:27 +09002529 * Feature for {@link #getSystemAvailableFeatures} and
2530 * {@link #hasSystemFeature}: This device supports HDMI-CEC.
2531 * @hide
2532 */
2533 @SdkConstant(SdkConstantType.FEATURE)
2534 public static final String FEATURE_HDMI_CEC = "android.hardware.hdmi.cec";
2535
2536 /**
Michael Wright6faa6752014-09-05 17:57:44 -07002537 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2538 * The device has all of the inputs necessary to be considered a compatible game controller, or
2539 * includes a compatible game controller in the box.
2540 */
2541 @SdkConstant(SdkConstantType.FEATURE)
2542 public static final String FEATURE_GAMEPAD = "android.hardware.gamepad";
2543
Mike Lockwood5781cd52015-03-27 13:23:41 -07002544 /**
2545 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2546 * The device has a full implementation of the android.media.midi.* APIs.
2547 */
2548 @SdkConstant(SdkConstantType.FEATURE)
2549 public static final String FEATURE_MIDI = "android.software.midi";
Michael Wright6faa6752014-09-05 17:57:44 -07002550
2551 /**
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08002552 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Ruben Brunk927d3452016-05-02 19:30:51 -07002553 * The device implements an optimized mode for virtual reality (VR) applications that handles
2554 * stereoscopic rendering of notifications, and disables most monocular system UI components
2555 * while a VR application has user focus.
2556 * Devices declaring this feature must include an application implementing a
2557 * {@link android.service.vr.VrListenerService} that can be targeted by VR applications via
2558 * {@link android.app.Activity#setVrModeEnabled}.
Craig Donnerc6f9c852017-12-27 17:15:19 -08002559 * @deprecated use {@link #FEATURE_VR_MODE_HIGH_PERFORMANCE} instead.
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08002560 */
Craig Donnerc6f9c852017-12-27 17:15:19 -08002561 @Deprecated
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08002562 @SdkConstant(SdkConstantType.FEATURE)
2563 public static final String FEATURE_VR_MODE = "android.software.vr.mode";
2564
2565 /**
Ruben Brunk31d80ea2016-01-25 20:14:08 -08002566 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Craig Donnerc6f9c852017-12-27 17:15:19 -08002567 * The device implements an optimized mode for virtual reality (VR) applications that handles
2568 * stereoscopic rendering of notifications, disables most monocular system UI components
2569 * while a VR application has user focus and meets extra CDD requirements to provide a
2570 * high-quality VR experience.
2571 * Devices declaring this feature must include an application implementing a
2572 * {@link android.service.vr.VrListenerService} that can be targeted by VR applications via
2573 * {@link android.app.Activity#setVrModeEnabled}.
2574 * and must meet CDD requirements to provide a high-quality VR experience.
Ruben Brunk31d80ea2016-01-25 20:14:08 -08002575 */
2576 @SdkConstant(SdkConstantType.FEATURE)
2577 public static final String FEATURE_VR_MODE_HIGH_PERFORMANCE
2578 = "android.hardware.vr.high_performance";
2579
2580 /**
Craig Donner279dd662017-03-15 17:10:50 -07002581 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Svet Ganov43574b02017-04-12 09:25:20 -07002582 * The device supports autofill of user credentials, addresses, credit cards, etc
2583 * via integration with {@link android.service.autofill.AutofillService autofill
2584 * providers}.
2585 */
2586 @SdkConstant(SdkConstantType.FEATURE)
2587 public static final String FEATURE_AUTOFILL = "android.software.autofill";
2588
2589 /**
2590 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Craig Donner279dd662017-03-15 17:10:50 -07002591 * The device implements headtracking suitable for a VR device.
2592 */
2593 @SdkConstant(SdkConstantType.FEATURE)
2594 public static final String FEATURE_VR_HEADTRACKING = "android.hardware.vr.headtracking";
2595
2596 /**
Dianne Hackborne83cefce2010-02-04 17:38:14 -08002597 * Action to external storage service to clean out removed apps.
2598 * @hide
2599 */
2600 public static final String ACTION_CLEAN_EXTERNAL_STORAGE
2601 = "android.content.pm.CLEAN_EXTERNAL_STORAGE";
Oscar Montemayor1228d0a2010-01-28 12:01:44 -08002602
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002603 /**
Kenny Root5ab21572011-07-27 11:11:19 -07002604 * Extra field name for the URI to a verification file. Passed to a package
2605 * verifier.
2606 *
2607 * @hide
2608 */
2609 public static final String EXTRA_VERIFICATION_URI = "android.content.pm.extra.VERIFICATION_URI";
2610
2611 /**
2612 * Extra field name for the ID of a package pending verification. Passed to
2613 * a package verifier and is used to call back to
Kenny Root3a9b5fb2011-09-20 14:15:38 -07002614 * {@link PackageManager#verifyPendingInstall(int, int)}
Kenny Root5ab21572011-07-27 11:11:19 -07002615 */
2616 public static final String EXTRA_VERIFICATION_ID = "android.content.pm.extra.VERIFICATION_ID";
2617
2618 /**
2619 * Extra field name for the package identifier which is trying to install
2620 * the package.
2621 *
2622 * @hide
2623 */
2624 public static final String EXTRA_VERIFICATION_INSTALLER_PACKAGE
2625 = "android.content.pm.extra.VERIFICATION_INSTALLER_PACKAGE";
2626
2627 /**
2628 * Extra field name for the requested install flags for a package pending
2629 * verification. Passed to a package verifier.
2630 *
2631 * @hide
2632 */
2633 public static final String EXTRA_VERIFICATION_INSTALL_FLAGS
2634 = "android.content.pm.extra.VERIFICATION_INSTALL_FLAGS";
2635
2636 /**
rich cannings13d428e2012-09-13 13:43:07 -07002637 * Extra field name for the uid of who is requesting to install
2638 * the package.
2639 *
2640 * @hide
2641 */
2642 public static final String EXTRA_VERIFICATION_INSTALLER_UID
2643 = "android.content.pm.extra.VERIFICATION_INSTALLER_UID";
2644
2645 /**
2646 * Extra field name for the package name of a package pending verification.
2647 *
2648 * @hide
2649 */
2650 public static final String EXTRA_VERIFICATION_PACKAGE_NAME
2651 = "android.content.pm.extra.VERIFICATION_PACKAGE_NAME";
2652 /**
rich canningsd1b5cfc2012-08-29 14:49:51 -07002653 * Extra field name for the result of a verification, either
2654 * {@link #VERIFICATION_ALLOW}, or {@link #VERIFICATION_REJECT}.
2655 * Passed to package verifiers after a package is verified.
2656 */
2657 public static final String EXTRA_VERIFICATION_RESULT
2658 = "android.content.pm.extra.VERIFICATION_RESULT";
2659
2660 /**
rich cannings13d428e2012-09-13 13:43:07 -07002661 * Extra field name for the version code of a package pending verification.
Dianne Hackborn3accca02013-09-20 09:32:11 -07002662 * @deprecated Use {@link #EXTRA_VERIFICATION_LONG_VERSION_CODE} instead.
2663 * @hide
2664 */
2665 @Deprecated
2666 public static final String EXTRA_VERIFICATION_VERSION_CODE
2667 = "android.content.pm.extra.VERIFICATION_VERSION_CODE";
2668
2669 /**
2670 * Extra field name for the long version code of a package pending verification.
rich cannings13d428e2012-09-13 13:43:07 -07002671 *
2672 * @hide
2673 */
Dianne Hackborn3accca02013-09-20 09:32:11 -07002674 public static final String EXTRA_VERIFICATION_LONG_VERSION_CODE =
2675 "android.content.pm.extra.VERIFICATION_LONG_VERSION_CODE";
rich cannings13d428e2012-09-13 13:43:07 -07002676
2677 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07002678 * Extra field name for the ID of a intent filter pending verification.
2679 * Passed to an intent filter verifier and is used to call back to
2680 * {@link #verifyIntentFilter}
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08002681 *
2682 * @hide
2683 */
2684 public static final String EXTRA_INTENT_FILTER_VERIFICATION_ID
2685 = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_ID";
2686
2687 /**
2688 * Extra field name for the scheme used for an intent filter pending verification. Passed to
2689 * an intent filter verifier and is used to construct the URI to verify against.
2690 *
2691 * Usually this is "https"
2692 *
2693 * @hide
2694 */
2695 public static final String EXTRA_INTENT_FILTER_VERIFICATION_URI_SCHEME
2696 = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_URI_SCHEME";
2697
2698 /**
2699 * Extra field name for the host names to be used for an intent filter pending verification.
2700 * Passed to an intent filter verifier and is used to construct the URI to verify the
2701 * intent filter.
2702 *
2703 * This is a space delimited list of hosts.
2704 *
2705 * @hide
2706 */
2707 public static final String EXTRA_INTENT_FILTER_VERIFICATION_HOSTS
2708 = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_HOSTS";
2709
2710 /**
2711 * Extra field name for the package name to be used for an intent filter pending verification.
2712 * Passed to an intent filter verifier and is used to check the verification responses coming
2713 * from the hosts. Each host response will need to include the package name of APK containing
2714 * the intent filter.
2715 *
2716 * @hide
2717 */
2718 public static final String EXTRA_INTENT_FILTER_VERIFICATION_PACKAGE_NAME
2719 = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_PACKAGE_NAME";
2720
2721 /**
2722 * The action used to request that the user approve a permission request
2723 * from the application.
Nick Kralevich035f80d2013-03-27 15:20:08 -07002724 *
2725 * @hide
2726 */
Svetoslavc6d1c342015-02-26 14:44:43 -08002727 @SystemApi
2728 public static final String ACTION_REQUEST_PERMISSIONS =
2729 "android.content.pm.action.REQUEST_PERMISSIONS";
Nick Kralevich035f80d2013-03-27 15:20:08 -07002730
2731 /**
Svetoslavc6d1c342015-02-26 14:44:43 -08002732 * The names of the requested permissions.
2733 * <p>
2734 * <strong>Type:</strong> String[]
2735 * </p>
2736 *
2737 * @hide
2738 */
2739 @SystemApi
2740 public static final String EXTRA_REQUEST_PERMISSIONS_NAMES =
2741 "android.content.pm.extra.REQUEST_PERMISSIONS_NAMES";
2742
2743 /**
2744 * The results from the permissions request.
2745 * <p>
2746 * <strong>Type:</strong> int[] of #PermissionResult
2747 * </p>
2748 *
2749 * @hide
2750 */
2751 @SystemApi
2752 public static final String EXTRA_REQUEST_PERMISSIONS_RESULTS
2753 = "android.content.pm.extra.REQUEST_PERMISSIONS_RESULTS";
Nick Kralevich035f80d2013-03-27 15:20:08 -07002754
2755 /**
Jeff Sharkeybb580672014-07-10 12:10:25 -07002756 * String extra for {@link PackageInstallObserver} in the 'extras' Bundle in case of
Christopher Tatef1977b42014-03-24 16:25:51 -07002757 * {@link #INSTALL_FAILED_DUPLICATE_PERMISSION}. This extra names the package which provides
2758 * the existing definition for the permission.
2759 * @hide
2760 */
2761 public static final String EXTRA_FAILURE_EXISTING_PACKAGE
2762 = "android.content.pm.extra.FAILURE_EXISTING_PACKAGE";
2763
2764 /**
Jeff Sharkeybb580672014-07-10 12:10:25 -07002765 * String extra for {@link PackageInstallObserver} in the 'extras' Bundle in case of
Christopher Tatef1977b42014-03-24 16:25:51 -07002766 * {@link #INSTALL_FAILED_DUPLICATE_PERMISSION}. This extra names the permission that is
2767 * being redundantly defined by the package being installed.
2768 * @hide
2769 */
2770 public static final String EXTRA_FAILURE_EXISTING_PERMISSION
2771 = "android.content.pm.extra.FAILURE_EXISTING_PERMISSION";
2772
Svet Ganov8c7f7002015-05-07 10:48:44 -07002773 /**
2774 * Permission flag: The permission is set in its current state
2775 * by the user and apps can still request it at runtime.
2776 *
2777 * @hide
2778 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08002779 @SystemApi
Svet Ganov8c7f7002015-05-07 10:48:44 -07002780 public static final int FLAG_PERMISSION_USER_SET = 1 << 0;
2781
2782 /**
2783 * Permission flag: The permission is set in its current state
2784 * by the user and it is fixed, i.e. apps can no longer request
2785 * this permission.
2786 *
2787 * @hide
2788 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08002789 @SystemApi
Svet Ganov8c7f7002015-05-07 10:48:44 -07002790 public static final int FLAG_PERMISSION_USER_FIXED = 1 << 1;
2791
2792 /**
2793 * Permission flag: The permission is set in its current state
2794 * by device policy and neither apps nor the user can change
2795 * its state.
2796 *
2797 * @hide
2798 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08002799 @SystemApi
Svet Ganov8c7f7002015-05-07 10:48:44 -07002800 public static final int FLAG_PERMISSION_POLICY_FIXED = 1 << 2;
2801
2802 /**
2803 * Permission flag: The permission is set in a granted state but
2804 * access to resources it guards is restricted by other means to
2805 * enable revoking a permission on legacy apps that do not support
2806 * runtime permissions. If this permission is upgraded to runtime
2807 * because the app was updated to support runtime permissions, the
2808 * the permission will be revoked in the upgrade process.
2809 *
2810 * @hide
2811 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08002812 @SystemApi
Svet Ganov8c7f7002015-05-07 10:48:44 -07002813 public static final int FLAG_PERMISSION_REVOKE_ON_UPGRADE = 1 << 3;
2814
Svet Ganovb3f22b42015-05-12 11:01:24 -07002815 /**
2816 * Permission flag: The permission is set in its current state
2817 * because the app is a component that is a part of the system.
2818 *
2819 * @hide
2820 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08002821 @SystemApi
Svet Ganovb3f22b42015-05-12 11:01:24 -07002822 public static final int FLAG_PERMISSION_SYSTEM_FIXED = 1 << 4;
Svet Ganov8c7f7002015-05-07 10:48:44 -07002823
Svet Ganov77ab6a82015-07-03 12:03:02 -07002824 /**
2825 * Permission flag: The permission is granted by default because it
2826 * enables app functionality that is expected to work out-of-the-box
2827 * for providing a smooth user experience. For example, the phone app
2828 * is expected to have the phone permission.
2829 *
2830 * @hide
2831 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08002832 @SystemApi
Svet Ganov77ab6a82015-07-03 12:03:02 -07002833 public static final int FLAG_PERMISSION_GRANTED_BY_DEFAULT = 1 << 5;
2834
Svet Ganov8c7f7002015-05-07 10:48:44 -07002835 /**
Svet Ganov9c165d72015-12-01 19:52:26 -08002836 * Permission flag: The permission has to be reviewed before any of
2837 * the app components can run.
2838 *
2839 * @hide
2840 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08002841 @SystemApi
Svet Ganov9c165d72015-12-01 19:52:26 -08002842 public static final int FLAG_PERMISSION_REVIEW_REQUIRED = 1 << 6;
2843
2844 /**
Svet Ganov8c7f7002015-05-07 10:48:44 -07002845 * Mask for all permission flags.
2846 *
2847 * @hide
2848 */
2849 @SystemApi
Svet Ganovb3f22b42015-05-12 11:01:24 -07002850 public static final int MASK_PERMISSION_FLAGS = 0xFF;
Svet Ganov8c7f7002015-05-07 10:48:44 -07002851
Christopher Tatef1977b42014-03-24 16:25:51 -07002852 /**
Svet Ganovd7b1f4112016-02-09 18:49:23 -08002853 * This is a library that contains components apps can invoke. For
2854 * example, a services for apps to bind to, or standard chooser UI,
2855 * etc. This library is versioned and backwards compatible. Clients
2856 * should check its version via {@link android.ext.services.Version
2857 * #getVersionCode()} and avoid calling APIs added in later versions.
2858 *
2859 * @hide
2860 */
2861 public static final String SYSTEM_SHARED_LIBRARY_SERVICES = "android.ext.services";
2862
2863 /**
2864 * This is a library that contains components apps can dynamically
2865 * load. For example, new widgets, helper classes, etc. This library
2866 * is versioned and backwards compatible. Clients should check its
2867 * version via {@link android.ext.shared.Version#getVersionCode()}
2868 * and avoid calling APIs added in later versions.
2869 *
2870 * @hide
2871 */
2872 public static final String SYSTEM_SHARED_LIBRARY_SHARED = "android.ext.shared";
2873
2874 /**
Brian Carlstromca82e612016-04-19 23:16:08 -07002875 * Used when starting a process for an Activity.
2876 *
2877 * @hide
2878 */
2879 public static final int NOTIFY_PACKAGE_USE_ACTIVITY = 0;
2880
2881 /**
2882 * Used when starting a process for a Service.
2883 *
2884 * @hide
2885 */
2886 public static final int NOTIFY_PACKAGE_USE_SERVICE = 1;
2887
2888 /**
2889 * Used when moving a Service to the foreground.
2890 *
2891 * @hide
2892 */
2893 public static final int NOTIFY_PACKAGE_USE_FOREGROUND_SERVICE = 2;
2894
2895 /**
2896 * Used when starting a process for a BroadcastReceiver.
2897 *
2898 * @hide
2899 */
2900 public static final int NOTIFY_PACKAGE_USE_BROADCAST_RECEIVER = 3;
2901
2902 /**
2903 * Used when starting a process for a ContentProvider.
2904 *
2905 * @hide
2906 */
2907 public static final int NOTIFY_PACKAGE_USE_CONTENT_PROVIDER = 4;
2908
2909 /**
2910 * Used when starting a process for a BroadcastReceiver.
2911 *
2912 * @hide
2913 */
2914 public static final int NOTIFY_PACKAGE_USE_BACKUP = 5;
2915
2916 /**
2917 * Used with Context.getClassLoader() across Android packages.
2918 *
2919 * @hide
2920 */
2921 public static final int NOTIFY_PACKAGE_USE_CROSS_PACKAGE = 6;
2922
2923 /**
2924 * Used when starting a package within a process for Instrumentation.
2925 *
2926 * @hide
2927 */
2928 public static final int NOTIFY_PACKAGE_USE_INSTRUMENTATION = 7;
2929
2930 /**
2931 * Total number of usage reasons.
2932 *
2933 * @hide
2934 */
2935 public static final int NOTIFY_PACKAGE_USE_REASONS_COUNT = 8;
2936
2937 /**
Svet Ganov67882122016-12-11 16:36:34 -08002938 * Constant for specifying the highest installed package version code.
2939 */
2940 public static final int VERSION_CODE_HIGHEST = -1;
2941
2942 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002943 * Retrieve overall information about an application package that is
2944 * installed on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002945 *
2946 * @param packageName The full name (i.e. com.google.apps.contacts) of the
Jeff Sharkey4347f812017-04-21 12:08:39 -06002947 * desired package.
2948 * @param flags Additional option flags to modify the data returned.
2949 * @return A PackageInfo object containing information about the package. If
2950 * flag {@code MATCH_UNINSTALLED_PACKAGES} is set and if the package
2951 * is not found in the list of installed applications, the package
2952 * information is retrieved from the list of uninstalled
kmccormick30498b42013-03-27 17:39:17 -07002953 * applications (which includes installed applications as well as
2954 * applications with data directory i.e. applications which had been
2955 * deleted with {@code DONT_DELETE_DATA} flag set).
Jeff Sharkey8588bc12016-01-06 16:47:42 -07002956 * @throws NameNotFoundException if a package with the given name cannot be
2957 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002958 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07002959 public abstract PackageInfo getPackageInfo(String packageName, @PackageInfoFlags int flags)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002960 throws NameNotFoundException;
2961
2962 /**
Svet Ganov67882122016-12-11 16:36:34 -08002963 * Retrieve overall information about an application package that is
2964 * installed on the system. This method can be used for retrieving
Jeff Sharkey4347f812017-04-21 12:08:39 -06002965 * information about packages for which multiple versions can be installed
2966 * at the time. Currently only packages hosting static shared libraries can
2967 * have multiple installed versions. The method can also be used to get info
2968 * for a package that has a single version installed by passing
2969 * {@link #VERSION_CODE_HIGHEST} in the {@link VersionedPackage}
Svet Ganov67882122016-12-11 16:36:34 -08002970 * constructor.
2971 *
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07002972 * @param versionedPackage The versioned package for which to query.
Jeff Sharkey4347f812017-04-21 12:08:39 -06002973 * @param flags Additional option flags to modify the data returned.
2974 * @return A PackageInfo object containing information about the package. If
2975 * flag {@code MATCH_UNINSTALLED_PACKAGES} is set and if the package
2976 * is not found in the list of installed applications, the package
2977 * information is retrieved from the list of uninstalled
Svet Ganov67882122016-12-11 16:36:34 -08002978 * applications (which includes installed applications as well as
2979 * applications with data directory i.e. applications which had been
2980 * deleted with {@code DONT_DELETE_DATA} flag set).
2981 * @throws NameNotFoundException if a package with the given name cannot be
2982 * found on the system.
Svet Ganov67882122016-12-11 16:36:34 -08002983 */
2984 public abstract PackageInfo getPackageInfo(VersionedPackage versionedPackage,
2985 @PackageInfoFlags int flags) throws NameNotFoundException;
2986
2987 /**
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002988 * Retrieve overall information about an application package that is
2989 * installed on the system.
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002990 *
2991 * @param packageName The full name (i.e. com.google.apps.contacts) of the
Jeff Sharkey4347f812017-04-21 12:08:39 -06002992 * desired package.
2993 * @param flags Additional option flags to modify the data returned.
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002994 * @param userId The user id.
Jeff Sharkey4347f812017-04-21 12:08:39 -06002995 * @return A PackageInfo object containing information about the package. If
2996 * flag {@code MATCH_UNINSTALLED_PACKAGES} is set and if the package
2997 * is not found in the list of installed applications, the package
2998 * information is retrieved from the list of uninstalled
Nicolas Prevot9a80e532015-09-23 15:49:28 +01002999 * applications (which includes installed applications as well as
3000 * applications with data directory i.e. applications which had been
3001 * deleted with {@code DONT_DELETE_DATA} flag set).
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003002 * @throws NameNotFoundException if a package with the given name cannot be
3003 * found on the system.
Svet Ganov67882122016-12-11 16:36:34 -08003004 * @hide
Nicolas Prevot9a80e532015-09-23 15:49:28 +01003005 */
3006 @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS)
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003007 public abstract PackageInfo getPackageInfoAsUser(String packageName,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003008 @PackageInfoFlags int flags, @UserIdInt int userId) throws NameNotFoundException;
Nicolas Prevot9a80e532015-09-23 15:49:28 +01003009
3010 /**
Dianne Hackborn47096932010-02-11 15:57:09 -08003011 * Map from the current package names in use on the device to whatever
3012 * the current canonical name of that package is.
3013 * @param names Array of current names to be mapped.
3014 * @return Returns an array of the same size as the original, containing
3015 * the canonical name for each package.
3016 */
3017 public abstract String[] currentToCanonicalPackageNames(String[] names);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003018
Dianne Hackborn47096932010-02-11 15:57:09 -08003019 /**
3020 * Map from a packages canonical name to the current name in use on the device.
3021 * @param names Array of new names to be mapped.
3022 * @return Returns an array of the same size as the original, containing
3023 * the current name for each package.
3024 */
3025 public abstract String[] canonicalToCurrentPackageNames(String[] names);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003026
Dianne Hackborn47096932010-02-11 15:57:09 -08003027 /**
Andrew Solovay5ae13352014-06-06 12:23:09 -07003028 * Returns a "good" intent to launch a front-door activity in a package.
3029 * This is used, for example, to implement an "open" button when browsing
3030 * through packages. The current implementation looks first for a main
3031 * activity in the category {@link Intent#CATEGORY_INFO}, and next for a
3032 * main activity in the category {@link Intent#CATEGORY_LAUNCHER}. Returns
3033 * <code>null</code> if neither are found.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003034 *
3035 * @param packageName The name of the package to inspect.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003036 *
Andrew Solovay5ae13352014-06-06 12:23:09 -07003037 * @return A fully-qualified {@link Intent} that can be used to launch the
3038 * main activity in the package. Returns <code>null</code> if the package
3039 * does not contain such an activity, or if <em>packageName</em> is not
Ihab Awad1ec68882014-09-12 11:09:01 -07003040 * recognized.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003041 */
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06003042 public abstract @Nullable Intent getLaunchIntentForPackage(@NonNull String packageName);
Mihai Predaeae850c2009-05-13 10:13:48 +02003043
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003044 /**
Jose Lima970417c2014-04-10 10:42:19 -07003045 * Return a "good" intent to launch a front-door Leanback activity in a
3046 * package, for use for example to implement an "open" button when browsing
3047 * through packages. The current implementation will look for a main
3048 * activity in the category {@link Intent#CATEGORY_LEANBACK_LAUNCHER}, or
3049 * return null if no main leanback activities are found.
Adam Connors551c0782014-06-05 12:13:03 +01003050 *
Jose Lima970417c2014-04-10 10:42:19 -07003051 * @param packageName The name of the package to inspect.
3052 * @return Returns either a fully-qualified Intent that can be used to launch
3053 * the main Leanback activity in the package, or null if the package
3054 * does not contain such an activity.
3055 */
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06003056 public abstract @Nullable Intent getLeanbackLaunchIntentForPackage(@NonNull String packageName);
Jose Lima970417c2014-04-10 10:42:19 -07003057
3058 /**
Roberto Perez7ee1a7a2017-12-04 17:14:33 -08003059 * Return a "good" intent to launch a front-door Car activity in a
3060 * package, for use for example to implement an "open" button when browsing
3061 * through packages. The current implementation will look for a main
3062 * activity in the category {@link Intent#CATEGORY_CAR_LAUNCHER}, or
3063 * return null if no main car activities are found.
3064 *
3065 * @param packageName The name of the package to inspect.
3066 * @return Returns either a fully-qualified Intent that can be used to launch
3067 * the main Car activity in the package, or null if the package
3068 * does not contain such an activity.
3069 * @hide
3070 */
3071 public abstract @Nullable Intent getCarLaunchIntentForPackage(@NonNull String packageName);
3072
3073 /**
Jeff Sharkeycf3f0a12016-03-17 19:57:58 -06003074 * Return an array of all of the POSIX secondary group IDs that have been
3075 * assigned to the given package.
3076 * <p>
3077 * Note that the same package may have different GIDs under different
3078 * {@link UserHandle} on the same device.
Adam Connors551c0782014-06-05 12:13:03 +01003079 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003080 * @param packageName The full name (i.e. com.google.apps.contacts) of the
Jeff Sharkeycf3f0a12016-03-17 19:57:58 -06003081 * desired package.
3082 * @return Returns an int array of the assigned GIDs, or null if there are
Jose Lima970417c2014-04-10 10:42:19 -07003083 * none.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003084 * @throws NameNotFoundException if a package with the given name cannot be
3085 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003086 */
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06003087 public abstract int[] getPackageGids(@NonNull String packageName)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003088 throws NameNotFoundException;
3089
3090 /**
Jeff Sharkeycf3f0a12016-03-17 19:57:58 -06003091 * Return an array of all of the POSIX secondary group IDs that have been
3092 * assigned to the given package.
3093 * <p>
3094 * Note that the same package may have different GIDs under different
3095 * {@link UserHandle} on the same device.
Dianne Hackborna06de0f2012-12-11 16:34:47 -08003096 *
3097 * @param packageName The full name (i.e. com.google.apps.contacts) of the
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003098 * desired package.
3099 * @return Returns an int array of the assigned gids, or null if there are
3100 * none.
3101 * @throws NameNotFoundException if a package with the given name cannot be
3102 * found on the system.
Dianne Hackborna06de0f2012-12-11 16:34:47 -08003103 */
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003104 public abstract int[] getPackageGids(String packageName, @PackageInfoFlags int flags)
Dianne Hackborna06de0f2012-12-11 16:34:47 -08003105 throws NameNotFoundException;
3106
3107 /**
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003108 * Return the UID associated with the given package name.
Jeff Sharkeycf3f0a12016-03-17 19:57:58 -06003109 * <p>
3110 * Note that the same package will have different UIDs under different
3111 * {@link UserHandle} on the same device.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003112 *
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003113 * @param packageName The full name (i.e. com.google.apps.contacts) of the
3114 * desired package.
3115 * @return Returns an integer UID who owns the given package name.
3116 * @throws NameNotFoundException if a package with the given name can not be
3117 * found on the system.
3118 */
3119 public abstract int getPackageUid(String packageName, @PackageInfoFlags int flags)
3120 throws NameNotFoundException;
3121
3122 /**
3123 * Return the UID associated with the given package name.
Jeff Sharkeycf3f0a12016-03-17 19:57:58 -06003124 * <p>
3125 * Note that the same package will have different UIDs under different
3126 * {@link UserHandle} on the same device.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003127 *
3128 * @param packageName The full name (i.e. com.google.apps.contacts) of the
3129 * desired package.
3130 * @param userId The user handle identifier to look up the package under.
3131 * @return Returns an integer UID who owns the given package name.
3132 * @throws NameNotFoundException if a package with the given name can not be
3133 * found on the system.
3134 * @hide
3135 */
3136 public abstract int getPackageUidAsUser(String packageName, @UserIdInt int userId)
3137 throws NameNotFoundException;
3138
3139 /**
3140 * Return the UID associated with the given package name.
Jeff Sharkeycf3f0a12016-03-17 19:57:58 -06003141 * <p>
3142 * Note that the same package will have different UIDs under different
3143 * {@link UserHandle} on the same device.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003144 *
3145 * @param packageName The full name (i.e. com.google.apps.contacts) of the
3146 * desired package.
3147 * @param userId The user handle identifier to look up the package under.
3148 * @return Returns an integer UID who owns the given package name.
3149 * @throws NameNotFoundException if a package with the given name can not be
3150 * found on the system.
3151 * @hide
3152 */
3153 public abstract int getPackageUidAsUser(String packageName, @PackageInfoFlags int flags,
3154 @UserIdInt int userId) throws NameNotFoundException;
3155
3156 /**
3157 * Retrieve all of the information we know about a particular permission.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003158 *
3159 * @param name The fully qualified name (i.e. com.google.permission.LOGIN)
Jeff Sharkey4347f812017-04-21 12:08:39 -06003160 * of the permission you are interested in.
3161 * @param flags Additional option flags to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003162 * @return Returns a {@link PermissionInfo} containing information about the
3163 * permission.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003164 * @throws NameNotFoundException if a package with the given name cannot be
3165 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003166 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003167 public abstract PermissionInfo getPermissionInfo(String name, @PermissionInfoFlags int flags)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003168 throws NameNotFoundException;
3169
3170 /**
3171 * Query for all of the permissions associated with a particular group.
3172 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003173 * @param group The fully qualified name (i.e. com.google.permission.LOGIN)
Jeff Sharkey4347f812017-04-21 12:08:39 -06003174 * of the permission group you are interested in. Use null to
3175 * find all of the permissions not associated with a group.
3176 * @param flags Additional option flags to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003177 * @return Returns a list of {@link PermissionInfo} containing information
Jeff Sharkey4347f812017-04-21 12:08:39 -06003178 * about all of the permissions in the given group.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003179 * @throws NameNotFoundException if a package with the given name cannot be
3180 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003181 */
3182 public abstract List<PermissionInfo> queryPermissionsByGroup(String group,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003183 @PermissionInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003184
3185 /**
Paul Navin7b89a7b2017-01-26 23:56:08 +00003186 * Returns true if Permission Review Mode is enabled, false otherwise.
3187 *
3188 * @hide
3189 */
3190 @TestApi
3191 public abstract boolean isPermissionReviewModeEnabled();
3192
3193 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003194 * Retrieve all of the information we know about a particular group of
3195 * permissions.
3196 *
Jeff Sharkey4347f812017-04-21 12:08:39 -06003197 * @param name The fully qualified name (i.e.
3198 * com.google.permission_group.APPS) of the permission you are
3199 * 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 PermissionGroupInfo} containing information
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003202 * about the 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 */
3206 public abstract PermissionGroupInfo getPermissionGroupInfo(String name,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003207 @PermissionGroupInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003208
3209 /**
3210 * Retrieve all of the known permission groups in the system.
3211 *
Jeff Sharkey4347f812017-04-21 12:08:39 -06003212 * @param flags Additional option flags to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003213 * @return Returns a list of {@link PermissionGroupInfo} containing
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003214 * information about all of the known permission groups.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003215 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003216 public abstract List<PermissionGroupInfo> getAllPermissionGroups(
3217 @PermissionGroupInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003218
3219 /**
3220 * Retrieve all of the information we know about a particular
3221 * package/application.
3222 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003223 * @param packageName The full name (i.e. com.google.apps.contacts) of an
Jeff Sharkey4347f812017-04-21 12:08:39 -06003224 * application.
3225 * @param flags Additional option flags to modify the data returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003226 * @return An {@link ApplicationInfo} containing information about the
Jeff Sharkey4347f812017-04-21 12:08:39 -06003227 * package. If flag {@code MATCH_UNINSTALLED_PACKAGES} is set and if
3228 * the package is not found in the list of installed applications,
3229 * the application information is retrieved from the list of
3230 * uninstalled applications (which includes installed applications
3231 * as well as applications with data directory i.e. applications
3232 * which had been deleted with {@code DONT_DELETE_DATA} flag set).
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003233 * @throws NameNotFoundException if a package with the given name cannot be
3234 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003235 */
3236 public abstract ApplicationInfo getApplicationInfo(String packageName,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003237 @ApplicationInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003238
Jeff Sharkeycd654482016-01-08 17:42:11 -07003239 /** {@hide} */
3240 public abstract ApplicationInfo getApplicationInfoAsUser(String packageName,
3241 @ApplicationInfoFlags int flags, @UserIdInt int userId) throws NameNotFoundException;
3242
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003243 /**
3244 * Retrieve all of the information we know about a particular activity
3245 * class.
3246 *
Dianne Hackborn361199b2010-08-30 17:42:07 -07003247 * @param component The full component name (i.e.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003248 * com.google.apps.contacts/com.google.apps.contacts.
3249 * ContactsList) of an Activity class.
Jeff Sharkey4347f812017-04-21 12:08:39 -06003250 * @param flags Additional option flags to modify the data returned.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003251 * @return An {@link ActivityInfo} containing information about the
3252 * activity.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003253 * @throws NameNotFoundException if a package with the given name cannot be
3254 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003255 */
Dianne Hackborn361199b2010-08-30 17:42:07 -07003256 public abstract ActivityInfo getActivityInfo(ComponentName component,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003257 @ComponentInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003258
3259 /**
3260 * Retrieve all of the information we know about a particular receiver
3261 * class.
3262 *
Dianne Hackborn361199b2010-08-30 17:42:07 -07003263 * @param component The full component name (i.e.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003264 * com.google.apps.calendar/com.google.apps.calendar.
3265 * CalendarAlarm) of a Receiver class.
Jeff Sharkey4347f812017-04-21 12:08:39 -06003266 * @param flags Additional option flags to modify the data returned.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003267 * @return An {@link ActivityInfo} containing information about the
3268 * receiver.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003269 * @throws NameNotFoundException if a package with the given name cannot be
3270 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003271 */
Dianne Hackborn361199b2010-08-30 17:42:07 -07003272 public abstract ActivityInfo getReceiverInfo(ComponentName component,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003273 @ComponentInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003274
3275 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003276 * Retrieve all of the information we know about a particular service class.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003277 *
Dianne Hackborn361199b2010-08-30 17:42:07 -07003278 * @param component The full component name (i.e.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003279 * com.google.apps.media/com.google.apps.media.
3280 * BackgroundPlayback) of a Service class.
Jeff Sharkey4347f812017-04-21 12:08:39 -06003281 * @param flags Additional option flags to modify the data returned.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003282 * @return A {@link ServiceInfo} object containing information about the
3283 * service.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003284 * @throws NameNotFoundException if a package with the given name cannot be
3285 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003286 */
Dianne Hackborn361199b2010-08-30 17:42:07 -07003287 public abstract ServiceInfo getServiceInfo(ComponentName component,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003288 @ComponentInfoFlags int flags) throws NameNotFoundException;
Dianne Hackborn361199b2010-08-30 17:42:07 -07003289
3290 /**
3291 * Retrieve all of the information we know about a particular content
3292 * provider class.
3293 *
Dianne Hackborn361199b2010-08-30 17:42:07 -07003294 * @param component The full component name (i.e.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003295 * com.google.providers.media/com.google.providers.media.
3296 * MediaProvider) of a ContentProvider class.
Jeff Sharkey4347f812017-04-21 12:08:39 -06003297 * @param flags Additional option flags to modify the data returned.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003298 * @return A {@link ProviderInfo} object containing information about the
3299 * provider.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003300 * @throws NameNotFoundException if a package with the given name cannot be
3301 * found on the system.
Dianne Hackborn361199b2010-08-30 17:42:07 -07003302 */
3303 public abstract ProviderInfo getProviderInfo(ComponentName component,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003304 @ComponentInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003305
3306 /**
Jeff Sharkey4347f812017-04-21 12:08:39 -06003307 * Return a List of all packages that are installed on the device.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003308 *
Jeff Sharkey4347f812017-04-21 12:08:39 -06003309 * @param flags Additional option flags to modify the data returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003310 * @return A List of PackageInfo objects, one for each installed package,
Jeff Sharkey4347f812017-04-21 12:08:39 -06003311 * containing information about the package. In the unlikely case
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003312 * there are no installed packages, an empty list is returned. If
3313 * flag {@code MATCH_UNINSTALLED_PACKAGES} is set, the package
3314 * information is retrieved from the list of uninstalled
3315 * applications (which includes installed applications as well as
3316 * applications with data directory i.e. applications which had been
3317 * deleted with {@code DONT_DELETE_DATA} flag set).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003318 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003319 public abstract List<PackageInfo> getInstalledPackages(@PackageInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003320
3321 /**
Jeff Sharkey4347f812017-04-21 12:08:39 -06003322 * Return a List of all installed packages that are currently holding any of
3323 * the given permissions.
Dianne Hackborne7991752013-01-16 17:56:46 -08003324 *
Jeff Sharkey4347f812017-04-21 12:08:39 -06003325 * @param flags Additional option flags to modify the data returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003326 * @return A List of PackageInfo objects, one for each installed package
3327 * that holds any of the permissions that were provided, containing
3328 * information about the package. If no installed packages hold any
3329 * of the permissions, an empty list is returned. If flag
Jeff Sharkey4347f812017-04-21 12:08:39 -06003330 * {@code MATCH_UNINSTALLED_PACKAGES} is set, the package
3331 * information is retrieved from the list of uninstalled
3332 * applications (which includes installed applications as well as
3333 * applications with data directory i.e. applications which had been
3334 * deleted with {@code DONT_DELETE_DATA} flag set).
Dianne Hackborne7991752013-01-16 17:56:46 -08003335 */
3336 public abstract List<PackageInfo> getPackagesHoldingPermissions(
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003337 String[] permissions, @PackageInfoFlags int flags);
Dianne Hackborne7991752013-01-16 17:56:46 -08003338
3339 /**
Jeff Sharkey4347f812017-04-21 12:08:39 -06003340 * Return a List of all packages that are installed on the device, for a
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06003341 * specific user.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003342 *
Jeff Sharkey4347f812017-04-21 12:08:39 -06003343 * @param flags Additional option flags to modify the data returned.
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003344 * @param userId The user for whom the installed packages are to be listed
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003345 * @return A List of PackageInfo objects, one for each installed package,
Jeff Sharkey4347f812017-04-21 12:08:39 -06003346 * containing information about the package. In the unlikely case
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003347 * there are no installed packages, an empty list is returned. If
3348 * flag {@code MATCH_UNINSTALLED_PACKAGES} is set, the package
3349 * information is retrieved from the list of uninstalled
3350 * applications (which includes installed applications as well as
3351 * applications with data directory i.e. applications which had been
3352 * deleted with {@code DONT_DELETE_DATA} flag set).
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003353 * @hide
3354 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08003355 @SystemApi
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06003356 @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS_FULL)
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07003357 public abstract List<PackageInfo> getInstalledPackagesAsUser(@PackageInfoFlags int flags,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003358 @UserIdInt int userId);
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003359
3360 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003361 * Check whether a particular package has been granted a particular
3362 * permission.
3363 *
Svet Ganovad3b2972015-07-07 22:49:17 -07003364 * @param permName The name of the permission you are checking for.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003365 * @param pkgName The name of the package you are checking against.
3366 *
3367 * @return If the package has the permission, PERMISSION_GRANTED is
3368 * returned. If it does not have the permission, PERMISSION_DENIED
3369 * is returned.
3370 *
3371 * @see #PERMISSION_GRANTED
3372 * @see #PERMISSION_DENIED
3373 */
Tor Norbye1c2bf032015-03-02 10:57:08 -08003374 @CheckResult
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06003375 public abstract @PermissionResult int checkPermission(String permName, String pkgName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003376
3377 /**
Svet Ganovad3b2972015-07-07 22:49:17 -07003378 * Checks whether a particular permissions has been revoked for a
3379 * package by policy. Typically the device owner or the profile owner
3380 * may apply such a policy. The user cannot grant policy revoked
3381 * permissions, hence the only way for an app to get such a permission
3382 * is by a policy change.
3383 *
3384 * @param permName The name of the permission you are checking for.
3385 * @param pkgName The name of the package you are checking against.
3386 *
3387 * @return Whether the permission is restricted by policy.
3388 */
3389 @CheckResult
Svet Ganovf1b7f202015-07-29 08:33:42 -07003390 public abstract boolean isPermissionRevokedByPolicy(@NonNull String permName,
3391 @NonNull String pkgName);
3392
3393 /**
3394 * Gets the package name of the component controlling runtime permissions.
3395 *
3396 * @return The package name.
3397 *
3398 * @hide
3399 */
Philip P. Moltmanneb0a0ae2017-06-30 10:55:51 -07003400 @TestApi
Svet Ganovf1b7f202015-07-29 08:33:42 -07003401 public abstract String getPermissionControllerPackageName();
Svet Ganovad3b2972015-07-07 22:49:17 -07003402
3403 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003404 * Add a new dynamic permission to the system. For this to work, your
3405 * package must have defined a permission tree through the
3406 * {@link android.R.styleable#AndroidManifestPermissionTree
3407 * &lt;permission-tree&gt;} tag in its manifest. A package can only add
3408 * permissions to trees that were defined by either its own package or
3409 * another with the same user id; a permission is in a tree if it
3410 * matches the name of the permission tree + ".": for example,
3411 * "com.foo.bar" is a member of the permission tree "com.foo".
3412 *
3413 * <p>It is good to make your permission tree name descriptive, because you
3414 * are taking possession of that entire set of permission names. Thus, it
3415 * must be under a domain you control, with a suffix that will not match
3416 * any normal permissions that may be declared in any applications that
3417 * are part of that domain.
3418 *
3419 * <p>New permissions must be added before
3420 * any .apks are installed that use those permissions. Permissions you
3421 * add through this method are remembered across reboots of the device.
3422 * If the given permission already exists, the info you supply here
3423 * will be used to update it.
3424 *
3425 * @param info Description of the permission to be added.
3426 *
3427 * @return Returns true if a new permission was created, false if an
3428 * existing one was updated.
3429 *
3430 * @throws SecurityException if you are not allowed to add the
3431 * given permission name.
3432 *
3433 * @see #removePermission(String)
3434 */
3435 public abstract boolean addPermission(PermissionInfo info);
3436
3437 /**
Dianne Hackbornd7c09682010-03-30 10:42:20 -07003438 * Like {@link #addPermission(PermissionInfo)} but asynchronously
3439 * persists the package manager state after returning from the call,
3440 * allowing it to return quicker and batch a series of adds at the
3441 * expense of no guarantee the added permission will be retained if
3442 * the device is rebooted before it is written.
3443 */
3444 public abstract boolean addPermissionAsync(PermissionInfo info);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003445
Dianne Hackbornd7c09682010-03-30 10:42:20 -07003446 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003447 * Removes a permission that was previously added with
3448 * {@link #addPermission(PermissionInfo)}. The same ownership rules apply
3449 * -- you are only allowed to remove permissions that you are allowed
3450 * to add.
3451 *
3452 * @param name The name of the permission to remove.
3453 *
3454 * @throws SecurityException if you are not allowed to remove the
3455 * given permission name.
3456 *
3457 * @see #addPermission(PermissionInfo)
3458 */
3459 public abstract void removePermission(String name);
3460
Svet Ganov8c7f7002015-05-07 10:48:44 -07003461 /**
3462 * Permission flags set when granting or revoking a permission.
3463 *
3464 * @hide
3465 */
3466 @SystemApi
Jeff Sharkey4347f812017-04-21 12:08:39 -06003467 @IntDef(prefix = { "FLAG_PERMISSION_" }, value = {
3468 FLAG_PERMISSION_USER_SET,
Svet Ganov8c7f7002015-05-07 10:48:44 -07003469 FLAG_PERMISSION_USER_FIXED,
3470 FLAG_PERMISSION_POLICY_FIXED,
Svet Ganovb3f22b42015-05-12 11:01:24 -07003471 FLAG_PERMISSION_REVOKE_ON_UPGRADE,
Svet Ganov77ab6a82015-07-03 12:03:02 -07003472 FLAG_PERMISSION_SYSTEM_FIXED,
Jeff Sharkey4347f812017-04-21 12:08:39 -06003473 FLAG_PERMISSION_GRANTED_BY_DEFAULT
3474 })
Svet Ganov8c7f7002015-05-07 10:48:44 -07003475 @Retention(RetentionPolicy.SOURCE)
3476 public @interface PermissionFlags {}
3477
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003478 /**
Svetoslavc6d1c342015-02-26 14:44:43 -08003479 * Grant a runtime permission to an application which the application does not
3480 * already have. The permission must have been requested by the application.
3481 * If the application is not allowed to hold the permission, a {@link
Ruben Brunk12ab5e12016-11-10 15:27:30 -08003482 * java.lang.SecurityException} is thrown. If the package or permission is
3483 * invalid, a {@link java.lang.IllegalArgumentException} is thrown.
Svetoslavc6d1c342015-02-26 14:44:43 -08003484 * <p>
3485 * <strong>Note: </strong>Using this API requires holding
Todd Kennedya8eb6a82016-07-28 16:35:42 -07003486 * android.permission.GRANT_RUNTIME_PERMISSIONS and if the user id is
Svetoslavc6d1c342015-02-26 14:44:43 -08003487 * not the current user android.permission.INTERACT_ACROSS_USERS_FULL.
3488 * </p>
Nick Kralevich035f80d2013-03-27 15:20:08 -07003489 *
Svetoslavc6d1c342015-02-26 14:44:43 -08003490 * @param packageName The package to which to grant the permission.
3491 * @param permissionName The permission name to grant.
3492 * @param user The user for which to grant the permission.
3493 *
Svet Ganov8c7f7002015-05-07 10:48:44 -07003494 * @see #revokeRuntimePermission(String, String, android.os.UserHandle)
Svetoslavc6d1c342015-02-26 14:44:43 -08003495 *
3496 * @hide
Nick Kralevich035f80d2013-03-27 15:20:08 -07003497 */
Svetoslavc6d1c342015-02-26 14:44:43 -08003498 @SystemApi
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06003499 @RequiresPermission(android.Manifest.permission.GRANT_RUNTIME_PERMISSIONS)
Svet Ganov8c7f7002015-05-07 10:48:44 -07003500 public abstract void grantRuntimePermission(@NonNull String packageName,
Svetoslavc6d1c342015-02-26 14:44:43 -08003501 @NonNull String permissionName, @NonNull UserHandle user);
Nick Kralevich035f80d2013-03-27 15:20:08 -07003502
Svetoslavc6d1c342015-02-26 14:44:43 -08003503 /**
3504 * Revoke a runtime permission that was previously granted by {@link
Svet Ganov8c7f7002015-05-07 10:48:44 -07003505 * #grantRuntimePermission(String, String, android.os.UserHandle)}. The
3506 * permission must have been requested by and granted to the application.
3507 * If the application is not allowed to hold the permission, a {@link
Ruben Brunk12ab5e12016-11-10 15:27:30 -08003508 * java.lang.SecurityException} is thrown. If the package or permission is
3509 * invalid, a {@link java.lang.IllegalArgumentException} is thrown.
Svetoslavc6d1c342015-02-26 14:44:43 -08003510 * <p>
3511 * <strong>Note: </strong>Using this API requires holding
Todd Kennedya8eb6a82016-07-28 16:35:42 -07003512 * android.permission.REVOKE_RUNTIME_PERMISSIONS and if the user id is
Svetoslavc6d1c342015-02-26 14:44:43 -08003513 * not the current user android.permission.INTERACT_ACROSS_USERS_FULL.
3514 * </p>
3515 *
3516 * @param packageName The package from which to revoke the permission.
3517 * @param permissionName The permission name to revoke.
3518 * @param user The user for which to revoke the permission.
3519 *
Svet Ganov8c7f7002015-05-07 10:48:44 -07003520 * @see #grantRuntimePermission(String, String, android.os.UserHandle)
Svetoslavc6d1c342015-02-26 14:44:43 -08003521 *
3522 * @hide
3523 */
3524 @SystemApi
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06003525 @RequiresPermission(android.Manifest.permission.REVOKE_RUNTIME_PERMISSIONS)
Svet Ganov8c7f7002015-05-07 10:48:44 -07003526 public abstract void revokeRuntimePermission(@NonNull String packageName,
Svetoslavc6d1c342015-02-26 14:44:43 -08003527 @NonNull String permissionName, @NonNull UserHandle user);
3528
3529 /**
Svet Ganov8c7f7002015-05-07 10:48:44 -07003530 * Gets the state flags associated with a permission.
3531 *
3532 * @param permissionName The permission for which to get the flags.
3533 * @param packageName The package name for which to get the flags.
3534 * @param user The user for which to get permission flags.
3535 * @return The permission flags.
3536 *
3537 * @hide
3538 */
3539 @SystemApi
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06003540 @RequiresPermission(anyOf = {
3541 android.Manifest.permission.GRANT_RUNTIME_PERMISSIONS,
3542 android.Manifest.permission.REVOKE_RUNTIME_PERMISSIONS
3543 })
Svet Ganov8c7f7002015-05-07 10:48:44 -07003544 public abstract @PermissionFlags int getPermissionFlags(String permissionName,
3545 String packageName, @NonNull UserHandle user);
3546
3547 /**
3548 * Updates the flags associated with a permission by replacing the flags in
3549 * the specified mask with the provided flag values.
3550 *
3551 * @param permissionName The permission for which to update the flags.
3552 * @param packageName The package name for which to update the flags.
3553 * @param flagMask The flags which to replace.
3554 * @param flagValues The flags with which to replace.
3555 * @param user The user for which to update the permission flags.
3556 *
3557 * @hide
3558 */
3559 @SystemApi
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06003560 @RequiresPermission(anyOf = {
3561 android.Manifest.permission.GRANT_RUNTIME_PERMISSIONS,
3562 android.Manifest.permission.REVOKE_RUNTIME_PERMISSIONS
3563 })
Svet Ganov8c7f7002015-05-07 10:48:44 -07003564 public abstract void updatePermissionFlags(String permissionName,
Jeff Sharkey4347f812017-04-21 12:08:39 -06003565 String packageName, @PermissionFlags int flagMask, @PermissionFlags int flagValues,
Svet Ganov8c7f7002015-05-07 10:48:44 -07003566 @NonNull UserHandle user);
3567
3568 /**
Svetoslav20770dd2015-05-29 15:43:04 -07003569 * Gets whether you should show UI with rationale for requesting a permission.
3570 * You should do this only if you do not have the permission and the context in
3571 * which the permission is requested does not clearly communicate to the user
3572 * what would be the benefit from grating this permission.
3573 *
3574 * @param permission A permission your app wants to request.
3575 * @return Whether you can show permission rationale UI.
3576 *
3577 * @hide
3578 */
3579 public abstract boolean shouldShowRequestPermissionRationale(String permission);
3580
3581 /**
Svetoslavc6d1c342015-02-26 14:44:43 -08003582 * Returns an {@link android.content.Intent} suitable for passing to
3583 * {@link android.app.Activity#startActivityForResult(android.content.Intent, int)}
3584 * which prompts the user to grant permissions to this application.
3585 *
3586 * @throws NullPointerException if {@code permissions} is {@code null} or empty.
3587 *
3588 * @hide
3589 */
3590 public Intent buildRequestPermissionsIntent(@NonNull String[] permissions) {
3591 if (ArrayUtils.isEmpty(permissions)) {
Svet Ganovf66381c2016-02-18 20:02:36 -08003592 throw new IllegalArgumentException("permission cannot be null or empty");
Svetoslavc6d1c342015-02-26 14:44:43 -08003593 }
3594 Intent intent = new Intent(ACTION_REQUEST_PERMISSIONS);
3595 intent.putExtra(EXTRA_REQUEST_PERMISSIONS_NAMES, permissions);
Svet Ganovf1b7f202015-07-29 08:33:42 -07003596 intent.setPackage(getPermissionControllerPackageName());
Svetoslavc6d1c342015-02-26 14:44:43 -08003597 return intent;
Nick Kralevich035f80d2013-03-27 15:20:08 -07003598 }
3599
3600 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003601 * Compare the signatures of two packages to determine if the same
3602 * signature appears in both of them. If they do contain the same
3603 * signature, then they are allowed special privileges when working
3604 * with each other: they can share the same user-id, run instrumentation
3605 * against each other, etc.
3606 *
3607 * @param pkg1 First package name whose signature will be compared.
3608 * @param pkg2 Second package name whose signature will be compared.
Chris Palmer09f33602010-09-13 14:27:18 -07003609 *
3610 * @return Returns an integer indicating whether all signatures on the
3611 * two packages match. The value is >= 0 ({@link #SIGNATURE_MATCH}) if
3612 * all signatures match or < 0 if there is not a match ({@link
3613 * #SIGNATURE_NO_MATCH} or {@link #SIGNATURE_UNKNOWN_PACKAGE}).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003614 *
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07003615 * @see #checkSignatures(int, int)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003616 */
Tor Norbye1c2bf032015-03-02 10:57:08 -08003617 @CheckResult
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06003618 public abstract @SignatureResult int checkSignatures(String pkg1, String pkg2);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003619
3620 /**
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07003621 * Like {@link #checkSignatures(String, String)}, but takes UIDs of
3622 * the two packages to be checked. This can be useful, for example,
3623 * when doing the check in an IPC, where the UID is the only identity
3624 * available. It is functionally identical to determining the package
3625 * associated with the UIDs and checking their signatures.
3626 *
Joe Onorato25660ec2009-08-12 22:40:37 -07003627 * @param uid1 First UID whose signature will be compared.
3628 * @param uid2 Second UID whose signature will be compared.
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07003629 *
Chris Palmer09f33602010-09-13 14:27:18 -07003630 * @return Returns an integer indicating whether all signatures on the
3631 * two packages match. The value is >= 0 ({@link #SIGNATURE_MATCH}) if
3632 * all signatures match or < 0 if there is not a match ({@link
3633 * #SIGNATURE_NO_MATCH} or {@link #SIGNATURE_UNKNOWN_PACKAGE}).
3634 *
3635 * @see #checkSignatures(String, String)
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07003636 */
Tor Norbye1c2bf032015-03-02 10:57:08 -08003637 @CheckResult
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06003638 public abstract @SignatureResult int checkSignatures(int uid1, int uid2);
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07003639
3640 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003641 * Retrieve the names of all packages that are associated with a particular
3642 * user id. In most cases, this will be a single package name, the package
3643 * that has been assigned that user id. Where there are multiple packages
3644 * sharing the same user id through the "sharedUserId" mechanism, all
3645 * packages with that id will be returned.
3646 *
3647 * @param uid The user id for which you would like to retrieve the
3648 * associated packages.
3649 *
3650 * @return Returns an array of one or more packages assigned to the user
3651 * id, or null if there are no known packages with the given id.
3652 */
Jeff Sharkey377ded0f2016-01-10 13:15:41 -07003653 public abstract @Nullable String[] getPackagesForUid(int uid);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003654
3655 /**
Michal Karpinskicb67dc92016-12-13 18:20:23 +00003656 * Retrieve the official name associated with a uid. This name is
Jonathan Basseri7ea3a332015-05-12 19:39:22 -07003657 * guaranteed to never change, though it is possible for the underlying
Michal Karpinskicb67dc92016-12-13 18:20:23 +00003658 * uid to be changed. That is, if you are storing information about
3659 * uids in persistent storage, you should use the string returned
3660 * by this function instead of the raw uid.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003661 *
Michal Karpinskicb67dc92016-12-13 18:20:23 +00003662 * @param uid The uid for which you would like to retrieve a name.
3663 * @return Returns a unique name for the given uid, or null if the
3664 * uid is not currently assigned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003665 */
Jeff Sharkey377ded0f2016-01-10 13:15:41 -07003666 public abstract @Nullable String getNameForUid(int uid);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003667
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003668 /**
Todd Kennedy9da8b8a72017-07-25 15:38:39 -07003669 * Retrieves the official names associated with each given uid.
3670 * @see #getNameForUid(int)
3671 *
3672 * @hide
3673 */
3674 public abstract @Nullable String[] getNamesForUids(int[] uids);
3675
3676 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003677 * Return the user id associated with a shared user name. Multiple
3678 * applications can specify a shared user name in their manifest and thus
3679 * end up using a common uid. This might be used for new applications
3680 * that use an existing shared user name and need to know the uid of the
3681 * shared user.
3682 *
3683 * @param sharedUserName The shared user name whose uid is to be retrieved.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003684 * @return Returns the UID associated with the shared user.
3685 * @throws NameNotFoundException if a package with the given name cannot be
3686 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003687 * @hide
3688 */
3689 public abstract int getUidForSharedUser(String sharedUserName)
3690 throws NameNotFoundException;
3691
3692 /**
3693 * Return a List of all application packages that are installed on the
3694 * device. If flag GET_UNINSTALLED_PACKAGES has been set, a list of all
Jeff Sharkey4347f812017-04-21 12:08:39 -06003695 * applications including those deleted with {@code DONT_DELETE_DATA}
3696 * (partially installed apps with data directory) will be returned.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003697 *
Jeff Sharkey4347f812017-04-21 12:08:39 -06003698 * @param flags Additional option flags to modify the data returned.
3699 * @return A List of ApplicationInfo objects, one for each installed
3700 * application. In the unlikely case there are no installed
3701 * packages, an empty list is returned. If flag
3702 * {@code MATCH_UNINSTALLED_PACKAGES} is set, the application
3703 * information is retrieved from the list of uninstalled
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003704 * applications (which includes installed applications as well as
3705 * applications with data directory i.e. applications which had been
3706 * deleted with {@code DONT_DELETE_DATA} flag set).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003707 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003708 public abstract List<ApplicationInfo> getInstalledApplications(@ApplicationInfoFlags int flags);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003709
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003710 /**
Jeff Sharkey4347f812017-04-21 12:08:39 -06003711 * Return a List of all application packages that are installed on the
3712 * device, for a specific user. If flag GET_UNINSTALLED_PACKAGES has been
3713 * set, a list of all applications including those deleted with
3714 * {@code DONT_DELETE_DATA} (partially installed apps with data directory)
Bartosz Fabianowski11334242016-11-17 20:49:16 +01003715 * will be returned.
3716 *
Jeff Sharkey4347f812017-04-21 12:08:39 -06003717 * @param flags Additional option flags to modify the data returned.
3718 * @param userId The user for whom the installed applications are to be
3719 * listed
3720 * @return A List of ApplicationInfo objects, one for each installed
3721 * application. In the unlikely case there are no installed
3722 * packages, an empty list is returned. If flag
3723 * {@code MATCH_UNINSTALLED_PACKAGES} is set, the application
3724 * information is retrieved from the list of uninstalled
Bartosz Fabianowski11334242016-11-17 20:49:16 +01003725 * applications (which includes installed applications as well as
3726 * applications with data directory i.e. applications which had been
3727 * deleted with {@code DONT_DELETE_DATA} flag set).
3728 * @hide
Bartosz Fabianowski11334242016-11-17 20:49:16 +01003729 */
3730 public abstract List<ApplicationInfo> getInstalledApplicationsAsUser(
3731 @ApplicationInfoFlags int flags, @UserIdInt int userId);
3732
3733 /**
Jeff Sharkey910e0812017-04-21 16:29:27 -06003734 * Gets the instant applications the user recently used.
Svet Ganov2acf0632015-11-24 19:10:59 -08003735 *
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003736 * @return The instant app list.
Svet Ganov2acf0632015-11-24 19:10:59 -08003737 *
3738 * @hide
3739 */
Todd Kennedy9c9fdf22017-03-06 10:58:27 -08003740 @SystemApi
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003741 @RequiresPermission(Manifest.permission.ACCESS_INSTANT_APPS)
3742 public abstract @NonNull List<InstantAppInfo> getInstantApps();
Svet Ganov2acf0632015-11-24 19:10:59 -08003743
3744 /**
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003745 * Gets the icon for an instant application.
Svet Ganov2acf0632015-11-24 19:10:59 -08003746 *
3747 * @param packageName The app package name.
3748 *
3749 * @hide
3750 */
Todd Kennedy9c9fdf22017-03-06 10:58:27 -08003751 @SystemApi
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003752 @RequiresPermission(Manifest.permission.ACCESS_INSTANT_APPS)
3753 public abstract @Nullable Drawable getInstantAppIcon(String packageName);
Svet Ganov2acf0632015-11-24 19:10:59 -08003754
3755 /**
David Christie31a16552017-03-01 15:08:45 -08003756 * Gets whether this application is an instant app.
Svet Ganov2acf0632015-11-24 19:10:59 -08003757 *
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003758 * @return Whether caller is an instant app.
Svet Ganov2acf0632015-11-24 19:10:59 -08003759 *
David Christie31a16552017-03-01 15:08:45 -08003760 * @see #isInstantApp(String)
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003761 * @see #updateInstantAppCookie(byte[])
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003762 * @see #getInstantAppCookie()
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003763 * @see #getInstantAppCookieMaxBytes()
Svet Ganov2acf0632015-11-24 19:10:59 -08003764 */
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003765 public abstract boolean isInstantApp();
Svet Ganov2acf0632015-11-24 19:10:59 -08003766
3767 /**
David Christie31a16552017-03-01 15:08:45 -08003768 * Gets whether the given package is an instant app.
3769 *
3770 * @param packageName The package to check
3771 * @return Whether the given package is an instant app.
3772 *
3773 * @see #isInstantApp()
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003774 * @see #updateInstantAppCookie(byte[])
David Christie31a16552017-03-01 15:08:45 -08003775 * @see #getInstantAppCookie()
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003776 * @see #getInstantAppCookieMaxBytes()
3777 * @see #clearInstantAppCookie()
David Christie31a16552017-03-01 15:08:45 -08003778 */
3779 public abstract boolean isInstantApp(String packageName);
3780
3781 /**
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003782 * Gets the maximum size in bytes of the cookie data an instant app
Svet Ganov2acf0632015-11-24 19:10:59 -08003783 * can store on the device.
3784 *
3785 * @return The max cookie size in bytes.
3786 *
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003787 * @see #isInstantApp()
David Christie31a16552017-03-01 15:08:45 -08003788 * @see #isInstantApp(String)
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003789 * @see #updateInstantAppCookie(byte[])
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003790 * @see #getInstantAppCookie()
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003791 * @see #clearInstantAppCookie()
3792 */
3793 public abstract int getInstantAppCookieMaxBytes();
3794
3795 /**
Daniel Cashman5cdda342018-01-19 07:22:52 -08003796 * deprecated
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003797 * @hide
Svet Ganov2acf0632015-11-24 19:10:59 -08003798 */
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003799 public abstract int getInstantAppCookieMaxSize();
Svet Ganov2acf0632015-11-24 19:10:59 -08003800
3801 /**
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003802 * Gets the instant application cookie for this app. Non
3803 * instant apps and apps that were instant but were upgraded
3804 * to normal apps can still access this API. For instant apps
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003805 * this cookie is cached for some time after uninstall while for
Svet Ganov2acf0632015-11-24 19:10:59 -08003806 * normal apps the cookie is deleted after the app is uninstalled.
3807 * The cookie is always present while the app is installed.
3808 *
3809 * @return The cookie.
3810 *
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003811 * @see #isInstantApp()
David Christie31a16552017-03-01 15:08:45 -08003812 * @see #isInstantApp(String)
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003813 * @see #updateInstantAppCookie(byte[])
3814 * @see #getInstantAppCookieMaxBytes()
3815 * @see #clearInstantAppCookie()
Svet Ganov2acf0632015-11-24 19:10:59 -08003816 */
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003817 public abstract @NonNull byte[] getInstantAppCookie();
Svet Ganov2acf0632015-11-24 19:10:59 -08003818
3819 /**
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003820 * Clears the instant application cookie for the calling app.
Svet Ganov2acf0632015-11-24 19:10:59 -08003821 *
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003822 * @see #isInstantApp()
David Christie31a16552017-03-01 15:08:45 -08003823 * @see #isInstantApp(String)
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003824 * @see #getInstantAppCookieMaxBytes()
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003825 * @see #getInstantAppCookie()
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003826 * @see #clearInstantAppCookie()
3827 */
3828 public abstract void clearInstantAppCookie();
3829
3830 /**
3831 * Updates the instant application cookie for the calling app. Non
3832 * instant apps and apps that were instant but were upgraded
3833 * to normal apps can still access this API. For instant apps
3834 * this cookie is cached for some time after uninstall while for
3835 * normal apps the cookie is deleted after the app is uninstalled.
3836 * The cookie is always present while the app is installed. The
3837 * cookie size is limited by {@link #getInstantAppCookieMaxBytes()}.
3838 * Passing <code>null</code> or an empty array clears the cookie.
3839 * </p>
3840 *
3841 * @param cookie The cookie data.
3842 *
3843 * @see #isInstantApp()
3844 * @see #isInstantApp(String)
3845 * @see #getInstantAppCookieMaxBytes()
3846 * @see #getInstantAppCookie()
3847 * @see #clearInstantAppCookie()
3848 *
3849 * @throws IllegalArgumentException if the array exceeds max cookie size.
3850 */
3851 public abstract void updateInstantAppCookie(@Nullable byte[] cookie);
3852
3853 /**
3854 * @removed
Svet Ganov2acf0632015-11-24 19:10:59 -08003855 */
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003856 public abstract boolean setInstantAppCookie(@Nullable byte[] cookie);
Svet Ganov2acf0632015-11-24 19:10:59 -08003857
3858 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003859 * Get a list of shared libraries that are available on the
3860 * system.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003861 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003862 * @return An array of shared library names that are
3863 * available on the system, or null if none are installed.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003864 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003865 */
3866 public abstract String[] getSystemSharedLibraryNames();
3867
3868 /**
Svet Ganov67882122016-12-11 16:36:34 -08003869 * Get a list of shared libraries on the device.
3870 *
3871 * @param flags To filter the libraries to return.
3872 * @return The shared library list.
3873 *
Svet Ganov67882122016-12-11 16:36:34 -08003874 * @see #MATCH_UNINSTALLED_PACKAGES
3875 */
3876 public abstract @NonNull List<SharedLibraryInfo> getSharedLibraries(
3877 @InstallFlags int flags);
3878
3879 /**
3880 * Get a list of shared libraries on the device.
3881 *
3882 * @param flags To filter the libraries to return.
3883 * @param userId The user to query for.
3884 * @return The shared library list.
3885 *
3886 * @see #MATCH_FACTORY_ONLY
3887 * @see #MATCH_KNOWN_PACKAGES
3888 * @see #MATCH_ANY_USER
3889 * @see #MATCH_UNINSTALLED_PACKAGES
3890 *
3891 * @hide
3892 */
3893 public abstract @NonNull List<SharedLibraryInfo> getSharedLibrariesAsUser(
3894 @InstallFlags int flags, @UserIdInt int userId);
3895
3896 /**
Svet Ganovd7b1f4112016-02-09 18:49:23 -08003897 * Get the name of the package hosting the services shared library.
3898 *
3899 * @return The library host package.
3900 *
3901 * @hide
3902 */
Svetoslav Ganova9c25002016-04-13 19:25:56 -07003903 public abstract @NonNull String getServicesSystemSharedLibraryPackageName();
3904
3905 /**
3906 * Get the name of the package hosting the shared components shared library.
3907 *
3908 * @return The library host package.
3909 *
3910 * @hide
3911 */
3912 public abstract @NonNull String getSharedSystemSharedLibraryPackageName();
Svet Ganovd7b1f4112016-02-09 18:49:23 -08003913
3914 /**
Todd Kennedy9106c642017-02-08 14:16:53 -08003915 * Returns the names of the packages that have been changed
3916 * [eg. added, removed or updated] since the given sequence
3917 * number.
3918 * <p>If no packages have been changed, returns <code>null</code>.
3919 * <p>The sequence number starts at <code>0</code> and is
3920 * reset every boot.
Todd Kennedy8fddf9d2017-04-17 15:16:12 -07003921 * @param sequenceNumber The first sequence number for which to retrieve package changes.
3922 * @see Settings.Global#BOOT_COUNT
Todd Kennedy9106c642017-02-08 14:16:53 -08003923 */
3924 public abstract @Nullable ChangedPackages getChangedPackages(
3925 @IntRange(from=0) int sequenceNumber);
3926
3927 /**
Dianne Hackborn49237342009-08-27 20:08:01 -07003928 * Get a list of features that are available on the
3929 * system.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003930 *
Dianne Hackborn49237342009-08-27 20:08:01 -07003931 * @return An array of FeatureInfo classes describing the features
3932 * that are available on the system, or null if there are none(!!).
Dianne Hackborn49237342009-08-27 20:08:01 -07003933 */
3934 public abstract FeatureInfo[] getSystemAvailableFeatures();
3935
3936 /**
Jeff Sharkey115d2c12016-02-15 17:25:57 -07003937 * Check whether the given feature name is one of the available features as
3938 * returned by {@link #getSystemAvailableFeatures()}. This tests for the
3939 * presence of <em>any</em> version of the given feature name; use
3940 * {@link #hasSystemFeature(String, int)} to check for a minimum version.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003941 *
Jeff Sharkey115d2c12016-02-15 17:25:57 -07003942 * @return Returns true if the devices supports the feature, else false.
Dianne Hackborn039c68e2009-09-26 16:39:23 -07003943 */
3944 public abstract boolean hasSystemFeature(String name);
3945
3946 /**
Jeff Sharkey115d2c12016-02-15 17:25:57 -07003947 * Check whether the given feature name and version is one of the available
3948 * features as returned by {@link #getSystemAvailableFeatures()}. Since
3949 * features are defined to always be backwards compatible, this returns true
3950 * if the available feature version is greater than or equal to the
3951 * requested version.
3952 *
3953 * @return Returns true if the devices supports the feature, else false.
3954 */
3955 public abstract boolean hasSystemFeature(String name, int version);
3956
3957 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003958 * Determine the best action to perform for a given Intent. This is how
3959 * {@link Intent#resolveActivity} finds an activity if a class has not been
3960 * explicitly specified.
3961 * <p>
3962 * <em>Note:</em> if using an implicit Intent (without an explicit
3963 * ComponentName specified), be sure to consider whether to set the
3964 * {@link #MATCH_DEFAULT_ONLY} only flag. You need to do so to resolve the
3965 * activity in the same way that
3966 * {@link android.content.Context#startActivity(Intent)} and
Dianne Hackborn4d023d212010-10-01 13:41:04 -07003967 * {@link android.content.Intent#resolveActivity(PackageManager)
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003968 * Intent.resolveActivity(PackageManager)} do.
3969 * </p>
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003970 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003971 * @param intent An intent containing all of the desired specification
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003972 * (action, data, type, category, and/or component).
Jeff Sharkey4347f812017-04-21 12:08:39 -06003973 * @param flags Additional option flags to modify the data returned. The
3974 * most important is {@link #MATCH_DEFAULT_ONLY}, to limit the
3975 * resolution to only those activities that support the
3976 * {@link android.content.Intent#CATEGORY_DEFAULT}.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003977 * @return Returns a ResolveInfo object containing the final activity intent
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003978 * that was determined to be the best action. Returns null if no
Mike LeBeaubd3f5272010-02-18 19:27:17 -08003979 * matching activity was found. If multiple matching activities are
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003980 * found and there is no default set, returns a ResolveInfo object
Mike LeBeaubd3f5272010-02-18 19:27:17 -08003981 * containing something else, such as the activity resolver.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003982 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003983 public abstract ResolveInfo resolveActivity(Intent intent, @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003984
3985 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003986 * Determine the best action to perform for a given Intent for a given user.
3987 * This is how {@link Intent#resolveActivity} finds an activity if a class
3988 * has not been explicitly specified.
3989 * <p>
3990 * <em>Note:</em> if using an implicit Intent (without an explicit
3991 * ComponentName specified), be sure to consider whether to set the
3992 * {@link #MATCH_DEFAULT_ONLY} only flag. You need to do so to resolve the
3993 * activity in the same way that
3994 * {@link android.content.Context#startActivity(Intent)} and
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07003995 * {@link android.content.Intent#resolveActivity(PackageManager)
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003996 * Intent.resolveActivity(PackageManager)} do.
3997 * </p>
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07003998 *
3999 * @param intent An intent containing all of the desired specification
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004000 * (action, data, type, category, and/or component).
Jeff Sharkey4347f812017-04-21 12:08:39 -06004001 * @param flags Additional option flags to modify the data returned. The
4002 * most important is {@link #MATCH_DEFAULT_ONLY}, to limit the
4003 * resolution to only those activities that support the
4004 * {@link android.content.Intent#CATEGORY_DEFAULT}.
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004005 * @param userId The user id.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004006 * @return Returns a ResolveInfo object containing the final activity intent
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004007 * that was determined to be the best action. Returns null if no
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004008 * matching activity was found. If multiple matching activities are
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004009 * found and there is no default set, returns a ResolveInfo object
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004010 * containing something else, such as the activity resolver.
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004011 * @hide
4012 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004013 public abstract ResolveInfo resolveActivityAsUser(Intent intent, @ResolveInfoFlags int flags,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004014 @UserIdInt int userId);
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004015
4016 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004017 * Retrieve all activities that can be performed for the given intent.
4018 *
4019 * @param intent The desired intent as per resolveActivity().
Jeff Sharkey4347f812017-04-21 12:08:39 -06004020 * @param flags Additional option flags to modify the data returned. The
4021 * most important is {@link #MATCH_DEFAULT_ONLY}, to limit the
4022 * resolution to only those activities that support the
4023 * {@link android.content.Intent#CATEGORY_DEFAULT}. Or, set
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004024 * {@link #MATCH_ALL} to prevent any filtering of the results.
4025 * @return Returns a List of ResolveInfo objects containing one entry for
4026 * each matching activity, ordered from best to worst. In other
4027 * words, the first item is what would be returned by
4028 * {@link #resolveActivity}. If there are no matching activities, an
4029 * empty list is returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004030 */
4031 public abstract List<ResolveInfo> queryIntentActivities(Intent intent,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004032 @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004033
4034 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004035 * Retrieve all activities that can be performed for the given intent, for a
4036 * specific user.
Amith Yamasani151ec4c2012-09-07 19:25:16 -07004037 *
4038 * @param intent The desired intent as per resolveActivity().
Jeff Sharkey4347f812017-04-21 12:08:39 -06004039 * @param flags Additional option flags to modify the data returned. The
4040 * most important is {@link #MATCH_DEFAULT_ONLY}, to limit the
4041 * resolution to only those activities that support the
4042 * {@link android.content.Intent#CATEGORY_DEFAULT}. Or, set
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004043 * {@link #MATCH_ALL} to prevent any filtering of the results.
4044 * @return Returns a List of ResolveInfo objects containing one entry for
4045 * each matching activity, ordered from best to worst. In other
4046 * words, the first item is what would be returned by
4047 * {@link #resolveActivity}. If there are no matching activities, an
4048 * empty list is returned.
Amith Yamasani151ec4c2012-09-07 19:25:16 -07004049 * @hide
4050 */
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004051 public abstract List<ResolveInfo> queryIntentActivitiesAsUser(Intent intent,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004052 @ResolveInfoFlags int flags, @UserIdInt int userId);
Amith Yamasani151ec4c2012-09-07 19:25:16 -07004053
4054 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004055 * Retrieve a set of activities that should be presented to the user as
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004056 * similar options. This is like {@link #queryIntentActivities}, except it
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004057 * also allows you to supply a list of more explicit Intents that you would
4058 * like to resolve to particular options, and takes care of returning the
4059 * final ResolveInfo list in a reasonable order, with no duplicates, based
4060 * on those inputs.
4061 *
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004062 * @param caller The class name of the activity that is making the request.
4063 * This activity will never appear in the output list. Can be
4064 * null.
4065 * @param specifics An array of Intents that should be resolved to the first
4066 * specific results. Can be null.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004067 * @param intent The desired intent as per resolveActivity().
Jeff Sharkey4347f812017-04-21 12:08:39 -06004068 * @param flags Additional option flags to modify the data returned. The
4069 * most important is {@link #MATCH_DEFAULT_ONLY}, to limit the
4070 * resolution to only those activities that support the
4071 * {@link android.content.Intent#CATEGORY_DEFAULT}.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004072 * @return Returns a List of ResolveInfo objects containing one entry for
4073 * each matching activity. The list is ordered first by all of the
4074 * intents resolved in <var>specifics</var> and then any additional
4075 * activities that can handle <var>intent</var> but did not get
4076 * included by one of the <var>specifics</var> intents. If there are
4077 * no matching activities, an empty list is returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004078 */
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06004079 public abstract List<ResolveInfo> queryIntentActivityOptions(@Nullable ComponentName caller,
4080 @Nullable Intent[] specifics, Intent intent, @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004081
4082 /**
4083 * Retrieve all receivers that can handle a broadcast of the given intent.
4084 *
4085 * @param intent The desired intent as per resolveActivity().
Jeff Sharkey4347f812017-04-21 12:08:39 -06004086 * @param flags Additional option flags to modify the data returned.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004087 * @return Returns a List of ResolveInfo objects containing one entry for
4088 * each matching receiver, ordered from best to worst. If there are
4089 * no matching receivers, an empty list or null is returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004090 */
4091 public abstract List<ResolveInfo> queryBroadcastReceivers(Intent intent,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004092 @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004093
4094 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004095 * Retrieve all receivers that can handle a broadcast of the given intent,
4096 * for a specific user.
Amith Yamasanif203aee2012-08-29 18:41:53 -07004097 *
4098 * @param intent The desired intent as per resolveActivity().
Jeff Sharkey4347f812017-04-21 12:08:39 -06004099 * @param flags Additional option flags to modify the data returned.
Fyodor Kupolov940e8572016-01-26 12:03:51 -08004100 * @param userHandle UserHandle of the user being queried.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004101 * @return Returns a List of ResolveInfo objects containing one entry for
4102 * each matching receiver, ordered from best to worst. If there are
4103 * no matching receivers, an empty list or null is returned.
Amith Yamasanif203aee2012-08-29 18:41:53 -07004104 * @hide
4105 */
Fyodor Kupolov940e8572016-01-26 12:03:51 -08004106 @SystemApi
Todd Kennedydbaef6d2017-07-24 11:28:00 -07004107 @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS)
Fyodor Kupolov940e8572016-01-26 12:03:51 -08004108 public List<ResolveInfo> queryBroadcastReceiversAsUser(Intent intent,
4109 @ResolveInfoFlags int flags, UserHandle userHandle) {
4110 return queryBroadcastReceiversAsUser(intent, flags, userHandle.getIdentifier());
4111 }
4112
4113 /**
4114 * @hide
4115 */
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07004116 public abstract List<ResolveInfo> queryBroadcastReceiversAsUser(Intent intent,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004117 @ResolveInfoFlags int flags, @UserIdInt int userId);
Amith Yamasanif203aee2012-08-29 18:41:53 -07004118
Fyodor Kupolov940e8572016-01-26 12:03:51 -08004119
Jeff Sharkeybd940222016-01-08 11:07:13 -07004120 /** {@hide} */
4121 @Deprecated
4122 public List<ResolveInfo> queryBroadcastReceivers(Intent intent,
4123 @ResolveInfoFlags int flags, @UserIdInt int userId) {
Jeff Sharkey6f4b2a32017-03-21 14:13:41 -06004124 final String msg = "Shame on you for calling the hidden API "
4125 + "queryBroadcastReceivers(). Shame!";
4126 if (VMRuntime.getRuntime().getTargetSdkVersion() >= Build.VERSION_CODES.O) {
4127 throw new UnsupportedOperationException(msg);
4128 } else {
4129 Log.d(TAG, msg);
4130 return queryBroadcastReceiversAsUser(intent, flags, userId);
4131 }
Jeff Sharkeybd940222016-01-08 11:07:13 -07004132 }
4133
Amith Yamasanif203aee2012-08-29 18:41:53 -07004134 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004135 * Determine the best service to handle for a given Intent.
4136 *
4137 * @param intent An intent containing all of the desired specification
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004138 * (action, data, type, category, and/or component).
Jeff Sharkey4347f812017-04-21 12:08:39 -06004139 * @param flags Additional option flags to modify the data returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004140 * @return Returns a ResolveInfo object containing the final service intent
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004141 * that was determined to be the best action. Returns null if no
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004142 * matching service was found.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004143 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004144 public abstract ResolveInfo resolveService(Intent intent, @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004145
4146 /**
4147 * Retrieve all services that can match the given intent.
4148 *
4149 * @param intent The desired intent as per resolveService().
Jeff Sharkey4347f812017-04-21 12:08:39 -06004150 * @param flags Additional option flags to modify the data returned.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004151 * @return Returns a List of ResolveInfo objects containing one entry for
4152 * each matching service, ordered from best to worst. In other
4153 * words, the first item is what would be returned by
4154 * {@link #resolveService}. If there are no matching services, an
4155 * empty list or null is returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004156 */
4157 public abstract List<ResolveInfo> queryIntentServices(Intent intent,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004158 @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004159
4160 /**
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004161 * Retrieve all services that can match the given intent for a given user.
4162 *
4163 * @param intent The desired intent as per resolveService().
Jeff Sharkey4347f812017-04-21 12:08:39 -06004164 * @param flags Additional option flags to modify the data returned.
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004165 * @param userId The user id.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004166 * @return Returns a List of ResolveInfo objects containing one entry for
4167 * each matching service, ordered from best to worst. In other
4168 * words, the first item is what would be returned by
4169 * {@link #resolveService}. If there are no matching services, an
4170 * empty list or null is returned.
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004171 * @hide
4172 */
4173 public abstract List<ResolveInfo> queryIntentServicesAsUser(Intent intent,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004174 @ResolveInfoFlags int flags, @UserIdInt int userId);
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004175
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004176 /**
4177 * Retrieve all providers that can match the given intent.
4178 *
4179 * @param intent An intent containing all of the desired specification
4180 * (action, data, type, category, and/or component).
Jeff Sharkey4347f812017-04-21 12:08:39 -06004181 * @param flags Additional option flags to modify the data returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004182 * @param userId The user id.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004183 * @return Returns a List of ResolveInfo objects containing one entry for
4184 * each matching provider, ordered from best to worst. If there are
4185 * no matching services, an empty list or null is returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004186 * @hide
4187 */
Jeff Sharkey85f5f812013-10-07 10:16:12 -07004188 public abstract List<ResolveInfo> queryIntentContentProvidersAsUser(
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004189 Intent intent, @ResolveInfoFlags int flags, @UserIdInt int userId);
Jeff Sharkey85f5f812013-10-07 10:16:12 -07004190
4191 /**
4192 * Retrieve all providers that can match the given intent.
4193 *
4194 * @param intent An intent containing all of the desired specification
4195 * (action, data, type, category, and/or component).
Jeff Sharkey4347f812017-04-21 12:08:39 -06004196 * @param flags Additional option flags to modify the data returned.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004197 * @return Returns a List of ResolveInfo objects containing one entry for
4198 * each matching provider, ordered from best to worst. If there are
4199 * no matching services, an empty list or null is returned.
Jeff Sharkey85f5f812013-10-07 10:16:12 -07004200 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004201 public abstract List<ResolveInfo> queryIntentContentProviders(Intent intent,
4202 @ResolveInfoFlags int flags);
Jeff Sharkey85f5f812013-10-07 10:16:12 -07004203
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004204 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004205 * Find a single content provider by its base path name.
4206 *
4207 * @param name The name of the provider to find.
Jeff Sharkey4347f812017-04-21 12:08:39 -06004208 * @param flags Additional option flags to modify the data returned.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004209 * @return A {@link ProviderInfo} object containing information about the
4210 * provider. If a provider was not found, returns null.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004211 */
4212 public abstract ProviderInfo resolveContentProvider(String name,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004213 @ComponentInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004214
4215 /**
Alexandra Gherghina0363c3e2014-06-23 13:34:59 +01004216 * Find a single content provider by its base path name.
4217 *
4218 * @param name The name of the provider to find.
Jeff Sharkey4347f812017-04-21 12:08:39 -06004219 * @param flags Additional option flags to modify the data returned.
Alexandra Gherghina0363c3e2014-06-23 13:34:59 +01004220 * @param userId The user id.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004221 * @return A {@link ProviderInfo} object containing information about the
4222 * provider. If a provider was not found, returns null.
Alexandra Gherghina0363c3e2014-06-23 13:34:59 +01004223 * @hide
4224 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004225 public abstract ProviderInfo resolveContentProviderAsUser(String name,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004226 @ComponentInfoFlags int flags, @UserIdInt int userId);
Alexandra Gherghina0363c3e2014-06-23 13:34:59 +01004227
4228 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004229 * Retrieve content provider information.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004230 * <p>
4231 * <em>Note: unlike most other methods, an empty result set is indicated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004232 * by a null return instead of an empty list.</em>
4233 *
4234 * @param processName If non-null, limits the returned providers to only
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004235 * those that are hosted by the given process. If null, all
4236 * content providers are returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004237 * @param uid If <var>processName</var> is non-null, this is the required
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004238 * uid owning the requested content providers.
Jeff Sharkey4347f812017-04-21 12:08:39 -06004239 * @param flags Additional option flags to modify the data returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004240 * @return A list of {@link ProviderInfo} objects containing one entry for
4241 * each provider either matching <var>processName</var> or, if
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004242 * <var>processName</var> is null, all known content providers.
4243 * <em>If there are no matching providers, null is returned.</em>
4244 */
4245 public abstract List<ProviderInfo> queryContentProviders(
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004246 String processName, int uid, @ComponentInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004247
4248 /**
Makoto Onuki32757292017-02-22 14:36:59 -08004249 * Same as {@link #queryContentProviders}, except when {@code metaDataKey} is not null,
4250 * it only returns providers which have metadata with the {@code metaDataKey} key.
4251 *
4252 * <p>DO NOT USE the {@code metaDataKey} parameter, unless you're the contacts provider.
4253 * You really shouldn't need it. Other apps should use {@link #queryIntentContentProviders}
4254 * instead.
4255 *
4256 * <p>The {@code metaDataKey} parameter was added to allow the contacts provider to quickly
4257 * scan the GAL providers on the device. Unfortunately the discovery protocol used metadata
4258 * to mark GAL providers, rather than intent filters, so we can't use
4259 * {@link #queryIntentContentProviders} for that.
4260 *
4261 * @hide
4262 */
4263 public List<ProviderInfo> queryContentProviders(
4264 String processName, int uid, @ComponentInfoFlags int flags, String metaDataKey) {
4265 // Provide the default implementation for mocks.
4266 return queryContentProviders(processName, uid, flags);
4267 }
4268
4269 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004270 * Retrieve all of the information we know about a particular
4271 * instrumentation class.
4272 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004273 * @param className The full name (i.e.
Jeff Sharkey4347f812017-04-21 12:08:39 -06004274 * com.google.apps.contacts.InstrumentList) of an Instrumentation
4275 * class.
4276 * @param flags Additional option flags to modify the data returned.
4277 * @return An {@link InstrumentationInfo} object containing information
4278 * about the instrumentation.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004279 * @throws NameNotFoundException if a package with the given name cannot be
4280 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004281 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004282 public abstract InstrumentationInfo getInstrumentationInfo(ComponentName className,
4283 @InstrumentationInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004284
4285 /**
Jeff Sharkey4347f812017-04-21 12:08:39 -06004286 * Retrieve information about available instrumentation code. May be used to
4287 * retrieve either all instrumentation code, or only the code targeting a
4288 * particular package.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004289 *
4290 * @param targetPackage If null, all instrumentation is returned; only the
Jeff Sharkey4347f812017-04-21 12:08:39 -06004291 * instrumentation targeting this package name is returned.
4292 * @param flags Additional option flags to modify the data returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004293 * @return A list of {@link InstrumentationInfo} objects containing one
4294 * entry for each matching instrumentation. If there are no
Jesse Hallf77a34f2016-02-04 18:41:33 -08004295 * instrumentation available, returns an empty list.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004296 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004297 public abstract List<InstrumentationInfo> queryInstrumentation(String targetPackage,
4298 @InstrumentationInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004299
4300 /**
4301 * Retrieve an image from a package. This is a low-level API used by
4302 * the various package manager info structures (such as
4303 * {@link ComponentInfo} to implement retrieval of their associated
4304 * icon.
4305 *
4306 * @param packageName The name of the package that this icon is coming from.
kmccormick30498b42013-03-27 17:39:17 -07004307 * Cannot be null.
4308 * @param resid The resource identifier of the desired image. Cannot be 0.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004309 * @param appInfo Overall information about <var>packageName</var>. This
4310 * may be null, in which case the application information will be retrieved
4311 * for you if needed; if you already have this information around, it can
4312 * be much more efficient to supply it here.
4313 *
4314 * @return Returns a Drawable holding the requested image. Returns null if
4315 * an image could not be found for any reason.
4316 */
Tor Norbye7b9c9122013-05-30 16:48:33 -07004317 public abstract Drawable getDrawable(String packageName, @DrawableRes int resid,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004318 ApplicationInfo appInfo);
4319
4320 /**
4321 * Retrieve the icon associated with an activity. Given the full name of
4322 * an activity, retrieves the information about it and calls
4323 * {@link ComponentInfo#loadIcon ComponentInfo.loadIcon()} to return its icon.
kmccormick30498b42013-03-27 17:39:17 -07004324 * If the activity cannot be found, NameNotFoundException is thrown.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004325 *
4326 * @param activityName Name of the activity whose icon is to be retrieved.
4327 *
4328 * @return Returns the image of the icon, or the default activity icon if
4329 * it could not be found. Does not return null.
4330 * @throws NameNotFoundException Thrown if the resources for the given
4331 * activity could not be loaded.
4332 *
4333 * @see #getActivityIcon(Intent)
4334 */
4335 public abstract Drawable getActivityIcon(ComponentName activityName)
4336 throws NameNotFoundException;
4337
4338 /**
4339 * Retrieve the icon associated with an Intent. If intent.getClassName() is
4340 * set, this simply returns the result of
4341 * getActivityIcon(intent.getClassName()). Otherwise it resolves the intent's
4342 * component and returns the icon associated with the resolved component.
kmccormick30498b42013-03-27 17:39:17 -07004343 * If intent.getClassName() cannot be found or the Intent cannot be resolved
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004344 * to a component, NameNotFoundException is thrown.
4345 *
4346 * @param intent The intent for which you would like to retrieve an icon.
4347 *
4348 * @return Returns the image of the icon, or the default activity icon if
4349 * it could not be found. Does not return null.
4350 * @throws NameNotFoundException Thrown if the resources for application
4351 * matching the given intent could not be loaded.
4352 *
4353 * @see #getActivityIcon(ComponentName)
4354 */
4355 public abstract Drawable getActivityIcon(Intent intent)
4356 throws NameNotFoundException;
4357
4358 /**
Jose Limaf78e3122014-03-06 12:13:15 -08004359 * Retrieve the banner associated with an activity. Given the full name of
4360 * an activity, retrieves the information about it and calls
4361 * {@link ComponentInfo#loadIcon ComponentInfo.loadIcon()} to return its
4362 * banner. If the activity cannot be found, NameNotFoundException is thrown.
4363 *
4364 * @param activityName Name of the activity whose banner is to be retrieved.
4365 * @return Returns the image of the banner, or null if the activity has no
4366 * banner specified.
4367 * @throws NameNotFoundException Thrown if the resources for the given
4368 * activity could not be loaded.
4369 * @see #getActivityBanner(Intent)
4370 */
4371 public abstract Drawable getActivityBanner(ComponentName activityName)
4372 throws NameNotFoundException;
4373
4374 /**
4375 * Retrieve the banner associated with an Intent. If intent.getClassName()
4376 * is set, this simply returns the result of
4377 * getActivityBanner(intent.getClassName()). Otherwise it resolves the
4378 * intent's component and returns the banner associated with the resolved
4379 * component. If intent.getClassName() cannot be found or the Intent cannot
4380 * be resolved to a component, NameNotFoundException is thrown.
4381 *
4382 * @param intent The intent for which you would like to retrieve a banner.
4383 * @return Returns the image of the banner, or null if the activity has no
4384 * banner specified.
4385 * @throws NameNotFoundException Thrown if the resources for application
4386 * matching the given intent could not be loaded.
4387 * @see #getActivityBanner(ComponentName)
4388 */
4389 public abstract Drawable getActivityBanner(Intent intent)
4390 throws NameNotFoundException;
4391
4392 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004393 * Return the generic icon for an activity that is used when no specific
4394 * icon is defined.
Adam Connors23cc04e2014-04-01 12:12:20 +01004395 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004396 * @return Drawable Image of the icon.
4397 */
4398 public abstract Drawable getDefaultActivityIcon();
4399
4400 /**
4401 * Retrieve the icon associated with an application. If it has not defined
4402 * an icon, the default app icon is returned. Does not return null.
4403 *
4404 * @param info Information about application being queried.
4405 *
4406 * @return Returns the image of the icon, or the default application icon
4407 * if it could not be found.
4408 *
4409 * @see #getApplicationIcon(String)
4410 */
4411 public abstract Drawable getApplicationIcon(ApplicationInfo info);
4412
4413 /**
4414 * Retrieve the icon associated with an application. Given the name of the
4415 * application's package, retrieves the information about it and calls
kmccormick30498b42013-03-27 17:39:17 -07004416 * getApplicationIcon() to return its icon. If the application cannot be
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004417 * found, NameNotFoundException is thrown.
4418 *
4419 * @param packageName Name of the package whose application icon is to be
4420 * retrieved.
4421 *
4422 * @return Returns the image of the icon, or the default application icon
4423 * if it could not be found. Does not return null.
4424 * @throws NameNotFoundException Thrown if the resources for the given
4425 * application could not be loaded.
4426 *
4427 * @see #getApplicationIcon(ApplicationInfo)
4428 */
4429 public abstract Drawable getApplicationIcon(String packageName)
4430 throws NameNotFoundException;
4431
4432 /**
Jose Limaf78e3122014-03-06 12:13:15 -08004433 * Retrieve the banner associated with an application.
4434 *
4435 * @param info Information about application being queried.
4436 * @return Returns the image of the banner or null if the application has no
4437 * banner specified.
4438 * @see #getApplicationBanner(String)
4439 */
4440 public abstract Drawable getApplicationBanner(ApplicationInfo info);
4441
4442 /**
4443 * Retrieve the banner associated with an application. Given the name of the
4444 * application's package, retrieves the information about it and calls
4445 * getApplicationIcon() to return its banner. If the application cannot be
4446 * found, NameNotFoundException is thrown.
4447 *
4448 * @param packageName Name of the package whose application banner is to be
4449 * retrieved.
4450 * @return Returns the image of the banner or null if the application has no
4451 * banner specified.
4452 * @throws NameNotFoundException Thrown if the resources for the given
4453 * application could not be loaded.
4454 * @see #getApplicationBanner(ApplicationInfo)
4455 */
4456 public abstract Drawable getApplicationBanner(String packageName)
4457 throws NameNotFoundException;
4458
4459 /**
4460 * Retrieve the logo associated with an activity. Given the full name of an
4461 * activity, retrieves the information about it and calls
4462 * {@link ComponentInfo#loadLogo ComponentInfo.loadLogo()} to return its
4463 * logo. If the activity cannot be found, NameNotFoundException is thrown.
Adam Powell81cd2e92010-04-21 16:35:18 -07004464 *
4465 * @param activityName Name of the activity whose logo is to be retrieved.
Jose Limaf78e3122014-03-06 12:13:15 -08004466 * @return Returns the image of the logo or null if the activity has no logo
4467 * specified.
Adam Powell81cd2e92010-04-21 16:35:18 -07004468 * @throws NameNotFoundException Thrown if the resources for the given
Jose Limaf78e3122014-03-06 12:13:15 -08004469 * activity could not be loaded.
Adam Powell81cd2e92010-04-21 16:35:18 -07004470 * @see #getActivityLogo(Intent)
4471 */
4472 public abstract Drawable getActivityLogo(ComponentName activityName)
4473 throws NameNotFoundException;
4474
4475 /**
4476 * Retrieve the logo associated with an Intent. If intent.getClassName() is
4477 * set, this simply returns the result of
4478 * getActivityLogo(intent.getClassName()). Otherwise it resolves the intent's
4479 * component and returns the logo associated with the resolved component.
kmccormick30498b42013-03-27 17:39:17 -07004480 * If intent.getClassName() cannot be found or the Intent cannot be resolved
Adam Powell81cd2e92010-04-21 16:35:18 -07004481 * to a component, NameNotFoundException is thrown.
4482 *
4483 * @param intent The intent for which you would like to retrieve a logo.
4484 *
4485 * @return Returns the image of the logo, or null if the activity has no
4486 * logo specified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004487 *
Adam Powell81cd2e92010-04-21 16:35:18 -07004488 * @throws NameNotFoundException Thrown if the resources for application
4489 * matching the given intent could not be loaded.
4490 *
4491 * @see #getActivityLogo(ComponentName)
4492 */
4493 public abstract Drawable getActivityLogo(Intent intent)
4494 throws NameNotFoundException;
4495
4496 /**
4497 * Retrieve the logo associated with an application. If it has not specified
4498 * a logo, this method returns null.
4499 *
4500 * @param info Information about application being queried.
4501 *
4502 * @return Returns the image of the logo, or null if no logo is specified
4503 * by the application.
4504 *
4505 * @see #getApplicationLogo(String)
4506 */
4507 public abstract Drawable getApplicationLogo(ApplicationInfo info);
4508
4509 /**
4510 * Retrieve the logo associated with an application. Given the name of the
4511 * application's package, retrieves the information about it and calls
kmccormick30498b42013-03-27 17:39:17 -07004512 * getApplicationLogo() to return its logo. If the application cannot be
Adam Powell81cd2e92010-04-21 16:35:18 -07004513 * found, NameNotFoundException is thrown.
4514 *
4515 * @param packageName Name of the package whose application logo is to be
4516 * retrieved.
4517 *
4518 * @return Returns the image of the logo, or null if no application logo
4519 * has been specified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004520 *
Adam Powell81cd2e92010-04-21 16:35:18 -07004521 * @throws NameNotFoundException Thrown if the resources for the given
4522 * application could not be loaded.
4523 *
4524 * @see #getApplicationLogo(ApplicationInfo)
4525 */
4526 public abstract Drawable getApplicationLogo(String packageName)
4527 throws NameNotFoundException;
4528
4529 /**
Tony Mak4dc008c2016-03-16 10:46:49 +00004530 * If the target user is a managed profile, then this returns a badged copy of the given icon
4531 * to be able to distinguish it from the original icon. For badging an arbitrary drawable use
Kenny Guydf77d712015-05-29 17:02:22 +01004532 * {@link #getUserBadgedDrawableForDensity(
Svetoslavc7d62f02014-09-04 15:39:54 -07004533 * android.graphics.drawable.Drawable, UserHandle, android.graphics.Rect, int)}.
4534 * <p>
4535 * If the original drawable is a BitmapDrawable and the backing bitmap is
4536 * mutable as per {@link android.graphics.Bitmap#isMutable()}, the badging
4537 * is performed in place and the original drawable is returned.
4538 * </p>
4539 *
4540 * @param icon The icon to badge.
4541 * @param user The target user.
4542 * @return A drawable that combines the original icon and a badge as
4543 * determined by the system.
4544 */
4545 public abstract Drawable getUserBadgedIcon(Drawable icon, UserHandle user);
4546
4547 /**
4548 * If the target user is a managed profile of the calling user or the caller
4549 * is itself a managed profile, then this returns a badged copy of the given
4550 * drawable allowing the user to distinguish it from the original drawable.
4551 * The caller can specify the location in the bounds of the drawable to be
4552 * badged where the badge should be applied as well as the density of the
4553 * badge to be used.
4554 * <p>
4555 * If the original drawable is a BitmapDrawable and the backing bitmap is
Vadim Tryshev66ae66a2016-02-18 15:41:21 -08004556 * mutable as per {@link android.graphics.Bitmap#isMutable()}, the badging
Svetoslavc7d62f02014-09-04 15:39:54 -07004557 * is performed in place and the original drawable is returned.
4558 * </p>
4559 *
4560 * @param drawable The drawable to badge.
4561 * @param user The target user.
4562 * @param badgeLocation Where in the bounds of the badged drawable to place
Vadim Tryshev66ae66a2016-02-18 15:41:21 -08004563 * the badge. If it's {@code null}, the badge is applied on top of the entire
Svetoslavc7d62f02014-09-04 15:39:54 -07004564 * drawable being badged.
4565 * @param badgeDensity The optional desired density for the badge as per
Vadim Tryshev66ae66a2016-02-18 15:41:21 -08004566 * {@link android.util.DisplayMetrics#densityDpi}. If it's not positive,
Svetoslavc7d62f02014-09-04 15:39:54 -07004567 * the density of the display is used.
4568 * @return A drawable that combines the original drawable and a badge as
4569 * determined by the system.
4570 */
4571 public abstract Drawable getUserBadgedDrawableForDensity(Drawable drawable,
4572 UserHandle user, Rect badgeLocation, int badgeDensity);
4573
4574 /**
4575 * If the target user is a managed profile of the calling user or the caller
4576 * is itself a managed profile, then this returns a drawable to use as a small
4577 * icon to include in a view to distinguish it from the original icon.
4578 *
4579 * @param user The target user.
4580 * @param density The optional desired density for the badge as per
4581 * {@link android.util.DisplayMetrics#densityDpi}. If not provided
4582 * the density of the current display is used.
4583 * @return the drawable or null if no drawable is required.
4584 * @hide
4585 */
4586 public abstract Drawable getUserBadgeForDensity(UserHandle user, int density);
4587
4588 /**
4589 * If the target user is a managed profile of the calling user or the caller
Selim Cineke6ff9462016-01-15 15:07:06 -08004590 * is itself a managed profile, then this returns a drawable to use as a small
4591 * icon to include in a view to distinguish it from the original icon. This version
4592 * doesn't have background protection and should be used over a light background instead of
4593 * a badge.
4594 *
4595 * @param user The target user.
4596 * @param density The optional desired density for the badge as per
4597 * {@link android.util.DisplayMetrics#densityDpi}. If not provided
4598 * the density of the current display is used.
4599 * @return the drawable or null if no drawable is required.
4600 * @hide
4601 */
4602 public abstract Drawable getUserBadgeForDensityNoBackground(UserHandle user, int density);
4603
4604 /**
4605 * If the target user is a managed profile of the calling user or the caller
Svetoslavc7d62f02014-09-04 15:39:54 -07004606 * is itself a managed profile, then this returns a copy of the label with
4607 * badging for accessibility services like talkback. E.g. passing in "Email"
4608 * and it might return "Work Email" for Email in the work profile.
4609 *
4610 * @param label The label to change.
4611 * @param user The target user.
4612 * @return A label that combines the original label and a badge as
4613 * determined by the system.
4614 */
4615 public abstract CharSequence getUserBadgedLabel(CharSequence label, UserHandle user);
4616
4617 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004618 * Retrieve text from a package. This is a low-level API used by
4619 * the various package manager info structures (such as
4620 * {@link ComponentInfo} to implement retrieval of their associated
4621 * labels and other text.
4622 *
4623 * @param packageName The name of the package that this text is coming from.
kmccormick30498b42013-03-27 17:39:17 -07004624 * Cannot be null.
4625 * @param resid The resource identifier of the desired text. Cannot be 0.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004626 * @param appInfo Overall information about <var>packageName</var>. This
4627 * may be null, in which case the application information will be retrieved
4628 * for you if needed; if you already have this information around, it can
4629 * be much more efficient to supply it here.
4630 *
4631 * @return Returns a CharSequence holding the requested text. Returns null
4632 * if the text could not be found for any reason.
4633 */
Tor Norbye7b9c9122013-05-30 16:48:33 -07004634 public abstract CharSequence getText(String packageName, @StringRes int resid,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004635 ApplicationInfo appInfo);
4636
4637 /**
4638 * Retrieve an XML file from a package. This is a low-level API used to
4639 * retrieve XML meta data.
4640 *
4641 * @param packageName The name of the package that this xml is coming from.
kmccormick30498b42013-03-27 17:39:17 -07004642 * Cannot be null.
4643 * @param resid The resource identifier of the desired xml. Cannot be 0.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004644 * @param appInfo Overall information about <var>packageName</var>. This
4645 * may be null, in which case the application information will be retrieved
4646 * for you if needed; if you already have this information around, it can
4647 * be much more efficient to supply it here.
4648 *
4649 * @return Returns an XmlPullParser allowing you to parse out the XML
4650 * data. Returns null if the xml resource could not be found for any
4651 * reason.
4652 */
Tor Norbye7b9c9122013-05-30 16:48:33 -07004653 public abstract XmlResourceParser getXml(String packageName, @XmlRes int resid,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004654 ApplicationInfo appInfo);
4655
4656 /**
4657 * Return the label to use for this application.
4658 *
4659 * @return Returns the label associated with this application, or null if
4660 * it could not be found for any reason.
kmccormick30498b42013-03-27 17:39:17 -07004661 * @param info The application to get the label of.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004662 */
4663 public abstract CharSequence getApplicationLabel(ApplicationInfo info);
4664
4665 /**
4666 * Retrieve the resources associated with an activity. Given the full
4667 * name of an activity, retrieves the information about it and calls
4668 * getResources() to return its application's resources. If the activity
kmccormick30498b42013-03-27 17:39:17 -07004669 * cannot be found, NameNotFoundException is thrown.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004670 *
4671 * @param activityName Name of the activity whose resources are to be
4672 * retrieved.
4673 *
4674 * @return Returns the application's Resources.
4675 * @throws NameNotFoundException Thrown if the resources for the given
4676 * application could not be loaded.
4677 *
4678 * @see #getResourcesForApplication(ApplicationInfo)
4679 */
4680 public abstract Resources getResourcesForActivity(ComponentName activityName)
4681 throws NameNotFoundException;
4682
4683 /**
4684 * Retrieve the resources for an application. Throws NameNotFoundException
4685 * if the package is no longer installed.
4686 *
4687 * @param app Information about the desired application.
4688 *
4689 * @return Returns the application's Resources.
4690 * @throws NameNotFoundException Thrown if the resources for the given
4691 * application could not be loaded (most likely because it was uninstalled).
4692 */
4693 public abstract Resources getResourcesForApplication(ApplicationInfo app)
4694 throws NameNotFoundException;
4695
4696 /**
4697 * Retrieve the resources associated with an application. Given the full
4698 * package name of an application, retrieves the information about it and
4699 * calls getResources() to return its application's resources. If the
kmccormick30498b42013-03-27 17:39:17 -07004700 * appPackageName cannot be found, NameNotFoundException is thrown.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004701 *
4702 * @param appPackageName Package name of the application whose resources
4703 * are to be retrieved.
4704 *
4705 * @return Returns the application's Resources.
4706 * @throws NameNotFoundException Thrown if the resources for the given
4707 * application could not be loaded.
4708 *
4709 * @see #getResourcesForApplication(ApplicationInfo)
4710 */
4711 public abstract Resources getResourcesForApplication(String appPackageName)
4712 throws NameNotFoundException;
4713
Amith Yamasani98edc952012-09-25 14:09:27 -07004714 /** @hide */
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004715 public abstract Resources getResourcesForApplicationAsUser(String appPackageName,
4716 @UserIdInt int userId) throws NameNotFoundException;
Amith Yamasani98edc952012-09-25 14:09:27 -07004717
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004718 /**
Jeff Sharkey4347f812017-04-21 12:08:39 -06004719 * Retrieve overall information about an application package defined in a
4720 * package archive file
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004721 *
4722 * @param archiveFilePath The path to the archive file
Jeff Sharkey4347f812017-04-21 12:08:39 -06004723 * @param flags Additional option flags to modify the data returned.
4724 * @return A PackageInfo object containing information about the package
4725 * archive. If the package could not be parsed, returns null.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004726 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004727 public PackageInfo getPackageArchiveInfo(String archiveFilePath, @PackageInfoFlags int flags) {
Jeff Sharkey275e0852014-06-17 18:18:49 -07004728 final PackageParser parser = new PackageParser();
Dianne Hackborncd154e92017-02-28 17:37:35 -08004729 parser.setCallback(new PackageParser.CallbackImpl(this));
Jeff Sharkey275e0852014-06-17 18:18:49 -07004730 final File apkFile = new File(archiveFilePath);
Jeff Sharkeyc4858a22014-06-16 10:51:20 -07004731 try {
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004732 if ((flags & (MATCH_DIRECT_BOOT_UNAWARE | MATCH_DIRECT_BOOT_AWARE)) != 0) {
Jeff Sharkeyc3132512016-01-12 14:06:58 -07004733 // Caller expressed an explicit opinion about what encryption
4734 // aware/unaware components they want to see, so fall through and
4735 // give them what they want
4736 } else {
4737 // Caller expressed no opinion, so match everything
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004738 flags |= MATCH_DIRECT_BOOT_AWARE | MATCH_DIRECT_BOOT_UNAWARE;
Jeff Sharkeyc3132512016-01-12 14:06:58 -07004739 }
4740
Jeff Sharkey275e0852014-06-17 18:18:49 -07004741 PackageParser.Package pkg = parser.parseMonolithicPackage(apkFile, 0);
Jeff Sharkeyc4858a22014-06-16 10:51:20 -07004742 if ((flags & GET_SIGNATURES) != 0) {
Svet Ganov354cd3c2015-12-17 11:35:04 -08004743 PackageParser.collectCertificates(pkg, 0);
Jeff Sharkeyc4858a22014-06-16 10:51:20 -07004744 }
4745 PackageUserState state = new PackageUserState();
4746 return PackageParser.generatePackageInfo(pkg, null, flags, 0, 0, null, state);
4747 } catch (PackageParserException e) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004748 return null;
4749 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004750 }
4751
4752 /**
Dianne Hackborn7767eac2012-08-23 18:25:40 -07004753 * If there is already an application with the given package name installed
4754 * on the system for other users, also install it for the calling user.
4755 * @hide
4756 */
Sunny Goyal07f41fb2017-08-09 02:56:34 -07004757 @SystemApi
Nicolas Prevot9a80e532015-09-23 15:49:28 +01004758 public abstract int installExistingPackage(String packageName) throws NameNotFoundException;
4759
4760 /**
4761 * If there is already an application with the given package name installed
Sunny Goyala31a74b2017-05-11 15:59:19 -07004762 * on the system for other users, also install it for the calling user.
4763 * @hide
4764 */
Sunny Goyal07f41fb2017-08-09 02:56:34 -07004765 @SystemApi
Sunny Goyala31a74b2017-05-11 15:59:19 -07004766 public abstract int installExistingPackage(String packageName, @InstallReason int installReason)
4767 throws NameNotFoundException;
4768
4769 /**
4770 * If there is already an application with the given package name installed
Nicolas Prevot9a80e532015-09-23 15:49:28 +01004771 * on the system for other users, also install it for the specified user.
4772 * @hide
4773 */
4774 @RequiresPermission(anyOf = {
4775 Manifest.permission.INSTALL_PACKAGES,
4776 Manifest.permission.INTERACT_ACROSS_USERS_FULL})
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004777 public abstract int installExistingPackageAsUser(String packageName, @UserIdInt int userId)
Dianne Hackborn7767eac2012-08-23 18:25:40 -07004778 throws NameNotFoundException;
4779
4780 /**
Kenny Root5ab21572011-07-27 11:11:19 -07004781 * Allows a package listening to the
4782 * {@link Intent#ACTION_PACKAGE_NEEDS_VERIFICATION package verification
Kenny Root3a9b5fb2011-09-20 14:15:38 -07004783 * broadcast} to respond to the package manager. The response must include
4784 * the {@code verificationCode} which is one of
4785 * {@link PackageManager#VERIFICATION_ALLOW} or
4786 * {@link PackageManager#VERIFICATION_REJECT}.
Kenny Root5ab21572011-07-27 11:11:19 -07004787 *
4788 * @param id pending package identifier as passed via the
kmccormick30498b42013-03-27 17:39:17 -07004789 * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra.
Kenny Root3a9b5fb2011-09-20 14:15:38 -07004790 * @param verificationCode either {@link PackageManager#VERIFICATION_ALLOW}
4791 * or {@link PackageManager#VERIFICATION_REJECT}.
rich cannings7e671512012-08-27 14:44:16 -07004792 * @throws SecurityException if the caller does not have the
Dianne Hackborn8832c182012-09-17 17:20:24 -07004793 * PACKAGE_VERIFICATION_AGENT permission.
Kenny Root5ab21572011-07-27 11:11:19 -07004794 */
Kenny Root3a9b5fb2011-09-20 14:15:38 -07004795 public abstract void verifyPendingInstall(int id, int verificationCode);
Kenny Root5ab21572011-07-27 11:11:19 -07004796
4797 /**
rich canningsd9ef3e52012-08-22 14:28:05 -07004798 * Allows a package listening to the
4799 * {@link Intent#ACTION_PACKAGE_NEEDS_VERIFICATION package verification
4800 * broadcast} to extend the default timeout for a response and declare what
4801 * action to perform after the timeout occurs. The response must include
4802 * the {@code verificationCodeAtTimeout} which is one of
4803 * {@link PackageManager#VERIFICATION_ALLOW} or
4804 * {@link PackageManager#VERIFICATION_REJECT}.
4805 *
4806 * This method may only be called once per package id. Additional calls
4807 * will have no effect.
4808 *
4809 * @param id pending package identifier as passed via the
kmccormick30498b42013-03-27 17:39:17 -07004810 * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra.
rich canningsd9ef3e52012-08-22 14:28:05 -07004811 * @param verificationCodeAtTimeout either
4812 * {@link PackageManager#VERIFICATION_ALLOW} or
rich canningsd1b5cfc2012-08-29 14:49:51 -07004813 * {@link PackageManager#VERIFICATION_REJECT}. If
4814 * {@code verificationCodeAtTimeout} is neither
4815 * {@link PackageManager#VERIFICATION_ALLOW} or
4816 * {@link PackageManager#VERIFICATION_REJECT}, then
4817 * {@code verificationCodeAtTimeout} will default to
rich canningsd9ef3e52012-08-22 14:28:05 -07004818 * {@link PackageManager#VERIFICATION_REJECT}.
4819 * @param millisecondsToDelay the amount of time requested for the timeout.
4820 * Must be positive and less than
rich canningsd1b5cfc2012-08-29 14:49:51 -07004821 * {@link PackageManager#MAXIMUM_VERIFICATION_TIMEOUT}. If
4822 * {@code millisecondsToDelay} is out of bounds,
4823 * {@code millisecondsToDelay} will be set to the closest in
4824 * bounds value; namely, 0 or
rich canningsd9ef3e52012-08-22 14:28:05 -07004825 * {@link PackageManager#MAXIMUM_VERIFICATION_TIMEOUT}.
rich cannings7e671512012-08-27 14:44:16 -07004826 * @throws SecurityException if the caller does not have the
Dianne Hackborn8832c182012-09-17 17:20:24 -07004827 * PACKAGE_VERIFICATION_AGENT permission.
rich canningsd9ef3e52012-08-22 14:28:05 -07004828 */
4829 public abstract void extendVerificationTimeout(int id,
4830 int verificationCodeAtTimeout, long millisecondsToDelay);
4831
4832 /**
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004833 * Allows a package listening to the
Todd Kennedydfa93ab2016-03-03 15:24:33 -08004834 * {@link Intent#ACTION_INTENT_FILTER_NEEDS_VERIFICATION} intent filter verification
4835 * broadcast to respond to the package manager. The response must include
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004836 * the {@code verificationCode} which is one of
4837 * {@link PackageManager#INTENT_FILTER_VERIFICATION_SUCCESS} or
4838 * {@link PackageManager#INTENT_FILTER_VERIFICATION_FAILURE}.
4839 *
4840 * @param verificationId pending package identifier as passed via the
4841 * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra.
4842 * @param verificationCode either {@link PackageManager#INTENT_FILTER_VERIFICATION_SUCCESS}
4843 * or {@link PackageManager#INTENT_FILTER_VERIFICATION_FAILURE}.
Todd Kennedydfa93ab2016-03-03 15:24:33 -08004844 * @param failedDomains a list of failed domains if the verificationCode is
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004845 * {@link PackageManager#INTENT_FILTER_VERIFICATION_FAILURE}, otherwise null;
4846 * @throws SecurityException if the caller does not have the
4847 * INTENT_FILTER_VERIFICATION_AGENT permission.
4848 *
4849 * @hide
4850 */
Fabrice Di Meglioef741da2015-05-12 16:31:38 -07004851 @SystemApi
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06004852 @RequiresPermission(android.Manifest.permission.INTENT_FILTER_VERIFICATION_AGENT)
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004853 public abstract void verifyIntentFilter(int verificationId, int verificationCode,
Todd Kennedydfa93ab2016-03-03 15:24:33 -08004854 List<String> failedDomains);
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004855
4856 /**
4857 * Get the status of a Domain Verification Result for an IntentFilter. This is
4858 * related to the {@link android.content.IntentFilter#setAutoVerify(boolean)} and
4859 * {@link android.content.IntentFilter#getAutoVerify()}
4860 *
4861 * This is used by the ResolverActivity to change the status depending on what the User select
4862 * in the Disambiguation Dialog and also used by the Settings App for changing the default App
4863 * for a domain.
4864 *
4865 * @param packageName The package name of the Activity associated with the IntentFilter.
4866 * @param userId The user id.
4867 *
4868 * @return The status to set to. This can be
4869 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK} or
4870 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS} or
4871 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER} or
4872 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED}
4873 *
4874 * @hide
4875 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08004876 @SystemApi
Todd Kennedydbaef6d2017-07-24 11:28:00 -07004877 @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS_FULL)
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004878 public abstract int getIntentVerificationStatusAsUser(String packageName, @UserIdInt int userId);
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004879
4880 /**
4881 * Allow to change the status of a Intent Verification status for all IntentFilter of an App.
4882 * This is related to the {@link android.content.IntentFilter#setAutoVerify(boolean)} and
4883 * {@link android.content.IntentFilter#getAutoVerify()}
4884 *
4885 * This is used by the ResolverActivity to change the status depending on what the User select
4886 * in the Disambiguation Dialog and also used by the Settings App for changing the default App
4887 * for a domain.
4888 *
4889 * @param packageName The package name of the Activity associated with the IntentFilter.
4890 * @param status The status to set to. This can be
4891 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK} or
4892 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS} or
4893 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER}
4894 * @param userId The user id.
4895 *
4896 * @return true if the status has been set. False otherwise.
4897 *
4898 * @hide
4899 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08004900 @SystemApi
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06004901 @RequiresPermission(android.Manifest.permission.SET_PREFERRED_APPLICATIONS)
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07004902 public abstract boolean updateIntentVerificationStatusAsUser(String packageName, int status,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004903 @UserIdInt int userId);
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004904
4905 /**
4906 * Get the list of IntentFilterVerificationInfo for a specific package and User.
4907 *
4908 * @param packageName the package name. When this parameter is set to a non null value,
4909 * the results will be filtered by the package name provided.
4910 * Otherwise, there will be no filtering and it will return a list
Fabrice Di Meglio07885952015-04-06 19:41:28 -07004911 * corresponding for all packages
4912 *
4913 * @return a list of IntentFilterVerificationInfo for a specific package.
4914 *
4915 * @hide
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004916 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08004917 @SystemApi
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004918 public abstract List<IntentFilterVerificationInfo> getIntentFilterVerifications(
4919 String packageName);
4920
4921 /**
Fabrice Di Meglio07885952015-04-06 19:41:28 -07004922 * Get the list of IntentFilter for a specific package.
4923 *
4924 * @param packageName the package name. This parameter is set to a non null value,
4925 * the list will contain all the IntentFilter for that package.
4926 * Otherwise, the list will be empty.
4927 *
4928 * @return a list of IntentFilter for a specific package.
4929 *
4930 * @hide
4931 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08004932 @SystemApi
Fabrice Di Meglio07885952015-04-06 19:41:28 -07004933 public abstract List<IntentFilter> getAllIntentFilters(String packageName);
4934
4935 /**
Fabrice Di Meglio62271722015-04-10 17:24:02 -07004936 * Get the default Browser package name for a specific user.
4937 *
4938 * @param userId The user id.
4939 *
4940 * @return the package name of the default Browser for the specified user. If the user id passed
4941 * is -1 (all users) it will return a null value.
4942 *
4943 * @hide
4944 */
Jeff Sharkeya73b8fd2016-01-06 17:02:08 -07004945 @TestApi
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08004946 @SystemApi
Todd Kennedydbaef6d2017-07-24 11:28:00 -07004947 @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS_FULL)
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004948 public abstract String getDefaultBrowserPackageNameAsUser(@UserIdInt int userId);
Fabrice Di Meglio62271722015-04-10 17:24:02 -07004949
4950 /**
4951 * Set the default Browser package name for a specific user.
4952 *
4953 * @param packageName The package name of the default Browser.
4954 * @param userId The user id.
4955 *
4956 * @return true if the default Browser for the specified user has been set,
4957 * otherwise return false. If the user id passed is -1 (all users) this call will not
4958 * do anything and just return false.
4959 *
4960 * @hide
4961 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08004962 @SystemApi
Todd Kennedydbaef6d2017-07-24 11:28:00 -07004963 @RequiresPermission(allOf = {
4964 Manifest.permission.SET_PREFERRED_APPLICATIONS,
4965 Manifest.permission.INTERACT_ACROSS_USERS_FULL})
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004966 public abstract boolean setDefaultBrowserPackageNameAsUser(String packageName,
4967 @UserIdInt int userId);
Fabrice Di Meglio62271722015-04-10 17:24:02 -07004968
4969 /**
Dianne Hackborn880119b2010-11-18 22:26:40 -08004970 * Change the installer associated with a given package. There are limitations
4971 * on how the installer package can be changed; in particular:
4972 * <ul>
4973 * <li> A SecurityException will be thrown if <var>installerPackageName</var>
4974 * is not signed with the same certificate as the calling application.
4975 * <li> A SecurityException will be thrown if <var>targetPackage</var> already
4976 * has an installer package, and that installer package is not signed with
4977 * the same certificate as the calling application.
4978 * </ul>
4979 *
4980 * @param targetPackage The installed package whose installer will be changed.
4981 * @param installerPackageName The package name of the new installer. May be
4982 * null to clear the association.
4983 */
4984 public abstract void setInstallerPackageName(String targetPackage,
4985 String installerPackageName);
4986
Todd Kennedyab532892017-03-08 14:19:49 -08004987 /** @hide */
4988 @SystemApi
4989 @RequiresPermission(Manifest.permission.INSTALL_PACKAGES)
4990 public abstract void setUpdateAvailable(String packageName, boolean updateAvaialble);
4991
Dianne Hackborn880119b2010-11-18 22:26:40 -08004992 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07004993 * Attempts to delete a package. Since this may take a little while, the
4994 * result will be posted back to the given observer. A deletion will fail if
4995 * the calling context lacks the
4996 * {@link android.Manifest.permission#DELETE_PACKAGES} permission, if the
4997 * named package cannot be found, or if the named package is a system
4998 * package.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004999 *
5000 * @param packageName The name of the package to delete
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005001 * @param observer An observer callback to get notified when the package
5002 * deletion is complete.
5003 * {@link android.content.pm.IPackageDeleteObserver#packageDeleted}
5004 * will be called when that happens. observer may be null to
5005 * indicate that no callback is desired.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005006 * @hide
5007 */
Svet Ganov67882122016-12-11 16:36:34 -08005008 @RequiresPermission(Manifest.permission.DELETE_PACKAGES)
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005009 public abstract void deletePackage(String packageName, IPackageDeleteObserver observer,
5010 @DeleteFlags int flags);
Jacek Surazski65e13172009-04-28 15:26:38 +02005011
5012 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005013 * Attempts to delete a package. Since this may take a little while, the
5014 * result will be posted back to the given observer. A deletion will fail if
5015 * the named package cannot be found, or if the named package is a system
5016 * package.
Nicolas Prevot9a80e532015-09-23 15:49:28 +01005017 *
5018 * @param packageName The name of the package to delete
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005019 * @param observer An observer callback to get notified when the package
5020 * deletion is complete.
5021 * {@link android.content.pm.IPackageDeleteObserver#packageDeleted}
5022 * will be called when that happens. observer may be null to
5023 * indicate that no callback is desired.
Nicolas Prevot9a80e532015-09-23 15:49:28 +01005024 * @param userId The user Id
Nicolas Prevot9a80e532015-09-23 15:49:28 +01005025 * @hide
5026 */
Svet Ganov67882122016-12-11 16:36:34 -08005027 @RequiresPermission(anyOf = {
Nicolas Prevot9a80e532015-09-23 15:49:28 +01005028 Manifest.permission.DELETE_PACKAGES,
5029 Manifest.permission.INTERACT_ACROSS_USERS_FULL})
Svet Ganov67882122016-12-11 16:36:34 -08005030 public abstract void deletePackageAsUser(@NonNull String packageName,
5031 IPackageDeleteObserver observer, @DeleteFlags int flags, @UserIdInt int userId);
Nicolas Prevot9a80e532015-09-23 15:49:28 +01005032
5033 /**
Jacek Surazski65e13172009-04-28 15:26:38 +02005034 * Retrieve the package name of the application that installed a package. This identifies
5035 * which market the package came from.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005036 *
Jacek Surazski65e13172009-04-28 15:26:38 +02005037 * @param packageName The name of the package to query
5038 */
5039 public abstract String getInstallerPackageName(String packageName);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005040
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005041 /**
5042 * Attempts to clear the user data directory of an application.
5043 * Since this may take a little while, the result will
5044 * be posted back to the given observer. A deletion will fail if the
5045 * named package cannot be found, or if the named package is a "system package".
5046 *
5047 * @param packageName The name of the package
5048 * @param observer An observer callback to get notified when the operation is finished
5049 * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)}
5050 * will be called when that happens. observer may be null to indicate that
5051 * no callback is desired.
5052 *
5053 * @hide
5054 */
5055 public abstract void clearApplicationUserData(String packageName,
5056 IPackageDataObserver observer);
5057 /**
5058 * Attempts to delete the cache files associated with an application.
5059 * Since this may take a little while, the result will
5060 * be posted back to the given observer. A deletion will fail if the calling context
5061 * lacks the {@link android.Manifest.permission#DELETE_CACHE_FILES} permission, if the
5062 * named package cannot be found, or if the named package is a "system package".
5063 *
5064 * @param packageName The name of the package to delete
5065 * @param observer An observer callback to get notified when the cache file deletion
5066 * is complete.
5067 * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)}
5068 * will be called when that happens. observer may be null to indicate that
5069 * no callback is desired.
5070 *
5071 * @hide
5072 */
5073 public abstract void deleteApplicationCacheFiles(String packageName,
5074 IPackageDataObserver observer);
5075
5076 /**
Suprabh Shukla78c9eb82016-04-12 15:51:35 -07005077 * Attempts to delete the cache files associated with an application for a given user. Since
5078 * this may take a little while, the result will be posted back to the given observer. A
5079 * deletion will fail if the calling context lacks the
5080 * {@link android.Manifest.permission#DELETE_CACHE_FILES} permission, if the named package
5081 * cannot be found, or if the named package is a "system package". If {@code userId} does not
5082 * belong to the calling user, the caller must have
5083 * {@link android.Manifest.permission#INTERACT_ACROSS_USERS} permission.
5084 *
5085 * @param packageName The name of the package to delete
5086 * @param userId the user for which the cache files needs to be deleted
5087 * @param observer An observer callback to get notified when the cache file deletion is
5088 * complete.
5089 * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)}
5090 * will be called when that happens. observer may be null to indicate that no
5091 * callback is desired.
5092 * @hide
5093 */
5094 public abstract void deleteApplicationCacheFilesAsUser(String packageName, int userId,
5095 IPackageDataObserver observer);
5096
5097 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005098 * Free storage by deleting LRU sorted list of cache files across
5099 * all applications. If the currently available free storage
5100 * on the device is greater than or equal to the requested
5101 * free storage, no cache files are cleared. If the currently
5102 * available storage on the device is less than the requested
5103 * free storage, some or all of the cache files across
5104 * all applications are deleted (based on last accessed time)
5105 * to increase the free storage space on the device to
5106 * the requested value. There is no guarantee that clearing all
5107 * the cache files from all applications will clear up
5108 * enough storage to achieve the desired value.
5109 * @param freeStorageSize The number of bytes of storage to be
5110 * freed by the system. Say if freeStorageSize is XX,
5111 * and the current free storage is YY,
5112 * if XX is less than YY, just return. if not free XX-YY number
5113 * of bytes if possible.
5114 * @param observer call back used to notify when
5115 * the operation is completed
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005116 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005117 * @hide
5118 */
Jeff Sharkey529f91f2015-04-18 20:23:13 -07005119 public void freeStorageAndNotify(long freeStorageSize, IPackageDataObserver observer) {
5120 freeStorageAndNotify(null, freeStorageSize, observer);
5121 }
5122
5123 /** {@hide} */
5124 public abstract void freeStorageAndNotify(String volumeUuid, long freeStorageSize,
5125 IPackageDataObserver observer);
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -07005126
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005127 /**
5128 * Free storage by deleting LRU sorted list of cache files across
5129 * all applications. If the currently available free storage
5130 * on the device is greater than or equal to the requested
5131 * free storage, no cache files are cleared. If the currently
5132 * available storage on the device is less than the requested
5133 * free storage, some or all of the cache files across
5134 * all applications are deleted (based on last accessed time)
5135 * to increase the free storage space on the device to
5136 * the requested value. There is no guarantee that clearing all
5137 * the cache files from all applications will clear up
5138 * enough storage to achieve the desired value.
5139 * @param freeStorageSize The number of bytes of storage to be
5140 * freed by the system. Say if freeStorageSize is XX,
5141 * and the current free storage is YY,
5142 * if XX is less than YY, just return. if not free XX-YY number
5143 * of bytes if possible.
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -07005144 * @param pi IntentSender call back used to
5145 * notify when the operation is completed.May be null
5146 * to indicate that no call back is desired.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005147 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005148 * @hide
5149 */
Jeff Sharkey529f91f2015-04-18 20:23:13 -07005150 public void freeStorage(long freeStorageSize, IntentSender pi) {
5151 freeStorage(null, freeStorageSize, pi);
5152 }
5153
5154 /** {@hide} */
5155 public abstract void freeStorage(String volumeUuid, long freeStorageSize, IntentSender pi);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005156
5157 /**
5158 * Retrieve the size information for a package.
5159 * Since this may take a little while, the result will
5160 * be posted back to the given observer. The calling context
5161 * should have the {@link android.Manifest.permission#GET_PACKAGE_SIZE} permission.
5162 *
5163 * @param packageName The name of the package whose size information is to be retrieved
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07005164 * @param userId The user whose size information should be retrieved.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005165 * @param observer An observer callback to get notified when the operation
5166 * is complete.
5167 * {@link android.content.pm.IPackageStatsObserver#onGetStatsCompleted(PackageStats, boolean)}
5168 * The observer's callback is invoked with a PackageStats object(containing the
5169 * code, data and cache sizes of the package) and a boolean value representing
5170 * the status of the operation. observer may be null to indicate that
5171 * no callback is desired.
5172 *
Jeff Sharkey60f95aa2017-03-08 13:57:15 -07005173 * @deprecated use {@link StorageStatsManager} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005174 * @hide
5175 */
Jeff Sharkey60f95aa2017-03-08 13:57:15 -07005176 @Deprecated
Jeff Sharkey8588bc12016-01-06 16:47:42 -07005177 public abstract void getPackageSizeInfoAsUser(String packageName, @UserIdInt int userId,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005178 IPackageStatsObserver observer);
5179
5180 /**
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07005181 * Like {@link #getPackageSizeInfoAsUser(String, int, IPackageStatsObserver)}, but
Dianne Hackborn0c380492012-08-20 17:23:30 -07005182 * returns the size for the calling user.
5183 *
Jeff Sharkey60f95aa2017-03-08 13:57:15 -07005184 * @deprecated use {@link StorageStatsManager} instead.
Dianne Hackborn0c380492012-08-20 17:23:30 -07005185 * @hide
5186 */
Jeff Sharkey60f95aa2017-03-08 13:57:15 -07005187 @Deprecated
Dianne Hackborn0c380492012-08-20 17:23:30 -07005188 public void getPackageSizeInfo(String packageName, IPackageStatsObserver observer) {
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07005189 getPackageSizeInfoAsUser(packageName, UserHandle.myUserId(), observer);
Dianne Hackborn0c380492012-08-20 17:23:30 -07005190 }
5191
5192 /**
Dianne Hackborna7ca0e52009-12-01 14:31:55 -08005193 * @deprecated This function no longer does anything; it was an old
kmccormickac66b852013-03-28 15:17:15 -07005194 * approach to managing preferred activities, which has been superseded
5195 * by (and conflicts with) the modern activity-based preferences.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005196 */
Dianne Hackborna7ca0e52009-12-01 14:31:55 -08005197 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005198 public abstract void addPackageToPreferred(String packageName);
5199
5200 /**
Dianne Hackborna7ca0e52009-12-01 14:31:55 -08005201 * @deprecated This function no longer does anything; it was an old
kmccormickac66b852013-03-28 15:17:15 -07005202 * approach to managing preferred activities, which has been superseded
5203 * by (and conflicts with) the modern activity-based preferences.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005204 */
Dianne Hackborna7ca0e52009-12-01 14:31:55 -08005205 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005206 public abstract void removePackageFromPreferred(String packageName);
5207
5208 /**
Jeff Sharkey4347f812017-04-21 12:08:39 -06005209 * Retrieve the list of all currently configured preferred packages. The
5210 * first package on the list is the most preferred, the last is the least
5211 * preferred.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005212 *
Jeff Sharkey4347f812017-04-21 12:08:39 -06005213 * @param flags Additional option flags to modify the data returned.
5214 * @return A List of PackageInfo objects, one for each preferred
5215 * application, in order of preference.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005216 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07005217 public abstract List<PackageInfo> getPreferredPackages(@PackageInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005218
5219 /**
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08005220 * @deprecated This is a protected API that should not have been available
5221 * to third party applications. It is the platform's responsibility for
kmccormick30498b42013-03-27 17:39:17 -07005222 * assigning preferred activities and this cannot be directly modified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005223 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005224 * Add a new preferred activity mapping to the system. This will be used
5225 * to automatically select the given activity component when
5226 * {@link Context#startActivity(Intent) Context.startActivity()} finds
5227 * multiple matching activities and also matches the given filter.
5228 *
5229 * @param filter The set of intents under which this activity will be
5230 * made preferred.
5231 * @param match The IntentFilter match category that this preference
5232 * applies to.
5233 * @param set The set of activities that the user was picking from when
5234 * this preference was made.
5235 * @param activity The component name of the activity that is to be
5236 * preferred.
5237 */
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08005238 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005239 public abstract void addPreferredActivity(IntentFilter filter, int match,
5240 ComponentName[] set, ComponentName activity);
5241
5242 /**
Amith Yamasania3f133a2012-08-09 17:11:28 -07005243 * Same as {@link #addPreferredActivity(IntentFilter, int,
5244 ComponentName[], ComponentName)}, but with a specific userId to apply the preference
5245 to.
5246 * @hide
5247 */
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07005248 public void addPreferredActivityAsUser(IntentFilter filter, int match,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07005249 ComponentName[] set, ComponentName activity, @UserIdInt int userId) {
Amith Yamasania3f133a2012-08-09 17:11:28 -07005250 throw new RuntimeException("Not implemented. Must override in a subclass.");
5251 }
5252
5253 /**
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08005254 * @deprecated This is a protected API that should not have been available
5255 * to third party applications. It is the platform's responsibility for
kmccormick30498b42013-03-27 17:39:17 -07005256 * assigning preferred activities and this cannot be directly modified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005257 *
Satish Sampath8dbe6122009-06-02 23:35:54 +01005258 * Replaces an existing preferred activity mapping to the system, and if that were not present
5259 * adds a new preferred activity. This will be used
5260 * to automatically select the given activity component when
5261 * {@link Context#startActivity(Intent) Context.startActivity()} finds
5262 * multiple matching activities and also matches the given filter.
5263 *
5264 * @param filter The set of intents under which this activity will be
5265 * made preferred.
5266 * @param match The IntentFilter match category that this preference
5267 * applies to.
5268 * @param set The set of activities that the user was picking from when
5269 * this preference was made.
5270 * @param activity The component name of the activity that is to be
5271 * preferred.
5272 * @hide
5273 */
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08005274 @Deprecated
Satish Sampath8dbe6122009-06-02 23:35:54 +01005275 public abstract void replacePreferredActivity(IntentFilter filter, int match,
5276 ComponentName[] set, ComponentName activity);
5277
5278 /**
Amith Yamasani41c1ded2014-08-05 11:15:05 -07005279 * @hide
5280 */
5281 @Deprecated
5282 public void replacePreferredActivityAsUser(IntentFilter filter, int match,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07005283 ComponentName[] set, ComponentName activity, @UserIdInt int userId) {
Amith Yamasani41c1ded2014-08-05 11:15:05 -07005284 throw new RuntimeException("Not implemented. Must override in a subclass.");
5285 }
5286
5287 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005288 * Remove all preferred activity mappings, previously added with
5289 * {@link #addPreferredActivity}, from the
5290 * system whose activities are implemented in the given package name.
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08005291 * An application can only clear its own package(s).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005292 *
5293 * @param packageName The name of the package whose preferred activity
5294 * mappings are to be removed.
5295 */
5296 public abstract void clearPackagePreferredActivities(String packageName);
5297
5298 /**
5299 * Retrieve all preferred activities, previously added with
5300 * {@link #addPreferredActivity}, that are
5301 * currently registered with the system.
5302 *
John Spurlock38e64252015-03-18 12:09:32 -04005303 * @param outFilters A required list in which to place the filters of all of the
5304 * preferred activities.
5305 * @param outActivities A required list in which to place the component names of
5306 * all of the preferred activities.
5307 * @param packageName An optional package in which you would like to limit
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005308 * the list. If null, all activities will be returned; if non-null, only
5309 * those activities in the given package are returned.
5310 *
5311 * @return Returns the total number of registered preferred activities
5312 * (the number of distinct IntentFilter records, not the number of unique
5313 * activity components) that were found.
5314 */
John Spurlock38e64252015-03-18 12:09:32 -04005315 public abstract int getPreferredActivities(@NonNull List<IntentFilter> outFilters,
5316 @NonNull List<ComponentName> outActivities, String packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005317
5318 /**
Christopher Tatea2a0850d2013-09-05 16:38:58 -07005319 * Ask for the set of available 'home' activities and the current explicit
5320 * default, if any.
5321 * @hide
5322 */
5323 public abstract ComponentName getHomeActivities(List<ResolveInfo> outActivities);
5324
5325 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005326 * Set the enabled setting for a package component (activity, receiver, service, provider).
5327 * This setting will override any enabled state which may have been set by the component in its
5328 * manifest.
5329 *
5330 * @param componentName The component to enable
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06005331 * @param newState The new enabled state for the component.
5332 * @param flags Optional behavior flags.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005333 */
5334 public abstract void setComponentEnabledSetting(ComponentName componentName,
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06005335 @EnabledState int newState, @EnabledFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005336
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005337 /**
Amaury Medeirosdde24262014-06-03 20:06:41 -03005338 * Return the enabled setting for a package component (activity,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005339 * receiver, service, provider). This returns the last value set by
5340 * {@link #setComponentEnabledSetting(ComponentName, int, int)}; in most
5341 * cases this value will be {@link #COMPONENT_ENABLED_STATE_DEFAULT} since
5342 * the value originally specified in the manifest has not been modified.
5343 *
5344 * @param componentName The component to retrieve.
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06005345 * @return Returns the current enabled state for the component.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005346 */
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06005347 public abstract @EnabledState int getComponentEnabledSetting(
5348 ComponentName componentName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005349
5350 /**
5351 * Set the enabled setting for an application
5352 * This setting will override any enabled state which may have been set by the application in
5353 * its manifest. It also overrides the enabled state set in the manifest for any of the
5354 * application's components. It does not override any enabled state set by
5355 * {@link #setComponentEnabledSetting} for any of the application's components.
5356 *
5357 * @param packageName The package name of the application to enable
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06005358 * @param newState The new enabled state for the application.
5359 * @param flags Optional behavior flags.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005360 */
5361 public abstract void setApplicationEnabledSetting(String packageName,
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06005362 @EnabledState int newState, @EnabledFlags int flags);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005363
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005364 /**
Amaury Medeirosdde24262014-06-03 20:06:41 -03005365 * Return the enabled setting for an application. This returns
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005366 * the last value set by
5367 * {@link #setApplicationEnabledSetting(String, int, int)}; in most
5368 * cases this value will be {@link #COMPONENT_ENABLED_STATE_DEFAULT} since
5369 * the value originally specified in the manifest has not been modified.
5370 *
Amaury Medeirosdde24262014-06-03 20:06:41 -03005371 * @param packageName The package name of the application to retrieve.
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06005372 * @return Returns the current enabled state for the application.
Mathew Inwood1b9f8d92011-09-26 13:23:56 +01005373 * @throws IllegalArgumentException if the named package does not exist.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005374 */
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06005375 public abstract @EnabledState int getApplicationEnabledSetting(String packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005376
5377 /**
Sudheer Shankabbb3ff22015-07-09 15:39:23 +01005378 * Flush the package restrictions for a given user to disk. This forces the package restrictions
5379 * like component and package enabled settings to be written to disk and avoids the delay that
5380 * is otherwise present when changing those settings.
5381 *
5382 * @param userId Ther userId of the user whose restrictions are to be flushed.
5383 * @hide
5384 */
5385 public abstract void flushPackageRestrictionsAsUser(int userId);
5386
5387 /**
Amith Yamasanie5bcff62014-07-19 15:44:09 -07005388 * Puts the package in a hidden state, which is almost like an uninstalled state,
Amith Yamasani655d0e22013-06-12 14:19:10 -07005389 * making the package unavailable, but it doesn't remove the data or the actual
Amith Yamasanie5bcff62014-07-19 15:44:09 -07005390 * package file. Application can be unhidden by either resetting the hidden state
5391 * or by installing it, such as with {@link #installExistingPackage(String)}
Amith Yamasani655d0e22013-06-12 14:19:10 -07005392 * @hide
5393 */
Amith Yamasanie5bcff62014-07-19 15:44:09 -07005394 public abstract boolean setApplicationHiddenSettingAsUser(String packageName, boolean hidden,
Amith Yamasani655d0e22013-06-12 14:19:10 -07005395 UserHandle userHandle);
5396
5397 /**
Amith Yamasanie5bcff62014-07-19 15:44:09 -07005398 * Returns the hidden state of a package.
5399 * @see #setApplicationHiddenSettingAsUser(String, boolean, UserHandle)
Amith Yamasani655d0e22013-06-12 14:19:10 -07005400 * @hide
5401 */
Amith Yamasanie5bcff62014-07-19 15:44:09 -07005402 public abstract boolean getApplicationHiddenSettingAsUser(String packageName,
Amith Yamasani655d0e22013-06-12 14:19:10 -07005403 UserHandle userHandle);
5404
5405 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005406 * Return whether the device has been booted into safe mode.
5407 */
5408 public abstract boolean isSafeMode();
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08005409
5410 /**
Svetoslavf7c06eb2015-06-10 18:43:22 -07005411 * Adds a listener for permission changes for installed packages.
5412 *
5413 * @param listener The listener to add.
5414 *
5415 * @hide
5416 */
5417 @SystemApi
5418 @RequiresPermission(Manifest.permission.OBSERVE_GRANT_REVOKE_PERMISSIONS)
5419 public abstract void addOnPermissionsChangeListener(OnPermissionsChangedListener listener);
5420
5421 /**
5422 * Remvoes a listener for permission changes for installed packages.
5423 *
5424 * @param listener The listener to remove.
5425 *
5426 * @hide
5427 */
5428 @SystemApi
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06005429 @RequiresPermission(Manifest.permission.OBSERVE_GRANT_REVOKE_PERMISSIONS)
Svetoslavf7c06eb2015-06-10 18:43:22 -07005430 public abstract void removeOnPermissionsChangeListener(OnPermissionsChangedListener listener);
5431
5432 /**
dcashman9d2f4412014-06-09 09:27:54 -07005433 * Return the {@link KeySet} associated with the String alias for this
5434 * application.
5435 *
5436 * @param alias The alias for a given {@link KeySet} as defined in the
5437 * application's AndroidManifest.xml.
dcashmanc6f22492014-08-14 09:54:51 -07005438 * @hide
dcashman9d2f4412014-06-09 09:27:54 -07005439 */
5440 public abstract KeySet getKeySetByAlias(String packageName, String alias);
5441
Ihab Awad1ec68882014-09-12 11:09:01 -07005442 /** Return the signing {@link KeySet} for this application.
dcashmanc6f22492014-08-14 09:54:51 -07005443 * @hide
5444 */
dcashman9d2f4412014-06-09 09:27:54 -07005445 public abstract KeySet getSigningKeySet(String packageName);
5446
5447 /**
5448 * Return whether the package denoted by packageName has been signed by all
5449 * of the keys specified by the {@link KeySet} ks. This will return true if
5450 * the package has been signed by additional keys (a superset) as well.
5451 * Compare to {@link #isSignedByExactly(String packageName, KeySet ks)}.
dcashmanc6f22492014-08-14 09:54:51 -07005452 * @hide
dcashman9d2f4412014-06-09 09:27:54 -07005453 */
5454 public abstract boolean isSignedBy(String packageName, KeySet ks);
5455
5456 /**
5457 * Return whether the package denoted by packageName has been signed by all
5458 * of, and only, the keys specified by the {@link KeySet} ks. Compare to
5459 * {@link #isSignedBy(String packageName, KeySet ks)}.
dcashmanc6f22492014-08-14 09:54:51 -07005460 * @hide
dcashman9d2f4412014-06-09 09:27:54 -07005461 */
5462 public abstract boolean isSignedByExactly(String packageName, KeySet ks);
5463
5464 /**
Andrei Stingaceanueb84b182016-01-26 18:39:55 +00005465 * Puts the package in a suspended state, where attempts at starting activities are denied.
Andrei Stingaceanu1e283912015-11-26 15:26:28 +00005466 *
Andrei Stingaceanueb84b182016-01-26 18:39:55 +00005467 * <p>It doesn't remove the data or the actual package file. The application notifications
5468 * will be hidden, the application will not show up in recents, will not be able to show
5469 * toasts or dialogs or ring the device.
5470 *
Kenny Guy871f3eb2016-03-09 20:06:16 +00005471 * <p>The package must already be installed. If the package is uninstalled while suspended
5472 * the package will no longer be suspended.
5473 *
Andrei Stingaceanueb84b182016-01-26 18:39:55 +00005474 * @param packageNames The names of the packages to set the suspended status.
5475 * @param suspended If set to {@code true} than the packages will be suspended, if set to
5476 * {@code false} the packages will be unsuspended.
Andrei Stingaceanu1e283912015-11-26 15:26:28 +00005477 * @param userId The user id.
5478 *
Andrei Stingaceanueb84b182016-01-26 18:39:55 +00005479 * @return an array of package names for which the suspended status is not set as requested in
5480 * this method.
5481 *
Andrei Stingaceanu1e283912015-11-26 15:26:28 +00005482 * @hide
5483 */
Andrei Stingaceanueb84b182016-01-26 18:39:55 +00005484 public abstract String[] setPackagesSuspendedAsUser(
5485 String[] packageNames, boolean suspended, @UserIdInt int userId);
Andrei Stingaceanu1e283912015-11-26 15:26:28 +00005486
Andrei Stingaceanu355b2322016-02-12 16:43:51 +00005487 /**
5488 * @see #setPackageSuspendedAsUser(String, boolean, int)
5489 * @param packageName The name of the package to get the suspended status of.
5490 * @param userId The user id.
5491 * @return {@code true} if the package is suspended or {@code false} if the package is not
5492 * suspended or could not be found.
5493 * @hide
5494 */
5495 public abstract boolean isPackageSuspendedForUser(String packageName, int userId);
5496
Jeff Sharkey9bc89af2017-01-11 11:25:50 -07005497 /**
5498 * Provide a hint of what the {@link ApplicationInfo#category} value should
5499 * be for the given package.
5500 * <p>
5501 * This hint can only be set by the app which installed this package, as
5502 * determined by {@link #getInstallerPackageName(String)}.
Jeff Sharkey60a82cd2017-04-18 18:19:16 -06005503 *
5504 * @param packageName the package to change the category hint for.
Jeff Sharkey4347f812017-04-21 12:08:39 -06005505 * @param categoryHint the category hint to set.
Jeff Sharkey9bc89af2017-01-11 11:25:50 -07005506 */
Jeff Sharkey60a82cd2017-04-18 18:19:16 -06005507 public abstract void setApplicationCategoryHint(@NonNull String packageName,
Jeff Sharkey9bc89af2017-01-11 11:25:50 -07005508 @ApplicationInfo.Category int categoryHint);
5509
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -07005510 /** {@hide} */
Jeff Sharkey620b32b2015-04-23 19:36:02 -07005511 public static boolean isMoveStatusFinished(int status) {
5512 return (status < 0 || status > 100);
5513 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005514
Jeff Sharkeye2d45be2015-04-15 17:14:12 -07005515 /** {@hide} */
Jeff Sharkey620b32b2015-04-23 19:36:02 -07005516 public static abstract class MoveCallback {
Jeff Sharkey50a05452015-04-29 11:24:52 -07005517 public void onCreated(int moveId, Bundle extras) {}
5518 public abstract void onStatusChanged(int moveId, int status, long estMillis);
Jeff Sharkey620b32b2015-04-23 19:36:02 -07005519 }
Jeff Sharkeye2d45be2015-04-15 17:14:12 -07005520
5521 /** {@hide} */
Jeff Sharkey620b32b2015-04-23 19:36:02 -07005522 public abstract int getMoveStatus(int moveId);
5523
5524 /** {@hide} */
5525 public abstract void registerMoveCallback(MoveCallback callback, Handler handler);
5526 /** {@hide} */
5527 public abstract void unregisterMoveCallback(MoveCallback callback);
5528
5529 /** {@hide} */
5530 public abstract int movePackage(String packageName, VolumeInfo vol);
5531 /** {@hide} */
5532 public abstract @Nullable VolumeInfo getPackageCurrentVolume(ApplicationInfo app);
5533 /** {@hide} */
5534 public abstract @NonNull List<VolumeInfo> getPackageCandidateVolumes(ApplicationInfo app);
5535
5536 /** {@hide} */
5537 public abstract int movePrimaryStorage(VolumeInfo vol);
5538 /** {@hide} */
5539 public abstract @Nullable VolumeInfo getPrimaryStorageCurrentVolume();
5540 /** {@hide} */
5541 public abstract @NonNull List<VolumeInfo> getPrimaryStorageCandidateVolumes();
Jeff Sharkeye2d45be2015-04-15 17:14:12 -07005542
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005543 /**
Amith Yamasani13593602012-03-22 16:16:17 -07005544 * Returns the device identity that verifiers can use to associate their scheme to a particular
5545 * device. This should not be used by anything other than a package verifier.
Aravind Akella068b0c02013-10-12 17:39:15 -07005546 *
Kenny Root0aaa0d92011-09-12 16:42:55 -07005547 * @return identity that uniquely identifies current device
5548 * @hide
5549 */
5550 public abstract VerifierDeviceIdentity getVerifierDeviceIdentity();
Amith Yamasani742a6712011-05-04 14:49:28 -07005551
Jeff Sharkey6c833e02014-07-14 22:44:30 -07005552 /**
Jeff Hao9f60c082014-10-28 18:51:07 -07005553 * Returns true if the device is upgrading, such as first boot after OTA.
5554 *
5555 * @hide
5556 */
5557 public abstract boolean isUpgrade();
5558
5559 /**
Jeff Sharkey6c833e02014-07-14 22:44:30 -07005560 * Return interface that offers the ability to install, upgrade, and remove
5561 * applications on the device.
5562 */
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005563 public abstract @NonNull PackageInstaller getPackageInstaller();
Jeff Sharkey3a44f3f2014-04-28 17:36:31 -07005564
Amith Yamasani742a6712011-05-04 14:49:28 -07005565 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005566 * Adds a {@code CrossProfileIntentFilter}. After calling this method all
5567 * intents sent from the user with id sourceUserId can also be be resolved
5568 * by activities in the user with id targetUserId if they match the
5569 * specified intent filter.
5570 *
Nicolas Prevot3f7777f2014-07-24 15:58:39 +01005571 * @param filter The {@link IntentFilter} the intent has to match
5572 * @param sourceUserId The source user id.
5573 * @param targetUserId The target user id.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005574 * @param flags The possible values are {@link #SKIP_CURRENT_PROFILE} and
5575 * {@link #ONLY_IF_NO_MATCH_FOUND}.
Nicolas Prevotc79586e2014-05-06 12:47:57 +01005576 * @hide
5577 */
Nicolas Prevot63798c52014-05-27 13:22:38 +01005578 public abstract void addCrossProfileIntentFilter(IntentFilter filter, int sourceUserId,
5579 int targetUserId, int flags);
Nicolas Prevotc79586e2014-05-06 12:47:57 +01005580
5581 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005582 * Clearing {@code CrossProfileIntentFilter}s which have the specified user
5583 * as their source, and have been set by the app calling this method.
5584 *
Nicolas Prevot3f7777f2014-07-24 15:58:39 +01005585 * @param sourceUserId The source user id.
Nicolas Prevotc79586e2014-05-06 12:47:57 +01005586 * @hide
5587 */
Nicolas Prevot81948992014-05-16 18:25:26 +01005588 public abstract void clearCrossProfileIntentFilters(int sourceUserId);
Alexandra Gherghina6e2ae252014-06-12 16:03:58 +01005589
5590 /**
Nicolas Prevot88cc3462014-05-14 14:51:48 +01005591 * @hide
5592 */
Nicolas Prevot7f7b0c72014-06-23 15:59:38 +01005593 public abstract Drawable loadItemIcon(PackageItemInfo itemInfo, ApplicationInfo appInfo);
Jeff Sharkey6c833e02014-07-14 22:44:30 -07005594
Benjamin Franzec2d48b2014-10-01 15:38:43 +01005595 /**
5596 * @hide
5597 */
5598 public abstract Drawable loadUnbadgedItemIcon(PackageItemInfo itemInfo, ApplicationInfo appInfo);
5599
Jeff Sharkey6c833e02014-07-14 22:44:30 -07005600 /** {@hide} */
5601 public abstract boolean isPackageAvailable(String packageName);
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005602
5603 /** {@hide} */
Jeff Sharkeya0907432014-08-15 10:23:11 -07005604 public static String installStatusToString(int status, String msg) {
5605 final String str = installStatusToString(status);
5606 if (msg != null) {
5607 return str + ": " + msg;
5608 } else {
5609 return str;
5610 }
5611 }
5612
5613 /** {@hide} */
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005614 public static String installStatusToString(int status) {
5615 switch (status) {
5616 case INSTALL_SUCCEEDED: return "INSTALL_SUCCEEDED";
5617 case INSTALL_FAILED_ALREADY_EXISTS: return "INSTALL_FAILED_ALREADY_EXISTS";
5618 case INSTALL_FAILED_INVALID_APK: return "INSTALL_FAILED_INVALID_APK";
5619 case INSTALL_FAILED_INVALID_URI: return "INSTALL_FAILED_INVALID_URI";
5620 case INSTALL_FAILED_INSUFFICIENT_STORAGE: return "INSTALL_FAILED_INSUFFICIENT_STORAGE";
5621 case INSTALL_FAILED_DUPLICATE_PACKAGE: return "INSTALL_FAILED_DUPLICATE_PACKAGE";
5622 case INSTALL_FAILED_NO_SHARED_USER: return "INSTALL_FAILED_NO_SHARED_USER";
5623 case INSTALL_FAILED_UPDATE_INCOMPATIBLE: return "INSTALL_FAILED_UPDATE_INCOMPATIBLE";
5624 case INSTALL_FAILED_SHARED_USER_INCOMPATIBLE: return "INSTALL_FAILED_SHARED_USER_INCOMPATIBLE";
5625 case INSTALL_FAILED_MISSING_SHARED_LIBRARY: return "INSTALL_FAILED_MISSING_SHARED_LIBRARY";
5626 case INSTALL_FAILED_REPLACE_COULDNT_DELETE: return "INSTALL_FAILED_REPLACE_COULDNT_DELETE";
5627 case INSTALL_FAILED_DEXOPT: return "INSTALL_FAILED_DEXOPT";
5628 case INSTALL_FAILED_OLDER_SDK: return "INSTALL_FAILED_OLDER_SDK";
5629 case INSTALL_FAILED_CONFLICTING_PROVIDER: return "INSTALL_FAILED_CONFLICTING_PROVIDER";
5630 case INSTALL_FAILED_NEWER_SDK: return "INSTALL_FAILED_NEWER_SDK";
5631 case INSTALL_FAILED_TEST_ONLY: return "INSTALL_FAILED_TEST_ONLY";
5632 case INSTALL_FAILED_CPU_ABI_INCOMPATIBLE: return "INSTALL_FAILED_CPU_ABI_INCOMPATIBLE";
5633 case INSTALL_FAILED_MISSING_FEATURE: return "INSTALL_FAILED_MISSING_FEATURE";
5634 case INSTALL_FAILED_CONTAINER_ERROR: return "INSTALL_FAILED_CONTAINER_ERROR";
5635 case INSTALL_FAILED_INVALID_INSTALL_LOCATION: return "INSTALL_FAILED_INVALID_INSTALL_LOCATION";
5636 case INSTALL_FAILED_MEDIA_UNAVAILABLE: return "INSTALL_FAILED_MEDIA_UNAVAILABLE";
5637 case INSTALL_FAILED_VERIFICATION_TIMEOUT: return "INSTALL_FAILED_VERIFICATION_TIMEOUT";
5638 case INSTALL_FAILED_VERIFICATION_FAILURE: return "INSTALL_FAILED_VERIFICATION_FAILURE";
5639 case INSTALL_FAILED_PACKAGE_CHANGED: return "INSTALL_FAILED_PACKAGE_CHANGED";
5640 case INSTALL_FAILED_UID_CHANGED: return "INSTALL_FAILED_UID_CHANGED";
5641 case INSTALL_FAILED_VERSION_DOWNGRADE: return "INSTALL_FAILED_VERSION_DOWNGRADE";
5642 case INSTALL_PARSE_FAILED_NOT_APK: return "INSTALL_PARSE_FAILED_NOT_APK";
5643 case INSTALL_PARSE_FAILED_BAD_MANIFEST: return "INSTALL_PARSE_FAILED_BAD_MANIFEST";
5644 case INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION: return "INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION";
5645 case INSTALL_PARSE_FAILED_NO_CERTIFICATES: return "INSTALL_PARSE_FAILED_NO_CERTIFICATES";
5646 case INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES: return "INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES";
5647 case INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING: return "INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING";
5648 case INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME: return "INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME";
5649 case INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID: return "INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID";
5650 case INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: return "INSTALL_PARSE_FAILED_MANIFEST_MALFORMED";
5651 case INSTALL_PARSE_FAILED_MANIFEST_EMPTY: return "INSTALL_PARSE_FAILED_MANIFEST_EMPTY";
5652 case INSTALL_FAILED_INTERNAL_ERROR: return "INSTALL_FAILED_INTERNAL_ERROR";
5653 case INSTALL_FAILED_USER_RESTRICTED: return "INSTALL_FAILED_USER_RESTRICTED";
5654 case INSTALL_FAILED_DUPLICATE_PERMISSION: return "INSTALL_FAILED_DUPLICATE_PERMISSION";
5655 case INSTALL_FAILED_NO_MATCHING_ABIS: return "INSTALL_FAILED_NO_MATCHING_ABIS";
Jeff Sharkeyf0600952014-08-07 17:31:53 -07005656 case INSTALL_FAILED_ABORTED: return "INSTALL_FAILED_ABORTED";
Calin Juravle3fc56c32017-12-11 18:26:13 -08005657 case INSTALL_FAILED_BAD_DEX_METADATA:
5658 return "INSTALL_FAILED_BAD_DEX_METADATA";
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005659 default: return Integer.toString(status);
5660 }
5661 }
5662
5663 /** {@hide} */
Jeff Sharkeya0907432014-08-15 10:23:11 -07005664 public static int installStatusToPublicStatus(int status) {
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005665 switch (status) {
Jeff Sharkeya0907432014-08-15 10:23:11 -07005666 case INSTALL_SUCCEEDED: return PackageInstaller.STATUS_SUCCESS;
5667 case INSTALL_FAILED_ALREADY_EXISTS: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5668 case INSTALL_FAILED_INVALID_APK: return PackageInstaller.STATUS_FAILURE_INVALID;
5669 case INSTALL_FAILED_INVALID_URI: return PackageInstaller.STATUS_FAILURE_INVALID;
5670 case INSTALL_FAILED_INSUFFICIENT_STORAGE: return PackageInstaller.STATUS_FAILURE_STORAGE;
5671 case INSTALL_FAILED_DUPLICATE_PACKAGE: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5672 case INSTALL_FAILED_NO_SHARED_USER: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5673 case INSTALL_FAILED_UPDATE_INCOMPATIBLE: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5674 case INSTALL_FAILED_SHARED_USER_INCOMPATIBLE: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5675 case INSTALL_FAILED_MISSING_SHARED_LIBRARY: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5676 case INSTALL_FAILED_REPLACE_COULDNT_DELETE: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5677 case INSTALL_FAILED_DEXOPT: return PackageInstaller.STATUS_FAILURE_INVALID;
5678 case INSTALL_FAILED_OLDER_SDK: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5679 case INSTALL_FAILED_CONFLICTING_PROVIDER: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5680 case INSTALL_FAILED_NEWER_SDK: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5681 case INSTALL_FAILED_TEST_ONLY: return PackageInstaller.STATUS_FAILURE_INVALID;
5682 case INSTALL_FAILED_CPU_ABI_INCOMPATIBLE: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5683 case INSTALL_FAILED_MISSING_FEATURE: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5684 case INSTALL_FAILED_CONTAINER_ERROR: return PackageInstaller.STATUS_FAILURE_STORAGE;
5685 case INSTALL_FAILED_INVALID_INSTALL_LOCATION: return PackageInstaller.STATUS_FAILURE_STORAGE;
5686 case INSTALL_FAILED_MEDIA_UNAVAILABLE: return PackageInstaller.STATUS_FAILURE_STORAGE;
5687 case INSTALL_FAILED_VERIFICATION_TIMEOUT: return PackageInstaller.STATUS_FAILURE_ABORTED;
5688 case INSTALL_FAILED_VERIFICATION_FAILURE: return PackageInstaller.STATUS_FAILURE_ABORTED;
5689 case INSTALL_FAILED_PACKAGE_CHANGED: return PackageInstaller.STATUS_FAILURE_INVALID;
5690 case INSTALL_FAILED_UID_CHANGED: return PackageInstaller.STATUS_FAILURE_INVALID;
5691 case INSTALL_FAILED_VERSION_DOWNGRADE: return PackageInstaller.STATUS_FAILURE_INVALID;
Svetoslavd9653702015-05-13 18:02:46 -07005692 case INSTALL_FAILED_PERMISSION_MODEL_DOWNGRADE: return PackageInstaller.STATUS_FAILURE_INVALID;
Jeff Sharkeya0907432014-08-15 10:23:11 -07005693 case INSTALL_PARSE_FAILED_NOT_APK: return PackageInstaller.STATUS_FAILURE_INVALID;
5694 case INSTALL_PARSE_FAILED_BAD_MANIFEST: return PackageInstaller.STATUS_FAILURE_INVALID;
5695 case INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION: return PackageInstaller.STATUS_FAILURE_INVALID;
5696 case INSTALL_PARSE_FAILED_NO_CERTIFICATES: return PackageInstaller.STATUS_FAILURE_INVALID;
5697 case INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES: return PackageInstaller.STATUS_FAILURE_INVALID;
5698 case INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING: return PackageInstaller.STATUS_FAILURE_INVALID;
5699 case INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME: return PackageInstaller.STATUS_FAILURE_INVALID;
5700 case INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID: return PackageInstaller.STATUS_FAILURE_INVALID;
5701 case INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: return PackageInstaller.STATUS_FAILURE_INVALID;
5702 case INSTALL_PARSE_FAILED_MANIFEST_EMPTY: return PackageInstaller.STATUS_FAILURE_INVALID;
Calin Juravle3fc56c32017-12-11 18:26:13 -08005703 case INSTALL_FAILED_BAD_DEX_METADATA: return PackageInstaller.STATUS_FAILURE_INVALID;
Jeff Sharkeya0907432014-08-15 10:23:11 -07005704 case INSTALL_FAILED_INTERNAL_ERROR: return PackageInstaller.STATUS_FAILURE;
5705 case INSTALL_FAILED_USER_RESTRICTED: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5706 case INSTALL_FAILED_DUPLICATE_PERMISSION: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5707 case INSTALL_FAILED_NO_MATCHING_ABIS: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5708 case INSTALL_FAILED_ABORTED: return PackageInstaller.STATUS_FAILURE_ABORTED;
5709 default: return PackageInstaller.STATUS_FAILURE;
5710 }
5711 }
5712
5713 /** {@hide} */
5714 public static String deleteStatusToString(int status, String msg) {
5715 final String str = deleteStatusToString(status);
5716 if (msg != null) {
5717 return str + ": " + msg;
5718 } else {
5719 return str;
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005720 }
5721 }
5722
5723 /** {@hide} */
5724 public static String deleteStatusToString(int status) {
5725 switch (status) {
5726 case DELETE_SUCCEEDED: return "DELETE_SUCCEEDED";
5727 case DELETE_FAILED_INTERNAL_ERROR: return "DELETE_FAILED_INTERNAL_ERROR";
5728 case DELETE_FAILED_DEVICE_POLICY_MANAGER: return "DELETE_FAILED_DEVICE_POLICY_MANAGER";
5729 case DELETE_FAILED_USER_RESTRICTED: return "DELETE_FAILED_USER_RESTRICTED";
5730 case DELETE_FAILED_OWNER_BLOCKED: return "DELETE_FAILED_OWNER_BLOCKED";
Jeff Sharkeyf0600952014-08-07 17:31:53 -07005731 case DELETE_FAILED_ABORTED: return "DELETE_FAILED_ABORTED";
Svet Ganov67882122016-12-11 16:36:34 -08005732 case DELETE_FAILED_USED_SHARED_LIBRARY: return "DELETE_FAILED_USED_SHARED_LIBRARY";
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005733 default: return Integer.toString(status);
5734 }
5735 }
Jeff Sharkeyf0600952014-08-07 17:31:53 -07005736
5737 /** {@hide} */
Jeff Sharkeya0907432014-08-15 10:23:11 -07005738 public static int deleteStatusToPublicStatus(int status) {
Jeff Sharkeyf0600952014-08-07 17:31:53 -07005739 switch (status) {
Jeff Sharkeya0907432014-08-15 10:23:11 -07005740 case DELETE_SUCCEEDED: return PackageInstaller.STATUS_SUCCESS;
5741 case DELETE_FAILED_INTERNAL_ERROR: return PackageInstaller.STATUS_FAILURE;
5742 case DELETE_FAILED_DEVICE_POLICY_MANAGER: return PackageInstaller.STATUS_FAILURE_BLOCKED;
5743 case DELETE_FAILED_USER_RESTRICTED: return PackageInstaller.STATUS_FAILURE_BLOCKED;
5744 case DELETE_FAILED_OWNER_BLOCKED: return PackageInstaller.STATUS_FAILURE_BLOCKED;
5745 case DELETE_FAILED_ABORTED: return PackageInstaller.STATUS_FAILURE_ABORTED;
Svet Ganov67882122016-12-11 16:36:34 -08005746 case DELETE_FAILED_USED_SHARED_LIBRARY: return PackageInstaller.STATUS_FAILURE_CONFLICT;
Jeff Sharkeya0907432014-08-15 10:23:11 -07005747 default: return PackageInstaller.STATUS_FAILURE;
Jeff Sharkeyf0600952014-08-07 17:31:53 -07005748 }
5749 }
Jeff Sharkey6c0b9da2014-08-07 22:07:11 -07005750
5751 /** {@hide} */
Svet Ganov77ab6a82015-07-03 12:03:02 -07005752 public static String permissionFlagToString(int flag) {
5753 switch (flag) {
Svetoslav4a5f4a22015-07-07 18:18:15 -07005754 case FLAG_PERMISSION_GRANTED_BY_DEFAULT: return "GRANTED_BY_DEFAULT";
5755 case FLAG_PERMISSION_POLICY_FIXED: return "POLICY_FIXED";
5756 case FLAG_PERMISSION_SYSTEM_FIXED: return "SYSTEM_FIXED";
5757 case FLAG_PERMISSION_USER_SET: return "USER_SET";
5758 case FLAG_PERMISSION_REVOKE_ON_UPGRADE: return "REVOKE_ON_UPGRADE";
5759 case FLAG_PERMISSION_USER_FIXED: return "USER_FIXED";
Svet Ganov9c165d72015-12-01 19:52:26 -08005760 case FLAG_PERMISSION_REVIEW_REQUIRED: return "REVIEW_REQUIRED";
Svet Ganov77ab6a82015-07-03 12:03:02 -07005761 default: return Integer.toString(flag);
5762 }
5763 }
5764
5765 /** {@hide} */
Jeff Sharkey6c0b9da2014-08-07 22:07:11 -07005766 public static class LegacyPackageDeleteObserver extends PackageDeleteObserver {
5767 private final IPackageDeleteObserver mLegacy;
5768
5769 public LegacyPackageDeleteObserver(IPackageDeleteObserver legacy) {
5770 mLegacy = legacy;
5771 }
5772
5773 @Override
5774 public void onPackageDeleted(String basePackageName, int returnCode, String msg) {
5775 if (mLegacy == null) return;
5776 try {
5777 mLegacy.packageDeleted(basePackageName, returnCode);
5778 } catch (RemoteException ignored) {
5779 }
5780 }
5781 }
Bartosz Fabianowskia34f53f2017-01-11 18:08:47 +01005782
5783 /**
Jeff Sharkey4347f812017-04-21 12:08:39 -06005784 * Return the install reason that was recorded when a package was first
5785 * installed for a specific user. Requesting the install reason for another
5786 * user will require the permission INTERACT_ACROSS_USERS_FULL.
Bartosz Fabianowskia34f53f2017-01-11 18:08:47 +01005787 *
5788 * @param packageName The package for which to retrieve the install reason
5789 * @param user The user for whom to retrieve the install reason
Jeff Sharkey4347f812017-04-21 12:08:39 -06005790 * @return The install reason. If the package is not installed for the given
5791 * user, {@code INSTALL_REASON_UNKNOWN} is returned.
Bartosz Fabianowskia34f53f2017-01-11 18:08:47 +01005792 * @hide
5793 */
5794 @TestApi
5795 public abstract @InstallReason int getInstallReason(String packageName,
5796 @NonNull UserHandle user);
Suprabh Shuklaaef25132017-01-23 18:09:03 -08005797
5798 /**
5799 * Checks whether the calling package is allowed to request package installs through package
Suprabh Shukla57528472017-04-14 19:22:45 -07005800 * installer. Apps are encouraged to call this API before launching the package installer via
Suprabh Shuklaaef25132017-01-23 18:09:03 -08005801 * intent {@link android.content.Intent#ACTION_INSTALL_PACKAGE}. Starting from Android O, the
5802 * user can explicitly choose what external sources they trust to install apps on the device.
Suprabh Shukla57528472017-04-14 19:22:45 -07005803 * If this API returns false, the install request will be blocked by the package installer and
Suprabh Shuklaaef25132017-01-23 18:09:03 -08005804 * a dialog will be shown to the user with an option to launch settings to change their
5805 * preference. An application must target Android O or higher and declare permission
Suprabh Shukla57528472017-04-14 19:22:45 -07005806 * {@link android.Manifest.permission#REQUEST_INSTALL_PACKAGES} in order to use this API.
Suprabh Shuklaaef25132017-01-23 18:09:03 -08005807 *
5808 * @return true if the calling package is trusted by the user to request install packages on
5809 * the device, false otherwise.
Suprabh Shukla57528472017-04-14 19:22:45 -07005810 * @see android.content.Intent#ACTION_INSTALL_PACKAGE
5811 * @see android.provider.Settings#ACTION_MANAGE_UNKNOWN_APP_SOURCES
Suprabh Shuklaaef25132017-01-23 18:09:03 -08005812 */
5813 public abstract boolean canRequestPackageInstalls();
Chad Brubakeraa49cb82017-03-24 15:53:09 -07005814
5815 /**
5816 * Return the {@link ComponentName} of the activity providing Settings for the Instant App
5817 * resolver.
5818 *
Todd Kennedy801e6592017-04-12 14:10:12 -07005819 * @see {@link android.content.Intent#ACTION_INSTANT_APP_RESOLVER_SETTINGS}
Chad Brubakeraa49cb82017-03-24 15:53:09 -07005820 * @hide
5821 */
5822 @SystemApi
5823 public abstract ComponentName getInstantAppResolverSettingsComponent();
Todd Kennedy801e6592017-04-12 14:10:12 -07005824
5825 /**
5826 * Return the {@link ComponentName} of the activity responsible for installing instant
5827 * applications.
5828 *
5829 * @see {@link android.content.Intent#ACTION_INSTALL_INSTANT_APP_PACKAGE}
5830 * @hide
5831 */
5832 @SystemApi
5833 public abstract ComponentName getInstantAppInstallerComponent();
Chad Brubaker0d277a72017-04-12 16:56:53 -07005834
5835 /**
5836 * Return the Android Id for a given Instant App.
5837 *
5838 * @see {@link android.provider.Settings.Secure#ANDROID_ID}
5839 * @hide
5840 */
5841 public abstract String getInstantAppAndroidId(String packageName, @NonNull UserHandle user);
Calin Juravle3d2af7f2017-04-19 19:56:21 -07005842
5843 /**
5844 * Callback use to notify the callers of module registration that the operation
5845 * has finished.
5846 *
5847 * @hide
5848 */
Jeff Sharkey90396362017-06-12 16:26:53 -06005849 @SystemApi
Calin Juravle3d2af7f2017-04-19 19:56:21 -07005850 public static abstract class DexModuleRegisterCallback {
5851 public abstract void onDexModuleRegistered(String dexModulePath, boolean success,
5852 String message);
5853 }
5854
5855 /**
5856 * Register an application dex module with the package manager.
5857 * The package manager will keep track of the given module for future optimizations.
5858 *
5859 * Dex module optimizations will disable the classpath checking at runtime. The client bares
5860 * the responsibility to ensure that the static assumptions on classes in the optimized code
5861 * hold at runtime (e.g. there's no duplicate classes in the classpath).
5862 *
5863 * Note that the package manager already keeps track of dex modules loaded with
5864 * {@link dalvik.system.DexClassLoader} and {@link dalvik.system.PathClassLoader}.
5865 * This can be called for an eager registration.
5866 *
5867 * The call might take a while and the results will be posted on the main thread, using
5868 * the given callback.
5869 *
5870 * If the module is intended to be shared with other apps, make sure that the file
5871 * permissions allow for it.
5872 * If at registration time the permissions allow for others to read it, the module would
5873 * be marked as a shared module which might undergo a different optimization strategy.
5874 * (usually shared modules will generated larger optimizations artifacts,
5875 * taking more disk space).
5876 *
5877 * @param dexModulePath the absolute path of the dex module.
5878 * @param callback if not null, {@link DexModuleRegisterCallback#onDexModuleRegistered} will
5879 * be called once the registration finishes.
5880 *
5881 * @hide
5882 */
Jeff Sharkey90396362017-06-12 16:26:53 -06005883 @SystemApi
Calin Juravle3d2af7f2017-04-19 19:56:21 -07005884 public abstract void registerDexModule(String dexModulePath,
5885 @Nullable DexModuleRegisterCallback callback);
Calin Juravle45f8b292017-11-07 18:49:43 -08005886
5887 /**
5888 * Returns the {@link ArtManager} associated with this package manager.
5889 *
5890 * @hide
5891 */
5892 @SystemApi
5893 public @NonNull ArtManager getArtManager() {
5894 throw new UnsupportedOperationException("getArtManager not implemented in subclass");
5895 }
Ben Gruver1ab3d6e2017-12-07 13:45:08 -08005896
5897 /**
5898 * Sets or clears the harmful app warning details for the given app.
5899 *
5900 * When set, any attempt to launch an activity in this package will be intercepted and a
5901 * warning dialog will be shown to the user instead, with the given warning. The user
5902 * will have the option to proceed with the activity launch, or to uninstall the application.
5903 *
5904 * @param packageName The full name of the package to warn on.
5905 * @param warning A warning string to display to the user describing the threat posed by the
5906 * application, or null to clear the warning.
5907 *
5908 * @hide
5909 */
5910 @RequiresPermission(Manifest.permission.SET_HARMFUL_APP_WARNINGS)
5911 @SystemApi
5912 public void setHarmfulAppWarning(@NonNull String packageName, @Nullable CharSequence warning) {
5913 throw new UnsupportedOperationException("setHarmfulAppWarning not implemented in subclass");
5914 }
5915
5916 /**
5917 * Returns the harmful app warning string for the given app, or null if there is none set.
5918 *
5919 * @param packageName The full name of the desired package.
5920 *
5921 * @hide
5922 */
5923 @RequiresPermission(Manifest.permission.SET_HARMFUL_APP_WARNINGS)
5924 @Nullable
5925 @SystemApi
5926 public CharSequence getHarmfulAppWarning(@NonNull String packageName) {
5927 throw new UnsupportedOperationException("getHarmfulAppWarning not implemented in subclass");
5928 }
Daniel Cashman5cdda342018-01-19 07:22:52 -08005929
5930 /** @hide */
5931 @IntDef(prefix = { "CERT_INPUT_" }, value = {
5932 CERT_INPUT_RAW_X509,
5933 CERT_INPUT_SHA256
5934 })
5935 @Retention(RetentionPolicy.SOURCE)
5936 public @interface CertificateInputType {}
5937
5938 /**
5939 * Certificate input bytes: the input bytes represent an encoded X.509 Certificate which could
5940 * be generated using an {@code CertificateFactory}
5941 */
5942 public static final int CERT_INPUT_RAW_X509 = 0;
5943
5944 /**
5945 * Certificate input bytes: the input bytes represent the SHA256 output of an encoded X.509
5946 * Certificate.
5947 */
5948 public static final int CERT_INPUT_SHA256 = 1;
5949
5950 /**
5951 * Searches the set of signing certificates by which the given package has proven to have been
5952 * signed. This should be used instead of {@code getPackageInfo} with {@code GET_SIGNATURES}
5953 * since it takes into account the possibility of signing certificate rotation, except in the
5954 * case of packages that are signed by multiple certificates, for which signing certificate
5955 * rotation is not supported.
5956 *
5957 * @param packageName package whose signing certificates to check
5958 * @param certificate signing certificate for which to search
5959 * @param type representation of the {@code certificate}
5960 * @return true if this package was or is signed by exactly the certificate {@code certificate}
5961 */
5962 public boolean hasSigningCertificate(
5963 String packageName, byte[] certificate, @CertificateInputType int type) {
5964 throw new UnsupportedOperationException(
5965 "hasSigningCertificate not implemented in subclass");
5966 }
5967
5968 /**
5969 * Searches the set of signing certificates by which the given uid has proven to have been
5970 * signed. This should be used instead of {@code getPackageInfo} with {@code GET_SIGNATURES}
5971 * since it takes into account the possibility of signing certificate rotation, except in the
5972 * case of packages that are signed by multiple certificates, for which signing certificate
5973 * rotation is not supported.
5974 *
5975 * @param uid package whose signing certificates to check
5976 * @param certificate signing certificate for which to search
5977 * @param type representation of the {@code certificate}
5978 * @return true if this package was or is signed by exactly the certificate {@code certificate}
5979 */
5980 public boolean hasSigningCertificate(
5981 int uid, byte[] certificate, @CertificateInputType int type) {
5982 throw new UnsupportedOperationException(
5983 "hasSigningCertificate not implemented in subclass");
5984 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005985}