blob: 9ac433f0e8d76705c7b40e6ca7c6b948ae367ba7 [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
Tor Norbyed9273d62013-05-30 15:59:53 -070019import android.annotation.IntDef;
Jeff Brownd5a5b5a2014-06-05 17:14:39 -070020import android.annotation.SystemApi;
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -080021import android.annotation.SdkConstant;
22import android.annotation.SdkConstant.SdkConstantType;
Christopher Tatef1977b42014-03-24 16:25:51 -070023import android.app.PackageInstallObserver;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080024import android.content.ComponentName;
25import android.content.Context;
26import android.content.Intent;
27import android.content.IntentFilter;
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -070028import android.content.IntentSender;
Jeff Sharkeyc4858a22014-06-16 10:51:20 -070029import android.content.pm.PackageParser.PackageParserException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080030import android.content.res.Resources;
31import android.content.res.XmlResourceParser;
Nicolas Prevot88cc3462014-05-14 14:51:48 +010032import android.graphics.Bitmap;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080033import android.graphics.drawable.Drawable;
34import android.net.Uri;
Amith Yamasani742a6712011-05-04 14:49:28 -070035import android.os.Environment;
Dianne Hackborn0c380492012-08-20 17:23:30 -070036import android.os.UserHandle;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080037import android.util.AndroidException;
38import android.util.DisplayMetrics;
39
40import java.io.File;
Tor Norbyed9273d62013-05-30 15:59:53 -070041import java.lang.annotation.Retention;
42import java.lang.annotation.RetentionPolicy;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080043import java.util.List;
44
45/**
46 * Class for retrieving various kinds of information related to the application
47 * packages that are currently installed on the device.
48 *
49 * You can find this class through {@link Context#getPackageManager}.
50 */
51public abstract class PackageManager {
52
53 /**
54 * This exception is thrown when a given package, application, or component
kmccormick30498b42013-03-27 17:39:17 -070055 * name cannot be found.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080056 */
57 public static class NameNotFoundException extends AndroidException {
58 public NameNotFoundException() {
59 }
60
61 public NameNotFoundException(String name) {
62 super(name);
63 }
64 }
65
66 /**
67 * {@link PackageInfo} flag: return information about
68 * activities in the package in {@link PackageInfo#activities}.
69 */
70 public static final int GET_ACTIVITIES = 0x00000001;
71
72 /**
73 * {@link PackageInfo} flag: return information about
74 * intent receivers in the package in
75 * {@link PackageInfo#receivers}.
76 */
77 public static final int GET_RECEIVERS = 0x00000002;
78
79 /**
80 * {@link PackageInfo} flag: return information about
81 * services in the package in {@link PackageInfo#services}.
82 */
83 public static final int GET_SERVICES = 0x00000004;
84
85 /**
86 * {@link PackageInfo} flag: return information about
87 * content providers in the package in
88 * {@link PackageInfo#providers}.
89 */
90 public static final int GET_PROVIDERS = 0x00000008;
91
92 /**
93 * {@link PackageInfo} flag: return information about
94 * instrumentation in the package in
95 * {@link PackageInfo#instrumentation}.
96 */
97 public static final int GET_INSTRUMENTATION = 0x00000010;
98
99 /**
100 * {@link PackageInfo} flag: return information about the
101 * intent filters supported by the activity.
102 */
103 public static final int GET_INTENT_FILTERS = 0x00000020;
104
105 /**
106 * {@link PackageInfo} flag: return information about the
107 * signatures included in the package.
108 */
109 public static final int GET_SIGNATURES = 0x00000040;
110
111 /**
112 * {@link ResolveInfo} flag: return the IntentFilter that
113 * was matched for a particular ResolveInfo in
114 * {@link ResolveInfo#filter}.
115 */
116 public static final int GET_RESOLVED_FILTER = 0x00000040;
117
118 /**
119 * {@link ComponentInfo} flag: return the {@link ComponentInfo#metaData}
120 * data {@link android.os.Bundle}s that are associated with a component.
121 * This applies for any API returning a ComponentInfo subclass.
122 */
123 public static final int GET_META_DATA = 0x00000080;
124
125 /**
126 * {@link PackageInfo} flag: return the
127 * {@link PackageInfo#gids group ids} that are associated with an
128 * application.
Ken Wakasaf76a50c2012-03-09 19:56:35 +0900129 * This applies for any API returning a PackageInfo class, either
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800130 * directly or nested inside of another.
131 */
132 public static final int GET_GIDS = 0x00000100;
133
134 /**
135 * {@link PackageInfo} flag: include disabled components in the returned info.
136 */
137 public static final int GET_DISABLED_COMPONENTS = 0x00000200;
138
139 /**
140 * {@link ApplicationInfo} flag: return the
141 * {@link ApplicationInfo#sharedLibraryFiles paths to the shared libraries}
142 * that are associated with an application.
143 * This applies for any API returning an ApplicationInfo class, either
144 * directly or nested inside of another.
145 */
146 public static final int GET_SHARED_LIBRARY_FILES = 0x00000400;
147
148 /**
149 * {@link ProviderInfo} flag: return the
150 * {@link ProviderInfo#uriPermissionPatterns URI permission patterns}
151 * that are associated with a content provider.
Ken Wakasaf76a50c2012-03-09 19:56:35 +0900152 * This applies for any API returning a ProviderInfo class, either
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800153 * directly or nested inside of another.
154 */
155 public static final int GET_URI_PERMISSION_PATTERNS = 0x00000800;
156 /**
157 * {@link PackageInfo} flag: return information about
158 * permissions in the package in
159 * {@link PackageInfo#permissions}.
160 */
161 public static final int GET_PERMISSIONS = 0x00001000;
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700162
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800163 /**
Kenny Root685f4902011-11-03 10:13:29 -0700164 * Flag parameter to retrieve some information about all applications (even
165 * uninstalled ones) which have data directories. This state could have
166 * resulted if applications have been deleted with flag
167 * {@code DONT_DELETE_DATA} with a possibility of being replaced or
168 * reinstalled in future.
169 * <p>
170 * Note: this flag may cause less information about currently installed
171 * applications to be returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800172 */
173 public static final int GET_UNINSTALLED_PACKAGES = 0x00002000;
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700174
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800175 /**
176 * {@link PackageInfo} flag: return information about
Dianne Hackborn49237342009-08-27 20:08:01 -0700177 * hardware preferences in
178 * {@link PackageInfo#configPreferences PackageInfo.configPreferences} and
179 * requested features in {@link PackageInfo#reqFeatures
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700180 * PackageInfo.reqFeatures}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800181 */
182 public static final int GET_CONFIGURATIONS = 0x00004000;
183
184 /**
Dianne Hackbornfd7aded2013-01-22 17:10:23 -0800185 * {@link PackageInfo} flag: include disabled components which are in
186 * that state only because of {@link #COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED}
187 * in the returned info. Note that if you set this flag, applications
188 * that are in this disabled state will be reported as enabled.
189 */
190 public static final int GET_DISABLED_UNTIL_USED_COMPONENTS = 0x00008000;
191
192 /**
Dianne Hackborn1655be42009-05-08 14:29:01 -0700193 * Resolution and querying flag: if set, only filters that support the
194 * {@link android.content.Intent#CATEGORY_DEFAULT} will be considered for
195 * matching. This is a synonym for including the CATEGORY_DEFAULT in your
196 * supplied Intent.
197 */
198 public static final int MATCH_DEFAULT_ONLY = 0x00010000;
199
Nicolas Prevot63798c52014-05-27 13:22:38 +0100200 /**
Alexandra Gherghinafa4533f2014-06-24 16:02:39 +0100201 * Resolution and querying flag: do not resolve intents cross-profile.
202 * @hide
203 */
204 public static final int NO_CROSS_PROFILE = 0x00020000;
205
206 /**
Nicolas Prevot63798c52014-05-27 13:22:38 +0100207 * Flag for {@link addCrossProfileIntentFilter}: if the cross-profile intent has been set by the
208 * profile owner.
209 * @hide
210 */
211 public static final int SET_BY_PROFILE_OWNER= 0x00000001;
212
213 /**
214 * Flag for {@link addCrossProfileIntentFilter}: if this flag is set:
215 * when resolving an intent that matches the {@link CrossProfileIntentFilter}, the current
216 * profile will be skipped.
217 * Only activities in the target user can respond to the intent.
218 * @hide
219 */
220 public static final int SKIP_CURRENT_PROFILE = 0x00000002;
221
Tor Norbyed9273d62013-05-30 15:59:53 -0700222 /** @hide */
223 @IntDef({PERMISSION_GRANTED, PERMISSION_DENIED})
224 @Retention(RetentionPolicy.SOURCE)
225 public @interface PermissionResult {}
226
Dianne Hackborn1655be42009-05-08 14:29:01 -0700227 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800228 * Permission check result: this is returned by {@link #checkPermission}
229 * if the permission has been granted to the given package.
230 */
231 public static final int PERMISSION_GRANTED = 0;
232
233 /**
234 * Permission check result: this is returned by {@link #checkPermission}
235 * if the permission has not been granted to the given package.
236 */
237 public static final int PERMISSION_DENIED = -1;
238
239 /**
240 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700241 * if all signatures on the two packages match.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800242 */
243 public static final int SIGNATURE_MATCH = 0;
244
245 /**
246 * Signature check result: this is returned by {@link #checkSignatures}
247 * if neither of the two packages is signed.
248 */
249 public static final int SIGNATURE_NEITHER_SIGNED = 1;
250
251 /**
252 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700253 * if the first package is not signed but the second is.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800254 */
255 public static final int SIGNATURE_FIRST_NOT_SIGNED = -1;
256
257 /**
258 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700259 * if the second package is not signed but the first is.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800260 */
261 public static final int SIGNATURE_SECOND_NOT_SIGNED = -2;
262
263 /**
264 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700265 * if not all signatures on both packages match.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800266 */
267 public static final int SIGNATURE_NO_MATCH = -3;
268
269 /**
270 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700271 * if either of the packages are not valid.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800272 */
273 public static final int SIGNATURE_UNKNOWN_PACKAGE = -4;
274
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700275 /**
276 * Flag for {@link #setApplicationEnabledSetting(String, int, int)}
277 * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This
278 * component or application is in its default enabled state (as specified
279 * in its manifest).
280 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800281 public static final int COMPONENT_ENABLED_STATE_DEFAULT = 0;
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700282
283 /**
284 * Flag for {@link #setApplicationEnabledSetting(String, int, int)}
285 * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This
286 * component or application has been explictily enabled, regardless of
287 * what it has specified in its manifest.
288 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800289 public static final int COMPONENT_ENABLED_STATE_ENABLED = 1;
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700290
291 /**
292 * Flag for {@link #setApplicationEnabledSetting(String, int, int)}
293 * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This
294 * component or application has been explicitly disabled, regardless of
295 * what it has specified in its manifest.
296 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800297 public static final int COMPONENT_ENABLED_STATE_DISABLED = 2;
298
299 /**
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700300 * Flag for {@link #setApplicationEnabledSetting(String, int, int)} only: The
301 * user has explicitly disabled the application, regardless of what it has
302 * specified in its manifest. Because this is due to the user's request,
303 * they may re-enable it if desired through the appropriate system UI. This
kmccormick30498b42013-03-27 17:39:17 -0700304 * option currently <strong>cannot</strong> be used with
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700305 * {@link #setComponentEnabledSetting(ComponentName, int, int)}.
306 */
307 public static final int COMPONENT_ENABLED_STATE_DISABLED_USER = 3;
308
309 /**
Dianne Hackbornfd7aded2013-01-22 17:10:23 -0800310 * Flag for {@link #setApplicationEnabledSetting(String, int, int)} only: This
311 * application should be considered, until the point where the user actually
312 * wants to use it. This means that it will not normally show up to the user
313 * (such as in the launcher), but various parts of the user interface can
314 * use {@link #GET_DISABLED_UNTIL_USED_COMPONENTS} to still see it and allow
315 * the user to select it (as for example an IME, device admin, etc). Such code,
316 * once the user has selected the app, should at that point also make it enabled.
317 * This option currently <strong>can not</strong> be used with
318 * {@link #setComponentEnabledSetting(ComponentName, int, int)}.
319 */
320 public static final int COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED = 4;
321
322 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800323 * Flag parameter for {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} to
324 * indicate that this package should be installed as forward locked, i.e. only the app itself
Brad Fitzpatrick2e805b12010-03-22 10:10:51 -0700325 * should have access to its code and non-resource assets.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700326 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800327 */
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700328 public static final int INSTALL_FORWARD_LOCK = 0x00000001;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800329
330 /**
331 * Flag parameter for {@link #installPackage} to indicate that you want to replace an already
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700332 * installed package, if one exists.
333 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800334 */
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700335 public static final int INSTALL_REPLACE_EXISTING = 0x00000002;
336
337 /**
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700338 * Flag parameter for {@link #installPackage} to indicate that you want to
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700339 * allow test packages (those that have set android:testOnly in their
340 * manifest) to be installed.
341 * @hide
342 */
343 public static final int INSTALL_ALLOW_TEST = 0x00000004;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800344
345 /**
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800346 * Flag parameter for {@link #installPackage} to indicate that this
347 * package has to be installed on the sdcard.
348 * @hide
349 */
Suchi Amalapurapu5b993ce2010-02-12 09:43:29 -0800350 public static final int INSTALL_EXTERNAL = 0x00000008;
Oscar Montemayor539d3c42010-01-29 15:27:00 -0800351
352 /**
Kenny Root5ab21572011-07-27 11:11:19 -0700353 * Flag parameter for {@link #installPackage} to indicate that this package
354 * has to be installed on the sdcard.
355 * @hide
356 */
357 public static final int INSTALL_INTERNAL = 0x00000010;
358
359 /**
360 * Flag parameter for {@link #installPackage} to indicate that this install
361 * was initiated via ADB.
362 *
363 * @hide
364 */
365 public static final int INSTALL_FROM_ADB = 0x00000020;
Suchi Amalapurapu14b6abd2010-03-17 08:37:04 -0700366
367 /**
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700368 * Flag parameter for {@link #installPackage} to indicate that this install
369 * should immediately be visible to all users.
370 *
371 * @hide
372 */
373 public static final int INSTALL_ALL_USERS = 0x00000040;
374
375 /**
376 * Flag parameter for {@link #installPackage} to indicate that it is okay
377 * to install an update to an app where the newly installed app has a lower
378 * version code than the currently installed app.
379 *
380 * @hide
381 */
382 public static final int INSTALL_ALLOW_DOWNGRADE = 0x00000080;
383
384 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800385 * Flag parameter for
386 * {@link #setComponentEnabledSetting(android.content.ComponentName, int, int)} to indicate
387 * that you don't want to kill the app containing the component. Be careful when you set this
388 * since changing component states can make the containing application's behavior unpredictable.
389 */
390 public static final int DONT_KILL_APP = 0x00000001;
391
392 /**
393 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
394 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} on success.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700395 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800396 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700397 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800398 public static final int INSTALL_SUCCEEDED = 1;
399
400 /**
401 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
402 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if the package is
403 * already installed.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700404 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800405 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700406 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800407 public static final int INSTALL_FAILED_ALREADY_EXISTS = -1;
408
409 /**
410 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
411 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if the package archive
412 * file is invalid.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700413 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800414 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700415 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800416 public static final int INSTALL_FAILED_INVALID_APK = -2;
417
418 /**
419 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
420 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if the URI passed in
421 * is invalid.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700422 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800423 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700424 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800425 public static final int INSTALL_FAILED_INVALID_URI = -3;
426
427 /**
428 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
429 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if the package manager
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700430 * service found that the device didn't have enough storage space to install the app.
431 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800432 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700433 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800434 public static final int INSTALL_FAILED_INSUFFICIENT_STORAGE = -4;
435
436 /**
437 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
438 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if a
439 * package is already installed with the same name.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700440 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800441 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700442 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800443 public static final int INSTALL_FAILED_DUPLICATE_PACKAGE = -5;
444
445 /**
446 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
447 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
448 * the requested shared user does not exist.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700449 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800450 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700451 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800452 public static final int INSTALL_FAILED_NO_SHARED_USER = -6;
453
454 /**
455 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
456 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
457 * a previously installed package of the same name has a different signature
458 * than the new package (and the old package's data was not removed).
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700459 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800460 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700461 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800462 public static final int INSTALL_FAILED_UPDATE_INCOMPATIBLE = -7;
463
464 /**
465 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
466 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
467 * the new package is requested a shared user which is already installed on the
468 * device and does not have matching signature.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700469 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800470 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700471 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800472 public static final int INSTALL_FAILED_SHARED_USER_INCOMPATIBLE = -8;
473
474 /**
475 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
476 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
477 * the new package uses a shared library that is not available.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700478 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800479 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700480 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800481 public static final int INSTALL_FAILED_MISSING_SHARED_LIBRARY = -9;
482
483 /**
484 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
485 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
486 * the new package uses a shared library that is not available.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700487 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800488 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700489 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800490 public static final int INSTALL_FAILED_REPLACE_COULDNT_DELETE = -10;
491
492 /**
493 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
494 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
495 * the new package failed while optimizing and validating its dex files,
496 * either because there was not enough storage or the validation failed.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700497 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800498 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700499 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800500 public static final int INSTALL_FAILED_DEXOPT = -11;
501
502 /**
503 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
504 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
505 * the new package failed because the current SDK version is older than
506 * that required by the package.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700507 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800508 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700509 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800510 public static final int INSTALL_FAILED_OLDER_SDK = -12;
511
512 /**
The Android Open Source Project10592532009-03-18 17:39:46 -0700513 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
514 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
515 * the new package failed because it contains a content provider with the
516 * same authority as a provider already installed in the system.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700517 * @hide
The Android Open Source Project10592532009-03-18 17:39:46 -0700518 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700519 @SystemApi
The Android Open Source Project10592532009-03-18 17:39:46 -0700520 public static final int INSTALL_FAILED_CONFLICTING_PROVIDER = -13;
521
522 /**
Dianne Hackborn851a5412009-05-08 12:06:44 -0700523 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
524 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
525 * the new package failed because the current SDK version is newer than
526 * that required by the package.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700527 * @hide
Dianne Hackborn851a5412009-05-08 12:06:44 -0700528 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700529 @SystemApi
Dianne Hackborn851a5412009-05-08 12:06:44 -0700530 public static final int INSTALL_FAILED_NEWER_SDK = -14;
531
532 /**
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700533 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
534 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
535 * the new package failed because it has specified that it is a test-only
536 * package and the caller has not supplied the {@link #INSTALL_ALLOW_TEST}
537 * flag.
538 * @hide
539 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700540 @SystemApi
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700541 public static final int INSTALL_FAILED_TEST_ONLY = -15;
542
543 /**
Dianne Hackbornb1811182009-05-21 15:45:42 -0700544 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
545 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
546 * the package being installed contains native code, but none that is
Amaury Medeirosdde24262014-06-03 20:06:41 -0300547 * compatible with the device's CPU_ABI.
Dianne Hackbornb1811182009-05-21 15:45:42 -0700548 * @hide
549 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700550 @SystemApi
Dianne Hackbornb1811182009-05-21 15:45:42 -0700551 public static final int INSTALL_FAILED_CPU_ABI_INCOMPATIBLE = -16;
552
553 /**
Dianne Hackborn49237342009-08-27 20:08:01 -0700554 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
555 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
556 * the new package uses a feature that is not available.
557 * @hide
558 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700559 @SystemApi
Dianne Hackborn49237342009-08-27 20:08:01 -0700560 public static final int INSTALL_FAILED_MISSING_FEATURE = -17;
561
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800562 // ------ Errors related to sdcard
563 /**
564 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
565 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
566 * a secure container mount point couldn't be accessed on external media.
567 * @hide
568 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700569 @SystemApi
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800570 public static final int INSTALL_FAILED_CONTAINER_ERROR = -18;
571
Dianne Hackborn49237342009-08-27 20:08:01 -0700572 /**
Suchi Amalapurapub56ae202010-02-04 22:51:07 -0800573 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
574 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
575 * the new package couldn't be installed in the specified install
576 * location.
577 * @hide
578 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700579 @SystemApi
Suchi Amalapurapub56ae202010-02-04 22:51:07 -0800580 public static final int INSTALL_FAILED_INVALID_INSTALL_LOCATION = -19;
581
582 /**
Suchi Amalapurapu8a9ab242010-03-11 16:49:16 -0800583 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
584 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
585 * the new package couldn't be installed in the specified install
586 * location because the media is not available.
587 * @hide
588 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700589 @SystemApi
Suchi Amalapurapu8a9ab242010-03-11 16:49:16 -0800590 public static final int INSTALL_FAILED_MEDIA_UNAVAILABLE = -20;
591
592 /**
Kenny Root5ab21572011-07-27 11:11:19 -0700593 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
594 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
595 * the new package couldn't be installed because the verification timed out.
596 * @hide
597 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700598 @SystemApi
Kenny Root5ab21572011-07-27 11:11:19 -0700599 public static final int INSTALL_FAILED_VERIFICATION_TIMEOUT = -21;
600
601 /**
602 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
603 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
604 * the new package couldn't be installed because the verification did not succeed.
605 * @hide
606 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700607 @SystemApi
Kenny Root5ab21572011-07-27 11:11:19 -0700608 public static final int INSTALL_FAILED_VERIFICATION_FAILURE = -22;
609
610 /**
611 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
612 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
613 * the package changed from what the calling program expected.
614 * @hide
615 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700616 @SystemApi
Kenny Root5ab21572011-07-27 11:11:19 -0700617 public static final int INSTALL_FAILED_PACKAGE_CHANGED = -23;
618
619 /**
Dianne Hackbornd0c5f512012-06-07 16:53:59 -0700620 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
621 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
622 * the new package is assigned a different UID than it previously held.
623 * @hide
624 */
625 public static final int INSTALL_FAILED_UID_CHANGED = -24;
626
627 /**
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700628 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
629 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
630 * the new package has an older version code than the currently installed package.
631 * @hide
632 */
633 public static final int INSTALL_FAILED_VERSION_DOWNGRADE = -25;
634
635 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800636 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
637 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
638 * if the parser was given a path that is not a file, or does not end with the expected
639 * '.apk' extension.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700640 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800641 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700642 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800643 public static final int INSTALL_PARSE_FAILED_NOT_APK = -100;
644
645 /**
646 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
647 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
648 * if the parser was unable to retrieve the AndroidManifest.xml file.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700649 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800650 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700651 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800652 public static final int INSTALL_PARSE_FAILED_BAD_MANIFEST = -101;
653
654 /**
655 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
656 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
657 * if the parser encountered an unexpected exception.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700658 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800659 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700660 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800661 public static final int INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION = -102;
662
663 /**
664 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
665 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
666 * if the parser did not find any certificates in the .apk.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700667 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800668 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700669 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800670 public static final int INSTALL_PARSE_FAILED_NO_CERTIFICATES = -103;
671
672 /**
673 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
674 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
675 * if the parser found inconsistent certificates on the files in the .apk.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700676 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800677 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700678 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800679 public static final int INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES = -104;
680
681 /**
682 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
683 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
684 * if the parser encountered a CertificateEncodingException in one of the
685 * files in the .apk.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700686 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800687 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700688 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800689 public static final int INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING = -105;
690
691 /**
692 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
693 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
694 * if the parser encountered a bad or missing package name in the manifest.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700695 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800696 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700697 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800698 public static final int INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME = -106;
699
700 /**
701 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
702 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
703 * if the parser encountered a bad shared user id name in the manifest.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700704 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800705 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700706 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800707 public static final int INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID = -107;
708
709 /**
710 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
711 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
712 * if the parser encountered some structural problem in the manifest.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700713 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800714 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700715 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800716 public static final int INSTALL_PARSE_FAILED_MANIFEST_MALFORMED = -108;
717
718 /**
719 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
720 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
721 * if the parser did not find any actionable tags (instrumentation or application)
722 * in the manifest.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700723 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800724 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700725 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800726 public static final int INSTALL_PARSE_FAILED_MANIFEST_EMPTY = -109;
727
728 /**
Suchi Amalapurapu5b993ce2010-02-12 09:43:29 -0800729 * Installation failed return code: this is passed to the {@link IPackageInstallObserver} by
730 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
731 * if the system failed to install the package because of system issues.
732 * @hide
733 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700734 @SystemApi
Suchi Amalapurapu5b993ce2010-02-12 09:43:29 -0800735 public static final int INSTALL_FAILED_INTERNAL_ERROR = -110;
736
737 /**
Amith Yamasanie4cf7342012-12-17 11:12:09 -0800738 * Installation failed return code: this is passed to the {@link IPackageInstallObserver} by
739 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
740 * if the system failed to install the package because the user is restricted from installing
741 * apps.
742 * @hide
743 */
744 public static final int INSTALL_FAILED_USER_RESTRICTED = -111;
745
746 /**
Christopher Tatef1977b42014-03-24 16:25:51 -0700747 * Installation failed return code: this is passed to the {@link IPackageInstallObserver} by
748 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
749 * if the system failed to install the package because it is attempting to define a
750 * permission that is already defined by some existing package.
751 *
752 * <p>The package name of the app which has already defined the permission is passed to
753 * a {@link IPackageInstallObserver2}, if any, as the {@link #EXTRA_EXISTING_PACKAGE}
754 * string extra; and the name of the permission being redefined is passed in the
755 * {@link #EXTRA_EXISTING_PERMISSION} string extra.
756 * @hide
757 */
758 public static final int INSTALL_FAILED_DUPLICATE_PERMISSION = -112;
759
760 /**
Narayan Kamathd11f2232014-04-10 10:37:17 +0100761 * Installation failed return code: this is passed to the {@link IPackageInstallObserver} by
762 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
Ramin Zaghi1378aba2014-02-28 15:03:19 +0000763 * if the system failed to install the package because its packaged native code did not
764 * match any of the ABIs supported by the system.
765 *
766 * @hide
767 */
Narayan Kamathd11f2232014-04-10 10:37:17 +0100768 public static final int INSTALL_FAILED_NO_MATCHING_ABIS = -113;
Ramin Zaghi1378aba2014-02-28 15:03:19 +0000769
770 /**
771 * Internal return code for NativeLibraryHelper methods to indicate that the package
772 * being processed did not contain any native code. This is placed here only so that
773 * it can belong to the same value space as the other install failure codes.
774 *
775 * @hide
776 */
Narayan Kamathd11f2232014-04-10 10:37:17 +0100777 public static final int NO_NATIVE_LIBRARIES = -114;
Ramin Zaghi1378aba2014-02-28 15:03:19 +0000778
779 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800780 * Flag parameter for {@link #deletePackage} to indicate that you don't want to delete the
781 * package's data directory.
782 *
783 * @hide
784 */
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700785 public static final int DELETE_KEEP_DATA = 0x00000001;
786
787 /**
788 * Flag parameter for {@link #deletePackage} to indicate that you want the
789 * package deleted for all users.
790 *
791 * @hide
792 */
793 public static final int DELETE_ALL_USERS = 0x00000002;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800794
795 /**
Dianne Hackbornc895be72013-03-11 17:48:43 -0700796 * Flag parameter for {@link #deletePackage} to indicate that, if you are calling
797 * uninstall on a system that has been updated, then don't do the normal process
798 * of uninstalling the update and rolling back to the older system version (which
799 * needs to happen for all users); instead, just mark the app as uninstalled for
800 * the current user.
801 *
802 * @hide
803 */
804 public static final int DELETE_SYSTEM_APP = 0x00000004;
805
806 /**
Kenny Rootc39bb4a2011-02-28 13:27:19 -0800807 * Return code for when package deletion succeeds. This is passed to the
808 * {@link IPackageDeleteObserver} by {@link #deletePackage()} if the system
809 * succeeded in deleting the package.
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700810 *
Kenny Rootc39bb4a2011-02-28 13:27:19 -0800811 * @hide
812 */
813 public static final int DELETE_SUCCEEDED = 1;
814
815 /**
816 * Deletion failed return code: this is passed to the
817 * {@link IPackageDeleteObserver} by {@link #deletePackage()} if the system
818 * failed to delete the package for an unspecified reason.
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700819 *
Kenny Rootc39bb4a2011-02-28 13:27:19 -0800820 * @hide
821 */
822 public static final int DELETE_FAILED_INTERNAL_ERROR = -1;
823
824 /**
825 * Deletion failed return code: this is passed to the
826 * {@link IPackageDeleteObserver} by {@link #deletePackage()} if the system
827 * failed to delete the package because it is the active DevicePolicy
828 * manager.
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700829 *
Kenny Rootc39bb4a2011-02-28 13:27:19 -0800830 * @hide
831 */
832 public static final int DELETE_FAILED_DEVICE_POLICY_MANAGER = -2;
833
834 /**
Amith Yamasanie4cf7342012-12-17 11:12:09 -0800835 * Deletion failed return code: this is passed to the
836 * {@link IPackageDeleteObserver} by {@link #deletePackage()} if the system
837 * failed to delete the package since the user is restricted.
838 *
839 * @hide
840 */
841 public static final int DELETE_FAILED_USER_RESTRICTED = -3;
842
843 /**
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -0800844 * Return code that is passed to the {@link IPackageMoveObserver} by
Kenny Rootc39bb4a2011-02-28 13:27:19 -0800845 * {@link #movePackage(android.net.Uri, IPackageMoveObserver)} when the
846 * package has been successfully moved by the system.
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700847 *
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -0800848 * @hide
849 */
850 public static final int MOVE_SUCCEEDED = 1;
851 /**
852 * Error code that is passed to the {@link IPackageMoveObserver} by
853 * {@link #movePackage(android.net.Uri, IPackageMoveObserver)}
854 * when the package hasn't been successfully moved by the system
855 * because of insufficient memory on specified media.
856 * @hide
857 */
858 public static final int MOVE_FAILED_INSUFFICIENT_STORAGE = -1;
859
860 /**
861 * Error code that is passed to the {@link IPackageMoveObserver} by
862 * {@link #movePackage(android.net.Uri, IPackageMoveObserver)}
863 * if the specified package doesn't exist.
864 * @hide
865 */
866 public static final int MOVE_FAILED_DOESNT_EXIST = -2;
867
868 /**
869 * Error code that is passed to the {@link IPackageMoveObserver} by
870 * {@link #movePackage(android.net.Uri, IPackageMoveObserver)}
871 * if the specified package cannot be moved since its a system package.
872 * @hide
873 */
874 public static final int MOVE_FAILED_SYSTEM_PACKAGE = -3;
875
876 /**
877 * Error code that is passed to the {@link IPackageMoveObserver} by
878 * {@link #movePackage(android.net.Uri, IPackageMoveObserver)}
879 * if the specified package cannot be moved since its forward locked.
880 * @hide
881 */
882 public static final int MOVE_FAILED_FORWARD_LOCKED = -4;
883
884 /**
885 * Error code that is passed to the {@link IPackageMoveObserver} by
886 * {@link #movePackage(android.net.Uri, IPackageMoveObserver)}
887 * if the specified package cannot be moved to the specified location.
888 * @hide
889 */
890 public static final int MOVE_FAILED_INVALID_LOCATION = -5;
891
892 /**
Suchi Amalapurapu8a9ab242010-03-11 16:49:16 -0800893 * Error code that is passed to the {@link IPackageMoveObserver} by
894 * {@link #movePackage(android.net.Uri, IPackageMoveObserver)}
895 * if the specified package cannot be moved to the specified location.
896 * @hide
897 */
898 public static final int MOVE_FAILED_INTERNAL_ERROR = -6;
899
900 /**
Kenny Rootdeb11262010-08-02 11:36:21 -0700901 * Error code that is passed to the {@link IPackageMoveObserver} by
902 * {@link #movePackage(android.net.Uri, IPackageMoveObserver)} if the
903 * specified package already has an operation pending in the
904 * {@link PackageHandler} queue.
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700905 *
Kenny Rootdeb11262010-08-02 11:36:21 -0700906 * @hide
907 */
908 public static final int MOVE_FAILED_OPERATION_PENDING = -7;
909
910 /**
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -0800911 * Flag parameter for {@link #movePackage} to indicate that
912 * the package should be moved to internal storage if its
913 * been installed on external media.
914 * @hide
915 */
916 public static final int MOVE_INTERNAL = 0x00000001;
917
918 /**
919 * Flag parameter for {@link #movePackage} to indicate that
920 * the package should be moved to external media.
921 * @hide
922 */
923 public static final int MOVE_EXTERNAL_MEDIA = 0x00000002;
924
925 /**
Kenny Root05ca4c92011-09-15 10:36:25 -0700926 * Usable by the required verifier as the {@code verificationCode} argument
927 * for {@link PackageManager#verifyPendingInstall} to indicate that it will
928 * allow the installation to proceed without any of the optional verifiers
929 * needing to vote.
930 *
931 * @hide
932 */
933 public static final int VERIFICATION_ALLOW_WITHOUT_SUFFICIENT = 2;
934
935 /**
Kenny Root3a9b5fb2011-09-20 14:15:38 -0700936 * Used as the {@code verificationCode} argument for
937 * {@link PackageManager#verifyPendingInstall} to indicate that the calling
938 * package verifier allows the installation to proceed.
939 */
940 public static final int VERIFICATION_ALLOW = 1;
941
942 /**
943 * Used as the {@code verificationCode} argument for
944 * {@link PackageManager#verifyPendingInstall} to indicate the calling
945 * package verifier does not vote to allow the installation to proceed.
946 */
947 public static final int VERIFICATION_REJECT = -1;
948
949 /**
rich canningsd9ef3e52012-08-22 14:28:05 -0700950 * Can be used as the {@code millisecondsToDelay} argument for
951 * {@link PackageManager#extendVerificationTimeout}. This is the
952 * maximum time {@code PackageManager} waits for the verification
953 * agent to return (in milliseconds).
954 */
955 public static final long MAXIMUM_VERIFICATION_TIMEOUT = 60*60*1000;
956
957 /**
Amith Yamasani0b285492011-04-14 17:35:23 -0700958 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: The device's
959 * audio pipeline is low-latency, more suitable for audio applications sensitive to delays or
960 * lag in sound input or output.
Dan Morrill898e1e82010-09-26 17:28:30 -0700961 */
962 @SdkConstant(SdkConstantType.FEATURE)
963 public static final String FEATURE_AUDIO_LOW_LATENCY = "android.hardware.audio.low_latency";
964
965 /**
966 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -0800967 * {@link #hasSystemFeature}: The device is capable of communicating with
968 * other devices via Bluetooth.
969 */
970 @SdkConstant(SdkConstantType.FEATURE)
971 public static final String FEATURE_BLUETOOTH = "android.hardware.bluetooth";
972
973 /**
974 * Feature for {@link #getSystemAvailableFeatures} and
Matthew Xiea7227722013-04-18 15:25:59 -0700975 * {@link #hasSystemFeature}: The device is capable of communicating with
976 * other devices via Bluetooth Low Energy radio.
977 */
978 @SdkConstant(SdkConstantType.FEATURE)
979 public static final String FEATURE_BLUETOOTH_LE = "android.hardware.bluetooth_le";
980
981 /**
982 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn08ee42c2009-11-19 17:08:01 -0800983 * {@link #hasSystemFeature}: The device has a camera facing away
984 * from the screen.
985 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -0800986 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -0800987 public static final String FEATURE_CAMERA = "android.hardware.camera";
Dan Morrill50ab63f2010-03-05 16:16:19 -0800988
Dianne Hackborn08ee42c2009-11-19 17:08:01 -0800989 /**
990 * Feature for {@link #getSystemAvailableFeatures} and
991 * {@link #hasSystemFeature}: The device's camera supports auto-focus.
992 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -0800993 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -0800994 public static final String FEATURE_CAMERA_AUTOFOCUS = "android.hardware.camera.autofocus";
Dan Morrill50ab63f2010-03-05 16:16:19 -0800995
Dianne Hackborn08ee42c2009-11-19 17:08:01 -0800996 /**
997 * Feature for {@link #getSystemAvailableFeatures} and
Eino-Ville Talvala752af832012-09-18 14:45:37 -0700998 * {@link #hasSystemFeature}: The device has at least one camera pointing in
Eino-Ville Talvala9131da22014-05-08 11:39:53 -0700999 * some direction, or can support an external camera being connected to it.
Eino-Ville Talvala752af832012-09-18 14:45:37 -07001000 */
1001 @SdkConstant(SdkConstantType.FEATURE)
1002 public static final String FEATURE_CAMERA_ANY = "android.hardware.camera.any";
1003
1004 /**
1005 * Feature for {@link #getSystemAvailableFeatures} and
Eino-Ville Talvala9131da22014-05-08 11:39:53 -07001006 * {@link #hasSystemFeature}: The device can support having an external camera connected to it.
1007 * The external camera may not always be connected or available to applications to use.
1008 */
1009 @SdkConstant(SdkConstantType.FEATURE)
1010 public static final String FEATURE_CAMERA_EXTERNAL = "android.hardware.camera.external";
1011
1012 /**
1013 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001014 * {@link #hasSystemFeature}: The device's camera supports flash.
1015 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001016 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001017 public static final String FEATURE_CAMERA_FLASH = "android.hardware.camera.flash";
Dan Morrill50ab63f2010-03-05 16:16:19 -08001018
1019 /**
1020 * Feature for {@link #getSystemAvailableFeatures} and
Chih-Chung Changde1057c2010-06-14 19:15:00 +08001021 * {@link #hasSystemFeature}: The device has a front facing camera.
1022 */
1023 @SdkConstant(SdkConstantType.FEATURE)
1024 public static final String FEATURE_CAMERA_FRONT = "android.hardware.camera.front";
1025
1026 /**
1027 * Feature for {@link #getSystemAvailableFeatures} and
Alex Ray0c9d61f2013-10-03 12:17:54 -07001028 * {@link #hasSystemFeature}: The device is capable of communicating with
1029 * consumer IR devices.
1030 */
1031 @SdkConstant(SdkConstantType.FEATURE)
1032 public static final String FEATURE_CONSUMER_IR = "android.hardware.consumerir";
1033
1034 /**
1035 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001036 * {@link #hasSystemFeature}: The device supports one or more methods of
1037 * reporting current location.
1038 */
1039 @SdkConstant(SdkConstantType.FEATURE)
1040 public static final String FEATURE_LOCATION = "android.hardware.location";
1041
1042 /**
1043 * Feature for {@link #getSystemAvailableFeatures} and
1044 * {@link #hasSystemFeature}: The device has a Global Positioning System
1045 * receiver and can report precise location.
1046 */
1047 @SdkConstant(SdkConstantType.FEATURE)
1048 public static final String FEATURE_LOCATION_GPS = "android.hardware.location.gps";
1049
1050 /**
1051 * Feature for {@link #getSystemAvailableFeatures} and
1052 * {@link #hasSystemFeature}: The device can report location with coarse
1053 * accuracy using a network-based geolocation system.
1054 */
1055 @SdkConstant(SdkConstantType.FEATURE)
1056 public static final String FEATURE_LOCATION_NETWORK = "android.hardware.location.network";
1057
1058 /**
1059 * Feature for {@link #getSystemAvailableFeatures} and
1060 * {@link #hasSystemFeature}: The device can record audio via a
1061 * microphone.
1062 */
1063 @SdkConstant(SdkConstantType.FEATURE)
1064 public static final String FEATURE_MICROPHONE = "android.hardware.microphone";
1065
1066 /**
1067 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill76437d32010-09-01 11:17:20 -07001068 * {@link #hasSystemFeature}: The device can communicate using Near-Field
1069 * Communications (NFC).
1070 */
1071 @SdkConstant(SdkConstantType.FEATURE)
1072 public static final String FEATURE_NFC = "android.hardware.nfc";
1073
1074 /**
1075 * Feature for {@link #getSystemAvailableFeatures} and
Martijn Coenenf4bf1582013-07-22 12:01:19 -07001076 * {@link #hasSystemFeature}: The device supports host-
1077 * based NFC card emulation.
Martijn Coenendf4d1d62013-08-28 11:18:58 -07001078 *
1079 * TODO remove when depending apps have moved to new constant.
1080 * @hide
1081 * @deprecated
Martijn Coenenf4bf1582013-07-22 12:01:19 -07001082 */
Jose Lima970417c2014-04-10 10:42:19 -07001083 @Deprecated
Martijn Coenenf4bf1582013-07-22 12:01:19 -07001084 @SdkConstant(SdkConstantType.FEATURE)
1085 public static final String FEATURE_NFC_HCE = "android.hardware.nfc.hce";
1086
1087 /**
1088 * Feature for {@link #getSystemAvailableFeatures} and
Martijn Coenendf4d1d62013-08-28 11:18:58 -07001089 * {@link #hasSystemFeature}: The device supports host-
1090 * based NFC card emulation.
1091 */
1092 @SdkConstant(SdkConstantType.FEATURE)
1093 public static final String FEATURE_NFC_HOST_CARD_EMULATION = "android.hardware.nfc.hce";
1094
1095 /**
1096 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill5744bb42010-09-01 19:18:57 -07001097 * {@link #hasSystemFeature}: The device includes an accelerometer.
1098 */
1099 @SdkConstant(SdkConstantType.FEATURE)
1100 public static final String FEATURE_SENSOR_ACCELEROMETER = "android.hardware.sensor.accelerometer";
1101
1102 /**
1103 * Feature for {@link #getSystemAvailableFeatures} and
1104 * {@link #hasSystemFeature}: The device includes a barometer (air
1105 * pressure sensor.)
1106 */
1107 @SdkConstant(SdkConstantType.FEATURE)
1108 public static final String FEATURE_SENSOR_BAROMETER = "android.hardware.sensor.barometer";
1109
1110 /**
1111 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001112 * {@link #hasSystemFeature}: The device includes a magnetometer (compass).
1113 */
1114 @SdkConstant(SdkConstantType.FEATURE)
1115 public static final String FEATURE_SENSOR_COMPASS = "android.hardware.sensor.compass";
1116
1117 /**
1118 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill5744bb42010-09-01 19:18:57 -07001119 * {@link #hasSystemFeature}: The device includes a gyroscope.
Dan Morrill50ab63f2010-03-05 16:16:19 -08001120 */
1121 @SdkConstant(SdkConstantType.FEATURE)
Dan Morrill5744bb42010-09-01 19:18:57 -07001122 public static final String FEATURE_SENSOR_GYROSCOPE = "android.hardware.sensor.gyroscope";
Dan Morrill50ab63f2010-03-05 16:16:19 -08001123
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001124 /**
1125 * Feature for {@link #getSystemAvailableFeatures} and
1126 * {@link #hasSystemFeature}: The device includes a light sensor.
1127 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001128 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001129 public static final String FEATURE_SENSOR_LIGHT = "android.hardware.sensor.light";
Dan Morrill50ab63f2010-03-05 16:16:19 -08001130
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001131 /**
1132 * Feature for {@link #getSystemAvailableFeatures} and
1133 * {@link #hasSystemFeature}: The device includes a proximity sensor.
1134 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001135 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001136 public static final String FEATURE_SENSOR_PROXIMITY = "android.hardware.sensor.proximity";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001137
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001138 /**
1139 * Feature for {@link #getSystemAvailableFeatures} and
Aravind Akella068b0c02013-10-12 17:39:15 -07001140 * {@link #hasSystemFeature}: The device includes a hardware step counter.
1141 */
1142 @SdkConstant(SdkConstantType.FEATURE)
1143 public static final String FEATURE_SENSOR_STEP_COUNTER = "android.hardware.sensor.stepcounter";
1144
1145 /**
1146 * Feature for {@link #getSystemAvailableFeatures} and
1147 * {@link #hasSystemFeature}: The device includes a hardware step detector.
1148 */
1149 @SdkConstant(SdkConstantType.FEATURE)
1150 public static final String FEATURE_SENSOR_STEP_DETECTOR = "android.hardware.sensor.stepdetector";
1151
1152 /**
1153 * Feature for {@link #getSystemAvailableFeatures} and
Vinod Krishnan8afb23c2014-04-30 11:11:39 -07001154 * {@link #hasSystemFeature}: The device includes a heart rate monitor.
1155 */
1156 @SdkConstant(SdkConstantType.FEATURE)
1157 public static final String FEATURE_SENSOR_HEART_RATE = "android.hardware.sensor.heartrate";
1158
1159 /**
1160 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001161 * {@link #hasSystemFeature}: The device has a telephony radio with data
1162 * communication support.
1163 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001164 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001165 public static final String FEATURE_TELEPHONY = "android.hardware.telephony";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001166
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001167 /**
1168 * Feature for {@link #getSystemAvailableFeatures} and
1169 * {@link #hasSystemFeature}: The device has a CDMA telephony stack.
1170 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001171 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001172 public static final String FEATURE_TELEPHONY_CDMA = "android.hardware.telephony.cdma";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001173
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001174 /**
1175 * Feature for {@link #getSystemAvailableFeatures} and
1176 * {@link #hasSystemFeature}: The device has a GSM telephony stack.
1177 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001178 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001179 public static final String FEATURE_TELEPHONY_GSM = "android.hardware.telephony.gsm";
Hung-ying Tyan3424c022010-08-27 18:08:19 +08001180
1181 /**
1182 * Feature for {@link #getSystemAvailableFeatures} and
Mike Lockwoodf4ca2472011-02-27 11:23:25 -08001183 * {@link #hasSystemFeature}: The device supports connecting to USB devices
1184 * as the USB host.
1185 */
1186 @SdkConstant(SdkConstantType.FEATURE)
1187 public static final String FEATURE_USB_HOST = "android.hardware.usb.host";
1188
1189 /**
1190 * Feature for {@link #getSystemAvailableFeatures} and
1191 * {@link #hasSystemFeature}: The device supports connecting to USB accessories.
1192 */
1193 @SdkConstant(SdkConstantType.FEATURE)
1194 public static final String FEATURE_USB_ACCESSORY = "android.hardware.usb.accessory";
1195
1196 /**
1197 * Feature for {@link #getSystemAvailableFeatures} and
Hung-ying Tyan3424c022010-08-27 18:08:19 +08001198 * {@link #hasSystemFeature}: The SIP API is enabled on the device.
1199 */
1200 @SdkConstant(SdkConstantType.FEATURE)
1201 public static final String FEATURE_SIP = "android.software.sip";
1202
1203 /**
1204 * Feature for {@link #getSystemAvailableFeatures} and
1205 * {@link #hasSystemFeature}: The device supports SIP-based VOIP.
1206 */
1207 @SdkConstant(SdkConstantType.FEATURE)
1208 public static final String FEATURE_SIP_VOIP = "android.software.sip.voip";
1209
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001210 /**
1211 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrillb0fe0332010-04-05 14:43:58 -07001212 * {@link #hasSystemFeature}: The device's display has a touch screen.
1213 */
1214 @SdkConstant(SdkConstantType.FEATURE)
1215 public static final String FEATURE_TOUCHSCREEN = "android.hardware.touchscreen";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001216
1217
Dan Morrillb0fe0332010-04-05 14:43:58 -07001218 /**
1219 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001220 * {@link #hasSystemFeature}: The device's touch screen supports
1221 * multitouch sufficient for basic two-finger gesture detection.
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001222 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001223 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001224 public static final String FEATURE_TOUCHSCREEN_MULTITOUCH = "android.hardware.touchscreen.multitouch";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001225
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001226 /**
1227 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001228 * {@link #hasSystemFeature}: The device's touch screen is capable of
1229 * tracking two or more fingers fully independently.
1230 */
1231 @SdkConstant(SdkConstantType.FEATURE)
1232 public static final String FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT = "android.hardware.touchscreen.multitouch.distinct";
1233
1234 /**
1235 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill6993d3d2010-09-03 14:30:14 -07001236 * {@link #hasSystemFeature}: The device's touch screen is capable of
1237 * tracking a full hand of fingers fully independently -- that is, 5 or
1238 * more simultaneous independent pointers.
1239 */
1240 @SdkConstant(SdkConstantType.FEATURE)
1241 public static final String FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND = "android.hardware.touchscreen.multitouch.jazzhand";
1242
1243 /**
1244 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrilla5376872011-01-23 13:15:53 -08001245 * {@link #hasSystemFeature}: The device does not have a touch screen, but
1246 * does support touch emulation for basic events. For instance, the
1247 * device might use a mouse or remote control to drive a cursor, and
1248 * emulate basic touch pointer events like down, up, drag, etc. All
1249 * devices that support android.hardware.touchscreen or a sub-feature are
1250 * presumed to also support faketouch.
1251 */
1252 @SdkConstant(SdkConstantType.FEATURE)
1253 public static final String FEATURE_FAKETOUCH = "android.hardware.faketouch";
1254
1255 /**
1256 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborne22fe932011-06-08 20:24:29 -07001257 * {@link #hasSystemFeature}: The device does not have a touch screen, but
1258 * does support touch emulation for basic events that supports distinct
1259 * tracking of two or more fingers. This is an extension of
1260 * {@link #FEATURE_FAKETOUCH} for input devices with this capability. Note
1261 * that unlike a distinct multitouch screen as defined by
1262 * {@link #FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT}, these kinds of input
1263 * devices will not actually provide full two-finger gestures since the
1264 * input is being transformed to cursor movement on the screen. That is,
1265 * single finger gestures will move a cursor; two-finger swipes will
1266 * result in single-finger touch events; other two-finger gestures will
1267 * result in the corresponding two-finger touch event.
1268 */
1269 @SdkConstant(SdkConstantType.FEATURE)
1270 public static final String FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT = "android.hardware.faketouch.multitouch.distinct";
1271
1272 /**
1273 * Feature for {@link #getSystemAvailableFeatures} and
1274 * {@link #hasSystemFeature}: The device does not have a touch screen, but
1275 * does support touch emulation for basic events that supports tracking
1276 * a hand of fingers (5 or more fingers) fully independently.
1277 * This is an extension of
1278 * {@link #FEATURE_FAKETOUCH} for input devices with this capability. Note
1279 * that unlike a multitouch screen as defined by
1280 * {@link #FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND}, not all two finger
1281 * gestures can be detected due to the limitations described for
1282 * {@link #FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT}.
1283 */
1284 @SdkConstant(SdkConstantType.FEATURE)
1285 public static final String FEATURE_FAKETOUCH_MULTITOUCH_JAZZHAND = "android.hardware.faketouch.multitouch.jazzhand";
1286
1287 /**
1288 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborne289bff2011-06-13 19:33:22 -07001289 * {@link #hasSystemFeature}: The device supports portrait orientation
1290 * screens. For backwards compatibility, you can assume that if neither
1291 * this nor {@link #FEATURE_SCREEN_LANDSCAPE} is set then the device supports
1292 * both portrait and landscape.
1293 */
1294 @SdkConstant(SdkConstantType.FEATURE)
1295 public static final String FEATURE_SCREEN_PORTRAIT = "android.hardware.screen.portrait";
1296
1297 /**
1298 * Feature for {@link #getSystemAvailableFeatures} and
1299 * {@link #hasSystemFeature}: The device supports landscape orientation
1300 * screens. For backwards compatibility, you can assume that if neither
1301 * this nor {@link #FEATURE_SCREEN_PORTRAIT} is set then the device supports
1302 * both portrait and landscape.
1303 */
1304 @SdkConstant(SdkConstantType.FEATURE)
1305 public static final String FEATURE_SCREEN_LANDSCAPE = "android.hardware.screen.landscape";
1306
1307 /**
1308 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001309 * {@link #hasSystemFeature}: The device supports live wallpapers.
1310 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001311 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001312 public static final String FEATURE_LIVE_WALLPAPER = "android.software.live_wallpaper";
Oscar Montemayor1228d0a2010-01-28 12:01:44 -08001313 /**
Dan Morrill50ab63f2010-03-05 16:16:19 -08001314 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn119bbc32013-03-22 17:27:25 -07001315 * {@link #hasSystemFeature}: The device supports app widgets.
1316 */
1317 @SdkConstant(SdkConstantType.FEATURE)
1318 public static final String FEATURE_APP_WIDGETS = "android.software.app_widgets";
1319
1320 /**
Dianne Hackborn91097de2014-04-04 18:02:06 -07001321 * @hide
1322 * Feature for {@link #getSystemAvailableFeatures} and
1323 * {@link #hasSystemFeature}: The device supports
1324 * {@link android.service.voice.VoiceInteractionService} and
1325 * {@link android.app.VoiceInteractor}.
1326 */
1327 @SdkConstant(SdkConstantType.FEATURE)
1328 public static final String FEATURE_VOICE_RECOGNIZERS = "android.software.voice_recognizers";
1329
1330
1331 /**
Dianne Hackborn119bbc32013-03-22 17:27:25 -07001332 * Feature for {@link #getSystemAvailableFeatures} and
1333 * {@link #hasSystemFeature}: The device supports a home screen that is replaceable
1334 * by third party applications.
1335 */
1336 @SdkConstant(SdkConstantType.FEATURE)
1337 public static final String FEATURE_HOME_SCREEN = "android.software.home_screen";
1338
1339 /**
1340 * Feature for {@link #getSystemAvailableFeatures} and
1341 * {@link #hasSystemFeature}: The device supports adding new input methods implemented
1342 * with the {@link android.inputmethodservice.InputMethodService} API.
1343 */
1344 @SdkConstant(SdkConstantType.FEATURE)
1345 public static final String FEATURE_INPUT_METHODS = "android.software.input_methods";
1346
1347 /**
1348 * Feature for {@link #getSystemAvailableFeatures} and
Amith Yamasani44a01b72013-09-16 10:44:57 -07001349 * {@link #hasSystemFeature}: The device supports device policy enforcement via device admins.
1350 */
1351 @SdkConstant(SdkConstantType.FEATURE)
1352 public static final String FEATURE_DEVICE_ADMIN = "android.software.device_admin";
1353
1354 /**
1355 * Feature for {@link #getSystemAvailableFeatures} and
Tim Kilbournf94b6a92014-03-07 15:13:48 -08001356 * {@link #hasSystemFeature}: The device supports leanback UI. This is
1357 * typically used in a living room television experience, but is a software
1358 * feature unlike {@link #FEATURE_TELEVISION}. Devices running with this
1359 * feature will use resources associated with the "television" UI mode.
1360 */
1361 @SdkConstant(SdkConstantType.FEATURE)
1362 public static final String FEATURE_LEANBACK = "android.software.leanback";
1363
1364 /**
1365 * Feature for {@link #getSystemAvailableFeatures} and
1366 * {@link #hasSystemFeature}: The device supports only leanback UI. Only
1367 * applications designed for this experience should be run, though this is
1368 * not enforced by the system.
1369 * @hide
1370 */
1371 @SdkConstant(SdkConstantType.FEATURE)
1372 public static final String FEATURE_LEANBACK_ONLY = "android.software.leanback_only";
1373
1374 /**
1375 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001376 * {@link #hasSystemFeature}: The device supports WiFi (802.11) networking.
1377 */
1378 @SdkConstant(SdkConstantType.FEATURE)
1379 public static final String FEATURE_WIFI = "android.hardware.wifi";
1380
1381 /**
Irfan Sheriff45b8b462011-09-07 11:24:16 -07001382 * Feature for {@link #getSystemAvailableFeatures} and
1383 * {@link #hasSystemFeature}: The device supports Wi-Fi Direct networking.
1384 */
1385 @SdkConstant(SdkConstantType.FEATURE)
1386 public static final String FEATURE_WIFI_DIRECT = "android.hardware.wifi.direct";
1387
1388 /**
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07001389 * Feature for {@link #getSystemAvailableFeatures} and
1390 * {@link #hasSystemFeature}: This is a device dedicated to showing UI
1391 * on a television. Television here is defined to be a typical living
1392 * room television experience: displayed on a big screen, where the user
1393 * is sitting far away from it, and the dominant form of input will be
1394 * something like a DPAD, not through touch or mouse.
Tim Kilbournf94b6a92014-03-07 15:13:48 -08001395 * @deprecated use {@link #FEATURE_LEANBACK} instead.
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07001396 */
Jose Lima970417c2014-04-10 10:42:19 -07001397 @Deprecated
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07001398 @SdkConstant(SdkConstantType.FEATURE)
1399 public static final String FEATURE_TELEVISION = "android.hardware.type.television";
1400
1401 /**
Justin Kohb5731f02014-02-13 16:06:59 -08001402 * Feature for {@link #getSystemAvailableFeatures} and
1403 * {@link #hasSystemFeature}: This is a device dedicated to showing UI
1404 * on a watch. A watch here is defined to be a device worn on the body, perhaps on
1405 * the wrist. The user is very close when interacting with the device.
1406 */
1407 @SdkConstant(SdkConstantType.FEATURE)
1408 public static final String FEATURE_WATCH = "android.hardware.type.watch";
1409
1410 /**
Adam Lesinski3d9bcb92014-02-18 14:05:14 -08001411 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
1412 * The device supports printing.
1413 */
1414 @SdkConstant(SdkConstantType.FEATURE)
1415 public static final String FEATURE_PRINTING = "android.software.print";
1416
1417 /**
1418 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
1419 * The device can perform backup and restore operations on installed applications.
1420 */
1421 @SdkConstant(SdkConstantType.FEATURE)
1422 public static final String FEATURE_BACKUP = "android.software.backup";
1423
1424 /**
Adam Connors23cc04e2014-04-01 12:12:20 +01001425 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
1426 * The device supports managed profiles for enterprise users.
1427 */
1428 @SdkConstant(SdkConstantType.FEATURE)
Adam Connors551c0782014-06-05 12:13:03 +01001429 public static final String FEATURE_MANAGED_PROFILES = "android.software.managed_profiles";
Adam Connors23cc04e2014-04-01 12:12:20 +01001430
1431 /**
Ben Murdochf564c7f2014-05-20 18:58:06 +01001432 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Ben Murdoch422c7a52014-05-16 13:45:47 +01001433 * The device has a full implementation of the android.webkit.* APIs. Devices
1434 * lacking this feature will not have a functioning WebView implementation.
1435 */
1436 @SdkConstant(SdkConstantType.FEATURE)
1437 public static final String FEATURE_WEBVIEW = "android.software.webview";
1438
1439 /**
Dianne Hackborne83cefc2010-02-04 17:38:14 -08001440 * Action to external storage service to clean out removed apps.
1441 * @hide
1442 */
1443 public static final String ACTION_CLEAN_EXTERNAL_STORAGE
1444 = "android.content.pm.CLEAN_EXTERNAL_STORAGE";
Oscar Montemayor1228d0a2010-01-28 12:01:44 -08001445
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001446 /**
Kenny Root5ab21572011-07-27 11:11:19 -07001447 * Extra field name for the URI to a verification file. Passed to a package
1448 * verifier.
1449 *
1450 * @hide
1451 */
1452 public static final String EXTRA_VERIFICATION_URI = "android.content.pm.extra.VERIFICATION_URI";
1453
1454 /**
1455 * Extra field name for the ID of a package pending verification. Passed to
1456 * a package verifier and is used to call back to
Kenny Root3a9b5fb2011-09-20 14:15:38 -07001457 * {@link PackageManager#verifyPendingInstall(int, int)}
Kenny Root5ab21572011-07-27 11:11:19 -07001458 */
1459 public static final String EXTRA_VERIFICATION_ID = "android.content.pm.extra.VERIFICATION_ID";
1460
1461 /**
1462 * Extra field name for the package identifier which is trying to install
1463 * the package.
1464 *
1465 * @hide
1466 */
1467 public static final String EXTRA_VERIFICATION_INSTALLER_PACKAGE
1468 = "android.content.pm.extra.VERIFICATION_INSTALLER_PACKAGE";
1469
1470 /**
1471 * Extra field name for the requested install flags for a package pending
1472 * verification. Passed to a package verifier.
1473 *
1474 * @hide
1475 */
1476 public static final String EXTRA_VERIFICATION_INSTALL_FLAGS
1477 = "android.content.pm.extra.VERIFICATION_INSTALL_FLAGS";
1478
1479 /**
rich cannings13d428e2012-09-13 13:43:07 -07001480 * Extra field name for the uid of who is requesting to install
1481 * the package.
1482 *
1483 * @hide
1484 */
1485 public static final String EXTRA_VERIFICATION_INSTALLER_UID
1486 = "android.content.pm.extra.VERIFICATION_INSTALLER_UID";
1487
1488 /**
1489 * Extra field name for the package name of a package pending verification.
1490 *
1491 * @hide
1492 */
1493 public static final String EXTRA_VERIFICATION_PACKAGE_NAME
1494 = "android.content.pm.extra.VERIFICATION_PACKAGE_NAME";
1495 /**
rich canningsd1b5cfc2012-08-29 14:49:51 -07001496 * Extra field name for the result of a verification, either
1497 * {@link #VERIFICATION_ALLOW}, or {@link #VERIFICATION_REJECT}.
1498 * Passed to package verifiers after a package is verified.
1499 */
1500 public static final String EXTRA_VERIFICATION_RESULT
1501 = "android.content.pm.extra.VERIFICATION_RESULT";
1502
1503 /**
rich cannings13d428e2012-09-13 13:43:07 -07001504 * Extra field name for the version code of a package pending verification.
1505 *
1506 * @hide
1507 */
1508 public static final String EXTRA_VERIFICATION_VERSION_CODE
1509 = "android.content.pm.extra.VERIFICATION_VERSION_CODE";
1510
1511 /**
Nick Kralevich035f80d2013-03-27 15:20:08 -07001512 * The action used to request that the user approve a permission request
1513 * from the application.
1514 *
1515 * @hide
1516 */
1517 public static final String ACTION_REQUEST_PERMISSION
1518 = "android.content.pm.action.REQUEST_PERMISSION";
1519
1520 /**
1521 * Extra field name for the list of permissions, which the user must approve.
1522 *
1523 * @hide
1524 */
1525 public static final String EXTRA_REQUEST_PERMISSION_PERMISSION_LIST
1526 = "android.content.pm.extra.PERMISSION_LIST";
1527
1528 /**
Christopher Tatef1977b42014-03-24 16:25:51 -07001529 * String extra for {@link IPackageInstallObserver2} in the 'extras' Bundle in case of
1530 * {@link #INSTALL_FAILED_DUPLICATE_PERMISSION}. This extra names the package which provides
1531 * the existing definition for the permission.
1532 * @hide
1533 */
1534 public static final String EXTRA_FAILURE_EXISTING_PACKAGE
1535 = "android.content.pm.extra.FAILURE_EXISTING_PACKAGE";
1536
1537 /**
1538 * String extra for {@link IPackageInstallObserver2} in the 'extras' Bundle in case of
1539 * {@link #INSTALL_FAILED_DUPLICATE_PERMISSION}. This extra names the permission that is
1540 * being redundantly defined by the package being installed.
1541 * @hide
1542 */
1543 public static final String EXTRA_FAILURE_EXISTING_PERMISSION
1544 = "android.content.pm.extra.FAILURE_EXISTING_PERMISSION";
1545
1546 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001547 * Retrieve overall information about an application package that is
1548 * installed on the system.
Kenny Root5ab21572011-07-27 11:11:19 -07001549 * <p>
1550 * Throws {@link NameNotFoundException} if a package with the given name can
1551 * not be found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001552 *
1553 * @param packageName The full name (i.e. com.google.apps.contacts) of the
Kenny Root5ab21572011-07-27 11:11:19 -07001554 * desired package.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001555 * @param flags Additional option flags. Use any combination of
Kenny Root5ab21572011-07-27 11:11:19 -07001556 * {@link #GET_ACTIVITIES}, {@link #GET_GIDS},
1557 * {@link #GET_CONFIGURATIONS}, {@link #GET_INSTRUMENTATION},
1558 * {@link #GET_PERMISSIONS}, {@link #GET_PROVIDERS},
1559 * {@link #GET_RECEIVERS}, {@link #GET_SERVICES},
1560 * {@link #GET_SIGNATURES}, {@link #GET_UNINSTALLED_PACKAGES} to
1561 * modify the data returned.
1562 * @return Returns a PackageInfo object containing information about the
1563 * package. If flag GET_UNINSTALLED_PACKAGES is set and if the
1564 * package is not found in the list of installed applications, the
1565 * package information is retrieved from the list of uninstalled
kmccormick30498b42013-03-27 17:39:17 -07001566 * applications (which includes installed applications as well as
1567 * applications with data directory i.e. applications which had been
1568 * deleted with {@code DONT_DELETE_DATA} flag set).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001569 * @see #GET_ACTIVITIES
1570 * @see #GET_GIDS
1571 * @see #GET_CONFIGURATIONS
1572 * @see #GET_INSTRUMENTATION
1573 * @see #GET_PERMISSIONS
1574 * @see #GET_PROVIDERS
1575 * @see #GET_RECEIVERS
1576 * @see #GET_SERVICES
1577 * @see #GET_SIGNATURES
1578 * @see #GET_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001579 */
1580 public abstract PackageInfo getPackageInfo(String packageName, int flags)
1581 throws NameNotFoundException;
1582
1583 /**
Dianne Hackborn47096932010-02-11 15:57:09 -08001584 * Map from the current package names in use on the device to whatever
1585 * the current canonical name of that package is.
1586 * @param names Array of current names to be mapped.
1587 * @return Returns an array of the same size as the original, containing
1588 * the canonical name for each package.
1589 */
1590 public abstract String[] currentToCanonicalPackageNames(String[] names);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001591
Dianne Hackborn47096932010-02-11 15:57:09 -08001592 /**
1593 * Map from a packages canonical name to the current name in use on the device.
1594 * @param names Array of new names to be mapped.
1595 * @return Returns an array of the same size as the original, containing
1596 * the current name for each package.
1597 */
1598 public abstract String[] canonicalToCurrentPackageNames(String[] names);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001599
Dianne Hackborn47096932010-02-11 15:57:09 -08001600 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001601 * Return a "good" intent to launch a front-door activity in a package,
1602 * for use for example to implement an "open" button when browsing through
1603 * packages. The current implementation will look first for a main
1604 * activity in the category {@link Intent#CATEGORY_INFO}, next for a
1605 * main activity in the category {@link Intent#CATEGORY_LAUNCHER}, or return
1606 * null if neither are found.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001607 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001608 * <p>Throws {@link NameNotFoundException} if a package with the given
kmccormick30498b42013-03-27 17:39:17 -07001609 * name cannot be found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001610 *
1611 * @param packageName The name of the package to inspect.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001612 *
Dianne Hackborn19415762010-12-15 00:20:27 -08001613 * @return Returns either a fully-qualified Intent that can be used to
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001614 * launch the main activity in the package, or null if the package does
1615 * not contain such an activity.
1616 */
Mihai Predaeae850c2009-05-13 10:13:48 +02001617 public abstract Intent getLaunchIntentForPackage(String packageName);
1618
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001619 /**
Jose Lima970417c2014-04-10 10:42:19 -07001620 * Return a "good" intent to launch a front-door Leanback activity in a
1621 * package, for use for example to implement an "open" button when browsing
1622 * through packages. The current implementation will look for a main
1623 * activity in the category {@link Intent#CATEGORY_LEANBACK_LAUNCHER}, or
1624 * return null if no main leanback activities are found.
1625 * <p>
1626 * Throws {@link NameNotFoundException} if a package with the given name
1627 * cannot be found on the system.
Adam Connors551c0782014-06-05 12:13:03 +01001628 *
Jose Lima970417c2014-04-10 10:42:19 -07001629 * @param packageName The name of the package to inspect.
1630 * @return Returns either a fully-qualified Intent that can be used to launch
1631 * the main Leanback activity in the package, or null if the package
1632 * does not contain such an activity.
1633 */
1634 public abstract Intent getLeanbackLaunchIntentForPackage(String packageName);
1635
1636 /**
1637 * Return an array of all of the secondary group-ids that have been assigned
1638 * to a package.
1639 * <p>
1640 * Throws {@link NameNotFoundException} if a package with the given name
1641 * cannot be found on the system.
Adam Connors551c0782014-06-05 12:13:03 +01001642 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001643 * @param packageName The full name (i.e. com.google.apps.contacts) of the
Jose Lima970417c2014-04-10 10:42:19 -07001644 * desired package.
1645 * @return Returns an int array of the assigned gids, or null if there are
1646 * none.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001647 */
1648 public abstract int[] getPackageGids(String packageName)
1649 throws NameNotFoundException;
1650
1651 /**
Dianne Hackborna06de0f2012-12-11 16:34:47 -08001652 * @hide Return the uid associated with the given package name for the
1653 * given user.
1654 *
1655 * <p>Throws {@link NameNotFoundException} if a package with the given
1656 * name can not be found on the system.
1657 *
1658 * @param packageName The full name (i.e. com.google.apps.contacts) of the
1659 * desired package.
1660 * @param userHandle The user handle identifier to look up the package under.
1661 *
1662 * @return Returns an integer uid who owns the given package name.
1663 */
1664 public abstract int getPackageUid(String packageName, int userHandle)
1665 throws NameNotFoundException;
1666
1667 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001668 * Retrieve all of the information we know about a particular permission.
1669 *
1670 * <p>Throws {@link NameNotFoundException} if a permission with the given
kmccormick30498b42013-03-27 17:39:17 -07001671 * name cannot be found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001672 *
1673 * @param name The fully qualified name (i.e. com.google.permission.LOGIN)
1674 * of the permission you are interested in.
1675 * @param flags Additional option flags. Use {@link #GET_META_DATA} to
1676 * retrieve any meta-data associated with the permission.
1677 *
1678 * @return Returns a {@link PermissionInfo} containing information about the
1679 * permission.
1680 */
1681 public abstract PermissionInfo getPermissionInfo(String name, int flags)
1682 throws NameNotFoundException;
1683
1684 /**
1685 * Query for all of the permissions associated with a particular group.
1686 *
1687 * <p>Throws {@link NameNotFoundException} if the given group does not
1688 * exist.
1689 *
1690 * @param group The fully qualified name (i.e. com.google.permission.LOGIN)
1691 * of the permission group you are interested in. Use null to
1692 * find all of the permissions not associated with a group.
1693 * @param flags Additional option flags. Use {@link #GET_META_DATA} to
1694 * retrieve any meta-data associated with the permissions.
1695 *
1696 * @return Returns a list of {@link PermissionInfo} containing information
1697 * about all of the permissions in the given group.
1698 */
1699 public abstract List<PermissionInfo> queryPermissionsByGroup(String group,
1700 int flags) throws NameNotFoundException;
1701
1702 /**
1703 * Retrieve all of the information we know about a particular group of
1704 * permissions.
1705 *
1706 * <p>Throws {@link NameNotFoundException} if a permission group with the given
kmccormick30498b42013-03-27 17:39:17 -07001707 * name cannot be found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001708 *
1709 * @param name The fully qualified name (i.e. com.google.permission_group.APPS)
1710 * of the permission you are interested in.
1711 * @param flags Additional option flags. Use {@link #GET_META_DATA} to
1712 * retrieve any meta-data associated with the permission group.
1713 *
1714 * @return Returns a {@link PermissionGroupInfo} containing information
1715 * about the permission.
1716 */
1717 public abstract PermissionGroupInfo getPermissionGroupInfo(String name,
1718 int flags) throws NameNotFoundException;
1719
1720 /**
1721 * Retrieve all of the known permission groups in the system.
1722 *
1723 * @param flags Additional option flags. Use {@link #GET_META_DATA} to
1724 * retrieve any meta-data associated with the permission group.
1725 *
1726 * @return Returns a list of {@link PermissionGroupInfo} containing
1727 * information about all of the known permission groups.
1728 */
1729 public abstract List<PermissionGroupInfo> getAllPermissionGroups(int flags);
1730
1731 /**
1732 * Retrieve all of the information we know about a particular
1733 * package/application.
1734 *
1735 * <p>Throws {@link NameNotFoundException} if an application with the given
kmccormick30498b42013-03-27 17:39:17 -07001736 * package name cannot be found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001737 *
1738 * @param packageName The full name (i.e. com.google.apps.contacts) of an
1739 * application.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001740 * @param flags Additional option flags. Use any combination of
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001741 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
1742 * {@link #GET_UNINSTALLED_PACKAGES} to modify the data returned.
1743 *
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001744 * @return {@link ApplicationInfo} Returns ApplicationInfo object containing
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001745 * information about the package.
1746 * If flag GET_UNINSTALLED_PACKAGES is set and if the package is not
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001747 * found in the list of installed applications,
1748 * the application information is retrieved from the
1749 * list of uninstalled applications(which includes
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001750 * installed applications as well as applications
1751 * with data directory ie applications which had been
kmccormick30498b42013-03-27 17:39:17 -07001752 * deleted with {@code DONT_DELETE_DATA} flag set).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001753 *
1754 * @see #GET_META_DATA
1755 * @see #GET_SHARED_LIBRARY_FILES
1756 * @see #GET_UNINSTALLED_PACKAGES
1757 */
1758 public abstract ApplicationInfo getApplicationInfo(String packageName,
1759 int flags) throws NameNotFoundException;
1760
1761 /**
1762 * Retrieve all of the information we know about a particular activity
1763 * class.
1764 *
1765 * <p>Throws {@link NameNotFoundException} if an activity with the given
kmccormick30498b42013-03-27 17:39:17 -07001766 * class name cannot be found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001767 *
Dianne Hackborn361199b2010-08-30 17:42:07 -07001768 * @param component The full component name (i.e.
1769 * com.google.apps.contacts/com.google.apps.contacts.ContactsList) of an Activity
1770 * class.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001771 * @param flags Additional option flags. Use any combination of
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001772 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
1773 * to modify the data (in ApplicationInfo) returned.
1774 *
1775 * @return {@link ActivityInfo} containing information about the activity.
1776 *
1777 * @see #GET_INTENT_FILTERS
1778 * @see #GET_META_DATA
1779 * @see #GET_SHARED_LIBRARY_FILES
1780 */
Dianne Hackborn361199b2010-08-30 17:42:07 -07001781 public abstract ActivityInfo getActivityInfo(ComponentName component,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001782 int flags) throws NameNotFoundException;
1783
1784 /**
1785 * Retrieve all of the information we know about a particular receiver
1786 * class.
1787 *
1788 * <p>Throws {@link NameNotFoundException} if a receiver with the given
kmccormick30498b42013-03-27 17:39:17 -07001789 * class name cannot be found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001790 *
Dianne Hackborn361199b2010-08-30 17:42:07 -07001791 * @param component The full component name (i.e.
1792 * com.google.apps.calendar/com.google.apps.calendar.CalendarAlarm) of a Receiver
1793 * class.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001794 * @param flags Additional option flags. Use any combination of
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001795 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
1796 * to modify the data returned.
1797 *
1798 * @return {@link ActivityInfo} containing information about the receiver.
1799 *
1800 * @see #GET_INTENT_FILTERS
1801 * @see #GET_META_DATA
1802 * @see #GET_SHARED_LIBRARY_FILES
1803 */
Dianne Hackborn361199b2010-08-30 17:42:07 -07001804 public abstract ActivityInfo getReceiverInfo(ComponentName component,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001805 int flags) throws NameNotFoundException;
1806
1807 /**
1808 * Retrieve all of the information we know about a particular service
1809 * class.
1810 *
1811 * <p>Throws {@link NameNotFoundException} if a service with the given
kmccormick30498b42013-03-27 17:39:17 -07001812 * class name cannot be found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001813 *
Dianne Hackborn361199b2010-08-30 17:42:07 -07001814 * @param component The full component name (i.e.
1815 * com.google.apps.media/com.google.apps.media.BackgroundPlayback) of a Service
1816 * class.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001817 * @param flags Additional option flags. Use any combination of
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001818 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
1819 * to modify the data returned.
1820 *
1821 * @return ServiceInfo containing information about the service.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001822 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001823 * @see #GET_META_DATA
1824 * @see #GET_SHARED_LIBRARY_FILES
1825 */
Dianne Hackborn361199b2010-08-30 17:42:07 -07001826 public abstract ServiceInfo getServiceInfo(ComponentName component,
1827 int flags) throws NameNotFoundException;
1828
1829 /**
1830 * Retrieve all of the information we know about a particular content
1831 * provider class.
1832 *
1833 * <p>Throws {@link NameNotFoundException} if a provider with the given
kmccormick30498b42013-03-27 17:39:17 -07001834 * class name cannot be found on the system.
Dianne Hackborn361199b2010-08-30 17:42:07 -07001835 *
1836 * @param component The full component name (i.e.
1837 * com.google.providers.media/com.google.providers.media.MediaProvider) of a
1838 * ContentProvider class.
1839 * @param flags Additional option flags. Use any combination of
1840 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
1841 * to modify the data returned.
1842 *
1843 * @return ProviderInfo containing information about the service.
1844 *
1845 * @see #GET_META_DATA
1846 * @see #GET_SHARED_LIBRARY_FILES
1847 */
1848 public abstract ProviderInfo getProviderInfo(ComponentName component,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001849 int flags) throws NameNotFoundException;
1850
1851 /**
1852 * Return a List of all packages that are installed
1853 * on the device.
1854 *
1855 * @param flags Additional option flags. Use any combination of
1856 * {@link #GET_ACTIVITIES},
1857 * {@link #GET_GIDS},
1858 * {@link #GET_CONFIGURATIONS},
1859 * {@link #GET_INSTRUMENTATION},
1860 * {@link #GET_PERMISSIONS},
1861 * {@link #GET_PROVIDERS},
1862 * {@link #GET_RECEIVERS},
1863 * {@link #GET_SERVICES},
1864 * {@link #GET_SIGNATURES},
1865 * {@link #GET_UNINSTALLED_PACKAGES} to modify the data returned.
1866 *
1867 * @return A List of PackageInfo objects, one for each package that is
1868 * installed on the device. In the unlikely case of there being no
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001869 * installed packages, an empty list is returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001870 * If flag GET_UNINSTALLED_PACKAGES is set, a list of all
kmccormick30498b42013-03-27 17:39:17 -07001871 * applications including those deleted with {@code DONT_DELETE_DATA}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001872 * (partially installed apps with data directory) will be returned.
1873 *
1874 * @see #GET_ACTIVITIES
1875 * @see #GET_GIDS
1876 * @see #GET_CONFIGURATIONS
1877 * @see #GET_INSTRUMENTATION
1878 * @see #GET_PERMISSIONS
1879 * @see #GET_PROVIDERS
1880 * @see #GET_RECEIVERS
1881 * @see #GET_SERVICES
1882 * @see #GET_SIGNATURES
1883 * @see #GET_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001884 */
1885 public abstract List<PackageInfo> getInstalledPackages(int flags);
1886
1887 /**
Dianne Hackborne7991752013-01-16 17:56:46 -08001888 * Return a List of all installed packages that are currently
1889 * holding any of the given permissions.
1890 *
1891 * @param flags Additional option flags. Use any combination of
1892 * {@link #GET_ACTIVITIES},
1893 * {@link #GET_GIDS},
1894 * {@link #GET_CONFIGURATIONS},
1895 * {@link #GET_INSTRUMENTATION},
1896 * {@link #GET_PERMISSIONS},
1897 * {@link #GET_PROVIDERS},
1898 * {@link #GET_RECEIVERS},
1899 * {@link #GET_SERVICES},
1900 * {@link #GET_SIGNATURES},
1901 * {@link #GET_UNINSTALLED_PACKAGES} to modify the data returned.
1902 *
1903 * @return Returns a List of PackageInfo objects, one for each installed
1904 * application that is holding any of the permissions that were provided.
1905 *
1906 * @see #GET_ACTIVITIES
1907 * @see #GET_GIDS
1908 * @see #GET_CONFIGURATIONS
1909 * @see #GET_INSTRUMENTATION
1910 * @see #GET_PERMISSIONS
1911 * @see #GET_PROVIDERS
1912 * @see #GET_RECEIVERS
1913 * @see #GET_SERVICES
1914 * @see #GET_SIGNATURES
1915 * @see #GET_UNINSTALLED_PACKAGES
1916 */
1917 public abstract List<PackageInfo> getPackagesHoldingPermissions(
1918 String[] permissions, int flags);
1919
1920 /**
Amith Yamasani151ec4c2012-09-07 19:25:16 -07001921 * Return a List of all packages that are installed on the device, for a specific user.
1922 * Requesting a list of installed packages for another user
1923 * will require the permission INTERACT_ACROSS_USERS_FULL.
1924 * @param flags Additional option flags. Use any combination of
1925 * {@link #GET_ACTIVITIES},
1926 * {@link #GET_GIDS},
1927 * {@link #GET_CONFIGURATIONS},
1928 * {@link #GET_INSTRUMENTATION},
1929 * {@link #GET_PERMISSIONS},
1930 * {@link #GET_PROVIDERS},
1931 * {@link #GET_RECEIVERS},
1932 * {@link #GET_SERVICES},
1933 * {@link #GET_SIGNATURES},
1934 * {@link #GET_UNINSTALLED_PACKAGES} to modify the data returned.
1935 * @param userId The user for whom the installed packages are to be listed
1936 *
1937 * @return A List of PackageInfo objects, one for each package that is
1938 * installed on the device. In the unlikely case of there being no
1939 * installed packages, an empty list is returned.
1940 * If flag GET_UNINSTALLED_PACKAGES is set, a list of all
kmccormick30498b42013-03-27 17:39:17 -07001941 * applications including those deleted with {@code DONT_DELETE_DATA}
Amith Yamasani151ec4c2012-09-07 19:25:16 -07001942 * (partially installed apps with data directory) will be returned.
1943 *
1944 * @see #GET_ACTIVITIES
1945 * @see #GET_GIDS
1946 * @see #GET_CONFIGURATIONS
1947 * @see #GET_INSTRUMENTATION
1948 * @see #GET_PERMISSIONS
1949 * @see #GET_PROVIDERS
1950 * @see #GET_RECEIVERS
1951 * @see #GET_SERVICES
1952 * @see #GET_SIGNATURES
1953 * @see #GET_UNINSTALLED_PACKAGES
1954 *
1955 * @hide
1956 */
1957 public abstract List<PackageInfo> getInstalledPackages(int flags, int userId);
1958
1959 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001960 * Check whether a particular package has been granted a particular
1961 * permission.
1962 *
1963 * @param permName The name of the permission you are checking for,
1964 * @param pkgName The name of the package you are checking against.
1965 *
1966 * @return If the package has the permission, PERMISSION_GRANTED is
1967 * returned. If it does not have the permission, PERMISSION_DENIED
1968 * is returned.
1969 *
1970 * @see #PERMISSION_GRANTED
1971 * @see #PERMISSION_DENIED
1972 */
1973 public abstract int checkPermission(String permName, String pkgName);
1974
1975 /**
1976 * Add a new dynamic permission to the system. For this to work, your
1977 * package must have defined a permission tree through the
1978 * {@link android.R.styleable#AndroidManifestPermissionTree
1979 * &lt;permission-tree&gt;} tag in its manifest. A package can only add
1980 * permissions to trees that were defined by either its own package or
1981 * another with the same user id; a permission is in a tree if it
1982 * matches the name of the permission tree + ".": for example,
1983 * "com.foo.bar" is a member of the permission tree "com.foo".
1984 *
1985 * <p>It is good to make your permission tree name descriptive, because you
1986 * are taking possession of that entire set of permission names. Thus, it
1987 * must be under a domain you control, with a suffix that will not match
1988 * any normal permissions that may be declared in any applications that
1989 * are part of that domain.
1990 *
1991 * <p>New permissions must be added before
1992 * any .apks are installed that use those permissions. Permissions you
1993 * add through this method are remembered across reboots of the device.
1994 * If the given permission already exists, the info you supply here
1995 * will be used to update it.
1996 *
1997 * @param info Description of the permission to be added.
1998 *
1999 * @return Returns true if a new permission was created, false if an
2000 * existing one was updated.
2001 *
2002 * @throws SecurityException if you are not allowed to add the
2003 * given permission name.
2004 *
2005 * @see #removePermission(String)
2006 */
2007 public abstract boolean addPermission(PermissionInfo info);
2008
2009 /**
Dianne Hackbornd7c09682010-03-30 10:42:20 -07002010 * Like {@link #addPermission(PermissionInfo)} but asynchronously
2011 * persists the package manager state after returning from the call,
2012 * allowing it to return quicker and batch a series of adds at the
2013 * expense of no guarantee the added permission will be retained if
2014 * the device is rebooted before it is written.
2015 */
2016 public abstract boolean addPermissionAsync(PermissionInfo info);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002017
Dianne Hackbornd7c09682010-03-30 10:42:20 -07002018 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002019 * Removes a permission that was previously added with
2020 * {@link #addPermission(PermissionInfo)}. The same ownership rules apply
2021 * -- you are only allowed to remove permissions that you are allowed
2022 * to add.
2023 *
2024 * @param name The name of the permission to remove.
2025 *
2026 * @throws SecurityException if you are not allowed to remove the
2027 * given permission name.
2028 *
2029 * @see #addPermission(PermissionInfo)
2030 */
2031 public abstract void removePermission(String name);
2032
2033 /**
Nick Kralevich035f80d2013-03-27 15:20:08 -07002034 * Returns an {@link Intent} suitable for passing to {@code startActivityForResult}
2035 * which prompts the user to grant {@code permissions} to this application.
Nick Kralevich32eb5b12013-04-11 10:20:09 -07002036 * @hide
Nick Kralevich035f80d2013-03-27 15:20:08 -07002037 *
2038 * @throws NullPointerException if {@code permissions} is {@code null}.
2039 * @throws IllegalArgumentException if {@code permissions} contains {@code null}.
2040 */
2041 public Intent buildPermissionRequestIntent(String... permissions) {
2042 if (permissions == null) {
2043 throw new NullPointerException("permissions cannot be null");
2044 }
2045 for (String permission : permissions) {
2046 if (permission == null) {
2047 throw new IllegalArgumentException("permissions cannot contain null");
2048 }
2049 }
2050
2051 Intent i = new Intent(ACTION_REQUEST_PERMISSION);
2052 i.putExtra(EXTRA_REQUEST_PERMISSION_PERMISSION_LIST, permissions);
2053 i.setPackage("com.android.packageinstaller");
2054 return i;
2055 }
2056
2057 /**
Dianne Hackborne639da72012-02-21 15:11:13 -08002058 * Grant a permission to an application which the application does not
2059 * already have. The permission must have been requested by the application,
2060 * but as an optional permission. If the application is not allowed to
2061 * hold the permission, a SecurityException is thrown.
2062 * @hide
2063 *
2064 * @param packageName The name of the package that the permission will be
2065 * granted to.
2066 * @param permissionName The name of the permission.
2067 */
2068 public abstract void grantPermission(String packageName, String permissionName);
2069
2070 /**
2071 * Revoke a permission that was previously granted by {@link #grantPermission}.
2072 * @hide
2073 *
2074 * @param packageName The name of the package that the permission will be
2075 * granted to.
2076 * @param permissionName The name of the permission.
2077 */
2078 public abstract void revokePermission(String packageName, String permissionName);
2079
2080 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002081 * Compare the signatures of two packages to determine if the same
2082 * signature appears in both of them. If they do contain the same
2083 * signature, then they are allowed special privileges when working
2084 * with each other: they can share the same user-id, run instrumentation
2085 * against each other, etc.
2086 *
2087 * @param pkg1 First package name whose signature will be compared.
2088 * @param pkg2 Second package name whose signature will be compared.
Chris Palmer09f33602010-09-13 14:27:18 -07002089 *
2090 * @return Returns an integer indicating whether all signatures on the
2091 * two packages match. The value is >= 0 ({@link #SIGNATURE_MATCH}) if
2092 * all signatures match or < 0 if there is not a match ({@link
2093 * #SIGNATURE_NO_MATCH} or {@link #SIGNATURE_UNKNOWN_PACKAGE}).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002094 *
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07002095 * @see #checkSignatures(int, int)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002096 * @see #SIGNATURE_MATCH
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002097 * @see #SIGNATURE_NO_MATCH
2098 * @see #SIGNATURE_UNKNOWN_PACKAGE
2099 */
2100 public abstract int checkSignatures(String pkg1, String pkg2);
2101
2102 /**
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07002103 * Like {@link #checkSignatures(String, String)}, but takes UIDs of
2104 * the two packages to be checked. This can be useful, for example,
2105 * when doing the check in an IPC, where the UID is the only identity
2106 * available. It is functionally identical to determining the package
2107 * associated with the UIDs and checking their signatures.
2108 *
Joe Onorato25660ec2009-08-12 22:40:37 -07002109 * @param uid1 First UID whose signature will be compared.
2110 * @param uid2 Second UID whose signature will be compared.
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07002111 *
Chris Palmer09f33602010-09-13 14:27:18 -07002112 * @return Returns an integer indicating whether all signatures on the
2113 * two packages match. The value is >= 0 ({@link #SIGNATURE_MATCH}) if
2114 * all signatures match or < 0 if there is not a match ({@link
2115 * #SIGNATURE_NO_MATCH} or {@link #SIGNATURE_UNKNOWN_PACKAGE}).
2116 *
2117 * @see #checkSignatures(String, String)
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07002118 * @see #SIGNATURE_MATCH
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07002119 * @see #SIGNATURE_NO_MATCH
2120 * @see #SIGNATURE_UNKNOWN_PACKAGE
2121 */
2122 public abstract int checkSignatures(int uid1, int uid2);
2123
2124 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002125 * Retrieve the names of all packages that are associated with a particular
2126 * user id. In most cases, this will be a single package name, the package
2127 * that has been assigned that user id. Where there are multiple packages
2128 * sharing the same user id through the "sharedUserId" mechanism, all
2129 * packages with that id will be returned.
2130 *
2131 * @param uid The user id for which you would like to retrieve the
2132 * associated packages.
2133 *
2134 * @return Returns an array of one or more packages assigned to the user
2135 * id, or null if there are no known packages with the given id.
2136 */
2137 public abstract String[] getPackagesForUid(int uid);
2138
2139 /**
2140 * Retrieve the official name associated with a user id. This name is
2141 * guaranteed to never change, though it is possibly for the underlying
2142 * user id to be changed. That is, if you are storing information about
2143 * user ids in persistent storage, you should use the string returned
2144 * by this function instead of the raw user-id.
2145 *
2146 * @param uid The user id for which you would like to retrieve a name.
2147 * @return Returns a unique name for the given user id, or null if the
2148 * user id is not currently assigned.
2149 */
2150 public abstract String getNameForUid(int uid);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002151
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002152 /**
2153 * Return the user id associated with a shared user name. Multiple
2154 * applications can specify a shared user name in their manifest and thus
2155 * end up using a common uid. This might be used for new applications
2156 * that use an existing shared user name and need to know the uid of the
2157 * shared user.
2158 *
2159 * @param sharedUserName The shared user name whose uid is to be retrieved.
2160 * @return Returns the uid associated with the shared user, or NameNotFoundException
2161 * if the shared user name is not being used by any installed packages
2162 * @hide
2163 */
2164 public abstract int getUidForSharedUser(String sharedUserName)
2165 throws NameNotFoundException;
2166
2167 /**
2168 * Return a List of all application packages that are installed on the
2169 * device. If flag GET_UNINSTALLED_PACKAGES has been set, a list of all
kmccormick30498b42013-03-27 17:39:17 -07002170 * applications including those deleted with {@code DONT_DELETE_DATA} (partially
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002171 * installed apps with data directory) will be returned.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002172 *
2173 * @param flags Additional option flags. Use any combination of
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002174 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
Jeff Smitha45746e2012-07-19 14:19:24 -05002175 * {@link #GET_UNINSTALLED_PACKAGES} to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002176 *
Dianne Hackborne7991752013-01-16 17:56:46 -08002177 * @return Returns a List of ApplicationInfo objects, one for each application that
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002178 * is installed on the device. In the unlikely case of there being
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002179 * no installed applications, an empty list is returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002180 * If flag GET_UNINSTALLED_PACKAGES is set, a list of all
kmccormick30498b42013-03-27 17:39:17 -07002181 * applications including those deleted with {@code DONT_DELETE_DATA}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002182 * (partially installed apps with data directory) will be returned.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002183 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002184 * @see #GET_META_DATA
2185 * @see #GET_SHARED_LIBRARY_FILES
2186 * @see #GET_UNINSTALLED_PACKAGES
2187 */
2188 public abstract List<ApplicationInfo> getInstalledApplications(int flags);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002189
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002190 /**
2191 * Get a list of shared libraries that are available on the
2192 * system.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002193 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002194 * @return An array of shared library names that are
2195 * available on the system, or null if none are installed.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002196 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002197 */
2198 public abstract String[] getSystemSharedLibraryNames();
2199
2200 /**
Dianne Hackborn49237342009-08-27 20:08:01 -07002201 * Get a list of features that are available on the
2202 * system.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002203 *
Dianne Hackborn49237342009-08-27 20:08:01 -07002204 * @return An array of FeatureInfo classes describing the features
2205 * that are available on the system, or null if there are none(!!).
Dianne Hackborn49237342009-08-27 20:08:01 -07002206 */
2207 public abstract FeatureInfo[] getSystemAvailableFeatures();
2208
2209 /**
Dianne Hackborn039c68e2009-09-26 16:39:23 -07002210 * Check whether the given feature name is one of the available
2211 * features as returned by {@link #getSystemAvailableFeatures()}.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002212 *
Dianne Hackborn039c68e2009-09-26 16:39:23 -07002213 * @return Returns true if the devices supports the feature, else
2214 * false.
2215 */
2216 public abstract boolean hasSystemFeature(String name);
2217
2218 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002219 * Determine the best action to perform for a given Intent. This is how
2220 * {@link Intent#resolveActivity} finds an activity if a class has not
2221 * been explicitly specified.
2222 *
Scott Mainef6b3052011-03-23 14:23:02 -07002223 * <p><em>Note:</em> if using an implicit Intent (without an explicit ComponentName
Dianne Hackborn4d023d22010-10-01 13:41:04 -07002224 * specified), be sure to consider whether to set the {@link #MATCH_DEFAULT_ONLY}
2225 * only flag. You need to do so to resolve the activity in the same way
2226 * that {@link android.content.Context#startActivity(Intent)} and
2227 * {@link android.content.Intent#resolveActivity(PackageManager)
2228 * Intent.resolveActivity(PackageManager)} do.</p>
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002229 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002230 * @param intent An intent containing all of the desired specification
2231 * (action, data, type, category, and/or component).
2232 * @param flags Additional option flags. The most important is
Dianne Hackborn4d023d22010-10-01 13:41:04 -07002233 * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only
2234 * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002235 *
2236 * @return Returns a ResolveInfo containing the final activity intent that
2237 * was determined to be the best action. Returns null if no
Mike LeBeaubd3f5272010-02-18 19:27:17 -08002238 * matching activity was found. If multiple matching activities are
2239 * found and there is no default set, returns a ResolveInfo
2240 * containing something else, such as the activity resolver.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002241 *
2242 * @see #MATCH_DEFAULT_ONLY
2243 * @see #GET_INTENT_FILTERS
2244 * @see #GET_RESOLVED_FILTER
2245 */
2246 public abstract ResolveInfo resolveActivity(Intent intent, int flags);
2247
2248 /**
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07002249 * Determine the best action to perform for a given Intent for a given user. This
2250 * is how {@link Intent#resolveActivity} finds an activity if a class has not
2251 * been explicitly specified.
2252 *
2253 * <p><em>Note:</em> if using an implicit Intent (without an explicit ComponentName
2254 * specified), be sure to consider whether to set the {@link #MATCH_DEFAULT_ONLY}
2255 * only flag. You need to do so to resolve the activity in the same way
2256 * that {@link android.content.Context#startActivity(Intent)} and
2257 * {@link android.content.Intent#resolveActivity(PackageManager)
2258 * Intent.resolveActivity(PackageManager)} do.</p>
2259 *
2260 * @param intent An intent containing all of the desired specification
2261 * (action, data, type, category, and/or component).
2262 * @param flags Additional option flags. The most important is
2263 * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only
2264 * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}.
2265 * @param userId The user id.
2266 *
2267 * @return Returns a ResolveInfo containing the final activity intent that
2268 * was determined to be the best action. Returns null if no
2269 * matching activity was found. If multiple matching activities are
2270 * found and there is no default set, returns a ResolveInfo
2271 * containing something else, such as the activity resolver.
2272 *
2273 * @see #MATCH_DEFAULT_ONLY
2274 * @see #GET_INTENT_FILTERS
2275 * @see #GET_RESOLVED_FILTER
2276 *
2277 * @hide
2278 */
2279 public abstract ResolveInfo resolveActivityAsUser(Intent intent, int flags, int userId);
2280
2281 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002282 * Retrieve all activities that can be performed for the given intent.
2283 *
2284 * @param intent The desired intent as per resolveActivity().
2285 * @param flags Additional option flags. The most important is
Dianne Hackborn4d023d22010-10-01 13:41:04 -07002286 * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only
2287 * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002288 *
Dianne Hackborn4d023d22010-10-01 13:41:04 -07002289 * @return A List&lt;ResolveInfo&gt; containing one entry for each matching
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002290 * Activity. These are ordered from best to worst match -- that
2291 * is, the first item in the list is what is returned by
Dianne Hackborn4d023d22010-10-01 13:41:04 -07002292 * {@link #resolveActivity}. If there are no matching activities, an empty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002293 * list is returned.
2294 *
2295 * @see #MATCH_DEFAULT_ONLY
2296 * @see #GET_INTENT_FILTERS
2297 * @see #GET_RESOLVED_FILTER
2298 */
2299 public abstract List<ResolveInfo> queryIntentActivities(Intent intent,
2300 int flags);
2301
2302 /**
Amith Yamasani151ec4c2012-09-07 19:25:16 -07002303 * Retrieve all activities that can be performed for the given intent, for a specific user.
2304 *
2305 * @param intent The desired intent as per resolveActivity().
2306 * @param flags Additional option flags. The most important is
2307 * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only
2308 * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}.
2309 *
2310 * @return A List&lt;ResolveInfo&gt; containing one entry for each matching
2311 * Activity. These are ordered from best to worst match -- that
2312 * is, the first item in the list is what is returned by
2313 * {@link #resolveActivity}. If there are no matching activities, an empty
2314 * list is returned.
2315 *
2316 * @see #MATCH_DEFAULT_ONLY
2317 * @see #GET_INTENT_FILTERS
2318 * @see #GET_RESOLVED_FILTER
Alexandra Gherghinafa4533f2014-06-24 16:02:39 +01002319 * @see #NO_CROSS_PROFILE
Amith Yamasani151ec4c2012-09-07 19:25:16 -07002320 * @hide
2321 */
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07002322 public abstract List<ResolveInfo> queryIntentActivitiesAsUser(Intent intent,
Amith Yamasani151ec4c2012-09-07 19:25:16 -07002323 int flags, int userId);
2324
2325
2326 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002327 * Retrieve a set of activities that should be presented to the user as
2328 * similar options. This is like {@link #queryIntentActivities}, except it
2329 * also allows you to supply a list of more explicit Intents that you would
2330 * like to resolve to particular options, and takes care of returning the
2331 * final ResolveInfo list in a reasonable order, with no duplicates, based
2332 * on those inputs.
2333 *
2334 * @param caller The class name of the activity that is making the
2335 * request. This activity will never appear in the output
2336 * list. Can be null.
2337 * @param specifics An array of Intents that should be resolved to the
2338 * first specific results. Can be null.
2339 * @param intent The desired intent as per resolveActivity().
2340 * @param flags Additional option flags. The most important is
Dianne Hackborn4d023d22010-10-01 13:41:04 -07002341 * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only
2342 * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002343 *
Dianne Hackborn4d023d22010-10-01 13:41:04 -07002344 * @return A List&lt;ResolveInfo&gt; containing one entry for each matching
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002345 * Activity. These are ordered first by all of the intents resolved
2346 * in <var>specifics</var> and then any additional activities that
2347 * can handle <var>intent</var> but did not get included by one of
2348 * the <var>specifics</var> intents. If there are no matching
2349 * activities, an empty list is returned.
2350 *
2351 * @see #MATCH_DEFAULT_ONLY
2352 * @see #GET_INTENT_FILTERS
2353 * @see #GET_RESOLVED_FILTER
2354 */
2355 public abstract List<ResolveInfo> queryIntentActivityOptions(
2356 ComponentName caller, Intent[] specifics, Intent intent, int flags);
2357
2358 /**
2359 * Retrieve all receivers that can handle a broadcast of the given intent.
2360 *
2361 * @param intent The desired intent as per resolveActivity().
Dianne Hackborn4d023d22010-10-01 13:41:04 -07002362 * @param flags Additional option flags.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002363 *
Dianne Hackborn4d023d22010-10-01 13:41:04 -07002364 * @return A List&lt;ResolveInfo&gt; containing one entry for each matching
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002365 * Receiver. These are ordered from first to last in priority. If
2366 * there are no matching receivers, an empty list is returned.
2367 *
2368 * @see #MATCH_DEFAULT_ONLY
2369 * @see #GET_INTENT_FILTERS
2370 * @see #GET_RESOLVED_FILTER
2371 */
2372 public abstract List<ResolveInfo> queryBroadcastReceivers(Intent intent,
2373 int flags);
2374
2375 /**
Amith Yamasanif203aee2012-08-29 18:41:53 -07002376 * Retrieve all receivers that can handle a broadcast of the given intent, for a specific
2377 * user.
2378 *
2379 * @param intent The desired intent as per resolveActivity().
2380 * @param flags Additional option flags.
2381 * @param userId The userId of the user being queried.
2382 *
2383 * @return A List&lt;ResolveInfo&gt; containing one entry for each matching
2384 * Receiver. These are ordered from first to last in priority. If
2385 * there are no matching receivers, an empty list is returned.
2386 *
2387 * @see #MATCH_DEFAULT_ONLY
2388 * @see #GET_INTENT_FILTERS
2389 * @see #GET_RESOLVED_FILTER
2390 * @hide
2391 */
2392 public abstract List<ResolveInfo> queryBroadcastReceivers(Intent intent,
2393 int flags, int userId);
2394
2395 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002396 * Determine the best service to handle for a given Intent.
2397 *
2398 * @param intent An intent containing all of the desired specification
2399 * (action, data, type, category, and/or component).
2400 * @param flags Additional option flags.
2401 *
2402 * @return Returns a ResolveInfo containing the final service intent that
2403 * was determined to be the best action. Returns null if no
2404 * matching service was found.
2405 *
2406 * @see #GET_INTENT_FILTERS
2407 * @see #GET_RESOLVED_FILTER
2408 */
2409 public abstract ResolveInfo resolveService(Intent intent, int flags);
2410
2411 /**
2412 * Retrieve all services that can match the given intent.
2413 *
2414 * @param intent The desired intent as per resolveService().
2415 * @param flags Additional option flags.
2416 *
Dianne Hackborn4d023d22010-10-01 13:41:04 -07002417 * @return A List&lt;ResolveInfo&gt; containing one entry for each matching
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002418 * ServiceInfo. These are ordered from best to worst match -- that
2419 * is, the first item in the list is what is returned by
2420 * resolveService(). If there are no matching services, an empty
2421 * list is returned.
2422 *
2423 * @see #GET_INTENT_FILTERS
2424 * @see #GET_RESOLVED_FILTER
2425 */
2426 public abstract List<ResolveInfo> queryIntentServices(Intent intent,
2427 int flags);
2428
2429 /**
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07002430 * Retrieve all services that can match the given intent for a given user.
2431 *
2432 * @param intent The desired intent as per resolveService().
2433 * @param flags Additional option flags.
2434 * @param userId The user id.
2435 *
2436 * @return A List&lt;ResolveInfo&gt; containing one entry for each matching
2437 * ServiceInfo. These are ordered from best to worst match -- that
2438 * is, the first item in the list is what is returned by
2439 * resolveService(). If there are no matching services, an empty
2440 * list is returned.
2441 *
2442 * @see #GET_INTENT_FILTERS
2443 * @see #GET_RESOLVED_FILTER
2444 *
2445 * @hide
2446 */
2447 public abstract List<ResolveInfo> queryIntentServicesAsUser(Intent intent,
2448 int flags, int userId);
2449
Jeff Sharkey85f5f812013-10-07 10:16:12 -07002450 /** {@hide} */
2451 public abstract List<ResolveInfo> queryIntentContentProvidersAsUser(
2452 Intent intent, int flags, int userId);
2453
2454 /**
2455 * Retrieve all providers that can match the given intent.
2456 *
2457 * @param intent An intent containing all of the desired specification
2458 * (action, data, type, category, and/or component).
2459 * @param flags Additional option flags.
2460 * @return A List&lt;ResolveInfo&gt; containing one entry for each matching
2461 * ProviderInfo. These are ordered from best to worst match. If
2462 * there are no matching providers, an empty list is returned.
2463 * @see #GET_INTENT_FILTERS
2464 * @see #GET_RESOLVED_FILTER
2465 */
2466 public abstract List<ResolveInfo> queryIntentContentProviders(Intent intent, int flags);
2467
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07002468 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002469 * Find a single content provider by its base path name.
2470 *
2471 * @param name The name of the provider to find.
2472 * @param flags Additional option flags. Currently should always be 0.
2473 *
2474 * @return ContentProviderInfo Information about the provider, if found,
2475 * else null.
2476 */
2477 public abstract ProviderInfo resolveContentProvider(String name,
2478 int flags);
2479
2480 /**
Alexandra Gherghina0363c3e2014-06-23 13:34:59 +01002481 * Find a single content provider by its base path name.
2482 *
2483 * @param name The name of the provider to find.
2484 * @param flags Additional option flags. Currently should always be 0.
2485 * @param userId The user id.
2486 *
2487 * @return ContentProviderInfo Information about the provider, if found,
2488 * else null.
2489 * @hide
2490 */
2491 public abstract ProviderInfo resolveContentProviderAsUser(String name, int flags, int userId);
2492
2493 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002494 * Retrieve content provider information.
2495 *
2496 * <p><em>Note: unlike most other methods, an empty result set is indicated
2497 * by a null return instead of an empty list.</em>
2498 *
2499 * @param processName If non-null, limits the returned providers to only
2500 * those that are hosted by the given process. If null,
2501 * all content providers are returned.
2502 * @param uid If <var>processName</var> is non-null, this is the required
2503 * uid owning the requested content providers.
2504 * @param flags Additional option flags. Currently should always be 0.
2505 *
Dianne Hackborn4d023d22010-10-01 13:41:04 -07002506 * @return A List&lt;ContentProviderInfo&gt; containing one entry for each
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002507 * content provider either patching <var>processName</var> or, if
2508 * <var>processName</var> is null, all known content providers.
2509 * <em>If there are no matching providers, null is returned.</em>
2510 */
2511 public abstract List<ProviderInfo> queryContentProviders(
2512 String processName, int uid, int flags);
2513
2514 /**
2515 * Retrieve all of the information we know about a particular
2516 * instrumentation class.
2517 *
2518 * <p>Throws {@link NameNotFoundException} if instrumentation with the
kmccormick30498b42013-03-27 17:39:17 -07002519 * given class name cannot be found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002520 *
2521 * @param className The full name (i.e.
2522 * com.google.apps.contacts.InstrumentList) of an
2523 * Instrumentation class.
2524 * @param flags Additional option flags. Currently should always be 0.
2525 *
2526 * @return InstrumentationInfo containing information about the
2527 * instrumentation.
2528 */
2529 public abstract InstrumentationInfo getInstrumentationInfo(
2530 ComponentName className, int flags) throws NameNotFoundException;
2531
2532 /**
2533 * Retrieve information about available instrumentation code. May be used
2534 * to retrieve either all instrumentation code, or only the code targeting
2535 * a particular package.
2536 *
2537 * @param targetPackage If null, all instrumentation is returned; only the
2538 * instrumentation targeting this package name is
2539 * returned.
2540 * @param flags Additional option flags. Currently should always be 0.
2541 *
Dianne Hackborn4d023d22010-10-01 13:41:04 -07002542 * @return A List&lt;InstrumentationInfo&gt; containing one entry for each
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002543 * matching available Instrumentation. Returns an empty list if
2544 * there is no instrumentation available for the given package.
2545 */
2546 public abstract List<InstrumentationInfo> queryInstrumentation(
2547 String targetPackage, int flags);
2548
2549 /**
2550 * Retrieve an image from a package. This is a low-level API used by
2551 * the various package manager info structures (such as
2552 * {@link ComponentInfo} to implement retrieval of their associated
2553 * icon.
2554 *
2555 * @param packageName The name of the package that this icon is coming from.
kmccormick30498b42013-03-27 17:39:17 -07002556 * Cannot be null.
2557 * @param resid The resource identifier of the desired image. Cannot be 0.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002558 * @param appInfo Overall information about <var>packageName</var>. This
2559 * may be null, in which case the application information will be retrieved
2560 * for you if needed; if you already have this information around, it can
2561 * be much more efficient to supply it here.
2562 *
2563 * @return Returns a Drawable holding the requested image. Returns null if
2564 * an image could not be found for any reason.
2565 */
2566 public abstract Drawable getDrawable(String packageName, int resid,
2567 ApplicationInfo appInfo);
2568
2569 /**
2570 * Retrieve the icon associated with an activity. Given the full name of
2571 * an activity, retrieves the information about it and calls
2572 * {@link ComponentInfo#loadIcon ComponentInfo.loadIcon()} to return its icon.
kmccormick30498b42013-03-27 17:39:17 -07002573 * If the activity cannot be found, NameNotFoundException is thrown.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002574 *
2575 * @param activityName Name of the activity whose icon is to be retrieved.
2576 *
2577 * @return Returns the image of the icon, or the default activity icon if
2578 * it could not be found. Does not return null.
2579 * @throws NameNotFoundException Thrown if the resources for the given
2580 * activity could not be loaded.
2581 *
2582 * @see #getActivityIcon(Intent)
2583 */
2584 public abstract Drawable getActivityIcon(ComponentName activityName)
2585 throws NameNotFoundException;
2586
2587 /**
2588 * Retrieve the icon associated with an Intent. If intent.getClassName() is
2589 * set, this simply returns the result of
2590 * getActivityIcon(intent.getClassName()). Otherwise it resolves the intent's
2591 * component and returns the icon associated with the resolved component.
kmccormick30498b42013-03-27 17:39:17 -07002592 * If intent.getClassName() cannot be found or the Intent cannot be resolved
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002593 * to a component, NameNotFoundException is thrown.
2594 *
2595 * @param intent The intent for which you would like to retrieve an icon.
2596 *
2597 * @return Returns the image of the icon, or the default activity icon if
2598 * it could not be found. Does not return null.
2599 * @throws NameNotFoundException Thrown if the resources for application
2600 * matching the given intent could not be loaded.
2601 *
2602 * @see #getActivityIcon(ComponentName)
2603 */
2604 public abstract Drawable getActivityIcon(Intent intent)
2605 throws NameNotFoundException;
2606
2607 /**
Jose Limaf78e3122014-03-06 12:13:15 -08002608 * Retrieve the banner associated with an activity. Given the full name of
2609 * an activity, retrieves the information about it and calls
2610 * {@link ComponentInfo#loadIcon ComponentInfo.loadIcon()} to return its
2611 * banner. If the activity cannot be found, NameNotFoundException is thrown.
2612 *
2613 * @param activityName Name of the activity whose banner is to be retrieved.
2614 * @return Returns the image of the banner, or null if the activity has no
2615 * banner specified.
2616 * @throws NameNotFoundException Thrown if the resources for the given
2617 * activity could not be loaded.
2618 * @see #getActivityBanner(Intent)
2619 */
2620 public abstract Drawable getActivityBanner(ComponentName activityName)
2621 throws NameNotFoundException;
2622
2623 /**
2624 * Retrieve the banner associated with an Intent. If intent.getClassName()
2625 * is set, this simply returns the result of
2626 * getActivityBanner(intent.getClassName()). Otherwise it resolves the
2627 * intent's component and returns the banner associated with the resolved
2628 * component. If intent.getClassName() cannot be found or the Intent cannot
2629 * be resolved to a component, NameNotFoundException is thrown.
2630 *
2631 * @param intent The intent for which you would like to retrieve a banner.
2632 * @return Returns the image of the banner, or null if the activity has no
2633 * banner specified.
2634 * @throws NameNotFoundException Thrown if the resources for application
2635 * matching the given intent could not be loaded.
2636 * @see #getActivityBanner(ComponentName)
2637 */
2638 public abstract Drawable getActivityBanner(Intent intent)
2639 throws NameNotFoundException;
2640
2641 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002642 * Return the generic icon for an activity that is used when no specific
2643 * icon is defined.
Adam Connors23cc04e2014-04-01 12:12:20 +01002644 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002645 * @return Drawable Image of the icon.
2646 */
2647 public abstract Drawable getDefaultActivityIcon();
2648
2649 /**
2650 * Retrieve the icon associated with an application. If it has not defined
2651 * an icon, the default app icon is returned. Does not return null.
2652 *
2653 * @param info Information about application being queried.
2654 *
2655 * @return Returns the image of the icon, or the default application icon
2656 * if it could not be found.
2657 *
2658 * @see #getApplicationIcon(String)
2659 */
2660 public abstract Drawable getApplicationIcon(ApplicationInfo info);
2661
2662 /**
2663 * Retrieve the icon associated with an application. Given the name of the
2664 * application's package, retrieves the information about it and calls
kmccormick30498b42013-03-27 17:39:17 -07002665 * getApplicationIcon() to return its icon. If the application cannot be
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002666 * found, NameNotFoundException is thrown.
2667 *
2668 * @param packageName Name of the package whose application icon is to be
2669 * retrieved.
2670 *
2671 * @return Returns the image of the icon, or the default application icon
2672 * if it could not be found. Does not return null.
2673 * @throws NameNotFoundException Thrown if the resources for the given
2674 * application could not be loaded.
2675 *
2676 * @see #getApplicationIcon(ApplicationInfo)
2677 */
2678 public abstract Drawable getApplicationIcon(String packageName)
2679 throws NameNotFoundException;
2680
2681 /**
Jose Limaf78e3122014-03-06 12:13:15 -08002682 * Retrieve the banner associated with an application.
2683 *
2684 * @param info Information about application being queried.
2685 * @return Returns the image of the banner or null if the application has no
2686 * banner specified.
2687 * @see #getApplicationBanner(String)
2688 */
2689 public abstract Drawable getApplicationBanner(ApplicationInfo info);
2690
2691 /**
2692 * Retrieve the banner associated with an application. Given the name of the
2693 * application's package, retrieves the information about it and calls
2694 * getApplicationIcon() to return its banner. If the application cannot be
2695 * found, NameNotFoundException is thrown.
2696 *
2697 * @param packageName Name of the package whose application banner is to be
2698 * retrieved.
2699 * @return Returns the image of the banner or null if the application has no
2700 * banner specified.
2701 * @throws NameNotFoundException Thrown if the resources for the given
2702 * application could not be loaded.
2703 * @see #getApplicationBanner(ApplicationInfo)
2704 */
2705 public abstract Drawable getApplicationBanner(String packageName)
2706 throws NameNotFoundException;
2707
2708 /**
2709 * Retrieve the logo associated with an activity. Given the full name of an
2710 * activity, retrieves the information about it and calls
2711 * {@link ComponentInfo#loadLogo ComponentInfo.loadLogo()} to return its
2712 * logo. If the activity cannot be found, NameNotFoundException is thrown.
Adam Powell81cd2e92010-04-21 16:35:18 -07002713 *
2714 * @param activityName Name of the activity whose logo is to be retrieved.
Jose Limaf78e3122014-03-06 12:13:15 -08002715 * @return Returns the image of the logo or null if the activity has no logo
2716 * specified.
Adam Powell81cd2e92010-04-21 16:35:18 -07002717 * @throws NameNotFoundException Thrown if the resources for the given
Jose Limaf78e3122014-03-06 12:13:15 -08002718 * activity could not be loaded.
Adam Powell81cd2e92010-04-21 16:35:18 -07002719 * @see #getActivityLogo(Intent)
2720 */
2721 public abstract Drawable getActivityLogo(ComponentName activityName)
2722 throws NameNotFoundException;
2723
2724 /**
2725 * Retrieve the logo associated with an Intent. If intent.getClassName() is
2726 * set, this simply returns the result of
2727 * getActivityLogo(intent.getClassName()). Otherwise it resolves the intent's
2728 * component and returns the logo associated with the resolved component.
kmccormick30498b42013-03-27 17:39:17 -07002729 * If intent.getClassName() cannot be found or the Intent cannot be resolved
Adam Powell81cd2e92010-04-21 16:35:18 -07002730 * to a component, NameNotFoundException is thrown.
2731 *
2732 * @param intent The intent for which you would like to retrieve a logo.
2733 *
2734 * @return Returns the image of the logo, or null if the activity has no
2735 * logo specified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002736 *
Adam Powell81cd2e92010-04-21 16:35:18 -07002737 * @throws NameNotFoundException Thrown if the resources for application
2738 * matching the given intent could not be loaded.
2739 *
2740 * @see #getActivityLogo(ComponentName)
2741 */
2742 public abstract Drawable getActivityLogo(Intent intent)
2743 throws NameNotFoundException;
2744
2745 /**
2746 * Retrieve the logo associated with an application. If it has not specified
2747 * a logo, this method returns null.
2748 *
2749 * @param info Information about application being queried.
2750 *
2751 * @return Returns the image of the logo, or null if no logo is specified
2752 * by the application.
2753 *
2754 * @see #getApplicationLogo(String)
2755 */
2756 public abstract Drawable getApplicationLogo(ApplicationInfo info);
2757
2758 /**
2759 * Retrieve the logo associated with an application. Given the name of the
2760 * application's package, retrieves the information about it and calls
kmccormick30498b42013-03-27 17:39:17 -07002761 * getApplicationLogo() to return its logo. If the application cannot be
Adam Powell81cd2e92010-04-21 16:35:18 -07002762 * found, NameNotFoundException is thrown.
2763 *
2764 * @param packageName Name of the package whose application logo is to be
2765 * retrieved.
2766 *
2767 * @return Returns the image of the logo, or null if no application logo
2768 * has been specified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002769 *
Adam Powell81cd2e92010-04-21 16:35:18 -07002770 * @throws NameNotFoundException Thrown if the resources for the given
2771 * application could not be loaded.
2772 *
2773 * @see #getApplicationLogo(ApplicationInfo)
2774 */
2775 public abstract Drawable getApplicationLogo(String packageName)
2776 throws NameNotFoundException;
2777
2778 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002779 * Retrieve text from a package. This is a low-level API used by
2780 * the various package manager info structures (such as
2781 * {@link ComponentInfo} to implement retrieval of their associated
2782 * labels and other text.
2783 *
2784 * @param packageName The name of the package that this text is coming from.
kmccormick30498b42013-03-27 17:39:17 -07002785 * Cannot be null.
2786 * @param resid The resource identifier of the desired text. Cannot be 0.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002787 * @param appInfo Overall information about <var>packageName</var>. This
2788 * may be null, in which case the application information will be retrieved
2789 * for you if needed; if you already have this information around, it can
2790 * be much more efficient to supply it here.
2791 *
2792 * @return Returns a CharSequence holding the requested text. Returns null
2793 * if the text could not be found for any reason.
2794 */
2795 public abstract CharSequence getText(String packageName, int resid,
2796 ApplicationInfo appInfo);
2797
2798 /**
2799 * Retrieve an XML file from a package. This is a low-level API used to
2800 * retrieve XML meta data.
2801 *
2802 * @param packageName The name of the package that this xml is coming from.
kmccormick30498b42013-03-27 17:39:17 -07002803 * Cannot be null.
2804 * @param resid The resource identifier of the desired xml. Cannot be 0.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002805 * @param appInfo Overall information about <var>packageName</var>. This
2806 * may be null, in which case the application information will be retrieved
2807 * for you if needed; if you already have this information around, it can
2808 * be much more efficient to supply it here.
2809 *
2810 * @return Returns an XmlPullParser allowing you to parse out the XML
2811 * data. Returns null if the xml resource could not be found for any
2812 * reason.
2813 */
2814 public abstract XmlResourceParser getXml(String packageName, int resid,
2815 ApplicationInfo appInfo);
2816
2817 /**
2818 * Return the label to use for this application.
2819 *
2820 * @return Returns the label associated with this application, or null if
2821 * it could not be found for any reason.
kmccormick30498b42013-03-27 17:39:17 -07002822 * @param info The application to get the label of.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002823 */
2824 public abstract CharSequence getApplicationLabel(ApplicationInfo info);
2825
2826 /**
2827 * Retrieve the resources associated with an activity. Given the full
2828 * name of an activity, retrieves the information about it and calls
2829 * getResources() to return its application's resources. If the activity
kmccormick30498b42013-03-27 17:39:17 -07002830 * cannot be found, NameNotFoundException is thrown.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002831 *
2832 * @param activityName Name of the activity whose resources are to be
2833 * retrieved.
2834 *
2835 * @return Returns the application's Resources.
2836 * @throws NameNotFoundException Thrown if the resources for the given
2837 * application could not be loaded.
2838 *
2839 * @see #getResourcesForApplication(ApplicationInfo)
2840 */
2841 public abstract Resources getResourcesForActivity(ComponentName activityName)
2842 throws NameNotFoundException;
2843
2844 /**
2845 * Retrieve the resources for an application. Throws NameNotFoundException
2846 * if the package is no longer installed.
2847 *
2848 * @param app Information about the desired application.
2849 *
2850 * @return Returns the application's Resources.
2851 * @throws NameNotFoundException Thrown if the resources for the given
2852 * application could not be loaded (most likely because it was uninstalled).
2853 */
2854 public abstract Resources getResourcesForApplication(ApplicationInfo app)
2855 throws NameNotFoundException;
2856
2857 /**
2858 * Retrieve the resources associated with an application. Given the full
2859 * package name of an application, retrieves the information about it and
2860 * calls getResources() to return its application's resources. If the
kmccormick30498b42013-03-27 17:39:17 -07002861 * appPackageName cannot be found, NameNotFoundException is thrown.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002862 *
2863 * @param appPackageName Package name of the application whose resources
2864 * are to be retrieved.
2865 *
2866 * @return Returns the application's Resources.
2867 * @throws NameNotFoundException Thrown if the resources for the given
2868 * application could not be loaded.
2869 *
2870 * @see #getResourcesForApplication(ApplicationInfo)
2871 */
2872 public abstract Resources getResourcesForApplication(String appPackageName)
2873 throws NameNotFoundException;
2874
Amith Yamasani98edc952012-09-25 14:09:27 -07002875 /** @hide */
2876 public abstract Resources getResourcesForApplicationAsUser(String appPackageName, int userId)
2877 throws NameNotFoundException;
2878
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002879 /**
2880 * Retrieve overall information about an application package defined
2881 * in a package archive file
2882 *
2883 * @param archiveFilePath The path to the archive file
2884 * @param flags Additional option flags. Use any combination of
2885 * {@link #GET_ACTIVITIES},
2886 * {@link #GET_GIDS},
2887 * {@link #GET_CONFIGURATIONS},
2888 * {@link #GET_INSTRUMENTATION},
2889 * {@link #GET_PERMISSIONS},
2890 * {@link #GET_PROVIDERS},
2891 * {@link #GET_RECEIVERS},
2892 * {@link #GET_SERVICES},
2893 * {@link #GET_SIGNATURES}, to modify the data returned.
2894 *
2895 * @return Returns the information about the package. Returns
2896 * null if the package could not be successfully parsed.
2897 *
2898 * @see #GET_ACTIVITIES
2899 * @see #GET_GIDS
2900 * @see #GET_CONFIGURATIONS
2901 * @see #GET_INSTRUMENTATION
2902 * @see #GET_PERMISSIONS
2903 * @see #GET_PROVIDERS
2904 * @see #GET_RECEIVERS
2905 * @see #GET_SERVICES
2906 * @see #GET_SIGNATURES
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002907 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002908 */
2909 public PackageInfo getPackageArchiveInfo(String archiveFilePath, int flags) {
Jeff Sharkey275e0852014-06-17 18:18:49 -07002910 final PackageParser parser = new PackageParser();
2911 final File apkFile = new File(archiveFilePath);
Jeff Sharkeyc4858a22014-06-16 10:51:20 -07002912 try {
Jeff Sharkey275e0852014-06-17 18:18:49 -07002913 PackageParser.Package pkg = parser.parseMonolithicPackage(apkFile, 0);
Jeff Sharkeyc4858a22014-06-16 10:51:20 -07002914 if ((flags & GET_SIGNATURES) != 0) {
Jeff Sharkey275e0852014-06-17 18:18:49 -07002915 parser.collectCertificates(pkg, 0);
Jeff Sharkey032f2b22014-06-19 15:48:47 -07002916 parser.collectManifestDigest(pkg);
Jeff Sharkeyc4858a22014-06-16 10:51:20 -07002917 }
2918 PackageUserState state = new PackageUserState();
2919 return PackageParser.generatePackageInfo(pkg, null, flags, 0, 0, null, state);
2920 } catch (PackageParserException e) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002921 return null;
2922 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002923 }
2924
2925 /**
Dianne Hackbornade3eca2009-05-11 18:54:45 -07002926 * @hide
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002927 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002928 * Install a package. Since this may take a little while, the result will
2929 * be posted back to the given observer. An installation will fail if the calling context
2930 * lacks the {@link android.Manifest.permission#INSTALL_PACKAGES} permission, if the
2931 * package named in the package file's manifest is already installed, or if there's no space
2932 * available on the device.
2933 *
2934 * @param packageURI The location of the package file to install. This can be a 'file:' or a
2935 * 'content:' URI.
2936 * @param observer An observer callback to get notified when the package installation is
2937 * complete. {@link IPackageInstallObserver#packageInstalled(String, int)} will be
Christopher Tatef1977b42014-03-24 16:25:51 -07002938 * called when that happens. This parameter must not be null.
Dianne Hackbornade3eca2009-05-11 18:54:45 -07002939 * @param flags - possible values: {@link #INSTALL_FORWARD_LOCK},
2940 * {@link #INSTALL_REPLACE_EXISTING}, {@link #INSTALL_ALLOW_TEST}.
Jacek Surazski65e13172009-04-28 15:26:38 +02002941 * @param installerPackageName Optional package name of the application that is performing the
2942 * installation. This identifies which market the package came from.
Christopher Tatef1977b42014-03-24 16:25:51 -07002943 * @deprecated Use {@link #installPackage(Uri, IPackageInstallObserver2, int, String)}
2944 * instead. This method will continue to be supported but the older observer interface
2945 * will not get additional failure details.
Jacek Surazski65e13172009-04-28 15:26:38 +02002946 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07002947 // @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002948 public abstract void installPackage(
Jacek Surazski65e13172009-04-28 15:26:38 +02002949 Uri packageURI, IPackageInstallObserver observer, int flags,
2950 String installerPackageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002951
2952 /**
Kenny Root5ab21572011-07-27 11:11:19 -07002953 * Similar to
2954 * {@link #installPackage(Uri, IPackageInstallObserver, int, String)} but
2955 * with an extra verification file provided.
2956 *
2957 * @param packageURI The location of the package file to install. This can
2958 * be a 'file:' or a 'content:' URI.
2959 * @param observer An observer callback to get notified when the package
2960 * installation is complete.
2961 * {@link IPackageInstallObserver#packageInstalled(String, int)}
Christopher Tatef1977b42014-03-24 16:25:51 -07002962 * will be called when that happens. This parameter must not be null.
Christopher Tateab8a5012014-03-24 16:25:51 -07002963 * @param flags - possible values: {@link #INSTALL_FORWARD_LOCK},
Christopher Tatef1977b42014-03-24 16:25:51 -07002964 * {@link #INSTALL_REPLACE_EXISTING}, {@link #INSTALL_ALLOW_TEST}.
Christopher Tateab8a5012014-03-24 16:25:51 -07002965 * @param installerPackageName Optional package name of the application that
2966 * is performing the installation. This identifies which market
2967 * the package came from.
2968 * @param verificationURI The location of the supplementary verification
2969 * file. This can be a 'file:' or a 'content:' URI. May be
2970 * {@code null}.
2971 * @param manifestDigest an object that holds the digest of the package
2972 * which can be used to verify ownership. May be {@code null}.
2973 * @param encryptionParams if the package to be installed is encrypted,
2974 * these parameters describing the encryption and authentication
2975 * used. May be {@code null}.
2976 * @hide
Christopher Tatef1977b42014-03-24 16:25:51 -07002977 * @deprecated Use {@link #installPackageWithVerification(Uri, IPackageInstallObserver2,
2978 * int, String, Uri, ManifestDigest, ContainerEncryptionParams)} instead. This method will
2979 * continue to be supported but the older observer interface will not get additional failure
2980 * details.
Christopher Tateab8a5012014-03-24 16:25:51 -07002981 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07002982 // @SystemApi
Christopher Tateab8a5012014-03-24 16:25:51 -07002983 public abstract void installPackageWithVerification(Uri packageURI,
2984 IPackageInstallObserver observer, int flags, String installerPackageName,
2985 Uri verificationURI, ManifestDigest manifestDigest,
2986 ContainerEncryptionParams encryptionParams);
2987
2988 /**
2989 * Similar to
2990 * {@link #installPackage(Uri, IPackageInstallObserver, int, String)} but
2991 * with an extra verification information provided.
2992 *
2993 * @param packageURI The location of the package file to install. This can
2994 * be a 'file:' or a 'content:' URI.
2995 * @param observer An observer callback to get notified when the package
2996 * installation is complete.
2997 * {@link IPackageInstallObserver#packageInstalled(String, int)}
Christopher Tatef1977b42014-03-24 16:25:51 -07002998 * will be called when that happens. This parameter must not be null.
Christopher Tateab8a5012014-03-24 16:25:51 -07002999 * @param flags - possible values: {@link #INSTALL_FORWARD_LOCK},
Christopher Tatef1977b42014-03-24 16:25:51 -07003000 * {@link #INSTALL_REPLACE_EXISTING}, {@link #INSTALL_ALLOW_TEST}.
3001 * @param installerPackageName Optional package name of the application that
3002 * is performing the installation. This identifies which market
3003 * the package came from.
3004 * @param verificationParams an object that holds signal information to
3005 * assist verification. May be {@code null}.
3006 * @param encryptionParams if the package to be installed is encrypted,
3007 * these parameters describing the encryption and authentication
3008 * used. May be {@code null}.
3009 *
3010 * @hide
3011 * @deprecated Use {@link #installPackageWithVerificationAndEncryption(Uri,
3012 * IPackageInstallObserver2, int, String, VerificationParams,
3013 * ContainerEncryptionParams)} instead. This method will continue to be
3014 * supported but the older observer interface will not get additional failure details.
3015 */
3016 @Deprecated
3017 public abstract void installPackageWithVerificationAndEncryption(Uri packageURI,
3018 IPackageInstallObserver observer, int flags, String installerPackageName,
3019 VerificationParams verificationParams,
3020 ContainerEncryptionParams encryptionParams);
3021
3022 // Package-install variants that take the new, expanded form of observer interface.
3023 // Note that these *also* take the original observer type and will redundantly
3024 // report the same information to that observer if supplied; but it is not required.
3025
3026 /**
3027 * @hide
3028 *
3029 * Install a package. Since this may take a little while, the result will
3030 * be posted back to the given observer. An installation will fail if the calling context
3031 * lacks the {@link android.Manifest.permission#INSTALL_PACKAGES} permission, if the
3032 * package named in the package file's manifest is already installed, or if there's no space
3033 * available on the device.
3034 *
3035 * @param packageURI The location of the package file to install. This can be a 'file:' or a
3036 * 'content:' URI.
3037 * @param observer An observer callback to get notified when the package installation is
3038 * complete. {@link PackageInstallObserver#packageInstalled(String, Bundle, int)} will be
3039 * called when that happens. This parameter must not be null.
3040 * @param flags - possible values: {@link #INSTALL_FORWARD_LOCK},
3041 * {@link #INSTALL_REPLACE_EXISTING}, {@link #INSTALL_ALLOW_TEST}.
3042 * @param installerPackageName Optional package name of the application that is performing the
3043 * installation. This identifies which market the package came from.
3044 */
3045 public abstract void installPackage(
3046 Uri packageURI, PackageInstallObserver observer,
3047 int flags, String installerPackageName);
3048
3049 /**
3050 * Similar to
3051 * {@link #installPackage(Uri, IPackageInstallObserver, int, String)} but
3052 * with an extra verification file provided.
3053 *
3054 * @param packageURI The location of the package file to install. This can
3055 * be a 'file:' or a 'content:' URI.
3056 * @param observer An observer callback to get notified when the package installation is
3057 * complete. {@link PackageInstallObserver#packageInstalled(String, Bundle, int)} will be
3058 * called when that happens. This parameter must not be null.
3059 * @param flags - possible values: {@link #INSTALL_FORWARD_LOCK},
3060 * {@link #INSTALL_REPLACE_EXISTING}, {@link #INSTALL_ALLOW_TEST}.
3061 * @param installerPackageName Optional package name of the application that
3062 * is performing the installation. This identifies which market
3063 * the package came from.
3064 * @param verificationURI The location of the supplementary verification
3065 * file. This can be a 'file:' or a 'content:' URI. May be
3066 * {@code null}.
3067 * @param manifestDigest an object that holds the digest of the package
3068 * which can be used to verify ownership. May be {@code null}.
3069 * @param encryptionParams if the package to be installed is encrypted,
3070 * these parameters describing the encryption and authentication
3071 * used. May be {@code null}.
3072 * @hide
3073 */
3074 public abstract void installPackageWithVerification(Uri packageURI,
3075 PackageInstallObserver observer, int flags, String installerPackageName,
3076 Uri verificationURI, ManifestDigest manifestDigest,
3077 ContainerEncryptionParams encryptionParams);
3078
3079 /**
3080 * Similar to
3081 * {@link #installPackage(Uri, IPackageInstallObserver, int, String)} but
3082 * with an extra verification information provided.
3083 *
3084 * @param packageURI The location of the package file to install. This can
3085 * be a 'file:' or a 'content:' URI.
3086 * @param observer An observer callback to get notified when the package installation is
3087 * complete. {@link PackageInstallObserver#packageInstalled(String, Bundle, int)} will be
3088 * called when that happens. This parameter must not be null.
3089 * @param flags - possible values: {@link #INSTALL_FORWARD_LOCK},
3090 * {@link #INSTALL_REPLACE_EXISTING}, {@link #INSTALL_ALLOW_TEST}.
Christopher Tateab8a5012014-03-24 16:25:51 -07003091 * @param installerPackageName Optional package name of the application that
3092 * is performing the installation. This identifies which market
3093 * the package came from.
3094 * @param verificationParams an object that holds signal information to
3095 * assist verification. May be {@code null}.
3096 * @param encryptionParams if the package to be installed is encrypted,
3097 * these parameters describing the encryption and authentication
3098 * used. May be {@code null}.
3099 *
3100 * @hide
Christopher Tateab8a5012014-03-24 16:25:51 -07003101 */
Christopher Tateab8a5012014-03-24 16:25:51 -07003102 public abstract void installPackageWithVerificationAndEncryption(Uri packageURI,
Christopher Tatef1977b42014-03-24 16:25:51 -07003103 PackageInstallObserver observer, int flags, String installerPackageName,
3104 VerificationParams verificationParams, ContainerEncryptionParams encryptionParams);
Christopher Tateab8a5012014-03-24 16:25:51 -07003105
rich cannings706e8ba2012-08-20 13:20:14 -07003106 /**
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003107 * If there is already an application with the given package name installed
3108 * on the system for other users, also install it for the calling user.
3109 * @hide
3110 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07003111 // @SystemApi
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003112 public abstract int installExistingPackage(String packageName)
3113 throws NameNotFoundException;
3114
3115 /**
Kenny Root5ab21572011-07-27 11:11:19 -07003116 * Allows a package listening to the
3117 * {@link Intent#ACTION_PACKAGE_NEEDS_VERIFICATION package verification
Kenny Root3a9b5fb2011-09-20 14:15:38 -07003118 * broadcast} to respond to the package manager. The response must include
3119 * the {@code verificationCode} which is one of
3120 * {@link PackageManager#VERIFICATION_ALLOW} or
3121 * {@link PackageManager#VERIFICATION_REJECT}.
Kenny Root5ab21572011-07-27 11:11:19 -07003122 *
3123 * @param id pending package identifier as passed via the
kmccormick30498b42013-03-27 17:39:17 -07003124 * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra.
Kenny Root3a9b5fb2011-09-20 14:15:38 -07003125 * @param verificationCode either {@link PackageManager#VERIFICATION_ALLOW}
3126 * or {@link PackageManager#VERIFICATION_REJECT}.
rich cannings7e671512012-08-27 14:44:16 -07003127 * @throws SecurityException if the caller does not have the
Dianne Hackborn8832c182012-09-17 17:20:24 -07003128 * PACKAGE_VERIFICATION_AGENT permission.
Kenny Root5ab21572011-07-27 11:11:19 -07003129 */
Kenny Root3a9b5fb2011-09-20 14:15:38 -07003130 public abstract void verifyPendingInstall(int id, int verificationCode);
Kenny Root5ab21572011-07-27 11:11:19 -07003131
3132 /**
rich canningsd9ef3e52012-08-22 14:28:05 -07003133 * Allows a package listening to the
3134 * {@link Intent#ACTION_PACKAGE_NEEDS_VERIFICATION package verification
3135 * broadcast} to extend the default timeout for a response and declare what
3136 * action to perform after the timeout occurs. The response must include
3137 * the {@code verificationCodeAtTimeout} which is one of
3138 * {@link PackageManager#VERIFICATION_ALLOW} or
3139 * {@link PackageManager#VERIFICATION_REJECT}.
3140 *
3141 * This method may only be called once per package id. Additional calls
3142 * will have no effect.
3143 *
3144 * @param id pending package identifier as passed via the
kmccormick30498b42013-03-27 17:39:17 -07003145 * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra.
rich canningsd9ef3e52012-08-22 14:28:05 -07003146 * @param verificationCodeAtTimeout either
3147 * {@link PackageManager#VERIFICATION_ALLOW} or
rich canningsd1b5cfc2012-08-29 14:49:51 -07003148 * {@link PackageManager#VERIFICATION_REJECT}. If
3149 * {@code verificationCodeAtTimeout} is neither
3150 * {@link PackageManager#VERIFICATION_ALLOW} or
3151 * {@link PackageManager#VERIFICATION_REJECT}, then
3152 * {@code verificationCodeAtTimeout} will default to
rich canningsd9ef3e52012-08-22 14:28:05 -07003153 * {@link PackageManager#VERIFICATION_REJECT}.
3154 * @param millisecondsToDelay the amount of time requested for the timeout.
3155 * Must be positive and less than
rich canningsd1b5cfc2012-08-29 14:49:51 -07003156 * {@link PackageManager#MAXIMUM_VERIFICATION_TIMEOUT}. If
3157 * {@code millisecondsToDelay} is out of bounds,
3158 * {@code millisecondsToDelay} will be set to the closest in
3159 * bounds value; namely, 0 or
rich canningsd9ef3e52012-08-22 14:28:05 -07003160 * {@link PackageManager#MAXIMUM_VERIFICATION_TIMEOUT}.
rich cannings7e671512012-08-27 14:44:16 -07003161 * @throws SecurityException if the caller does not have the
Dianne Hackborn8832c182012-09-17 17:20:24 -07003162 * PACKAGE_VERIFICATION_AGENT permission.
rich canningsd9ef3e52012-08-22 14:28:05 -07003163 */
3164 public abstract void extendVerificationTimeout(int id,
3165 int verificationCodeAtTimeout, long millisecondsToDelay);
3166
3167 /**
Dianne Hackborn880119b2010-11-18 22:26:40 -08003168 * Change the installer associated with a given package. There are limitations
3169 * on how the installer package can be changed; in particular:
3170 * <ul>
3171 * <li> A SecurityException will be thrown if <var>installerPackageName</var>
3172 * is not signed with the same certificate as the calling application.
3173 * <li> A SecurityException will be thrown if <var>targetPackage</var> already
3174 * has an installer package, and that installer package is not signed with
3175 * the same certificate as the calling application.
3176 * </ul>
3177 *
3178 * @param targetPackage The installed package whose installer will be changed.
3179 * @param installerPackageName The package name of the new installer. May be
3180 * null to clear the association.
3181 */
3182 public abstract void setInstallerPackageName(String targetPackage,
3183 String installerPackageName);
3184
3185 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003186 * Attempts to delete a package. Since this may take a little while, the result will
3187 * be posted back to the given observer. A deletion will fail if the calling context
3188 * lacks the {@link android.Manifest.permission#DELETE_PACKAGES} permission, if the
3189 * named package cannot be found, or if the named package is a "system package".
3190 * (TODO: include pointer to documentation on "system packages")
3191 *
3192 * @param packageName The name of the package to delete
3193 * @param observer An observer callback to get notified when the package deletion is
3194 * complete. {@link android.content.pm.IPackageDeleteObserver#packageDeleted(boolean)} will be
3195 * called when that happens. observer may be null to indicate that no callback is desired.
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003196 * @param flags - possible values: {@link #DELETE_KEEP_DATA},
3197 * {@link #DELETE_ALL_USERS}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003198 *
3199 * @hide
3200 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07003201 // @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003202 public abstract void deletePackage(
3203 String packageName, IPackageDeleteObserver observer, int flags);
Jacek Surazski65e13172009-04-28 15:26:38 +02003204
3205 /**
3206 * Retrieve the package name of the application that installed a package. This identifies
3207 * which market the package came from.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003208 *
Jacek Surazski65e13172009-04-28 15:26:38 +02003209 * @param packageName The name of the package to query
3210 */
3211 public abstract String getInstallerPackageName(String packageName);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003212
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003213 /**
3214 * Attempts to clear the user data directory of an application.
3215 * Since this may take a little while, the result will
3216 * be posted back to the given observer. A deletion will fail if the
3217 * named package cannot be found, or if the named package is a "system package".
3218 *
3219 * @param packageName The name of the package
3220 * @param observer An observer callback to get notified when the operation is finished
3221 * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)}
3222 * will be called when that happens. observer may be null to indicate that
3223 * no callback is desired.
3224 *
3225 * @hide
3226 */
3227 public abstract void clearApplicationUserData(String packageName,
3228 IPackageDataObserver observer);
3229 /**
3230 * Attempts to delete the cache files associated with an application.
3231 * Since this may take a little while, the result will
3232 * be posted back to the given observer. A deletion will fail if the calling context
3233 * lacks the {@link android.Manifest.permission#DELETE_CACHE_FILES} permission, if the
3234 * named package cannot be found, or if the named package is a "system package".
3235 *
3236 * @param packageName The name of the package to delete
3237 * @param observer An observer callback to get notified when the cache file deletion
3238 * is complete.
3239 * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)}
3240 * will be called when that happens. observer may be null to indicate that
3241 * no callback is desired.
3242 *
3243 * @hide
3244 */
3245 public abstract void deleteApplicationCacheFiles(String packageName,
3246 IPackageDataObserver observer);
3247
3248 /**
3249 * Free storage by deleting LRU sorted list of cache files across
3250 * all applications. If the currently available free storage
3251 * on the device is greater than or equal to the requested
3252 * free storage, no cache files are cleared. If the currently
3253 * available storage on the device is less than the requested
3254 * free storage, some or all of the cache files across
3255 * all applications are deleted (based on last accessed time)
3256 * to increase the free storage space on the device to
3257 * the requested value. There is no guarantee that clearing all
3258 * the cache files from all applications will clear up
3259 * enough storage to achieve the desired value.
3260 * @param freeStorageSize The number of bytes of storage to be
3261 * freed by the system. Say if freeStorageSize is XX,
3262 * and the current free storage is YY,
3263 * if XX is less than YY, just return. if not free XX-YY number
3264 * of bytes if possible.
3265 * @param observer call back used to notify when
3266 * the operation is completed
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003267 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003268 * @hide
3269 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07003270 // @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003271 public abstract void freeStorageAndNotify(long freeStorageSize, IPackageDataObserver observer);
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -07003272
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003273 /**
3274 * Free storage by deleting LRU sorted list of cache files across
3275 * all applications. If the currently available free storage
3276 * on the device is greater than or equal to the requested
3277 * free storage, no cache files are cleared. If the currently
3278 * available storage on the device is less than the requested
3279 * free storage, some or all of the cache files across
3280 * all applications are deleted (based on last accessed time)
3281 * to increase the free storage space on the device to
3282 * the requested value. There is no guarantee that clearing all
3283 * the cache files from all applications will clear up
3284 * enough storage to achieve the desired value.
3285 * @param freeStorageSize The number of bytes of storage to be
3286 * freed by the system. Say if freeStorageSize is XX,
3287 * and the current free storage is YY,
3288 * if XX is less than YY, just return. if not free XX-YY number
3289 * of bytes if possible.
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -07003290 * @param pi IntentSender call back used to
3291 * notify when the operation is completed.May be null
3292 * to indicate that no call back is desired.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003293 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003294 * @hide
3295 */
Suchi Amalapurapubc806f62009-06-17 15:18:19 -07003296 public abstract void freeStorage(long freeStorageSize, IntentSender pi);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003297
3298 /**
3299 * Retrieve the size information for a package.
3300 * Since this may take a little while, the result will
3301 * be posted back to the given observer. The calling context
3302 * should have the {@link android.Manifest.permission#GET_PACKAGE_SIZE} permission.
3303 *
3304 * @param packageName The name of the package whose size information is to be retrieved
Dianne Hackborn0c380492012-08-20 17:23:30 -07003305 * @param userHandle The user whose size information should be retrieved.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003306 * @param observer An observer callback to get notified when the operation
3307 * is complete.
3308 * {@link android.content.pm.IPackageStatsObserver#onGetStatsCompleted(PackageStats, boolean)}
3309 * The observer's callback is invoked with a PackageStats object(containing the
3310 * code, data and cache sizes of the package) and a boolean value representing
3311 * the status of the operation. observer may be null to indicate that
3312 * no callback is desired.
3313 *
3314 * @hide
3315 */
Dianne Hackborn0c380492012-08-20 17:23:30 -07003316 public abstract void getPackageSizeInfo(String packageName, int userHandle,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003317 IPackageStatsObserver observer);
3318
3319 /**
Dianne Hackborn0c380492012-08-20 17:23:30 -07003320 * Like {@link #getPackageSizeInfo(String, int, IPackageStatsObserver)}, but
3321 * returns the size for the calling user.
3322 *
3323 * @hide
3324 */
3325 public void getPackageSizeInfo(String packageName, IPackageStatsObserver observer) {
3326 getPackageSizeInfo(packageName, UserHandle.myUserId(), observer);
3327 }
3328
3329 /**
Dianne Hackborna7ca0e52009-12-01 14:31:55 -08003330 * @deprecated This function no longer does anything; it was an old
kmccormickac66b852013-03-28 15:17:15 -07003331 * approach to managing preferred activities, which has been superseded
3332 * by (and conflicts with) the modern activity-based preferences.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003333 */
Dianne Hackborna7ca0e52009-12-01 14:31:55 -08003334 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003335 public abstract void addPackageToPreferred(String packageName);
3336
3337 /**
Dianne Hackborna7ca0e52009-12-01 14:31:55 -08003338 * @deprecated This function no longer does anything; it was an old
kmccormickac66b852013-03-28 15:17:15 -07003339 * approach to managing preferred activities, which has been superseded
3340 * by (and conflicts with) the modern activity-based preferences.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003341 */
Dianne Hackborna7ca0e52009-12-01 14:31:55 -08003342 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003343 public abstract void removePackageFromPreferred(String packageName);
3344
3345 /**
3346 * Retrieve the list of all currently configured preferred packages. The
3347 * first package on the list is the most preferred, the last is the
3348 * least preferred.
3349 *
3350 * @param flags Additional option flags. Use any combination of
3351 * {@link #GET_ACTIVITIES},
3352 * {@link #GET_GIDS},
3353 * {@link #GET_CONFIGURATIONS},
3354 * {@link #GET_INSTRUMENTATION},
3355 * {@link #GET_PERMISSIONS},
3356 * {@link #GET_PROVIDERS},
3357 * {@link #GET_RECEIVERS},
3358 * {@link #GET_SERVICES},
3359 * {@link #GET_SIGNATURES}, to modify the data returned.
3360 *
3361 * @return Returns a list of PackageInfo objects describing each
3362 * preferred application, in order of preference.
3363 *
3364 * @see #GET_ACTIVITIES
3365 * @see #GET_GIDS
3366 * @see #GET_CONFIGURATIONS
3367 * @see #GET_INSTRUMENTATION
3368 * @see #GET_PERMISSIONS
3369 * @see #GET_PROVIDERS
3370 * @see #GET_RECEIVERS
3371 * @see #GET_SERVICES
3372 * @see #GET_SIGNATURES
3373 */
3374 public abstract List<PackageInfo> getPreferredPackages(int flags);
3375
3376 /**
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08003377 * @deprecated This is a protected API that should not have been available
3378 * to third party applications. It is the platform's responsibility for
kmccormick30498b42013-03-27 17:39:17 -07003379 * assigning preferred activities and this cannot be directly modified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003380 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003381 * Add a new preferred activity mapping to the system. This will be used
3382 * to automatically select the given activity component when
3383 * {@link Context#startActivity(Intent) Context.startActivity()} finds
3384 * multiple matching activities and also matches the given filter.
3385 *
3386 * @param filter The set of intents under which this activity will be
3387 * made preferred.
3388 * @param match The IntentFilter match category that this preference
3389 * applies to.
3390 * @param set The set of activities that the user was picking from when
3391 * this preference was made.
3392 * @param activity The component name of the activity that is to be
3393 * preferred.
3394 */
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08003395 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003396 public abstract void addPreferredActivity(IntentFilter filter, int match,
3397 ComponentName[] set, ComponentName activity);
3398
3399 /**
Amith Yamasania3f133a2012-08-09 17:11:28 -07003400 * Same as {@link #addPreferredActivity(IntentFilter, int,
3401 ComponentName[], ComponentName)}, but with a specific userId to apply the preference
3402 to.
3403 * @hide
3404 */
3405 public void addPreferredActivity(IntentFilter filter, int match,
3406 ComponentName[] set, ComponentName activity, int userId) {
3407 throw new RuntimeException("Not implemented. Must override in a subclass.");
3408 }
3409
3410 /**
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08003411 * @deprecated This is a protected API that should not have been available
3412 * to third party applications. It is the platform's responsibility for
kmccormick30498b42013-03-27 17:39:17 -07003413 * assigning preferred activities and this cannot be directly modified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003414 *
Satish Sampath8dbe6122009-06-02 23:35:54 +01003415 * Replaces an existing preferred activity mapping to the system, and if that were not present
3416 * adds a new preferred activity. This will be used
3417 * to automatically select the given activity component when
3418 * {@link Context#startActivity(Intent) Context.startActivity()} finds
3419 * multiple matching activities and also matches the given filter.
3420 *
3421 * @param filter The set of intents under which this activity will be
3422 * made preferred.
3423 * @param match The IntentFilter match category that this preference
3424 * applies to.
3425 * @param set The set of activities that the user was picking from when
3426 * this preference was made.
3427 * @param activity The component name of the activity that is to be
3428 * preferred.
3429 * @hide
3430 */
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08003431 @Deprecated
Satish Sampath8dbe6122009-06-02 23:35:54 +01003432 public abstract void replacePreferredActivity(IntentFilter filter, int match,
3433 ComponentName[] set, ComponentName activity);
3434
3435 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003436 * Remove all preferred activity mappings, previously added with
3437 * {@link #addPreferredActivity}, from the
3438 * system whose activities are implemented in the given package name.
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08003439 * An application can only clear its own package(s).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003440 *
3441 * @param packageName The name of the package whose preferred activity
3442 * mappings are to be removed.
3443 */
3444 public abstract void clearPackagePreferredActivities(String packageName);
3445
3446 /**
3447 * Retrieve all preferred activities, previously added with
3448 * {@link #addPreferredActivity}, that are
3449 * currently registered with the system.
3450 *
3451 * @param outFilters A list in which to place the filters of all of the
3452 * preferred activities, or null for none.
3453 * @param outActivities A list in which to place the component names of
3454 * all of the preferred activities, or null for none.
3455 * @param packageName An option package in which you would like to limit
3456 * the list. If null, all activities will be returned; if non-null, only
3457 * those activities in the given package are returned.
3458 *
3459 * @return Returns the total number of registered preferred activities
3460 * (the number of distinct IntentFilter records, not the number of unique
3461 * activity components) that were found.
3462 */
3463 public abstract int getPreferredActivities(List<IntentFilter> outFilters,
3464 List<ComponentName> outActivities, String packageName);
3465
3466 /**
Christopher Tatea2a08502013-09-05 16:38:58 -07003467 * Ask for the set of available 'home' activities and the current explicit
3468 * default, if any.
3469 * @hide
3470 */
3471 public abstract ComponentName getHomeActivities(List<ResolveInfo> outActivities);
3472
3473 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003474 * Set the enabled setting for a package component (activity, receiver, service, provider).
3475 * This setting will override any enabled state which may have been set by the component in its
3476 * manifest.
3477 *
3478 * @param componentName The component to enable
3479 * @param newState The new enabled state for the component. The legal values for this state
3480 * are:
3481 * {@link #COMPONENT_ENABLED_STATE_ENABLED},
3482 * {@link #COMPONENT_ENABLED_STATE_DISABLED}
3483 * and
3484 * {@link #COMPONENT_ENABLED_STATE_DEFAULT}
3485 * The last one removes the setting, thereby restoring the component's state to
3486 * whatever was set in it's manifest (or enabled, by default).
3487 * @param flags Optional behavior flags: {@link #DONT_KILL_APP} or 0.
3488 */
3489 public abstract void setComponentEnabledSetting(ComponentName componentName,
3490 int newState, int flags);
3491
3492
3493 /**
Amaury Medeirosdde24262014-06-03 20:06:41 -03003494 * Return the enabled setting for a package component (activity,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003495 * receiver, service, provider). This returns the last value set by
3496 * {@link #setComponentEnabledSetting(ComponentName, int, int)}; in most
3497 * cases this value will be {@link #COMPONENT_ENABLED_STATE_DEFAULT} since
3498 * the value originally specified in the manifest has not been modified.
3499 *
3500 * @param componentName The component to retrieve.
3501 * @return Returns the current enabled state for the component. May
3502 * be one of {@link #COMPONENT_ENABLED_STATE_ENABLED},
3503 * {@link #COMPONENT_ENABLED_STATE_DISABLED}, or
3504 * {@link #COMPONENT_ENABLED_STATE_DEFAULT}. The last one means the
3505 * component's enabled state is based on the original information in
3506 * the manifest as found in {@link ComponentInfo}.
3507 */
3508 public abstract int getComponentEnabledSetting(ComponentName componentName);
3509
3510 /**
3511 * Set the enabled setting for an application
3512 * This setting will override any enabled state which may have been set by the application in
3513 * its manifest. It also overrides the enabled state set in the manifest for any of the
3514 * application's components. It does not override any enabled state set by
3515 * {@link #setComponentEnabledSetting} for any of the application's components.
3516 *
3517 * @param packageName The package name of the application to enable
3518 * @param newState The new enabled state for the component. The legal values for this state
3519 * are:
3520 * {@link #COMPONENT_ENABLED_STATE_ENABLED},
3521 * {@link #COMPONENT_ENABLED_STATE_DISABLED}
3522 * and
3523 * {@link #COMPONENT_ENABLED_STATE_DEFAULT}
3524 * The last one removes the setting, thereby restoring the applications's state to
3525 * whatever was set in its manifest (or enabled, by default).
3526 * @param flags Optional behavior flags: {@link #DONT_KILL_APP} or 0.
3527 */
3528 public abstract void setApplicationEnabledSetting(String packageName,
3529 int newState, int flags);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003530
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003531 /**
Amaury Medeirosdde24262014-06-03 20:06:41 -03003532 * Return the enabled setting for an application. This returns
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003533 * the last value set by
3534 * {@link #setApplicationEnabledSetting(String, int, int)}; in most
3535 * cases this value will be {@link #COMPONENT_ENABLED_STATE_DEFAULT} since
3536 * the value originally specified in the manifest has not been modified.
3537 *
Amaury Medeirosdde24262014-06-03 20:06:41 -03003538 * @param packageName The package name of the application to retrieve.
3539 * @return Returns the current enabled state for the application. May
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003540 * be one of {@link #COMPONENT_ENABLED_STATE_ENABLED},
3541 * {@link #COMPONENT_ENABLED_STATE_DISABLED}, or
3542 * {@link #COMPONENT_ENABLED_STATE_DEFAULT}. The last one means the
3543 * application's enabled state is based on the original information in
3544 * the manifest as found in {@link ComponentInfo}.
Mathew Inwood1b9f8d92011-09-26 13:23:56 +01003545 * @throws IllegalArgumentException if the named package does not exist.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003546 */
3547 public abstract int getApplicationEnabledSetting(String packageName);
3548
3549 /**
Amith Yamasani655d0e22013-06-12 14:19:10 -07003550 * Puts the package in a blocked state, which is almost like an uninstalled state,
3551 * making the package unavailable, but it doesn't remove the data or the actual
3552 * package file.
3553 * @hide
3554 */
3555 public abstract boolean setApplicationBlockedSettingAsUser(String packageName, boolean blocked,
3556 UserHandle userHandle);
3557
3558 /**
3559 * Returns the blocked state of a package.
3560 * @see #setApplicationBlockedSettingAsUser(String, boolean, UserHandle)
3561 * @hide
3562 */
3563 public abstract boolean getApplicationBlockedSettingAsUser(String packageName,
3564 UserHandle userHandle);
3565
3566 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003567 * Return whether the device has been booted into safe mode.
3568 */
3569 public abstract boolean isSafeMode();
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08003570
3571 /**
3572 * Attempts to move package resources from internal to external media or vice versa.
3573 * Since this may take a little while, the result will
3574 * be posted back to the given observer. This call may fail if the calling context
3575 * lacks the {@link android.Manifest.permission#MOVE_PACKAGE} permission, if the
3576 * named package cannot be found, or if the named package is a "system package".
3577 *
3578 * @param packageName The name of the package to delete
3579 * @param observer An observer callback to get notified when the package move is
3580 * complete. {@link android.content.pm.IPackageMoveObserver#packageMoved(boolean)} will be
3581 * called when that happens. observer may be null to indicate that no callback is desired.
3582 * @param flags To indicate install location {@link #MOVE_INTERNAL} or
3583 * {@link #MOVE_EXTERNAL_MEDIA}
3584 *
3585 * @hide
3586 */
3587 public abstract void movePackage(
3588 String packageName, IPackageMoveObserver observer, int flags);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003589
3590 /**
Amith Yamasani13593602012-03-22 16:16:17 -07003591 * Returns the device identity that verifiers can use to associate their scheme to a particular
3592 * device. This should not be used by anything other than a package verifier.
Aravind Akella068b0c02013-10-12 17:39:15 -07003593 *
Kenny Root0aaa0d92011-09-12 16:42:55 -07003594 * @return identity that uniquely identifies current device
3595 * @hide
3596 */
3597 public abstract VerifierDeviceIdentity getVerifierDeviceIdentity();
Amith Yamasani742a6712011-05-04 14:49:28 -07003598
Jeff Sharkey3a44f3f2014-04-28 17:36:31 -07003599 /** {@hide} */
3600 public abstract PackageInstaller getPackageInstaller();
3601
Amith Yamasani742a6712011-05-04 14:49:28 -07003602 /**
3603 * Returns the data directory for a particular user and package, given the uid of the package.
3604 * @param uid uid of the package, including the userId and appId
3605 * @param packageName name of the package
3606 * @return the user-specific data directory for the package
3607 * @hide
3608 */
3609 public static String getDataDirForUser(int userId, String packageName) {
3610 // TODO: This should be shared with Installer's knowledge of user directory
3611 return Environment.getDataDirectory().toString() + "/user/" + userId
3612 + "/" + packageName;
3613 }
Nicolas Prevotc79586e2014-05-06 12:47:57 +01003614
3615 /**
Nicolas Prevot81948992014-05-16 18:25:26 +01003616 * Adds a {@link CrossProfileIntentFilter}. After calling this method all intents sent from the
3617 * user with id sourceUserId can also be be resolved by activities in the user with id
3618 * targetUserId if they match the specified intent filter.
3619 * @param filter the {@link IntentFilter} the intent has to match
3620 * @param removable if set to false, {@link clearCrossProfileIntentFilters} will not remove this
3621 * {@link CrossProfileIntentFilter}
Nicolas Prevotc79586e2014-05-06 12:47:57 +01003622 * @hide
3623 */
Nicolas Prevot63798c52014-05-27 13:22:38 +01003624 public abstract void addCrossProfileIntentFilter(IntentFilter filter, int sourceUserId,
3625 int targetUserId, int flags);
Nicolas Prevotc79586e2014-05-06 12:47:57 +01003626
3627 /**
Nicolas Prevot63798c52014-05-27 13:22:38 +01003628 * Clearing {@link CrossProfileIntentFilter}s which have the specified user as their
3629 * source, and have been set by the profile owner
Nicolas Prevot81948992014-05-16 18:25:26 +01003630 * @param sourceUserId
Nicolas Prevotc79586e2014-05-06 12:47:57 +01003631 * @hide
3632 */
Nicolas Prevot81948992014-05-16 18:25:26 +01003633 public abstract void clearCrossProfileIntentFilters(int sourceUserId);
Alexandra Gherghina6e2ae252014-06-12 16:03:58 +01003634
3635 /**
3636 * Forwards all intents for {@link packageName} for user {@link sourceUserId} to user
3637 * {@link targetUserId}.
3638 * @hide
3639 */
3640 public abstract void addCrossProfileIntentsForPackage(String packageName,
3641 int sourceUserId, int targetUserId);
Nicolas Prevot88cc3462014-05-14 14:51:48 +01003642 /**
3643 * @hide
3644 */
3645 public abstract Bitmap getUserIcon(int userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003646}