blob: a5464c2137af3417306f2b0f8510bcb53dcbc14f [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;
Mathew Inwood5c0d3542018-08-14 13:54:31 +010032import android.annotation.UnsupportedAppUsage;
Jeff Sharkeybd940222016-01-08 11:07:13 -070033import android.annotation.UserIdInt;
Tor Norbye7b9c9122013-05-30 16:48:33 -070034import android.annotation.XmlRes;
Dianne Hackborn2a103f12017-08-08 15:50:31 -070035import android.app.ActivityManager;
Ricky Wai92cd0062019-02-14 20:23:22 +000036import android.app.AppDetailsActivity;
Jeff Sharkey6c0b9da2014-08-07 22:07:11 -070037import android.app.PackageDeleteObserver;
Christopher Tatef1977b42014-03-24 16:25:51 -070038import android.app.PackageInstallObserver;
Amith Yamasani1d653272014-09-11 17:56:05 -070039import android.app.admin.DevicePolicyManager;
Jeff Sharkey60f95aa2017-03-08 13:57:15 -070040import android.app.usage.StorageStatsManager;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080041import android.content.ComponentName;
42import android.content.Context;
43import android.content.Intent;
44import android.content.IntentFilter;
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -070045import android.content.IntentSender;
Jeff Sharkeyc4858a22014-06-16 10:51:20 -070046import android.content.pm.PackageParser.PackageParserException;
Calin Juravle45f8b292017-11-07 18:49:43 -080047import android.content.pm.dex.ArtManager;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080048import android.content.res.Resources;
49import android.content.res.XmlResourceParser;
Svetoslavc7d62f02014-09-04 15:39:54 -070050import android.graphics.Rect;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080051import android.graphics.drawable.Drawable;
Peter Qiu3d615e42017-08-07 20:13:32 +000052import android.net.wifi.WifiManager;
Jeff Sharkey6f4b2a32017-03-21 14:13:41 -060053import android.os.Build;
Jeff Sharkeybb580672014-07-10 12:10:25 -070054import android.os.Bundle;
Jeff Sharkey620b32b2015-04-23 19:36:02 -070055import android.os.Handler;
Suprabh Shukla021b57a2018-03-08 18:21:50 -080056import android.os.PersistableBundle;
Jeff Sharkey6c0b9da2014-08-07 22:07:11 -070057import android.os.RemoteException;
Dianne Hackborn0c380492012-08-20 17:23:30 -070058import android.os.UserHandle;
Jeff Sharkey8a372a02016-03-16 16:25:45 -060059import android.os.UserManager;
Jeff Sharkey683bcd32017-03-18 17:54:51 -060060import android.os.storage.StorageManager;
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -070061import android.os.storage.VolumeInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080062import android.util.AndroidException;
Jeff Sharkeybd940222016-01-08 11:07:13 -070063import android.util.Log;
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -070064
Svetoslavc6d1c342015-02-26 14:44:43 -080065import com.android.internal.util.ArrayUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080066
Jeff Sharkey6f4b2a32017-03-21 14:13:41 -060067import dalvik.system.VMRuntime;
68
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080069import java.io.File;
Tor Norbyed9273d62013-05-30 15:59:53 -070070import java.lang.annotation.Retention;
71import java.lang.annotation.RetentionPolicy;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080072import java.util.List;
Suprabh Shukla3e03ab92018-04-11 16:03:49 -070073import java.util.Locale;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080074
75/**
76 * Class for retrieving various kinds of information related to the application
77 * packages that are currently installed on the device.
78 *
79 * You can find this class through {@link Context#getPackageManager}.
80 */
81public abstract class PackageManager {
Jeff Sharkeybd940222016-01-08 11:07:13 -070082 private static final String TAG = "PackageManager";
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080083
Jeff Sharkeye4697132016-02-06 19:46:15 -070084 /** {@hide} */
Jeff Sharkey8a372a02016-03-16 16:25:45 -060085 public static final boolean APPLY_DEFAULT_TO_DEVICE_PROTECTED_STORAGE = true;
Jeff Sharkeye4697132016-02-06 19:46:15 -070086
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080087 /**
88 * This exception is thrown when a given package, application, or component
kmccormick30498b42013-03-27 17:39:17 -070089 * name cannot be found.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080090 */
91 public static class NameNotFoundException extends AndroidException {
92 public NameNotFoundException() {
93 }
94
95 public NameNotFoundException(String name) {
96 super(name);
97 }
98 }
99
100 /**
Svetoslavf7c06eb2015-06-10 18:43:22 -0700101 * Listener for changes in permissions granted to a UID.
102 *
103 * @hide
104 */
105 @SystemApi
106 public interface OnPermissionsChangedListener {
107
108 /**
109 * Called when the permissions for a UID change.
110 * @param uid The UID with a change.
111 */
112 public void onPermissionsChanged(int uid);
113 }
114
115 /**
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700116 * As a guiding principle:
117 * <p>
118 * {@code GET_} flags are used to request additional data that may have been
119 * elided to save wire space.
120 * <p>
121 * {@code MATCH_} flags are used to include components or packages that
122 * would have otherwise been omitted from a result set by current system
123 * state.
124 */
125
126 /** @hide */
Jeff Sharkey4347f812017-04-21 12:08:39 -0600127 @IntDef(flag = true, prefix = { "GET_", "MATCH_" }, value = {
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700128 GET_ACTIVITIES,
Todd Kennedy6b9bfa12016-01-08 13:44:51 -0800129 GET_CONFIGURATIONS,
130 GET_GIDS,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700131 GET_INSTRUMENTATION,
132 GET_INTENT_FILTERS,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700133 GET_META_DATA,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700134 GET_PERMISSIONS,
Todd Kennedy6b9bfa12016-01-08 13:44:51 -0800135 GET_PROVIDERS,
136 GET_RECEIVERS,
137 GET_SERVICES,
138 GET_SHARED_LIBRARY_FILES,
139 GET_SIGNATURES,
Daniel Cashman5cdda342018-01-19 07:22:52 -0800140 GET_SIGNING_CERTIFICATES,
Todd Kennedy6b9bfa12016-01-08 13:44:51 -0800141 GET_URI_PERMISSION_PATTERNS,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700142 MATCH_UNINSTALLED_PACKAGES,
143 MATCH_DISABLED_COMPONENTS,
144 MATCH_DISABLED_UNTIL_USED_COMPONENTS,
Jeff Sharkeyc5967e92016-01-07 18:50:29 -0700145 MATCH_SYSTEM_ONLY,
Todd Kennedyd6ee0ba2016-03-31 15:11:11 -0700146 MATCH_FACTORY_ONLY,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700147 MATCH_DEBUG_TRIAGED_MISSING,
Todd Kennedy9c9fdf22017-03-06 10:58:27 -0800148 MATCH_INSTANT,
Dario Frenicb7a68d2018-10-18 11:49:50 +0100149 MATCH_APEX,
Todd Kennedy1f397f42016-06-28 12:14:11 -0700150 GET_DISABLED_COMPONENTS,
151 GET_DISABLED_UNTIL_USED_COMPONENTS,
152 GET_UNINSTALLED_PACKAGES,
Rhed Jaocd47c262018-06-13 11:16:16 +0800153 MATCH_HIDDEN_UNTIL_INSTALLED_COMPONENTS,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700154 })
155 @Retention(RetentionPolicy.SOURCE)
156 public @interface PackageInfoFlags {}
157
158 /** @hide */
Jeff Sharkey4347f812017-04-21 12:08:39 -0600159 @IntDef(flag = true, prefix = { "GET_", "MATCH_" }, value = {
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700160 GET_META_DATA,
161 GET_SHARED_LIBRARY_FILES,
162 MATCH_UNINSTALLED_PACKAGES,
163 MATCH_SYSTEM_ONLY,
164 MATCH_DEBUG_TRIAGED_MISSING,
Todd Kennedy24522022017-03-27 16:32:20 -0700165 MATCH_DISABLED_COMPONENTS,
Todd Kennedy5a32c6c2016-07-07 14:29:06 -0700166 MATCH_DISABLED_UNTIL_USED_COMPONENTS,
Todd Kennedy9c9fdf22017-03-06 10:58:27 -0800167 MATCH_INSTANT,
Svet Ganov9e779772017-05-11 14:36:50 -0700168 MATCH_STATIC_SHARED_LIBRARIES,
Todd Kennedy5a32c6c2016-07-07 14:29:06 -0700169 GET_DISABLED_UNTIL_USED_COMPONENTS,
Todd Kennedy1f397f42016-06-28 12:14:11 -0700170 GET_UNINSTALLED_PACKAGES,
Rhed Jaocd47c262018-06-13 11:16:16 +0800171 MATCH_HIDDEN_UNTIL_INSTALLED_COMPONENTS,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700172 })
173 @Retention(RetentionPolicy.SOURCE)
174 public @interface ApplicationInfoFlags {}
175
176 /** @hide */
Jeff Sharkey4347f812017-04-21 12:08:39 -0600177 @IntDef(flag = true, prefix = { "GET_", "MATCH_" }, value = {
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700178 GET_META_DATA,
179 GET_SHARED_LIBRARY_FILES,
Todd Kennedy6b9bfa12016-01-08 13:44:51 -0800180 MATCH_ALL,
181 MATCH_DEBUG_TRIAGED_MISSING,
182 MATCH_DEFAULT_ONLY,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700183 MATCH_DISABLED_COMPONENTS,
184 MATCH_DISABLED_UNTIL_USED_COMPONENTS,
Jeff Sharkeyc59a5e72018-06-21 19:14:58 -0600185 MATCH_DIRECT_BOOT_AUTO,
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600186 MATCH_DIRECT_BOOT_AWARE,
187 MATCH_DIRECT_BOOT_UNAWARE,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700188 MATCH_SYSTEM_ONLY,
Todd Kennedy6b9bfa12016-01-08 13:44:51 -0800189 MATCH_UNINSTALLED_PACKAGES,
Todd Kennedy9c9fdf22017-03-06 10:58:27 -0800190 MATCH_INSTANT,
Svet Ganov9e779772017-05-11 14:36:50 -0700191 MATCH_STATIC_SHARED_LIBRARIES,
Todd Kennedy1f397f42016-06-28 12:14:11 -0700192 GET_DISABLED_COMPONENTS,
193 GET_DISABLED_UNTIL_USED_COMPONENTS,
194 GET_UNINSTALLED_PACKAGES,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700195 })
196 @Retention(RetentionPolicy.SOURCE)
197 public @interface ComponentInfoFlags {}
198
199 /** @hide */
Jeff Sharkey4347f812017-04-21 12:08:39 -0600200 @IntDef(flag = true, prefix = { "GET_", "MATCH_" }, value = {
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700201 GET_META_DATA,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700202 GET_RESOLVED_FILTER,
Todd Kennedy6b9bfa12016-01-08 13:44:51 -0800203 GET_SHARED_LIBRARY_FILES,
204 MATCH_ALL,
205 MATCH_DEBUG_TRIAGED_MISSING,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700206 MATCH_DISABLED_COMPONENTS,
207 MATCH_DISABLED_UNTIL_USED_COMPONENTS,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700208 MATCH_DEFAULT_ONLY,
Jeff Sharkeyc59a5e72018-06-21 19:14:58 -0600209 MATCH_DIRECT_BOOT_AUTO,
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600210 MATCH_DIRECT_BOOT_AWARE,
211 MATCH_DIRECT_BOOT_UNAWARE,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700212 MATCH_SYSTEM_ONLY,
Todd Kennedy6b9bfa12016-01-08 13:44:51 -0800213 MATCH_UNINSTALLED_PACKAGES,
Todd Kennedy9c9fdf22017-03-06 10:58:27 -0800214 MATCH_INSTANT,
Todd Kennedy1f397f42016-06-28 12:14:11 -0700215 GET_DISABLED_COMPONENTS,
216 GET_DISABLED_UNTIL_USED_COMPONENTS,
217 GET_UNINSTALLED_PACKAGES,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700218 })
219 @Retention(RetentionPolicy.SOURCE)
220 public @interface ResolveInfoFlags {}
221
222 /** @hide */
Jeff Sharkey4347f812017-04-21 12:08:39 -0600223 @IntDef(flag = true, prefix = { "GET_", "MATCH_" }, value = {
Todd Kennedy3dbf83a2018-11-13 13:29:16 -0800224 })
225 @Retention(RetentionPolicy.SOURCE)
226 public @interface ModuleInfoFlags {}
227
228 /** @hide */
229 @IntDef(flag = true, prefix = { "GET_", "MATCH_" }, value = {
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700230 GET_META_DATA,
231 })
232 @Retention(RetentionPolicy.SOURCE)
233 public @interface PermissionInfoFlags {}
234
235 /** @hide */
Jeff Sharkey4347f812017-04-21 12:08:39 -0600236 @IntDef(flag = true, prefix = { "GET_", "MATCH_" }, value = {
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700237 GET_META_DATA,
238 })
239 @Retention(RetentionPolicy.SOURCE)
240 public @interface PermissionGroupInfoFlags {}
241
242 /** @hide */
Jeff Sharkey4347f812017-04-21 12:08:39 -0600243 @IntDef(flag = true, prefix = { "GET_", "MATCH_" }, value = {
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700244 GET_META_DATA,
245 })
246 @Retention(RetentionPolicy.SOURCE)
247 public @interface InstrumentationInfoFlags {}
248
249 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800250 * {@link PackageInfo} flag: return information about
251 * activities in the package in {@link PackageInfo#activities}.
252 */
253 public static final int GET_ACTIVITIES = 0x00000001;
254
255 /**
256 * {@link PackageInfo} flag: return information about
257 * intent receivers in the package in
258 * {@link PackageInfo#receivers}.
259 */
260 public static final int GET_RECEIVERS = 0x00000002;
261
262 /**
263 * {@link PackageInfo} flag: return information about
264 * services in the package in {@link PackageInfo#services}.
265 */
266 public static final int GET_SERVICES = 0x00000004;
267
268 /**
269 * {@link PackageInfo} flag: return information about
270 * content providers in the package in
271 * {@link PackageInfo#providers}.
272 */
273 public static final int GET_PROVIDERS = 0x00000008;
274
275 /**
276 * {@link PackageInfo} flag: return information about
277 * instrumentation in the package in
278 * {@link PackageInfo#instrumentation}.
279 */
280 public static final int GET_INSTRUMENTATION = 0x00000010;
281
282 /**
283 * {@link PackageInfo} flag: return information about the
284 * intent filters supported by the activity.
285 */
286 public static final int GET_INTENT_FILTERS = 0x00000020;
287
288 /**
289 * {@link PackageInfo} flag: return information about the
290 * signatures included in the package.
Daniel Cashman5cdda342018-01-19 07:22:52 -0800291 *
292 * @deprecated use {@code GET_SIGNING_CERTIFICATES} instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800293 */
Daniel Cashman5cdda342018-01-19 07:22:52 -0800294 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800295 public static final int GET_SIGNATURES = 0x00000040;
296
297 /**
298 * {@link ResolveInfo} flag: return the IntentFilter that
299 * was matched for a particular ResolveInfo in
300 * {@link ResolveInfo#filter}.
301 */
302 public static final int GET_RESOLVED_FILTER = 0x00000040;
303
304 /**
305 * {@link ComponentInfo} flag: return the {@link ComponentInfo#metaData}
306 * data {@link android.os.Bundle}s that are associated with a component.
307 * This applies for any API returning a ComponentInfo subclass.
308 */
309 public static final int GET_META_DATA = 0x00000080;
310
311 /**
312 * {@link PackageInfo} flag: return the
313 * {@link PackageInfo#gids group ids} that are associated with an
314 * application.
Ken Wakasaf76a50c2012-03-09 19:56:35 +0900315 * This applies for any API returning a PackageInfo class, either
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800316 * directly or nested inside of another.
317 */
318 public static final int GET_GIDS = 0x00000100;
319
320 /**
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700321 * @deprecated replaced with {@link #MATCH_DISABLED_COMPONENTS}
322 */
323 @Deprecated
324 public static final int GET_DISABLED_COMPONENTS = 0x00000200;
325
326 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800327 * {@link PackageInfo} flag: include disabled components in the returned info.
328 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700329 public static final int MATCH_DISABLED_COMPONENTS = 0x00000200;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800330
331 /**
332 * {@link ApplicationInfo} flag: return the
333 * {@link ApplicationInfo#sharedLibraryFiles paths to the shared libraries}
334 * that are associated with an application.
335 * This applies for any API returning an ApplicationInfo class, either
336 * directly or nested inside of another.
337 */
338 public static final int GET_SHARED_LIBRARY_FILES = 0x00000400;
339
340 /**
341 * {@link ProviderInfo} flag: return the
342 * {@link ProviderInfo#uriPermissionPatterns URI permission patterns}
343 * that are associated with a content provider.
Ken Wakasaf76a50c2012-03-09 19:56:35 +0900344 * This applies for any API returning a ProviderInfo class, either
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800345 * directly or nested inside of another.
346 */
347 public static final int GET_URI_PERMISSION_PATTERNS = 0x00000800;
348 /**
349 * {@link PackageInfo} flag: return information about
350 * permissions in the package in
351 * {@link PackageInfo#permissions}.
352 */
353 public static final int GET_PERMISSIONS = 0x00001000;
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700354
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800355 /**
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700356 * @deprecated replaced with {@link #MATCH_UNINSTALLED_PACKAGES}
357 */
358 @Deprecated
359 public static final int GET_UNINSTALLED_PACKAGES = 0x00002000;
360
361 /**
Kenny Root685f4902011-11-03 10:13:29 -0700362 * Flag parameter to retrieve some information about all applications (even
363 * uninstalled ones) which have data directories. This state could have
364 * resulted if applications have been deleted with flag
365 * {@code DONT_DELETE_DATA} with a possibility of being replaced or
366 * reinstalled in future.
367 * <p>
368 * Note: this flag may cause less information about currently installed
369 * applications to be returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800370 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700371 public static final int MATCH_UNINSTALLED_PACKAGES = 0x00002000;
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700372
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800373 /**
374 * {@link PackageInfo} flag: return information about
Dianne Hackborn49237342009-08-27 20:08:01 -0700375 * hardware preferences in
Adam Lesinskid3edfde2014-08-08 17:32:44 -0700376 * {@link PackageInfo#configPreferences PackageInfo.configPreferences},
377 * and requested features in {@link PackageInfo#reqFeatures} and
378 * {@link PackageInfo#featureGroups}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800379 */
380 public static final int GET_CONFIGURATIONS = 0x00004000;
381
382 /**
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700383 * @deprecated replaced with {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}.
384 */
385 @Deprecated
386 public static final int GET_DISABLED_UNTIL_USED_COMPONENTS = 0x00008000;
387
388 /**
Dianne Hackbornfd7aded2013-01-22 17:10:23 -0800389 * {@link PackageInfo} flag: include disabled components which are in
390 * that state only because of {@link #COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED}
391 * in the returned info. Note that if you set this flag, applications
392 * that are in this disabled state will be reported as enabled.
393 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700394 public static final int MATCH_DISABLED_UNTIL_USED_COMPONENTS = 0x00008000;
Dianne Hackbornfd7aded2013-01-22 17:10:23 -0800395
396 /**
Dianne Hackborn1655be42009-05-08 14:29:01 -0700397 * Resolution and querying flag: if set, only filters that support the
398 * {@link android.content.Intent#CATEGORY_DEFAULT} will be considered for
399 * matching. This is a synonym for including the CATEGORY_DEFAULT in your
400 * supplied Intent.
401 */
Fabrice Di Meglio9f7e39f2015-04-10 20:40:16 -0700402 public static final int MATCH_DEFAULT_ONLY = 0x00010000;
403
404 /**
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700405 * Querying flag: if set and if the platform is doing any filtering of the
406 * results, then the filtering will not happen. This is a synonym for saying
407 * that all results should be returned.
408 * <p>
409 * <em>This flag should be used with extreme care.</em>
Fabrice Di Meglio9f7e39f2015-04-10 20:40:16 -0700410 */
411 public static final int MATCH_ALL = 0x00020000;
Dianne Hackborn1655be42009-05-08 14:29:01 -0700412
Nicolas Prevot63798c52014-05-27 13:22:38 +0100413 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600414 * Querying flag: match components which are direct boot <em>unaware</em> in
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700415 * the returned info, regardless of the current user state.
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600416 * <p>
417 * When neither {@link #MATCH_DIRECT_BOOT_AWARE} nor
418 * {@link #MATCH_DIRECT_BOOT_UNAWARE} are specified, the default behavior is
419 * to match only runnable components based on the user state. For example,
420 * when a user is started but credentials have not been presented yet, the
421 * user is running "locked" and only {@link #MATCH_DIRECT_BOOT_AWARE}
422 * components are returned. Once the user credentials have been presented,
423 * the user is running "unlocked" and both {@link #MATCH_DIRECT_BOOT_AWARE}
424 * and {@link #MATCH_DIRECT_BOOT_UNAWARE} components are returned.
425 *
426 * @see UserManager#isUserUnlocked()
Jeff Sharkeye17ac152015-11-06 22:40:29 -0800427 */
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600428 public static final int MATCH_DIRECT_BOOT_UNAWARE = 0x00040000;
429
430 /**
431 * Querying flag: match components which are direct boot <em>aware</em> in
432 * the returned info, regardless of the current user state.
433 * <p>
434 * When neither {@link #MATCH_DIRECT_BOOT_AWARE} nor
435 * {@link #MATCH_DIRECT_BOOT_UNAWARE} are specified, the default behavior is
436 * to match only runnable components based on the user state. For example,
437 * when a user is started but credentials have not been presented yet, the
438 * user is running "locked" and only {@link #MATCH_DIRECT_BOOT_AWARE}
439 * components are returned. Once the user credentials have been presented,
440 * the user is running "unlocked" and both {@link #MATCH_DIRECT_BOOT_AWARE}
441 * and {@link #MATCH_DIRECT_BOOT_UNAWARE} components are returned.
442 *
443 * @see UserManager#isUserUnlocked()
444 */
445 public static final int MATCH_DIRECT_BOOT_AWARE = 0x00080000;
446
Jeff Sharkey2a9e3f82015-12-18 10:57:58 -0700447 /**
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700448 * Querying flag: include only components from applications that are marked
449 * with {@link ApplicationInfo#FLAG_SYSTEM}.
Jeff Sharkey5217cac2015-12-20 15:34:01 -0700450 */
451 public static final int MATCH_SYSTEM_ONLY = 0x00100000;
452
453 /**
Todd Kennedyd6ee0ba2016-03-31 15:11:11 -0700454 * Internal {@link PackageInfo} flag: include only components on the system image.
455 * This will not return information on any unbundled update to system components.
456 * @hide
457 */
Todd Kennedy49084962017-03-27 16:20:37 -0700458 @SystemApi
Fyodor Kupolove5698042018-01-26 14:24:37 -0800459 @TestApi
Todd Kennedyd6ee0ba2016-03-31 15:11:11 -0700460 public static final int MATCH_FACTORY_ONLY = 0x00200000;
461
462 /**
Amith Yamasani0d1fd8d2016-10-12 14:21:51 -0700463 * Allows querying of packages installed for any user, not just the specific one. This flag
Amith Yamasani475f9a32016-12-08 09:46:15 -0800464 * is only meant for use by apps that have INTERACT_ACROSS_USERS permission.
Amith Yamasani0d1fd8d2016-10-12 14:21:51 -0700465 * @hide
466 */
Amith Yamasani475f9a32016-12-08 09:46:15 -0800467 @SystemApi
Amith Yamasani0d1fd8d2016-10-12 14:21:51 -0700468 public static final int MATCH_ANY_USER = 0x00400000;
469
470 /**
471 * Combination of MATCH_ANY_USER and MATCH_UNINSTALLED_PACKAGES to mean any known
472 * package.
473 * @hide
474 */
Todd Kennedyef9acb62018-05-29 15:18:06 -0700475 @TestApi
Amith Yamasani0d1fd8d2016-10-12 14:21:51 -0700476 public static final int MATCH_KNOWN_PACKAGES = MATCH_UNINSTALLED_PACKAGES | MATCH_ANY_USER;
477
478 /**
Todd Kennedy7bc3a702016-12-08 14:54:48 -0800479 * Internal {@link PackageInfo} flag: include components that are part of an
Todd Kennedybe0b8892017-02-15 14:13:52 -0800480 * instant app. By default, instant app components are not matched.
Todd Kennedy7bc3a702016-12-08 14:54:48 -0800481 * @hide
482 */
Todd Kennedy9c9fdf22017-03-06 10:58:27 -0800483 @SystemApi
Todd Kennedybe0b8892017-02-15 14:13:52 -0800484 public static final int MATCH_INSTANT = 0x00800000;
Todd Kennedy7bc3a702016-12-08 14:54:48 -0800485
486 /**
487 * Internal {@link PackageInfo} flag: include only components that are exposed to
Todd Kennedyc05f5d12017-04-25 11:11:40 -0700488 * instant apps. Matched components may have been either explicitly or implicitly
489 * exposed.
Todd Kennedy7bc3a702016-12-08 14:54:48 -0800490 * @hide
491 */
Todd Kennedybe0b8892017-02-15 14:13:52 -0800492 public static final int MATCH_VISIBLE_TO_INSTANT_APP_ONLY = 0x01000000;
Todd Kennedy7bc3a702016-12-08 14:54:48 -0800493
494 /**
Todd Kennedyc05f5d12017-04-25 11:11:40 -0700495 * Internal {@link PackageInfo} flag: include only components that have been
496 * explicitly exposed to instant apps.
497 * @hide
498 */
499 public static final int MATCH_EXPLICITLY_VISIBLE_ONLY = 0x02000000;
500
501 /**
Svet Ganov9e779772017-05-11 14:36:50 -0700502 * Internal {@link PackageInfo} flag: include static shared libraries.
503 * Apps that depend on static shared libs can always access the version
504 * of the lib they depend on. System/shell/root can access all shared
505 * libs regardless of dependency but need to explicitly ask for them
506 * via this flag.
507 * @hide
508 */
509 public static final int MATCH_STATIC_SHARED_LIBRARIES = 0x04000000;
510
511 /**
Daniel Cashman5cdda342018-01-19 07:22:52 -0800512 * {@link PackageInfo} flag: return the signing certificates associated with
513 * this package. Each entry is a signing certificate that the package
514 * has proven it is authorized to use, usually a past signing certificate from
515 * which it has rotated.
516 */
517 public static final int GET_SIGNING_CERTIFICATES = 0x08000000;
518
519 /**
Jeff Sharkeyc59a5e72018-06-21 19:14:58 -0600520 * Querying flag: automatically match components based on their Direct Boot
521 * awareness and the current user state.
522 * <p>
523 * Since the default behavior is to automatically apply the current user
524 * state, this is effectively a sentinel value that doesn't change the
525 * output of any queries based on its presence or absence.
526 * <p>
527 * Instead, this value can be useful in conjunction with
528 * {@link android.os.StrictMode.VmPolicy.Builder#detectImplicitDirectBoot()}
529 * to detect when a caller is relying on implicit automatic matching,
530 * instead of confirming the explicit behavior they want, using a
531 * combination of these flags:
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700532 * <ul>
Jeff Sharkeyc59a5e72018-06-21 19:14:58 -0600533 * <li>{@link #MATCH_DIRECT_BOOT_AWARE}
534 * <li>{@link #MATCH_DIRECT_BOOT_UNAWARE}
535 * <li>{@link #MATCH_DIRECT_BOOT_AUTO}
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700536 * </ul>
Jeff Sharkeye17ac152015-11-06 22:40:29 -0800537 */
Jeff Sharkeyc59a5e72018-06-21 19:14:58 -0600538 public static final int MATCH_DIRECT_BOOT_AUTO = 0x10000000;
539
540 /** @hide */
541 @Deprecated
542 public static final int MATCH_DEBUG_TRIAGED_MISSING = MATCH_DIRECT_BOOT_AUTO;
Jeff Sharkeye17ac152015-11-06 22:40:29 -0800543
544 /**
Rhed Jaocd47c262018-06-13 11:16:16 +0800545 * Internal flag used to indicate that a package is a hidden system app.
546 * @hide
547 */
548 public static final int MATCH_HIDDEN_UNTIL_INSTALLED_COMPONENTS = 0x20000000;
549
550 /**
Dario Frenicb7a68d2018-10-18 11:49:50 +0100551 * {@link PackageInfo} flag: include APEX packages that are currently
552 * installed. In APEX terminology, this corresponds to packages that are
553 * currently active, i.e. mounted and available to other processes of the OS.
554 * In particular, this flag alone will not match APEX files that are staged
555 * for activation at next reboot.
Dario Frenicb7a68d2018-10-18 11:49:50 +0100556 */
557 public static final int MATCH_APEX = 0x40000000;
558
559 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700560 * Flag for {@link #addCrossProfileIntentFilter}: if this flag is set: when
561 * resolving an intent that matches the {@code CrossProfileIntentFilter},
562 * the current profile will be skipped. Only activities in the target user
563 * can respond to the intent.
564 *
Nicolas Prevot63798c52014-05-27 13:22:38 +0100565 * @hide
566 */
567 public static final int SKIP_CURRENT_PROFILE = 0x00000002;
568
Tony Mak807e01c2015-12-01 20:19:03 +0000569 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700570 * Flag for {@link #addCrossProfileIntentFilter}: if this flag is set:
Tony Mak807e01c2015-12-01 20:19:03 +0000571 * activities in the other profiles can respond to the intent only if no activity with
572 * non-negative priority in current profile can respond to the intent.
573 * @hide
574 */
575 public static final int ONLY_IF_NO_MATCH_FOUND = 0x00000004;
576
Tor Norbyed9273d62013-05-30 15:59:53 -0700577 /** @hide */
Jeff Sharkey4347f812017-04-21 12:08:39 -0600578 @IntDef(prefix = { "PERMISSION_" }, value = {
579 PERMISSION_GRANTED,
580 PERMISSION_DENIED
581 })
Tor Norbyed9273d62013-05-30 15:59:53 -0700582 @Retention(RetentionPolicy.SOURCE)
583 public @interface PermissionResult {}
584
Dianne Hackborn1655be42009-05-08 14:29:01 -0700585 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800586 * Permission check result: this is returned by {@link #checkPermission}
587 * if the permission has been granted to the given package.
588 */
589 public static final int PERMISSION_GRANTED = 0;
590
591 /**
592 * Permission check result: this is returned by {@link #checkPermission}
593 * if the permission has not been granted to the given package.
594 */
595 public static final int PERMISSION_DENIED = -1;
596
Jeff Sharkey30e06bb2017-04-24 11:18:03 -0600597 /** @hide */
598 @IntDef(prefix = { "SIGNATURE_" }, value = {
599 SIGNATURE_MATCH,
600 SIGNATURE_NEITHER_SIGNED,
601 SIGNATURE_FIRST_NOT_SIGNED,
602 SIGNATURE_SECOND_NOT_SIGNED,
603 SIGNATURE_NO_MATCH,
604 SIGNATURE_UNKNOWN_PACKAGE,
605 })
606 @Retention(RetentionPolicy.SOURCE)
607 public @interface SignatureResult {}
608
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800609 /**
610 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700611 * if all signatures on the two packages match.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800612 */
613 public static final int SIGNATURE_MATCH = 0;
614
615 /**
616 * Signature check result: this is returned by {@link #checkSignatures}
617 * if neither of the two packages is signed.
618 */
619 public static final int SIGNATURE_NEITHER_SIGNED = 1;
620
621 /**
622 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700623 * if the first package is not signed but the second is.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800624 */
625 public static final int SIGNATURE_FIRST_NOT_SIGNED = -1;
626
627 /**
628 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700629 * if the second package is not signed but the first is.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800630 */
631 public static final int SIGNATURE_SECOND_NOT_SIGNED = -2;
632
633 /**
634 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700635 * if not all signatures on both packages match.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800636 */
637 public static final int SIGNATURE_NO_MATCH = -3;
638
639 /**
640 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700641 * if either of the packages are not valid.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800642 */
643 public static final int SIGNATURE_UNKNOWN_PACKAGE = -4;
644
Jeff Sharkey30e06bb2017-04-24 11:18:03 -0600645 /** @hide */
646 @IntDef(prefix = { "COMPONENT_ENABLED_STATE_" }, value = {
647 COMPONENT_ENABLED_STATE_DEFAULT,
648 COMPONENT_ENABLED_STATE_ENABLED,
649 COMPONENT_ENABLED_STATE_DISABLED,
650 COMPONENT_ENABLED_STATE_DISABLED_USER,
651 COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED,
652 })
653 @Retention(RetentionPolicy.SOURCE)
654 public @interface EnabledState {}
655
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700656 /**
Jeff Sharkey30e06bb2017-04-24 11:18:03 -0600657 * Flag for {@link #setApplicationEnabledSetting(String, int, int)} and
658 * {@link #setComponentEnabledSetting(ComponentName, int, int)}: This
659 * component or application is in its default enabled state (as specified in
660 * its manifest).
661 * <p>
662 * Explicitly setting the component state to this value restores it's
663 * enabled state to whatever is set in the manifest.
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700664 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800665 public static final int COMPONENT_ENABLED_STATE_DEFAULT = 0;
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700666
667 /**
668 * Flag for {@link #setApplicationEnabledSetting(String, int, int)}
669 * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This
670 * component or application has been explictily enabled, regardless of
671 * what it has specified in its manifest.
672 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800673 public static final int COMPONENT_ENABLED_STATE_ENABLED = 1;
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700674
675 /**
676 * Flag for {@link #setApplicationEnabledSetting(String, int, int)}
677 * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This
678 * component or application has been explicitly disabled, regardless of
679 * what it has specified in its manifest.
680 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800681 public static final int COMPONENT_ENABLED_STATE_DISABLED = 2;
682
683 /**
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700684 * Flag for {@link #setApplicationEnabledSetting(String, int, int)} only: The
685 * user has explicitly disabled the application, regardless of what it has
686 * specified in its manifest. Because this is due to the user's request,
687 * they may re-enable it if desired through the appropriate system UI. This
kmccormick30498b42013-03-27 17:39:17 -0700688 * option currently <strong>cannot</strong> be used with
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700689 * {@link #setComponentEnabledSetting(ComponentName, int, int)}.
690 */
691 public static final int COMPONENT_ENABLED_STATE_DISABLED_USER = 3;
692
693 /**
Dianne Hackbornfd7aded2013-01-22 17:10:23 -0800694 * Flag for {@link #setApplicationEnabledSetting(String, int, int)} only: This
695 * application should be considered, until the point where the user actually
696 * wants to use it. This means that it will not normally show up to the user
697 * (such as in the launcher), but various parts of the user interface can
698 * use {@link #GET_DISABLED_UNTIL_USED_COMPONENTS} to still see it and allow
699 * the user to select it (as for example an IME, device admin, etc). Such code,
700 * once the user has selected the app, should at that point also make it enabled.
701 * This option currently <strong>can not</strong> be used with
702 * {@link #setComponentEnabledSetting(ComponentName, int, int)}.
703 */
704 public static final int COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED = 4;
705
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700706 /** @hide */
Jeff Sharkey4347f812017-04-21 12:08:39 -0600707 @IntDef(flag = true, prefix = { "INSTALL_" }, value = {
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700708 INSTALL_REPLACE_EXISTING,
709 INSTALL_ALLOW_TEST,
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700710 INSTALL_INTERNAL,
711 INSTALL_FROM_ADB,
712 INSTALL_ALL_USERS,
713 INSTALL_ALLOW_DOWNGRADE,
714 INSTALL_GRANT_RUNTIME_PERMISSIONS,
715 INSTALL_FORCE_VOLUME_UUID,
716 INSTALL_FORCE_PERMISSION_PROMPT,
Todd Kennedybe0b8892017-02-15 14:13:52 -0800717 INSTALL_INSTANT_APP,
Todd Kennedy39bfee52016-02-24 10:28:21 -0800718 INSTALL_DONT_KILL_APP,
Jeff Sharkey683bcd32017-03-18 17:54:51 -0600719 INSTALL_FULL_APP,
720 INSTALL_ALLOCATE_AGGRESSIVE,
Richard Uhlerb29f1452018-09-12 16:38:15 +0100721 INSTALL_VIRTUAL_PRELOAD,
722 INSTALL_APEX,
723 INSTALL_ENABLE_ROLLBACK,
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700724 })
725 @Retention(RetentionPolicy.SOURCE)
726 public @interface InstallFlags {}
727
Dianne Hackbornfd7aded2013-01-22 17:10:23 -0800728 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700729 * Flag parameter for {@link #installPackage} to indicate that you want to
730 * replace an already installed package, if one exists.
731 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700732 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800733 */
Mathew Inwood5c0d3542018-08-14 13:54:31 +0100734 @UnsupportedAppUsage
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700735 public static final int INSTALL_REPLACE_EXISTING = 0x00000002;
736
737 /**
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700738 * Flag parameter for {@link #installPackage} to indicate that you want to
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700739 * allow test packages (those that have set android:testOnly in their
740 * manifest) to be installed.
741 * @hide
742 */
743 public static final int INSTALL_ALLOW_TEST = 0x00000004;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800744
745 /**
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -0700746 * Flag parameter for {@link #installPackage} to indicate that this package
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -0700747 * must be installed to internal storage.
748 *
Kenny Root5ab21572011-07-27 11:11:19 -0700749 * @hide
750 */
751 public static final int INSTALL_INTERNAL = 0x00000010;
752
753 /**
754 * Flag parameter for {@link #installPackage} to indicate that this install
755 * was initiated via ADB.
756 *
757 * @hide
758 */
759 public static final int INSTALL_FROM_ADB = 0x00000020;
Suchi Amalapurapu14b6abd2010-03-17 08:37:04 -0700760
761 /**
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700762 * Flag parameter for {@link #installPackage} to indicate that this install
763 * should immediately be visible to all users.
764 *
765 * @hide
766 */
767 public static final int INSTALL_ALL_USERS = 0x00000040;
768
769 /**
770 * Flag parameter for {@link #installPackage} to indicate that it is okay
771 * to install an update to an app where the newly installed app has a lower
Alex Klyubin921dd752016-02-24 13:21:41 -0800772 * version code than the currently installed app. This is permitted only if
773 * the currently installed app is marked debuggable.
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700774 *
775 * @hide
776 */
777 public static final int INSTALL_ALLOW_DOWNGRADE = 0x00000080;
778
779 /**
Svet Ganov95c1ade2015-03-19 09:38:52 -0700780 * Flag parameter for {@link #installPackage} to indicate that all runtime
781 * permissions should be granted to the package. If {@link #INSTALL_ALL_USERS}
782 * is set the runtime permissions will be granted to all users, otherwise
783 * only to the owner.
784 *
785 * @hide
786 */
787 public static final int INSTALL_GRANT_RUNTIME_PERMISSIONS = 0x00000100;
788
Jeff Sharkeyab234092015-06-09 21:42:22 -0700789 /** {@hide} */
790 public static final int INSTALL_FORCE_VOLUME_UUID = 0x00000200;
791
Svet Ganov95c1ade2015-03-19 09:38:52 -0700792 /**
Todd Kennedya1d12cf2015-09-29 15:43:00 -0700793 * Flag parameter for {@link #installPackage} to indicate that we always want to force
794 * the prompt for permission approval. This overrides any special behaviour for internal
795 * components.
796 *
797 * @hide
798 */
799 public static final int INSTALL_FORCE_PERMISSION_PROMPT = 0x00000400;
800
801 /**
Todd Kennedy27c24fb2015-09-17 16:49:25 -0700802 * Flag parameter for {@link #installPackage} to indicate that this package is
Todd Kennedy2699f062015-11-20 13:07:17 -0800803 * to be installed as a lightweight "ephemeral" app.
804 *
805 * @hide
806 */
Todd Kennedybe0b8892017-02-15 14:13:52 -0800807 public static final int INSTALL_INSTANT_APP = 0x00000800;
808
809 /**
Todd Kennedy39bfee52016-02-24 10:28:21 -0800810 * Flag parameter for {@link #installPackage} to indicate that this package contains
811 * a feature split to an existing application and the existing application should not
812 * be killed during the installation process.
813 *
814 * @hide
815 */
816 public static final int INSTALL_DONT_KILL_APP = 0x00001000;
817
818 /**
Jeff Sharkey683bcd32017-03-18 17:54:51 -0600819 * Flag parameter for {@link #installPackage} to indicate that this package is
820 * to be installed as a heavy weight app. This is fundamentally the opposite of
821 * {@link #INSTALL_INSTANT_APP}.
822 *
823 * @hide
824 */
825 public static final int INSTALL_FULL_APP = 0x00004000;
826
827 /**
828 * Flag parameter for {@link #installPackage} to indicate that this package
829 * is critical to system health or security, meaning the system should use
830 * {@link StorageManager#FLAG_ALLOCATE_AGGRESSIVE} internally.
831 *
832 * @hide
833 */
834 public static final int INSTALL_ALLOCATE_AGGRESSIVE = 0x00008000;
835
Todd Kennedy78a72502017-07-19 12:49:30 -0700836 /**
837 * Flag parameter for {@link #installPackage} to indicate that this package
838 * is a virtual preload.
839 *
840 * @hide
841 */
842 public static final int INSTALL_VIRTUAL_PRELOAD = 0x00010000;
843
Dario Frenid8bf22e2018-08-31 14:18:04 +0100844 /**
845 * Flag parameter for {@link #installPackage} to indicate that this package
846 * is an APEX package
847 *
848 * @hide
849 */
850 public static final int INSTALL_APEX = 0x00020000;
851
Richard Uhlerb29f1452018-09-12 16:38:15 +0100852 /**
853 * Flag parameter for {@link #installPackage} to indicate that rollback
854 * should be enabled for this install.
855 *
856 * @hide
857 */
858 public static final int INSTALL_ENABLE_ROLLBACK = 0x00040000;
859
Dario Freni49c3fa72019-02-04 12:07:25 +0000860 /**
861 * Flag parameter for {@link #installPackage} to indicate that package verification should be
862 * disabled for this package.
863 *
864 * @hide
865 */
866 public static final int INSTALL_DISABLE_VERIFICATION = 0x00080000;
867
Jeff Sharkey30e06bb2017-04-24 11:18:03 -0600868 /** @hide */
869 @IntDef(flag = true, prefix = { "DONT_KILL_APP" }, value = {
870 DONT_KILL_APP
871 })
872 @Retention(RetentionPolicy.SOURCE)
873 public @interface EnabledFlags {}
874
Jeff Sharkey683bcd32017-03-18 17:54:51 -0600875 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800876 * Flag parameter for
877 * {@link #setComponentEnabledSetting(android.content.ComponentName, int, int)} to indicate
878 * that you don't want to kill the app containing the component. Be careful when you set this
879 * since changing component states can make the containing application's behavior unpredictable.
880 */
881 public static final int DONT_KILL_APP = 0x00000001;
882
Bartosz Fabianowskia34f53f2017-01-11 18:08:47 +0100883 /** @hide */
Jeff Sharkey4347f812017-04-21 12:08:39 -0600884 @IntDef(prefix = { "INSTALL_REASON_" }, value = {
885 INSTALL_REASON_UNKNOWN,
886 INSTALL_REASON_POLICY,
887 INSTALL_REASON_DEVICE_RESTORE,
888 INSTALL_REASON_DEVICE_SETUP,
889 INSTALL_REASON_USER
890 })
Bartosz Fabianowskia34f53f2017-01-11 18:08:47 +0100891 @Retention(RetentionPolicy.SOURCE)
892 public @interface InstallReason {}
893
894 /**
895 * Code indicating that the reason for installing this package is unknown.
896 */
897 public static final int INSTALL_REASON_UNKNOWN = 0;
898
899 /**
900 * Code indicating that this package was installed due to enterprise policy.
901 */
902 public static final int INSTALL_REASON_POLICY = 1;
903
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800904 /**
Sunny Goyal80af6a22017-03-02 08:32:33 -0800905 * Code indicating that this package was installed as part of restoring from another device.
906 */
907 public static final int INSTALL_REASON_DEVICE_RESTORE = 2;
908
909 /**
910 * Code indicating that this package was installed as part of device setup.
911 */
912 public static final int INSTALL_REASON_DEVICE_SETUP = 3;
913
914 /**
915 * Code indicating that the package installation was initiated by the user.
916 */
917 public static final int INSTALL_REASON_USER = 4;
918
919 /**
Patrick Baumann0aff9b12018-11-08 14:05:08 +0000920 * @hide
921 */
922 public static final int INSTALL_UNKNOWN = 0;
923
924 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800925 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
926 * on success.
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700927 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700928 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800929 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700930 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800931 public static final int INSTALL_SUCCEEDED = 1;
932
933 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800934 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
935 * if the package is already installed.
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700936 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700937 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800938 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700939 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800940 public static final int INSTALL_FAILED_ALREADY_EXISTS = -1;
941
942 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800943 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
944 * if the package archive file is invalid.
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700945 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700946 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800947 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700948 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800949 public static final int INSTALL_FAILED_INVALID_APK = -2;
950
951 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800952 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
953 * if the URI passed in is invalid.
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_INVALID_URI = -3;
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 package manager service found that the device didn't have enough storage space to
963 * install the app.
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_INSUFFICIENT_STORAGE = -4;
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 a package is already installed with the same name.
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_DUPLICATE_PACKAGE = -5;
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 requested shared user does not exist.
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_NO_SHARED_USER = -6;
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 a previously installed package of the same name has a different signature than the new
991 * package (and the old package's data was not removed).
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_UPDATE_INCOMPATIBLE = -7;
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 is requested a shared user which is already installed on the device and
1001 * does not have matching signature.
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_SHARED_USER_INCOMPATIBLE = -8;
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 uses a shared library that is not available.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001011 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001012 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001013 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001014 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001015 public static final int INSTALL_FAILED_MISSING_SHARED_LIBRARY = -9;
1016
1017 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001018 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1019 * if the new package uses a shared library that is not available.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001020 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001021 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001022 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001023 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001024 public static final int INSTALL_FAILED_REPLACE_COULDNT_DELETE = -10;
1025
1026 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001027 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1028 * if the new package failed while optimizing and validating its dex files, either because there
1029 * was not enough storage or the validation failed.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001030 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001031 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001032 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001033 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001034 public static final int INSTALL_FAILED_DEXOPT = -11;
1035
1036 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001037 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1038 * if the new package failed because the current SDK version is older than that required by the
1039 * package.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001040 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001041 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001042 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001043 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001044 public static final int INSTALL_FAILED_OLDER_SDK = -12;
1045
1046 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001047 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1048 * if the new package failed because it contains a content provider with the same authority as a
1049 * provider already installed in the system.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001050 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001051 * @hide
The Android Open Source Project10592532009-03-18 17:39:46 -07001052 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001053 @SystemApi
The Android Open Source Project10592532009-03-18 17:39:46 -07001054 public static final int INSTALL_FAILED_CONFLICTING_PROVIDER = -13;
1055
1056 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001057 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1058 * if the new package failed because the current SDK version is newer than that required by the
1059 * package.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001060 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001061 * @hide
Dianne Hackborn851a5412009-05-08 12:06:44 -07001062 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001063 @SystemApi
Dianne Hackborn851a5412009-05-08 12:06:44 -07001064 public static final int INSTALL_FAILED_NEWER_SDK = -14;
1065
1066 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001067 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1068 * if the new package failed because it has specified that it is a test-only package and the
1069 * caller has not supplied the {@link #INSTALL_ALLOW_TEST} flag.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001070 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001071 * @hide
1072 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001073 @SystemApi
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001074 public static final int INSTALL_FAILED_TEST_ONLY = -15;
1075
1076 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001077 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1078 * if the package being installed contains native code, but none that is compatible with the
1079 * device's CPU_ABI.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001080 *
Dianne Hackbornb1811182009-05-21 15:45:42 -07001081 * @hide
1082 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001083 @SystemApi
Dianne Hackbornb1811182009-05-21 15:45:42 -07001084 public static final int INSTALL_FAILED_CPU_ABI_INCOMPATIBLE = -16;
1085
1086 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001087 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1088 * if the new package uses a feature that is not available.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001089 *
Dianne Hackborn49237342009-08-27 20:08:01 -07001090 * @hide
1091 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001092 @SystemApi
Dianne Hackborn49237342009-08-27 20:08:01 -07001093 public static final int INSTALL_FAILED_MISSING_FEATURE = -17;
1094
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -08001095 // ------ Errors related to sdcard
1096 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001097 * Installation return code: this is passed in the
1098 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if a secure container mount point couldn't be
1099 * accessed on external media.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001100 *
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -08001101 * @hide
1102 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001103 @SystemApi
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -08001104 public static final int INSTALL_FAILED_CONTAINER_ERROR = -18;
1105
Dianne Hackborn49237342009-08-27 20:08:01 -07001106 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001107 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1108 * if the new package couldn't be installed in the specified install location.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001109 *
Suchi Amalapurapub56ae202010-02-04 22:51:07 -08001110 * @hide
1111 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001112 @SystemApi
Suchi Amalapurapub56ae202010-02-04 22:51:07 -08001113 public static final int INSTALL_FAILED_INVALID_INSTALL_LOCATION = -19;
1114
1115 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001116 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1117 * if the new package couldn't be installed in the specified install location because the media
1118 * is not available.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001119 *
Suchi Amalapurapu8a9ab242010-03-11 16:49:16 -08001120 * @hide
1121 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001122 @SystemApi
Suchi Amalapurapu8a9ab242010-03-11 16:49:16 -08001123 public static final int INSTALL_FAILED_MEDIA_UNAVAILABLE = -20;
1124
1125 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001126 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1127 * if the new package couldn't be installed because the verification timed out.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001128 *
Kenny Root5ab21572011-07-27 11:11:19 -07001129 * @hide
1130 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001131 @SystemApi
Kenny Root5ab21572011-07-27 11:11:19 -07001132 public static final int INSTALL_FAILED_VERIFICATION_TIMEOUT = -21;
1133
1134 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001135 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1136 * if the new package couldn't be installed because the verification did not succeed.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001137 *
Kenny Root5ab21572011-07-27 11:11:19 -07001138 * @hide
1139 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001140 @SystemApi
Kenny Root5ab21572011-07-27 11:11:19 -07001141 public static final int INSTALL_FAILED_VERIFICATION_FAILURE = -22;
1142
1143 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001144 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1145 * if the package changed from what the calling program expected.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001146 *
Kenny Root5ab21572011-07-27 11:11:19 -07001147 * @hide
1148 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001149 @SystemApi
Kenny Root5ab21572011-07-27 11:11:19 -07001150 public static final int INSTALL_FAILED_PACKAGE_CHANGED = -23;
1151
1152 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001153 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1154 * if the new package is assigned a different UID than it previously held.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001155 *
Dianne Hackbornd0c5f512012-06-07 16:53:59 -07001156 * @hide
1157 */
1158 public static final int INSTALL_FAILED_UID_CHANGED = -24;
1159
1160 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001161 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1162 * if the new package has an older version code than the currently installed package.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001163 *
Dianne Hackborn7767eac2012-08-23 18:25:40 -07001164 * @hide
1165 */
1166 public static final int INSTALL_FAILED_VERSION_DOWNGRADE = -25;
1167
1168 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001169 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1170 * if the old package has target SDK high enough to support runtime permission and the new
1171 * package has target SDK low enough to not support runtime permissions.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001172 *
Svetoslavd9653702015-05-13 18:02:46 -07001173 * @hide
1174 */
1175 @SystemApi
1176 public static final int INSTALL_FAILED_PERMISSION_MODEL_DOWNGRADE = -26;
1177
1178 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001179 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1180 * if the new package attempts to downgrade the target sandbox version of the app.
Chad Brubaker34573b22017-03-07 15:27:35 -08001181 *
1182 * @hide
1183 */
1184 @SystemApi
1185 public static final int INSTALL_FAILED_SANDBOX_VERSION_DOWNGRADE = -27;
1186
1187 /**
Todd Kennedy29cfa272018-09-26 10:25:24 -07001188 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1189 * if the new package requires at least one split and it was not provided.
1190 *
1191 * @hide
1192 */
1193 public static final int INSTALL_FAILED_MISSING_SPLIT = -28;
1194
1195 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001196 * Installation parse return code: this is passed in the
1197 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser was given a path that is not a
1198 * file, or does not end with the expected '.apk' extension.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001199 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001200 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001201 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001202 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001203 public static final int INSTALL_PARSE_FAILED_NOT_APK = -100;
1204
1205 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001206 * Installation parse return code: this is passed in the
1207 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser was unable to retrieve the
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001208 * AndroidManifest.xml file.
1209 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001210 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001211 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001212 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001213 public static final int INSTALL_PARSE_FAILED_BAD_MANIFEST = -101;
1214
1215 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001216 * Installation parse return code: this is passed in the
1217 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser encountered an unexpected
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001218 * exception.
1219 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001220 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001221 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001222 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001223 public static final int INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION = -102;
1224
1225 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001226 * Installation parse return code: this is passed in the
1227 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser did not find any certificates in
1228 * the .apk.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001229 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001230 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001231 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001232 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001233 public static final int INSTALL_PARSE_FAILED_NO_CERTIFICATES = -103;
1234
1235 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001236 * Installation parse return code: this is passed in the
1237 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser found inconsistent certificates on
1238 * the files in the .apk.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001239 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001240 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001241 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001242 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001243 public static final int INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES = -104;
1244
1245 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001246 * Installation parse return code: this is passed in the
1247 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser encountered a
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001248 * CertificateEncodingException in one of the files in the .apk.
1249 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001250 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001251 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001252 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001253 public static final int INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING = -105;
1254
1255 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001256 * Installation parse return code: this is passed in the
1257 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser encountered a bad or missing
1258 * package name in the manifest.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001259 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001260 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001261 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001262 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001263 public static final int INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME = -106;
1264
1265 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001266 * Installation parse return code: tthis is passed in the
1267 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser encountered a bad shared user id
1268 * name in the manifest.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001269 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001270 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001271 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001272 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001273 public static final int INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID = -107;
1274
1275 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001276 * Installation parse return code: this is passed in the
1277 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser encountered some structural
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001278 * problem in the manifest.
1279 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001280 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001281 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001282 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001283 public static final int INSTALL_PARSE_FAILED_MANIFEST_MALFORMED = -108;
1284
1285 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001286 * Installation parse return code: this is passed in the
1287 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser did not find any actionable tags
1288 * (instrumentation or application) in the manifest.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001289 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001290 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001291 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001292 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001293 public static final int INSTALL_PARSE_FAILED_MANIFEST_EMPTY = -109;
1294
1295 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001296 * Installation failed return code: this is passed in the
1297 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the system failed to install the package
1298 * because of system issues.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001299 *
Suchi Amalapurapu5b993ce2010-02-12 09:43:29 -08001300 * @hide
1301 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001302 @SystemApi
Suchi Amalapurapu5b993ce2010-02-12 09:43:29 -08001303 public static final int INSTALL_FAILED_INTERNAL_ERROR = -110;
1304
1305 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001306 * Installation failed return code: this is passed in the
1307 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the system failed to install the package
1308 * because the user is restricted from installing apps.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001309 *
Amith Yamasanie4cf7342012-12-17 11:12:09 -08001310 * @hide
1311 */
1312 public static final int INSTALL_FAILED_USER_RESTRICTED = -111;
1313
1314 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001315 * Installation failed return code: this is passed in the
1316 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the system failed to install the package
1317 * because it is attempting to define a permission that is already defined by some existing
1318 * package.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001319 * <p>
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001320 * The package name of the app which has already defined the permission is passed to a
1321 * {@link PackageInstallObserver}, if any, as the {@link #EXTRA_FAILURE_EXISTING_PACKAGE} string
1322 * extra; and the name of the permission being redefined is passed in the
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001323 * {@link #EXTRA_FAILURE_EXISTING_PERMISSION} string extra.
Christopher Tatef1977b42014-03-24 16:25:51 -07001324 *
Christopher Tatef1977b42014-03-24 16:25:51 -07001325 * @hide
1326 */
1327 public static final int INSTALL_FAILED_DUPLICATE_PERMISSION = -112;
1328
1329 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001330 * Installation failed return code: this is passed in the
1331 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the system failed to install the package
1332 * because its packaged native code did not match any of the ABIs supported by the system.
Ramin Zaghi1378aba2014-02-28 15:03:19 +00001333 *
1334 * @hide
1335 */
Narayan Kamathd11f2232014-04-10 10:37:17 +01001336 public static final int INSTALL_FAILED_NO_MATCHING_ABIS = -113;
Ramin Zaghi1378aba2014-02-28 15:03:19 +00001337
1338 /**
1339 * Internal return code for NativeLibraryHelper methods to indicate that the package
1340 * being processed did not contain any native code. This is placed here only so that
1341 * it can belong to the same value space as the other install failure codes.
1342 *
1343 * @hide
1344 */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01001345 @UnsupportedAppUsage
Narayan Kamathd11f2232014-04-10 10:37:17 +01001346 public static final int NO_NATIVE_LIBRARIES = -114;
Ramin Zaghi1378aba2014-02-28 15:03:19 +00001347
Jeff Sharkey7328a1b2014-08-07 14:01:43 -07001348 /** {@hide} */
Jeff Sharkeyf0600952014-08-07 17:31:53 -07001349 public static final int INSTALL_FAILED_ABORTED = -115;
Jeff Sharkey7328a1b2014-08-07 14:01:43 -07001350
Ramin Zaghi1378aba2014-02-28 15:03:19 +00001351 /**
Todd Kennedybe0b8892017-02-15 14:13:52 -08001352 * Installation failed return code: instant app installs are incompatible with some
Todd Kennedy2699f062015-11-20 13:07:17 -08001353 * other installation flags supplied for the operation; or other circumstances such
Todd Kennedybe0b8892017-02-15 14:13:52 -08001354 * as trying to upgrade a system app via an instant app install.
Todd Kennedy2699f062015-11-20 13:07:17 -08001355 * @hide
1356 */
Todd Kennedybe0b8892017-02-15 14:13:52 -08001357 public static final int INSTALL_FAILED_INSTANT_APP_INVALID = -116;
Todd Kennedy2699f062015-11-20 13:07:17 -08001358
Calin Juravle3fc56c32017-12-11 18:26:13 -08001359 /**
1360 * Installation parse return code: this is passed in the
1361 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the dex metadata file is invalid or
1362 * if there was no matching apk file for a dex metadata file.
1363 *
1364 * @hide
1365 */
1366 public static final int INSTALL_FAILED_BAD_DEX_METADATA = -117;
1367
Victor Hsiehc0cd7482018-10-04 10:10:54 -07001368 /**
1369 * Installation parse return code: this is passed in the
1370 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if there is any signature problem.
1371 *
1372 * @hide
1373 */
1374 public static final int INSTALL_FAILED_BAD_SIGNATURE = -118;
1375
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001376 /** @hide */
Jeff Sharkey4347f812017-04-21 12:08:39 -06001377 @IntDef(flag = true, prefix = { "DELETE_" }, value = {
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001378 DELETE_KEEP_DATA,
1379 DELETE_ALL_USERS,
1380 DELETE_SYSTEM_APP,
Todd Kennedy39bfee52016-02-24 10:28:21 -08001381 DELETE_DONT_KILL_APP,
Todd Kennedy232d29e2017-11-06 14:45:53 -08001382 DELETE_CHATTY,
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001383 })
1384 @Retention(RetentionPolicy.SOURCE)
1385 public @interface DeleteFlags {}
1386
Todd Kennedy2699f062015-11-20 13:07:17 -08001387 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001388 * Flag parameter for {@link #deletePackage} to indicate that you don't want to delete the
1389 * package's data directory.
1390 *
1391 * @hide
1392 */
Dianne Hackborn7767eac2012-08-23 18:25:40 -07001393 public static final int DELETE_KEEP_DATA = 0x00000001;
1394
1395 /**
1396 * Flag parameter for {@link #deletePackage} to indicate that you want the
1397 * package deleted for all users.
1398 *
1399 * @hide
1400 */
1401 public static final int DELETE_ALL_USERS = 0x00000002;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001402
1403 /**
Dianne Hackbornc895be72013-03-11 17:48:43 -07001404 * Flag parameter for {@link #deletePackage} to indicate that, if you are calling
1405 * uninstall on a system that has been updated, then don't do the normal process
1406 * of uninstalling the update and rolling back to the older system version (which
1407 * needs to happen for all users); instead, just mark the app as uninstalled for
1408 * the current user.
1409 *
1410 * @hide
1411 */
1412 public static final int DELETE_SYSTEM_APP = 0x00000004;
1413
1414 /**
Todd Kennedy39bfee52016-02-24 10:28:21 -08001415 * Flag parameter for {@link #deletePackage} to indicate that, if you are calling
1416 * uninstall on a package that is replaced to provide new feature splits, the
1417 * existing application should not be killed during the removal process.
1418 *
1419 * @hide
1420 */
1421 public static final int DELETE_DONT_KILL_APP = 0x00000008;
1422
1423 /**
Jeff Sharkeydc50d4c2018-12-10 18:28:56 -07001424 * Flag parameter for {@link #deletePackage} to indicate that any
1425 * contributed media should also be deleted during this uninstall. The
1426 * meaning of "contributed" means it won't automatically be deleted when the
1427 * app is uninstalled.
1428 *
1429 * @hide
1430 */
1431 public static final int DELETE_CONTRIBUTED_MEDIA = 0x00000010;
1432
1433 /**
Todd Kennedy232d29e2017-11-06 14:45:53 -08001434 * Flag parameter for {@link #deletePackage} to indicate that package deletion
1435 * should be chatty.
1436 *
1437 * @hide
1438 */
1439 public static final int DELETE_CHATTY = 0x80000000;
1440
1441 /**
Kenny Rootc39bb4a2011-02-28 13:27:19 -08001442 * Return code for when package deletion succeeds. This is passed to the
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001443 * {@link IPackageDeleteObserver} if the system succeeded in deleting the
1444 * package.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001445 *
Kenny Rootc39bb4a2011-02-28 13:27:19 -08001446 * @hide
1447 */
1448 public static final int DELETE_SUCCEEDED = 1;
1449
1450 /**
1451 * Deletion failed return code: this is passed to the
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001452 * {@link IPackageDeleteObserver} if the system failed to delete the package
1453 * for an unspecified reason.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001454 *
Kenny Rootc39bb4a2011-02-28 13:27:19 -08001455 * @hide
1456 */
1457 public static final int DELETE_FAILED_INTERNAL_ERROR = -1;
1458
1459 /**
1460 * Deletion failed return code: this is passed to the
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001461 * {@link IPackageDeleteObserver} if the system failed to delete the package
1462 * because it is the active DevicePolicy manager.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001463 *
Kenny Rootc39bb4a2011-02-28 13:27:19 -08001464 * @hide
1465 */
1466 public static final int DELETE_FAILED_DEVICE_POLICY_MANAGER = -2;
1467
1468 /**
Amith Yamasanie4cf7342012-12-17 11:12:09 -08001469 * Deletion failed return code: this is passed to the
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001470 * {@link IPackageDeleteObserver} if the system failed to delete the package
1471 * since the user is restricted.
Amith Yamasanie4cf7342012-12-17 11:12:09 -08001472 *
1473 * @hide
1474 */
1475 public static final int DELETE_FAILED_USER_RESTRICTED = -3;
1476
1477 /**
Kenny Guy1b88da52014-07-10 16:33:49 +01001478 * Deletion failed return code: this is passed to the
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001479 * {@link IPackageDeleteObserver} if the system failed to delete the package
1480 * because a profile or device owner has marked the package as
1481 * uninstallable.
Kenny Guyc13053b2014-05-29 14:17:17 +01001482 *
1483 * @hide
1484 */
Jeff Sharkeyf0600952014-08-07 17:31:53 -07001485 public static final int DELETE_FAILED_OWNER_BLOCKED = -4;
1486
1487 /** {@hide} */
1488 public static final int DELETE_FAILED_ABORTED = -5;
Kenny Guyc13053b2014-05-29 14:17:17 +01001489
1490 /**
Svet Ganov67882122016-12-11 16:36:34 -08001491 * Deletion failed return code: this is passed to the
1492 * {@link IPackageDeleteObserver} if the system failed to delete the package
1493 * because the packge is a shared library used by other installed packages.
1494 * {@hide} */
1495 public static final int DELETE_FAILED_USED_SHARED_LIBRARY = -6;
1496
1497 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001498 * Return code that is passed to the {@link IPackageMoveObserver} when the
Kenny Rootc39bb4a2011-02-28 13:27:19 -08001499 * package has been successfully moved by the system.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001500 *
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001501 * @hide
1502 */
Jeff Sharkey620b32b2015-04-23 19:36:02 -07001503 public static final int MOVE_SUCCEEDED = -100;
1504
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001505 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001506 * Error code that is passed to the {@link IPackageMoveObserver} when the
1507 * package hasn't been successfully moved by the system because of
1508 * insufficient memory on specified media.
1509 *
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001510 * @hide
1511 */
1512 public static final int MOVE_FAILED_INSUFFICIENT_STORAGE = -1;
1513
1514 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001515 * Error code that is passed to the {@link IPackageMoveObserver} if the
1516 * specified package doesn't exist.
1517 *
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001518 * @hide
1519 */
1520 public static final int MOVE_FAILED_DOESNT_EXIST = -2;
1521
1522 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001523 * Error code that is passed to the {@link IPackageMoveObserver} if the
1524 * specified package cannot be moved since its a system package.
1525 *
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001526 * @hide
1527 */
1528 public static final int MOVE_FAILED_SYSTEM_PACKAGE = -3;
1529
1530 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001531 * Error code that is passed to the {@link IPackageMoveObserver} if the
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001532 * specified package cannot be moved to the specified location.
1533 *
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001534 * @hide
1535 */
1536 public static final int MOVE_FAILED_INVALID_LOCATION = -5;
1537
1538 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001539 * Error code that is passed to the {@link IPackageMoveObserver} if the
1540 * specified package cannot be moved to the specified location.
1541 *
Suchi Amalapurapu8a9ab242010-03-11 16:49:16 -08001542 * @hide
1543 */
1544 public static final int MOVE_FAILED_INTERNAL_ERROR = -6;
1545
1546 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001547 * Error code that is passed to the {@link IPackageMoveObserver} if the
1548 * specified package already has an operation pending in the queue.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001549 *
Kenny Rootdeb11262010-08-02 11:36:21 -07001550 * @hide
1551 */
1552 public static final int MOVE_FAILED_OPERATION_PENDING = -7;
1553
1554 /**
Makoto Onukif34db0a2016-02-17 11:17:15 -08001555 * Error code that is passed to the {@link IPackageMoveObserver} if the
1556 * specified package cannot be moved since it contains a device admin.
1557 *
1558 * @hide
1559 */
1560 public static final int MOVE_FAILED_DEVICE_ADMIN = -8;
1561
1562 /**
Yao Chen022b8ea2016-12-16 11:03:28 -08001563 * Error code that is passed to the {@link IPackageMoveObserver} if system does not allow
1564 * non-system apps to be moved to internal storage.
1565 *
1566 * @hide
1567 */
1568 public static final int MOVE_FAILED_3RD_PARTY_NOT_ALLOWED_ON_INTERNAL = -9;
1569
Jeff Sharkeya65e6492017-06-21 13:45:11 -06001570 /** @hide */
1571 public static final int MOVE_FAILED_LOCKED_USER = -10;
1572
Yao Chen022b8ea2016-12-16 11:03:28 -08001573 /**
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001574 * Flag parameter for {@link #movePackage} to indicate that
1575 * the package should be moved to internal storage if its
1576 * been installed on external media.
1577 * @hide
1578 */
Jeff Sharkey620b32b2015-04-23 19:36:02 -07001579 @Deprecated
Mathew Inwood5c0d3542018-08-14 13:54:31 +01001580 @UnsupportedAppUsage
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001581 public static final int MOVE_INTERNAL = 0x00000001;
1582
1583 /**
1584 * Flag parameter for {@link #movePackage} to indicate that
1585 * the package should be moved to external media.
1586 * @hide
1587 */
Jeff Sharkey620b32b2015-04-23 19:36:02 -07001588 @Deprecated
Mathew Inwood5c0d3542018-08-14 13:54:31 +01001589 @UnsupportedAppUsage
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001590 public static final int MOVE_EXTERNAL_MEDIA = 0x00000002;
1591
Jeff Sharkey620b32b2015-04-23 19:36:02 -07001592 /** {@hide} */
1593 public static final String EXTRA_MOVE_ID = "android.content.pm.extra.MOVE_ID";
1594
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001595 /**
Kenny Root05ca4c92011-09-15 10:36:25 -07001596 * Usable by the required verifier as the {@code verificationCode} argument
1597 * for {@link PackageManager#verifyPendingInstall} to indicate that it will
1598 * allow the installation to proceed without any of the optional verifiers
1599 * needing to vote.
1600 *
1601 * @hide
1602 */
1603 public static final int VERIFICATION_ALLOW_WITHOUT_SUFFICIENT = 2;
1604
1605 /**
Kenny Root3a9b5fb2011-09-20 14:15:38 -07001606 * Used as the {@code verificationCode} argument for
1607 * {@link PackageManager#verifyPendingInstall} to indicate that the calling
1608 * package verifier allows the installation to proceed.
1609 */
1610 public static final int VERIFICATION_ALLOW = 1;
1611
1612 /**
1613 * Used as the {@code verificationCode} argument for
1614 * {@link PackageManager#verifyPendingInstall} to indicate the calling
1615 * package verifier does not vote to allow the installation to proceed.
1616 */
1617 public static final int VERIFICATION_REJECT = -1;
1618
1619 /**
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001620 * Used as the {@code verificationCode} argument for
1621 * {@link PackageManager#verifyIntentFilter} to indicate that the calling
1622 * IntentFilter Verifier confirms that the IntentFilter is verified.
1623 *
1624 * @hide
1625 */
Todd Kennedydfa93ab2016-03-03 15:24:33 -08001626 @SystemApi
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001627 public static final int INTENT_FILTER_VERIFICATION_SUCCESS = 1;
1628
1629 /**
1630 * Used as the {@code verificationCode} argument for
1631 * {@link PackageManager#verifyIntentFilter} to indicate that the calling
1632 * IntentFilter Verifier confirms that the IntentFilter is NOT verified.
1633 *
1634 * @hide
1635 */
Todd Kennedydfa93ab2016-03-03 15:24:33 -08001636 @SystemApi
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001637 public static final int INTENT_FILTER_VERIFICATION_FAILURE = -1;
1638
1639 /**
1640 * Internal status code to indicate that an IntentFilter verification result is not specified.
1641 *
1642 * @hide
1643 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08001644 @SystemApi
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001645 public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED = 0;
1646
1647 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001648 * Used as the {@code status} argument for
1649 * {@link #updateIntentVerificationStatusAsUser} to indicate that the User
1650 * will always be prompted the Intent Disambiguation Dialog if there are two
1651 * or more Intent resolved for the IntentFilter's domain(s).
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001652 *
1653 * @hide
1654 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08001655 @SystemApi
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001656 public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK = 1;
1657
1658 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001659 * Used as the {@code status} argument for
1660 * {@link #updateIntentVerificationStatusAsUser} to indicate that the User
1661 * will never be prompted the Intent Disambiguation Dialog if there are two
1662 * or more resolution of the Intent. The default App for the domain(s)
1663 * specified in the IntentFilter will also ALWAYS be used.
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001664 *
1665 * @hide
1666 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08001667 @SystemApi
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001668 public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS = 2;
1669
1670 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001671 * Used as the {@code status} argument for
1672 * {@link #updateIntentVerificationStatusAsUser} to indicate that the User
1673 * may be prompted the Intent Disambiguation Dialog if there are two or more
1674 * Intent resolved. The default App for the domain(s) specified in the
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001675 * IntentFilter will also NEVER be presented to the User.
1676 *
1677 * @hide
1678 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08001679 @SystemApi
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001680 public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER = 3;
1681
1682 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001683 * Used as the {@code status} argument for
1684 * {@link #updateIntentVerificationStatusAsUser} to indicate that this app
1685 * should always be considered as an ambiguous candidate for handling the
1686 * matching Intent even if there are other candidate apps in the "always"
1687 * state. Put another way: if there are any 'always ask' apps in a set of
1688 * more than one candidate app, then a disambiguation is *always* presented
1689 * even if there is another candidate app with the 'always' state.
Christopher Tate56f0ff32015-08-13 16:29:33 -07001690 *
1691 * @hide
1692 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08001693 @SystemApi
Christopher Tate56f0ff32015-08-13 16:29:33 -07001694 public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS_ASK = 4;
1695
1696 /**
rich canningsd9ef3e52012-08-22 14:28:05 -07001697 * Can be used as the {@code millisecondsToDelay} argument for
1698 * {@link PackageManager#extendVerificationTimeout}. This is the
1699 * maximum time {@code PackageManager} waits for the verification
1700 * agent to return (in milliseconds).
1701 */
1702 public static final long MAXIMUM_VERIFICATION_TIMEOUT = 60*60*1000;
1703
1704 /**
Amith Yamasani0b285492011-04-14 17:35:23 -07001705 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: The device's
1706 * audio pipeline is low-latency, more suitable for audio applications sensitive to delays or
1707 * lag in sound input or output.
Dan Morrill898e1e82010-09-26 17:28:30 -07001708 */
1709 @SdkConstant(SdkConstantType.FEATURE)
1710 public static final String FEATURE_AUDIO_LOW_LATENCY = "android.hardware.audio.low_latency";
1711
1712 /**
1713 * Feature for {@link #getSystemAvailableFeatures} and
Unsuk Jung50909f62014-09-02 18:25:49 -07001714 * {@link #hasSystemFeature}: The device includes at least one form of audio
Glenn Kasten0a111ad2018-05-16 14:11:09 -07001715 * output, as defined in the Android Compatibility Definition Document (CDD)
1716 * <a href="https://source.android.com/compatibility/android-cdd#7_8_audio">section 7.8 Audio</a>.
Unsuk Jung50909f62014-09-02 18:25:49 -07001717 */
1718 @SdkConstant(SdkConstantType.FEATURE)
1719 public static final String FEATURE_AUDIO_OUTPUT = "android.hardware.audio.output";
1720
1721 /**
Glenn Kastencdcb5772015-05-06 15:54:49 -07001722 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Glenn Kasten7587edc2015-10-30 17:45:52 -07001723 * The device has professional audio level of functionality and performance.
Glenn Kastencdcb5772015-05-06 15:54:49 -07001724 */
1725 @SdkConstant(SdkConstantType.FEATURE)
1726 public static final String FEATURE_AUDIO_PRO = "android.hardware.audio.pro";
1727
1728 /**
Unsuk Jung50909f62014-09-02 18:25:49 -07001729 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001730 * {@link #hasSystemFeature}: The device is capable of communicating with
1731 * other devices via Bluetooth.
1732 */
1733 @SdkConstant(SdkConstantType.FEATURE)
1734 public static final String FEATURE_BLUETOOTH = "android.hardware.bluetooth";
1735
1736 /**
1737 * Feature for {@link #getSystemAvailableFeatures} and
Matthew Xiea7227722013-04-18 15:25:59 -07001738 * {@link #hasSystemFeature}: The device is capable of communicating with
1739 * other devices via Bluetooth Low Energy radio.
1740 */
1741 @SdkConstant(SdkConstantType.FEATURE)
1742 public static final String FEATURE_BLUETOOTH_LE = "android.hardware.bluetooth_le";
1743
1744 /**
1745 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001746 * {@link #hasSystemFeature}: The device has a camera facing away
1747 * from the screen.
1748 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001749 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001750 public static final String FEATURE_CAMERA = "android.hardware.camera";
Dan Morrill50ab63f2010-03-05 16:16:19 -08001751
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001752 /**
1753 * Feature for {@link #getSystemAvailableFeatures} and
1754 * {@link #hasSystemFeature}: The device's camera supports auto-focus.
1755 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001756 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001757 public static final String FEATURE_CAMERA_AUTOFOCUS = "android.hardware.camera.autofocus";
Dan Morrill50ab63f2010-03-05 16:16:19 -08001758
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001759 /**
1760 * Feature for {@link #getSystemAvailableFeatures} and
Eino-Ville Talvala752af832012-09-18 14:45:37 -07001761 * {@link #hasSystemFeature}: The device has at least one camera pointing in
Eino-Ville Talvala9131da22014-05-08 11:39:53 -07001762 * some direction, or can support an external camera being connected to it.
Eino-Ville Talvala752af832012-09-18 14:45:37 -07001763 */
1764 @SdkConstant(SdkConstantType.FEATURE)
1765 public static final String FEATURE_CAMERA_ANY = "android.hardware.camera.any";
1766
1767 /**
1768 * Feature for {@link #getSystemAvailableFeatures} and
Eino-Ville Talvala9131da22014-05-08 11:39:53 -07001769 * {@link #hasSystemFeature}: The device can support having an external camera connected to it.
1770 * The external camera may not always be connected or available to applications to use.
1771 */
1772 @SdkConstant(SdkConstantType.FEATURE)
1773 public static final String FEATURE_CAMERA_EXTERNAL = "android.hardware.camera.external";
1774
1775 /**
1776 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001777 * {@link #hasSystemFeature}: The device's camera supports flash.
1778 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001779 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001780 public static final String FEATURE_CAMERA_FLASH = "android.hardware.camera.flash";
Dan Morrill50ab63f2010-03-05 16:16:19 -08001781
1782 /**
1783 * Feature for {@link #getSystemAvailableFeatures} and
Chih-Chung Changde1057c2010-06-14 19:15:00 +08001784 * {@link #hasSystemFeature}: The device has a front facing camera.
1785 */
1786 @SdkConstant(SdkConstantType.FEATURE)
1787 public static final String FEATURE_CAMERA_FRONT = "android.hardware.camera.front";
1788
1789 /**
Eino-Ville Talvala611fece2014-07-10 17:29:38 -07001790 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one
1791 * of the cameras on the device supports the
1792 * {@link android.hardware.camera2.CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL full hardware}
1793 * capability level.
1794 */
1795 @SdkConstant(SdkConstantType.FEATURE)
1796 public static final String FEATURE_CAMERA_LEVEL_FULL = "android.hardware.camera.level.full";
1797
1798 /**
1799 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one
1800 * of the cameras on the device supports the
1801 * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR manual sensor}
1802 * capability level.
1803 */
1804 @SdkConstant(SdkConstantType.FEATURE)
1805 public static final String FEATURE_CAMERA_CAPABILITY_MANUAL_SENSOR =
1806 "android.hardware.camera.capability.manual_sensor";
1807
1808 /**
1809 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one
1810 * of the cameras on the device supports the
1811 * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MANUAL_POST_PROCESSING manual post-processing}
1812 * capability level.
1813 */
1814 @SdkConstant(SdkConstantType.FEATURE)
1815 public static final String FEATURE_CAMERA_CAPABILITY_MANUAL_POST_PROCESSING =
1816 "android.hardware.camera.capability.manual_post_processing";
1817
1818 /**
1819 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one
1820 * of the cameras on the device supports the
1821 * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_RAW RAW}
1822 * capability level.
1823 */
1824 @SdkConstant(SdkConstantType.FEATURE)
1825 public static final String FEATURE_CAMERA_CAPABILITY_RAW =
1826 "android.hardware.camera.capability.raw";
1827
1828 /**
Eino-Ville Talvaladfa0c2a2018-01-10 12:01:08 -08001829 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one
1830 * of the cameras on the device supports the
1831 * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MOTION_TRACKING
1832 * MOTION_TRACKING} capability level.
1833 */
1834 @SdkConstant(SdkConstantType.FEATURE)
1835 public static final String FEATURE_CAMERA_AR =
1836 "android.hardware.camera.ar";
1837
1838 /**
Chih-Chung Changde1057c2010-06-14 19:15:00 +08001839 * Feature for {@link #getSystemAvailableFeatures} and
Alex Ray0c9d61f2013-10-03 12:17:54 -07001840 * {@link #hasSystemFeature}: The device is capable of communicating with
1841 * consumer IR devices.
1842 */
1843 @SdkConstant(SdkConstantType.FEATURE)
1844 public static final String FEATURE_CONSUMER_IR = "android.hardware.consumerir";
1845
Sam Lin90e258b2017-04-03 20:57:45 -07001846 /** {@hide} */
1847 @SdkConstant(SdkConstantType.FEATURE)
1848 public static final String FEATURE_CTS = "android.software.cts";
1849
Alex Ray0c9d61f2013-10-03 12:17:54 -07001850 /**
1851 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001852 * {@link #hasSystemFeature}: The device supports one or more methods of
1853 * reporting current location.
1854 */
1855 @SdkConstant(SdkConstantType.FEATURE)
1856 public static final String FEATURE_LOCATION = "android.hardware.location";
1857
1858 /**
1859 * Feature for {@link #getSystemAvailableFeatures} and
1860 * {@link #hasSystemFeature}: The device has a Global Positioning System
1861 * receiver and can report precise location.
1862 */
1863 @SdkConstant(SdkConstantType.FEATURE)
1864 public static final String FEATURE_LOCATION_GPS = "android.hardware.location.gps";
1865
1866 /**
1867 * Feature for {@link #getSystemAvailableFeatures} and
1868 * {@link #hasSystemFeature}: The device can report location with coarse
1869 * accuracy using a network-based geolocation system.
1870 */
1871 @SdkConstant(SdkConstantType.FEATURE)
1872 public static final String FEATURE_LOCATION_NETWORK = "android.hardware.location.network";
1873
1874 /**
1875 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn2a103f12017-08-08 15:50:31 -07001876 * {@link #hasSystemFeature}: The device's
1877 * {@link ActivityManager#isLowRamDevice() ActivityManager.isLowRamDevice()} method returns
1878 * true.
1879 */
1880 @SdkConstant(SdkConstantType.FEATURE)
1881 public static final String FEATURE_RAM_LOW = "android.hardware.ram.low";
1882
1883 /**
1884 * Feature for {@link #getSystemAvailableFeatures} and
1885 * {@link #hasSystemFeature}: The device's
1886 * {@link ActivityManager#isLowRamDevice() ActivityManager.isLowRamDevice()} method returns
1887 * false.
1888 */
1889 @SdkConstant(SdkConstantType.FEATURE)
1890 public static final String FEATURE_RAM_NORMAL = "android.hardware.ram.normal";
1891
1892 /**
1893 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001894 * {@link #hasSystemFeature}: The device can record audio via a
1895 * microphone.
1896 */
1897 @SdkConstant(SdkConstantType.FEATURE)
1898 public static final String FEATURE_MICROPHONE = "android.hardware.microphone";
1899
1900 /**
1901 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill76437d32010-09-01 11:17:20 -07001902 * {@link #hasSystemFeature}: The device can communicate using Near-Field
1903 * Communications (NFC).
1904 */
1905 @SdkConstant(SdkConstantType.FEATURE)
1906 public static final String FEATURE_NFC = "android.hardware.nfc";
1907
1908 /**
1909 * Feature for {@link #getSystemAvailableFeatures} and
Martijn Coenenf4bf1582013-07-22 12:01:19 -07001910 * {@link #hasSystemFeature}: The device supports host-
1911 * based NFC card emulation.
Martijn Coenendf4d1d62013-08-28 11:18:58 -07001912 *
1913 * TODO remove when depending apps have moved to new constant.
1914 * @hide
1915 * @deprecated
Martijn Coenenf4bf1582013-07-22 12:01:19 -07001916 */
Jose Lima970417c2014-04-10 10:42:19 -07001917 @Deprecated
Martijn Coenenf4bf1582013-07-22 12:01:19 -07001918 @SdkConstant(SdkConstantType.FEATURE)
1919 public static final String FEATURE_NFC_HCE = "android.hardware.nfc.hce";
1920
1921 /**
1922 * Feature for {@link #getSystemAvailableFeatures} and
Martijn Coenendf4d1d62013-08-28 11:18:58 -07001923 * {@link #hasSystemFeature}: The device supports host-
1924 * based NFC card emulation.
1925 */
1926 @SdkConstant(SdkConstantType.FEATURE)
1927 public static final String FEATURE_NFC_HOST_CARD_EMULATION = "android.hardware.nfc.hce";
1928
1929 /**
1930 * Feature for {@link #getSystemAvailableFeatures} and
Yoshinobu Itoc52adfe2016-01-22 18:14:18 +09001931 * {@link #hasSystemFeature}: The device supports host-
1932 * based NFC-F card emulation.
1933 */
1934 @SdkConstant(SdkConstantType.FEATURE)
1935 public static final String FEATURE_NFC_HOST_CARD_EMULATION_NFCF = "android.hardware.nfc.hcef";
1936
1937 /**
1938 * Feature for {@link #getSystemAvailableFeatures} and
Ruchi Kandoiebf267a2018-10-16 17:29:16 -07001939 * {@link #hasSystemFeature}: The device supports uicc-
1940 * based NFC card emulation.
1941 */
1942 @SdkConstant(SdkConstantType.FEATURE)
1943 public static final String FEATURE_NFC_OFF_HOST_CARD_EMULATION_UICC =
1944 "android.hardware.nfc.uicc";
1945
1946 /**
1947 * Feature for {@link #getSystemAvailableFeatures} and
1948 * {@link #hasSystemFeature}: The device supports eSE-
1949 * based NFC card emulation.
1950 */
1951 @SdkConstant(SdkConstantType.FEATURE)
1952 public static final String FEATURE_NFC_OFF_HOST_CARD_EMULATION_ESE = "android.hardware.nfc.ese";
1953
1954 /**
1955 * Feature for {@link #getSystemAvailableFeatures} and
Ruchi Kandoi96fe50b2018-10-23 14:40:29 -07001956 * {@link #hasSystemFeature}: The Beam API is enabled on the device.
1957 */
1958 @SdkConstant(SdkConstantType.FEATURE)
1959 public static final String FEATURE_NFC_BEAM = "android.sofware.nfc.beam";
1960
1961 /**
1962 * Feature for {@link #getSystemAvailableFeatures} and
Martijn Coenen441d61b2017-04-12 13:52:40 -07001963 * {@link #hasSystemFeature}: The device supports any
1964 * one of the {@link #FEATURE_NFC}, {@link #FEATURE_NFC_HOST_CARD_EMULATION},
1965 * or {@link #FEATURE_NFC_HOST_CARD_EMULATION_NFCF} features.
1966 *
1967 * @hide
1968 */
1969 @SdkConstant(SdkConstantType.FEATURE)
1970 public static final String FEATURE_NFC_ANY = "android.hardware.nfc.any";
1971
1972 /**
1973 * Feature for {@link #getSystemAvailableFeatures} and
Jesse Hall7f517062014-07-18 11:54:41 -07001974 * {@link #hasSystemFeature}: The device supports the OpenGL ES
1975 * <a href="http://www.khronos.org/registry/gles/extensions/ANDROID/ANDROID_extension_pack_es31a.txt">
1976 * Android Extension Pack</a>.
1977 */
1978 @SdkConstant(SdkConstantType.FEATURE)
1979 public static final String FEATURE_OPENGLES_EXTENSION_PACK = "android.hardware.opengles.aep";
1980
1981 /**
1982 * Feature for {@link #getSystemAvailableFeatures} and
Jesse Hall39ceeb52016-03-10 09:04:26 -08001983 * {@link #hasSystemFeature(String, int)}: If this feature is supported, the Vulkan native API
1984 * will enumerate at least one {@code VkPhysicalDevice}, and the feature version will indicate
1985 * what level of optional hardware features limits it supports.
Jesse Hallf77a34f2016-02-04 18:41:33 -08001986 * <p>
1987 * Level 0 includes the base Vulkan requirements as well as:
1988 * <ul><li>{@code VkPhysicalDeviceFeatures::textureCompressionETC2}</li></ul>
1989 * <p>
1990 * Level 1 additionally includes:
1991 * <ul>
1992 * <li>{@code VkPhysicalDeviceFeatures::fullDrawIndexUint32}</li>
1993 * <li>{@code VkPhysicalDeviceFeatures::imageCubeArray}</li>
1994 * <li>{@code VkPhysicalDeviceFeatures::independentBlend}</li>
1995 * <li>{@code VkPhysicalDeviceFeatures::geometryShader}</li>
1996 * <li>{@code VkPhysicalDeviceFeatures::tessellationShader}</li>
1997 * <li>{@code VkPhysicalDeviceFeatures::sampleRateShading}</li>
1998 * <li>{@code VkPhysicalDeviceFeatures::textureCompressionASTC_LDR}</li>
1999 * <li>{@code VkPhysicalDeviceFeatures::fragmentStoresAndAtomics}</li>
2000 * <li>{@code VkPhysicalDeviceFeatures::shaderImageGatherExtended}</li>
2001 * <li>{@code VkPhysicalDeviceFeatures::shaderUniformBufferArrayDynamicIndexing}</li>
2002 * <li>{@code VkPhysicalDeviceFeatures::shaderSampledImageArrayDynamicIndexing}</li>
2003 * </ul>
2004 */
2005 @SdkConstant(SdkConstantType.FEATURE)
2006 public static final String FEATURE_VULKAN_HARDWARE_LEVEL = "android.hardware.vulkan.level";
2007
2008 /**
2009 * Feature for {@link #getSystemAvailableFeatures} and
Jesse Hall1cd7e932017-02-05 19:58:15 -08002010 * {@link #hasSystemFeature(String, int)}: If this feature is supported, the Vulkan native API
2011 * will enumerate at least one {@code VkPhysicalDevice}, and the feature version will indicate
Jesse Hall54fc6092017-08-22 07:19:56 -07002012 * what level of optional compute features that device supports beyond the Vulkan 1.0
2013 * requirements.
Jesse Hall1cd7e932017-02-05 19:58:15 -08002014 * <p>
Jesse Hall54fc6092017-08-22 07:19:56 -07002015 * Compute level 0 indicates:
2016 * <ul>
2017 * <li>The {@code VK_KHR_variable_pointers} extension and
2018 * {@code VkPhysicalDeviceVariablePointerFeaturesKHR::variablePointers} feature are
2019 supported.</li>
2020 * <li>{@code VkPhysicalDeviceLimits::maxPerStageDescriptorStorageBuffers} is at least 16.</li>
2021 * </ul>
Jesse Hall1cd7e932017-02-05 19:58:15 -08002022 */
2023 @SdkConstant(SdkConstantType.FEATURE)
2024 public static final String FEATURE_VULKAN_HARDWARE_COMPUTE = "android.hardware.vulkan.compute";
2025
2026 /**
2027 * Feature for {@link #getSystemAvailableFeatures} and
Jesse Hall39ceeb52016-03-10 09:04:26 -08002028 * {@link #hasSystemFeature(String, int)}: The version of this feature indicates the highest
Jesse Hallf77a34f2016-02-04 18:41:33 -08002029 * {@code VkPhysicalDeviceProperties::apiVersion} supported by the physical devices that support
2030 * the hardware level indicated by {@link #FEATURE_VULKAN_HARDWARE_LEVEL}. The feature version
2031 * uses the same encoding as Vulkan version numbers:
2032 * <ul>
2033 * <li>Major version number in bits 31-22</li>
2034 * <li>Minor version number in bits 21-12</li>
2035 * <li>Patch version number in bits 11-0</li>
2036 * </ul>
Jesse Hall239373f2018-01-26 11:35:10 +08002037 * A version of 1.1.0 or higher also indicates:
2038 * <ul>
Yiwei Zhang58f9c482018-07-31 17:55:43 -07002039 * <li>The {@code VK_ANDROID_external_memory_android_hardware_buffer} extension is
2040 * supported.</li>
Jesse Hall239373f2018-01-26 11:35:10 +08002041 * <li>{@code SYNC_FD} external semaphore and fence handles are supported.</li>
2042 * <li>{@code VkPhysicalDeviceSamplerYcbcrConversionFeatures::samplerYcbcrConversion} is
2043 * supported.</li>
2044 * </ul>
Jesse Hallf77a34f2016-02-04 18:41:33 -08002045 */
2046 @SdkConstant(SdkConstantType.FEATURE)
2047 public static final String FEATURE_VULKAN_HARDWARE_VERSION = "android.hardware.vulkan.version";
2048
2049 /**
Tomasz Wasilczyk05392d62017-07-10 19:33:22 -07002050 * Feature for {@link #getSystemAvailableFeatures} and
2051 * {@link #hasSystemFeature}: The device includes broadcast radio tuner.
2052 * @hide
Tomasz Wasilczyk347192e2017-04-04 11:13:44 -07002053 */
Tomasz Wasilczyk05392d62017-07-10 19:33:22 -07002054 @SystemApi
Tomasz Wasilczyk347192e2017-04-04 11:13:44 -07002055 @SdkConstant(SdkConstantType.FEATURE)
Tomasz Wasilczyk05392d62017-07-10 19:33:22 -07002056 public static final String FEATURE_BROADCAST_RADIO = "android.hardware.broadcastradio";
Tomasz Wasilczyk347192e2017-04-04 11:13:44 -07002057
2058 /**
Jesse Hallf77a34f2016-02-04 18:41:33 -08002059 * Feature for {@link #getSystemAvailableFeatures} and
Lenka Trochtova66c492a2018-12-06 11:29:21 +01002060 * {@link #hasSystemFeature}: The device has a secure implementation of keyguard, meaning the
2061 * device supports PIN, pattern and password as defined in Android CDD
2062 */
2063 @SdkConstant(SdkConstantType.FEATURE)
2064 public static final String FEATURE_SECURE_LOCK_SCREEN = "android.software.secure_lock_screen";
2065
2066 /**
2067 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill5744bb42010-09-01 19:18:57 -07002068 * {@link #hasSystemFeature}: The device includes an accelerometer.
2069 */
2070 @SdkConstant(SdkConstantType.FEATURE)
2071 public static final String FEATURE_SENSOR_ACCELEROMETER = "android.hardware.sensor.accelerometer";
2072
2073 /**
2074 * Feature for {@link #getSystemAvailableFeatures} and
2075 * {@link #hasSystemFeature}: The device includes a barometer (air
2076 * pressure sensor.)
2077 */
2078 @SdkConstant(SdkConstantType.FEATURE)
2079 public static final String FEATURE_SENSOR_BAROMETER = "android.hardware.sensor.barometer";
2080
2081 /**
2082 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08002083 * {@link #hasSystemFeature}: The device includes a magnetometer (compass).
2084 */
2085 @SdkConstant(SdkConstantType.FEATURE)
2086 public static final String FEATURE_SENSOR_COMPASS = "android.hardware.sensor.compass";
2087
2088 /**
2089 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill5744bb42010-09-01 19:18:57 -07002090 * {@link #hasSystemFeature}: The device includes a gyroscope.
Dan Morrill50ab63f2010-03-05 16:16:19 -08002091 */
2092 @SdkConstant(SdkConstantType.FEATURE)
Dan Morrill5744bb42010-09-01 19:18:57 -07002093 public static final String FEATURE_SENSOR_GYROSCOPE = "android.hardware.sensor.gyroscope";
Dan Morrill50ab63f2010-03-05 16:16:19 -08002094
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002095 /**
2096 * Feature for {@link #getSystemAvailableFeatures} and
2097 * {@link #hasSystemFeature}: The device includes a light sensor.
2098 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08002099 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002100 public static final String FEATURE_SENSOR_LIGHT = "android.hardware.sensor.light";
Dan Morrill50ab63f2010-03-05 16:16:19 -08002101
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002102 /**
2103 * Feature for {@link #getSystemAvailableFeatures} and
2104 * {@link #hasSystemFeature}: The device includes a proximity sensor.
2105 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08002106 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002107 public static final String FEATURE_SENSOR_PROXIMITY = "android.hardware.sensor.proximity";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002108
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002109 /**
2110 * Feature for {@link #getSystemAvailableFeatures} and
Aravind Akella068b0c02013-10-12 17:39:15 -07002111 * {@link #hasSystemFeature}: The device includes a hardware step counter.
2112 */
2113 @SdkConstant(SdkConstantType.FEATURE)
2114 public static final String FEATURE_SENSOR_STEP_COUNTER = "android.hardware.sensor.stepcounter";
2115
2116 /**
2117 * Feature for {@link #getSystemAvailableFeatures} and
2118 * {@link #hasSystemFeature}: The device includes a hardware step detector.
2119 */
2120 @SdkConstant(SdkConstantType.FEATURE)
2121 public static final String FEATURE_SENSOR_STEP_DETECTOR = "android.hardware.sensor.stepdetector";
2122
2123 /**
2124 * Feature for {@link #getSystemAvailableFeatures} and
Vinod Krishnan8afb23c2014-04-30 11:11:39 -07002125 * {@link #hasSystemFeature}: The device includes a heart rate monitor.
2126 */
2127 @SdkConstant(SdkConstantType.FEATURE)
2128 public static final String FEATURE_SENSOR_HEART_RATE = "android.hardware.sensor.heartrate";
2129
2130 /**
2131 * Feature for {@link #getSystemAvailableFeatures} and
Trevor Johns682c24e2016-04-12 10:13:47 -07002132 * {@link #hasSystemFeature}: The heart rate sensor on this device is an Electrocardiogram.
Vinod Krishnan1ab76892014-08-20 11:11:55 -07002133 */
2134 @SdkConstant(SdkConstantType.FEATURE)
2135 public static final String FEATURE_SENSOR_HEART_RATE_ECG =
2136 "android.hardware.sensor.heartrate.ecg";
2137
2138 /**
2139 * Feature for {@link #getSystemAvailableFeatures} and
Aravind Akella8b8e74b2014-07-09 11:52:39 -07002140 * {@link #hasSystemFeature}: The device includes a relative humidity sensor.
2141 */
2142 @SdkConstant(SdkConstantType.FEATURE)
2143 public static final String FEATURE_SENSOR_RELATIVE_HUMIDITY =
2144 "android.hardware.sensor.relative_humidity";
2145
2146 /**
2147 * Feature for {@link #getSystemAvailableFeatures} and
2148 * {@link #hasSystemFeature}: The device includes an ambient temperature sensor.
2149 */
2150 @SdkConstant(SdkConstantType.FEATURE)
2151 public static final String FEATURE_SENSOR_AMBIENT_TEMPERATURE =
2152 "android.hardware.sensor.ambient_temperature";
2153
2154 /**
2155 * Feature for {@link #getSystemAvailableFeatures} and
Ashutosh Joshieae371b2015-04-09 10:30:07 -07002156 * {@link #hasSystemFeature}: The device supports high fidelity sensor processing
2157 * capabilities.
2158 */
2159 @SdkConstant(SdkConstantType.FEATURE)
2160 public static final String FEATURE_HIFI_SENSORS =
2161 "android.hardware.sensor.hifi_sensors";
2162
2163 /**
Philip Quinnb6bd3012018-02-09 17:56:40 -08002164 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2165 * The device supports a hardware mechanism for invoking an assist gesture.
2166 * @see android.provider.Settings.Secure#ASSIST_GESTURE_ENABLED
2167 * @hide
2168 */
2169 @SdkConstant(SdkConstantType.FEATURE)
2170 public static final String FEATURE_ASSIST_GESTURE = "android.hardware.sensor.assist";
2171
2172 /**
Ashutosh Joshieae371b2015-04-09 10:30:07 -07002173 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002174 * {@link #hasSystemFeature}: The device has a telephony radio with data
2175 * communication support.
2176 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08002177 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002178 public static final String FEATURE_TELEPHONY = "android.hardware.telephony";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002179
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002180 /**
2181 * Feature for {@link #getSystemAvailableFeatures} and
2182 * {@link #hasSystemFeature}: The device has a CDMA telephony stack.
2183 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08002184 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002185 public static final String FEATURE_TELEPHONY_CDMA = "android.hardware.telephony.cdma";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002186
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002187 /**
2188 * Feature for {@link #getSystemAvailableFeatures} and
2189 * {@link #hasSystemFeature}: The device has a GSM telephony stack.
2190 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08002191 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002192 public static final String FEATURE_TELEPHONY_GSM = "android.hardware.telephony.gsm";
Hung-ying Tyan3424c022010-08-27 18:08:19 +08002193
2194 /**
Polina Bondarenko80909ce2017-01-12 21:10:38 +01002195 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2196 * The device supports telephony carrier restriction mechanism.
2197 *
2198 * <p>Devices declaring this feature must have an implementation of the
2199 * {@link android.telephony.TelephonyManager#getAllowedCarriers} and
2200 * {@link android.telephony.TelephonyManager#setAllowedCarriers}.
2201 * @hide
2202 */
2203 @SystemApi
2204 @SdkConstant(SdkConstantType.FEATURE)
2205 public static final String FEATURE_TELEPHONY_CARRIERLOCK =
2206 "android.hardware.telephony.carrierlock";
2207
2208 /**
Jeff Davidson35cda392017-02-27 09:46:00 -08002209 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: The device
2210 * supports embedded subscriptions on eUICCs.
Jeff Davidson35cda392017-02-27 09:46:00 -08002211 */
2212 @SdkConstant(SdkConstantType.FEATURE)
2213 public static final String FEATURE_TELEPHONY_EUICC = "android.hardware.telephony.euicc";
2214
2215 /**
Hall Liuc6703d92017-11-17 11:31:57 -08002216 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: The device
2217 * supports cell-broadcast reception using the MBMS APIs.
2218 */
2219 @SdkConstant(SdkConstantType.FEATURE)
2220 public static final String FEATURE_TELEPHONY_MBMS = "android.hardware.telephony.mbms";
2221
2222 /**
Brad Ebinger4e65f802019-01-23 15:01:54 -08002223 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: The device
2224 * supports attaching to IMS implementations using the ImsService API in telephony.
2225 */
2226 @SdkConstant(SdkConstantType.FEATURE)
2227 public static final String FEATURE_TELEPHONY_IMS = "android.hardware.telephony.ims";
2228
2229 /**
Hung-ying Tyan3424c022010-08-27 18:08:19 +08002230 * Feature for {@link #getSystemAvailableFeatures} and
Mike Lockwoodf4ca2472011-02-27 11:23:25 -08002231 * {@link #hasSystemFeature}: The device supports connecting to USB devices
2232 * as the USB host.
2233 */
2234 @SdkConstant(SdkConstantType.FEATURE)
2235 public static final String FEATURE_USB_HOST = "android.hardware.usb.host";
2236
2237 /**
2238 * Feature for {@link #getSystemAvailableFeatures} and
2239 * {@link #hasSystemFeature}: The device supports connecting to USB accessories.
2240 */
2241 @SdkConstant(SdkConstantType.FEATURE)
2242 public static final String FEATURE_USB_ACCESSORY = "android.hardware.usb.accessory";
2243
2244 /**
2245 * Feature for {@link #getSystemAvailableFeatures} and
Hung-ying Tyan3424c022010-08-27 18:08:19 +08002246 * {@link #hasSystemFeature}: The SIP API is enabled on the device.
2247 */
2248 @SdkConstant(SdkConstantType.FEATURE)
2249 public static final String FEATURE_SIP = "android.software.sip";
2250
2251 /**
2252 * Feature for {@link #getSystemAvailableFeatures} and
2253 * {@link #hasSystemFeature}: The device supports SIP-based VOIP.
2254 */
2255 @SdkConstant(SdkConstantType.FEATURE)
2256 public static final String FEATURE_SIP_VOIP = "android.software.sip.voip";
2257
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002258 /**
2259 * Feature for {@link #getSystemAvailableFeatures} and
Ihab Awad1ec68882014-09-12 11:09:01 -07002260 * {@link #hasSystemFeature}: The Connection Service API is enabled on the device.
2261 */
2262 @SdkConstant(SdkConstantType.FEATURE)
2263 public static final String FEATURE_CONNECTION_SERVICE = "android.software.connectionservice";
2264
2265 /**
2266 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrillb0fe0332010-04-05 14:43:58 -07002267 * {@link #hasSystemFeature}: The device's display has a touch screen.
2268 */
2269 @SdkConstant(SdkConstantType.FEATURE)
2270 public static final String FEATURE_TOUCHSCREEN = "android.hardware.touchscreen";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002271
Dan Morrillb0fe0332010-04-05 14:43:58 -07002272 /**
2273 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08002274 * {@link #hasSystemFeature}: The device's touch screen supports
2275 * multitouch sufficient for basic two-finger gesture detection.
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002276 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08002277 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002278 public static final String FEATURE_TOUCHSCREEN_MULTITOUCH = "android.hardware.touchscreen.multitouch";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002279
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002280 /**
2281 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08002282 * {@link #hasSystemFeature}: The device's touch screen is capable of
2283 * tracking two or more fingers fully independently.
2284 */
2285 @SdkConstant(SdkConstantType.FEATURE)
2286 public static final String FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT = "android.hardware.touchscreen.multitouch.distinct";
2287
2288 /**
2289 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill6993d3d2010-09-03 14:30:14 -07002290 * {@link #hasSystemFeature}: The device's touch screen is capable of
2291 * tracking a full hand of fingers fully independently -- that is, 5 or
2292 * more simultaneous independent pointers.
2293 */
2294 @SdkConstant(SdkConstantType.FEATURE)
2295 public static final String FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND = "android.hardware.touchscreen.multitouch.jazzhand";
2296
2297 /**
2298 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrilla5376872011-01-23 13:15:53 -08002299 * {@link #hasSystemFeature}: The device does not have a touch screen, but
2300 * does support touch emulation for basic events. For instance, the
2301 * device might use a mouse or remote control to drive a cursor, and
2302 * emulate basic touch pointer events like down, up, drag, etc. All
2303 * devices that support android.hardware.touchscreen or a sub-feature are
2304 * presumed to also support faketouch.
2305 */
2306 @SdkConstant(SdkConstantType.FEATURE)
2307 public static final String FEATURE_FAKETOUCH = "android.hardware.faketouch";
2308
2309 /**
2310 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborne22fe932011-06-08 20:24:29 -07002311 * {@link #hasSystemFeature}: The device does not have a touch screen, but
2312 * does support touch emulation for basic events that supports distinct
2313 * tracking of two or more fingers. This is an extension of
2314 * {@link #FEATURE_FAKETOUCH} for input devices with this capability. Note
2315 * that unlike a distinct multitouch screen as defined by
2316 * {@link #FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT}, these kinds of input
2317 * devices will not actually provide full two-finger gestures since the
2318 * input is being transformed to cursor movement on the screen. That is,
2319 * single finger gestures will move a cursor; two-finger swipes will
2320 * result in single-finger touch events; other two-finger gestures will
2321 * result in the corresponding two-finger touch event.
2322 */
2323 @SdkConstant(SdkConstantType.FEATURE)
2324 public static final String FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT = "android.hardware.faketouch.multitouch.distinct";
2325
2326 /**
2327 * Feature for {@link #getSystemAvailableFeatures} and
2328 * {@link #hasSystemFeature}: The device does not have a touch screen, but
2329 * does support touch emulation for basic events that supports tracking
2330 * a hand of fingers (5 or more fingers) fully independently.
2331 * This is an extension of
2332 * {@link #FEATURE_FAKETOUCH} for input devices with this capability. Note
2333 * that unlike a multitouch screen as defined by
2334 * {@link #FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND}, not all two finger
2335 * gestures can be detected due to the limitations described for
2336 * {@link #FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT}.
2337 */
2338 @SdkConstant(SdkConstantType.FEATURE)
2339 public static final String FEATURE_FAKETOUCH_MULTITOUCH_JAZZHAND = "android.hardware.faketouch.multitouch.jazzhand";
2340
2341 /**
2342 * Feature for {@link #getSystemAvailableFeatures} and
Jim Millerd9b9d412015-07-22 19:51:40 -07002343 * {@link #hasSystemFeature}: The device has biometric hardware to detect a fingerprint.
Gilad Brettercb51b8b2018-03-22 17:04:51 +02002344 */
Jim Millerd9b9d412015-07-22 19:51:40 -07002345 @SdkConstant(SdkConstantType.FEATURE)
Kevin Chyn59c2da712019-01-22 10:35:56 -08002346 public static final String FEATURE_FINGERPRINT = "android.hardware.fingerprint";
Jim Millerd9b9d412015-07-22 19:51:40 -07002347
2348 /**
2349 * Feature for {@link #getSystemAvailableFeatures} and
Gilad Brettercb51b8b2018-03-22 17:04:51 +02002350 * {@link #hasSystemFeature}: The device has biometric hardware to perform face authentication.
Gilad Brettercb51b8b2018-03-22 17:04:51 +02002351 */
2352 @SdkConstant(SdkConstantType.FEATURE)
Kevin Chyn5c5603d2018-12-13 18:06:10 -08002353 public static final String FEATURE_FACE = "android.hardware.biometrics.face";
Gilad Brettercb51b8b2018-03-22 17:04:51 +02002354
2355 /**
2356 * Feature for {@link #getSystemAvailableFeatures} and
Kevin Chyna24e9fd2018-08-27 12:39:17 -07002357 * {@link #hasSystemFeature}: The device has biometric hardware to perform iris authentication.
Kevin Chyna24e9fd2018-08-27 12:39:17 -07002358 */
2359 @SdkConstant(SdkConstantType.FEATURE)
Kevin Chyn5c5603d2018-12-13 18:06:10 -08002360 public static final String FEATURE_IRIS = "android.hardware.biometrics.iris";
Kevin Chyna24e9fd2018-08-27 12:39:17 -07002361
2362 /**
2363 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborne289bff2011-06-13 19:33:22 -07002364 * {@link #hasSystemFeature}: The device supports portrait orientation
2365 * screens. For backwards compatibility, you can assume that if neither
2366 * this nor {@link #FEATURE_SCREEN_LANDSCAPE} is set then the device supports
2367 * both portrait and landscape.
2368 */
2369 @SdkConstant(SdkConstantType.FEATURE)
2370 public static final String FEATURE_SCREEN_PORTRAIT = "android.hardware.screen.portrait";
2371
2372 /**
2373 * Feature for {@link #getSystemAvailableFeatures} and
2374 * {@link #hasSystemFeature}: The device supports landscape orientation
2375 * screens. For backwards compatibility, you can assume that if neither
2376 * this nor {@link #FEATURE_SCREEN_PORTRAIT} is set then the device supports
2377 * both portrait and landscape.
2378 */
2379 @SdkConstant(SdkConstantType.FEATURE)
2380 public static final String FEATURE_SCREEN_LANDSCAPE = "android.hardware.screen.landscape";
2381
2382 /**
2383 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002384 * {@link #hasSystemFeature}: The device supports live wallpapers.
2385 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08002386 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002387 public static final String FEATURE_LIVE_WALLPAPER = "android.software.live_wallpaper";
Oscar Montemayor1228d0a2010-01-28 12:01:44 -08002388 /**
Dan Morrill50ab63f2010-03-05 16:16:19 -08002389 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn119bbc32013-03-22 17:27:25 -07002390 * {@link #hasSystemFeature}: The device supports app widgets.
2391 */
2392 @SdkConstant(SdkConstantType.FEATURE)
2393 public static final String FEATURE_APP_WIDGETS = "android.software.app_widgets";
Dianne Hackbornc8e4fad2018-05-04 11:31:09 -07002394 /**
2395 * Feature for {@link #getSystemAvailableFeatures} and
2396 * {@link #hasSystemFeature}: The device supports the
2397 * {@link android.R.attr#cantSaveState} API.
2398 */
2399 @SdkConstant(SdkConstantType.FEATURE)
2400 public static final String FEATURE_CANT_SAVE_STATE = "android.software.cant_save_state";
Dianne Hackborn119bbc32013-03-22 17:27:25 -07002401
2402 /**
Dianne Hackborn91097de2014-04-04 18:02:06 -07002403 * @hide
2404 * Feature for {@link #getSystemAvailableFeatures} and
2405 * {@link #hasSystemFeature}: The device supports
2406 * {@link android.service.voice.VoiceInteractionService} and
2407 * {@link android.app.VoiceInteractor}.
2408 */
2409 @SdkConstant(SdkConstantType.FEATURE)
2410 public static final String FEATURE_VOICE_RECOGNIZERS = "android.software.voice_recognizers";
2411
2412
2413 /**
Dianne Hackborn119bbc32013-03-22 17:27:25 -07002414 * Feature for {@link #getSystemAvailableFeatures} and
2415 * {@link #hasSystemFeature}: The device supports a home screen that is replaceable
2416 * by third party applications.
2417 */
2418 @SdkConstant(SdkConstantType.FEATURE)
2419 public static final String FEATURE_HOME_SCREEN = "android.software.home_screen";
2420
2421 /**
2422 * Feature for {@link #getSystemAvailableFeatures} and
2423 * {@link #hasSystemFeature}: The device supports adding new input methods implemented
2424 * with the {@link android.inputmethodservice.InputMethodService} API.
2425 */
2426 @SdkConstant(SdkConstantType.FEATURE)
2427 public static final String FEATURE_INPUT_METHODS = "android.software.input_methods";
2428
2429 /**
2430 * Feature for {@link #getSystemAvailableFeatures} and
Amith Yamasani44a01b72013-09-16 10:44:57 -07002431 * {@link #hasSystemFeature}: The device supports device policy enforcement via device admins.
2432 */
2433 @SdkConstant(SdkConstantType.FEATURE)
2434 public static final String FEATURE_DEVICE_ADMIN = "android.software.device_admin";
2435
2436 /**
2437 * Feature for {@link #getSystemAvailableFeatures} and
Tim Kilbournf94b6a92014-03-07 15:13:48 -08002438 * {@link #hasSystemFeature}: The device supports leanback UI. This is
2439 * typically used in a living room television experience, but is a software
2440 * feature unlike {@link #FEATURE_TELEVISION}. Devices running with this
2441 * feature will use resources associated with the "television" UI mode.
2442 */
2443 @SdkConstant(SdkConstantType.FEATURE)
2444 public static final String FEATURE_LEANBACK = "android.software.leanback";
2445
2446 /**
2447 * Feature for {@link #getSystemAvailableFeatures} and
2448 * {@link #hasSystemFeature}: The device supports only leanback UI. Only
2449 * applications designed for this experience should be run, though this is
2450 * not enforced by the system.
Tim Kilbournf94b6a92014-03-07 15:13:48 -08002451 */
2452 @SdkConstant(SdkConstantType.FEATURE)
2453 public static final String FEATURE_LEANBACK_ONLY = "android.software.leanback_only";
2454
2455 /**
2456 * Feature for {@link #getSystemAvailableFeatures} and
Jae Seocfd861e2014-08-27 14:02:15 -07002457 * {@link #hasSystemFeature}: The device supports live TV and can display
2458 * contents from TV inputs implemented with the
2459 * {@link android.media.tv.TvInputService} API.
2460 */
2461 @SdkConstant(SdkConstantType.FEATURE)
2462 public static final String FEATURE_LIVE_TV = "android.software.live_tv";
2463
2464 /**
2465 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08002466 * {@link #hasSystemFeature}: The device supports WiFi (802.11) networking.
2467 */
2468 @SdkConstant(SdkConstantType.FEATURE)
2469 public static final String FEATURE_WIFI = "android.hardware.wifi";
2470
2471 /**
Irfan Sheriff45b8b462011-09-07 11:24:16 -07002472 * Feature for {@link #getSystemAvailableFeatures} and
2473 * {@link #hasSystemFeature}: The device supports Wi-Fi Direct networking.
2474 */
2475 @SdkConstant(SdkConstantType.FEATURE)
2476 public static final String FEATURE_WIFI_DIRECT = "android.hardware.wifi.direct";
2477
2478 /**
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07002479 * Feature for {@link #getSystemAvailableFeatures} and
Etan Cohen04133272016-10-26 11:22:06 -07002480 * {@link #hasSystemFeature}: The device supports Wi-Fi Aware.
Etan Cohen20d329b2015-09-29 13:49:02 -07002481 */
2482 @SdkConstant(SdkConstantType.FEATURE)
Etan Cohen04133272016-10-26 11:22:06 -07002483 public static final String FEATURE_WIFI_AWARE = "android.hardware.wifi.aware";
Etan Cohen20d329b2015-09-29 13:49:02 -07002484
2485 /**
2486 * Feature for {@link #getSystemAvailableFeatures} and
Peter Qiu3d615e42017-08-07 20:13:32 +00002487 * {@link #hasSystemFeature}: The device supports Wi-Fi Passpoint and all
2488 * Passpoint related APIs in {@link WifiManager} are supported. Refer to
2489 * {@link WifiManager#addOrUpdatePasspointConfiguration} for more info.
Peter Qiub99fe312017-05-05 13:48:47 -07002490 */
2491 @SdkConstant(SdkConstantType.FEATURE)
2492 public static final String FEATURE_WIFI_PASSPOINT = "android.hardware.wifi.passpoint";
2493
2494 /**
2495 * Feature for {@link #getSystemAvailableFeatures} and
Etan Cohen692e68e2017-09-14 15:42:01 -07002496 * {@link #hasSystemFeature}: The device supports Wi-Fi RTT (IEEE 802.11mc).
Etan Cohen692e68e2017-09-14 15:42:01 -07002497 */
2498 @SdkConstant(SdkConstantType.FEATURE)
2499 public static final String FEATURE_WIFI_RTT = "android.hardware.wifi.rtt";
2500
2501
2502 /**
2503 * Feature for {@link #getSystemAvailableFeatures} and
Robert Quattlebaum87a71042017-05-15 15:45:20 -07002504 * {@link #hasSystemFeature}: The device supports LoWPAN networking.
2505 * @hide
2506 */
2507 @SdkConstant(SdkConstantType.FEATURE)
2508 public static final String FEATURE_LOWPAN = "android.hardware.lowpan";
2509
2510 /**
2511 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07002512 * {@link #hasSystemFeature}: This is a device dedicated to showing UI
Todd Kennedy7f95a002015-04-22 14:28:25 -07002513 * on a vehicle headunit. A headunit here is defined to be inside a
2514 * vehicle that may or may not be moving. A headunit uses either a
2515 * primary display in the center console and/or additional displays in
2516 * the instrument cluster or elsewhere in the vehicle. Headunit display(s)
2517 * have limited size and resolution. The user will likely be focused on
2518 * driving so limiting driver distraction is a primary concern. User input
2519 * can be a variety of hard buttons, touch, rotary controllers and even mouse-
2520 * like interfaces.
2521 */
2522 @SdkConstant(SdkConstantType.FEATURE)
2523 public static final String FEATURE_AUTOMOTIVE = "android.hardware.type.automotive";
2524
2525 /**
2526 * Feature for {@link #getSystemAvailableFeatures} and
2527 * {@link #hasSystemFeature}: This is a device dedicated to showing UI
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07002528 * on a television. Television here is defined to be a typical living
2529 * room television experience: displayed on a big screen, where the user
2530 * is sitting far away from it, and the dominant form of input will be
2531 * something like a DPAD, not through touch or mouse.
Tim Kilbournf94b6a92014-03-07 15:13:48 -08002532 * @deprecated use {@link #FEATURE_LEANBACK} instead.
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07002533 */
Jose Lima970417c2014-04-10 10:42:19 -07002534 @Deprecated
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07002535 @SdkConstant(SdkConstantType.FEATURE)
2536 public static final String FEATURE_TELEVISION = "android.hardware.type.television";
2537
2538 /**
Justin Kohb5731f091c2014-02-13 16:06:59 -08002539 * Feature for {@link #getSystemAvailableFeatures} and
2540 * {@link #hasSystemFeature}: This is a device dedicated to showing UI
2541 * on a watch. A watch here is defined to be a device worn on the body, perhaps on
2542 * the wrist. The user is very close when interacting with the device.
2543 */
2544 @SdkConstant(SdkConstantType.FEATURE)
2545 public static final String FEATURE_WATCH = "android.hardware.type.watch";
2546
2547 /**
Ralph Nathanb8e0dee2017-01-24 15:24:59 -08002548 * Feature for {@link #getSystemAvailableFeatures} and
2549 * {@link #hasSystemFeature}: This is a device for IoT and may not have an UI. An embedded
2550 * device is defined as a full stack Android device with or without a display and no
2551 * user-installable apps.
2552 */
2553 @SdkConstant(SdkConstantType.FEATURE)
2554 public static final String FEATURE_EMBEDDED = "android.hardware.type.embedded";
2555
2556 /**
Dennis Kempin7345ed52017-04-14 16:40:56 -07002557 * Feature for {@link #getSystemAvailableFeatures} and
2558 * {@link #hasSystemFeature}: This is a device dedicated to be primarily used
2559 * with keyboard, mouse or touchpad. This includes traditional desktop
2560 * computers, laptops and variants such as convertibles or detachables.
2561 * Due to the larger screen, the device will most likely use the
2562 * {@link #FEATURE_FREEFORM_WINDOW_MANAGEMENT} feature as well.
2563 */
2564 @SdkConstant(SdkConstantType.FEATURE)
2565 public static final String FEATURE_PC = "android.hardware.type.pc";
2566
2567 /**
Sam Lin821f43a2019-02-13 19:15:32 -08002568 * Feature for {@link #getSystemAvailableFeatures} and
2569 * {@link #hasSystemFeature}: This is a foldable device. Properties such as
2570 * the display size may change in response to being folded.
2571 */
2572 @SdkConstant(SdkConstantType.FEATURE)
2573 public static final String FEATURE_FOLDABLE = "android.hardware.type.foldable";
2574
2575 /**
Adam Lesinski3d9bcb92014-02-18 14:05:14 -08002576 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2577 * The device supports printing.
2578 */
2579 @SdkConstant(SdkConstantType.FEATURE)
2580 public static final String FEATURE_PRINTING = "android.software.print";
2581
2582 /**
2583 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Eugene Susla7c3eef22017-03-10 14:25:58 -08002584 * The device supports {@link android.companion.CompanionDeviceManager#associate associating}
2585 * with devices via {@link android.companion.CompanionDeviceManager}.
2586 */
2587 @SdkConstant(SdkConstantType.FEATURE)
2588 public static final String FEATURE_COMPANION_DEVICE_SETUP
2589 = "android.software.companion_device_setup";
2590
2591 /**
2592 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Adam Lesinski3d9bcb92014-02-18 14:05:14 -08002593 * The device can perform backup and restore operations on installed applications.
2594 */
2595 @SdkConstant(SdkConstantType.FEATURE)
2596 public static final String FEATURE_BACKUP = "android.software.backup";
2597
2598 /**
Vladislav Kaznacheevd303b252015-10-27 17:30:58 -07002599 * Feature for {@link #getSystemAvailableFeatures} and
2600 * {@link #hasSystemFeature}: The device supports freeform window management.
2601 * Windows have title bars and can be moved and resized.
2602 */
Filip Gruszczynski811dc3b2015-11-23 12:34:22 -08002603 // If this feature is present, you also need to set
2604 // com.android.internal.R.config_freeformWindowManagement to true in your configuration overlay.
Vladislav Kaznacheevd303b252015-10-27 17:30:58 -07002605 @SdkConstant(SdkConstantType.FEATURE)
2606 public static final String FEATURE_FREEFORM_WINDOW_MANAGEMENT
2607 = "android.software.freeform_window_management";
2608
2609 /**
Adam Connors23cc04e2014-04-01 12:12:20 +01002610 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Wale Ogunwalefbe12c42015-12-06 16:23:50 -08002611 * The device supports picture-in-picture multi-window mode.
2612 */
2613 @SdkConstant(SdkConstantType.FEATURE)
2614 public static final String FEATURE_PICTURE_IN_PICTURE = "android.software.picture_in_picture";
2615
2616 /**
2617 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Andrii Kulian1981f5f2017-04-07 16:23:12 -07002618 * The device supports running activities on secondary displays.
2619 */
2620 @SdkConstant(SdkConstantType.FEATURE)
2621 public static final String FEATURE_ACTIVITIES_ON_SECONDARY_DISPLAYS
2622 = "android.software.activities_on_secondary_displays";
2623
2624 /**
2625 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Amith Yamasani1d653272014-09-11 17:56:05 -07002626 * The device supports creating secondary users and managed profiles via
2627 * {@link DevicePolicyManager}.
Adam Connors23cc04e2014-04-01 12:12:20 +01002628 */
2629 @SdkConstant(SdkConstantType.FEATURE)
Amith Yamasani1d653272014-09-11 17:56:05 -07002630 public static final String FEATURE_MANAGED_USERS = "android.software.managed_users";
2631
2632 /**
2633 * @hide
2634 * TODO: Remove after dependencies updated b/17392243
2635 */
2636 public static final String FEATURE_MANAGED_PROFILES = "android.software.managed_users";
Adam Connors23cc04e2014-04-01 12:12:20 +01002637
2638 /**
Ben Murdochf564c7f2014-05-20 18:58:06 +01002639 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Adam Connors19ccb5f2014-09-08 17:31:50 +01002640 * The device supports verified boot.
2641 */
2642 @SdkConstant(SdkConstantType.FEATURE)
2643 public static final String FEATURE_VERIFIED_BOOT = "android.software.verified_boot";
2644
2645 /**
2646 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2647 * The device supports secure removal of users. When a user is deleted the data associated
2648 * with that user is securely deleted and no longer available.
2649 */
2650 @SdkConstant(SdkConstantType.FEATURE)
2651 public static final String FEATURE_SECURELY_REMOVES_USERS
2652 = "android.software.securely_removes_users";
2653
Jeff Sharkeyb92b05b2016-01-28 09:50:00 -07002654 /** {@hide} */
Jeff Sharkey8eb783b2018-01-04 16:46:48 -07002655 @TestApi
Jeff Sharkeyb92b05b2016-01-28 09:50:00 -07002656 @SdkConstant(SdkConstantType.FEATURE)
2657 public static final String FEATURE_FILE_BASED_ENCRYPTION
2658 = "android.software.file_based_encryption";
2659
Jeff Sharkey8eb783b2018-01-04 16:46:48 -07002660 /** {@hide} */
2661 @TestApi
2662 @SdkConstant(SdkConstantType.FEATURE)
2663 public static final String FEATURE_ADOPTABLE_STORAGE
2664 = "android.software.adoptable_storage";
2665
Adam Connors19ccb5f2014-09-08 17:31:50 +01002666 /**
2667 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Ben Murdoch422c7a52014-05-16 13:45:47 +01002668 * The device has a full implementation of the android.webkit.* APIs. Devices
2669 * lacking this feature will not have a functioning WebView implementation.
2670 */
2671 @SdkConstant(SdkConstantType.FEATURE)
2672 public static final String FEATURE_WEBVIEW = "android.software.webview";
2673
2674 /**
Joe LaPenna4bb015d2014-07-04 17:15:54 -07002675 * Feature for {@link #getSystemAvailableFeatures} and
2676 * {@link #hasSystemFeature}: This device supports ethernet.
Joe LaPenna4bb015d2014-07-04 17:15:54 -07002677 */
2678 @SdkConstant(SdkConstantType.FEATURE)
2679 public static final String FEATURE_ETHERNET = "android.hardware.ethernet";
2680
2681 /**
Yuncheol Heoa0c4a062014-07-10 20:49:27 +09002682 * Feature for {@link #getSystemAvailableFeatures} and
2683 * {@link #hasSystemFeature}: This device supports HDMI-CEC.
2684 * @hide
2685 */
2686 @SdkConstant(SdkConstantType.FEATURE)
2687 public static final String FEATURE_HDMI_CEC = "android.hardware.hdmi.cec";
2688
2689 /**
Michael Wright6faa6752014-09-05 17:57:44 -07002690 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2691 * The device has all of the inputs necessary to be considered a compatible game controller, or
2692 * includes a compatible game controller in the box.
2693 */
2694 @SdkConstant(SdkConstantType.FEATURE)
2695 public static final String FEATURE_GAMEPAD = "android.hardware.gamepad";
2696
Mike Lockwood5781cd52015-03-27 13:23:41 -07002697 /**
2698 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2699 * The device has a full implementation of the android.media.midi.* APIs.
2700 */
2701 @SdkConstant(SdkConstantType.FEATURE)
2702 public static final String FEATURE_MIDI = "android.software.midi";
Michael Wright6faa6752014-09-05 17:57:44 -07002703
2704 /**
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08002705 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Ruben Brunk927d3452016-05-02 19:30:51 -07002706 * The device implements an optimized mode for virtual reality (VR) applications that handles
2707 * stereoscopic rendering of notifications, and disables most monocular system UI components
2708 * while a VR application has user focus.
2709 * Devices declaring this feature must include an application implementing a
2710 * {@link android.service.vr.VrListenerService} that can be targeted by VR applications via
2711 * {@link android.app.Activity#setVrModeEnabled}.
Craig Donnerc6f9c852017-12-27 17:15:19 -08002712 * @deprecated use {@link #FEATURE_VR_MODE_HIGH_PERFORMANCE} instead.
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08002713 */
Craig Donnerc6f9c852017-12-27 17:15:19 -08002714 @Deprecated
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08002715 @SdkConstant(SdkConstantType.FEATURE)
2716 public static final String FEATURE_VR_MODE = "android.software.vr.mode";
2717
2718 /**
Ruben Brunk31d80ea2016-01-25 20:14:08 -08002719 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Craig Donnerc6f9c852017-12-27 17:15:19 -08002720 * The device implements an optimized mode for virtual reality (VR) applications that handles
2721 * stereoscopic rendering of notifications, disables most monocular system UI components
2722 * while a VR application has user focus and meets extra CDD requirements to provide a
2723 * high-quality VR experience.
2724 * Devices declaring this feature must include an application implementing a
2725 * {@link android.service.vr.VrListenerService} that can be targeted by VR applications via
2726 * {@link android.app.Activity#setVrModeEnabled}.
2727 * and must meet CDD requirements to provide a high-quality VR experience.
Ruben Brunk31d80ea2016-01-25 20:14:08 -08002728 */
2729 @SdkConstant(SdkConstantType.FEATURE)
2730 public static final String FEATURE_VR_MODE_HIGH_PERFORMANCE
2731 = "android.hardware.vr.high_performance";
2732
2733 /**
Craig Donner279dd662017-03-15 17:10:50 -07002734 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Svet Ganov43574b02017-04-12 09:25:20 -07002735 * The device supports autofill of user credentials, addresses, credit cards, etc
2736 * via integration with {@link android.service.autofill.AutofillService autofill
2737 * providers}.
2738 */
2739 @SdkConstant(SdkConstantType.FEATURE)
2740 public static final String FEATURE_AUTOFILL = "android.software.autofill";
2741
2742 /**
2743 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Craig Donner279dd662017-03-15 17:10:50 -07002744 * The device implements headtracking suitable for a VR device.
2745 */
2746 @SdkConstant(SdkConstantType.FEATURE)
2747 public static final String FEATURE_VR_HEADTRACKING = "android.hardware.vr.headtracking";
2748
2749 /**
Frank Salimea5e0382018-01-23 22:42:29 -08002750 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2751 * The device has a StrongBox hardware-backed Keystore.
2752 */
2753 @SdkConstant(SdkConstantType.FEATURE)
2754 public static final String FEATURE_STRONGBOX_KEYSTORE =
2755 "android.hardware.strongbox_keystore";
2756
2757 /**
Eran Messeriadaf68c2018-03-27 19:34:03 +01002758 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2759 * The device has a Keymaster implementation that supports Device ID attestation.
2760 *
2761 * @see DevicePolicyManager#isDeviceIdAttestationSupported
2762 * @hide
2763 */
2764 @SdkConstant(SdkConstantType.FEATURE)
2765 public static final String FEATURE_DEVICE_ID_ATTESTATION =
2766 "android.software.device_id_attestation";
2767
2768 /**
Benedict Wongdc92c692018-11-05 13:35:06 -08002769 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: The device has
2770 * the requisite kernel support for multinetworking-capable IPsec tunnels.
2771 *
2772 * <p>This feature implies that the device supports XFRM Interfaces (CONFIG_XFRM_INTERFACE), or
2773 * VTIs with kernel patches allowing updates of output/set mark via UPDSA.
2774 */
2775 @SdkConstant(SdkConstantType.FEATURE)
2776 public static final String FEATURE_IPSEC_TUNNELS = "android.software.ipsec_tunnels";
2777
2778 /**
Kenny Root5ab21572011-07-27 11:11:19 -07002779 * Extra field name for the URI to a verification file. Passed to a package
2780 * verifier.
2781 *
2782 * @hide
2783 */
2784 public static final String EXTRA_VERIFICATION_URI = "android.content.pm.extra.VERIFICATION_URI";
2785
2786 /**
2787 * Extra field name for the ID of a package pending verification. Passed to
2788 * a package verifier and is used to call back to
Kenny Root3a9b5fb2011-09-20 14:15:38 -07002789 * {@link PackageManager#verifyPendingInstall(int, int)}
Kenny Root5ab21572011-07-27 11:11:19 -07002790 */
2791 public static final String EXTRA_VERIFICATION_ID = "android.content.pm.extra.VERIFICATION_ID";
2792
2793 /**
2794 * Extra field name for the package identifier which is trying to install
2795 * the package.
2796 *
2797 * @hide
2798 */
2799 public static final String EXTRA_VERIFICATION_INSTALLER_PACKAGE
2800 = "android.content.pm.extra.VERIFICATION_INSTALLER_PACKAGE";
2801
2802 /**
2803 * Extra field name for the requested install flags for a package pending
2804 * verification. Passed to a package verifier.
2805 *
2806 * @hide
2807 */
2808 public static final String EXTRA_VERIFICATION_INSTALL_FLAGS
2809 = "android.content.pm.extra.VERIFICATION_INSTALL_FLAGS";
2810
2811 /**
rich cannings13d428e2012-09-13 13:43:07 -07002812 * Extra field name for the uid of who is requesting to install
2813 * the package.
2814 *
2815 * @hide
2816 */
2817 public static final String EXTRA_VERIFICATION_INSTALLER_UID
2818 = "android.content.pm.extra.VERIFICATION_INSTALLER_UID";
2819
2820 /**
2821 * Extra field name for the package name of a package pending verification.
2822 *
2823 * @hide
2824 */
2825 public static final String EXTRA_VERIFICATION_PACKAGE_NAME
2826 = "android.content.pm.extra.VERIFICATION_PACKAGE_NAME";
2827 /**
rich canningsd1b5cfc2012-08-29 14:49:51 -07002828 * Extra field name for the result of a verification, either
2829 * {@link #VERIFICATION_ALLOW}, or {@link #VERIFICATION_REJECT}.
2830 * Passed to package verifiers after a package is verified.
2831 */
2832 public static final String EXTRA_VERIFICATION_RESULT
2833 = "android.content.pm.extra.VERIFICATION_RESULT";
2834
2835 /**
rich cannings13d428e2012-09-13 13:43:07 -07002836 * Extra field name for the version code of a package pending verification.
Dianne Hackborn3accca02013-09-20 09:32:11 -07002837 * @deprecated Use {@link #EXTRA_VERIFICATION_LONG_VERSION_CODE} instead.
2838 * @hide
2839 */
2840 @Deprecated
2841 public static final String EXTRA_VERIFICATION_VERSION_CODE
2842 = "android.content.pm.extra.VERIFICATION_VERSION_CODE";
2843
2844 /**
2845 * Extra field name for the long version code of a package pending verification.
rich cannings13d428e2012-09-13 13:43:07 -07002846 *
2847 * @hide
2848 */
Dianne Hackborn3accca02013-09-20 09:32:11 -07002849 public static final String EXTRA_VERIFICATION_LONG_VERSION_CODE =
2850 "android.content.pm.extra.VERIFICATION_LONG_VERSION_CODE";
rich cannings13d428e2012-09-13 13:43:07 -07002851
2852 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07002853 * Extra field name for the ID of a intent filter pending verification.
2854 * Passed to an intent filter verifier and is used to call back to
2855 * {@link #verifyIntentFilter}
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08002856 *
2857 * @hide
2858 */
2859 public static final String EXTRA_INTENT_FILTER_VERIFICATION_ID
2860 = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_ID";
2861
2862 /**
2863 * Extra field name for the scheme used for an intent filter pending verification. Passed to
2864 * an intent filter verifier and is used to construct the URI to verify against.
2865 *
2866 * Usually this is "https"
2867 *
2868 * @hide
2869 */
2870 public static final String EXTRA_INTENT_FILTER_VERIFICATION_URI_SCHEME
2871 = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_URI_SCHEME";
2872
2873 /**
2874 * Extra field name for the host names to be used for an intent filter pending verification.
2875 * Passed to an intent filter verifier and is used to construct the URI to verify the
2876 * intent filter.
2877 *
2878 * This is a space delimited list of hosts.
2879 *
2880 * @hide
2881 */
2882 public static final String EXTRA_INTENT_FILTER_VERIFICATION_HOSTS
2883 = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_HOSTS";
2884
2885 /**
2886 * Extra field name for the package name to be used for an intent filter pending verification.
2887 * Passed to an intent filter verifier and is used to check the verification responses coming
2888 * from the hosts. Each host response will need to include the package name of APK containing
2889 * the intent filter.
2890 *
2891 * @hide
2892 */
2893 public static final String EXTRA_INTENT_FILTER_VERIFICATION_PACKAGE_NAME
2894 = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_PACKAGE_NAME";
2895
2896 /**
2897 * The action used to request that the user approve a permission request
2898 * from the application.
Nick Kralevich035f80d2013-03-27 15:20:08 -07002899 *
2900 * @hide
2901 */
Svetoslavc6d1c342015-02-26 14:44:43 -08002902 @SystemApi
2903 public static final String ACTION_REQUEST_PERMISSIONS =
2904 "android.content.pm.action.REQUEST_PERMISSIONS";
Nick Kralevich035f80d2013-03-27 15:20:08 -07002905
2906 /**
Svetoslavc6d1c342015-02-26 14:44:43 -08002907 * The names of the requested permissions.
2908 * <p>
2909 * <strong>Type:</strong> String[]
2910 * </p>
2911 *
2912 * @hide
2913 */
2914 @SystemApi
2915 public static final String EXTRA_REQUEST_PERMISSIONS_NAMES =
2916 "android.content.pm.extra.REQUEST_PERMISSIONS_NAMES";
2917
2918 /**
2919 * The results from the permissions request.
2920 * <p>
2921 * <strong>Type:</strong> int[] of #PermissionResult
2922 * </p>
2923 *
2924 * @hide
2925 */
2926 @SystemApi
2927 public static final String EXTRA_REQUEST_PERMISSIONS_RESULTS
2928 = "android.content.pm.extra.REQUEST_PERMISSIONS_RESULTS";
Nick Kralevich035f80d2013-03-27 15:20:08 -07002929
2930 /**
Jeff Sharkeybb580672014-07-10 12:10:25 -07002931 * String extra for {@link PackageInstallObserver} in the 'extras' Bundle in case of
Christopher Tatef1977b42014-03-24 16:25:51 -07002932 * {@link #INSTALL_FAILED_DUPLICATE_PERMISSION}. This extra names the package which provides
2933 * the existing definition for the permission.
2934 * @hide
2935 */
2936 public static final String EXTRA_FAILURE_EXISTING_PACKAGE
2937 = "android.content.pm.extra.FAILURE_EXISTING_PACKAGE";
2938
2939 /**
Jeff Sharkeybb580672014-07-10 12:10:25 -07002940 * String extra for {@link PackageInstallObserver} in the 'extras' Bundle in case of
Christopher Tatef1977b42014-03-24 16:25:51 -07002941 * {@link #INSTALL_FAILED_DUPLICATE_PERMISSION}. This extra names the permission that is
2942 * being redundantly defined by the package being installed.
2943 * @hide
2944 */
2945 public static final String EXTRA_FAILURE_EXISTING_PERMISSION
2946 = "android.content.pm.extra.FAILURE_EXISTING_PERMISSION";
2947
Svet Ganov8c7f7002015-05-07 10:48:44 -07002948 /**
2949 * Permission flag: The permission is set in its current state
2950 * by the user and apps can still request it at runtime.
2951 *
2952 * @hide
2953 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08002954 @SystemApi
Philip P. Moltmann3e496172019-02-11 16:29:19 -08002955 @TestApi
Svet Ganov8c7f7002015-05-07 10:48:44 -07002956 public static final int FLAG_PERMISSION_USER_SET = 1 << 0;
2957
2958 /**
2959 * Permission flag: The permission is set in its current state
2960 * by the user and it is fixed, i.e. apps can no longer request
2961 * this permission.
2962 *
2963 * @hide
2964 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08002965 @SystemApi
Philip P. Moltmann3e496172019-02-11 16:29:19 -08002966 @TestApi
Svet Ganov8c7f7002015-05-07 10:48:44 -07002967 public static final int FLAG_PERMISSION_USER_FIXED = 1 << 1;
2968
2969 /**
2970 * Permission flag: The permission is set in its current state
2971 * by device policy and neither apps nor the user can change
2972 * its state.
2973 *
2974 * @hide
2975 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08002976 @SystemApi
Svet Ganov8c7f7002015-05-07 10:48:44 -07002977 public static final int FLAG_PERMISSION_POLICY_FIXED = 1 << 2;
2978
2979 /**
2980 * Permission flag: The permission is set in a granted state but
2981 * access to resources it guards is restricted by other means to
2982 * enable revoking a permission on legacy apps that do not support
2983 * runtime permissions. If this permission is upgraded to runtime
2984 * because the app was updated to support runtime permissions, the
2985 * the permission will be revoked in the upgrade process.
2986 *
2987 * @hide
2988 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08002989 @SystemApi
Philip P. Moltmann48456672019-01-20 13:14:03 -08002990 @TestApi
Svet Ganov8c7f7002015-05-07 10:48:44 -07002991 public static final int FLAG_PERMISSION_REVOKE_ON_UPGRADE = 1 << 3;
2992
Svet Ganovb3f22b42015-05-12 11:01:24 -07002993 /**
2994 * Permission flag: The permission is set in its current state
2995 * because the app is a component that is a part of the system.
2996 *
2997 * @hide
2998 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08002999 @SystemApi
Svet Ganovb3f22b42015-05-12 11:01:24 -07003000 public static final int FLAG_PERMISSION_SYSTEM_FIXED = 1 << 4;
Svet Ganov8c7f7002015-05-07 10:48:44 -07003001
Svet Ganov77ab6a82015-07-03 12:03:02 -07003002 /**
3003 * Permission flag: The permission is granted by default because it
3004 * enables app functionality that is expected to work out-of-the-box
3005 * for providing a smooth user experience. For example, the phone app
3006 * is expected to have the phone permission.
3007 *
3008 * @hide
3009 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08003010 @SystemApi
Svet Ganov77ab6a82015-07-03 12:03:02 -07003011 public static final int FLAG_PERMISSION_GRANTED_BY_DEFAULT = 1 << 5;
3012
Svet Ganov8c7f7002015-05-07 10:48:44 -07003013 /**
Svet Ganov9c165d72015-12-01 19:52:26 -08003014 * Permission flag: The permission has to be reviewed before any of
3015 * the app components can run.
3016 *
3017 * @hide
3018 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08003019 @SystemApi
Philip P. Moltmann3e496172019-02-11 16:29:19 -08003020 @TestApi
Svet Ganov9c165d72015-12-01 19:52:26 -08003021 public static final int FLAG_PERMISSION_REVIEW_REQUIRED = 1 << 6;
3022
3023 /**
Philip P. Moltmann17f65af2018-10-18 15:32:29 -07003024 * Permission flag: The permission has not been explicitly requested by
3025 * the app but has been added automatically by the system. Revoke once
3026 * the app does explicitly request it.
3027 *
3028 * @hide
3029 */
Philip P. Moltmann48456672019-01-20 13:14:03 -08003030 @TestApi
Philip P. Moltmann17f65af2018-10-18 15:32:29 -07003031 public static final int FLAG_PERMISSION_REVOKE_WHEN_REQUESTED = 1 << 7;
3032
3033 /**
Svet Ganov8c7f7002015-05-07 10:48:44 -07003034 * Mask for all permission flags.
3035 *
3036 * @hide
3037 */
3038 @SystemApi
Svet Ganovb3f22b42015-05-12 11:01:24 -07003039 public static final int MASK_PERMISSION_FLAGS = 0xFF;
Svet Ganov8c7f7002015-05-07 10:48:44 -07003040
Christopher Tatef1977b42014-03-24 16:25:51 -07003041 /**
Ricky Wai92cd0062019-02-14 20:23:22 +00003042 * Injected activity in app that forwards user to setting activity of that app.
3043 *
3044 * @hide
3045 */
3046 public static final String APP_DETAILS_ACTIVITY_CLASS_NAME = AppDetailsActivity.class.getName();
3047
3048 /**
Svet Ganovd7b1f4112016-02-09 18:49:23 -08003049 * This is a library that contains components apps can invoke. For
3050 * example, a services for apps to bind to, or standard chooser UI,
3051 * etc. This library is versioned and backwards compatible. Clients
3052 * should check its version via {@link android.ext.services.Version
3053 * #getVersionCode()} and avoid calling APIs added in later versions.
3054 *
3055 * @hide
3056 */
Jeff Sharkeyc6091162018-06-29 17:15:40 -06003057 @TestApi
Svet Ganovd7b1f4112016-02-09 18:49:23 -08003058 public static final String SYSTEM_SHARED_LIBRARY_SERVICES = "android.ext.services";
3059
3060 /**
3061 * This is a library that contains components apps can dynamically
3062 * load. For example, new widgets, helper classes, etc. This library
3063 * is versioned and backwards compatible. Clients should check its
3064 * version via {@link android.ext.shared.Version#getVersionCode()}
3065 * and avoid calling APIs added in later versions.
3066 *
3067 * @hide
3068 */
Jeff Sharkeyc6091162018-06-29 17:15:40 -06003069 @TestApi
Svet Ganovd7b1f4112016-02-09 18:49:23 -08003070 public static final String SYSTEM_SHARED_LIBRARY_SHARED = "android.ext.shared";
3071
3072 /**
Brian Carlstromca82e612016-04-19 23:16:08 -07003073 * Used when starting a process for an Activity.
3074 *
3075 * @hide
3076 */
3077 public static final int NOTIFY_PACKAGE_USE_ACTIVITY = 0;
3078
3079 /**
3080 * Used when starting a process for a Service.
3081 *
3082 * @hide
3083 */
3084 public static final int NOTIFY_PACKAGE_USE_SERVICE = 1;
3085
3086 /**
3087 * Used when moving a Service to the foreground.
3088 *
3089 * @hide
3090 */
3091 public static final int NOTIFY_PACKAGE_USE_FOREGROUND_SERVICE = 2;
3092
3093 /**
3094 * Used when starting a process for a BroadcastReceiver.
3095 *
3096 * @hide
3097 */
3098 public static final int NOTIFY_PACKAGE_USE_BROADCAST_RECEIVER = 3;
3099
3100 /**
3101 * Used when starting a process for a ContentProvider.
3102 *
3103 * @hide
3104 */
3105 public static final int NOTIFY_PACKAGE_USE_CONTENT_PROVIDER = 4;
3106
3107 /**
3108 * Used when starting a process for a BroadcastReceiver.
3109 *
3110 * @hide
3111 */
3112 public static final int NOTIFY_PACKAGE_USE_BACKUP = 5;
3113
3114 /**
3115 * Used with Context.getClassLoader() across Android packages.
3116 *
3117 * @hide
3118 */
3119 public static final int NOTIFY_PACKAGE_USE_CROSS_PACKAGE = 6;
3120
3121 /**
3122 * Used when starting a package within a process for Instrumentation.
3123 *
3124 * @hide
3125 */
3126 public static final int NOTIFY_PACKAGE_USE_INSTRUMENTATION = 7;
3127
3128 /**
3129 * Total number of usage reasons.
3130 *
3131 * @hide
3132 */
3133 public static final int NOTIFY_PACKAGE_USE_REASONS_COUNT = 8;
3134
3135 /**
Svet Ganov67882122016-12-11 16:36:34 -08003136 * Constant for specifying the highest installed package version code.
3137 */
3138 public static final int VERSION_CODE_HIGHEST = -1;
3139
Jeff Sharkeyad357d12018-02-02 13:25:31 -07003140 /** {@hide} */
3141 public int getUserId() {
3142 return UserHandle.myUserId();
3143 }
3144
Svet Ganov67882122016-12-11 16:36:34 -08003145 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003146 * Retrieve overall information about an application package that is
3147 * installed on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003148 *
3149 * @param packageName The full name (i.e. com.google.apps.contacts) of the
Jeff Sharkey4347f812017-04-21 12:08:39 -06003150 * desired package.
3151 * @param flags Additional option flags to modify the data returned.
3152 * @return A PackageInfo object containing information about the package. If
3153 * flag {@code MATCH_UNINSTALLED_PACKAGES} is set and if the package
3154 * is not found in the list of installed applications, the package
3155 * information is retrieved from the list of uninstalled
kmccormick30498b42013-03-27 17:39:17 -07003156 * applications (which includes installed applications as well as
3157 * applications with data directory i.e. applications which had been
3158 * deleted with {@code DONT_DELETE_DATA} flag set).
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003159 * @throws NameNotFoundException if a package with the given name cannot be
3160 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003161 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003162 public abstract PackageInfo getPackageInfo(String packageName, @PackageInfoFlags int flags)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003163 throws NameNotFoundException;
3164
3165 /**
Svet Ganov67882122016-12-11 16:36:34 -08003166 * Retrieve overall information about an application package that is
3167 * installed on the system. This method can be used for retrieving
Jeff Sharkey4347f812017-04-21 12:08:39 -06003168 * information about packages for which multiple versions can be installed
3169 * at the time. Currently only packages hosting static shared libraries can
3170 * have multiple installed versions. The method can also be used to get info
3171 * for a package that has a single version installed by passing
3172 * {@link #VERSION_CODE_HIGHEST} in the {@link VersionedPackage}
Svet Ganov67882122016-12-11 16:36:34 -08003173 * constructor.
3174 *
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003175 * @param versionedPackage The versioned package for which to query.
Jeff Sharkey4347f812017-04-21 12:08:39 -06003176 * @param flags Additional option flags to modify the data returned.
3177 * @return A PackageInfo object containing information about the package. If
3178 * flag {@code MATCH_UNINSTALLED_PACKAGES} is set and if the package
3179 * is not found in the list of installed applications, the package
3180 * information is retrieved from the list of uninstalled
Svet Ganov67882122016-12-11 16:36:34 -08003181 * applications (which includes installed applications as well as
3182 * applications with data directory i.e. applications which had been
3183 * deleted with {@code DONT_DELETE_DATA} flag set).
3184 * @throws NameNotFoundException if a package with the given name cannot be
3185 * found on the system.
Svet Ganov67882122016-12-11 16:36:34 -08003186 */
3187 public abstract PackageInfo getPackageInfo(VersionedPackage versionedPackage,
3188 @PackageInfoFlags int flags) throws NameNotFoundException;
3189
3190 /**
Nicolas Prevot9a80e532015-09-23 15:49:28 +01003191 * Retrieve overall information about an application package that is
3192 * installed on the system.
Nicolas Prevot9a80e532015-09-23 15:49:28 +01003193 *
3194 * @param packageName The full name (i.e. com.google.apps.contacts) of the
Jeff Sharkey4347f812017-04-21 12:08:39 -06003195 * desired package.
3196 * @param flags Additional option flags to modify the data returned.
Nicolas Prevot9a80e532015-09-23 15:49:28 +01003197 * @param userId The user id.
Jeff Sharkey4347f812017-04-21 12:08:39 -06003198 * @return A PackageInfo object containing information about the package. If
3199 * flag {@code MATCH_UNINSTALLED_PACKAGES} is set and if the package
3200 * is not found in the list of installed applications, the package
3201 * information is retrieved from the list of uninstalled
Nicolas Prevot9a80e532015-09-23 15:49:28 +01003202 * applications (which includes installed applications as well as
3203 * applications with data directory i.e. applications which had been
3204 * deleted with {@code DONT_DELETE_DATA} flag set).
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003205 * @throws NameNotFoundException if a package with the given name cannot be
3206 * found on the system.
Svet Ganov67882122016-12-11 16:36:34 -08003207 * @hide
Nicolas Prevot9a80e532015-09-23 15:49:28 +01003208 */
3209 @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS)
Mathew Inwood5c0d3542018-08-14 13:54:31 +01003210 @UnsupportedAppUsage
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003211 public abstract PackageInfo getPackageInfoAsUser(String packageName,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003212 @PackageInfoFlags int flags, @UserIdInt int userId) throws NameNotFoundException;
Nicolas Prevot9a80e532015-09-23 15:49:28 +01003213
3214 /**
Dianne Hackborn47096932010-02-11 15:57:09 -08003215 * Map from the current package names in use on the device to whatever
3216 * the current canonical name of that package is.
3217 * @param names Array of current names to be mapped.
3218 * @return Returns an array of the same size as the original, containing
3219 * the canonical name for each package.
3220 */
3221 public abstract String[] currentToCanonicalPackageNames(String[] names);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003222
Dianne Hackborn47096932010-02-11 15:57:09 -08003223 /**
3224 * Map from a packages canonical name to the current name in use on the device.
3225 * @param names Array of new names to be mapped.
3226 * @return Returns an array of the same size as the original, containing
3227 * the current name for each package.
3228 */
3229 public abstract String[] canonicalToCurrentPackageNames(String[] names);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003230
Dianne Hackborn47096932010-02-11 15:57:09 -08003231 /**
Andrew Solovay5ae13352014-06-06 12:23:09 -07003232 * Returns a "good" intent to launch a front-door activity in a package.
3233 * This is used, for example, to implement an "open" button when browsing
3234 * through packages. The current implementation looks first for a main
3235 * activity in the category {@link Intent#CATEGORY_INFO}, and next for a
3236 * main activity in the category {@link Intent#CATEGORY_LAUNCHER}. Returns
3237 * <code>null</code> if neither are found.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003238 *
3239 * @param packageName The name of the package to inspect.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003240 *
Andrew Solovay5ae13352014-06-06 12:23:09 -07003241 * @return A fully-qualified {@link Intent} that can be used to launch the
3242 * main activity in the package. Returns <code>null</code> if the package
3243 * does not contain such an activity, or if <em>packageName</em> is not
Ihab Awad1ec68882014-09-12 11:09:01 -07003244 * recognized.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003245 */
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06003246 public abstract @Nullable Intent getLaunchIntentForPackage(@NonNull String packageName);
Mihai Predaeae850c2009-05-13 10:13:48 +02003247
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003248 /**
Jose Lima970417c2014-04-10 10:42:19 -07003249 * Return a "good" intent to launch a front-door Leanback activity in a
3250 * package, for use for example to implement an "open" button when browsing
3251 * through packages. The current implementation will look for a main
3252 * activity in the category {@link Intent#CATEGORY_LEANBACK_LAUNCHER}, or
3253 * return null if no main leanback activities are found.
Adam Connors551c0782014-06-05 12:13:03 +01003254 *
Jose Lima970417c2014-04-10 10:42:19 -07003255 * @param packageName The name of the package to inspect.
3256 * @return Returns either a fully-qualified Intent that can be used to launch
3257 * the main Leanback activity in the package, or null if the package
3258 * does not contain such an activity.
3259 */
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06003260 public abstract @Nullable Intent getLeanbackLaunchIntentForPackage(@NonNull String packageName);
Jose Lima970417c2014-04-10 10:42:19 -07003261
3262 /**
Roberto Perez7ee1a7a2017-12-04 17:14:33 -08003263 * Return a "good" intent to launch a front-door Car activity in a
3264 * package, for use for example to implement an "open" button when browsing
3265 * through packages. The current implementation will look for a main
3266 * activity in the category {@link Intent#CATEGORY_CAR_LAUNCHER}, or
3267 * return null if no main car activities are found.
3268 *
3269 * @param packageName The name of the package to inspect.
3270 * @return Returns either a fully-qualified Intent that can be used to launch
3271 * the main Car activity in the package, or null if the package
3272 * does not contain such an activity.
3273 * @hide
3274 */
3275 public abstract @Nullable Intent getCarLaunchIntentForPackage(@NonNull String packageName);
3276
3277 /**
Jeff Sharkeycf3f0a12016-03-17 19:57:58 -06003278 * Return an array of all of the POSIX secondary group IDs that have been
3279 * assigned to the given package.
3280 * <p>
3281 * Note that the same package may have different GIDs under different
3282 * {@link UserHandle} on the same device.
Adam Connors551c0782014-06-05 12:13:03 +01003283 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003284 * @param packageName The full name (i.e. com.google.apps.contacts) of the
Jeff Sharkeycf3f0a12016-03-17 19:57:58 -06003285 * desired package.
3286 * @return Returns an int array of the assigned GIDs, or null if there are
Jose Lima970417c2014-04-10 10:42:19 -07003287 * none.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003288 * @throws NameNotFoundException if a package with the given name cannot be
3289 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003290 */
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06003291 public abstract int[] getPackageGids(@NonNull String packageName)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003292 throws NameNotFoundException;
3293
3294 /**
Jeff Sharkeycf3f0a12016-03-17 19:57:58 -06003295 * Return an array of all of the POSIX secondary group IDs that have been
3296 * assigned to the given package.
3297 * <p>
3298 * Note that the same package may have different GIDs under different
3299 * {@link UserHandle} on the same device.
Dianne Hackborna06de0f2012-12-11 16:34:47 -08003300 *
3301 * @param packageName The full name (i.e. com.google.apps.contacts) of the
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003302 * desired package.
3303 * @return Returns an int array of the assigned gids, or null if there are
3304 * none.
3305 * @throws NameNotFoundException if a package with the given name cannot be
3306 * found on the system.
Dianne Hackborna06de0f2012-12-11 16:34:47 -08003307 */
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003308 public abstract int[] getPackageGids(String packageName, @PackageInfoFlags int flags)
Dianne Hackborna06de0f2012-12-11 16:34:47 -08003309 throws NameNotFoundException;
3310
3311 /**
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003312 * Return the UID associated with the given package name.
Jeff Sharkeycf3f0a12016-03-17 19:57:58 -06003313 * <p>
3314 * Note that the same package will have different UIDs under different
3315 * {@link UserHandle} on the same device.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003316 *
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003317 * @param packageName The full name (i.e. com.google.apps.contacts) of the
3318 * desired package.
3319 * @return Returns an integer UID who owns the given package name.
3320 * @throws NameNotFoundException if a package with the given name can not be
3321 * found on the system.
3322 */
3323 public abstract int getPackageUid(String packageName, @PackageInfoFlags int flags)
3324 throws NameNotFoundException;
3325
3326 /**
3327 * Return the UID associated with the given package name.
Jeff Sharkeycf3f0a12016-03-17 19:57:58 -06003328 * <p>
3329 * Note that the same package will have different UIDs under different
3330 * {@link UserHandle} on the same device.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003331 *
3332 * @param packageName The full name (i.e. com.google.apps.contacts) of the
3333 * desired package.
3334 * @param userId The user handle identifier to look up the package under.
3335 * @return Returns an integer UID who owns the given package name.
3336 * @throws NameNotFoundException if a package with the given name can not be
3337 * found on the system.
3338 * @hide
3339 */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01003340 @UnsupportedAppUsage
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003341 public abstract int getPackageUidAsUser(String packageName, @UserIdInt int userId)
3342 throws NameNotFoundException;
3343
3344 /**
3345 * Return the UID associated with the given package name.
Jeff Sharkeycf3f0a12016-03-17 19:57:58 -06003346 * <p>
3347 * Note that the same package will have different UIDs under different
3348 * {@link UserHandle} on the same device.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003349 *
3350 * @param packageName The full name (i.e. com.google.apps.contacts) of the
3351 * desired package.
3352 * @param userId The user handle identifier to look up the package under.
3353 * @return Returns an integer UID who owns the given package name.
3354 * @throws NameNotFoundException if a package with the given name can not be
3355 * found on the system.
3356 * @hide
3357 */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01003358 @UnsupportedAppUsage
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003359 public abstract int getPackageUidAsUser(String packageName, @PackageInfoFlags int flags,
3360 @UserIdInt int userId) throws NameNotFoundException;
3361
3362 /**
3363 * Retrieve all of the information we know about a particular permission.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003364 *
3365 * @param name The fully qualified name (i.e. com.google.permission.LOGIN)
Jeff Sharkey4347f812017-04-21 12:08:39 -06003366 * of the permission you are interested in.
3367 * @param flags Additional option flags to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003368 * @return Returns a {@link PermissionInfo} containing information about the
3369 * permission.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003370 * @throws NameNotFoundException if a package with the given name cannot be
3371 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003372 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003373 public abstract PermissionInfo getPermissionInfo(String name, @PermissionInfoFlags int flags)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003374 throws NameNotFoundException;
3375
3376 /**
3377 * Query for all of the permissions associated with a particular group.
3378 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003379 * @param group The fully qualified name (i.e. com.google.permission.LOGIN)
Jeff Sharkey4347f812017-04-21 12:08:39 -06003380 * of the permission group you are interested in. Use null to
3381 * find all of the permissions not associated with a group.
3382 * @param flags Additional option flags to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003383 * @return Returns a list of {@link PermissionInfo} containing information
Jeff Sharkey4347f812017-04-21 12:08:39 -06003384 * about all of the permissions in the given group.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003385 * @throws NameNotFoundException if a package with the given name cannot be
3386 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003387 */
3388 public abstract List<PermissionInfo> queryPermissionsByGroup(String group,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003389 @PermissionInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003390
3391 /**
Philip P. Moltmanna4b30222018-08-31 09:30:18 -07003392 * Returns true if some permissions are individually controlled.
3393 *
3394 * <p>The user usually grants and revokes permission-groups. If this option is set some
3395 * dangerous system permissions can be revoked/granted by the user separately from their group.
Paul Navin7b89a7b2017-01-26 23:56:08 +00003396 *
3397 * @hide
3398 */
Philip P. Moltmanna4b30222018-08-31 09:30:18 -07003399 @TestApi @SystemApi
Philip P. Moltmann6c644e62018-07-18 15:41:24 -07003400 public abstract boolean arePermissionsIndividuallyControlled();
3401
3402 /**
3403 * Returns true if wireless consent mode is enabled
3404 *
3405 * @hide
3406 */
3407 public abstract boolean isWirelessConsentModeEnabled();
Paul Navin7b89a7b2017-01-26 23:56:08 +00003408
3409 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003410 * Retrieve all of the information we know about a particular group of
3411 * permissions.
3412 *
Jeff Sharkey4347f812017-04-21 12:08:39 -06003413 * @param name The fully qualified name (i.e.
3414 * com.google.permission_group.APPS) of the permission you are
3415 * interested in.
3416 * @param flags Additional option flags to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003417 * @return Returns a {@link PermissionGroupInfo} containing information
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003418 * about the permission.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003419 * @throws NameNotFoundException if a package with the given name cannot be
3420 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003421 */
3422 public abstract PermissionGroupInfo getPermissionGroupInfo(String name,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003423 @PermissionGroupInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003424
3425 /**
3426 * Retrieve all of the known permission groups in the system.
3427 *
Jeff Sharkey4347f812017-04-21 12:08:39 -06003428 * @param flags Additional option flags to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003429 * @return Returns a list of {@link PermissionGroupInfo} containing
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003430 * information about all of the known permission groups.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003431 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003432 public abstract List<PermissionGroupInfo> getAllPermissionGroups(
3433 @PermissionGroupInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003434
3435 /**
3436 * Retrieve all of the information we know about a particular
3437 * package/application.
3438 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003439 * @param packageName The full name (i.e. com.google.apps.contacts) of an
Jeff Sharkey4347f812017-04-21 12:08:39 -06003440 * application.
3441 * @param flags Additional option flags to modify the data returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003442 * @return An {@link ApplicationInfo} containing information about the
Jeff Sharkey4347f812017-04-21 12:08:39 -06003443 * package. If flag {@code MATCH_UNINSTALLED_PACKAGES} is set and if
3444 * the package is not found in the list of installed applications,
3445 * the application information is retrieved from the list of
3446 * uninstalled applications (which includes installed applications
3447 * as well as applications with data directory i.e. applications
3448 * which had been deleted with {@code DONT_DELETE_DATA} flag set).
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003449 * @throws NameNotFoundException if a package with the given name cannot be
3450 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003451 */
3452 public abstract ApplicationInfo getApplicationInfo(String packageName,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003453 @ApplicationInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003454
Jeff Sharkeycd654482016-01-08 17:42:11 -07003455 /** {@hide} */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01003456 @UnsupportedAppUsage
Jeff Sharkeycd654482016-01-08 17:42:11 -07003457 public abstract ApplicationInfo getApplicationInfoAsUser(String packageName,
3458 @ApplicationInfoFlags int flags, @UserIdInt int userId) throws NameNotFoundException;
3459
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003460 /**
Hai Zhang8c7e93b2018-12-11 18:34:06 -08003461 * Retrieve all of the information we know about a particular
3462 * package/application, for a specific user.
3463 *
3464 * @param packageName The full name (i.e. com.google.apps.contacts) of an
3465 * application.
3466 * @param flags Additional option flags to modify the data returned.
3467 * @return An {@link ApplicationInfo} containing information about the
3468 * package. If flag {@code MATCH_UNINSTALLED_PACKAGES} is set and if
3469 * the package is not found in the list of installed applications,
3470 * the application information is retrieved from the list of
3471 * uninstalled applications (which includes installed applications
3472 * as well as applications with data directory i.e. applications
3473 * which had been deleted with {@code DONT_DELETE_DATA} flag set).
3474 * @throws NameNotFoundException if a package with the given name cannot be
3475 * found on the system.
3476 * @hide
3477 */
3478 @NonNull
3479 @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS)
3480 @SystemApi
3481 public ApplicationInfo getApplicationInfoAsUser(@NonNull String packageName,
3482 @ApplicationInfoFlags int flags, @NonNull UserHandle user)
3483 throws NameNotFoundException {
3484 return getApplicationInfoAsUser(packageName, flags, user.getIdentifier());
3485 }
3486
3487 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003488 * Retrieve all of the information we know about a particular activity
3489 * class.
3490 *
Dianne Hackborn361199b2010-08-30 17:42:07 -07003491 * @param component The full component name (i.e.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003492 * com.google.apps.contacts/com.google.apps.contacts.
3493 * ContactsList) of an Activity class.
Jeff Sharkey4347f812017-04-21 12:08:39 -06003494 * @param flags Additional option flags to modify the data returned.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003495 * @return An {@link ActivityInfo} containing information about the
3496 * activity.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003497 * @throws NameNotFoundException if a package with the given name cannot be
3498 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003499 */
Dianne Hackborn361199b2010-08-30 17:42:07 -07003500 public abstract ActivityInfo getActivityInfo(ComponentName component,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003501 @ComponentInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003502
3503 /**
3504 * Retrieve all of the information we know about a particular receiver
3505 * class.
3506 *
Dianne Hackborn361199b2010-08-30 17:42:07 -07003507 * @param component The full component name (i.e.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003508 * com.google.apps.calendar/com.google.apps.calendar.
3509 * CalendarAlarm) of a Receiver class.
Jeff Sharkey4347f812017-04-21 12:08:39 -06003510 * @param flags Additional option flags to modify the data returned.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003511 * @return An {@link ActivityInfo} containing information about the
3512 * receiver.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003513 * @throws NameNotFoundException if a package with the given name cannot be
3514 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003515 */
Dianne Hackborn361199b2010-08-30 17:42:07 -07003516 public abstract ActivityInfo getReceiverInfo(ComponentName component,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003517 @ComponentInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003518
3519 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003520 * Retrieve all of the information we know about a particular service class.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003521 *
Dianne Hackborn361199b2010-08-30 17:42:07 -07003522 * @param component The full component name (i.e.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003523 * com.google.apps.media/com.google.apps.media.
3524 * BackgroundPlayback) of a Service class.
Jeff Sharkey4347f812017-04-21 12:08:39 -06003525 * @param flags Additional option flags to modify the data returned.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003526 * @return A {@link ServiceInfo} object containing information about the
3527 * service.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003528 * @throws NameNotFoundException if a package with the given name cannot be
3529 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003530 */
Dianne Hackborn361199b2010-08-30 17:42:07 -07003531 public abstract ServiceInfo getServiceInfo(ComponentName component,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003532 @ComponentInfoFlags int flags) throws NameNotFoundException;
Dianne Hackborn361199b2010-08-30 17:42:07 -07003533
3534 /**
3535 * Retrieve all of the information we know about a particular content
3536 * provider class.
3537 *
Dianne Hackborn361199b2010-08-30 17:42:07 -07003538 * @param component The full component name (i.e.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003539 * com.google.providers.media/com.google.providers.media.
3540 * MediaProvider) of a ContentProvider class.
Jeff Sharkey4347f812017-04-21 12:08:39 -06003541 * @param flags Additional option flags to modify the data returned.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003542 * @return A {@link ProviderInfo} object containing information about the
3543 * provider.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003544 * @throws NameNotFoundException if a package with the given name cannot be
3545 * found on the system.
Dianne Hackborn361199b2010-08-30 17:42:07 -07003546 */
3547 public abstract ProviderInfo getProviderInfo(ComponentName component,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003548 @ComponentInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003549
3550 /**
Todd Kennedy3dbf83a2018-11-13 13:29:16 -08003551 * Retrieve information for a particular module.
3552 *
3553 * @param packageName The name of the module.
3554 * @param flags Additional option flags to modify the data returned.
3555 * @return A {@link ModuleInfo} object containing information about the
3556 * module.
3557 * @throws NameNotFoundException if a module with the given name cannot be
3558 * found on the system.
3559 */
3560 public ModuleInfo getModuleInfo(String packageName, @ModuleInfoFlags int flags)
3561 throws NameNotFoundException {
3562 throw new UnsupportedOperationException(
3563 "getModuleInfo not implemented in subclass");
3564 }
3565
3566 /**
3567 * Return a List of all modules that are installed.
3568 *
3569 * @param flags Additional option flags to modify the data returned.
3570 * @return A {@link List} of {@link ModuleInfo} objects, one for each installed
3571 * module, containing information about the module. In the unlikely case
3572 * there are no installed modules, an empty list is returned.
3573 */
3574 public @NonNull List<ModuleInfo> getInstalledModules(@ModuleInfoFlags int flags) {
3575 throw new UnsupportedOperationException(
3576 "getInstalledModules not implemented in subclass");
3577 }
3578
3579 /**
Ricky Wai9964f702018-04-12 17:01:20 +01003580 * Return a List of all packages that are installed for the current user.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003581 *
Jeff Sharkey4347f812017-04-21 12:08:39 -06003582 * @param flags Additional option flags to modify the data returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003583 * @return A List of PackageInfo objects, one for each installed package,
Jeff Sharkey4347f812017-04-21 12:08:39 -06003584 * containing information about the package. In the unlikely case
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003585 * there are no installed packages, an empty list is returned. If
3586 * flag {@code MATCH_UNINSTALLED_PACKAGES} is set, the package
3587 * information is retrieved from the list of uninstalled
3588 * applications (which includes installed applications as well as
3589 * applications with data directory i.e. applications which had been
3590 * deleted with {@code DONT_DELETE_DATA} flag set).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003591 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003592 public abstract List<PackageInfo> getInstalledPackages(@PackageInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003593
3594 /**
Jeff Sharkey4347f812017-04-21 12:08:39 -06003595 * Return a List of all installed packages that are currently holding any of
3596 * the given permissions.
Dianne Hackborne7991752013-01-16 17:56:46 -08003597 *
Jeff Sharkey4347f812017-04-21 12:08:39 -06003598 * @param flags Additional option flags to modify the data returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003599 * @return A List of PackageInfo objects, one for each installed package
3600 * that holds any of the permissions that were provided, containing
3601 * information about the package. If no installed packages hold any
3602 * of the permissions, an empty list is returned. If flag
Jeff Sharkey4347f812017-04-21 12:08:39 -06003603 * {@code MATCH_UNINSTALLED_PACKAGES} is set, the package
3604 * information is retrieved from the list of uninstalled
3605 * applications (which includes installed applications as well as
3606 * applications with data directory i.e. applications which had been
3607 * deleted with {@code DONT_DELETE_DATA} flag set).
Dianne Hackborne7991752013-01-16 17:56:46 -08003608 */
3609 public abstract List<PackageInfo> getPackagesHoldingPermissions(
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003610 String[] permissions, @PackageInfoFlags int flags);
Dianne Hackborne7991752013-01-16 17:56:46 -08003611
3612 /**
Jeff Sharkey4347f812017-04-21 12:08:39 -06003613 * Return a List of all packages that are installed on the device, for a
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06003614 * specific user.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003615 *
Jeff Sharkey4347f812017-04-21 12:08:39 -06003616 * @param flags Additional option flags to modify the data returned.
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003617 * @param userId The user for whom the installed packages are to be listed
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003618 * @return A List of PackageInfo objects, one for each installed package,
Jeff Sharkey4347f812017-04-21 12:08:39 -06003619 * containing information about the package. In the unlikely case
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003620 * there are no installed packages, an empty list is returned. If
3621 * flag {@code MATCH_UNINSTALLED_PACKAGES} is set, the package
3622 * information is retrieved from the list of uninstalled
3623 * applications (which includes installed applications as well as
3624 * applications with data directory i.e. applications which had been
3625 * deleted with {@code DONT_DELETE_DATA} flag set).
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003626 * @hide
3627 */
Todd Kennedyef9acb62018-05-29 15:18:06 -07003628 @TestApi
Svet Ganovae0e03a2016-02-25 18:22:10 -08003629 @SystemApi
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06003630 @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS_FULL)
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07003631 public abstract List<PackageInfo> getInstalledPackagesAsUser(@PackageInfoFlags int flags,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003632 @UserIdInt int userId);
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003633
3634 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003635 * Check whether a particular package has been granted a particular
3636 * permission.
3637 *
Svet Ganovad3b2972015-07-07 22:49:17 -07003638 * @param permName The name of the permission you are checking for.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003639 * @param pkgName The name of the package you are checking against.
3640 *
3641 * @return If the package has the permission, PERMISSION_GRANTED is
3642 * returned. If it does not have the permission, PERMISSION_DENIED
3643 * is returned.
3644 *
3645 * @see #PERMISSION_GRANTED
3646 * @see #PERMISSION_DENIED
3647 */
Tor Norbye1c2bf032015-03-02 10:57:08 -08003648 @CheckResult
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06003649 public abstract @PermissionResult int checkPermission(String permName, String pkgName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003650
3651 /**
Svet Ganovad3b2972015-07-07 22:49:17 -07003652 * Checks whether a particular permissions has been revoked for a
3653 * package by policy. Typically the device owner or the profile owner
3654 * may apply such a policy. The user cannot grant policy revoked
3655 * permissions, hence the only way for an app to get such a permission
3656 * is by a policy change.
3657 *
3658 * @param permName The name of the permission you are checking for.
3659 * @param pkgName The name of the package you are checking against.
3660 *
3661 * @return Whether the permission is restricted by policy.
3662 */
3663 @CheckResult
Svet Ganovf1b7f202015-07-29 08:33:42 -07003664 public abstract boolean isPermissionRevokedByPolicy(@NonNull String permName,
3665 @NonNull String pkgName);
3666
3667 /**
3668 * Gets the package name of the component controlling runtime permissions.
3669 *
3670 * @return The package name.
3671 *
3672 * @hide
3673 */
Philip P. Moltmanneb0a0ae2017-06-30 10:55:51 -07003674 @TestApi
Svet Ganovf1b7f202015-07-29 08:33:42 -07003675 public abstract String getPermissionControllerPackageName();
Svet Ganovad3b2972015-07-07 22:49:17 -07003676
3677 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003678 * Add a new dynamic permission to the system. For this to work, your
3679 * package must have defined a permission tree through the
3680 * {@link android.R.styleable#AndroidManifestPermissionTree
3681 * &lt;permission-tree&gt;} tag in its manifest. A package can only add
3682 * permissions to trees that were defined by either its own package or
3683 * another with the same user id; a permission is in a tree if it
3684 * matches the name of the permission tree + ".": for example,
3685 * "com.foo.bar" is a member of the permission tree "com.foo".
3686 *
3687 * <p>It is good to make your permission tree name descriptive, because you
3688 * are taking possession of that entire set of permission names. Thus, it
3689 * must be under a domain you control, with a suffix that will not match
3690 * any normal permissions that may be declared in any applications that
3691 * are part of that domain.
3692 *
3693 * <p>New permissions must be added before
3694 * any .apks are installed that use those permissions. Permissions you
3695 * add through this method are remembered across reboots of the device.
3696 * If the given permission already exists, the info you supply here
3697 * will be used to update it.
3698 *
3699 * @param info Description of the permission to be added.
3700 *
3701 * @return Returns true if a new permission was created, false if an
3702 * existing one was updated.
3703 *
3704 * @throws SecurityException if you are not allowed to add the
3705 * given permission name.
3706 *
3707 * @see #removePermission(String)
3708 */
3709 public abstract boolean addPermission(PermissionInfo info);
3710
3711 /**
Dianne Hackbornd7c09682010-03-30 10:42:20 -07003712 * Like {@link #addPermission(PermissionInfo)} but asynchronously
3713 * persists the package manager state after returning from the call,
3714 * allowing it to return quicker and batch a series of adds at the
3715 * expense of no guarantee the added permission will be retained if
3716 * the device is rebooted before it is written.
3717 */
3718 public abstract boolean addPermissionAsync(PermissionInfo info);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003719
Dianne Hackbornd7c09682010-03-30 10:42:20 -07003720 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003721 * Removes a permission that was previously added with
3722 * {@link #addPermission(PermissionInfo)}. The same ownership rules apply
3723 * -- you are only allowed to remove permissions that you are allowed
3724 * to add.
3725 *
3726 * @param name The name of the permission to remove.
3727 *
3728 * @throws SecurityException if you are not allowed to remove the
3729 * given permission name.
3730 *
3731 * @see #addPermission(PermissionInfo)
3732 */
3733 public abstract void removePermission(String name);
3734
Svet Ganov8c7f7002015-05-07 10:48:44 -07003735 /**
3736 * Permission flags set when granting or revoking a permission.
3737 *
3738 * @hide
3739 */
3740 @SystemApi
Jeff Sharkey4347f812017-04-21 12:08:39 -06003741 @IntDef(prefix = { "FLAG_PERMISSION_" }, value = {
3742 FLAG_PERMISSION_USER_SET,
Svet Ganov8c7f7002015-05-07 10:48:44 -07003743 FLAG_PERMISSION_USER_FIXED,
3744 FLAG_PERMISSION_POLICY_FIXED,
Svet Ganovb3f22b42015-05-12 11:01:24 -07003745 FLAG_PERMISSION_REVOKE_ON_UPGRADE,
Svet Ganov77ab6a82015-07-03 12:03:02 -07003746 FLAG_PERMISSION_SYSTEM_FIXED,
Philip P. Moltmann17f65af2018-10-18 15:32:29 -07003747 FLAG_PERMISSION_GRANTED_BY_DEFAULT,
3748 /*
3749 FLAG_PERMISSION_REVOKE_WHEN_REQUESED
3750 */
Jeff Sharkey4347f812017-04-21 12:08:39 -06003751 })
Svet Ganov8c7f7002015-05-07 10:48:44 -07003752 @Retention(RetentionPolicy.SOURCE)
3753 public @interface PermissionFlags {}
3754
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003755 /**
Svetoslavc6d1c342015-02-26 14:44:43 -08003756 * Grant a runtime permission to an application which the application does not
3757 * already have. The permission must have been requested by the application.
3758 * If the application is not allowed to hold the permission, a {@link
Ruben Brunk12ab5e12016-11-10 15:27:30 -08003759 * java.lang.SecurityException} is thrown. If the package or permission is
3760 * invalid, a {@link java.lang.IllegalArgumentException} is thrown.
Svetoslavc6d1c342015-02-26 14:44:43 -08003761 * <p>
3762 * <strong>Note: </strong>Using this API requires holding
Todd Kennedya8eb6a82016-07-28 16:35:42 -07003763 * android.permission.GRANT_RUNTIME_PERMISSIONS and if the user id is
Svetoslavc6d1c342015-02-26 14:44:43 -08003764 * not the current user android.permission.INTERACT_ACROSS_USERS_FULL.
3765 * </p>
Nick Kralevich035f80d2013-03-27 15:20:08 -07003766 *
Svetoslavc6d1c342015-02-26 14:44:43 -08003767 * @param packageName The package to which to grant the permission.
3768 * @param permissionName The permission name to grant.
3769 * @param user The user for which to grant the permission.
3770 *
Svet Ganov8c7f7002015-05-07 10:48:44 -07003771 * @see #revokeRuntimePermission(String, String, android.os.UserHandle)
Svetoslavc6d1c342015-02-26 14:44:43 -08003772 *
3773 * @hide
Nick Kralevich035f80d2013-03-27 15:20:08 -07003774 */
Svet Ganovd873ae62018-06-25 16:39:23 -07003775 @TestApi
Svetoslavc6d1c342015-02-26 14:44:43 -08003776 @SystemApi
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06003777 @RequiresPermission(android.Manifest.permission.GRANT_RUNTIME_PERMISSIONS)
Svet Ganov8c7f7002015-05-07 10:48:44 -07003778 public abstract void grantRuntimePermission(@NonNull String packageName,
Svetoslavc6d1c342015-02-26 14:44:43 -08003779 @NonNull String permissionName, @NonNull UserHandle user);
Nick Kralevich035f80d2013-03-27 15:20:08 -07003780
Svetoslavc6d1c342015-02-26 14:44:43 -08003781 /**
3782 * Revoke a runtime permission that was previously granted by {@link
Svet Ganov8c7f7002015-05-07 10:48:44 -07003783 * #grantRuntimePermission(String, String, android.os.UserHandle)}. The
3784 * permission must have been requested by and granted to the application.
3785 * If the application is not allowed to hold the permission, a {@link
Ruben Brunk12ab5e12016-11-10 15:27:30 -08003786 * java.lang.SecurityException} is thrown. If the package or permission is
3787 * invalid, a {@link java.lang.IllegalArgumentException} is thrown.
Svetoslavc6d1c342015-02-26 14:44:43 -08003788 * <p>
3789 * <strong>Note: </strong>Using this API requires holding
Todd Kennedya8eb6a82016-07-28 16:35:42 -07003790 * android.permission.REVOKE_RUNTIME_PERMISSIONS and if the user id is
Svetoslavc6d1c342015-02-26 14:44:43 -08003791 * not the current user android.permission.INTERACT_ACROSS_USERS_FULL.
3792 * </p>
3793 *
3794 * @param packageName The package from which to revoke the permission.
3795 * @param permissionName The permission name to revoke.
3796 * @param user The user for which to revoke the permission.
3797 *
Svet Ganov8c7f7002015-05-07 10:48:44 -07003798 * @see #grantRuntimePermission(String, String, android.os.UserHandle)
Svetoslavc6d1c342015-02-26 14:44:43 -08003799 *
3800 * @hide
3801 */
Svet Ganovd873ae62018-06-25 16:39:23 -07003802 @TestApi
Svetoslavc6d1c342015-02-26 14:44:43 -08003803 @SystemApi
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06003804 @RequiresPermission(android.Manifest.permission.REVOKE_RUNTIME_PERMISSIONS)
Svet Ganov8c7f7002015-05-07 10:48:44 -07003805 public abstract void revokeRuntimePermission(@NonNull String packageName,
Svetoslavc6d1c342015-02-26 14:44:43 -08003806 @NonNull String permissionName, @NonNull UserHandle user);
3807
3808 /**
Svet Ganov8c7f7002015-05-07 10:48:44 -07003809 * Gets the state flags associated with a permission.
3810 *
3811 * @param permissionName The permission for which to get the flags.
3812 * @param packageName The package name for which to get the flags.
3813 * @param user The user for which to get permission flags.
3814 * @return The permission flags.
3815 *
3816 * @hide
3817 */
3818 @SystemApi
Philip P. Moltmann3e496172019-02-11 16:29:19 -08003819 @TestApi
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06003820 @RequiresPermission(anyOf = {
3821 android.Manifest.permission.GRANT_RUNTIME_PERMISSIONS,
3822 android.Manifest.permission.REVOKE_RUNTIME_PERMISSIONS
3823 })
Svet Ganov8c7f7002015-05-07 10:48:44 -07003824 public abstract @PermissionFlags int getPermissionFlags(String permissionName,
3825 String packageName, @NonNull UserHandle user);
3826
3827 /**
3828 * Updates the flags associated with a permission by replacing the flags in
3829 * the specified mask with the provided flag values.
3830 *
3831 * @param permissionName The permission for which to update the flags.
3832 * @param packageName The package name for which to update the flags.
3833 * @param flagMask The flags which to replace.
3834 * @param flagValues The flags with which to replace.
3835 * @param user The user for which to update the permission flags.
3836 *
3837 * @hide
3838 */
3839 @SystemApi
Philip P. Moltmann3e496172019-02-11 16:29:19 -08003840 @TestApi
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06003841 @RequiresPermission(anyOf = {
3842 android.Manifest.permission.GRANT_RUNTIME_PERMISSIONS,
3843 android.Manifest.permission.REVOKE_RUNTIME_PERMISSIONS
3844 })
Svet Ganov8c7f7002015-05-07 10:48:44 -07003845 public abstract void updatePermissionFlags(String permissionName,
Jeff Sharkey4347f812017-04-21 12:08:39 -06003846 String packageName, @PermissionFlags int flagMask, @PermissionFlags int flagValues,
Svet Ganov8c7f7002015-05-07 10:48:44 -07003847 @NonNull UserHandle user);
3848
3849 /**
Svetoslav20770dd2015-05-29 15:43:04 -07003850 * Gets whether you should show UI with rationale for requesting a permission.
3851 * You should do this only if you do not have the permission and the context in
3852 * which the permission is requested does not clearly communicate to the user
3853 * what would be the benefit from grating this permission.
3854 *
3855 * @param permission A permission your app wants to request.
3856 * @return Whether you can show permission rationale UI.
3857 *
3858 * @hide
3859 */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01003860 @UnsupportedAppUsage
Svetoslav20770dd2015-05-29 15:43:04 -07003861 public abstract boolean shouldShowRequestPermissionRationale(String permission);
3862
3863 /**
Svetoslavc6d1c342015-02-26 14:44:43 -08003864 * Returns an {@link android.content.Intent} suitable for passing to
3865 * {@link android.app.Activity#startActivityForResult(android.content.Intent, int)}
3866 * which prompts the user to grant permissions to this application.
3867 *
3868 * @throws NullPointerException if {@code permissions} is {@code null} or empty.
3869 *
3870 * @hide
3871 */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01003872 @UnsupportedAppUsage
Svetoslavc6d1c342015-02-26 14:44:43 -08003873 public Intent buildRequestPermissionsIntent(@NonNull String[] permissions) {
3874 if (ArrayUtils.isEmpty(permissions)) {
Svet Ganovf66381c2016-02-18 20:02:36 -08003875 throw new IllegalArgumentException("permission cannot be null or empty");
Svetoslavc6d1c342015-02-26 14:44:43 -08003876 }
3877 Intent intent = new Intent(ACTION_REQUEST_PERMISSIONS);
3878 intent.putExtra(EXTRA_REQUEST_PERMISSIONS_NAMES, permissions);
Svet Ganovf1b7f202015-07-29 08:33:42 -07003879 intent.setPackage(getPermissionControllerPackageName());
Svetoslavc6d1c342015-02-26 14:44:43 -08003880 return intent;
Nick Kralevich035f80d2013-03-27 15:20:08 -07003881 }
3882
3883 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003884 * Compare the signatures of two packages to determine if the same
3885 * signature appears in both of them. If they do contain the same
3886 * signature, then they are allowed special privileges when working
3887 * with each other: they can share the same user-id, run instrumentation
3888 * against each other, etc.
3889 *
3890 * @param pkg1 First package name whose signature will be compared.
3891 * @param pkg2 Second package name whose signature will be compared.
Chris Palmer09f33602010-09-13 14:27:18 -07003892 *
3893 * @return Returns an integer indicating whether all signatures on the
3894 * two packages match. The value is >= 0 ({@link #SIGNATURE_MATCH}) if
3895 * all signatures match or < 0 if there is not a match ({@link
3896 * #SIGNATURE_NO_MATCH} or {@link #SIGNATURE_UNKNOWN_PACKAGE}).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003897 *
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07003898 * @see #checkSignatures(int, int)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003899 */
Tor Norbye1c2bf032015-03-02 10:57:08 -08003900 @CheckResult
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06003901 public abstract @SignatureResult int checkSignatures(String pkg1, String pkg2);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003902
3903 /**
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07003904 * Like {@link #checkSignatures(String, String)}, but takes UIDs of
3905 * the two packages to be checked. This can be useful, for example,
3906 * when doing the check in an IPC, where the UID is the only identity
3907 * available. It is functionally identical to determining the package
3908 * associated with the UIDs and checking their signatures.
3909 *
Joe Onorato25660ec2009-08-12 22:40:37 -07003910 * @param uid1 First UID whose signature will be compared.
3911 * @param uid2 Second UID whose signature will be compared.
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07003912 *
Chris Palmer09f33602010-09-13 14:27:18 -07003913 * @return Returns an integer indicating whether all signatures on the
3914 * two packages match. The value is >= 0 ({@link #SIGNATURE_MATCH}) if
3915 * all signatures match or < 0 if there is not a match ({@link
3916 * #SIGNATURE_NO_MATCH} or {@link #SIGNATURE_UNKNOWN_PACKAGE}).
3917 *
3918 * @see #checkSignatures(String, String)
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07003919 */
Tor Norbye1c2bf032015-03-02 10:57:08 -08003920 @CheckResult
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06003921 public abstract @SignatureResult int checkSignatures(int uid1, int uid2);
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07003922
3923 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003924 * Retrieve the names of all packages that are associated with a particular
3925 * user id. In most cases, this will be a single package name, the package
3926 * that has been assigned that user id. Where there are multiple packages
3927 * sharing the same user id through the "sharedUserId" mechanism, all
3928 * packages with that id will be returned.
3929 *
3930 * @param uid The user id for which you would like to retrieve the
3931 * associated packages.
3932 *
3933 * @return Returns an array of one or more packages assigned to the user
3934 * id, or null if there are no known packages with the given id.
3935 */
Jeff Sharkey377ded0f2016-01-10 13:15:41 -07003936 public abstract @Nullable String[] getPackagesForUid(int uid);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003937
3938 /**
Michal Karpinskicb67dc92016-12-13 18:20:23 +00003939 * Retrieve the official name associated with a uid. This name is
Jonathan Basseri7ea3a332015-05-12 19:39:22 -07003940 * guaranteed to never change, though it is possible for the underlying
Michal Karpinskicb67dc92016-12-13 18:20:23 +00003941 * uid to be changed. That is, if you are storing information about
3942 * uids in persistent storage, you should use the string returned
3943 * by this function instead of the raw uid.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003944 *
Michal Karpinskicb67dc92016-12-13 18:20:23 +00003945 * @param uid The uid for which you would like to retrieve a name.
3946 * @return Returns a unique name for the given uid, or null if the
3947 * uid is not currently assigned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003948 */
Jeff Sharkey377ded0f2016-01-10 13:15:41 -07003949 public abstract @Nullable String getNameForUid(int uid);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003950
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003951 /**
Todd Kennedy9da8b8a72017-07-25 15:38:39 -07003952 * Retrieves the official names associated with each given uid.
3953 * @see #getNameForUid(int)
3954 *
3955 * @hide
3956 */
Philip P. Moltmannabeb04e2018-03-26 10:15:23 -07003957 @TestApi
Todd Kennedy9da8b8a72017-07-25 15:38:39 -07003958 public abstract @Nullable String[] getNamesForUids(int[] uids);
3959
3960 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003961 * Return the user id associated with a shared user name. Multiple
3962 * applications can specify a shared user name in their manifest and thus
3963 * end up using a common uid. This might be used for new applications
3964 * that use an existing shared user name and need to know the uid of the
3965 * shared user.
3966 *
3967 * @param sharedUserName The shared user name whose uid is to be retrieved.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003968 * @return Returns the UID associated with the shared user.
3969 * @throws NameNotFoundException if a package with the given name cannot be
3970 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003971 * @hide
3972 */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01003973 @UnsupportedAppUsage
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003974 public abstract int getUidForSharedUser(String sharedUserName)
3975 throws NameNotFoundException;
3976
3977 /**
Ricky Wai9964f702018-04-12 17:01:20 +01003978 * Return a List of all application packages that are installed for the
3979 * current user. If flag GET_UNINSTALLED_PACKAGES has been set, a list of all
Jeff Sharkey4347f812017-04-21 12:08:39 -06003980 * applications including those deleted with {@code DONT_DELETE_DATA}
3981 * (partially installed apps with data directory) will be returned.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003982 *
Jeff Sharkey4347f812017-04-21 12:08:39 -06003983 * @param flags Additional option flags to modify the data returned.
3984 * @return A List of ApplicationInfo objects, one for each installed
3985 * application. In the unlikely case there are no installed
3986 * packages, an empty list is returned. If flag
3987 * {@code MATCH_UNINSTALLED_PACKAGES} is set, the application
3988 * information is retrieved from the list of uninstalled
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003989 * applications (which includes installed applications as well as
3990 * applications with data directory i.e. applications which had been
3991 * deleted with {@code DONT_DELETE_DATA} flag set).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003992 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003993 public abstract List<ApplicationInfo> getInstalledApplications(@ApplicationInfoFlags int flags);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003994
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003995 /**
Jeff Sharkey4347f812017-04-21 12:08:39 -06003996 * Return a List of all application packages that are installed on the
3997 * device, for a specific user. If flag GET_UNINSTALLED_PACKAGES has been
3998 * set, a list of all applications including those deleted with
3999 * {@code DONT_DELETE_DATA} (partially installed apps with data directory)
Bartosz Fabianowski11334242016-11-17 20:49:16 +01004000 * will be returned.
4001 *
Jeff Sharkey4347f812017-04-21 12:08:39 -06004002 * @param flags Additional option flags to modify the data returned.
4003 * @param userId The user for whom the installed applications are to be
4004 * listed
4005 * @return A List of ApplicationInfo objects, one for each installed
4006 * application. In the unlikely case there are no installed
4007 * packages, an empty list is returned. If flag
4008 * {@code MATCH_UNINSTALLED_PACKAGES} is set, the application
4009 * information is retrieved from the list of uninstalled
Bartosz Fabianowski11334242016-11-17 20:49:16 +01004010 * applications (which includes installed applications as well as
4011 * applications with data directory i.e. applications which had been
4012 * deleted with {@code DONT_DELETE_DATA} flag set).
4013 * @hide
Bartosz Fabianowski11334242016-11-17 20:49:16 +01004014 */
Hongming Jin83e16262018-05-18 10:47:57 -07004015 @TestApi
Bartosz Fabianowski11334242016-11-17 20:49:16 +01004016 public abstract List<ApplicationInfo> getInstalledApplicationsAsUser(
4017 @ApplicationInfoFlags int flags, @UserIdInt int userId);
4018
4019 /**
Jeff Sharkey910e0812017-04-21 16:29:27 -06004020 * Gets the instant applications the user recently used.
Svet Ganov2acf0632015-11-24 19:10:59 -08004021 *
Svetoslav Ganov096d3042017-01-30 16:34:13 -08004022 * @return The instant app list.
Svet Ganov2acf0632015-11-24 19:10:59 -08004023 *
4024 * @hide
4025 */
Todd Kennedy9c9fdf22017-03-06 10:58:27 -08004026 @SystemApi
Svetoslav Ganov096d3042017-01-30 16:34:13 -08004027 @RequiresPermission(Manifest.permission.ACCESS_INSTANT_APPS)
4028 public abstract @NonNull List<InstantAppInfo> getInstantApps();
Svet Ganov2acf0632015-11-24 19:10:59 -08004029
4030 /**
Svetoslav Ganov096d3042017-01-30 16:34:13 -08004031 * Gets the icon for an instant application.
Svet Ganov2acf0632015-11-24 19:10:59 -08004032 *
4033 * @param packageName The app package name.
4034 *
4035 * @hide
4036 */
Todd Kennedy9c9fdf22017-03-06 10:58:27 -08004037 @SystemApi
Svetoslav Ganov096d3042017-01-30 16:34:13 -08004038 @RequiresPermission(Manifest.permission.ACCESS_INSTANT_APPS)
4039 public abstract @Nullable Drawable getInstantAppIcon(String packageName);
Svet Ganov2acf0632015-11-24 19:10:59 -08004040
4041 /**
David Christie31a16552017-03-01 15:08:45 -08004042 * Gets whether this application is an instant app.
Svet Ganov2acf0632015-11-24 19:10:59 -08004043 *
Svetoslav Ganov096d3042017-01-30 16:34:13 -08004044 * @return Whether caller is an instant app.
Svet Ganov2acf0632015-11-24 19:10:59 -08004045 *
David Christie31a16552017-03-01 15:08:45 -08004046 * @see #isInstantApp(String)
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07004047 * @see #updateInstantAppCookie(byte[])
Svetoslav Ganov096d3042017-01-30 16:34:13 -08004048 * @see #getInstantAppCookie()
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07004049 * @see #getInstantAppCookieMaxBytes()
Svet Ganov2acf0632015-11-24 19:10:59 -08004050 */
Svetoslav Ganov096d3042017-01-30 16:34:13 -08004051 public abstract boolean isInstantApp();
Svet Ganov2acf0632015-11-24 19:10:59 -08004052
4053 /**
David Christie31a16552017-03-01 15:08:45 -08004054 * Gets whether the given package is an instant app.
4055 *
4056 * @param packageName The package to check
4057 * @return Whether the given package is an instant app.
4058 *
4059 * @see #isInstantApp()
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07004060 * @see #updateInstantAppCookie(byte[])
David Christie31a16552017-03-01 15:08:45 -08004061 * @see #getInstantAppCookie()
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07004062 * @see #getInstantAppCookieMaxBytes()
4063 * @see #clearInstantAppCookie()
David Christie31a16552017-03-01 15:08:45 -08004064 */
4065 public abstract boolean isInstantApp(String packageName);
4066
4067 /**
Svetoslav Ganov096d3042017-01-30 16:34:13 -08004068 * Gets the maximum size in bytes of the cookie data an instant app
Svet Ganov2acf0632015-11-24 19:10:59 -08004069 * can store on the device.
4070 *
4071 * @return The max cookie size in bytes.
4072 *
Svetoslav Ganov096d3042017-01-30 16:34:13 -08004073 * @see #isInstantApp()
David Christie31a16552017-03-01 15:08:45 -08004074 * @see #isInstantApp(String)
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07004075 * @see #updateInstantAppCookie(byte[])
Svetoslav Ganov096d3042017-01-30 16:34:13 -08004076 * @see #getInstantAppCookie()
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07004077 * @see #clearInstantAppCookie()
4078 */
4079 public abstract int getInstantAppCookieMaxBytes();
4080
4081 /**
Daniel Cashman5cdda342018-01-19 07:22:52 -08004082 * deprecated
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07004083 * @hide
Svet Ganov2acf0632015-11-24 19:10:59 -08004084 */
Svetoslav Ganov096d3042017-01-30 16:34:13 -08004085 public abstract int getInstantAppCookieMaxSize();
Svet Ganov2acf0632015-11-24 19:10:59 -08004086
4087 /**
Svetoslav Ganov096d3042017-01-30 16:34:13 -08004088 * Gets the instant application cookie for this app. Non
4089 * instant apps and apps that were instant but were upgraded
4090 * to normal apps can still access this API. For instant apps
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07004091 * this cookie is cached for some time after uninstall while for
Svet Ganov2acf0632015-11-24 19:10:59 -08004092 * normal apps the cookie is deleted after the app is uninstalled.
4093 * The cookie is always present while the app is installed.
4094 *
4095 * @return The cookie.
4096 *
Svetoslav Ganov096d3042017-01-30 16:34:13 -08004097 * @see #isInstantApp()
David Christie31a16552017-03-01 15:08:45 -08004098 * @see #isInstantApp(String)
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07004099 * @see #updateInstantAppCookie(byte[])
4100 * @see #getInstantAppCookieMaxBytes()
4101 * @see #clearInstantAppCookie()
Svet Ganov2acf0632015-11-24 19:10:59 -08004102 */
Svetoslav Ganov096d3042017-01-30 16:34:13 -08004103 public abstract @NonNull byte[] getInstantAppCookie();
Svet Ganov2acf0632015-11-24 19:10:59 -08004104
4105 /**
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07004106 * Clears the instant application cookie for the calling app.
Svet Ganov2acf0632015-11-24 19:10:59 -08004107 *
Svetoslav Ganov096d3042017-01-30 16:34:13 -08004108 * @see #isInstantApp()
David Christie31a16552017-03-01 15:08:45 -08004109 * @see #isInstantApp(String)
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07004110 * @see #getInstantAppCookieMaxBytes()
Svetoslav Ganov096d3042017-01-30 16:34:13 -08004111 * @see #getInstantAppCookie()
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07004112 * @see #clearInstantAppCookie()
4113 */
4114 public abstract void clearInstantAppCookie();
4115
4116 /**
4117 * Updates the instant application cookie for the calling app. Non
4118 * instant apps and apps that were instant but were upgraded
4119 * to normal apps can still access this API. For instant apps
4120 * this cookie is cached for some time after uninstall while for
4121 * normal apps the cookie is deleted after the app is uninstalled.
4122 * The cookie is always present while the app is installed. The
4123 * cookie size is limited by {@link #getInstantAppCookieMaxBytes()}.
4124 * Passing <code>null</code> or an empty array clears the cookie.
4125 * </p>
4126 *
4127 * @param cookie The cookie data.
4128 *
4129 * @see #isInstantApp()
4130 * @see #isInstantApp(String)
4131 * @see #getInstantAppCookieMaxBytes()
4132 * @see #getInstantAppCookie()
4133 * @see #clearInstantAppCookie()
4134 *
4135 * @throws IllegalArgumentException if the array exceeds max cookie size.
4136 */
4137 public abstract void updateInstantAppCookie(@Nullable byte[] cookie);
4138
4139 /**
4140 * @removed
Svet Ganov2acf0632015-11-24 19:10:59 -08004141 */
Svetoslav Ganov096d3042017-01-30 16:34:13 -08004142 public abstract boolean setInstantAppCookie(@Nullable byte[] cookie);
Svet Ganov2acf0632015-11-24 19:10:59 -08004143
4144 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004145 * Get a list of shared libraries that are available on the
4146 * system.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004147 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004148 * @return An array of shared library names that are
4149 * available on the system, or null if none are installed.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004150 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004151 */
4152 public abstract String[] getSystemSharedLibraryNames();
4153
4154 /**
Svet Ganov67882122016-12-11 16:36:34 -08004155 * Get a list of shared libraries on the device.
4156 *
4157 * @param flags To filter the libraries to return.
4158 * @return The shared library list.
4159 *
Svet Ganov67882122016-12-11 16:36:34 -08004160 * @see #MATCH_UNINSTALLED_PACKAGES
4161 */
4162 public abstract @NonNull List<SharedLibraryInfo> getSharedLibraries(
4163 @InstallFlags int flags);
4164
4165 /**
4166 * Get a list of shared libraries on the device.
4167 *
4168 * @param flags To filter the libraries to return.
4169 * @param userId The user to query for.
4170 * @return The shared library list.
4171 *
4172 * @see #MATCH_FACTORY_ONLY
4173 * @see #MATCH_KNOWN_PACKAGES
4174 * @see #MATCH_ANY_USER
4175 * @see #MATCH_UNINSTALLED_PACKAGES
4176 *
4177 * @hide
4178 */
4179 public abstract @NonNull List<SharedLibraryInfo> getSharedLibrariesAsUser(
4180 @InstallFlags int flags, @UserIdInt int userId);
4181
4182 /**
Svet Ganovd7b1f4112016-02-09 18:49:23 -08004183 * Get the name of the package hosting the services shared library.
4184 *
4185 * @return The library host package.
4186 *
4187 * @hide
4188 */
Philip P. Moltmannf80809f2018-04-04 11:20:44 -07004189 @TestApi
Svetoslav Ganova9c25002016-04-13 19:25:56 -07004190 public abstract @NonNull String getServicesSystemSharedLibraryPackageName();
4191
4192 /**
4193 * Get the name of the package hosting the shared components shared library.
4194 *
4195 * @return The library host package.
4196 *
4197 * @hide
4198 */
Philip P. Moltmannf80809f2018-04-04 11:20:44 -07004199 @TestApi
Svetoslav Ganova9c25002016-04-13 19:25:56 -07004200 public abstract @NonNull String getSharedSystemSharedLibraryPackageName();
Svet Ganovd7b1f4112016-02-09 18:49:23 -08004201
4202 /**
Todd Kennedy9106c642017-02-08 14:16:53 -08004203 * Returns the names of the packages that have been changed
4204 * [eg. added, removed or updated] since the given sequence
4205 * number.
4206 * <p>If no packages have been changed, returns <code>null</code>.
4207 * <p>The sequence number starts at <code>0</code> and is
4208 * reset every boot.
Todd Kennedy8fddf9d2017-04-17 15:16:12 -07004209 * @param sequenceNumber The first sequence number for which to retrieve package changes.
Aurimas Liutikas7f695332018-05-31 21:07:32 -07004210 * @see android.provider.Settings.Global#BOOT_COUNT
Todd Kennedy9106c642017-02-08 14:16:53 -08004211 */
4212 public abstract @Nullable ChangedPackages getChangedPackages(
4213 @IntRange(from=0) int sequenceNumber);
4214
4215 /**
Dianne Hackborn49237342009-08-27 20:08:01 -07004216 * Get a list of features that are available on the
4217 * system.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004218 *
Dianne Hackborn49237342009-08-27 20:08:01 -07004219 * @return An array of FeatureInfo classes describing the features
4220 * that are available on the system, or null if there are none(!!).
Dianne Hackborn49237342009-08-27 20:08:01 -07004221 */
4222 public abstract FeatureInfo[] getSystemAvailableFeatures();
4223
4224 /**
Jeff Sharkey115d2c12016-02-15 17:25:57 -07004225 * Check whether the given feature name is one of the available features as
4226 * returned by {@link #getSystemAvailableFeatures()}. This tests for the
4227 * presence of <em>any</em> version of the given feature name; use
4228 * {@link #hasSystemFeature(String, int)} to check for a minimum version.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004229 *
Jeff Sharkey115d2c12016-02-15 17:25:57 -07004230 * @return Returns true if the devices supports the feature, else false.
Dianne Hackborn039c68e2009-09-26 16:39:23 -07004231 */
4232 public abstract boolean hasSystemFeature(String name);
4233
4234 /**
Jeff Sharkey115d2c12016-02-15 17:25:57 -07004235 * Check whether the given feature name and version is one of the available
4236 * features as returned by {@link #getSystemAvailableFeatures()}. Since
4237 * features are defined to always be backwards compatible, this returns true
4238 * if the available feature version is greater than or equal to the
4239 * requested version.
4240 *
4241 * @return Returns true if the devices supports the feature, else false.
4242 */
4243 public abstract boolean hasSystemFeature(String name, int version);
4244
4245 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004246 * Determine the best action to perform for a given Intent. This is how
4247 * {@link Intent#resolveActivity} finds an activity if a class has not been
4248 * explicitly specified.
4249 * <p>
4250 * <em>Note:</em> if using an implicit Intent (without an explicit
4251 * ComponentName specified), be sure to consider whether to set the
4252 * {@link #MATCH_DEFAULT_ONLY} only flag. You need to do so to resolve the
4253 * activity in the same way that
4254 * {@link android.content.Context#startActivity(Intent)} and
Dianne Hackborn4d023d212010-10-01 13:41:04 -07004255 * {@link android.content.Intent#resolveActivity(PackageManager)
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004256 * Intent.resolveActivity(PackageManager)} do.
4257 * </p>
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004258 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004259 * @param intent An intent containing all of the desired specification
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004260 * (action, data, type, category, and/or component).
Jeff Sharkey4347f812017-04-21 12:08:39 -06004261 * @param flags Additional option flags to modify the data returned. The
4262 * most important is {@link #MATCH_DEFAULT_ONLY}, to limit the
4263 * resolution to only those activities that support the
4264 * {@link android.content.Intent#CATEGORY_DEFAULT}.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004265 * @return Returns a ResolveInfo object containing the final activity intent
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004266 * that was determined to be the best action. Returns null if no
Mike LeBeaubd3f5272010-02-18 19:27:17 -08004267 * matching activity was found. If multiple matching activities are
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004268 * found and there is no default set, returns a ResolveInfo object
Mike LeBeaubd3f5272010-02-18 19:27:17 -08004269 * containing something else, such as the activity resolver.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004270 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004271 public abstract ResolveInfo resolveActivity(Intent intent, @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004272
4273 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004274 * Determine the best action to perform for a given Intent for a given user.
4275 * This is how {@link Intent#resolveActivity} finds an activity if a class
4276 * has not been explicitly specified.
4277 * <p>
4278 * <em>Note:</em> if using an implicit Intent (without an explicit
4279 * ComponentName specified), be sure to consider whether to set the
4280 * {@link #MATCH_DEFAULT_ONLY} only flag. You need to do so to resolve the
4281 * activity in the same way that
4282 * {@link android.content.Context#startActivity(Intent)} and
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004283 * {@link android.content.Intent#resolveActivity(PackageManager)
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004284 * Intent.resolveActivity(PackageManager)} do.
4285 * </p>
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004286 *
4287 * @param intent An intent containing all of the desired specification
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004288 * (action, data, type, category, and/or component).
Jeff Sharkey4347f812017-04-21 12:08:39 -06004289 * @param flags Additional option flags to modify the data returned. The
4290 * most important is {@link #MATCH_DEFAULT_ONLY}, to limit the
4291 * resolution to only those activities that support the
4292 * {@link android.content.Intent#CATEGORY_DEFAULT}.
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004293 * @param userId The user id.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004294 * @return Returns a ResolveInfo object containing the final activity intent
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004295 * that was determined to be the best action. Returns null if no
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004296 * matching activity was found. If multiple matching activities are
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004297 * found and there is no default set, returns a ResolveInfo object
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004298 * containing something else, such as the activity resolver.
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004299 * @hide
4300 */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01004301 @UnsupportedAppUsage
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004302 public abstract ResolveInfo resolveActivityAsUser(Intent intent, @ResolveInfoFlags int flags,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004303 @UserIdInt int userId);
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004304
4305 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004306 * Retrieve all activities that can be performed for the given intent.
4307 *
4308 * @param intent The desired intent as per resolveActivity().
Jeff Sharkey4347f812017-04-21 12:08:39 -06004309 * @param flags Additional option flags to modify the data returned. The
4310 * most important is {@link #MATCH_DEFAULT_ONLY}, to limit the
4311 * resolution to only those activities that support the
4312 * {@link android.content.Intent#CATEGORY_DEFAULT}. Or, set
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004313 * {@link #MATCH_ALL} to prevent any filtering of the results.
4314 * @return Returns a List of ResolveInfo objects containing one entry for
4315 * each matching activity, ordered from best to worst. In other
4316 * words, the first item is what would be returned by
4317 * {@link #resolveActivity}. If there are no matching activities, an
4318 * empty list is returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004319 */
4320 public abstract List<ResolveInfo> queryIntentActivities(Intent intent,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004321 @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004322
4323 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004324 * Retrieve all activities that can be performed for the given intent, for a
4325 * specific user.
Amith Yamasani151ec4c2012-09-07 19:25:16 -07004326 *
4327 * @param intent The desired intent as per resolveActivity().
Jeff Sharkey4347f812017-04-21 12:08:39 -06004328 * @param flags Additional option flags to modify the data returned. The
4329 * most important is {@link #MATCH_DEFAULT_ONLY}, to limit the
4330 * resolution to only those activities that support the
4331 * {@link android.content.Intent#CATEGORY_DEFAULT}. Or, set
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004332 * {@link #MATCH_ALL} to prevent any filtering of the results.
4333 * @return Returns a List of ResolveInfo objects containing one entry for
4334 * each matching activity, ordered from best to worst. In other
4335 * words, the first item is what would be returned by
4336 * {@link #resolveActivity}. If there are no matching activities, an
4337 * empty list is returned.
Amith Yamasani151ec4c2012-09-07 19:25:16 -07004338 * @hide
4339 */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01004340 @UnsupportedAppUsage
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004341 public abstract List<ResolveInfo> queryIntentActivitiesAsUser(Intent intent,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004342 @ResolveInfoFlags int flags, @UserIdInt int userId);
Amith Yamasani151ec4c2012-09-07 19:25:16 -07004343
4344 /**
Hai Zhang8c7e93b2018-12-11 18:34:06 -08004345 * Retrieve all activities that can be performed for the given intent, for a
4346 * specific user.
4347 *
4348 * @param intent The desired intent as per resolveActivity().
4349 * @param flags Additional option flags to modify the data returned. The
4350 * most important is {@link #MATCH_DEFAULT_ONLY}, to limit the
4351 * resolution to only those activities that support the
4352 * {@link android.content.Intent#CATEGORY_DEFAULT}. Or, set
4353 * {@link #MATCH_ALL} to prevent any filtering of the results.
4354 * @param user The user being queried.
4355 * @return Returns a List of ResolveInfo objects containing one entry for
4356 * each matching activity, ordered from best to worst. In other
4357 * words, the first item is what would be returned by
4358 * {@link #resolveActivity}. If there are no matching activities, an
4359 * empty list is returned.
4360 * @hide
4361 */
4362 @NonNull
4363 @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS)
4364 @SystemApi
4365 public List<ResolveInfo> queryIntentActivitiesAsUser(@NonNull Intent intent,
4366 @ResolveInfoFlags int flags, @NonNull UserHandle user) {
4367 return queryIntentActivitiesAsUser(intent, flags, user.getIdentifier());
4368 }
4369
4370 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004371 * Retrieve a set of activities that should be presented to the user as
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004372 * similar options. This is like {@link #queryIntentActivities}, except it
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004373 * also allows you to supply a list of more explicit Intents that you would
4374 * like to resolve to particular options, and takes care of returning the
4375 * final ResolveInfo list in a reasonable order, with no duplicates, based
4376 * on those inputs.
4377 *
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004378 * @param caller The class name of the activity that is making the request.
4379 * This activity will never appear in the output list. Can be
4380 * null.
4381 * @param specifics An array of Intents that should be resolved to the first
4382 * specific results. Can be null.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004383 * @param intent The desired intent as per resolveActivity().
Jeff Sharkey4347f812017-04-21 12:08:39 -06004384 * @param flags Additional option flags to modify the data returned. The
4385 * most important is {@link #MATCH_DEFAULT_ONLY}, to limit the
4386 * resolution to only those activities that support the
4387 * {@link android.content.Intent#CATEGORY_DEFAULT}.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004388 * @return Returns a List of ResolveInfo objects containing one entry for
4389 * each matching activity. The list is ordered first by all of the
4390 * intents resolved in <var>specifics</var> and then any additional
4391 * activities that can handle <var>intent</var> but did not get
4392 * included by one of the <var>specifics</var> intents. If there are
4393 * no matching activities, an empty list is returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004394 */
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06004395 public abstract List<ResolveInfo> queryIntentActivityOptions(@Nullable ComponentName caller,
4396 @Nullable Intent[] specifics, Intent intent, @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004397
4398 /**
4399 * Retrieve all receivers that can handle a broadcast of the given intent.
4400 *
4401 * @param intent The desired intent as per resolveActivity().
Jeff Sharkey4347f812017-04-21 12:08:39 -06004402 * @param flags Additional option flags to modify the data returned.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004403 * @return Returns a List of ResolveInfo objects containing one entry for
4404 * each matching receiver, ordered from best to worst. If there are
4405 * no matching receivers, an empty list or null is returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004406 */
4407 public abstract List<ResolveInfo> queryBroadcastReceivers(Intent intent,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004408 @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004409
4410 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004411 * Retrieve all receivers that can handle a broadcast of the given intent,
4412 * for a specific user.
Amith Yamasanif203aee2012-08-29 18:41:53 -07004413 *
4414 * @param intent The desired intent as per resolveActivity().
Jeff Sharkey4347f812017-04-21 12:08:39 -06004415 * @param flags Additional option flags to modify the data returned.
Fyodor Kupolov940e8572016-01-26 12:03:51 -08004416 * @param userHandle UserHandle of the user being queried.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004417 * @return Returns a List of ResolveInfo objects containing one entry for
4418 * each matching receiver, ordered from best to worst. If there are
4419 * no matching receivers, an empty list or null is returned.
Amith Yamasanif203aee2012-08-29 18:41:53 -07004420 * @hide
4421 */
Fyodor Kupolov940e8572016-01-26 12:03:51 -08004422 @SystemApi
Todd Kennedydbaef6d2017-07-24 11:28:00 -07004423 @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS)
Fyodor Kupolov940e8572016-01-26 12:03:51 -08004424 public List<ResolveInfo> queryBroadcastReceiversAsUser(Intent intent,
4425 @ResolveInfoFlags int flags, UserHandle userHandle) {
4426 return queryBroadcastReceiversAsUser(intent, flags, userHandle.getIdentifier());
4427 }
4428
4429 /**
4430 * @hide
4431 */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01004432 @UnsupportedAppUsage
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07004433 public abstract List<ResolveInfo> queryBroadcastReceiversAsUser(Intent intent,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004434 @ResolveInfoFlags int flags, @UserIdInt int userId);
Amith Yamasanif203aee2012-08-29 18:41:53 -07004435
Fyodor Kupolov940e8572016-01-26 12:03:51 -08004436
Jeff Sharkeybd940222016-01-08 11:07:13 -07004437 /** {@hide} */
4438 @Deprecated
Mathew Inwood5c0d3542018-08-14 13:54:31 +01004439 @UnsupportedAppUsage
Jeff Sharkeybd940222016-01-08 11:07:13 -07004440 public List<ResolveInfo> queryBroadcastReceivers(Intent intent,
4441 @ResolveInfoFlags int flags, @UserIdInt int userId) {
Jeff Sharkey6f4b2a32017-03-21 14:13:41 -06004442 final String msg = "Shame on you for calling the hidden API "
4443 + "queryBroadcastReceivers(). Shame!";
4444 if (VMRuntime.getRuntime().getTargetSdkVersion() >= Build.VERSION_CODES.O) {
4445 throw new UnsupportedOperationException(msg);
4446 } else {
4447 Log.d(TAG, msg);
4448 return queryBroadcastReceiversAsUser(intent, flags, userId);
4449 }
Jeff Sharkeybd940222016-01-08 11:07:13 -07004450 }
4451
Amith Yamasanif203aee2012-08-29 18:41:53 -07004452 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004453 * Determine the best service to handle for a given Intent.
4454 *
4455 * @param intent An intent containing all of the desired specification
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004456 * (action, data, type, category, and/or component).
Jeff Sharkey4347f812017-04-21 12:08:39 -06004457 * @param flags Additional option flags to modify the data returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004458 * @return Returns a ResolveInfo object containing the final service intent
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004459 * that was determined to be the best action. Returns null if no
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004460 * matching service was found.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004461 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004462 public abstract ResolveInfo resolveService(Intent intent, @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004463
4464 /**
Philip P. Moltmann18e3eb82018-03-09 16:55:55 -08004465 * @hide
4466 */
4467 public abstract ResolveInfo resolveServiceAsUser(Intent intent, @ResolveInfoFlags int flags,
4468 @UserIdInt int userId);
4469
4470 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004471 * Retrieve all services that can match the given intent.
4472 *
4473 * @param intent The desired intent as per resolveService().
Jeff Sharkey4347f812017-04-21 12:08:39 -06004474 * @param flags Additional option flags to modify the data returned.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004475 * @return Returns a List of ResolveInfo objects containing one entry for
4476 * each matching service, ordered from best to worst. In other
4477 * words, the first item is what would be returned by
4478 * {@link #resolveService}. If there are no matching services, an
4479 * empty list or null is returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004480 */
4481 public abstract List<ResolveInfo> queryIntentServices(Intent intent,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004482 @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004483
4484 /**
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004485 * Retrieve all services that can match the given intent for a given user.
4486 *
4487 * @param intent The desired intent as per resolveService().
Jeff Sharkey4347f812017-04-21 12:08:39 -06004488 * @param flags Additional option flags to modify the data returned.
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004489 * @param userId The user id.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004490 * @return Returns a List of ResolveInfo objects containing one entry for
4491 * each matching service, ordered from best to worst. In other
4492 * words, the first item is what would be returned by
4493 * {@link #resolveService}. If there are no matching services, an
4494 * empty list or null is returned.
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004495 * @hide
4496 */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01004497 @UnsupportedAppUsage
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004498 public abstract List<ResolveInfo> queryIntentServicesAsUser(Intent intent,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004499 @ResolveInfoFlags int flags, @UserIdInt int userId);
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004500
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004501 /**
Hai Zhang8c7e93b2018-12-11 18:34:06 -08004502 * Retrieve all services that can match the given intent for a given user.
4503 *
4504 * @param intent The desired intent as per resolveService().
4505 * @param flags Additional option flags to modify the data returned.
4506 * @param user The user being queried.
4507 * @return Returns a List of ResolveInfo objects containing one entry for
4508 * each matching service, ordered from best to worst. In other
4509 * words, the first item is what would be returned by
4510 * {@link #resolveService}. If there are no matching services, an
4511 * empty list or null is returned.
4512 * @hide
4513 */
4514 @NonNull
4515 @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS)
4516 @SystemApi
4517 public List<ResolveInfo> queryIntentServicesAsUser(@NonNull Intent intent,
4518 @ResolveInfoFlags int flags, @NonNull UserHandle user) {
4519 return queryIntentServicesAsUser(intent, flags, user.getIdentifier());
4520 }
4521
4522 /**
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004523 * Retrieve all providers that can match the given intent.
4524 *
4525 * @param intent An intent containing all of the desired specification
4526 * (action, data, type, category, and/or component).
Jeff Sharkey4347f812017-04-21 12:08:39 -06004527 * @param flags Additional option flags to modify the data returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004528 * @param userId The user id.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004529 * @return Returns a List of ResolveInfo objects containing one entry for
4530 * each matching provider, ordered from best to worst. If there are
4531 * no matching services, an empty list or null is returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004532 * @hide
4533 */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01004534 @UnsupportedAppUsage
Jeff Sharkey85f5f812013-10-07 10:16:12 -07004535 public abstract List<ResolveInfo> queryIntentContentProvidersAsUser(
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004536 Intent intent, @ResolveInfoFlags int flags, @UserIdInt int userId);
Jeff Sharkey85f5f812013-10-07 10:16:12 -07004537
4538 /**
4539 * Retrieve all providers that can match the given intent.
4540 *
4541 * @param intent An intent containing all of the desired specification
4542 * (action, data, type, category, and/or component).
Jeff Sharkey4347f812017-04-21 12:08:39 -06004543 * @param flags Additional option flags to modify the data returned.
Hai Zhang8c7e93b2018-12-11 18:34:06 -08004544 * @param user The user being queried.
4545 * @return Returns a List of ResolveInfo objects containing one entry for
4546 * each matching provider, ordered from best to worst. If there are
4547 * no matching services, an empty list or null is returned.
4548 * @hide
4549 */
4550 @NonNull
4551 @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS)
4552 @SystemApi
4553 public List<ResolveInfo> queryIntentContentProvidersAsUser(@NonNull Intent intent,
4554 @ResolveInfoFlags int flags, @NonNull UserHandle user) {
4555 return queryIntentContentProvidersAsUser(intent, flags, user.getIdentifier());
4556 }
4557
4558 /**
4559 * Retrieve all providers that can match the given intent.
4560 *
4561 * @param intent An intent containing all of the desired specification
4562 * (action, data, type, category, and/or component).
4563 * @param flags Additional option flags to modify the data returned.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004564 * @return Returns a List of ResolveInfo objects containing one entry for
4565 * each matching provider, ordered from best to worst. If there are
4566 * no matching services, an empty list or null is returned.
Jeff Sharkey85f5f812013-10-07 10:16:12 -07004567 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004568 public abstract List<ResolveInfo> queryIntentContentProviders(Intent intent,
4569 @ResolveInfoFlags int flags);
Jeff Sharkey85f5f812013-10-07 10:16:12 -07004570
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004571 /**
Todd Kennedy5fdbabb2018-03-07 15:59:41 -08004572 * Find a single content provider by its authority.
4573 * <p>
4574 * Example:<p>
4575 * <pre>
4576 * Uri uri = Uri.parse("content://com.example.app.provider/table1");
4577 * ProviderInfo info = packageManager.resolveContentProvider(uri.getAuthority(), flags);
4578 * </pre>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004579 *
Todd Kennedy5fdbabb2018-03-07 15:59:41 -08004580 * @param authority The authority of the provider to find.
Jeff Sharkey4347f812017-04-21 12:08:39 -06004581 * @param flags Additional option flags to modify the data returned.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004582 * @return A {@link ProviderInfo} object containing information about the
4583 * provider. If a provider was not found, returns null.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004584 */
Todd Kennedy5fdbabb2018-03-07 15:59:41 -08004585 public abstract ProviderInfo resolveContentProvider(String authority,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004586 @ComponentInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004587
4588 /**
Alexandra Gherghina0363c3e2014-06-23 13:34:59 +01004589 * Find a single content provider by its base path name.
4590 *
4591 * @param name The name of the provider to find.
Jeff Sharkey4347f812017-04-21 12:08:39 -06004592 * @param flags Additional option flags to modify the data returned.
Alexandra Gherghina0363c3e2014-06-23 13:34:59 +01004593 * @param userId The user id.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004594 * @return A {@link ProviderInfo} object containing information about the
4595 * provider. If a provider was not found, returns null.
Alexandra Gherghina0363c3e2014-06-23 13:34:59 +01004596 * @hide
4597 */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01004598 @UnsupportedAppUsage
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004599 public abstract ProviderInfo resolveContentProviderAsUser(String name,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004600 @ComponentInfoFlags int flags, @UserIdInt int userId);
Alexandra Gherghina0363c3e2014-06-23 13:34:59 +01004601
4602 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004603 * Retrieve content provider information.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004604 * <p>
4605 * <em>Note: unlike most other methods, an empty result set is indicated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004606 * by a null return instead of an empty list.</em>
4607 *
4608 * @param processName If non-null, limits the returned providers to only
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004609 * those that are hosted by the given process. If null, all
4610 * content providers are returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004611 * @param uid If <var>processName</var> is non-null, this is the required
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004612 * uid owning the requested content providers.
Jeff Sharkey4347f812017-04-21 12:08:39 -06004613 * @param flags Additional option flags to modify the data returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004614 * @return A list of {@link ProviderInfo} objects containing one entry for
4615 * each provider either matching <var>processName</var> or, if
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004616 * <var>processName</var> is null, all known content providers.
4617 * <em>If there are no matching providers, null is returned.</em>
4618 */
4619 public abstract List<ProviderInfo> queryContentProviders(
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004620 String processName, int uid, @ComponentInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004621
4622 /**
Makoto Onuki32757292017-02-22 14:36:59 -08004623 * Same as {@link #queryContentProviders}, except when {@code metaDataKey} is not null,
4624 * it only returns providers which have metadata with the {@code metaDataKey} key.
4625 *
4626 * <p>DO NOT USE the {@code metaDataKey} parameter, unless you're the contacts provider.
4627 * You really shouldn't need it. Other apps should use {@link #queryIntentContentProviders}
4628 * instead.
4629 *
4630 * <p>The {@code metaDataKey} parameter was added to allow the contacts provider to quickly
4631 * scan the GAL providers on the device. Unfortunately the discovery protocol used metadata
4632 * to mark GAL providers, rather than intent filters, so we can't use
4633 * {@link #queryIntentContentProviders} for that.
4634 *
4635 * @hide
4636 */
4637 public List<ProviderInfo> queryContentProviders(
4638 String processName, int uid, @ComponentInfoFlags int flags, String metaDataKey) {
4639 // Provide the default implementation for mocks.
4640 return queryContentProviders(processName, uid, flags);
4641 }
4642
4643 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004644 * Retrieve all of the information we know about a particular
4645 * instrumentation class.
4646 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004647 * @param className The full name (i.e.
Jeff Sharkey4347f812017-04-21 12:08:39 -06004648 * com.google.apps.contacts.InstrumentList) of an Instrumentation
4649 * class.
4650 * @param flags Additional option flags to modify the data returned.
4651 * @return An {@link InstrumentationInfo} object containing information
4652 * about the instrumentation.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004653 * @throws NameNotFoundException if a package with the given name cannot be
4654 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004655 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004656 public abstract InstrumentationInfo getInstrumentationInfo(ComponentName className,
4657 @InstrumentationInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004658
4659 /**
Jeff Sharkey4347f812017-04-21 12:08:39 -06004660 * Retrieve information about available instrumentation code. May be used to
4661 * retrieve either all instrumentation code, or only the code targeting a
4662 * particular package.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004663 *
4664 * @param targetPackage If null, all instrumentation is returned; only the
Jeff Sharkey4347f812017-04-21 12:08:39 -06004665 * instrumentation targeting this package name is returned.
4666 * @param flags Additional option flags to modify the data returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004667 * @return A list of {@link InstrumentationInfo} objects containing one
4668 * entry for each matching instrumentation. If there are no
Jesse Hallf77a34f2016-02-04 18:41:33 -08004669 * instrumentation available, returns an empty list.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004670 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004671 public abstract List<InstrumentationInfo> queryInstrumentation(String targetPackage,
4672 @InstrumentationInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004673
4674 /**
4675 * Retrieve an image from a package. This is a low-level API used by
4676 * the various package manager info structures (such as
4677 * {@link ComponentInfo} to implement retrieval of their associated
4678 * icon.
4679 *
4680 * @param packageName The name of the package that this icon is coming from.
kmccormick30498b42013-03-27 17:39:17 -07004681 * Cannot be null.
4682 * @param resid The resource identifier of the desired image. Cannot be 0.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004683 * @param appInfo Overall information about <var>packageName</var>. This
4684 * may be null, in which case the application information will be retrieved
4685 * for you if needed; if you already have this information around, it can
4686 * be much more efficient to supply it here.
4687 *
4688 * @return Returns a Drawable holding the requested image. Returns null if
4689 * an image could not be found for any reason.
4690 */
Tor Norbye7b9c9122013-05-30 16:48:33 -07004691 public abstract Drawable getDrawable(String packageName, @DrawableRes int resid,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004692 ApplicationInfo appInfo);
4693
4694 /**
4695 * Retrieve the icon associated with an activity. Given the full name of
4696 * an activity, retrieves the information about it and calls
4697 * {@link ComponentInfo#loadIcon ComponentInfo.loadIcon()} to return its icon.
kmccormick30498b42013-03-27 17:39:17 -07004698 * If the activity cannot be found, NameNotFoundException is thrown.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004699 *
4700 * @param activityName Name of the activity whose icon is to be retrieved.
4701 *
4702 * @return Returns the image of the icon, or the default activity icon if
4703 * it could not be found. Does not return null.
4704 * @throws NameNotFoundException Thrown if the resources for the given
4705 * activity could not be loaded.
4706 *
4707 * @see #getActivityIcon(Intent)
4708 */
4709 public abstract Drawable getActivityIcon(ComponentName activityName)
4710 throws NameNotFoundException;
4711
4712 /**
4713 * Retrieve the icon associated with an Intent. If intent.getClassName() is
4714 * set, this simply returns the result of
4715 * getActivityIcon(intent.getClassName()). Otherwise it resolves the intent's
4716 * component and returns the icon associated with the resolved component.
kmccormick30498b42013-03-27 17:39:17 -07004717 * If intent.getClassName() cannot be found or the Intent cannot be resolved
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004718 * to a component, NameNotFoundException is thrown.
4719 *
4720 * @param intent The intent for which you would like to retrieve an icon.
4721 *
4722 * @return Returns the image of the icon, or the default activity icon if
4723 * it could not be found. Does not return null.
4724 * @throws NameNotFoundException Thrown if the resources for application
4725 * matching the given intent could not be loaded.
4726 *
4727 * @see #getActivityIcon(ComponentName)
4728 */
4729 public abstract Drawable getActivityIcon(Intent intent)
4730 throws NameNotFoundException;
4731
4732 /**
Jose Limaf78e3122014-03-06 12:13:15 -08004733 * Retrieve the banner associated with an activity. Given the full name of
4734 * an activity, retrieves the information about it and calls
4735 * {@link ComponentInfo#loadIcon ComponentInfo.loadIcon()} to return its
4736 * banner. If the activity cannot be found, NameNotFoundException is thrown.
4737 *
4738 * @param activityName Name of the activity whose banner is to be retrieved.
4739 * @return Returns the image of the banner, or null if the activity has no
4740 * banner specified.
4741 * @throws NameNotFoundException Thrown if the resources for the given
4742 * activity could not be loaded.
4743 * @see #getActivityBanner(Intent)
4744 */
4745 public abstract Drawable getActivityBanner(ComponentName activityName)
4746 throws NameNotFoundException;
4747
4748 /**
4749 * Retrieve the banner associated with an Intent. If intent.getClassName()
4750 * is set, this simply returns the result of
4751 * getActivityBanner(intent.getClassName()). Otherwise it resolves the
4752 * intent's component and returns the banner associated with the resolved
4753 * component. If intent.getClassName() cannot be found or the Intent cannot
4754 * be resolved to a component, NameNotFoundException is thrown.
4755 *
4756 * @param intent The intent for which you would like to retrieve a banner.
4757 * @return Returns the image of the banner, or null if the activity has no
4758 * banner specified.
4759 * @throws NameNotFoundException Thrown if the resources for application
4760 * matching the given intent could not be loaded.
4761 * @see #getActivityBanner(ComponentName)
4762 */
4763 public abstract Drawable getActivityBanner(Intent intent)
4764 throws NameNotFoundException;
4765
4766 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004767 * Return the generic icon for an activity that is used when no specific
4768 * icon is defined.
Adam Connors23cc04e2014-04-01 12:12:20 +01004769 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004770 * @return Drawable Image of the icon.
4771 */
4772 public abstract Drawable getDefaultActivityIcon();
4773
4774 /**
4775 * Retrieve the icon associated with an application. If it has not defined
4776 * an icon, the default app icon is returned. Does not return null.
4777 *
4778 * @param info Information about application being queried.
4779 *
4780 * @return Returns the image of the icon, or the default application icon
4781 * if it could not be found.
4782 *
4783 * @see #getApplicationIcon(String)
4784 */
4785 public abstract Drawable getApplicationIcon(ApplicationInfo info);
4786
4787 /**
4788 * Retrieve the icon associated with an application. Given the name of the
4789 * application's package, retrieves the information about it and calls
kmccormick30498b42013-03-27 17:39:17 -07004790 * getApplicationIcon() to return its icon. If the application cannot be
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004791 * found, NameNotFoundException is thrown.
4792 *
4793 * @param packageName Name of the package whose application icon is to be
4794 * retrieved.
4795 *
4796 * @return Returns the image of the icon, or the default application icon
4797 * if it could not be found. Does not return null.
4798 * @throws NameNotFoundException Thrown if the resources for the given
4799 * application could not be loaded.
4800 *
4801 * @see #getApplicationIcon(ApplicationInfo)
4802 */
4803 public abstract Drawable getApplicationIcon(String packageName)
4804 throws NameNotFoundException;
4805
4806 /**
Jose Limaf78e3122014-03-06 12:13:15 -08004807 * Retrieve the banner associated with an application.
4808 *
4809 * @param info Information about application being queried.
4810 * @return Returns the image of the banner or null if the application has no
4811 * banner specified.
4812 * @see #getApplicationBanner(String)
4813 */
4814 public abstract Drawable getApplicationBanner(ApplicationInfo info);
4815
4816 /**
4817 * Retrieve the banner associated with an application. Given the name of the
4818 * application's package, retrieves the information about it and calls
4819 * getApplicationIcon() to return its banner. If the application cannot be
4820 * found, NameNotFoundException is thrown.
4821 *
4822 * @param packageName Name of the package whose application banner is to be
4823 * retrieved.
4824 * @return Returns the image of the banner or null if the application has no
4825 * banner specified.
4826 * @throws NameNotFoundException Thrown if the resources for the given
4827 * application could not be loaded.
4828 * @see #getApplicationBanner(ApplicationInfo)
4829 */
4830 public abstract Drawable getApplicationBanner(String packageName)
4831 throws NameNotFoundException;
4832
4833 /**
4834 * Retrieve the logo associated with an activity. Given the full name of an
4835 * activity, retrieves the information about it and calls
4836 * {@link ComponentInfo#loadLogo ComponentInfo.loadLogo()} to return its
4837 * logo. If the activity cannot be found, NameNotFoundException is thrown.
Adam Powell81cd2e92010-04-21 16:35:18 -07004838 *
4839 * @param activityName Name of the activity whose logo is to be retrieved.
Jose Limaf78e3122014-03-06 12:13:15 -08004840 * @return Returns the image of the logo or null if the activity has no logo
4841 * specified.
Adam Powell81cd2e92010-04-21 16:35:18 -07004842 * @throws NameNotFoundException Thrown if the resources for the given
Jose Limaf78e3122014-03-06 12:13:15 -08004843 * activity could not be loaded.
Adam Powell81cd2e92010-04-21 16:35:18 -07004844 * @see #getActivityLogo(Intent)
4845 */
4846 public abstract Drawable getActivityLogo(ComponentName activityName)
4847 throws NameNotFoundException;
4848
4849 /**
4850 * Retrieve the logo associated with an Intent. If intent.getClassName() is
4851 * set, this simply returns the result of
4852 * getActivityLogo(intent.getClassName()). Otherwise it resolves the intent's
4853 * component and returns the logo associated with the resolved component.
kmccormick30498b42013-03-27 17:39:17 -07004854 * If intent.getClassName() cannot be found or the Intent cannot be resolved
Adam Powell81cd2e92010-04-21 16:35:18 -07004855 * to a component, NameNotFoundException is thrown.
4856 *
4857 * @param intent The intent for which you would like to retrieve a logo.
4858 *
4859 * @return Returns the image of the logo, or null if the activity has no
4860 * logo specified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004861 *
Adam Powell81cd2e92010-04-21 16:35:18 -07004862 * @throws NameNotFoundException Thrown if the resources for application
4863 * matching the given intent could not be loaded.
4864 *
4865 * @see #getActivityLogo(ComponentName)
4866 */
4867 public abstract Drawable getActivityLogo(Intent intent)
4868 throws NameNotFoundException;
4869
4870 /**
4871 * Retrieve the logo associated with an application. If it has not specified
4872 * a logo, this method returns null.
4873 *
4874 * @param info Information about application being queried.
4875 *
4876 * @return Returns the image of the logo, or null if no logo is specified
4877 * by the application.
4878 *
4879 * @see #getApplicationLogo(String)
4880 */
4881 public abstract Drawable getApplicationLogo(ApplicationInfo info);
4882
4883 /**
4884 * Retrieve the logo associated with an application. Given the name of the
4885 * application's package, retrieves the information about it and calls
kmccormick30498b42013-03-27 17:39:17 -07004886 * getApplicationLogo() to return its logo. If the application cannot be
Adam Powell81cd2e92010-04-21 16:35:18 -07004887 * found, NameNotFoundException is thrown.
4888 *
4889 * @param packageName Name of the package whose application logo is to be
4890 * retrieved.
4891 *
4892 * @return Returns the image of the logo, or null if no application logo
4893 * has been specified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004894 *
Adam Powell81cd2e92010-04-21 16:35:18 -07004895 * @throws NameNotFoundException Thrown if the resources for the given
4896 * application could not be loaded.
4897 *
4898 * @see #getApplicationLogo(ApplicationInfo)
4899 */
4900 public abstract Drawable getApplicationLogo(String packageName)
4901 throws NameNotFoundException;
4902
4903 /**
Tony Mak4dc008c2016-03-16 10:46:49 +00004904 * If the target user is a managed profile, then this returns a badged copy of the given icon
4905 * to be able to distinguish it from the original icon. For badging an arbitrary drawable use
Kenny Guydf77d712015-05-29 17:02:22 +01004906 * {@link #getUserBadgedDrawableForDensity(
Svetoslavc7d62f02014-09-04 15:39:54 -07004907 * android.graphics.drawable.Drawable, UserHandle, android.graphics.Rect, int)}.
4908 * <p>
4909 * If the original drawable is a BitmapDrawable and the backing bitmap is
4910 * mutable as per {@link android.graphics.Bitmap#isMutable()}, the badging
4911 * is performed in place and the original drawable is returned.
4912 * </p>
4913 *
4914 * @param icon The icon to badge.
4915 * @param user The target user.
4916 * @return A drawable that combines the original icon and a badge as
4917 * determined by the system.
4918 */
4919 public abstract Drawable getUserBadgedIcon(Drawable icon, UserHandle user);
4920
4921 /**
4922 * If the target user is a managed profile of the calling user or the caller
4923 * is itself a managed profile, then this returns a badged copy of the given
4924 * drawable allowing the user to distinguish it from the original drawable.
4925 * The caller can specify the location in the bounds of the drawable to be
4926 * badged where the badge should be applied as well as the density of the
4927 * badge to be used.
4928 * <p>
4929 * If the original drawable is a BitmapDrawable and the backing bitmap is
Vadim Tryshev66ae66a2016-02-18 15:41:21 -08004930 * mutable as per {@link android.graphics.Bitmap#isMutable()}, the badging
Svetoslavc7d62f02014-09-04 15:39:54 -07004931 * is performed in place and the original drawable is returned.
4932 * </p>
4933 *
4934 * @param drawable The drawable to badge.
4935 * @param user The target user.
4936 * @param badgeLocation Where in the bounds of the badged drawable to place
Vadim Tryshev66ae66a2016-02-18 15:41:21 -08004937 * the badge. If it's {@code null}, the badge is applied on top of the entire
Svetoslavc7d62f02014-09-04 15:39:54 -07004938 * drawable being badged.
4939 * @param badgeDensity The optional desired density for the badge as per
Vadim Tryshev66ae66a2016-02-18 15:41:21 -08004940 * {@link android.util.DisplayMetrics#densityDpi}. If it's not positive,
Svetoslavc7d62f02014-09-04 15:39:54 -07004941 * the density of the display is used.
4942 * @return A drawable that combines the original drawable and a badge as
4943 * determined by the system.
4944 */
4945 public abstract Drawable getUserBadgedDrawableForDensity(Drawable drawable,
4946 UserHandle user, Rect badgeLocation, int badgeDensity);
4947
4948 /**
4949 * If the target user is a managed profile of the calling user or the caller
4950 * is itself a managed profile, then this returns a drawable to use as a small
4951 * icon to include in a view to distinguish it from the original icon.
4952 *
4953 * @param user The target user.
4954 * @param density The optional desired density for the badge as per
4955 * {@link android.util.DisplayMetrics#densityDpi}. If not provided
4956 * the density of the current display is used.
4957 * @return the drawable or null if no drawable is required.
4958 * @hide
4959 */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01004960 @UnsupportedAppUsage
Svetoslavc7d62f02014-09-04 15:39:54 -07004961 public abstract Drawable getUserBadgeForDensity(UserHandle user, int density);
4962
4963 /**
4964 * If the target user is a managed profile of the calling user or the caller
Selim Cineke6ff9462016-01-15 15:07:06 -08004965 * is itself a managed profile, then this returns a drawable to use as a small
4966 * icon to include in a view to distinguish it from the original icon. This version
4967 * doesn't have background protection and should be used over a light background instead of
4968 * a badge.
4969 *
4970 * @param user The target user.
4971 * @param density The optional desired density for the badge as per
4972 * {@link android.util.DisplayMetrics#densityDpi}. If not provided
4973 * the density of the current display is used.
4974 * @return the drawable or null if no drawable is required.
4975 * @hide
4976 */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01004977 @UnsupportedAppUsage
Selim Cineke6ff9462016-01-15 15:07:06 -08004978 public abstract Drawable getUserBadgeForDensityNoBackground(UserHandle user, int density);
4979
4980 /**
4981 * If the target user is a managed profile of the calling user or the caller
Svetoslavc7d62f02014-09-04 15:39:54 -07004982 * is itself a managed profile, then this returns a copy of the label with
4983 * badging for accessibility services like talkback. E.g. passing in "Email"
4984 * and it might return "Work Email" for Email in the work profile.
4985 *
4986 * @param label The label to change.
4987 * @param user The target user.
4988 * @return A label that combines the original label and a badge as
4989 * determined by the system.
4990 */
4991 public abstract CharSequence getUserBadgedLabel(CharSequence label, UserHandle user);
4992
4993 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004994 * Retrieve text from a package. This is a low-level API used by
4995 * the various package manager info structures (such as
4996 * {@link ComponentInfo} to implement retrieval of their associated
4997 * labels and other text.
4998 *
4999 * @param packageName The name of the package that this text is coming from.
kmccormick30498b42013-03-27 17:39:17 -07005000 * Cannot be null.
5001 * @param resid The resource identifier of the desired text. Cannot be 0.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005002 * @param appInfo Overall information about <var>packageName</var>. This
5003 * may be null, in which case the application information will be retrieved
5004 * for you if needed; if you already have this information around, it can
5005 * be much more efficient to supply it here.
5006 *
5007 * @return Returns a CharSequence holding the requested text. Returns null
5008 * if the text could not be found for any reason.
5009 */
Tor Norbye7b9c9122013-05-30 16:48:33 -07005010 public abstract CharSequence getText(String packageName, @StringRes int resid,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005011 ApplicationInfo appInfo);
5012
5013 /**
5014 * Retrieve an XML file from a package. This is a low-level API used to
5015 * retrieve XML meta data.
5016 *
5017 * @param packageName The name of the package that this xml is coming from.
kmccormick30498b42013-03-27 17:39:17 -07005018 * Cannot be null.
5019 * @param resid The resource identifier of the desired xml. Cannot be 0.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005020 * @param appInfo Overall information about <var>packageName</var>. This
5021 * may be null, in which case the application information will be retrieved
5022 * for you if needed; if you already have this information around, it can
5023 * be much more efficient to supply it here.
5024 *
5025 * @return Returns an XmlPullParser allowing you to parse out the XML
5026 * data. Returns null if the xml resource could not be found for any
5027 * reason.
5028 */
Tor Norbye7b9c9122013-05-30 16:48:33 -07005029 public abstract XmlResourceParser getXml(String packageName, @XmlRes int resid,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005030 ApplicationInfo appInfo);
5031
5032 /**
5033 * Return the label to use for this application.
5034 *
5035 * @return Returns the label associated with this application, or null if
5036 * it could not be found for any reason.
kmccormick30498b42013-03-27 17:39:17 -07005037 * @param info The application to get the label of.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005038 */
5039 public abstract CharSequence getApplicationLabel(ApplicationInfo info);
5040
5041 /**
5042 * Retrieve the resources associated with an activity. Given the full
5043 * name of an activity, retrieves the information about it and calls
5044 * getResources() to return its application's resources. If the activity
kmccormick30498b42013-03-27 17:39:17 -07005045 * cannot be found, NameNotFoundException is thrown.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005046 *
5047 * @param activityName Name of the activity whose resources are to be
5048 * retrieved.
5049 *
5050 * @return Returns the application's Resources.
5051 * @throws NameNotFoundException Thrown if the resources for the given
5052 * application could not be loaded.
5053 *
5054 * @see #getResourcesForApplication(ApplicationInfo)
5055 */
5056 public abstract Resources getResourcesForActivity(ComponentName activityName)
5057 throws NameNotFoundException;
5058
5059 /**
5060 * Retrieve the resources for an application. Throws NameNotFoundException
5061 * if the package is no longer installed.
5062 *
5063 * @param app Information about the desired application.
5064 *
5065 * @return Returns the application's Resources.
5066 * @throws NameNotFoundException Thrown if the resources for the given
5067 * application could not be loaded (most likely because it was uninstalled).
5068 */
5069 public abstract Resources getResourcesForApplication(ApplicationInfo app)
5070 throws NameNotFoundException;
5071
5072 /**
5073 * Retrieve the resources associated with an application. Given the full
5074 * package name of an application, retrieves the information about it and
5075 * calls getResources() to return its application's resources. If the
kmccormick30498b42013-03-27 17:39:17 -07005076 * appPackageName cannot be found, NameNotFoundException is thrown.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005077 *
5078 * @param appPackageName Package name of the application whose resources
5079 * are to be retrieved.
5080 *
5081 * @return Returns the application's Resources.
5082 * @throws NameNotFoundException Thrown if the resources for the given
5083 * application could not be loaded.
5084 *
5085 * @see #getResourcesForApplication(ApplicationInfo)
5086 */
5087 public abstract Resources getResourcesForApplication(String appPackageName)
5088 throws NameNotFoundException;
5089
Amith Yamasani98edc952012-09-25 14:09:27 -07005090 /** @hide */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01005091 @UnsupportedAppUsage
Jeff Sharkey8588bc12016-01-06 16:47:42 -07005092 public abstract Resources getResourcesForApplicationAsUser(String appPackageName,
5093 @UserIdInt int userId) throws NameNotFoundException;
Amith Yamasani98edc952012-09-25 14:09:27 -07005094
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005095 /**
Jeff Sharkey4347f812017-04-21 12:08:39 -06005096 * Retrieve overall information about an application package defined in a
5097 * package archive file
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005098 *
5099 * @param archiveFilePath The path to the archive file
Jeff Sharkey4347f812017-04-21 12:08:39 -06005100 * @param flags Additional option flags to modify the data returned.
5101 * @return A PackageInfo object containing information about the package
5102 * archive. If the package could not be parsed, returns null.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005103 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07005104 public PackageInfo getPackageArchiveInfo(String archiveFilePath, @PackageInfoFlags int flags) {
Jeff Sharkey275e0852014-06-17 18:18:49 -07005105 final PackageParser parser = new PackageParser();
Dianne Hackborncd154e92017-02-28 17:37:35 -08005106 parser.setCallback(new PackageParser.CallbackImpl(this));
Jeff Sharkey275e0852014-06-17 18:18:49 -07005107 final File apkFile = new File(archiveFilePath);
Jeff Sharkeyc4858a22014-06-16 10:51:20 -07005108 try {
Jeff Sharkey8a372a02016-03-16 16:25:45 -06005109 if ((flags & (MATCH_DIRECT_BOOT_UNAWARE | MATCH_DIRECT_BOOT_AWARE)) != 0) {
Jeff Sharkeyc3132512016-01-12 14:06:58 -07005110 // Caller expressed an explicit opinion about what encryption
5111 // aware/unaware components they want to see, so fall through and
5112 // give them what they want
5113 } else {
5114 // Caller expressed no opinion, so match everything
Jeff Sharkey8a372a02016-03-16 16:25:45 -06005115 flags |= MATCH_DIRECT_BOOT_AWARE | MATCH_DIRECT_BOOT_UNAWARE;
Jeff Sharkeyc3132512016-01-12 14:06:58 -07005116 }
5117
Jeff Sharkey275e0852014-06-17 18:18:49 -07005118 PackageParser.Package pkg = parser.parseMonolithicPackage(apkFile, 0);
Jeff Sharkeyc4858a22014-06-16 10:51:20 -07005119 if ((flags & GET_SIGNATURES) != 0) {
Victor Hsieh5f761242018-01-20 10:30:12 -08005120 PackageParser.collectCertificates(pkg, false /* skipVerify */);
Jeff Sharkeyc4858a22014-06-16 10:51:20 -07005121 }
5122 PackageUserState state = new PackageUserState();
5123 return PackageParser.generatePackageInfo(pkg, null, flags, 0, 0, null, state);
5124 } catch (PackageParserException e) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005125 return null;
5126 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005127 }
5128
5129 /**
Dianne Hackborn7767eac2012-08-23 18:25:40 -07005130 * If there is already an application with the given package name installed
5131 * on the system for other users, also install it for the calling user.
5132 * @hide
Chandan Nathe8e463b2019-01-28 15:23:38 +00005133 *
5134 * @deprecated use {@link PackageInstaller#installExistingPackage()} instead.
Dianne Hackborn7767eac2012-08-23 18:25:40 -07005135 */
Chandan Nathe8e463b2019-01-28 15:23:38 +00005136 @Deprecated
Sunny Goyal07f41fb2017-08-09 02:56:34 -07005137 @SystemApi
Nicolas Prevot9a80e532015-09-23 15:49:28 +01005138 public abstract int installExistingPackage(String packageName) throws NameNotFoundException;
5139
5140 /**
5141 * If there is already an application with the given package name installed
Sunny Goyala31a74b2017-05-11 15:59:19 -07005142 * on the system for other users, also install it for the calling user.
5143 * @hide
Chandan Nathe8e463b2019-01-28 15:23:38 +00005144 *
5145 * @deprecated use {@link PackageInstaller#installExistingPackage()} instead.
Sunny Goyala31a74b2017-05-11 15:59:19 -07005146 */
Chandan Nathe8e463b2019-01-28 15:23:38 +00005147 @Deprecated
Sunny Goyal07f41fb2017-08-09 02:56:34 -07005148 @SystemApi
Sunny Goyala31a74b2017-05-11 15:59:19 -07005149 public abstract int installExistingPackage(String packageName, @InstallReason int installReason)
5150 throws NameNotFoundException;
5151
5152 /**
5153 * If there is already an application with the given package name installed
Nicolas Prevot9a80e532015-09-23 15:49:28 +01005154 * on the system for other users, also install it for the specified user.
5155 * @hide
Chandan Nathe8e463b2019-01-28 15:23:38 +00005156 *
5157 * @deprecated use {@link PackageInstaller#installExistingPackage()} instead.
Nicolas Prevot9a80e532015-09-23 15:49:28 +01005158 */
Chandan Nathe8e463b2019-01-28 15:23:38 +00005159 @Deprecated
Rhed Jaocd47c262018-06-13 11:16:16 +08005160 @RequiresPermission(anyOf = {
5161 Manifest.permission.INSTALL_EXISTING_PACKAGES,
Nicolas Prevot9a80e532015-09-23 15:49:28 +01005162 Manifest.permission.INSTALL_PACKAGES,
5163 Manifest.permission.INTERACT_ACROSS_USERS_FULL})
Mathew Inwood5c0d3542018-08-14 13:54:31 +01005164 @UnsupportedAppUsage
Jeff Sharkey8588bc12016-01-06 16:47:42 -07005165 public abstract int installExistingPackageAsUser(String packageName, @UserIdInt int userId)
Dianne Hackborn7767eac2012-08-23 18:25:40 -07005166 throws NameNotFoundException;
5167
5168 /**
Kenny Root5ab21572011-07-27 11:11:19 -07005169 * Allows a package listening to the
5170 * {@link Intent#ACTION_PACKAGE_NEEDS_VERIFICATION package verification
Kenny Root3a9b5fb2011-09-20 14:15:38 -07005171 * broadcast} to respond to the package manager. The response must include
5172 * the {@code verificationCode} which is one of
5173 * {@link PackageManager#VERIFICATION_ALLOW} or
5174 * {@link PackageManager#VERIFICATION_REJECT}.
Kenny Root5ab21572011-07-27 11:11:19 -07005175 *
5176 * @param id pending package identifier as passed via the
kmccormick30498b42013-03-27 17:39:17 -07005177 * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra.
Kenny Root3a9b5fb2011-09-20 14:15:38 -07005178 * @param verificationCode either {@link PackageManager#VERIFICATION_ALLOW}
5179 * or {@link PackageManager#VERIFICATION_REJECT}.
rich cannings7e671512012-08-27 14:44:16 -07005180 * @throws SecurityException if the caller does not have the
Dianne Hackborn8832c182012-09-17 17:20:24 -07005181 * PACKAGE_VERIFICATION_AGENT permission.
Kenny Root5ab21572011-07-27 11:11:19 -07005182 */
Kenny Root3a9b5fb2011-09-20 14:15:38 -07005183 public abstract void verifyPendingInstall(int id, int verificationCode);
Kenny Root5ab21572011-07-27 11:11:19 -07005184
5185 /**
rich canningsd9ef3e52012-08-22 14:28:05 -07005186 * Allows a package listening to the
5187 * {@link Intent#ACTION_PACKAGE_NEEDS_VERIFICATION package verification
5188 * broadcast} to extend the default timeout for a response and declare what
5189 * action to perform after the timeout occurs. The response must include
5190 * the {@code verificationCodeAtTimeout} which is one of
5191 * {@link PackageManager#VERIFICATION_ALLOW} or
5192 * {@link PackageManager#VERIFICATION_REJECT}.
5193 *
5194 * This method may only be called once per package id. Additional calls
5195 * will have no effect.
5196 *
5197 * @param id pending package identifier as passed via the
kmccormick30498b42013-03-27 17:39:17 -07005198 * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra.
rich canningsd9ef3e52012-08-22 14:28:05 -07005199 * @param verificationCodeAtTimeout either
5200 * {@link PackageManager#VERIFICATION_ALLOW} or
rich canningsd1b5cfc2012-08-29 14:49:51 -07005201 * {@link PackageManager#VERIFICATION_REJECT}. If
5202 * {@code verificationCodeAtTimeout} is neither
5203 * {@link PackageManager#VERIFICATION_ALLOW} or
5204 * {@link PackageManager#VERIFICATION_REJECT}, then
5205 * {@code verificationCodeAtTimeout} will default to
rich canningsd9ef3e52012-08-22 14:28:05 -07005206 * {@link PackageManager#VERIFICATION_REJECT}.
5207 * @param millisecondsToDelay the amount of time requested for the timeout.
5208 * Must be positive and less than
rich canningsd1b5cfc2012-08-29 14:49:51 -07005209 * {@link PackageManager#MAXIMUM_VERIFICATION_TIMEOUT}. If
5210 * {@code millisecondsToDelay} is out of bounds,
5211 * {@code millisecondsToDelay} will be set to the closest in
5212 * bounds value; namely, 0 or
rich canningsd9ef3e52012-08-22 14:28:05 -07005213 * {@link PackageManager#MAXIMUM_VERIFICATION_TIMEOUT}.
rich cannings7e671512012-08-27 14:44:16 -07005214 * @throws SecurityException if the caller does not have the
Dianne Hackborn8832c182012-09-17 17:20:24 -07005215 * PACKAGE_VERIFICATION_AGENT permission.
rich canningsd9ef3e52012-08-22 14:28:05 -07005216 */
5217 public abstract void extendVerificationTimeout(int id,
5218 int verificationCodeAtTimeout, long millisecondsToDelay);
5219
5220 /**
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08005221 * Allows a package listening to the
Todd Kennedydfa93ab2016-03-03 15:24:33 -08005222 * {@link Intent#ACTION_INTENT_FILTER_NEEDS_VERIFICATION} intent filter verification
5223 * broadcast to respond to the package manager. The response must include
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08005224 * the {@code verificationCode} which is one of
5225 * {@link PackageManager#INTENT_FILTER_VERIFICATION_SUCCESS} or
5226 * {@link PackageManager#INTENT_FILTER_VERIFICATION_FAILURE}.
5227 *
5228 * @param verificationId pending package identifier as passed via the
5229 * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra.
5230 * @param verificationCode either {@link PackageManager#INTENT_FILTER_VERIFICATION_SUCCESS}
5231 * or {@link PackageManager#INTENT_FILTER_VERIFICATION_FAILURE}.
Todd Kennedydfa93ab2016-03-03 15:24:33 -08005232 * @param failedDomains a list of failed domains if the verificationCode is
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08005233 * {@link PackageManager#INTENT_FILTER_VERIFICATION_FAILURE}, otherwise null;
5234 * @throws SecurityException if the caller does not have the
5235 * INTENT_FILTER_VERIFICATION_AGENT permission.
5236 *
5237 * @hide
5238 */
Fabrice Di Meglioef741da2015-05-12 16:31:38 -07005239 @SystemApi
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06005240 @RequiresPermission(android.Manifest.permission.INTENT_FILTER_VERIFICATION_AGENT)
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08005241 public abstract void verifyIntentFilter(int verificationId, int verificationCode,
Todd Kennedydfa93ab2016-03-03 15:24:33 -08005242 List<String> failedDomains);
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08005243
5244 /**
5245 * Get the status of a Domain Verification Result for an IntentFilter. This is
5246 * related to the {@link android.content.IntentFilter#setAutoVerify(boolean)} and
5247 * {@link android.content.IntentFilter#getAutoVerify()}
5248 *
5249 * This is used by the ResolverActivity to change the status depending on what the User select
5250 * in the Disambiguation Dialog and also used by the Settings App for changing the default App
5251 * for a domain.
5252 *
5253 * @param packageName The package name of the Activity associated with the IntentFilter.
5254 * @param userId The user id.
5255 *
5256 * @return The status to set to. This can be
5257 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK} or
5258 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS} or
5259 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER} or
5260 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED}
5261 *
5262 * @hide
5263 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08005264 @SystemApi
Todd Kennedydbaef6d2017-07-24 11:28:00 -07005265 @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS_FULL)
Jeff Sharkey8588bc12016-01-06 16:47:42 -07005266 public abstract int getIntentVerificationStatusAsUser(String packageName, @UserIdInt int userId);
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08005267
5268 /**
5269 * Allow to change the status of a Intent Verification status for all IntentFilter of an App.
5270 * This is related to the {@link android.content.IntentFilter#setAutoVerify(boolean)} and
5271 * {@link android.content.IntentFilter#getAutoVerify()}
5272 *
5273 * This is used by the ResolverActivity to change the status depending on what the User select
5274 * in the Disambiguation Dialog and also used by the Settings App for changing the default App
5275 * for a domain.
5276 *
5277 * @param packageName The package name of the Activity associated with the IntentFilter.
5278 * @param status The status to set to. This can be
5279 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK} or
5280 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS} or
5281 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER}
5282 * @param userId The user id.
5283 *
5284 * @return true if the status has been set. False otherwise.
5285 *
5286 * @hide
5287 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08005288 @SystemApi
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06005289 @RequiresPermission(android.Manifest.permission.SET_PREFERRED_APPLICATIONS)
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07005290 public abstract boolean updateIntentVerificationStatusAsUser(String packageName, int status,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07005291 @UserIdInt int userId);
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08005292
5293 /**
5294 * Get the list of IntentFilterVerificationInfo for a specific package and User.
5295 *
5296 * @param packageName the package name. When this parameter is set to a non null value,
5297 * the results will be filtered by the package name provided.
5298 * Otherwise, there will be no filtering and it will return a list
Fabrice Di Meglio07885952015-04-06 19:41:28 -07005299 * corresponding for all packages
5300 *
5301 * @return a list of IntentFilterVerificationInfo for a specific package.
5302 *
5303 * @hide
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08005304 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08005305 @SystemApi
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08005306 public abstract List<IntentFilterVerificationInfo> getIntentFilterVerifications(
5307 String packageName);
5308
5309 /**
Fabrice Di Meglio07885952015-04-06 19:41:28 -07005310 * Get the list of IntentFilter for a specific package.
5311 *
5312 * @param packageName the package name. This parameter is set to a non null value,
5313 * the list will contain all the IntentFilter for that package.
5314 * Otherwise, the list will be empty.
5315 *
5316 * @return a list of IntentFilter for a specific package.
5317 *
5318 * @hide
5319 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08005320 @SystemApi
Fabrice Di Meglio07885952015-04-06 19:41:28 -07005321 public abstract List<IntentFilter> getAllIntentFilters(String packageName);
5322
5323 /**
Fabrice Di Meglio62271722015-04-10 17:24:02 -07005324 * Get the default Browser package name for a specific user.
5325 *
5326 * @param userId The user id.
5327 *
5328 * @return the package name of the default Browser for the specified user. If the user id passed
5329 * is -1 (all users) it will return a null value.
5330 *
5331 * @hide
5332 */
Jeff Sharkeya73b8fd2016-01-06 17:02:08 -07005333 @TestApi
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08005334 @SystemApi
Todd Kennedydbaef6d2017-07-24 11:28:00 -07005335 @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS_FULL)
Jeff Sharkey8588bc12016-01-06 16:47:42 -07005336 public abstract String getDefaultBrowserPackageNameAsUser(@UserIdInt int userId);
Fabrice Di Meglio62271722015-04-10 17:24:02 -07005337
5338 /**
5339 * Set the default Browser package name for a specific user.
5340 *
5341 * @param packageName The package name of the default Browser.
5342 * @param userId The user id.
5343 *
5344 * @return true if the default Browser for the specified user has been set,
5345 * otherwise return false. If the user id passed is -1 (all users) this call will not
5346 * do anything and just return false.
5347 *
5348 * @hide
5349 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08005350 @SystemApi
Todd Kennedydbaef6d2017-07-24 11:28:00 -07005351 @RequiresPermission(allOf = {
5352 Manifest.permission.SET_PREFERRED_APPLICATIONS,
5353 Manifest.permission.INTERACT_ACROSS_USERS_FULL})
Jeff Sharkey8588bc12016-01-06 16:47:42 -07005354 public abstract boolean setDefaultBrowserPackageNameAsUser(String packageName,
5355 @UserIdInt int userId);
Fabrice Di Meglio62271722015-04-10 17:24:02 -07005356
5357 /**
Dianne Hackborn880119b2010-11-18 22:26:40 -08005358 * Change the installer associated with a given package. There are limitations
5359 * on how the installer package can be changed; in particular:
5360 * <ul>
5361 * <li> A SecurityException will be thrown if <var>installerPackageName</var>
5362 * is not signed with the same certificate as the calling application.
5363 * <li> A SecurityException will be thrown if <var>targetPackage</var> already
5364 * has an installer package, and that installer package is not signed with
5365 * the same certificate as the calling application.
5366 * </ul>
5367 *
5368 * @param targetPackage The installed package whose installer will be changed.
5369 * @param installerPackageName The package name of the new installer. May be
5370 * null to clear the association.
5371 */
5372 public abstract void setInstallerPackageName(String targetPackage,
5373 String installerPackageName);
5374
Todd Kennedyab532892017-03-08 14:19:49 -08005375 /** @hide */
5376 @SystemApi
5377 @RequiresPermission(Manifest.permission.INSTALL_PACKAGES)
5378 public abstract void setUpdateAvailable(String packageName, boolean updateAvaialble);
5379
Dianne Hackborn880119b2010-11-18 22:26:40 -08005380 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005381 * Attempts to delete a package. Since this may take a little while, the
5382 * result will be posted back to the given observer. A deletion will fail if
5383 * the calling context lacks the
5384 * {@link android.Manifest.permission#DELETE_PACKAGES} permission, if the
5385 * named package cannot be found, or if the named package is a system
5386 * package.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005387 *
5388 * @param packageName The name of the package to delete
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005389 * @param observer An observer callback to get notified when the package
5390 * deletion is complete.
5391 * {@link android.content.pm.IPackageDeleteObserver#packageDeleted}
5392 * will be called when that happens. observer may be null to
5393 * indicate that no callback is desired.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005394 * @hide
5395 */
Svet Ganov67882122016-12-11 16:36:34 -08005396 @RequiresPermission(Manifest.permission.DELETE_PACKAGES)
Mathew Inwood5c0d3542018-08-14 13:54:31 +01005397 @UnsupportedAppUsage
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005398 public abstract void deletePackage(String packageName, IPackageDeleteObserver observer,
5399 @DeleteFlags int flags);
Jacek Surazski65e13172009-04-28 15:26:38 +02005400
5401 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005402 * Attempts to delete a package. Since this may take a little while, the
5403 * result will be posted back to the given observer. A deletion will fail if
5404 * the named package cannot be found, or if the named package is a system
5405 * package.
Nicolas Prevot9a80e532015-09-23 15:49:28 +01005406 *
5407 * @param packageName The name of the package to delete
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005408 * @param observer An observer callback to get notified when the package
5409 * deletion is complete.
5410 * {@link android.content.pm.IPackageDeleteObserver#packageDeleted}
5411 * will be called when that happens. observer may be null to
5412 * indicate that no callback is desired.
Nicolas Prevot9a80e532015-09-23 15:49:28 +01005413 * @param userId The user Id
Nicolas Prevot9a80e532015-09-23 15:49:28 +01005414 * @hide
5415 */
Svet Ganov67882122016-12-11 16:36:34 -08005416 @RequiresPermission(anyOf = {
Nicolas Prevot9a80e532015-09-23 15:49:28 +01005417 Manifest.permission.DELETE_PACKAGES,
5418 Manifest.permission.INTERACT_ACROSS_USERS_FULL})
Mathew Inwood5c0d3542018-08-14 13:54:31 +01005419 @UnsupportedAppUsage
Svet Ganov67882122016-12-11 16:36:34 -08005420 public abstract void deletePackageAsUser(@NonNull String packageName,
5421 IPackageDeleteObserver observer, @DeleteFlags int flags, @UserIdInt int userId);
Nicolas Prevot9a80e532015-09-23 15:49:28 +01005422
5423 /**
Jacek Surazski65e13172009-04-28 15:26:38 +02005424 * Retrieve the package name of the application that installed a package. This identifies
5425 * which market the package came from.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005426 *
Jacek Surazski65e13172009-04-28 15:26:38 +02005427 * @param packageName The name of the package to query
Todd Kennedy9db65632018-02-13 11:12:35 -08005428 * @throws IllegalArgumentException if the given package name is not installed
Jacek Surazski65e13172009-04-28 15:26:38 +02005429 */
Scott Kennedy98b5f892018-10-09 17:26:19 -07005430 @Nullable
Jacek Surazski65e13172009-04-28 15:26:38 +02005431 public abstract String getInstallerPackageName(String packageName);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005432
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005433 /**
5434 * Attempts to clear the user data directory of an application.
5435 * Since this may take a little while, the result will
5436 * be posted back to the given observer. A deletion will fail if the
5437 * named package cannot be found, or if the named package is a "system package".
5438 *
5439 * @param packageName The name of the package
5440 * @param observer An observer callback to get notified when the operation is finished
5441 * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)}
5442 * will be called when that happens. observer may be null to indicate that
5443 * no callback is desired.
5444 *
5445 * @hide
5446 */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01005447 @UnsupportedAppUsage
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005448 public abstract void clearApplicationUserData(String packageName,
5449 IPackageDataObserver observer);
5450 /**
5451 * Attempts to delete the cache files associated with an application.
5452 * Since this may take a little while, the result will
5453 * be posted back to the given observer. A deletion will fail if the calling context
5454 * lacks the {@link android.Manifest.permission#DELETE_CACHE_FILES} permission, if the
5455 * named package cannot be found, or if the named package is a "system package".
5456 *
5457 * @param packageName The name of the package to delete
5458 * @param observer An observer callback to get notified when the cache file deletion
5459 * is complete.
5460 * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)}
5461 * will be called when that happens. observer may be null to indicate that
5462 * no callback is desired.
5463 *
5464 * @hide
5465 */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01005466 @UnsupportedAppUsage
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005467 public abstract void deleteApplicationCacheFiles(String packageName,
5468 IPackageDataObserver observer);
5469
5470 /**
Suprabh Shukla78c9eb82016-04-12 15:51:35 -07005471 * Attempts to delete the cache files associated with an application for a given user. Since
5472 * this may take a little while, the result will be posted back to the given observer. A
5473 * deletion will fail if the calling context lacks the
5474 * {@link android.Manifest.permission#DELETE_CACHE_FILES} permission, if the named package
5475 * cannot be found, or if the named package is a "system package". If {@code userId} does not
5476 * belong to the calling user, the caller must have
5477 * {@link android.Manifest.permission#INTERACT_ACROSS_USERS} permission.
5478 *
5479 * @param packageName The name of the package to delete
5480 * @param userId the user for which the cache files needs to be deleted
5481 * @param observer An observer callback to get notified when the cache file deletion is
5482 * complete.
5483 * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)}
5484 * will be called when that happens. observer may be null to indicate that no
5485 * callback is desired.
5486 * @hide
5487 */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01005488 @UnsupportedAppUsage
Suprabh Shukla78c9eb82016-04-12 15:51:35 -07005489 public abstract void deleteApplicationCacheFilesAsUser(String packageName, int userId,
5490 IPackageDataObserver observer);
5491
5492 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005493 * Free storage by deleting LRU sorted list of cache files across
5494 * all applications. If the currently available free storage
5495 * on the device is greater than or equal to the requested
5496 * free storage, no cache files are cleared. If the currently
5497 * available storage on the device is less than the requested
5498 * free storage, some or all of the cache files across
5499 * all applications are deleted (based on last accessed time)
5500 * to increase the free storage space on the device to
5501 * the requested value. There is no guarantee that clearing all
5502 * the cache files from all applications will clear up
5503 * enough storage to achieve the desired value.
5504 * @param freeStorageSize The number of bytes of storage to be
5505 * freed by the system. Say if freeStorageSize is XX,
5506 * and the current free storage is YY,
5507 * if XX is less than YY, just return. if not free XX-YY number
5508 * of bytes if possible.
5509 * @param observer call back used to notify when
5510 * the operation is completed
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005511 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005512 * @hide
5513 */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01005514 @UnsupportedAppUsage
Jeff Sharkey529f91f2015-04-18 20:23:13 -07005515 public void freeStorageAndNotify(long freeStorageSize, IPackageDataObserver observer) {
5516 freeStorageAndNotify(null, freeStorageSize, observer);
5517 }
5518
5519 /** {@hide} */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01005520 @UnsupportedAppUsage
Jeff Sharkey529f91f2015-04-18 20:23:13 -07005521 public abstract void freeStorageAndNotify(String volumeUuid, long freeStorageSize,
5522 IPackageDataObserver observer);
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -07005523
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005524 /**
5525 * Free storage by deleting LRU sorted list of cache files across
5526 * all applications. If the currently available free storage
5527 * on the device is greater than or equal to the requested
5528 * free storage, no cache files are cleared. If the currently
5529 * available storage on the device is less than the requested
5530 * free storage, some or all of the cache files across
5531 * all applications are deleted (based on last accessed time)
5532 * to increase the free storage space on the device to
5533 * the requested value. There is no guarantee that clearing all
5534 * the cache files from all applications will clear up
5535 * enough storage to achieve the desired value.
5536 * @param freeStorageSize The number of bytes of storage to be
5537 * freed by the system. Say if freeStorageSize is XX,
5538 * and the current free storage is YY,
5539 * if XX is less than YY, just return. if not free XX-YY number
5540 * of bytes if possible.
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -07005541 * @param pi IntentSender call back used to
5542 * notify when the operation is completed.May be null
5543 * to indicate that no call back is desired.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005544 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005545 * @hide
5546 */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01005547 @UnsupportedAppUsage
Jeff Sharkey529f91f2015-04-18 20:23:13 -07005548 public void freeStorage(long freeStorageSize, IntentSender pi) {
5549 freeStorage(null, freeStorageSize, pi);
5550 }
5551
5552 /** {@hide} */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01005553 @UnsupportedAppUsage
Jeff Sharkey529f91f2015-04-18 20:23:13 -07005554 public abstract void freeStorage(String volumeUuid, long freeStorageSize, IntentSender pi);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005555
5556 /**
5557 * Retrieve the size information for a package.
5558 * Since this may take a little while, the result will
5559 * be posted back to the given observer. The calling context
5560 * should have the {@link android.Manifest.permission#GET_PACKAGE_SIZE} permission.
5561 *
5562 * @param packageName The name of the package whose size information is to be retrieved
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07005563 * @param userId The user whose size information should be retrieved.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005564 * @param observer An observer callback to get notified when the operation
5565 * is complete.
5566 * {@link android.content.pm.IPackageStatsObserver#onGetStatsCompleted(PackageStats, boolean)}
5567 * The observer's callback is invoked with a PackageStats object(containing the
5568 * code, data and cache sizes of the package) and a boolean value representing
5569 * the status of the operation. observer may be null to indicate that
5570 * no callback is desired.
5571 *
Jeff Sharkey60f95aa2017-03-08 13:57:15 -07005572 * @deprecated use {@link StorageStatsManager} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005573 * @hide
5574 */
Jeff Sharkey60f95aa2017-03-08 13:57:15 -07005575 @Deprecated
Mathew Inwood5c0d3542018-08-14 13:54:31 +01005576 @UnsupportedAppUsage
Jeff Sharkey8588bc12016-01-06 16:47:42 -07005577 public abstract void getPackageSizeInfoAsUser(String packageName, @UserIdInt int userId,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005578 IPackageStatsObserver observer);
5579
5580 /**
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07005581 * Like {@link #getPackageSizeInfoAsUser(String, int, IPackageStatsObserver)}, but
Dianne Hackborn0c380492012-08-20 17:23:30 -07005582 * returns the size for the calling user.
5583 *
Jeff Sharkey60f95aa2017-03-08 13:57:15 -07005584 * @deprecated use {@link StorageStatsManager} instead.
Dianne Hackborn0c380492012-08-20 17:23:30 -07005585 * @hide
5586 */
Jeff Sharkey60f95aa2017-03-08 13:57:15 -07005587 @Deprecated
Mathew Inwood5c0d3542018-08-14 13:54:31 +01005588 @UnsupportedAppUsage
Dianne Hackborn0c380492012-08-20 17:23:30 -07005589 public void getPackageSizeInfo(String packageName, IPackageStatsObserver observer) {
Jeff Sharkeyad357d12018-02-02 13:25:31 -07005590 getPackageSizeInfoAsUser(packageName, getUserId(), observer);
Dianne Hackborn0c380492012-08-20 17:23:30 -07005591 }
5592
5593 /**
Nikita Dubrovsky7e9d5e12019-01-15 08:09:22 -08005594 * @deprecated This function no longer does anything. It is the platform's
5595 * responsibility to assign preferred activities and this cannot be modified
5596 * directly. To determine the activities resolved by the platform, use
5597 * {@link #resolveActivity} or {@link #queryIntentActivities}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005598 */
Dianne Hackborna7ca0e52009-12-01 14:31:55 -08005599 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005600 public abstract void addPackageToPreferred(String packageName);
5601
5602 /**
Nikita Dubrovsky7e9d5e12019-01-15 08:09:22 -08005603 * @deprecated This function no longer does anything. It is the platform's
5604 * responsibility to assign preferred activities and this cannot be modified
5605 * directly. To determine the activities resolved by the platform, use
5606 * {@link #resolveActivity} or {@link #queryIntentActivities}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005607 */
Dianne Hackborna7ca0e52009-12-01 14:31:55 -08005608 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005609 public abstract void removePackageFromPreferred(String packageName);
5610
5611 /**
Jeff Sharkey4347f812017-04-21 12:08:39 -06005612 * Retrieve the list of all currently configured preferred packages. The
5613 * first package on the list is the most preferred, the last is the least
5614 * preferred.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005615 *
Jeff Sharkey4347f812017-04-21 12:08:39 -06005616 * @param flags Additional option flags to modify the data returned.
5617 * @return A List of PackageInfo objects, one for each preferred
5618 * application, in order of preference.
Nikita Dubrovsky7e9d5e12019-01-15 08:09:22 -08005619 *
5620 * @deprecated This function no longer does anything. It is the platform's
5621 * responsibility to assign preferred activities and this cannot be modified
5622 * directly. To determine the activities resolved by the platform, use
5623 * {@link #resolveActivity} or {@link #queryIntentActivities}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005624 */
Nikita Dubrovsky18a87692018-11-27 16:43:22 -08005625 @Deprecated
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07005626 public abstract List<PackageInfo> getPreferredPackages(@PackageInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005627
5628 /**
5629 * Add a new preferred activity mapping to the system. This will be used
5630 * to automatically select the given activity component when
5631 * {@link Context#startActivity(Intent) Context.startActivity()} finds
5632 * multiple matching activities and also matches the given filter.
5633 *
5634 * @param filter The set of intents under which this activity will be
5635 * made preferred.
5636 * @param match The IntentFilter match category that this preference
5637 * applies to.
5638 * @param set The set of activities that the user was picking from when
5639 * this preference was made.
5640 * @param activity The component name of the activity that is to be
5641 * preferred.
Nikita Dubrovsky7e9d5e12019-01-15 08:09:22 -08005642 *
5643 * @deprecated This function no longer does anything. It is the platform's
5644 * responsibility to assign preferred activities and this cannot be modified
5645 * directly. To determine the activities resolved by the platform, use
5646 * {@link #resolveActivity} or {@link #queryIntentActivities}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005647 */
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08005648 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005649 public abstract void addPreferredActivity(IntentFilter filter, int match,
5650 ComponentName[] set, ComponentName activity);
5651
5652 /**
Amith Yamasania3f133a2012-08-09 17:11:28 -07005653 * Same as {@link #addPreferredActivity(IntentFilter, int,
5654 ComponentName[], ComponentName)}, but with a specific userId to apply the preference
5655 to.
5656 * @hide
Nikita Dubrovsky7e9d5e12019-01-15 08:09:22 -08005657 *
5658 * @deprecated This function no longer does anything. It is the platform's
5659 * responsibility to assign preferred activities and this cannot be modified
5660 * directly. To determine the activities resolved by the platform, use
5661 * {@link #resolveActivity} or {@link #queryIntentActivities}.
Amith Yamasania3f133a2012-08-09 17:11:28 -07005662 */
Nikita Dubrovsky18a87692018-11-27 16:43:22 -08005663 @Deprecated
Mathew Inwood5c0d3542018-08-14 13:54:31 +01005664 @UnsupportedAppUsage
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07005665 public void addPreferredActivityAsUser(IntentFilter filter, int match,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07005666 ComponentName[] set, ComponentName activity, @UserIdInt int userId) {
Amith Yamasania3f133a2012-08-09 17:11:28 -07005667 throw new RuntimeException("Not implemented. Must override in a subclass.");
5668 }
5669
5670 /**
Satish Sampath8dbe6122009-06-02 23:35:54 +01005671 * Replaces an existing preferred activity mapping to the system, and if that were not present
5672 * adds a new preferred activity. This will be used
5673 * to automatically select the given activity component when
5674 * {@link Context#startActivity(Intent) Context.startActivity()} finds
5675 * multiple matching activities and also matches the given filter.
5676 *
5677 * @param filter The set of intents under which this activity will be
5678 * made preferred.
5679 * @param match The IntentFilter match category that this preference
5680 * applies to.
5681 * @param set The set of activities that the user was picking from when
5682 * this preference was made.
5683 * @param activity The component name of the activity that is to be
5684 * preferred.
Nikita Dubrovsky7e9d5e12019-01-15 08:09:22 -08005685 *
Satish Sampath8dbe6122009-06-02 23:35:54 +01005686 * @hide
Nikita Dubrovsky7e9d5e12019-01-15 08:09:22 -08005687 *
5688 * @deprecated This function no longer does anything. It is the platform's
5689 * responsibility to assign preferred activities and this cannot be modified
5690 * directly. To determine the activities resolved by the platform, use
5691 * {@link #resolveActivity} or {@link #queryIntentActivities}.
Satish Sampath8dbe6122009-06-02 23:35:54 +01005692 */
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08005693 @Deprecated
Mathew Inwood5c0d3542018-08-14 13:54:31 +01005694 @UnsupportedAppUsage
Satish Sampath8dbe6122009-06-02 23:35:54 +01005695 public abstract void replacePreferredActivity(IntentFilter filter, int match,
5696 ComponentName[] set, ComponentName activity);
5697
5698 /**
Hai Zhangb7776682018-09-25 15:10:57 -07005699 * Replaces an existing preferred activity mapping to the system, and if that were not present
5700 * adds a new preferred activity. This will be used to automatically select the given activity
5701 * component when {@link Context#startActivity(Intent) Context.startActivity()} finds multiple
5702 * matching activities and also matches the given filter.
5703 *
5704 * @param filter The set of intents under which this activity will be made preferred.
5705 * @param match The IntentFilter match category that this preference applies to. Should be a
5706 * combination of {@link IntentFilter#MATCH_CATEGORY_MASK} and
5707 * {@link IntentFilter#MATCH_ADJUSTMENT_MASK}).
5708 * @param set The set of activities that the user was picking from when this preference was
5709 * made.
5710 * @param activity The component name of the activity that is to be preferred.
5711 *
5712 * @hide
Nikita Dubrovsky7e9d5e12019-01-15 08:09:22 -08005713 *
5714 * @deprecated This function no longer does anything. It is the platform's
5715 * responsibility to assign preferred activities and this cannot be modified
5716 * directly. To determine the activities resolved by the platform, use
5717 * {@link #resolveActivity} or {@link #queryIntentActivities}.
Hai Zhangb7776682018-09-25 15:10:57 -07005718 */
Nikita Dubrovsky18a87692018-11-27 16:43:22 -08005719 @Deprecated
Hai Zhangb7776682018-09-25 15:10:57 -07005720 @SystemApi
5721 public void replacePreferredActivity(@NonNull IntentFilter filter, int match,
5722 @NonNull List<ComponentName> set, @NonNull ComponentName activity) {
5723 replacePreferredActivity(filter, match, set.toArray(new ComponentName[0]), activity);
5724 }
5725
5726 /**
Amith Yamasani41c1ded2014-08-05 11:15:05 -07005727 * @hide
Nikita Dubrovsky7e9d5e12019-01-15 08:09:22 -08005728 *
5729 * @deprecated This function no longer does anything. It is the platform's
5730 * responsibility to assign preferred activities and this cannot be modified
5731 * directly. To determine the activities resolved by the platform, use
5732 * {@link #resolveActivity} or {@link #queryIntentActivities}.
Amith Yamasani41c1ded2014-08-05 11:15:05 -07005733 */
5734 @Deprecated
Mathew Inwood5c0d3542018-08-14 13:54:31 +01005735 @UnsupportedAppUsage
Amith Yamasani41c1ded2014-08-05 11:15:05 -07005736 public void replacePreferredActivityAsUser(IntentFilter filter, int match,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07005737 ComponentName[] set, ComponentName activity, @UserIdInt int userId) {
Amith Yamasani41c1ded2014-08-05 11:15:05 -07005738 throw new RuntimeException("Not implemented. Must override in a subclass.");
5739 }
5740
5741 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005742 * Remove all preferred activity mappings, previously added with
5743 * {@link #addPreferredActivity}, from the
5744 * system whose activities are implemented in the given package name.
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08005745 * An application can only clear its own package(s).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005746 *
5747 * @param packageName The name of the package whose preferred activity
5748 * mappings are to be removed.
Nikita Dubrovsky7e9d5e12019-01-15 08:09:22 -08005749 *
5750 * @deprecated This function no longer does anything. It is the platform's
5751 * responsibility to assign preferred activities and this cannot be modified
5752 * directly. To determine the activities resolved by the platform, use
5753 * {@link #resolveActivity} or {@link #queryIntentActivities}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005754 */
Nikita Dubrovsky18a87692018-11-27 16:43:22 -08005755 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005756 public abstract void clearPackagePreferredActivities(String packageName);
5757
5758 /**
5759 * Retrieve all preferred activities, previously added with
5760 * {@link #addPreferredActivity}, that are
5761 * currently registered with the system.
5762 *
John Spurlock38e64252015-03-18 12:09:32 -04005763 * @param outFilters A required list in which to place the filters of all of the
5764 * preferred activities.
5765 * @param outActivities A required list in which to place the component names of
5766 * all of the preferred activities.
5767 * @param packageName An optional package in which you would like to limit
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005768 * the list. If null, all activities will be returned; if non-null, only
5769 * those activities in the given package are returned.
5770 *
5771 * @return Returns the total number of registered preferred activities
5772 * (the number of distinct IntentFilter records, not the number of unique
5773 * activity components) that were found.
Nikita Dubrovsky7e9d5e12019-01-15 08:09:22 -08005774 *
5775 * @deprecated This function no longer does anything. It is the platform's
5776 * responsibility to assign preferred activities and this cannot be modified
5777 * directly. To determine the activities resolved by the platform, use
5778 * {@link #resolveActivity} or {@link #queryIntentActivities}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005779 */
Nikita Dubrovsky18a87692018-11-27 16:43:22 -08005780 @Deprecated
John Spurlock38e64252015-03-18 12:09:32 -04005781 public abstract int getPreferredActivities(@NonNull List<IntentFilter> outFilters,
5782 @NonNull List<ComponentName> outActivities, String packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005783
5784 /**
Christopher Tatea2a0850d2013-09-05 16:38:58 -07005785 * Ask for the set of available 'home' activities and the current explicit
5786 * default, if any.
5787 * @hide
5788 */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01005789 @UnsupportedAppUsage
Christopher Tatea2a0850d2013-09-05 16:38:58 -07005790 public abstract ComponentName getHomeActivities(List<ResolveInfo> outActivities);
5791
5792 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005793 * Set the enabled setting for a package component (activity, receiver, service, provider).
5794 * This setting will override any enabled state which may have been set by the component in its
5795 * manifest.
5796 *
5797 * @param componentName The component to enable
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06005798 * @param newState The new enabled state for the component.
5799 * @param flags Optional behavior flags.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005800 */
Chad Brubaker3875ce02018-05-11 13:40:51 -07005801 @RequiresPermission(value = android.Manifest.permission.CHANGE_COMPONENT_ENABLED_STATE,
5802 conditional = true)
Adrian Roos918c4f12019-01-22 17:48:51 +01005803 public abstract void setComponentEnabledSetting(@NonNull ComponentName componentName,
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06005804 @EnabledState int newState, @EnabledFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005805
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005806 /**
Amaury Medeirosdde24262014-06-03 20:06:41 -03005807 * Return the enabled setting for a package component (activity,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005808 * receiver, service, provider). This returns the last value set by
5809 * {@link #setComponentEnabledSetting(ComponentName, int, int)}; in most
5810 * cases this value will be {@link #COMPONENT_ENABLED_STATE_DEFAULT} since
5811 * the value originally specified in the manifest has not been modified.
5812 *
5813 * @param componentName The component to retrieve.
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06005814 * @return Returns the current enabled state for the component.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005815 */
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06005816 public abstract @EnabledState int getComponentEnabledSetting(
Adrian Roos918c4f12019-01-22 17:48:51 +01005817 @NonNull ComponentName componentName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005818
5819 /**
Ricky Wai92cd0062019-02-14 20:23:22 +00005820 * Set the enabled setting for a package app settings activity.
5821 *
5822 * @param packageName The package name of the app
5823 * @param enabled The new enabled state for app details activity
5824 *
5825 * @hide
5826 */
5827 @RequiresPermission(value = android.Manifest.permission.CHANGE_COMPONENT_ENABLED_STATE,
5828 conditional = true)
5829 @SystemApi
5830 public void setAppDetailsActivityEnabled(@NonNull String packageName, boolean enabled) {
5831 throw new UnsupportedOperationException(
5832 "setAppDetailsActivityEnabled not implemented");
5833 }
5834
5835
5836 /**
5837 * Return the enabled setting for a package app settings activity.
5838 *
5839 * @param packageName The package name of the app
5840 * @return Returns the current enabled state for app settings activity.
5841 *
5842 * @hide
5843 */
5844 @SystemApi
5845 public boolean getAppDetailsActivityEnabled(@NonNull String packageName) {
5846 throw new UnsupportedOperationException(
5847 "getAppDetailsActivityEnabled not implemented");
5848 }
5849
5850 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005851 * Set the enabled setting for an application
5852 * This setting will override any enabled state which may have been set by the application in
5853 * its manifest. It also overrides the enabled state set in the manifest for any of the
5854 * application's components. It does not override any enabled state set by
5855 * {@link #setComponentEnabledSetting} for any of the application's components.
5856 *
5857 * @param packageName The package name of the application to enable
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06005858 * @param newState The new enabled state for the application.
5859 * @param flags Optional behavior flags.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005860 */
Chad Brubaker3875ce02018-05-11 13:40:51 -07005861 @RequiresPermission(value = android.Manifest.permission.CHANGE_COMPONENT_ENABLED_STATE,
5862 conditional = true)
Adrian Roos918c4f12019-01-22 17:48:51 +01005863 public abstract void setApplicationEnabledSetting(@NonNull String packageName,
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06005864 @EnabledState int newState, @EnabledFlags int flags);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005865
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005866 /**
Amaury Medeirosdde24262014-06-03 20:06:41 -03005867 * Return the enabled setting for an application. This returns
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005868 * the last value set by
5869 * {@link #setApplicationEnabledSetting(String, int, int)}; in most
5870 * cases this value will be {@link #COMPONENT_ENABLED_STATE_DEFAULT} since
5871 * the value originally specified in the manifest has not been modified.
5872 *
Amaury Medeirosdde24262014-06-03 20:06:41 -03005873 * @param packageName The package name of the application to retrieve.
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06005874 * @return Returns the current enabled state for the application.
Mathew Inwood1b9f8d92011-09-26 13:23:56 +01005875 * @throws IllegalArgumentException if the named package does not exist.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005876 */
Adrian Roos918c4f12019-01-22 17:48:51 +01005877 public abstract @EnabledState int getApplicationEnabledSetting(@NonNull String packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005878
5879 /**
Sudheer Shankabbb3ff22015-07-09 15:39:23 +01005880 * Flush the package restrictions for a given user to disk. This forces the package restrictions
5881 * like component and package enabled settings to be written to disk and avoids the delay that
5882 * is otherwise present when changing those settings.
5883 *
5884 * @param userId Ther userId of the user whose restrictions are to be flushed.
5885 * @hide
5886 */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01005887 @UnsupportedAppUsage
Sudheer Shankabbb3ff22015-07-09 15:39:23 +01005888 public abstract void flushPackageRestrictionsAsUser(int userId);
5889
5890 /**
Amith Yamasanie5bcff62014-07-19 15:44:09 -07005891 * Puts the package in a hidden state, which is almost like an uninstalled state,
Amith Yamasani655d0e22013-06-12 14:19:10 -07005892 * making the package unavailable, but it doesn't remove the data or the actual
Amith Yamasanie5bcff62014-07-19 15:44:09 -07005893 * package file. Application can be unhidden by either resetting the hidden state
5894 * or by installing it, such as with {@link #installExistingPackage(String)}
Amith Yamasani655d0e22013-06-12 14:19:10 -07005895 * @hide
5896 */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01005897 @UnsupportedAppUsage
Amith Yamasanie5bcff62014-07-19 15:44:09 -07005898 public abstract boolean setApplicationHiddenSettingAsUser(String packageName, boolean hidden,
Amith Yamasani655d0e22013-06-12 14:19:10 -07005899 UserHandle userHandle);
5900
5901 /**
Amith Yamasanie5bcff62014-07-19 15:44:09 -07005902 * Returns the hidden state of a package.
5903 * @see #setApplicationHiddenSettingAsUser(String, boolean, UserHandle)
Amith Yamasani655d0e22013-06-12 14:19:10 -07005904 * @hide
5905 */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01005906 @UnsupportedAppUsage
Amith Yamasanie5bcff62014-07-19 15:44:09 -07005907 public abstract boolean getApplicationHiddenSettingAsUser(String packageName,
Amith Yamasani655d0e22013-06-12 14:19:10 -07005908 UserHandle userHandle);
5909
5910 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005911 * Return whether the device has been booted into safe mode.
5912 */
5913 public abstract boolean isSafeMode();
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08005914
5915 /**
Svetoslavf7c06eb2015-06-10 18:43:22 -07005916 * Adds a listener for permission changes for installed packages.
5917 *
5918 * @param listener The listener to add.
5919 *
5920 * @hide
5921 */
5922 @SystemApi
5923 @RequiresPermission(Manifest.permission.OBSERVE_GRANT_REVOKE_PERMISSIONS)
5924 public abstract void addOnPermissionsChangeListener(OnPermissionsChangedListener listener);
5925
5926 /**
5927 * Remvoes a listener for permission changes for installed packages.
5928 *
5929 * @param listener The listener to remove.
5930 *
5931 * @hide
5932 */
5933 @SystemApi
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06005934 @RequiresPermission(Manifest.permission.OBSERVE_GRANT_REVOKE_PERMISSIONS)
Svetoslavf7c06eb2015-06-10 18:43:22 -07005935 public abstract void removeOnPermissionsChangeListener(OnPermissionsChangedListener listener);
5936
5937 /**
dcashman9d2f4412014-06-09 09:27:54 -07005938 * Return the {@link KeySet} associated with the String alias for this
5939 * application.
5940 *
5941 * @param alias The alias for a given {@link KeySet} as defined in the
5942 * application's AndroidManifest.xml.
dcashmanc6f22492014-08-14 09:54:51 -07005943 * @hide
dcashman9d2f4412014-06-09 09:27:54 -07005944 */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01005945 @UnsupportedAppUsage
dcashman9d2f4412014-06-09 09:27:54 -07005946 public abstract KeySet getKeySetByAlias(String packageName, String alias);
5947
Ihab Awad1ec68882014-09-12 11:09:01 -07005948 /** Return the signing {@link KeySet} for this application.
dcashmanc6f22492014-08-14 09:54:51 -07005949 * @hide
5950 */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01005951 @UnsupportedAppUsage
dcashman9d2f4412014-06-09 09:27:54 -07005952 public abstract KeySet getSigningKeySet(String packageName);
5953
5954 /**
5955 * Return whether the package denoted by packageName has been signed by all
5956 * of the keys specified by the {@link KeySet} ks. This will return true if
5957 * the package has been signed by additional keys (a superset) as well.
5958 * Compare to {@link #isSignedByExactly(String packageName, KeySet ks)}.
dcashmanc6f22492014-08-14 09:54:51 -07005959 * @hide
dcashman9d2f4412014-06-09 09:27:54 -07005960 */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01005961 @UnsupportedAppUsage
dcashman9d2f4412014-06-09 09:27:54 -07005962 public abstract boolean isSignedBy(String packageName, KeySet ks);
5963
5964 /**
5965 * Return whether the package denoted by packageName has been signed by all
5966 * of, and only, the keys specified by the {@link KeySet} ks. Compare to
5967 * {@link #isSignedBy(String packageName, KeySet ks)}.
dcashmanc6f22492014-08-14 09:54:51 -07005968 * @hide
dcashman9d2f4412014-06-09 09:27:54 -07005969 */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01005970 @UnsupportedAppUsage
dcashman9d2f4412014-06-09 09:27:54 -07005971 public abstract boolean isSignedByExactly(String packageName, KeySet ks);
5972
5973 /**
Suprabh Shukla79000492018-12-24 17:03:02 -08005974 * Flag to denote no restrictions. This should be used to clear any restrictions that may have
5975 * been previously set for the package.
Suprabh Shukla79000492018-12-24 17:03:02 -08005976 * @hide
Suprabh Shukla8b924432019-02-12 15:48:22 -08005977 * @see #setDistractingPackageRestrictions(String[], int)
Suprabh Shukla79000492018-12-24 17:03:02 -08005978 */
5979 @SystemApi
5980 public static final int RESTRICTION_NONE = 0x0;
5981
5982 /**
5983 * Flag to denote that a package should be hidden from any suggestions to the user.
Suprabh Shukla79000492018-12-24 17:03:02 -08005984 * @hide
Suprabh Shukla8b924432019-02-12 15:48:22 -08005985 * @see #setDistractingPackageRestrictions(String[], int)
Suprabh Shukla79000492018-12-24 17:03:02 -08005986 */
5987 @SystemApi
5988 public static final int RESTRICTION_HIDE_FROM_SUGGESTIONS = 0x00000001;
5989
5990 /**
5991 * Flag to denote that a package's notifications should be hidden.
Suprabh Shukla79000492018-12-24 17:03:02 -08005992 * @hide
Suprabh Shukla8b924432019-02-12 15:48:22 -08005993 * @see #setDistractingPackageRestrictions(String[], int)
Suprabh Shukla79000492018-12-24 17:03:02 -08005994 */
5995 @SystemApi
5996 public static final int RESTRICTION_HIDE_NOTIFICATIONS = 0x00000002;
5997
5998 /**
5999 * Restriction flags to set on a package that is considered as distracting to the user.
6000 * These should help the user to restrict their usage of these apps.
6001 *
6002 * @see #setDistractingPackageRestrictions(String[], int)
6003 * @hide
6004 */
Suprabh Shukla79000492018-12-24 17:03:02 -08006005 @IntDef(flag = true, prefix = {"RESTRICTION_"}, value = {
6006 RESTRICTION_NONE,
6007 RESTRICTION_HIDE_FROM_SUGGESTIONS,
6008 RESTRICTION_HIDE_NOTIFICATIONS
6009 })
6010 @Retention(RetentionPolicy.SOURCE)
6011 public @interface DistractionRestriction {}
6012
6013 /**
6014 * Mark or unmark the given packages as distracting to the user.
6015 * These packages can have certain restrictions set that should discourage the user to launch
6016 * them often. For example, notifications from such an app can be hidden, or the app can be
6017 * removed from launcher suggestions, so the user is able to restrict their use of these apps.
6018 *
6019 * <p>The caller must hold {@link android.Manifest.permission#SUSPEND_APPS} to use this API.
6020 *
6021 * @param packages Packages to mark as distracting.
Suprabh Shukla8b924432019-02-12 15:48:22 -08006022 * @param restrictionFlags Any combination of restrictions to impose on the given packages.
6023 * {@link #RESTRICTION_NONE} can be used to clear any existing
6024 * restrictions.
Suprabh Shukla79000492018-12-24 17:03:02 -08006025 * @return A list of packages that could not have the {@code restrictionFlags} set. The system
6026 * may prevent restricting critical packages to preserve normal device function.
6027 *
Suprabh Shukla79000492018-12-24 17:03:02 -08006028 * @hide
Suprabh Shukla8b924432019-02-12 15:48:22 -08006029 * @see #RESTRICTION_NONE
6030 * @see #RESTRICTION_HIDE_FROM_SUGGESTIONS
6031 * @see #RESTRICTION_HIDE_NOTIFICATIONS
Suprabh Shukla79000492018-12-24 17:03:02 -08006032 */
6033 @SystemApi
6034 @RequiresPermission(android.Manifest.permission.SUSPEND_APPS)
6035 @NonNull
6036 public String[] setDistractingPackageRestrictions(@NonNull String[] packages,
6037 @DistractionRestriction int restrictionFlags) {
6038 throw new UnsupportedOperationException(
6039 "setDistractingPackageRestrictions not implemented");
6040 }
6041
6042 /**
Andrei Stingaceanueb84b182016-01-26 18:39:55 +00006043 * Puts the package in a suspended state, where attempts at starting activities are denied.
Andrei Stingaceanu1e283912015-11-26 15:26:28 +00006044 *
Suprabh Shukla021b57a2018-03-08 18:21:50 -08006045 * <p>It doesn't remove the data or the actual package file. The application's notifications
Suprabh Shukla2fd43ba2018-03-22 16:57:49 -07006046 * will be hidden, any of its started activities will be stopped and it will not be able to
Suprabh Shukla3e03ab92018-04-11 16:03:49 -07006047 * show toasts or system alert windows or ring the device.
6048 *
6049 * <p>When the user tries to launch a suspended app, a system dialog with the given
6050 * {@code dialogMessage} will be shown instead. Since the message is supplied to the system as
6051 * a {@link String}, the caller needs to take care of localization as needed.
6052 * The dialog message can optionally contain a placeholder for the name of the suspended app.
6053 * The system uses {@link String#format(Locale, String, Object...) String.format} to insert the
6054 * app name into the message, so an example format string could be {@code "The app %1$s is
6055 * currently suspended"}. This makes it easier for callers to provide a single message which
6056 * works for all the packages being suspended in a single call.
Andrei Stingaceanueb84b182016-01-26 18:39:55 +00006057 *
Kenny Guy871f3eb2016-03-09 20:06:16 +00006058 * <p>The package must already be installed. If the package is uninstalled while suspended
Suprabh Shukla021b57a2018-03-08 18:21:50 -08006059 * the package will no longer be suspended. </p>
6060 *
6061 * <p>Optionally, the suspending app can provide extra information in the form of
6062 * {@link PersistableBundle} objects to be shared with the apps being suspended and the
Suprabh Shukla3e03ab92018-04-11 16:03:49 -07006063 * launcher to support customization that they might need to handle the suspended state.
Suprabh Shukla021b57a2018-03-08 18:21:50 -08006064 *
Suprabh Shukla79000492018-12-24 17:03:02 -08006065 * <p>The caller must hold {@link Manifest.permission#SUSPEND_APPS} to use this API.
Kenny Guy871f3eb2016-03-09 20:06:16 +00006066 *
Andrei Stingaceanueb84b182016-01-26 18:39:55 +00006067 * @param packageNames The names of the packages to set the suspended status.
Suprabh Shukla389cb6f2018-10-01 18:20:39 -07006068 * @param suspended If set to {@code true}, the packages will be suspended, if set to
Suprabh Shukla021b57a2018-03-08 18:21:50 -08006069 * {@code false}, the packages will be unsuspended.
6070 * @param appExtras An optional {@link PersistableBundle} that the suspending app can provide
6071 * which will be shared with the apps being suspended. Ignored if
6072 * {@code suspended} is false.
6073 * @param launcherExtras An optional {@link PersistableBundle} that the suspending app can
6074 * provide which will be shared with the launcher. Ignored if
6075 * {@code suspended} is false.
6076 * @param dialogMessage The message to be displayed to the user, when they try to launch a
6077 * suspended app.
Andrei Stingaceanu1e283912015-11-26 15:26:28 +00006078 *
Suprabh Shukla3e03ab92018-04-11 16:03:49 -07006079 * @return an array of package names for which the suspended status could not be set as
Suprabh Shukla389cb6f2018-10-01 18:20:39 -07006080 * requested in this method. Returns {@code null} if {@code packageNames} was {@code null}.
6081 *
6082 * @deprecated use {@link #setPackagesSuspended(String[], boolean, PersistableBundle,
6083 * PersistableBundle, android.content.pm.SuspendDialogInfo)} instead.
6084 *
6085 * @hide
6086 */
6087 @SystemApi
6088 @Deprecated
6089 @RequiresPermission(Manifest.permission.SUSPEND_APPS)
6090 @Nullable
6091 public String[] setPackagesSuspended(@Nullable String[] packageNames, boolean suspended,
6092 @Nullable PersistableBundle appExtras, @Nullable PersistableBundle launcherExtras,
6093 @Nullable String dialogMessage) {
6094 throw new UnsupportedOperationException("setPackagesSuspended not implemented");
6095 }
6096
6097 /**
6098 * Puts the given packages in a suspended state, where attempts at starting activities are
6099 * denied.
6100 *
6101 * <p>The suspended application's notifications and all of its windows will be hidden, any
6102 * of its started activities will be stopped and it won't be able to ring the device.
6103 * It doesn't remove the data or the actual package file.
6104 *
6105 * <p>When the user tries to launch a suspended app, a system dialog alerting them that the app
6106 * is suspended will be shown instead.
6107 * The caller can optionally customize the dialog by passing a {@link SuspendDialogInfo} object
Suprabh Shukla79000492018-12-24 17:03:02 -08006108 * to this API. This dialog will have a button that starts the
Suprabh Shukla389cb6f2018-10-01 18:20:39 -07006109 * {@link Intent#ACTION_SHOW_SUSPENDED_APP_DETAILS} intent if the suspending app declares an
6110 * activity which handles this action.
6111 *
6112 * <p>The packages being suspended must already be installed. If a package is uninstalled, it
6113 * will no longer be suspended.
6114 *
6115 * <p>Optionally, the suspending app can provide extra information in the form of
6116 * {@link PersistableBundle} objects to be shared with the apps being suspended and the
6117 * launcher to support customization that they might need to handle the suspended state.
6118 *
Suprabh Shukla79000492018-12-24 17:03:02 -08006119 * <p>The caller must hold {@link Manifest.permission#SUSPEND_APPS} to use this API.
Suprabh Shukla389cb6f2018-10-01 18:20:39 -07006120 *
6121 * @param packageNames The names of the packages to set the suspended status.
6122 * @param suspended If set to {@code true}, the packages will be suspended, if set to
6123 * {@code false}, the packages will be unsuspended.
6124 * @param appExtras An optional {@link PersistableBundle} that the suspending app can provide
6125 * which will be shared with the apps being suspended. Ignored if
6126 * {@code suspended} is false.
6127 * @param launcherExtras An optional {@link PersistableBundle} that the suspending app can
6128 * provide which will be shared with the launcher. Ignored if
6129 * {@code suspended} is false.
6130 * @param dialogInfo An optional {@link SuspendDialogInfo} object describing the dialog that
6131 * should be shown to the user when they try to launch a suspended app.
6132 * Ignored if {@code suspended} is false.
6133 *
6134 * @return an array of package names for which the suspended status could not be set as
6135 * requested in this method. Returns {@code null} if {@code packageNames} was {@code null}.
6136 *
6137 * @see #isPackageSuspended
6138 * @see SuspendDialogInfo
6139 * @see SuspendDialogInfo.Builder
6140 * @see Intent#ACTION_SHOW_SUSPENDED_APP_DETAILS
Andrei Stingaceanueb84b182016-01-26 18:39:55 +00006141 *
Andrei Stingaceanu1e283912015-11-26 15:26:28 +00006142 * @hide
6143 */
Suprabh Shukla021b57a2018-03-08 18:21:50 -08006144 @SystemApi
Suprabh Shukla14405c92018-05-16 20:41:00 -07006145 @RequiresPermission(Manifest.permission.SUSPEND_APPS)
Suprabh Shukla389cb6f2018-10-01 18:20:39 -07006146 @Nullable
6147 public String[] setPackagesSuspended(@Nullable String[] packageNames, boolean suspended,
Suprabh Shukla021b57a2018-03-08 18:21:50 -08006148 @Nullable PersistableBundle appExtras, @Nullable PersistableBundle launcherExtras,
Suprabh Shukla389cb6f2018-10-01 18:20:39 -07006149 @Nullable SuspendDialogInfo dialogInfo) {
Suprabh Shukla021b57a2018-03-08 18:21:50 -08006150 throw new UnsupportedOperationException("setPackagesSuspended not implemented");
6151 }
Andrei Stingaceanu1e283912015-11-26 15:26:28 +00006152
Andrei Stingaceanu355b2322016-02-12 16:43:51 +00006153 /**
Suprabh Shukla436d093ba2018-12-12 16:01:41 +00006154 * Returns any packages in a given set of packages that cannot be suspended via a call to {@link
Suprabh Shukla1f1de702018-11-09 22:49:23 -08006155 * #setPackagesSuspended(String[], boolean, PersistableBundle, PersistableBundle,
6156 * SuspendDialogInfo) setPackagesSuspended}. The platform prevents suspending certain critical
6157 * packages to keep the device in a functioning state, e.g. the default dialer.
Suprabh Shukla79000492018-12-24 17:03:02 -08006158 * Apps need to hold {@link Manifest.permission#SUSPEND_APPS SUSPEND_APPS} to call this API.
Suprabh Shukla1f1de702018-11-09 22:49:23 -08006159 *
6160 * <p>
Suprabh Shukla436d093ba2018-12-12 16:01:41 +00006161 * Note that this set of critical packages can change with time, so even though a package name
6162 * was not returned by this call, it does not guarantee that a subsequent call to
6163 * {@link #setPackagesSuspended(String[], boolean, PersistableBundle, PersistableBundle,
6164 * SuspendDialogInfo) setPackagesSuspended} for that package will succeed, especially if
6165 * significant time elapsed between the two calls.
Suprabh Shukla1f1de702018-11-09 22:49:23 -08006166 *
Suprabh Shukla436d093ba2018-12-12 16:01:41 +00006167 * @param packageNames The packages to check.
6168 * @return A list of packages that can not be currently suspended by the system.
Suprabh Shukla1f1de702018-11-09 22:49:23 -08006169 * @hide
6170 */
6171 @SystemApi
6172 @RequiresPermission(Manifest.permission.SUSPEND_APPS)
Suprabh Shukla436d093ba2018-12-12 16:01:41 +00006173 @NonNull
6174 public String[] getUnsuspendablePackages(@NonNull String[] packageNames) {
6175 throw new UnsupportedOperationException("canSuspendPackages not implemented");
Suprabh Shukla1f1de702018-11-09 22:49:23 -08006176 }
6177
6178 /**
Suprabh Shukla021b57a2018-03-08 18:21:50 -08006179 * @see #setPackagesSuspended(String[], boolean, PersistableBundle, PersistableBundle, String)
Andrei Stingaceanu355b2322016-02-12 16:43:51 +00006180 * @param packageName The name of the package to get the suspended status of.
6181 * @param userId The user id.
6182 * @return {@code true} if the package is suspended or {@code false} if the package is not
Suprabh Shukla96212bc2018-04-10 15:04:51 -07006183 * suspended.
6184 * @throws IllegalArgumentException if the package was not found.
Andrei Stingaceanu355b2322016-02-12 16:43:51 +00006185 * @hide
6186 */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01006187 @UnsupportedAppUsage
Andrei Stingaceanu355b2322016-02-12 16:43:51 +00006188 public abstract boolean isPackageSuspendedForUser(String packageName, int userId);
6189
Jeff Sharkey9bc89af2017-01-11 11:25:50 -07006190 /**
Suprabh Shukla021b57a2018-03-08 18:21:50 -08006191 * Query if an app is currently suspended.
6192 *
6193 * @return {@code true} if the given package is suspended, {@code false} otherwise
Suprabh Shukla96212bc2018-04-10 15:04:51 -07006194 * @throws NameNotFoundException if the package could not be found.
Suprabh Shukla021b57a2018-03-08 18:21:50 -08006195 *
Suprabh Shuklaa89d7f82018-08-13 14:27:01 -07006196 * @see #isPackageSuspended()
Suprabh Shukla021b57a2018-03-08 18:21:50 -08006197 */
Suprabh Shukla96212bc2018-04-10 15:04:51 -07006198 public boolean isPackageSuspended(String packageName) throws NameNotFoundException {
Suprabh Shukla021b57a2018-03-08 18:21:50 -08006199 throw new UnsupportedOperationException("isPackageSuspended not implemented");
6200 }
6201
6202 /**
Suprabh Shukla2fd43ba2018-03-22 16:57:49 -07006203 * Apps can query this to know if they have been suspended. A system app with the permission
6204 * {@code android.permission.SUSPEND_APPS} can put any app on the device into a suspended state.
6205 *
6206 * <p>While in this state, the application's notifications will be hidden, any of its started
Suprabh Shukla3017fe42018-11-08 19:00:01 -08006207 * activities will be stopped and it will not be able to show toasts or dialogs or play audio.
6208 * When the user tries to launch a suspended app, the system will, instead, show a
Suprabh Shukla2fd43ba2018-03-22 16:57:49 -07006209 * dialog to the user informing them that they cannot use this app while it is suspended.
6210 *
6211 * <p>When an app is put into this state, the broadcast action
6212 * {@link Intent#ACTION_MY_PACKAGE_SUSPENDED} will be delivered to any of its broadcast
6213 * receivers that included this action in their intent-filters, <em>including manifest
6214 * receivers.</em> Similarly, a broadcast action {@link Intent#ACTION_MY_PACKAGE_UNSUSPENDED}
Suprabh Shukla3017fe42018-11-08 19:00:01 -08006215 * is delivered when a previously suspended app is taken out of this state. Apps are expected to
6216 * use these to gracefully deal with transitions to and from this state.
Suprabh Shukla021b57a2018-03-08 18:21:50 -08006217 *
6218 * @return {@code true} if the calling package has been suspended, {@code false} otherwise.
6219 *
6220 * @see #getSuspendedPackageAppExtras()
Suprabh Shukla2fd43ba2018-03-22 16:57:49 -07006221 * @see Intent#ACTION_MY_PACKAGE_SUSPENDED
6222 * @see Intent#ACTION_MY_PACKAGE_UNSUSPENDED
Suprabh Shukla021b57a2018-03-08 18:21:50 -08006223 */
6224 public boolean isPackageSuspended() {
6225 throw new UnsupportedOperationException("isPackageSuspended not implemented");
6226 }
6227
6228 /**
Suprabh Shukla96212bc2018-04-10 15:04:51 -07006229 * Returns a {@link Bundle} of extras that was meant to be sent to the calling app when it was
6230 * suspended. An app with the permission {@code android.permission.SUSPEND_APPS} can supply this
6231 * to the system at the time of suspending an app.
Suprabh Shukla021b57a2018-03-08 18:21:50 -08006232 *
Suprabh Shukla96212bc2018-04-10 15:04:51 -07006233 * <p>This is the same {@link Bundle} that is sent along with the broadcast
6234 * {@link Intent#ACTION_MY_PACKAGE_SUSPENDED}, whenever the app is suspended. The contents of
6235 * this {@link Bundle} are a contract between the suspended app and the suspending app.
6236 *
6237 * <p>Note: These extras are optional, so if no extras were supplied to the system, this method
6238 * will return {@code null}, even when the calling app has been suspended.
Suprabh Shukla021b57a2018-03-08 18:21:50 -08006239 *
Suprabh Shukla2fd43ba2018-03-22 16:57:49 -07006240 * @return A {@link Bundle} containing the extras for the app, or {@code null} if the
Suprabh Shukla021b57a2018-03-08 18:21:50 -08006241 * package is not currently suspended.
Suprabh Shukla2fd43ba2018-03-22 16:57:49 -07006242 *
Suprabh Shukla021b57a2018-03-08 18:21:50 -08006243 * @see #isPackageSuspended()
Suprabh Shukla2fd43ba2018-03-22 16:57:49 -07006244 * @see Intent#ACTION_MY_PACKAGE_UNSUSPENDED
6245 * @see Intent#ACTION_MY_PACKAGE_SUSPENDED
Suprabh Shukla96212bc2018-04-10 15:04:51 -07006246 * @see Intent#EXTRA_SUSPENDED_PACKAGE_EXTRAS
Suprabh Shukla021b57a2018-03-08 18:21:50 -08006247 */
Suprabh Shukla2fd43ba2018-03-22 16:57:49 -07006248 public @Nullable Bundle getSuspendedPackageAppExtras() {
Suprabh Shukla021b57a2018-03-08 18:21:50 -08006249 throw new UnsupportedOperationException("getSuspendedPackageAppExtras not implemented");
6250 }
6251
6252 /**
Jeff Sharkey9bc89af2017-01-11 11:25:50 -07006253 * Provide a hint of what the {@link ApplicationInfo#category} value should
6254 * be for the given package.
6255 * <p>
6256 * This hint can only be set by the app which installed this package, as
6257 * determined by {@link #getInstallerPackageName(String)}.
Jeff Sharkey60a82cd2017-04-18 18:19:16 -06006258 *
6259 * @param packageName the package to change the category hint for.
Jeff Sharkey4347f812017-04-21 12:08:39 -06006260 * @param categoryHint the category hint to set.
Jeff Sharkey9bc89af2017-01-11 11:25:50 -07006261 */
Jeff Sharkey60a82cd2017-04-18 18:19:16 -06006262 public abstract void setApplicationCategoryHint(@NonNull String packageName,
Jeff Sharkey9bc89af2017-01-11 11:25:50 -07006263 @ApplicationInfo.Category int categoryHint);
6264
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -07006265 /** {@hide} */
Jeff Sharkey620b32b2015-04-23 19:36:02 -07006266 public static boolean isMoveStatusFinished(int status) {
6267 return (status < 0 || status > 100);
6268 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07006269
Jeff Sharkeye2d45be2015-04-15 17:14:12 -07006270 /** {@hide} */
Jeff Sharkey620b32b2015-04-23 19:36:02 -07006271 public static abstract class MoveCallback {
Jeff Sharkey50a05452015-04-29 11:24:52 -07006272 public void onCreated(int moveId, Bundle extras) {}
6273 public abstract void onStatusChanged(int moveId, int status, long estMillis);
Jeff Sharkey620b32b2015-04-23 19:36:02 -07006274 }
Jeff Sharkeye2d45be2015-04-15 17:14:12 -07006275
6276 /** {@hide} */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01006277 @UnsupportedAppUsage
Jeff Sharkey620b32b2015-04-23 19:36:02 -07006278 public abstract int getMoveStatus(int moveId);
6279
6280 /** {@hide} */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01006281 @UnsupportedAppUsage
Jeff Sharkey620b32b2015-04-23 19:36:02 -07006282 public abstract void registerMoveCallback(MoveCallback callback, Handler handler);
6283 /** {@hide} */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01006284 @UnsupportedAppUsage
Jeff Sharkey620b32b2015-04-23 19:36:02 -07006285 public abstract void unregisterMoveCallback(MoveCallback callback);
6286
6287 /** {@hide} */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01006288 @UnsupportedAppUsage
Jeff Sharkey620b32b2015-04-23 19:36:02 -07006289 public abstract int movePackage(String packageName, VolumeInfo vol);
6290 /** {@hide} */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01006291 @UnsupportedAppUsage
Jeff Sharkey620b32b2015-04-23 19:36:02 -07006292 public abstract @Nullable VolumeInfo getPackageCurrentVolume(ApplicationInfo app);
6293 /** {@hide} */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01006294 @UnsupportedAppUsage
Jeff Sharkey620b32b2015-04-23 19:36:02 -07006295 public abstract @NonNull List<VolumeInfo> getPackageCandidateVolumes(ApplicationInfo app);
6296
6297 /** {@hide} */
6298 public abstract int movePrimaryStorage(VolumeInfo vol);
6299 /** {@hide} */
6300 public abstract @Nullable VolumeInfo getPrimaryStorageCurrentVolume();
6301 /** {@hide} */
6302 public abstract @NonNull List<VolumeInfo> getPrimaryStorageCandidateVolumes();
Jeff Sharkeye2d45be2015-04-15 17:14:12 -07006303
Amith Yamasani4b2e9342011-03-31 12:38:53 -07006304 /**
Amith Yamasani13593602012-03-22 16:16:17 -07006305 * Returns the device identity that verifiers can use to associate their scheme to a particular
6306 * device. This should not be used by anything other than a package verifier.
Aravind Akella068b0c02013-10-12 17:39:15 -07006307 *
Kenny Root0aaa0d92011-09-12 16:42:55 -07006308 * @return identity that uniquely identifies current device
6309 * @hide
6310 */
6311 public abstract VerifierDeviceIdentity getVerifierDeviceIdentity();
Amith Yamasani742a6712011-05-04 14:49:28 -07006312
Jeff Sharkey6c833e02014-07-14 22:44:30 -07006313 /**
Jeff Hao9f60c082014-10-28 18:51:07 -07006314 * Returns true if the device is upgrading, such as first boot after OTA.
6315 *
6316 * @hide
6317 */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01006318 @UnsupportedAppUsage
Jeff Hao9f60c082014-10-28 18:51:07 -07006319 public abstract boolean isUpgrade();
6320
6321 /**
Jeff Sharkey6c833e02014-07-14 22:44:30 -07006322 * Return interface that offers the ability to install, upgrade, and remove
6323 * applications on the device.
6324 */
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07006325 public abstract @NonNull PackageInstaller getPackageInstaller();
Jeff Sharkey3a44f3f2014-04-28 17:36:31 -07006326
Amith Yamasani742a6712011-05-04 14:49:28 -07006327 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07006328 * Adds a {@code CrossProfileIntentFilter}. After calling this method all
6329 * intents sent from the user with id sourceUserId can also be be resolved
6330 * by activities in the user with id targetUserId if they match the
6331 * specified intent filter.
6332 *
Nicolas Prevot3f7777f2014-07-24 15:58:39 +01006333 * @param filter The {@link IntentFilter} the intent has to match
6334 * @param sourceUserId The source user id.
6335 * @param targetUserId The target user id.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07006336 * @param flags The possible values are {@link #SKIP_CURRENT_PROFILE} and
6337 * {@link #ONLY_IF_NO_MATCH_FOUND}.
Nicolas Prevotc79586e2014-05-06 12:47:57 +01006338 * @hide
6339 */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01006340 @UnsupportedAppUsage
Nicolas Prevot63798c52014-05-27 13:22:38 +01006341 public abstract void addCrossProfileIntentFilter(IntentFilter filter, int sourceUserId,
6342 int targetUserId, int flags);
Nicolas Prevotc79586e2014-05-06 12:47:57 +01006343
6344 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07006345 * Clearing {@code CrossProfileIntentFilter}s which have the specified user
6346 * as their source, and have been set by the app calling this method.
6347 *
Nicolas Prevot3f7777f2014-07-24 15:58:39 +01006348 * @param sourceUserId The source user id.
Nicolas Prevotc79586e2014-05-06 12:47:57 +01006349 * @hide
6350 */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01006351 @UnsupportedAppUsage
Nicolas Prevot81948992014-05-16 18:25:26 +01006352 public abstract void clearCrossProfileIntentFilters(int sourceUserId);
Alexandra Gherghina6e2ae252014-06-12 16:03:58 +01006353
6354 /**
Nicolas Prevot88cc3462014-05-14 14:51:48 +01006355 * @hide
6356 */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01006357 @UnsupportedAppUsage
Nicolas Prevot7f7b0c72014-06-23 15:59:38 +01006358 public abstract Drawable loadItemIcon(PackageItemInfo itemInfo, ApplicationInfo appInfo);
Jeff Sharkey6c833e02014-07-14 22:44:30 -07006359
Benjamin Franzec2d48b2014-10-01 15:38:43 +01006360 /**
6361 * @hide
6362 */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01006363 @UnsupportedAppUsage
Benjamin Franzec2d48b2014-10-01 15:38:43 +01006364 public abstract Drawable loadUnbadgedItemIcon(PackageItemInfo itemInfo, ApplicationInfo appInfo);
6365
Jeff Sharkey6c833e02014-07-14 22:44:30 -07006366 /** {@hide} */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01006367 @UnsupportedAppUsage
Jeff Sharkey6c833e02014-07-14 22:44:30 -07006368 public abstract boolean isPackageAvailable(String packageName);
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07006369
6370 /** {@hide} */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01006371 @UnsupportedAppUsage
Jeff Sharkeya0907432014-08-15 10:23:11 -07006372 public static String installStatusToString(int status, String msg) {
6373 final String str = installStatusToString(status);
6374 if (msg != null) {
6375 return str + ": " + msg;
6376 } else {
6377 return str;
6378 }
6379 }
6380
6381 /** {@hide} */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01006382 @UnsupportedAppUsage
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07006383 public static String installStatusToString(int status) {
6384 switch (status) {
6385 case INSTALL_SUCCEEDED: return "INSTALL_SUCCEEDED";
6386 case INSTALL_FAILED_ALREADY_EXISTS: return "INSTALL_FAILED_ALREADY_EXISTS";
6387 case INSTALL_FAILED_INVALID_APK: return "INSTALL_FAILED_INVALID_APK";
6388 case INSTALL_FAILED_INVALID_URI: return "INSTALL_FAILED_INVALID_URI";
6389 case INSTALL_FAILED_INSUFFICIENT_STORAGE: return "INSTALL_FAILED_INSUFFICIENT_STORAGE";
6390 case INSTALL_FAILED_DUPLICATE_PACKAGE: return "INSTALL_FAILED_DUPLICATE_PACKAGE";
6391 case INSTALL_FAILED_NO_SHARED_USER: return "INSTALL_FAILED_NO_SHARED_USER";
6392 case INSTALL_FAILED_UPDATE_INCOMPATIBLE: return "INSTALL_FAILED_UPDATE_INCOMPATIBLE";
6393 case INSTALL_FAILED_SHARED_USER_INCOMPATIBLE: return "INSTALL_FAILED_SHARED_USER_INCOMPATIBLE";
6394 case INSTALL_FAILED_MISSING_SHARED_LIBRARY: return "INSTALL_FAILED_MISSING_SHARED_LIBRARY";
6395 case INSTALL_FAILED_REPLACE_COULDNT_DELETE: return "INSTALL_FAILED_REPLACE_COULDNT_DELETE";
6396 case INSTALL_FAILED_DEXOPT: return "INSTALL_FAILED_DEXOPT";
6397 case INSTALL_FAILED_OLDER_SDK: return "INSTALL_FAILED_OLDER_SDK";
6398 case INSTALL_FAILED_CONFLICTING_PROVIDER: return "INSTALL_FAILED_CONFLICTING_PROVIDER";
6399 case INSTALL_FAILED_NEWER_SDK: return "INSTALL_FAILED_NEWER_SDK";
6400 case INSTALL_FAILED_TEST_ONLY: return "INSTALL_FAILED_TEST_ONLY";
6401 case INSTALL_FAILED_CPU_ABI_INCOMPATIBLE: return "INSTALL_FAILED_CPU_ABI_INCOMPATIBLE";
6402 case INSTALL_FAILED_MISSING_FEATURE: return "INSTALL_FAILED_MISSING_FEATURE";
6403 case INSTALL_FAILED_CONTAINER_ERROR: return "INSTALL_FAILED_CONTAINER_ERROR";
6404 case INSTALL_FAILED_INVALID_INSTALL_LOCATION: return "INSTALL_FAILED_INVALID_INSTALL_LOCATION";
6405 case INSTALL_FAILED_MEDIA_UNAVAILABLE: return "INSTALL_FAILED_MEDIA_UNAVAILABLE";
6406 case INSTALL_FAILED_VERIFICATION_TIMEOUT: return "INSTALL_FAILED_VERIFICATION_TIMEOUT";
6407 case INSTALL_FAILED_VERIFICATION_FAILURE: return "INSTALL_FAILED_VERIFICATION_FAILURE";
6408 case INSTALL_FAILED_PACKAGE_CHANGED: return "INSTALL_FAILED_PACKAGE_CHANGED";
6409 case INSTALL_FAILED_UID_CHANGED: return "INSTALL_FAILED_UID_CHANGED";
6410 case INSTALL_FAILED_VERSION_DOWNGRADE: return "INSTALL_FAILED_VERSION_DOWNGRADE";
6411 case INSTALL_PARSE_FAILED_NOT_APK: return "INSTALL_PARSE_FAILED_NOT_APK";
6412 case INSTALL_PARSE_FAILED_BAD_MANIFEST: return "INSTALL_PARSE_FAILED_BAD_MANIFEST";
6413 case INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION: return "INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION";
6414 case INSTALL_PARSE_FAILED_NO_CERTIFICATES: return "INSTALL_PARSE_FAILED_NO_CERTIFICATES";
6415 case INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES: return "INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES";
6416 case INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING: return "INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING";
6417 case INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME: return "INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME";
6418 case INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID: return "INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID";
6419 case INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: return "INSTALL_PARSE_FAILED_MANIFEST_MALFORMED";
6420 case INSTALL_PARSE_FAILED_MANIFEST_EMPTY: return "INSTALL_PARSE_FAILED_MANIFEST_EMPTY";
6421 case INSTALL_FAILED_INTERNAL_ERROR: return "INSTALL_FAILED_INTERNAL_ERROR";
6422 case INSTALL_FAILED_USER_RESTRICTED: return "INSTALL_FAILED_USER_RESTRICTED";
6423 case INSTALL_FAILED_DUPLICATE_PERMISSION: return "INSTALL_FAILED_DUPLICATE_PERMISSION";
6424 case INSTALL_FAILED_NO_MATCHING_ABIS: return "INSTALL_FAILED_NO_MATCHING_ABIS";
Jeff Sharkeyf0600952014-08-07 17:31:53 -07006425 case INSTALL_FAILED_ABORTED: return "INSTALL_FAILED_ABORTED";
Todd Kennedy29cfa272018-09-26 10:25:24 -07006426 case INSTALL_FAILED_BAD_DEX_METADATA: return "INSTALL_FAILED_BAD_DEX_METADATA";
6427 case INSTALL_FAILED_MISSING_SPLIT: return "INSTALL_FAILED_MISSING_SPLIT";
Victor Hsiehc0cd7482018-10-04 10:10:54 -07006428 case INSTALL_FAILED_BAD_SIGNATURE: return "INSTALL_FAILED_BAD_SIGNATURE";
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07006429 default: return Integer.toString(status);
6430 }
6431 }
6432
6433 /** {@hide} */
Jeff Sharkeya0907432014-08-15 10:23:11 -07006434 public static int installStatusToPublicStatus(int status) {
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07006435 switch (status) {
Jeff Sharkeya0907432014-08-15 10:23:11 -07006436 case INSTALL_SUCCEEDED: return PackageInstaller.STATUS_SUCCESS;
6437 case INSTALL_FAILED_ALREADY_EXISTS: return PackageInstaller.STATUS_FAILURE_CONFLICT;
6438 case INSTALL_FAILED_INVALID_APK: return PackageInstaller.STATUS_FAILURE_INVALID;
6439 case INSTALL_FAILED_INVALID_URI: return PackageInstaller.STATUS_FAILURE_INVALID;
6440 case INSTALL_FAILED_INSUFFICIENT_STORAGE: return PackageInstaller.STATUS_FAILURE_STORAGE;
6441 case INSTALL_FAILED_DUPLICATE_PACKAGE: return PackageInstaller.STATUS_FAILURE_CONFLICT;
6442 case INSTALL_FAILED_NO_SHARED_USER: return PackageInstaller.STATUS_FAILURE_CONFLICT;
6443 case INSTALL_FAILED_UPDATE_INCOMPATIBLE: return PackageInstaller.STATUS_FAILURE_CONFLICT;
6444 case INSTALL_FAILED_SHARED_USER_INCOMPATIBLE: return PackageInstaller.STATUS_FAILURE_CONFLICT;
6445 case INSTALL_FAILED_MISSING_SHARED_LIBRARY: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
6446 case INSTALL_FAILED_REPLACE_COULDNT_DELETE: return PackageInstaller.STATUS_FAILURE_CONFLICT;
6447 case INSTALL_FAILED_DEXOPT: return PackageInstaller.STATUS_FAILURE_INVALID;
6448 case INSTALL_FAILED_OLDER_SDK: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
6449 case INSTALL_FAILED_CONFLICTING_PROVIDER: return PackageInstaller.STATUS_FAILURE_CONFLICT;
6450 case INSTALL_FAILED_NEWER_SDK: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
6451 case INSTALL_FAILED_TEST_ONLY: return PackageInstaller.STATUS_FAILURE_INVALID;
6452 case INSTALL_FAILED_CPU_ABI_INCOMPATIBLE: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
6453 case INSTALL_FAILED_MISSING_FEATURE: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
6454 case INSTALL_FAILED_CONTAINER_ERROR: return PackageInstaller.STATUS_FAILURE_STORAGE;
6455 case INSTALL_FAILED_INVALID_INSTALL_LOCATION: return PackageInstaller.STATUS_FAILURE_STORAGE;
6456 case INSTALL_FAILED_MEDIA_UNAVAILABLE: return PackageInstaller.STATUS_FAILURE_STORAGE;
6457 case INSTALL_FAILED_VERIFICATION_TIMEOUT: return PackageInstaller.STATUS_FAILURE_ABORTED;
6458 case INSTALL_FAILED_VERIFICATION_FAILURE: return PackageInstaller.STATUS_FAILURE_ABORTED;
6459 case INSTALL_FAILED_PACKAGE_CHANGED: return PackageInstaller.STATUS_FAILURE_INVALID;
6460 case INSTALL_FAILED_UID_CHANGED: return PackageInstaller.STATUS_FAILURE_INVALID;
6461 case INSTALL_FAILED_VERSION_DOWNGRADE: return PackageInstaller.STATUS_FAILURE_INVALID;
Svetoslavd9653702015-05-13 18:02:46 -07006462 case INSTALL_FAILED_PERMISSION_MODEL_DOWNGRADE: return PackageInstaller.STATUS_FAILURE_INVALID;
Jeff Sharkeya0907432014-08-15 10:23:11 -07006463 case INSTALL_PARSE_FAILED_NOT_APK: return PackageInstaller.STATUS_FAILURE_INVALID;
6464 case INSTALL_PARSE_FAILED_BAD_MANIFEST: return PackageInstaller.STATUS_FAILURE_INVALID;
6465 case INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION: return PackageInstaller.STATUS_FAILURE_INVALID;
6466 case INSTALL_PARSE_FAILED_NO_CERTIFICATES: return PackageInstaller.STATUS_FAILURE_INVALID;
6467 case INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES: return PackageInstaller.STATUS_FAILURE_INVALID;
6468 case INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING: return PackageInstaller.STATUS_FAILURE_INVALID;
6469 case INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME: return PackageInstaller.STATUS_FAILURE_INVALID;
6470 case INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID: return PackageInstaller.STATUS_FAILURE_INVALID;
6471 case INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: return PackageInstaller.STATUS_FAILURE_INVALID;
6472 case INSTALL_PARSE_FAILED_MANIFEST_EMPTY: return PackageInstaller.STATUS_FAILURE_INVALID;
Calin Juravle3fc56c32017-12-11 18:26:13 -08006473 case INSTALL_FAILED_BAD_DEX_METADATA: return PackageInstaller.STATUS_FAILURE_INVALID;
Victor Hsiehc0cd7482018-10-04 10:10:54 -07006474 case INSTALL_FAILED_BAD_SIGNATURE: return PackageInstaller.STATUS_FAILURE_INVALID;
Jeff Sharkeya0907432014-08-15 10:23:11 -07006475 case INSTALL_FAILED_INTERNAL_ERROR: return PackageInstaller.STATUS_FAILURE;
6476 case INSTALL_FAILED_USER_RESTRICTED: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
6477 case INSTALL_FAILED_DUPLICATE_PERMISSION: return PackageInstaller.STATUS_FAILURE_CONFLICT;
6478 case INSTALL_FAILED_NO_MATCHING_ABIS: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
6479 case INSTALL_FAILED_ABORTED: return PackageInstaller.STATUS_FAILURE_ABORTED;
Todd Kennedy29cfa272018-09-26 10:25:24 -07006480 case INSTALL_FAILED_MISSING_SPLIT: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
Jeff Sharkeya0907432014-08-15 10:23:11 -07006481 default: return PackageInstaller.STATUS_FAILURE;
6482 }
6483 }
6484
6485 /** {@hide} */
6486 public static String deleteStatusToString(int status, String msg) {
6487 final String str = deleteStatusToString(status);
6488 if (msg != null) {
6489 return str + ": " + msg;
6490 } else {
6491 return str;
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07006492 }
6493 }
6494
6495 /** {@hide} */
Mathew Inwood5c0d3542018-08-14 13:54:31 +01006496 @UnsupportedAppUsage
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07006497 public static String deleteStatusToString(int status) {
6498 switch (status) {
6499 case DELETE_SUCCEEDED: return "DELETE_SUCCEEDED";
6500 case DELETE_FAILED_INTERNAL_ERROR: return "DELETE_FAILED_INTERNAL_ERROR";
6501 case DELETE_FAILED_DEVICE_POLICY_MANAGER: return "DELETE_FAILED_DEVICE_POLICY_MANAGER";
6502 case DELETE_FAILED_USER_RESTRICTED: return "DELETE_FAILED_USER_RESTRICTED";
6503 case DELETE_FAILED_OWNER_BLOCKED: return "DELETE_FAILED_OWNER_BLOCKED";
Jeff Sharkeyf0600952014-08-07 17:31:53 -07006504 case DELETE_FAILED_ABORTED: return "DELETE_FAILED_ABORTED";
Svet Ganov67882122016-12-11 16:36:34 -08006505 case DELETE_FAILED_USED_SHARED_LIBRARY: return "DELETE_FAILED_USED_SHARED_LIBRARY";
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07006506 default: return Integer.toString(status);
6507 }
6508 }
Jeff Sharkeyf0600952014-08-07 17:31:53 -07006509
6510 /** {@hide} */
Jeff Sharkeya0907432014-08-15 10:23:11 -07006511 public static int deleteStatusToPublicStatus(int status) {
Jeff Sharkeyf0600952014-08-07 17:31:53 -07006512 switch (status) {
Jeff Sharkeya0907432014-08-15 10:23:11 -07006513 case DELETE_SUCCEEDED: return PackageInstaller.STATUS_SUCCESS;
6514 case DELETE_FAILED_INTERNAL_ERROR: return PackageInstaller.STATUS_FAILURE;
6515 case DELETE_FAILED_DEVICE_POLICY_MANAGER: return PackageInstaller.STATUS_FAILURE_BLOCKED;
6516 case DELETE_FAILED_USER_RESTRICTED: return PackageInstaller.STATUS_FAILURE_BLOCKED;
6517 case DELETE_FAILED_OWNER_BLOCKED: return PackageInstaller.STATUS_FAILURE_BLOCKED;
6518 case DELETE_FAILED_ABORTED: return PackageInstaller.STATUS_FAILURE_ABORTED;
Svet Ganov67882122016-12-11 16:36:34 -08006519 case DELETE_FAILED_USED_SHARED_LIBRARY: return PackageInstaller.STATUS_FAILURE_CONFLICT;
Jeff Sharkeya0907432014-08-15 10:23:11 -07006520 default: return PackageInstaller.STATUS_FAILURE;
Jeff Sharkeyf0600952014-08-07 17:31:53 -07006521 }
6522 }
Jeff Sharkey6c0b9da2014-08-07 22:07:11 -07006523
6524 /** {@hide} */
Svet Ganov77ab6a82015-07-03 12:03:02 -07006525 public static String permissionFlagToString(int flag) {
6526 switch (flag) {
Svetoslav4a5f4a22015-07-07 18:18:15 -07006527 case FLAG_PERMISSION_GRANTED_BY_DEFAULT: return "GRANTED_BY_DEFAULT";
6528 case FLAG_PERMISSION_POLICY_FIXED: return "POLICY_FIXED";
6529 case FLAG_PERMISSION_SYSTEM_FIXED: return "SYSTEM_FIXED";
6530 case FLAG_PERMISSION_USER_SET: return "USER_SET";
6531 case FLAG_PERMISSION_REVOKE_ON_UPGRADE: return "REVOKE_ON_UPGRADE";
6532 case FLAG_PERMISSION_USER_FIXED: return "USER_FIXED";
Svet Ganov9c165d72015-12-01 19:52:26 -08006533 case FLAG_PERMISSION_REVIEW_REQUIRED: return "REVIEW_REQUIRED";
Philip P. Moltmann17f65af2018-10-18 15:32:29 -07006534 case FLAG_PERMISSION_REVOKE_WHEN_REQUESTED: return "REVOKE_WHEN_REQUESTED";
Svet Ganov77ab6a82015-07-03 12:03:02 -07006535 default: return Integer.toString(flag);
6536 }
6537 }
6538
6539 /** {@hide} */
Jeff Sharkey6c0b9da2014-08-07 22:07:11 -07006540 public static class LegacyPackageDeleteObserver extends PackageDeleteObserver {
6541 private final IPackageDeleteObserver mLegacy;
6542
6543 public LegacyPackageDeleteObserver(IPackageDeleteObserver legacy) {
6544 mLegacy = legacy;
6545 }
6546
6547 @Override
6548 public void onPackageDeleted(String basePackageName, int returnCode, String msg) {
6549 if (mLegacy == null) return;
6550 try {
6551 mLegacy.packageDeleted(basePackageName, returnCode);
6552 } catch (RemoteException ignored) {
6553 }
6554 }
6555 }
Bartosz Fabianowskia34f53f2017-01-11 18:08:47 +01006556
6557 /**
Jeff Sharkey4347f812017-04-21 12:08:39 -06006558 * Return the install reason that was recorded when a package was first
6559 * installed for a specific user. Requesting the install reason for another
6560 * user will require the permission INTERACT_ACROSS_USERS_FULL.
Bartosz Fabianowskia34f53f2017-01-11 18:08:47 +01006561 *
6562 * @param packageName The package for which to retrieve the install reason
6563 * @param user The user for whom to retrieve the install reason
Jeff Sharkey4347f812017-04-21 12:08:39 -06006564 * @return The install reason. If the package is not installed for the given
6565 * user, {@code INSTALL_REASON_UNKNOWN} is returned.
Bartosz Fabianowskia34f53f2017-01-11 18:08:47 +01006566 * @hide
6567 */
6568 @TestApi
6569 public abstract @InstallReason int getInstallReason(String packageName,
6570 @NonNull UserHandle user);
Suprabh Shuklaaef25132017-01-23 18:09:03 -08006571
6572 /**
6573 * Checks whether the calling package is allowed to request package installs through package
Suprabh Shukla57528472017-04-14 19:22:45 -07006574 * installer. Apps are encouraged to call this API before launching the package installer via
Suprabh Shuklaaef25132017-01-23 18:09:03 -08006575 * intent {@link android.content.Intent#ACTION_INSTALL_PACKAGE}. Starting from Android O, the
6576 * user can explicitly choose what external sources they trust to install apps on the device.
Suprabh Shukla57528472017-04-14 19:22:45 -07006577 * If this API returns false, the install request will be blocked by the package installer and
Suprabh Shuklaaef25132017-01-23 18:09:03 -08006578 * a dialog will be shown to the user with an option to launch settings to change their
6579 * preference. An application must target Android O or higher and declare permission
Suprabh Shukla57528472017-04-14 19:22:45 -07006580 * {@link android.Manifest.permission#REQUEST_INSTALL_PACKAGES} in order to use this API.
Suprabh Shuklaaef25132017-01-23 18:09:03 -08006581 *
6582 * @return true if the calling package is trusted by the user to request install packages on
6583 * the device, false otherwise.
Suprabh Shukla57528472017-04-14 19:22:45 -07006584 * @see android.content.Intent#ACTION_INSTALL_PACKAGE
6585 * @see android.provider.Settings#ACTION_MANAGE_UNKNOWN_APP_SOURCES
Suprabh Shuklaaef25132017-01-23 18:09:03 -08006586 */
6587 public abstract boolean canRequestPackageInstalls();
Chad Brubakeraa49cb82017-03-24 15:53:09 -07006588
6589 /**
6590 * Return the {@link ComponentName} of the activity providing Settings for the Instant App
6591 * resolver.
6592 *
Todd Kennedy801e6592017-04-12 14:10:12 -07006593 * @see {@link android.content.Intent#ACTION_INSTANT_APP_RESOLVER_SETTINGS}
Chad Brubakeraa49cb82017-03-24 15:53:09 -07006594 * @hide
6595 */
6596 @SystemApi
6597 public abstract ComponentName getInstantAppResolverSettingsComponent();
Todd Kennedy801e6592017-04-12 14:10:12 -07006598
6599 /**
6600 * Return the {@link ComponentName} of the activity responsible for installing instant
6601 * applications.
6602 *
6603 * @see {@link android.content.Intent#ACTION_INSTALL_INSTANT_APP_PACKAGE}
6604 * @hide
6605 */
6606 @SystemApi
6607 public abstract ComponentName getInstantAppInstallerComponent();
Chad Brubaker0d277a72017-04-12 16:56:53 -07006608
6609 /**
6610 * Return the Android Id for a given Instant App.
6611 *
6612 * @see {@link android.provider.Settings.Secure#ANDROID_ID}
6613 * @hide
6614 */
6615 public abstract String getInstantAppAndroidId(String packageName, @NonNull UserHandle user);
Calin Juravle3d2af7f2017-04-19 19:56:21 -07006616
6617 /**
6618 * Callback use to notify the callers of module registration that the operation
6619 * has finished.
6620 *
6621 * @hide
6622 */
Jeff Sharkey90396362017-06-12 16:26:53 -06006623 @SystemApi
Calin Juravle3d2af7f2017-04-19 19:56:21 -07006624 public static abstract class DexModuleRegisterCallback {
6625 public abstract void onDexModuleRegistered(String dexModulePath, boolean success,
6626 String message);
6627 }
6628
6629 /**
6630 * Register an application dex module with the package manager.
6631 * The package manager will keep track of the given module for future optimizations.
6632 *
6633 * Dex module optimizations will disable the classpath checking at runtime. The client bares
6634 * the responsibility to ensure that the static assumptions on classes in the optimized code
6635 * hold at runtime (e.g. there's no duplicate classes in the classpath).
6636 *
6637 * Note that the package manager already keeps track of dex modules loaded with
6638 * {@link dalvik.system.DexClassLoader} and {@link dalvik.system.PathClassLoader}.
6639 * This can be called for an eager registration.
6640 *
6641 * The call might take a while and the results will be posted on the main thread, using
6642 * the given callback.
6643 *
6644 * If the module is intended to be shared with other apps, make sure that the file
6645 * permissions allow for it.
6646 * If at registration time the permissions allow for others to read it, the module would
6647 * be marked as a shared module which might undergo a different optimization strategy.
6648 * (usually shared modules will generated larger optimizations artifacts,
6649 * taking more disk space).
6650 *
6651 * @param dexModulePath the absolute path of the dex module.
6652 * @param callback if not null, {@link DexModuleRegisterCallback#onDexModuleRegistered} will
6653 * be called once the registration finishes.
6654 *
6655 * @hide
6656 */
Jeff Sharkey90396362017-06-12 16:26:53 -06006657 @SystemApi
Calin Juravle3d2af7f2017-04-19 19:56:21 -07006658 public abstract void registerDexModule(String dexModulePath,
6659 @Nullable DexModuleRegisterCallback callback);
Calin Juravle45f8b292017-11-07 18:49:43 -08006660
6661 /**
6662 * Returns the {@link ArtManager} associated with this package manager.
6663 *
6664 * @hide
6665 */
6666 @SystemApi
6667 public @NonNull ArtManager getArtManager() {
6668 throw new UnsupportedOperationException("getArtManager not implemented in subclass");
6669 }
Ben Gruver1ab3d6e2017-12-07 13:45:08 -08006670
6671 /**
6672 * Sets or clears the harmful app warning details for the given app.
6673 *
6674 * When set, any attempt to launch an activity in this package will be intercepted and a
6675 * warning dialog will be shown to the user instead, with the given warning. The user
6676 * will have the option to proceed with the activity launch, or to uninstall the application.
6677 *
6678 * @param packageName The full name of the package to warn on.
6679 * @param warning A warning string to display to the user describing the threat posed by the
6680 * application, or null to clear the warning.
6681 *
6682 * @hide
6683 */
6684 @RequiresPermission(Manifest.permission.SET_HARMFUL_APP_WARNINGS)
6685 @SystemApi
6686 public void setHarmfulAppWarning(@NonNull String packageName, @Nullable CharSequence warning) {
6687 throw new UnsupportedOperationException("setHarmfulAppWarning not implemented in subclass");
6688 }
6689
6690 /**
6691 * Returns the harmful app warning string for the given app, or null if there is none set.
6692 *
6693 * @param packageName The full name of the desired package.
6694 *
6695 * @hide
6696 */
6697 @RequiresPermission(Manifest.permission.SET_HARMFUL_APP_WARNINGS)
6698 @Nullable
6699 @SystemApi
6700 public CharSequence getHarmfulAppWarning(@NonNull String packageName) {
6701 throw new UnsupportedOperationException("getHarmfulAppWarning not implemented in subclass");
6702 }
Daniel Cashman5cdda342018-01-19 07:22:52 -08006703
6704 /** @hide */
6705 @IntDef(prefix = { "CERT_INPUT_" }, value = {
6706 CERT_INPUT_RAW_X509,
6707 CERT_INPUT_SHA256
6708 })
6709 @Retention(RetentionPolicy.SOURCE)
6710 public @interface CertificateInputType {}
6711
6712 /**
6713 * Certificate input bytes: the input bytes represent an encoded X.509 Certificate which could
6714 * be generated using an {@code CertificateFactory}
6715 */
6716 public static final int CERT_INPUT_RAW_X509 = 0;
6717
6718 /**
6719 * Certificate input bytes: the input bytes represent the SHA256 output of an encoded X.509
6720 * Certificate.
6721 */
6722 public static final int CERT_INPUT_SHA256 = 1;
6723
6724 /**
6725 * Searches the set of signing certificates by which the given package has proven to have been
6726 * signed. This should be used instead of {@code getPackageInfo} with {@code GET_SIGNATURES}
6727 * since it takes into account the possibility of signing certificate rotation, except in the
6728 * case of packages that are signed by multiple certificates, for which signing certificate
Daniel Cashmanbd8ce382018-04-02 16:59:19 -07006729 * rotation is not supported. This method is analogous to using {@code getPackageInfo} with
6730 * {@code GET_SIGNING_CERTIFICATES} and then searching through the resulting {@code
Dan Cashmane942b912018-04-16 14:41:24 -07006731 * signingInfo} field to see if the desired certificate is present.
Daniel Cashman5cdda342018-01-19 07:22:52 -08006732 *
6733 * @param packageName package whose signing certificates to check
6734 * @param certificate signing certificate for which to search
6735 * @param type representation of the {@code certificate}
6736 * @return true if this package was or is signed by exactly the certificate {@code certificate}
6737 */
6738 public boolean hasSigningCertificate(
6739 String packageName, byte[] certificate, @CertificateInputType int type) {
6740 throw new UnsupportedOperationException(
6741 "hasSigningCertificate not implemented in subclass");
6742 }
6743
6744 /**
Daniel Cashmanbd8ce382018-04-02 16:59:19 -07006745 * Searches the set of signing certificates by which the package(s) for the given uid has proven
6746 * to have been signed. For multiple packages sharing the same uid, this will return the
6747 * signing certificates found in the signing history of the "newest" package, where "newest"
6748 * indicates the package with the newest signing certificate in the shared uid group. This
6749 * method should be used instead of {@code getPackageInfo} with {@code GET_SIGNATURES}
Daniel Cashman5cdda342018-01-19 07:22:52 -08006750 * since it takes into account the possibility of signing certificate rotation, except in the
6751 * case of packages that are signed by multiple certificates, for which signing certificate
Daniel Cashmanbd8ce382018-04-02 16:59:19 -07006752 * rotation is not supported. This method is analogous to using {@code getPackagesForUid}
6753 * followed by {@code getPackageInfo} with {@code GET_SIGNING_CERTIFICATES}, selecting the
6754 * {@code PackageInfo} of the newest-signed bpackage , and finally searching through the
Dan Cashmane942b912018-04-16 14:41:24 -07006755 * resulting {@code signingInfo} field to see if the desired certificate is there.
Daniel Cashman5cdda342018-01-19 07:22:52 -08006756 *
Daniel Cashmanbd8ce382018-04-02 16:59:19 -07006757 * @param uid uid whose signing certificates to check
Daniel Cashman5cdda342018-01-19 07:22:52 -08006758 * @param certificate signing certificate for which to search
6759 * @param type representation of the {@code certificate}
6760 * @return true if this package was or is signed by exactly the certificate {@code certificate}
6761 */
6762 public boolean hasSigningCertificate(
6763 int uid, byte[] certificate, @CertificateInputType int type) {
6764 throw new UnsupportedOperationException(
6765 "hasSigningCertificate not implemented in subclass");
6766 }
Makoto Onuki700feef2018-02-15 10:59:41 -08006767
6768 /**
6769 * @return the system defined text classifier package name, or null if there's none.
6770 *
6771 * @hide
6772 */
6773 public String getSystemTextClassifierPackageName() {
6774 throw new UnsupportedOperationException(
6775 "getSystemTextClassifierPackageName not implemented in subclass");
6776 }
Benjamin Franz7cc9a812018-03-22 10:11:29 +00006777
6778 /**
Varun Shah5f303652018-11-16 18:11:19 -08006779 * @return the wellbeing app package name, or null if it's not defined by the OEM.
6780 *
6781 * @hide
6782 */
Varun Shahdad9b862018-12-10 20:17:31 -08006783 @TestApi
Varun Shah5f303652018-11-16 18:11:19 -08006784 public String getWellbeingPackageName() {
6785 throw new UnsupportedOperationException(
6786 "getWellbeingPackageName not implemented in subclass");
6787 }
6788
6789 /**
George Hodulikcd7695d2019-01-29 18:17:05 -08006790 * @return the system defined app predictor package name, or null if there's none.
6791 *
6792 * @hide
6793 */
6794 public String getAppPredictionServicePackageName() {
6795 throw new UnsupportedOperationException(
6796 "getAppPredictionServicePackageName not implemented in subclass");
6797 }
6798
6799 /**
Nadav Bar6d79ab72019-01-10 10:52:11 +02006800 * @return the system defined content capture service package name, or null if there's none.
6801 *
6802 * @hide
6803 */
6804 public String getContentCaptureServicePackageName() {
6805 throw new UnsupportedOperationException(
6806 "getContentCaptureServicePackageName not implemented in subclass");
6807 }
6808
6809 /**
Joe Onorato5a15b552018-12-18 10:40:04 -08006810 * @return the incident report approver app package name, or null if it's not defined
6811 * by the OEM.
6812 *
6813 * @hide
6814 */
6815 @SystemApi
6816 @TestApi
6817 public String getIncidentReportApproverPackageName() {
6818 throw new UnsupportedOperationException(
6819 "getIncidentReportApproverPackageName not implemented in subclass");
6820 }
6821
6822 /**
Benjamin Franz7cc9a812018-03-22 10:11:29 +00006823 * @return whether a given package's state is protected, e.g. package cannot be disabled,
6824 * suspended, hidden or force stopped.
6825 *
6826 * @hide
6827 */
6828 public boolean isPackageStateProtected(String packageName, int userId) {
6829 throw new UnsupportedOperationException(
6830 "isPackageStateProtected not implemented in subclass");
6831 }
6832
MÃ¥rten Kongstadfd20b832018-10-26 15:36:20 +02006833 /**
6834 * Notify to the rest of the system that a new device configuration has
6835 * been prepared and that it is time to refresh caches.
6836 *
6837 * @see android.content.Intent#ACTION_DEVICE_CUSTOMIZATION_READY
6838 *
6839 * @hide
6840 */
6841 @SystemApi
6842 public void sendDeviceCustomizationReadyBroadcast() {
6843 throw new UnsupportedOperationException(
6844 "sendDeviceCustomizationReadyBroadcast not implemented in subclass");
6845 }
6846
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08006847}