blob: c97c2b89304deb1ebe251037dd8014658a13679f [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
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -080019import android.annotation.SdkConstant;
20import android.annotation.SdkConstant.SdkConstantType;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080021import android.content.ComponentName;
22import android.content.Context;
23import android.content.Intent;
24import android.content.IntentFilter;
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -070025import android.content.IntentSender;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080026import android.content.res.Resources;
27import android.content.res.XmlResourceParser;
28import android.graphics.drawable.Drawable;
29import android.net.Uri;
Amith Yamasani742a6712011-05-04 14:49:28 -070030import android.os.Environment;
Dianne Hackborn0c380492012-08-20 17:23:30 -070031import android.os.UserHandle;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080032import android.util.AndroidException;
33import android.util.DisplayMetrics;
34
35import java.io.File;
36import java.util.List;
37
38/**
39 * Class for retrieving various kinds of information related to the application
40 * packages that are currently installed on the device.
41 *
42 * You can find this class through {@link Context#getPackageManager}.
43 */
44public abstract class PackageManager {
45
46 /**
47 * This exception is thrown when a given package, application, or component
kmccormick30498b42013-03-27 17:39:17 -070048 * name cannot be found.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080049 */
50 public static class NameNotFoundException extends AndroidException {
51 public NameNotFoundException() {
52 }
53
54 public NameNotFoundException(String name) {
55 super(name);
56 }
57 }
58
59 /**
60 * {@link PackageInfo} flag: return information about
61 * activities in the package in {@link PackageInfo#activities}.
62 */
63 public static final int GET_ACTIVITIES = 0x00000001;
64
65 /**
66 * {@link PackageInfo} flag: return information about
67 * intent receivers in the package in
68 * {@link PackageInfo#receivers}.
69 */
70 public static final int GET_RECEIVERS = 0x00000002;
71
72 /**
73 * {@link PackageInfo} flag: return information about
74 * services in the package in {@link PackageInfo#services}.
75 */
76 public static final int GET_SERVICES = 0x00000004;
77
78 /**
79 * {@link PackageInfo} flag: return information about
80 * content providers in the package in
81 * {@link PackageInfo#providers}.
82 */
83 public static final int GET_PROVIDERS = 0x00000008;
84
85 /**
86 * {@link PackageInfo} flag: return information about
87 * instrumentation in the package in
88 * {@link PackageInfo#instrumentation}.
89 */
90 public static final int GET_INSTRUMENTATION = 0x00000010;
91
92 /**
93 * {@link PackageInfo} flag: return information about the
94 * intent filters supported by the activity.
95 */
96 public static final int GET_INTENT_FILTERS = 0x00000020;
97
98 /**
99 * {@link PackageInfo} flag: return information about the
100 * signatures included in the package.
101 */
102 public static final int GET_SIGNATURES = 0x00000040;
103
104 /**
105 * {@link ResolveInfo} flag: return the IntentFilter that
106 * was matched for a particular ResolveInfo in
107 * {@link ResolveInfo#filter}.
108 */
109 public static final int GET_RESOLVED_FILTER = 0x00000040;
110
111 /**
112 * {@link ComponentInfo} flag: return the {@link ComponentInfo#metaData}
113 * data {@link android.os.Bundle}s that are associated with a component.
114 * This applies for any API returning a ComponentInfo subclass.
115 */
116 public static final int GET_META_DATA = 0x00000080;
117
118 /**
119 * {@link PackageInfo} flag: return the
120 * {@link PackageInfo#gids group ids} that are associated with an
121 * application.
Ken Wakasaf76a50c2012-03-09 19:56:35 +0900122 * This applies for any API returning a PackageInfo class, either
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800123 * directly or nested inside of another.
124 */
125 public static final int GET_GIDS = 0x00000100;
126
127 /**
128 * {@link PackageInfo} flag: include disabled components in the returned info.
129 */
130 public static final int GET_DISABLED_COMPONENTS = 0x00000200;
131
132 /**
133 * {@link ApplicationInfo} flag: return the
134 * {@link ApplicationInfo#sharedLibraryFiles paths to the shared libraries}
135 * that are associated with an application.
136 * This applies for any API returning an ApplicationInfo class, either
137 * directly or nested inside of another.
138 */
139 public static final int GET_SHARED_LIBRARY_FILES = 0x00000400;
140
141 /**
142 * {@link ProviderInfo} flag: return the
143 * {@link ProviderInfo#uriPermissionPatterns URI permission patterns}
144 * that are associated with a content provider.
Ken Wakasaf76a50c2012-03-09 19:56:35 +0900145 * This applies for any API returning a ProviderInfo class, either
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800146 * directly or nested inside of another.
147 */
148 public static final int GET_URI_PERMISSION_PATTERNS = 0x00000800;
149 /**
150 * {@link PackageInfo} flag: return information about
151 * permissions in the package in
152 * {@link PackageInfo#permissions}.
153 */
154 public static final int GET_PERMISSIONS = 0x00001000;
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700155
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800156 /**
Kenny Root685f4902011-11-03 10:13:29 -0700157 * Flag parameter to retrieve some information about all applications (even
158 * uninstalled ones) which have data directories. This state could have
159 * resulted if applications have been deleted with flag
160 * {@code DONT_DELETE_DATA} with a possibility of being replaced or
161 * reinstalled in future.
162 * <p>
163 * Note: this flag may cause less information about currently installed
164 * applications to be returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800165 */
166 public static final int GET_UNINSTALLED_PACKAGES = 0x00002000;
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700167
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800168 /**
169 * {@link PackageInfo} flag: return information about
Dianne Hackborn49237342009-08-27 20:08:01 -0700170 * hardware preferences in
171 * {@link PackageInfo#configPreferences PackageInfo.configPreferences} and
172 * requested features in {@link PackageInfo#reqFeatures
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700173 * PackageInfo.reqFeatures}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800174 */
175 public static final int GET_CONFIGURATIONS = 0x00004000;
176
177 /**
Dianne Hackbornfd7aded2013-01-22 17:10:23 -0800178 * {@link PackageInfo} flag: include disabled components which are in
179 * that state only because of {@link #COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED}
180 * in the returned info. Note that if you set this flag, applications
181 * that are in this disabled state will be reported as enabled.
182 */
183 public static final int GET_DISABLED_UNTIL_USED_COMPONENTS = 0x00008000;
184
185 /**
Dianne Hackborn1655be42009-05-08 14:29:01 -0700186 * Resolution and querying flag: if set, only filters that support the
187 * {@link android.content.Intent#CATEGORY_DEFAULT} will be considered for
188 * matching. This is a synonym for including the CATEGORY_DEFAULT in your
189 * supplied Intent.
190 */
191 public static final int MATCH_DEFAULT_ONLY = 0x00010000;
192
193 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800194 * Permission check result: this is returned by {@link #checkPermission}
195 * if the permission has been granted to the given package.
196 */
197 public static final int PERMISSION_GRANTED = 0;
198
199 /**
200 * Permission check result: this is returned by {@link #checkPermission}
201 * if the permission has not been granted to the given package.
202 */
203 public static final int PERMISSION_DENIED = -1;
204
205 /**
206 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700207 * if all signatures on the two packages match.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800208 */
209 public static final int SIGNATURE_MATCH = 0;
210
211 /**
212 * Signature check result: this is returned by {@link #checkSignatures}
213 * if neither of the two packages is signed.
214 */
215 public static final int SIGNATURE_NEITHER_SIGNED = 1;
216
217 /**
218 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700219 * if the first package is not signed but the second is.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800220 */
221 public static final int SIGNATURE_FIRST_NOT_SIGNED = -1;
222
223 /**
224 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700225 * if the second package is not signed but the first is.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800226 */
227 public static final int SIGNATURE_SECOND_NOT_SIGNED = -2;
228
229 /**
230 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700231 * if not all signatures on both packages match.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800232 */
233 public static final int SIGNATURE_NO_MATCH = -3;
234
235 /**
236 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700237 * if either of the packages are not valid.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800238 */
239 public static final int SIGNATURE_UNKNOWN_PACKAGE = -4;
240
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700241 /**
242 * Flag for {@link #setApplicationEnabledSetting(String, int, int)}
243 * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This
244 * component or application is in its default enabled state (as specified
245 * in its manifest).
246 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800247 public static final int COMPONENT_ENABLED_STATE_DEFAULT = 0;
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700248
249 /**
250 * Flag for {@link #setApplicationEnabledSetting(String, int, int)}
251 * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This
252 * component or application has been explictily enabled, regardless of
253 * what it has specified in its manifest.
254 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800255 public static final int COMPONENT_ENABLED_STATE_ENABLED = 1;
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 explicitly disabled, 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_DISABLED = 2;
264
265 /**
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700266 * Flag for {@link #setApplicationEnabledSetting(String, int, int)} only: The
267 * user has explicitly disabled the application, regardless of what it has
268 * specified in its manifest. Because this is due to the user's request,
269 * they may re-enable it if desired through the appropriate system UI. This
kmccormick30498b42013-03-27 17:39:17 -0700270 * option currently <strong>cannot</strong> be used with
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700271 * {@link #setComponentEnabledSetting(ComponentName, int, int)}.
272 */
273 public static final int COMPONENT_ENABLED_STATE_DISABLED_USER = 3;
274
275 /**
Dianne Hackbornfd7aded2013-01-22 17:10:23 -0800276 * Flag for {@link #setApplicationEnabledSetting(String, int, int)} only: This
277 * application should be considered, until the point where the user actually
278 * wants to use it. This means that it will not normally show up to the user
279 * (such as in the launcher), but various parts of the user interface can
280 * use {@link #GET_DISABLED_UNTIL_USED_COMPONENTS} to still see it and allow
281 * the user to select it (as for example an IME, device admin, etc). Such code,
282 * once the user has selected the app, should at that point also make it enabled.
283 * This option currently <strong>can not</strong> be used with
284 * {@link #setComponentEnabledSetting(ComponentName, int, int)}.
285 */
286 public static final int COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED = 4;
287
288 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800289 * Flag parameter for {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} to
290 * indicate that this package should be installed as forward locked, i.e. only the app itself
Brad Fitzpatrick2e805b12010-03-22 10:10:51 -0700291 * should have access to its code and non-resource assets.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700292 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800293 */
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700294 public static final int INSTALL_FORWARD_LOCK = 0x00000001;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800295
296 /**
297 * Flag parameter for {@link #installPackage} to indicate that you want to replace an already
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700298 * installed package, if one exists.
299 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800300 */
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700301 public static final int INSTALL_REPLACE_EXISTING = 0x00000002;
302
303 /**
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700304 * Flag parameter for {@link #installPackage} to indicate that you want to
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700305 * allow test packages (those that have set android:testOnly in their
306 * manifest) to be installed.
307 * @hide
308 */
309 public static final int INSTALL_ALLOW_TEST = 0x00000004;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800310
311 /**
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800312 * Flag parameter for {@link #installPackage} to indicate that this
313 * package has to be installed on the sdcard.
314 * @hide
315 */
Suchi Amalapurapu5b993ce2010-02-12 09:43:29 -0800316 public static final int INSTALL_EXTERNAL = 0x00000008;
Oscar Montemayor539d3c42010-01-29 15:27:00 -0800317
318 /**
Kenny Root5ab21572011-07-27 11:11:19 -0700319 * Flag parameter for {@link #installPackage} to indicate that this package
320 * has to be installed on the sdcard.
321 * @hide
322 */
323 public static final int INSTALL_INTERNAL = 0x00000010;
324
325 /**
326 * Flag parameter for {@link #installPackage} to indicate that this install
327 * was initiated via ADB.
328 *
329 * @hide
330 */
331 public static final int INSTALL_FROM_ADB = 0x00000020;
Suchi Amalapurapu14b6abd2010-03-17 08:37:04 -0700332
333 /**
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700334 * Flag parameter for {@link #installPackage} to indicate that this install
335 * should immediately be visible to all users.
336 *
337 * @hide
338 */
339 public static final int INSTALL_ALL_USERS = 0x00000040;
340
341 /**
342 * Flag parameter for {@link #installPackage} to indicate that it is okay
343 * to install an update to an app where the newly installed app has a lower
344 * version code than the currently installed app.
345 *
346 * @hide
347 */
348 public static final int INSTALL_ALLOW_DOWNGRADE = 0x00000080;
349
350 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800351 * Flag parameter for
352 * {@link #setComponentEnabledSetting(android.content.ComponentName, int, int)} to indicate
353 * that you don't want to kill the app containing the component. Be careful when you set this
354 * since changing component states can make the containing application's behavior unpredictable.
355 */
356 public static final int DONT_KILL_APP = 0x00000001;
357
358 /**
359 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
360 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} on success.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700361 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800362 */
363 public static final int INSTALL_SUCCEEDED = 1;
364
365 /**
366 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
367 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if the package is
368 * already installed.
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_FAILED_ALREADY_EXISTS = -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 archive
376 * file is invalid.
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_INVALID_APK = -2;
380
381 /**
382 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
383 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if the URI passed in
384 * 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_URI = -3;
388
389 /**
390 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
391 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if the package manager
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700392 * service found that the device didn't have enough storage space to install the app.
393 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800394 */
395 public static final int INSTALL_FAILED_INSUFFICIENT_STORAGE = -4;
396
397 /**
398 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
399 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if a
400 * package is already installed with the same name.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700401 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800402 */
403 public static final int INSTALL_FAILED_DUPLICATE_PACKAGE = -5;
404
405 /**
406 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
407 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
408 * the requested shared user does not exist.
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_NO_SHARED_USER = -6;
412
413 /**
414 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
415 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
416 * a previously installed package of the same name has a different signature
417 * than the new package (and the old package's data was not removed).
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700418 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800419 */
420 public static final int INSTALL_FAILED_UPDATE_INCOMPATIBLE = -7;
421
422 /**
423 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
424 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
425 * the new package is requested a shared user which is already installed on the
426 * device and does not have matching signature.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700427 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800428 */
429 public static final int INSTALL_FAILED_SHARED_USER_INCOMPATIBLE = -8;
430
431 /**
432 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
433 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
434 * the new package uses a shared library that is not available.
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_MISSING_SHARED_LIBRARY = -9;
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_REPLACE_COULDNT_DELETE = -10;
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 failed while optimizing and validating its dex files,
451 * either because there was not enough storage or the validation failed.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700452 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800453 */
454 public static final int INSTALL_FAILED_DEXOPT = -11;
455
456 /**
457 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
458 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
459 * the new package failed because the current SDK version is older than
460 * that required by the package.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700461 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800462 */
463 public static final int INSTALL_FAILED_OLDER_SDK = -12;
464
465 /**
The Android Open Source Project10592532009-03-18 17:39:46 -0700466 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
467 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
468 * the new package failed because it contains a content provider with the
469 * same authority as a provider already installed in the system.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700470 * @hide
The Android Open Source Project10592532009-03-18 17:39:46 -0700471 */
472 public static final int INSTALL_FAILED_CONFLICTING_PROVIDER = -13;
473
474 /**
Dianne Hackborn851a5412009-05-08 12:06:44 -0700475 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
476 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
477 * the new package failed because the current SDK version is newer than
478 * that required by the package.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700479 * @hide
Dianne Hackborn851a5412009-05-08 12:06:44 -0700480 */
481 public static final int INSTALL_FAILED_NEWER_SDK = -14;
482
483 /**
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700484 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
485 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
486 * the new package failed because it has specified that it is a test-only
487 * package and the caller has not supplied the {@link #INSTALL_ALLOW_TEST}
488 * flag.
489 * @hide
490 */
491 public static final int INSTALL_FAILED_TEST_ONLY = -15;
492
493 /**
Dianne Hackbornb1811182009-05-21 15:45:42 -0700494 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
495 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
496 * the package being installed contains native code, but none that is
497 * compatible with the the device's CPU_ABI.
498 * @hide
499 */
500 public static final int INSTALL_FAILED_CPU_ABI_INCOMPATIBLE = -16;
501
502 /**
Dianne Hackborn49237342009-08-27 20:08:01 -0700503 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
504 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
505 * the new package uses a feature that is not available.
506 * @hide
507 */
508 public static final int INSTALL_FAILED_MISSING_FEATURE = -17;
509
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800510 // ------ Errors related to sdcard
511 /**
512 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
513 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
514 * a secure container mount point couldn't be accessed on external media.
515 * @hide
516 */
517 public static final int INSTALL_FAILED_CONTAINER_ERROR = -18;
518
Dianne Hackborn49237342009-08-27 20:08:01 -0700519 /**
Suchi Amalapurapub56ae202010-02-04 22:51:07 -0800520 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
521 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
522 * the new package couldn't be installed in the specified install
523 * location.
524 * @hide
525 */
526 public static final int INSTALL_FAILED_INVALID_INSTALL_LOCATION = -19;
527
528 /**
Suchi Amalapurapu8a9ab242010-03-11 16:49:16 -0800529 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
530 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
531 * the new package couldn't be installed in the specified install
532 * location because the media is not available.
533 * @hide
534 */
535 public static final int INSTALL_FAILED_MEDIA_UNAVAILABLE = -20;
536
537 /**
Kenny Root5ab21572011-07-27 11:11:19 -0700538 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
539 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
540 * the new package couldn't be installed because the verification timed out.
541 * @hide
542 */
543 public static final int INSTALL_FAILED_VERIFICATION_TIMEOUT = -21;
544
545 /**
546 * 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 did not succeed.
549 * @hide
550 */
551 public static final int INSTALL_FAILED_VERIFICATION_FAILURE = -22;
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 package changed from what the calling program expected.
557 * @hide
558 */
559 public static final int INSTALL_FAILED_PACKAGE_CHANGED = -23;
560
561 /**
Dianne Hackbornd0c5f512012-06-07 16:53:59 -0700562 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
563 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
564 * the new package is assigned a different UID than it previously held.
565 * @hide
566 */
567 public static final int INSTALL_FAILED_UID_CHANGED = -24;
568
569 /**
Dianne Hackborn7767eac2012-08-23 18:25:40 -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 has an older version code than the currently installed package.
573 * @hide
574 */
575 public static final int INSTALL_FAILED_VERSION_DOWNGRADE = -25;
576
577 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800578 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
579 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
580 * if the parser was given a path that is not a file, or does not end with the expected
581 * '.apk' extension.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700582 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800583 */
584 public static final int INSTALL_PARSE_FAILED_NOT_APK = -100;
585
586 /**
587 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
588 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
589 * if the parser was unable to retrieve the AndroidManifest.xml file.
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_BAD_MANIFEST = -101;
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 encountered an unexpected exception.
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_UNEXPECTED_EXCEPTION = -102;
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 did not find any certificates in the .apk.
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_NO_CERTIFICATES = -103;
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 found inconsistent certificates on the files 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_INCONSISTENT_CERTIFICATES = -104;
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 encountered a CertificateEncodingException in one of the
622 * files in the .apk.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700623 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800624 */
625 public static final int INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING = -105;
626
627 /**
628 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
629 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
630 * if the parser encountered a bad or missing package name in the manifest.
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_BAD_PACKAGE_NAME = -106;
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 shared user id 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_SHARED_USER_ID = -107;
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 some structural problem 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_MANIFEST_MALFORMED = -108;
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 did not find any actionable tags (instrumentation or application)
655 * in the manifest.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700656 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800657 */
658 public static final int INSTALL_PARSE_FAILED_MANIFEST_EMPTY = -109;
659
660 /**
Suchi Amalapurapu5b993ce2010-02-12 09:43:29 -0800661 * Installation failed return code: this is passed to the {@link IPackageInstallObserver} by
662 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
663 * if the system failed to install the package because of system issues.
664 * @hide
665 */
666 public static final int INSTALL_FAILED_INTERNAL_ERROR = -110;
667
668 /**
Amith Yamasanie4cf7342012-12-17 11:12:09 -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 the user is restricted from installing
672 * apps.
673 * @hide
674 */
675 public static final int INSTALL_FAILED_USER_RESTRICTED = -111;
676
677 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800678 * Flag parameter for {@link #deletePackage} to indicate that you don't want to delete the
679 * package's data directory.
680 *
681 * @hide
682 */
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700683 public static final int DELETE_KEEP_DATA = 0x00000001;
684
685 /**
686 * Flag parameter for {@link #deletePackage} to indicate that you want the
687 * package deleted for all users.
688 *
689 * @hide
690 */
691 public static final int DELETE_ALL_USERS = 0x00000002;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800692
693 /**
Dianne Hackbornc895be72013-03-11 17:48:43 -0700694 * Flag parameter for {@link #deletePackage} to indicate that, if you are calling
695 * uninstall on a system that has been updated, then don't do the normal process
696 * of uninstalling the update and rolling back to the older system version (which
697 * needs to happen for all users); instead, just mark the app as uninstalled for
698 * the current user.
699 *
700 * @hide
701 */
702 public static final int DELETE_SYSTEM_APP = 0x00000004;
703
704 /**
Kenny Rootc39bb4a2011-02-28 13:27:19 -0800705 * Return code for when package deletion succeeds. This is passed to the
706 * {@link IPackageDeleteObserver} by {@link #deletePackage()} if the system
707 * succeeded in deleting the package.
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700708 *
Kenny Rootc39bb4a2011-02-28 13:27:19 -0800709 * @hide
710 */
711 public static final int DELETE_SUCCEEDED = 1;
712
713 /**
714 * Deletion failed return code: this is passed to the
715 * {@link IPackageDeleteObserver} by {@link #deletePackage()} if the system
716 * failed to delete the package for an unspecified reason.
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700717 *
Kenny Rootc39bb4a2011-02-28 13:27:19 -0800718 * @hide
719 */
720 public static final int DELETE_FAILED_INTERNAL_ERROR = -1;
721
722 /**
723 * Deletion failed return code: this is passed to the
724 * {@link IPackageDeleteObserver} by {@link #deletePackage()} if the system
725 * failed to delete the package because it is the active DevicePolicy
726 * manager.
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700727 *
Kenny Rootc39bb4a2011-02-28 13:27:19 -0800728 * @hide
729 */
730 public static final int DELETE_FAILED_DEVICE_POLICY_MANAGER = -2;
731
732 /**
Amith Yamasanie4cf7342012-12-17 11:12:09 -0800733 * Deletion failed return code: this is passed to the
734 * {@link IPackageDeleteObserver} by {@link #deletePackage()} if the system
735 * failed to delete the package since the user is restricted.
736 *
737 * @hide
738 */
739 public static final int DELETE_FAILED_USER_RESTRICTED = -3;
740
741 /**
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -0800742 * Return code that is passed to the {@link IPackageMoveObserver} by
Kenny Rootc39bb4a2011-02-28 13:27:19 -0800743 * {@link #movePackage(android.net.Uri, IPackageMoveObserver)} when the
744 * package has been successfully moved by the system.
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700745 *
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -0800746 * @hide
747 */
748 public static final int MOVE_SUCCEEDED = 1;
749 /**
750 * Error code that is passed to the {@link IPackageMoveObserver} by
751 * {@link #movePackage(android.net.Uri, IPackageMoveObserver)}
752 * when the package hasn't been successfully moved by the system
753 * because of insufficient memory on specified media.
754 * @hide
755 */
756 public static final int MOVE_FAILED_INSUFFICIENT_STORAGE = -1;
757
758 /**
759 * Error code that is passed to the {@link IPackageMoveObserver} by
760 * {@link #movePackage(android.net.Uri, IPackageMoveObserver)}
761 * if the specified package doesn't exist.
762 * @hide
763 */
764 public static final int MOVE_FAILED_DOESNT_EXIST = -2;
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 cannot be moved since its a system package.
770 * @hide
771 */
772 public static final int MOVE_FAILED_SYSTEM_PACKAGE = -3;
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 forward locked.
778 * @hide
779 */
780 public static final int MOVE_FAILED_FORWARD_LOCKED = -4;
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 to the specified location.
786 * @hide
787 */
788 public static final int MOVE_FAILED_INVALID_LOCATION = -5;
789
790 /**
Suchi Amalapurapu8a9ab242010-03-11 16:49:16 -0800791 * 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_INTERNAL_ERROR = -6;
797
798 /**
Kenny Rootdeb11262010-08-02 11:36:21 -0700799 * Error code that is passed to the {@link IPackageMoveObserver} by
800 * {@link #movePackage(android.net.Uri, IPackageMoveObserver)} if the
801 * specified package already has an operation pending in the
802 * {@link PackageHandler} queue.
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700803 *
Kenny Rootdeb11262010-08-02 11:36:21 -0700804 * @hide
805 */
806 public static final int MOVE_FAILED_OPERATION_PENDING = -7;
807
808 /**
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -0800809 * Flag parameter for {@link #movePackage} to indicate that
810 * the package should be moved to internal storage if its
811 * been installed on external media.
812 * @hide
813 */
814 public static final int MOVE_INTERNAL = 0x00000001;
815
816 /**
817 * Flag parameter for {@link #movePackage} to indicate that
818 * the package should be moved to external media.
819 * @hide
820 */
821 public static final int MOVE_EXTERNAL_MEDIA = 0x00000002;
822
823 /**
Kenny Root05ca4c92011-09-15 10:36:25 -0700824 * Usable by the required verifier as the {@code verificationCode} argument
825 * for {@link PackageManager#verifyPendingInstall} to indicate that it will
826 * allow the installation to proceed without any of the optional verifiers
827 * needing to vote.
828 *
829 * @hide
830 */
831 public static final int VERIFICATION_ALLOW_WITHOUT_SUFFICIENT = 2;
832
833 /**
Kenny Root3a9b5fb2011-09-20 14:15:38 -0700834 * Used as the {@code verificationCode} argument for
835 * {@link PackageManager#verifyPendingInstall} to indicate that the calling
836 * package verifier allows the installation to proceed.
837 */
838 public static final int VERIFICATION_ALLOW = 1;
839
840 /**
841 * Used as the {@code verificationCode} argument for
842 * {@link PackageManager#verifyPendingInstall} to indicate the calling
843 * package verifier does not vote to allow the installation to proceed.
844 */
845 public static final int VERIFICATION_REJECT = -1;
846
847 /**
rich canningsd9ef3e52012-08-22 14:28:05 -0700848 * Can be used as the {@code millisecondsToDelay} argument for
849 * {@link PackageManager#extendVerificationTimeout}. This is the
850 * maximum time {@code PackageManager} waits for the verification
851 * agent to return (in milliseconds).
852 */
853 public static final long MAXIMUM_VERIFICATION_TIMEOUT = 60*60*1000;
854
855 /**
Amith Yamasani0b285492011-04-14 17:35:23 -0700856 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: The device's
857 * audio pipeline is low-latency, more suitable for audio applications sensitive to delays or
858 * lag in sound input or output.
Dan Morrill898e1e82010-09-26 17:28:30 -0700859 */
860 @SdkConstant(SdkConstantType.FEATURE)
861 public static final String FEATURE_AUDIO_LOW_LATENCY = "android.hardware.audio.low_latency";
862
863 /**
864 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -0800865 * {@link #hasSystemFeature}: The device is capable of communicating with
866 * other devices via Bluetooth.
867 */
868 @SdkConstant(SdkConstantType.FEATURE)
869 public static final String FEATURE_BLUETOOTH = "android.hardware.bluetooth";
870
871 /**
872 * Feature for {@link #getSystemAvailableFeatures} and
Matthew Xiea7227722013-04-18 15:25:59 -0700873 * {@link #hasSystemFeature}: The device is capable of communicating with
874 * other devices via Bluetooth Low Energy radio.
875 */
876 @SdkConstant(SdkConstantType.FEATURE)
877 public static final String FEATURE_BLUETOOTH_LE = "android.hardware.bluetooth_le";
878
879 /**
880 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn08ee42c2009-11-19 17:08:01 -0800881 * {@link #hasSystemFeature}: The device has a camera facing away
882 * from the screen.
883 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -0800884 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -0800885 public static final String FEATURE_CAMERA = "android.hardware.camera";
Dan Morrill50ab63f2010-03-05 16:16:19 -0800886
Dianne Hackborn08ee42c2009-11-19 17:08:01 -0800887 /**
888 * Feature for {@link #getSystemAvailableFeatures} and
889 * {@link #hasSystemFeature}: The device's camera supports auto-focus.
890 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -0800891 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -0800892 public static final String FEATURE_CAMERA_AUTOFOCUS = "android.hardware.camera.autofocus";
Dan Morrill50ab63f2010-03-05 16:16:19 -0800893
Dianne Hackborn08ee42c2009-11-19 17:08:01 -0800894 /**
895 * Feature for {@link #getSystemAvailableFeatures} and
Eino-Ville Talvala752af832012-09-18 14:45:37 -0700896 * {@link #hasSystemFeature}: The device has at least one camera pointing in
897 * some direction.
Eino-Ville Talvala752af832012-09-18 14:45:37 -0700898 */
899 @SdkConstant(SdkConstantType.FEATURE)
900 public static final String FEATURE_CAMERA_ANY = "android.hardware.camera.any";
901
902 /**
903 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn08ee42c2009-11-19 17:08:01 -0800904 * {@link #hasSystemFeature}: The device's camera supports flash.
905 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -0800906 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -0800907 public static final String FEATURE_CAMERA_FLASH = "android.hardware.camera.flash";
Dan Morrill50ab63f2010-03-05 16:16:19 -0800908
909 /**
910 * Feature for {@link #getSystemAvailableFeatures} and
Chih-Chung Changde1057c2010-06-14 19:15:00 +0800911 * {@link #hasSystemFeature}: The device has a front facing camera.
912 */
913 @SdkConstant(SdkConstantType.FEATURE)
914 public static final String FEATURE_CAMERA_FRONT = "android.hardware.camera.front";
915
916 /**
917 * Feature for {@link #getSystemAvailableFeatures} and
Alex Ray0c9d61f2013-10-03 12:17:54 -0700918 * {@link #hasSystemFeature}: The device is capable of communicating with
919 * consumer IR devices.
920 */
921 @SdkConstant(SdkConstantType.FEATURE)
922 public static final String FEATURE_CONSUMER_IR = "android.hardware.consumerir";
923
924 /**
925 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -0800926 * {@link #hasSystemFeature}: The device supports one or more methods of
927 * reporting current location.
928 */
929 @SdkConstant(SdkConstantType.FEATURE)
930 public static final String FEATURE_LOCATION = "android.hardware.location";
931
932 /**
933 * Feature for {@link #getSystemAvailableFeatures} and
934 * {@link #hasSystemFeature}: The device has a Global Positioning System
935 * receiver and can report precise location.
936 */
937 @SdkConstant(SdkConstantType.FEATURE)
938 public static final String FEATURE_LOCATION_GPS = "android.hardware.location.gps";
939
940 /**
941 * Feature for {@link #getSystemAvailableFeatures} and
942 * {@link #hasSystemFeature}: The device can report location with coarse
943 * accuracy using a network-based geolocation system.
944 */
945 @SdkConstant(SdkConstantType.FEATURE)
946 public static final String FEATURE_LOCATION_NETWORK = "android.hardware.location.network";
947
948 /**
949 * Feature for {@link #getSystemAvailableFeatures} and
950 * {@link #hasSystemFeature}: The device can record audio via a
951 * microphone.
952 */
953 @SdkConstant(SdkConstantType.FEATURE)
954 public static final String FEATURE_MICROPHONE = "android.hardware.microphone";
955
956 /**
957 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill76437d32010-09-01 11:17:20 -0700958 * {@link #hasSystemFeature}: The device can communicate using Near-Field
959 * Communications (NFC).
960 */
961 @SdkConstant(SdkConstantType.FEATURE)
962 public static final String FEATURE_NFC = "android.hardware.nfc";
963
964 /**
965 * Feature for {@link #getSystemAvailableFeatures} and
Martijn Coenenf4bf1582013-07-22 12:01:19 -0700966 * {@link #hasSystemFeature}: The device supports host-
967 * based NFC card emulation.
Martijn Coenendf4d1d62013-08-28 11:18:58 -0700968 *
969 * TODO remove when depending apps have moved to new constant.
970 * @hide
971 * @deprecated
Martijn Coenenf4bf1582013-07-22 12:01:19 -0700972 */
973 @SdkConstant(SdkConstantType.FEATURE)
974 public static final String FEATURE_NFC_HCE = "android.hardware.nfc.hce";
975
976 /**
977 * Feature for {@link #getSystemAvailableFeatures} and
Martijn Coenendf4d1d62013-08-28 11:18:58 -0700978 * {@link #hasSystemFeature}: The device supports host-
979 * based NFC card emulation.
980 */
981 @SdkConstant(SdkConstantType.FEATURE)
982 public static final String FEATURE_NFC_HOST_CARD_EMULATION = "android.hardware.nfc.hce";
983
984 /**
985 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill5744bb42010-09-01 19:18:57 -0700986 * {@link #hasSystemFeature}: The device includes an accelerometer.
987 */
988 @SdkConstant(SdkConstantType.FEATURE)
989 public static final String FEATURE_SENSOR_ACCELEROMETER = "android.hardware.sensor.accelerometer";
990
991 /**
992 * Feature for {@link #getSystemAvailableFeatures} and
993 * {@link #hasSystemFeature}: The device includes a barometer (air
994 * pressure sensor.)
995 */
996 @SdkConstant(SdkConstantType.FEATURE)
997 public static final String FEATURE_SENSOR_BAROMETER = "android.hardware.sensor.barometer";
998
999 /**
1000 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001001 * {@link #hasSystemFeature}: The device includes a magnetometer (compass).
1002 */
1003 @SdkConstant(SdkConstantType.FEATURE)
1004 public static final String FEATURE_SENSOR_COMPASS = "android.hardware.sensor.compass";
1005
1006 /**
1007 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill5744bb42010-09-01 19:18:57 -07001008 * {@link #hasSystemFeature}: The device includes a gyroscope.
Dan Morrill50ab63f2010-03-05 16:16:19 -08001009 */
1010 @SdkConstant(SdkConstantType.FEATURE)
Dan Morrill5744bb42010-09-01 19:18:57 -07001011 public static final String FEATURE_SENSOR_GYROSCOPE = "android.hardware.sensor.gyroscope";
Dan Morrill50ab63f2010-03-05 16:16:19 -08001012
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001013 /**
1014 * Feature for {@link #getSystemAvailableFeatures} and
1015 * {@link #hasSystemFeature}: The device includes a light sensor.
1016 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001017 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001018 public static final String FEATURE_SENSOR_LIGHT = "android.hardware.sensor.light";
Dan Morrill50ab63f2010-03-05 16:16:19 -08001019
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001020 /**
1021 * Feature for {@link #getSystemAvailableFeatures} and
1022 * {@link #hasSystemFeature}: The device includes a proximity sensor.
1023 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001024 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001025 public static final String FEATURE_SENSOR_PROXIMITY = "android.hardware.sensor.proximity";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001026
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001027 /**
1028 * Feature for {@link #getSystemAvailableFeatures} and
Aravind Akella068b0c02013-10-12 17:39:15 -07001029 * {@link #hasSystemFeature}: The device includes a hardware step counter.
1030 */
1031 @SdkConstant(SdkConstantType.FEATURE)
1032 public static final String FEATURE_SENSOR_STEP_COUNTER = "android.hardware.sensor.stepcounter";
1033
1034 /**
1035 * Feature for {@link #getSystemAvailableFeatures} and
1036 * {@link #hasSystemFeature}: The device includes a hardware step detector.
1037 */
1038 @SdkConstant(SdkConstantType.FEATURE)
1039 public static final String FEATURE_SENSOR_STEP_DETECTOR = "android.hardware.sensor.stepdetector";
1040
1041 /**
1042 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001043 * {@link #hasSystemFeature}: The device has a telephony radio with data
1044 * communication support.
1045 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001046 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001047 public static final String FEATURE_TELEPHONY = "android.hardware.telephony";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001048
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001049 /**
1050 * Feature for {@link #getSystemAvailableFeatures} and
1051 * {@link #hasSystemFeature}: The device has a CDMA telephony stack.
1052 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001053 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001054 public static final String FEATURE_TELEPHONY_CDMA = "android.hardware.telephony.cdma";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001055
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001056 /**
1057 * Feature for {@link #getSystemAvailableFeatures} and
1058 * {@link #hasSystemFeature}: The device has a GSM telephony stack.
1059 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001060 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001061 public static final String FEATURE_TELEPHONY_GSM = "android.hardware.telephony.gsm";
Hung-ying Tyan3424c022010-08-27 18:08:19 +08001062
1063 /**
1064 * Feature for {@link #getSystemAvailableFeatures} and
Mike Lockwoodf4ca2472011-02-27 11:23:25 -08001065 * {@link #hasSystemFeature}: The device supports connecting to USB devices
1066 * as the USB host.
1067 */
1068 @SdkConstant(SdkConstantType.FEATURE)
1069 public static final String FEATURE_USB_HOST = "android.hardware.usb.host";
1070
1071 /**
1072 * Feature for {@link #getSystemAvailableFeatures} and
1073 * {@link #hasSystemFeature}: The device supports connecting to USB accessories.
1074 */
1075 @SdkConstant(SdkConstantType.FEATURE)
1076 public static final String FEATURE_USB_ACCESSORY = "android.hardware.usb.accessory";
1077
1078 /**
1079 * Feature for {@link #getSystemAvailableFeatures} and
Hung-ying Tyan3424c022010-08-27 18:08:19 +08001080 * {@link #hasSystemFeature}: The SIP API is enabled on the device.
1081 */
1082 @SdkConstant(SdkConstantType.FEATURE)
1083 public static final String FEATURE_SIP = "android.software.sip";
1084
1085 /**
1086 * Feature for {@link #getSystemAvailableFeatures} and
1087 * {@link #hasSystemFeature}: The device supports SIP-based VOIP.
1088 */
1089 @SdkConstant(SdkConstantType.FEATURE)
1090 public static final String FEATURE_SIP_VOIP = "android.software.sip.voip";
1091
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001092 /**
1093 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrillb0fe0332010-04-05 14:43:58 -07001094 * {@link #hasSystemFeature}: The device's display has a touch screen.
1095 */
1096 @SdkConstant(SdkConstantType.FEATURE)
1097 public static final String FEATURE_TOUCHSCREEN = "android.hardware.touchscreen";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001098
1099
Dan Morrillb0fe0332010-04-05 14:43:58 -07001100 /**
1101 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001102 * {@link #hasSystemFeature}: The device's touch screen supports
1103 * multitouch sufficient for basic two-finger gesture detection.
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001104 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001105 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001106 public static final String FEATURE_TOUCHSCREEN_MULTITOUCH = "android.hardware.touchscreen.multitouch";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001107
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001108 /**
1109 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001110 * {@link #hasSystemFeature}: The device's touch screen is capable of
1111 * tracking two or more fingers fully independently.
1112 */
1113 @SdkConstant(SdkConstantType.FEATURE)
1114 public static final String FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT = "android.hardware.touchscreen.multitouch.distinct";
1115
1116 /**
1117 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill6993d3d2010-09-03 14:30:14 -07001118 * {@link #hasSystemFeature}: The device's touch screen is capable of
1119 * tracking a full hand of fingers fully independently -- that is, 5 or
1120 * more simultaneous independent pointers.
1121 */
1122 @SdkConstant(SdkConstantType.FEATURE)
1123 public static final String FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND = "android.hardware.touchscreen.multitouch.jazzhand";
1124
1125 /**
1126 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrilla5376872011-01-23 13:15:53 -08001127 * {@link #hasSystemFeature}: The device does not have a touch screen, but
1128 * does support touch emulation for basic events. For instance, the
1129 * device might use a mouse or remote control to drive a cursor, and
1130 * emulate basic touch pointer events like down, up, drag, etc. All
1131 * devices that support android.hardware.touchscreen or a sub-feature are
1132 * presumed to also support faketouch.
1133 */
1134 @SdkConstant(SdkConstantType.FEATURE)
1135 public static final String FEATURE_FAKETOUCH = "android.hardware.faketouch";
1136
1137 /**
1138 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborne22fe932011-06-08 20:24:29 -07001139 * {@link #hasSystemFeature}: The device does not have a touch screen, but
1140 * does support touch emulation for basic events that supports distinct
1141 * tracking of two or more fingers. This is an extension of
1142 * {@link #FEATURE_FAKETOUCH} for input devices with this capability. Note
1143 * that unlike a distinct multitouch screen as defined by
1144 * {@link #FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT}, these kinds of input
1145 * devices will not actually provide full two-finger gestures since the
1146 * input is being transformed to cursor movement on the screen. That is,
1147 * single finger gestures will move a cursor; two-finger swipes will
1148 * result in single-finger touch events; other two-finger gestures will
1149 * result in the corresponding two-finger touch event.
1150 */
1151 @SdkConstant(SdkConstantType.FEATURE)
1152 public static final String FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT = "android.hardware.faketouch.multitouch.distinct";
1153
1154 /**
1155 * Feature for {@link #getSystemAvailableFeatures} and
1156 * {@link #hasSystemFeature}: The device does not have a touch screen, but
1157 * does support touch emulation for basic events that supports tracking
1158 * a hand of fingers (5 or more fingers) fully independently.
1159 * This is an extension of
1160 * {@link #FEATURE_FAKETOUCH} for input devices with this capability. Note
1161 * that unlike a multitouch screen as defined by
1162 * {@link #FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND}, not all two finger
1163 * gestures can be detected due to the limitations described for
1164 * {@link #FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT}.
1165 */
1166 @SdkConstant(SdkConstantType.FEATURE)
1167 public static final String FEATURE_FAKETOUCH_MULTITOUCH_JAZZHAND = "android.hardware.faketouch.multitouch.jazzhand";
1168
1169 /**
1170 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborne289bff2011-06-13 19:33:22 -07001171 * {@link #hasSystemFeature}: The device supports portrait orientation
1172 * screens. For backwards compatibility, you can assume that if neither
1173 * this nor {@link #FEATURE_SCREEN_LANDSCAPE} is set then the device supports
1174 * both portrait and landscape.
1175 */
1176 @SdkConstant(SdkConstantType.FEATURE)
1177 public static final String FEATURE_SCREEN_PORTRAIT = "android.hardware.screen.portrait";
1178
1179 /**
1180 * Feature for {@link #getSystemAvailableFeatures} and
1181 * {@link #hasSystemFeature}: The device supports landscape orientation
1182 * screens. For backwards compatibility, you can assume that if neither
1183 * this nor {@link #FEATURE_SCREEN_PORTRAIT} is set then the device supports
1184 * both portrait and landscape.
1185 */
1186 @SdkConstant(SdkConstantType.FEATURE)
1187 public static final String FEATURE_SCREEN_LANDSCAPE = "android.hardware.screen.landscape";
1188
1189 /**
1190 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001191 * {@link #hasSystemFeature}: The device supports live wallpapers.
1192 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001193 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001194 public static final String FEATURE_LIVE_WALLPAPER = "android.software.live_wallpaper";
Oscar Montemayor1228d0a2010-01-28 12:01:44 -08001195
Oscar Montemayor1228d0a2010-01-28 12:01:44 -08001196 /**
Dan Morrill50ab63f2010-03-05 16:16:19 -08001197 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn119bbc32013-03-22 17:27:25 -07001198 * {@link #hasSystemFeature}: The device supports app widgets.
1199 */
1200 @SdkConstant(SdkConstantType.FEATURE)
1201 public static final String FEATURE_APP_WIDGETS = "android.software.app_widgets";
1202
1203 /**
1204 * Feature for {@link #getSystemAvailableFeatures} and
1205 * {@link #hasSystemFeature}: The device supports a home screen that is replaceable
1206 * by third party applications.
1207 */
1208 @SdkConstant(SdkConstantType.FEATURE)
1209 public static final String FEATURE_HOME_SCREEN = "android.software.home_screen";
1210
1211 /**
1212 * Feature for {@link #getSystemAvailableFeatures} and
1213 * {@link #hasSystemFeature}: The device supports adding new input methods implemented
1214 * with the {@link android.inputmethodservice.InputMethodService} API.
1215 */
1216 @SdkConstant(SdkConstantType.FEATURE)
1217 public static final String FEATURE_INPUT_METHODS = "android.software.input_methods";
1218
1219 /**
1220 * Feature for {@link #getSystemAvailableFeatures} and
Amith Yamasani44a01b72013-09-16 10:44:57 -07001221 * {@link #hasSystemFeature}: The device supports device policy enforcement via device admins.
1222 */
1223 @SdkConstant(SdkConstantType.FEATURE)
1224 public static final String FEATURE_DEVICE_ADMIN = "android.software.device_admin";
1225
1226 /**
1227 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001228 * {@link #hasSystemFeature}: The device supports WiFi (802.11) networking.
1229 */
1230 @SdkConstant(SdkConstantType.FEATURE)
1231 public static final String FEATURE_WIFI = "android.hardware.wifi";
1232
1233 /**
Irfan Sheriff45b8b462011-09-07 11:24:16 -07001234 * Feature for {@link #getSystemAvailableFeatures} and
1235 * {@link #hasSystemFeature}: The device supports Wi-Fi Direct networking.
1236 */
1237 @SdkConstant(SdkConstantType.FEATURE)
1238 public static final String FEATURE_WIFI_DIRECT = "android.hardware.wifi.direct";
1239
1240 /**
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07001241 * Feature for {@link #getSystemAvailableFeatures} and
1242 * {@link #hasSystemFeature}: This is a device dedicated to showing UI
1243 * on a television. Television here is defined to be a typical living
1244 * room television experience: displayed on a big screen, where the user
1245 * is sitting far away from it, and the dominant form of input will be
1246 * something like a DPAD, not through touch or mouse.
1247 */
1248 @SdkConstant(SdkConstantType.FEATURE)
1249 public static final String FEATURE_TELEVISION = "android.hardware.type.television";
1250
1251 /**
Dianne Hackborne83cefce2010-02-04 17:38:14 -08001252 * Action to external storage service to clean out removed apps.
1253 * @hide
1254 */
1255 public static final String ACTION_CLEAN_EXTERNAL_STORAGE
1256 = "android.content.pm.CLEAN_EXTERNAL_STORAGE";
Oscar Montemayor1228d0a2010-01-28 12:01:44 -08001257
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001258 /**
Kenny Root5ab21572011-07-27 11:11:19 -07001259 * Extra field name for the URI to a verification file. Passed to a package
1260 * verifier.
1261 *
1262 * @hide
1263 */
1264 public static final String EXTRA_VERIFICATION_URI = "android.content.pm.extra.VERIFICATION_URI";
1265
1266 /**
1267 * Extra field name for the ID of a package pending verification. Passed to
1268 * a package verifier and is used to call back to
Kenny Root3a9b5fb2011-09-20 14:15:38 -07001269 * {@link PackageManager#verifyPendingInstall(int, int)}
Kenny Root5ab21572011-07-27 11:11:19 -07001270 */
1271 public static final String EXTRA_VERIFICATION_ID = "android.content.pm.extra.VERIFICATION_ID";
1272
1273 /**
1274 * Extra field name for the package identifier which is trying to install
1275 * the package.
1276 *
1277 * @hide
1278 */
1279 public static final String EXTRA_VERIFICATION_INSTALLER_PACKAGE
1280 = "android.content.pm.extra.VERIFICATION_INSTALLER_PACKAGE";
1281
1282 /**
1283 * Extra field name for the requested install flags for a package pending
1284 * verification. Passed to a package verifier.
1285 *
1286 * @hide
1287 */
1288 public static final String EXTRA_VERIFICATION_INSTALL_FLAGS
1289 = "android.content.pm.extra.VERIFICATION_INSTALL_FLAGS";
1290
1291 /**
rich cannings13d428e2012-09-13 13:43:07 -07001292 * Extra field name for the uid of who is requesting to install
1293 * the package.
1294 *
1295 * @hide
1296 */
1297 public static final String EXTRA_VERIFICATION_INSTALLER_UID
1298 = "android.content.pm.extra.VERIFICATION_INSTALLER_UID";
1299
1300 /**
1301 * Extra field name for the package name of a package pending verification.
1302 *
1303 * @hide
1304 */
1305 public static final String EXTRA_VERIFICATION_PACKAGE_NAME
1306 = "android.content.pm.extra.VERIFICATION_PACKAGE_NAME";
1307 /**
rich canningsd1b5cfc2012-08-29 14:49:51 -07001308 * Extra field name for the result of a verification, either
1309 * {@link #VERIFICATION_ALLOW}, or {@link #VERIFICATION_REJECT}.
1310 * Passed to package verifiers after a package is verified.
1311 */
1312 public static final String EXTRA_VERIFICATION_RESULT
1313 = "android.content.pm.extra.VERIFICATION_RESULT";
1314
1315 /**
rich cannings13d428e2012-09-13 13:43:07 -07001316 * Extra field name for the version code of a package pending verification.
1317 *
1318 * @hide
1319 */
1320 public static final String EXTRA_VERIFICATION_VERSION_CODE
1321 = "android.content.pm.extra.VERIFICATION_VERSION_CODE";
1322
1323 /**
Nick Kralevich035f80d2013-03-27 15:20:08 -07001324 * The action used to request that the user approve a permission request
1325 * from the application.
1326 *
1327 * @hide
1328 */
1329 public static final String ACTION_REQUEST_PERMISSION
1330 = "android.content.pm.action.REQUEST_PERMISSION";
1331
1332 /**
1333 * Extra field name for the list of permissions, which the user must approve.
1334 *
1335 * @hide
1336 */
1337 public static final String EXTRA_REQUEST_PERMISSION_PERMISSION_LIST
1338 = "android.content.pm.extra.PERMISSION_LIST";
1339
1340 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001341 * Retrieve overall information about an application package that is
1342 * installed on the system.
Kenny Root5ab21572011-07-27 11:11:19 -07001343 * <p>
1344 * Throws {@link NameNotFoundException} if a package with the given name can
1345 * not be found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001346 *
1347 * @param packageName The full name (i.e. com.google.apps.contacts) of the
Kenny Root5ab21572011-07-27 11:11:19 -07001348 * desired package.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001349 * @param flags Additional option flags. Use any combination of
Kenny Root5ab21572011-07-27 11:11:19 -07001350 * {@link #GET_ACTIVITIES}, {@link #GET_GIDS},
1351 * {@link #GET_CONFIGURATIONS}, {@link #GET_INSTRUMENTATION},
1352 * {@link #GET_PERMISSIONS}, {@link #GET_PROVIDERS},
1353 * {@link #GET_RECEIVERS}, {@link #GET_SERVICES},
1354 * {@link #GET_SIGNATURES}, {@link #GET_UNINSTALLED_PACKAGES} to
1355 * modify the data returned.
1356 * @return Returns a PackageInfo object containing information about the
1357 * package. If flag GET_UNINSTALLED_PACKAGES is set and if the
1358 * package is not found in the list of installed applications, the
1359 * package information is retrieved from the list of uninstalled
kmccormick30498b42013-03-27 17:39:17 -07001360 * applications (which includes installed applications as well as
1361 * applications with data directory i.e. applications which had been
1362 * deleted with {@code DONT_DELETE_DATA} flag set).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001363 * @see #GET_ACTIVITIES
1364 * @see #GET_GIDS
1365 * @see #GET_CONFIGURATIONS
1366 * @see #GET_INSTRUMENTATION
1367 * @see #GET_PERMISSIONS
1368 * @see #GET_PROVIDERS
1369 * @see #GET_RECEIVERS
1370 * @see #GET_SERVICES
1371 * @see #GET_SIGNATURES
1372 * @see #GET_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001373 */
1374 public abstract PackageInfo getPackageInfo(String packageName, int flags)
1375 throws NameNotFoundException;
1376
1377 /**
Dianne Hackborn47096932010-02-11 15:57:09 -08001378 * Map from the current package names in use on the device to whatever
1379 * the current canonical name of that package is.
1380 * @param names Array of current names to be mapped.
1381 * @return Returns an array of the same size as the original, containing
1382 * the canonical name for each package.
1383 */
1384 public abstract String[] currentToCanonicalPackageNames(String[] names);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001385
Dianne Hackborn47096932010-02-11 15:57:09 -08001386 /**
1387 * Map from a packages canonical name to the current name in use on the device.
1388 * @param names Array of new names to be mapped.
1389 * @return Returns an array of the same size as the original, containing
1390 * the current name for each package.
1391 */
1392 public abstract String[] canonicalToCurrentPackageNames(String[] names);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001393
Dianne Hackborn47096932010-02-11 15:57:09 -08001394 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001395 * Return a "good" intent to launch a front-door activity in a package,
1396 * for use for example to implement an "open" button when browsing through
1397 * packages. The current implementation will look first for a main
1398 * activity in the category {@link Intent#CATEGORY_INFO}, next for a
1399 * main activity in the category {@link Intent#CATEGORY_LAUNCHER}, or return
1400 * null if neither are found.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001401 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001402 * <p>Throws {@link NameNotFoundException} if a package with the given
kmccormick30498b42013-03-27 17:39:17 -07001403 * name cannot be found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001404 *
1405 * @param packageName The name of the package to inspect.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001406 *
Dianne Hackborn19415762010-12-15 00:20:27 -08001407 * @return Returns either a fully-qualified Intent that can be used to
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001408 * launch the main activity in the package, or null if the package does
1409 * not contain such an activity.
1410 */
Mihai Predaeae850c2009-05-13 10:13:48 +02001411 public abstract Intent getLaunchIntentForPackage(String packageName);
1412
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001413 /**
1414 * Return an array of all of the secondary group-ids that have been
1415 * assigned to a package.
1416 *
1417 * <p>Throws {@link NameNotFoundException} if a package with the given
kmccormick30498b42013-03-27 17:39:17 -07001418 * name cannot be found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001419 *
1420 * @param packageName The full name (i.e. com.google.apps.contacts) of the
1421 * desired package.
1422 *
1423 * @return Returns an int array of the assigned gids, or null if there
1424 * are none.
1425 */
1426 public abstract int[] getPackageGids(String packageName)
1427 throws NameNotFoundException;
1428
1429 /**
Dianne Hackborna06de0f2012-12-11 16:34:47 -08001430 * @hide Return the uid associated with the given package name for the
1431 * given user.
1432 *
1433 * <p>Throws {@link NameNotFoundException} if a package with the given
1434 * name can not be found on the system.
1435 *
1436 * @param packageName The full name (i.e. com.google.apps.contacts) of the
1437 * desired package.
1438 * @param userHandle The user handle identifier to look up the package under.
1439 *
1440 * @return Returns an integer uid who owns the given package name.
1441 */
1442 public abstract int getPackageUid(String packageName, int userHandle)
1443 throws NameNotFoundException;
1444
1445 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001446 * Retrieve all of the information we know about a particular permission.
1447 *
1448 * <p>Throws {@link NameNotFoundException} if a permission with the given
kmccormick30498b42013-03-27 17:39:17 -07001449 * name cannot be found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001450 *
1451 * @param name The fully qualified name (i.e. com.google.permission.LOGIN)
1452 * of the permission you are interested in.
1453 * @param flags Additional option flags. Use {@link #GET_META_DATA} to
1454 * retrieve any meta-data associated with the permission.
1455 *
1456 * @return Returns a {@link PermissionInfo} containing information about the
1457 * permission.
1458 */
1459 public abstract PermissionInfo getPermissionInfo(String name, int flags)
1460 throws NameNotFoundException;
1461
1462 /**
1463 * Query for all of the permissions associated with a particular group.
1464 *
1465 * <p>Throws {@link NameNotFoundException} if the given group does not
1466 * exist.
1467 *
1468 * @param group The fully qualified name (i.e. com.google.permission.LOGIN)
1469 * of the permission group you are interested in. Use null to
1470 * find all of the permissions not associated with a group.
1471 * @param flags Additional option flags. Use {@link #GET_META_DATA} to
1472 * retrieve any meta-data associated with the permissions.
1473 *
1474 * @return Returns a list of {@link PermissionInfo} containing information
1475 * about all of the permissions in the given group.
1476 */
1477 public abstract List<PermissionInfo> queryPermissionsByGroup(String group,
1478 int flags) throws NameNotFoundException;
1479
1480 /**
1481 * Retrieve all of the information we know about a particular group of
1482 * permissions.
1483 *
1484 * <p>Throws {@link NameNotFoundException} if a permission group with the given
kmccormick30498b42013-03-27 17:39:17 -07001485 * name cannot be found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001486 *
1487 * @param name The fully qualified name (i.e. com.google.permission_group.APPS)
1488 * of the permission you are interested in.
1489 * @param flags Additional option flags. Use {@link #GET_META_DATA} to
1490 * retrieve any meta-data associated with the permission group.
1491 *
1492 * @return Returns a {@link PermissionGroupInfo} containing information
1493 * about the permission.
1494 */
1495 public abstract PermissionGroupInfo getPermissionGroupInfo(String name,
1496 int flags) throws NameNotFoundException;
1497
1498 /**
1499 * Retrieve all of the known permission groups in the system.
1500 *
1501 * @param flags Additional option flags. Use {@link #GET_META_DATA} to
1502 * retrieve any meta-data associated with the permission group.
1503 *
1504 * @return Returns a list of {@link PermissionGroupInfo} containing
1505 * information about all of the known permission groups.
1506 */
1507 public abstract List<PermissionGroupInfo> getAllPermissionGroups(int flags);
1508
1509 /**
1510 * Retrieve all of the information we know about a particular
1511 * package/application.
1512 *
1513 * <p>Throws {@link NameNotFoundException} if an application with the given
kmccormick30498b42013-03-27 17:39:17 -07001514 * package name cannot be found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001515 *
1516 * @param packageName The full name (i.e. com.google.apps.contacts) of an
1517 * application.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001518 * @param flags Additional option flags. Use any combination of
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001519 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
1520 * {@link #GET_UNINSTALLED_PACKAGES} to modify the data returned.
1521 *
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001522 * @return {@link ApplicationInfo} Returns ApplicationInfo object containing
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001523 * information about the package.
1524 * If flag GET_UNINSTALLED_PACKAGES is set and if the package is not
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001525 * found in the list of installed applications,
1526 * the application information is retrieved from the
1527 * list of uninstalled applications(which includes
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001528 * installed applications as well as applications
1529 * with data directory ie applications which had been
kmccormick30498b42013-03-27 17:39:17 -07001530 * deleted with {@code DONT_DELETE_DATA} flag set).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001531 *
1532 * @see #GET_META_DATA
1533 * @see #GET_SHARED_LIBRARY_FILES
1534 * @see #GET_UNINSTALLED_PACKAGES
1535 */
1536 public abstract ApplicationInfo getApplicationInfo(String packageName,
1537 int flags) throws NameNotFoundException;
1538
1539 /**
1540 * Retrieve all of the information we know about a particular activity
1541 * class.
1542 *
1543 * <p>Throws {@link NameNotFoundException} if an activity with the given
kmccormick30498b42013-03-27 17:39:17 -07001544 * class name cannot be found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001545 *
Dianne Hackborn361199b2010-08-30 17:42:07 -07001546 * @param component The full component name (i.e.
1547 * com.google.apps.contacts/com.google.apps.contacts.ContactsList) of an Activity
1548 * class.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001549 * @param flags Additional option flags. Use any combination of
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001550 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
1551 * to modify the data (in ApplicationInfo) returned.
1552 *
1553 * @return {@link ActivityInfo} containing information about the activity.
1554 *
1555 * @see #GET_INTENT_FILTERS
1556 * @see #GET_META_DATA
1557 * @see #GET_SHARED_LIBRARY_FILES
1558 */
Dianne Hackborn361199b2010-08-30 17:42:07 -07001559 public abstract ActivityInfo getActivityInfo(ComponentName component,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001560 int flags) throws NameNotFoundException;
1561
1562 /**
1563 * Retrieve all of the information we know about a particular receiver
1564 * class.
1565 *
1566 * <p>Throws {@link NameNotFoundException} if a receiver with the given
kmccormick30498b42013-03-27 17:39:17 -07001567 * class name cannot be found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001568 *
Dianne Hackborn361199b2010-08-30 17:42:07 -07001569 * @param component The full component name (i.e.
1570 * com.google.apps.calendar/com.google.apps.calendar.CalendarAlarm) of a Receiver
1571 * class.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001572 * @param flags Additional option flags. Use any combination of
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001573 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
1574 * to modify the data returned.
1575 *
1576 * @return {@link ActivityInfo} containing information about the receiver.
1577 *
1578 * @see #GET_INTENT_FILTERS
1579 * @see #GET_META_DATA
1580 * @see #GET_SHARED_LIBRARY_FILES
1581 */
Dianne Hackborn361199b2010-08-30 17:42:07 -07001582 public abstract ActivityInfo getReceiverInfo(ComponentName component,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001583 int flags) throws NameNotFoundException;
1584
1585 /**
1586 * Retrieve all of the information we know about a particular service
1587 * class.
1588 *
1589 * <p>Throws {@link NameNotFoundException} if a service with the given
kmccormick30498b42013-03-27 17:39:17 -07001590 * class name cannot be found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001591 *
Dianne Hackborn361199b2010-08-30 17:42:07 -07001592 * @param component The full component name (i.e.
1593 * com.google.apps.media/com.google.apps.media.BackgroundPlayback) of a Service
1594 * class.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001595 * @param flags Additional option flags. Use any combination of
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001596 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
1597 * to modify the data returned.
1598 *
1599 * @return ServiceInfo containing information about the service.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001600 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001601 * @see #GET_META_DATA
1602 * @see #GET_SHARED_LIBRARY_FILES
1603 */
Dianne Hackborn361199b2010-08-30 17:42:07 -07001604 public abstract ServiceInfo getServiceInfo(ComponentName component,
1605 int flags) throws NameNotFoundException;
1606
1607 /**
1608 * Retrieve all of the information we know about a particular content
1609 * provider class.
1610 *
1611 * <p>Throws {@link NameNotFoundException} if a provider with the given
kmccormick30498b42013-03-27 17:39:17 -07001612 * class name cannot be found on the system.
Dianne Hackborn361199b2010-08-30 17:42:07 -07001613 *
1614 * @param component The full component name (i.e.
1615 * com.google.providers.media/com.google.providers.media.MediaProvider) of a
1616 * ContentProvider class.
1617 * @param flags Additional option flags. Use any combination of
1618 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
1619 * to modify the data returned.
1620 *
1621 * @return ProviderInfo containing information about the service.
1622 *
1623 * @see #GET_META_DATA
1624 * @see #GET_SHARED_LIBRARY_FILES
1625 */
1626 public abstract ProviderInfo getProviderInfo(ComponentName component,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001627 int flags) throws NameNotFoundException;
1628
1629 /**
1630 * Return a List of all packages that are installed
1631 * on the device.
1632 *
1633 * @param flags Additional option flags. Use any combination of
1634 * {@link #GET_ACTIVITIES},
1635 * {@link #GET_GIDS},
1636 * {@link #GET_CONFIGURATIONS},
1637 * {@link #GET_INSTRUMENTATION},
1638 * {@link #GET_PERMISSIONS},
1639 * {@link #GET_PROVIDERS},
1640 * {@link #GET_RECEIVERS},
1641 * {@link #GET_SERVICES},
1642 * {@link #GET_SIGNATURES},
1643 * {@link #GET_UNINSTALLED_PACKAGES} to modify the data returned.
1644 *
1645 * @return A List of PackageInfo objects, one for each package that is
1646 * installed on the device. In the unlikely case of there being no
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001647 * installed packages, an empty list is returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001648 * If flag GET_UNINSTALLED_PACKAGES is set, a list of all
kmccormick30498b42013-03-27 17:39:17 -07001649 * applications including those deleted with {@code DONT_DELETE_DATA}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001650 * (partially installed apps with data directory) will be returned.
1651 *
1652 * @see #GET_ACTIVITIES
1653 * @see #GET_GIDS
1654 * @see #GET_CONFIGURATIONS
1655 * @see #GET_INSTRUMENTATION
1656 * @see #GET_PERMISSIONS
1657 * @see #GET_PROVIDERS
1658 * @see #GET_RECEIVERS
1659 * @see #GET_SERVICES
1660 * @see #GET_SIGNATURES
1661 * @see #GET_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001662 */
1663 public abstract List<PackageInfo> getInstalledPackages(int flags);
1664
1665 /**
Dianne Hackborne7991752013-01-16 17:56:46 -08001666 * Return a List of all installed packages that are currently
1667 * holding any of the given permissions.
1668 *
1669 * @param flags Additional option flags. Use any combination of
1670 * {@link #GET_ACTIVITIES},
1671 * {@link #GET_GIDS},
1672 * {@link #GET_CONFIGURATIONS},
1673 * {@link #GET_INSTRUMENTATION},
1674 * {@link #GET_PERMISSIONS},
1675 * {@link #GET_PROVIDERS},
1676 * {@link #GET_RECEIVERS},
1677 * {@link #GET_SERVICES},
1678 * {@link #GET_SIGNATURES},
1679 * {@link #GET_UNINSTALLED_PACKAGES} to modify the data returned.
1680 *
1681 * @return Returns a List of PackageInfo objects, one for each installed
1682 * application that is holding any of the permissions that were provided.
1683 *
1684 * @see #GET_ACTIVITIES
1685 * @see #GET_GIDS
1686 * @see #GET_CONFIGURATIONS
1687 * @see #GET_INSTRUMENTATION
1688 * @see #GET_PERMISSIONS
1689 * @see #GET_PROVIDERS
1690 * @see #GET_RECEIVERS
1691 * @see #GET_SERVICES
1692 * @see #GET_SIGNATURES
1693 * @see #GET_UNINSTALLED_PACKAGES
1694 */
1695 public abstract List<PackageInfo> getPackagesHoldingPermissions(
1696 String[] permissions, int flags);
1697
1698 /**
Amith Yamasani151ec4c2012-09-07 19:25:16 -07001699 * Return a List of all packages that are installed on the device, for a specific user.
1700 * Requesting a list of installed packages for another user
1701 * will require the permission INTERACT_ACROSS_USERS_FULL.
1702 * @param flags Additional option flags. Use any combination of
1703 * {@link #GET_ACTIVITIES},
1704 * {@link #GET_GIDS},
1705 * {@link #GET_CONFIGURATIONS},
1706 * {@link #GET_INSTRUMENTATION},
1707 * {@link #GET_PERMISSIONS},
1708 * {@link #GET_PROVIDERS},
1709 * {@link #GET_RECEIVERS},
1710 * {@link #GET_SERVICES},
1711 * {@link #GET_SIGNATURES},
1712 * {@link #GET_UNINSTALLED_PACKAGES} to modify the data returned.
1713 * @param userId The user for whom the installed packages are to be listed
1714 *
1715 * @return A List of PackageInfo objects, one for each package that is
1716 * installed on the device. In the unlikely case of there being no
1717 * installed packages, an empty list is returned.
1718 * If flag GET_UNINSTALLED_PACKAGES is set, a list of all
kmccormick30498b42013-03-27 17:39:17 -07001719 * applications including those deleted with {@code DONT_DELETE_DATA}
Amith Yamasani151ec4c2012-09-07 19:25:16 -07001720 * (partially installed apps with data directory) will be returned.
1721 *
1722 * @see #GET_ACTIVITIES
1723 * @see #GET_GIDS
1724 * @see #GET_CONFIGURATIONS
1725 * @see #GET_INSTRUMENTATION
1726 * @see #GET_PERMISSIONS
1727 * @see #GET_PROVIDERS
1728 * @see #GET_RECEIVERS
1729 * @see #GET_SERVICES
1730 * @see #GET_SIGNATURES
1731 * @see #GET_UNINSTALLED_PACKAGES
1732 *
1733 * @hide
1734 */
1735 public abstract List<PackageInfo> getInstalledPackages(int flags, int userId);
1736
1737 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001738 * Check whether a particular package has been granted a particular
1739 * permission.
1740 *
1741 * @param permName The name of the permission you are checking for,
1742 * @param pkgName The name of the package you are checking against.
1743 *
1744 * @return If the package has the permission, PERMISSION_GRANTED is
1745 * returned. If it does not have the permission, PERMISSION_DENIED
1746 * is returned.
1747 *
1748 * @see #PERMISSION_GRANTED
1749 * @see #PERMISSION_DENIED
1750 */
1751 public abstract int checkPermission(String permName, String pkgName);
1752
1753 /**
1754 * Add a new dynamic permission to the system. For this to work, your
1755 * package must have defined a permission tree through the
1756 * {@link android.R.styleable#AndroidManifestPermissionTree
1757 * &lt;permission-tree&gt;} tag in its manifest. A package can only add
1758 * permissions to trees that were defined by either its own package or
1759 * another with the same user id; a permission is in a tree if it
1760 * matches the name of the permission tree + ".": for example,
1761 * "com.foo.bar" is a member of the permission tree "com.foo".
1762 *
1763 * <p>It is good to make your permission tree name descriptive, because you
1764 * are taking possession of that entire set of permission names. Thus, it
1765 * must be under a domain you control, with a suffix that will not match
1766 * any normal permissions that may be declared in any applications that
1767 * are part of that domain.
1768 *
1769 * <p>New permissions must be added before
1770 * any .apks are installed that use those permissions. Permissions you
1771 * add through this method are remembered across reboots of the device.
1772 * If the given permission already exists, the info you supply here
1773 * will be used to update it.
1774 *
1775 * @param info Description of the permission to be added.
1776 *
1777 * @return Returns true if a new permission was created, false if an
1778 * existing one was updated.
1779 *
1780 * @throws SecurityException if you are not allowed to add the
1781 * given permission name.
1782 *
1783 * @see #removePermission(String)
1784 */
1785 public abstract boolean addPermission(PermissionInfo info);
1786
1787 /**
Dianne Hackbornd7c09682010-03-30 10:42:20 -07001788 * Like {@link #addPermission(PermissionInfo)} but asynchronously
1789 * persists the package manager state after returning from the call,
1790 * allowing it to return quicker and batch a series of adds at the
1791 * expense of no guarantee the added permission will be retained if
1792 * the device is rebooted before it is written.
1793 */
1794 public abstract boolean addPermissionAsync(PermissionInfo info);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001795
Dianne Hackbornd7c09682010-03-30 10:42:20 -07001796 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001797 * Removes a permission that was previously added with
1798 * {@link #addPermission(PermissionInfo)}. The same ownership rules apply
1799 * -- you are only allowed to remove permissions that you are allowed
1800 * to add.
1801 *
1802 * @param name The name of the permission to remove.
1803 *
1804 * @throws SecurityException if you are not allowed to remove the
1805 * given permission name.
1806 *
1807 * @see #addPermission(PermissionInfo)
1808 */
1809 public abstract void removePermission(String name);
1810
1811 /**
Nick Kralevich035f80d2013-03-27 15:20:08 -07001812 * Returns an {@link Intent} suitable for passing to {@code startActivityForResult}
1813 * which prompts the user to grant {@code permissions} to this application.
Nick Kralevich32eb5b182013-04-11 10:20:09 -07001814 * @hide
Nick Kralevich035f80d2013-03-27 15:20:08 -07001815 *
1816 * @throws NullPointerException if {@code permissions} is {@code null}.
1817 * @throws IllegalArgumentException if {@code permissions} contains {@code null}.
1818 */
1819 public Intent buildPermissionRequestIntent(String... permissions) {
1820 if (permissions == null) {
1821 throw new NullPointerException("permissions cannot be null");
1822 }
1823 for (String permission : permissions) {
1824 if (permission == null) {
1825 throw new IllegalArgumentException("permissions cannot contain null");
1826 }
1827 }
1828
1829 Intent i = new Intent(ACTION_REQUEST_PERMISSION);
1830 i.putExtra(EXTRA_REQUEST_PERMISSION_PERMISSION_LIST, permissions);
1831 i.setPackage("com.android.packageinstaller");
1832 return i;
1833 }
1834
1835 /**
Dianne Hackborne639da72012-02-21 15:11:13 -08001836 * Grant a permission to an application which the application does not
1837 * already have. The permission must have been requested by the application,
1838 * but as an optional permission. If the application is not allowed to
1839 * hold the permission, a SecurityException is thrown.
1840 * @hide
1841 *
1842 * @param packageName The name of the package that the permission will be
1843 * granted to.
1844 * @param permissionName The name of the permission.
1845 */
1846 public abstract void grantPermission(String packageName, String permissionName);
1847
1848 /**
1849 * Revoke a permission that was previously granted by {@link #grantPermission}.
1850 * @hide
1851 *
1852 * @param packageName The name of the package that the permission will be
1853 * granted to.
1854 * @param permissionName The name of the permission.
1855 */
1856 public abstract void revokePermission(String packageName, String permissionName);
1857
1858 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001859 * Compare the signatures of two packages to determine if the same
1860 * signature appears in both of them. If they do contain the same
1861 * signature, then they are allowed special privileges when working
1862 * with each other: they can share the same user-id, run instrumentation
1863 * against each other, etc.
1864 *
1865 * @param pkg1 First package name whose signature will be compared.
1866 * @param pkg2 Second package name whose signature will be compared.
Chris Palmer09f33602010-09-13 14:27:18 -07001867 *
1868 * @return Returns an integer indicating whether all signatures on the
1869 * two packages match. The value is >= 0 ({@link #SIGNATURE_MATCH}) if
1870 * all signatures match or < 0 if there is not a match ({@link
1871 * #SIGNATURE_NO_MATCH} or {@link #SIGNATURE_UNKNOWN_PACKAGE}).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001872 *
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07001873 * @see #checkSignatures(int, int)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001874 * @see #SIGNATURE_MATCH
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001875 * @see #SIGNATURE_NO_MATCH
1876 * @see #SIGNATURE_UNKNOWN_PACKAGE
1877 */
1878 public abstract int checkSignatures(String pkg1, String pkg2);
1879
1880 /**
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07001881 * Like {@link #checkSignatures(String, String)}, but takes UIDs of
1882 * the two packages to be checked. This can be useful, for example,
1883 * when doing the check in an IPC, where the UID is the only identity
1884 * available. It is functionally identical to determining the package
1885 * associated with the UIDs and checking their signatures.
1886 *
Joe Onorato25660ec2009-08-12 22:40:37 -07001887 * @param uid1 First UID whose signature will be compared.
1888 * @param uid2 Second UID whose signature will be compared.
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07001889 *
Chris Palmer09f33602010-09-13 14:27:18 -07001890 * @return Returns an integer indicating whether all signatures on the
1891 * two packages match. The value is >= 0 ({@link #SIGNATURE_MATCH}) if
1892 * all signatures match or < 0 if there is not a match ({@link
1893 * #SIGNATURE_NO_MATCH} or {@link #SIGNATURE_UNKNOWN_PACKAGE}).
1894 *
1895 * @see #checkSignatures(String, String)
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07001896 * @see #SIGNATURE_MATCH
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07001897 * @see #SIGNATURE_NO_MATCH
1898 * @see #SIGNATURE_UNKNOWN_PACKAGE
1899 */
1900 public abstract int checkSignatures(int uid1, int uid2);
1901
1902 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001903 * Retrieve the names of all packages that are associated with a particular
1904 * user id. In most cases, this will be a single package name, the package
1905 * that has been assigned that user id. Where there are multiple packages
1906 * sharing the same user id through the "sharedUserId" mechanism, all
1907 * packages with that id will be returned.
1908 *
1909 * @param uid The user id for which you would like to retrieve the
1910 * associated packages.
1911 *
1912 * @return Returns an array of one or more packages assigned to the user
1913 * id, or null if there are no known packages with the given id.
1914 */
1915 public abstract String[] getPackagesForUid(int uid);
1916
1917 /**
1918 * Retrieve the official name associated with a user id. This name is
1919 * guaranteed to never change, though it is possibly for the underlying
1920 * user id to be changed. That is, if you are storing information about
1921 * user ids in persistent storage, you should use the string returned
1922 * by this function instead of the raw user-id.
1923 *
1924 * @param uid The user id for which you would like to retrieve a name.
1925 * @return Returns a unique name for the given user id, or null if the
1926 * user id is not currently assigned.
1927 */
1928 public abstract String getNameForUid(int uid);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001929
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001930 /**
1931 * Return the user id associated with a shared user name. Multiple
1932 * applications can specify a shared user name in their manifest and thus
1933 * end up using a common uid. This might be used for new applications
1934 * that use an existing shared user name and need to know the uid of the
1935 * shared user.
1936 *
1937 * @param sharedUserName The shared user name whose uid is to be retrieved.
1938 * @return Returns the uid associated with the shared user, or NameNotFoundException
1939 * if the shared user name is not being used by any installed packages
1940 * @hide
1941 */
1942 public abstract int getUidForSharedUser(String sharedUserName)
1943 throws NameNotFoundException;
1944
1945 /**
1946 * Return a List of all application packages that are installed on the
1947 * device. If flag GET_UNINSTALLED_PACKAGES has been set, a list of all
kmccormick30498b42013-03-27 17:39:17 -07001948 * applications including those deleted with {@code DONT_DELETE_DATA} (partially
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001949 * installed apps with data directory) will be returned.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001950 *
1951 * @param flags Additional option flags. Use any combination of
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001952 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
Jeff Smitha45746e2012-07-19 14:19:24 -05001953 * {@link #GET_UNINSTALLED_PACKAGES} to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001954 *
Dianne Hackborne7991752013-01-16 17:56:46 -08001955 * @return Returns a List of ApplicationInfo objects, one for each application that
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001956 * is installed on the device. In the unlikely case of there being
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001957 * no installed applications, an empty list is returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001958 * If flag GET_UNINSTALLED_PACKAGES is set, a list of all
kmccormick30498b42013-03-27 17:39:17 -07001959 * applications including those deleted with {@code DONT_DELETE_DATA}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001960 * (partially installed apps with data directory) will be returned.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001961 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001962 * @see #GET_META_DATA
1963 * @see #GET_SHARED_LIBRARY_FILES
1964 * @see #GET_UNINSTALLED_PACKAGES
1965 */
1966 public abstract List<ApplicationInfo> getInstalledApplications(int flags);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001967
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001968 /**
1969 * Get a list of shared libraries that are available on the
1970 * system.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001971 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001972 * @return An array of shared library names that are
1973 * available on the system, or null if none are installed.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001974 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001975 */
1976 public abstract String[] getSystemSharedLibraryNames();
1977
1978 /**
Dianne Hackborn49237342009-08-27 20:08:01 -07001979 * Get a list of features that are available on the
1980 * system.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001981 *
Dianne Hackborn49237342009-08-27 20:08:01 -07001982 * @return An array of FeatureInfo classes describing the features
1983 * that are available on the system, or null if there are none(!!).
Dianne Hackborn49237342009-08-27 20:08:01 -07001984 */
1985 public abstract FeatureInfo[] getSystemAvailableFeatures();
1986
1987 /**
Dianne Hackborn039c68e2009-09-26 16:39:23 -07001988 * Check whether the given feature name is one of the available
1989 * features as returned by {@link #getSystemAvailableFeatures()}.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001990 *
Dianne Hackborn039c68e2009-09-26 16:39:23 -07001991 * @return Returns true if the devices supports the feature, else
1992 * false.
1993 */
1994 public abstract boolean hasSystemFeature(String name);
1995
1996 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001997 * Determine the best action to perform for a given Intent. This is how
1998 * {@link Intent#resolveActivity} finds an activity if a class has not
1999 * been explicitly specified.
2000 *
Scott Mainef6b3052011-03-23 14:23:02 -07002001 * <p><em>Note:</em> if using an implicit Intent (without an explicit ComponentName
Dianne Hackborn4d023d212010-10-01 13:41:04 -07002002 * specified), be sure to consider whether to set the {@link #MATCH_DEFAULT_ONLY}
2003 * only flag. You need to do so to resolve the activity in the same way
2004 * that {@link android.content.Context#startActivity(Intent)} and
2005 * {@link android.content.Intent#resolveActivity(PackageManager)
2006 * Intent.resolveActivity(PackageManager)} do.</p>
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002007 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002008 * @param intent An intent containing all of the desired specification
2009 * (action, data, type, category, and/or component).
2010 * @param flags Additional option flags. The most important is
Dianne Hackborn4d023d212010-10-01 13:41:04 -07002011 * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only
2012 * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002013 *
2014 * @return Returns a ResolveInfo containing the final activity intent that
2015 * was determined to be the best action. Returns null if no
Mike LeBeaubd3f5272010-02-18 19:27:17 -08002016 * matching activity was found. If multiple matching activities are
2017 * found and there is no default set, returns a ResolveInfo
2018 * containing something else, such as the activity resolver.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002019 *
2020 * @see #MATCH_DEFAULT_ONLY
2021 * @see #GET_INTENT_FILTERS
2022 * @see #GET_RESOLVED_FILTER
2023 */
2024 public abstract ResolveInfo resolveActivity(Intent intent, int flags);
2025
2026 /**
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07002027 * Determine the best action to perform for a given Intent for a given user. This
2028 * is how {@link Intent#resolveActivity} finds an activity if a class has not
2029 * been explicitly specified.
2030 *
2031 * <p><em>Note:</em> if using an implicit Intent (without an explicit ComponentName
2032 * specified), be sure to consider whether to set the {@link #MATCH_DEFAULT_ONLY}
2033 * only flag. You need to do so to resolve the activity in the same way
2034 * that {@link android.content.Context#startActivity(Intent)} and
2035 * {@link android.content.Intent#resolveActivity(PackageManager)
2036 * Intent.resolveActivity(PackageManager)} do.</p>
2037 *
2038 * @param intent An intent containing all of the desired specification
2039 * (action, data, type, category, and/or component).
2040 * @param flags Additional option flags. The most important is
2041 * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only
2042 * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}.
2043 * @param userId The user id.
2044 *
2045 * @return Returns a ResolveInfo containing the final activity intent that
2046 * was determined to be the best action. Returns null if no
2047 * matching activity was found. If multiple matching activities are
2048 * found and there is no default set, returns a ResolveInfo
2049 * containing something else, such as the activity resolver.
2050 *
2051 * @see #MATCH_DEFAULT_ONLY
2052 * @see #GET_INTENT_FILTERS
2053 * @see #GET_RESOLVED_FILTER
2054 *
2055 * @hide
2056 */
2057 public abstract ResolveInfo resolveActivityAsUser(Intent intent, int flags, int userId);
2058
2059 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002060 * Retrieve all activities that can be performed for the given intent.
2061 *
2062 * @param intent The desired intent as per resolveActivity().
2063 * @param flags Additional option flags. The most important is
Dianne Hackborn4d023d212010-10-01 13:41:04 -07002064 * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only
2065 * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002066 *
Dianne Hackborn4d023d212010-10-01 13:41:04 -07002067 * @return A List&lt;ResolveInfo&gt; containing one entry for each matching
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002068 * Activity. These are ordered from best to worst match -- that
2069 * is, the first item in the list is what is returned by
Dianne Hackborn4d023d212010-10-01 13:41:04 -07002070 * {@link #resolveActivity}. If there are no matching activities, an empty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002071 * list is returned.
2072 *
2073 * @see #MATCH_DEFAULT_ONLY
2074 * @see #GET_INTENT_FILTERS
2075 * @see #GET_RESOLVED_FILTER
2076 */
2077 public abstract List<ResolveInfo> queryIntentActivities(Intent intent,
2078 int flags);
2079
2080 /**
Amith Yamasani151ec4c2012-09-07 19:25:16 -07002081 * Retrieve all activities that can be performed for the given intent, for a specific user.
2082 *
2083 * @param intent The desired intent as per resolveActivity().
2084 * @param flags Additional option flags. The most important is
2085 * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only
2086 * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}.
2087 *
2088 * @return A List&lt;ResolveInfo&gt; containing one entry for each matching
2089 * Activity. These are ordered from best to worst match -- that
2090 * is, the first item in the list is what is returned by
2091 * {@link #resolveActivity}. If there are no matching activities, an empty
2092 * list is returned.
2093 *
2094 * @see #MATCH_DEFAULT_ONLY
2095 * @see #GET_INTENT_FILTERS
2096 * @see #GET_RESOLVED_FILTER
2097 * @hide
2098 */
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07002099 public abstract List<ResolveInfo> queryIntentActivitiesAsUser(Intent intent,
Amith Yamasani151ec4c2012-09-07 19:25:16 -07002100 int flags, int userId);
2101
2102
2103 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002104 * Retrieve a set of activities that should be presented to the user as
2105 * similar options. This is like {@link #queryIntentActivities}, except it
2106 * also allows you to supply a list of more explicit Intents that you would
2107 * like to resolve to particular options, and takes care of returning the
2108 * final ResolveInfo list in a reasonable order, with no duplicates, based
2109 * on those inputs.
2110 *
2111 * @param caller The class name of the activity that is making the
2112 * request. This activity will never appear in the output
2113 * list. Can be null.
2114 * @param specifics An array of Intents that should be resolved to the
2115 * first specific results. Can be null.
2116 * @param intent The desired intent as per resolveActivity().
2117 * @param flags Additional option flags. The most important is
Dianne Hackborn4d023d212010-10-01 13:41:04 -07002118 * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only
2119 * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002120 *
Dianne Hackborn4d023d212010-10-01 13:41:04 -07002121 * @return A List&lt;ResolveInfo&gt; containing one entry for each matching
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002122 * Activity. These are ordered first by all of the intents resolved
2123 * in <var>specifics</var> and then any additional activities that
2124 * can handle <var>intent</var> but did not get included by one of
2125 * the <var>specifics</var> intents. If there are no matching
2126 * activities, an empty list is returned.
2127 *
2128 * @see #MATCH_DEFAULT_ONLY
2129 * @see #GET_INTENT_FILTERS
2130 * @see #GET_RESOLVED_FILTER
2131 */
2132 public abstract List<ResolveInfo> queryIntentActivityOptions(
2133 ComponentName caller, Intent[] specifics, Intent intent, int flags);
2134
2135 /**
2136 * Retrieve all receivers that can handle a broadcast of the given intent.
2137 *
2138 * @param intent The desired intent as per resolveActivity().
Dianne Hackborn4d023d212010-10-01 13:41:04 -07002139 * @param flags Additional option flags.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002140 *
Dianne Hackborn4d023d212010-10-01 13:41:04 -07002141 * @return A List&lt;ResolveInfo&gt; containing one entry for each matching
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002142 * Receiver. These are ordered from first to last in priority. If
2143 * there are no matching receivers, an empty list is returned.
2144 *
2145 * @see #MATCH_DEFAULT_ONLY
2146 * @see #GET_INTENT_FILTERS
2147 * @see #GET_RESOLVED_FILTER
2148 */
2149 public abstract List<ResolveInfo> queryBroadcastReceivers(Intent intent,
2150 int flags);
2151
2152 /**
Amith Yamasanif203aee2012-08-29 18:41:53 -07002153 * Retrieve all receivers that can handle a broadcast of the given intent, for a specific
2154 * user.
2155 *
2156 * @param intent The desired intent as per resolveActivity().
2157 * @param flags Additional option flags.
2158 * @param userId The userId of the user being queried.
2159 *
2160 * @return A List&lt;ResolveInfo&gt; containing one entry for each matching
2161 * Receiver. These are ordered from first to last in priority. If
2162 * there are no matching receivers, an empty list is returned.
2163 *
2164 * @see #MATCH_DEFAULT_ONLY
2165 * @see #GET_INTENT_FILTERS
2166 * @see #GET_RESOLVED_FILTER
2167 * @hide
2168 */
2169 public abstract List<ResolveInfo> queryBroadcastReceivers(Intent intent,
2170 int flags, int userId);
2171
2172 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002173 * Determine the best service to handle for a given Intent.
2174 *
2175 * @param intent An intent containing all of the desired specification
2176 * (action, data, type, category, and/or component).
2177 * @param flags Additional option flags.
2178 *
2179 * @return Returns a ResolveInfo containing the final service intent that
2180 * was determined to be the best action. Returns null if no
2181 * matching service was found.
2182 *
2183 * @see #GET_INTENT_FILTERS
2184 * @see #GET_RESOLVED_FILTER
2185 */
2186 public abstract ResolveInfo resolveService(Intent intent, int flags);
2187
2188 /**
2189 * Retrieve all services that can match the given intent.
2190 *
2191 * @param intent The desired intent as per resolveService().
2192 * @param flags Additional option flags.
2193 *
Dianne Hackborn4d023d212010-10-01 13:41:04 -07002194 * @return A List&lt;ResolveInfo&gt; containing one entry for each matching
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002195 * ServiceInfo. These are ordered from best to worst match -- that
2196 * is, the first item in the list is what is returned by
2197 * resolveService(). If there are no matching services, an empty
2198 * list is returned.
2199 *
2200 * @see #GET_INTENT_FILTERS
2201 * @see #GET_RESOLVED_FILTER
2202 */
2203 public abstract List<ResolveInfo> queryIntentServices(Intent intent,
2204 int flags);
2205
2206 /**
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07002207 * Retrieve all services that can match the given intent for a given user.
2208 *
2209 * @param intent The desired intent as per resolveService().
2210 * @param flags Additional option flags.
2211 * @param userId The user id.
2212 *
2213 * @return A List&lt;ResolveInfo&gt; containing one entry for each matching
2214 * ServiceInfo. These are ordered from best to worst match -- that
2215 * is, the first item in the list is what is returned by
2216 * resolveService(). If there are no matching services, an empty
2217 * list is returned.
2218 *
2219 * @see #GET_INTENT_FILTERS
2220 * @see #GET_RESOLVED_FILTER
2221 *
2222 * @hide
2223 */
2224 public abstract List<ResolveInfo> queryIntentServicesAsUser(Intent intent,
2225 int flags, int userId);
2226
Jeff Sharkey85f5f812013-10-07 10:16:12 -07002227 /** {@hide} */
2228 public abstract List<ResolveInfo> queryIntentContentProvidersAsUser(
2229 Intent intent, int flags, int userId);
2230
2231 /**
2232 * Retrieve all providers that can match the given intent.
2233 *
2234 * @param intent An intent containing all of the desired specification
2235 * (action, data, type, category, and/or component).
2236 * @param flags Additional option flags.
2237 * @return A List&lt;ResolveInfo&gt; containing one entry for each matching
2238 * ProviderInfo. These are ordered from best to worst match. If
2239 * there are no matching providers, an empty list is returned.
2240 * @see #GET_INTENT_FILTERS
2241 * @see #GET_RESOLVED_FILTER
2242 */
2243 public abstract List<ResolveInfo> queryIntentContentProviders(Intent intent, int flags);
2244
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07002245 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002246 * Find a single content provider by its base path name.
2247 *
2248 * @param name The name of the provider to find.
2249 * @param flags Additional option flags. Currently should always be 0.
2250 *
2251 * @return ContentProviderInfo Information about the provider, if found,
2252 * else null.
2253 */
2254 public abstract ProviderInfo resolveContentProvider(String name,
2255 int flags);
2256
2257 /**
2258 * Retrieve content provider information.
2259 *
2260 * <p><em>Note: unlike most other methods, an empty result set is indicated
2261 * by a null return instead of an empty list.</em>
2262 *
2263 * @param processName If non-null, limits the returned providers to only
2264 * those that are hosted by the given process. If null,
2265 * all content providers are returned.
2266 * @param uid If <var>processName</var> is non-null, this is the required
2267 * uid owning the requested content providers.
2268 * @param flags Additional option flags. Currently should always be 0.
2269 *
Dianne Hackborn4d023d212010-10-01 13:41:04 -07002270 * @return A List&lt;ContentProviderInfo&gt; containing one entry for each
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002271 * content provider either patching <var>processName</var> or, if
2272 * <var>processName</var> is null, all known content providers.
2273 * <em>If there are no matching providers, null is returned.</em>
2274 */
2275 public abstract List<ProviderInfo> queryContentProviders(
2276 String processName, int uid, int flags);
2277
2278 /**
2279 * Retrieve all of the information we know about a particular
2280 * instrumentation class.
2281 *
2282 * <p>Throws {@link NameNotFoundException} if instrumentation with the
kmccormick30498b42013-03-27 17:39:17 -07002283 * given class name cannot be found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002284 *
2285 * @param className The full name (i.e.
2286 * com.google.apps.contacts.InstrumentList) of an
2287 * Instrumentation class.
2288 * @param flags Additional option flags. Currently should always be 0.
2289 *
2290 * @return InstrumentationInfo containing information about the
2291 * instrumentation.
2292 */
2293 public abstract InstrumentationInfo getInstrumentationInfo(
2294 ComponentName className, int flags) throws NameNotFoundException;
2295
2296 /**
2297 * Retrieve information about available instrumentation code. May be used
2298 * to retrieve either all instrumentation code, or only the code targeting
2299 * a particular package.
2300 *
2301 * @param targetPackage If null, all instrumentation is returned; only the
2302 * instrumentation targeting this package name is
2303 * returned.
2304 * @param flags Additional option flags. Currently should always be 0.
2305 *
Dianne Hackborn4d023d212010-10-01 13:41:04 -07002306 * @return A List&lt;InstrumentationInfo&gt; containing one entry for each
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002307 * matching available Instrumentation. Returns an empty list if
2308 * there is no instrumentation available for the given package.
2309 */
2310 public abstract List<InstrumentationInfo> queryInstrumentation(
2311 String targetPackage, int flags);
2312
2313 /**
2314 * Retrieve an image from a package. This is a low-level API used by
2315 * the various package manager info structures (such as
2316 * {@link ComponentInfo} to implement retrieval of their associated
2317 * icon.
2318 *
2319 * @param packageName The name of the package that this icon is coming from.
kmccormick30498b42013-03-27 17:39:17 -07002320 * Cannot be null.
2321 * @param resid The resource identifier of the desired image. Cannot be 0.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002322 * @param appInfo Overall information about <var>packageName</var>. This
2323 * may be null, in which case the application information will be retrieved
2324 * for you if needed; if you already have this information around, it can
2325 * be much more efficient to supply it here.
2326 *
2327 * @return Returns a Drawable holding the requested image. Returns null if
2328 * an image could not be found for any reason.
2329 */
2330 public abstract Drawable getDrawable(String packageName, int resid,
2331 ApplicationInfo appInfo);
2332
2333 /**
2334 * Retrieve the icon associated with an activity. Given the full name of
2335 * an activity, retrieves the information about it and calls
2336 * {@link ComponentInfo#loadIcon ComponentInfo.loadIcon()} to return its icon.
kmccormick30498b42013-03-27 17:39:17 -07002337 * If the activity cannot be found, NameNotFoundException is thrown.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002338 *
2339 * @param activityName Name of the activity whose icon is to be retrieved.
2340 *
2341 * @return Returns the image of the icon, or the default activity icon if
2342 * it could not be found. Does not return null.
2343 * @throws NameNotFoundException Thrown if the resources for the given
2344 * activity could not be loaded.
2345 *
2346 * @see #getActivityIcon(Intent)
2347 */
2348 public abstract Drawable getActivityIcon(ComponentName activityName)
2349 throws NameNotFoundException;
2350
2351 /**
2352 * Retrieve the icon associated with an Intent. If intent.getClassName() is
2353 * set, this simply returns the result of
2354 * getActivityIcon(intent.getClassName()). Otherwise it resolves the intent's
2355 * component and returns the icon associated with the resolved component.
kmccormick30498b42013-03-27 17:39:17 -07002356 * If intent.getClassName() cannot be found or the Intent cannot be resolved
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002357 * to a component, NameNotFoundException is thrown.
2358 *
2359 * @param intent The intent for which you would like to retrieve an icon.
2360 *
2361 * @return Returns the image of the icon, or the default activity icon if
2362 * it could not be found. Does not return null.
2363 * @throws NameNotFoundException Thrown if the resources for application
2364 * matching the given intent could not be loaded.
2365 *
2366 * @see #getActivityIcon(ComponentName)
2367 */
2368 public abstract Drawable getActivityIcon(Intent intent)
2369 throws NameNotFoundException;
2370
2371 /**
2372 * Return the generic icon for an activity that is used when no specific
2373 * icon is defined.
2374 *
2375 * @return Drawable Image of the icon.
2376 */
2377 public abstract Drawable getDefaultActivityIcon();
2378
2379 /**
2380 * Retrieve the icon associated with an application. If it has not defined
2381 * an icon, the default app icon is returned. Does not return null.
2382 *
2383 * @param info Information about application being queried.
2384 *
2385 * @return Returns the image of the icon, or the default application icon
2386 * if it could not be found.
2387 *
2388 * @see #getApplicationIcon(String)
2389 */
2390 public abstract Drawable getApplicationIcon(ApplicationInfo info);
2391
2392 /**
2393 * Retrieve the icon associated with an application. Given the name of the
2394 * application's package, retrieves the information about it and calls
kmccormick30498b42013-03-27 17:39:17 -07002395 * getApplicationIcon() to return its icon. If the application cannot be
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002396 * found, NameNotFoundException is thrown.
2397 *
2398 * @param packageName Name of the package whose application icon is to be
2399 * retrieved.
2400 *
2401 * @return Returns the image of the icon, or the default application icon
2402 * if it could not be found. Does not return null.
2403 * @throws NameNotFoundException Thrown if the resources for the given
2404 * application could not be loaded.
2405 *
2406 * @see #getApplicationIcon(ApplicationInfo)
2407 */
2408 public abstract Drawable getApplicationIcon(String packageName)
2409 throws NameNotFoundException;
2410
2411 /**
Adam Powell81cd2e92010-04-21 16:35:18 -07002412 * Retrieve the logo associated with an activity. Given the full name of
2413 * an activity, retrieves the information about it and calls
2414 * {@link ComponentInfo#loadLogo ComponentInfo.loadLogo()} to return its logo.
kmccormick30498b42013-03-27 17:39:17 -07002415 * If the activity cannot be found, NameNotFoundException is thrown.
Adam Powell81cd2e92010-04-21 16:35:18 -07002416 *
2417 * @param activityName Name of the activity whose logo is to be retrieved.
2418 *
2419 * @return Returns the image of the logo or null if the activity has no
2420 * logo specified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002421 *
Adam Powell81cd2e92010-04-21 16:35:18 -07002422 * @throws NameNotFoundException Thrown if the resources for the given
2423 * activity could not be loaded.
2424 *
2425 * @see #getActivityLogo(Intent)
2426 */
2427 public abstract Drawable getActivityLogo(ComponentName activityName)
2428 throws NameNotFoundException;
2429
2430 /**
2431 * Retrieve the logo associated with an Intent. If intent.getClassName() is
2432 * set, this simply returns the result of
2433 * getActivityLogo(intent.getClassName()). Otherwise it resolves the intent's
2434 * component and returns the logo associated with the resolved component.
kmccormick30498b42013-03-27 17:39:17 -07002435 * If intent.getClassName() cannot be found or the Intent cannot be resolved
Adam Powell81cd2e92010-04-21 16:35:18 -07002436 * to a component, NameNotFoundException is thrown.
2437 *
2438 * @param intent The intent for which you would like to retrieve a logo.
2439 *
2440 * @return Returns the image of the logo, or null if the activity has no
2441 * logo specified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002442 *
Adam Powell81cd2e92010-04-21 16:35:18 -07002443 * @throws NameNotFoundException Thrown if the resources for application
2444 * matching the given intent could not be loaded.
2445 *
2446 * @see #getActivityLogo(ComponentName)
2447 */
2448 public abstract Drawable getActivityLogo(Intent intent)
2449 throws NameNotFoundException;
2450
2451 /**
2452 * Retrieve the logo associated with an application. If it has not specified
2453 * a logo, this method returns null.
2454 *
2455 * @param info Information about application being queried.
2456 *
2457 * @return Returns the image of the logo, or null if no logo is specified
2458 * by the application.
2459 *
2460 * @see #getApplicationLogo(String)
2461 */
2462 public abstract Drawable getApplicationLogo(ApplicationInfo info);
2463
2464 /**
2465 * Retrieve the logo associated with an application. Given the name of the
2466 * application's package, retrieves the information about it and calls
kmccormick30498b42013-03-27 17:39:17 -07002467 * getApplicationLogo() to return its logo. If the application cannot be
Adam Powell81cd2e92010-04-21 16:35:18 -07002468 * found, NameNotFoundException is thrown.
2469 *
2470 * @param packageName Name of the package whose application logo is to be
2471 * retrieved.
2472 *
2473 * @return Returns the image of the logo, or null if no application logo
2474 * has been specified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002475 *
Adam Powell81cd2e92010-04-21 16:35:18 -07002476 * @throws NameNotFoundException Thrown if the resources for the given
2477 * application could not be loaded.
2478 *
2479 * @see #getApplicationLogo(ApplicationInfo)
2480 */
2481 public abstract Drawable getApplicationLogo(String packageName)
2482 throws NameNotFoundException;
2483
2484 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002485 * Retrieve text from a package. This is a low-level API used by
2486 * the various package manager info structures (such as
2487 * {@link ComponentInfo} to implement retrieval of their associated
2488 * labels and other text.
2489 *
2490 * @param packageName The name of the package that this text is coming from.
kmccormick30498b42013-03-27 17:39:17 -07002491 * Cannot be null.
2492 * @param resid The resource identifier of the desired text. Cannot be 0.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002493 * @param appInfo Overall information about <var>packageName</var>. This
2494 * may be null, in which case the application information will be retrieved
2495 * for you if needed; if you already have this information around, it can
2496 * be much more efficient to supply it here.
2497 *
2498 * @return Returns a CharSequence holding the requested text. Returns null
2499 * if the text could not be found for any reason.
2500 */
2501 public abstract CharSequence getText(String packageName, int resid,
2502 ApplicationInfo appInfo);
2503
2504 /**
2505 * Retrieve an XML file from a package. This is a low-level API used to
2506 * retrieve XML meta data.
2507 *
2508 * @param packageName The name of the package that this xml is coming from.
kmccormick30498b42013-03-27 17:39:17 -07002509 * Cannot be null.
2510 * @param resid The resource identifier of the desired xml. Cannot be 0.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002511 * @param appInfo Overall information about <var>packageName</var>. This
2512 * may be null, in which case the application information will be retrieved
2513 * for you if needed; if you already have this information around, it can
2514 * be much more efficient to supply it here.
2515 *
2516 * @return Returns an XmlPullParser allowing you to parse out the XML
2517 * data. Returns null if the xml resource could not be found for any
2518 * reason.
2519 */
2520 public abstract XmlResourceParser getXml(String packageName, int resid,
2521 ApplicationInfo appInfo);
2522
2523 /**
2524 * Return the label to use for this application.
2525 *
2526 * @return Returns the label associated with this application, or null if
2527 * it could not be found for any reason.
kmccormick30498b42013-03-27 17:39:17 -07002528 * @param info The application to get the label of.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002529 */
2530 public abstract CharSequence getApplicationLabel(ApplicationInfo info);
2531
2532 /**
2533 * Retrieve the resources associated with an activity. Given the full
2534 * name of an activity, retrieves the information about it and calls
2535 * getResources() to return its application's resources. If the activity
kmccormick30498b42013-03-27 17:39:17 -07002536 * cannot be found, NameNotFoundException is thrown.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002537 *
2538 * @param activityName Name of the activity whose resources are to be
2539 * retrieved.
2540 *
2541 * @return Returns the application's Resources.
2542 * @throws NameNotFoundException Thrown if the resources for the given
2543 * application could not be loaded.
2544 *
2545 * @see #getResourcesForApplication(ApplicationInfo)
2546 */
2547 public abstract Resources getResourcesForActivity(ComponentName activityName)
2548 throws NameNotFoundException;
2549
2550 /**
2551 * Retrieve the resources for an application. Throws NameNotFoundException
2552 * if the package is no longer installed.
2553 *
2554 * @param app Information about the desired application.
2555 *
2556 * @return Returns the application's Resources.
2557 * @throws NameNotFoundException Thrown if the resources for the given
2558 * application could not be loaded (most likely because it was uninstalled).
2559 */
2560 public abstract Resources getResourcesForApplication(ApplicationInfo app)
2561 throws NameNotFoundException;
2562
2563 /**
2564 * Retrieve the resources associated with an application. Given the full
2565 * package name of an application, retrieves the information about it and
2566 * calls getResources() to return its application's resources. If the
kmccormick30498b42013-03-27 17:39:17 -07002567 * appPackageName cannot be found, NameNotFoundException is thrown.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002568 *
2569 * @param appPackageName Package name of the application whose resources
2570 * are to be retrieved.
2571 *
2572 * @return Returns the application's Resources.
2573 * @throws NameNotFoundException Thrown if the resources for the given
2574 * application could not be loaded.
2575 *
2576 * @see #getResourcesForApplication(ApplicationInfo)
2577 */
2578 public abstract Resources getResourcesForApplication(String appPackageName)
2579 throws NameNotFoundException;
2580
Amith Yamasani98edc952012-09-25 14:09:27 -07002581 /** @hide */
2582 public abstract Resources getResourcesForApplicationAsUser(String appPackageName, int userId)
2583 throws NameNotFoundException;
2584
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002585 /**
2586 * Retrieve overall information about an application package defined
2587 * in a package archive file
2588 *
2589 * @param archiveFilePath The path to the archive file
2590 * @param flags Additional option flags. Use any combination of
2591 * {@link #GET_ACTIVITIES},
2592 * {@link #GET_GIDS},
2593 * {@link #GET_CONFIGURATIONS},
2594 * {@link #GET_INSTRUMENTATION},
2595 * {@link #GET_PERMISSIONS},
2596 * {@link #GET_PROVIDERS},
2597 * {@link #GET_RECEIVERS},
2598 * {@link #GET_SERVICES},
2599 * {@link #GET_SIGNATURES}, to modify the data returned.
2600 *
2601 * @return Returns the information about the package. Returns
2602 * null if the package could not be successfully parsed.
2603 *
2604 * @see #GET_ACTIVITIES
2605 * @see #GET_GIDS
2606 * @see #GET_CONFIGURATIONS
2607 * @see #GET_INSTRUMENTATION
2608 * @see #GET_PERMISSIONS
2609 * @see #GET_PROVIDERS
2610 * @see #GET_RECEIVERS
2611 * @see #GET_SERVICES
2612 * @see #GET_SIGNATURES
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002613 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002614 */
2615 public PackageInfo getPackageArchiveInfo(String archiveFilePath, int flags) {
2616 PackageParser packageParser = new PackageParser(archiveFilePath);
2617 DisplayMetrics metrics = new DisplayMetrics();
2618 metrics.setToDefaults();
2619 final File sourceFile = new File(archiveFilePath);
2620 PackageParser.Package pkg = packageParser.parsePackage(
2621 sourceFile, archiveFilePath, metrics, 0);
2622 if (pkg == null) {
2623 return null;
2624 }
Kenny Root6ccd4122011-10-13 14:56:21 -07002625 if ((flags & GET_SIGNATURES) != 0) {
2626 packageParser.collectCertificates(pkg, 0);
2627 }
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002628 PackageUserState state = new PackageUserState();
2629 return PackageParser.generatePackageInfo(pkg, null, flags, 0, 0, null, state);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002630 }
2631
2632 /**
Dianne Hackbornade3eca2009-05-11 18:54:45 -07002633 * @hide
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002634 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002635 * Install a package. Since this may take a little while, the result will
2636 * be posted back to the given observer. An installation will fail if the calling context
2637 * lacks the {@link android.Manifest.permission#INSTALL_PACKAGES} permission, if the
2638 * package named in the package file's manifest is already installed, or if there's no space
2639 * available on the device.
2640 *
2641 * @param packageURI The location of the package file to install. This can be a 'file:' or a
2642 * 'content:' URI.
2643 * @param observer An observer callback to get notified when the package installation is
2644 * complete. {@link IPackageInstallObserver#packageInstalled(String, int)} will be
2645 * called when that happens. observer may be null to indicate that no callback is desired.
Dianne Hackbornade3eca2009-05-11 18:54:45 -07002646 * @param flags - possible values: {@link #INSTALL_FORWARD_LOCK},
2647 * {@link #INSTALL_REPLACE_EXISTING}, {@link #INSTALL_ALLOW_TEST}.
Jacek Surazski65e13172009-04-28 15:26:38 +02002648 * @param installerPackageName Optional package name of the application that is performing the
2649 * installation. This identifies which market the package came from.
Jacek Surazski65e13172009-04-28 15:26:38 +02002650 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002651 public abstract void installPackage(
Jacek Surazski65e13172009-04-28 15:26:38 +02002652 Uri packageURI, IPackageInstallObserver observer, int flags,
2653 String installerPackageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002654
2655 /**
Kenny Root5ab21572011-07-27 11:11:19 -07002656 * Similar to
2657 * {@link #installPackage(Uri, IPackageInstallObserver, int, String)} but
2658 * with an extra verification file provided.
2659 *
2660 * @param packageURI The location of the package file to install. This can
2661 * be a 'file:' or a 'content:' URI.
2662 * @param observer An observer callback to get notified when the package
2663 * installation is complete.
2664 * {@link IPackageInstallObserver#packageInstalled(String, int)}
2665 * will be called when that happens. observer may be null to
2666 * indicate that no callback is desired.
2667 * @param flags - possible values: {@link #INSTALL_FORWARD_LOCK},
2668 * {@link #INSTALL_REPLACE_EXISTING}, {@link #INSTALL_ALLOW_TEST}
2669 * .
2670 * @param installerPackageName Optional package name of the application that
2671 * is performing the installation. This identifies which market
2672 * the package came from.
2673 * @param verificationURI The location of the supplementary verification
Anonymous Cowardceb1b0b2012-04-24 10:35:16 -07002674 * file. This can be a 'file:' or a 'content:' URI. May be
2675 * {@code null}.
2676 * @param manifestDigest an object that holds the digest of the package
2677 * which can be used to verify ownership. May be {@code null}.
2678 * @param encryptionParams if the package to be installed is encrypted,
2679 * these parameters describing the encryption and authentication
2680 * used. May be {@code null}.
Kenny Root5ab21572011-07-27 11:11:19 -07002681 * @hide
2682 */
2683 public abstract void installPackageWithVerification(Uri packageURI,
2684 IPackageInstallObserver observer, int flags, String installerPackageName,
Anonymous Cowardceb1b0b2012-04-24 10:35:16 -07002685 Uri verificationURI, ManifestDigest manifestDigest,
Rich Canningse1d7c712012-08-08 12:46:06 -07002686 ContainerEncryptionParams encryptionParams);
Kenny Root5ab21572011-07-27 11:11:19 -07002687
2688 /**
rich cannings706e8ba2012-08-20 13:20:14 -07002689 * Similar to
2690 * {@link #installPackage(Uri, IPackageInstallObserver, int, String)} but
2691 * with an extra verification information provided.
2692 *
2693 * @param packageURI The location of the package file to install. This can
2694 * be a 'file:' or a 'content:' URI.
2695 * @param observer An observer callback to get notified when the package
2696 * installation is complete.
2697 * {@link IPackageInstallObserver#packageInstalled(String, int)}
2698 * will be called when that happens. observer may be null to
2699 * indicate that no callback is desired.
2700 * @param flags - possible values: {@link #INSTALL_FORWARD_LOCK},
2701 * {@link #INSTALL_REPLACE_EXISTING}, {@link #INSTALL_ALLOW_TEST}
2702 * .
2703 * @param installerPackageName Optional package name of the application that
2704 * is performing the installation. This identifies which market
2705 * the package came from.
2706 * @param verificationParams an object that holds signal information to
2707 * assist verification. May be {@code null}.
2708 * @param encryptionParams if the package to be installed is encrypted,
2709 * these parameters describing the encryption and authentication
2710 * used. May be {@code null}.
2711 *
2712 * @hide
2713 */
2714 public abstract void installPackageWithVerificationAndEncryption(Uri packageURI,
2715 IPackageInstallObserver observer, int flags, String installerPackageName,
2716 VerificationParams verificationParams,
2717 ContainerEncryptionParams encryptionParams);
2718
2719 /**
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002720 * If there is already an application with the given package name installed
2721 * on the system for other users, also install it for the calling user.
2722 * @hide
2723 */
2724 public abstract int installExistingPackage(String packageName)
2725 throws NameNotFoundException;
2726
2727 /**
Kenny Root5ab21572011-07-27 11:11:19 -07002728 * Allows a package listening to the
2729 * {@link Intent#ACTION_PACKAGE_NEEDS_VERIFICATION package verification
Kenny Root3a9b5fb2011-09-20 14:15:38 -07002730 * broadcast} to respond to the package manager. The response must include
2731 * the {@code verificationCode} which is one of
2732 * {@link PackageManager#VERIFICATION_ALLOW} or
2733 * {@link PackageManager#VERIFICATION_REJECT}.
Kenny Root5ab21572011-07-27 11:11:19 -07002734 *
2735 * @param id pending package identifier as passed via the
kmccormick30498b42013-03-27 17:39:17 -07002736 * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra.
Kenny Root3a9b5fb2011-09-20 14:15:38 -07002737 * @param verificationCode either {@link PackageManager#VERIFICATION_ALLOW}
2738 * or {@link PackageManager#VERIFICATION_REJECT}.
rich cannings7e671512012-08-27 14:44:16 -07002739 * @throws SecurityException if the caller does not have the
Dianne Hackborn8832c182012-09-17 17:20:24 -07002740 * PACKAGE_VERIFICATION_AGENT permission.
Kenny Root5ab21572011-07-27 11:11:19 -07002741 */
Kenny Root3a9b5fb2011-09-20 14:15:38 -07002742 public abstract void verifyPendingInstall(int id, int verificationCode);
Kenny Root5ab21572011-07-27 11:11:19 -07002743
2744 /**
rich canningsd9ef3e52012-08-22 14:28:05 -07002745 * Allows a package listening to the
2746 * {@link Intent#ACTION_PACKAGE_NEEDS_VERIFICATION package verification
2747 * broadcast} to extend the default timeout for a response and declare what
2748 * action to perform after the timeout occurs. The response must include
2749 * the {@code verificationCodeAtTimeout} which is one of
2750 * {@link PackageManager#VERIFICATION_ALLOW} or
2751 * {@link PackageManager#VERIFICATION_REJECT}.
2752 *
2753 * This method may only be called once per package id. Additional calls
2754 * will have no effect.
2755 *
2756 * @param id pending package identifier as passed via the
kmccormick30498b42013-03-27 17:39:17 -07002757 * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra.
rich canningsd9ef3e52012-08-22 14:28:05 -07002758 * @param verificationCodeAtTimeout either
2759 * {@link PackageManager#VERIFICATION_ALLOW} or
rich canningsd1b5cfc2012-08-29 14:49:51 -07002760 * {@link PackageManager#VERIFICATION_REJECT}. If
2761 * {@code verificationCodeAtTimeout} is neither
2762 * {@link PackageManager#VERIFICATION_ALLOW} or
2763 * {@link PackageManager#VERIFICATION_REJECT}, then
2764 * {@code verificationCodeAtTimeout} will default to
rich canningsd9ef3e52012-08-22 14:28:05 -07002765 * {@link PackageManager#VERIFICATION_REJECT}.
2766 * @param millisecondsToDelay the amount of time requested for the timeout.
2767 * Must be positive and less than
rich canningsd1b5cfc2012-08-29 14:49:51 -07002768 * {@link PackageManager#MAXIMUM_VERIFICATION_TIMEOUT}. If
2769 * {@code millisecondsToDelay} is out of bounds,
2770 * {@code millisecondsToDelay} will be set to the closest in
2771 * bounds value; namely, 0 or
rich canningsd9ef3e52012-08-22 14:28:05 -07002772 * {@link PackageManager#MAXIMUM_VERIFICATION_TIMEOUT}.
rich cannings7e671512012-08-27 14:44:16 -07002773 * @throws SecurityException if the caller does not have the
Dianne Hackborn8832c182012-09-17 17:20:24 -07002774 * PACKAGE_VERIFICATION_AGENT permission.
rich canningsd9ef3e52012-08-22 14:28:05 -07002775 */
2776 public abstract void extendVerificationTimeout(int id,
2777 int verificationCodeAtTimeout, long millisecondsToDelay);
2778
2779 /**
Dianne Hackborn880119b2010-11-18 22:26:40 -08002780 * Change the installer associated with a given package. There are limitations
2781 * on how the installer package can be changed; in particular:
2782 * <ul>
2783 * <li> A SecurityException will be thrown if <var>installerPackageName</var>
2784 * is not signed with the same certificate as the calling application.
2785 * <li> A SecurityException will be thrown if <var>targetPackage</var> already
2786 * has an installer package, and that installer package is not signed with
2787 * the same certificate as the calling application.
2788 * </ul>
2789 *
2790 * @param targetPackage The installed package whose installer will be changed.
2791 * @param installerPackageName The package name of the new installer. May be
2792 * null to clear the association.
2793 */
2794 public abstract void setInstallerPackageName(String targetPackage,
2795 String installerPackageName);
2796
2797 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002798 * Attempts to delete a package. Since this may take a little while, the result will
2799 * be posted back to the given observer. A deletion will fail if the calling context
2800 * lacks the {@link android.Manifest.permission#DELETE_PACKAGES} permission, if the
2801 * named package cannot be found, or if the named package is a "system package".
2802 * (TODO: include pointer to documentation on "system packages")
2803 *
2804 * @param packageName The name of the package to delete
2805 * @param observer An observer callback to get notified when the package deletion is
2806 * complete. {@link android.content.pm.IPackageDeleteObserver#packageDeleted(boolean)} will be
2807 * called when that happens. observer may be null to indicate that no callback is desired.
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002808 * @param flags - possible values: {@link #DELETE_KEEP_DATA},
2809 * {@link #DELETE_ALL_USERS}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002810 *
2811 * @hide
2812 */
2813 public abstract void deletePackage(
2814 String packageName, IPackageDeleteObserver observer, int flags);
Jacek Surazski65e13172009-04-28 15:26:38 +02002815
2816 /**
2817 * Retrieve the package name of the application that installed a package. This identifies
2818 * which market the package came from.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002819 *
Jacek Surazski65e13172009-04-28 15:26:38 +02002820 * @param packageName The name of the package to query
2821 */
2822 public abstract String getInstallerPackageName(String packageName);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002823
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002824 /**
2825 * Attempts to clear the user data directory of an application.
2826 * Since this may take a little while, the result will
2827 * be posted back to the given observer. A deletion will fail if the
2828 * named package cannot be found, or if the named package is a "system package".
2829 *
2830 * @param packageName The name of the package
2831 * @param observer An observer callback to get notified when the operation is finished
2832 * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)}
2833 * will be called when that happens. observer may be null to indicate that
2834 * no callback is desired.
2835 *
2836 * @hide
2837 */
2838 public abstract void clearApplicationUserData(String packageName,
2839 IPackageDataObserver observer);
2840 /**
2841 * Attempts to delete the cache files associated with an application.
2842 * Since this may take a little while, the result will
2843 * be posted back to the given observer. A deletion will fail if the calling context
2844 * lacks the {@link android.Manifest.permission#DELETE_CACHE_FILES} permission, if the
2845 * named package cannot be found, or if the named package is a "system package".
2846 *
2847 * @param packageName The name of the package to delete
2848 * @param observer An observer callback to get notified when the cache file deletion
2849 * is complete.
2850 * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)}
2851 * will be called when that happens. observer may be null to indicate that
2852 * no callback is desired.
2853 *
2854 * @hide
2855 */
2856 public abstract void deleteApplicationCacheFiles(String packageName,
2857 IPackageDataObserver observer);
2858
2859 /**
2860 * Free storage by deleting LRU sorted list of cache files across
2861 * all applications. If the currently available free storage
2862 * on the device is greater than or equal to the requested
2863 * free storage, no cache files are cleared. If the currently
2864 * available storage on the device is less than the requested
2865 * free storage, some or all of the cache files across
2866 * all applications are deleted (based on last accessed time)
2867 * to increase the free storage space on the device to
2868 * the requested value. There is no guarantee that clearing all
2869 * the cache files from all applications will clear up
2870 * enough storage to achieve the desired value.
2871 * @param freeStorageSize The number of bytes of storage to be
2872 * freed by the system. Say if freeStorageSize is XX,
2873 * and the current free storage is YY,
2874 * if XX is less than YY, just return. if not free XX-YY number
2875 * of bytes if possible.
2876 * @param observer call back used to notify when
2877 * the operation is completed
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002878 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002879 * @hide
2880 */
2881 public abstract void freeStorageAndNotify(long freeStorageSize, IPackageDataObserver observer);
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -07002882
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002883 /**
2884 * Free storage by deleting LRU sorted list of cache files across
2885 * all applications. If the currently available free storage
2886 * on the device is greater than or equal to the requested
2887 * free storage, no cache files are cleared. If the currently
2888 * available storage on the device is less than the requested
2889 * free storage, some or all of the cache files across
2890 * all applications are deleted (based on last accessed time)
2891 * to increase the free storage space on the device to
2892 * the requested value. There is no guarantee that clearing all
2893 * the cache files from all applications will clear up
2894 * enough storage to achieve the desired value.
2895 * @param freeStorageSize The number of bytes of storage to be
2896 * freed by the system. Say if freeStorageSize is XX,
2897 * and the current free storage is YY,
2898 * if XX is less than YY, just return. if not free XX-YY number
2899 * of bytes if possible.
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -07002900 * @param pi IntentSender call back used to
2901 * notify when the operation is completed.May be null
2902 * to indicate that no call back is desired.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002903 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002904 * @hide
2905 */
Suchi Amalapurapubc806f62009-06-17 15:18:19 -07002906 public abstract void freeStorage(long freeStorageSize, IntentSender pi);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002907
2908 /**
2909 * Retrieve the size information for a package.
2910 * Since this may take a little while, the result will
2911 * be posted back to the given observer. The calling context
2912 * should have the {@link android.Manifest.permission#GET_PACKAGE_SIZE} permission.
2913 *
2914 * @param packageName The name of the package whose size information is to be retrieved
Dianne Hackborn0c380492012-08-20 17:23:30 -07002915 * @param userHandle The user whose size information should be retrieved.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002916 * @param observer An observer callback to get notified when the operation
2917 * is complete.
2918 * {@link android.content.pm.IPackageStatsObserver#onGetStatsCompleted(PackageStats, boolean)}
2919 * The observer's callback is invoked with a PackageStats object(containing the
2920 * code, data and cache sizes of the package) and a boolean value representing
2921 * the status of the operation. observer may be null to indicate that
2922 * no callback is desired.
2923 *
2924 * @hide
2925 */
Dianne Hackborn0c380492012-08-20 17:23:30 -07002926 public abstract void getPackageSizeInfo(String packageName, int userHandle,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002927 IPackageStatsObserver observer);
2928
2929 /**
Dianne Hackborn0c380492012-08-20 17:23:30 -07002930 * Like {@link #getPackageSizeInfo(String, int, IPackageStatsObserver)}, but
2931 * returns the size for the calling user.
2932 *
2933 * @hide
2934 */
2935 public void getPackageSizeInfo(String packageName, IPackageStatsObserver observer) {
2936 getPackageSizeInfo(packageName, UserHandle.myUserId(), observer);
2937 }
2938
2939 /**
Dianne Hackborna7ca0e52009-12-01 14:31:55 -08002940 * @deprecated This function no longer does anything; it was an old
kmccormickac66b852013-03-28 15:17:15 -07002941 * approach to managing preferred activities, which has been superseded
2942 * by (and conflicts with) the modern activity-based preferences.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002943 */
Dianne Hackborna7ca0e52009-12-01 14:31:55 -08002944 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002945 public abstract void addPackageToPreferred(String packageName);
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 removePackageFromPreferred(String packageName);
2954
2955 /**
2956 * Retrieve the list of all currently configured preferred packages. The
2957 * first package on the list is the most preferred, the last is the
2958 * least preferred.
2959 *
2960 * @param flags Additional option flags. Use any combination of
2961 * {@link #GET_ACTIVITIES},
2962 * {@link #GET_GIDS},
2963 * {@link #GET_CONFIGURATIONS},
2964 * {@link #GET_INSTRUMENTATION},
2965 * {@link #GET_PERMISSIONS},
2966 * {@link #GET_PROVIDERS},
2967 * {@link #GET_RECEIVERS},
2968 * {@link #GET_SERVICES},
2969 * {@link #GET_SIGNATURES}, to modify the data returned.
2970 *
2971 * @return Returns a list of PackageInfo objects describing each
2972 * preferred application, in order of preference.
2973 *
2974 * @see #GET_ACTIVITIES
2975 * @see #GET_GIDS
2976 * @see #GET_CONFIGURATIONS
2977 * @see #GET_INSTRUMENTATION
2978 * @see #GET_PERMISSIONS
2979 * @see #GET_PROVIDERS
2980 * @see #GET_RECEIVERS
2981 * @see #GET_SERVICES
2982 * @see #GET_SIGNATURES
2983 */
2984 public abstract List<PackageInfo> getPreferredPackages(int flags);
2985
2986 /**
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08002987 * @deprecated This is a protected API that should not have been available
2988 * to third party applications. It is the platform's responsibility for
kmccormick30498b42013-03-27 17:39:17 -07002989 * assigning preferred activities and this cannot be directly modified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002990 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002991 * Add a new preferred activity mapping to the system. This will be used
2992 * to automatically select the given activity component when
2993 * {@link Context#startActivity(Intent) Context.startActivity()} finds
2994 * multiple matching activities and also matches the given filter.
2995 *
2996 * @param filter The set of intents under which this activity will be
2997 * made preferred.
2998 * @param match The IntentFilter match category that this preference
2999 * applies to.
3000 * @param set The set of activities that the user was picking from when
3001 * this preference was made.
3002 * @param activity The component name of the activity that is to be
3003 * preferred.
3004 */
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08003005 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003006 public abstract void addPreferredActivity(IntentFilter filter, int match,
3007 ComponentName[] set, ComponentName activity);
3008
3009 /**
Amith Yamasania3f133a2012-08-09 17:11:28 -07003010 * Same as {@link #addPreferredActivity(IntentFilter, int,
3011 ComponentName[], ComponentName)}, but with a specific userId to apply the preference
3012 to.
3013 * @hide
3014 */
3015 public void addPreferredActivity(IntentFilter filter, int match,
3016 ComponentName[] set, ComponentName activity, int userId) {
3017 throw new RuntimeException("Not implemented. Must override in a subclass.");
3018 }
3019
3020 /**
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08003021 * @deprecated This is a protected API that should not have been available
3022 * to third party applications. It is the platform's responsibility for
kmccormick30498b42013-03-27 17:39:17 -07003023 * assigning preferred activities and this cannot be directly modified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003024 *
Satish Sampath8dbe6122009-06-02 23:35:54 +01003025 * Replaces an existing preferred activity mapping to the system, and if that were not present
3026 * adds a new preferred activity. This will be used
3027 * to automatically select the given activity component when
3028 * {@link Context#startActivity(Intent) Context.startActivity()} finds
3029 * multiple matching activities and also matches the given filter.
3030 *
3031 * @param filter The set of intents under which this activity will be
3032 * made preferred.
3033 * @param match The IntentFilter match category that this preference
3034 * applies to.
3035 * @param set The set of activities that the user was picking from when
3036 * this preference was made.
3037 * @param activity The component name of the activity that is to be
3038 * preferred.
3039 * @hide
3040 */
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08003041 @Deprecated
Satish Sampath8dbe6122009-06-02 23:35:54 +01003042 public abstract void replacePreferredActivity(IntentFilter filter, int match,
3043 ComponentName[] set, ComponentName activity);
3044
3045 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003046 * Remove all preferred activity mappings, previously added with
3047 * {@link #addPreferredActivity}, from the
3048 * system whose activities are implemented in the given package name.
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08003049 * An application can only clear its own package(s).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003050 *
3051 * @param packageName The name of the package whose preferred activity
3052 * mappings are to be removed.
3053 */
3054 public abstract void clearPackagePreferredActivities(String packageName);
3055
3056 /**
3057 * Retrieve all preferred activities, previously added with
3058 * {@link #addPreferredActivity}, that are
3059 * currently registered with the system.
3060 *
3061 * @param outFilters A list in which to place the filters of all of the
3062 * preferred activities, or null for none.
3063 * @param outActivities A list in which to place the component names of
3064 * all of the preferred activities, or null for none.
3065 * @param packageName An option package in which you would like to limit
3066 * the list. If null, all activities will be returned; if non-null, only
3067 * those activities in the given package are returned.
3068 *
3069 * @return Returns the total number of registered preferred activities
3070 * (the number of distinct IntentFilter records, not the number of unique
3071 * activity components) that were found.
3072 */
3073 public abstract int getPreferredActivities(List<IntentFilter> outFilters,
3074 List<ComponentName> outActivities, String packageName);
3075
3076 /**
Christopher Tatea2a0850d2013-09-05 16:38:58 -07003077 * Ask for the set of available 'home' activities and the current explicit
3078 * default, if any.
3079 * @hide
3080 */
3081 public abstract ComponentName getHomeActivities(List<ResolveInfo> outActivities);
3082
3083 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003084 * Set the enabled setting for a package component (activity, receiver, service, provider).
3085 * This setting will override any enabled state which may have been set by the component in its
3086 * manifest.
3087 *
3088 * @param componentName The component to enable
3089 * @param newState The new enabled state for the component. The legal values for this state
3090 * are:
3091 * {@link #COMPONENT_ENABLED_STATE_ENABLED},
3092 * {@link #COMPONENT_ENABLED_STATE_DISABLED}
3093 * and
3094 * {@link #COMPONENT_ENABLED_STATE_DEFAULT}
3095 * The last one removes the setting, thereby restoring the component's state to
3096 * whatever was set in it's manifest (or enabled, by default).
3097 * @param flags Optional behavior flags: {@link #DONT_KILL_APP} or 0.
3098 */
3099 public abstract void setComponentEnabledSetting(ComponentName componentName,
3100 int newState, int flags);
3101
3102
3103 /**
3104 * Return the the enabled setting for a package component (activity,
3105 * receiver, service, provider). This returns the last value set by
3106 * {@link #setComponentEnabledSetting(ComponentName, int, int)}; in most
3107 * cases this value will be {@link #COMPONENT_ENABLED_STATE_DEFAULT} since
3108 * the value originally specified in the manifest has not been modified.
3109 *
3110 * @param componentName The component to retrieve.
3111 * @return Returns the current enabled state for the component. May
3112 * be one of {@link #COMPONENT_ENABLED_STATE_ENABLED},
3113 * {@link #COMPONENT_ENABLED_STATE_DISABLED}, or
3114 * {@link #COMPONENT_ENABLED_STATE_DEFAULT}. The last one means the
3115 * component's enabled state is based on the original information in
3116 * the manifest as found in {@link ComponentInfo}.
3117 */
3118 public abstract int getComponentEnabledSetting(ComponentName componentName);
3119
3120 /**
3121 * Set the enabled setting for an application
3122 * This setting will override any enabled state which may have been set by the application in
3123 * its manifest. It also overrides the enabled state set in the manifest for any of the
3124 * application's components. It does not override any enabled state set by
3125 * {@link #setComponentEnabledSetting} for any of the application's components.
3126 *
3127 * @param packageName The package name of the application to enable
3128 * @param newState The new enabled state for the component. The legal values for this state
3129 * are:
3130 * {@link #COMPONENT_ENABLED_STATE_ENABLED},
3131 * {@link #COMPONENT_ENABLED_STATE_DISABLED}
3132 * and
3133 * {@link #COMPONENT_ENABLED_STATE_DEFAULT}
3134 * The last one removes the setting, thereby restoring the applications's state to
3135 * whatever was set in its manifest (or enabled, by default).
3136 * @param flags Optional behavior flags: {@link #DONT_KILL_APP} or 0.
3137 */
3138 public abstract void setApplicationEnabledSetting(String packageName,
3139 int newState, int flags);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003140
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003141 /**
3142 * Return the the enabled setting for an application. This returns
3143 * the last value set by
3144 * {@link #setApplicationEnabledSetting(String, int, int)}; in most
3145 * cases this value will be {@link #COMPONENT_ENABLED_STATE_DEFAULT} since
3146 * the value originally specified in the manifest has not been modified.
3147 *
3148 * @param packageName The component to retrieve.
3149 * @return Returns the current enabled state for the component. May
3150 * be one of {@link #COMPONENT_ENABLED_STATE_ENABLED},
3151 * {@link #COMPONENT_ENABLED_STATE_DISABLED}, or
3152 * {@link #COMPONENT_ENABLED_STATE_DEFAULT}. The last one means the
3153 * application's enabled state is based on the original information in
3154 * the manifest as found in {@link ComponentInfo}.
Mathew Inwood1b9f8d92011-09-26 13:23:56 +01003155 * @throws IllegalArgumentException if the named package does not exist.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003156 */
3157 public abstract int getApplicationEnabledSetting(String packageName);
3158
3159 /**
Amith Yamasani655d0e22013-06-12 14:19:10 -07003160 * Puts the package in a blocked state, which is almost like an uninstalled state,
3161 * making the package unavailable, but it doesn't remove the data or the actual
3162 * package file.
3163 * @hide
3164 */
3165 public abstract boolean setApplicationBlockedSettingAsUser(String packageName, boolean blocked,
3166 UserHandle userHandle);
3167
3168 /**
3169 * Returns the blocked state of a package.
3170 * @see #setApplicationBlockedSettingAsUser(String, boolean, UserHandle)
3171 * @hide
3172 */
3173 public abstract boolean getApplicationBlockedSettingAsUser(String packageName,
3174 UserHandle userHandle);
3175
3176 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003177 * Return whether the device has been booted into safe mode.
3178 */
3179 public abstract boolean isSafeMode();
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08003180
3181 /**
3182 * Attempts to move package resources from internal to external media or vice versa.
3183 * Since this may take a little while, the result will
3184 * be posted back to the given observer. This call may fail if the calling context
3185 * lacks the {@link android.Manifest.permission#MOVE_PACKAGE} permission, if the
3186 * named package cannot be found, or if the named package is a "system package".
3187 *
3188 * @param packageName The name of the package to delete
3189 * @param observer An observer callback to get notified when the package move is
3190 * complete. {@link android.content.pm.IPackageMoveObserver#packageMoved(boolean)} will be
3191 * called when that happens. observer may be null to indicate that no callback is desired.
3192 * @param flags To indicate install location {@link #MOVE_INTERNAL} or
3193 * {@link #MOVE_EXTERNAL_MEDIA}
3194 *
3195 * @hide
3196 */
3197 public abstract void movePackage(
3198 String packageName, IPackageMoveObserver observer, int flags);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003199
3200 /**
Amith Yamasani13593602012-03-22 16:16:17 -07003201 * Returns the device identity that verifiers can use to associate their scheme to a particular
3202 * device. This should not be used by anything other than a package verifier.
Aravind Akella068b0c02013-10-12 17:39:15 -07003203 *
Kenny Root0aaa0d92011-09-12 16:42:55 -07003204 * @return identity that uniquely identifies current device
3205 * @hide
3206 */
3207 public abstract VerifierDeviceIdentity getVerifierDeviceIdentity();
Amith Yamasani742a6712011-05-04 14:49:28 -07003208
3209 /**
3210 * Returns the data directory for a particular user and package, given the uid of the package.
3211 * @param uid uid of the package, including the userId and appId
3212 * @param packageName name of the package
3213 * @return the user-specific data directory for the package
3214 * @hide
3215 */
3216 public static String getDataDirForUser(int userId, String packageName) {
3217 // TODO: This should be shared with Installer's knowledge of user directory
3218 return Environment.getDataDirectory().toString() + "/user/" + userId
3219 + "/" + packageName;
3220 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003221}