blob: 0192a30f84d17e057af18ce679b73aaf73094751 [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;
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -080020import android.annotation.SdkConstant;
21import android.annotation.SdkConstant.SdkConstantType;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080022import android.content.ComponentName;
23import android.content.Context;
24import android.content.Intent;
25import android.content.IntentFilter;
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -070026import android.content.IntentSender;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080027import android.content.res.Resources;
28import android.content.res.XmlResourceParser;
29import android.graphics.drawable.Drawable;
30import android.net.Uri;
Amith Yamasani742a6712011-05-04 14:49:28 -070031import android.os.Environment;
Dianne Hackborn0c380492012-08-20 17:23:30 -070032import android.os.UserHandle;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080033import android.util.AndroidException;
34import android.util.DisplayMetrics;
35
36import java.io.File;
Tor Norbyed9273d62013-05-30 15:59:53 -070037import java.lang.annotation.Retention;
38import java.lang.annotation.RetentionPolicy;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080039import java.util.List;
40
41/**
42 * Class for retrieving various kinds of information related to the application
43 * packages that are currently installed on the device.
44 *
45 * You can find this class through {@link Context#getPackageManager}.
46 */
47public abstract class PackageManager {
48
49 /**
50 * This exception is thrown when a given package, application, or component
kmccormick30498b42013-03-27 17:39:17 -070051 * name cannot be found.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080052 */
53 public static class NameNotFoundException extends AndroidException {
54 public NameNotFoundException() {
55 }
56
57 public NameNotFoundException(String name) {
58 super(name);
59 }
60 }
61
62 /**
63 * {@link PackageInfo} flag: return information about
64 * activities in the package in {@link PackageInfo#activities}.
65 */
66 public static final int GET_ACTIVITIES = 0x00000001;
67
68 /**
69 * {@link PackageInfo} flag: return information about
70 * intent receivers in the package in
71 * {@link PackageInfo#receivers}.
72 */
73 public static final int GET_RECEIVERS = 0x00000002;
74
75 /**
76 * {@link PackageInfo} flag: return information about
77 * services in the package in {@link PackageInfo#services}.
78 */
79 public static final int GET_SERVICES = 0x00000004;
80
81 /**
82 * {@link PackageInfo} flag: return information about
83 * content providers in the package in
84 * {@link PackageInfo#providers}.
85 */
86 public static final int GET_PROVIDERS = 0x00000008;
87
88 /**
89 * {@link PackageInfo} flag: return information about
90 * instrumentation in the package in
91 * {@link PackageInfo#instrumentation}.
92 */
93 public static final int GET_INSTRUMENTATION = 0x00000010;
94
95 /**
96 * {@link PackageInfo} flag: return information about the
97 * intent filters supported by the activity.
98 */
99 public static final int GET_INTENT_FILTERS = 0x00000020;
100
101 /**
102 * {@link PackageInfo} flag: return information about the
103 * signatures included in the package.
104 */
105 public static final int GET_SIGNATURES = 0x00000040;
106
107 /**
108 * {@link ResolveInfo} flag: return the IntentFilter that
109 * was matched for a particular ResolveInfo in
110 * {@link ResolveInfo#filter}.
111 */
112 public static final int GET_RESOLVED_FILTER = 0x00000040;
113
114 /**
115 * {@link ComponentInfo} flag: return the {@link ComponentInfo#metaData}
116 * data {@link android.os.Bundle}s that are associated with a component.
117 * This applies for any API returning a ComponentInfo subclass.
118 */
119 public static final int GET_META_DATA = 0x00000080;
120
121 /**
122 * {@link PackageInfo} flag: return the
123 * {@link PackageInfo#gids group ids} that are associated with an
124 * application.
Ken Wakasaf76a50c2012-03-09 19:56:35 +0900125 * This applies for any API returning a PackageInfo class, either
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800126 * directly or nested inside of another.
127 */
128 public static final int GET_GIDS = 0x00000100;
129
130 /**
131 * {@link PackageInfo} flag: include disabled components in the returned info.
132 */
133 public static final int GET_DISABLED_COMPONENTS = 0x00000200;
134
135 /**
136 * {@link ApplicationInfo} flag: return the
137 * {@link ApplicationInfo#sharedLibraryFiles paths to the shared libraries}
138 * that are associated with an application.
139 * This applies for any API returning an ApplicationInfo class, either
140 * directly or nested inside of another.
141 */
142 public static final int GET_SHARED_LIBRARY_FILES = 0x00000400;
143
144 /**
145 * {@link ProviderInfo} flag: return the
146 * {@link ProviderInfo#uriPermissionPatterns URI permission patterns}
147 * that are associated with a content provider.
Ken Wakasaf76a50c2012-03-09 19:56:35 +0900148 * This applies for any API returning a ProviderInfo class, either
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800149 * directly or nested inside of another.
150 */
151 public static final int GET_URI_PERMISSION_PATTERNS = 0x00000800;
152 /**
153 * {@link PackageInfo} flag: return information about
154 * permissions in the package in
155 * {@link PackageInfo#permissions}.
156 */
157 public static final int GET_PERMISSIONS = 0x00001000;
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700158
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800159 /**
Kenny Root685f4902011-11-03 10:13:29 -0700160 * Flag parameter to retrieve some information about all applications (even
161 * uninstalled ones) which have data directories. This state could have
162 * resulted if applications have been deleted with flag
163 * {@code DONT_DELETE_DATA} with a possibility of being replaced or
164 * reinstalled in future.
165 * <p>
166 * Note: this flag may cause less information about currently installed
167 * applications to be returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800168 */
169 public static final int GET_UNINSTALLED_PACKAGES = 0x00002000;
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700170
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800171 /**
172 * {@link PackageInfo} flag: return information about
Dianne Hackborn49237342009-08-27 20:08:01 -0700173 * hardware preferences in
174 * {@link PackageInfo#configPreferences PackageInfo.configPreferences} and
175 * requested features in {@link PackageInfo#reqFeatures
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700176 * PackageInfo.reqFeatures}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800177 */
178 public static final int GET_CONFIGURATIONS = 0x00004000;
179
180 /**
Dianne Hackbornfd7aded2013-01-22 17:10:23 -0800181 * {@link PackageInfo} flag: include disabled components which are in
182 * that state only because of {@link #COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED}
183 * in the returned info. Note that if you set this flag, applications
184 * that are in this disabled state will be reported as enabled.
185 */
186 public static final int GET_DISABLED_UNTIL_USED_COMPONENTS = 0x00008000;
187
188 /**
Dianne Hackborn1655be42009-05-08 14:29:01 -0700189 * Resolution and querying flag: if set, only filters that support the
190 * {@link android.content.Intent#CATEGORY_DEFAULT} will be considered for
191 * matching. This is a synonym for including the CATEGORY_DEFAULT in your
192 * supplied Intent.
193 */
194 public static final int MATCH_DEFAULT_ONLY = 0x00010000;
195
Tor Norbyed9273d62013-05-30 15:59:53 -0700196 /** @hide */
197 @IntDef({PERMISSION_GRANTED, PERMISSION_DENIED})
198 @Retention(RetentionPolicy.SOURCE)
199 public @interface PermissionResult {}
200
Dianne Hackborn1655be42009-05-08 14:29:01 -0700201 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800202 * Permission check result: this is returned by {@link #checkPermission}
203 * if the permission has been granted to the given package.
204 */
205 public static final int PERMISSION_GRANTED = 0;
206
207 /**
208 * Permission check result: this is returned by {@link #checkPermission}
209 * if the permission has not been granted to the given package.
210 */
211 public static final int PERMISSION_DENIED = -1;
212
213 /**
214 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700215 * if all signatures on the two packages match.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800216 */
217 public static final int SIGNATURE_MATCH = 0;
218
219 /**
220 * Signature check result: this is returned by {@link #checkSignatures}
221 * if neither of the two packages is signed.
222 */
223 public static final int SIGNATURE_NEITHER_SIGNED = 1;
224
225 /**
226 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700227 * if the first package is not signed but the second is.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800228 */
229 public static final int SIGNATURE_FIRST_NOT_SIGNED = -1;
230
231 /**
232 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700233 * if the second package is not signed but the first is.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800234 */
235 public static final int SIGNATURE_SECOND_NOT_SIGNED = -2;
236
237 /**
238 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700239 * if not all signatures on both packages match.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800240 */
241 public static final int SIGNATURE_NO_MATCH = -3;
242
243 /**
244 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700245 * if either of the packages are not valid.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800246 */
247 public static final int SIGNATURE_UNKNOWN_PACKAGE = -4;
248
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700249 /**
250 * Flag for {@link #setApplicationEnabledSetting(String, int, int)}
251 * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This
252 * component or application is in its default enabled state (as specified
253 * in its manifest).
254 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800255 public static final int COMPONENT_ENABLED_STATE_DEFAULT = 0;
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700256
257 /**
258 * Flag for {@link #setApplicationEnabledSetting(String, int, int)}
259 * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This
260 * component or application has been explictily enabled, regardless of
261 * what it has specified in its manifest.
262 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800263 public static final int COMPONENT_ENABLED_STATE_ENABLED = 1;
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700264
265 /**
266 * Flag for {@link #setApplicationEnabledSetting(String, int, int)}
267 * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This
268 * component or application has been explicitly disabled, regardless of
269 * what it has specified in its manifest.
270 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800271 public static final int COMPONENT_ENABLED_STATE_DISABLED = 2;
272
273 /**
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700274 * Flag for {@link #setApplicationEnabledSetting(String, int, int)} only: The
275 * user has explicitly disabled the application, regardless of what it has
276 * specified in its manifest. Because this is due to the user's request,
277 * they may re-enable it if desired through the appropriate system UI. This
kmccormick30498b42013-03-27 17:39:17 -0700278 * option currently <strong>cannot</strong> be used with
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700279 * {@link #setComponentEnabledSetting(ComponentName, int, int)}.
280 */
281 public static final int COMPONENT_ENABLED_STATE_DISABLED_USER = 3;
282
283 /**
Dianne Hackbornfd7aded2013-01-22 17:10:23 -0800284 * Flag for {@link #setApplicationEnabledSetting(String, int, int)} only: This
285 * application should be considered, until the point where the user actually
286 * wants to use it. This means that it will not normally show up to the user
287 * (such as in the launcher), but various parts of the user interface can
288 * use {@link #GET_DISABLED_UNTIL_USED_COMPONENTS} to still see it and allow
289 * the user to select it (as for example an IME, device admin, etc). Such code,
290 * once the user has selected the app, should at that point also make it enabled.
291 * This option currently <strong>can not</strong> be used with
292 * {@link #setComponentEnabledSetting(ComponentName, int, int)}.
293 */
294 public static final int COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED = 4;
295
296 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800297 * Flag parameter for {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} to
298 * indicate that this package should be installed as forward locked, i.e. only the app itself
Brad Fitzpatrick2e805b12010-03-22 10:10:51 -0700299 * should have access to its code and non-resource assets.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700300 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800301 */
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700302 public static final int INSTALL_FORWARD_LOCK = 0x00000001;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800303
304 /**
305 * Flag parameter for {@link #installPackage} to indicate that you want to replace an already
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700306 * installed package, if one exists.
307 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800308 */
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700309 public static final int INSTALL_REPLACE_EXISTING = 0x00000002;
310
311 /**
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700312 * Flag parameter for {@link #installPackage} to indicate that you want to
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700313 * allow test packages (those that have set android:testOnly in their
314 * manifest) to be installed.
315 * @hide
316 */
317 public static final int INSTALL_ALLOW_TEST = 0x00000004;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800318
319 /**
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800320 * Flag parameter for {@link #installPackage} to indicate that this
321 * package has to be installed on the sdcard.
322 * @hide
323 */
Suchi Amalapurapu5b993ce2010-02-12 09:43:29 -0800324 public static final int INSTALL_EXTERNAL = 0x00000008;
Oscar Montemayor539d3c42010-01-29 15:27:00 -0800325
326 /**
Kenny Root5ab21572011-07-27 11:11:19 -0700327 * Flag parameter for {@link #installPackage} to indicate that this package
328 * has to be installed on the sdcard.
329 * @hide
330 */
331 public static final int INSTALL_INTERNAL = 0x00000010;
332
333 /**
334 * Flag parameter for {@link #installPackage} to indicate that this install
335 * was initiated via ADB.
336 *
337 * @hide
338 */
339 public static final int INSTALL_FROM_ADB = 0x00000020;
Suchi Amalapurapu14b6abd2010-03-17 08:37:04 -0700340
341 /**
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700342 * Flag parameter for {@link #installPackage} to indicate that this install
343 * should immediately be visible to all users.
344 *
345 * @hide
346 */
347 public static final int INSTALL_ALL_USERS = 0x00000040;
348
349 /**
350 * Flag parameter for {@link #installPackage} to indicate that it is okay
351 * to install an update to an app where the newly installed app has a lower
352 * version code than the currently installed app.
353 *
354 * @hide
355 */
356 public static final int INSTALL_ALLOW_DOWNGRADE = 0x00000080;
357
358 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800359 * Flag parameter for
360 * {@link #setComponentEnabledSetting(android.content.ComponentName, int, int)} to indicate
361 * that you don't want to kill the app containing the component. Be careful when you set this
362 * since changing component states can make the containing application's behavior unpredictable.
363 */
364 public static final int DONT_KILL_APP = 0x00000001;
365
366 /**
367 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
368 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} on success.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700369 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800370 */
371 public static final int INSTALL_SUCCEEDED = 1;
372
373 /**
374 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
375 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if the package is
376 * already installed.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700377 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800378 */
379 public static final int INSTALL_FAILED_ALREADY_EXISTS = -1;
380
381 /**
382 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
383 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if the package archive
384 * file is invalid.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700385 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800386 */
387 public static final int INSTALL_FAILED_INVALID_APK = -2;
388
389 /**
390 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
391 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if the URI passed in
392 * is invalid.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700393 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800394 */
395 public static final int INSTALL_FAILED_INVALID_URI = -3;
396
397 /**
398 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
399 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if the package manager
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700400 * service found that the device didn't have enough storage space to install the app.
401 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800402 */
403 public static final int INSTALL_FAILED_INSUFFICIENT_STORAGE = -4;
404
405 /**
406 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
407 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if a
408 * package is already installed with the same name.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700409 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800410 */
411 public static final int INSTALL_FAILED_DUPLICATE_PACKAGE = -5;
412
413 /**
414 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
415 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
416 * the requested shared user does not exist.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700417 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800418 */
419 public static final int INSTALL_FAILED_NO_SHARED_USER = -6;
420
421 /**
422 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
423 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
424 * a previously installed package of the same name has a different signature
425 * than the new package (and the old package's data was not removed).
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700426 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800427 */
428 public static final int INSTALL_FAILED_UPDATE_INCOMPATIBLE = -7;
429
430 /**
431 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
432 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
433 * the new package is requested a shared user which is already installed on the
434 * device and does not have matching signature.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700435 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800436 */
437 public static final int INSTALL_FAILED_SHARED_USER_INCOMPATIBLE = -8;
438
439 /**
440 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
441 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
442 * the new package uses a shared library that is not available.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700443 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800444 */
445 public static final int INSTALL_FAILED_MISSING_SHARED_LIBRARY = -9;
446
447 /**
448 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
449 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
450 * the new package uses a shared library that is not available.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700451 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800452 */
453 public static final int INSTALL_FAILED_REPLACE_COULDNT_DELETE = -10;
454
455 /**
456 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
457 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
458 * the new package failed while optimizing and validating its dex files,
459 * either because there was not enough storage or the validation failed.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700460 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800461 */
462 public static final int INSTALL_FAILED_DEXOPT = -11;
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 failed because the current SDK version is older than
468 * that required by the package.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700469 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800470 */
471 public static final int INSTALL_FAILED_OLDER_SDK = -12;
472
473 /**
The Android Open Source Project10592532009-03-18 17:39:46 -0700474 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
475 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
476 * the new package failed because it contains a content provider with the
477 * same authority as a provider already installed in the system.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700478 * @hide
The Android Open Source Project10592532009-03-18 17:39:46 -0700479 */
480 public static final int INSTALL_FAILED_CONFLICTING_PROVIDER = -13;
481
482 /**
Dianne Hackborn851a5412009-05-08 12:06:44 -0700483 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
484 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
485 * the new package failed because the current SDK version is newer than
486 * that required by the package.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700487 * @hide
Dianne Hackborn851a5412009-05-08 12:06:44 -0700488 */
489 public static final int INSTALL_FAILED_NEWER_SDK = -14;
490
491 /**
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700492 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
493 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
494 * the new package failed because it has specified that it is a test-only
495 * package and the caller has not supplied the {@link #INSTALL_ALLOW_TEST}
496 * flag.
497 * @hide
498 */
499 public static final int INSTALL_FAILED_TEST_ONLY = -15;
500
501 /**
Dianne Hackbornb1811182009-05-21 15:45:42 -0700502 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
503 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
504 * the package being installed contains native code, but none that is
505 * compatible with the the device's CPU_ABI.
506 * @hide
507 */
508 public static final int INSTALL_FAILED_CPU_ABI_INCOMPATIBLE = -16;
509
510 /**
Dianne Hackborn49237342009-08-27 20:08:01 -0700511 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
512 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
513 * the new package uses a feature that is not available.
514 * @hide
515 */
516 public static final int INSTALL_FAILED_MISSING_FEATURE = -17;
517
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800518 // ------ Errors related to sdcard
519 /**
520 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
521 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
522 * a secure container mount point couldn't be accessed on external media.
523 * @hide
524 */
525 public static final int INSTALL_FAILED_CONTAINER_ERROR = -18;
526
Dianne Hackborn49237342009-08-27 20:08:01 -0700527 /**
Suchi Amalapurapub56ae202010-02-04 22:51:07 -0800528 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
529 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
530 * the new package couldn't be installed in the specified install
531 * location.
532 * @hide
533 */
534 public static final int INSTALL_FAILED_INVALID_INSTALL_LOCATION = -19;
535
536 /**
Suchi Amalapurapu8a9ab242010-03-11 16:49:16 -0800537 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
538 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
539 * the new package couldn't be installed in the specified install
540 * location because the media is not available.
541 * @hide
542 */
543 public static final int INSTALL_FAILED_MEDIA_UNAVAILABLE = -20;
544
545 /**
Kenny Root5ab21572011-07-27 11:11:19 -0700546 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
547 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
548 * the new package couldn't be installed because the verification timed out.
549 * @hide
550 */
551 public static final int INSTALL_FAILED_VERIFICATION_TIMEOUT = -21;
552
553 /**
554 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
555 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
556 * the new package couldn't be installed because the verification did not succeed.
557 * @hide
558 */
559 public static final int INSTALL_FAILED_VERIFICATION_FAILURE = -22;
560
561 /**
562 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
563 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
564 * the package changed from what the calling program expected.
565 * @hide
566 */
567 public static final int INSTALL_FAILED_PACKAGE_CHANGED = -23;
568
569 /**
Dianne Hackbornd0c5f512012-06-07 16:53:59 -0700570 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
571 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
572 * the new package is assigned a different UID than it previously held.
573 * @hide
574 */
575 public static final int INSTALL_FAILED_UID_CHANGED = -24;
576
577 /**
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700578 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
579 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
580 * the new package has an older version code than the currently installed package.
581 * @hide
582 */
583 public static final int INSTALL_FAILED_VERSION_DOWNGRADE = -25;
584
585 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800586 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
587 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
588 * if the parser was given a path that is not a file, or does not end with the expected
589 * '.apk' extension.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700590 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800591 */
592 public static final int INSTALL_PARSE_FAILED_NOT_APK = -100;
593
594 /**
595 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
596 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
597 * if the parser was unable to retrieve the AndroidManifest.xml file.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700598 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800599 */
600 public static final int INSTALL_PARSE_FAILED_BAD_MANIFEST = -101;
601
602 /**
603 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
604 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
605 * if the parser encountered an unexpected exception.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700606 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800607 */
608 public static final int INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION = -102;
609
610 /**
611 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
612 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
613 * if the parser did not find any certificates in the .apk.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700614 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800615 */
616 public static final int INSTALL_PARSE_FAILED_NO_CERTIFICATES = -103;
617
618 /**
619 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
620 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
621 * if the parser found inconsistent certificates on the files in the .apk.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700622 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800623 */
624 public static final int INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES = -104;
625
626 /**
627 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
628 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
629 * if the parser encountered a CertificateEncodingException in one of the
630 * files in the .apk.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700631 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800632 */
633 public static final int INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING = -105;
634
635 /**
636 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
637 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
638 * if the parser encountered a bad or missing package name in the manifest.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700639 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800640 */
641 public static final int INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME = -106;
642
643 /**
644 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
645 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
646 * if the parser encountered a bad shared user id name in the manifest.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700647 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800648 */
649 public static final int INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID = -107;
650
651 /**
652 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
653 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
654 * if the parser encountered some structural problem in the manifest.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700655 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800656 */
657 public static final int INSTALL_PARSE_FAILED_MANIFEST_MALFORMED = -108;
658
659 /**
660 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
661 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
662 * if the parser did not find any actionable tags (instrumentation or application)
663 * in the manifest.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700664 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800665 */
666 public static final int INSTALL_PARSE_FAILED_MANIFEST_EMPTY = -109;
667
668 /**
Suchi Amalapurapu5b993ce2010-02-12 09:43:29 -0800669 * Installation failed return code: this is passed to the {@link IPackageInstallObserver} by
670 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
671 * if the system failed to install the package because of system issues.
672 * @hide
673 */
674 public static final int INSTALL_FAILED_INTERNAL_ERROR = -110;
675
676 /**
Amith Yamasanie4cf7342012-12-17 11:12:09 -0800677 * Installation failed return code: this is passed to the {@link IPackageInstallObserver} by
678 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
679 * if the system failed to install the package because the user is restricted from installing
680 * apps.
681 * @hide
682 */
683 public static final int INSTALL_FAILED_USER_RESTRICTED = -111;
684
685 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800686 * Flag parameter for {@link #deletePackage} to indicate that you don't want to delete the
687 * package's data directory.
688 *
689 * @hide
690 */
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700691 public static final int DELETE_KEEP_DATA = 0x00000001;
692
693 /**
694 * Flag parameter for {@link #deletePackage} to indicate that you want the
695 * package deleted for all users.
696 *
697 * @hide
698 */
699 public static final int DELETE_ALL_USERS = 0x00000002;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800700
701 /**
Dianne Hackbornc895be72013-03-11 17:48:43 -0700702 * Flag parameter for {@link #deletePackage} to indicate that, if you are calling
703 * uninstall on a system that has been updated, then don't do the normal process
704 * of uninstalling the update and rolling back to the older system version (which
705 * needs to happen for all users); instead, just mark the app as uninstalled for
706 * the current user.
707 *
708 * @hide
709 */
710 public static final int DELETE_SYSTEM_APP = 0x00000004;
711
712 /**
Kenny Rootc39bb4a2011-02-28 13:27:19 -0800713 * Return code for when package deletion succeeds. This is passed to the
714 * {@link IPackageDeleteObserver} by {@link #deletePackage()} if the system
715 * succeeded in deleting the package.
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700716 *
Kenny Rootc39bb4a2011-02-28 13:27:19 -0800717 * @hide
718 */
719 public static final int DELETE_SUCCEEDED = 1;
720
721 /**
722 * Deletion failed return code: this is passed to the
723 * {@link IPackageDeleteObserver} by {@link #deletePackage()} if the system
724 * failed to delete the package for an unspecified reason.
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700725 *
Kenny Rootc39bb4a2011-02-28 13:27:19 -0800726 * @hide
727 */
728 public static final int DELETE_FAILED_INTERNAL_ERROR = -1;
729
730 /**
731 * Deletion failed return code: this is passed to the
732 * {@link IPackageDeleteObserver} by {@link #deletePackage()} if the system
733 * failed to delete the package because it is the active DevicePolicy
734 * manager.
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700735 *
Kenny Rootc39bb4a2011-02-28 13:27:19 -0800736 * @hide
737 */
738 public static final int DELETE_FAILED_DEVICE_POLICY_MANAGER = -2;
739
740 /**
Amith Yamasanie4cf7342012-12-17 11:12:09 -0800741 * Deletion failed return code: this is passed to the
742 * {@link IPackageDeleteObserver} by {@link #deletePackage()} if the system
743 * failed to delete the package since the user is restricted.
744 *
745 * @hide
746 */
747 public static final int DELETE_FAILED_USER_RESTRICTED = -3;
748
749 /**
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -0800750 * Return code that is passed to the {@link IPackageMoveObserver} by
Kenny Rootc39bb4a2011-02-28 13:27:19 -0800751 * {@link #movePackage(android.net.Uri, IPackageMoveObserver)} when the
752 * package has been successfully moved by the system.
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700753 *
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -0800754 * @hide
755 */
756 public static final int MOVE_SUCCEEDED = 1;
757 /**
758 * Error code that is passed to the {@link IPackageMoveObserver} by
759 * {@link #movePackage(android.net.Uri, IPackageMoveObserver)}
760 * when the package hasn't been successfully moved by the system
761 * because of insufficient memory on specified media.
762 * @hide
763 */
764 public static final int MOVE_FAILED_INSUFFICIENT_STORAGE = -1;
765
766 /**
767 * Error code that is passed to the {@link IPackageMoveObserver} by
768 * {@link #movePackage(android.net.Uri, IPackageMoveObserver)}
769 * if the specified package doesn't exist.
770 * @hide
771 */
772 public static final int MOVE_FAILED_DOESNT_EXIST = -2;
773
774 /**
775 * Error code that is passed to the {@link IPackageMoveObserver} by
776 * {@link #movePackage(android.net.Uri, IPackageMoveObserver)}
777 * if the specified package cannot be moved since its a system package.
778 * @hide
779 */
780 public static final int MOVE_FAILED_SYSTEM_PACKAGE = -3;
781
782 /**
783 * Error code that is passed to the {@link IPackageMoveObserver} by
784 * {@link #movePackage(android.net.Uri, IPackageMoveObserver)}
785 * if the specified package cannot be moved since its forward locked.
786 * @hide
787 */
788 public static final int MOVE_FAILED_FORWARD_LOCKED = -4;
789
790 /**
791 * Error code that is passed to the {@link IPackageMoveObserver} by
792 * {@link #movePackage(android.net.Uri, IPackageMoveObserver)}
793 * if the specified package cannot be moved to the specified location.
794 * @hide
795 */
796 public static final int MOVE_FAILED_INVALID_LOCATION = -5;
797
798 /**
Suchi Amalapurapu8a9ab242010-03-11 16:49:16 -0800799 * Error code that is passed to the {@link IPackageMoveObserver} by
800 * {@link #movePackage(android.net.Uri, IPackageMoveObserver)}
801 * if the specified package cannot be moved to the specified location.
802 * @hide
803 */
804 public static final int MOVE_FAILED_INTERNAL_ERROR = -6;
805
806 /**
Kenny Rootdeb11262010-08-02 11:36:21 -0700807 * Error code that is passed to the {@link IPackageMoveObserver} by
808 * {@link #movePackage(android.net.Uri, IPackageMoveObserver)} if the
809 * specified package already has an operation pending in the
810 * {@link PackageHandler} queue.
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700811 *
Kenny Rootdeb11262010-08-02 11:36:21 -0700812 * @hide
813 */
814 public static final int MOVE_FAILED_OPERATION_PENDING = -7;
815
816 /**
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -0800817 * Flag parameter for {@link #movePackage} to indicate that
818 * the package should be moved to internal storage if its
819 * been installed on external media.
820 * @hide
821 */
822 public static final int MOVE_INTERNAL = 0x00000001;
823
824 /**
825 * Flag parameter for {@link #movePackage} to indicate that
826 * the package should be moved to external media.
827 * @hide
828 */
829 public static final int MOVE_EXTERNAL_MEDIA = 0x00000002;
830
831 /**
Kenny Root05ca4c92011-09-15 10:36:25 -0700832 * Usable by the required verifier as the {@code verificationCode} argument
833 * for {@link PackageManager#verifyPendingInstall} to indicate that it will
834 * allow the installation to proceed without any of the optional verifiers
835 * needing to vote.
836 *
837 * @hide
838 */
839 public static final int VERIFICATION_ALLOW_WITHOUT_SUFFICIENT = 2;
840
841 /**
Kenny Root3a9b5fb2011-09-20 14:15:38 -0700842 * Used as the {@code verificationCode} argument for
843 * {@link PackageManager#verifyPendingInstall} to indicate that the calling
844 * package verifier allows the installation to proceed.
845 */
846 public static final int VERIFICATION_ALLOW = 1;
847
848 /**
849 * Used as the {@code verificationCode} argument for
850 * {@link PackageManager#verifyPendingInstall} to indicate the calling
851 * package verifier does not vote to allow the installation to proceed.
852 */
853 public static final int VERIFICATION_REJECT = -1;
854
855 /**
rich canningsd9ef3e52012-08-22 14:28:05 -0700856 * Can be used as the {@code millisecondsToDelay} argument for
857 * {@link PackageManager#extendVerificationTimeout}. This is the
858 * maximum time {@code PackageManager} waits for the verification
859 * agent to return (in milliseconds).
860 */
861 public static final long MAXIMUM_VERIFICATION_TIMEOUT = 60*60*1000;
862
863 /**
Amith Yamasani0b285492011-04-14 17:35:23 -0700864 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: The device's
865 * audio pipeline is low-latency, more suitable for audio applications sensitive to delays or
866 * lag in sound input or output.
Dan Morrill898e1e82010-09-26 17:28:30 -0700867 */
868 @SdkConstant(SdkConstantType.FEATURE)
869 public static final String FEATURE_AUDIO_LOW_LATENCY = "android.hardware.audio.low_latency";
870
871 /**
872 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -0800873 * {@link #hasSystemFeature}: The device is capable of communicating with
874 * other devices via Bluetooth.
875 */
876 @SdkConstant(SdkConstantType.FEATURE)
877 public static final String FEATURE_BLUETOOTH = "android.hardware.bluetooth";
878
879 /**
880 * Feature for {@link #getSystemAvailableFeatures} and
Matthew Xiea7227722013-04-18 15:25:59 -0700881 * {@link #hasSystemFeature}: The device is capable of communicating with
882 * other devices via Bluetooth Low Energy radio.
883 */
884 @SdkConstant(SdkConstantType.FEATURE)
885 public static final String FEATURE_BLUETOOTH_LE = "android.hardware.bluetooth_le";
886
887 /**
888 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn08ee42c2009-11-19 17:08:01 -0800889 * {@link #hasSystemFeature}: The device has a camera facing away
890 * from the screen.
891 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -0800892 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -0800893 public static final String FEATURE_CAMERA = "android.hardware.camera";
Dan Morrill50ab63f2010-03-05 16:16:19 -0800894
Dianne Hackborn08ee42c2009-11-19 17:08:01 -0800895 /**
896 * Feature for {@link #getSystemAvailableFeatures} and
897 * {@link #hasSystemFeature}: The device's camera supports auto-focus.
898 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -0800899 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -0800900 public static final String FEATURE_CAMERA_AUTOFOCUS = "android.hardware.camera.autofocus";
Dan Morrill50ab63f2010-03-05 16:16:19 -0800901
Dianne Hackborn08ee42c2009-11-19 17:08:01 -0800902 /**
903 * Feature for {@link #getSystemAvailableFeatures} and
Eino-Ville Talvala752af832012-09-18 14:45:37 -0700904 * {@link #hasSystemFeature}: The device has at least one camera pointing in
905 * some direction.
Eino-Ville Talvala752af832012-09-18 14:45:37 -0700906 */
907 @SdkConstant(SdkConstantType.FEATURE)
908 public static final String FEATURE_CAMERA_ANY = "android.hardware.camera.any";
909
910 /**
911 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn08ee42c2009-11-19 17:08:01 -0800912 * {@link #hasSystemFeature}: The device's camera supports flash.
913 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -0800914 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -0800915 public static final String FEATURE_CAMERA_FLASH = "android.hardware.camera.flash";
Dan Morrill50ab63f2010-03-05 16:16:19 -0800916
917 /**
918 * Feature for {@link #getSystemAvailableFeatures} and
Chih-Chung Changde1057c2010-06-14 19:15:00 +0800919 * {@link #hasSystemFeature}: The device has a front facing camera.
920 */
921 @SdkConstant(SdkConstantType.FEATURE)
922 public static final String FEATURE_CAMERA_FRONT = "android.hardware.camera.front";
923
924 /**
925 * Feature for {@link #getSystemAvailableFeatures} and
Alex Ray0c9d61f2013-10-03 12:17:54 -0700926 * {@link #hasSystemFeature}: The device is capable of communicating with
927 * consumer IR devices.
928 */
929 @SdkConstant(SdkConstantType.FEATURE)
930 public static final String FEATURE_CONSUMER_IR = "android.hardware.consumerir";
931
932 /**
933 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -0800934 * {@link #hasSystemFeature}: The device supports one or more methods of
935 * reporting current location.
936 */
937 @SdkConstant(SdkConstantType.FEATURE)
938 public static final String FEATURE_LOCATION = "android.hardware.location";
939
940 /**
941 * Feature for {@link #getSystemAvailableFeatures} and
942 * {@link #hasSystemFeature}: The device has a Global Positioning System
943 * receiver and can report precise location.
944 */
945 @SdkConstant(SdkConstantType.FEATURE)
946 public static final String FEATURE_LOCATION_GPS = "android.hardware.location.gps";
947
948 /**
949 * Feature for {@link #getSystemAvailableFeatures} and
950 * {@link #hasSystemFeature}: The device can report location with coarse
951 * accuracy using a network-based geolocation system.
952 */
953 @SdkConstant(SdkConstantType.FEATURE)
954 public static final String FEATURE_LOCATION_NETWORK = "android.hardware.location.network";
955
956 /**
957 * Feature for {@link #getSystemAvailableFeatures} and
958 * {@link #hasSystemFeature}: The device can record audio via a
959 * microphone.
960 */
961 @SdkConstant(SdkConstantType.FEATURE)
962 public static final String FEATURE_MICROPHONE = "android.hardware.microphone";
963
964 /**
965 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill76437d32010-09-01 11:17:20 -0700966 * {@link #hasSystemFeature}: The device can communicate using Near-Field
967 * Communications (NFC).
968 */
969 @SdkConstant(SdkConstantType.FEATURE)
970 public static final String FEATURE_NFC = "android.hardware.nfc";
971
972 /**
973 * Feature for {@link #getSystemAvailableFeatures} and
Martijn Coenenf4bf1582013-07-22 12:01:19 -0700974 * {@link #hasSystemFeature}: The device supports host-
975 * based NFC card emulation.
Martijn Coenendf4d1d62013-08-28 11:18:58 -0700976 *
977 * TODO remove when depending apps have moved to new constant.
978 * @hide
979 * @deprecated
Martijn Coenenf4bf1582013-07-22 12:01:19 -0700980 */
981 @SdkConstant(SdkConstantType.FEATURE)
982 public static final String FEATURE_NFC_HCE = "android.hardware.nfc.hce";
983
984 /**
985 * Feature for {@link #getSystemAvailableFeatures} and
Martijn Coenendf4d1d62013-08-28 11:18:58 -0700986 * {@link #hasSystemFeature}: The device supports host-
987 * based NFC card emulation.
988 */
989 @SdkConstant(SdkConstantType.FEATURE)
990 public static final String FEATURE_NFC_HOST_CARD_EMULATION = "android.hardware.nfc.hce";
991
992 /**
993 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill5744bb42010-09-01 19:18:57 -0700994 * {@link #hasSystemFeature}: The device includes an accelerometer.
995 */
996 @SdkConstant(SdkConstantType.FEATURE)
997 public static final String FEATURE_SENSOR_ACCELEROMETER = "android.hardware.sensor.accelerometer";
998
999 /**
1000 * Feature for {@link #getSystemAvailableFeatures} and
1001 * {@link #hasSystemFeature}: The device includes a barometer (air
1002 * pressure sensor.)
1003 */
1004 @SdkConstant(SdkConstantType.FEATURE)
1005 public static final String FEATURE_SENSOR_BAROMETER = "android.hardware.sensor.barometer";
1006
1007 /**
1008 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001009 * {@link #hasSystemFeature}: The device includes a magnetometer (compass).
1010 */
1011 @SdkConstant(SdkConstantType.FEATURE)
1012 public static final String FEATURE_SENSOR_COMPASS = "android.hardware.sensor.compass";
1013
1014 /**
1015 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill5744bb42010-09-01 19:18:57 -07001016 * {@link #hasSystemFeature}: The device includes a gyroscope.
Dan Morrill50ab63f2010-03-05 16:16:19 -08001017 */
1018 @SdkConstant(SdkConstantType.FEATURE)
Dan Morrill5744bb42010-09-01 19:18:57 -07001019 public static final String FEATURE_SENSOR_GYROSCOPE = "android.hardware.sensor.gyroscope";
Dan Morrill50ab63f2010-03-05 16:16:19 -08001020
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001021 /**
1022 * Feature for {@link #getSystemAvailableFeatures} and
1023 * {@link #hasSystemFeature}: The device includes a light sensor.
1024 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001025 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001026 public static final String FEATURE_SENSOR_LIGHT = "android.hardware.sensor.light";
Dan Morrill50ab63f2010-03-05 16:16:19 -08001027
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001028 /**
1029 * Feature for {@link #getSystemAvailableFeatures} and
1030 * {@link #hasSystemFeature}: The device includes a proximity sensor.
1031 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001032 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001033 public static final String FEATURE_SENSOR_PROXIMITY = "android.hardware.sensor.proximity";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001034
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001035 /**
1036 * Feature for {@link #getSystemAvailableFeatures} and
Aravind Akella068b0c02013-10-12 17:39:15 -07001037 * {@link #hasSystemFeature}: The device includes a hardware step counter.
1038 */
1039 @SdkConstant(SdkConstantType.FEATURE)
1040 public static final String FEATURE_SENSOR_STEP_COUNTER = "android.hardware.sensor.stepcounter";
1041
1042 /**
1043 * Feature for {@link #getSystemAvailableFeatures} and
1044 * {@link #hasSystemFeature}: The device includes a hardware step detector.
1045 */
1046 @SdkConstant(SdkConstantType.FEATURE)
1047 public static final String FEATURE_SENSOR_STEP_DETECTOR = "android.hardware.sensor.stepdetector";
1048
1049 /**
1050 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001051 * {@link #hasSystemFeature}: The device has a telephony radio with data
1052 * communication support.
1053 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001054 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001055 public static final String FEATURE_TELEPHONY = "android.hardware.telephony";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001056
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001057 /**
1058 * Feature for {@link #getSystemAvailableFeatures} and
1059 * {@link #hasSystemFeature}: The device has a CDMA telephony stack.
1060 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001061 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001062 public static final String FEATURE_TELEPHONY_CDMA = "android.hardware.telephony.cdma";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001063
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001064 /**
1065 * Feature for {@link #getSystemAvailableFeatures} and
1066 * {@link #hasSystemFeature}: The device has a GSM telephony stack.
1067 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001068 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001069 public static final String FEATURE_TELEPHONY_GSM = "android.hardware.telephony.gsm";
Hung-ying Tyan3424c022010-08-27 18:08:19 +08001070
1071 /**
1072 * Feature for {@link #getSystemAvailableFeatures} and
Mike Lockwoodf4ca2472011-02-27 11:23:25 -08001073 * {@link #hasSystemFeature}: The device supports connecting to USB devices
1074 * as the USB host.
1075 */
1076 @SdkConstant(SdkConstantType.FEATURE)
1077 public static final String FEATURE_USB_HOST = "android.hardware.usb.host";
1078
1079 /**
1080 * Feature for {@link #getSystemAvailableFeatures} and
1081 * {@link #hasSystemFeature}: The device supports connecting to USB accessories.
1082 */
1083 @SdkConstant(SdkConstantType.FEATURE)
1084 public static final String FEATURE_USB_ACCESSORY = "android.hardware.usb.accessory";
1085
1086 /**
1087 * Feature for {@link #getSystemAvailableFeatures} and
Hung-ying Tyan3424c022010-08-27 18:08:19 +08001088 * {@link #hasSystemFeature}: The SIP API is enabled on the device.
1089 */
1090 @SdkConstant(SdkConstantType.FEATURE)
1091 public static final String FEATURE_SIP = "android.software.sip";
1092
1093 /**
1094 * Feature for {@link #getSystemAvailableFeatures} and
1095 * {@link #hasSystemFeature}: The device supports SIP-based VOIP.
1096 */
1097 @SdkConstant(SdkConstantType.FEATURE)
1098 public static final String FEATURE_SIP_VOIP = "android.software.sip.voip";
1099
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001100 /**
1101 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrillb0fe0332010-04-05 14:43:58 -07001102 * {@link #hasSystemFeature}: The device's display has a touch screen.
1103 */
1104 @SdkConstant(SdkConstantType.FEATURE)
1105 public static final String FEATURE_TOUCHSCREEN = "android.hardware.touchscreen";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001106
1107
Dan Morrillb0fe0332010-04-05 14:43:58 -07001108 /**
1109 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001110 * {@link #hasSystemFeature}: The device's touch screen supports
1111 * multitouch sufficient for basic two-finger gesture detection.
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001112 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001113 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001114 public static final String FEATURE_TOUCHSCREEN_MULTITOUCH = "android.hardware.touchscreen.multitouch";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001115
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001116 /**
1117 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001118 * {@link #hasSystemFeature}: The device's touch screen is capable of
1119 * tracking two or more fingers fully independently.
1120 */
1121 @SdkConstant(SdkConstantType.FEATURE)
1122 public static final String FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT = "android.hardware.touchscreen.multitouch.distinct";
1123
1124 /**
1125 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill6993d3d2010-09-03 14:30:14 -07001126 * {@link #hasSystemFeature}: The device's touch screen is capable of
1127 * tracking a full hand of fingers fully independently -- that is, 5 or
1128 * more simultaneous independent pointers.
1129 */
1130 @SdkConstant(SdkConstantType.FEATURE)
1131 public static final String FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND = "android.hardware.touchscreen.multitouch.jazzhand";
1132
1133 /**
1134 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrilla5376872011-01-23 13:15:53 -08001135 * {@link #hasSystemFeature}: The device does not have a touch screen, but
1136 * does support touch emulation for basic events. For instance, the
1137 * device might use a mouse or remote control to drive a cursor, and
1138 * emulate basic touch pointer events like down, up, drag, etc. All
1139 * devices that support android.hardware.touchscreen or a sub-feature are
1140 * presumed to also support faketouch.
1141 */
1142 @SdkConstant(SdkConstantType.FEATURE)
1143 public static final String FEATURE_FAKETOUCH = "android.hardware.faketouch";
1144
1145 /**
1146 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborne22fe932011-06-08 20:24:29 -07001147 * {@link #hasSystemFeature}: The device does not have a touch screen, but
1148 * does support touch emulation for basic events that supports distinct
1149 * tracking of two or more fingers. This is an extension of
1150 * {@link #FEATURE_FAKETOUCH} for input devices with this capability. Note
1151 * that unlike a distinct multitouch screen as defined by
1152 * {@link #FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT}, these kinds of input
1153 * devices will not actually provide full two-finger gestures since the
1154 * input is being transformed to cursor movement on the screen. That is,
1155 * single finger gestures will move a cursor; two-finger swipes will
1156 * result in single-finger touch events; other two-finger gestures will
1157 * result in the corresponding two-finger touch event.
1158 */
1159 @SdkConstant(SdkConstantType.FEATURE)
1160 public static final String FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT = "android.hardware.faketouch.multitouch.distinct";
1161
1162 /**
1163 * Feature for {@link #getSystemAvailableFeatures} and
1164 * {@link #hasSystemFeature}: The device does not have a touch screen, but
1165 * does support touch emulation for basic events that supports tracking
1166 * a hand of fingers (5 or more fingers) fully independently.
1167 * This is an extension of
1168 * {@link #FEATURE_FAKETOUCH} for input devices with this capability. Note
1169 * that unlike a multitouch screen as defined by
1170 * {@link #FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND}, not all two finger
1171 * gestures can be detected due to the limitations described for
1172 * {@link #FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT}.
1173 */
1174 @SdkConstant(SdkConstantType.FEATURE)
1175 public static final String FEATURE_FAKETOUCH_MULTITOUCH_JAZZHAND = "android.hardware.faketouch.multitouch.jazzhand";
1176
1177 /**
1178 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborne289bff2011-06-13 19:33:22 -07001179 * {@link #hasSystemFeature}: The device supports portrait orientation
1180 * screens. For backwards compatibility, you can assume that if neither
1181 * this nor {@link #FEATURE_SCREEN_LANDSCAPE} is set then the device supports
1182 * both portrait and landscape.
1183 */
1184 @SdkConstant(SdkConstantType.FEATURE)
1185 public static final String FEATURE_SCREEN_PORTRAIT = "android.hardware.screen.portrait";
1186
1187 /**
1188 * Feature for {@link #getSystemAvailableFeatures} and
1189 * {@link #hasSystemFeature}: The device supports landscape orientation
1190 * screens. For backwards compatibility, you can assume that if neither
1191 * this nor {@link #FEATURE_SCREEN_PORTRAIT} is set then the device supports
1192 * both portrait and landscape.
1193 */
1194 @SdkConstant(SdkConstantType.FEATURE)
1195 public static final String FEATURE_SCREEN_LANDSCAPE = "android.hardware.screen.landscape";
1196
1197 /**
1198 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001199 * {@link #hasSystemFeature}: The device supports live wallpapers.
1200 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001201 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001202 public static final String FEATURE_LIVE_WALLPAPER = "android.software.live_wallpaper";
Oscar Montemayor1228d0a2010-01-28 12:01:44 -08001203
Oscar Montemayor1228d0a2010-01-28 12:01:44 -08001204 /**
Dan Morrill50ab63f2010-03-05 16:16:19 -08001205 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn119bbc32013-03-22 17:27:25 -07001206 * {@link #hasSystemFeature}: The device supports app widgets.
1207 */
1208 @SdkConstant(SdkConstantType.FEATURE)
1209 public static final String FEATURE_APP_WIDGETS = "android.software.app_widgets";
1210
1211 /**
1212 * Feature for {@link #getSystemAvailableFeatures} and
1213 * {@link #hasSystemFeature}: The device supports a home screen that is replaceable
1214 * by third party applications.
1215 */
1216 @SdkConstant(SdkConstantType.FEATURE)
1217 public static final String FEATURE_HOME_SCREEN = "android.software.home_screen";
1218
1219 /**
1220 * Feature for {@link #getSystemAvailableFeatures} and
1221 * {@link #hasSystemFeature}: The device supports adding new input methods implemented
1222 * with the {@link android.inputmethodservice.InputMethodService} API.
1223 */
1224 @SdkConstant(SdkConstantType.FEATURE)
1225 public static final String FEATURE_INPUT_METHODS = "android.software.input_methods";
1226
1227 /**
1228 * Feature for {@link #getSystemAvailableFeatures} and
Amith Yamasani44a01b72013-09-16 10:44:57 -07001229 * {@link #hasSystemFeature}: The device supports device policy enforcement via device admins.
1230 */
1231 @SdkConstant(SdkConstantType.FEATURE)
1232 public static final String FEATURE_DEVICE_ADMIN = "android.software.device_admin";
1233
1234 /**
1235 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001236 * {@link #hasSystemFeature}: The device supports WiFi (802.11) networking.
1237 */
1238 @SdkConstant(SdkConstantType.FEATURE)
1239 public static final String FEATURE_WIFI = "android.hardware.wifi";
1240
1241 /**
Irfan Sheriff45b8b462011-09-07 11:24:16 -07001242 * Feature for {@link #getSystemAvailableFeatures} and
1243 * {@link #hasSystemFeature}: The device supports Wi-Fi Direct networking.
1244 */
1245 @SdkConstant(SdkConstantType.FEATURE)
1246 public static final String FEATURE_WIFI_DIRECT = "android.hardware.wifi.direct";
1247
1248 /**
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07001249 * Feature for {@link #getSystemAvailableFeatures} and
1250 * {@link #hasSystemFeature}: This is a device dedicated to showing UI
1251 * on a television. Television here is defined to be a typical living
1252 * room television experience: displayed on a big screen, where the user
1253 * is sitting far away from it, and the dominant form of input will be
1254 * something like a DPAD, not through touch or mouse.
1255 */
1256 @SdkConstant(SdkConstantType.FEATURE)
1257 public static final String FEATURE_TELEVISION = "android.hardware.type.television";
1258
1259 /**
Dianne Hackborne83cefce2010-02-04 17:38:14 -08001260 * Action to external storage service to clean out removed apps.
1261 * @hide
1262 */
1263 public static final String ACTION_CLEAN_EXTERNAL_STORAGE
1264 = "android.content.pm.CLEAN_EXTERNAL_STORAGE";
Oscar Montemayor1228d0a2010-01-28 12:01:44 -08001265
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001266 /**
Kenny Root5ab21572011-07-27 11:11:19 -07001267 * Extra field name for the URI to a verification file. Passed to a package
1268 * verifier.
1269 *
1270 * @hide
1271 */
1272 public static final String EXTRA_VERIFICATION_URI = "android.content.pm.extra.VERIFICATION_URI";
1273
1274 /**
1275 * Extra field name for the ID of a package pending verification. Passed to
1276 * a package verifier and is used to call back to
Kenny Root3a9b5fb2011-09-20 14:15:38 -07001277 * {@link PackageManager#verifyPendingInstall(int, int)}
Kenny Root5ab21572011-07-27 11:11:19 -07001278 */
1279 public static final String EXTRA_VERIFICATION_ID = "android.content.pm.extra.VERIFICATION_ID";
1280
1281 /**
1282 * Extra field name for the package identifier which is trying to install
1283 * the package.
1284 *
1285 * @hide
1286 */
1287 public static final String EXTRA_VERIFICATION_INSTALLER_PACKAGE
1288 = "android.content.pm.extra.VERIFICATION_INSTALLER_PACKAGE";
1289
1290 /**
1291 * Extra field name for the requested install flags for a package pending
1292 * verification. Passed to a package verifier.
1293 *
1294 * @hide
1295 */
1296 public static final String EXTRA_VERIFICATION_INSTALL_FLAGS
1297 = "android.content.pm.extra.VERIFICATION_INSTALL_FLAGS";
1298
1299 /**
rich cannings13d428e2012-09-13 13:43:07 -07001300 * Extra field name for the uid of who is requesting to install
1301 * the package.
1302 *
1303 * @hide
1304 */
1305 public static final String EXTRA_VERIFICATION_INSTALLER_UID
1306 = "android.content.pm.extra.VERIFICATION_INSTALLER_UID";
1307
1308 /**
1309 * Extra field name for the package name of a package pending verification.
1310 *
1311 * @hide
1312 */
1313 public static final String EXTRA_VERIFICATION_PACKAGE_NAME
1314 = "android.content.pm.extra.VERIFICATION_PACKAGE_NAME";
1315 /**
rich canningsd1b5cfc2012-08-29 14:49:51 -07001316 * Extra field name for the result of a verification, either
1317 * {@link #VERIFICATION_ALLOW}, or {@link #VERIFICATION_REJECT}.
1318 * Passed to package verifiers after a package is verified.
1319 */
1320 public static final String EXTRA_VERIFICATION_RESULT
1321 = "android.content.pm.extra.VERIFICATION_RESULT";
1322
1323 /**
rich cannings13d428e2012-09-13 13:43:07 -07001324 * Extra field name for the version code of a package pending verification.
1325 *
1326 * @hide
1327 */
1328 public static final String EXTRA_VERIFICATION_VERSION_CODE
1329 = "android.content.pm.extra.VERIFICATION_VERSION_CODE";
1330
1331 /**
Nick Kralevich035f80d2013-03-27 15:20:08 -07001332 * The action used to request that the user approve a permission request
1333 * from the application.
1334 *
1335 * @hide
1336 */
1337 public static final String ACTION_REQUEST_PERMISSION
1338 = "android.content.pm.action.REQUEST_PERMISSION";
1339
1340 /**
1341 * Extra field name for the list of permissions, which the user must approve.
1342 *
1343 * @hide
1344 */
1345 public static final String EXTRA_REQUEST_PERMISSION_PERMISSION_LIST
1346 = "android.content.pm.extra.PERMISSION_LIST";
1347
1348 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001349 * Retrieve overall information about an application package that is
1350 * installed on the system.
Kenny Root5ab21572011-07-27 11:11:19 -07001351 * <p>
1352 * Throws {@link NameNotFoundException} if a package with the given name can
1353 * not be found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001354 *
1355 * @param packageName The full name (i.e. com.google.apps.contacts) of the
Kenny Root5ab21572011-07-27 11:11:19 -07001356 * desired package.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001357 * @param flags Additional option flags. Use any combination of
Kenny Root5ab21572011-07-27 11:11:19 -07001358 * {@link #GET_ACTIVITIES}, {@link #GET_GIDS},
1359 * {@link #GET_CONFIGURATIONS}, {@link #GET_INSTRUMENTATION},
1360 * {@link #GET_PERMISSIONS}, {@link #GET_PROVIDERS},
1361 * {@link #GET_RECEIVERS}, {@link #GET_SERVICES},
1362 * {@link #GET_SIGNATURES}, {@link #GET_UNINSTALLED_PACKAGES} to
1363 * modify the data returned.
1364 * @return Returns a PackageInfo object containing information about the
1365 * package. If flag GET_UNINSTALLED_PACKAGES is set and if the
1366 * package is not found in the list of installed applications, the
1367 * package information is retrieved from the list of uninstalled
kmccormick30498b42013-03-27 17:39:17 -07001368 * applications (which includes installed applications as well as
1369 * applications with data directory i.e. applications which had been
1370 * deleted with {@code DONT_DELETE_DATA} flag set).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001371 * @see #GET_ACTIVITIES
1372 * @see #GET_GIDS
1373 * @see #GET_CONFIGURATIONS
1374 * @see #GET_INSTRUMENTATION
1375 * @see #GET_PERMISSIONS
1376 * @see #GET_PROVIDERS
1377 * @see #GET_RECEIVERS
1378 * @see #GET_SERVICES
1379 * @see #GET_SIGNATURES
1380 * @see #GET_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001381 */
1382 public abstract PackageInfo getPackageInfo(String packageName, int flags)
1383 throws NameNotFoundException;
1384
1385 /**
Dianne Hackborn47096932010-02-11 15:57:09 -08001386 * Map from the current package names in use on the device to whatever
1387 * the current canonical name of that package is.
1388 * @param names Array of current names to be mapped.
1389 * @return Returns an array of the same size as the original, containing
1390 * the canonical name for each package.
1391 */
1392 public abstract String[] currentToCanonicalPackageNames(String[] names);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001393
Dianne Hackborn47096932010-02-11 15:57:09 -08001394 /**
1395 * Map from a packages canonical name to the current name in use on the device.
1396 * @param names Array of new names to be mapped.
1397 * @return Returns an array of the same size as the original, containing
1398 * the current name for each package.
1399 */
1400 public abstract String[] canonicalToCurrentPackageNames(String[] names);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001401
Dianne Hackborn47096932010-02-11 15:57:09 -08001402 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001403 * Return a "good" intent to launch a front-door activity in a package,
1404 * for use for example to implement an "open" button when browsing through
1405 * packages. The current implementation will look first for a main
1406 * activity in the category {@link Intent#CATEGORY_INFO}, next for a
1407 * main activity in the category {@link Intent#CATEGORY_LAUNCHER}, or return
1408 * null if neither are found.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001409 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001410 * <p>Throws {@link NameNotFoundException} if a package with the given
kmccormick30498b42013-03-27 17:39:17 -07001411 * name cannot be found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001412 *
1413 * @param packageName The name of the package to inspect.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001414 *
Dianne Hackborn19415762010-12-15 00:20:27 -08001415 * @return Returns either a fully-qualified Intent that can be used to
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001416 * launch the main activity in the package, or null if the package does
1417 * not contain such an activity.
1418 */
Mihai Predaeae850c2009-05-13 10:13:48 +02001419 public abstract Intent getLaunchIntentForPackage(String packageName);
1420
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001421 /**
1422 * Return an array of all of the secondary group-ids that have been
1423 * assigned to a package.
1424 *
1425 * <p>Throws {@link NameNotFoundException} if a package with the given
kmccormick30498b42013-03-27 17:39:17 -07001426 * name cannot be found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001427 *
1428 * @param packageName The full name (i.e. com.google.apps.contacts) of the
1429 * desired package.
1430 *
1431 * @return Returns an int array of the assigned gids, or null if there
1432 * are none.
1433 */
1434 public abstract int[] getPackageGids(String packageName)
1435 throws NameNotFoundException;
1436
1437 /**
Dianne Hackborna06de0f2012-12-11 16:34:47 -08001438 * @hide Return the uid associated with the given package name for the
1439 * given user.
1440 *
1441 * <p>Throws {@link NameNotFoundException} if a package with the given
1442 * name can not be found on the system.
1443 *
1444 * @param packageName The full name (i.e. com.google.apps.contacts) of the
1445 * desired package.
1446 * @param userHandle The user handle identifier to look up the package under.
1447 *
1448 * @return Returns an integer uid who owns the given package name.
1449 */
1450 public abstract int getPackageUid(String packageName, int userHandle)
1451 throws NameNotFoundException;
1452
1453 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001454 * Retrieve all of the information we know about a particular permission.
1455 *
1456 * <p>Throws {@link NameNotFoundException} if a permission with the given
kmccormick30498b42013-03-27 17:39:17 -07001457 * name cannot be found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001458 *
1459 * @param name The fully qualified name (i.e. com.google.permission.LOGIN)
1460 * of the permission you are interested in.
1461 * @param flags Additional option flags. Use {@link #GET_META_DATA} to
1462 * retrieve any meta-data associated with the permission.
1463 *
1464 * @return Returns a {@link PermissionInfo} containing information about the
1465 * permission.
1466 */
1467 public abstract PermissionInfo getPermissionInfo(String name, int flags)
1468 throws NameNotFoundException;
1469
1470 /**
1471 * Query for all of the permissions associated with a particular group.
1472 *
1473 * <p>Throws {@link NameNotFoundException} if the given group does not
1474 * exist.
1475 *
1476 * @param group The fully qualified name (i.e. com.google.permission.LOGIN)
1477 * of the permission group you are interested in. Use null to
1478 * find all of the permissions not associated with a group.
1479 * @param flags Additional option flags. Use {@link #GET_META_DATA} to
1480 * retrieve any meta-data associated with the permissions.
1481 *
1482 * @return Returns a list of {@link PermissionInfo} containing information
1483 * about all of the permissions in the given group.
1484 */
1485 public abstract List<PermissionInfo> queryPermissionsByGroup(String group,
1486 int flags) throws NameNotFoundException;
1487
1488 /**
1489 * Retrieve all of the information we know about a particular group of
1490 * permissions.
1491 *
1492 * <p>Throws {@link NameNotFoundException} if a permission group with the given
kmccormick30498b42013-03-27 17:39:17 -07001493 * name cannot be found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001494 *
1495 * @param name The fully qualified name (i.e. com.google.permission_group.APPS)
1496 * of the permission you are interested in.
1497 * @param flags Additional option flags. Use {@link #GET_META_DATA} to
1498 * retrieve any meta-data associated with the permission group.
1499 *
1500 * @return Returns a {@link PermissionGroupInfo} containing information
1501 * about the permission.
1502 */
1503 public abstract PermissionGroupInfo getPermissionGroupInfo(String name,
1504 int flags) throws NameNotFoundException;
1505
1506 /**
1507 * Retrieve all of the known permission groups in the system.
1508 *
1509 * @param flags Additional option flags. Use {@link #GET_META_DATA} to
1510 * retrieve any meta-data associated with the permission group.
1511 *
1512 * @return Returns a list of {@link PermissionGroupInfo} containing
1513 * information about all of the known permission groups.
1514 */
1515 public abstract List<PermissionGroupInfo> getAllPermissionGroups(int flags);
1516
1517 /**
1518 * Retrieve all of the information we know about a particular
1519 * package/application.
1520 *
1521 * <p>Throws {@link NameNotFoundException} if an application with the given
kmccormick30498b42013-03-27 17:39:17 -07001522 * package name cannot be found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001523 *
1524 * @param packageName The full name (i.e. com.google.apps.contacts) of an
1525 * application.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001526 * @param flags Additional option flags. Use any combination of
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001527 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
1528 * {@link #GET_UNINSTALLED_PACKAGES} to modify the data returned.
1529 *
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001530 * @return {@link ApplicationInfo} Returns ApplicationInfo object containing
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001531 * information about the package.
1532 * If flag GET_UNINSTALLED_PACKAGES is set and if the package is not
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001533 * found in the list of installed applications,
1534 * the application information is retrieved from the
1535 * list of uninstalled applications(which includes
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001536 * installed applications as well as applications
1537 * with data directory ie applications which had been
kmccormick30498b42013-03-27 17:39:17 -07001538 * deleted with {@code DONT_DELETE_DATA} flag set).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001539 *
1540 * @see #GET_META_DATA
1541 * @see #GET_SHARED_LIBRARY_FILES
1542 * @see #GET_UNINSTALLED_PACKAGES
1543 */
1544 public abstract ApplicationInfo getApplicationInfo(String packageName,
1545 int flags) throws NameNotFoundException;
1546
1547 /**
1548 * Retrieve all of the information we know about a particular activity
1549 * class.
1550 *
1551 * <p>Throws {@link NameNotFoundException} if an activity with the given
kmccormick30498b42013-03-27 17:39:17 -07001552 * class name cannot be found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001553 *
Dianne Hackborn361199b2010-08-30 17:42:07 -07001554 * @param component The full component name (i.e.
1555 * com.google.apps.contacts/com.google.apps.contacts.ContactsList) of an Activity
1556 * class.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001557 * @param flags Additional option flags. Use any combination of
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001558 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
1559 * to modify the data (in ApplicationInfo) returned.
1560 *
1561 * @return {@link ActivityInfo} containing information about the activity.
1562 *
1563 * @see #GET_INTENT_FILTERS
1564 * @see #GET_META_DATA
1565 * @see #GET_SHARED_LIBRARY_FILES
1566 */
Dianne Hackborn361199b2010-08-30 17:42:07 -07001567 public abstract ActivityInfo getActivityInfo(ComponentName component,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001568 int flags) throws NameNotFoundException;
1569
1570 /**
1571 * Retrieve all of the information we know about a particular receiver
1572 * class.
1573 *
1574 * <p>Throws {@link NameNotFoundException} if a receiver with the given
kmccormick30498b42013-03-27 17:39:17 -07001575 * class name cannot be found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001576 *
Dianne Hackborn361199b2010-08-30 17:42:07 -07001577 * @param component The full component name (i.e.
1578 * com.google.apps.calendar/com.google.apps.calendar.CalendarAlarm) of a Receiver
1579 * class.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001580 * @param flags Additional option flags. Use any combination of
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001581 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
1582 * to modify the data returned.
1583 *
1584 * @return {@link ActivityInfo} containing information about the receiver.
1585 *
1586 * @see #GET_INTENT_FILTERS
1587 * @see #GET_META_DATA
1588 * @see #GET_SHARED_LIBRARY_FILES
1589 */
Dianne Hackborn361199b2010-08-30 17:42:07 -07001590 public abstract ActivityInfo getReceiverInfo(ComponentName component,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001591 int flags) throws NameNotFoundException;
1592
1593 /**
1594 * Retrieve all of the information we know about a particular service
1595 * class.
1596 *
1597 * <p>Throws {@link NameNotFoundException} if a service with the given
kmccormick30498b42013-03-27 17:39:17 -07001598 * class name cannot be found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001599 *
Dianne Hackborn361199b2010-08-30 17:42:07 -07001600 * @param component The full component name (i.e.
1601 * com.google.apps.media/com.google.apps.media.BackgroundPlayback) of a Service
1602 * class.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001603 * @param flags Additional option flags. Use any combination of
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001604 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
1605 * to modify the data returned.
1606 *
1607 * @return ServiceInfo containing information about the service.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001608 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001609 * @see #GET_META_DATA
1610 * @see #GET_SHARED_LIBRARY_FILES
1611 */
Dianne Hackborn361199b2010-08-30 17:42:07 -07001612 public abstract ServiceInfo getServiceInfo(ComponentName component,
1613 int flags) throws NameNotFoundException;
1614
1615 /**
1616 * Retrieve all of the information we know about a particular content
1617 * provider class.
1618 *
1619 * <p>Throws {@link NameNotFoundException} if a provider with the given
kmccormick30498b42013-03-27 17:39:17 -07001620 * class name cannot be found on the system.
Dianne Hackborn361199b2010-08-30 17:42:07 -07001621 *
1622 * @param component The full component name (i.e.
1623 * com.google.providers.media/com.google.providers.media.MediaProvider) of a
1624 * ContentProvider class.
1625 * @param flags Additional option flags. Use any combination of
1626 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
1627 * to modify the data returned.
1628 *
1629 * @return ProviderInfo containing information about the service.
1630 *
1631 * @see #GET_META_DATA
1632 * @see #GET_SHARED_LIBRARY_FILES
1633 */
1634 public abstract ProviderInfo getProviderInfo(ComponentName component,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001635 int flags) throws NameNotFoundException;
1636
1637 /**
1638 * Return a List of all packages that are installed
1639 * on the device.
1640 *
1641 * @param flags Additional option flags. Use any combination of
1642 * {@link #GET_ACTIVITIES},
1643 * {@link #GET_GIDS},
1644 * {@link #GET_CONFIGURATIONS},
1645 * {@link #GET_INSTRUMENTATION},
1646 * {@link #GET_PERMISSIONS},
1647 * {@link #GET_PROVIDERS},
1648 * {@link #GET_RECEIVERS},
1649 * {@link #GET_SERVICES},
1650 * {@link #GET_SIGNATURES},
1651 * {@link #GET_UNINSTALLED_PACKAGES} to modify the data returned.
1652 *
1653 * @return A List of PackageInfo objects, one for each package that is
1654 * installed on the device. In the unlikely case of there being no
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001655 * installed packages, an empty list is returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001656 * If flag GET_UNINSTALLED_PACKAGES is set, a list of all
kmccormick30498b42013-03-27 17:39:17 -07001657 * applications including those deleted with {@code DONT_DELETE_DATA}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001658 * (partially installed apps with data directory) will be returned.
1659 *
1660 * @see #GET_ACTIVITIES
1661 * @see #GET_GIDS
1662 * @see #GET_CONFIGURATIONS
1663 * @see #GET_INSTRUMENTATION
1664 * @see #GET_PERMISSIONS
1665 * @see #GET_PROVIDERS
1666 * @see #GET_RECEIVERS
1667 * @see #GET_SERVICES
1668 * @see #GET_SIGNATURES
1669 * @see #GET_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001670 */
1671 public abstract List<PackageInfo> getInstalledPackages(int flags);
1672
1673 /**
Dianne Hackborne7991752013-01-16 17:56:46 -08001674 * Return a List of all installed packages that are currently
1675 * holding any of the given permissions.
1676 *
1677 * @param flags Additional option flags. Use any combination of
1678 * {@link #GET_ACTIVITIES},
1679 * {@link #GET_GIDS},
1680 * {@link #GET_CONFIGURATIONS},
1681 * {@link #GET_INSTRUMENTATION},
1682 * {@link #GET_PERMISSIONS},
1683 * {@link #GET_PROVIDERS},
1684 * {@link #GET_RECEIVERS},
1685 * {@link #GET_SERVICES},
1686 * {@link #GET_SIGNATURES},
1687 * {@link #GET_UNINSTALLED_PACKAGES} to modify the data returned.
1688 *
1689 * @return Returns a List of PackageInfo objects, one for each installed
1690 * application that is holding any of the permissions that were provided.
1691 *
1692 * @see #GET_ACTIVITIES
1693 * @see #GET_GIDS
1694 * @see #GET_CONFIGURATIONS
1695 * @see #GET_INSTRUMENTATION
1696 * @see #GET_PERMISSIONS
1697 * @see #GET_PROVIDERS
1698 * @see #GET_RECEIVERS
1699 * @see #GET_SERVICES
1700 * @see #GET_SIGNATURES
1701 * @see #GET_UNINSTALLED_PACKAGES
1702 */
1703 public abstract List<PackageInfo> getPackagesHoldingPermissions(
1704 String[] permissions, int flags);
1705
1706 /**
Amith Yamasani151ec4c2012-09-07 19:25:16 -07001707 * Return a List of all packages that are installed on the device, for a specific user.
1708 * Requesting a list of installed packages for another user
1709 * will require the permission INTERACT_ACROSS_USERS_FULL.
1710 * @param flags Additional option flags. Use any combination of
1711 * {@link #GET_ACTIVITIES},
1712 * {@link #GET_GIDS},
1713 * {@link #GET_CONFIGURATIONS},
1714 * {@link #GET_INSTRUMENTATION},
1715 * {@link #GET_PERMISSIONS},
1716 * {@link #GET_PROVIDERS},
1717 * {@link #GET_RECEIVERS},
1718 * {@link #GET_SERVICES},
1719 * {@link #GET_SIGNATURES},
1720 * {@link #GET_UNINSTALLED_PACKAGES} to modify the data returned.
1721 * @param userId The user for whom the installed packages are to be listed
1722 *
1723 * @return A List of PackageInfo objects, one for each package that is
1724 * installed on the device. In the unlikely case of there being no
1725 * installed packages, an empty list is returned.
1726 * If flag GET_UNINSTALLED_PACKAGES is set, a list of all
kmccormick30498b42013-03-27 17:39:17 -07001727 * applications including those deleted with {@code DONT_DELETE_DATA}
Amith Yamasani151ec4c2012-09-07 19:25:16 -07001728 * (partially installed apps with data directory) will be returned.
1729 *
1730 * @see #GET_ACTIVITIES
1731 * @see #GET_GIDS
1732 * @see #GET_CONFIGURATIONS
1733 * @see #GET_INSTRUMENTATION
1734 * @see #GET_PERMISSIONS
1735 * @see #GET_PROVIDERS
1736 * @see #GET_RECEIVERS
1737 * @see #GET_SERVICES
1738 * @see #GET_SIGNATURES
1739 * @see #GET_UNINSTALLED_PACKAGES
1740 *
1741 * @hide
1742 */
1743 public abstract List<PackageInfo> getInstalledPackages(int flags, int userId);
1744
1745 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001746 * Check whether a particular package has been granted a particular
1747 * permission.
1748 *
1749 * @param permName The name of the permission you are checking for,
1750 * @param pkgName The name of the package you are checking against.
1751 *
1752 * @return If the package has the permission, PERMISSION_GRANTED is
1753 * returned. If it does not have the permission, PERMISSION_DENIED
1754 * is returned.
1755 *
1756 * @see #PERMISSION_GRANTED
1757 * @see #PERMISSION_DENIED
1758 */
1759 public abstract int checkPermission(String permName, String pkgName);
1760
1761 /**
1762 * Add a new dynamic permission to the system. For this to work, your
1763 * package must have defined a permission tree through the
1764 * {@link android.R.styleable#AndroidManifestPermissionTree
1765 * &lt;permission-tree&gt;} tag in its manifest. A package can only add
1766 * permissions to trees that were defined by either its own package or
1767 * another with the same user id; a permission is in a tree if it
1768 * matches the name of the permission tree + ".": for example,
1769 * "com.foo.bar" is a member of the permission tree "com.foo".
1770 *
1771 * <p>It is good to make your permission tree name descriptive, because you
1772 * are taking possession of that entire set of permission names. Thus, it
1773 * must be under a domain you control, with a suffix that will not match
1774 * any normal permissions that may be declared in any applications that
1775 * are part of that domain.
1776 *
1777 * <p>New permissions must be added before
1778 * any .apks are installed that use those permissions. Permissions you
1779 * add through this method are remembered across reboots of the device.
1780 * If the given permission already exists, the info you supply here
1781 * will be used to update it.
1782 *
1783 * @param info Description of the permission to be added.
1784 *
1785 * @return Returns true if a new permission was created, false if an
1786 * existing one was updated.
1787 *
1788 * @throws SecurityException if you are not allowed to add the
1789 * given permission name.
1790 *
1791 * @see #removePermission(String)
1792 */
1793 public abstract boolean addPermission(PermissionInfo info);
1794
1795 /**
Dianne Hackbornd7c09682010-03-30 10:42:20 -07001796 * Like {@link #addPermission(PermissionInfo)} but asynchronously
1797 * persists the package manager state after returning from the call,
1798 * allowing it to return quicker and batch a series of adds at the
1799 * expense of no guarantee the added permission will be retained if
1800 * the device is rebooted before it is written.
1801 */
1802 public abstract boolean addPermissionAsync(PermissionInfo info);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001803
Dianne Hackbornd7c09682010-03-30 10:42:20 -07001804 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001805 * Removes a permission that was previously added with
1806 * {@link #addPermission(PermissionInfo)}. The same ownership rules apply
1807 * -- you are only allowed to remove permissions that you are allowed
1808 * to add.
1809 *
1810 * @param name The name of the permission to remove.
1811 *
1812 * @throws SecurityException if you are not allowed to remove the
1813 * given permission name.
1814 *
1815 * @see #addPermission(PermissionInfo)
1816 */
1817 public abstract void removePermission(String name);
1818
1819 /**
Nick Kralevich035f80d2013-03-27 15:20:08 -07001820 * Returns an {@link Intent} suitable for passing to {@code startActivityForResult}
1821 * which prompts the user to grant {@code permissions} to this application.
Nick Kralevich32eb5b182013-04-11 10:20:09 -07001822 * @hide
Nick Kralevich035f80d2013-03-27 15:20:08 -07001823 *
1824 * @throws NullPointerException if {@code permissions} is {@code null}.
1825 * @throws IllegalArgumentException if {@code permissions} contains {@code null}.
1826 */
1827 public Intent buildPermissionRequestIntent(String... permissions) {
1828 if (permissions == null) {
1829 throw new NullPointerException("permissions cannot be null");
1830 }
1831 for (String permission : permissions) {
1832 if (permission == null) {
1833 throw new IllegalArgumentException("permissions cannot contain null");
1834 }
1835 }
1836
1837 Intent i = new Intent(ACTION_REQUEST_PERMISSION);
1838 i.putExtra(EXTRA_REQUEST_PERMISSION_PERMISSION_LIST, permissions);
1839 i.setPackage("com.android.packageinstaller");
1840 return i;
1841 }
1842
1843 /**
Dianne Hackborne639da72012-02-21 15:11:13 -08001844 * Grant a permission to an application which the application does not
1845 * already have. The permission must have been requested by the application,
1846 * but as an optional permission. If the application is not allowed to
1847 * hold the permission, a SecurityException is thrown.
1848 * @hide
1849 *
1850 * @param packageName The name of the package that the permission will be
1851 * granted to.
1852 * @param permissionName The name of the permission.
1853 */
1854 public abstract void grantPermission(String packageName, String permissionName);
1855
1856 /**
1857 * Revoke a permission that was previously granted by {@link #grantPermission}.
1858 * @hide
1859 *
1860 * @param packageName The name of the package that the permission will be
1861 * granted to.
1862 * @param permissionName The name of the permission.
1863 */
1864 public abstract void revokePermission(String packageName, String permissionName);
1865
1866 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001867 * Compare the signatures of two packages to determine if the same
1868 * signature appears in both of them. If they do contain the same
1869 * signature, then they are allowed special privileges when working
1870 * with each other: they can share the same user-id, run instrumentation
1871 * against each other, etc.
1872 *
1873 * @param pkg1 First package name whose signature will be compared.
1874 * @param pkg2 Second package name whose signature will be compared.
Chris Palmer09f33602010-09-13 14:27:18 -07001875 *
1876 * @return Returns an integer indicating whether all signatures on the
1877 * two packages match. The value is >= 0 ({@link #SIGNATURE_MATCH}) if
1878 * all signatures match or < 0 if there is not a match ({@link
1879 * #SIGNATURE_NO_MATCH} or {@link #SIGNATURE_UNKNOWN_PACKAGE}).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001880 *
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07001881 * @see #checkSignatures(int, int)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001882 * @see #SIGNATURE_MATCH
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001883 * @see #SIGNATURE_NO_MATCH
1884 * @see #SIGNATURE_UNKNOWN_PACKAGE
1885 */
1886 public abstract int checkSignatures(String pkg1, String pkg2);
1887
1888 /**
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07001889 * Like {@link #checkSignatures(String, String)}, but takes UIDs of
1890 * the two packages to be checked. This can be useful, for example,
1891 * when doing the check in an IPC, where the UID is the only identity
1892 * available. It is functionally identical to determining the package
1893 * associated with the UIDs and checking their signatures.
1894 *
Joe Onorato25660ec2009-08-12 22:40:37 -07001895 * @param uid1 First UID whose signature will be compared.
1896 * @param uid2 Second UID whose signature will be compared.
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07001897 *
Chris Palmer09f33602010-09-13 14:27:18 -07001898 * @return Returns an integer indicating whether all signatures on the
1899 * two packages match. The value is >= 0 ({@link #SIGNATURE_MATCH}) if
1900 * all signatures match or < 0 if there is not a match ({@link
1901 * #SIGNATURE_NO_MATCH} or {@link #SIGNATURE_UNKNOWN_PACKAGE}).
1902 *
1903 * @see #checkSignatures(String, String)
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07001904 * @see #SIGNATURE_MATCH
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07001905 * @see #SIGNATURE_NO_MATCH
1906 * @see #SIGNATURE_UNKNOWN_PACKAGE
1907 */
1908 public abstract int checkSignatures(int uid1, int uid2);
1909
1910 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001911 * Retrieve the names of all packages that are associated with a particular
1912 * user id. In most cases, this will be a single package name, the package
1913 * that has been assigned that user id. Where there are multiple packages
1914 * sharing the same user id through the "sharedUserId" mechanism, all
1915 * packages with that id will be returned.
1916 *
1917 * @param uid The user id for which you would like to retrieve the
1918 * associated packages.
1919 *
1920 * @return Returns an array of one or more packages assigned to the user
1921 * id, or null if there are no known packages with the given id.
1922 */
1923 public abstract String[] getPackagesForUid(int uid);
1924
1925 /**
1926 * Retrieve the official name associated with a user id. This name is
1927 * guaranteed to never change, though it is possibly for the underlying
1928 * user id to be changed. That is, if you are storing information about
1929 * user ids in persistent storage, you should use the string returned
1930 * by this function instead of the raw user-id.
1931 *
1932 * @param uid The user id for which you would like to retrieve a name.
1933 * @return Returns a unique name for the given user id, or null if the
1934 * user id is not currently assigned.
1935 */
1936 public abstract String getNameForUid(int uid);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001937
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001938 /**
1939 * Return the user id associated with a shared user name. Multiple
1940 * applications can specify a shared user name in their manifest and thus
1941 * end up using a common uid. This might be used for new applications
1942 * that use an existing shared user name and need to know the uid of the
1943 * shared user.
1944 *
1945 * @param sharedUserName The shared user name whose uid is to be retrieved.
1946 * @return Returns the uid associated with the shared user, or NameNotFoundException
1947 * if the shared user name is not being used by any installed packages
1948 * @hide
1949 */
1950 public abstract int getUidForSharedUser(String sharedUserName)
1951 throws NameNotFoundException;
1952
1953 /**
1954 * Return a List of all application packages that are installed on the
1955 * device. If flag GET_UNINSTALLED_PACKAGES has been set, a list of all
kmccormick30498b42013-03-27 17:39:17 -07001956 * applications including those deleted with {@code DONT_DELETE_DATA} (partially
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001957 * installed apps with data directory) will be returned.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001958 *
1959 * @param flags Additional option flags. Use any combination of
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001960 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
Jeff Smitha45746e2012-07-19 14:19:24 -05001961 * {@link #GET_UNINSTALLED_PACKAGES} to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001962 *
Dianne Hackborne7991752013-01-16 17:56:46 -08001963 * @return Returns a List of ApplicationInfo objects, one for each application that
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001964 * is installed on the device. In the unlikely case of there being
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001965 * no installed applications, an empty list is returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001966 * If flag GET_UNINSTALLED_PACKAGES is set, a list of all
kmccormick30498b42013-03-27 17:39:17 -07001967 * applications including those deleted with {@code DONT_DELETE_DATA}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001968 * (partially installed apps with data directory) will be returned.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001969 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001970 * @see #GET_META_DATA
1971 * @see #GET_SHARED_LIBRARY_FILES
1972 * @see #GET_UNINSTALLED_PACKAGES
1973 */
1974 public abstract List<ApplicationInfo> getInstalledApplications(int flags);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001975
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001976 /**
1977 * Get a list of shared libraries that are available on the
1978 * system.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001979 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001980 * @return An array of shared library names that are
1981 * available on the system, or null if none are installed.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001982 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001983 */
1984 public abstract String[] getSystemSharedLibraryNames();
1985
1986 /**
Dianne Hackborn49237342009-08-27 20:08:01 -07001987 * Get a list of features that are available on the
1988 * system.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001989 *
Dianne Hackborn49237342009-08-27 20:08:01 -07001990 * @return An array of FeatureInfo classes describing the features
1991 * that are available on the system, or null if there are none(!!).
Dianne Hackborn49237342009-08-27 20:08:01 -07001992 */
1993 public abstract FeatureInfo[] getSystemAvailableFeatures();
1994
1995 /**
Dianne Hackborn039c68e2009-09-26 16:39:23 -07001996 * Check whether the given feature name is one of the available
1997 * features as returned by {@link #getSystemAvailableFeatures()}.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001998 *
Dianne Hackborn039c68e2009-09-26 16:39:23 -07001999 * @return Returns true if the devices supports the feature, else
2000 * false.
2001 */
2002 public abstract boolean hasSystemFeature(String name);
2003
2004 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002005 * Determine the best action to perform for a given Intent. This is how
2006 * {@link Intent#resolveActivity} finds an activity if a class has not
2007 * been explicitly specified.
2008 *
Scott Mainef6b3052011-03-23 14:23:02 -07002009 * <p><em>Note:</em> if using an implicit Intent (without an explicit ComponentName
Dianne Hackborn4d023d212010-10-01 13:41:04 -07002010 * specified), be sure to consider whether to set the {@link #MATCH_DEFAULT_ONLY}
2011 * only flag. You need to do so to resolve the activity in the same way
2012 * that {@link android.content.Context#startActivity(Intent)} and
2013 * {@link android.content.Intent#resolveActivity(PackageManager)
2014 * Intent.resolveActivity(PackageManager)} do.</p>
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002015 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002016 * @param intent An intent containing all of the desired specification
2017 * (action, data, type, category, and/or component).
2018 * @param flags Additional option flags. The most important is
Dianne Hackborn4d023d212010-10-01 13:41:04 -07002019 * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only
2020 * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002021 *
2022 * @return Returns a ResolveInfo containing the final activity intent that
2023 * was determined to be the best action. Returns null if no
Mike LeBeaubd3f5272010-02-18 19:27:17 -08002024 * matching activity was found. If multiple matching activities are
2025 * found and there is no default set, returns a ResolveInfo
2026 * containing something else, such as the activity resolver.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002027 *
2028 * @see #MATCH_DEFAULT_ONLY
2029 * @see #GET_INTENT_FILTERS
2030 * @see #GET_RESOLVED_FILTER
2031 */
2032 public abstract ResolveInfo resolveActivity(Intent intent, int flags);
2033
2034 /**
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07002035 * Determine the best action to perform for a given Intent for a given user. This
2036 * is how {@link Intent#resolveActivity} finds an activity if a class has not
2037 * been explicitly specified.
2038 *
2039 * <p><em>Note:</em> if using an implicit Intent (without an explicit ComponentName
2040 * specified), be sure to consider whether to set the {@link #MATCH_DEFAULT_ONLY}
2041 * only flag. You need to do so to resolve the activity in the same way
2042 * that {@link android.content.Context#startActivity(Intent)} and
2043 * {@link android.content.Intent#resolveActivity(PackageManager)
2044 * Intent.resolveActivity(PackageManager)} do.</p>
2045 *
2046 * @param intent An intent containing all of the desired specification
2047 * (action, data, type, category, and/or component).
2048 * @param flags Additional option flags. The most important is
2049 * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only
2050 * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}.
2051 * @param userId The user id.
2052 *
2053 * @return Returns a ResolveInfo containing the final activity intent that
2054 * was determined to be the best action. Returns null if no
2055 * matching activity was found. If multiple matching activities are
2056 * found and there is no default set, returns a ResolveInfo
2057 * containing something else, such as the activity resolver.
2058 *
2059 * @see #MATCH_DEFAULT_ONLY
2060 * @see #GET_INTENT_FILTERS
2061 * @see #GET_RESOLVED_FILTER
2062 *
2063 * @hide
2064 */
2065 public abstract ResolveInfo resolveActivityAsUser(Intent intent, int flags, int userId);
2066
2067 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002068 * Retrieve all activities that can be performed for the given intent.
2069 *
2070 * @param intent The desired intent as per resolveActivity().
2071 * @param flags Additional option flags. The most important is
Dianne Hackborn4d023d212010-10-01 13:41:04 -07002072 * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only
2073 * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002074 *
Dianne Hackborn4d023d212010-10-01 13:41:04 -07002075 * @return A List&lt;ResolveInfo&gt; containing one entry for each matching
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002076 * Activity. These are ordered from best to worst match -- that
2077 * is, the first item in the list is what is returned by
Dianne Hackborn4d023d212010-10-01 13:41:04 -07002078 * {@link #resolveActivity}. If there are no matching activities, an empty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002079 * list is returned.
2080 *
2081 * @see #MATCH_DEFAULT_ONLY
2082 * @see #GET_INTENT_FILTERS
2083 * @see #GET_RESOLVED_FILTER
2084 */
2085 public abstract List<ResolveInfo> queryIntentActivities(Intent intent,
2086 int flags);
2087
2088 /**
Amith Yamasani151ec4c2012-09-07 19:25:16 -07002089 * Retrieve all activities that can be performed for the given intent, for a specific user.
2090 *
2091 * @param intent The desired intent as per resolveActivity().
2092 * @param flags Additional option flags. The most important is
2093 * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only
2094 * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}.
2095 *
2096 * @return A List&lt;ResolveInfo&gt; containing one entry for each matching
2097 * Activity. These are ordered from best to worst match -- that
2098 * is, the first item in the list is what is returned by
2099 * {@link #resolveActivity}. If there are no matching activities, an empty
2100 * list is returned.
2101 *
2102 * @see #MATCH_DEFAULT_ONLY
2103 * @see #GET_INTENT_FILTERS
2104 * @see #GET_RESOLVED_FILTER
2105 * @hide
2106 */
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07002107 public abstract List<ResolveInfo> queryIntentActivitiesAsUser(Intent intent,
Amith Yamasani151ec4c2012-09-07 19:25:16 -07002108 int flags, int userId);
2109
2110
2111 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002112 * Retrieve a set of activities that should be presented to the user as
2113 * similar options. This is like {@link #queryIntentActivities}, except it
2114 * also allows you to supply a list of more explicit Intents that you would
2115 * like to resolve to particular options, and takes care of returning the
2116 * final ResolveInfo list in a reasonable order, with no duplicates, based
2117 * on those inputs.
2118 *
2119 * @param caller The class name of the activity that is making the
2120 * request. This activity will never appear in the output
2121 * list. Can be null.
2122 * @param specifics An array of Intents that should be resolved to the
2123 * first specific results. Can be null.
2124 * @param intent The desired intent as per resolveActivity().
2125 * @param flags Additional option flags. The most important is
Dianne Hackborn4d023d212010-10-01 13:41:04 -07002126 * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only
2127 * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002128 *
Dianne Hackborn4d023d212010-10-01 13:41:04 -07002129 * @return A List&lt;ResolveInfo&gt; containing one entry for each matching
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002130 * Activity. These are ordered first by all of the intents resolved
2131 * in <var>specifics</var> and then any additional activities that
2132 * can handle <var>intent</var> but did not get included by one of
2133 * the <var>specifics</var> intents. If there are no matching
2134 * activities, an empty list is returned.
2135 *
2136 * @see #MATCH_DEFAULT_ONLY
2137 * @see #GET_INTENT_FILTERS
2138 * @see #GET_RESOLVED_FILTER
2139 */
2140 public abstract List<ResolveInfo> queryIntentActivityOptions(
2141 ComponentName caller, Intent[] specifics, Intent intent, int flags);
2142
2143 /**
2144 * Retrieve all receivers that can handle a broadcast of the given intent.
2145 *
2146 * @param intent The desired intent as per resolveActivity().
Dianne Hackborn4d023d212010-10-01 13:41:04 -07002147 * @param flags Additional option flags.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002148 *
Dianne Hackborn4d023d212010-10-01 13:41:04 -07002149 * @return A List&lt;ResolveInfo&gt; containing one entry for each matching
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002150 * Receiver. These are ordered from first to last in priority. If
2151 * there are no matching receivers, an empty list is returned.
2152 *
2153 * @see #MATCH_DEFAULT_ONLY
2154 * @see #GET_INTENT_FILTERS
2155 * @see #GET_RESOLVED_FILTER
2156 */
2157 public abstract List<ResolveInfo> queryBroadcastReceivers(Intent intent,
2158 int flags);
2159
2160 /**
Amith Yamasanif203aee2012-08-29 18:41:53 -07002161 * Retrieve all receivers that can handle a broadcast of the given intent, for a specific
2162 * user.
2163 *
2164 * @param intent The desired intent as per resolveActivity().
2165 * @param flags Additional option flags.
2166 * @param userId The userId of the user being queried.
2167 *
2168 * @return A List&lt;ResolveInfo&gt; containing one entry for each matching
2169 * Receiver. These are ordered from first to last in priority. If
2170 * there are no matching receivers, an empty list is returned.
2171 *
2172 * @see #MATCH_DEFAULT_ONLY
2173 * @see #GET_INTENT_FILTERS
2174 * @see #GET_RESOLVED_FILTER
2175 * @hide
2176 */
2177 public abstract List<ResolveInfo> queryBroadcastReceivers(Intent intent,
2178 int flags, int userId);
2179
2180 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002181 * Determine the best service to handle for a given Intent.
2182 *
2183 * @param intent An intent containing all of the desired specification
2184 * (action, data, type, category, and/or component).
2185 * @param flags Additional option flags.
2186 *
2187 * @return Returns a ResolveInfo containing the final service intent that
2188 * was determined to be the best action. Returns null if no
2189 * matching service was found.
2190 *
2191 * @see #GET_INTENT_FILTERS
2192 * @see #GET_RESOLVED_FILTER
2193 */
2194 public abstract ResolveInfo resolveService(Intent intent, int flags);
2195
2196 /**
2197 * Retrieve all services that can match the given intent.
2198 *
2199 * @param intent The desired intent as per resolveService().
2200 * @param flags Additional option flags.
2201 *
Dianne Hackborn4d023d212010-10-01 13:41:04 -07002202 * @return A List&lt;ResolveInfo&gt; containing one entry for each matching
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002203 * ServiceInfo. These are ordered from best to worst match -- that
2204 * is, the first item in the list is what is returned by
2205 * resolveService(). If there are no matching services, an empty
2206 * list is returned.
2207 *
2208 * @see #GET_INTENT_FILTERS
2209 * @see #GET_RESOLVED_FILTER
2210 */
2211 public abstract List<ResolveInfo> queryIntentServices(Intent intent,
2212 int flags);
2213
2214 /**
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07002215 * Retrieve all services that can match the given intent for a given user.
2216 *
2217 * @param intent The desired intent as per resolveService().
2218 * @param flags Additional option flags.
2219 * @param userId The user id.
2220 *
2221 * @return A List&lt;ResolveInfo&gt; containing one entry for each matching
2222 * ServiceInfo. These are ordered from best to worst match -- that
2223 * is, the first item in the list is what is returned by
2224 * resolveService(). If there are no matching services, an empty
2225 * list is returned.
2226 *
2227 * @see #GET_INTENT_FILTERS
2228 * @see #GET_RESOLVED_FILTER
2229 *
2230 * @hide
2231 */
2232 public abstract List<ResolveInfo> queryIntentServicesAsUser(Intent intent,
2233 int flags, int userId);
2234
Jeff Sharkey85f5f812013-10-07 10:16:12 -07002235 /** {@hide} */
2236 public abstract List<ResolveInfo> queryIntentContentProvidersAsUser(
2237 Intent intent, int flags, int userId);
2238
2239 /**
2240 * Retrieve all providers that can match the given intent.
2241 *
2242 * @param intent An intent containing all of the desired specification
2243 * (action, data, type, category, and/or component).
2244 * @param flags Additional option flags.
2245 * @return A List&lt;ResolveInfo&gt; containing one entry for each matching
2246 * ProviderInfo. These are ordered from best to worst match. If
2247 * there are no matching providers, an empty list is returned.
2248 * @see #GET_INTENT_FILTERS
2249 * @see #GET_RESOLVED_FILTER
2250 */
2251 public abstract List<ResolveInfo> queryIntentContentProviders(Intent intent, int flags);
2252
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07002253 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002254 * Find a single content provider by its base path name.
2255 *
2256 * @param name The name of the provider to find.
2257 * @param flags Additional option flags. Currently should always be 0.
2258 *
2259 * @return ContentProviderInfo Information about the provider, if found,
2260 * else null.
2261 */
2262 public abstract ProviderInfo resolveContentProvider(String name,
2263 int flags);
2264
2265 /**
2266 * Retrieve content provider information.
2267 *
2268 * <p><em>Note: unlike most other methods, an empty result set is indicated
2269 * by a null return instead of an empty list.</em>
2270 *
2271 * @param processName If non-null, limits the returned providers to only
2272 * those that are hosted by the given process. If null,
2273 * all content providers are returned.
2274 * @param uid If <var>processName</var> is non-null, this is the required
2275 * uid owning the requested content providers.
2276 * @param flags Additional option flags. Currently should always be 0.
2277 *
Dianne Hackborn4d023d212010-10-01 13:41:04 -07002278 * @return A List&lt;ContentProviderInfo&gt; containing one entry for each
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002279 * content provider either patching <var>processName</var> or, if
2280 * <var>processName</var> is null, all known content providers.
2281 * <em>If there are no matching providers, null is returned.</em>
2282 */
2283 public abstract List<ProviderInfo> queryContentProviders(
2284 String processName, int uid, int flags);
2285
2286 /**
2287 * Retrieve all of the information we know about a particular
2288 * instrumentation class.
2289 *
2290 * <p>Throws {@link NameNotFoundException} if instrumentation with the
kmccormick30498b42013-03-27 17:39:17 -07002291 * given class name cannot be found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002292 *
2293 * @param className The full name (i.e.
2294 * com.google.apps.contacts.InstrumentList) of an
2295 * Instrumentation class.
2296 * @param flags Additional option flags. Currently should always be 0.
2297 *
2298 * @return InstrumentationInfo containing information about the
2299 * instrumentation.
2300 */
2301 public abstract InstrumentationInfo getInstrumentationInfo(
2302 ComponentName className, int flags) throws NameNotFoundException;
2303
2304 /**
2305 * Retrieve information about available instrumentation code. May be used
2306 * to retrieve either all instrumentation code, or only the code targeting
2307 * a particular package.
2308 *
2309 * @param targetPackage If null, all instrumentation is returned; only the
2310 * instrumentation targeting this package name is
2311 * returned.
2312 * @param flags Additional option flags. Currently should always be 0.
2313 *
Dianne Hackborn4d023d212010-10-01 13:41:04 -07002314 * @return A List&lt;InstrumentationInfo&gt; containing one entry for each
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002315 * matching available Instrumentation. Returns an empty list if
2316 * there is no instrumentation available for the given package.
2317 */
2318 public abstract List<InstrumentationInfo> queryInstrumentation(
2319 String targetPackage, int flags);
2320
2321 /**
2322 * Retrieve an image from a package. This is a low-level API used by
2323 * the various package manager info structures (such as
2324 * {@link ComponentInfo} to implement retrieval of their associated
2325 * icon.
2326 *
2327 * @param packageName The name of the package that this icon is coming from.
kmccormick30498b42013-03-27 17:39:17 -07002328 * Cannot be null.
2329 * @param resid The resource identifier of the desired image. Cannot be 0.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002330 * @param appInfo Overall information about <var>packageName</var>. This
2331 * may be null, in which case the application information will be retrieved
2332 * for you if needed; if you already have this information around, it can
2333 * be much more efficient to supply it here.
2334 *
2335 * @return Returns a Drawable holding the requested image. Returns null if
2336 * an image could not be found for any reason.
2337 */
2338 public abstract Drawable getDrawable(String packageName, int resid,
2339 ApplicationInfo appInfo);
2340
2341 /**
2342 * Retrieve the icon associated with an activity. Given the full name of
2343 * an activity, retrieves the information about it and calls
2344 * {@link ComponentInfo#loadIcon ComponentInfo.loadIcon()} to return its icon.
kmccormick30498b42013-03-27 17:39:17 -07002345 * If the activity cannot be found, NameNotFoundException is thrown.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002346 *
2347 * @param activityName Name of the activity whose icon is to be retrieved.
2348 *
2349 * @return Returns the image of the icon, or the default activity icon if
2350 * it could not be found. Does not return null.
2351 * @throws NameNotFoundException Thrown if the resources for the given
2352 * activity could not be loaded.
2353 *
2354 * @see #getActivityIcon(Intent)
2355 */
2356 public abstract Drawable getActivityIcon(ComponentName activityName)
2357 throws NameNotFoundException;
2358
2359 /**
2360 * Retrieve the icon associated with an Intent. If intent.getClassName() is
2361 * set, this simply returns the result of
2362 * getActivityIcon(intent.getClassName()). Otherwise it resolves the intent's
2363 * component and returns the icon associated with the resolved component.
kmccormick30498b42013-03-27 17:39:17 -07002364 * If intent.getClassName() cannot be found or the Intent cannot be resolved
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002365 * to a component, NameNotFoundException is thrown.
2366 *
2367 * @param intent The intent for which you would like to retrieve an icon.
2368 *
2369 * @return Returns the image of the icon, or the default activity icon if
2370 * it could not be found. Does not return null.
2371 * @throws NameNotFoundException Thrown if the resources for application
2372 * matching the given intent could not be loaded.
2373 *
2374 * @see #getActivityIcon(ComponentName)
2375 */
2376 public abstract Drawable getActivityIcon(Intent intent)
2377 throws NameNotFoundException;
2378
2379 /**
2380 * Return the generic icon for an activity that is used when no specific
2381 * icon is defined.
2382 *
2383 * @return Drawable Image of the icon.
2384 */
2385 public abstract Drawable getDefaultActivityIcon();
2386
2387 /**
2388 * Retrieve the icon associated with an application. If it has not defined
2389 * an icon, the default app icon is returned. Does not return null.
2390 *
2391 * @param info Information about application being queried.
2392 *
2393 * @return Returns the image of the icon, or the default application icon
2394 * if it could not be found.
2395 *
2396 * @see #getApplicationIcon(String)
2397 */
2398 public abstract Drawable getApplicationIcon(ApplicationInfo info);
2399
2400 /**
2401 * Retrieve the icon associated with an application. Given the name of the
2402 * application's package, retrieves the information about it and calls
kmccormick30498b42013-03-27 17:39:17 -07002403 * getApplicationIcon() to return its icon. If the application cannot be
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002404 * found, NameNotFoundException is thrown.
2405 *
2406 * @param packageName Name of the package whose application icon is to be
2407 * retrieved.
2408 *
2409 * @return Returns the image of the icon, or the default application icon
2410 * if it could not be found. Does not return null.
2411 * @throws NameNotFoundException Thrown if the resources for the given
2412 * application could not be loaded.
2413 *
2414 * @see #getApplicationIcon(ApplicationInfo)
2415 */
2416 public abstract Drawable getApplicationIcon(String packageName)
2417 throws NameNotFoundException;
2418
2419 /**
Adam Powell81cd2e92010-04-21 16:35:18 -07002420 * Retrieve the logo associated with an activity. Given the full name of
2421 * an activity, retrieves the information about it and calls
2422 * {@link ComponentInfo#loadLogo ComponentInfo.loadLogo()} to return its logo.
kmccormick30498b42013-03-27 17:39:17 -07002423 * If the activity cannot be found, NameNotFoundException is thrown.
Adam Powell81cd2e92010-04-21 16:35:18 -07002424 *
2425 * @param activityName Name of the activity whose logo is to be retrieved.
2426 *
2427 * @return Returns the image of the logo or null if the activity has no
2428 * logo specified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002429 *
Adam Powell81cd2e92010-04-21 16:35:18 -07002430 * @throws NameNotFoundException Thrown if the resources for the given
2431 * activity could not be loaded.
2432 *
2433 * @see #getActivityLogo(Intent)
2434 */
2435 public abstract Drawable getActivityLogo(ComponentName activityName)
2436 throws NameNotFoundException;
2437
2438 /**
2439 * Retrieve the logo associated with an Intent. If intent.getClassName() is
2440 * set, this simply returns the result of
2441 * getActivityLogo(intent.getClassName()). Otherwise it resolves the intent's
2442 * component and returns the logo associated with the resolved component.
kmccormick30498b42013-03-27 17:39:17 -07002443 * If intent.getClassName() cannot be found or the Intent cannot be resolved
Adam Powell81cd2e92010-04-21 16:35:18 -07002444 * to a component, NameNotFoundException is thrown.
2445 *
2446 * @param intent The intent for which you would like to retrieve a logo.
2447 *
2448 * @return Returns the image of the logo, or null if the activity has no
2449 * logo specified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002450 *
Adam Powell81cd2e92010-04-21 16:35:18 -07002451 * @throws NameNotFoundException Thrown if the resources for application
2452 * matching the given intent could not be loaded.
2453 *
2454 * @see #getActivityLogo(ComponentName)
2455 */
2456 public abstract Drawable getActivityLogo(Intent intent)
2457 throws NameNotFoundException;
2458
2459 /**
2460 * Retrieve the logo associated with an application. If it has not specified
2461 * a logo, this method returns null.
2462 *
2463 * @param info Information about application being queried.
2464 *
2465 * @return Returns the image of the logo, or null if no logo is specified
2466 * by the application.
2467 *
2468 * @see #getApplicationLogo(String)
2469 */
2470 public abstract Drawable getApplicationLogo(ApplicationInfo info);
2471
2472 /**
2473 * Retrieve the logo associated with an application. Given the name of the
2474 * application's package, retrieves the information about it and calls
kmccormick30498b42013-03-27 17:39:17 -07002475 * getApplicationLogo() to return its logo. If the application cannot be
Adam Powell81cd2e92010-04-21 16:35:18 -07002476 * found, NameNotFoundException is thrown.
2477 *
2478 * @param packageName Name of the package whose application logo is to be
2479 * retrieved.
2480 *
2481 * @return Returns the image of the logo, or null if no application logo
2482 * has been specified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002483 *
Adam Powell81cd2e92010-04-21 16:35:18 -07002484 * @throws NameNotFoundException Thrown if the resources for the given
2485 * application could not be loaded.
2486 *
2487 * @see #getApplicationLogo(ApplicationInfo)
2488 */
2489 public abstract Drawable getApplicationLogo(String packageName)
2490 throws NameNotFoundException;
2491
2492 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002493 * Retrieve text from a package. This is a low-level API used by
2494 * the various package manager info structures (such as
2495 * {@link ComponentInfo} to implement retrieval of their associated
2496 * labels and other text.
2497 *
2498 * @param packageName The name of the package that this text is coming from.
kmccormick30498b42013-03-27 17:39:17 -07002499 * Cannot be null.
2500 * @param resid The resource identifier of the desired text. Cannot be 0.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002501 * @param appInfo Overall information about <var>packageName</var>. This
2502 * may be null, in which case the application information will be retrieved
2503 * for you if needed; if you already have this information around, it can
2504 * be much more efficient to supply it here.
2505 *
2506 * @return Returns a CharSequence holding the requested text. Returns null
2507 * if the text could not be found for any reason.
2508 */
2509 public abstract CharSequence getText(String packageName, int resid,
2510 ApplicationInfo appInfo);
2511
2512 /**
2513 * Retrieve an XML file from a package. This is a low-level API used to
2514 * retrieve XML meta data.
2515 *
2516 * @param packageName The name of the package that this xml is coming from.
kmccormick30498b42013-03-27 17:39:17 -07002517 * Cannot be null.
2518 * @param resid The resource identifier of the desired xml. Cannot be 0.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002519 * @param appInfo Overall information about <var>packageName</var>. This
2520 * may be null, in which case the application information will be retrieved
2521 * for you if needed; if you already have this information around, it can
2522 * be much more efficient to supply it here.
2523 *
2524 * @return Returns an XmlPullParser allowing you to parse out the XML
2525 * data. Returns null if the xml resource could not be found for any
2526 * reason.
2527 */
2528 public abstract XmlResourceParser getXml(String packageName, int resid,
2529 ApplicationInfo appInfo);
2530
2531 /**
2532 * Return the label to use for this application.
2533 *
2534 * @return Returns the label associated with this application, or null if
2535 * it could not be found for any reason.
kmccormick30498b42013-03-27 17:39:17 -07002536 * @param info The application to get the label of.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002537 */
2538 public abstract CharSequence getApplicationLabel(ApplicationInfo info);
2539
2540 /**
2541 * Retrieve the resources associated with an activity. Given the full
2542 * name of an activity, retrieves the information about it and calls
2543 * getResources() to return its application's resources. If the activity
kmccormick30498b42013-03-27 17:39:17 -07002544 * cannot be found, NameNotFoundException is thrown.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002545 *
2546 * @param activityName Name of the activity whose resources are to be
2547 * retrieved.
2548 *
2549 * @return Returns the application's Resources.
2550 * @throws NameNotFoundException Thrown if the resources for the given
2551 * application could not be loaded.
2552 *
2553 * @see #getResourcesForApplication(ApplicationInfo)
2554 */
2555 public abstract Resources getResourcesForActivity(ComponentName activityName)
2556 throws NameNotFoundException;
2557
2558 /**
2559 * Retrieve the resources for an application. Throws NameNotFoundException
2560 * if the package is no longer installed.
2561 *
2562 * @param app Information about the desired application.
2563 *
2564 * @return Returns the application's Resources.
2565 * @throws NameNotFoundException Thrown if the resources for the given
2566 * application could not be loaded (most likely because it was uninstalled).
2567 */
2568 public abstract Resources getResourcesForApplication(ApplicationInfo app)
2569 throws NameNotFoundException;
2570
2571 /**
2572 * Retrieve the resources associated with an application. Given the full
2573 * package name of an application, retrieves the information about it and
2574 * calls getResources() to return its application's resources. If the
kmccormick30498b42013-03-27 17:39:17 -07002575 * appPackageName cannot be found, NameNotFoundException is thrown.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002576 *
2577 * @param appPackageName Package name of the application whose resources
2578 * are to be retrieved.
2579 *
2580 * @return Returns the application's Resources.
2581 * @throws NameNotFoundException Thrown if the resources for the given
2582 * application could not be loaded.
2583 *
2584 * @see #getResourcesForApplication(ApplicationInfo)
2585 */
2586 public abstract Resources getResourcesForApplication(String appPackageName)
2587 throws NameNotFoundException;
2588
Amith Yamasani98edc952012-09-25 14:09:27 -07002589 /** @hide */
2590 public abstract Resources getResourcesForApplicationAsUser(String appPackageName, int userId)
2591 throws NameNotFoundException;
2592
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002593 /**
2594 * Retrieve overall information about an application package defined
2595 * in a package archive file
2596 *
2597 * @param archiveFilePath The path to the archive file
2598 * @param flags Additional option flags. Use any combination of
2599 * {@link #GET_ACTIVITIES},
2600 * {@link #GET_GIDS},
2601 * {@link #GET_CONFIGURATIONS},
2602 * {@link #GET_INSTRUMENTATION},
2603 * {@link #GET_PERMISSIONS},
2604 * {@link #GET_PROVIDERS},
2605 * {@link #GET_RECEIVERS},
2606 * {@link #GET_SERVICES},
2607 * {@link #GET_SIGNATURES}, to modify the data returned.
2608 *
2609 * @return Returns the information about the package. Returns
2610 * null if the package could not be successfully parsed.
2611 *
2612 * @see #GET_ACTIVITIES
2613 * @see #GET_GIDS
2614 * @see #GET_CONFIGURATIONS
2615 * @see #GET_INSTRUMENTATION
2616 * @see #GET_PERMISSIONS
2617 * @see #GET_PROVIDERS
2618 * @see #GET_RECEIVERS
2619 * @see #GET_SERVICES
2620 * @see #GET_SIGNATURES
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002621 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002622 */
2623 public PackageInfo getPackageArchiveInfo(String archiveFilePath, int flags) {
2624 PackageParser packageParser = new PackageParser(archiveFilePath);
2625 DisplayMetrics metrics = new DisplayMetrics();
2626 metrics.setToDefaults();
2627 final File sourceFile = new File(archiveFilePath);
2628 PackageParser.Package pkg = packageParser.parsePackage(
2629 sourceFile, archiveFilePath, metrics, 0);
2630 if (pkg == null) {
2631 return null;
2632 }
Kenny Root6ccd4122011-10-13 14:56:21 -07002633 if ((flags & GET_SIGNATURES) != 0) {
2634 packageParser.collectCertificates(pkg, 0);
2635 }
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002636 PackageUserState state = new PackageUserState();
2637 return PackageParser.generatePackageInfo(pkg, null, flags, 0, 0, null, state);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002638 }
2639
2640 /**
Dianne Hackbornade3eca2009-05-11 18:54:45 -07002641 * @hide
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002642 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002643 * Install a package. Since this may take a little while, the result will
2644 * be posted back to the given observer. An installation will fail if the calling context
2645 * lacks the {@link android.Manifest.permission#INSTALL_PACKAGES} permission, if the
2646 * package named in the package file's manifest is already installed, or if there's no space
2647 * available on the device.
2648 *
2649 * @param packageURI The location of the package file to install. This can be a 'file:' or a
2650 * 'content:' URI.
2651 * @param observer An observer callback to get notified when the package installation is
2652 * complete. {@link IPackageInstallObserver#packageInstalled(String, int)} will be
2653 * called when that happens. observer may be null to indicate that no callback is desired.
Dianne Hackbornade3eca2009-05-11 18:54:45 -07002654 * @param flags - possible values: {@link #INSTALL_FORWARD_LOCK},
2655 * {@link #INSTALL_REPLACE_EXISTING}, {@link #INSTALL_ALLOW_TEST}.
Jacek Surazski65e13172009-04-28 15:26:38 +02002656 * @param installerPackageName Optional package name of the application that is performing the
2657 * installation. This identifies which market the package came from.
Jacek Surazski65e13172009-04-28 15:26:38 +02002658 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002659 public abstract void installPackage(
Jacek Surazski65e13172009-04-28 15:26:38 +02002660 Uri packageURI, IPackageInstallObserver observer, int flags,
2661 String installerPackageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002662
2663 /**
Kenny Root5ab21572011-07-27 11:11:19 -07002664 * Similar to
2665 * {@link #installPackage(Uri, IPackageInstallObserver, int, String)} but
2666 * with an extra verification file provided.
2667 *
2668 * @param packageURI The location of the package file to install. This can
2669 * be a 'file:' or a 'content:' URI.
2670 * @param observer An observer callback to get notified when the package
2671 * installation is complete.
2672 * {@link IPackageInstallObserver#packageInstalled(String, int)}
2673 * will be called when that happens. observer may be null to
2674 * indicate that no callback is desired.
2675 * @param flags - possible values: {@link #INSTALL_FORWARD_LOCK},
2676 * {@link #INSTALL_REPLACE_EXISTING}, {@link #INSTALL_ALLOW_TEST}
2677 * .
2678 * @param installerPackageName Optional package name of the application that
2679 * is performing the installation. This identifies which market
2680 * the package came from.
2681 * @param verificationURI The location of the supplementary verification
Anonymous Cowardceb1b0b2012-04-24 10:35:16 -07002682 * file. This can be a 'file:' or a 'content:' URI. May be
2683 * {@code null}.
2684 * @param manifestDigest an object that holds the digest of the package
2685 * which can be used to verify ownership. May be {@code null}.
2686 * @param encryptionParams if the package to be installed is encrypted,
2687 * these parameters describing the encryption and authentication
2688 * used. May be {@code null}.
Kenny Root5ab21572011-07-27 11:11:19 -07002689 * @hide
2690 */
2691 public abstract void installPackageWithVerification(Uri packageURI,
2692 IPackageInstallObserver observer, int flags, String installerPackageName,
Anonymous Cowardceb1b0b2012-04-24 10:35:16 -07002693 Uri verificationURI, ManifestDigest manifestDigest,
Rich Canningse1d7c712012-08-08 12:46:06 -07002694 ContainerEncryptionParams encryptionParams);
Kenny Root5ab21572011-07-27 11:11:19 -07002695
2696 /**
rich cannings706e8ba2012-08-20 13:20:14 -07002697 * Similar to
2698 * {@link #installPackage(Uri, IPackageInstallObserver, int, String)} but
2699 * with an extra verification information provided.
2700 *
2701 * @param packageURI The location of the package file to install. This can
2702 * be a 'file:' or a 'content:' URI.
2703 * @param observer An observer callback to get notified when the package
2704 * installation is complete.
2705 * {@link IPackageInstallObserver#packageInstalled(String, int)}
2706 * will be called when that happens. observer may be null to
2707 * indicate that no callback is desired.
2708 * @param flags - possible values: {@link #INSTALL_FORWARD_LOCK},
2709 * {@link #INSTALL_REPLACE_EXISTING}, {@link #INSTALL_ALLOW_TEST}
2710 * .
2711 * @param installerPackageName Optional package name of the application that
2712 * is performing the installation. This identifies which market
2713 * the package came from.
2714 * @param verificationParams an object that holds signal information to
2715 * assist verification. May be {@code null}.
2716 * @param encryptionParams if the package to be installed is encrypted,
2717 * these parameters describing the encryption and authentication
2718 * used. May be {@code null}.
2719 *
2720 * @hide
2721 */
2722 public abstract void installPackageWithVerificationAndEncryption(Uri packageURI,
2723 IPackageInstallObserver observer, int flags, String installerPackageName,
2724 VerificationParams verificationParams,
2725 ContainerEncryptionParams encryptionParams);
2726
2727 /**
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002728 * If there is already an application with the given package name installed
2729 * on the system for other users, also install it for the calling user.
2730 * @hide
2731 */
2732 public abstract int installExistingPackage(String packageName)
2733 throws NameNotFoundException;
2734
2735 /**
Kenny Root5ab21572011-07-27 11:11:19 -07002736 * Allows a package listening to the
2737 * {@link Intent#ACTION_PACKAGE_NEEDS_VERIFICATION package verification
Kenny Root3a9b5fb2011-09-20 14:15:38 -07002738 * broadcast} to respond to the package manager. The response must include
2739 * the {@code verificationCode} which is one of
2740 * {@link PackageManager#VERIFICATION_ALLOW} or
2741 * {@link PackageManager#VERIFICATION_REJECT}.
Kenny Root5ab21572011-07-27 11:11:19 -07002742 *
2743 * @param id pending package identifier as passed via the
kmccormick30498b42013-03-27 17:39:17 -07002744 * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra.
Kenny Root3a9b5fb2011-09-20 14:15:38 -07002745 * @param verificationCode either {@link PackageManager#VERIFICATION_ALLOW}
2746 * or {@link PackageManager#VERIFICATION_REJECT}.
rich cannings7e671512012-08-27 14:44:16 -07002747 * @throws SecurityException if the caller does not have the
Dianne Hackborn8832c182012-09-17 17:20:24 -07002748 * PACKAGE_VERIFICATION_AGENT permission.
Kenny Root5ab21572011-07-27 11:11:19 -07002749 */
Kenny Root3a9b5fb2011-09-20 14:15:38 -07002750 public abstract void verifyPendingInstall(int id, int verificationCode);
Kenny Root5ab21572011-07-27 11:11:19 -07002751
2752 /**
rich canningsd9ef3e52012-08-22 14:28:05 -07002753 * Allows a package listening to the
2754 * {@link Intent#ACTION_PACKAGE_NEEDS_VERIFICATION package verification
2755 * broadcast} to extend the default timeout for a response and declare what
2756 * action to perform after the timeout occurs. The response must include
2757 * the {@code verificationCodeAtTimeout} which is one of
2758 * {@link PackageManager#VERIFICATION_ALLOW} or
2759 * {@link PackageManager#VERIFICATION_REJECT}.
2760 *
2761 * This method may only be called once per package id. Additional calls
2762 * will have no effect.
2763 *
2764 * @param id pending package identifier as passed via the
kmccormick30498b42013-03-27 17:39:17 -07002765 * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra.
rich canningsd9ef3e52012-08-22 14:28:05 -07002766 * @param verificationCodeAtTimeout either
2767 * {@link PackageManager#VERIFICATION_ALLOW} or
rich canningsd1b5cfc2012-08-29 14:49:51 -07002768 * {@link PackageManager#VERIFICATION_REJECT}. If
2769 * {@code verificationCodeAtTimeout} is neither
2770 * {@link PackageManager#VERIFICATION_ALLOW} or
2771 * {@link PackageManager#VERIFICATION_REJECT}, then
2772 * {@code verificationCodeAtTimeout} will default to
rich canningsd9ef3e52012-08-22 14:28:05 -07002773 * {@link PackageManager#VERIFICATION_REJECT}.
2774 * @param millisecondsToDelay the amount of time requested for the timeout.
2775 * Must be positive and less than
rich canningsd1b5cfc2012-08-29 14:49:51 -07002776 * {@link PackageManager#MAXIMUM_VERIFICATION_TIMEOUT}. If
2777 * {@code millisecondsToDelay} is out of bounds,
2778 * {@code millisecondsToDelay} will be set to the closest in
2779 * bounds value; namely, 0 or
rich canningsd9ef3e52012-08-22 14:28:05 -07002780 * {@link PackageManager#MAXIMUM_VERIFICATION_TIMEOUT}.
rich cannings7e671512012-08-27 14:44:16 -07002781 * @throws SecurityException if the caller does not have the
Dianne Hackborn8832c182012-09-17 17:20:24 -07002782 * PACKAGE_VERIFICATION_AGENT permission.
rich canningsd9ef3e52012-08-22 14:28:05 -07002783 */
2784 public abstract void extendVerificationTimeout(int id,
2785 int verificationCodeAtTimeout, long millisecondsToDelay);
2786
2787 /**
Dianne Hackborn880119b2010-11-18 22:26:40 -08002788 * Change the installer associated with a given package. There are limitations
2789 * on how the installer package can be changed; in particular:
2790 * <ul>
2791 * <li> A SecurityException will be thrown if <var>installerPackageName</var>
2792 * is not signed with the same certificate as the calling application.
2793 * <li> A SecurityException will be thrown if <var>targetPackage</var> already
2794 * has an installer package, and that installer package is not signed with
2795 * the same certificate as the calling application.
2796 * </ul>
2797 *
2798 * @param targetPackage The installed package whose installer will be changed.
2799 * @param installerPackageName The package name of the new installer. May be
2800 * null to clear the association.
2801 */
2802 public abstract void setInstallerPackageName(String targetPackage,
2803 String installerPackageName);
2804
2805 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002806 * Attempts to delete a package. Since this may take a little while, the result will
2807 * be posted back to the given observer. A deletion will fail if the calling context
2808 * lacks the {@link android.Manifest.permission#DELETE_PACKAGES} permission, if the
2809 * named package cannot be found, or if the named package is a "system package".
2810 * (TODO: include pointer to documentation on "system packages")
2811 *
2812 * @param packageName The name of the package to delete
2813 * @param observer An observer callback to get notified when the package deletion is
2814 * complete. {@link android.content.pm.IPackageDeleteObserver#packageDeleted(boolean)} will be
2815 * called when that happens. observer may be null to indicate that no callback is desired.
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002816 * @param flags - possible values: {@link #DELETE_KEEP_DATA},
2817 * {@link #DELETE_ALL_USERS}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002818 *
2819 * @hide
2820 */
2821 public abstract void deletePackage(
2822 String packageName, IPackageDeleteObserver observer, int flags);
Jacek Surazski65e13172009-04-28 15:26:38 +02002823
2824 /**
2825 * Retrieve the package name of the application that installed a package. This identifies
2826 * which market the package came from.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002827 *
Jacek Surazski65e13172009-04-28 15:26:38 +02002828 * @param packageName The name of the package to query
2829 */
2830 public abstract String getInstallerPackageName(String packageName);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002831
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002832 /**
2833 * Attempts to clear the user data directory of an application.
2834 * Since this may take a little while, the result will
2835 * be posted back to the given observer. A deletion will fail if the
2836 * named package cannot be found, or if the named package is a "system package".
2837 *
2838 * @param packageName The name of the package
2839 * @param observer An observer callback to get notified when the operation is finished
2840 * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)}
2841 * will be called when that happens. observer may be null to indicate that
2842 * no callback is desired.
2843 *
2844 * @hide
2845 */
2846 public abstract void clearApplicationUserData(String packageName,
2847 IPackageDataObserver observer);
2848 /**
2849 * Attempts to delete the cache files associated with an application.
2850 * Since this may take a little while, the result will
2851 * be posted back to the given observer. A deletion will fail if the calling context
2852 * lacks the {@link android.Manifest.permission#DELETE_CACHE_FILES} permission, if the
2853 * named package cannot be found, or if the named package is a "system package".
2854 *
2855 * @param packageName The name of the package to delete
2856 * @param observer An observer callback to get notified when the cache file deletion
2857 * is complete.
2858 * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)}
2859 * will be called when that happens. observer may be null to indicate that
2860 * no callback is desired.
2861 *
2862 * @hide
2863 */
2864 public abstract void deleteApplicationCacheFiles(String packageName,
2865 IPackageDataObserver observer);
2866
2867 /**
2868 * Free storage by deleting LRU sorted list of cache files across
2869 * all applications. If the currently available free storage
2870 * on the device is greater than or equal to the requested
2871 * free storage, no cache files are cleared. If the currently
2872 * available storage on the device is less than the requested
2873 * free storage, some or all of the cache files across
2874 * all applications are deleted (based on last accessed time)
2875 * to increase the free storage space on the device to
2876 * the requested value. There is no guarantee that clearing all
2877 * the cache files from all applications will clear up
2878 * enough storage to achieve the desired value.
2879 * @param freeStorageSize The number of bytes of storage to be
2880 * freed by the system. Say if freeStorageSize is XX,
2881 * and the current free storage is YY,
2882 * if XX is less than YY, just return. if not free XX-YY number
2883 * of bytes if possible.
2884 * @param observer call back used to notify when
2885 * the operation is completed
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002886 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002887 * @hide
2888 */
2889 public abstract void freeStorageAndNotify(long freeStorageSize, IPackageDataObserver observer);
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -07002890
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002891 /**
2892 * Free storage by deleting LRU sorted list of cache files across
2893 * all applications. If the currently available free storage
2894 * on the device is greater than or equal to the requested
2895 * free storage, no cache files are cleared. If the currently
2896 * available storage on the device is less than the requested
2897 * free storage, some or all of the cache files across
2898 * all applications are deleted (based on last accessed time)
2899 * to increase the free storage space on the device to
2900 * the requested value. There is no guarantee that clearing all
2901 * the cache files from all applications will clear up
2902 * enough storage to achieve the desired value.
2903 * @param freeStorageSize The number of bytes of storage to be
2904 * freed by the system. Say if freeStorageSize is XX,
2905 * and the current free storage is YY,
2906 * if XX is less than YY, just return. if not free XX-YY number
2907 * of bytes if possible.
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -07002908 * @param pi IntentSender call back used to
2909 * notify when the operation is completed.May be null
2910 * to indicate that no call back is desired.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002911 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002912 * @hide
2913 */
Suchi Amalapurapubc806f62009-06-17 15:18:19 -07002914 public abstract void freeStorage(long freeStorageSize, IntentSender pi);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002915
2916 /**
2917 * Retrieve the size information for a package.
2918 * Since this may take a little while, the result will
2919 * be posted back to the given observer. The calling context
2920 * should have the {@link android.Manifest.permission#GET_PACKAGE_SIZE} permission.
2921 *
2922 * @param packageName The name of the package whose size information is to be retrieved
Dianne Hackborn0c380492012-08-20 17:23:30 -07002923 * @param userHandle The user whose size information should be retrieved.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002924 * @param observer An observer callback to get notified when the operation
2925 * is complete.
2926 * {@link android.content.pm.IPackageStatsObserver#onGetStatsCompleted(PackageStats, boolean)}
2927 * The observer's callback is invoked with a PackageStats object(containing the
2928 * code, data and cache sizes of the package) and a boolean value representing
2929 * the status of the operation. observer may be null to indicate that
2930 * no callback is desired.
2931 *
2932 * @hide
2933 */
Dianne Hackborn0c380492012-08-20 17:23:30 -07002934 public abstract void getPackageSizeInfo(String packageName, int userHandle,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002935 IPackageStatsObserver observer);
2936
2937 /**
Dianne Hackborn0c380492012-08-20 17:23:30 -07002938 * Like {@link #getPackageSizeInfo(String, int, IPackageStatsObserver)}, but
2939 * returns the size for the calling user.
2940 *
2941 * @hide
2942 */
2943 public void getPackageSizeInfo(String packageName, IPackageStatsObserver observer) {
2944 getPackageSizeInfo(packageName, UserHandle.myUserId(), observer);
2945 }
2946
2947 /**
Dianne Hackborna7ca0e52009-12-01 14:31:55 -08002948 * @deprecated This function no longer does anything; it was an old
kmccormickac66b852013-03-28 15:17:15 -07002949 * approach to managing preferred activities, which has been superseded
2950 * by (and conflicts with) the modern activity-based preferences.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002951 */
Dianne Hackborna7ca0e52009-12-01 14:31:55 -08002952 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002953 public abstract void addPackageToPreferred(String packageName);
2954
2955 /**
Dianne Hackborna7ca0e52009-12-01 14:31:55 -08002956 * @deprecated This function no longer does anything; it was an old
kmccormickac66b852013-03-28 15:17:15 -07002957 * approach to managing preferred activities, which has been superseded
2958 * by (and conflicts with) the modern activity-based preferences.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002959 */
Dianne Hackborna7ca0e52009-12-01 14:31:55 -08002960 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002961 public abstract void removePackageFromPreferred(String packageName);
2962
2963 /**
2964 * Retrieve the list of all currently configured preferred packages. The
2965 * first package on the list is the most preferred, the last is the
2966 * least preferred.
2967 *
2968 * @param flags Additional option flags. Use any combination of
2969 * {@link #GET_ACTIVITIES},
2970 * {@link #GET_GIDS},
2971 * {@link #GET_CONFIGURATIONS},
2972 * {@link #GET_INSTRUMENTATION},
2973 * {@link #GET_PERMISSIONS},
2974 * {@link #GET_PROVIDERS},
2975 * {@link #GET_RECEIVERS},
2976 * {@link #GET_SERVICES},
2977 * {@link #GET_SIGNATURES}, to modify the data returned.
2978 *
2979 * @return Returns a list of PackageInfo objects describing each
2980 * preferred application, in order of preference.
2981 *
2982 * @see #GET_ACTIVITIES
2983 * @see #GET_GIDS
2984 * @see #GET_CONFIGURATIONS
2985 * @see #GET_INSTRUMENTATION
2986 * @see #GET_PERMISSIONS
2987 * @see #GET_PROVIDERS
2988 * @see #GET_RECEIVERS
2989 * @see #GET_SERVICES
2990 * @see #GET_SIGNATURES
2991 */
2992 public abstract List<PackageInfo> getPreferredPackages(int flags);
2993
2994 /**
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08002995 * @deprecated This is a protected API that should not have been available
2996 * to third party applications. It is the platform's responsibility for
kmccormick30498b42013-03-27 17:39:17 -07002997 * assigning preferred activities and this cannot be directly modified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002998 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002999 * Add a new preferred activity mapping to the system. This will be used
3000 * to automatically select the given activity component when
3001 * {@link Context#startActivity(Intent) Context.startActivity()} finds
3002 * multiple matching activities and also matches the given filter.
3003 *
3004 * @param filter The set of intents under which this activity will be
3005 * made preferred.
3006 * @param match The IntentFilter match category that this preference
3007 * applies to.
3008 * @param set The set of activities that the user was picking from when
3009 * this preference was made.
3010 * @param activity The component name of the activity that is to be
3011 * preferred.
3012 */
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08003013 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003014 public abstract void addPreferredActivity(IntentFilter filter, int match,
3015 ComponentName[] set, ComponentName activity);
3016
3017 /**
Amith Yamasania3f133a2012-08-09 17:11:28 -07003018 * Same as {@link #addPreferredActivity(IntentFilter, int,
3019 ComponentName[], ComponentName)}, but with a specific userId to apply the preference
3020 to.
3021 * @hide
3022 */
3023 public void addPreferredActivity(IntentFilter filter, int match,
3024 ComponentName[] set, ComponentName activity, int userId) {
3025 throw new RuntimeException("Not implemented. Must override in a subclass.");
3026 }
3027
3028 /**
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08003029 * @deprecated This is a protected API that should not have been available
3030 * to third party applications. It is the platform's responsibility for
kmccormick30498b42013-03-27 17:39:17 -07003031 * assigning preferred activities and this cannot be directly modified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003032 *
Satish Sampath8dbe6122009-06-02 23:35:54 +01003033 * Replaces an existing preferred activity mapping to the system, and if that were not present
3034 * adds a new preferred activity. This will be used
3035 * to automatically select the given activity component when
3036 * {@link Context#startActivity(Intent) Context.startActivity()} finds
3037 * multiple matching activities and also matches the given filter.
3038 *
3039 * @param filter The set of intents under which this activity will be
3040 * made preferred.
3041 * @param match The IntentFilter match category that this preference
3042 * applies to.
3043 * @param set The set of activities that the user was picking from when
3044 * this preference was made.
3045 * @param activity The component name of the activity that is to be
3046 * preferred.
3047 * @hide
3048 */
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08003049 @Deprecated
Satish Sampath8dbe6122009-06-02 23:35:54 +01003050 public abstract void replacePreferredActivity(IntentFilter filter, int match,
3051 ComponentName[] set, ComponentName activity);
3052
3053 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003054 * Remove all preferred activity mappings, previously added with
3055 * {@link #addPreferredActivity}, from the
3056 * system whose activities are implemented in the given package name.
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08003057 * An application can only clear its own package(s).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003058 *
3059 * @param packageName The name of the package whose preferred activity
3060 * mappings are to be removed.
3061 */
3062 public abstract void clearPackagePreferredActivities(String packageName);
3063
3064 /**
3065 * Retrieve all preferred activities, previously added with
3066 * {@link #addPreferredActivity}, that are
3067 * currently registered with the system.
3068 *
3069 * @param outFilters A list in which to place the filters of all of the
3070 * preferred activities, or null for none.
3071 * @param outActivities A list in which to place the component names of
3072 * all of the preferred activities, or null for none.
3073 * @param packageName An option package in which you would like to limit
3074 * the list. If null, all activities will be returned; if non-null, only
3075 * those activities in the given package are returned.
3076 *
3077 * @return Returns the total number of registered preferred activities
3078 * (the number of distinct IntentFilter records, not the number of unique
3079 * activity components) that were found.
3080 */
3081 public abstract int getPreferredActivities(List<IntentFilter> outFilters,
3082 List<ComponentName> outActivities, String packageName);
3083
3084 /**
Christopher Tatea2a0850d2013-09-05 16:38:58 -07003085 * Ask for the set of available 'home' activities and the current explicit
3086 * default, if any.
3087 * @hide
3088 */
3089 public abstract ComponentName getHomeActivities(List<ResolveInfo> outActivities);
3090
3091 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003092 * Set the enabled setting for a package component (activity, receiver, service, provider).
3093 * This setting will override any enabled state which may have been set by the component in its
3094 * manifest.
3095 *
3096 * @param componentName The component to enable
3097 * @param newState The new enabled state for the component. The legal values for this state
3098 * are:
3099 * {@link #COMPONENT_ENABLED_STATE_ENABLED},
3100 * {@link #COMPONENT_ENABLED_STATE_DISABLED}
3101 * and
3102 * {@link #COMPONENT_ENABLED_STATE_DEFAULT}
3103 * The last one removes the setting, thereby restoring the component's state to
3104 * whatever was set in it's manifest (or enabled, by default).
3105 * @param flags Optional behavior flags: {@link #DONT_KILL_APP} or 0.
3106 */
3107 public abstract void setComponentEnabledSetting(ComponentName componentName,
3108 int newState, int flags);
3109
3110
3111 /**
3112 * Return the the enabled setting for a package component (activity,
3113 * receiver, service, provider). This returns the last value set by
3114 * {@link #setComponentEnabledSetting(ComponentName, int, int)}; in most
3115 * cases this value will be {@link #COMPONENT_ENABLED_STATE_DEFAULT} since
3116 * the value originally specified in the manifest has not been modified.
3117 *
3118 * @param componentName The component to retrieve.
3119 * @return Returns the current enabled state for the component. May
3120 * be one of {@link #COMPONENT_ENABLED_STATE_ENABLED},
3121 * {@link #COMPONENT_ENABLED_STATE_DISABLED}, or
3122 * {@link #COMPONENT_ENABLED_STATE_DEFAULT}. The last one means the
3123 * component's enabled state is based on the original information in
3124 * the manifest as found in {@link ComponentInfo}.
3125 */
3126 public abstract int getComponentEnabledSetting(ComponentName componentName);
3127
3128 /**
3129 * Set the enabled setting for an application
3130 * This setting will override any enabled state which may have been set by the application in
3131 * its manifest. It also overrides the enabled state set in the manifest for any of the
3132 * application's components. It does not override any enabled state set by
3133 * {@link #setComponentEnabledSetting} for any of the application's components.
3134 *
3135 * @param packageName The package name of the application to enable
3136 * @param newState The new enabled state for the component. The legal values for this state
3137 * are:
3138 * {@link #COMPONENT_ENABLED_STATE_ENABLED},
3139 * {@link #COMPONENT_ENABLED_STATE_DISABLED}
3140 * and
3141 * {@link #COMPONENT_ENABLED_STATE_DEFAULT}
3142 * The last one removes the setting, thereby restoring the applications's state to
3143 * whatever was set in its manifest (or enabled, by default).
3144 * @param flags Optional behavior flags: {@link #DONT_KILL_APP} or 0.
3145 */
3146 public abstract void setApplicationEnabledSetting(String packageName,
3147 int newState, int flags);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003148
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003149 /**
3150 * Return the the enabled setting for an application. This returns
3151 * the last value set by
3152 * {@link #setApplicationEnabledSetting(String, int, int)}; in most
3153 * cases this value will be {@link #COMPONENT_ENABLED_STATE_DEFAULT} since
3154 * the value originally specified in the manifest has not been modified.
3155 *
3156 * @param packageName The component to retrieve.
3157 * @return Returns the current enabled state for the component. May
3158 * be one of {@link #COMPONENT_ENABLED_STATE_ENABLED},
3159 * {@link #COMPONENT_ENABLED_STATE_DISABLED}, or
3160 * {@link #COMPONENT_ENABLED_STATE_DEFAULT}. The last one means the
3161 * application's enabled state is based on the original information in
3162 * the manifest as found in {@link ComponentInfo}.
Mathew Inwood1b9f8d92011-09-26 13:23:56 +01003163 * @throws IllegalArgumentException if the named package does not exist.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003164 */
3165 public abstract int getApplicationEnabledSetting(String packageName);
3166
3167 /**
Amith Yamasani655d0e22013-06-12 14:19:10 -07003168 * Puts the package in a blocked state, which is almost like an uninstalled state,
3169 * making the package unavailable, but it doesn't remove the data or the actual
3170 * package file.
3171 * @hide
3172 */
3173 public abstract boolean setApplicationBlockedSettingAsUser(String packageName, boolean blocked,
3174 UserHandle userHandle);
3175
3176 /**
3177 * Returns the blocked state of a package.
3178 * @see #setApplicationBlockedSettingAsUser(String, boolean, UserHandle)
3179 * @hide
3180 */
3181 public abstract boolean getApplicationBlockedSettingAsUser(String packageName,
3182 UserHandle userHandle);
3183
3184 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003185 * Return whether the device has been booted into safe mode.
3186 */
3187 public abstract boolean isSafeMode();
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08003188
3189 /**
3190 * Attempts to move package resources from internal to external media or vice versa.
3191 * Since this may take a little while, the result will
3192 * be posted back to the given observer. This call may fail if the calling context
3193 * lacks the {@link android.Manifest.permission#MOVE_PACKAGE} permission, if the
3194 * named package cannot be found, or if the named package is a "system package".
3195 *
3196 * @param packageName The name of the package to delete
3197 * @param observer An observer callback to get notified when the package move is
3198 * complete. {@link android.content.pm.IPackageMoveObserver#packageMoved(boolean)} will be
3199 * called when that happens. observer may be null to indicate that no callback is desired.
3200 * @param flags To indicate install location {@link #MOVE_INTERNAL} or
3201 * {@link #MOVE_EXTERNAL_MEDIA}
3202 *
3203 * @hide
3204 */
3205 public abstract void movePackage(
3206 String packageName, IPackageMoveObserver observer, int flags);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003207
3208 /**
Amith Yamasani13593602012-03-22 16:16:17 -07003209 * Returns the device identity that verifiers can use to associate their scheme to a particular
3210 * device. This should not be used by anything other than a package verifier.
Aravind Akella068b0c02013-10-12 17:39:15 -07003211 *
Kenny Root0aaa0d92011-09-12 16:42:55 -07003212 * @return identity that uniquely identifies current device
3213 * @hide
3214 */
3215 public abstract VerifierDeviceIdentity getVerifierDeviceIdentity();
Amith Yamasani742a6712011-05-04 14:49:28 -07003216
3217 /**
3218 * Returns the data directory for a particular user and package, given the uid of the package.
3219 * @param uid uid of the package, including the userId and appId
3220 * @param packageName name of the package
3221 * @return the user-specific data directory for the package
3222 * @hide
3223 */
3224 public static String getDataDirForUser(int userId, String packageName) {
3225 // TODO: This should be shared with Installer's knowledge of user directory
3226 return Environment.getDataDirectory().toString() + "/user/" + userId
3227 + "/" + packageName;
3228 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003229}