blob: 35db667922caeda136c1cefa239d538bfd7c9e86 [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 Inwood1c77a112018-08-14 14:06:26 +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;
Jeff Sharkey6c0b9da2014-08-07 22:07:11 -070036import android.app.PackageDeleteObserver;
Christopher Tatef1977b42014-03-24 16:25:51 -070037import android.app.PackageInstallObserver;
Amith Yamasani1d653272014-09-11 17:56:05 -070038import android.app.admin.DevicePolicyManager;
Jeff Sharkey60f95aa2017-03-08 13:57:15 -070039import android.app.usage.StorageStatsManager;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080040import android.content.ComponentName;
41import android.content.Context;
42import android.content.Intent;
43import android.content.IntentFilter;
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -070044import android.content.IntentSender;
Jeff Sharkeyc4858a22014-06-16 10:51:20 -070045import android.content.pm.PackageParser.PackageParserException;
Calin Juravle45f8b292017-11-07 18:49:43 -080046import android.content.pm.dex.ArtManager;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080047import android.content.res.Resources;
48import android.content.res.XmlResourceParser;
Svetoslavc7d62f02014-09-04 15:39:54 -070049import android.graphics.Rect;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080050import android.graphics.drawable.Drawable;
Peter Qiu3d615e42017-08-07 20:13:32 +000051import android.net.wifi.WifiManager;
Jeff Sharkey6f4b2a32017-03-21 14:13:41 -060052import android.os.Build;
Jeff Sharkeybb580672014-07-10 12:10:25 -070053import android.os.Bundle;
Jeff Sharkey620b32b2015-04-23 19:36:02 -070054import android.os.Handler;
Suprabh Shukla021b57a2018-03-08 18:21:50 -080055import android.os.PersistableBundle;
Jeff Sharkey6c0b9da2014-08-07 22:07:11 -070056import android.os.RemoteException;
Dianne Hackborn0c380492012-08-20 17:23:30 -070057import android.os.UserHandle;
Jeff Sharkey8a372a02016-03-16 16:25:45 -060058import android.os.UserManager;
Jeff Sharkey683bcd32017-03-18 17:54:51 -060059import android.os.storage.StorageManager;
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -070060import android.os.storage.VolumeInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080061import android.util.AndroidException;
Jeff Sharkeybd940222016-01-08 11:07:13 -070062import android.util.Log;
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -070063
Svetoslavc6d1c342015-02-26 14:44:43 -080064import com.android.internal.util.ArrayUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080065
Jeff Sharkey6f4b2a32017-03-21 14:13:41 -060066import dalvik.system.VMRuntime;
67
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080068import java.io.File;
Tor Norbyed9273d62013-05-30 15:59:53 -070069import java.lang.annotation.Retention;
70import java.lang.annotation.RetentionPolicy;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080071import java.util.List;
Suprabh Shukla3e03ab92018-04-11 16:03:49 -070072import java.util.Locale;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080073
74/**
75 * Class for retrieving various kinds of information related to the application
76 * packages that are currently installed on the device.
77 *
78 * You can find this class through {@link Context#getPackageManager}.
79 */
80public abstract class PackageManager {
Jeff Sharkeybd940222016-01-08 11:07:13 -070081 private static final String TAG = "PackageManager";
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080082
Jeff Sharkeye4697132016-02-06 19:46:15 -070083 /** {@hide} */
Jeff Sharkey8a372a02016-03-16 16:25:45 -060084 public static final boolean APPLY_DEFAULT_TO_DEVICE_PROTECTED_STORAGE = true;
Jeff Sharkeye4697132016-02-06 19:46:15 -070085
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080086 /**
87 * This exception is thrown when a given package, application, or component
kmccormick30498b42013-03-27 17:39:17 -070088 * name cannot be found.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080089 */
90 public static class NameNotFoundException extends AndroidException {
91 public NameNotFoundException() {
92 }
93
94 public NameNotFoundException(String name) {
95 super(name);
96 }
97 }
98
99 /**
Svetoslavf7c06eb2015-06-10 18:43:22 -0700100 * Listener for changes in permissions granted to a UID.
101 *
102 * @hide
103 */
104 @SystemApi
105 public interface OnPermissionsChangedListener {
106
107 /**
108 * Called when the permissions for a UID change.
109 * @param uid The UID with a change.
110 */
111 public void onPermissionsChanged(int uid);
112 }
113
114 /**
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700115 * As a guiding principle:
116 * <p>
117 * {@code GET_} flags are used to request additional data that may have been
118 * elided to save wire space.
119 * <p>
120 * {@code MATCH_} flags are used to include components or packages that
121 * would have otherwise been omitted from a result set by current system
122 * state.
123 */
124
125 /** @hide */
Jeff Sharkey4347f812017-04-21 12:08:39 -0600126 @IntDef(flag = true, prefix = { "GET_", "MATCH_" }, value = {
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700127 GET_ACTIVITIES,
Todd Kennedy6b9bfa12016-01-08 13:44:51 -0800128 GET_CONFIGURATIONS,
129 GET_GIDS,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700130 GET_INSTRUMENTATION,
131 GET_INTENT_FILTERS,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700132 GET_META_DATA,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700133 GET_PERMISSIONS,
Todd Kennedy6b9bfa12016-01-08 13:44:51 -0800134 GET_PROVIDERS,
135 GET_RECEIVERS,
136 GET_SERVICES,
137 GET_SHARED_LIBRARY_FILES,
138 GET_SIGNATURES,
Daniel Cashman5cdda342018-01-19 07:22:52 -0800139 GET_SIGNING_CERTIFICATES,
Todd Kennedy6b9bfa12016-01-08 13:44:51 -0800140 GET_URI_PERMISSION_PATTERNS,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700141 MATCH_UNINSTALLED_PACKAGES,
142 MATCH_DISABLED_COMPONENTS,
143 MATCH_DISABLED_UNTIL_USED_COMPONENTS,
Jeff Sharkeyc5967e92016-01-07 18:50:29 -0700144 MATCH_SYSTEM_ONLY,
Todd Kennedyd6ee0ba2016-03-31 15:11:11 -0700145 MATCH_FACTORY_ONLY,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700146 MATCH_DEBUG_TRIAGED_MISSING,
Todd Kennedy9c9fdf22017-03-06 10:58:27 -0800147 MATCH_INSTANT,
Todd Kennedy1f397f42016-06-28 12:14:11 -0700148 GET_DISABLED_COMPONENTS,
149 GET_DISABLED_UNTIL_USED_COMPONENTS,
150 GET_UNINSTALLED_PACKAGES,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700151 })
152 @Retention(RetentionPolicy.SOURCE)
153 public @interface PackageInfoFlags {}
154
155 /** @hide */
Jeff Sharkey4347f812017-04-21 12:08:39 -0600156 @IntDef(flag = true, prefix = { "GET_", "MATCH_" }, value = {
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700157 GET_META_DATA,
158 GET_SHARED_LIBRARY_FILES,
159 MATCH_UNINSTALLED_PACKAGES,
160 MATCH_SYSTEM_ONLY,
161 MATCH_DEBUG_TRIAGED_MISSING,
Todd Kennedy24522022017-03-27 16:32:20 -0700162 MATCH_DISABLED_COMPONENTS,
Todd Kennedy5a32c6c2016-07-07 14:29:06 -0700163 MATCH_DISABLED_UNTIL_USED_COMPONENTS,
Todd Kennedy9c9fdf22017-03-06 10:58:27 -0800164 MATCH_INSTANT,
Svet Ganov9e779772017-05-11 14:36:50 -0700165 MATCH_STATIC_SHARED_LIBRARIES,
Todd Kennedy5a32c6c2016-07-07 14:29:06 -0700166 GET_DISABLED_UNTIL_USED_COMPONENTS,
Todd Kennedy1f397f42016-06-28 12:14:11 -0700167 GET_UNINSTALLED_PACKAGES,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700168 })
169 @Retention(RetentionPolicy.SOURCE)
170 public @interface ApplicationInfoFlags {}
171
172 /** @hide */
Jeff Sharkey4347f812017-04-21 12:08:39 -0600173 @IntDef(flag = true, prefix = { "GET_", "MATCH_" }, value = {
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700174 GET_META_DATA,
175 GET_SHARED_LIBRARY_FILES,
Todd Kennedy6b9bfa12016-01-08 13:44:51 -0800176 MATCH_ALL,
177 MATCH_DEBUG_TRIAGED_MISSING,
178 MATCH_DEFAULT_ONLY,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700179 MATCH_DISABLED_COMPONENTS,
180 MATCH_DISABLED_UNTIL_USED_COMPONENTS,
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600181 MATCH_DIRECT_BOOT_AWARE,
182 MATCH_DIRECT_BOOT_UNAWARE,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700183 MATCH_SYSTEM_ONLY,
Todd Kennedy6b9bfa12016-01-08 13:44:51 -0800184 MATCH_UNINSTALLED_PACKAGES,
Todd Kennedy9c9fdf22017-03-06 10:58:27 -0800185 MATCH_INSTANT,
Svet Ganov9e779772017-05-11 14:36:50 -0700186 MATCH_STATIC_SHARED_LIBRARIES,
Todd Kennedy1f397f42016-06-28 12:14:11 -0700187 GET_DISABLED_COMPONENTS,
188 GET_DISABLED_UNTIL_USED_COMPONENTS,
189 GET_UNINSTALLED_PACKAGES,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700190 })
191 @Retention(RetentionPolicy.SOURCE)
192 public @interface ComponentInfoFlags {}
193
194 /** @hide */
Jeff Sharkey4347f812017-04-21 12:08:39 -0600195 @IntDef(flag = true, prefix = { "GET_", "MATCH_" }, value = {
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700196 GET_META_DATA,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700197 GET_RESOLVED_FILTER,
Todd Kennedy6b9bfa12016-01-08 13:44:51 -0800198 GET_SHARED_LIBRARY_FILES,
199 MATCH_ALL,
200 MATCH_DEBUG_TRIAGED_MISSING,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700201 MATCH_DISABLED_COMPONENTS,
202 MATCH_DISABLED_UNTIL_USED_COMPONENTS,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700203 MATCH_DEFAULT_ONLY,
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600204 MATCH_DIRECT_BOOT_AWARE,
205 MATCH_DIRECT_BOOT_UNAWARE,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700206 MATCH_SYSTEM_ONLY,
Todd Kennedy6b9bfa12016-01-08 13:44:51 -0800207 MATCH_UNINSTALLED_PACKAGES,
Todd Kennedy9c9fdf22017-03-06 10:58:27 -0800208 MATCH_INSTANT,
Todd Kennedy1f397f42016-06-28 12:14:11 -0700209 GET_DISABLED_COMPONENTS,
210 GET_DISABLED_UNTIL_USED_COMPONENTS,
211 GET_UNINSTALLED_PACKAGES,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700212 })
213 @Retention(RetentionPolicy.SOURCE)
214 public @interface ResolveInfoFlags {}
215
216 /** @hide */
Jeff Sharkey4347f812017-04-21 12:08:39 -0600217 @IntDef(flag = true, prefix = { "GET_", "MATCH_" }, value = {
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700218 GET_META_DATA,
219 })
220 @Retention(RetentionPolicy.SOURCE)
221 public @interface PermissionInfoFlags {}
222
223 /** @hide */
Jeff Sharkey4347f812017-04-21 12:08:39 -0600224 @IntDef(flag = true, prefix = { "GET_", "MATCH_" }, value = {
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700225 GET_META_DATA,
226 })
227 @Retention(RetentionPolicy.SOURCE)
228 public @interface PermissionGroupInfoFlags {}
229
230 /** @hide */
Jeff Sharkey4347f812017-04-21 12:08:39 -0600231 @IntDef(flag = true, prefix = { "GET_", "MATCH_" }, value = {
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700232 GET_META_DATA,
233 })
234 @Retention(RetentionPolicy.SOURCE)
235 public @interface InstrumentationInfoFlags {}
236
237 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800238 * {@link PackageInfo} flag: return information about
239 * activities in the package in {@link PackageInfo#activities}.
240 */
241 public static final int GET_ACTIVITIES = 0x00000001;
242
243 /**
244 * {@link PackageInfo} flag: return information about
245 * intent receivers in the package in
246 * {@link PackageInfo#receivers}.
247 */
248 public static final int GET_RECEIVERS = 0x00000002;
249
250 /**
251 * {@link PackageInfo} flag: return information about
252 * services in the package in {@link PackageInfo#services}.
253 */
254 public static final int GET_SERVICES = 0x00000004;
255
256 /**
257 * {@link PackageInfo} flag: return information about
258 * content providers in the package in
259 * {@link PackageInfo#providers}.
260 */
261 public static final int GET_PROVIDERS = 0x00000008;
262
263 /**
264 * {@link PackageInfo} flag: return information about
265 * instrumentation in the package in
266 * {@link PackageInfo#instrumentation}.
267 */
268 public static final int GET_INSTRUMENTATION = 0x00000010;
269
270 /**
271 * {@link PackageInfo} flag: return information about the
272 * intent filters supported by the activity.
273 */
274 public static final int GET_INTENT_FILTERS = 0x00000020;
275
276 /**
277 * {@link PackageInfo} flag: return information about the
278 * signatures included in the package.
Daniel Cashman5cdda342018-01-19 07:22:52 -0800279 *
280 * @deprecated use {@code GET_SIGNING_CERTIFICATES} instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800281 */
Daniel Cashman5cdda342018-01-19 07:22:52 -0800282 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800283 public static final int GET_SIGNATURES = 0x00000040;
284
285 /**
286 * {@link ResolveInfo} flag: return the IntentFilter that
287 * was matched for a particular ResolveInfo in
288 * {@link ResolveInfo#filter}.
289 */
290 public static final int GET_RESOLVED_FILTER = 0x00000040;
291
292 /**
293 * {@link ComponentInfo} flag: return the {@link ComponentInfo#metaData}
294 * data {@link android.os.Bundle}s that are associated with a component.
295 * This applies for any API returning a ComponentInfo subclass.
296 */
297 public static final int GET_META_DATA = 0x00000080;
298
299 /**
300 * {@link PackageInfo} flag: return the
301 * {@link PackageInfo#gids group ids} that are associated with an
302 * application.
Ken Wakasaf76a50c2012-03-09 19:56:35 +0900303 * This applies for any API returning a PackageInfo class, either
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800304 * directly or nested inside of another.
305 */
306 public static final int GET_GIDS = 0x00000100;
307
308 /**
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700309 * @deprecated replaced with {@link #MATCH_DISABLED_COMPONENTS}
310 */
311 @Deprecated
312 public static final int GET_DISABLED_COMPONENTS = 0x00000200;
313
314 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800315 * {@link PackageInfo} flag: include disabled components in the returned info.
316 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700317 public static final int MATCH_DISABLED_COMPONENTS = 0x00000200;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800318
319 /**
320 * {@link ApplicationInfo} flag: return the
321 * {@link ApplicationInfo#sharedLibraryFiles paths to the shared libraries}
322 * that are associated with an application.
323 * This applies for any API returning an ApplicationInfo class, either
324 * directly or nested inside of another.
325 */
326 public static final int GET_SHARED_LIBRARY_FILES = 0x00000400;
327
328 /**
329 * {@link ProviderInfo} flag: return the
330 * {@link ProviderInfo#uriPermissionPatterns URI permission patterns}
331 * that are associated with a content provider.
Ken Wakasaf76a50c2012-03-09 19:56:35 +0900332 * This applies for any API returning a ProviderInfo class, either
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800333 * directly or nested inside of another.
334 */
335 public static final int GET_URI_PERMISSION_PATTERNS = 0x00000800;
336 /**
337 * {@link PackageInfo} flag: return information about
338 * permissions in the package in
339 * {@link PackageInfo#permissions}.
340 */
341 public static final int GET_PERMISSIONS = 0x00001000;
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700342
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800343 /**
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700344 * @deprecated replaced with {@link #MATCH_UNINSTALLED_PACKAGES}
345 */
346 @Deprecated
347 public static final int GET_UNINSTALLED_PACKAGES = 0x00002000;
348
349 /**
Kenny Root685f4902011-11-03 10:13:29 -0700350 * Flag parameter to retrieve some information about all applications (even
351 * uninstalled ones) which have data directories. This state could have
352 * resulted if applications have been deleted with flag
353 * {@code DONT_DELETE_DATA} with a possibility of being replaced or
354 * reinstalled in future.
355 * <p>
356 * Note: this flag may cause less information about currently installed
357 * applications to be returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800358 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700359 public static final int MATCH_UNINSTALLED_PACKAGES = 0x00002000;
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700360
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800361 /**
362 * {@link PackageInfo} flag: return information about
Dianne Hackborn49237342009-08-27 20:08:01 -0700363 * hardware preferences in
Adam Lesinskid3edfde2014-08-08 17:32:44 -0700364 * {@link PackageInfo#configPreferences PackageInfo.configPreferences},
365 * and requested features in {@link PackageInfo#reqFeatures} and
366 * {@link PackageInfo#featureGroups}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800367 */
368 public static final int GET_CONFIGURATIONS = 0x00004000;
369
370 /**
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700371 * @deprecated replaced with {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}.
372 */
373 @Deprecated
374 public static final int GET_DISABLED_UNTIL_USED_COMPONENTS = 0x00008000;
375
376 /**
Dianne Hackbornfd7aded2013-01-22 17:10:23 -0800377 * {@link PackageInfo} flag: include disabled components which are in
378 * that state only because of {@link #COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED}
379 * in the returned info. Note that if you set this flag, applications
380 * that are in this disabled state will be reported as enabled.
381 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700382 public static final int MATCH_DISABLED_UNTIL_USED_COMPONENTS = 0x00008000;
Dianne Hackbornfd7aded2013-01-22 17:10:23 -0800383
384 /**
Dianne Hackborn1655be42009-05-08 14:29:01 -0700385 * Resolution and querying flag: if set, only filters that support the
386 * {@link android.content.Intent#CATEGORY_DEFAULT} will be considered for
387 * matching. This is a synonym for including the CATEGORY_DEFAULT in your
388 * supplied Intent.
389 */
Fabrice Di Meglio9f7e39f2015-04-10 20:40:16 -0700390 public static final int MATCH_DEFAULT_ONLY = 0x00010000;
391
392 /**
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700393 * Querying flag: if set and if the platform is doing any filtering of the
394 * results, then the filtering will not happen. This is a synonym for saying
395 * that all results should be returned.
396 * <p>
397 * <em>This flag should be used with extreme care.</em>
Fabrice Di Meglio9f7e39f2015-04-10 20:40:16 -0700398 */
399 public static final int MATCH_ALL = 0x00020000;
Dianne Hackborn1655be42009-05-08 14:29:01 -0700400
Nicolas Prevot63798c52014-05-27 13:22:38 +0100401 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600402 * Querying flag: match components which are direct boot <em>unaware</em> in
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700403 * the returned info, regardless of the current user state.
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600404 * <p>
405 * When neither {@link #MATCH_DIRECT_BOOT_AWARE} nor
406 * {@link #MATCH_DIRECT_BOOT_UNAWARE} are specified, the default behavior is
407 * to match only runnable components based on the user state. For example,
408 * when a user is started but credentials have not been presented yet, the
409 * user is running "locked" and only {@link #MATCH_DIRECT_BOOT_AWARE}
410 * components are returned. Once the user credentials have been presented,
411 * the user is running "unlocked" and both {@link #MATCH_DIRECT_BOOT_AWARE}
412 * and {@link #MATCH_DIRECT_BOOT_UNAWARE} components are returned.
413 *
414 * @see UserManager#isUserUnlocked()
Jeff Sharkeye17ac152015-11-06 22:40:29 -0800415 */
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600416 public static final int MATCH_DIRECT_BOOT_UNAWARE = 0x00040000;
417
418 /**
419 * Querying flag: match components which are direct boot <em>aware</em> in
420 * the returned info, regardless of the current user state.
421 * <p>
422 * When neither {@link #MATCH_DIRECT_BOOT_AWARE} nor
423 * {@link #MATCH_DIRECT_BOOT_UNAWARE} are specified, the default behavior is
424 * to match only runnable components based on the user state. For example,
425 * when a user is started but credentials have not been presented yet, the
426 * user is running "locked" and only {@link #MATCH_DIRECT_BOOT_AWARE}
427 * components are returned. Once the user credentials have been presented,
428 * the user is running "unlocked" and both {@link #MATCH_DIRECT_BOOT_AWARE}
429 * and {@link #MATCH_DIRECT_BOOT_UNAWARE} components are returned.
430 *
431 * @see UserManager#isUserUnlocked()
432 */
433 public static final int MATCH_DIRECT_BOOT_AWARE = 0x00080000;
434
Jeff Sharkey2a9e3f82015-12-18 10:57:58 -0700435 /**
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700436 * Querying flag: include only components from applications that are marked
437 * with {@link ApplicationInfo#FLAG_SYSTEM}.
Jeff Sharkey5217cac2015-12-20 15:34:01 -0700438 */
439 public static final int MATCH_SYSTEM_ONLY = 0x00100000;
440
441 /**
Todd Kennedyd6ee0ba2016-03-31 15:11:11 -0700442 * Internal {@link PackageInfo} flag: include only components on the system image.
443 * This will not return information on any unbundled update to system components.
444 * @hide
445 */
Todd Kennedy49084962017-03-27 16:20:37 -0700446 @SystemApi
Fyodor Kupolove5698042018-01-26 14:24:37 -0800447 @TestApi
Todd Kennedyd6ee0ba2016-03-31 15:11:11 -0700448 public static final int MATCH_FACTORY_ONLY = 0x00200000;
449
450 /**
Amith Yamasani0d1fd8d2016-10-12 14:21:51 -0700451 * Allows querying of packages installed for any user, not just the specific one. This flag
Amith Yamasani475f9a32016-12-08 09:46:15 -0800452 * is only meant for use by apps that have INTERACT_ACROSS_USERS permission.
Amith Yamasani0d1fd8d2016-10-12 14:21:51 -0700453 * @hide
454 */
Amith Yamasani475f9a32016-12-08 09:46:15 -0800455 @SystemApi
Amith Yamasani0d1fd8d2016-10-12 14:21:51 -0700456 public static final int MATCH_ANY_USER = 0x00400000;
457
458 /**
459 * Combination of MATCH_ANY_USER and MATCH_UNINSTALLED_PACKAGES to mean any known
460 * package.
461 * @hide
462 */
Todd Kennedyef9acb62018-05-29 15:18:06 -0700463 @TestApi
Amith Yamasani0d1fd8d2016-10-12 14:21:51 -0700464 public static final int MATCH_KNOWN_PACKAGES = MATCH_UNINSTALLED_PACKAGES | MATCH_ANY_USER;
465
466 /**
Todd Kennedy7bc3a702016-12-08 14:54:48 -0800467 * Internal {@link PackageInfo} flag: include components that are part of an
Todd Kennedybe0b8892017-02-15 14:13:52 -0800468 * instant app. By default, instant app components are not matched.
Todd Kennedy7bc3a702016-12-08 14:54:48 -0800469 * @hide
470 */
Todd Kennedy9c9fdf22017-03-06 10:58:27 -0800471 @SystemApi
Todd Kennedybe0b8892017-02-15 14:13:52 -0800472 public static final int MATCH_INSTANT = 0x00800000;
Todd Kennedy7bc3a702016-12-08 14:54:48 -0800473
474 /**
475 * Internal {@link PackageInfo} flag: include only components that are exposed to
Todd Kennedyc05f5d12017-04-25 11:11:40 -0700476 * instant apps. Matched components may have been either explicitly or implicitly
477 * exposed.
Todd Kennedy7bc3a702016-12-08 14:54:48 -0800478 * @hide
479 */
Todd Kennedybe0b8892017-02-15 14:13:52 -0800480 public static final int MATCH_VISIBLE_TO_INSTANT_APP_ONLY = 0x01000000;
Todd Kennedy7bc3a702016-12-08 14:54:48 -0800481
482 /**
Todd Kennedyc05f5d12017-04-25 11:11:40 -0700483 * Internal {@link PackageInfo} flag: include only components that have been
484 * explicitly exposed to instant apps.
485 * @hide
486 */
487 public static final int MATCH_EXPLICITLY_VISIBLE_ONLY = 0x02000000;
488
489 /**
Svet Ganov9e779772017-05-11 14:36:50 -0700490 * Internal {@link PackageInfo} flag: include static shared libraries.
491 * Apps that depend on static shared libs can always access the version
492 * of the lib they depend on. System/shell/root can access all shared
493 * libs regardless of dependency but need to explicitly ask for them
494 * via this flag.
495 * @hide
496 */
497 public static final int MATCH_STATIC_SHARED_LIBRARIES = 0x04000000;
498
499 /**
Daniel Cashman5cdda342018-01-19 07:22:52 -0800500 * {@link PackageInfo} flag: return the signing certificates associated with
501 * this package. Each entry is a signing certificate that the package
502 * has proven it is authorized to use, usually a past signing certificate from
503 * which it has rotated.
504 */
505 public static final int GET_SIGNING_CERTIFICATES = 0x08000000;
506
507 /**
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700508 * Internal flag used to indicate that a system component has done their
509 * homework and verified that they correctly handle packages and components
510 * that come and go over time. In particular:
511 * <ul>
512 * <li>Apps installed on external storage, which will appear to be
513 * uninstalled while the the device is ejected.
514 * <li>Apps with encryption unaware components, which will appear to not
515 * exist while the device is locked.
516 * </ul>
Jeff Sharkeye17ac152015-11-06 22:40:29 -0800517 *
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700518 * @see #MATCH_UNINSTALLED_PACKAGES
Jeff Sharkey8a372a02016-03-16 16:25:45 -0600519 * @see #MATCH_DIRECT_BOOT_AWARE
520 * @see #MATCH_DIRECT_BOOT_UNAWARE
Jeff Sharkeye17ac152015-11-06 22:40:29 -0800521 * @hide
522 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -0700523 public static final int MATCH_DEBUG_TRIAGED_MISSING = 0x10000000;
Jeff Sharkeye17ac152015-11-06 22:40:29 -0800524
525 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700526 * Flag for {@link #addCrossProfileIntentFilter}: if this flag is set: when
527 * resolving an intent that matches the {@code CrossProfileIntentFilter},
528 * the current profile will be skipped. Only activities in the target user
529 * can respond to the intent.
530 *
Nicolas Prevot63798c52014-05-27 13:22:38 +0100531 * @hide
532 */
533 public static final int SKIP_CURRENT_PROFILE = 0x00000002;
534
Tony Mak807e01c2015-12-01 20:19:03 +0000535 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700536 * Flag for {@link #addCrossProfileIntentFilter}: if this flag is set:
Tony Mak807e01c2015-12-01 20:19:03 +0000537 * activities in the other profiles can respond to the intent only if no activity with
538 * non-negative priority in current profile can respond to the intent.
539 * @hide
540 */
541 public static final int ONLY_IF_NO_MATCH_FOUND = 0x00000004;
542
Tor Norbyed9273d62013-05-30 15:59:53 -0700543 /** @hide */
Jeff Sharkey4347f812017-04-21 12:08:39 -0600544 @IntDef(prefix = { "PERMISSION_" }, value = {
545 PERMISSION_GRANTED,
546 PERMISSION_DENIED
547 })
Tor Norbyed9273d62013-05-30 15:59:53 -0700548 @Retention(RetentionPolicy.SOURCE)
549 public @interface PermissionResult {}
550
Dianne Hackborn1655be42009-05-08 14:29:01 -0700551 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800552 * Permission check result: this is returned by {@link #checkPermission}
553 * if the permission has been granted to the given package.
554 */
555 public static final int PERMISSION_GRANTED = 0;
556
557 /**
558 * Permission check result: this is returned by {@link #checkPermission}
559 * if the permission has not been granted to the given package.
560 */
561 public static final int PERMISSION_DENIED = -1;
562
Jeff Sharkey30e06bb2017-04-24 11:18:03 -0600563 /** @hide */
564 @IntDef(prefix = { "SIGNATURE_" }, value = {
565 SIGNATURE_MATCH,
566 SIGNATURE_NEITHER_SIGNED,
567 SIGNATURE_FIRST_NOT_SIGNED,
568 SIGNATURE_SECOND_NOT_SIGNED,
569 SIGNATURE_NO_MATCH,
570 SIGNATURE_UNKNOWN_PACKAGE,
571 })
572 @Retention(RetentionPolicy.SOURCE)
573 public @interface SignatureResult {}
574
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800575 /**
576 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700577 * if all signatures on the two packages match.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800578 */
579 public static final int SIGNATURE_MATCH = 0;
580
581 /**
582 * Signature check result: this is returned by {@link #checkSignatures}
583 * if neither of the two packages is signed.
584 */
585 public static final int SIGNATURE_NEITHER_SIGNED = 1;
586
587 /**
588 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700589 * if the first package is not signed but the second is.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800590 */
591 public static final int SIGNATURE_FIRST_NOT_SIGNED = -1;
592
593 /**
594 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700595 * if the second package is not signed but the first is.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800596 */
597 public static final int SIGNATURE_SECOND_NOT_SIGNED = -2;
598
599 /**
600 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700601 * if not all signatures on both packages match.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800602 */
603 public static final int SIGNATURE_NO_MATCH = -3;
604
605 /**
606 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700607 * if either of the packages are not valid.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800608 */
609 public static final int SIGNATURE_UNKNOWN_PACKAGE = -4;
610
Jeff Sharkey30e06bb2017-04-24 11:18:03 -0600611 /** @hide */
612 @IntDef(prefix = { "COMPONENT_ENABLED_STATE_" }, value = {
613 COMPONENT_ENABLED_STATE_DEFAULT,
614 COMPONENT_ENABLED_STATE_ENABLED,
615 COMPONENT_ENABLED_STATE_DISABLED,
616 COMPONENT_ENABLED_STATE_DISABLED_USER,
617 COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED,
618 })
619 @Retention(RetentionPolicy.SOURCE)
620 public @interface EnabledState {}
621
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700622 /**
Jeff Sharkey30e06bb2017-04-24 11:18:03 -0600623 * Flag for {@link #setApplicationEnabledSetting(String, int, int)} and
624 * {@link #setComponentEnabledSetting(ComponentName, int, int)}: This
625 * component or application is in its default enabled state (as specified in
626 * its manifest).
627 * <p>
628 * Explicitly setting the component state to this value restores it's
629 * enabled state to whatever is set in the manifest.
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700630 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800631 public static final int COMPONENT_ENABLED_STATE_DEFAULT = 0;
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700632
633 /**
634 * Flag for {@link #setApplicationEnabledSetting(String, int, int)}
635 * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This
636 * component or application has been explictily enabled, regardless of
637 * what it has specified in its manifest.
638 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800639 public static final int COMPONENT_ENABLED_STATE_ENABLED = 1;
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700640
641 /**
642 * Flag for {@link #setApplicationEnabledSetting(String, int, int)}
643 * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This
644 * component or application has been explicitly disabled, regardless of
645 * what it has specified in its manifest.
646 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800647 public static final int COMPONENT_ENABLED_STATE_DISABLED = 2;
648
649 /**
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700650 * Flag for {@link #setApplicationEnabledSetting(String, int, int)} only: The
651 * user has explicitly disabled the application, regardless of what it has
652 * specified in its manifest. Because this is due to the user's request,
653 * they may re-enable it if desired through the appropriate system UI. This
kmccormick30498b42013-03-27 17:39:17 -0700654 * option currently <strong>cannot</strong> be used with
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700655 * {@link #setComponentEnabledSetting(ComponentName, int, int)}.
656 */
657 public static final int COMPONENT_ENABLED_STATE_DISABLED_USER = 3;
658
659 /**
Dianne Hackbornfd7aded2013-01-22 17:10:23 -0800660 * Flag for {@link #setApplicationEnabledSetting(String, int, int)} only: This
661 * application should be considered, until the point where the user actually
662 * wants to use it. This means that it will not normally show up to the user
663 * (such as in the launcher), but various parts of the user interface can
664 * use {@link #GET_DISABLED_UNTIL_USED_COMPONENTS} to still see it and allow
665 * the user to select it (as for example an IME, device admin, etc). Such code,
666 * once the user has selected the app, should at that point also make it enabled.
667 * This option currently <strong>can not</strong> be used with
668 * {@link #setComponentEnabledSetting(ComponentName, int, int)}.
669 */
670 public static final int COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED = 4;
671
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700672 /** @hide */
Jeff Sharkey4347f812017-04-21 12:08:39 -0600673 @IntDef(flag = true, prefix = { "INSTALL_" }, value = {
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700674 INSTALL_FORWARD_LOCK,
675 INSTALL_REPLACE_EXISTING,
676 INSTALL_ALLOW_TEST,
677 INSTALL_EXTERNAL,
678 INSTALL_INTERNAL,
679 INSTALL_FROM_ADB,
680 INSTALL_ALL_USERS,
681 INSTALL_ALLOW_DOWNGRADE,
682 INSTALL_GRANT_RUNTIME_PERMISSIONS,
683 INSTALL_FORCE_VOLUME_UUID,
684 INSTALL_FORCE_PERMISSION_PROMPT,
Todd Kennedybe0b8892017-02-15 14:13:52 -0800685 INSTALL_INSTANT_APP,
Todd Kennedy39bfee52016-02-24 10:28:21 -0800686 INSTALL_DONT_KILL_APP,
Jeff Sharkey683bcd32017-03-18 17:54:51 -0600687 INSTALL_FORCE_SDK,
688 INSTALL_FULL_APP,
689 INSTALL_ALLOCATE_AGGRESSIVE,
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700690 })
691 @Retention(RetentionPolicy.SOURCE)
692 public @interface InstallFlags {}
693
Dianne Hackbornfd7aded2013-01-22 17:10:23 -0800694 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700695 * Flag parameter for {@link #installPackage} to indicate that this package
696 * should be installed as forward locked, i.e. only the app itself should
697 * have access to its code and non-resource assets.
698 *
Jeff Sharkey8c61e392017-02-24 09:22:48 -0700699 * @deprecated new installs into ASEC containers are no longer supported.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700700 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800701 */
Jeff Sharkey8c61e392017-02-24 09:22:48 -0700702 @Deprecated
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700703 public static final int INSTALL_FORWARD_LOCK = 0x00000001;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800704
705 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700706 * Flag parameter for {@link #installPackage} to indicate that you want to
707 * replace an already installed package, if one exists.
708 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700709 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800710 */
Mathew Inwood1c77a112018-08-14 14:06:26 +0100711 @UnsupportedAppUsage
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700712 public static final int INSTALL_REPLACE_EXISTING = 0x00000002;
713
714 /**
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700715 * Flag parameter for {@link #installPackage} to indicate that you want to
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700716 * allow test packages (those that have set android:testOnly in their
717 * manifest) to be installed.
718 * @hide
719 */
720 public static final int INSTALL_ALLOW_TEST = 0x00000004;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800721
722 /**
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -0700723 * Flag parameter for {@link #installPackage} to indicate that this package
724 * must be installed to an ASEC on a {@link VolumeInfo#TYPE_PUBLIC}.
725 *
Jeff Sharkey8c61e392017-02-24 09:22:48 -0700726 * @deprecated new installs into ASEC containers are no longer supported;
727 * use adoptable storage instead.
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800728 * @hide
729 */
Jeff Sharkey8c61e392017-02-24 09:22:48 -0700730 @Deprecated
Suchi Amalapurapu5b993ce2010-02-12 09:43:29 -0800731 public static final int INSTALL_EXTERNAL = 0x00000008;
Oscar Montemayor539d3c42010-01-29 15:27:00 -0800732
733 /**
Kenny Root5ab21572011-07-27 11:11:19 -0700734 * Flag parameter for {@link #installPackage} to indicate that this package
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -0700735 * must be installed to internal storage.
736 *
Kenny Root5ab21572011-07-27 11:11:19 -0700737 * @hide
738 */
739 public static final int INSTALL_INTERNAL = 0x00000010;
740
741 /**
742 * Flag parameter for {@link #installPackage} to indicate that this install
743 * was initiated via ADB.
744 *
745 * @hide
746 */
747 public static final int INSTALL_FROM_ADB = 0x00000020;
Suchi Amalapurapu14b6abd2010-03-17 08:37:04 -0700748
749 /**
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700750 * Flag parameter for {@link #installPackage} to indicate that this install
751 * should immediately be visible to all users.
752 *
753 * @hide
754 */
755 public static final int INSTALL_ALL_USERS = 0x00000040;
756
757 /**
758 * Flag parameter for {@link #installPackage} to indicate that it is okay
759 * to install an update to an app where the newly installed app has a lower
Alex Klyubin921dd752016-02-24 13:21:41 -0800760 * version code than the currently installed app. This is permitted only if
761 * the currently installed app is marked debuggable.
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700762 *
763 * @hide
764 */
765 public static final int INSTALL_ALLOW_DOWNGRADE = 0x00000080;
766
767 /**
Svet Ganov95c1ade2015-03-19 09:38:52 -0700768 * Flag parameter for {@link #installPackage} to indicate that all runtime
769 * permissions should be granted to the package. If {@link #INSTALL_ALL_USERS}
770 * is set the runtime permissions will be granted to all users, otherwise
771 * only to the owner.
772 *
773 * @hide
774 */
775 public static final int INSTALL_GRANT_RUNTIME_PERMISSIONS = 0x00000100;
776
Jeff Sharkeyab234092015-06-09 21:42:22 -0700777 /** {@hide} */
778 public static final int INSTALL_FORCE_VOLUME_UUID = 0x00000200;
779
Svet Ganov95c1ade2015-03-19 09:38:52 -0700780 /**
Todd Kennedya1d12cf2015-09-29 15:43:00 -0700781 * Flag parameter for {@link #installPackage} to indicate that we always want to force
782 * the prompt for permission approval. This overrides any special behaviour for internal
783 * components.
784 *
785 * @hide
786 */
787 public static final int INSTALL_FORCE_PERMISSION_PROMPT = 0x00000400;
788
789 /**
Todd Kennedy27c24fb2015-09-17 16:49:25 -0700790 * Flag parameter for {@link #installPackage} to indicate that this package is
Todd Kennedy2699f062015-11-20 13:07:17 -0800791 * to be installed as a lightweight "ephemeral" app.
792 *
793 * @hide
794 */
Todd Kennedybe0b8892017-02-15 14:13:52 -0800795 public static final int INSTALL_INSTANT_APP = 0x00000800;
796
797 /**
Todd Kennedy39bfee52016-02-24 10:28:21 -0800798 * Flag parameter for {@link #installPackage} to indicate that this package contains
799 * a feature split to an existing application and the existing application should not
800 * be killed during the installation process.
801 *
802 * @hide
803 */
804 public static final int INSTALL_DONT_KILL_APP = 0x00001000;
805
806 /**
Todd Kennedyb1072712016-04-26 15:41:20 -0700807 * Flag parameter for {@link #installPackage} to indicate that this package is an
Patrick Baumannccb20b82018-01-08 13:22:46 -0800808 * upgrade to a package that refers to the SDK via release letter or is targeting an SDK via
809 * release letter that the current build does not support.
Todd Kennedyb1072712016-04-26 15:41:20 -0700810 *
811 * @hide
812 */
813 public static final int INSTALL_FORCE_SDK = 0x00002000;
814
815 /**
Jeff Sharkey683bcd32017-03-18 17:54:51 -0600816 * Flag parameter for {@link #installPackage} to indicate that this package is
817 * to be installed as a heavy weight app. This is fundamentally the opposite of
818 * {@link #INSTALL_INSTANT_APP}.
819 *
820 * @hide
821 */
822 public static final int INSTALL_FULL_APP = 0x00004000;
823
824 /**
825 * Flag parameter for {@link #installPackage} to indicate that this package
826 * is critical to system health or security, meaning the system should use
827 * {@link StorageManager#FLAG_ALLOCATE_AGGRESSIVE} internally.
828 *
829 * @hide
830 */
831 public static final int INSTALL_ALLOCATE_AGGRESSIVE = 0x00008000;
832
Todd Kennedy78a72502017-07-19 12:49:30 -0700833 /**
834 * Flag parameter for {@link #installPackage} to indicate that this package
835 * is a virtual preload.
836 *
837 * @hide
838 */
839 public static final int INSTALL_VIRTUAL_PRELOAD = 0x00010000;
840
Jeff Sharkey30e06bb2017-04-24 11:18:03 -0600841 /** @hide */
842 @IntDef(flag = true, prefix = { "DONT_KILL_APP" }, value = {
843 DONT_KILL_APP
844 })
845 @Retention(RetentionPolicy.SOURCE)
846 public @interface EnabledFlags {}
847
Jeff Sharkey683bcd32017-03-18 17:54:51 -0600848 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800849 * Flag parameter for
850 * {@link #setComponentEnabledSetting(android.content.ComponentName, int, int)} to indicate
851 * that you don't want to kill the app containing the component. Be careful when you set this
852 * since changing component states can make the containing application's behavior unpredictable.
853 */
854 public static final int DONT_KILL_APP = 0x00000001;
855
Bartosz Fabianowskia34f53f2017-01-11 18:08:47 +0100856 /** @hide */
Jeff Sharkey4347f812017-04-21 12:08:39 -0600857 @IntDef(prefix = { "INSTALL_REASON_" }, value = {
858 INSTALL_REASON_UNKNOWN,
859 INSTALL_REASON_POLICY,
860 INSTALL_REASON_DEVICE_RESTORE,
861 INSTALL_REASON_DEVICE_SETUP,
862 INSTALL_REASON_USER
863 })
Bartosz Fabianowskia34f53f2017-01-11 18:08:47 +0100864 @Retention(RetentionPolicy.SOURCE)
865 public @interface InstallReason {}
866
867 /**
868 * Code indicating that the reason for installing this package is unknown.
869 */
870 public static final int INSTALL_REASON_UNKNOWN = 0;
871
872 /**
873 * Code indicating that this package was installed due to enterprise policy.
874 */
875 public static final int INSTALL_REASON_POLICY = 1;
876
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800877 /**
Sunny Goyal80af6a22017-03-02 08:32:33 -0800878 * Code indicating that this package was installed as part of restoring from another device.
879 */
880 public static final int INSTALL_REASON_DEVICE_RESTORE = 2;
881
882 /**
883 * Code indicating that this package was installed as part of device setup.
884 */
885 public static final int INSTALL_REASON_DEVICE_SETUP = 3;
886
887 /**
888 * Code indicating that the package installation was initiated by the user.
889 */
890 public static final int INSTALL_REASON_USER = 4;
891
892 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800893 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
894 * on success.
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700895 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700896 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800897 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700898 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800899 public static final int INSTALL_SUCCEEDED = 1;
900
901 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800902 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
903 * if the package is already installed.
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700904 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700905 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800906 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700907 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800908 public static final int INSTALL_FAILED_ALREADY_EXISTS = -1;
909
910 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800911 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
912 * if the package archive file is invalid.
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700913 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700914 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800915 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700916 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800917 public static final int INSTALL_FAILED_INVALID_APK = -2;
918
919 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800920 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
921 * if the URI passed in is invalid.
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700922 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700923 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800924 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700925 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800926 public static final int INSTALL_FAILED_INVALID_URI = -3;
927
928 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800929 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
930 * if the package manager service found that the device didn't have enough storage space to
931 * install the app.
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700932 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700933 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800934 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700935 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800936 public static final int INSTALL_FAILED_INSUFFICIENT_STORAGE = -4;
937
938 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800939 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
940 * if a package is already installed with the same name.
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700941 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700942 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800943 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700944 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800945 public static final int INSTALL_FAILED_DUPLICATE_PACKAGE = -5;
946
947 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800948 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
949 * if the requested shared user does not exist.
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700950 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700951 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800952 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700953 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800954 public static final int INSTALL_FAILED_NO_SHARED_USER = -6;
955
956 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800957 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
958 * if a previously installed package of the same name has a different signature than the new
959 * package (and the old package's data was not removed).
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700960 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700961 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800962 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700963 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800964 public static final int INSTALL_FAILED_UPDATE_INCOMPATIBLE = -7;
965
966 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800967 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
968 * if the new package is requested a shared user which is already installed on the device and
969 * does not have matching signature.
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700970 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700971 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800972 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700973 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800974 public static final int INSTALL_FAILED_SHARED_USER_INCOMPATIBLE = -8;
975
976 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800977 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
978 * if the new package uses a shared library that is not available.
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700979 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700980 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800981 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700982 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800983 public static final int INSTALL_FAILED_MISSING_SHARED_LIBRARY = -9;
984
985 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800986 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
987 * if the new package uses a shared library that is not available.
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700988 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700989 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800990 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700991 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800992 public static final int INSTALL_FAILED_REPLACE_COULDNT_DELETE = -10;
993
994 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -0800995 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
996 * if the new package failed while optimizing and validating its dex files, either because there
997 * was not enough storage or the validation failed.
Jeff Sharkey5aa86932016-01-08 19:07:49 -0700998 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700999 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001000 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001001 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001002 public static final int INSTALL_FAILED_DEXOPT = -11;
1003
1004 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001005 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1006 * if the new package failed because the current SDK version is older than that required by the
1007 * package.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001008 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001009 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001010 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001011 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001012 public static final int INSTALL_FAILED_OLDER_SDK = -12;
1013
1014 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001015 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1016 * if the new package failed because it contains a content provider with the same authority as a
1017 * provider already installed in the system.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001018 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001019 * @hide
The Android Open Source Project10592532009-03-18 17:39:46 -07001020 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001021 @SystemApi
The Android Open Source Project10592532009-03-18 17:39:46 -07001022 public static final int INSTALL_FAILED_CONFLICTING_PROVIDER = -13;
1023
1024 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001025 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1026 * if the new package failed because the current SDK version is newer than that required by the
1027 * package.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001028 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001029 * @hide
Dianne Hackborn851a5412009-05-08 12:06:44 -07001030 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001031 @SystemApi
Dianne Hackborn851a5412009-05-08 12:06:44 -07001032 public static final int INSTALL_FAILED_NEWER_SDK = -14;
1033
1034 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001035 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1036 * if the new package failed because it has specified that it is a test-only package and the
1037 * caller has not supplied the {@link #INSTALL_ALLOW_TEST} flag.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001038 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001039 * @hide
1040 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001041 @SystemApi
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001042 public static final int INSTALL_FAILED_TEST_ONLY = -15;
1043
1044 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001045 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1046 * if the package being installed contains native code, but none that is compatible with the
1047 * device's CPU_ABI.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001048 *
Dianne Hackbornb1811182009-05-21 15:45:42 -07001049 * @hide
1050 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001051 @SystemApi
Dianne Hackbornb1811182009-05-21 15:45:42 -07001052 public static final int INSTALL_FAILED_CPU_ABI_INCOMPATIBLE = -16;
1053
1054 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001055 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1056 * if the new package uses a feature that is not available.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001057 *
Dianne Hackborn49237342009-08-27 20:08:01 -07001058 * @hide
1059 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001060 @SystemApi
Dianne Hackborn49237342009-08-27 20:08:01 -07001061 public static final int INSTALL_FAILED_MISSING_FEATURE = -17;
1062
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -08001063 // ------ Errors related to sdcard
1064 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001065 * Installation return code: this is passed in the
1066 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if a secure container mount point couldn't be
1067 * accessed on external media.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001068 *
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -08001069 * @hide
1070 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001071 @SystemApi
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -08001072 public static final int INSTALL_FAILED_CONTAINER_ERROR = -18;
1073
Dianne Hackborn49237342009-08-27 20:08:01 -07001074 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001075 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1076 * if the new package couldn't be installed in the specified install location.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001077 *
Suchi Amalapurapub56ae202010-02-04 22:51:07 -08001078 * @hide
1079 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001080 @SystemApi
Suchi Amalapurapub56ae202010-02-04 22:51:07 -08001081 public static final int INSTALL_FAILED_INVALID_INSTALL_LOCATION = -19;
1082
1083 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001084 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1085 * if the new package couldn't be installed in the specified install location because the media
1086 * is not available.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001087 *
Suchi Amalapurapu8a9ab242010-03-11 16:49:16 -08001088 * @hide
1089 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001090 @SystemApi
Suchi Amalapurapu8a9ab242010-03-11 16:49:16 -08001091 public static final int INSTALL_FAILED_MEDIA_UNAVAILABLE = -20;
1092
1093 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001094 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1095 * if the new package couldn't be installed because the verification timed out.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001096 *
Kenny Root5ab21572011-07-27 11:11:19 -07001097 * @hide
1098 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001099 @SystemApi
Kenny Root5ab21572011-07-27 11:11:19 -07001100 public static final int INSTALL_FAILED_VERIFICATION_TIMEOUT = -21;
1101
1102 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001103 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1104 * if the new package couldn't be installed because the verification did not succeed.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001105 *
Kenny Root5ab21572011-07-27 11:11:19 -07001106 * @hide
1107 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001108 @SystemApi
Kenny Root5ab21572011-07-27 11:11:19 -07001109 public static final int INSTALL_FAILED_VERIFICATION_FAILURE = -22;
1110
1111 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001112 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1113 * if the package changed from what the calling program expected.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001114 *
Kenny Root5ab21572011-07-27 11:11:19 -07001115 * @hide
1116 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001117 @SystemApi
Kenny Root5ab21572011-07-27 11:11:19 -07001118 public static final int INSTALL_FAILED_PACKAGE_CHANGED = -23;
1119
1120 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001121 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1122 * if the new package is assigned a different UID than it previously held.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001123 *
Dianne Hackbornd0c5f512012-06-07 16:53:59 -07001124 * @hide
1125 */
1126 public static final int INSTALL_FAILED_UID_CHANGED = -24;
1127
1128 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001129 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1130 * if the new package has an older version code than the currently installed package.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001131 *
Dianne Hackborn7767eac2012-08-23 18:25:40 -07001132 * @hide
1133 */
1134 public static final int INSTALL_FAILED_VERSION_DOWNGRADE = -25;
1135
1136 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001137 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1138 * if the old package has target SDK high enough to support runtime permission and the new
1139 * package has target SDK low enough to not support runtime permissions.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001140 *
Svetoslavd9653702015-05-13 18:02:46 -07001141 * @hide
1142 */
1143 @SystemApi
1144 public static final int INSTALL_FAILED_PERMISSION_MODEL_DOWNGRADE = -26;
1145
1146 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001147 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
1148 * if the new package attempts to downgrade the target sandbox version of the app.
Chad Brubaker34573b22017-03-07 15:27:35 -08001149 *
1150 * @hide
1151 */
1152 @SystemApi
1153 public static final int INSTALL_FAILED_SANDBOX_VERSION_DOWNGRADE = -27;
1154
1155 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001156 * Installation parse return code: this is passed in the
1157 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser was given a path that is not a
1158 * file, or does not end with the expected '.apk' extension.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001159 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001160 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001161 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001162 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001163 public static final int INSTALL_PARSE_FAILED_NOT_APK = -100;
1164
1165 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001166 * Installation parse return code: this is passed in the
1167 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser was unable to retrieve the
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001168 * AndroidManifest.xml file.
1169 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001170 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001171 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001172 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001173 public static final int INSTALL_PARSE_FAILED_BAD_MANIFEST = -101;
1174
1175 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001176 * Installation parse return code: this is passed in the
1177 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser encountered an unexpected
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001178 * exception.
1179 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001180 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001181 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001182 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001183 public static final int INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION = -102;
1184
1185 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001186 * Installation parse return code: this is passed in the
1187 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser did not find any certificates in
1188 * the .apk.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001189 *
Dianne Hackbornade3eca2009-05-11 18:54:45 -07001190 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001191 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001192 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001193 public static final int INSTALL_PARSE_FAILED_NO_CERTIFICATES = -103;
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 found inconsistent certificates on
1198 * the files in the .apk.
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_INCONSISTENT_CERTIFICATES = -104;
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 encountered a
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001208 * CertificateEncodingException in one of the files in the .apk.
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_CERTIFICATE_ENCODING = -105;
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 a bad or missing
1218 * package name in the manifest.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001219 *
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_BAD_PACKAGE_NAME = -106;
1224
1225 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001226 * Installation parse return code: tthis is passed in the
1227 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser encountered a bad shared user id
1228 * name in the manifest.
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_BAD_SHARED_USER_ID = -107;
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 encountered some structural
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001238 * problem in the manifest.
1239 *
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_MANIFEST_MALFORMED = -108;
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 did not find any actionable tags
1248 * (instrumentation or application) in the manifest.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001249 *
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_MANIFEST_EMPTY = -109;
1254
1255 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001256 * Installation failed return code: this is passed in the
1257 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the system failed to install the package
1258 * because of system issues.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001259 *
Suchi Amalapurapu5b993ce2010-02-12 09:43:29 -08001260 * @hide
1261 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07001262 @SystemApi
Suchi Amalapurapu5b993ce2010-02-12 09:43:29 -08001263 public static final int INSTALL_FAILED_INTERNAL_ERROR = -110;
1264
1265 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001266 * Installation failed return code: this is passed in the
1267 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the system failed to install the package
1268 * because the user is restricted from installing apps.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001269 *
Amith Yamasanie4cf7342012-12-17 11:12:09 -08001270 * @hide
1271 */
1272 public static final int INSTALL_FAILED_USER_RESTRICTED = -111;
1273
1274 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001275 * Installation failed return code: this is passed in the
1276 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the system failed to install the package
1277 * because it is attempting to define a permission that is already defined by some existing
1278 * package.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001279 * <p>
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001280 * The package name of the app which has already defined the permission is passed to a
1281 * {@link PackageInstallObserver}, if any, as the {@link #EXTRA_FAILURE_EXISTING_PACKAGE} string
1282 * extra; and the name of the permission being redefined is passed in the
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001283 * {@link #EXTRA_FAILURE_EXISTING_PERMISSION} string extra.
Christopher Tatef1977b42014-03-24 16:25:51 -07001284 *
Christopher Tatef1977b42014-03-24 16:25:51 -07001285 * @hide
1286 */
1287 public static final int INSTALL_FAILED_DUPLICATE_PERMISSION = -112;
1288
1289 /**
Philip P. Moltmannb13f1532017-11-14 08:34:06 -08001290 * Installation failed return code: this is passed in the
1291 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the system failed to install the package
1292 * because its packaged native code did not match any of the ABIs supported by the system.
Ramin Zaghi1378aba2014-02-28 15:03:19 +00001293 *
1294 * @hide
1295 */
Narayan Kamathd11f2232014-04-10 10:37:17 +01001296 public static final int INSTALL_FAILED_NO_MATCHING_ABIS = -113;
Ramin Zaghi1378aba2014-02-28 15:03:19 +00001297
1298 /**
1299 * Internal return code for NativeLibraryHelper methods to indicate that the package
1300 * being processed did not contain any native code. This is placed here only so that
1301 * it can belong to the same value space as the other install failure codes.
1302 *
1303 * @hide
1304 */
Mathew Inwood1c77a112018-08-14 14:06:26 +01001305 @UnsupportedAppUsage
Narayan Kamathd11f2232014-04-10 10:37:17 +01001306 public static final int NO_NATIVE_LIBRARIES = -114;
Ramin Zaghi1378aba2014-02-28 15:03:19 +00001307
Jeff Sharkey7328a1b2014-08-07 14:01:43 -07001308 /** {@hide} */
Jeff Sharkeyf0600952014-08-07 17:31:53 -07001309 public static final int INSTALL_FAILED_ABORTED = -115;
Jeff Sharkey7328a1b2014-08-07 14:01:43 -07001310
Ramin Zaghi1378aba2014-02-28 15:03:19 +00001311 /**
Todd Kennedybe0b8892017-02-15 14:13:52 -08001312 * Installation failed return code: instant app installs are incompatible with some
Todd Kennedy2699f062015-11-20 13:07:17 -08001313 * other installation flags supplied for the operation; or other circumstances such
Todd Kennedybe0b8892017-02-15 14:13:52 -08001314 * as trying to upgrade a system app via an instant app install.
Todd Kennedy2699f062015-11-20 13:07:17 -08001315 * @hide
1316 */
Todd Kennedybe0b8892017-02-15 14:13:52 -08001317 public static final int INSTALL_FAILED_INSTANT_APP_INVALID = -116;
Todd Kennedy2699f062015-11-20 13:07:17 -08001318
Calin Juravle3fc56c32017-12-11 18:26:13 -08001319 /**
1320 * Installation parse return code: this is passed in the
1321 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the dex metadata file is invalid or
1322 * if there was no matching apk file for a dex metadata file.
1323 *
1324 * @hide
1325 */
1326 public static final int INSTALL_FAILED_BAD_DEX_METADATA = -117;
1327
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001328 /** @hide */
Jeff Sharkey4347f812017-04-21 12:08:39 -06001329 @IntDef(flag = true, prefix = { "DELETE_" }, value = {
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001330 DELETE_KEEP_DATA,
1331 DELETE_ALL_USERS,
1332 DELETE_SYSTEM_APP,
Todd Kennedy39bfee52016-02-24 10:28:21 -08001333 DELETE_DONT_KILL_APP,
Todd Kennedy232d29e2017-11-06 14:45:53 -08001334 DELETE_CHATTY,
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001335 })
1336 @Retention(RetentionPolicy.SOURCE)
1337 public @interface DeleteFlags {}
1338
Todd Kennedy2699f062015-11-20 13:07:17 -08001339 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001340 * Flag parameter for {@link #deletePackage} to indicate that you don't want to delete the
1341 * package's data directory.
1342 *
1343 * @hide
1344 */
Dianne Hackborn7767eac2012-08-23 18:25:40 -07001345 public static final int DELETE_KEEP_DATA = 0x00000001;
1346
1347 /**
1348 * Flag parameter for {@link #deletePackage} to indicate that you want the
1349 * package deleted for all users.
1350 *
1351 * @hide
1352 */
1353 public static final int DELETE_ALL_USERS = 0x00000002;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001354
1355 /**
Dianne Hackbornc895be72013-03-11 17:48:43 -07001356 * Flag parameter for {@link #deletePackage} to indicate that, if you are calling
1357 * uninstall on a system that has been updated, then don't do the normal process
1358 * of uninstalling the update and rolling back to the older system version (which
1359 * needs to happen for all users); instead, just mark the app as uninstalled for
1360 * the current user.
1361 *
1362 * @hide
1363 */
1364 public static final int DELETE_SYSTEM_APP = 0x00000004;
1365
1366 /**
Todd Kennedy39bfee52016-02-24 10:28:21 -08001367 * Flag parameter for {@link #deletePackage} to indicate that, if you are calling
1368 * uninstall on a package that is replaced to provide new feature splits, the
1369 * existing application should not be killed during the removal process.
1370 *
1371 * @hide
1372 */
1373 public static final int DELETE_DONT_KILL_APP = 0x00000008;
1374
1375 /**
Todd Kennedy232d29e2017-11-06 14:45:53 -08001376 * Flag parameter for {@link #deletePackage} to indicate that package deletion
1377 * should be chatty.
1378 *
1379 * @hide
1380 */
1381 public static final int DELETE_CHATTY = 0x80000000;
1382
1383 /**
Kenny Rootc39bb4a2011-02-28 13:27:19 -08001384 * Return code for when package deletion succeeds. This is passed to the
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001385 * {@link IPackageDeleteObserver} if the system succeeded in deleting the
1386 * package.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001387 *
Kenny Rootc39bb4a2011-02-28 13:27:19 -08001388 * @hide
1389 */
1390 public static final int DELETE_SUCCEEDED = 1;
1391
1392 /**
1393 * Deletion failed return code: this is passed to the
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001394 * {@link IPackageDeleteObserver} if the system failed to delete the package
1395 * for an unspecified reason.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001396 *
Kenny Rootc39bb4a2011-02-28 13:27:19 -08001397 * @hide
1398 */
1399 public static final int DELETE_FAILED_INTERNAL_ERROR = -1;
1400
1401 /**
1402 * Deletion failed return code: this is passed to the
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001403 * {@link IPackageDeleteObserver} if the system failed to delete the package
1404 * because it is the active DevicePolicy manager.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001405 *
Kenny Rootc39bb4a2011-02-28 13:27:19 -08001406 * @hide
1407 */
1408 public static final int DELETE_FAILED_DEVICE_POLICY_MANAGER = -2;
1409
1410 /**
Amith Yamasanie4cf7342012-12-17 11:12:09 -08001411 * Deletion failed return code: this is passed to the
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001412 * {@link IPackageDeleteObserver} if the system failed to delete the package
1413 * since the user is restricted.
Amith Yamasanie4cf7342012-12-17 11:12:09 -08001414 *
1415 * @hide
1416 */
1417 public static final int DELETE_FAILED_USER_RESTRICTED = -3;
1418
1419 /**
Kenny Guy1b88da52014-07-10 16:33:49 +01001420 * Deletion failed return code: this is passed to the
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001421 * {@link IPackageDeleteObserver} if the system failed to delete the package
1422 * because a profile or device owner has marked the package as
1423 * uninstallable.
Kenny Guyc13053b2014-05-29 14:17:17 +01001424 *
1425 * @hide
1426 */
Jeff Sharkeyf0600952014-08-07 17:31:53 -07001427 public static final int DELETE_FAILED_OWNER_BLOCKED = -4;
1428
1429 /** {@hide} */
1430 public static final int DELETE_FAILED_ABORTED = -5;
Kenny Guyc13053b2014-05-29 14:17:17 +01001431
1432 /**
Svet Ganov67882122016-12-11 16:36:34 -08001433 * Deletion failed return code: this is passed to the
1434 * {@link IPackageDeleteObserver} if the system failed to delete the package
1435 * because the packge is a shared library used by other installed packages.
1436 * {@hide} */
1437 public static final int DELETE_FAILED_USED_SHARED_LIBRARY = -6;
1438
1439 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001440 * Return code that is passed to the {@link IPackageMoveObserver} when the
Kenny Rootc39bb4a2011-02-28 13:27:19 -08001441 * package has been successfully moved by the system.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001442 *
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001443 * @hide
1444 */
Jeff Sharkey620b32b2015-04-23 19:36:02 -07001445 public static final int MOVE_SUCCEEDED = -100;
1446
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001447 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001448 * Error code that is passed to the {@link IPackageMoveObserver} when the
1449 * package hasn't been successfully moved by the system because of
1450 * insufficient memory on specified media.
1451 *
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001452 * @hide
1453 */
1454 public static final int MOVE_FAILED_INSUFFICIENT_STORAGE = -1;
1455
1456 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001457 * Error code that is passed to the {@link IPackageMoveObserver} if the
1458 * specified package doesn't exist.
1459 *
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001460 * @hide
1461 */
1462 public static final int MOVE_FAILED_DOESNT_EXIST = -2;
1463
1464 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001465 * Error code that is passed to the {@link IPackageMoveObserver} if the
1466 * specified package cannot be moved since its a system package.
1467 *
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001468 * @hide
1469 */
1470 public static final int MOVE_FAILED_SYSTEM_PACKAGE = -3;
1471
1472 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001473 * Error code that is passed to the {@link IPackageMoveObserver} if the
1474 * specified package cannot be moved since its forward locked.
1475 *
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001476 * @hide
1477 */
1478 public static final int MOVE_FAILED_FORWARD_LOCKED = -4;
1479
1480 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001481 * Error code that is passed to the {@link IPackageMoveObserver} if the
1482 * specified package cannot be moved to the specified location.
1483 *
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001484 * @hide
1485 */
1486 public static final int MOVE_FAILED_INVALID_LOCATION = -5;
1487
1488 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001489 * Error code that is passed to the {@link IPackageMoveObserver} if the
1490 * specified package cannot be moved to the specified location.
1491 *
Suchi Amalapurapu8a9ab242010-03-11 16:49:16 -08001492 * @hide
1493 */
1494 public static final int MOVE_FAILED_INTERNAL_ERROR = -6;
1495
1496 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001497 * Error code that is passed to the {@link IPackageMoveObserver} if the
1498 * specified package already has an operation pending in the queue.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001499 *
Kenny Rootdeb11262010-08-02 11:36:21 -07001500 * @hide
1501 */
1502 public static final int MOVE_FAILED_OPERATION_PENDING = -7;
1503
1504 /**
Makoto Onukif34db0a2016-02-17 11:17:15 -08001505 * Error code that is passed to the {@link IPackageMoveObserver} if the
1506 * specified package cannot be moved since it contains a device admin.
1507 *
1508 * @hide
1509 */
1510 public static final int MOVE_FAILED_DEVICE_ADMIN = -8;
1511
1512 /**
Yao Chen022b8ea2016-12-16 11:03:28 -08001513 * Error code that is passed to the {@link IPackageMoveObserver} if system does not allow
1514 * non-system apps to be moved to internal storage.
1515 *
1516 * @hide
1517 */
1518 public static final int MOVE_FAILED_3RD_PARTY_NOT_ALLOWED_ON_INTERNAL = -9;
1519
Jeff Sharkeya65e6492017-06-21 13:45:11 -06001520 /** @hide */
1521 public static final int MOVE_FAILED_LOCKED_USER = -10;
1522
Yao Chen022b8ea2016-12-16 11:03:28 -08001523 /**
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001524 * Flag parameter for {@link #movePackage} to indicate that
1525 * the package should be moved to internal storage if its
1526 * been installed on external media.
1527 * @hide
1528 */
Jeff Sharkey620b32b2015-04-23 19:36:02 -07001529 @Deprecated
Mathew Inwood1c77a112018-08-14 14:06:26 +01001530 @UnsupportedAppUsage
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001531 public static final int MOVE_INTERNAL = 0x00000001;
1532
1533 /**
1534 * Flag parameter for {@link #movePackage} to indicate that
1535 * the package should be moved to external media.
1536 * @hide
1537 */
Jeff Sharkey620b32b2015-04-23 19:36:02 -07001538 @Deprecated
Mathew Inwood1c77a112018-08-14 14:06:26 +01001539 @UnsupportedAppUsage
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001540 public static final int MOVE_EXTERNAL_MEDIA = 0x00000002;
1541
Jeff Sharkey620b32b2015-04-23 19:36:02 -07001542 /** {@hide} */
1543 public static final String EXTRA_MOVE_ID = "android.content.pm.extra.MOVE_ID";
1544
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08001545 /**
Kenny Root05ca4c92011-09-15 10:36:25 -07001546 * Usable by the required verifier as the {@code verificationCode} argument
1547 * for {@link PackageManager#verifyPendingInstall} to indicate that it will
1548 * allow the installation to proceed without any of the optional verifiers
1549 * needing to vote.
1550 *
1551 * @hide
1552 */
1553 public static final int VERIFICATION_ALLOW_WITHOUT_SUFFICIENT = 2;
1554
1555 /**
Kenny Root3a9b5fb2011-09-20 14:15:38 -07001556 * Used as the {@code verificationCode} argument for
1557 * {@link PackageManager#verifyPendingInstall} to indicate that the calling
1558 * package verifier allows the installation to proceed.
1559 */
1560 public static final int VERIFICATION_ALLOW = 1;
1561
1562 /**
1563 * Used as the {@code verificationCode} argument for
1564 * {@link PackageManager#verifyPendingInstall} to indicate the calling
1565 * package verifier does not vote to allow the installation to proceed.
1566 */
1567 public static final int VERIFICATION_REJECT = -1;
1568
1569 /**
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001570 * Used as the {@code verificationCode} argument for
1571 * {@link PackageManager#verifyIntentFilter} to indicate that the calling
1572 * IntentFilter Verifier confirms that the IntentFilter is verified.
1573 *
1574 * @hide
1575 */
Todd Kennedydfa93ab2016-03-03 15:24:33 -08001576 @SystemApi
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001577 public static final int INTENT_FILTER_VERIFICATION_SUCCESS = 1;
1578
1579 /**
1580 * Used as the {@code verificationCode} argument for
1581 * {@link PackageManager#verifyIntentFilter} to indicate that the calling
1582 * IntentFilter Verifier confirms that the IntentFilter is NOT verified.
1583 *
1584 * @hide
1585 */
Todd Kennedydfa93ab2016-03-03 15:24:33 -08001586 @SystemApi
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001587 public static final int INTENT_FILTER_VERIFICATION_FAILURE = -1;
1588
1589 /**
1590 * Internal status code to indicate that an IntentFilter verification result is not specified.
1591 *
1592 * @hide
1593 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08001594 @SystemApi
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001595 public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED = 0;
1596
1597 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001598 * Used as the {@code status} argument for
1599 * {@link #updateIntentVerificationStatusAsUser} to indicate that the User
1600 * will always be prompted the Intent Disambiguation Dialog if there are two
1601 * or more Intent resolved for the IntentFilter's domain(s).
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001602 *
1603 * @hide
1604 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08001605 @SystemApi
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001606 public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK = 1;
1607
1608 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001609 * Used as the {@code status} argument for
1610 * {@link #updateIntentVerificationStatusAsUser} to indicate that the User
1611 * will never be prompted the Intent Disambiguation Dialog if there are two
1612 * or more resolution of the Intent. The default App for the domain(s)
1613 * specified in the IntentFilter will also ALWAYS be used.
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001614 *
1615 * @hide
1616 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08001617 @SystemApi
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001618 public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS = 2;
1619
1620 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001621 * Used as the {@code status} argument for
1622 * {@link #updateIntentVerificationStatusAsUser} to indicate that the User
1623 * may be prompted the Intent Disambiguation Dialog if there are two or more
1624 * Intent resolved. The default App for the domain(s) specified in the
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001625 * IntentFilter will also NEVER be presented to the User.
1626 *
1627 * @hide
1628 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08001629 @SystemApi
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08001630 public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER = 3;
1631
1632 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07001633 * Used as the {@code status} argument for
1634 * {@link #updateIntentVerificationStatusAsUser} to indicate that this app
1635 * should always be considered as an ambiguous candidate for handling the
1636 * matching Intent even if there are other candidate apps in the "always"
1637 * state. Put another way: if there are any 'always ask' apps in a set of
1638 * more than one candidate app, then a disambiguation is *always* presented
1639 * even if there is another candidate app with the 'always' state.
Christopher Tate56f0ff32015-08-13 16:29:33 -07001640 *
1641 * @hide
1642 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08001643 @SystemApi
Christopher Tate56f0ff32015-08-13 16:29:33 -07001644 public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS_ASK = 4;
1645
1646 /**
rich canningsd9ef3e52012-08-22 14:28:05 -07001647 * Can be used as the {@code millisecondsToDelay} argument for
1648 * {@link PackageManager#extendVerificationTimeout}. This is the
1649 * maximum time {@code PackageManager} waits for the verification
1650 * agent to return (in milliseconds).
1651 */
1652 public static final long MAXIMUM_VERIFICATION_TIMEOUT = 60*60*1000;
1653
1654 /**
Amith Yamasani0b285492011-04-14 17:35:23 -07001655 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: The device's
1656 * audio pipeline is low-latency, more suitable for audio applications sensitive to delays or
1657 * lag in sound input or output.
Dan Morrill898e1e82010-09-26 17:28:30 -07001658 */
1659 @SdkConstant(SdkConstantType.FEATURE)
1660 public static final String FEATURE_AUDIO_LOW_LATENCY = "android.hardware.audio.low_latency";
1661
1662 /**
1663 * Feature for {@link #getSystemAvailableFeatures} and
Unsuk Jung50909f62014-09-02 18:25:49 -07001664 * {@link #hasSystemFeature}: The device includes at least one form of audio
Glenn Kasten0a111ad2018-05-16 14:11:09 -07001665 * output, as defined in the Android Compatibility Definition Document (CDD)
1666 * <a href="https://source.android.com/compatibility/android-cdd#7_8_audio">section 7.8 Audio</a>.
Unsuk Jung50909f62014-09-02 18:25:49 -07001667 */
1668 @SdkConstant(SdkConstantType.FEATURE)
1669 public static final String FEATURE_AUDIO_OUTPUT = "android.hardware.audio.output";
1670
1671 /**
Glenn Kastencdcb5772015-05-06 15:54:49 -07001672 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Glenn Kasten7587edc2015-10-30 17:45:52 -07001673 * The device has professional audio level of functionality and performance.
Glenn Kastencdcb5772015-05-06 15:54:49 -07001674 */
1675 @SdkConstant(SdkConstantType.FEATURE)
1676 public static final String FEATURE_AUDIO_PRO = "android.hardware.audio.pro";
1677
1678 /**
Unsuk Jung50909f62014-09-02 18:25:49 -07001679 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001680 * {@link #hasSystemFeature}: The device is capable of communicating with
1681 * other devices via Bluetooth.
1682 */
1683 @SdkConstant(SdkConstantType.FEATURE)
1684 public static final String FEATURE_BLUETOOTH = "android.hardware.bluetooth";
1685
1686 /**
1687 * Feature for {@link #getSystemAvailableFeatures} and
Matthew Xiea7227722013-04-18 15:25:59 -07001688 * {@link #hasSystemFeature}: The device is capable of communicating with
1689 * other devices via Bluetooth Low Energy radio.
1690 */
1691 @SdkConstant(SdkConstantType.FEATURE)
1692 public static final String FEATURE_BLUETOOTH_LE = "android.hardware.bluetooth_le";
1693
1694 /**
1695 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001696 * {@link #hasSystemFeature}: The device has a camera facing away
1697 * from the screen.
1698 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001699 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001700 public static final String FEATURE_CAMERA = "android.hardware.camera";
Dan Morrill50ab63f2010-03-05 16:16:19 -08001701
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001702 /**
1703 * Feature for {@link #getSystemAvailableFeatures} and
1704 * {@link #hasSystemFeature}: The device's camera supports auto-focus.
1705 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001706 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001707 public static final String FEATURE_CAMERA_AUTOFOCUS = "android.hardware.camera.autofocus";
Dan Morrill50ab63f2010-03-05 16:16:19 -08001708
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001709 /**
1710 * Feature for {@link #getSystemAvailableFeatures} and
Eino-Ville Talvala752af832012-09-18 14:45:37 -07001711 * {@link #hasSystemFeature}: The device has at least one camera pointing in
Eino-Ville Talvala9131da22014-05-08 11:39:53 -07001712 * some direction, or can support an external camera being connected to it.
Eino-Ville Talvala752af832012-09-18 14:45:37 -07001713 */
1714 @SdkConstant(SdkConstantType.FEATURE)
1715 public static final String FEATURE_CAMERA_ANY = "android.hardware.camera.any";
1716
1717 /**
1718 * Feature for {@link #getSystemAvailableFeatures} and
Eino-Ville Talvala9131da22014-05-08 11:39:53 -07001719 * {@link #hasSystemFeature}: The device can support having an external camera connected to it.
1720 * The external camera may not always be connected or available to applications to use.
1721 */
1722 @SdkConstant(SdkConstantType.FEATURE)
1723 public static final String FEATURE_CAMERA_EXTERNAL = "android.hardware.camera.external";
1724
1725 /**
1726 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001727 * {@link #hasSystemFeature}: The device's camera supports flash.
1728 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001729 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001730 public static final String FEATURE_CAMERA_FLASH = "android.hardware.camera.flash";
Dan Morrill50ab63f2010-03-05 16:16:19 -08001731
1732 /**
1733 * Feature for {@link #getSystemAvailableFeatures} and
Chih-Chung Changde1057c2010-06-14 19:15:00 +08001734 * {@link #hasSystemFeature}: The device has a front facing camera.
1735 */
1736 @SdkConstant(SdkConstantType.FEATURE)
1737 public static final String FEATURE_CAMERA_FRONT = "android.hardware.camera.front";
1738
1739 /**
Eino-Ville Talvala611fece2014-07-10 17:29:38 -07001740 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one
1741 * of the cameras on the device supports the
1742 * {@link android.hardware.camera2.CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL full hardware}
1743 * capability level.
1744 */
1745 @SdkConstant(SdkConstantType.FEATURE)
1746 public static final String FEATURE_CAMERA_LEVEL_FULL = "android.hardware.camera.level.full";
1747
1748 /**
1749 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one
1750 * of the cameras on the device supports the
1751 * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR manual sensor}
1752 * capability level.
1753 */
1754 @SdkConstant(SdkConstantType.FEATURE)
1755 public static final String FEATURE_CAMERA_CAPABILITY_MANUAL_SENSOR =
1756 "android.hardware.camera.capability.manual_sensor";
1757
1758 /**
1759 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one
1760 * of the cameras on the device supports the
1761 * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MANUAL_POST_PROCESSING manual post-processing}
1762 * capability level.
1763 */
1764 @SdkConstant(SdkConstantType.FEATURE)
1765 public static final String FEATURE_CAMERA_CAPABILITY_MANUAL_POST_PROCESSING =
1766 "android.hardware.camera.capability.manual_post_processing";
1767
1768 /**
1769 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one
1770 * of the cameras on the device supports the
1771 * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_RAW RAW}
1772 * capability level.
1773 */
1774 @SdkConstant(SdkConstantType.FEATURE)
1775 public static final String FEATURE_CAMERA_CAPABILITY_RAW =
1776 "android.hardware.camera.capability.raw";
1777
1778 /**
Eino-Ville Talvaladfa0c2a2018-01-10 12:01:08 -08001779 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one
1780 * of the cameras on the device supports the
1781 * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MOTION_TRACKING
1782 * MOTION_TRACKING} capability level.
1783 */
1784 @SdkConstant(SdkConstantType.FEATURE)
1785 public static final String FEATURE_CAMERA_AR =
1786 "android.hardware.camera.ar";
1787
1788 /**
Chih-Chung Changde1057c2010-06-14 19:15:00 +08001789 * Feature for {@link #getSystemAvailableFeatures} and
Alex Ray0c9d61f2013-10-03 12:17:54 -07001790 * {@link #hasSystemFeature}: The device is capable of communicating with
1791 * consumer IR devices.
1792 */
1793 @SdkConstant(SdkConstantType.FEATURE)
1794 public static final String FEATURE_CONSUMER_IR = "android.hardware.consumerir";
1795
Sam Lin90e258b2017-04-03 20:57:45 -07001796 /** {@hide} */
1797 @SdkConstant(SdkConstantType.FEATURE)
1798 public static final String FEATURE_CTS = "android.software.cts";
1799
Alex Ray0c9d61f2013-10-03 12:17:54 -07001800 /**
1801 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001802 * {@link #hasSystemFeature}: The device supports one or more methods of
1803 * reporting current location.
1804 */
1805 @SdkConstant(SdkConstantType.FEATURE)
1806 public static final String FEATURE_LOCATION = "android.hardware.location";
1807
1808 /**
1809 * Feature for {@link #getSystemAvailableFeatures} and
1810 * {@link #hasSystemFeature}: The device has a Global Positioning System
1811 * receiver and can report precise location.
1812 */
1813 @SdkConstant(SdkConstantType.FEATURE)
1814 public static final String FEATURE_LOCATION_GPS = "android.hardware.location.gps";
1815
1816 /**
1817 * Feature for {@link #getSystemAvailableFeatures} and
1818 * {@link #hasSystemFeature}: The device can report location with coarse
1819 * accuracy using a network-based geolocation system.
1820 */
1821 @SdkConstant(SdkConstantType.FEATURE)
1822 public static final String FEATURE_LOCATION_NETWORK = "android.hardware.location.network";
1823
1824 /**
1825 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn2a103f12017-08-08 15:50:31 -07001826 * {@link #hasSystemFeature}: The device's
1827 * {@link ActivityManager#isLowRamDevice() ActivityManager.isLowRamDevice()} method returns
1828 * true.
1829 */
1830 @SdkConstant(SdkConstantType.FEATURE)
1831 public static final String FEATURE_RAM_LOW = "android.hardware.ram.low";
1832
1833 /**
1834 * Feature for {@link #getSystemAvailableFeatures} and
1835 * {@link #hasSystemFeature}: The device's
1836 * {@link ActivityManager#isLowRamDevice() ActivityManager.isLowRamDevice()} method returns
1837 * false.
1838 */
1839 @SdkConstant(SdkConstantType.FEATURE)
1840 public static final String FEATURE_RAM_NORMAL = "android.hardware.ram.normal";
1841
1842 /**
1843 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001844 * {@link #hasSystemFeature}: The device can record audio via a
1845 * microphone.
1846 */
1847 @SdkConstant(SdkConstantType.FEATURE)
1848 public static final String FEATURE_MICROPHONE = "android.hardware.microphone";
1849
1850 /**
1851 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill76437d32010-09-01 11:17:20 -07001852 * {@link #hasSystemFeature}: The device can communicate using Near-Field
1853 * Communications (NFC).
1854 */
1855 @SdkConstant(SdkConstantType.FEATURE)
1856 public static final String FEATURE_NFC = "android.hardware.nfc";
1857
1858 /**
1859 * Feature for {@link #getSystemAvailableFeatures} and
Martijn Coenenf4bf1582013-07-22 12:01:19 -07001860 * {@link #hasSystemFeature}: The device supports host-
1861 * based NFC card emulation.
Martijn Coenendf4d1d62013-08-28 11:18:58 -07001862 *
1863 * TODO remove when depending apps have moved to new constant.
1864 * @hide
1865 * @deprecated
Martijn Coenenf4bf1582013-07-22 12:01:19 -07001866 */
Jose Lima970417c2014-04-10 10:42:19 -07001867 @Deprecated
Martijn Coenenf4bf1582013-07-22 12:01:19 -07001868 @SdkConstant(SdkConstantType.FEATURE)
1869 public static final String FEATURE_NFC_HCE = "android.hardware.nfc.hce";
1870
1871 /**
1872 * Feature for {@link #getSystemAvailableFeatures} and
Martijn Coenendf4d1d62013-08-28 11:18:58 -07001873 * {@link #hasSystemFeature}: The device supports host-
1874 * based NFC card emulation.
1875 */
1876 @SdkConstant(SdkConstantType.FEATURE)
1877 public static final String FEATURE_NFC_HOST_CARD_EMULATION = "android.hardware.nfc.hce";
1878
1879 /**
1880 * Feature for {@link #getSystemAvailableFeatures} and
Yoshinobu Itoc52adfe2016-01-22 18:14:18 +09001881 * {@link #hasSystemFeature}: The device supports host-
1882 * based NFC-F card emulation.
1883 */
1884 @SdkConstant(SdkConstantType.FEATURE)
1885 public static final String FEATURE_NFC_HOST_CARD_EMULATION_NFCF = "android.hardware.nfc.hcef";
1886
1887 /**
1888 * Feature for {@link #getSystemAvailableFeatures} and
Martijn Coenen441d61b2017-04-12 13:52:40 -07001889 * {@link #hasSystemFeature}: The device supports any
1890 * one of the {@link #FEATURE_NFC}, {@link #FEATURE_NFC_HOST_CARD_EMULATION},
1891 * or {@link #FEATURE_NFC_HOST_CARD_EMULATION_NFCF} features.
1892 *
1893 * @hide
1894 */
1895 @SdkConstant(SdkConstantType.FEATURE)
1896 public static final String FEATURE_NFC_ANY = "android.hardware.nfc.any";
1897
1898 /**
1899 * Feature for {@link #getSystemAvailableFeatures} and
Jesse Hall7f517062014-07-18 11:54:41 -07001900 * {@link #hasSystemFeature}: The device supports the OpenGL ES
1901 * <a href="http://www.khronos.org/registry/gles/extensions/ANDROID/ANDROID_extension_pack_es31a.txt">
1902 * Android Extension Pack</a>.
1903 */
1904 @SdkConstant(SdkConstantType.FEATURE)
1905 public static final String FEATURE_OPENGLES_EXTENSION_PACK = "android.hardware.opengles.aep";
1906
1907 /**
1908 * Feature for {@link #getSystemAvailableFeatures} and
Jesse Hall39ceeb52016-03-10 09:04:26 -08001909 * {@link #hasSystemFeature(String, int)}: If this feature is supported, the Vulkan native API
1910 * will enumerate at least one {@code VkPhysicalDevice}, and the feature version will indicate
1911 * what level of optional hardware features limits it supports.
Jesse Hallf77a34f2016-02-04 18:41:33 -08001912 * <p>
1913 * Level 0 includes the base Vulkan requirements as well as:
1914 * <ul><li>{@code VkPhysicalDeviceFeatures::textureCompressionETC2}</li></ul>
1915 * <p>
1916 * Level 1 additionally includes:
1917 * <ul>
1918 * <li>{@code VkPhysicalDeviceFeatures::fullDrawIndexUint32}</li>
1919 * <li>{@code VkPhysicalDeviceFeatures::imageCubeArray}</li>
1920 * <li>{@code VkPhysicalDeviceFeatures::independentBlend}</li>
1921 * <li>{@code VkPhysicalDeviceFeatures::geometryShader}</li>
1922 * <li>{@code VkPhysicalDeviceFeatures::tessellationShader}</li>
1923 * <li>{@code VkPhysicalDeviceFeatures::sampleRateShading}</li>
1924 * <li>{@code VkPhysicalDeviceFeatures::textureCompressionASTC_LDR}</li>
1925 * <li>{@code VkPhysicalDeviceFeatures::fragmentStoresAndAtomics}</li>
1926 * <li>{@code VkPhysicalDeviceFeatures::shaderImageGatherExtended}</li>
1927 * <li>{@code VkPhysicalDeviceFeatures::shaderUniformBufferArrayDynamicIndexing}</li>
1928 * <li>{@code VkPhysicalDeviceFeatures::shaderSampledImageArrayDynamicIndexing}</li>
1929 * </ul>
1930 */
1931 @SdkConstant(SdkConstantType.FEATURE)
1932 public static final String FEATURE_VULKAN_HARDWARE_LEVEL = "android.hardware.vulkan.level";
1933
1934 /**
1935 * Feature for {@link #getSystemAvailableFeatures} and
Jesse Hall1cd7e932017-02-05 19:58:15 -08001936 * {@link #hasSystemFeature(String, int)}: If this feature is supported, the Vulkan native API
1937 * will enumerate at least one {@code VkPhysicalDevice}, and the feature version will indicate
Jesse Hall54fc6092017-08-22 07:19:56 -07001938 * what level of optional compute features that device supports beyond the Vulkan 1.0
1939 * requirements.
Jesse Hall1cd7e932017-02-05 19:58:15 -08001940 * <p>
Jesse Hall54fc6092017-08-22 07:19:56 -07001941 * Compute level 0 indicates:
1942 * <ul>
1943 * <li>The {@code VK_KHR_variable_pointers} extension and
1944 * {@code VkPhysicalDeviceVariablePointerFeaturesKHR::variablePointers} feature are
1945 supported.</li>
1946 * <li>{@code VkPhysicalDeviceLimits::maxPerStageDescriptorStorageBuffers} is at least 16.</li>
1947 * </ul>
Jesse Hall1cd7e932017-02-05 19:58:15 -08001948 */
1949 @SdkConstant(SdkConstantType.FEATURE)
1950 public static final String FEATURE_VULKAN_HARDWARE_COMPUTE = "android.hardware.vulkan.compute";
1951
1952 /**
1953 * Feature for {@link #getSystemAvailableFeatures} and
Jesse Hall39ceeb52016-03-10 09:04:26 -08001954 * {@link #hasSystemFeature(String, int)}: The version of this feature indicates the highest
Jesse Hallf77a34f2016-02-04 18:41:33 -08001955 * {@code VkPhysicalDeviceProperties::apiVersion} supported by the physical devices that support
1956 * the hardware level indicated by {@link #FEATURE_VULKAN_HARDWARE_LEVEL}. The feature version
1957 * uses the same encoding as Vulkan version numbers:
1958 * <ul>
1959 * <li>Major version number in bits 31-22</li>
1960 * <li>Minor version number in bits 21-12</li>
1961 * <li>Patch version number in bits 11-0</li>
1962 * </ul>
Jesse Hall239373f2018-01-26 11:35:10 +08001963 * A version of 1.1.0 or higher also indicates:
1964 * <ul>
Jesse Hall239373f2018-01-26 11:35:10 +08001965 * <li>{@code SYNC_FD} external semaphore and fence handles are supported.</li>
1966 * <li>{@code VkPhysicalDeviceSamplerYcbcrConversionFeatures::samplerYcbcrConversion} is
1967 * supported.</li>
1968 * </ul>
Jesse Hallf77a34f2016-02-04 18:41:33 -08001969 */
1970 @SdkConstant(SdkConstantType.FEATURE)
1971 public static final String FEATURE_VULKAN_HARDWARE_VERSION = "android.hardware.vulkan.version";
1972
1973 /**
Tomasz Wasilczyk05392d62017-07-10 19:33:22 -07001974 * Feature for {@link #getSystemAvailableFeatures} and
1975 * {@link #hasSystemFeature}: The device includes broadcast radio tuner.
1976 * @hide
Tomasz Wasilczyk347192e2017-04-04 11:13:44 -07001977 */
Tomasz Wasilczyk05392d62017-07-10 19:33:22 -07001978 @SystemApi
Tomasz Wasilczyk347192e2017-04-04 11:13:44 -07001979 @SdkConstant(SdkConstantType.FEATURE)
Tomasz Wasilczyk05392d62017-07-10 19:33:22 -07001980 public static final String FEATURE_BROADCAST_RADIO = "android.hardware.broadcastradio";
Tomasz Wasilczyk347192e2017-04-04 11:13:44 -07001981
1982 /**
Jesse Hallf77a34f2016-02-04 18:41:33 -08001983 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill5744bb42010-09-01 19:18:57 -07001984 * {@link #hasSystemFeature}: The device includes an accelerometer.
1985 */
1986 @SdkConstant(SdkConstantType.FEATURE)
1987 public static final String FEATURE_SENSOR_ACCELEROMETER = "android.hardware.sensor.accelerometer";
1988
1989 /**
1990 * Feature for {@link #getSystemAvailableFeatures} and
1991 * {@link #hasSystemFeature}: The device includes a barometer (air
1992 * pressure sensor.)
1993 */
1994 @SdkConstant(SdkConstantType.FEATURE)
1995 public static final String FEATURE_SENSOR_BAROMETER = "android.hardware.sensor.barometer";
1996
1997 /**
1998 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001999 * {@link #hasSystemFeature}: The device includes a magnetometer (compass).
2000 */
2001 @SdkConstant(SdkConstantType.FEATURE)
2002 public static final String FEATURE_SENSOR_COMPASS = "android.hardware.sensor.compass";
2003
2004 /**
2005 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill5744bb42010-09-01 19:18:57 -07002006 * {@link #hasSystemFeature}: The device includes a gyroscope.
Dan Morrill50ab63f2010-03-05 16:16:19 -08002007 */
2008 @SdkConstant(SdkConstantType.FEATURE)
Dan Morrill5744bb42010-09-01 19:18:57 -07002009 public static final String FEATURE_SENSOR_GYROSCOPE = "android.hardware.sensor.gyroscope";
Dan Morrill50ab63f2010-03-05 16:16:19 -08002010
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002011 /**
2012 * Feature for {@link #getSystemAvailableFeatures} and
2013 * {@link #hasSystemFeature}: The device includes a light sensor.
2014 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08002015 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002016 public static final String FEATURE_SENSOR_LIGHT = "android.hardware.sensor.light";
Dan Morrill50ab63f2010-03-05 16:16:19 -08002017
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002018 /**
2019 * Feature for {@link #getSystemAvailableFeatures} and
2020 * {@link #hasSystemFeature}: The device includes a proximity sensor.
2021 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08002022 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002023 public static final String FEATURE_SENSOR_PROXIMITY = "android.hardware.sensor.proximity";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002024
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002025 /**
2026 * Feature for {@link #getSystemAvailableFeatures} and
Aravind Akella068b0c02013-10-12 17:39:15 -07002027 * {@link #hasSystemFeature}: The device includes a hardware step counter.
2028 */
2029 @SdkConstant(SdkConstantType.FEATURE)
2030 public static final String FEATURE_SENSOR_STEP_COUNTER = "android.hardware.sensor.stepcounter";
2031
2032 /**
2033 * Feature for {@link #getSystemAvailableFeatures} and
2034 * {@link #hasSystemFeature}: The device includes a hardware step detector.
2035 */
2036 @SdkConstant(SdkConstantType.FEATURE)
2037 public static final String FEATURE_SENSOR_STEP_DETECTOR = "android.hardware.sensor.stepdetector";
2038
2039 /**
2040 * Feature for {@link #getSystemAvailableFeatures} and
Vinod Krishnan8afb23c2014-04-30 11:11:39 -07002041 * {@link #hasSystemFeature}: The device includes a heart rate monitor.
2042 */
2043 @SdkConstant(SdkConstantType.FEATURE)
2044 public static final String FEATURE_SENSOR_HEART_RATE = "android.hardware.sensor.heartrate";
2045
2046 /**
2047 * Feature for {@link #getSystemAvailableFeatures} and
Trevor Johns682c24e2016-04-12 10:13:47 -07002048 * {@link #hasSystemFeature}: The heart rate sensor on this device is an Electrocardiogram.
Vinod Krishnan1ab76892014-08-20 11:11:55 -07002049 */
2050 @SdkConstant(SdkConstantType.FEATURE)
2051 public static final String FEATURE_SENSOR_HEART_RATE_ECG =
2052 "android.hardware.sensor.heartrate.ecg";
2053
2054 /**
2055 * Feature for {@link #getSystemAvailableFeatures} and
Aravind Akella8b8e74b2014-07-09 11:52:39 -07002056 * {@link #hasSystemFeature}: The device includes a relative humidity sensor.
2057 */
2058 @SdkConstant(SdkConstantType.FEATURE)
2059 public static final String FEATURE_SENSOR_RELATIVE_HUMIDITY =
2060 "android.hardware.sensor.relative_humidity";
2061
2062 /**
2063 * Feature for {@link #getSystemAvailableFeatures} and
2064 * {@link #hasSystemFeature}: The device includes an ambient temperature sensor.
2065 */
2066 @SdkConstant(SdkConstantType.FEATURE)
2067 public static final String FEATURE_SENSOR_AMBIENT_TEMPERATURE =
2068 "android.hardware.sensor.ambient_temperature";
2069
2070 /**
2071 * Feature for {@link #getSystemAvailableFeatures} and
Ashutosh Joshieae371b2015-04-09 10:30:07 -07002072 * {@link #hasSystemFeature}: The device supports high fidelity sensor processing
2073 * capabilities.
2074 */
2075 @SdkConstant(SdkConstantType.FEATURE)
2076 public static final String FEATURE_HIFI_SENSORS =
2077 "android.hardware.sensor.hifi_sensors";
2078
2079 /**
Philip Quinnb6bd3012018-02-09 17:56:40 -08002080 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2081 * The device supports a hardware mechanism for invoking an assist gesture.
2082 * @see android.provider.Settings.Secure#ASSIST_GESTURE_ENABLED
2083 * @hide
2084 */
2085 @SdkConstant(SdkConstantType.FEATURE)
2086 public static final String FEATURE_ASSIST_GESTURE = "android.hardware.sensor.assist";
2087
2088 /**
Ashutosh Joshieae371b2015-04-09 10:30:07 -07002089 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002090 * {@link #hasSystemFeature}: The device has a telephony radio with data
2091 * communication support.
2092 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08002093 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002094 public static final String FEATURE_TELEPHONY = "android.hardware.telephony";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002095
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002096 /**
2097 * Feature for {@link #getSystemAvailableFeatures} and
2098 * {@link #hasSystemFeature}: The device has a CDMA telephony stack.
2099 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08002100 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002101 public static final String FEATURE_TELEPHONY_CDMA = "android.hardware.telephony.cdma";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002102
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002103 /**
2104 * Feature for {@link #getSystemAvailableFeatures} and
2105 * {@link #hasSystemFeature}: The device has a GSM telephony stack.
2106 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08002107 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002108 public static final String FEATURE_TELEPHONY_GSM = "android.hardware.telephony.gsm";
Hung-ying Tyan3424c022010-08-27 18:08:19 +08002109
2110 /**
Polina Bondarenko80909ce2017-01-12 21:10:38 +01002111 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2112 * The device supports telephony carrier restriction mechanism.
2113 *
2114 * <p>Devices declaring this feature must have an implementation of the
2115 * {@link android.telephony.TelephonyManager#getAllowedCarriers} and
2116 * {@link android.telephony.TelephonyManager#setAllowedCarriers}.
2117 * @hide
2118 */
2119 @SystemApi
2120 @SdkConstant(SdkConstantType.FEATURE)
2121 public static final String FEATURE_TELEPHONY_CARRIERLOCK =
2122 "android.hardware.telephony.carrierlock";
2123
2124 /**
Jeff Davidson35cda392017-02-27 09:46:00 -08002125 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: The device
2126 * supports embedded subscriptions on eUICCs.
Jeff Davidson35cda392017-02-27 09:46:00 -08002127 */
2128 @SdkConstant(SdkConstantType.FEATURE)
2129 public static final String FEATURE_TELEPHONY_EUICC = "android.hardware.telephony.euicc";
2130
2131 /**
Hall Liuc6703d92017-11-17 11:31:57 -08002132 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: The device
2133 * supports cell-broadcast reception using the MBMS APIs.
2134 */
2135 @SdkConstant(SdkConstantType.FEATURE)
2136 public static final String FEATURE_TELEPHONY_MBMS = "android.hardware.telephony.mbms";
2137
2138 /**
Hung-ying Tyan3424c022010-08-27 18:08:19 +08002139 * Feature for {@link #getSystemAvailableFeatures} and
Mike Lockwoodf4ca2472011-02-27 11:23:25 -08002140 * {@link #hasSystemFeature}: The device supports connecting to USB devices
2141 * as the USB host.
2142 */
2143 @SdkConstant(SdkConstantType.FEATURE)
2144 public static final String FEATURE_USB_HOST = "android.hardware.usb.host";
2145
2146 /**
2147 * Feature for {@link #getSystemAvailableFeatures} and
2148 * {@link #hasSystemFeature}: The device supports connecting to USB accessories.
2149 */
2150 @SdkConstant(SdkConstantType.FEATURE)
2151 public static final String FEATURE_USB_ACCESSORY = "android.hardware.usb.accessory";
2152
2153 /**
2154 * Feature for {@link #getSystemAvailableFeatures} and
Hung-ying Tyan3424c022010-08-27 18:08:19 +08002155 * {@link #hasSystemFeature}: The SIP API is enabled on the device.
2156 */
2157 @SdkConstant(SdkConstantType.FEATURE)
2158 public static final String FEATURE_SIP = "android.software.sip";
2159
2160 /**
2161 * Feature for {@link #getSystemAvailableFeatures} and
2162 * {@link #hasSystemFeature}: The device supports SIP-based VOIP.
2163 */
2164 @SdkConstant(SdkConstantType.FEATURE)
2165 public static final String FEATURE_SIP_VOIP = "android.software.sip.voip";
2166
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002167 /**
2168 * Feature for {@link #getSystemAvailableFeatures} and
Ihab Awad1ec68882014-09-12 11:09:01 -07002169 * {@link #hasSystemFeature}: The Connection Service API is enabled on the device.
2170 */
2171 @SdkConstant(SdkConstantType.FEATURE)
2172 public static final String FEATURE_CONNECTION_SERVICE = "android.software.connectionservice";
2173
2174 /**
2175 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrillb0fe0332010-04-05 14:43:58 -07002176 * {@link #hasSystemFeature}: The device's display has a touch screen.
2177 */
2178 @SdkConstant(SdkConstantType.FEATURE)
2179 public static final String FEATURE_TOUCHSCREEN = "android.hardware.touchscreen";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002180
Dan Morrillb0fe0332010-04-05 14:43:58 -07002181 /**
2182 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08002183 * {@link #hasSystemFeature}: The device's touch screen supports
2184 * multitouch sufficient for basic two-finger gesture detection.
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002185 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08002186 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002187 public static final String FEATURE_TOUCHSCREEN_MULTITOUCH = "android.hardware.touchscreen.multitouch";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002188
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002189 /**
2190 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08002191 * {@link #hasSystemFeature}: The device's touch screen is capable of
2192 * tracking two or more fingers fully independently.
2193 */
2194 @SdkConstant(SdkConstantType.FEATURE)
2195 public static final String FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT = "android.hardware.touchscreen.multitouch.distinct";
2196
2197 /**
2198 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill6993d3d2010-09-03 14:30:14 -07002199 * {@link #hasSystemFeature}: The device's touch screen is capable of
2200 * tracking a full hand of fingers fully independently -- that is, 5 or
2201 * more simultaneous independent pointers.
2202 */
2203 @SdkConstant(SdkConstantType.FEATURE)
2204 public static final String FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND = "android.hardware.touchscreen.multitouch.jazzhand";
2205
2206 /**
2207 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrilla5376872011-01-23 13:15:53 -08002208 * {@link #hasSystemFeature}: The device does not have a touch screen, but
2209 * does support touch emulation for basic events. For instance, the
2210 * device might use a mouse or remote control to drive a cursor, and
2211 * emulate basic touch pointer events like down, up, drag, etc. All
2212 * devices that support android.hardware.touchscreen or a sub-feature are
2213 * presumed to also support faketouch.
2214 */
2215 @SdkConstant(SdkConstantType.FEATURE)
2216 public static final String FEATURE_FAKETOUCH = "android.hardware.faketouch";
2217
2218 /**
2219 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborne22fe932011-06-08 20:24:29 -07002220 * {@link #hasSystemFeature}: The device does not have a touch screen, but
2221 * does support touch emulation for basic events that supports distinct
2222 * tracking of two or more fingers. This is an extension of
2223 * {@link #FEATURE_FAKETOUCH} for input devices with this capability. Note
2224 * that unlike a distinct multitouch screen as defined by
2225 * {@link #FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT}, these kinds of input
2226 * devices will not actually provide full two-finger gestures since the
2227 * input is being transformed to cursor movement on the screen. That is,
2228 * single finger gestures will move a cursor; two-finger swipes will
2229 * result in single-finger touch events; other two-finger gestures will
2230 * result in the corresponding two-finger touch event.
2231 */
2232 @SdkConstant(SdkConstantType.FEATURE)
2233 public static final String FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT = "android.hardware.faketouch.multitouch.distinct";
2234
2235 /**
2236 * Feature for {@link #getSystemAvailableFeatures} and
2237 * {@link #hasSystemFeature}: The device does not have a touch screen, but
2238 * does support touch emulation for basic events that supports tracking
2239 * a hand of fingers (5 or more fingers) fully independently.
2240 * This is an extension of
2241 * {@link #FEATURE_FAKETOUCH} for input devices with this capability. Note
2242 * that unlike a multitouch screen as defined by
2243 * {@link #FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND}, not all two finger
2244 * gestures can be detected due to the limitations described for
2245 * {@link #FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT}.
2246 */
2247 @SdkConstant(SdkConstantType.FEATURE)
2248 public static final String FEATURE_FAKETOUCH_MULTITOUCH_JAZZHAND = "android.hardware.faketouch.multitouch.jazzhand";
2249
2250 /**
2251 * Feature for {@link #getSystemAvailableFeatures} and
Jim Millerd9b9d412015-07-22 19:51:40 -07002252 * {@link #hasSystemFeature}: The device has biometric hardware to detect a fingerprint.
2253 */
2254 @SdkConstant(SdkConstantType.FEATURE)
2255 public static final String FEATURE_FINGERPRINT = "android.hardware.fingerprint";
2256
2257 /**
2258 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborne289bff2011-06-13 19:33:22 -07002259 * {@link #hasSystemFeature}: The device supports portrait orientation
2260 * screens. For backwards compatibility, you can assume that if neither
2261 * this nor {@link #FEATURE_SCREEN_LANDSCAPE} is set then the device supports
2262 * both portrait and landscape.
2263 */
2264 @SdkConstant(SdkConstantType.FEATURE)
2265 public static final String FEATURE_SCREEN_PORTRAIT = "android.hardware.screen.portrait";
2266
2267 /**
2268 * Feature for {@link #getSystemAvailableFeatures} and
2269 * {@link #hasSystemFeature}: The device supports landscape orientation
2270 * screens. For backwards compatibility, you can assume that if neither
2271 * this nor {@link #FEATURE_SCREEN_PORTRAIT} is set then the device supports
2272 * both portrait and landscape.
2273 */
2274 @SdkConstant(SdkConstantType.FEATURE)
2275 public static final String FEATURE_SCREEN_LANDSCAPE = "android.hardware.screen.landscape";
2276
2277 /**
2278 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002279 * {@link #hasSystemFeature}: The device supports live wallpapers.
2280 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08002281 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002282 public static final String FEATURE_LIVE_WALLPAPER = "android.software.live_wallpaper";
Oscar Montemayor1228d0a2010-01-28 12:01:44 -08002283 /**
Dan Morrill50ab63f2010-03-05 16:16:19 -08002284 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn119bbc32013-03-22 17:27:25 -07002285 * {@link #hasSystemFeature}: The device supports app widgets.
2286 */
2287 @SdkConstant(SdkConstantType.FEATURE)
2288 public static final String FEATURE_APP_WIDGETS = "android.software.app_widgets";
Dianne Hackbornc8e4fad2018-05-04 11:31:09 -07002289 /**
2290 * Feature for {@link #getSystemAvailableFeatures} and
2291 * {@link #hasSystemFeature}: The device supports the
2292 * {@link android.R.attr#cantSaveState} API.
2293 */
2294 @SdkConstant(SdkConstantType.FEATURE)
2295 public static final String FEATURE_CANT_SAVE_STATE = "android.software.cant_save_state";
Dianne Hackborn119bbc32013-03-22 17:27:25 -07002296
2297 /**
Dianne Hackborn91097de2014-04-04 18:02:06 -07002298 * @hide
2299 * Feature for {@link #getSystemAvailableFeatures} and
2300 * {@link #hasSystemFeature}: The device supports
2301 * {@link android.service.voice.VoiceInteractionService} and
2302 * {@link android.app.VoiceInteractor}.
2303 */
2304 @SdkConstant(SdkConstantType.FEATURE)
2305 public static final String FEATURE_VOICE_RECOGNIZERS = "android.software.voice_recognizers";
2306
2307
2308 /**
Dianne Hackborn119bbc32013-03-22 17:27:25 -07002309 * Feature for {@link #getSystemAvailableFeatures} and
2310 * {@link #hasSystemFeature}: The device supports a home screen that is replaceable
2311 * by third party applications.
2312 */
2313 @SdkConstant(SdkConstantType.FEATURE)
2314 public static final String FEATURE_HOME_SCREEN = "android.software.home_screen";
2315
2316 /**
2317 * Feature for {@link #getSystemAvailableFeatures} and
2318 * {@link #hasSystemFeature}: The device supports adding new input methods implemented
2319 * with the {@link android.inputmethodservice.InputMethodService} API.
2320 */
2321 @SdkConstant(SdkConstantType.FEATURE)
2322 public static final String FEATURE_INPUT_METHODS = "android.software.input_methods";
2323
2324 /**
2325 * Feature for {@link #getSystemAvailableFeatures} and
Amith Yamasani44a01b72013-09-16 10:44:57 -07002326 * {@link #hasSystemFeature}: The device supports device policy enforcement via device admins.
2327 */
2328 @SdkConstant(SdkConstantType.FEATURE)
2329 public static final String FEATURE_DEVICE_ADMIN = "android.software.device_admin";
2330
2331 /**
2332 * Feature for {@link #getSystemAvailableFeatures} and
Tim Kilbournf94b6a92014-03-07 15:13:48 -08002333 * {@link #hasSystemFeature}: The device supports leanback UI. This is
2334 * typically used in a living room television experience, but is a software
2335 * feature unlike {@link #FEATURE_TELEVISION}. Devices running with this
2336 * feature will use resources associated with the "television" UI mode.
2337 */
2338 @SdkConstant(SdkConstantType.FEATURE)
2339 public static final String FEATURE_LEANBACK = "android.software.leanback";
2340
2341 /**
2342 * Feature for {@link #getSystemAvailableFeatures} and
2343 * {@link #hasSystemFeature}: The device supports only leanback UI. Only
2344 * applications designed for this experience should be run, though this is
2345 * not enforced by the system.
Tim Kilbournf94b6a92014-03-07 15:13:48 -08002346 */
2347 @SdkConstant(SdkConstantType.FEATURE)
2348 public static final String FEATURE_LEANBACK_ONLY = "android.software.leanback_only";
2349
2350 /**
2351 * Feature for {@link #getSystemAvailableFeatures} and
Jae Seocfd861e2014-08-27 14:02:15 -07002352 * {@link #hasSystemFeature}: The device supports live TV and can display
2353 * contents from TV inputs implemented with the
2354 * {@link android.media.tv.TvInputService} API.
2355 */
2356 @SdkConstant(SdkConstantType.FEATURE)
2357 public static final String FEATURE_LIVE_TV = "android.software.live_tv";
2358
2359 /**
2360 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08002361 * {@link #hasSystemFeature}: The device supports WiFi (802.11) networking.
2362 */
2363 @SdkConstant(SdkConstantType.FEATURE)
2364 public static final String FEATURE_WIFI = "android.hardware.wifi";
2365
2366 /**
Irfan Sheriff45b8b462011-09-07 11:24:16 -07002367 * Feature for {@link #getSystemAvailableFeatures} and
2368 * {@link #hasSystemFeature}: The device supports Wi-Fi Direct networking.
2369 */
2370 @SdkConstant(SdkConstantType.FEATURE)
2371 public static final String FEATURE_WIFI_DIRECT = "android.hardware.wifi.direct";
2372
2373 /**
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07002374 * Feature for {@link #getSystemAvailableFeatures} and
Etan Cohen04133272016-10-26 11:22:06 -07002375 * {@link #hasSystemFeature}: The device supports Wi-Fi Aware.
Etan Cohen20d329b2015-09-29 13:49:02 -07002376 */
2377 @SdkConstant(SdkConstantType.FEATURE)
Etan Cohen04133272016-10-26 11:22:06 -07002378 public static final String FEATURE_WIFI_AWARE = "android.hardware.wifi.aware";
Etan Cohen20d329b2015-09-29 13:49:02 -07002379
2380 /**
2381 * Feature for {@link #getSystemAvailableFeatures} and
Peter Qiu3d615e42017-08-07 20:13:32 +00002382 * {@link #hasSystemFeature}: The device supports Wi-Fi Passpoint and all
2383 * Passpoint related APIs in {@link WifiManager} are supported. Refer to
2384 * {@link WifiManager#addOrUpdatePasspointConfiguration} for more info.
Peter Qiub99fe312017-05-05 13:48:47 -07002385 */
2386 @SdkConstant(SdkConstantType.FEATURE)
2387 public static final String FEATURE_WIFI_PASSPOINT = "android.hardware.wifi.passpoint";
2388
2389 /**
2390 * Feature for {@link #getSystemAvailableFeatures} and
Etan Cohen692e68e2017-09-14 15:42:01 -07002391 * {@link #hasSystemFeature}: The device supports Wi-Fi RTT (IEEE 802.11mc).
Etan Cohen692e68e2017-09-14 15:42:01 -07002392 */
2393 @SdkConstant(SdkConstantType.FEATURE)
2394 public static final String FEATURE_WIFI_RTT = "android.hardware.wifi.rtt";
2395
2396
2397 /**
2398 * Feature for {@link #getSystemAvailableFeatures} and
Robert Quattlebaum87a71042017-05-15 15:45:20 -07002399 * {@link #hasSystemFeature}: The device supports LoWPAN networking.
2400 * @hide
2401 */
2402 @SdkConstant(SdkConstantType.FEATURE)
2403 public static final String FEATURE_LOWPAN = "android.hardware.lowpan";
2404
2405 /**
2406 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07002407 * {@link #hasSystemFeature}: This is a device dedicated to showing UI
Todd Kennedy7f95a002015-04-22 14:28:25 -07002408 * on a vehicle headunit. A headunit here is defined to be inside a
2409 * vehicle that may or may not be moving. A headunit uses either a
2410 * primary display in the center console and/or additional displays in
2411 * the instrument cluster or elsewhere in the vehicle. Headunit display(s)
2412 * have limited size and resolution. The user will likely be focused on
2413 * driving so limiting driver distraction is a primary concern. User input
2414 * can be a variety of hard buttons, touch, rotary controllers and even mouse-
2415 * like interfaces.
2416 */
2417 @SdkConstant(SdkConstantType.FEATURE)
2418 public static final String FEATURE_AUTOMOTIVE = "android.hardware.type.automotive";
2419
2420 /**
2421 * Feature for {@link #getSystemAvailableFeatures} and
2422 * {@link #hasSystemFeature}: This is a device dedicated to showing UI
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07002423 * on a television. Television here is defined to be a typical living
2424 * room television experience: displayed on a big screen, where the user
2425 * is sitting far away from it, and the dominant form of input will be
2426 * something like a DPAD, not through touch or mouse.
Tim Kilbournf94b6a92014-03-07 15:13:48 -08002427 * @deprecated use {@link #FEATURE_LEANBACK} instead.
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07002428 */
Jose Lima970417c2014-04-10 10:42:19 -07002429 @Deprecated
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07002430 @SdkConstant(SdkConstantType.FEATURE)
2431 public static final String FEATURE_TELEVISION = "android.hardware.type.television";
2432
2433 /**
Justin Kohb5731f091c2014-02-13 16:06:59 -08002434 * Feature for {@link #getSystemAvailableFeatures} and
2435 * {@link #hasSystemFeature}: This is a device dedicated to showing UI
2436 * on a watch. A watch here is defined to be a device worn on the body, perhaps on
2437 * the wrist. The user is very close when interacting with the device.
2438 */
2439 @SdkConstant(SdkConstantType.FEATURE)
2440 public static final String FEATURE_WATCH = "android.hardware.type.watch";
2441
2442 /**
Ralph Nathanb8e0dee2017-01-24 15:24:59 -08002443 * Feature for {@link #getSystemAvailableFeatures} and
2444 * {@link #hasSystemFeature}: This is a device for IoT and may not have an UI. An embedded
2445 * device is defined as a full stack Android device with or without a display and no
2446 * user-installable apps.
2447 */
2448 @SdkConstant(SdkConstantType.FEATURE)
2449 public static final String FEATURE_EMBEDDED = "android.hardware.type.embedded";
2450
2451 /**
Dennis Kempin7345ed52017-04-14 16:40:56 -07002452 * Feature for {@link #getSystemAvailableFeatures} and
2453 * {@link #hasSystemFeature}: This is a device dedicated to be primarily used
2454 * with keyboard, mouse or touchpad. This includes traditional desktop
2455 * computers, laptops and variants such as convertibles or detachables.
2456 * Due to the larger screen, the device will most likely use the
2457 * {@link #FEATURE_FREEFORM_WINDOW_MANAGEMENT} feature as well.
2458 */
2459 @SdkConstant(SdkConstantType.FEATURE)
2460 public static final String FEATURE_PC = "android.hardware.type.pc";
2461
2462 /**
Adam Lesinski3d9bcb92014-02-18 14:05:14 -08002463 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2464 * The device supports printing.
2465 */
2466 @SdkConstant(SdkConstantType.FEATURE)
2467 public static final String FEATURE_PRINTING = "android.software.print";
2468
2469 /**
2470 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Eugene Susla7c3eef22017-03-10 14:25:58 -08002471 * The device supports {@link android.companion.CompanionDeviceManager#associate associating}
2472 * with devices via {@link android.companion.CompanionDeviceManager}.
2473 */
2474 @SdkConstant(SdkConstantType.FEATURE)
2475 public static final String FEATURE_COMPANION_DEVICE_SETUP
2476 = "android.software.companion_device_setup";
2477
2478 /**
2479 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Adam Lesinski3d9bcb92014-02-18 14:05:14 -08002480 * The device can perform backup and restore operations on installed applications.
2481 */
2482 @SdkConstant(SdkConstantType.FEATURE)
2483 public static final String FEATURE_BACKUP = "android.software.backup";
2484
2485 /**
Vladislav Kaznacheevd303b252015-10-27 17:30:58 -07002486 * Feature for {@link #getSystemAvailableFeatures} and
2487 * {@link #hasSystemFeature}: The device supports freeform window management.
2488 * Windows have title bars and can be moved and resized.
2489 */
Filip Gruszczynski811dc3b2015-11-23 12:34:22 -08002490 // If this feature is present, you also need to set
2491 // com.android.internal.R.config_freeformWindowManagement to true in your configuration overlay.
Vladislav Kaznacheevd303b252015-10-27 17:30:58 -07002492 @SdkConstant(SdkConstantType.FEATURE)
2493 public static final String FEATURE_FREEFORM_WINDOW_MANAGEMENT
2494 = "android.software.freeform_window_management";
2495
2496 /**
Adam Connors23cc04e2014-04-01 12:12:20 +01002497 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Wale Ogunwalefbe12c42015-12-06 16:23:50 -08002498 * The device supports picture-in-picture multi-window mode.
2499 */
2500 @SdkConstant(SdkConstantType.FEATURE)
2501 public static final String FEATURE_PICTURE_IN_PICTURE = "android.software.picture_in_picture";
2502
2503 /**
2504 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Andrii Kulian1981f5f2017-04-07 16:23:12 -07002505 * The device supports running activities on secondary displays.
2506 */
2507 @SdkConstant(SdkConstantType.FEATURE)
2508 public static final String FEATURE_ACTIVITIES_ON_SECONDARY_DISPLAYS
2509 = "android.software.activities_on_secondary_displays";
2510
2511 /**
2512 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Amith Yamasani1d653272014-09-11 17:56:05 -07002513 * The device supports creating secondary users and managed profiles via
2514 * {@link DevicePolicyManager}.
Adam Connors23cc04e2014-04-01 12:12:20 +01002515 */
2516 @SdkConstant(SdkConstantType.FEATURE)
Amith Yamasani1d653272014-09-11 17:56:05 -07002517 public static final String FEATURE_MANAGED_USERS = "android.software.managed_users";
2518
2519 /**
2520 * @hide
2521 * TODO: Remove after dependencies updated b/17392243
2522 */
2523 public static final String FEATURE_MANAGED_PROFILES = "android.software.managed_users";
Adam Connors23cc04e2014-04-01 12:12:20 +01002524
2525 /**
Ben Murdochf564c7f2014-05-20 18:58:06 +01002526 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Adam Connors19ccb5f2014-09-08 17:31:50 +01002527 * The device supports verified boot.
2528 */
2529 @SdkConstant(SdkConstantType.FEATURE)
2530 public static final String FEATURE_VERIFIED_BOOT = "android.software.verified_boot";
2531
2532 /**
2533 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2534 * The device supports secure removal of users. When a user is deleted the data associated
2535 * with that user is securely deleted and no longer available.
2536 */
2537 @SdkConstant(SdkConstantType.FEATURE)
2538 public static final String FEATURE_SECURELY_REMOVES_USERS
2539 = "android.software.securely_removes_users";
2540
Jeff Sharkeyb92b05b2016-01-28 09:50:00 -07002541 /** {@hide} */
Jeff Sharkey8eb783b2018-01-04 16:46:48 -07002542 @TestApi
Jeff Sharkeyb92b05b2016-01-28 09:50:00 -07002543 @SdkConstant(SdkConstantType.FEATURE)
2544 public static final String FEATURE_FILE_BASED_ENCRYPTION
2545 = "android.software.file_based_encryption";
2546
Jeff Sharkey8eb783b2018-01-04 16:46:48 -07002547 /** {@hide} */
2548 @TestApi
2549 @SdkConstant(SdkConstantType.FEATURE)
2550 public static final String FEATURE_ADOPTABLE_STORAGE
2551 = "android.software.adoptable_storage";
2552
Adam Connors19ccb5f2014-09-08 17:31:50 +01002553 /**
2554 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Ben Murdoch422c7a52014-05-16 13:45:47 +01002555 * The device has a full implementation of the android.webkit.* APIs. Devices
2556 * lacking this feature will not have a functioning WebView implementation.
2557 */
2558 @SdkConstant(SdkConstantType.FEATURE)
2559 public static final String FEATURE_WEBVIEW = "android.software.webview";
2560
2561 /**
Joe LaPenna4bb015d2014-07-04 17:15:54 -07002562 * Feature for {@link #getSystemAvailableFeatures} and
2563 * {@link #hasSystemFeature}: This device supports ethernet.
Joe LaPenna4bb015d2014-07-04 17:15:54 -07002564 */
2565 @SdkConstant(SdkConstantType.FEATURE)
2566 public static final String FEATURE_ETHERNET = "android.hardware.ethernet";
2567
2568 /**
Yuncheol Heoa0c4a062014-07-10 20:49:27 +09002569 * Feature for {@link #getSystemAvailableFeatures} and
2570 * {@link #hasSystemFeature}: This device supports HDMI-CEC.
2571 * @hide
2572 */
2573 @SdkConstant(SdkConstantType.FEATURE)
2574 public static final String FEATURE_HDMI_CEC = "android.hardware.hdmi.cec";
2575
2576 /**
Michael Wright6faa6752014-09-05 17:57:44 -07002577 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2578 * The device has all of the inputs necessary to be considered a compatible game controller, or
2579 * includes a compatible game controller in the box.
2580 */
2581 @SdkConstant(SdkConstantType.FEATURE)
2582 public static final String FEATURE_GAMEPAD = "android.hardware.gamepad";
2583
Mike Lockwood5781cd52015-03-27 13:23:41 -07002584 /**
2585 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2586 * The device has a full implementation of the android.media.midi.* APIs.
2587 */
2588 @SdkConstant(SdkConstantType.FEATURE)
2589 public static final String FEATURE_MIDI = "android.software.midi";
Michael Wright6faa6752014-09-05 17:57:44 -07002590
2591 /**
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08002592 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Ruben Brunk927d3452016-05-02 19:30:51 -07002593 * The device implements an optimized mode for virtual reality (VR) applications that handles
2594 * stereoscopic rendering of notifications, and disables most monocular system UI components
2595 * while a VR application has user focus.
2596 * Devices declaring this feature must include an application implementing a
2597 * {@link android.service.vr.VrListenerService} that can be targeted by VR applications via
2598 * {@link android.app.Activity#setVrModeEnabled}.
Craig Donnerc6f9c852017-12-27 17:15:19 -08002599 * @deprecated use {@link #FEATURE_VR_MODE_HIGH_PERFORMANCE} instead.
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08002600 */
Craig Donnerc6f9c852017-12-27 17:15:19 -08002601 @Deprecated
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08002602 @SdkConstant(SdkConstantType.FEATURE)
2603 public static final String FEATURE_VR_MODE = "android.software.vr.mode";
2604
2605 /**
Ruben Brunk31d80ea2016-01-25 20:14:08 -08002606 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Craig Donnerc6f9c852017-12-27 17:15:19 -08002607 * The device implements an optimized mode for virtual reality (VR) applications that handles
2608 * stereoscopic rendering of notifications, disables most monocular system UI components
2609 * while a VR application has user focus and meets extra CDD requirements to provide a
2610 * high-quality VR experience.
2611 * Devices declaring this feature must include an application implementing a
2612 * {@link android.service.vr.VrListenerService} that can be targeted by VR applications via
2613 * {@link android.app.Activity#setVrModeEnabled}.
2614 * and must meet CDD requirements to provide a high-quality VR experience.
Ruben Brunk31d80ea2016-01-25 20:14:08 -08002615 */
2616 @SdkConstant(SdkConstantType.FEATURE)
2617 public static final String FEATURE_VR_MODE_HIGH_PERFORMANCE
2618 = "android.hardware.vr.high_performance";
2619
2620 /**
Craig Donner279dd662017-03-15 17:10:50 -07002621 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Svet Ganov43574b02017-04-12 09:25:20 -07002622 * The device supports autofill of user credentials, addresses, credit cards, etc
2623 * via integration with {@link android.service.autofill.AutofillService autofill
2624 * providers}.
2625 */
2626 @SdkConstant(SdkConstantType.FEATURE)
2627 public static final String FEATURE_AUTOFILL = "android.software.autofill";
2628
2629 /**
2630 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Craig Donner279dd662017-03-15 17:10:50 -07002631 * The device implements headtracking suitable for a VR device.
2632 */
2633 @SdkConstant(SdkConstantType.FEATURE)
2634 public static final String FEATURE_VR_HEADTRACKING = "android.hardware.vr.headtracking";
2635
2636 /**
Frank Salimea5e0382018-01-23 22:42:29 -08002637 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2638 * The device has a StrongBox hardware-backed Keystore.
2639 */
2640 @SdkConstant(SdkConstantType.FEATURE)
2641 public static final String FEATURE_STRONGBOX_KEYSTORE =
2642 "android.hardware.strongbox_keystore";
2643
2644 /**
Eran Messeriadaf68c2018-03-27 19:34:03 +01002645 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
2646 * The device has a Keymaster implementation that supports Device ID attestation.
2647 *
2648 * @see DevicePolicyManager#isDeviceIdAttestationSupported
2649 * @hide
2650 */
2651 @SdkConstant(SdkConstantType.FEATURE)
2652 public static final String FEATURE_DEVICE_ID_ATTESTATION =
2653 "android.software.device_id_attestation";
2654
2655 /**
Dianne Hackborne83cefce2010-02-04 17:38:14 -08002656 * Action to external storage service to clean out removed apps.
2657 * @hide
2658 */
2659 public static final String ACTION_CLEAN_EXTERNAL_STORAGE
2660 = "android.content.pm.CLEAN_EXTERNAL_STORAGE";
Oscar Montemayor1228d0a2010-01-28 12:01:44 -08002661
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08002662 /**
Kenny Root5ab21572011-07-27 11:11:19 -07002663 * Extra field name for the URI to a verification file. Passed to a package
2664 * verifier.
2665 *
2666 * @hide
2667 */
2668 public static final String EXTRA_VERIFICATION_URI = "android.content.pm.extra.VERIFICATION_URI";
2669
2670 /**
2671 * Extra field name for the ID of a package pending verification. Passed to
2672 * a package verifier and is used to call back to
Kenny Root3a9b5fb2011-09-20 14:15:38 -07002673 * {@link PackageManager#verifyPendingInstall(int, int)}
Kenny Root5ab21572011-07-27 11:11:19 -07002674 */
2675 public static final String EXTRA_VERIFICATION_ID = "android.content.pm.extra.VERIFICATION_ID";
2676
2677 /**
2678 * Extra field name for the package identifier which is trying to install
2679 * the package.
2680 *
2681 * @hide
2682 */
2683 public static final String EXTRA_VERIFICATION_INSTALLER_PACKAGE
2684 = "android.content.pm.extra.VERIFICATION_INSTALLER_PACKAGE";
2685
2686 /**
2687 * Extra field name for the requested install flags for a package pending
2688 * verification. Passed to a package verifier.
2689 *
2690 * @hide
2691 */
2692 public static final String EXTRA_VERIFICATION_INSTALL_FLAGS
2693 = "android.content.pm.extra.VERIFICATION_INSTALL_FLAGS";
2694
2695 /**
rich cannings13d428e2012-09-13 13:43:07 -07002696 * Extra field name for the uid of who is requesting to install
2697 * the package.
2698 *
2699 * @hide
2700 */
2701 public static final String EXTRA_VERIFICATION_INSTALLER_UID
2702 = "android.content.pm.extra.VERIFICATION_INSTALLER_UID";
2703
2704 /**
2705 * Extra field name for the package name of a package pending verification.
2706 *
2707 * @hide
2708 */
2709 public static final String EXTRA_VERIFICATION_PACKAGE_NAME
2710 = "android.content.pm.extra.VERIFICATION_PACKAGE_NAME";
2711 /**
rich canningsd1b5cfc2012-08-29 14:49:51 -07002712 * Extra field name for the result of a verification, either
2713 * {@link #VERIFICATION_ALLOW}, or {@link #VERIFICATION_REJECT}.
2714 * Passed to package verifiers after a package is verified.
2715 */
2716 public static final String EXTRA_VERIFICATION_RESULT
2717 = "android.content.pm.extra.VERIFICATION_RESULT";
2718
2719 /**
rich cannings13d428e2012-09-13 13:43:07 -07002720 * Extra field name for the version code of a package pending verification.
Dianne Hackborn3accca02013-09-20 09:32:11 -07002721 * @deprecated Use {@link #EXTRA_VERIFICATION_LONG_VERSION_CODE} instead.
2722 * @hide
2723 */
2724 @Deprecated
2725 public static final String EXTRA_VERIFICATION_VERSION_CODE
2726 = "android.content.pm.extra.VERIFICATION_VERSION_CODE";
2727
2728 /**
2729 * Extra field name for the long version code of a package pending verification.
rich cannings13d428e2012-09-13 13:43:07 -07002730 *
2731 * @hide
2732 */
Dianne Hackborn3accca02013-09-20 09:32:11 -07002733 public static final String EXTRA_VERIFICATION_LONG_VERSION_CODE =
2734 "android.content.pm.extra.VERIFICATION_LONG_VERSION_CODE";
rich cannings13d428e2012-09-13 13:43:07 -07002735
2736 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07002737 * Extra field name for the ID of a intent filter pending verification.
2738 * Passed to an intent filter verifier and is used to call back to
2739 * {@link #verifyIntentFilter}
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08002740 *
2741 * @hide
2742 */
2743 public static final String EXTRA_INTENT_FILTER_VERIFICATION_ID
2744 = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_ID";
2745
2746 /**
2747 * Extra field name for the scheme used for an intent filter pending verification. Passed to
2748 * an intent filter verifier and is used to construct the URI to verify against.
2749 *
2750 * Usually this is "https"
2751 *
2752 * @hide
2753 */
2754 public static final String EXTRA_INTENT_FILTER_VERIFICATION_URI_SCHEME
2755 = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_URI_SCHEME";
2756
2757 /**
2758 * Extra field name for the host names to be used for an intent filter pending verification.
2759 * Passed to an intent filter verifier and is used to construct the URI to verify the
2760 * intent filter.
2761 *
2762 * This is a space delimited list of hosts.
2763 *
2764 * @hide
2765 */
2766 public static final String EXTRA_INTENT_FILTER_VERIFICATION_HOSTS
2767 = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_HOSTS";
2768
2769 /**
2770 * Extra field name for the package name to be used for an intent filter pending verification.
2771 * Passed to an intent filter verifier and is used to check the verification responses coming
2772 * from the hosts. Each host response will need to include the package name of APK containing
2773 * the intent filter.
2774 *
2775 * @hide
2776 */
2777 public static final String EXTRA_INTENT_FILTER_VERIFICATION_PACKAGE_NAME
2778 = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_PACKAGE_NAME";
2779
2780 /**
2781 * The action used to request that the user approve a permission request
2782 * from the application.
Nick Kralevich035f80d2013-03-27 15:20:08 -07002783 *
2784 * @hide
2785 */
Svetoslavc6d1c342015-02-26 14:44:43 -08002786 @SystemApi
2787 public static final String ACTION_REQUEST_PERMISSIONS =
2788 "android.content.pm.action.REQUEST_PERMISSIONS";
Nick Kralevich035f80d2013-03-27 15:20:08 -07002789
2790 /**
Svetoslavc6d1c342015-02-26 14:44:43 -08002791 * The names of the requested permissions.
2792 * <p>
2793 * <strong>Type:</strong> String[]
2794 * </p>
2795 *
2796 * @hide
2797 */
2798 @SystemApi
2799 public static final String EXTRA_REQUEST_PERMISSIONS_NAMES =
2800 "android.content.pm.extra.REQUEST_PERMISSIONS_NAMES";
2801
2802 /**
2803 * The results from the permissions request.
2804 * <p>
2805 * <strong>Type:</strong> int[] of #PermissionResult
2806 * </p>
2807 *
2808 * @hide
2809 */
2810 @SystemApi
2811 public static final String EXTRA_REQUEST_PERMISSIONS_RESULTS
2812 = "android.content.pm.extra.REQUEST_PERMISSIONS_RESULTS";
Nick Kralevich035f80d2013-03-27 15:20:08 -07002813
2814 /**
Jeff Sharkeybb580672014-07-10 12:10:25 -07002815 * String extra for {@link PackageInstallObserver} in the 'extras' Bundle in case of
Christopher Tatef1977b42014-03-24 16:25:51 -07002816 * {@link #INSTALL_FAILED_DUPLICATE_PERMISSION}. This extra names the package which provides
2817 * the existing definition for the permission.
2818 * @hide
2819 */
2820 public static final String EXTRA_FAILURE_EXISTING_PACKAGE
2821 = "android.content.pm.extra.FAILURE_EXISTING_PACKAGE";
2822
2823 /**
Jeff Sharkeybb580672014-07-10 12:10:25 -07002824 * String extra for {@link PackageInstallObserver} in the 'extras' Bundle in case of
Christopher Tatef1977b42014-03-24 16:25:51 -07002825 * {@link #INSTALL_FAILED_DUPLICATE_PERMISSION}. This extra names the permission that is
2826 * being redundantly defined by the package being installed.
2827 * @hide
2828 */
2829 public static final String EXTRA_FAILURE_EXISTING_PERMISSION
2830 = "android.content.pm.extra.FAILURE_EXISTING_PERMISSION";
2831
Svet Ganov8c7f7002015-05-07 10:48:44 -07002832 /**
2833 * Permission flag: The permission is set in its current state
2834 * by the user and apps can still request it at runtime.
2835 *
2836 * @hide
2837 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08002838 @SystemApi
Svet Ganov8c7f7002015-05-07 10:48:44 -07002839 public static final int FLAG_PERMISSION_USER_SET = 1 << 0;
2840
2841 /**
2842 * Permission flag: The permission is set in its current state
2843 * by the user and it is fixed, i.e. apps can no longer request
2844 * this permission.
2845 *
2846 * @hide
2847 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08002848 @SystemApi
Svet Ganov8c7f7002015-05-07 10:48:44 -07002849 public static final int FLAG_PERMISSION_USER_FIXED = 1 << 1;
2850
2851 /**
2852 * Permission flag: The permission is set in its current state
2853 * by device policy and neither apps nor the user can change
2854 * its state.
2855 *
2856 * @hide
2857 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08002858 @SystemApi
Svet Ganov8c7f7002015-05-07 10:48:44 -07002859 public static final int FLAG_PERMISSION_POLICY_FIXED = 1 << 2;
2860
2861 /**
2862 * Permission flag: The permission is set in a granted state but
2863 * access to resources it guards is restricted by other means to
2864 * enable revoking a permission on legacy apps that do not support
2865 * runtime permissions. If this permission is upgraded to runtime
2866 * because the app was updated to support runtime permissions, the
2867 * the permission will be revoked in the upgrade process.
2868 *
2869 * @hide
2870 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08002871 @SystemApi
Svet Ganov8c7f7002015-05-07 10:48:44 -07002872 public static final int FLAG_PERMISSION_REVOKE_ON_UPGRADE = 1 << 3;
2873
Svet Ganovb3f22b42015-05-12 11:01:24 -07002874 /**
2875 * Permission flag: The permission is set in its current state
2876 * because the app is a component that is a part of the system.
2877 *
2878 * @hide
2879 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08002880 @SystemApi
Svet Ganovb3f22b42015-05-12 11:01:24 -07002881 public static final int FLAG_PERMISSION_SYSTEM_FIXED = 1 << 4;
Svet Ganov8c7f7002015-05-07 10:48:44 -07002882
Svet Ganov77ab6a82015-07-03 12:03:02 -07002883 /**
2884 * Permission flag: The permission is granted by default because it
2885 * enables app functionality that is expected to work out-of-the-box
2886 * for providing a smooth user experience. For example, the phone app
2887 * is expected to have the phone permission.
2888 *
2889 * @hide
2890 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08002891 @SystemApi
Svet Ganov77ab6a82015-07-03 12:03:02 -07002892 public static final int FLAG_PERMISSION_GRANTED_BY_DEFAULT = 1 << 5;
2893
Svet Ganov8c7f7002015-05-07 10:48:44 -07002894 /**
Svet Ganov9c165d72015-12-01 19:52:26 -08002895 * Permission flag: The permission has to be reviewed before any of
2896 * the app components can run.
2897 *
2898 * @hide
2899 */
Svet Ganovae0e03a2016-02-25 18:22:10 -08002900 @SystemApi
Svet Ganov9c165d72015-12-01 19:52:26 -08002901 public static final int FLAG_PERMISSION_REVIEW_REQUIRED = 1 << 6;
2902
2903 /**
Svet Ganov8c7f7002015-05-07 10:48:44 -07002904 * Mask for all permission flags.
2905 *
2906 * @hide
2907 */
2908 @SystemApi
Svet Ganovb3f22b42015-05-12 11:01:24 -07002909 public static final int MASK_PERMISSION_FLAGS = 0xFF;
Svet Ganov8c7f7002015-05-07 10:48:44 -07002910
Christopher Tatef1977b42014-03-24 16:25:51 -07002911 /**
Svet Ganovd7b1f4112016-02-09 18:49:23 -08002912 * This is a library that contains components apps can invoke. For
2913 * example, a services for apps to bind to, or standard chooser UI,
2914 * etc. This library is versioned and backwards compatible. Clients
2915 * should check its version via {@link android.ext.services.Version
2916 * #getVersionCode()} and avoid calling APIs added in later versions.
2917 *
2918 * @hide
2919 */
2920 public static final String SYSTEM_SHARED_LIBRARY_SERVICES = "android.ext.services";
2921
2922 /**
2923 * This is a library that contains components apps can dynamically
2924 * load. For example, new widgets, helper classes, etc. This library
2925 * is versioned and backwards compatible. Clients should check its
2926 * version via {@link android.ext.shared.Version#getVersionCode()}
2927 * and avoid calling APIs added in later versions.
2928 *
2929 * @hide
2930 */
2931 public static final String SYSTEM_SHARED_LIBRARY_SHARED = "android.ext.shared";
2932
2933 /**
Brian Carlstromca82e612016-04-19 23:16:08 -07002934 * Used when starting a process for an Activity.
2935 *
2936 * @hide
2937 */
2938 public static final int NOTIFY_PACKAGE_USE_ACTIVITY = 0;
2939
2940 /**
2941 * Used when starting a process for a Service.
2942 *
2943 * @hide
2944 */
2945 public static final int NOTIFY_PACKAGE_USE_SERVICE = 1;
2946
2947 /**
2948 * Used when moving a Service to the foreground.
2949 *
2950 * @hide
2951 */
2952 public static final int NOTIFY_PACKAGE_USE_FOREGROUND_SERVICE = 2;
2953
2954 /**
2955 * Used when starting a process for a BroadcastReceiver.
2956 *
2957 * @hide
2958 */
2959 public static final int NOTIFY_PACKAGE_USE_BROADCAST_RECEIVER = 3;
2960
2961 /**
2962 * Used when starting a process for a ContentProvider.
2963 *
2964 * @hide
2965 */
2966 public static final int NOTIFY_PACKAGE_USE_CONTENT_PROVIDER = 4;
2967
2968 /**
2969 * Used when starting a process for a BroadcastReceiver.
2970 *
2971 * @hide
2972 */
2973 public static final int NOTIFY_PACKAGE_USE_BACKUP = 5;
2974
2975 /**
2976 * Used with Context.getClassLoader() across Android packages.
2977 *
2978 * @hide
2979 */
2980 public static final int NOTIFY_PACKAGE_USE_CROSS_PACKAGE = 6;
2981
2982 /**
2983 * Used when starting a package within a process for Instrumentation.
2984 *
2985 * @hide
2986 */
2987 public static final int NOTIFY_PACKAGE_USE_INSTRUMENTATION = 7;
2988
2989 /**
2990 * Total number of usage reasons.
2991 *
2992 * @hide
2993 */
2994 public static final int NOTIFY_PACKAGE_USE_REASONS_COUNT = 8;
2995
2996 /**
Svet Ganov67882122016-12-11 16:36:34 -08002997 * Constant for specifying the highest installed package version code.
2998 */
2999 public static final int VERSION_CODE_HIGHEST = -1;
3000
Jeff Sharkeyad357d12018-02-02 13:25:31 -07003001 /** {@hide} */
3002 public int getUserId() {
3003 return UserHandle.myUserId();
3004 }
3005
Svet Ganov67882122016-12-11 16:36:34 -08003006 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003007 * Retrieve overall information about an application package that is
3008 * installed on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003009 *
3010 * @param packageName The full name (i.e. com.google.apps.contacts) of the
Jeff Sharkey4347f812017-04-21 12:08:39 -06003011 * desired package.
3012 * @param flags Additional option flags to modify the data returned.
3013 * @return A PackageInfo object containing information about the package. If
3014 * flag {@code MATCH_UNINSTALLED_PACKAGES} is set and if the package
3015 * is not found in the list of installed applications, the package
3016 * information is retrieved from the list of uninstalled
kmccormick30498b42013-03-27 17:39:17 -07003017 * applications (which includes installed applications as well as
3018 * applications with data directory i.e. applications which had been
3019 * deleted with {@code DONT_DELETE_DATA} flag set).
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003020 * @throws NameNotFoundException if a package with the given name cannot be
3021 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003022 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003023 public abstract PackageInfo getPackageInfo(String packageName, @PackageInfoFlags int flags)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003024 throws NameNotFoundException;
3025
3026 /**
Svet Ganov67882122016-12-11 16:36:34 -08003027 * Retrieve overall information about an application package that is
3028 * installed on the system. This method can be used for retrieving
Jeff Sharkey4347f812017-04-21 12:08:39 -06003029 * information about packages for which multiple versions can be installed
3030 * at the time. Currently only packages hosting static shared libraries can
3031 * have multiple installed versions. The method can also be used to get info
3032 * for a package that has a single version installed by passing
3033 * {@link #VERSION_CODE_HIGHEST} in the {@link VersionedPackage}
Svet Ganov67882122016-12-11 16:36:34 -08003034 * constructor.
3035 *
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003036 * @param versionedPackage The versioned package for which to query.
Jeff Sharkey4347f812017-04-21 12:08:39 -06003037 * @param flags Additional option flags to modify the data returned.
3038 * @return A PackageInfo object containing information about the package. If
3039 * flag {@code MATCH_UNINSTALLED_PACKAGES} is set and if the package
3040 * is not found in the list of installed applications, the package
3041 * information is retrieved from the list of uninstalled
Svet Ganov67882122016-12-11 16:36:34 -08003042 * applications (which includes installed applications as well as
3043 * applications with data directory i.e. applications which had been
3044 * deleted with {@code DONT_DELETE_DATA} flag set).
3045 * @throws NameNotFoundException if a package with the given name cannot be
3046 * found on the system.
Svet Ganov67882122016-12-11 16:36:34 -08003047 */
3048 public abstract PackageInfo getPackageInfo(VersionedPackage versionedPackage,
3049 @PackageInfoFlags int flags) throws NameNotFoundException;
3050
3051 /**
Nicolas Prevot9a80e532015-09-23 15:49:28 +01003052 * Retrieve overall information about an application package that is
3053 * installed on the system.
Nicolas Prevot9a80e532015-09-23 15:49:28 +01003054 *
3055 * @param packageName The full name (i.e. com.google.apps.contacts) of the
Jeff Sharkey4347f812017-04-21 12:08:39 -06003056 * desired package.
3057 * @param flags Additional option flags to modify the data returned.
Nicolas Prevot9a80e532015-09-23 15:49:28 +01003058 * @param userId The user id.
Jeff Sharkey4347f812017-04-21 12:08:39 -06003059 * @return A PackageInfo object containing information about the package. If
3060 * flag {@code MATCH_UNINSTALLED_PACKAGES} is set and if the package
3061 * is not found in the list of installed applications, the package
3062 * information is retrieved from the list of uninstalled
Nicolas Prevot9a80e532015-09-23 15:49:28 +01003063 * applications (which includes installed applications as well as
3064 * applications with data directory i.e. applications which had been
3065 * deleted with {@code DONT_DELETE_DATA} flag set).
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003066 * @throws NameNotFoundException if a package with the given name cannot be
3067 * found on the system.
Svet Ganov67882122016-12-11 16:36:34 -08003068 * @hide
Nicolas Prevot9a80e532015-09-23 15:49:28 +01003069 */
3070 @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS)
Mathew Inwood1c77a112018-08-14 14:06:26 +01003071 @UnsupportedAppUsage
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003072 public abstract PackageInfo getPackageInfoAsUser(String packageName,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003073 @PackageInfoFlags int flags, @UserIdInt int userId) throws NameNotFoundException;
Nicolas Prevot9a80e532015-09-23 15:49:28 +01003074
3075 /**
Dianne Hackborn47096932010-02-11 15:57:09 -08003076 * Map from the current package names in use on the device to whatever
3077 * the current canonical name of that package is.
3078 * @param names Array of current names to be mapped.
3079 * @return Returns an array of the same size as the original, containing
3080 * the canonical name for each package.
3081 */
3082 public abstract String[] currentToCanonicalPackageNames(String[] names);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003083
Dianne Hackborn47096932010-02-11 15:57:09 -08003084 /**
3085 * Map from a packages canonical name to the current name in use on the device.
3086 * @param names Array of new names to be mapped.
3087 * @return Returns an array of the same size as the original, containing
3088 * the current name for each package.
3089 */
3090 public abstract String[] canonicalToCurrentPackageNames(String[] names);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003091
Dianne Hackborn47096932010-02-11 15:57:09 -08003092 /**
Andrew Solovay5ae13352014-06-06 12:23:09 -07003093 * Returns a "good" intent to launch a front-door activity in a package.
3094 * This is used, for example, to implement an "open" button when browsing
3095 * through packages. The current implementation looks first for a main
3096 * activity in the category {@link Intent#CATEGORY_INFO}, and next for a
3097 * main activity in the category {@link Intent#CATEGORY_LAUNCHER}. Returns
3098 * <code>null</code> if neither are found.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003099 *
3100 * @param packageName The name of the package to inspect.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003101 *
Andrew Solovay5ae13352014-06-06 12:23:09 -07003102 * @return A fully-qualified {@link Intent} that can be used to launch the
3103 * main activity in the package. Returns <code>null</code> if the package
3104 * does not contain such an activity, or if <em>packageName</em> is not
Ihab Awad1ec68882014-09-12 11:09:01 -07003105 * recognized.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003106 */
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06003107 public abstract @Nullable Intent getLaunchIntentForPackage(@NonNull String packageName);
Mihai Predaeae850c2009-05-13 10:13:48 +02003108
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003109 /**
Jose Lima970417c2014-04-10 10:42:19 -07003110 * Return a "good" intent to launch a front-door Leanback activity in a
3111 * package, for use for example to implement an "open" button when browsing
3112 * through packages. The current implementation will look for a main
3113 * activity in the category {@link Intent#CATEGORY_LEANBACK_LAUNCHER}, or
3114 * return null if no main leanback activities are found.
Adam Connors551c0782014-06-05 12:13:03 +01003115 *
Jose Lima970417c2014-04-10 10:42:19 -07003116 * @param packageName The name of the package to inspect.
3117 * @return Returns either a fully-qualified Intent that can be used to launch
3118 * the main Leanback activity in the package, or null if the package
3119 * does not contain such an activity.
3120 */
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06003121 public abstract @Nullable Intent getLeanbackLaunchIntentForPackage(@NonNull String packageName);
Jose Lima970417c2014-04-10 10:42:19 -07003122
3123 /**
Roberto Perez7ee1a7a2017-12-04 17:14:33 -08003124 * Return a "good" intent to launch a front-door Car activity in a
3125 * package, for use for example to implement an "open" button when browsing
3126 * through packages. The current implementation will look for a main
3127 * activity in the category {@link Intent#CATEGORY_CAR_LAUNCHER}, or
3128 * return null if no main car activities are found.
3129 *
3130 * @param packageName The name of the package to inspect.
3131 * @return Returns either a fully-qualified Intent that can be used to launch
3132 * the main Car activity in the package, or null if the package
3133 * does not contain such an activity.
3134 * @hide
3135 */
3136 public abstract @Nullable Intent getCarLaunchIntentForPackage(@NonNull String packageName);
3137
3138 /**
Jeff Sharkeycf3f0a12016-03-17 19:57:58 -06003139 * Return an array of all of the POSIX secondary group IDs that have been
3140 * assigned to the given package.
3141 * <p>
3142 * Note that the same package may have different GIDs under different
3143 * {@link UserHandle} on the same device.
Adam Connors551c0782014-06-05 12:13:03 +01003144 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003145 * @param packageName The full name (i.e. com.google.apps.contacts) of the
Jeff Sharkeycf3f0a12016-03-17 19:57:58 -06003146 * desired package.
3147 * @return Returns an int array of the assigned GIDs, or null if there are
Jose Lima970417c2014-04-10 10:42:19 -07003148 * none.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003149 * @throws NameNotFoundException if a package with the given name cannot be
3150 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003151 */
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06003152 public abstract int[] getPackageGids(@NonNull String packageName)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003153 throws NameNotFoundException;
3154
3155 /**
Jeff Sharkeycf3f0a12016-03-17 19:57:58 -06003156 * Return an array of all of the POSIX secondary group IDs that have been
3157 * assigned to the given package.
3158 * <p>
3159 * Note that the same package may have different GIDs under different
3160 * {@link UserHandle} on the same device.
Dianne Hackborna06de0f2012-12-11 16:34:47 -08003161 *
3162 * @param packageName The full name (i.e. com.google.apps.contacts) of the
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003163 * desired package.
3164 * @return Returns an int array of the assigned gids, or null if there are
3165 * none.
3166 * @throws NameNotFoundException if a package with the given name cannot be
3167 * found on the system.
Dianne Hackborna06de0f2012-12-11 16:34:47 -08003168 */
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003169 public abstract int[] getPackageGids(String packageName, @PackageInfoFlags int flags)
Dianne Hackborna06de0f2012-12-11 16:34:47 -08003170 throws NameNotFoundException;
3171
3172 /**
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003173 * Return the UID associated with the given package name.
Jeff Sharkeycf3f0a12016-03-17 19:57:58 -06003174 * <p>
3175 * Note that the same package will have different UIDs under different
3176 * {@link UserHandle} on the same device.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003177 *
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003178 * @param packageName The full name (i.e. com.google.apps.contacts) of the
3179 * desired package.
3180 * @return Returns an integer UID who owns the given package name.
3181 * @throws NameNotFoundException if a package with the given name can not be
3182 * found on the system.
3183 */
3184 public abstract int getPackageUid(String packageName, @PackageInfoFlags int flags)
3185 throws NameNotFoundException;
3186
3187 /**
3188 * Return the UID associated with the given package name.
Jeff Sharkeycf3f0a12016-03-17 19:57:58 -06003189 * <p>
3190 * Note that the same package will have different UIDs under different
3191 * {@link UserHandle} on the same device.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003192 *
3193 * @param packageName The full name (i.e. com.google.apps.contacts) of the
3194 * desired package.
3195 * @param userId The user handle identifier to look up the package under.
3196 * @return Returns an integer UID who owns the given package name.
3197 * @throws NameNotFoundException if a package with the given name can not be
3198 * found on the system.
3199 * @hide
3200 */
Mathew Inwood1c77a112018-08-14 14:06:26 +01003201 @UnsupportedAppUsage
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003202 public abstract int getPackageUidAsUser(String packageName, @UserIdInt int userId)
3203 throws NameNotFoundException;
3204
3205 /**
3206 * Return the UID associated with the given package name.
Jeff Sharkeycf3f0a12016-03-17 19:57:58 -06003207 * <p>
3208 * Note that the same package will have different UIDs under different
3209 * {@link UserHandle} on the same device.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003210 *
3211 * @param packageName The full name (i.e. com.google.apps.contacts) of the
3212 * desired package.
3213 * @param userId The user handle identifier to look up the package under.
3214 * @return Returns an integer UID who owns the given package name.
3215 * @throws NameNotFoundException if a package with the given name can not be
3216 * found on the system.
3217 * @hide
3218 */
Mathew Inwood1c77a112018-08-14 14:06:26 +01003219 @UnsupportedAppUsage
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003220 public abstract int getPackageUidAsUser(String packageName, @PackageInfoFlags int flags,
3221 @UserIdInt int userId) throws NameNotFoundException;
3222
3223 /**
3224 * Retrieve all of the information we know about a particular permission.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003225 *
3226 * @param name The fully qualified name (i.e. com.google.permission.LOGIN)
Jeff Sharkey4347f812017-04-21 12:08:39 -06003227 * of the permission you are interested in.
3228 * @param flags Additional option flags to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003229 * @return Returns a {@link PermissionInfo} containing information about the
3230 * permission.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003231 * @throws NameNotFoundException if a package with the given name cannot be
3232 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003233 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003234 public abstract PermissionInfo getPermissionInfo(String name, @PermissionInfoFlags int flags)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003235 throws NameNotFoundException;
3236
3237 /**
3238 * Query for all of the permissions associated with a particular group.
3239 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003240 * @param group The fully qualified name (i.e. com.google.permission.LOGIN)
Jeff Sharkey4347f812017-04-21 12:08:39 -06003241 * of the permission group you are interested in. Use null to
3242 * find all of the permissions not associated with a group.
3243 * @param flags Additional option flags to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003244 * @return Returns a list of {@link PermissionInfo} containing information
Jeff Sharkey4347f812017-04-21 12:08:39 -06003245 * about all of the permissions in the given group.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003246 * @throws NameNotFoundException if a package with the given name cannot be
3247 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003248 */
3249 public abstract List<PermissionInfo> queryPermissionsByGroup(String group,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003250 @PermissionInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003251
3252 /**
Paul Navin7b89a7b2017-01-26 23:56:08 +00003253 * Returns true if Permission Review Mode is enabled, false otherwise.
3254 *
3255 * @hide
3256 */
3257 @TestApi
3258 public abstract boolean isPermissionReviewModeEnabled();
3259
3260 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003261 * Retrieve all of the information we know about a particular group of
3262 * permissions.
3263 *
Jeff Sharkey4347f812017-04-21 12:08:39 -06003264 * @param name The fully qualified name (i.e.
3265 * com.google.permission_group.APPS) of the permission you are
3266 * interested in.
3267 * @param flags Additional option flags to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003268 * @return Returns a {@link PermissionGroupInfo} containing information
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003269 * about the permission.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003270 * @throws NameNotFoundException if a package with the given name cannot be
3271 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003272 */
3273 public abstract PermissionGroupInfo getPermissionGroupInfo(String name,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003274 @PermissionGroupInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003275
3276 /**
3277 * Retrieve all of the known permission groups in the system.
3278 *
Jeff Sharkey4347f812017-04-21 12:08:39 -06003279 * @param flags Additional option flags to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003280 * @return Returns a list of {@link PermissionGroupInfo} containing
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003281 * information about all of the known permission groups.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003282 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003283 public abstract List<PermissionGroupInfo> getAllPermissionGroups(
3284 @PermissionGroupInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003285
3286 /**
3287 * Retrieve all of the information we know about a particular
3288 * package/application.
3289 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003290 * @param packageName The full name (i.e. com.google.apps.contacts) of an
Jeff Sharkey4347f812017-04-21 12:08:39 -06003291 * application.
3292 * @param flags Additional option flags to modify the data returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003293 * @return An {@link ApplicationInfo} containing information about the
Jeff Sharkey4347f812017-04-21 12:08:39 -06003294 * package. If flag {@code MATCH_UNINSTALLED_PACKAGES} is set and if
3295 * the package is not found in the list of installed applications,
3296 * the application information is retrieved from the list of
3297 * uninstalled applications (which includes installed applications
3298 * as well as applications with data directory i.e. applications
3299 * which had been deleted with {@code DONT_DELETE_DATA} flag set).
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003300 * @throws NameNotFoundException if a package with the given name cannot be
3301 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003302 */
3303 public abstract ApplicationInfo getApplicationInfo(String packageName,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003304 @ApplicationInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003305
Jeff Sharkeycd654482016-01-08 17:42:11 -07003306 /** {@hide} */
Mathew Inwood1c77a112018-08-14 14:06:26 +01003307 @UnsupportedAppUsage
Jeff Sharkeycd654482016-01-08 17:42:11 -07003308 public abstract ApplicationInfo getApplicationInfoAsUser(String packageName,
3309 @ApplicationInfoFlags int flags, @UserIdInt int userId) throws NameNotFoundException;
3310
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003311 /**
3312 * Retrieve all of the information we know about a particular activity
3313 * class.
3314 *
Dianne Hackborn361199b2010-08-30 17:42:07 -07003315 * @param component The full component name (i.e.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003316 * com.google.apps.contacts/com.google.apps.contacts.
3317 * ContactsList) of an Activity class.
Jeff Sharkey4347f812017-04-21 12:08:39 -06003318 * @param flags Additional option flags to modify the data returned.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003319 * @return An {@link ActivityInfo} containing information about the
3320 * activity.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003321 * @throws NameNotFoundException if a package with the given name cannot be
3322 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003323 */
Dianne Hackborn361199b2010-08-30 17:42:07 -07003324 public abstract ActivityInfo getActivityInfo(ComponentName component,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003325 @ComponentInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003326
3327 /**
3328 * Retrieve all of the information we know about a particular receiver
3329 * class.
3330 *
Dianne Hackborn361199b2010-08-30 17:42:07 -07003331 * @param component The full component name (i.e.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003332 * com.google.apps.calendar/com.google.apps.calendar.
3333 * CalendarAlarm) of a Receiver class.
Jeff Sharkey4347f812017-04-21 12:08:39 -06003334 * @param flags Additional option flags to modify the data returned.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003335 * @return An {@link ActivityInfo} containing information about the
3336 * receiver.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003337 * @throws NameNotFoundException if a package with the given name cannot be
3338 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003339 */
Dianne Hackborn361199b2010-08-30 17:42:07 -07003340 public abstract ActivityInfo getReceiverInfo(ComponentName component,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003341 @ComponentInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003342
3343 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003344 * Retrieve all of the information we know about a particular service class.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003345 *
Dianne Hackborn361199b2010-08-30 17:42:07 -07003346 * @param component The full component name (i.e.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003347 * com.google.apps.media/com.google.apps.media.
3348 * BackgroundPlayback) of a Service class.
Jeff Sharkey4347f812017-04-21 12:08:39 -06003349 * @param flags Additional option flags to modify the data returned.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003350 * @return A {@link ServiceInfo} object containing information about the
3351 * service.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003352 * @throws NameNotFoundException if a package with the given name cannot be
3353 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003354 */
Dianne Hackborn361199b2010-08-30 17:42:07 -07003355 public abstract ServiceInfo getServiceInfo(ComponentName component,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003356 @ComponentInfoFlags int flags) throws NameNotFoundException;
Dianne Hackborn361199b2010-08-30 17:42:07 -07003357
3358 /**
3359 * Retrieve all of the information we know about a particular content
3360 * provider class.
3361 *
Dianne Hackborn361199b2010-08-30 17:42:07 -07003362 * @param component The full component name (i.e.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003363 * com.google.providers.media/com.google.providers.media.
3364 * MediaProvider) of a ContentProvider class.
Jeff Sharkey4347f812017-04-21 12:08:39 -06003365 * @param flags Additional option flags to modify the data returned.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06003366 * @return A {@link ProviderInfo} object containing information about the
3367 * provider.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003368 * @throws NameNotFoundException if a package with the given name cannot be
3369 * found on the system.
Dianne Hackborn361199b2010-08-30 17:42:07 -07003370 */
3371 public abstract ProviderInfo getProviderInfo(ComponentName component,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003372 @ComponentInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003373
3374 /**
Ricky Wai9964f702018-04-12 17:01:20 +01003375 * Return a List of all packages that are installed for the current user.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003376 *
Jeff Sharkey4347f812017-04-21 12:08:39 -06003377 * @param flags Additional option flags to modify the data returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003378 * @return A List of PackageInfo objects, one for each installed package,
Jeff Sharkey4347f812017-04-21 12:08:39 -06003379 * containing information about the package. In the unlikely case
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003380 * there are no installed packages, an empty list is returned. If
3381 * flag {@code MATCH_UNINSTALLED_PACKAGES} is set, the package
3382 * information is retrieved from the list of uninstalled
3383 * applications (which includes installed applications as well as
3384 * applications with data directory i.e. applications which had been
3385 * deleted with {@code DONT_DELETE_DATA} flag set).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003386 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003387 public abstract List<PackageInfo> getInstalledPackages(@PackageInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003388
3389 /**
Jeff Sharkey4347f812017-04-21 12:08:39 -06003390 * Return a List of all installed packages that are currently holding any of
3391 * the given permissions.
Dianne Hackborne7991752013-01-16 17:56:46 -08003392 *
Jeff Sharkey4347f812017-04-21 12:08:39 -06003393 * @param flags Additional option flags to modify the data returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003394 * @return A List of PackageInfo objects, one for each installed package
3395 * that holds any of the permissions that were provided, containing
3396 * information about the package. If no installed packages hold any
3397 * of the permissions, an empty list is returned. If flag
Jeff Sharkey4347f812017-04-21 12:08:39 -06003398 * {@code MATCH_UNINSTALLED_PACKAGES} is set, the package
3399 * information is retrieved from the list of uninstalled
3400 * applications (which includes installed applications as well as
3401 * applications with data directory i.e. applications which had been
3402 * deleted with {@code DONT_DELETE_DATA} flag set).
Dianne Hackborne7991752013-01-16 17:56:46 -08003403 */
3404 public abstract List<PackageInfo> getPackagesHoldingPermissions(
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003405 String[] permissions, @PackageInfoFlags int flags);
Dianne Hackborne7991752013-01-16 17:56:46 -08003406
3407 /**
Jeff Sharkey4347f812017-04-21 12:08:39 -06003408 * Return a List of all packages that are installed on the device, for a
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06003409 * specific user.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003410 *
Jeff Sharkey4347f812017-04-21 12:08:39 -06003411 * @param flags Additional option flags to modify the data returned.
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003412 * @param userId The user for whom the installed packages are to be listed
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003413 * @return A List of PackageInfo objects, one for each installed package,
Jeff Sharkey4347f812017-04-21 12:08:39 -06003414 * containing information about the package. In the unlikely case
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003415 * there are no installed packages, an empty list is returned. If
3416 * flag {@code MATCH_UNINSTALLED_PACKAGES} is set, the package
3417 * information is retrieved from the list of uninstalled
3418 * applications (which includes installed applications as well as
3419 * applications with data directory i.e. applications which had been
3420 * deleted with {@code DONT_DELETE_DATA} flag set).
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003421 * @hide
3422 */
Todd Kennedyef9acb62018-05-29 15:18:06 -07003423 @TestApi
Svet Ganovae0e03a2016-02-25 18:22:10 -08003424 @SystemApi
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06003425 @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS_FULL)
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07003426 public abstract List<PackageInfo> getInstalledPackagesAsUser(@PackageInfoFlags int flags,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003427 @UserIdInt int userId);
Amith Yamasani151ec4c2012-09-07 19:25:16 -07003428
3429 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003430 * Check whether a particular package has been granted a particular
3431 * permission.
3432 *
Svet Ganovad3b2972015-07-07 22:49:17 -07003433 * @param permName The name of the permission you are checking for.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003434 * @param pkgName The name of the package you are checking against.
3435 *
3436 * @return If the package has the permission, PERMISSION_GRANTED is
3437 * returned. If it does not have the permission, PERMISSION_DENIED
3438 * is returned.
3439 *
3440 * @see #PERMISSION_GRANTED
3441 * @see #PERMISSION_DENIED
3442 */
Tor Norbye1c2bf032015-03-02 10:57:08 -08003443 @CheckResult
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06003444 public abstract @PermissionResult int checkPermission(String permName, String pkgName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003445
3446 /**
Svet Ganovad3b2972015-07-07 22:49:17 -07003447 * Checks whether a particular permissions has been revoked for a
3448 * package by policy. Typically the device owner or the profile owner
3449 * may apply such a policy. The user cannot grant policy revoked
3450 * permissions, hence the only way for an app to get such a permission
3451 * is by a policy change.
3452 *
3453 * @param permName The name of the permission you are checking for.
3454 * @param pkgName The name of the package you are checking against.
3455 *
3456 * @return Whether the permission is restricted by policy.
3457 */
3458 @CheckResult
Svet Ganovf1b7f202015-07-29 08:33:42 -07003459 public abstract boolean isPermissionRevokedByPolicy(@NonNull String permName,
3460 @NonNull String pkgName);
3461
3462 /**
3463 * Gets the package name of the component controlling runtime permissions.
3464 *
3465 * @return The package name.
3466 *
3467 * @hide
3468 */
Philip P. Moltmanneb0a0ae2017-06-30 10:55:51 -07003469 @TestApi
Svet Ganovf1b7f202015-07-29 08:33:42 -07003470 public abstract String getPermissionControllerPackageName();
Svet Ganovad3b2972015-07-07 22:49:17 -07003471
3472 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003473 * Add a new dynamic permission to the system. For this to work, your
3474 * package must have defined a permission tree through the
3475 * {@link android.R.styleable#AndroidManifestPermissionTree
3476 * &lt;permission-tree&gt;} tag in its manifest. A package can only add
3477 * permissions to trees that were defined by either its own package or
3478 * another with the same user id; a permission is in a tree if it
3479 * matches the name of the permission tree + ".": for example,
3480 * "com.foo.bar" is a member of the permission tree "com.foo".
3481 *
3482 * <p>It is good to make your permission tree name descriptive, because you
3483 * are taking possession of that entire set of permission names. Thus, it
3484 * must be under a domain you control, with a suffix that will not match
3485 * any normal permissions that may be declared in any applications that
3486 * are part of that domain.
3487 *
3488 * <p>New permissions must be added before
3489 * any .apks are installed that use those permissions. Permissions you
3490 * add through this method are remembered across reboots of the device.
3491 * If the given permission already exists, the info you supply here
3492 * will be used to update it.
3493 *
3494 * @param info Description of the permission to be added.
3495 *
3496 * @return Returns true if a new permission was created, false if an
3497 * existing one was updated.
3498 *
3499 * @throws SecurityException if you are not allowed to add the
3500 * given permission name.
3501 *
3502 * @see #removePermission(String)
3503 */
3504 public abstract boolean addPermission(PermissionInfo info);
3505
3506 /**
Dianne Hackbornd7c09682010-03-30 10:42:20 -07003507 * Like {@link #addPermission(PermissionInfo)} but asynchronously
3508 * persists the package manager state after returning from the call,
3509 * allowing it to return quicker and batch a series of adds at the
3510 * expense of no guarantee the added permission will be retained if
3511 * the device is rebooted before it is written.
3512 */
3513 public abstract boolean addPermissionAsync(PermissionInfo info);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003514
Dianne Hackbornd7c09682010-03-30 10:42:20 -07003515 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003516 * Removes a permission that was previously added with
3517 * {@link #addPermission(PermissionInfo)}. The same ownership rules apply
3518 * -- you are only allowed to remove permissions that you are allowed
3519 * to add.
3520 *
3521 * @param name The name of the permission to remove.
3522 *
3523 * @throws SecurityException if you are not allowed to remove the
3524 * given permission name.
3525 *
3526 * @see #addPermission(PermissionInfo)
3527 */
3528 public abstract void removePermission(String name);
3529
Svet Ganov8c7f7002015-05-07 10:48:44 -07003530 /**
3531 * Permission flags set when granting or revoking a permission.
3532 *
3533 * @hide
3534 */
3535 @SystemApi
Jeff Sharkey4347f812017-04-21 12:08:39 -06003536 @IntDef(prefix = { "FLAG_PERMISSION_" }, value = {
3537 FLAG_PERMISSION_USER_SET,
Svet Ganov8c7f7002015-05-07 10:48:44 -07003538 FLAG_PERMISSION_USER_FIXED,
3539 FLAG_PERMISSION_POLICY_FIXED,
Svet Ganovb3f22b42015-05-12 11:01:24 -07003540 FLAG_PERMISSION_REVOKE_ON_UPGRADE,
Svet Ganov77ab6a82015-07-03 12:03:02 -07003541 FLAG_PERMISSION_SYSTEM_FIXED,
Jeff Sharkey4347f812017-04-21 12:08:39 -06003542 FLAG_PERMISSION_GRANTED_BY_DEFAULT
3543 })
Svet Ganov8c7f7002015-05-07 10:48:44 -07003544 @Retention(RetentionPolicy.SOURCE)
3545 public @interface PermissionFlags {}
3546
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003547 /**
Svetoslavc6d1c342015-02-26 14:44:43 -08003548 * Grant a runtime permission to an application which the application does not
3549 * already have. The permission must have been requested by the application.
3550 * If the application is not allowed to hold the permission, a {@link
Ruben Brunk12ab5e12016-11-10 15:27:30 -08003551 * java.lang.SecurityException} is thrown. If the package or permission is
3552 * invalid, a {@link java.lang.IllegalArgumentException} is thrown.
Svetoslavc6d1c342015-02-26 14:44:43 -08003553 * <p>
3554 * <strong>Note: </strong>Using this API requires holding
Todd Kennedya8eb6a82016-07-28 16:35:42 -07003555 * android.permission.GRANT_RUNTIME_PERMISSIONS and if the user id is
Svetoslavc6d1c342015-02-26 14:44:43 -08003556 * not the current user android.permission.INTERACT_ACROSS_USERS_FULL.
3557 * </p>
Nick Kralevich035f80d2013-03-27 15:20:08 -07003558 *
Svetoslavc6d1c342015-02-26 14:44:43 -08003559 * @param packageName The package to which to grant the permission.
3560 * @param permissionName The permission name to grant.
3561 * @param user The user for which to grant the permission.
3562 *
Svet Ganov8c7f7002015-05-07 10:48:44 -07003563 * @see #revokeRuntimePermission(String, String, android.os.UserHandle)
Svetoslavc6d1c342015-02-26 14:44:43 -08003564 *
3565 * @hide
Nick Kralevich035f80d2013-03-27 15:20:08 -07003566 */
Svetoslavc6d1c342015-02-26 14:44:43 -08003567 @SystemApi
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06003568 @RequiresPermission(android.Manifest.permission.GRANT_RUNTIME_PERMISSIONS)
Svet Ganov8c7f7002015-05-07 10:48:44 -07003569 public abstract void grantRuntimePermission(@NonNull String packageName,
Svetoslavc6d1c342015-02-26 14:44:43 -08003570 @NonNull String permissionName, @NonNull UserHandle user);
Nick Kralevich035f80d2013-03-27 15:20:08 -07003571
Svetoslavc6d1c342015-02-26 14:44:43 -08003572 /**
3573 * Revoke a runtime permission that was previously granted by {@link
Svet Ganov8c7f7002015-05-07 10:48:44 -07003574 * #grantRuntimePermission(String, String, android.os.UserHandle)}. The
3575 * permission must have been requested by and granted to the application.
3576 * If the application is not allowed to hold the permission, a {@link
Ruben Brunk12ab5e12016-11-10 15:27:30 -08003577 * java.lang.SecurityException} is thrown. If the package or permission is
3578 * invalid, a {@link java.lang.IllegalArgumentException} is thrown.
Svetoslavc6d1c342015-02-26 14:44:43 -08003579 * <p>
3580 * <strong>Note: </strong>Using this API requires holding
Todd Kennedya8eb6a82016-07-28 16:35:42 -07003581 * android.permission.REVOKE_RUNTIME_PERMISSIONS and if the user id is
Svetoslavc6d1c342015-02-26 14:44:43 -08003582 * not the current user android.permission.INTERACT_ACROSS_USERS_FULL.
3583 * </p>
3584 *
3585 * @param packageName The package from which to revoke the permission.
3586 * @param permissionName The permission name to revoke.
3587 * @param user The user for which to revoke the permission.
3588 *
Svet Ganov8c7f7002015-05-07 10:48:44 -07003589 * @see #grantRuntimePermission(String, String, android.os.UserHandle)
Svetoslavc6d1c342015-02-26 14:44:43 -08003590 *
3591 * @hide
3592 */
3593 @SystemApi
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06003594 @RequiresPermission(android.Manifest.permission.REVOKE_RUNTIME_PERMISSIONS)
Svet Ganov8c7f7002015-05-07 10:48:44 -07003595 public abstract void revokeRuntimePermission(@NonNull String packageName,
Svetoslavc6d1c342015-02-26 14:44:43 -08003596 @NonNull String permissionName, @NonNull UserHandle user);
3597
3598 /**
Svet Ganov8c7f7002015-05-07 10:48:44 -07003599 * Gets the state flags associated with a permission.
3600 *
3601 * @param permissionName The permission for which to get the flags.
3602 * @param packageName The package name for which to get the flags.
3603 * @param user The user for which to get permission flags.
3604 * @return The permission flags.
3605 *
3606 * @hide
3607 */
3608 @SystemApi
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06003609 @RequiresPermission(anyOf = {
3610 android.Manifest.permission.GRANT_RUNTIME_PERMISSIONS,
3611 android.Manifest.permission.REVOKE_RUNTIME_PERMISSIONS
3612 })
Svet Ganov8c7f7002015-05-07 10:48:44 -07003613 public abstract @PermissionFlags int getPermissionFlags(String permissionName,
3614 String packageName, @NonNull UserHandle user);
3615
3616 /**
3617 * Updates the flags associated with a permission by replacing the flags in
3618 * the specified mask with the provided flag values.
3619 *
3620 * @param permissionName The permission for which to update the flags.
3621 * @param packageName The package name for which to update the flags.
3622 * @param flagMask The flags which to replace.
3623 * @param flagValues The flags with which to replace.
3624 * @param user The user for which to update the permission flags.
3625 *
3626 * @hide
3627 */
3628 @SystemApi
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06003629 @RequiresPermission(anyOf = {
3630 android.Manifest.permission.GRANT_RUNTIME_PERMISSIONS,
3631 android.Manifest.permission.REVOKE_RUNTIME_PERMISSIONS
3632 })
Svet Ganov8c7f7002015-05-07 10:48:44 -07003633 public abstract void updatePermissionFlags(String permissionName,
Jeff Sharkey4347f812017-04-21 12:08:39 -06003634 String packageName, @PermissionFlags int flagMask, @PermissionFlags int flagValues,
Svet Ganov8c7f7002015-05-07 10:48:44 -07003635 @NonNull UserHandle user);
3636
3637 /**
Svetoslav20770dd2015-05-29 15:43:04 -07003638 * Gets whether you should show UI with rationale for requesting a permission.
3639 * You should do this only if you do not have the permission and the context in
3640 * which the permission is requested does not clearly communicate to the user
3641 * what would be the benefit from grating this permission.
3642 *
3643 * @param permission A permission your app wants to request.
3644 * @return Whether you can show permission rationale UI.
3645 *
3646 * @hide
3647 */
Mathew Inwood1c77a112018-08-14 14:06:26 +01003648 @UnsupportedAppUsage
Svetoslav20770dd2015-05-29 15:43:04 -07003649 public abstract boolean shouldShowRequestPermissionRationale(String permission);
3650
3651 /**
Svetoslavc6d1c342015-02-26 14:44:43 -08003652 * Returns an {@link android.content.Intent} suitable for passing to
3653 * {@link android.app.Activity#startActivityForResult(android.content.Intent, int)}
3654 * which prompts the user to grant permissions to this application.
3655 *
3656 * @throws NullPointerException if {@code permissions} is {@code null} or empty.
3657 *
3658 * @hide
3659 */
Mathew Inwood1c77a112018-08-14 14:06:26 +01003660 @UnsupportedAppUsage
Svetoslavc6d1c342015-02-26 14:44:43 -08003661 public Intent buildRequestPermissionsIntent(@NonNull String[] permissions) {
3662 if (ArrayUtils.isEmpty(permissions)) {
Svet Ganovf66381c2016-02-18 20:02:36 -08003663 throw new IllegalArgumentException("permission cannot be null or empty");
Svetoslavc6d1c342015-02-26 14:44:43 -08003664 }
3665 Intent intent = new Intent(ACTION_REQUEST_PERMISSIONS);
3666 intent.putExtra(EXTRA_REQUEST_PERMISSIONS_NAMES, permissions);
Svet Ganovf1b7f202015-07-29 08:33:42 -07003667 intent.setPackage(getPermissionControllerPackageName());
Svetoslavc6d1c342015-02-26 14:44:43 -08003668 return intent;
Nick Kralevich035f80d2013-03-27 15:20:08 -07003669 }
3670
3671 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003672 * Compare the signatures of two packages to determine if the same
3673 * signature appears in both of them. If they do contain the same
3674 * signature, then they are allowed special privileges when working
3675 * with each other: they can share the same user-id, run instrumentation
3676 * against each other, etc.
3677 *
3678 * @param pkg1 First package name whose signature will be compared.
3679 * @param pkg2 Second package name whose signature will be compared.
Chris Palmer09f33602010-09-13 14:27:18 -07003680 *
3681 * @return Returns an integer indicating whether all signatures on the
3682 * two packages match. The value is >= 0 ({@link #SIGNATURE_MATCH}) if
3683 * all signatures match or < 0 if there is not a match ({@link
3684 * #SIGNATURE_NO_MATCH} or {@link #SIGNATURE_UNKNOWN_PACKAGE}).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003685 *
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07003686 * @see #checkSignatures(int, int)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003687 */
Tor Norbye1c2bf032015-03-02 10:57:08 -08003688 @CheckResult
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06003689 public abstract @SignatureResult int checkSignatures(String pkg1, String pkg2);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003690
3691 /**
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07003692 * Like {@link #checkSignatures(String, String)}, but takes UIDs of
3693 * the two packages to be checked. This can be useful, for example,
3694 * when doing the check in an IPC, where the UID is the only identity
3695 * available. It is functionally identical to determining the package
3696 * associated with the UIDs and checking their signatures.
3697 *
Joe Onorato25660ec2009-08-12 22:40:37 -07003698 * @param uid1 First UID whose signature will be compared.
3699 * @param uid2 Second UID whose signature will be compared.
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07003700 *
Chris Palmer09f33602010-09-13 14:27:18 -07003701 * @return Returns an integer indicating whether all signatures on the
3702 * two packages match. The value is >= 0 ({@link #SIGNATURE_MATCH}) if
3703 * all signatures match or < 0 if there is not a match ({@link
3704 * #SIGNATURE_NO_MATCH} or {@link #SIGNATURE_UNKNOWN_PACKAGE}).
3705 *
3706 * @see #checkSignatures(String, String)
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07003707 */
Tor Norbye1c2bf032015-03-02 10:57:08 -08003708 @CheckResult
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06003709 public abstract @SignatureResult int checkSignatures(int uid1, int uid2);
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07003710
3711 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003712 * Retrieve the names of all packages that are associated with a particular
3713 * user id. In most cases, this will be a single package name, the package
3714 * that has been assigned that user id. Where there are multiple packages
3715 * sharing the same user id through the "sharedUserId" mechanism, all
3716 * packages with that id will be returned.
3717 *
3718 * @param uid The user id for which you would like to retrieve the
3719 * associated packages.
3720 *
3721 * @return Returns an array of one or more packages assigned to the user
3722 * id, or null if there are no known packages with the given id.
3723 */
Jeff Sharkey377ded0f2016-01-10 13:15:41 -07003724 public abstract @Nullable String[] getPackagesForUid(int uid);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003725
3726 /**
Michal Karpinskicb67dc92016-12-13 18:20:23 +00003727 * Retrieve the official name associated with a uid. This name is
Jonathan Basseri7ea3a332015-05-12 19:39:22 -07003728 * guaranteed to never change, though it is possible for the underlying
Michal Karpinskicb67dc92016-12-13 18:20:23 +00003729 * uid to be changed. That is, if you are storing information about
3730 * uids in persistent storage, you should use the string returned
3731 * by this function instead of the raw uid.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003732 *
Michal Karpinskicb67dc92016-12-13 18:20:23 +00003733 * @param uid The uid for which you would like to retrieve a name.
3734 * @return Returns a unique name for the given uid, or null if the
3735 * uid is not currently assigned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003736 */
Jeff Sharkey377ded0f2016-01-10 13:15:41 -07003737 public abstract @Nullable String getNameForUid(int uid);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003738
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003739 /**
Todd Kennedy9da8b8a72017-07-25 15:38:39 -07003740 * Retrieves the official names associated with each given uid.
3741 * @see #getNameForUid(int)
3742 *
3743 * @hide
3744 */
Philip P. Moltmannabeb04e2018-03-26 10:15:23 -07003745 @TestApi
Todd Kennedy9da8b8a72017-07-25 15:38:39 -07003746 public abstract @Nullable String[] getNamesForUids(int[] uids);
3747
3748 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003749 * Return the user id associated with a shared user name. Multiple
3750 * applications can specify a shared user name in their manifest and thus
3751 * end up using a common uid. This might be used for new applications
3752 * that use an existing shared user name and need to know the uid of the
3753 * shared user.
3754 *
3755 * @param sharedUserName The shared user name whose uid is to be retrieved.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07003756 * @return Returns the UID associated with the shared user.
3757 * @throws NameNotFoundException if a package with the given name cannot be
3758 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003759 * @hide
3760 */
Mathew Inwood1c77a112018-08-14 14:06:26 +01003761 @UnsupportedAppUsage
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003762 public abstract int getUidForSharedUser(String sharedUserName)
3763 throws NameNotFoundException;
3764
3765 /**
Ricky Wai9964f702018-04-12 17:01:20 +01003766 * Return a List of all application packages that are installed for the
3767 * current user. If flag GET_UNINSTALLED_PACKAGES has been set, a list of all
Jeff Sharkey4347f812017-04-21 12:08:39 -06003768 * applications including those deleted with {@code DONT_DELETE_DATA}
3769 * (partially installed apps with data directory) will be returned.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003770 *
Jeff Sharkey4347f812017-04-21 12:08:39 -06003771 * @param flags Additional option flags to modify the data returned.
3772 * @return A List of ApplicationInfo objects, one for each installed
3773 * application. In the unlikely case there are no installed
3774 * packages, an empty list is returned. If flag
3775 * {@code MATCH_UNINSTALLED_PACKAGES} is set, the application
3776 * information is retrieved from the list of uninstalled
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08003777 * applications (which includes installed applications as well as
3778 * applications with data directory i.e. applications which had been
3779 * deleted with {@code DONT_DELETE_DATA} flag set).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003780 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07003781 public abstract List<ApplicationInfo> getInstalledApplications(@ApplicationInfoFlags int flags);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003782
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003783 /**
Jeff Sharkey4347f812017-04-21 12:08:39 -06003784 * Return a List of all application packages that are installed on the
3785 * device, for a specific user. If flag GET_UNINSTALLED_PACKAGES has been
3786 * set, a list of all applications including those deleted with
3787 * {@code DONT_DELETE_DATA} (partially installed apps with data directory)
Bartosz Fabianowski11334242016-11-17 20:49:16 +01003788 * will be returned.
3789 *
Jeff Sharkey4347f812017-04-21 12:08:39 -06003790 * @param flags Additional option flags to modify the data returned.
3791 * @param userId The user for whom the installed applications are to be
3792 * listed
3793 * @return A List of ApplicationInfo objects, one for each installed
3794 * application. In the unlikely case there are no installed
3795 * packages, an empty list is returned. If flag
3796 * {@code MATCH_UNINSTALLED_PACKAGES} is set, the application
3797 * information is retrieved from the list of uninstalled
Bartosz Fabianowski11334242016-11-17 20:49:16 +01003798 * applications (which includes installed applications as well as
3799 * applications with data directory i.e. applications which had been
3800 * deleted with {@code DONT_DELETE_DATA} flag set).
3801 * @hide
Bartosz Fabianowski11334242016-11-17 20:49:16 +01003802 */
Hongming Jin83e16262018-05-18 10:47:57 -07003803 @TestApi
Bartosz Fabianowski11334242016-11-17 20:49:16 +01003804 public abstract List<ApplicationInfo> getInstalledApplicationsAsUser(
3805 @ApplicationInfoFlags int flags, @UserIdInt int userId);
3806
3807 /**
Jeff Sharkey910e0812017-04-21 16:29:27 -06003808 * Gets the instant applications the user recently used.
Svet Ganov2acf0632015-11-24 19:10:59 -08003809 *
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003810 * @return The instant app list.
Svet Ganov2acf0632015-11-24 19:10:59 -08003811 *
3812 * @hide
3813 */
Todd Kennedy9c9fdf22017-03-06 10:58:27 -08003814 @SystemApi
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003815 @RequiresPermission(Manifest.permission.ACCESS_INSTANT_APPS)
3816 public abstract @NonNull List<InstantAppInfo> getInstantApps();
Svet Ganov2acf0632015-11-24 19:10:59 -08003817
3818 /**
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003819 * Gets the icon for an instant application.
Svet Ganov2acf0632015-11-24 19:10:59 -08003820 *
3821 * @param packageName The app package name.
3822 *
3823 * @hide
3824 */
Todd Kennedy9c9fdf22017-03-06 10:58:27 -08003825 @SystemApi
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003826 @RequiresPermission(Manifest.permission.ACCESS_INSTANT_APPS)
3827 public abstract @Nullable Drawable getInstantAppIcon(String packageName);
Svet Ganov2acf0632015-11-24 19:10:59 -08003828
3829 /**
David Christie31a16552017-03-01 15:08:45 -08003830 * Gets whether this application is an instant app.
Svet Ganov2acf0632015-11-24 19:10:59 -08003831 *
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003832 * @return Whether caller is an instant app.
Svet Ganov2acf0632015-11-24 19:10:59 -08003833 *
David Christie31a16552017-03-01 15:08:45 -08003834 * @see #isInstantApp(String)
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003835 * @see #updateInstantAppCookie(byte[])
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003836 * @see #getInstantAppCookie()
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003837 * @see #getInstantAppCookieMaxBytes()
Svet Ganov2acf0632015-11-24 19:10:59 -08003838 */
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003839 public abstract boolean isInstantApp();
Svet Ganov2acf0632015-11-24 19:10:59 -08003840
3841 /**
David Christie31a16552017-03-01 15:08:45 -08003842 * Gets whether the given package is an instant app.
3843 *
3844 * @param packageName The package to check
3845 * @return Whether the given package is an instant app.
3846 *
3847 * @see #isInstantApp()
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003848 * @see #updateInstantAppCookie(byte[])
David Christie31a16552017-03-01 15:08:45 -08003849 * @see #getInstantAppCookie()
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003850 * @see #getInstantAppCookieMaxBytes()
3851 * @see #clearInstantAppCookie()
David Christie31a16552017-03-01 15:08:45 -08003852 */
3853 public abstract boolean isInstantApp(String packageName);
3854
3855 /**
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003856 * Gets the maximum size in bytes of the cookie data an instant app
Svet Ganov2acf0632015-11-24 19:10:59 -08003857 * can store on the device.
3858 *
3859 * @return The max cookie size in bytes.
3860 *
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003861 * @see #isInstantApp()
David Christie31a16552017-03-01 15:08:45 -08003862 * @see #isInstantApp(String)
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003863 * @see #updateInstantAppCookie(byte[])
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003864 * @see #getInstantAppCookie()
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003865 * @see #clearInstantAppCookie()
3866 */
3867 public abstract int getInstantAppCookieMaxBytes();
3868
3869 /**
Daniel Cashman5cdda342018-01-19 07:22:52 -08003870 * deprecated
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003871 * @hide
Svet Ganov2acf0632015-11-24 19:10:59 -08003872 */
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003873 public abstract int getInstantAppCookieMaxSize();
Svet Ganov2acf0632015-11-24 19:10:59 -08003874
3875 /**
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003876 * Gets the instant application cookie for this app. Non
3877 * instant apps and apps that were instant but were upgraded
3878 * to normal apps can still access this API. For instant apps
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003879 * this cookie is cached for some time after uninstall while for
Svet Ganov2acf0632015-11-24 19:10:59 -08003880 * normal apps the cookie is deleted after the app is uninstalled.
3881 * The cookie is always present while the app is installed.
3882 *
3883 * @return The cookie.
3884 *
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003885 * @see #isInstantApp()
David Christie31a16552017-03-01 15:08:45 -08003886 * @see #isInstantApp(String)
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003887 * @see #updateInstantAppCookie(byte[])
3888 * @see #getInstantAppCookieMaxBytes()
3889 * @see #clearInstantAppCookie()
Svet Ganov2acf0632015-11-24 19:10:59 -08003890 */
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003891 public abstract @NonNull byte[] getInstantAppCookie();
Svet Ganov2acf0632015-11-24 19:10:59 -08003892
3893 /**
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003894 * Clears the instant application cookie for the calling app.
Svet Ganov2acf0632015-11-24 19:10:59 -08003895 *
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003896 * @see #isInstantApp()
David Christie31a16552017-03-01 15:08:45 -08003897 * @see #isInstantApp(String)
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003898 * @see #getInstantAppCookieMaxBytes()
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003899 * @see #getInstantAppCookie()
Svetoslav Ganov345ffa52017-04-18 16:08:41 -07003900 * @see #clearInstantAppCookie()
3901 */
3902 public abstract void clearInstantAppCookie();
3903
3904 /**
3905 * Updates the instant application cookie for the calling app. Non
3906 * instant apps and apps that were instant but were upgraded
3907 * to normal apps can still access this API. For instant apps
3908 * this cookie is cached for some time after uninstall while for
3909 * normal apps the cookie is deleted after the app is uninstalled.
3910 * The cookie is always present while the app is installed. The
3911 * cookie size is limited by {@link #getInstantAppCookieMaxBytes()}.
3912 * Passing <code>null</code> or an empty array clears the cookie.
3913 * </p>
3914 *
3915 * @param cookie The cookie data.
3916 *
3917 * @see #isInstantApp()
3918 * @see #isInstantApp(String)
3919 * @see #getInstantAppCookieMaxBytes()
3920 * @see #getInstantAppCookie()
3921 * @see #clearInstantAppCookie()
3922 *
3923 * @throws IllegalArgumentException if the array exceeds max cookie size.
3924 */
3925 public abstract void updateInstantAppCookie(@Nullable byte[] cookie);
3926
3927 /**
3928 * @removed
Svet Ganov2acf0632015-11-24 19:10:59 -08003929 */
Svetoslav Ganov096d3042017-01-30 16:34:13 -08003930 public abstract boolean setInstantAppCookie(@Nullable byte[] cookie);
Svet Ganov2acf0632015-11-24 19:10:59 -08003931
3932 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003933 * Get a list of shared libraries that are available on the
3934 * system.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003935 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003936 * @return An array of shared library names that are
3937 * available on the system, or null if none are installed.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003938 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003939 */
3940 public abstract String[] getSystemSharedLibraryNames();
3941
3942 /**
Svet Ganov67882122016-12-11 16:36:34 -08003943 * Get a list of shared libraries on the device.
3944 *
3945 * @param flags To filter the libraries to return.
3946 * @return The shared library list.
3947 *
Svet Ganov67882122016-12-11 16:36:34 -08003948 * @see #MATCH_UNINSTALLED_PACKAGES
3949 */
3950 public abstract @NonNull List<SharedLibraryInfo> getSharedLibraries(
3951 @InstallFlags int flags);
3952
3953 /**
3954 * Get a list of shared libraries on the device.
3955 *
3956 * @param flags To filter the libraries to return.
3957 * @param userId The user to query for.
3958 * @return The shared library list.
3959 *
3960 * @see #MATCH_FACTORY_ONLY
3961 * @see #MATCH_KNOWN_PACKAGES
3962 * @see #MATCH_ANY_USER
3963 * @see #MATCH_UNINSTALLED_PACKAGES
3964 *
3965 * @hide
3966 */
3967 public abstract @NonNull List<SharedLibraryInfo> getSharedLibrariesAsUser(
3968 @InstallFlags int flags, @UserIdInt int userId);
3969
3970 /**
Svet Ganovd7b1f4112016-02-09 18:49:23 -08003971 * Get the name of the package hosting the services shared library.
3972 *
3973 * @return The library host package.
3974 *
3975 * @hide
3976 */
Philip P. Moltmannf80809f2018-04-04 11:20:44 -07003977 @TestApi
Svetoslav Ganova9c25002016-04-13 19:25:56 -07003978 public abstract @NonNull String getServicesSystemSharedLibraryPackageName();
3979
3980 /**
3981 * Get the name of the package hosting the shared components shared library.
3982 *
3983 * @return The library host package.
3984 *
3985 * @hide
3986 */
Philip P. Moltmannf80809f2018-04-04 11:20:44 -07003987 @TestApi
Svetoslav Ganova9c25002016-04-13 19:25:56 -07003988 public abstract @NonNull String getSharedSystemSharedLibraryPackageName();
Svet Ganovd7b1f4112016-02-09 18:49:23 -08003989
3990 /**
Todd Kennedy9106c642017-02-08 14:16:53 -08003991 * Returns the names of the packages that have been changed
3992 * [eg. added, removed or updated] since the given sequence
3993 * number.
3994 * <p>If no packages have been changed, returns <code>null</code>.
3995 * <p>The sequence number starts at <code>0</code> and is
3996 * reset every boot.
Todd Kennedy8fddf9d2017-04-17 15:16:12 -07003997 * @param sequenceNumber The first sequence number for which to retrieve package changes.
3998 * @see Settings.Global#BOOT_COUNT
Todd Kennedy9106c642017-02-08 14:16:53 -08003999 */
4000 public abstract @Nullable ChangedPackages getChangedPackages(
4001 @IntRange(from=0) int sequenceNumber);
4002
4003 /**
Dianne Hackborn49237342009-08-27 20:08:01 -07004004 * Get a list of features that are available on the
4005 * system.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004006 *
Dianne Hackborn49237342009-08-27 20:08:01 -07004007 * @return An array of FeatureInfo classes describing the features
4008 * that are available on the system, or null if there are none(!!).
Dianne Hackborn49237342009-08-27 20:08:01 -07004009 */
4010 public abstract FeatureInfo[] getSystemAvailableFeatures();
4011
4012 /**
Jeff Sharkey115d2c12016-02-15 17:25:57 -07004013 * Check whether the given feature name is one of the available features as
4014 * returned by {@link #getSystemAvailableFeatures()}. This tests for the
4015 * presence of <em>any</em> version of the given feature name; use
4016 * {@link #hasSystemFeature(String, int)} to check for a minimum version.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004017 *
Jeff Sharkey115d2c12016-02-15 17:25:57 -07004018 * @return Returns true if the devices supports the feature, else false.
Dianne Hackborn039c68e2009-09-26 16:39:23 -07004019 */
4020 public abstract boolean hasSystemFeature(String name);
4021
4022 /**
Jeff Sharkey115d2c12016-02-15 17:25:57 -07004023 * Check whether the given feature name and version is one of the available
4024 * features as returned by {@link #getSystemAvailableFeatures()}. Since
4025 * features are defined to always be backwards compatible, this returns true
4026 * if the available feature version is greater than or equal to the
4027 * requested version.
4028 *
4029 * @return Returns true if the devices supports the feature, else false.
4030 */
4031 public abstract boolean hasSystemFeature(String name, int version);
4032
4033 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004034 * Determine the best action to perform for a given Intent. This is how
4035 * {@link Intent#resolveActivity} finds an activity if a class has not been
4036 * explicitly specified.
4037 * <p>
4038 * <em>Note:</em> if using an implicit Intent (without an explicit
4039 * ComponentName specified), be sure to consider whether to set the
4040 * {@link #MATCH_DEFAULT_ONLY} only flag. You need to do so to resolve the
4041 * activity in the same way that
4042 * {@link android.content.Context#startActivity(Intent)} and
Dianne Hackborn4d023d212010-10-01 13:41:04 -07004043 * {@link android.content.Intent#resolveActivity(PackageManager)
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004044 * Intent.resolveActivity(PackageManager)} do.
4045 * </p>
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004046 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004047 * @param intent An intent containing all of the desired specification
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004048 * (action, data, type, category, and/or component).
Jeff Sharkey4347f812017-04-21 12:08:39 -06004049 * @param flags Additional option flags to modify the data returned. The
4050 * most important is {@link #MATCH_DEFAULT_ONLY}, to limit the
4051 * resolution to only those activities that support the
4052 * {@link android.content.Intent#CATEGORY_DEFAULT}.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004053 * @return Returns a ResolveInfo object containing the final activity intent
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004054 * that was determined to be the best action. Returns null if no
Mike LeBeaubd3f5272010-02-18 19:27:17 -08004055 * matching activity was found. If multiple matching activities are
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004056 * found and there is no default set, returns a ResolveInfo object
Mike LeBeaubd3f5272010-02-18 19:27:17 -08004057 * containing something else, such as the activity resolver.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004058 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004059 public abstract ResolveInfo resolveActivity(Intent intent, @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004060
4061 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004062 * Determine the best action to perform for a given Intent for a given user.
4063 * This is how {@link Intent#resolveActivity} finds an activity if a class
4064 * has not been explicitly specified.
4065 * <p>
4066 * <em>Note:</em> if using an implicit Intent (without an explicit
4067 * ComponentName specified), be sure to consider whether to set the
4068 * {@link #MATCH_DEFAULT_ONLY} only flag. You need to do so to resolve the
4069 * activity in the same way that
4070 * {@link android.content.Context#startActivity(Intent)} and
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004071 * {@link android.content.Intent#resolveActivity(PackageManager)
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004072 * Intent.resolveActivity(PackageManager)} do.
4073 * </p>
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004074 *
4075 * @param intent An intent containing all of the desired specification
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004076 * (action, data, type, category, and/or component).
Jeff Sharkey4347f812017-04-21 12:08:39 -06004077 * @param flags Additional option flags to modify the data returned. The
4078 * most important is {@link #MATCH_DEFAULT_ONLY}, to limit the
4079 * resolution to only those activities that support the
4080 * {@link android.content.Intent#CATEGORY_DEFAULT}.
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004081 * @param userId The user id.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004082 * @return Returns a ResolveInfo object containing the final activity intent
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004083 * that was determined to be the best action. Returns null if no
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004084 * matching activity was found. If multiple matching activities are
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004085 * found and there is no default set, returns a ResolveInfo object
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004086 * containing something else, such as the activity resolver.
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004087 * @hide
4088 */
Mathew Inwood1c77a112018-08-14 14:06:26 +01004089 @UnsupportedAppUsage
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004090 public abstract ResolveInfo resolveActivityAsUser(Intent intent, @ResolveInfoFlags int flags,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004091 @UserIdInt int userId);
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004092
4093 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004094 * Retrieve all activities that can be performed for the given intent.
4095 *
4096 * @param intent The desired intent as per resolveActivity().
Jeff Sharkey4347f812017-04-21 12:08:39 -06004097 * @param flags Additional option flags to modify the data returned. The
4098 * most important is {@link #MATCH_DEFAULT_ONLY}, to limit the
4099 * resolution to only those activities that support the
4100 * {@link android.content.Intent#CATEGORY_DEFAULT}. Or, set
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004101 * {@link #MATCH_ALL} to prevent any filtering of the results.
4102 * @return Returns a List of ResolveInfo objects containing one entry for
4103 * each matching activity, ordered from best to worst. In other
4104 * words, the first item is what would be returned by
4105 * {@link #resolveActivity}. If there are no matching activities, an
4106 * empty list is returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004107 */
4108 public abstract List<ResolveInfo> queryIntentActivities(Intent intent,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004109 @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004110
4111 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004112 * Retrieve all activities that can be performed for the given intent, for a
4113 * specific user.
Amith Yamasani151ec4c2012-09-07 19:25:16 -07004114 *
4115 * @param intent The desired intent as per resolveActivity().
Jeff Sharkey4347f812017-04-21 12:08:39 -06004116 * @param flags Additional option flags to modify the data returned. The
4117 * most important is {@link #MATCH_DEFAULT_ONLY}, to limit the
4118 * resolution to only those activities that support the
4119 * {@link android.content.Intent#CATEGORY_DEFAULT}. Or, set
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004120 * {@link #MATCH_ALL} to prevent any filtering of the results.
4121 * @return Returns a List of ResolveInfo objects containing one entry for
4122 * each matching activity, ordered from best to worst. In other
4123 * words, the first item is what would be returned by
4124 * {@link #resolveActivity}. If there are no matching activities, an
4125 * empty list is returned.
Amith Yamasani151ec4c2012-09-07 19:25:16 -07004126 * @hide
4127 */
Mathew Inwood1c77a112018-08-14 14:06:26 +01004128 @UnsupportedAppUsage
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004129 public abstract List<ResolveInfo> queryIntentActivitiesAsUser(Intent intent,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004130 @ResolveInfoFlags int flags, @UserIdInt int userId);
Amith Yamasani151ec4c2012-09-07 19:25:16 -07004131
4132 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004133 * Retrieve a set of activities that should be presented to the user as
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004134 * similar options. This is like {@link #queryIntentActivities}, except it
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004135 * also allows you to supply a list of more explicit Intents that you would
4136 * like to resolve to particular options, and takes care of returning the
4137 * final ResolveInfo list in a reasonable order, with no duplicates, based
4138 * on those inputs.
4139 *
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004140 * @param caller The class name of the activity that is making the request.
4141 * This activity will never appear in the output list. Can be
4142 * null.
4143 * @param specifics An array of Intents that should be resolved to the first
4144 * specific results. Can be null.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004145 * @param intent The desired intent as per resolveActivity().
Jeff Sharkey4347f812017-04-21 12:08:39 -06004146 * @param flags Additional option flags to modify the data returned. The
4147 * most important is {@link #MATCH_DEFAULT_ONLY}, to limit the
4148 * resolution to only those activities that support the
4149 * {@link android.content.Intent#CATEGORY_DEFAULT}.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004150 * @return Returns a List of ResolveInfo objects containing one entry for
4151 * each matching activity. The list is ordered first by all of the
4152 * intents resolved in <var>specifics</var> and then any additional
4153 * activities that can handle <var>intent</var> but did not get
4154 * included by one of the <var>specifics</var> intents. If there are
4155 * no matching activities, an empty list is returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004156 */
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06004157 public abstract List<ResolveInfo> queryIntentActivityOptions(@Nullable ComponentName caller,
4158 @Nullable Intent[] specifics, Intent intent, @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004159
4160 /**
4161 * Retrieve all receivers that can handle a broadcast of the given intent.
4162 *
4163 * @param intent The desired intent as per resolveActivity().
Jeff Sharkey4347f812017-04-21 12:08:39 -06004164 * @param flags Additional option flags to modify the data returned.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004165 * @return Returns a List of ResolveInfo objects containing one entry for
4166 * each matching receiver, ordered from best to worst. If there are
4167 * no matching receivers, an empty list or null is returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004168 */
4169 public abstract List<ResolveInfo> queryBroadcastReceivers(Intent intent,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004170 @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004171
4172 /**
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004173 * Retrieve all receivers that can handle a broadcast of the given intent,
4174 * for a specific user.
Amith Yamasanif203aee2012-08-29 18:41:53 -07004175 *
4176 * @param intent The desired intent as per resolveActivity().
Jeff Sharkey4347f812017-04-21 12:08:39 -06004177 * @param flags Additional option flags to modify the data returned.
Fyodor Kupolov940e8572016-01-26 12:03:51 -08004178 * @param userHandle UserHandle of the user being queried.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004179 * @return Returns a List of ResolveInfo objects containing one entry for
4180 * each matching receiver, ordered from best to worst. If there are
4181 * no matching receivers, an empty list or null is returned.
Amith Yamasanif203aee2012-08-29 18:41:53 -07004182 * @hide
4183 */
Fyodor Kupolov940e8572016-01-26 12:03:51 -08004184 @SystemApi
Todd Kennedydbaef6d2017-07-24 11:28:00 -07004185 @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS)
Fyodor Kupolov940e8572016-01-26 12:03:51 -08004186 public List<ResolveInfo> queryBroadcastReceiversAsUser(Intent intent,
4187 @ResolveInfoFlags int flags, UserHandle userHandle) {
4188 return queryBroadcastReceiversAsUser(intent, flags, userHandle.getIdentifier());
4189 }
4190
4191 /**
4192 * @hide
4193 */
Mathew Inwood1c77a112018-08-14 14:06:26 +01004194 @UnsupportedAppUsage
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07004195 public abstract List<ResolveInfo> queryBroadcastReceiversAsUser(Intent intent,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004196 @ResolveInfoFlags int flags, @UserIdInt int userId);
Amith Yamasanif203aee2012-08-29 18:41:53 -07004197
Fyodor Kupolov940e8572016-01-26 12:03:51 -08004198
Jeff Sharkeybd940222016-01-08 11:07:13 -07004199 /** {@hide} */
4200 @Deprecated
Mathew Inwood1c77a112018-08-14 14:06:26 +01004201 @UnsupportedAppUsage
Jeff Sharkeybd940222016-01-08 11:07:13 -07004202 public List<ResolveInfo> queryBroadcastReceivers(Intent intent,
4203 @ResolveInfoFlags int flags, @UserIdInt int userId) {
Jeff Sharkey6f4b2a32017-03-21 14:13:41 -06004204 final String msg = "Shame on you for calling the hidden API "
4205 + "queryBroadcastReceivers(). Shame!";
4206 if (VMRuntime.getRuntime().getTargetSdkVersion() >= Build.VERSION_CODES.O) {
4207 throw new UnsupportedOperationException(msg);
4208 } else {
4209 Log.d(TAG, msg);
4210 return queryBroadcastReceiversAsUser(intent, flags, userId);
4211 }
Jeff Sharkeybd940222016-01-08 11:07:13 -07004212 }
4213
Amith Yamasanif203aee2012-08-29 18:41:53 -07004214 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004215 * Determine the best service to handle for a given Intent.
4216 *
4217 * @param intent An intent containing all of the desired specification
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004218 * (action, data, type, category, and/or component).
Jeff Sharkey4347f812017-04-21 12:08:39 -06004219 * @param flags Additional option flags to modify the data returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004220 * @return Returns a ResolveInfo object containing the final service intent
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004221 * that was determined to be the best action. Returns null if no
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004222 * matching service was found.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004223 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004224 public abstract ResolveInfo resolveService(Intent intent, @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004225
4226 /**
Philip P. Moltmann18e3eb82018-03-09 16:55:55 -08004227 * @hide
4228 */
4229 public abstract ResolveInfo resolveServiceAsUser(Intent intent, @ResolveInfoFlags int flags,
4230 @UserIdInt int userId);
4231
4232 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004233 * Retrieve all services that can match the given intent.
4234 *
4235 * @param intent The desired intent as per resolveService().
Jeff Sharkey4347f812017-04-21 12:08:39 -06004236 * @param flags Additional option flags to modify the data returned.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004237 * @return Returns a List of ResolveInfo objects containing one entry for
4238 * each matching service, ordered from best to worst. In other
4239 * words, the first item is what would be returned by
4240 * {@link #resolveService}. If there are no matching services, an
4241 * empty list or null is returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004242 */
4243 public abstract List<ResolveInfo> queryIntentServices(Intent intent,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004244 @ResolveInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004245
4246 /**
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004247 * Retrieve all services that can match the given intent for a given user.
4248 *
4249 * @param intent The desired intent as per resolveService().
Jeff Sharkey4347f812017-04-21 12:08:39 -06004250 * @param flags Additional option flags to modify the data returned.
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004251 * @param userId The user id.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004252 * @return Returns a List of ResolveInfo objects containing one entry for
4253 * each matching service, ordered from best to worst. In other
4254 * words, the first item is what would be returned by
4255 * {@link #resolveService}. If there are no matching services, an
4256 * empty list or null is returned.
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004257 * @hide
4258 */
Mathew Inwood1c77a112018-08-14 14:06:26 +01004259 @UnsupportedAppUsage
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004260 public abstract List<ResolveInfo> queryIntentServicesAsUser(Intent intent,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004261 @ResolveInfoFlags int flags, @UserIdInt int userId);
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004262
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004263 /**
4264 * Retrieve all providers that can match the given intent.
4265 *
4266 * @param intent An intent containing all of the desired specification
4267 * (action, data, type, category, and/or component).
Jeff Sharkey4347f812017-04-21 12:08:39 -06004268 * @param flags Additional option flags to modify the data returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004269 * @param userId The user id.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004270 * @return Returns a List of ResolveInfo objects containing one entry for
4271 * each matching provider, ordered from best to worst. If there are
4272 * no matching services, an empty list or null is returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004273 * @hide
4274 */
Mathew Inwood1c77a112018-08-14 14:06:26 +01004275 @UnsupportedAppUsage
Jeff Sharkey85f5f812013-10-07 10:16:12 -07004276 public abstract List<ResolveInfo> queryIntentContentProvidersAsUser(
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004277 Intent intent, @ResolveInfoFlags int flags, @UserIdInt int userId);
Jeff Sharkey85f5f812013-10-07 10:16:12 -07004278
4279 /**
4280 * Retrieve all providers that can match the given intent.
4281 *
4282 * @param intent An intent containing all of the desired specification
4283 * (action, data, type, category, and/or component).
Jeff Sharkey4347f812017-04-21 12:08:39 -06004284 * @param flags Additional option flags to modify the data returned.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004285 * @return Returns a List of ResolveInfo objects containing one entry for
4286 * each matching provider, ordered from best to worst. If there are
4287 * no matching services, an empty list or null is returned.
Jeff Sharkey85f5f812013-10-07 10:16:12 -07004288 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004289 public abstract List<ResolveInfo> queryIntentContentProviders(Intent intent,
4290 @ResolveInfoFlags int flags);
Jeff Sharkey85f5f812013-10-07 10:16:12 -07004291
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07004292 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004293 * Find a single content provider by its base path name.
4294 *
4295 * @param name The name of the provider to find.
Jeff Sharkey4347f812017-04-21 12:08:39 -06004296 * @param flags Additional option flags to modify the data returned.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004297 * @return A {@link ProviderInfo} object containing information about the
4298 * provider. If a provider was not found, returns null.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004299 */
4300 public abstract ProviderInfo resolveContentProvider(String name,
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004301 @ComponentInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004302
4303 /**
Alexandra Gherghina0363c3e2014-06-23 13:34:59 +01004304 * Find a single content provider by its base path name.
4305 *
4306 * @param name The name of the provider to find.
Jeff Sharkey4347f812017-04-21 12:08:39 -06004307 * @param flags Additional option flags to modify the data returned.
Alexandra Gherghina0363c3e2014-06-23 13:34:59 +01004308 * @param userId The user id.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004309 * @return A {@link ProviderInfo} object containing information about the
4310 * provider. If a provider was not found, returns null.
Alexandra Gherghina0363c3e2014-06-23 13:34:59 +01004311 * @hide
4312 */
Mathew Inwood1c77a112018-08-14 14:06:26 +01004313 @UnsupportedAppUsage
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004314 public abstract ProviderInfo resolveContentProviderAsUser(String name,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004315 @ComponentInfoFlags int flags, @UserIdInt int userId);
Alexandra Gherghina0363c3e2014-06-23 13:34:59 +01004316
4317 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004318 * Retrieve content provider information.
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004319 * <p>
4320 * <em>Note: unlike most other methods, an empty result set is indicated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004321 * by a null return instead of an empty list.</em>
4322 *
4323 * @param processName If non-null, limits the returned providers to only
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004324 * those that are hosted by the given process. If null, all
4325 * content providers are returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004326 * @param uid If <var>processName</var> is non-null, this is the required
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004327 * uid owning the requested content providers.
Jeff Sharkey4347f812017-04-21 12:08:39 -06004328 * @param flags Additional option flags to modify the data returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004329 * @return A list of {@link ProviderInfo} objects containing one entry for
4330 * each provider either matching <var>processName</var> or, if
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004331 * <var>processName</var> is null, all known content providers.
4332 * <em>If there are no matching providers, null is returned.</em>
4333 */
4334 public abstract List<ProviderInfo> queryContentProviders(
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004335 String processName, int uid, @ComponentInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004336
4337 /**
Makoto Onuki32757292017-02-22 14:36:59 -08004338 * Same as {@link #queryContentProviders}, except when {@code metaDataKey} is not null,
4339 * it only returns providers which have metadata with the {@code metaDataKey} key.
4340 *
4341 * <p>DO NOT USE the {@code metaDataKey} parameter, unless you're the contacts provider.
4342 * You really shouldn't need it. Other apps should use {@link #queryIntentContentProviders}
4343 * instead.
4344 *
4345 * <p>The {@code metaDataKey} parameter was added to allow the contacts provider to quickly
4346 * scan the GAL providers on the device. Unfortunately the discovery protocol used metadata
4347 * to mark GAL providers, rather than intent filters, so we can't use
4348 * {@link #queryIntentContentProviders} for that.
4349 *
4350 * @hide
4351 */
4352 public List<ProviderInfo> queryContentProviders(
4353 String processName, int uid, @ComponentInfoFlags int flags, String metaDataKey) {
4354 // Provide the default implementation for mocks.
4355 return queryContentProviders(processName, uid, flags);
4356 }
4357
4358 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004359 * Retrieve all of the information we know about a particular
4360 * instrumentation class.
4361 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004362 * @param className The full name (i.e.
Jeff Sharkey4347f812017-04-21 12:08:39 -06004363 * com.google.apps.contacts.InstrumentList) of an Instrumentation
4364 * class.
4365 * @param flags Additional option flags to modify the data returned.
4366 * @return An {@link InstrumentationInfo} object containing information
4367 * about the instrumentation.
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004368 * @throws NameNotFoundException if a package with the given name cannot be
4369 * found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004370 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004371 public abstract InstrumentationInfo getInstrumentationInfo(ComponentName className,
4372 @InstrumentationInfoFlags int flags) throws NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004373
4374 /**
Jeff Sharkey4347f812017-04-21 12:08:39 -06004375 * Retrieve information about available instrumentation code. May be used to
4376 * retrieve either all instrumentation code, or only the code targeting a
4377 * particular package.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004378 *
4379 * @param targetPackage If null, all instrumentation is returned; only the
Jeff Sharkey4347f812017-04-21 12:08:39 -06004380 * instrumentation targeting this package name is returned.
4381 * @param flags Additional option flags to modify the data returned.
Todd Kennedy6b9bfa12016-01-08 13:44:51 -08004382 * @return A list of {@link InstrumentationInfo} objects containing one
4383 * entry for each matching instrumentation. If there are no
Jesse Hallf77a34f2016-02-04 18:41:33 -08004384 * instrumentation available, returns an empty list.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004385 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004386 public abstract List<InstrumentationInfo> queryInstrumentation(String targetPackage,
4387 @InstrumentationInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004388
4389 /**
4390 * Retrieve an image from a package. This is a low-level API used by
4391 * the various package manager info structures (such as
4392 * {@link ComponentInfo} to implement retrieval of their associated
4393 * icon.
4394 *
4395 * @param packageName The name of the package that this icon is coming from.
kmccormick30498b42013-03-27 17:39:17 -07004396 * Cannot be null.
4397 * @param resid The resource identifier of the desired image. Cannot be 0.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004398 * @param appInfo Overall information about <var>packageName</var>. This
4399 * may be null, in which case the application information will be retrieved
4400 * for you if needed; if you already have this information around, it can
4401 * be much more efficient to supply it here.
4402 *
4403 * @return Returns a Drawable holding the requested image. Returns null if
4404 * an image could not be found for any reason.
4405 */
Tor Norbye7b9c9122013-05-30 16:48:33 -07004406 public abstract Drawable getDrawable(String packageName, @DrawableRes int resid,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004407 ApplicationInfo appInfo);
4408
4409 /**
4410 * Retrieve the icon associated with an activity. Given the full name of
4411 * an activity, retrieves the information about it and calls
4412 * {@link ComponentInfo#loadIcon ComponentInfo.loadIcon()} to return its icon.
kmccormick30498b42013-03-27 17:39:17 -07004413 * If the activity cannot be found, NameNotFoundException is thrown.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004414 *
4415 * @param activityName Name of the activity whose icon is to be retrieved.
4416 *
4417 * @return Returns the image of the icon, or the default activity icon if
4418 * it could not be found. Does not return null.
4419 * @throws NameNotFoundException Thrown if the resources for the given
4420 * activity could not be loaded.
4421 *
4422 * @see #getActivityIcon(Intent)
4423 */
4424 public abstract Drawable getActivityIcon(ComponentName activityName)
4425 throws NameNotFoundException;
4426
4427 /**
4428 * Retrieve the icon associated with an Intent. If intent.getClassName() is
4429 * set, this simply returns the result of
4430 * getActivityIcon(intent.getClassName()). Otherwise it resolves the intent's
4431 * component and returns the icon associated with the resolved component.
kmccormick30498b42013-03-27 17:39:17 -07004432 * If intent.getClassName() cannot be found or the Intent cannot be resolved
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004433 * to a component, NameNotFoundException is thrown.
4434 *
4435 * @param intent The intent for which you would like to retrieve an icon.
4436 *
4437 * @return Returns the image of the icon, or the default activity icon if
4438 * it could not be found. Does not return null.
4439 * @throws NameNotFoundException Thrown if the resources for application
4440 * matching the given intent could not be loaded.
4441 *
4442 * @see #getActivityIcon(ComponentName)
4443 */
4444 public abstract Drawable getActivityIcon(Intent intent)
4445 throws NameNotFoundException;
4446
4447 /**
Jose Limaf78e3122014-03-06 12:13:15 -08004448 * Retrieve the banner associated with an activity. Given the full name of
4449 * an activity, retrieves the information about it and calls
4450 * {@link ComponentInfo#loadIcon ComponentInfo.loadIcon()} to return its
4451 * banner. If the activity cannot be found, NameNotFoundException is thrown.
4452 *
4453 * @param activityName Name of the activity whose banner is to be retrieved.
4454 * @return Returns the image of the banner, or null if the activity has no
4455 * banner specified.
4456 * @throws NameNotFoundException Thrown if the resources for the given
4457 * activity could not be loaded.
4458 * @see #getActivityBanner(Intent)
4459 */
4460 public abstract Drawable getActivityBanner(ComponentName activityName)
4461 throws NameNotFoundException;
4462
4463 /**
4464 * Retrieve the banner associated with an Intent. If intent.getClassName()
4465 * is set, this simply returns the result of
4466 * getActivityBanner(intent.getClassName()). Otherwise it resolves the
4467 * intent's component and returns the banner associated with the resolved
4468 * component. If intent.getClassName() cannot be found or the Intent cannot
4469 * be resolved to a component, NameNotFoundException is thrown.
4470 *
4471 * @param intent The intent for which you would like to retrieve a banner.
4472 * @return Returns the image of the banner, or null if the activity has no
4473 * banner specified.
4474 * @throws NameNotFoundException Thrown if the resources for application
4475 * matching the given intent could not be loaded.
4476 * @see #getActivityBanner(ComponentName)
4477 */
4478 public abstract Drawable getActivityBanner(Intent intent)
4479 throws NameNotFoundException;
4480
4481 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004482 * Return the generic icon for an activity that is used when no specific
4483 * icon is defined.
Adam Connors23cc04e2014-04-01 12:12:20 +01004484 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004485 * @return Drawable Image of the icon.
4486 */
4487 public abstract Drawable getDefaultActivityIcon();
4488
4489 /**
4490 * Retrieve the icon associated with an application. If it has not defined
4491 * an icon, the default app icon is returned. Does not return null.
4492 *
4493 * @param info Information about application being queried.
4494 *
4495 * @return Returns the image of the icon, or the default application icon
4496 * if it could not be found.
4497 *
4498 * @see #getApplicationIcon(String)
4499 */
4500 public abstract Drawable getApplicationIcon(ApplicationInfo info);
4501
4502 /**
4503 * Retrieve the icon associated with an application. Given the name of the
4504 * application's package, retrieves the information about it and calls
kmccormick30498b42013-03-27 17:39:17 -07004505 * getApplicationIcon() to return its icon. If the application cannot be
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004506 * found, NameNotFoundException is thrown.
4507 *
4508 * @param packageName Name of the package whose application icon is to be
4509 * retrieved.
4510 *
4511 * @return Returns the image of the icon, or the default application icon
4512 * if it could not be found. Does not return null.
4513 * @throws NameNotFoundException Thrown if the resources for the given
4514 * application could not be loaded.
4515 *
4516 * @see #getApplicationIcon(ApplicationInfo)
4517 */
4518 public abstract Drawable getApplicationIcon(String packageName)
4519 throws NameNotFoundException;
4520
4521 /**
Jose Limaf78e3122014-03-06 12:13:15 -08004522 * Retrieve the banner associated with an application.
4523 *
4524 * @param info Information about application being queried.
4525 * @return Returns the image of the banner or null if the application has no
4526 * banner specified.
4527 * @see #getApplicationBanner(String)
4528 */
4529 public abstract Drawable getApplicationBanner(ApplicationInfo info);
4530
4531 /**
4532 * Retrieve the banner associated with an application. Given the name of the
4533 * application's package, retrieves the information about it and calls
4534 * getApplicationIcon() to return its banner. If the application cannot be
4535 * found, NameNotFoundException is thrown.
4536 *
4537 * @param packageName Name of the package whose application banner is to be
4538 * retrieved.
4539 * @return Returns the image of the banner or null if the application has no
4540 * banner specified.
4541 * @throws NameNotFoundException Thrown if the resources for the given
4542 * application could not be loaded.
4543 * @see #getApplicationBanner(ApplicationInfo)
4544 */
4545 public abstract Drawable getApplicationBanner(String packageName)
4546 throws NameNotFoundException;
4547
4548 /**
4549 * Retrieve the logo associated with an activity. Given the full name of an
4550 * activity, retrieves the information about it and calls
4551 * {@link ComponentInfo#loadLogo ComponentInfo.loadLogo()} to return its
4552 * logo. If the activity cannot be found, NameNotFoundException is thrown.
Adam Powell81cd2e92010-04-21 16:35:18 -07004553 *
4554 * @param activityName Name of the activity whose logo is to be retrieved.
Jose Limaf78e3122014-03-06 12:13:15 -08004555 * @return Returns the image of the logo or null if the activity has no logo
4556 * specified.
Adam Powell81cd2e92010-04-21 16:35:18 -07004557 * @throws NameNotFoundException Thrown if the resources for the given
Jose Limaf78e3122014-03-06 12:13:15 -08004558 * activity could not be loaded.
Adam Powell81cd2e92010-04-21 16:35:18 -07004559 * @see #getActivityLogo(Intent)
4560 */
4561 public abstract Drawable getActivityLogo(ComponentName activityName)
4562 throws NameNotFoundException;
4563
4564 /**
4565 * Retrieve the logo associated with an Intent. If intent.getClassName() is
4566 * set, this simply returns the result of
4567 * getActivityLogo(intent.getClassName()). Otherwise it resolves the intent's
4568 * component and returns the logo associated with the resolved component.
kmccormick30498b42013-03-27 17:39:17 -07004569 * If intent.getClassName() cannot be found or the Intent cannot be resolved
Adam Powell81cd2e92010-04-21 16:35:18 -07004570 * to a component, NameNotFoundException is thrown.
4571 *
4572 * @param intent The intent for which you would like to retrieve a logo.
4573 *
4574 * @return Returns the image of the logo, or null if the activity has no
4575 * logo specified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004576 *
Adam Powell81cd2e92010-04-21 16:35:18 -07004577 * @throws NameNotFoundException Thrown if the resources for application
4578 * matching the given intent could not be loaded.
4579 *
4580 * @see #getActivityLogo(ComponentName)
4581 */
4582 public abstract Drawable getActivityLogo(Intent intent)
4583 throws NameNotFoundException;
4584
4585 /**
4586 * Retrieve the logo associated with an application. If it has not specified
4587 * a logo, this method returns null.
4588 *
4589 * @param info Information about application being queried.
4590 *
4591 * @return Returns the image of the logo, or null if no logo is specified
4592 * by the application.
4593 *
4594 * @see #getApplicationLogo(String)
4595 */
4596 public abstract Drawable getApplicationLogo(ApplicationInfo info);
4597
4598 /**
4599 * Retrieve the logo associated with an application. Given the name of the
4600 * application's package, retrieves the information about it and calls
kmccormick30498b42013-03-27 17:39:17 -07004601 * getApplicationLogo() to return its logo. If the application cannot be
Adam Powell81cd2e92010-04-21 16:35:18 -07004602 * found, NameNotFoundException is thrown.
4603 *
4604 * @param packageName Name of the package whose application logo is to be
4605 * retrieved.
4606 *
4607 * @return Returns the image of the logo, or null if no application logo
4608 * has been specified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004609 *
Adam Powell81cd2e92010-04-21 16:35:18 -07004610 * @throws NameNotFoundException Thrown if the resources for the given
4611 * application could not be loaded.
4612 *
4613 * @see #getApplicationLogo(ApplicationInfo)
4614 */
4615 public abstract Drawable getApplicationLogo(String packageName)
4616 throws NameNotFoundException;
4617
4618 /**
Tony Mak4dc008c2016-03-16 10:46:49 +00004619 * If the target user is a managed profile, then this returns a badged copy of the given icon
4620 * to be able to distinguish it from the original icon. For badging an arbitrary drawable use
Kenny Guydf77d712015-05-29 17:02:22 +01004621 * {@link #getUserBadgedDrawableForDensity(
Svetoslavc7d62f02014-09-04 15:39:54 -07004622 * android.graphics.drawable.Drawable, UserHandle, android.graphics.Rect, int)}.
4623 * <p>
4624 * If the original drawable is a BitmapDrawable and the backing bitmap is
4625 * mutable as per {@link android.graphics.Bitmap#isMutable()}, the badging
4626 * is performed in place and the original drawable is returned.
4627 * </p>
4628 *
4629 * @param icon The icon to badge.
4630 * @param user The target user.
4631 * @return A drawable that combines the original icon and a badge as
4632 * determined by the system.
4633 */
4634 public abstract Drawable getUserBadgedIcon(Drawable icon, UserHandle user);
4635
4636 /**
4637 * If the target user is a managed profile of the calling user or the caller
4638 * is itself a managed profile, then this returns a badged copy of the given
4639 * drawable allowing the user to distinguish it from the original drawable.
4640 * The caller can specify the location in the bounds of the drawable to be
4641 * badged where the badge should be applied as well as the density of the
4642 * badge to be used.
4643 * <p>
4644 * If the original drawable is a BitmapDrawable and the backing bitmap is
Vadim Tryshev66ae66a2016-02-18 15:41:21 -08004645 * mutable as per {@link android.graphics.Bitmap#isMutable()}, the badging
Svetoslavc7d62f02014-09-04 15:39:54 -07004646 * is performed in place and the original drawable is returned.
4647 * </p>
4648 *
4649 * @param drawable The drawable to badge.
4650 * @param user The target user.
4651 * @param badgeLocation Where in the bounds of the badged drawable to place
Vadim Tryshev66ae66a2016-02-18 15:41:21 -08004652 * the badge. If it's {@code null}, the badge is applied on top of the entire
Svetoslavc7d62f02014-09-04 15:39:54 -07004653 * drawable being badged.
4654 * @param badgeDensity The optional desired density for the badge as per
Vadim Tryshev66ae66a2016-02-18 15:41:21 -08004655 * {@link android.util.DisplayMetrics#densityDpi}. If it's not positive,
Svetoslavc7d62f02014-09-04 15:39:54 -07004656 * the density of the display is used.
4657 * @return A drawable that combines the original drawable and a badge as
4658 * determined by the system.
4659 */
4660 public abstract Drawable getUserBadgedDrawableForDensity(Drawable drawable,
4661 UserHandle user, Rect badgeLocation, int badgeDensity);
4662
4663 /**
4664 * If the target user is a managed profile of the calling user or the caller
4665 * is itself a managed profile, then this returns a drawable to use as a small
4666 * icon to include in a view to distinguish it from the original icon.
4667 *
4668 * @param user The target user.
4669 * @param density The optional desired density for the badge as per
4670 * {@link android.util.DisplayMetrics#densityDpi}. If not provided
4671 * the density of the current display is used.
4672 * @return the drawable or null if no drawable is required.
4673 * @hide
4674 */
Mathew Inwood1c77a112018-08-14 14:06:26 +01004675 @UnsupportedAppUsage
Svetoslavc7d62f02014-09-04 15:39:54 -07004676 public abstract Drawable getUserBadgeForDensity(UserHandle user, int density);
4677
4678 /**
4679 * If the target user is a managed profile of the calling user or the caller
Selim Cineke6ff9462016-01-15 15:07:06 -08004680 * is itself a managed profile, then this returns a drawable to use as a small
4681 * icon to include in a view to distinguish it from the original icon. This version
4682 * doesn't have background protection and should be used over a light background instead of
4683 * a badge.
4684 *
4685 * @param user The target user.
4686 * @param density The optional desired density for the badge as per
4687 * {@link android.util.DisplayMetrics#densityDpi}. If not provided
4688 * the density of the current display is used.
4689 * @return the drawable or null if no drawable is required.
4690 * @hide
4691 */
Mathew Inwood1c77a112018-08-14 14:06:26 +01004692 @UnsupportedAppUsage
Selim Cineke6ff9462016-01-15 15:07:06 -08004693 public abstract Drawable getUserBadgeForDensityNoBackground(UserHandle user, int density);
4694
4695 /**
4696 * If the target user is a managed profile of the calling user or the caller
Svetoslavc7d62f02014-09-04 15:39:54 -07004697 * is itself a managed profile, then this returns a copy of the label with
4698 * badging for accessibility services like talkback. E.g. passing in "Email"
4699 * and it might return "Work Email" for Email in the work profile.
4700 *
4701 * @param label The label to change.
4702 * @param user The target user.
4703 * @return A label that combines the original label and a badge as
4704 * determined by the system.
4705 */
4706 public abstract CharSequence getUserBadgedLabel(CharSequence label, UserHandle user);
4707
4708 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004709 * Retrieve text from a package. This is a low-level API used by
4710 * the various package manager info structures (such as
4711 * {@link ComponentInfo} to implement retrieval of their associated
4712 * labels and other text.
4713 *
4714 * @param packageName The name of the package that this text is coming from.
kmccormick30498b42013-03-27 17:39:17 -07004715 * Cannot be null.
4716 * @param resid The resource identifier of the desired text. Cannot be 0.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004717 * @param appInfo Overall information about <var>packageName</var>. This
4718 * may be null, in which case the application information will be retrieved
4719 * for you if needed; if you already have this information around, it can
4720 * be much more efficient to supply it here.
4721 *
4722 * @return Returns a CharSequence holding the requested text. Returns null
4723 * if the text could not be found for any reason.
4724 */
Tor Norbye7b9c9122013-05-30 16:48:33 -07004725 public abstract CharSequence getText(String packageName, @StringRes int resid,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004726 ApplicationInfo appInfo);
4727
4728 /**
4729 * Retrieve an XML file from a package. This is a low-level API used to
4730 * retrieve XML meta data.
4731 *
4732 * @param packageName The name of the package that this xml is coming from.
kmccormick30498b42013-03-27 17:39:17 -07004733 * Cannot be null.
4734 * @param resid The resource identifier of the desired xml. Cannot be 0.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004735 * @param appInfo Overall information about <var>packageName</var>. This
4736 * may be null, in which case the application information will be retrieved
4737 * for you if needed; if you already have this information around, it can
4738 * be much more efficient to supply it here.
4739 *
4740 * @return Returns an XmlPullParser allowing you to parse out the XML
4741 * data. Returns null if the xml resource could not be found for any
4742 * reason.
4743 */
Tor Norbye7b9c9122013-05-30 16:48:33 -07004744 public abstract XmlResourceParser getXml(String packageName, @XmlRes int resid,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004745 ApplicationInfo appInfo);
4746
4747 /**
4748 * Return the label to use for this application.
4749 *
4750 * @return Returns the label associated with this application, or null if
4751 * it could not be found for any reason.
kmccormick30498b42013-03-27 17:39:17 -07004752 * @param info The application to get the label of.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004753 */
4754 public abstract CharSequence getApplicationLabel(ApplicationInfo info);
4755
4756 /**
4757 * Retrieve the resources associated with an activity. Given the full
4758 * name of an activity, retrieves the information about it and calls
4759 * getResources() to return its application's resources. If the activity
kmccormick30498b42013-03-27 17:39:17 -07004760 * cannot be found, NameNotFoundException is thrown.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004761 *
4762 * @param activityName Name of the activity whose resources are to be
4763 * retrieved.
4764 *
4765 * @return Returns the application's Resources.
4766 * @throws NameNotFoundException Thrown if the resources for the given
4767 * application could not be loaded.
4768 *
4769 * @see #getResourcesForApplication(ApplicationInfo)
4770 */
4771 public abstract Resources getResourcesForActivity(ComponentName activityName)
4772 throws NameNotFoundException;
4773
4774 /**
4775 * Retrieve the resources for an application. Throws NameNotFoundException
4776 * if the package is no longer installed.
4777 *
4778 * @param app Information about the desired application.
4779 *
4780 * @return Returns the application's Resources.
4781 * @throws NameNotFoundException Thrown if the resources for the given
4782 * application could not be loaded (most likely because it was uninstalled).
4783 */
4784 public abstract Resources getResourcesForApplication(ApplicationInfo app)
4785 throws NameNotFoundException;
4786
4787 /**
4788 * Retrieve the resources associated with an application. Given the full
4789 * package name of an application, retrieves the information about it and
4790 * calls getResources() to return its application's resources. If the
kmccormick30498b42013-03-27 17:39:17 -07004791 * appPackageName cannot be found, NameNotFoundException is thrown.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004792 *
4793 * @param appPackageName Package name of the application whose resources
4794 * are to be retrieved.
4795 *
4796 * @return Returns the application's Resources.
4797 * @throws NameNotFoundException Thrown if the resources for the given
4798 * application could not be loaded.
4799 *
4800 * @see #getResourcesForApplication(ApplicationInfo)
4801 */
4802 public abstract Resources getResourcesForApplication(String appPackageName)
4803 throws NameNotFoundException;
4804
Amith Yamasani98edc952012-09-25 14:09:27 -07004805 /** @hide */
Mathew Inwood1c77a112018-08-14 14:06:26 +01004806 @UnsupportedAppUsage
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004807 public abstract Resources getResourcesForApplicationAsUser(String appPackageName,
4808 @UserIdInt int userId) throws NameNotFoundException;
Amith Yamasani98edc952012-09-25 14:09:27 -07004809
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004810 /**
Jeff Sharkey4347f812017-04-21 12:08:39 -06004811 * Retrieve overall information about an application package defined in a
4812 * package archive file
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004813 *
4814 * @param archiveFilePath The path to the archive file
Jeff Sharkey4347f812017-04-21 12:08:39 -06004815 * @param flags Additional option flags to modify the data returned.
4816 * @return A PackageInfo object containing information about the package
4817 * archive. If the package could not be parsed, returns null.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004818 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07004819 public PackageInfo getPackageArchiveInfo(String archiveFilePath, @PackageInfoFlags int flags) {
Jeff Sharkey275e0852014-06-17 18:18:49 -07004820 final PackageParser parser = new PackageParser();
Dianne Hackborncd154e92017-02-28 17:37:35 -08004821 parser.setCallback(new PackageParser.CallbackImpl(this));
Jeff Sharkey275e0852014-06-17 18:18:49 -07004822 final File apkFile = new File(archiveFilePath);
Jeff Sharkeyc4858a22014-06-16 10:51:20 -07004823 try {
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004824 if ((flags & (MATCH_DIRECT_BOOT_UNAWARE | MATCH_DIRECT_BOOT_AWARE)) != 0) {
Jeff Sharkeyc3132512016-01-12 14:06:58 -07004825 // Caller expressed an explicit opinion about what encryption
4826 // aware/unaware components they want to see, so fall through and
4827 // give them what they want
4828 } else {
4829 // Caller expressed no opinion, so match everything
Jeff Sharkey8a372a02016-03-16 16:25:45 -06004830 flags |= MATCH_DIRECT_BOOT_AWARE | MATCH_DIRECT_BOOT_UNAWARE;
Jeff Sharkeyc3132512016-01-12 14:06:58 -07004831 }
4832
Jeff Sharkey275e0852014-06-17 18:18:49 -07004833 PackageParser.Package pkg = parser.parseMonolithicPackage(apkFile, 0);
Jeff Sharkeyc4858a22014-06-16 10:51:20 -07004834 if ((flags & GET_SIGNATURES) != 0) {
Victor Hsieh5f761242018-01-20 10:30:12 -08004835 PackageParser.collectCertificates(pkg, false /* skipVerify */);
Jeff Sharkeyc4858a22014-06-16 10:51:20 -07004836 }
4837 PackageUserState state = new PackageUserState();
4838 return PackageParser.generatePackageInfo(pkg, null, flags, 0, 0, null, state);
4839 } catch (PackageParserException e) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004840 return null;
4841 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004842 }
4843
4844 /**
Dianne Hackborn7767eac2012-08-23 18:25:40 -07004845 * If there is already an application with the given package name installed
4846 * on the system for other users, also install it for the calling user.
4847 * @hide
4848 */
Sunny Goyal07f41fb2017-08-09 02:56:34 -07004849 @SystemApi
Nicolas Prevot9a80e532015-09-23 15:49:28 +01004850 public abstract int installExistingPackage(String packageName) throws NameNotFoundException;
4851
4852 /**
4853 * If there is already an application with the given package name installed
Sunny Goyala31a74b2017-05-11 15:59:19 -07004854 * on the system for other users, also install it for the calling user.
4855 * @hide
4856 */
Sunny Goyal07f41fb2017-08-09 02:56:34 -07004857 @SystemApi
Sunny Goyala31a74b2017-05-11 15:59:19 -07004858 public abstract int installExistingPackage(String packageName, @InstallReason int installReason)
4859 throws NameNotFoundException;
4860
4861 /**
4862 * If there is already an application with the given package name installed
Nicolas Prevot9a80e532015-09-23 15:49:28 +01004863 * on the system for other users, also install it for the specified user.
4864 * @hide
4865 */
Sanry Huangafef5da2018-06-06 17:34:34 +00004866 @RequiresPermission(anyOf = {
Nicolas Prevot9a80e532015-09-23 15:49:28 +01004867 Manifest.permission.INSTALL_PACKAGES,
4868 Manifest.permission.INTERACT_ACROSS_USERS_FULL})
Mathew Inwood1c77a112018-08-14 14:06:26 +01004869 @UnsupportedAppUsage
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004870 public abstract int installExistingPackageAsUser(String packageName, @UserIdInt int userId)
Dianne Hackborn7767eac2012-08-23 18:25:40 -07004871 throws NameNotFoundException;
4872
4873 /**
Kenny Root5ab21572011-07-27 11:11:19 -07004874 * Allows a package listening to the
4875 * {@link Intent#ACTION_PACKAGE_NEEDS_VERIFICATION package verification
Kenny Root3a9b5fb2011-09-20 14:15:38 -07004876 * broadcast} to respond to the package manager. The response must include
4877 * the {@code verificationCode} which is one of
4878 * {@link PackageManager#VERIFICATION_ALLOW} or
4879 * {@link PackageManager#VERIFICATION_REJECT}.
Kenny Root5ab21572011-07-27 11:11:19 -07004880 *
4881 * @param id pending package identifier as passed via the
kmccormick30498b42013-03-27 17:39:17 -07004882 * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra.
Kenny Root3a9b5fb2011-09-20 14:15:38 -07004883 * @param verificationCode either {@link PackageManager#VERIFICATION_ALLOW}
4884 * or {@link PackageManager#VERIFICATION_REJECT}.
rich cannings7e671512012-08-27 14:44:16 -07004885 * @throws SecurityException if the caller does not have the
Dianne Hackborn8832c182012-09-17 17:20:24 -07004886 * PACKAGE_VERIFICATION_AGENT permission.
Kenny Root5ab21572011-07-27 11:11:19 -07004887 */
Kenny Root3a9b5fb2011-09-20 14:15:38 -07004888 public abstract void verifyPendingInstall(int id, int verificationCode);
Kenny Root5ab21572011-07-27 11:11:19 -07004889
4890 /**
rich canningsd9ef3e52012-08-22 14:28:05 -07004891 * Allows a package listening to the
4892 * {@link Intent#ACTION_PACKAGE_NEEDS_VERIFICATION package verification
4893 * broadcast} to extend the default timeout for a response and declare what
4894 * action to perform after the timeout occurs. The response must include
4895 * the {@code verificationCodeAtTimeout} which is one of
4896 * {@link PackageManager#VERIFICATION_ALLOW} or
4897 * {@link PackageManager#VERIFICATION_REJECT}.
4898 *
4899 * This method may only be called once per package id. Additional calls
4900 * will have no effect.
4901 *
4902 * @param id pending package identifier as passed via the
kmccormick30498b42013-03-27 17:39:17 -07004903 * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra.
rich canningsd9ef3e52012-08-22 14:28:05 -07004904 * @param verificationCodeAtTimeout either
4905 * {@link PackageManager#VERIFICATION_ALLOW} or
rich canningsd1b5cfc2012-08-29 14:49:51 -07004906 * {@link PackageManager#VERIFICATION_REJECT}. If
4907 * {@code verificationCodeAtTimeout} is neither
4908 * {@link PackageManager#VERIFICATION_ALLOW} or
4909 * {@link PackageManager#VERIFICATION_REJECT}, then
4910 * {@code verificationCodeAtTimeout} will default to
rich canningsd9ef3e52012-08-22 14:28:05 -07004911 * {@link PackageManager#VERIFICATION_REJECT}.
4912 * @param millisecondsToDelay the amount of time requested for the timeout.
4913 * Must be positive and less than
rich canningsd1b5cfc2012-08-29 14:49:51 -07004914 * {@link PackageManager#MAXIMUM_VERIFICATION_TIMEOUT}. If
4915 * {@code millisecondsToDelay} is out of bounds,
4916 * {@code millisecondsToDelay} will be set to the closest in
4917 * bounds value; namely, 0 or
rich canningsd9ef3e52012-08-22 14:28:05 -07004918 * {@link PackageManager#MAXIMUM_VERIFICATION_TIMEOUT}.
rich cannings7e671512012-08-27 14:44:16 -07004919 * @throws SecurityException if the caller does not have the
Dianne Hackborn8832c182012-09-17 17:20:24 -07004920 * PACKAGE_VERIFICATION_AGENT permission.
rich canningsd9ef3e52012-08-22 14:28:05 -07004921 */
4922 public abstract void extendVerificationTimeout(int id,
4923 int verificationCodeAtTimeout, long millisecondsToDelay);
4924
4925 /**
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004926 * Allows a package listening to the
Todd Kennedydfa93ab2016-03-03 15:24:33 -08004927 * {@link Intent#ACTION_INTENT_FILTER_NEEDS_VERIFICATION} intent filter verification
4928 * broadcast to respond to the package manager. The response must include
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004929 * the {@code verificationCode} which is one of
4930 * {@link PackageManager#INTENT_FILTER_VERIFICATION_SUCCESS} or
4931 * {@link PackageManager#INTENT_FILTER_VERIFICATION_FAILURE}.
4932 *
4933 * @param verificationId pending package identifier as passed via the
4934 * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra.
4935 * @param verificationCode either {@link PackageManager#INTENT_FILTER_VERIFICATION_SUCCESS}
4936 * or {@link PackageManager#INTENT_FILTER_VERIFICATION_FAILURE}.
Todd Kennedydfa93ab2016-03-03 15:24:33 -08004937 * @param failedDomains a list of failed domains if the verificationCode is
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004938 * {@link PackageManager#INTENT_FILTER_VERIFICATION_FAILURE}, otherwise null;
4939 * @throws SecurityException if the caller does not have the
4940 * INTENT_FILTER_VERIFICATION_AGENT permission.
4941 *
4942 * @hide
4943 */
Fabrice Di Meglioef741da2015-05-12 16:31:38 -07004944 @SystemApi
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06004945 @RequiresPermission(android.Manifest.permission.INTENT_FILTER_VERIFICATION_AGENT)
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004946 public abstract void verifyIntentFilter(int verificationId, int verificationCode,
Todd Kennedydfa93ab2016-03-03 15:24:33 -08004947 List<String> failedDomains);
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004948
4949 /**
4950 * Get the status of a Domain Verification Result for an IntentFilter. This is
4951 * related to the {@link android.content.IntentFilter#setAutoVerify(boolean)} and
4952 * {@link android.content.IntentFilter#getAutoVerify()}
4953 *
4954 * This is used by the ResolverActivity to change the status depending on what the User select
4955 * in the Disambiguation Dialog and also used by the Settings App for changing the default App
4956 * for a domain.
4957 *
4958 * @param packageName The package name of the Activity associated with the IntentFilter.
4959 * @param userId The user id.
4960 *
4961 * @return The status to set to. This can be
4962 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK} or
4963 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS} or
4964 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER} or
4965 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED}
4966 *
4967 * @hide
4968 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08004969 @SystemApi
Todd Kennedydbaef6d2017-07-24 11:28:00 -07004970 @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS_FULL)
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004971 public abstract int getIntentVerificationStatusAsUser(String packageName, @UserIdInt int userId);
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004972
4973 /**
4974 * Allow to change the status of a Intent Verification status for all IntentFilter of an App.
4975 * This is related to the {@link android.content.IntentFilter#setAutoVerify(boolean)} and
4976 * {@link android.content.IntentFilter#getAutoVerify()}
4977 *
4978 * This is used by the ResolverActivity to change the status depending on what the User select
4979 * in the Disambiguation Dialog and also used by the Settings App for changing the default App
4980 * for a domain.
4981 *
4982 * @param packageName The package name of the Activity associated with the IntentFilter.
4983 * @param status The status to set to. This can be
4984 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK} or
4985 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS} or
4986 * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER}
4987 * @param userId The user id.
4988 *
4989 * @return true if the status has been set. False otherwise.
4990 *
4991 * @hide
4992 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08004993 @SystemApi
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06004994 @RequiresPermission(android.Manifest.permission.SET_PREFERRED_APPLICATIONS)
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07004995 public abstract boolean updateIntentVerificationStatusAsUser(String packageName, int status,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07004996 @UserIdInt int userId);
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08004997
4998 /**
4999 * Get the list of IntentFilterVerificationInfo for a specific package and User.
5000 *
5001 * @param packageName the package name. When this parameter is set to a non null value,
5002 * the results will be filtered by the package name provided.
5003 * Otherwise, there will be no filtering and it will return a list
Fabrice Di Meglio07885952015-04-06 19:41:28 -07005004 * corresponding for all packages
5005 *
5006 * @return a list of IntentFilterVerificationInfo for a specific package.
5007 *
5008 * @hide
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08005009 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08005010 @SystemApi
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08005011 public abstract List<IntentFilterVerificationInfo> getIntentFilterVerifications(
5012 String packageName);
5013
5014 /**
Fabrice Di Meglio07885952015-04-06 19:41:28 -07005015 * Get the list of IntentFilter for a specific package.
5016 *
5017 * @param packageName the package name. This parameter is set to a non null value,
5018 * the list will contain all the IntentFilter for that package.
5019 * Otherwise, the list will be empty.
5020 *
5021 * @return a list of IntentFilter for a specific package.
5022 *
5023 * @hide
5024 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08005025 @SystemApi
Fabrice Di Meglio07885952015-04-06 19:41:28 -07005026 public abstract List<IntentFilter> getAllIntentFilters(String packageName);
5027
5028 /**
Fabrice Di Meglio62271722015-04-10 17:24:02 -07005029 * Get the default Browser package name for a specific user.
5030 *
5031 * @param userId The user id.
5032 *
5033 * @return the package name of the default Browser for the specified user. If the user id passed
5034 * is -1 (all users) it will return a null value.
5035 *
5036 * @hide
5037 */
Jeff Sharkeya73b8fd2016-01-06 17:02:08 -07005038 @TestApi
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08005039 @SystemApi
Todd Kennedydbaef6d2017-07-24 11:28:00 -07005040 @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS_FULL)
Jeff Sharkey8588bc12016-01-06 16:47:42 -07005041 public abstract String getDefaultBrowserPackageNameAsUser(@UserIdInt int userId);
Fabrice Di Meglio62271722015-04-10 17:24:02 -07005042
5043 /**
5044 * Set the default Browser package name for a specific user.
5045 *
5046 * @param packageName The package name of the default Browser.
5047 * @param userId The user id.
5048 *
5049 * @return true if the default Browser for the specified user has been set,
5050 * otherwise return false. If the user id passed is -1 (all users) this call will not
5051 * do anything and just return false.
5052 *
5053 * @hide
5054 */
Jeff Schumacher6fd90ed2017-01-20 13:58:34 -08005055 @SystemApi
Todd Kennedydbaef6d2017-07-24 11:28:00 -07005056 @RequiresPermission(allOf = {
5057 Manifest.permission.SET_PREFERRED_APPLICATIONS,
5058 Manifest.permission.INTERACT_ACROSS_USERS_FULL})
Jeff Sharkey8588bc12016-01-06 16:47:42 -07005059 public abstract boolean setDefaultBrowserPackageNameAsUser(String packageName,
5060 @UserIdInt int userId);
Fabrice Di Meglio62271722015-04-10 17:24:02 -07005061
5062 /**
Dianne Hackborn880119b2010-11-18 22:26:40 -08005063 * Change the installer associated with a given package. There are limitations
5064 * on how the installer package can be changed; in particular:
5065 * <ul>
5066 * <li> A SecurityException will be thrown if <var>installerPackageName</var>
5067 * is not signed with the same certificate as the calling application.
5068 * <li> A SecurityException will be thrown if <var>targetPackage</var> already
5069 * has an installer package, and that installer package is not signed with
5070 * the same certificate as the calling application.
5071 * </ul>
5072 *
5073 * @param targetPackage The installed package whose installer will be changed.
5074 * @param installerPackageName The package name of the new installer. May be
5075 * null to clear the association.
5076 */
5077 public abstract void setInstallerPackageName(String targetPackage,
5078 String installerPackageName);
5079
Todd Kennedyab532892017-03-08 14:19:49 -08005080 /** @hide */
5081 @SystemApi
5082 @RequiresPermission(Manifest.permission.INSTALL_PACKAGES)
5083 public abstract void setUpdateAvailable(String packageName, boolean updateAvaialble);
5084
Dianne Hackborn880119b2010-11-18 22:26:40 -08005085 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005086 * Attempts to delete a package. Since this may take a little while, the
5087 * result will be posted back to the given observer. A deletion will fail if
5088 * the calling context lacks the
5089 * {@link android.Manifest.permission#DELETE_PACKAGES} permission, if the
5090 * named package cannot be found, or if the named package is a system
5091 * package.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005092 *
5093 * @param packageName The name of the package to delete
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005094 * @param observer An observer callback to get notified when the package
5095 * deletion is complete.
5096 * {@link android.content.pm.IPackageDeleteObserver#packageDeleted}
5097 * will be called when that happens. observer may be null to
5098 * indicate that no callback is desired.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005099 * @hide
5100 */
Svet Ganov67882122016-12-11 16:36:34 -08005101 @RequiresPermission(Manifest.permission.DELETE_PACKAGES)
Mathew Inwood1c77a112018-08-14 14:06:26 +01005102 @UnsupportedAppUsage
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005103 public abstract void deletePackage(String packageName, IPackageDeleteObserver observer,
5104 @DeleteFlags int flags);
Jacek Surazski65e13172009-04-28 15:26:38 +02005105
5106 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005107 * Attempts to delete a package. Since this may take a little while, the
5108 * result will be posted back to the given observer. A deletion will fail if
5109 * the named package cannot be found, or if the named package is a system
5110 * package.
Nicolas Prevot9a80e532015-09-23 15:49:28 +01005111 *
5112 * @param packageName The name of the package to delete
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005113 * @param observer An observer callback to get notified when the package
5114 * deletion is complete.
5115 * {@link android.content.pm.IPackageDeleteObserver#packageDeleted}
5116 * will be called when that happens. observer may be null to
5117 * indicate that no callback is desired.
Nicolas Prevot9a80e532015-09-23 15:49:28 +01005118 * @param userId The user Id
Nicolas Prevot9a80e532015-09-23 15:49:28 +01005119 * @hide
5120 */
Svet Ganov67882122016-12-11 16:36:34 -08005121 @RequiresPermission(anyOf = {
Nicolas Prevot9a80e532015-09-23 15:49:28 +01005122 Manifest.permission.DELETE_PACKAGES,
5123 Manifest.permission.INTERACT_ACROSS_USERS_FULL})
Mathew Inwood1c77a112018-08-14 14:06:26 +01005124 @UnsupportedAppUsage
Svet Ganov67882122016-12-11 16:36:34 -08005125 public abstract void deletePackageAsUser(@NonNull String packageName,
5126 IPackageDeleteObserver observer, @DeleteFlags int flags, @UserIdInt int userId);
Nicolas Prevot9a80e532015-09-23 15:49:28 +01005127
5128 /**
Jacek Surazski65e13172009-04-28 15:26:38 +02005129 * Retrieve the package name of the application that installed a package. This identifies
5130 * which market the package came from.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005131 *
Jacek Surazski65e13172009-04-28 15:26:38 +02005132 * @param packageName The name of the package to query
Todd Kennedy9db65632018-02-13 11:12:35 -08005133 * @throws IllegalArgumentException if the given package name is not installed
Jacek Surazski65e13172009-04-28 15:26:38 +02005134 */
Scott Kennedy98b5f892018-10-09 17:26:19 -07005135 @Nullable
Jacek Surazski65e13172009-04-28 15:26:38 +02005136 public abstract String getInstallerPackageName(String packageName);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005137
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005138 /**
5139 * Attempts to clear the user data directory of an application.
5140 * Since this may take a little while, the result will
5141 * be posted back to the given observer. A deletion will fail if the
5142 * named package cannot be found, or if the named package is a "system package".
5143 *
5144 * @param packageName The name of the package
5145 * @param observer An observer callback to get notified when the operation is finished
5146 * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)}
5147 * will be called when that happens. observer may be null to indicate that
5148 * no callback is desired.
5149 *
5150 * @hide
5151 */
Mathew Inwood1c77a112018-08-14 14:06:26 +01005152 @UnsupportedAppUsage
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005153 public abstract void clearApplicationUserData(String packageName,
5154 IPackageDataObserver observer);
5155 /**
5156 * Attempts to delete the cache files associated with an application.
5157 * Since this may take a little while, the result will
5158 * be posted back to the given observer. A deletion will fail if the calling context
5159 * lacks the {@link android.Manifest.permission#DELETE_CACHE_FILES} permission, if the
5160 * named package cannot be found, or if the named package is a "system package".
5161 *
5162 * @param packageName The name of the package to delete
5163 * @param observer An observer callback to get notified when the cache file deletion
5164 * is complete.
5165 * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)}
5166 * will be called when that happens. observer may be null to indicate that
5167 * no callback is desired.
5168 *
5169 * @hide
5170 */
Mathew Inwood1c77a112018-08-14 14:06:26 +01005171 @UnsupportedAppUsage
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005172 public abstract void deleteApplicationCacheFiles(String packageName,
5173 IPackageDataObserver observer);
5174
5175 /**
Suprabh Shukla78c9eb82016-04-12 15:51:35 -07005176 * Attempts to delete the cache files associated with an application for a given user. Since
5177 * this may take a little while, the result will be posted back to the given observer. A
5178 * deletion will fail if the calling context lacks the
5179 * {@link android.Manifest.permission#DELETE_CACHE_FILES} permission, if the named package
5180 * cannot be found, or if the named package is a "system package". If {@code userId} does not
5181 * belong to the calling user, the caller must have
5182 * {@link android.Manifest.permission#INTERACT_ACROSS_USERS} permission.
5183 *
5184 * @param packageName The name of the package to delete
5185 * @param userId the user for which the cache files needs to be deleted
5186 * @param observer An observer callback to get notified when the cache file deletion is
5187 * complete.
5188 * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)}
5189 * will be called when that happens. observer may be null to indicate that no
5190 * callback is desired.
5191 * @hide
5192 */
Mathew Inwood1c77a112018-08-14 14:06:26 +01005193 @UnsupportedAppUsage
Suprabh Shukla78c9eb82016-04-12 15:51:35 -07005194 public abstract void deleteApplicationCacheFilesAsUser(String packageName, int userId,
5195 IPackageDataObserver observer);
5196
5197 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005198 * Free storage by deleting LRU sorted list of cache files across
5199 * all applications. If the currently available free storage
5200 * on the device is greater than or equal to the requested
5201 * free storage, no cache files are cleared. If the currently
5202 * available storage on the device is less than the requested
5203 * free storage, some or all of the cache files across
5204 * all applications are deleted (based on last accessed time)
5205 * to increase the free storage space on the device to
5206 * the requested value. There is no guarantee that clearing all
5207 * the cache files from all applications will clear up
5208 * enough storage to achieve the desired value.
5209 * @param freeStorageSize The number of bytes of storage to be
5210 * freed by the system. Say if freeStorageSize is XX,
5211 * and the current free storage is YY,
5212 * if XX is less than YY, just return. if not free XX-YY number
5213 * of bytes if possible.
5214 * @param observer call back used to notify when
5215 * the operation is completed
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005216 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005217 * @hide
5218 */
Mathew Inwood1c77a112018-08-14 14:06:26 +01005219 @UnsupportedAppUsage
Jeff Sharkey529f91f2015-04-18 20:23:13 -07005220 public void freeStorageAndNotify(long freeStorageSize, IPackageDataObserver observer) {
5221 freeStorageAndNotify(null, freeStorageSize, observer);
5222 }
5223
5224 /** {@hide} */
Mathew Inwood1c77a112018-08-14 14:06:26 +01005225 @UnsupportedAppUsage
Jeff Sharkey529f91f2015-04-18 20:23:13 -07005226 public abstract void freeStorageAndNotify(String volumeUuid, long freeStorageSize,
5227 IPackageDataObserver observer);
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -07005228
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005229 /**
5230 * Free storage by deleting LRU sorted list of cache files across
5231 * all applications. If the currently available free storage
5232 * on the device is greater than or equal to the requested
5233 * free storage, no cache files are cleared. If the currently
5234 * available storage on the device is less than the requested
5235 * free storage, some or all of the cache files across
5236 * all applications are deleted (based on last accessed time)
5237 * to increase the free storage space on the device to
5238 * the requested value. There is no guarantee that clearing all
5239 * the cache files from all applications will clear up
5240 * enough storage to achieve the desired value.
5241 * @param freeStorageSize The number of bytes of storage to be
5242 * freed by the system. Say if freeStorageSize is XX,
5243 * and the current free storage is YY,
5244 * if XX is less than YY, just return. if not free XX-YY number
5245 * of bytes if possible.
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -07005246 * @param pi IntentSender call back used to
5247 * notify when the operation is completed.May be null
5248 * to indicate that no call back is desired.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005249 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005250 * @hide
5251 */
Mathew Inwood1c77a112018-08-14 14:06:26 +01005252 @UnsupportedAppUsage
Jeff Sharkey529f91f2015-04-18 20:23:13 -07005253 public void freeStorage(long freeStorageSize, IntentSender pi) {
5254 freeStorage(null, freeStorageSize, pi);
5255 }
5256
5257 /** {@hide} */
Mathew Inwood1c77a112018-08-14 14:06:26 +01005258 @UnsupportedAppUsage
Jeff Sharkey529f91f2015-04-18 20:23:13 -07005259 public abstract void freeStorage(String volumeUuid, long freeStorageSize, IntentSender pi);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005260
5261 /**
5262 * Retrieve the size information for a package.
5263 * Since this may take a little while, the result will
5264 * be posted back to the given observer. The calling context
5265 * should have the {@link android.Manifest.permission#GET_PACKAGE_SIZE} permission.
5266 *
5267 * @param packageName The name of the package whose size information is to be retrieved
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07005268 * @param userId The user whose size information should be retrieved.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005269 * @param observer An observer callback to get notified when the operation
5270 * is complete.
5271 * {@link android.content.pm.IPackageStatsObserver#onGetStatsCompleted(PackageStats, boolean)}
5272 * The observer's callback is invoked with a PackageStats object(containing the
5273 * code, data and cache sizes of the package) and a boolean value representing
5274 * the status of the operation. observer may be null to indicate that
5275 * no callback is desired.
5276 *
Jeff Sharkey60f95aa2017-03-08 13:57:15 -07005277 * @deprecated use {@link StorageStatsManager} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005278 * @hide
5279 */
Jeff Sharkey60f95aa2017-03-08 13:57:15 -07005280 @Deprecated
Mathew Inwood1c77a112018-08-14 14:06:26 +01005281 @UnsupportedAppUsage
Jeff Sharkey8588bc12016-01-06 16:47:42 -07005282 public abstract void getPackageSizeInfoAsUser(String packageName, @UserIdInt int userId,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005283 IPackageStatsObserver observer);
5284
5285 /**
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07005286 * Like {@link #getPackageSizeInfoAsUser(String, int, IPackageStatsObserver)}, but
Dianne Hackborn0c380492012-08-20 17:23:30 -07005287 * returns the size for the calling user.
5288 *
Jeff Sharkey60f95aa2017-03-08 13:57:15 -07005289 * @deprecated use {@link StorageStatsManager} instead.
Dianne Hackborn0c380492012-08-20 17:23:30 -07005290 * @hide
5291 */
Jeff Sharkey60f95aa2017-03-08 13:57:15 -07005292 @Deprecated
Mathew Inwood1c77a112018-08-14 14:06:26 +01005293 @UnsupportedAppUsage
Dianne Hackborn0c380492012-08-20 17:23:30 -07005294 public void getPackageSizeInfo(String packageName, IPackageStatsObserver observer) {
Jeff Sharkeyad357d12018-02-02 13:25:31 -07005295 getPackageSizeInfoAsUser(packageName, getUserId(), observer);
Dianne Hackborn0c380492012-08-20 17:23:30 -07005296 }
5297
5298 /**
Dianne Hackborna7ca0e52009-12-01 14:31:55 -08005299 * @deprecated This function no longer does anything; it was an old
kmccormickac66b852013-03-28 15:17:15 -07005300 * approach to managing preferred activities, which has been superseded
5301 * by (and conflicts with) the modern activity-based preferences.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005302 */
Dianne Hackborna7ca0e52009-12-01 14:31:55 -08005303 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005304 public abstract void addPackageToPreferred(String packageName);
5305
5306 /**
Dianne Hackborna7ca0e52009-12-01 14:31:55 -08005307 * @deprecated This function no longer does anything; it was an old
kmccormickac66b852013-03-28 15:17:15 -07005308 * approach to managing preferred activities, which has been superseded
5309 * by (and conflicts with) the modern activity-based preferences.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005310 */
Dianne Hackborna7ca0e52009-12-01 14:31:55 -08005311 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005312 public abstract void removePackageFromPreferred(String packageName);
5313
5314 /**
Jeff Sharkey4347f812017-04-21 12:08:39 -06005315 * Retrieve the list of all currently configured preferred packages. The
5316 * first package on the list is the most preferred, the last is the least
5317 * preferred.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005318 *
Jeff Sharkey4347f812017-04-21 12:08:39 -06005319 * @param flags Additional option flags to modify the data returned.
5320 * @return A List of PackageInfo objects, one for each preferred
5321 * application, in order of preference.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005322 */
Jeff Sharkey2f3e3532015-12-21 14:16:43 -07005323 public abstract List<PackageInfo> getPreferredPackages(@PackageInfoFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005324
5325 /**
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08005326 * @deprecated This is a protected API that should not have been available
5327 * to third party applications. It is the platform's responsibility for
kmccormick30498b42013-03-27 17:39:17 -07005328 * assigning preferred activities and this cannot be directly modified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005329 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005330 * Add a new preferred activity mapping to the system. This will be used
5331 * to automatically select the given activity component when
5332 * {@link Context#startActivity(Intent) Context.startActivity()} finds
5333 * multiple matching activities and also matches the given filter.
5334 *
5335 * @param filter The set of intents under which this activity will be
5336 * made preferred.
5337 * @param match The IntentFilter match category that this preference
5338 * applies to.
5339 * @param set The set of activities that the user was picking from when
5340 * this preference was made.
5341 * @param activity The component name of the activity that is to be
5342 * preferred.
5343 */
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08005344 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005345 public abstract void addPreferredActivity(IntentFilter filter, int match,
5346 ComponentName[] set, ComponentName activity);
5347
5348 /**
Amith Yamasania3f133a2012-08-09 17:11:28 -07005349 * Same as {@link #addPreferredActivity(IntentFilter, int,
5350 ComponentName[], ComponentName)}, but with a specific userId to apply the preference
5351 to.
5352 * @hide
5353 */
Mathew Inwood1c77a112018-08-14 14:06:26 +01005354 @UnsupportedAppUsage
Jeff Sharkeye06b4d12016-01-06 14:51:50 -07005355 public void addPreferredActivityAsUser(IntentFilter filter, int match,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07005356 ComponentName[] set, ComponentName activity, @UserIdInt int userId) {
Amith Yamasania3f133a2012-08-09 17:11:28 -07005357 throw new RuntimeException("Not implemented. Must override in a subclass.");
5358 }
5359
5360 /**
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08005361 * @deprecated This is a protected API that should not have been available
5362 * to third party applications. It is the platform's responsibility for
kmccormick30498b42013-03-27 17:39:17 -07005363 * assigning preferred activities and this cannot be directly modified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005364 *
Satish Sampath8dbe6122009-06-02 23:35:54 +01005365 * Replaces an existing preferred activity mapping to the system, and if that were not present
5366 * adds a new preferred activity. This will be used
5367 * to automatically select the given activity component when
5368 * {@link Context#startActivity(Intent) Context.startActivity()} finds
5369 * multiple matching activities and also matches the given filter.
5370 *
5371 * @param filter The set of intents under which this activity will be
5372 * made preferred.
5373 * @param match The IntentFilter match category that this preference
5374 * applies to.
5375 * @param set The set of activities that the user was picking from when
5376 * this preference was made.
5377 * @param activity The component name of the activity that is to be
5378 * preferred.
5379 * @hide
5380 */
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08005381 @Deprecated
Mathew Inwood1c77a112018-08-14 14:06:26 +01005382 @UnsupportedAppUsage
Satish Sampath8dbe6122009-06-02 23:35:54 +01005383 public abstract void replacePreferredActivity(IntentFilter filter, int match,
5384 ComponentName[] set, ComponentName activity);
5385
5386 /**
Amith Yamasani41c1ded2014-08-05 11:15:05 -07005387 * @hide
5388 */
5389 @Deprecated
Mathew Inwood1c77a112018-08-14 14:06:26 +01005390 @UnsupportedAppUsage
Amith Yamasani41c1ded2014-08-05 11:15:05 -07005391 public void replacePreferredActivityAsUser(IntentFilter filter, int match,
Jeff Sharkey8588bc12016-01-06 16:47:42 -07005392 ComponentName[] set, ComponentName activity, @UserIdInt int userId) {
Amith Yamasani41c1ded2014-08-05 11:15:05 -07005393 throw new RuntimeException("Not implemented. Must override in a subclass.");
5394 }
5395
5396 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005397 * Remove all preferred activity mappings, previously added with
5398 * {@link #addPreferredActivity}, from the
5399 * system whose activities are implemented in the given package name.
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08005400 * An application can only clear its own package(s).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005401 *
5402 * @param packageName The name of the package whose preferred activity
5403 * mappings are to be removed.
5404 */
5405 public abstract void clearPackagePreferredActivities(String packageName);
5406
5407 /**
5408 * Retrieve all preferred activities, previously added with
5409 * {@link #addPreferredActivity}, that are
5410 * currently registered with the system.
5411 *
John Spurlock38e64252015-03-18 12:09:32 -04005412 * @param outFilters A required list in which to place the filters of all of the
5413 * preferred activities.
5414 * @param outActivities A required list in which to place the component names of
5415 * all of the preferred activities.
5416 * @param packageName An optional package in which you would like to limit
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005417 * the list. If null, all activities will be returned; if non-null, only
5418 * those activities in the given package are returned.
5419 *
5420 * @return Returns the total number of registered preferred activities
5421 * (the number of distinct IntentFilter records, not the number of unique
5422 * activity components) that were found.
5423 */
John Spurlock38e64252015-03-18 12:09:32 -04005424 public abstract int getPreferredActivities(@NonNull List<IntentFilter> outFilters,
5425 @NonNull List<ComponentName> outActivities, String packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005426
5427 /**
Christopher Tatea2a0850d2013-09-05 16:38:58 -07005428 * Ask for the set of available 'home' activities and the current explicit
5429 * default, if any.
5430 * @hide
5431 */
Mathew Inwood1c77a112018-08-14 14:06:26 +01005432 @UnsupportedAppUsage
Christopher Tatea2a0850d2013-09-05 16:38:58 -07005433 public abstract ComponentName getHomeActivities(List<ResolveInfo> outActivities);
5434
5435 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005436 * Set the enabled setting for a package component (activity, receiver, service, provider).
5437 * This setting will override any enabled state which may have been set by the component in its
5438 * manifest.
5439 *
5440 * @param componentName The component to enable
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06005441 * @param newState The new enabled state for the component.
5442 * @param flags Optional behavior flags.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005443 */
5444 public abstract void setComponentEnabledSetting(ComponentName componentName,
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06005445 @EnabledState int newState, @EnabledFlags int flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005446
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005447 /**
Amaury Medeirosdde24262014-06-03 20:06:41 -03005448 * Return the enabled setting for a package component (activity,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005449 * receiver, service, provider). This returns the last value set by
5450 * {@link #setComponentEnabledSetting(ComponentName, int, int)}; in most
5451 * cases this value will be {@link #COMPONENT_ENABLED_STATE_DEFAULT} since
5452 * the value originally specified in the manifest has not been modified.
5453 *
5454 * @param componentName The component to retrieve.
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06005455 * @return Returns the current enabled state for the component.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005456 */
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06005457 public abstract @EnabledState int getComponentEnabledSetting(
5458 ComponentName componentName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005459
5460 /**
5461 * Set the enabled setting for an application
5462 * This setting will override any enabled state which may have been set by the application in
5463 * its manifest. It also overrides the enabled state set in the manifest for any of the
5464 * application's components. It does not override any enabled state set by
5465 * {@link #setComponentEnabledSetting} for any of the application's components.
5466 *
5467 * @param packageName The package name of the application to enable
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06005468 * @param newState The new enabled state for the application.
5469 * @param flags Optional behavior flags.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005470 */
5471 public abstract void setApplicationEnabledSetting(String packageName,
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06005472 @EnabledState int newState, @EnabledFlags int flags);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005473
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005474 /**
Amaury Medeirosdde24262014-06-03 20:06:41 -03005475 * Return the enabled setting for an application. This returns
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005476 * the last value set by
5477 * {@link #setApplicationEnabledSetting(String, int, int)}; in most
5478 * cases this value will be {@link #COMPONENT_ENABLED_STATE_DEFAULT} since
5479 * the value originally specified in the manifest has not been modified.
5480 *
Amaury Medeirosdde24262014-06-03 20:06:41 -03005481 * @param packageName The package name of the application to retrieve.
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06005482 * @return Returns the current enabled state for the application.
Mathew Inwood1b9f8d92011-09-26 13:23:56 +01005483 * @throws IllegalArgumentException if the named package does not exist.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005484 */
Jeff Sharkey30e06bb2017-04-24 11:18:03 -06005485 public abstract @EnabledState int getApplicationEnabledSetting(String packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005486
5487 /**
Sudheer Shankabbb3ff22015-07-09 15:39:23 +01005488 * Flush the package restrictions for a given user to disk. This forces the package restrictions
5489 * like component and package enabled settings to be written to disk and avoids the delay that
5490 * is otherwise present when changing those settings.
5491 *
5492 * @param userId Ther userId of the user whose restrictions are to be flushed.
5493 * @hide
5494 */
Mathew Inwood1c77a112018-08-14 14:06:26 +01005495 @UnsupportedAppUsage
Sudheer Shankabbb3ff22015-07-09 15:39:23 +01005496 public abstract void flushPackageRestrictionsAsUser(int userId);
5497
5498 /**
Amith Yamasanie5bcff62014-07-19 15:44:09 -07005499 * Puts the package in a hidden state, which is almost like an uninstalled state,
Amith Yamasani655d0e22013-06-12 14:19:10 -07005500 * making the package unavailable, but it doesn't remove the data or the actual
Amith Yamasanie5bcff62014-07-19 15:44:09 -07005501 * package file. Application can be unhidden by either resetting the hidden state
5502 * or by installing it, such as with {@link #installExistingPackage(String)}
Amith Yamasani655d0e22013-06-12 14:19:10 -07005503 * @hide
5504 */
Mathew Inwood1c77a112018-08-14 14:06:26 +01005505 @UnsupportedAppUsage
Amith Yamasanie5bcff62014-07-19 15:44:09 -07005506 public abstract boolean setApplicationHiddenSettingAsUser(String packageName, boolean hidden,
Amith Yamasani655d0e22013-06-12 14:19:10 -07005507 UserHandle userHandle);
5508
5509 /**
Amith Yamasanie5bcff62014-07-19 15:44:09 -07005510 * Returns the hidden state of a package.
5511 * @see #setApplicationHiddenSettingAsUser(String, boolean, UserHandle)
Amith Yamasani655d0e22013-06-12 14:19:10 -07005512 * @hide
5513 */
Mathew Inwood1c77a112018-08-14 14:06:26 +01005514 @UnsupportedAppUsage
Amith Yamasanie5bcff62014-07-19 15:44:09 -07005515 public abstract boolean getApplicationHiddenSettingAsUser(String packageName,
Amith Yamasani655d0e22013-06-12 14:19:10 -07005516 UserHandle userHandle);
5517
5518 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005519 * Return whether the device has been booted into safe mode.
5520 */
5521 public abstract boolean isSafeMode();
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08005522
5523 /**
Svetoslavf7c06eb2015-06-10 18:43:22 -07005524 * Adds a listener for permission changes for installed packages.
5525 *
5526 * @param listener The listener to add.
5527 *
5528 * @hide
5529 */
5530 @SystemApi
5531 @RequiresPermission(Manifest.permission.OBSERVE_GRANT_REVOKE_PERMISSIONS)
5532 public abstract void addOnPermissionsChangeListener(OnPermissionsChangedListener listener);
5533
5534 /**
5535 * Remvoes a listener for permission changes for installed packages.
5536 *
5537 * @param listener The listener to remove.
5538 *
5539 * @hide
5540 */
5541 @SystemApi
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -06005542 @RequiresPermission(Manifest.permission.OBSERVE_GRANT_REVOKE_PERMISSIONS)
Svetoslavf7c06eb2015-06-10 18:43:22 -07005543 public abstract void removeOnPermissionsChangeListener(OnPermissionsChangedListener listener);
5544
5545 /**
dcashman9d2f4412014-06-09 09:27:54 -07005546 * Return the {@link KeySet} associated with the String alias for this
5547 * application.
5548 *
5549 * @param alias The alias for a given {@link KeySet} as defined in the
5550 * application's AndroidManifest.xml.
dcashmanc6f22492014-08-14 09:54:51 -07005551 * @hide
dcashman9d2f4412014-06-09 09:27:54 -07005552 */
Mathew Inwood1c77a112018-08-14 14:06:26 +01005553 @UnsupportedAppUsage
dcashman9d2f4412014-06-09 09:27:54 -07005554 public abstract KeySet getKeySetByAlias(String packageName, String alias);
5555
Ihab Awad1ec68882014-09-12 11:09:01 -07005556 /** Return the signing {@link KeySet} for this application.
dcashmanc6f22492014-08-14 09:54:51 -07005557 * @hide
5558 */
Mathew Inwood1c77a112018-08-14 14:06:26 +01005559 @UnsupportedAppUsage
dcashman9d2f4412014-06-09 09:27:54 -07005560 public abstract KeySet getSigningKeySet(String packageName);
5561
5562 /**
5563 * Return whether the package denoted by packageName has been signed by all
5564 * of the keys specified by the {@link KeySet} ks. This will return true if
5565 * the package has been signed by additional keys (a superset) as well.
5566 * Compare to {@link #isSignedByExactly(String packageName, KeySet ks)}.
dcashmanc6f22492014-08-14 09:54:51 -07005567 * @hide
dcashman9d2f4412014-06-09 09:27:54 -07005568 */
Mathew Inwood1c77a112018-08-14 14:06:26 +01005569 @UnsupportedAppUsage
dcashman9d2f4412014-06-09 09:27:54 -07005570 public abstract boolean isSignedBy(String packageName, KeySet ks);
5571
5572 /**
5573 * Return whether the package denoted by packageName has been signed by all
5574 * of, and only, the keys specified by the {@link KeySet} ks. Compare to
5575 * {@link #isSignedBy(String packageName, KeySet ks)}.
dcashmanc6f22492014-08-14 09:54:51 -07005576 * @hide
dcashman9d2f4412014-06-09 09:27:54 -07005577 */
Mathew Inwood1c77a112018-08-14 14:06:26 +01005578 @UnsupportedAppUsage
dcashman9d2f4412014-06-09 09:27:54 -07005579 public abstract boolean isSignedByExactly(String packageName, KeySet ks);
5580
5581 /**
Andrei Stingaceanueb84b182016-01-26 18:39:55 +00005582 * Puts the package in a suspended state, where attempts at starting activities are denied.
Andrei Stingaceanu1e283912015-11-26 15:26:28 +00005583 *
Suprabh Shukla021b57a2018-03-08 18:21:50 -08005584 * <p>It doesn't remove the data or the actual package file. The application's notifications
Suprabh Shukla2fd43ba2018-03-22 16:57:49 -07005585 * 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 -07005586 * show toasts or system alert windows or ring the device.
5587 *
5588 * <p>When the user tries to launch a suspended app, a system dialog with the given
5589 * {@code dialogMessage} will be shown instead. Since the message is supplied to the system as
5590 * a {@link String}, the caller needs to take care of localization as needed.
5591 * The dialog message can optionally contain a placeholder for the name of the suspended app.
5592 * The system uses {@link String#format(Locale, String, Object...) String.format} to insert the
5593 * app name into the message, so an example format string could be {@code "The app %1$s is
5594 * currently suspended"}. This makes it easier for callers to provide a single message which
5595 * works for all the packages being suspended in a single call.
Andrei Stingaceanueb84b182016-01-26 18:39:55 +00005596 *
Kenny Guy871f3eb2016-03-09 20:06:16 +00005597 * <p>The package must already be installed. If the package is uninstalled while suspended
Suprabh Shukla021b57a2018-03-08 18:21:50 -08005598 * the package will no longer be suspended. </p>
5599 *
5600 * <p>Optionally, the suspending app can provide extra information in the form of
5601 * {@link PersistableBundle} objects to be shared with the apps being suspended and the
Suprabh Shukla3e03ab92018-04-11 16:03:49 -07005602 * launcher to support customization that they might need to handle the suspended state.
Suprabh Shukla021b57a2018-03-08 18:21:50 -08005603 *
5604 * <p>The caller must hold {@link Manifest.permission#SUSPEND_APPS} or
5605 * {@link Manifest.permission#MANAGE_USERS} to use this api.</p>
Kenny Guy871f3eb2016-03-09 20:06:16 +00005606 *
Andrei Stingaceanueb84b182016-01-26 18:39:55 +00005607 * @param packageNames The names of the packages to set the suspended status.
5608 * @param suspended If set to {@code true} than the packages will be suspended, if set to
Suprabh Shukla021b57a2018-03-08 18:21:50 -08005609 * {@code false}, the packages will be unsuspended.
5610 * @param appExtras An optional {@link PersistableBundle} that the suspending app can provide
5611 * which will be shared with the apps being suspended. Ignored if
5612 * {@code suspended} is false.
5613 * @param launcherExtras An optional {@link PersistableBundle} that the suspending app can
5614 * provide which will be shared with the launcher. Ignored if
5615 * {@code suspended} is false.
5616 * @param dialogMessage The message to be displayed to the user, when they try to launch a
5617 * suspended app.
Andrei Stingaceanu1e283912015-11-26 15:26:28 +00005618 *
Suprabh Shukla3e03ab92018-04-11 16:03:49 -07005619 * @return an array of package names for which the suspended status could not be set as
5620 * requested in this method.
Andrei Stingaceanueb84b182016-01-26 18:39:55 +00005621 *
Andrei Stingaceanu1e283912015-11-26 15:26:28 +00005622 * @hide
5623 */
Suprabh Shukla021b57a2018-03-08 18:21:50 -08005624 @SystemApi
Suprabh Shukla14405c92018-05-16 20:41:00 -07005625 @RequiresPermission(Manifest.permission.SUSPEND_APPS)
Suprabh Shukla021b57a2018-03-08 18:21:50 -08005626 public String[] setPackagesSuspended(String[] packageNames, boolean suspended,
5627 @Nullable PersistableBundle appExtras, @Nullable PersistableBundle launcherExtras,
5628 String dialogMessage) {
5629 throw new UnsupportedOperationException("setPackagesSuspended not implemented");
5630 }
Andrei Stingaceanu1e283912015-11-26 15:26:28 +00005631
Andrei Stingaceanu355b2322016-02-12 16:43:51 +00005632 /**
Suprabh Shukla021b57a2018-03-08 18:21:50 -08005633 * @see #setPackagesSuspended(String[], boolean, PersistableBundle, PersistableBundle, String)
Andrei Stingaceanu355b2322016-02-12 16:43:51 +00005634 * @param packageName The name of the package to get the suspended status of.
5635 * @param userId The user id.
5636 * @return {@code true} if the package is suspended or {@code false} if the package is not
Suprabh Shukla96212bc2018-04-10 15:04:51 -07005637 * suspended.
5638 * @throws IllegalArgumentException if the package was not found.
Andrei Stingaceanu355b2322016-02-12 16:43:51 +00005639 * @hide
5640 */
Mathew Inwood1c77a112018-08-14 14:06:26 +01005641 @UnsupportedAppUsage
Andrei Stingaceanu355b2322016-02-12 16:43:51 +00005642 public abstract boolean isPackageSuspendedForUser(String packageName, int userId);
5643
Jeff Sharkey9bc89af2017-01-11 11:25:50 -07005644 /**
Suprabh Shukla021b57a2018-03-08 18:21:50 -08005645 * Query if an app is currently suspended.
5646 *
5647 * @return {@code true} if the given package is suspended, {@code false} otherwise
Suprabh Shukla96212bc2018-04-10 15:04:51 -07005648 * @throws NameNotFoundException if the package could not be found.
Suprabh Shukla021b57a2018-03-08 18:21:50 -08005649 *
5650 * @see #setPackagesSuspended(String[], boolean, PersistableBundle, PersistableBundle, String)
5651 * @hide
5652 */
5653 @SystemApi
Suprabh Shukla96212bc2018-04-10 15:04:51 -07005654 public boolean isPackageSuspended(String packageName) throws NameNotFoundException {
Suprabh Shukla021b57a2018-03-08 18:21:50 -08005655 throw new UnsupportedOperationException("isPackageSuspended not implemented");
5656 }
5657
5658 /**
Suprabh Shukla2fd43ba2018-03-22 16:57:49 -07005659 * Apps can query this to know if they have been suspended. A system app with the permission
5660 * {@code android.permission.SUSPEND_APPS} can put any app on the device into a suspended state.
5661 *
5662 * <p>While in this state, the application's notifications will be hidden, any of its started
5663 * activities will be stopped and it will not be able to show toasts or dialogs or ring the
5664 * device. When the user tries to launch a suspended app, the system will, instead, show a
5665 * dialog to the user informing them that they cannot use this app while it is suspended.
5666 *
5667 * <p>When an app is put into this state, the broadcast action
5668 * {@link Intent#ACTION_MY_PACKAGE_SUSPENDED} will be delivered to any of its broadcast
5669 * receivers that included this action in their intent-filters, <em>including manifest
5670 * receivers.</em> Similarly, a broadcast action {@link Intent#ACTION_MY_PACKAGE_UNSUSPENDED}
5671 * is delivered when a previously suspended app is taken out of this state.
5672 * </p>
Suprabh Shukla021b57a2018-03-08 18:21:50 -08005673 *
5674 * @return {@code true} if the calling package has been suspended, {@code false} otherwise.
5675 *
5676 * @see #getSuspendedPackageAppExtras()
Suprabh Shukla2fd43ba2018-03-22 16:57:49 -07005677 * @see Intent#ACTION_MY_PACKAGE_SUSPENDED
5678 * @see Intent#ACTION_MY_PACKAGE_UNSUSPENDED
Suprabh Shukla021b57a2018-03-08 18:21:50 -08005679 */
5680 public boolean isPackageSuspended() {
5681 throw new UnsupportedOperationException("isPackageSuspended not implemented");
5682 }
5683
5684 /**
Suprabh Shukla96212bc2018-04-10 15:04:51 -07005685 * Returns a {@link Bundle} of extras that was meant to be sent to the calling app when it was
5686 * suspended. An app with the permission {@code android.permission.SUSPEND_APPS} can supply this
5687 * to the system at the time of suspending an app.
Suprabh Shukla021b57a2018-03-08 18:21:50 -08005688 *
Suprabh Shukla96212bc2018-04-10 15:04:51 -07005689 * <p>This is the same {@link Bundle} that is sent along with the broadcast
5690 * {@link Intent#ACTION_MY_PACKAGE_SUSPENDED}, whenever the app is suspended. The contents of
5691 * this {@link Bundle} are a contract between the suspended app and the suspending app.
5692 *
5693 * <p>Note: These extras are optional, so if no extras were supplied to the system, this method
5694 * will return {@code null}, even when the calling app has been suspended.
Suprabh Shukla021b57a2018-03-08 18:21:50 -08005695 *
Suprabh Shukla2fd43ba2018-03-22 16:57:49 -07005696 * @return A {@link Bundle} containing the extras for the app, or {@code null} if the
Suprabh Shukla021b57a2018-03-08 18:21:50 -08005697 * package is not currently suspended.
Suprabh Shukla2fd43ba2018-03-22 16:57:49 -07005698 *
Suprabh Shukla021b57a2018-03-08 18:21:50 -08005699 * @see #isPackageSuspended()
Suprabh Shukla2fd43ba2018-03-22 16:57:49 -07005700 * @see Intent#ACTION_MY_PACKAGE_UNSUSPENDED
5701 * @see Intent#ACTION_MY_PACKAGE_SUSPENDED
Suprabh Shukla96212bc2018-04-10 15:04:51 -07005702 * @see Intent#EXTRA_SUSPENDED_PACKAGE_EXTRAS
Suprabh Shukla021b57a2018-03-08 18:21:50 -08005703 */
Suprabh Shukla2fd43ba2018-03-22 16:57:49 -07005704 public @Nullable Bundle getSuspendedPackageAppExtras() {
Suprabh Shukla021b57a2018-03-08 18:21:50 -08005705 throw new UnsupportedOperationException("getSuspendedPackageAppExtras not implemented");
5706 }
5707
5708 /**
Jeff Sharkey9bc89af2017-01-11 11:25:50 -07005709 * Provide a hint of what the {@link ApplicationInfo#category} value should
5710 * be for the given package.
5711 * <p>
5712 * This hint can only be set by the app which installed this package, as
5713 * determined by {@link #getInstallerPackageName(String)}.
Jeff Sharkey60a82cd2017-04-18 18:19:16 -06005714 *
5715 * @param packageName the package to change the category hint for.
Jeff Sharkey4347f812017-04-21 12:08:39 -06005716 * @param categoryHint the category hint to set.
Jeff Sharkey9bc89af2017-01-11 11:25:50 -07005717 */
Jeff Sharkey60a82cd2017-04-18 18:19:16 -06005718 public abstract void setApplicationCategoryHint(@NonNull String packageName,
Jeff Sharkey9bc89af2017-01-11 11:25:50 -07005719 @ApplicationInfo.Category int categoryHint);
5720
Jeff Sharkeyb2b9ab82015-04-05 21:10:42 -07005721 /** {@hide} */
Jeff Sharkey620b32b2015-04-23 19:36:02 -07005722 public static boolean isMoveStatusFinished(int status) {
5723 return (status < 0 || status > 100);
5724 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005725
Jeff Sharkeye2d45be2015-04-15 17:14:12 -07005726 /** {@hide} */
Jeff Sharkey620b32b2015-04-23 19:36:02 -07005727 public static abstract class MoveCallback {
Jeff Sharkey50a05452015-04-29 11:24:52 -07005728 public void onCreated(int moveId, Bundle extras) {}
5729 public abstract void onStatusChanged(int moveId, int status, long estMillis);
Jeff Sharkey620b32b2015-04-23 19:36:02 -07005730 }
Jeff Sharkeye2d45be2015-04-15 17:14:12 -07005731
5732 /** {@hide} */
Mathew Inwood1c77a112018-08-14 14:06:26 +01005733 @UnsupportedAppUsage
Jeff Sharkey620b32b2015-04-23 19:36:02 -07005734 public abstract int getMoveStatus(int moveId);
5735
5736 /** {@hide} */
Mathew Inwood1c77a112018-08-14 14:06:26 +01005737 @UnsupportedAppUsage
Jeff Sharkey620b32b2015-04-23 19:36:02 -07005738 public abstract void registerMoveCallback(MoveCallback callback, Handler handler);
5739 /** {@hide} */
Mathew Inwood1c77a112018-08-14 14:06:26 +01005740 @UnsupportedAppUsage
Jeff Sharkey620b32b2015-04-23 19:36:02 -07005741 public abstract void unregisterMoveCallback(MoveCallback callback);
5742
5743 /** {@hide} */
Mathew Inwood1c77a112018-08-14 14:06:26 +01005744 @UnsupportedAppUsage
Jeff Sharkey620b32b2015-04-23 19:36:02 -07005745 public abstract int movePackage(String packageName, VolumeInfo vol);
5746 /** {@hide} */
Mathew Inwood1c77a112018-08-14 14:06:26 +01005747 @UnsupportedAppUsage
Jeff Sharkey620b32b2015-04-23 19:36:02 -07005748 public abstract @Nullable VolumeInfo getPackageCurrentVolume(ApplicationInfo app);
5749 /** {@hide} */
Mathew Inwood1c77a112018-08-14 14:06:26 +01005750 @UnsupportedAppUsage
Jeff Sharkey620b32b2015-04-23 19:36:02 -07005751 public abstract @NonNull List<VolumeInfo> getPackageCandidateVolumes(ApplicationInfo app);
5752
5753 /** {@hide} */
5754 public abstract int movePrimaryStorage(VolumeInfo vol);
5755 /** {@hide} */
5756 public abstract @Nullable VolumeInfo getPrimaryStorageCurrentVolume();
5757 /** {@hide} */
5758 public abstract @NonNull List<VolumeInfo> getPrimaryStorageCandidateVolumes();
Jeff Sharkeye2d45be2015-04-15 17:14:12 -07005759
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005760 /**
Amith Yamasani13593602012-03-22 16:16:17 -07005761 * Returns the device identity that verifiers can use to associate their scheme to a particular
5762 * device. This should not be used by anything other than a package verifier.
Aravind Akella068b0c02013-10-12 17:39:15 -07005763 *
Kenny Root0aaa0d92011-09-12 16:42:55 -07005764 * @return identity that uniquely identifies current device
5765 * @hide
5766 */
5767 public abstract VerifierDeviceIdentity getVerifierDeviceIdentity();
Amith Yamasani742a6712011-05-04 14:49:28 -07005768
Jeff Sharkey6c833e02014-07-14 22:44:30 -07005769 /**
Jeff Hao9f60c082014-10-28 18:51:07 -07005770 * Returns true if the device is upgrading, such as first boot after OTA.
5771 *
5772 * @hide
5773 */
Mathew Inwood1c77a112018-08-14 14:06:26 +01005774 @UnsupportedAppUsage
Jeff Hao9f60c082014-10-28 18:51:07 -07005775 public abstract boolean isUpgrade();
5776
5777 /**
Jeff Sharkey6c833e02014-07-14 22:44:30 -07005778 * Return interface that offers the ability to install, upgrade, and remove
5779 * applications on the device.
5780 */
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005781 public abstract @NonNull PackageInstaller getPackageInstaller();
Jeff Sharkey3a44f3f2014-04-28 17:36:31 -07005782
Amith Yamasani742a6712011-05-04 14:49:28 -07005783 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005784 * Adds a {@code CrossProfileIntentFilter}. After calling this method all
5785 * intents sent from the user with id sourceUserId can also be be resolved
5786 * by activities in the user with id targetUserId if they match the
5787 * specified intent filter.
5788 *
Nicolas Prevot3f7777f2014-07-24 15:58:39 +01005789 * @param filter The {@link IntentFilter} the intent has to match
5790 * @param sourceUserId The source user id.
5791 * @param targetUserId The target user id.
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005792 * @param flags The possible values are {@link #SKIP_CURRENT_PROFILE} and
5793 * {@link #ONLY_IF_NO_MATCH_FOUND}.
Nicolas Prevotc79586e2014-05-06 12:47:57 +01005794 * @hide
5795 */
Mathew Inwood1c77a112018-08-14 14:06:26 +01005796 @UnsupportedAppUsage
Nicolas Prevot63798c52014-05-27 13:22:38 +01005797 public abstract void addCrossProfileIntentFilter(IntentFilter filter, int sourceUserId,
5798 int targetUserId, int flags);
Nicolas Prevotc79586e2014-05-06 12:47:57 +01005799
5800 /**
Jeff Sharkey5aa86932016-01-08 19:07:49 -07005801 * Clearing {@code CrossProfileIntentFilter}s which have the specified user
5802 * as their source, and have been set by the app calling this method.
5803 *
Nicolas Prevot3f7777f2014-07-24 15:58:39 +01005804 * @param sourceUserId The source user id.
Nicolas Prevotc79586e2014-05-06 12:47:57 +01005805 * @hide
5806 */
Mathew Inwood1c77a112018-08-14 14:06:26 +01005807 @UnsupportedAppUsage
Nicolas Prevot81948992014-05-16 18:25:26 +01005808 public abstract void clearCrossProfileIntentFilters(int sourceUserId);
Alexandra Gherghina6e2ae252014-06-12 16:03:58 +01005809
5810 /**
Nicolas Prevot88cc3462014-05-14 14:51:48 +01005811 * @hide
5812 */
Mathew Inwood1c77a112018-08-14 14:06:26 +01005813 @UnsupportedAppUsage
Nicolas Prevot7f7b0c72014-06-23 15:59:38 +01005814 public abstract Drawable loadItemIcon(PackageItemInfo itemInfo, ApplicationInfo appInfo);
Jeff Sharkey6c833e02014-07-14 22:44:30 -07005815
Benjamin Franzec2d48b2014-10-01 15:38:43 +01005816 /**
5817 * @hide
5818 */
Mathew Inwood1c77a112018-08-14 14:06:26 +01005819 @UnsupportedAppUsage
Benjamin Franzec2d48b2014-10-01 15:38:43 +01005820 public abstract Drawable loadUnbadgedItemIcon(PackageItemInfo itemInfo, ApplicationInfo appInfo);
5821
Jeff Sharkey6c833e02014-07-14 22:44:30 -07005822 /** {@hide} */
Mathew Inwood1c77a112018-08-14 14:06:26 +01005823 @UnsupportedAppUsage
Jeff Sharkey6c833e02014-07-14 22:44:30 -07005824 public abstract boolean isPackageAvailable(String packageName);
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005825
5826 /** {@hide} */
Mathew Inwood1c77a112018-08-14 14:06:26 +01005827 @UnsupportedAppUsage
Jeff Sharkeya0907432014-08-15 10:23:11 -07005828 public static String installStatusToString(int status, String msg) {
5829 final String str = installStatusToString(status);
5830 if (msg != null) {
5831 return str + ": " + msg;
5832 } else {
5833 return str;
5834 }
5835 }
5836
5837 /** {@hide} */
Mathew Inwood1c77a112018-08-14 14:06:26 +01005838 @UnsupportedAppUsage
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005839 public static String installStatusToString(int status) {
5840 switch (status) {
5841 case INSTALL_SUCCEEDED: return "INSTALL_SUCCEEDED";
5842 case INSTALL_FAILED_ALREADY_EXISTS: return "INSTALL_FAILED_ALREADY_EXISTS";
5843 case INSTALL_FAILED_INVALID_APK: return "INSTALL_FAILED_INVALID_APK";
5844 case INSTALL_FAILED_INVALID_URI: return "INSTALL_FAILED_INVALID_URI";
5845 case INSTALL_FAILED_INSUFFICIENT_STORAGE: return "INSTALL_FAILED_INSUFFICIENT_STORAGE";
5846 case INSTALL_FAILED_DUPLICATE_PACKAGE: return "INSTALL_FAILED_DUPLICATE_PACKAGE";
5847 case INSTALL_FAILED_NO_SHARED_USER: return "INSTALL_FAILED_NO_SHARED_USER";
5848 case INSTALL_FAILED_UPDATE_INCOMPATIBLE: return "INSTALL_FAILED_UPDATE_INCOMPATIBLE";
5849 case INSTALL_FAILED_SHARED_USER_INCOMPATIBLE: return "INSTALL_FAILED_SHARED_USER_INCOMPATIBLE";
5850 case INSTALL_FAILED_MISSING_SHARED_LIBRARY: return "INSTALL_FAILED_MISSING_SHARED_LIBRARY";
5851 case INSTALL_FAILED_REPLACE_COULDNT_DELETE: return "INSTALL_FAILED_REPLACE_COULDNT_DELETE";
5852 case INSTALL_FAILED_DEXOPT: return "INSTALL_FAILED_DEXOPT";
5853 case INSTALL_FAILED_OLDER_SDK: return "INSTALL_FAILED_OLDER_SDK";
5854 case INSTALL_FAILED_CONFLICTING_PROVIDER: return "INSTALL_FAILED_CONFLICTING_PROVIDER";
5855 case INSTALL_FAILED_NEWER_SDK: return "INSTALL_FAILED_NEWER_SDK";
5856 case INSTALL_FAILED_TEST_ONLY: return "INSTALL_FAILED_TEST_ONLY";
5857 case INSTALL_FAILED_CPU_ABI_INCOMPATIBLE: return "INSTALL_FAILED_CPU_ABI_INCOMPATIBLE";
5858 case INSTALL_FAILED_MISSING_FEATURE: return "INSTALL_FAILED_MISSING_FEATURE";
5859 case INSTALL_FAILED_CONTAINER_ERROR: return "INSTALL_FAILED_CONTAINER_ERROR";
5860 case INSTALL_FAILED_INVALID_INSTALL_LOCATION: return "INSTALL_FAILED_INVALID_INSTALL_LOCATION";
5861 case INSTALL_FAILED_MEDIA_UNAVAILABLE: return "INSTALL_FAILED_MEDIA_UNAVAILABLE";
5862 case INSTALL_FAILED_VERIFICATION_TIMEOUT: return "INSTALL_FAILED_VERIFICATION_TIMEOUT";
5863 case INSTALL_FAILED_VERIFICATION_FAILURE: return "INSTALL_FAILED_VERIFICATION_FAILURE";
5864 case INSTALL_FAILED_PACKAGE_CHANGED: return "INSTALL_FAILED_PACKAGE_CHANGED";
5865 case INSTALL_FAILED_UID_CHANGED: return "INSTALL_FAILED_UID_CHANGED";
5866 case INSTALL_FAILED_VERSION_DOWNGRADE: return "INSTALL_FAILED_VERSION_DOWNGRADE";
5867 case INSTALL_PARSE_FAILED_NOT_APK: return "INSTALL_PARSE_FAILED_NOT_APK";
5868 case INSTALL_PARSE_FAILED_BAD_MANIFEST: return "INSTALL_PARSE_FAILED_BAD_MANIFEST";
5869 case INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION: return "INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION";
5870 case INSTALL_PARSE_FAILED_NO_CERTIFICATES: return "INSTALL_PARSE_FAILED_NO_CERTIFICATES";
5871 case INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES: return "INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES";
5872 case INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING: return "INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING";
5873 case INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME: return "INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME";
5874 case INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID: return "INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID";
5875 case INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: return "INSTALL_PARSE_FAILED_MANIFEST_MALFORMED";
5876 case INSTALL_PARSE_FAILED_MANIFEST_EMPTY: return "INSTALL_PARSE_FAILED_MANIFEST_EMPTY";
5877 case INSTALL_FAILED_INTERNAL_ERROR: return "INSTALL_FAILED_INTERNAL_ERROR";
5878 case INSTALL_FAILED_USER_RESTRICTED: return "INSTALL_FAILED_USER_RESTRICTED";
5879 case INSTALL_FAILED_DUPLICATE_PERMISSION: return "INSTALL_FAILED_DUPLICATE_PERMISSION";
5880 case INSTALL_FAILED_NO_MATCHING_ABIS: return "INSTALL_FAILED_NO_MATCHING_ABIS";
Jeff Sharkeyf0600952014-08-07 17:31:53 -07005881 case INSTALL_FAILED_ABORTED: return "INSTALL_FAILED_ABORTED";
Calin Juravle3fc56c32017-12-11 18:26:13 -08005882 case INSTALL_FAILED_BAD_DEX_METADATA:
5883 return "INSTALL_FAILED_BAD_DEX_METADATA";
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005884 default: return Integer.toString(status);
5885 }
5886 }
5887
5888 /** {@hide} */
Jeff Sharkeya0907432014-08-15 10:23:11 -07005889 public static int installStatusToPublicStatus(int status) {
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005890 switch (status) {
Jeff Sharkeya0907432014-08-15 10:23:11 -07005891 case INSTALL_SUCCEEDED: return PackageInstaller.STATUS_SUCCESS;
5892 case INSTALL_FAILED_ALREADY_EXISTS: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5893 case INSTALL_FAILED_INVALID_APK: return PackageInstaller.STATUS_FAILURE_INVALID;
5894 case INSTALL_FAILED_INVALID_URI: return PackageInstaller.STATUS_FAILURE_INVALID;
5895 case INSTALL_FAILED_INSUFFICIENT_STORAGE: return PackageInstaller.STATUS_FAILURE_STORAGE;
5896 case INSTALL_FAILED_DUPLICATE_PACKAGE: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5897 case INSTALL_FAILED_NO_SHARED_USER: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5898 case INSTALL_FAILED_UPDATE_INCOMPATIBLE: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5899 case INSTALL_FAILED_SHARED_USER_INCOMPATIBLE: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5900 case INSTALL_FAILED_MISSING_SHARED_LIBRARY: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5901 case INSTALL_FAILED_REPLACE_COULDNT_DELETE: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5902 case INSTALL_FAILED_DEXOPT: return PackageInstaller.STATUS_FAILURE_INVALID;
5903 case INSTALL_FAILED_OLDER_SDK: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5904 case INSTALL_FAILED_CONFLICTING_PROVIDER: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5905 case INSTALL_FAILED_NEWER_SDK: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5906 case INSTALL_FAILED_TEST_ONLY: return PackageInstaller.STATUS_FAILURE_INVALID;
5907 case INSTALL_FAILED_CPU_ABI_INCOMPATIBLE: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5908 case INSTALL_FAILED_MISSING_FEATURE: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5909 case INSTALL_FAILED_CONTAINER_ERROR: return PackageInstaller.STATUS_FAILURE_STORAGE;
5910 case INSTALL_FAILED_INVALID_INSTALL_LOCATION: return PackageInstaller.STATUS_FAILURE_STORAGE;
5911 case INSTALL_FAILED_MEDIA_UNAVAILABLE: return PackageInstaller.STATUS_FAILURE_STORAGE;
5912 case INSTALL_FAILED_VERIFICATION_TIMEOUT: return PackageInstaller.STATUS_FAILURE_ABORTED;
5913 case INSTALL_FAILED_VERIFICATION_FAILURE: return PackageInstaller.STATUS_FAILURE_ABORTED;
5914 case INSTALL_FAILED_PACKAGE_CHANGED: return PackageInstaller.STATUS_FAILURE_INVALID;
5915 case INSTALL_FAILED_UID_CHANGED: return PackageInstaller.STATUS_FAILURE_INVALID;
5916 case INSTALL_FAILED_VERSION_DOWNGRADE: return PackageInstaller.STATUS_FAILURE_INVALID;
Svetoslavd9653702015-05-13 18:02:46 -07005917 case INSTALL_FAILED_PERMISSION_MODEL_DOWNGRADE: return PackageInstaller.STATUS_FAILURE_INVALID;
Jeff Sharkeya0907432014-08-15 10:23:11 -07005918 case INSTALL_PARSE_FAILED_NOT_APK: return PackageInstaller.STATUS_FAILURE_INVALID;
5919 case INSTALL_PARSE_FAILED_BAD_MANIFEST: return PackageInstaller.STATUS_FAILURE_INVALID;
5920 case INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION: return PackageInstaller.STATUS_FAILURE_INVALID;
5921 case INSTALL_PARSE_FAILED_NO_CERTIFICATES: return PackageInstaller.STATUS_FAILURE_INVALID;
5922 case INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES: return PackageInstaller.STATUS_FAILURE_INVALID;
5923 case INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING: return PackageInstaller.STATUS_FAILURE_INVALID;
5924 case INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME: return PackageInstaller.STATUS_FAILURE_INVALID;
5925 case INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID: return PackageInstaller.STATUS_FAILURE_INVALID;
5926 case INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: return PackageInstaller.STATUS_FAILURE_INVALID;
5927 case INSTALL_PARSE_FAILED_MANIFEST_EMPTY: return PackageInstaller.STATUS_FAILURE_INVALID;
Calin Juravle3fc56c32017-12-11 18:26:13 -08005928 case INSTALL_FAILED_BAD_DEX_METADATA: return PackageInstaller.STATUS_FAILURE_INVALID;
Jeff Sharkeya0907432014-08-15 10:23:11 -07005929 case INSTALL_FAILED_INTERNAL_ERROR: return PackageInstaller.STATUS_FAILURE;
5930 case INSTALL_FAILED_USER_RESTRICTED: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5931 case INSTALL_FAILED_DUPLICATE_PERMISSION: return PackageInstaller.STATUS_FAILURE_CONFLICT;
5932 case INSTALL_FAILED_NO_MATCHING_ABIS: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
5933 case INSTALL_FAILED_ABORTED: return PackageInstaller.STATUS_FAILURE_ABORTED;
5934 default: return PackageInstaller.STATUS_FAILURE;
5935 }
5936 }
5937
5938 /** {@hide} */
5939 public static String deleteStatusToString(int status, String msg) {
5940 final String str = deleteStatusToString(status);
5941 if (msg != null) {
5942 return str + ": " + msg;
5943 } else {
5944 return str;
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005945 }
5946 }
5947
5948 /** {@hide} */
Mathew Inwood1c77a112018-08-14 14:06:26 +01005949 @UnsupportedAppUsage
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005950 public static String deleteStatusToString(int status) {
5951 switch (status) {
5952 case DELETE_SUCCEEDED: return "DELETE_SUCCEEDED";
5953 case DELETE_FAILED_INTERNAL_ERROR: return "DELETE_FAILED_INTERNAL_ERROR";
5954 case DELETE_FAILED_DEVICE_POLICY_MANAGER: return "DELETE_FAILED_DEVICE_POLICY_MANAGER";
5955 case DELETE_FAILED_USER_RESTRICTED: return "DELETE_FAILED_USER_RESTRICTED";
5956 case DELETE_FAILED_OWNER_BLOCKED: return "DELETE_FAILED_OWNER_BLOCKED";
Jeff Sharkeyf0600952014-08-07 17:31:53 -07005957 case DELETE_FAILED_ABORTED: return "DELETE_FAILED_ABORTED";
Svet Ganov67882122016-12-11 16:36:34 -08005958 case DELETE_FAILED_USED_SHARED_LIBRARY: return "DELETE_FAILED_USED_SHARED_LIBRARY";
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07005959 default: return Integer.toString(status);
5960 }
5961 }
Jeff Sharkeyf0600952014-08-07 17:31:53 -07005962
5963 /** {@hide} */
Jeff Sharkeya0907432014-08-15 10:23:11 -07005964 public static int deleteStatusToPublicStatus(int status) {
Jeff Sharkeyf0600952014-08-07 17:31:53 -07005965 switch (status) {
Jeff Sharkeya0907432014-08-15 10:23:11 -07005966 case DELETE_SUCCEEDED: return PackageInstaller.STATUS_SUCCESS;
5967 case DELETE_FAILED_INTERNAL_ERROR: return PackageInstaller.STATUS_FAILURE;
5968 case DELETE_FAILED_DEVICE_POLICY_MANAGER: return PackageInstaller.STATUS_FAILURE_BLOCKED;
5969 case DELETE_FAILED_USER_RESTRICTED: return PackageInstaller.STATUS_FAILURE_BLOCKED;
5970 case DELETE_FAILED_OWNER_BLOCKED: return PackageInstaller.STATUS_FAILURE_BLOCKED;
5971 case DELETE_FAILED_ABORTED: return PackageInstaller.STATUS_FAILURE_ABORTED;
Svet Ganov67882122016-12-11 16:36:34 -08005972 case DELETE_FAILED_USED_SHARED_LIBRARY: return PackageInstaller.STATUS_FAILURE_CONFLICT;
Jeff Sharkeya0907432014-08-15 10:23:11 -07005973 default: return PackageInstaller.STATUS_FAILURE;
Jeff Sharkeyf0600952014-08-07 17:31:53 -07005974 }
5975 }
Jeff Sharkey6c0b9da2014-08-07 22:07:11 -07005976
5977 /** {@hide} */
Svet Ganov77ab6a82015-07-03 12:03:02 -07005978 public static String permissionFlagToString(int flag) {
5979 switch (flag) {
Svetoslav4a5f4a22015-07-07 18:18:15 -07005980 case FLAG_PERMISSION_GRANTED_BY_DEFAULT: return "GRANTED_BY_DEFAULT";
5981 case FLAG_PERMISSION_POLICY_FIXED: return "POLICY_FIXED";
5982 case FLAG_PERMISSION_SYSTEM_FIXED: return "SYSTEM_FIXED";
5983 case FLAG_PERMISSION_USER_SET: return "USER_SET";
5984 case FLAG_PERMISSION_REVOKE_ON_UPGRADE: return "REVOKE_ON_UPGRADE";
5985 case FLAG_PERMISSION_USER_FIXED: return "USER_FIXED";
Svet Ganov9c165d72015-12-01 19:52:26 -08005986 case FLAG_PERMISSION_REVIEW_REQUIRED: return "REVIEW_REQUIRED";
Svet Ganov77ab6a82015-07-03 12:03:02 -07005987 default: return Integer.toString(flag);
5988 }
5989 }
5990
5991 /** {@hide} */
Jeff Sharkey6c0b9da2014-08-07 22:07:11 -07005992 public static class LegacyPackageDeleteObserver extends PackageDeleteObserver {
5993 private final IPackageDeleteObserver mLegacy;
5994
5995 public LegacyPackageDeleteObserver(IPackageDeleteObserver legacy) {
5996 mLegacy = legacy;
5997 }
5998
5999 @Override
6000 public void onPackageDeleted(String basePackageName, int returnCode, String msg) {
6001 if (mLegacy == null) return;
6002 try {
6003 mLegacy.packageDeleted(basePackageName, returnCode);
6004 } catch (RemoteException ignored) {
6005 }
6006 }
6007 }
Bartosz Fabianowskia34f53f2017-01-11 18:08:47 +01006008
6009 /**
Jeff Sharkey4347f812017-04-21 12:08:39 -06006010 * Return the install reason that was recorded when a package was first
6011 * installed for a specific user. Requesting the install reason for another
6012 * user will require the permission INTERACT_ACROSS_USERS_FULL.
Bartosz Fabianowskia34f53f2017-01-11 18:08:47 +01006013 *
6014 * @param packageName The package for which to retrieve the install reason
6015 * @param user The user for whom to retrieve the install reason
Jeff Sharkey4347f812017-04-21 12:08:39 -06006016 * @return The install reason. If the package is not installed for the given
6017 * user, {@code INSTALL_REASON_UNKNOWN} is returned.
Bartosz Fabianowskia34f53f2017-01-11 18:08:47 +01006018 * @hide
6019 */
6020 @TestApi
6021 public abstract @InstallReason int getInstallReason(String packageName,
6022 @NonNull UserHandle user);
Suprabh Shuklaaef25132017-01-23 18:09:03 -08006023
6024 /**
6025 * Checks whether the calling package is allowed to request package installs through package
Suprabh Shukla57528472017-04-14 19:22:45 -07006026 * installer. Apps are encouraged to call this API before launching the package installer via
Suprabh Shuklaaef25132017-01-23 18:09:03 -08006027 * intent {@link android.content.Intent#ACTION_INSTALL_PACKAGE}. Starting from Android O, the
6028 * user can explicitly choose what external sources they trust to install apps on the device.
Suprabh Shukla57528472017-04-14 19:22:45 -07006029 * If this API returns false, the install request will be blocked by the package installer and
Suprabh Shuklaaef25132017-01-23 18:09:03 -08006030 * a dialog will be shown to the user with an option to launch settings to change their
6031 * preference. An application must target Android O or higher and declare permission
Suprabh Shukla57528472017-04-14 19:22:45 -07006032 * {@link android.Manifest.permission#REQUEST_INSTALL_PACKAGES} in order to use this API.
Suprabh Shuklaaef25132017-01-23 18:09:03 -08006033 *
6034 * @return true if the calling package is trusted by the user to request install packages on
6035 * the device, false otherwise.
Suprabh Shukla57528472017-04-14 19:22:45 -07006036 * @see android.content.Intent#ACTION_INSTALL_PACKAGE
6037 * @see android.provider.Settings#ACTION_MANAGE_UNKNOWN_APP_SOURCES
Suprabh Shuklaaef25132017-01-23 18:09:03 -08006038 */
6039 public abstract boolean canRequestPackageInstalls();
Chad Brubakeraa49cb82017-03-24 15:53:09 -07006040
6041 /**
6042 * Return the {@link ComponentName} of the activity providing Settings for the Instant App
6043 * resolver.
6044 *
Todd Kennedy801e6592017-04-12 14:10:12 -07006045 * @see {@link android.content.Intent#ACTION_INSTANT_APP_RESOLVER_SETTINGS}
Chad Brubakeraa49cb82017-03-24 15:53:09 -07006046 * @hide
6047 */
6048 @SystemApi
6049 public abstract ComponentName getInstantAppResolverSettingsComponent();
Todd Kennedy801e6592017-04-12 14:10:12 -07006050
6051 /**
6052 * Return the {@link ComponentName} of the activity responsible for installing instant
6053 * applications.
6054 *
6055 * @see {@link android.content.Intent#ACTION_INSTALL_INSTANT_APP_PACKAGE}
6056 * @hide
6057 */
6058 @SystemApi
6059 public abstract ComponentName getInstantAppInstallerComponent();
Chad Brubaker0d277a72017-04-12 16:56:53 -07006060
6061 /**
6062 * Return the Android Id for a given Instant App.
6063 *
6064 * @see {@link android.provider.Settings.Secure#ANDROID_ID}
6065 * @hide
6066 */
6067 public abstract String getInstantAppAndroidId(String packageName, @NonNull UserHandle user);
Calin Juravle3d2af7f2017-04-19 19:56:21 -07006068
6069 /**
6070 * Callback use to notify the callers of module registration that the operation
6071 * has finished.
6072 *
6073 * @hide
6074 */
Jeff Sharkey90396362017-06-12 16:26:53 -06006075 @SystemApi
Calin Juravle3d2af7f2017-04-19 19:56:21 -07006076 public static abstract class DexModuleRegisterCallback {
6077 public abstract void onDexModuleRegistered(String dexModulePath, boolean success,
6078 String message);
6079 }
6080
6081 /**
6082 * Register an application dex module with the package manager.
6083 * The package manager will keep track of the given module for future optimizations.
6084 *
6085 * Dex module optimizations will disable the classpath checking at runtime. The client bares
6086 * the responsibility to ensure that the static assumptions on classes in the optimized code
6087 * hold at runtime (e.g. there's no duplicate classes in the classpath).
6088 *
6089 * Note that the package manager already keeps track of dex modules loaded with
6090 * {@link dalvik.system.DexClassLoader} and {@link dalvik.system.PathClassLoader}.
6091 * This can be called for an eager registration.
6092 *
6093 * The call might take a while and the results will be posted on the main thread, using
6094 * the given callback.
6095 *
6096 * If the module is intended to be shared with other apps, make sure that the file
6097 * permissions allow for it.
6098 * If at registration time the permissions allow for others to read it, the module would
6099 * be marked as a shared module which might undergo a different optimization strategy.
6100 * (usually shared modules will generated larger optimizations artifacts,
6101 * taking more disk space).
6102 *
6103 * @param dexModulePath the absolute path of the dex module.
6104 * @param callback if not null, {@link DexModuleRegisterCallback#onDexModuleRegistered} will
6105 * be called once the registration finishes.
6106 *
6107 * @hide
6108 */
Jeff Sharkey90396362017-06-12 16:26:53 -06006109 @SystemApi
Calin Juravle3d2af7f2017-04-19 19:56:21 -07006110 public abstract void registerDexModule(String dexModulePath,
6111 @Nullable DexModuleRegisterCallback callback);
Calin Juravle45f8b292017-11-07 18:49:43 -08006112
6113 /**
6114 * Returns the {@link ArtManager} associated with this package manager.
6115 *
6116 * @hide
6117 */
6118 @SystemApi
6119 public @NonNull ArtManager getArtManager() {
6120 throw new UnsupportedOperationException("getArtManager not implemented in subclass");
6121 }
Ben Gruver1ab3d6e2017-12-07 13:45:08 -08006122
6123 /**
6124 * Sets or clears the harmful app warning details for the given app.
6125 *
6126 * When set, any attempt to launch an activity in this package will be intercepted and a
6127 * warning dialog will be shown to the user instead, with the given warning. The user
6128 * will have the option to proceed with the activity launch, or to uninstall the application.
6129 *
6130 * @param packageName The full name of the package to warn on.
6131 * @param warning A warning string to display to the user describing the threat posed by the
6132 * application, or null to clear the warning.
6133 *
6134 * @hide
6135 */
6136 @RequiresPermission(Manifest.permission.SET_HARMFUL_APP_WARNINGS)
6137 @SystemApi
6138 public void setHarmfulAppWarning(@NonNull String packageName, @Nullable CharSequence warning) {
6139 throw new UnsupportedOperationException("setHarmfulAppWarning not implemented in subclass");
6140 }
6141
6142 /**
6143 * Returns the harmful app warning string for the given app, or null if there is none set.
6144 *
6145 * @param packageName The full name of the desired package.
6146 *
6147 * @hide
6148 */
6149 @RequiresPermission(Manifest.permission.SET_HARMFUL_APP_WARNINGS)
6150 @Nullable
6151 @SystemApi
6152 public CharSequence getHarmfulAppWarning(@NonNull String packageName) {
6153 throw new UnsupportedOperationException("getHarmfulAppWarning not implemented in subclass");
6154 }
Daniel Cashman5cdda342018-01-19 07:22:52 -08006155
6156 /** @hide */
6157 @IntDef(prefix = { "CERT_INPUT_" }, value = {
6158 CERT_INPUT_RAW_X509,
6159 CERT_INPUT_SHA256
6160 })
6161 @Retention(RetentionPolicy.SOURCE)
6162 public @interface CertificateInputType {}
6163
6164 /**
6165 * Certificate input bytes: the input bytes represent an encoded X.509 Certificate which could
6166 * be generated using an {@code CertificateFactory}
6167 */
6168 public static final int CERT_INPUT_RAW_X509 = 0;
6169
6170 /**
6171 * Certificate input bytes: the input bytes represent the SHA256 output of an encoded X.509
6172 * Certificate.
6173 */
6174 public static final int CERT_INPUT_SHA256 = 1;
6175
6176 /**
6177 * Searches the set of signing certificates by which the given package has proven to have been
6178 * signed. This should be used instead of {@code getPackageInfo} with {@code GET_SIGNATURES}
6179 * since it takes into account the possibility of signing certificate rotation, except in the
6180 * case of packages that are signed by multiple certificates, for which signing certificate
Daniel Cashmanbd8ce382018-04-02 16:59:19 -07006181 * rotation is not supported. This method is analogous to using {@code getPackageInfo} with
6182 * {@code GET_SIGNING_CERTIFICATES} and then searching through the resulting {@code
Dan Cashmane942b912018-04-16 14:41:24 -07006183 * signingInfo} field to see if the desired certificate is present.
Daniel Cashman5cdda342018-01-19 07:22:52 -08006184 *
6185 * @param packageName package whose signing certificates to check
6186 * @param certificate signing certificate for which to search
6187 * @param type representation of the {@code certificate}
6188 * @return true if this package was or is signed by exactly the certificate {@code certificate}
6189 */
6190 public boolean hasSigningCertificate(
6191 String packageName, byte[] certificate, @CertificateInputType int type) {
6192 throw new UnsupportedOperationException(
6193 "hasSigningCertificate not implemented in subclass");
6194 }
6195
6196 /**
Daniel Cashmanbd8ce382018-04-02 16:59:19 -07006197 * Searches the set of signing certificates by which the package(s) for the given uid has proven
6198 * to have been signed. For multiple packages sharing the same uid, this will return the
6199 * signing certificates found in the signing history of the "newest" package, where "newest"
6200 * indicates the package with the newest signing certificate in the shared uid group. This
6201 * method should be used instead of {@code getPackageInfo} with {@code GET_SIGNATURES}
Daniel Cashman5cdda342018-01-19 07:22:52 -08006202 * since it takes into account the possibility of signing certificate rotation, except in the
6203 * case of packages that are signed by multiple certificates, for which signing certificate
Daniel Cashmanbd8ce382018-04-02 16:59:19 -07006204 * rotation is not supported. This method is analogous to using {@code getPackagesForUid}
6205 * followed by {@code getPackageInfo} with {@code GET_SIGNING_CERTIFICATES}, selecting the
6206 * {@code PackageInfo} of the newest-signed bpackage , and finally searching through the
Dan Cashmane942b912018-04-16 14:41:24 -07006207 * resulting {@code signingInfo} field to see if the desired certificate is there.
Daniel Cashman5cdda342018-01-19 07:22:52 -08006208 *
Daniel Cashmanbd8ce382018-04-02 16:59:19 -07006209 * @param uid uid whose signing certificates to check
Daniel Cashman5cdda342018-01-19 07:22:52 -08006210 * @param certificate signing certificate for which to search
6211 * @param type representation of the {@code certificate}
6212 * @return true if this package was or is signed by exactly the certificate {@code certificate}
6213 */
6214 public boolean hasSigningCertificate(
6215 int uid, byte[] certificate, @CertificateInputType int type) {
6216 throw new UnsupportedOperationException(
6217 "hasSigningCertificate not implemented in subclass");
6218 }
Makoto Onuki700feef2018-02-15 10:59:41 -08006219
6220 /**
6221 * @return the system defined text classifier package name, or null if there's none.
6222 *
6223 * @hide
6224 */
6225 public String getSystemTextClassifierPackageName() {
6226 throw new UnsupportedOperationException(
6227 "getSystemTextClassifierPackageName not implemented in subclass");
6228 }
Benjamin Franz7cc9a812018-03-22 10:11:29 +00006229
6230 /**
6231 * @return whether a given package's state is protected, e.g. package cannot be disabled,
6232 * suspended, hidden or force stopped.
6233 *
6234 * @hide
6235 */
6236 public boolean isPackageStateProtected(String packageName, int userId) {
6237 throw new UnsupportedOperationException(
6238 "isPackageStateProtected not implemented in subclass");
6239 }
6240
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08006241}