blob: e5191630fa60ba22ca928fff71ed5cbd3c9a4572 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.content.pm;
18
Tor Norbyed9273d62013-05-30 15:59:53 -070019import android.annotation.IntDef;
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -070020import android.annotation.NonNull;
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -080021import android.annotation.SdkConstant;
22import android.annotation.SdkConstant.SdkConstantType;
Jeff Sharkeybb580672014-07-10 12:10:25 -070023import android.annotation.SystemApi;
Jeff Sharkey6c0b9da2014-08-07 22:07:11 -070024import android.app.PackageDeleteObserver;
Christopher Tatef1977b42014-03-24 16:25:51 -070025import android.app.PackageInstallObserver;
Amith Yamasani1d653272014-09-11 17:56:05 -070026import android.app.admin.DevicePolicyManager;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080027import android.content.ComponentName;
28import android.content.Context;
29import android.content.Intent;
30import android.content.IntentFilter;
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -070031import android.content.IntentSender;
Jeff Sharkeyc4858a22014-06-16 10:51:20 -070032import android.content.pm.PackageParser.PackageParserException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080033import android.content.res.Resources;
34import android.content.res.XmlResourceParser;
Svetoslavc7d62f02014-09-04 15:39:54 -070035import android.graphics.Rect;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080036import android.graphics.drawable.Drawable;
37import android.net.Uri;
Jeff Sharkeybb580672014-07-10 12:10:25 -070038import android.os.Bundle;
Amith Yamasani742a6712011-05-04 14:49:28 -070039import android.os.Environment;
Jeff Sharkey6c0b9da2014-08-07 22:07:11 -070040import android.os.RemoteException;
Dianne Hackborn0c380492012-08-20 17:23:30 -070041import android.os.UserHandle;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080042import android.util.AndroidException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080043
44import java.io.File;
Tor Norbyed9273d62013-05-30 15:59:53 -070045import java.lang.annotation.Retention;
46import java.lang.annotation.RetentionPolicy;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080047import java.util.List;
48
49/**
50 * Class for retrieving various kinds of information related to the application
51 * packages that are currently installed on the device.
52 *
53 * You can find this class through {@link Context#getPackageManager}.
54 */
55public abstract class PackageManager {
56
57 /**
58 * This exception is thrown when a given package, application, or component
kmccormick30498b42013-03-27 17:39:17 -070059 * name cannot be found.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080060 */
61 public static class NameNotFoundException extends AndroidException {
62 public NameNotFoundException() {
63 }
64
65 public NameNotFoundException(String name) {
66 super(name);
67 }
68 }
69
70 /**
71 * {@link PackageInfo} flag: return information about
72 * activities in the package in {@link PackageInfo#activities}.
73 */
74 public static final int GET_ACTIVITIES = 0x00000001;
75
76 /**
77 * {@link PackageInfo} flag: return information about
78 * intent receivers in the package in
79 * {@link PackageInfo#receivers}.
80 */
81 public static final int GET_RECEIVERS = 0x00000002;
82
83 /**
84 * {@link PackageInfo} flag: return information about
85 * services in the package in {@link PackageInfo#services}.
86 */
87 public static final int GET_SERVICES = 0x00000004;
88
89 /**
90 * {@link PackageInfo} flag: return information about
91 * content providers in the package in
92 * {@link PackageInfo#providers}.
93 */
94 public static final int GET_PROVIDERS = 0x00000008;
95
96 /**
97 * {@link PackageInfo} flag: return information about
98 * instrumentation in the package in
99 * {@link PackageInfo#instrumentation}.
100 */
101 public static final int GET_INSTRUMENTATION = 0x00000010;
102
103 /**
104 * {@link PackageInfo} flag: return information about the
105 * intent filters supported by the activity.
106 */
107 public static final int GET_INTENT_FILTERS = 0x00000020;
108
109 /**
110 * {@link PackageInfo} flag: return information about the
111 * signatures included in the package.
112 */
113 public static final int GET_SIGNATURES = 0x00000040;
114
115 /**
116 * {@link ResolveInfo} flag: return the IntentFilter that
117 * was matched for a particular ResolveInfo in
118 * {@link ResolveInfo#filter}.
119 */
120 public static final int GET_RESOLVED_FILTER = 0x00000040;
121
122 /**
123 * {@link ComponentInfo} flag: return the {@link ComponentInfo#metaData}
124 * data {@link android.os.Bundle}s that are associated with a component.
125 * This applies for any API returning a ComponentInfo subclass.
126 */
127 public static final int GET_META_DATA = 0x00000080;
128
129 /**
130 * {@link PackageInfo} flag: return the
131 * {@link PackageInfo#gids group ids} that are associated with an
132 * application.
Ken Wakasaf76a50c2012-03-09 19:56:35 +0900133 * This applies for any API returning a PackageInfo class, either
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800134 * directly or nested inside of another.
135 */
136 public static final int GET_GIDS = 0x00000100;
137
138 /**
139 * {@link PackageInfo} flag: include disabled components in the returned info.
140 */
141 public static final int GET_DISABLED_COMPONENTS = 0x00000200;
142
143 /**
144 * {@link ApplicationInfo} flag: return the
145 * {@link ApplicationInfo#sharedLibraryFiles paths to the shared libraries}
146 * that are associated with an application.
147 * This applies for any API returning an ApplicationInfo class, either
148 * directly or nested inside of another.
149 */
150 public static final int GET_SHARED_LIBRARY_FILES = 0x00000400;
151
152 /**
153 * {@link ProviderInfo} flag: return the
154 * {@link ProviderInfo#uriPermissionPatterns URI permission patterns}
155 * that are associated with a content provider.
Ken Wakasaf76a50c2012-03-09 19:56:35 +0900156 * This applies for any API returning a ProviderInfo class, either
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800157 * directly or nested inside of another.
158 */
159 public static final int GET_URI_PERMISSION_PATTERNS = 0x00000800;
160 /**
161 * {@link PackageInfo} flag: return information about
162 * permissions in the package in
163 * {@link PackageInfo#permissions}.
164 */
165 public static final int GET_PERMISSIONS = 0x00001000;
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700166
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800167 /**
Kenny Root685f4902011-11-03 10:13:29 -0700168 * Flag parameter to retrieve some information about all applications (even
169 * uninstalled ones) which have data directories. This state could have
170 * resulted if applications have been deleted with flag
171 * {@code DONT_DELETE_DATA} with a possibility of being replaced or
172 * reinstalled in future.
173 * <p>
174 * Note: this flag may cause less information about currently installed
175 * applications to be returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800176 */
177 public static final int GET_UNINSTALLED_PACKAGES = 0x00002000;
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700178
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800179 /**
180 * {@link PackageInfo} flag: return information about
Dianne Hackborn49237342009-08-27 20:08:01 -0700181 * hardware preferences in
Adam Lesinskid3edfde2014-08-08 17:32:44 -0700182 * {@link PackageInfo#configPreferences PackageInfo.configPreferences},
183 * and requested features in {@link PackageInfo#reqFeatures} and
184 * {@link PackageInfo#featureGroups}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800185 */
186 public static final int GET_CONFIGURATIONS = 0x00004000;
187
188 /**
Dianne Hackbornfd7aded2013-01-22 17:10:23 -0800189 * {@link PackageInfo} flag: include disabled components which are in
190 * that state only because of {@link #COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED}
191 * in the returned info. Note that if you set this flag, applications
192 * that are in this disabled state will be reported as enabled.
193 */
194 public static final int GET_DISABLED_UNTIL_USED_COMPONENTS = 0x00008000;
195
196 /**
Dianne Hackborn1655be42009-05-08 14:29:01 -0700197 * Resolution and querying flag: if set, only filters that support the
198 * {@link android.content.Intent#CATEGORY_DEFAULT} will be considered for
199 * matching. This is a synonym for including the CATEGORY_DEFAULT in your
200 * supplied Intent.
201 */
202 public static final int MATCH_DEFAULT_ONLY = 0x00010000;
203
Nicolas Prevot63798c52014-05-27 13:22:38 +0100204 /**
Nicolas Prevot63798c52014-05-27 13:22:38 +0100205 * Flag for {@link addCrossProfileIntentFilter}: if this flag is set:
206 * when resolving an intent that matches the {@link CrossProfileIntentFilter}, the current
207 * profile will be skipped.
208 * Only activities in the target user can respond to the intent.
209 * @hide
210 */
211 public static final int SKIP_CURRENT_PROFILE = 0x00000002;
212
Tor Norbyed9273d62013-05-30 15:59:53 -0700213 /** @hide */
214 @IntDef({PERMISSION_GRANTED, PERMISSION_DENIED})
215 @Retention(RetentionPolicy.SOURCE)
216 public @interface PermissionResult {}
217
Dianne Hackborn1655be42009-05-08 14:29:01 -0700218 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800219 * Permission check result: this is returned by {@link #checkPermission}
220 * if the permission has been granted to the given package.
221 */
222 public static final int PERMISSION_GRANTED = 0;
223
224 /**
225 * Permission check result: this is returned by {@link #checkPermission}
226 * if the permission has not been granted to the given package.
227 */
228 public static final int PERMISSION_DENIED = -1;
229
230 /**
231 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700232 * if all signatures on the two packages match.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800233 */
234 public static final int SIGNATURE_MATCH = 0;
235
236 /**
237 * Signature check result: this is returned by {@link #checkSignatures}
238 * if neither of the two packages is signed.
239 */
240 public static final int SIGNATURE_NEITHER_SIGNED = 1;
241
242 /**
243 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700244 * if the first package is not signed but the second is.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800245 */
246 public static final int SIGNATURE_FIRST_NOT_SIGNED = -1;
247
248 /**
249 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700250 * if the second package is not signed but the first is.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800251 */
252 public static final int SIGNATURE_SECOND_NOT_SIGNED = -2;
253
254 /**
255 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700256 * if not all signatures on both packages match.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800257 */
258 public static final int SIGNATURE_NO_MATCH = -3;
259
260 /**
261 * Signature check result: this is returned by {@link #checkSignatures}
Chris Palmer09f33602010-09-13 14:27:18 -0700262 * if either of the packages are not valid.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800263 */
264 public static final int SIGNATURE_UNKNOWN_PACKAGE = -4;
265
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700266 /**
267 * Flag for {@link #setApplicationEnabledSetting(String, int, int)}
268 * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This
269 * component or application is in its default enabled state (as specified
270 * in its manifest).
271 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800272 public static final int COMPONENT_ENABLED_STATE_DEFAULT = 0;
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700273
274 /**
275 * Flag for {@link #setApplicationEnabledSetting(String, int, int)}
276 * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This
277 * component or application has been explictily enabled, regardless of
278 * what it has specified in its manifest.
279 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800280 public static final int COMPONENT_ENABLED_STATE_ENABLED = 1;
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700281
282 /**
283 * Flag for {@link #setApplicationEnabledSetting(String, int, int)}
284 * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This
285 * component or application has been explicitly disabled, regardless of
286 * what it has specified in its manifest.
287 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800288 public static final int COMPONENT_ENABLED_STATE_DISABLED = 2;
289
290 /**
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700291 * Flag for {@link #setApplicationEnabledSetting(String, int, int)} only: The
292 * user has explicitly disabled the application, regardless of what it has
293 * specified in its manifest. Because this is due to the user's request,
294 * they may re-enable it if desired through the appropriate system UI. This
kmccormick30498b42013-03-27 17:39:17 -0700295 * option currently <strong>cannot</strong> be used with
Dianne Hackborn0ac30312011-06-17 14:49:23 -0700296 * {@link #setComponentEnabledSetting(ComponentName, int, int)}.
297 */
298 public static final int COMPONENT_ENABLED_STATE_DISABLED_USER = 3;
299
300 /**
Dianne Hackbornfd7aded2013-01-22 17:10:23 -0800301 * Flag for {@link #setApplicationEnabledSetting(String, int, int)} only: This
302 * application should be considered, until the point where the user actually
303 * wants to use it. This means that it will not normally show up to the user
304 * (such as in the launcher), but various parts of the user interface can
305 * use {@link #GET_DISABLED_UNTIL_USED_COMPONENTS} to still see it and allow
306 * the user to select it (as for example an IME, device admin, etc). Such code,
307 * once the user has selected the app, should at that point also make it enabled.
308 * This option currently <strong>can not</strong> be used with
309 * {@link #setComponentEnabledSetting(ComponentName, int, int)}.
310 */
311 public static final int COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED = 4;
312
313 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800314 * Flag parameter for {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} to
315 * indicate that this package should be installed as forward locked, i.e. only the app itself
Brad Fitzpatrick2e805b12010-03-22 10:10:51 -0700316 * should have access to its code and non-resource assets.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700317 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800318 */
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700319 public static final int INSTALL_FORWARD_LOCK = 0x00000001;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800320
321 /**
322 * Flag parameter for {@link #installPackage} to indicate that you want to replace an already
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700323 * installed package, if one exists.
324 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800325 */
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700326 public static final int INSTALL_REPLACE_EXISTING = 0x00000002;
327
328 /**
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700329 * Flag parameter for {@link #installPackage} to indicate that you want to
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700330 * allow test packages (those that have set android:testOnly in their
331 * manifest) to be installed.
332 * @hide
333 */
334 public static final int INSTALL_ALLOW_TEST = 0x00000004;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800335
336 /**
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800337 * Flag parameter for {@link #installPackage} to indicate that this
338 * package has to be installed on the sdcard.
339 * @hide
340 */
Suchi Amalapurapu5b993ce2010-02-12 09:43:29 -0800341 public static final int INSTALL_EXTERNAL = 0x00000008;
Oscar Montemayor539d3c42010-01-29 15:27:00 -0800342
343 /**
Kenny Root5ab21572011-07-27 11:11:19 -0700344 * Flag parameter for {@link #installPackage} to indicate that this package
345 * has to be installed on the sdcard.
346 * @hide
347 */
348 public static final int INSTALL_INTERNAL = 0x00000010;
349
350 /**
351 * Flag parameter for {@link #installPackage} to indicate that this install
352 * was initiated via ADB.
353 *
354 * @hide
355 */
356 public static final int INSTALL_FROM_ADB = 0x00000020;
Suchi Amalapurapu14b6abd2010-03-17 08:37:04 -0700357
358 /**
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700359 * Flag parameter for {@link #installPackage} to indicate that this install
360 * should immediately be visible to all users.
361 *
362 * @hide
363 */
364 public static final int INSTALL_ALL_USERS = 0x00000040;
365
366 /**
367 * Flag parameter for {@link #installPackage} to indicate that it is okay
368 * to install an update to an app where the newly installed app has a lower
369 * version code than the currently installed app.
370 *
371 * @hide
372 */
373 public static final int INSTALL_ALLOW_DOWNGRADE = 0x00000080;
374
375 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800376 * Flag parameter for
377 * {@link #setComponentEnabledSetting(android.content.ComponentName, int, int)} to indicate
378 * that you don't want to kill the app containing the component. Be careful when you set this
379 * since changing component states can make the containing application's behavior unpredictable.
380 */
381 public static final int DONT_KILL_APP = 0x00000001;
382
383 /**
384 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
385 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} on success.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700386 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800387 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700388 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800389 public static final int INSTALL_SUCCEEDED = 1;
390
391 /**
392 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
393 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if the package is
394 * already installed.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700395 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800396 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700397 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800398 public static final int INSTALL_FAILED_ALREADY_EXISTS = -1;
399
400 /**
401 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
402 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if the package archive
403 * file is invalid.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700404 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800405 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700406 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800407 public static final int INSTALL_FAILED_INVALID_APK = -2;
408
409 /**
410 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
411 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if the URI passed in
412 * is invalid.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700413 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800414 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700415 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800416 public static final int INSTALL_FAILED_INVALID_URI = -3;
417
418 /**
419 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
420 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if the package manager
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700421 * service found that the device didn't have enough storage space to install the app.
422 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800423 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700424 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800425 public static final int INSTALL_FAILED_INSUFFICIENT_STORAGE = -4;
426
427 /**
428 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
429 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if a
430 * package is already installed with the same name.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700431 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800432 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700433 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800434 public static final int INSTALL_FAILED_DUPLICATE_PACKAGE = -5;
435
436 /**
437 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
438 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
439 * the requested shared user does not exist.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700440 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800441 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700442 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800443 public static final int INSTALL_FAILED_NO_SHARED_USER = -6;
444
445 /**
446 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
447 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
448 * a previously installed package of the same name has a different signature
449 * than the new package (and the old package's data was not removed).
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700450 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800451 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700452 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800453 public static final int INSTALL_FAILED_UPDATE_INCOMPATIBLE = -7;
454
455 /**
456 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
457 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
458 * the new package is requested a shared user which is already installed on the
459 * device and does not have matching signature.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700460 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800461 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700462 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800463 public static final int INSTALL_FAILED_SHARED_USER_INCOMPATIBLE = -8;
464
465 /**
466 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
467 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
468 * the new package uses a shared library that is not available.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700469 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800470 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700471 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800472 public static final int INSTALL_FAILED_MISSING_SHARED_LIBRARY = -9;
473
474 /**
475 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
476 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
477 * the new package uses a shared library that is not available.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700478 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800479 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700480 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800481 public static final int INSTALL_FAILED_REPLACE_COULDNT_DELETE = -10;
482
483 /**
484 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
485 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
486 * the new package failed while optimizing and validating its dex files,
487 * either because there was not enough storage or the validation failed.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700488 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800489 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700490 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800491 public static final int INSTALL_FAILED_DEXOPT = -11;
492
493 /**
494 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
495 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
496 * the new package failed because the current SDK version is older than
497 * that required by the package.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700498 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800499 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700500 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800501 public static final int INSTALL_FAILED_OLDER_SDK = -12;
502
503 /**
The Android Open Source Project10592532009-03-18 17:39:46 -0700504 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
505 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
506 * the new package failed because it contains a content provider with the
507 * same authority as a provider already installed in the system.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700508 * @hide
The Android Open Source Project10592532009-03-18 17:39:46 -0700509 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700510 @SystemApi
The Android Open Source Project10592532009-03-18 17:39:46 -0700511 public static final int INSTALL_FAILED_CONFLICTING_PROVIDER = -13;
512
513 /**
Dianne Hackborn851a5412009-05-08 12:06:44 -0700514 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
515 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
516 * the new package failed because the current SDK version is newer than
517 * that required by the package.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700518 * @hide
Dianne Hackborn851a5412009-05-08 12:06:44 -0700519 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700520 @SystemApi
Dianne Hackborn851a5412009-05-08 12:06:44 -0700521 public static final int INSTALL_FAILED_NEWER_SDK = -14;
522
523 /**
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700524 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
525 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
526 * the new package failed because it has specified that it is a test-only
527 * package and the caller has not supplied the {@link #INSTALL_ALLOW_TEST}
528 * flag.
529 * @hide
530 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700531 @SystemApi
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700532 public static final int INSTALL_FAILED_TEST_ONLY = -15;
533
534 /**
Dianne Hackbornb1811182009-05-21 15:45:42 -0700535 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
536 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
537 * the package being installed contains native code, but none that is
Amaury Medeirosdde24262014-06-03 20:06:41 -0300538 * compatible with the device's CPU_ABI.
Dianne Hackbornb1811182009-05-21 15:45:42 -0700539 * @hide
540 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700541 @SystemApi
Dianne Hackbornb1811182009-05-21 15:45:42 -0700542 public static final int INSTALL_FAILED_CPU_ABI_INCOMPATIBLE = -16;
543
544 /**
Dianne Hackborn49237342009-08-27 20:08:01 -0700545 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
546 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
547 * the new package uses a feature that is not available.
548 * @hide
549 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700550 @SystemApi
Dianne Hackborn49237342009-08-27 20:08:01 -0700551 public static final int INSTALL_FAILED_MISSING_FEATURE = -17;
552
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800553 // ------ Errors related to sdcard
554 /**
555 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
556 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
557 * a secure container mount point couldn't be accessed on external media.
558 * @hide
559 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700560 @SystemApi
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800561 public static final int INSTALL_FAILED_CONTAINER_ERROR = -18;
562
Dianne Hackborn49237342009-08-27 20:08:01 -0700563 /**
Suchi Amalapurapub56ae202010-02-04 22:51:07 -0800564 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
565 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
566 * the new package couldn't be installed in the specified install
567 * location.
568 * @hide
569 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700570 @SystemApi
Suchi Amalapurapub56ae202010-02-04 22:51:07 -0800571 public static final int INSTALL_FAILED_INVALID_INSTALL_LOCATION = -19;
572
573 /**
Suchi Amalapurapu8a9ab242010-03-11 16:49:16 -0800574 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
575 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
576 * the new package couldn't be installed in the specified install
577 * location because the media is not available.
578 * @hide
579 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700580 @SystemApi
Suchi Amalapurapu8a9ab242010-03-11 16:49:16 -0800581 public static final int INSTALL_FAILED_MEDIA_UNAVAILABLE = -20;
582
583 /**
Kenny Root5ab21572011-07-27 11:11:19 -0700584 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
585 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
586 * the new package couldn't be installed because the verification timed out.
587 * @hide
588 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700589 @SystemApi
Kenny Root5ab21572011-07-27 11:11:19 -0700590 public static final int INSTALL_FAILED_VERIFICATION_TIMEOUT = -21;
591
592 /**
593 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
594 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
595 * the new package couldn't be installed because the verification did not succeed.
596 * @hide
597 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700598 @SystemApi
Kenny Root5ab21572011-07-27 11:11:19 -0700599 public static final int INSTALL_FAILED_VERIFICATION_FAILURE = -22;
600
601 /**
602 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
603 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
604 * the package changed from what the calling program expected.
605 * @hide
606 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700607 @SystemApi
Kenny Root5ab21572011-07-27 11:11:19 -0700608 public static final int INSTALL_FAILED_PACKAGE_CHANGED = -23;
609
610 /**
Dianne Hackbornd0c5f512012-06-07 16:53:59 -0700611 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
612 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
613 * the new package is assigned a different UID than it previously held.
614 * @hide
615 */
616 public static final int INSTALL_FAILED_UID_CHANGED = -24;
617
618 /**
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700619 * Installation return code: this is passed to the {@link IPackageInstallObserver} by
620 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
621 * the new package has an older version code than the currently installed package.
622 * @hide
623 */
624 public static final int INSTALL_FAILED_VERSION_DOWNGRADE = -25;
625
626 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800627 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
628 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
629 * if the parser was given a path that is not a file, or does not end with the expected
630 * '.apk' extension.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700631 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800632 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700633 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800634 public static final int INSTALL_PARSE_FAILED_NOT_APK = -100;
635
636 /**
637 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
638 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
639 * if the parser was unable to retrieve the AndroidManifest.xml file.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700640 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800641 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700642 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800643 public static final int INSTALL_PARSE_FAILED_BAD_MANIFEST = -101;
644
645 /**
646 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
647 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
648 * if the parser encountered an unexpected exception.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700649 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800650 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700651 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800652 public static final int INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION = -102;
653
654 /**
655 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
656 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
657 * if the parser did not find any certificates in the .apk.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700658 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800659 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700660 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800661 public static final int INSTALL_PARSE_FAILED_NO_CERTIFICATES = -103;
662
663 /**
664 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
665 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
666 * if the parser found inconsistent certificates on the files in the .apk.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700667 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800668 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700669 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800670 public static final int INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES = -104;
671
672 /**
673 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
674 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
675 * if the parser encountered a CertificateEncodingException in one of the
676 * files in the .apk.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700677 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800678 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700679 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800680 public static final int INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING = -105;
681
682 /**
683 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
684 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
685 * if the parser encountered a bad or missing package name in the manifest.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700686 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800687 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700688 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800689 public static final int INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME = -106;
690
691 /**
692 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
693 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
694 * if the parser encountered a bad shared user id name in the manifest.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700695 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800696 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700697 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800698 public static final int INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID = -107;
699
700 /**
701 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
702 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
703 * if the parser encountered some structural problem in the manifest.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700704 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800705 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700706 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800707 public static final int INSTALL_PARSE_FAILED_MANIFEST_MALFORMED = -108;
708
709 /**
710 * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
711 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
712 * if the parser did not find any actionable tags (instrumentation or application)
713 * in the manifest.
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700714 * @hide
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800715 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700716 @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800717 public static final int INSTALL_PARSE_FAILED_MANIFEST_EMPTY = -109;
718
719 /**
Suchi Amalapurapu5b993ce2010-02-12 09:43:29 -0800720 * Installation failed return code: this is passed to the {@link IPackageInstallObserver} by
721 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
722 * if the system failed to install the package because of system issues.
723 * @hide
724 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -0700725 @SystemApi
Suchi Amalapurapu5b993ce2010-02-12 09:43:29 -0800726 public static final int INSTALL_FAILED_INTERNAL_ERROR = -110;
727
728 /**
Amith Yamasanie4cf7342012-12-17 11:12:09 -0800729 * Installation failed return code: this is passed to the {@link IPackageInstallObserver} by
730 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
731 * if the system failed to install the package because the user is restricted from installing
732 * apps.
733 * @hide
734 */
735 public static final int INSTALL_FAILED_USER_RESTRICTED = -111;
736
737 /**
Christopher Tatef1977b42014-03-24 16:25:51 -0700738 * Installation failed return code: this is passed to the {@link IPackageInstallObserver} by
739 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
740 * if the system failed to install the package because it is attempting to define a
741 * permission that is already defined by some existing package.
742 *
743 * <p>The package name of the app which has already defined the permission is passed to
Jeff Sharkeybb580672014-07-10 12:10:25 -0700744 * a {@link PackageInstallObserver}, if any, as the {@link #EXTRA_EXISTING_PACKAGE}
Christopher Tatef1977b42014-03-24 16:25:51 -0700745 * string extra; and the name of the permission being redefined is passed in the
746 * {@link #EXTRA_EXISTING_PERMISSION} string extra.
747 * @hide
748 */
749 public static final int INSTALL_FAILED_DUPLICATE_PERMISSION = -112;
750
751 /**
Narayan Kamathd11f2232014-04-10 10:37:17 +0100752 * Installation failed return code: this is passed to the {@link IPackageInstallObserver} by
753 * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
Ramin Zaghi1378aba2014-02-28 15:03:19 +0000754 * if the system failed to install the package because its packaged native code did not
755 * match any of the ABIs supported by the system.
756 *
757 * @hide
758 */
Narayan Kamathd11f2232014-04-10 10:37:17 +0100759 public static final int INSTALL_FAILED_NO_MATCHING_ABIS = -113;
Ramin Zaghi1378aba2014-02-28 15:03:19 +0000760
761 /**
762 * Internal return code for NativeLibraryHelper methods to indicate that the package
763 * being processed did not contain any native code. This is placed here only so that
764 * it can belong to the same value space as the other install failure codes.
765 *
766 * @hide
767 */
Narayan Kamathd11f2232014-04-10 10:37:17 +0100768 public static final int NO_NATIVE_LIBRARIES = -114;
Ramin Zaghi1378aba2014-02-28 15:03:19 +0000769
Jeff Sharkey7328a1b2014-08-07 14:01:43 -0700770 /** {@hide} */
Jeff Sharkeyf0600952014-08-07 17:31:53 -0700771 public static final int INSTALL_FAILED_ABORTED = -115;
Jeff Sharkey7328a1b2014-08-07 14:01:43 -0700772
Ramin Zaghi1378aba2014-02-28 15:03:19 +0000773 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800774 * Flag parameter for {@link #deletePackage} to indicate that you don't want to delete the
775 * package's data directory.
776 *
777 * @hide
778 */
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700779 public static final int DELETE_KEEP_DATA = 0x00000001;
780
781 /**
782 * Flag parameter for {@link #deletePackage} to indicate that you want the
783 * package deleted for all users.
784 *
785 * @hide
786 */
787 public static final int DELETE_ALL_USERS = 0x00000002;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800788
789 /**
Dianne Hackbornc895be72013-03-11 17:48:43 -0700790 * Flag parameter for {@link #deletePackage} to indicate that, if you are calling
791 * uninstall on a system that has been updated, then don't do the normal process
792 * of uninstalling the update and rolling back to the older system version (which
793 * needs to happen for all users); instead, just mark the app as uninstalled for
794 * the current user.
795 *
796 * @hide
797 */
798 public static final int DELETE_SYSTEM_APP = 0x00000004;
799
800 /**
Kenny Rootc39bb4a2011-02-28 13:27:19 -0800801 * Return code for when package deletion succeeds. This is passed to the
802 * {@link IPackageDeleteObserver} by {@link #deletePackage()} if the system
803 * succeeded in deleting the package.
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700804 *
Kenny Rootc39bb4a2011-02-28 13:27:19 -0800805 * @hide
806 */
807 public static final int DELETE_SUCCEEDED = 1;
808
809 /**
810 * Deletion failed return code: this is passed to the
811 * {@link IPackageDeleteObserver} by {@link #deletePackage()} if the system
812 * failed to delete the package for an unspecified reason.
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700813 *
Kenny Rootc39bb4a2011-02-28 13:27:19 -0800814 * @hide
815 */
816 public static final int DELETE_FAILED_INTERNAL_ERROR = -1;
817
818 /**
819 * Deletion failed return code: this is passed to the
820 * {@link IPackageDeleteObserver} by {@link #deletePackage()} if the system
821 * failed to delete the package because it is the active DevicePolicy
822 * manager.
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700823 *
Kenny Rootc39bb4a2011-02-28 13:27:19 -0800824 * @hide
825 */
826 public static final int DELETE_FAILED_DEVICE_POLICY_MANAGER = -2;
827
828 /**
Amith Yamasanie4cf7342012-12-17 11:12:09 -0800829 * Deletion failed return code: this is passed to the
830 * {@link IPackageDeleteObserver} by {@link #deletePackage()} if the system
831 * failed to delete the package since the user is restricted.
832 *
833 * @hide
834 */
835 public static final int DELETE_FAILED_USER_RESTRICTED = -3;
836
837 /**
Kenny Guy1b88da52014-07-10 16:33:49 +0100838 * Deletion failed return code: this is passed to the
839 * {@link IPackageDeleteObserver} by {@link #deletePackage()} if the system
840 * failed to delete the package because a profile
Kenny Guyc13053b2014-05-29 14:17:17 +0100841 * or device owner has marked the package as uninstallable.
842 *
843 * @hide
844 */
Jeff Sharkeyf0600952014-08-07 17:31:53 -0700845 public static final int DELETE_FAILED_OWNER_BLOCKED = -4;
846
847 /** {@hide} */
848 public static final int DELETE_FAILED_ABORTED = -5;
Kenny Guyc13053b2014-05-29 14:17:17 +0100849
850 /**
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -0800851 * Return code that is passed to the {@link IPackageMoveObserver} by
Kenny Rootc39bb4a2011-02-28 13:27:19 -0800852 * {@link #movePackage(android.net.Uri, IPackageMoveObserver)} when the
853 * package has been successfully moved by the system.
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700854 *
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -0800855 * @hide
856 */
857 public static final int MOVE_SUCCEEDED = 1;
858 /**
859 * Error code that is passed to the {@link IPackageMoveObserver} by
860 * {@link #movePackage(android.net.Uri, IPackageMoveObserver)}
861 * when the package hasn't been successfully moved by the system
862 * because of insufficient memory on specified media.
863 * @hide
864 */
865 public static final int MOVE_FAILED_INSUFFICIENT_STORAGE = -1;
866
867 /**
868 * Error code that is passed to the {@link IPackageMoveObserver} by
869 * {@link #movePackage(android.net.Uri, IPackageMoveObserver)}
870 * if the specified package doesn't exist.
871 * @hide
872 */
873 public static final int MOVE_FAILED_DOESNT_EXIST = -2;
874
875 /**
876 * Error code that is passed to the {@link IPackageMoveObserver} by
877 * {@link #movePackage(android.net.Uri, IPackageMoveObserver)}
878 * if the specified package cannot be moved since its a system package.
879 * @hide
880 */
881 public static final int MOVE_FAILED_SYSTEM_PACKAGE = -3;
882
883 /**
884 * Error code that is passed to the {@link IPackageMoveObserver} by
885 * {@link #movePackage(android.net.Uri, IPackageMoveObserver)}
886 * if the specified package cannot be moved since its forward locked.
887 * @hide
888 */
889 public static final int MOVE_FAILED_FORWARD_LOCKED = -4;
890
891 /**
892 * Error code that is passed to the {@link IPackageMoveObserver} by
893 * {@link #movePackage(android.net.Uri, IPackageMoveObserver)}
894 * if the specified package cannot be moved to the specified location.
895 * @hide
896 */
897 public static final int MOVE_FAILED_INVALID_LOCATION = -5;
898
899 /**
Suchi Amalapurapu8a9ab242010-03-11 16:49:16 -0800900 * Error code that is passed to the {@link IPackageMoveObserver} by
901 * {@link #movePackage(android.net.Uri, IPackageMoveObserver)}
902 * if the specified package cannot be moved to the specified location.
903 * @hide
904 */
905 public static final int MOVE_FAILED_INTERNAL_ERROR = -6;
906
907 /**
Kenny Rootdeb11262010-08-02 11:36:21 -0700908 * Error code that is passed to the {@link IPackageMoveObserver} by
909 * {@link #movePackage(android.net.Uri, IPackageMoveObserver)} if the
910 * specified package already has an operation pending in the
911 * {@link PackageHandler} queue.
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700912 *
Kenny Rootdeb11262010-08-02 11:36:21 -0700913 * @hide
914 */
915 public static final int MOVE_FAILED_OPERATION_PENDING = -7;
916
917 /**
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -0800918 * Flag parameter for {@link #movePackage} to indicate that
919 * the package should be moved to internal storage if its
920 * been installed on external media.
921 * @hide
922 */
923 public static final int MOVE_INTERNAL = 0x00000001;
924
925 /**
926 * Flag parameter for {@link #movePackage} to indicate that
927 * the package should be moved to external media.
928 * @hide
929 */
930 public static final int MOVE_EXTERNAL_MEDIA = 0x00000002;
931
932 /**
Kenny Root05ca4c92011-09-15 10:36:25 -0700933 * Usable by the required verifier as the {@code verificationCode} argument
934 * for {@link PackageManager#verifyPendingInstall} to indicate that it will
935 * allow the installation to proceed without any of the optional verifiers
936 * needing to vote.
937 *
938 * @hide
939 */
940 public static final int VERIFICATION_ALLOW_WITHOUT_SUFFICIENT = 2;
941
942 /**
Kenny Root3a9b5fb2011-09-20 14:15:38 -0700943 * Used as the {@code verificationCode} argument for
944 * {@link PackageManager#verifyPendingInstall} to indicate that the calling
945 * package verifier allows the installation to proceed.
946 */
947 public static final int VERIFICATION_ALLOW = 1;
948
949 /**
950 * Used as the {@code verificationCode} argument for
951 * {@link PackageManager#verifyPendingInstall} to indicate the calling
952 * package verifier does not vote to allow the installation to proceed.
953 */
954 public static final int VERIFICATION_REJECT = -1;
955
956 /**
rich canningsd9ef3e52012-08-22 14:28:05 -0700957 * Can be used as the {@code millisecondsToDelay} argument for
958 * {@link PackageManager#extendVerificationTimeout}. This is the
959 * maximum time {@code PackageManager} waits for the verification
960 * agent to return (in milliseconds).
961 */
962 public static final long MAXIMUM_VERIFICATION_TIMEOUT = 60*60*1000;
963
964 /**
Amith Yamasani0b285492011-04-14 17:35:23 -0700965 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: The device's
966 * audio pipeline is low-latency, more suitable for audio applications sensitive to delays or
967 * lag in sound input or output.
Dan Morrill898e1e82010-09-26 17:28:30 -0700968 */
969 @SdkConstant(SdkConstantType.FEATURE)
970 public static final String FEATURE_AUDIO_LOW_LATENCY = "android.hardware.audio.low_latency";
971
972 /**
973 * Feature for {@link #getSystemAvailableFeatures} and
Unsuk Jung50909f62014-09-02 18:25:49 -0700974 * {@link #hasSystemFeature}: The device includes at least one form of audio
975 * output, such as speakers, audio jack or streaming over bluetooth
976 */
977 @SdkConstant(SdkConstantType.FEATURE)
978 public static final String FEATURE_AUDIO_OUTPUT = "android.hardware.audio.output";
979
980 /**
981 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -0800982 * {@link #hasSystemFeature}: The device is capable of communicating with
983 * other devices via Bluetooth.
984 */
985 @SdkConstant(SdkConstantType.FEATURE)
986 public static final String FEATURE_BLUETOOTH = "android.hardware.bluetooth";
987
988 /**
989 * Feature for {@link #getSystemAvailableFeatures} and
Matthew Xiea7227722013-04-18 15:25:59 -0700990 * {@link #hasSystemFeature}: The device is capable of communicating with
991 * other devices via Bluetooth Low Energy radio.
992 */
993 @SdkConstant(SdkConstantType.FEATURE)
994 public static final String FEATURE_BLUETOOTH_LE = "android.hardware.bluetooth_le";
995
996 /**
997 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn08ee42c2009-11-19 17:08:01 -0800998 * {@link #hasSystemFeature}: The device has a camera facing away
999 * from the screen.
1000 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001001 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001002 public static final String FEATURE_CAMERA = "android.hardware.camera";
Dan Morrill50ab63f2010-03-05 16:16:19 -08001003
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001004 /**
1005 * Feature for {@link #getSystemAvailableFeatures} and
1006 * {@link #hasSystemFeature}: The device's camera supports auto-focus.
1007 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001008 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001009 public static final String FEATURE_CAMERA_AUTOFOCUS = "android.hardware.camera.autofocus";
Dan Morrill50ab63f2010-03-05 16:16:19 -08001010
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001011 /**
1012 * Feature for {@link #getSystemAvailableFeatures} and
Eino-Ville Talvala752af832012-09-18 14:45:37 -07001013 * {@link #hasSystemFeature}: The device has at least one camera pointing in
Eino-Ville Talvala9131da22014-05-08 11:39:53 -07001014 * some direction, or can support an external camera being connected to it.
Eino-Ville Talvala752af832012-09-18 14:45:37 -07001015 */
1016 @SdkConstant(SdkConstantType.FEATURE)
1017 public static final String FEATURE_CAMERA_ANY = "android.hardware.camera.any";
1018
1019 /**
1020 * Feature for {@link #getSystemAvailableFeatures} and
Eino-Ville Talvala9131da22014-05-08 11:39:53 -07001021 * {@link #hasSystemFeature}: The device can support having an external camera connected to it.
1022 * The external camera may not always be connected or available to applications to use.
1023 */
1024 @SdkConstant(SdkConstantType.FEATURE)
1025 public static final String FEATURE_CAMERA_EXTERNAL = "android.hardware.camera.external";
1026
1027 /**
1028 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001029 * {@link #hasSystemFeature}: The device's camera supports flash.
1030 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001031 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001032 public static final String FEATURE_CAMERA_FLASH = "android.hardware.camera.flash";
Dan Morrill50ab63f2010-03-05 16:16:19 -08001033
1034 /**
1035 * Feature for {@link #getSystemAvailableFeatures} and
Chih-Chung Changde1057c2010-06-14 19:15:00 +08001036 * {@link #hasSystemFeature}: The device has a front facing camera.
1037 */
1038 @SdkConstant(SdkConstantType.FEATURE)
1039 public static final String FEATURE_CAMERA_FRONT = "android.hardware.camera.front";
1040
1041 /**
Eino-Ville Talvala611fece2014-07-10 17:29:38 -07001042 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one
1043 * of the cameras on the device supports the
1044 * {@link android.hardware.camera2.CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL full hardware}
1045 * capability level.
1046 */
1047 @SdkConstant(SdkConstantType.FEATURE)
1048 public static final String FEATURE_CAMERA_LEVEL_FULL = "android.hardware.camera.level.full";
1049
1050 /**
1051 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one
1052 * of the cameras on the device supports the
1053 * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR manual sensor}
1054 * capability level.
1055 */
1056 @SdkConstant(SdkConstantType.FEATURE)
1057 public static final String FEATURE_CAMERA_CAPABILITY_MANUAL_SENSOR =
1058 "android.hardware.camera.capability.manual_sensor";
1059
1060 /**
1061 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one
1062 * of the cameras on the device supports the
1063 * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MANUAL_POST_PROCESSING manual post-processing}
1064 * capability level.
1065 */
1066 @SdkConstant(SdkConstantType.FEATURE)
1067 public static final String FEATURE_CAMERA_CAPABILITY_MANUAL_POST_PROCESSING =
1068 "android.hardware.camera.capability.manual_post_processing";
1069
1070 /**
1071 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one
1072 * of the cameras on the device supports the
1073 * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_RAW RAW}
1074 * capability level.
1075 */
1076 @SdkConstant(SdkConstantType.FEATURE)
1077 public static final String FEATURE_CAMERA_CAPABILITY_RAW =
1078 "android.hardware.camera.capability.raw";
1079
1080 /**
Chih-Chung Changde1057c2010-06-14 19:15:00 +08001081 * Feature for {@link #getSystemAvailableFeatures} and
Alex Ray0c9d61f2013-10-03 12:17:54 -07001082 * {@link #hasSystemFeature}: The device is capable of communicating with
1083 * consumer IR devices.
1084 */
1085 @SdkConstant(SdkConstantType.FEATURE)
1086 public static final String FEATURE_CONSUMER_IR = "android.hardware.consumerir";
1087
1088 /**
1089 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001090 * {@link #hasSystemFeature}: The device supports one or more methods of
1091 * reporting current location.
1092 */
1093 @SdkConstant(SdkConstantType.FEATURE)
1094 public static final String FEATURE_LOCATION = "android.hardware.location";
1095
1096 /**
1097 * Feature for {@link #getSystemAvailableFeatures} and
1098 * {@link #hasSystemFeature}: The device has a Global Positioning System
1099 * receiver and can report precise location.
1100 */
1101 @SdkConstant(SdkConstantType.FEATURE)
1102 public static final String FEATURE_LOCATION_GPS = "android.hardware.location.gps";
1103
1104 /**
1105 * Feature for {@link #getSystemAvailableFeatures} and
1106 * {@link #hasSystemFeature}: The device can report location with coarse
1107 * accuracy using a network-based geolocation system.
1108 */
1109 @SdkConstant(SdkConstantType.FEATURE)
1110 public static final String FEATURE_LOCATION_NETWORK = "android.hardware.location.network";
1111
1112 /**
1113 * Feature for {@link #getSystemAvailableFeatures} and
1114 * {@link #hasSystemFeature}: The device can record audio via a
1115 * microphone.
1116 */
1117 @SdkConstant(SdkConstantType.FEATURE)
1118 public static final String FEATURE_MICROPHONE = "android.hardware.microphone";
1119
1120 /**
1121 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill76437d32010-09-01 11:17:20 -07001122 * {@link #hasSystemFeature}: The device can communicate using Near-Field
1123 * Communications (NFC).
1124 */
1125 @SdkConstant(SdkConstantType.FEATURE)
1126 public static final String FEATURE_NFC = "android.hardware.nfc";
1127
1128 /**
1129 * Feature for {@link #getSystemAvailableFeatures} and
Martijn Coenenf4bf1582013-07-22 12:01:19 -07001130 * {@link #hasSystemFeature}: The device supports host-
1131 * based NFC card emulation.
Martijn Coenendf4d1d62013-08-28 11:18:58 -07001132 *
1133 * TODO remove when depending apps have moved to new constant.
1134 * @hide
1135 * @deprecated
Martijn Coenenf4bf1582013-07-22 12:01:19 -07001136 */
Jose Lima970417c2014-04-10 10:42:19 -07001137 @Deprecated
Martijn Coenenf4bf1582013-07-22 12:01:19 -07001138 @SdkConstant(SdkConstantType.FEATURE)
1139 public static final String FEATURE_NFC_HCE = "android.hardware.nfc.hce";
1140
1141 /**
1142 * Feature for {@link #getSystemAvailableFeatures} and
Martijn Coenendf4d1d62013-08-28 11:18:58 -07001143 * {@link #hasSystemFeature}: The device supports host-
1144 * based NFC card emulation.
1145 */
1146 @SdkConstant(SdkConstantType.FEATURE)
1147 public static final String FEATURE_NFC_HOST_CARD_EMULATION = "android.hardware.nfc.hce";
1148
1149 /**
1150 * Feature for {@link #getSystemAvailableFeatures} and
Jesse Hall7f517062014-07-18 11:54:41 -07001151 * {@link #hasSystemFeature}: The device supports the OpenGL ES
1152 * <a href="http://www.khronos.org/registry/gles/extensions/ANDROID/ANDROID_extension_pack_es31a.txt">
1153 * Android Extension Pack</a>.
1154 */
1155 @SdkConstant(SdkConstantType.FEATURE)
1156 public static final String FEATURE_OPENGLES_EXTENSION_PACK = "android.hardware.opengles.aep";
1157
1158 /**
1159 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill5744bb42010-09-01 19:18:57 -07001160 * {@link #hasSystemFeature}: The device includes an accelerometer.
1161 */
1162 @SdkConstant(SdkConstantType.FEATURE)
1163 public static final String FEATURE_SENSOR_ACCELEROMETER = "android.hardware.sensor.accelerometer";
1164
1165 /**
1166 * Feature for {@link #getSystemAvailableFeatures} and
1167 * {@link #hasSystemFeature}: The device includes a barometer (air
1168 * pressure sensor.)
1169 */
1170 @SdkConstant(SdkConstantType.FEATURE)
1171 public static final String FEATURE_SENSOR_BAROMETER = "android.hardware.sensor.barometer";
1172
1173 /**
1174 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001175 * {@link #hasSystemFeature}: The device includes a magnetometer (compass).
1176 */
1177 @SdkConstant(SdkConstantType.FEATURE)
1178 public static final String FEATURE_SENSOR_COMPASS = "android.hardware.sensor.compass";
1179
1180 /**
1181 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill5744bb42010-09-01 19:18:57 -07001182 * {@link #hasSystemFeature}: The device includes a gyroscope.
Dan Morrill50ab63f2010-03-05 16:16:19 -08001183 */
1184 @SdkConstant(SdkConstantType.FEATURE)
Dan Morrill5744bb42010-09-01 19:18:57 -07001185 public static final String FEATURE_SENSOR_GYROSCOPE = "android.hardware.sensor.gyroscope";
Dan Morrill50ab63f2010-03-05 16:16:19 -08001186
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001187 /**
1188 * Feature for {@link #getSystemAvailableFeatures} and
1189 * {@link #hasSystemFeature}: The device includes a light sensor.
1190 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001191 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001192 public static final String FEATURE_SENSOR_LIGHT = "android.hardware.sensor.light";
Dan Morrill50ab63f2010-03-05 16:16:19 -08001193
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001194 /**
1195 * Feature for {@link #getSystemAvailableFeatures} and
1196 * {@link #hasSystemFeature}: The device includes a proximity sensor.
1197 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001198 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001199 public static final String FEATURE_SENSOR_PROXIMITY = "android.hardware.sensor.proximity";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001200
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001201 /**
1202 * Feature for {@link #getSystemAvailableFeatures} and
Aravind Akella068b0c02013-10-12 17:39:15 -07001203 * {@link #hasSystemFeature}: The device includes a hardware step counter.
1204 */
1205 @SdkConstant(SdkConstantType.FEATURE)
1206 public static final String FEATURE_SENSOR_STEP_COUNTER = "android.hardware.sensor.stepcounter";
1207
1208 /**
1209 * Feature for {@link #getSystemAvailableFeatures} and
1210 * {@link #hasSystemFeature}: The device includes a hardware step detector.
1211 */
1212 @SdkConstant(SdkConstantType.FEATURE)
1213 public static final String FEATURE_SENSOR_STEP_DETECTOR = "android.hardware.sensor.stepdetector";
1214
1215 /**
1216 * Feature for {@link #getSystemAvailableFeatures} and
Vinod Krishnan8afb23c2014-04-30 11:11:39 -07001217 * {@link #hasSystemFeature}: The device includes a heart rate monitor.
1218 */
1219 @SdkConstant(SdkConstantType.FEATURE)
1220 public static final String FEATURE_SENSOR_HEART_RATE = "android.hardware.sensor.heartrate";
1221
1222 /**
1223 * Feature for {@link #getSystemAvailableFeatures} and
Vinod Krishnan1ab76892014-08-20 11:11:55 -07001224 * {@link #hasSystemFeature}: The heart rate sensor on this device is an Electrocargiogram.
1225 */
1226 @SdkConstant(SdkConstantType.FEATURE)
1227 public static final String FEATURE_SENSOR_HEART_RATE_ECG =
1228 "android.hardware.sensor.heartrate.ecg";
1229
1230 /**
1231 * Feature for {@link #getSystemAvailableFeatures} and
Aravind Akella8b8e74b2014-07-09 11:52:39 -07001232 * {@link #hasSystemFeature}: The device includes a relative humidity sensor.
1233 */
1234 @SdkConstant(SdkConstantType.FEATURE)
1235 public static final String FEATURE_SENSOR_RELATIVE_HUMIDITY =
1236 "android.hardware.sensor.relative_humidity";
1237
1238 /**
1239 * Feature for {@link #getSystemAvailableFeatures} and
1240 * {@link #hasSystemFeature}: The device includes an ambient temperature sensor.
1241 */
1242 @SdkConstant(SdkConstantType.FEATURE)
1243 public static final String FEATURE_SENSOR_AMBIENT_TEMPERATURE =
1244 "android.hardware.sensor.ambient_temperature";
1245
1246 /**
1247 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001248 * {@link #hasSystemFeature}: The device has a telephony radio with data
1249 * communication support.
1250 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001251 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001252 public static final String FEATURE_TELEPHONY = "android.hardware.telephony";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001253
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001254 /**
1255 * Feature for {@link #getSystemAvailableFeatures} and
1256 * {@link #hasSystemFeature}: The device has a CDMA telephony stack.
1257 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001258 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001259 public static final String FEATURE_TELEPHONY_CDMA = "android.hardware.telephony.cdma";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001260
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001261 /**
1262 * Feature for {@link #getSystemAvailableFeatures} and
1263 * {@link #hasSystemFeature}: The device has a GSM telephony stack.
1264 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001265 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001266 public static final String FEATURE_TELEPHONY_GSM = "android.hardware.telephony.gsm";
Hung-ying Tyan3424c022010-08-27 18:08:19 +08001267
1268 /**
1269 * Feature for {@link #getSystemAvailableFeatures} and
Mike Lockwoodf4ca2472011-02-27 11:23:25 -08001270 * {@link #hasSystemFeature}: The device supports connecting to USB devices
1271 * as the USB host.
1272 */
1273 @SdkConstant(SdkConstantType.FEATURE)
1274 public static final String FEATURE_USB_HOST = "android.hardware.usb.host";
1275
1276 /**
1277 * Feature for {@link #getSystemAvailableFeatures} and
1278 * {@link #hasSystemFeature}: The device supports connecting to USB accessories.
1279 */
1280 @SdkConstant(SdkConstantType.FEATURE)
1281 public static final String FEATURE_USB_ACCESSORY = "android.hardware.usb.accessory";
1282
1283 /**
1284 * Feature for {@link #getSystemAvailableFeatures} and
Hung-ying Tyan3424c022010-08-27 18:08:19 +08001285 * {@link #hasSystemFeature}: The SIP API is enabled on the device.
1286 */
1287 @SdkConstant(SdkConstantType.FEATURE)
1288 public static final String FEATURE_SIP = "android.software.sip";
1289
1290 /**
1291 * Feature for {@link #getSystemAvailableFeatures} and
1292 * {@link #hasSystemFeature}: The device supports SIP-based VOIP.
1293 */
1294 @SdkConstant(SdkConstantType.FEATURE)
1295 public static final String FEATURE_SIP_VOIP = "android.software.sip.voip";
1296
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001297 /**
1298 * Feature for {@link #getSystemAvailableFeatures} and
Ihab Awad1ec68882014-09-12 11:09:01 -07001299 * {@link #hasSystemFeature}: The Connection Service API is enabled on the device.
1300 */
1301 @SdkConstant(SdkConstantType.FEATURE)
1302 public static final String FEATURE_CONNECTION_SERVICE = "android.software.connectionservice";
1303
1304 /**
1305 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrillb0fe0332010-04-05 14:43:58 -07001306 * {@link #hasSystemFeature}: The device's display has a touch screen.
1307 */
1308 @SdkConstant(SdkConstantType.FEATURE)
1309 public static final String FEATURE_TOUCHSCREEN = "android.hardware.touchscreen";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001310
Dan Morrillb0fe0332010-04-05 14:43:58 -07001311 /**
1312 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001313 * {@link #hasSystemFeature}: The device's touch screen supports
1314 * multitouch sufficient for basic two-finger gesture detection.
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001315 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001316 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001317 public static final String FEATURE_TOUCHSCREEN_MULTITOUCH = "android.hardware.touchscreen.multitouch";
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001318
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001319 /**
1320 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001321 * {@link #hasSystemFeature}: The device's touch screen is capable of
1322 * tracking two or more fingers fully independently.
1323 */
1324 @SdkConstant(SdkConstantType.FEATURE)
1325 public static final String FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT = "android.hardware.touchscreen.multitouch.distinct";
1326
1327 /**
1328 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill6993d3d2010-09-03 14:30:14 -07001329 * {@link #hasSystemFeature}: The device's touch screen is capable of
1330 * tracking a full hand of fingers fully independently -- that is, 5 or
1331 * more simultaneous independent pointers.
1332 */
1333 @SdkConstant(SdkConstantType.FEATURE)
1334 public static final String FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND = "android.hardware.touchscreen.multitouch.jazzhand";
1335
1336 /**
1337 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrilla5376872011-01-23 13:15:53 -08001338 * {@link #hasSystemFeature}: The device does not have a touch screen, but
1339 * does support touch emulation for basic events. For instance, the
1340 * device might use a mouse or remote control to drive a cursor, and
1341 * emulate basic touch pointer events like down, up, drag, etc. All
1342 * devices that support android.hardware.touchscreen or a sub-feature are
1343 * presumed to also support faketouch.
1344 */
1345 @SdkConstant(SdkConstantType.FEATURE)
1346 public static final String FEATURE_FAKETOUCH = "android.hardware.faketouch";
1347
1348 /**
1349 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborne22fe932011-06-08 20:24:29 -07001350 * {@link #hasSystemFeature}: The device does not have a touch screen, but
1351 * does support touch emulation for basic events that supports distinct
1352 * tracking of two or more fingers. This is an extension of
1353 * {@link #FEATURE_FAKETOUCH} for input devices with this capability. Note
1354 * that unlike a distinct multitouch screen as defined by
1355 * {@link #FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT}, these kinds of input
1356 * devices will not actually provide full two-finger gestures since the
1357 * input is being transformed to cursor movement on the screen. That is,
1358 * single finger gestures will move a cursor; two-finger swipes will
1359 * result in single-finger touch events; other two-finger gestures will
1360 * result in the corresponding two-finger touch event.
1361 */
1362 @SdkConstant(SdkConstantType.FEATURE)
1363 public static final String FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT = "android.hardware.faketouch.multitouch.distinct";
1364
1365 /**
1366 * Feature for {@link #getSystemAvailableFeatures} and
1367 * {@link #hasSystemFeature}: The device does not have a touch screen, but
1368 * does support touch emulation for basic events that supports tracking
1369 * a hand of fingers (5 or more fingers) fully independently.
1370 * This is an extension of
1371 * {@link #FEATURE_FAKETOUCH} for input devices with this capability. Note
1372 * that unlike a multitouch screen as defined by
1373 * {@link #FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND}, not all two finger
1374 * gestures can be detected due to the limitations described for
1375 * {@link #FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT}.
1376 */
1377 @SdkConstant(SdkConstantType.FEATURE)
1378 public static final String FEATURE_FAKETOUCH_MULTITOUCH_JAZZHAND = "android.hardware.faketouch.multitouch.jazzhand";
1379
1380 /**
1381 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborne289bff2011-06-13 19:33:22 -07001382 * {@link #hasSystemFeature}: The device supports portrait orientation
1383 * screens. For backwards compatibility, you can assume that if neither
1384 * this nor {@link #FEATURE_SCREEN_LANDSCAPE} is set then the device supports
1385 * both portrait and landscape.
1386 */
1387 @SdkConstant(SdkConstantType.FEATURE)
1388 public static final String FEATURE_SCREEN_PORTRAIT = "android.hardware.screen.portrait";
1389
1390 /**
1391 * Feature for {@link #getSystemAvailableFeatures} and
1392 * {@link #hasSystemFeature}: The device supports landscape orientation
1393 * screens. For backwards compatibility, you can assume that if neither
1394 * this nor {@link #FEATURE_SCREEN_PORTRAIT} is set then the device supports
1395 * both portrait and landscape.
1396 */
1397 @SdkConstant(SdkConstantType.FEATURE)
1398 public static final String FEATURE_SCREEN_LANDSCAPE = "android.hardware.screen.landscape";
1399
1400 /**
1401 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001402 * {@link #hasSystemFeature}: The device supports live wallpapers.
1403 */
Xavier Ducrohet3274b9b2009-12-14 17:52:20 -08001404 @SdkConstant(SdkConstantType.FEATURE)
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001405 public static final String FEATURE_LIVE_WALLPAPER = "android.software.live_wallpaper";
Oscar Montemayor1228d0a2010-01-28 12:01:44 -08001406 /**
Dan Morrill50ab63f2010-03-05 16:16:19 -08001407 * Feature for {@link #getSystemAvailableFeatures} and
Dianne Hackborn119bbc32013-03-22 17:27:25 -07001408 * {@link #hasSystemFeature}: The device supports app widgets.
1409 */
1410 @SdkConstant(SdkConstantType.FEATURE)
1411 public static final String FEATURE_APP_WIDGETS = "android.software.app_widgets";
1412
1413 /**
Dianne Hackborn91097de2014-04-04 18:02:06 -07001414 * @hide
1415 * Feature for {@link #getSystemAvailableFeatures} and
1416 * {@link #hasSystemFeature}: The device supports
1417 * {@link android.service.voice.VoiceInteractionService} and
1418 * {@link android.app.VoiceInteractor}.
1419 */
1420 @SdkConstant(SdkConstantType.FEATURE)
1421 public static final String FEATURE_VOICE_RECOGNIZERS = "android.software.voice_recognizers";
1422
1423
1424 /**
Dianne Hackborn119bbc32013-03-22 17:27:25 -07001425 * Feature for {@link #getSystemAvailableFeatures} and
1426 * {@link #hasSystemFeature}: The device supports a home screen that is replaceable
1427 * by third party applications.
1428 */
1429 @SdkConstant(SdkConstantType.FEATURE)
1430 public static final String FEATURE_HOME_SCREEN = "android.software.home_screen";
1431
1432 /**
1433 * Feature for {@link #getSystemAvailableFeatures} and
1434 * {@link #hasSystemFeature}: The device supports adding new input methods implemented
1435 * with the {@link android.inputmethodservice.InputMethodService} API.
1436 */
1437 @SdkConstant(SdkConstantType.FEATURE)
1438 public static final String FEATURE_INPUT_METHODS = "android.software.input_methods";
1439
1440 /**
1441 * Feature for {@link #getSystemAvailableFeatures} and
Amith Yamasani44a01b72013-09-16 10:44:57 -07001442 * {@link #hasSystemFeature}: The device supports device policy enforcement via device admins.
1443 */
1444 @SdkConstant(SdkConstantType.FEATURE)
1445 public static final String FEATURE_DEVICE_ADMIN = "android.software.device_admin";
1446
1447 /**
1448 * Feature for {@link #getSystemAvailableFeatures} and
Tim Kilbournf94b6a92014-03-07 15:13:48 -08001449 * {@link #hasSystemFeature}: The device supports leanback UI. This is
1450 * typically used in a living room television experience, but is a software
1451 * feature unlike {@link #FEATURE_TELEVISION}. Devices running with this
1452 * feature will use resources associated with the "television" UI mode.
1453 */
1454 @SdkConstant(SdkConstantType.FEATURE)
1455 public static final String FEATURE_LEANBACK = "android.software.leanback";
1456
1457 /**
1458 * Feature for {@link #getSystemAvailableFeatures} and
1459 * {@link #hasSystemFeature}: The device supports only leanback UI. Only
1460 * applications designed for this experience should be run, though this is
1461 * not enforced by the system.
1462 * @hide
1463 */
1464 @SdkConstant(SdkConstantType.FEATURE)
1465 public static final String FEATURE_LEANBACK_ONLY = "android.software.leanback_only";
1466
1467 /**
1468 * Feature for {@link #getSystemAvailableFeatures} and
Jae Seocfd861e2014-08-27 14:02:15 -07001469 * {@link #hasSystemFeature}: The device supports live TV and can display
1470 * contents from TV inputs implemented with the
1471 * {@link android.media.tv.TvInputService} API.
1472 */
1473 @SdkConstant(SdkConstantType.FEATURE)
1474 public static final String FEATURE_LIVE_TV = "android.software.live_tv";
1475
1476 /**
1477 * Feature for {@link #getSystemAvailableFeatures} and
Dan Morrill50ab63f2010-03-05 16:16:19 -08001478 * {@link #hasSystemFeature}: The device supports WiFi (802.11) networking.
1479 */
1480 @SdkConstant(SdkConstantType.FEATURE)
1481 public static final String FEATURE_WIFI = "android.hardware.wifi";
1482
1483 /**
Irfan Sheriff45b8b462011-09-07 11:24:16 -07001484 * Feature for {@link #getSystemAvailableFeatures} and
1485 * {@link #hasSystemFeature}: The device supports Wi-Fi Direct networking.
1486 */
1487 @SdkConstant(SdkConstantType.FEATURE)
1488 public static final String FEATURE_WIFI_DIRECT = "android.hardware.wifi.direct";
1489
1490 /**
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07001491 * Feature for {@link #getSystemAvailableFeatures} and
1492 * {@link #hasSystemFeature}: This is a device dedicated to showing UI
1493 * on a television. Television here is defined to be a typical living
1494 * room television experience: displayed on a big screen, where the user
1495 * is sitting far away from it, and the dominant form of input will be
1496 * something like a DPAD, not through touch or mouse.
Tim Kilbournf94b6a92014-03-07 15:13:48 -08001497 * @deprecated use {@link #FEATURE_LEANBACK} instead.
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07001498 */
Jose Lima970417c2014-04-10 10:42:19 -07001499 @Deprecated
Dianne Hackborn0cf2c8a2012-05-17 17:29:49 -07001500 @SdkConstant(SdkConstantType.FEATURE)
1501 public static final String FEATURE_TELEVISION = "android.hardware.type.television";
1502
1503 /**
Justin Kohb5731f02014-02-13 16:06:59 -08001504 * Feature for {@link #getSystemAvailableFeatures} and
1505 * {@link #hasSystemFeature}: This is a device dedicated to showing UI
1506 * on a watch. A watch here is defined to be a device worn on the body, perhaps on
1507 * the wrist. The user is very close when interacting with the device.
1508 */
1509 @SdkConstant(SdkConstantType.FEATURE)
1510 public static final String FEATURE_WATCH = "android.hardware.type.watch";
1511
1512 /**
Adam Lesinski3d9bcb92014-02-18 14:05:14 -08001513 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
1514 * The device supports printing.
1515 */
1516 @SdkConstant(SdkConstantType.FEATURE)
1517 public static final String FEATURE_PRINTING = "android.software.print";
1518
1519 /**
1520 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
1521 * The device can perform backup and restore operations on installed applications.
1522 */
1523 @SdkConstant(SdkConstantType.FEATURE)
1524 public static final String FEATURE_BACKUP = "android.software.backup";
1525
1526 /**
Adam Connors23cc04e2014-04-01 12:12:20 +01001527 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Amith Yamasani1d653272014-09-11 17:56:05 -07001528 * The device supports creating secondary users and managed profiles via
1529 * {@link DevicePolicyManager}.
Adam Connors23cc04e2014-04-01 12:12:20 +01001530 */
1531 @SdkConstant(SdkConstantType.FEATURE)
Amith Yamasani1d653272014-09-11 17:56:05 -07001532 public static final String FEATURE_MANAGED_USERS = "android.software.managed_users";
1533
1534 /**
1535 * @hide
1536 * TODO: Remove after dependencies updated b/17392243
1537 */
1538 public static final String FEATURE_MANAGED_PROFILES = "android.software.managed_users";
Adam Connors23cc04e2014-04-01 12:12:20 +01001539
1540 /**
Ben Murdochf564c7f2014-05-20 18:58:06 +01001541 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Adam Connors19ccb5f2014-09-08 17:31:50 +01001542 * The device supports verified boot.
1543 */
1544 @SdkConstant(SdkConstantType.FEATURE)
1545 public static final String FEATURE_VERIFIED_BOOT = "android.software.verified_boot";
1546
1547 /**
1548 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
1549 * The device supports secure removal of users. When a user is deleted the data associated
1550 * with that user is securely deleted and no longer available.
1551 */
1552 @SdkConstant(SdkConstantType.FEATURE)
1553 public static final String FEATURE_SECURELY_REMOVES_USERS
1554 = "android.software.securely_removes_users";
1555
1556 /**
1557 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
Ben Murdoch422c7a52014-05-16 13:45:47 +01001558 * The device has a full implementation of the android.webkit.* APIs. Devices
1559 * lacking this feature will not have a functioning WebView implementation.
1560 */
1561 @SdkConstant(SdkConstantType.FEATURE)
1562 public static final String FEATURE_WEBVIEW = "android.software.webview";
1563
1564 /**
Joe LaPenna4bb015d2014-07-04 17:15:54 -07001565 * Feature for {@link #getSystemAvailableFeatures} and
1566 * {@link #hasSystemFeature}: This device supports ethernet.
1567 * @hide
1568 */
1569 @SdkConstant(SdkConstantType.FEATURE)
1570 public static final String FEATURE_ETHERNET = "android.hardware.ethernet";
1571
1572 /**
Yuncheol Heoa0c4a062014-07-10 20:49:27 +09001573 * Feature for {@link #getSystemAvailableFeatures} and
1574 * {@link #hasSystemFeature}: This device supports HDMI-CEC.
1575 * @hide
1576 */
1577 @SdkConstant(SdkConstantType.FEATURE)
1578 public static final String FEATURE_HDMI_CEC = "android.hardware.hdmi.cec";
1579
1580 /**
Michael Wright6faa6752014-09-05 17:57:44 -07001581 * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
1582 * The device has all of the inputs necessary to be considered a compatible game controller, or
1583 * includes a compatible game controller in the box.
1584 */
1585 @SdkConstant(SdkConstantType.FEATURE)
1586 public static final String FEATURE_GAMEPAD = "android.hardware.gamepad";
1587
1588
1589 /**
Dianne Hackborne83cefc2010-02-04 17:38:14 -08001590 * Action to external storage service to clean out removed apps.
1591 * @hide
1592 */
1593 public static final String ACTION_CLEAN_EXTERNAL_STORAGE
1594 = "android.content.pm.CLEAN_EXTERNAL_STORAGE";
Oscar Montemayor1228d0a2010-01-28 12:01:44 -08001595
Dianne Hackborn08ee42c2009-11-19 17:08:01 -08001596 /**
Kenny Root5ab21572011-07-27 11:11:19 -07001597 * Extra field name for the URI to a verification file. Passed to a package
1598 * verifier.
1599 *
1600 * @hide
1601 */
1602 public static final String EXTRA_VERIFICATION_URI = "android.content.pm.extra.VERIFICATION_URI";
1603
1604 /**
1605 * Extra field name for the ID of a package pending verification. Passed to
1606 * a package verifier and is used to call back to
Kenny Root3a9b5fb2011-09-20 14:15:38 -07001607 * {@link PackageManager#verifyPendingInstall(int, int)}
Kenny Root5ab21572011-07-27 11:11:19 -07001608 */
1609 public static final String EXTRA_VERIFICATION_ID = "android.content.pm.extra.VERIFICATION_ID";
1610
1611 /**
1612 * Extra field name for the package identifier which is trying to install
1613 * the package.
1614 *
1615 * @hide
1616 */
1617 public static final String EXTRA_VERIFICATION_INSTALLER_PACKAGE
1618 = "android.content.pm.extra.VERIFICATION_INSTALLER_PACKAGE";
1619
1620 /**
1621 * Extra field name for the requested install flags for a package pending
1622 * verification. Passed to a package verifier.
1623 *
1624 * @hide
1625 */
1626 public static final String EXTRA_VERIFICATION_INSTALL_FLAGS
1627 = "android.content.pm.extra.VERIFICATION_INSTALL_FLAGS";
1628
1629 /**
rich cannings13d428e2012-09-13 13:43:07 -07001630 * Extra field name for the uid of who is requesting to install
1631 * the package.
1632 *
1633 * @hide
1634 */
1635 public static final String EXTRA_VERIFICATION_INSTALLER_UID
1636 = "android.content.pm.extra.VERIFICATION_INSTALLER_UID";
1637
1638 /**
1639 * Extra field name for the package name of a package pending verification.
1640 *
1641 * @hide
1642 */
1643 public static final String EXTRA_VERIFICATION_PACKAGE_NAME
1644 = "android.content.pm.extra.VERIFICATION_PACKAGE_NAME";
1645 /**
rich canningsd1b5cfc2012-08-29 14:49:51 -07001646 * Extra field name for the result of a verification, either
1647 * {@link #VERIFICATION_ALLOW}, or {@link #VERIFICATION_REJECT}.
1648 * Passed to package verifiers after a package is verified.
1649 */
1650 public static final String EXTRA_VERIFICATION_RESULT
1651 = "android.content.pm.extra.VERIFICATION_RESULT";
1652
1653 /**
rich cannings13d428e2012-09-13 13:43:07 -07001654 * Extra field name for the version code of a package pending verification.
1655 *
1656 * @hide
1657 */
1658 public static final String EXTRA_VERIFICATION_VERSION_CODE
1659 = "android.content.pm.extra.VERIFICATION_VERSION_CODE";
1660
1661 /**
Nick Kralevich035f80d2013-03-27 15:20:08 -07001662 * The action used to request that the user approve a permission request
1663 * from the application.
1664 *
1665 * @hide
1666 */
1667 public static final String ACTION_REQUEST_PERMISSION
1668 = "android.content.pm.action.REQUEST_PERMISSION";
1669
1670 /**
1671 * Extra field name for the list of permissions, which the user must approve.
1672 *
1673 * @hide
1674 */
1675 public static final String EXTRA_REQUEST_PERMISSION_PERMISSION_LIST
1676 = "android.content.pm.extra.PERMISSION_LIST";
1677
1678 /**
Jeff Sharkeybb580672014-07-10 12:10:25 -07001679 * String extra for {@link PackageInstallObserver} in the 'extras' Bundle in case of
Christopher Tatef1977b42014-03-24 16:25:51 -07001680 * {@link #INSTALL_FAILED_DUPLICATE_PERMISSION}. This extra names the package which provides
1681 * the existing definition for the permission.
1682 * @hide
1683 */
1684 public static final String EXTRA_FAILURE_EXISTING_PACKAGE
1685 = "android.content.pm.extra.FAILURE_EXISTING_PACKAGE";
1686
1687 /**
Jeff Sharkeybb580672014-07-10 12:10:25 -07001688 * String extra for {@link PackageInstallObserver} in the 'extras' Bundle in case of
Christopher Tatef1977b42014-03-24 16:25:51 -07001689 * {@link #INSTALL_FAILED_DUPLICATE_PERMISSION}. This extra names the permission that is
1690 * being redundantly defined by the package being installed.
1691 * @hide
1692 */
1693 public static final String EXTRA_FAILURE_EXISTING_PERMISSION
1694 = "android.content.pm.extra.FAILURE_EXISTING_PERMISSION";
1695
1696 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001697 * Retrieve overall information about an application package that is
1698 * installed on the system.
Kenny Root5ab21572011-07-27 11:11:19 -07001699 * <p>
1700 * Throws {@link NameNotFoundException} if a package with the given name can
1701 * not be found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001702 *
1703 * @param packageName The full name (i.e. com.google.apps.contacts) of the
Kenny Root5ab21572011-07-27 11:11:19 -07001704 * desired package.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001705 * @param flags Additional option flags. Use any combination of
Kenny Root5ab21572011-07-27 11:11:19 -07001706 * {@link #GET_ACTIVITIES}, {@link #GET_GIDS},
1707 * {@link #GET_CONFIGURATIONS}, {@link #GET_INSTRUMENTATION},
1708 * {@link #GET_PERMISSIONS}, {@link #GET_PROVIDERS},
1709 * {@link #GET_RECEIVERS}, {@link #GET_SERVICES},
1710 * {@link #GET_SIGNATURES}, {@link #GET_UNINSTALLED_PACKAGES} to
1711 * modify the data returned.
1712 * @return Returns a PackageInfo object containing information about the
1713 * package. If flag GET_UNINSTALLED_PACKAGES is set and if the
1714 * package is not found in the list of installed applications, the
1715 * package information is retrieved from the list of uninstalled
kmccormick30498b42013-03-27 17:39:17 -07001716 * applications (which includes installed applications as well as
1717 * applications with data directory i.e. applications which had been
1718 * deleted with {@code DONT_DELETE_DATA} flag set).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001719 * @see #GET_ACTIVITIES
1720 * @see #GET_GIDS
1721 * @see #GET_CONFIGURATIONS
1722 * @see #GET_INSTRUMENTATION
1723 * @see #GET_PERMISSIONS
1724 * @see #GET_PROVIDERS
1725 * @see #GET_RECEIVERS
1726 * @see #GET_SERVICES
1727 * @see #GET_SIGNATURES
1728 * @see #GET_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001729 */
1730 public abstract PackageInfo getPackageInfo(String packageName, int flags)
1731 throws NameNotFoundException;
1732
1733 /**
Dianne Hackborn47096932010-02-11 15:57:09 -08001734 * Map from the current package names in use on the device to whatever
1735 * the current canonical name of that package is.
1736 * @param names Array of current names to be mapped.
1737 * @return Returns an array of the same size as the original, containing
1738 * the canonical name for each package.
1739 */
1740 public abstract String[] currentToCanonicalPackageNames(String[] names);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001741
Dianne Hackborn47096932010-02-11 15:57:09 -08001742 /**
1743 * Map from a packages canonical name to the current name in use on the device.
1744 * @param names Array of new names to be mapped.
1745 * @return Returns an array of the same size as the original, containing
1746 * the current name for each package.
1747 */
1748 public abstract String[] canonicalToCurrentPackageNames(String[] names);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001749
Dianne Hackborn47096932010-02-11 15:57:09 -08001750 /**
Andrew Solovay5ae13352014-06-06 12:23:09 -07001751 * Returns a "good" intent to launch a front-door activity in a package.
1752 * This is used, for example, to implement an "open" button when browsing
1753 * through packages. The current implementation looks first for a main
1754 * activity in the category {@link Intent#CATEGORY_INFO}, and next for a
1755 * main activity in the category {@link Intent#CATEGORY_LAUNCHER}. Returns
1756 * <code>null</code> if neither are found.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001757 *
1758 * @param packageName The name of the package to inspect.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001759 *
Andrew Solovay5ae13352014-06-06 12:23:09 -07001760 * @return A fully-qualified {@link Intent} that can be used to launch the
1761 * main activity in the package. Returns <code>null</code> if the package
1762 * does not contain such an activity, or if <em>packageName</em> is not
Ihab Awad1ec68882014-09-12 11:09:01 -07001763 * recognized.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001764 */
Mihai Predaeae850c2009-05-13 10:13:48 +02001765 public abstract Intent getLaunchIntentForPackage(String packageName);
1766
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001767 /**
Jose Lima970417c2014-04-10 10:42:19 -07001768 * Return a "good" intent to launch a front-door Leanback activity in a
1769 * package, for use for example to implement an "open" button when browsing
1770 * through packages. The current implementation will look for a main
1771 * activity in the category {@link Intent#CATEGORY_LEANBACK_LAUNCHER}, or
1772 * return null if no main leanback activities are found.
1773 * <p>
1774 * Throws {@link NameNotFoundException} if a package with the given name
1775 * cannot be found on the system.
Adam Connors551c0782014-06-05 12:13:03 +01001776 *
Jose Lima970417c2014-04-10 10:42:19 -07001777 * @param packageName The name of the package to inspect.
1778 * @return Returns either a fully-qualified Intent that can be used to launch
1779 * the main Leanback activity in the package, or null if the package
1780 * does not contain such an activity.
1781 */
1782 public abstract Intent getLeanbackLaunchIntentForPackage(String packageName);
1783
1784 /**
1785 * Return an array of all of the secondary group-ids that have been assigned
1786 * to a package.
1787 * <p>
1788 * Throws {@link NameNotFoundException} if a package with the given name
1789 * cannot be found on the system.
Adam Connors551c0782014-06-05 12:13:03 +01001790 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001791 * @param packageName The full name (i.e. com.google.apps.contacts) of the
Jose Lima970417c2014-04-10 10:42:19 -07001792 * desired package.
1793 * @return Returns an int array of the assigned gids, or null if there are
1794 * none.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001795 */
1796 public abstract int[] getPackageGids(String packageName)
1797 throws NameNotFoundException;
1798
1799 /**
Dianne Hackborna06de0f2012-12-11 16:34:47 -08001800 * @hide Return the uid associated with the given package name for the
1801 * given user.
1802 *
1803 * <p>Throws {@link NameNotFoundException} if a package with the given
1804 * name can not be found on the system.
1805 *
1806 * @param packageName The full name (i.e. com.google.apps.contacts) of the
1807 * desired package.
1808 * @param userHandle The user handle identifier to look up the package under.
1809 *
1810 * @return Returns an integer uid who owns the given package name.
1811 */
1812 public abstract int getPackageUid(String packageName, int userHandle)
1813 throws NameNotFoundException;
1814
1815 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001816 * Retrieve all of the information we know about a particular permission.
1817 *
1818 * <p>Throws {@link NameNotFoundException} if a permission with the given
kmccormick30498b42013-03-27 17:39:17 -07001819 * name cannot be found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001820 *
1821 * @param name The fully qualified name (i.e. com.google.permission.LOGIN)
1822 * of the permission you are interested in.
1823 * @param flags Additional option flags. Use {@link #GET_META_DATA} to
1824 * retrieve any meta-data associated with the permission.
1825 *
1826 * @return Returns a {@link PermissionInfo} containing information about the
1827 * permission.
1828 */
1829 public abstract PermissionInfo getPermissionInfo(String name, int flags)
1830 throws NameNotFoundException;
1831
1832 /**
1833 * Query for all of the permissions associated with a particular group.
1834 *
1835 * <p>Throws {@link NameNotFoundException} if the given group does not
1836 * exist.
1837 *
1838 * @param group The fully qualified name (i.e. com.google.permission.LOGIN)
1839 * of the permission group you are interested in. Use null to
1840 * find all of the permissions not associated with a group.
1841 * @param flags Additional option flags. Use {@link #GET_META_DATA} to
1842 * retrieve any meta-data associated with the permissions.
1843 *
1844 * @return Returns a list of {@link PermissionInfo} containing information
1845 * about all of the permissions in the given group.
1846 */
1847 public abstract List<PermissionInfo> queryPermissionsByGroup(String group,
1848 int flags) throws NameNotFoundException;
1849
1850 /**
1851 * Retrieve all of the information we know about a particular group of
1852 * permissions.
1853 *
1854 * <p>Throws {@link NameNotFoundException} if a permission group with the given
kmccormick30498b42013-03-27 17:39:17 -07001855 * name cannot be found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001856 *
1857 * @param name The fully qualified name (i.e. com.google.permission_group.APPS)
1858 * of the permission you are interested in.
1859 * @param flags Additional option flags. Use {@link #GET_META_DATA} to
1860 * retrieve any meta-data associated with the permission group.
1861 *
1862 * @return Returns a {@link PermissionGroupInfo} containing information
1863 * about the permission.
1864 */
1865 public abstract PermissionGroupInfo getPermissionGroupInfo(String name,
1866 int flags) throws NameNotFoundException;
1867
1868 /**
1869 * Retrieve all of the known permission groups in the system.
1870 *
1871 * @param flags Additional option flags. Use {@link #GET_META_DATA} to
1872 * retrieve any meta-data associated with the permission group.
1873 *
1874 * @return Returns a list of {@link PermissionGroupInfo} containing
1875 * information about all of the known permission groups.
1876 */
1877 public abstract List<PermissionGroupInfo> getAllPermissionGroups(int flags);
1878
1879 /**
1880 * Retrieve all of the information we know about a particular
1881 * package/application.
1882 *
1883 * <p>Throws {@link NameNotFoundException} if an application with the given
kmccormick30498b42013-03-27 17:39:17 -07001884 * package name cannot be found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001885 *
1886 * @param packageName The full name (i.e. com.google.apps.contacts) of an
1887 * application.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001888 * @param flags Additional option flags. Use any combination of
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001889 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
1890 * {@link #GET_UNINSTALLED_PACKAGES} to modify the data returned.
1891 *
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001892 * @return {@link ApplicationInfo} Returns ApplicationInfo object containing
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001893 * information about the package.
1894 * If flag GET_UNINSTALLED_PACKAGES is set and if the package is not
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001895 * found in the list of installed applications,
1896 * the application information is retrieved from the
1897 * list of uninstalled applications(which includes
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001898 * installed applications as well as applications
1899 * with data directory ie applications which had been
kmccormick30498b42013-03-27 17:39:17 -07001900 * deleted with {@code DONT_DELETE_DATA} flag set).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001901 *
1902 * @see #GET_META_DATA
1903 * @see #GET_SHARED_LIBRARY_FILES
1904 * @see #GET_UNINSTALLED_PACKAGES
1905 */
1906 public abstract ApplicationInfo getApplicationInfo(String packageName,
1907 int flags) throws NameNotFoundException;
1908
1909 /**
1910 * Retrieve all of the information we know about a particular activity
1911 * class.
1912 *
1913 * <p>Throws {@link NameNotFoundException} if an activity with the given
kmccormick30498b42013-03-27 17:39:17 -07001914 * class name cannot be found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001915 *
Dianne Hackborn361199b2010-08-30 17:42:07 -07001916 * @param component The full component name (i.e.
1917 * com.google.apps.contacts/com.google.apps.contacts.ContactsList) of an Activity
1918 * class.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001919 * @param flags Additional option flags. Use any combination of
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001920 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
1921 * to modify the data (in ApplicationInfo) returned.
1922 *
1923 * @return {@link ActivityInfo} containing information about the activity.
1924 *
1925 * @see #GET_INTENT_FILTERS
1926 * @see #GET_META_DATA
1927 * @see #GET_SHARED_LIBRARY_FILES
1928 */
Dianne Hackborn361199b2010-08-30 17:42:07 -07001929 public abstract ActivityInfo getActivityInfo(ComponentName component,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001930 int flags) throws NameNotFoundException;
1931
1932 /**
1933 * Retrieve all of the information we know about a particular receiver
1934 * class.
1935 *
1936 * <p>Throws {@link NameNotFoundException} if a receiver with the given
kmccormick30498b42013-03-27 17:39:17 -07001937 * class name cannot be found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001938 *
Dianne Hackborn361199b2010-08-30 17:42:07 -07001939 * @param component The full component name (i.e.
1940 * com.google.apps.calendar/com.google.apps.calendar.CalendarAlarm) of a Receiver
1941 * class.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001942 * @param flags Additional option flags. Use any combination of
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001943 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
1944 * to modify the data returned.
1945 *
1946 * @return {@link ActivityInfo} containing information about the receiver.
1947 *
1948 * @see #GET_INTENT_FILTERS
1949 * @see #GET_META_DATA
1950 * @see #GET_SHARED_LIBRARY_FILES
1951 */
Dianne Hackborn361199b2010-08-30 17:42:07 -07001952 public abstract ActivityInfo getReceiverInfo(ComponentName component,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001953 int flags) throws NameNotFoundException;
1954
1955 /**
1956 * Retrieve all of the information we know about a particular service
1957 * class.
1958 *
1959 * <p>Throws {@link NameNotFoundException} if a service with the given
kmccormick30498b42013-03-27 17:39:17 -07001960 * class name cannot be found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001961 *
Dianne Hackborn361199b2010-08-30 17:42:07 -07001962 * @param component The full component name (i.e.
1963 * com.google.apps.media/com.google.apps.media.BackgroundPlayback) of a Service
1964 * class.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001965 * @param flags Additional option flags. Use any combination of
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001966 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
1967 * to modify the data returned.
1968 *
1969 * @return ServiceInfo containing information about the service.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001970 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001971 * @see #GET_META_DATA
1972 * @see #GET_SHARED_LIBRARY_FILES
1973 */
Dianne Hackborn361199b2010-08-30 17:42:07 -07001974 public abstract ServiceInfo getServiceInfo(ComponentName component,
1975 int flags) throws NameNotFoundException;
1976
1977 /**
1978 * Retrieve all of the information we know about a particular content
1979 * provider class.
1980 *
1981 * <p>Throws {@link NameNotFoundException} if a provider with the given
kmccormick30498b42013-03-27 17:39:17 -07001982 * class name cannot be found on the system.
Dianne Hackborn361199b2010-08-30 17:42:07 -07001983 *
1984 * @param component The full component name (i.e.
1985 * com.google.providers.media/com.google.providers.media.MediaProvider) of a
1986 * ContentProvider class.
1987 * @param flags Additional option flags. Use any combination of
1988 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
1989 * to modify the data returned.
1990 *
1991 * @return ProviderInfo containing information about the service.
1992 *
1993 * @see #GET_META_DATA
1994 * @see #GET_SHARED_LIBRARY_FILES
1995 */
1996 public abstract ProviderInfo getProviderInfo(ComponentName component,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001997 int flags) throws NameNotFoundException;
1998
1999 /**
2000 * Return a List of all packages that are installed
2001 * on the device.
2002 *
2003 * @param flags Additional option flags. Use any combination of
2004 * {@link #GET_ACTIVITIES},
2005 * {@link #GET_GIDS},
2006 * {@link #GET_CONFIGURATIONS},
2007 * {@link #GET_INSTRUMENTATION},
2008 * {@link #GET_PERMISSIONS},
2009 * {@link #GET_PROVIDERS},
2010 * {@link #GET_RECEIVERS},
2011 * {@link #GET_SERVICES},
2012 * {@link #GET_SIGNATURES},
2013 * {@link #GET_UNINSTALLED_PACKAGES} to modify the data returned.
2014 *
2015 * @return A List of PackageInfo objects, one for each package that is
2016 * installed on the device. In the unlikely case of there being no
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002017 * installed packages, an empty list is returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002018 * If flag GET_UNINSTALLED_PACKAGES is set, a list of all
kmccormick30498b42013-03-27 17:39:17 -07002019 * applications including those deleted with {@code DONT_DELETE_DATA}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002020 * (partially installed apps with data directory) will be returned.
2021 *
2022 * @see #GET_ACTIVITIES
2023 * @see #GET_GIDS
2024 * @see #GET_CONFIGURATIONS
2025 * @see #GET_INSTRUMENTATION
2026 * @see #GET_PERMISSIONS
2027 * @see #GET_PROVIDERS
2028 * @see #GET_RECEIVERS
2029 * @see #GET_SERVICES
2030 * @see #GET_SIGNATURES
2031 * @see #GET_UNINSTALLED_PACKAGES
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002032 */
2033 public abstract List<PackageInfo> getInstalledPackages(int flags);
2034
2035 /**
Dianne Hackborne7991752013-01-16 17:56:46 -08002036 * Return a List of all installed packages that are currently
2037 * holding any of the given permissions.
2038 *
2039 * @param flags Additional option flags. Use any combination of
2040 * {@link #GET_ACTIVITIES},
2041 * {@link #GET_GIDS},
2042 * {@link #GET_CONFIGURATIONS},
2043 * {@link #GET_INSTRUMENTATION},
2044 * {@link #GET_PERMISSIONS},
2045 * {@link #GET_PROVIDERS},
2046 * {@link #GET_RECEIVERS},
2047 * {@link #GET_SERVICES},
2048 * {@link #GET_SIGNATURES},
2049 * {@link #GET_UNINSTALLED_PACKAGES} to modify the data returned.
2050 *
2051 * @return Returns a List of PackageInfo objects, one for each installed
2052 * application that is holding any of the permissions that were provided.
2053 *
2054 * @see #GET_ACTIVITIES
2055 * @see #GET_GIDS
2056 * @see #GET_CONFIGURATIONS
2057 * @see #GET_INSTRUMENTATION
2058 * @see #GET_PERMISSIONS
2059 * @see #GET_PROVIDERS
2060 * @see #GET_RECEIVERS
2061 * @see #GET_SERVICES
2062 * @see #GET_SIGNATURES
2063 * @see #GET_UNINSTALLED_PACKAGES
2064 */
2065 public abstract List<PackageInfo> getPackagesHoldingPermissions(
2066 String[] permissions, int flags);
2067
2068 /**
Amith Yamasani151ec4c2012-09-07 19:25:16 -07002069 * Return a List of all packages that are installed on the device, for a specific user.
2070 * Requesting a list of installed packages for another user
2071 * will require the permission INTERACT_ACROSS_USERS_FULL.
2072 * @param flags Additional option flags. Use any combination of
2073 * {@link #GET_ACTIVITIES},
2074 * {@link #GET_GIDS},
2075 * {@link #GET_CONFIGURATIONS},
2076 * {@link #GET_INSTRUMENTATION},
2077 * {@link #GET_PERMISSIONS},
2078 * {@link #GET_PROVIDERS},
2079 * {@link #GET_RECEIVERS},
2080 * {@link #GET_SERVICES},
2081 * {@link #GET_SIGNATURES},
2082 * {@link #GET_UNINSTALLED_PACKAGES} to modify the data returned.
2083 * @param userId The user for whom the installed packages are to be listed
2084 *
2085 * @return A List of PackageInfo objects, one for each package that is
2086 * installed on the device. In the unlikely case of there being no
2087 * installed packages, an empty list is returned.
2088 * If flag GET_UNINSTALLED_PACKAGES is set, a list of all
kmccormick30498b42013-03-27 17:39:17 -07002089 * applications including those deleted with {@code DONT_DELETE_DATA}
Amith Yamasani151ec4c2012-09-07 19:25:16 -07002090 * (partially installed apps with data directory) will be returned.
2091 *
2092 * @see #GET_ACTIVITIES
2093 * @see #GET_GIDS
2094 * @see #GET_CONFIGURATIONS
2095 * @see #GET_INSTRUMENTATION
2096 * @see #GET_PERMISSIONS
2097 * @see #GET_PROVIDERS
2098 * @see #GET_RECEIVERS
2099 * @see #GET_SERVICES
2100 * @see #GET_SIGNATURES
2101 * @see #GET_UNINSTALLED_PACKAGES
2102 *
2103 * @hide
2104 */
2105 public abstract List<PackageInfo> getInstalledPackages(int flags, int userId);
2106
2107 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002108 * Check whether a particular package has been granted a particular
2109 * permission.
2110 *
2111 * @param permName The name of the permission you are checking for,
2112 * @param pkgName The name of the package you are checking against.
2113 *
2114 * @return If the package has the permission, PERMISSION_GRANTED is
2115 * returned. If it does not have the permission, PERMISSION_DENIED
2116 * is returned.
2117 *
2118 * @see #PERMISSION_GRANTED
2119 * @see #PERMISSION_DENIED
2120 */
2121 public abstract int checkPermission(String permName, String pkgName);
2122
2123 /**
2124 * Add a new dynamic permission to the system. For this to work, your
2125 * package must have defined a permission tree through the
2126 * {@link android.R.styleable#AndroidManifestPermissionTree
2127 * &lt;permission-tree&gt;} tag in its manifest. A package can only add
2128 * permissions to trees that were defined by either its own package or
2129 * another with the same user id; a permission is in a tree if it
2130 * matches the name of the permission tree + ".": for example,
2131 * "com.foo.bar" is a member of the permission tree "com.foo".
2132 *
2133 * <p>It is good to make your permission tree name descriptive, because you
2134 * are taking possession of that entire set of permission names. Thus, it
2135 * must be under a domain you control, with a suffix that will not match
2136 * any normal permissions that may be declared in any applications that
2137 * are part of that domain.
2138 *
2139 * <p>New permissions must be added before
2140 * any .apks are installed that use those permissions. Permissions you
2141 * add through this method are remembered across reboots of the device.
2142 * If the given permission already exists, the info you supply here
2143 * will be used to update it.
2144 *
2145 * @param info Description of the permission to be added.
2146 *
2147 * @return Returns true if a new permission was created, false if an
2148 * existing one was updated.
2149 *
2150 * @throws SecurityException if you are not allowed to add the
2151 * given permission name.
2152 *
2153 * @see #removePermission(String)
2154 */
2155 public abstract boolean addPermission(PermissionInfo info);
2156
2157 /**
Dianne Hackbornd7c09682010-03-30 10:42:20 -07002158 * Like {@link #addPermission(PermissionInfo)} but asynchronously
2159 * persists the package manager state after returning from the call,
2160 * allowing it to return quicker and batch a series of adds at the
2161 * expense of no guarantee the added permission will be retained if
2162 * the device is rebooted before it is written.
2163 */
2164 public abstract boolean addPermissionAsync(PermissionInfo info);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002165
Dianne Hackbornd7c09682010-03-30 10:42:20 -07002166 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002167 * Removes a permission that was previously added with
2168 * {@link #addPermission(PermissionInfo)}. The same ownership rules apply
2169 * -- you are only allowed to remove permissions that you are allowed
2170 * to add.
2171 *
2172 * @param name The name of the permission to remove.
2173 *
2174 * @throws SecurityException if you are not allowed to remove the
2175 * given permission name.
2176 *
2177 * @see #addPermission(PermissionInfo)
2178 */
2179 public abstract void removePermission(String name);
2180
2181 /**
Nick Kralevich035f80d2013-03-27 15:20:08 -07002182 * Returns an {@link Intent} suitable for passing to {@code startActivityForResult}
2183 * which prompts the user to grant {@code permissions} to this application.
Nick Kralevich32eb5b12013-04-11 10:20:09 -07002184 * @hide
Nick Kralevich035f80d2013-03-27 15:20:08 -07002185 *
2186 * @throws NullPointerException if {@code permissions} is {@code null}.
2187 * @throws IllegalArgumentException if {@code permissions} contains {@code null}.
2188 */
2189 public Intent buildPermissionRequestIntent(String... permissions) {
2190 if (permissions == null) {
2191 throw new NullPointerException("permissions cannot be null");
2192 }
2193 for (String permission : permissions) {
2194 if (permission == null) {
2195 throw new IllegalArgumentException("permissions cannot contain null");
2196 }
2197 }
2198
2199 Intent i = new Intent(ACTION_REQUEST_PERMISSION);
2200 i.putExtra(EXTRA_REQUEST_PERMISSION_PERMISSION_LIST, permissions);
2201 i.setPackage("com.android.packageinstaller");
2202 return i;
2203 }
2204
2205 /**
Dianne Hackborne639da72012-02-21 15:11:13 -08002206 * Grant a permission to an application which the application does not
2207 * already have. The permission must have been requested by the application,
2208 * but as an optional permission. If the application is not allowed to
2209 * hold the permission, a SecurityException is thrown.
2210 * @hide
2211 *
2212 * @param packageName The name of the package that the permission will be
2213 * granted to.
2214 * @param permissionName The name of the permission.
2215 */
2216 public abstract void grantPermission(String packageName, String permissionName);
2217
2218 /**
2219 * Revoke a permission that was previously granted by {@link #grantPermission}.
2220 * @hide
2221 *
2222 * @param packageName The name of the package that the permission will be
2223 * granted to.
2224 * @param permissionName The name of the permission.
2225 */
2226 public abstract void revokePermission(String packageName, String permissionName);
2227
2228 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002229 * Compare the signatures of two packages to determine if the same
2230 * signature appears in both of them. If they do contain the same
2231 * signature, then they are allowed special privileges when working
2232 * with each other: they can share the same user-id, run instrumentation
2233 * against each other, etc.
2234 *
2235 * @param pkg1 First package name whose signature will be compared.
2236 * @param pkg2 Second package name whose signature will be compared.
Chris Palmer09f33602010-09-13 14:27:18 -07002237 *
2238 * @return Returns an integer indicating whether all signatures on the
2239 * two packages match. The value is >= 0 ({@link #SIGNATURE_MATCH}) if
2240 * all signatures match or < 0 if there is not a match ({@link
2241 * #SIGNATURE_NO_MATCH} or {@link #SIGNATURE_UNKNOWN_PACKAGE}).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002242 *
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07002243 * @see #checkSignatures(int, int)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002244 * @see #SIGNATURE_MATCH
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002245 * @see #SIGNATURE_NO_MATCH
2246 * @see #SIGNATURE_UNKNOWN_PACKAGE
2247 */
2248 public abstract int checkSignatures(String pkg1, String pkg2);
2249
2250 /**
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07002251 * Like {@link #checkSignatures(String, String)}, but takes UIDs of
2252 * the two packages to be checked. This can be useful, for example,
2253 * when doing the check in an IPC, where the UID is the only identity
2254 * available. It is functionally identical to determining the package
2255 * associated with the UIDs and checking their signatures.
2256 *
Joe Onorato25660ec2009-08-12 22:40:37 -07002257 * @param uid1 First UID whose signature will be compared.
2258 * @param uid2 Second UID whose signature will be compared.
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07002259 *
Chris Palmer09f33602010-09-13 14:27:18 -07002260 * @return Returns an integer indicating whether all signatures on the
2261 * two packages match. The value is >= 0 ({@link #SIGNATURE_MATCH}) if
2262 * all signatures match or < 0 if there is not a match ({@link
2263 * #SIGNATURE_NO_MATCH} or {@link #SIGNATURE_UNKNOWN_PACKAGE}).
2264 *
2265 * @see #checkSignatures(String, String)
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07002266 * @see #SIGNATURE_MATCH
Dianne Hackborn766cbfe2009-08-12 18:33:39 -07002267 * @see #SIGNATURE_NO_MATCH
2268 * @see #SIGNATURE_UNKNOWN_PACKAGE
2269 */
2270 public abstract int checkSignatures(int uid1, int uid2);
2271
2272 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002273 * Retrieve the names of all packages that are associated with a particular
2274 * user id. In most cases, this will be a single package name, the package
2275 * that has been assigned that user id. Where there are multiple packages
2276 * sharing the same user id through the "sharedUserId" mechanism, all
2277 * packages with that id will be returned.
2278 *
2279 * @param uid The user id for which you would like to retrieve the
2280 * associated packages.
2281 *
2282 * @return Returns an array of one or more packages assigned to the user
2283 * id, or null if there are no known packages with the given id.
2284 */
2285 public abstract String[] getPackagesForUid(int uid);
2286
2287 /**
2288 * Retrieve the official name associated with a user id. This name is
2289 * guaranteed to never change, though it is possibly for the underlying
2290 * user id to be changed. That is, if you are storing information about
2291 * user ids in persistent storage, you should use the string returned
2292 * by this function instead of the raw user-id.
2293 *
2294 * @param uid The user id for which you would like to retrieve a name.
2295 * @return Returns a unique name for the given user id, or null if the
2296 * user id is not currently assigned.
2297 */
2298 public abstract String getNameForUid(int uid);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002299
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002300 /**
2301 * Return the user id associated with a shared user name. Multiple
2302 * applications can specify a shared user name in their manifest and thus
2303 * end up using a common uid. This might be used for new applications
2304 * that use an existing shared user name and need to know the uid of the
2305 * shared user.
2306 *
2307 * @param sharedUserName The shared user name whose uid is to be retrieved.
2308 * @return Returns the uid associated with the shared user, or NameNotFoundException
2309 * if the shared user name is not being used by any installed packages
2310 * @hide
2311 */
2312 public abstract int getUidForSharedUser(String sharedUserName)
2313 throws NameNotFoundException;
2314
2315 /**
2316 * Return a List of all application packages that are installed on the
2317 * device. If flag GET_UNINSTALLED_PACKAGES has been set, a list of all
kmccormick30498b42013-03-27 17:39:17 -07002318 * applications including those deleted with {@code DONT_DELETE_DATA} (partially
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002319 * installed apps with data directory) will be returned.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002320 *
2321 * @param flags Additional option flags. Use any combination of
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002322 * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
Jeff Smitha45746e2012-07-19 14:19:24 -05002323 * {@link #GET_UNINSTALLED_PACKAGES} to modify the data returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002324 *
Dianne Hackborne7991752013-01-16 17:56:46 -08002325 * @return Returns a List of ApplicationInfo objects, one for each application that
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002326 * is installed on the device. In the unlikely case of there being
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002327 * no installed applications, an empty list is returned.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002328 * If flag GET_UNINSTALLED_PACKAGES is set, a list of all
kmccormick30498b42013-03-27 17:39:17 -07002329 * applications including those deleted with {@code DONT_DELETE_DATA}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002330 * (partially installed apps with data directory) will be returned.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002331 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002332 * @see #GET_META_DATA
2333 * @see #GET_SHARED_LIBRARY_FILES
2334 * @see #GET_UNINSTALLED_PACKAGES
2335 */
2336 public abstract List<ApplicationInfo> getInstalledApplications(int flags);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002337
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002338 /**
2339 * Get a list of shared libraries that are available on the
2340 * system.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002341 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002342 * @return An array of shared library names that are
2343 * available on the system, or null if none are installed.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002344 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002345 */
2346 public abstract String[] getSystemSharedLibraryNames();
2347
2348 /**
Dianne Hackborn49237342009-08-27 20:08:01 -07002349 * Get a list of features that are available on the
2350 * system.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002351 *
Dianne Hackborn49237342009-08-27 20:08:01 -07002352 * @return An array of FeatureInfo classes describing the features
2353 * that are available on the system, or null if there are none(!!).
Dianne Hackborn49237342009-08-27 20:08:01 -07002354 */
2355 public abstract FeatureInfo[] getSystemAvailableFeatures();
2356
2357 /**
Dianne Hackborn039c68e2009-09-26 16:39:23 -07002358 * Check whether the given feature name is one of the available
2359 * features as returned by {@link #getSystemAvailableFeatures()}.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002360 *
Dianne Hackborn039c68e2009-09-26 16:39:23 -07002361 * @return Returns true if the devices supports the feature, else
2362 * false.
2363 */
2364 public abstract boolean hasSystemFeature(String name);
2365
2366 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002367 * Determine the best action to perform for a given Intent. This is how
2368 * {@link Intent#resolveActivity} finds an activity if a class has not
2369 * been explicitly specified.
2370 *
Scott Mainef6b3052011-03-23 14:23:02 -07002371 * <p><em>Note:</em> if using an implicit Intent (without an explicit ComponentName
Dianne Hackborn4d023d22010-10-01 13:41:04 -07002372 * specified), be sure to consider whether to set the {@link #MATCH_DEFAULT_ONLY}
2373 * only flag. You need to do so to resolve the activity in the same way
2374 * that {@link android.content.Context#startActivity(Intent)} and
2375 * {@link android.content.Intent#resolveActivity(PackageManager)
2376 * Intent.resolveActivity(PackageManager)} do.</p>
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002377 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002378 * @param intent An intent containing all of the desired specification
2379 * (action, data, type, category, and/or component).
2380 * @param flags Additional option flags. The most important is
Dianne Hackborn4d023d22010-10-01 13:41:04 -07002381 * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only
2382 * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002383 *
2384 * @return Returns a ResolveInfo containing the final activity intent that
2385 * was determined to be the best action. Returns null if no
Mike LeBeaubd3f5272010-02-18 19:27:17 -08002386 * matching activity was found. If multiple matching activities are
2387 * found and there is no default set, returns a ResolveInfo
2388 * containing something else, such as the activity resolver.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002389 *
2390 * @see #MATCH_DEFAULT_ONLY
2391 * @see #GET_INTENT_FILTERS
2392 * @see #GET_RESOLVED_FILTER
2393 */
2394 public abstract ResolveInfo resolveActivity(Intent intent, int flags);
2395
2396 /**
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07002397 * Determine the best action to perform for a given Intent for a given user. This
2398 * is how {@link Intent#resolveActivity} finds an activity if a class has not
2399 * been explicitly specified.
2400 *
2401 * <p><em>Note:</em> if using an implicit Intent (without an explicit ComponentName
2402 * specified), be sure to consider whether to set the {@link #MATCH_DEFAULT_ONLY}
2403 * only flag. You need to do so to resolve the activity in the same way
2404 * that {@link android.content.Context#startActivity(Intent)} and
2405 * {@link android.content.Intent#resolveActivity(PackageManager)
2406 * Intent.resolveActivity(PackageManager)} do.</p>
2407 *
2408 * @param intent An intent containing all of the desired specification
2409 * (action, data, type, category, and/or component).
2410 * @param flags Additional option flags. The most important is
2411 * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only
2412 * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}.
2413 * @param userId The user id.
2414 *
2415 * @return Returns a ResolveInfo containing the final activity intent that
2416 * was determined to be the best action. Returns null if no
2417 * matching activity was found. If multiple matching activities are
2418 * found and there is no default set, returns a ResolveInfo
2419 * containing something else, such as the activity resolver.
2420 *
2421 * @see #MATCH_DEFAULT_ONLY
2422 * @see #GET_INTENT_FILTERS
2423 * @see #GET_RESOLVED_FILTER
2424 *
2425 * @hide
2426 */
2427 public abstract ResolveInfo resolveActivityAsUser(Intent intent, int flags, int userId);
2428
2429 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002430 * Retrieve all activities that can be performed for the given intent.
2431 *
2432 * @param intent The desired intent as per resolveActivity().
2433 * @param flags Additional option flags. The most important is
Dianne Hackborn4d023d22010-10-01 13:41:04 -07002434 * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only
2435 * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002436 *
Dianne Hackborn4d023d22010-10-01 13:41:04 -07002437 * @return A List&lt;ResolveInfo&gt; containing one entry for each matching
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002438 * Activity. These are ordered from best to worst match -- that
2439 * is, the first item in the list is what is returned by
Dianne Hackborn4d023d22010-10-01 13:41:04 -07002440 * {@link #resolveActivity}. If there are no matching activities, an empty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002441 * list is returned.
2442 *
2443 * @see #MATCH_DEFAULT_ONLY
2444 * @see #GET_INTENT_FILTERS
2445 * @see #GET_RESOLVED_FILTER
2446 */
2447 public abstract List<ResolveInfo> queryIntentActivities(Intent intent,
2448 int flags);
2449
2450 /**
Amith Yamasani151ec4c2012-09-07 19:25:16 -07002451 * Retrieve all activities that can be performed for the given intent, for a specific user.
2452 *
2453 * @param intent The desired intent as per resolveActivity().
2454 * @param flags Additional option flags. The most important is
2455 * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only
2456 * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}.
2457 *
2458 * @return A List&lt;ResolveInfo&gt; containing one entry for each matching
2459 * Activity. These are ordered from best to worst match -- that
2460 * is, the first item in the list is what is returned by
2461 * {@link #resolveActivity}. If there are no matching activities, an empty
2462 * list is returned.
2463 *
2464 * @see #MATCH_DEFAULT_ONLY
2465 * @see #GET_INTENT_FILTERS
2466 * @see #GET_RESOLVED_FILTER
2467 * @hide
2468 */
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07002469 public abstract List<ResolveInfo> queryIntentActivitiesAsUser(Intent intent,
Amith Yamasani151ec4c2012-09-07 19:25:16 -07002470 int flags, int userId);
2471
2472
2473 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002474 * Retrieve a set of activities that should be presented to the user as
2475 * similar options. This is like {@link #queryIntentActivities}, except it
2476 * also allows you to supply a list of more explicit Intents that you would
2477 * like to resolve to particular options, and takes care of returning the
2478 * final ResolveInfo list in a reasonable order, with no duplicates, based
2479 * on those inputs.
2480 *
2481 * @param caller The class name of the activity that is making the
2482 * request. This activity will never appear in the output
2483 * list. Can be null.
2484 * @param specifics An array of Intents that should be resolved to the
2485 * first specific results. Can be null.
2486 * @param intent The desired intent as per resolveActivity().
2487 * @param flags Additional option flags. The most important is
Dianne Hackborn4d023d22010-10-01 13:41:04 -07002488 * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only
2489 * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002490 *
Dianne Hackborn4d023d22010-10-01 13:41:04 -07002491 * @return A List&lt;ResolveInfo&gt; containing one entry for each matching
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002492 * Activity. These are ordered first by all of the intents resolved
2493 * in <var>specifics</var> and then any additional activities that
2494 * can handle <var>intent</var> but did not get included by one of
2495 * the <var>specifics</var> intents. If there are no matching
2496 * activities, an empty list is returned.
2497 *
2498 * @see #MATCH_DEFAULT_ONLY
2499 * @see #GET_INTENT_FILTERS
2500 * @see #GET_RESOLVED_FILTER
2501 */
2502 public abstract List<ResolveInfo> queryIntentActivityOptions(
2503 ComponentName caller, Intent[] specifics, Intent intent, int flags);
2504
2505 /**
2506 * Retrieve all receivers that can handle a broadcast of the given intent.
2507 *
2508 * @param intent The desired intent as per resolveActivity().
Dianne Hackborn4d023d22010-10-01 13:41:04 -07002509 * @param flags Additional option flags.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002510 *
Dianne Hackborn4d023d22010-10-01 13:41:04 -07002511 * @return A List&lt;ResolveInfo&gt; containing one entry for each matching
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002512 * Receiver. These are ordered from first to last in priority. If
2513 * there are no matching receivers, an empty list is returned.
2514 *
2515 * @see #MATCH_DEFAULT_ONLY
2516 * @see #GET_INTENT_FILTERS
2517 * @see #GET_RESOLVED_FILTER
2518 */
2519 public abstract List<ResolveInfo> queryBroadcastReceivers(Intent intent,
2520 int flags);
2521
2522 /**
Amith Yamasanif203aee2012-08-29 18:41:53 -07002523 * Retrieve all receivers that can handle a broadcast of the given intent, for a specific
2524 * user.
2525 *
2526 * @param intent The desired intent as per resolveActivity().
2527 * @param flags Additional option flags.
2528 * @param userId The userId of the user being queried.
2529 *
2530 * @return A List&lt;ResolveInfo&gt; containing one entry for each matching
2531 * Receiver. These are ordered from first to last in priority. If
2532 * there are no matching receivers, an empty list is returned.
2533 *
2534 * @see #MATCH_DEFAULT_ONLY
2535 * @see #GET_INTENT_FILTERS
2536 * @see #GET_RESOLVED_FILTER
2537 * @hide
2538 */
2539 public abstract List<ResolveInfo> queryBroadcastReceivers(Intent intent,
2540 int flags, int userId);
2541
2542 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002543 * Determine the best service to handle for a given Intent.
2544 *
2545 * @param intent An intent containing all of the desired specification
2546 * (action, data, type, category, and/or component).
2547 * @param flags Additional option flags.
2548 *
2549 * @return Returns a ResolveInfo containing the final service intent that
2550 * was determined to be the best action. Returns null if no
2551 * matching service was found.
2552 *
2553 * @see #GET_INTENT_FILTERS
2554 * @see #GET_RESOLVED_FILTER
2555 */
2556 public abstract ResolveInfo resolveService(Intent intent, int flags);
2557
2558 /**
2559 * Retrieve all services that can match the given intent.
2560 *
2561 * @param intent The desired intent as per resolveService().
2562 * @param flags Additional option flags.
2563 *
Dianne Hackborn4d023d22010-10-01 13:41:04 -07002564 * @return A List&lt;ResolveInfo&gt; containing one entry for each matching
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002565 * ServiceInfo. These are ordered from best to worst match -- that
2566 * is, the first item in the list is what is returned by
2567 * resolveService(). If there are no matching services, an empty
2568 * list is returned.
2569 *
2570 * @see #GET_INTENT_FILTERS
2571 * @see #GET_RESOLVED_FILTER
2572 */
2573 public abstract List<ResolveInfo> queryIntentServices(Intent intent,
2574 int flags);
2575
2576 /**
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07002577 * Retrieve all services that can match the given intent for a given user.
2578 *
2579 * @param intent The desired intent as per resolveService().
2580 * @param flags Additional option flags.
2581 * @param userId The user id.
2582 *
2583 * @return A List&lt;ResolveInfo&gt; containing one entry for each matching
2584 * ServiceInfo. These are ordered from best to worst match -- that
2585 * is, the first item in the list is what is returned by
2586 * resolveService(). If there are no matching services, an empty
2587 * list is returned.
2588 *
2589 * @see #GET_INTENT_FILTERS
2590 * @see #GET_RESOLVED_FILTER
2591 *
2592 * @hide
2593 */
2594 public abstract List<ResolveInfo> queryIntentServicesAsUser(Intent intent,
2595 int flags, int userId);
2596
Jeff Sharkey85f5f812013-10-07 10:16:12 -07002597 /** {@hide} */
2598 public abstract List<ResolveInfo> queryIntentContentProvidersAsUser(
2599 Intent intent, int flags, int userId);
2600
2601 /**
2602 * Retrieve all providers that can match the given intent.
2603 *
2604 * @param intent An intent containing all of the desired specification
2605 * (action, data, type, category, and/or component).
2606 * @param flags Additional option flags.
2607 * @return A List&lt;ResolveInfo&gt; containing one entry for each matching
2608 * ProviderInfo. These are ordered from best to worst match. If
2609 * there are no matching providers, an empty list is returned.
2610 * @see #GET_INTENT_FILTERS
2611 * @see #GET_RESOLVED_FILTER
2612 */
2613 public abstract List<ResolveInfo> queryIntentContentProviders(Intent intent, int flags);
2614
Svetoslav Ganov58d37b52012-09-18 12:04:19 -07002615 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002616 * Find a single content provider by its base path name.
2617 *
2618 * @param name The name of the provider to find.
2619 * @param flags Additional option flags. Currently should always be 0.
2620 *
2621 * @return ContentProviderInfo Information about the provider, if found,
2622 * else null.
2623 */
2624 public abstract ProviderInfo resolveContentProvider(String name,
2625 int flags);
2626
2627 /**
Alexandra Gherghina0363c3e2014-06-23 13:34:59 +01002628 * Find a single content provider by its base path name.
2629 *
2630 * @param name The name of the provider to find.
2631 * @param flags Additional option flags. Currently should always be 0.
2632 * @param userId The user id.
2633 *
2634 * @return ContentProviderInfo Information about the provider, if found,
2635 * else null.
2636 * @hide
2637 */
2638 public abstract ProviderInfo resolveContentProviderAsUser(String name, int flags, int userId);
2639
2640 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002641 * Retrieve content provider information.
2642 *
2643 * <p><em>Note: unlike most other methods, an empty result set is indicated
2644 * by a null return instead of an empty list.</em>
2645 *
2646 * @param processName If non-null, limits the returned providers to only
2647 * those that are hosted by the given process. If null,
2648 * all content providers are returned.
2649 * @param uid If <var>processName</var> is non-null, this is the required
2650 * uid owning the requested content providers.
2651 * @param flags Additional option flags. Currently should always be 0.
2652 *
Dianne Hackborn4d023d22010-10-01 13:41:04 -07002653 * @return A List&lt;ContentProviderInfo&gt; containing one entry for each
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002654 * content provider either patching <var>processName</var> or, if
2655 * <var>processName</var> is null, all known content providers.
2656 * <em>If there are no matching providers, null is returned.</em>
2657 */
2658 public abstract List<ProviderInfo> queryContentProviders(
2659 String processName, int uid, int flags);
2660
2661 /**
2662 * Retrieve all of the information we know about a particular
2663 * instrumentation class.
2664 *
2665 * <p>Throws {@link NameNotFoundException} if instrumentation with the
kmccormick30498b42013-03-27 17:39:17 -07002666 * given class name cannot be found on the system.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002667 *
2668 * @param className The full name (i.e.
2669 * com.google.apps.contacts.InstrumentList) of an
2670 * Instrumentation class.
2671 * @param flags Additional option flags. Currently should always be 0.
2672 *
2673 * @return InstrumentationInfo containing information about the
2674 * instrumentation.
2675 */
2676 public abstract InstrumentationInfo getInstrumentationInfo(
2677 ComponentName className, int flags) throws NameNotFoundException;
2678
2679 /**
2680 * Retrieve information about available instrumentation code. May be used
2681 * to retrieve either all instrumentation code, or only the code targeting
2682 * a particular package.
2683 *
2684 * @param targetPackage If null, all instrumentation is returned; only the
2685 * instrumentation targeting this package name is
2686 * returned.
2687 * @param flags Additional option flags. Currently should always be 0.
2688 *
Dianne Hackborn4d023d22010-10-01 13:41:04 -07002689 * @return A List&lt;InstrumentationInfo&gt; containing one entry for each
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002690 * matching available Instrumentation. Returns an empty list if
2691 * there is no instrumentation available for the given package.
2692 */
2693 public abstract List<InstrumentationInfo> queryInstrumentation(
2694 String targetPackage, int flags);
2695
2696 /**
2697 * Retrieve an image from a package. This is a low-level API used by
2698 * the various package manager info structures (such as
2699 * {@link ComponentInfo} to implement retrieval of their associated
2700 * icon.
2701 *
2702 * @param packageName The name of the package that this icon is coming from.
kmccormick30498b42013-03-27 17:39:17 -07002703 * Cannot be null.
2704 * @param resid The resource identifier of the desired image. Cannot be 0.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002705 * @param appInfo Overall information about <var>packageName</var>. This
2706 * may be null, in which case the application information will be retrieved
2707 * for you if needed; if you already have this information around, it can
2708 * be much more efficient to supply it here.
2709 *
2710 * @return Returns a Drawable holding the requested image. Returns null if
2711 * an image could not be found for any reason.
2712 */
2713 public abstract Drawable getDrawable(String packageName, int resid,
2714 ApplicationInfo appInfo);
2715
2716 /**
2717 * Retrieve the icon associated with an activity. Given the full name of
2718 * an activity, retrieves the information about it and calls
2719 * {@link ComponentInfo#loadIcon ComponentInfo.loadIcon()} to return its icon.
kmccormick30498b42013-03-27 17:39:17 -07002720 * If the activity cannot be found, NameNotFoundException is thrown.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002721 *
2722 * @param activityName Name of the activity whose icon is to be retrieved.
2723 *
2724 * @return Returns the image of the icon, or the default activity icon if
2725 * it could not be found. Does not return null.
2726 * @throws NameNotFoundException Thrown if the resources for the given
2727 * activity could not be loaded.
2728 *
2729 * @see #getActivityIcon(Intent)
2730 */
2731 public abstract Drawable getActivityIcon(ComponentName activityName)
2732 throws NameNotFoundException;
2733
2734 /**
2735 * Retrieve the icon associated with an Intent. If intent.getClassName() is
2736 * set, this simply returns the result of
2737 * getActivityIcon(intent.getClassName()). Otherwise it resolves the intent's
2738 * component and returns the icon associated with the resolved component.
kmccormick30498b42013-03-27 17:39:17 -07002739 * If intent.getClassName() cannot be found or the Intent cannot be resolved
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002740 * to a component, NameNotFoundException is thrown.
2741 *
2742 * @param intent The intent for which you would like to retrieve an icon.
2743 *
2744 * @return Returns the image of the icon, or the default activity icon if
2745 * it could not be found. Does not return null.
2746 * @throws NameNotFoundException Thrown if the resources for application
2747 * matching the given intent could not be loaded.
2748 *
2749 * @see #getActivityIcon(ComponentName)
2750 */
2751 public abstract Drawable getActivityIcon(Intent intent)
2752 throws NameNotFoundException;
2753
2754 /**
Jose Limaf78e3122014-03-06 12:13:15 -08002755 * Retrieve the banner associated with an activity. Given the full name of
2756 * an activity, retrieves the information about it and calls
2757 * {@link ComponentInfo#loadIcon ComponentInfo.loadIcon()} to return its
2758 * banner. If the activity cannot be found, NameNotFoundException is thrown.
2759 *
2760 * @param activityName Name of the activity whose banner is to be retrieved.
2761 * @return Returns the image of the banner, or null if the activity has no
2762 * banner specified.
2763 * @throws NameNotFoundException Thrown if the resources for the given
2764 * activity could not be loaded.
2765 * @see #getActivityBanner(Intent)
2766 */
2767 public abstract Drawable getActivityBanner(ComponentName activityName)
2768 throws NameNotFoundException;
2769
2770 /**
2771 * Retrieve the banner associated with an Intent. If intent.getClassName()
2772 * is set, this simply returns the result of
2773 * getActivityBanner(intent.getClassName()). Otherwise it resolves the
2774 * intent's component and returns the banner associated with the resolved
2775 * component. If intent.getClassName() cannot be found or the Intent cannot
2776 * be resolved to a component, NameNotFoundException is thrown.
2777 *
2778 * @param intent The intent for which you would like to retrieve a banner.
2779 * @return Returns the image of the banner, or null if the activity has no
2780 * banner specified.
2781 * @throws NameNotFoundException Thrown if the resources for application
2782 * matching the given intent could not be loaded.
2783 * @see #getActivityBanner(ComponentName)
2784 */
2785 public abstract Drawable getActivityBanner(Intent intent)
2786 throws NameNotFoundException;
2787
2788 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002789 * Return the generic icon for an activity that is used when no specific
2790 * icon is defined.
Adam Connors23cc04e2014-04-01 12:12:20 +01002791 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002792 * @return Drawable Image of the icon.
2793 */
2794 public abstract Drawable getDefaultActivityIcon();
2795
2796 /**
2797 * Retrieve the icon associated with an application. If it has not defined
2798 * an icon, the default app icon is returned. Does not return null.
2799 *
2800 * @param info Information about application being queried.
2801 *
2802 * @return Returns the image of the icon, or the default application icon
2803 * if it could not be found.
2804 *
2805 * @see #getApplicationIcon(String)
2806 */
2807 public abstract Drawable getApplicationIcon(ApplicationInfo info);
2808
2809 /**
2810 * Retrieve the icon associated with an application. Given the name of the
2811 * application's package, retrieves the information about it and calls
kmccormick30498b42013-03-27 17:39:17 -07002812 * getApplicationIcon() to return its icon. If the application cannot be
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002813 * found, NameNotFoundException is thrown.
2814 *
2815 * @param packageName Name of the package whose application icon is to be
2816 * retrieved.
2817 *
2818 * @return Returns the image of the icon, or the default application icon
2819 * if it could not be found. Does not return null.
2820 * @throws NameNotFoundException Thrown if the resources for the given
2821 * application could not be loaded.
2822 *
2823 * @see #getApplicationIcon(ApplicationInfo)
2824 */
2825 public abstract Drawable getApplicationIcon(String packageName)
2826 throws NameNotFoundException;
2827
2828 /**
Jose Limaf78e3122014-03-06 12:13:15 -08002829 * Retrieve the banner associated with an application.
2830 *
2831 * @param info Information about application being queried.
2832 * @return Returns the image of the banner or null if the application has no
2833 * banner specified.
2834 * @see #getApplicationBanner(String)
2835 */
2836 public abstract Drawable getApplicationBanner(ApplicationInfo info);
2837
2838 /**
2839 * Retrieve the banner associated with an application. Given the name of the
2840 * application's package, retrieves the information about it and calls
2841 * getApplicationIcon() to return its banner. If the application cannot be
2842 * found, NameNotFoundException is thrown.
2843 *
2844 * @param packageName Name of the package whose application banner is to be
2845 * retrieved.
2846 * @return Returns the image of the banner or null if the application has no
2847 * banner specified.
2848 * @throws NameNotFoundException Thrown if the resources for the given
2849 * application could not be loaded.
2850 * @see #getApplicationBanner(ApplicationInfo)
2851 */
2852 public abstract Drawable getApplicationBanner(String packageName)
2853 throws NameNotFoundException;
2854
2855 /**
2856 * Retrieve the logo associated with an activity. Given the full name of an
2857 * activity, retrieves the information about it and calls
2858 * {@link ComponentInfo#loadLogo ComponentInfo.loadLogo()} to return its
2859 * logo. If the activity cannot be found, NameNotFoundException is thrown.
Adam Powell81cd2e92010-04-21 16:35:18 -07002860 *
2861 * @param activityName Name of the activity whose logo is to be retrieved.
Jose Limaf78e3122014-03-06 12:13:15 -08002862 * @return Returns the image of the logo or null if the activity has no logo
2863 * specified.
Adam Powell81cd2e92010-04-21 16:35:18 -07002864 * @throws NameNotFoundException Thrown if the resources for the given
Jose Limaf78e3122014-03-06 12:13:15 -08002865 * activity could not be loaded.
Adam Powell81cd2e92010-04-21 16:35:18 -07002866 * @see #getActivityLogo(Intent)
2867 */
2868 public abstract Drawable getActivityLogo(ComponentName activityName)
2869 throws NameNotFoundException;
2870
2871 /**
2872 * Retrieve the logo associated with an Intent. If intent.getClassName() is
2873 * set, this simply returns the result of
2874 * getActivityLogo(intent.getClassName()). Otherwise it resolves the intent's
2875 * component and returns the logo associated with the resolved component.
kmccormick30498b42013-03-27 17:39:17 -07002876 * If intent.getClassName() cannot be found or the Intent cannot be resolved
Adam Powell81cd2e92010-04-21 16:35:18 -07002877 * to a component, NameNotFoundException is thrown.
2878 *
2879 * @param intent The intent for which you would like to retrieve a logo.
2880 *
2881 * @return Returns the image of the logo, or null if the activity has no
2882 * logo specified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002883 *
Adam Powell81cd2e92010-04-21 16:35:18 -07002884 * @throws NameNotFoundException Thrown if the resources for application
2885 * matching the given intent could not be loaded.
2886 *
2887 * @see #getActivityLogo(ComponentName)
2888 */
2889 public abstract Drawable getActivityLogo(Intent intent)
2890 throws NameNotFoundException;
2891
2892 /**
2893 * Retrieve the logo associated with an application. If it has not specified
2894 * a logo, this method returns null.
2895 *
2896 * @param info Information about application being queried.
2897 *
2898 * @return Returns the image of the logo, or null if no logo is specified
2899 * by the application.
2900 *
2901 * @see #getApplicationLogo(String)
2902 */
2903 public abstract Drawable getApplicationLogo(ApplicationInfo info);
2904
2905 /**
2906 * Retrieve the logo associated with an application. Given the name of the
2907 * application's package, retrieves the information about it and calls
kmccormick30498b42013-03-27 17:39:17 -07002908 * getApplicationLogo() to return its logo. If the application cannot be
Adam Powell81cd2e92010-04-21 16:35:18 -07002909 * found, NameNotFoundException is thrown.
2910 *
2911 * @param packageName Name of the package whose application logo is to be
2912 * retrieved.
2913 *
2914 * @return Returns the image of the logo, or null if no application logo
2915 * has been specified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002916 *
Adam Powell81cd2e92010-04-21 16:35:18 -07002917 * @throws NameNotFoundException Thrown if the resources for the given
2918 * application could not be loaded.
2919 *
2920 * @see #getApplicationLogo(ApplicationInfo)
2921 */
2922 public abstract Drawable getApplicationLogo(String packageName)
2923 throws NameNotFoundException;
2924
2925 /**
Svetoslavc7d62f02014-09-04 15:39:54 -07002926 * If the target user is a managed profile of the calling user or the caller
2927 * is itself a managed profile, then this returns a badged copy of the given
2928 * icon to be able to distinguish it from the original icon. For badging an
2929 * arbitrary drawable use {@link #getUserBadgedDrawableForDensity(
2930 * android.graphics.drawable.Drawable, UserHandle, android.graphics.Rect, int)}.
2931 * <p>
2932 * If the original drawable is a BitmapDrawable and the backing bitmap is
2933 * mutable as per {@link android.graphics.Bitmap#isMutable()}, the badging
2934 * is performed in place and the original drawable is returned.
2935 * </p>
2936 *
2937 * @param icon The icon to badge.
2938 * @param user The target user.
2939 * @return A drawable that combines the original icon and a badge as
2940 * determined by the system.
2941 */
2942 public abstract Drawable getUserBadgedIcon(Drawable icon, UserHandle user);
2943
2944 /**
2945 * If the target user is a managed profile of the calling user or the caller
2946 * is itself a managed profile, then this returns a badged copy of the given
2947 * drawable allowing the user to distinguish it from the original drawable.
2948 * The caller can specify the location in the bounds of the drawable to be
2949 * badged where the badge should be applied as well as the density of the
2950 * badge to be used.
2951 * <p>
2952 * If the original drawable is a BitmapDrawable and the backing bitmap is
2953 * mutable as per {@link android.graphics.Bitmap#isMutable()}, the bading
2954 * is performed in place and the original drawable is returned.
2955 * </p>
2956 *
2957 * @param drawable The drawable to badge.
2958 * @param user The target user.
2959 * @param badgeLocation Where in the bounds of the badged drawable to place
2960 * the badge. If not provided, the badge is applied on top of the entire
2961 * drawable being badged.
2962 * @param badgeDensity The optional desired density for the badge as per
2963 * {@link android.util.DisplayMetrics#densityDpi}. If not provided,
2964 * the density of the display is used.
2965 * @return A drawable that combines the original drawable and a badge as
2966 * determined by the system.
2967 */
2968 public abstract Drawable getUserBadgedDrawableForDensity(Drawable drawable,
2969 UserHandle user, Rect badgeLocation, int badgeDensity);
2970
2971 /**
2972 * If the target user is a managed profile of the calling user or the caller
2973 * is itself a managed profile, then this returns a drawable to use as a small
2974 * icon to include in a view to distinguish it from the original icon.
2975 *
2976 * @param user The target user.
2977 * @param density The optional desired density for the badge as per
2978 * {@link android.util.DisplayMetrics#densityDpi}. If not provided
2979 * the density of the current display is used.
2980 * @return the drawable or null if no drawable is required.
2981 * @hide
2982 */
2983 public abstract Drawable getUserBadgeForDensity(UserHandle user, int density);
2984
2985 /**
2986 * If the target user is a managed profile of the calling user or the caller
2987 * is itself a managed profile, then this returns a copy of the label with
2988 * badging for accessibility services like talkback. E.g. passing in "Email"
2989 * and it might return "Work Email" for Email in the work profile.
2990 *
2991 * @param label The label to change.
2992 * @param user The target user.
2993 * @return A label that combines the original label and a badge as
2994 * determined by the system.
2995 */
2996 public abstract CharSequence getUserBadgedLabel(CharSequence label, UserHandle user);
2997
2998 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002999 * Retrieve text from a package. This is a low-level API used by
3000 * the various package manager info structures (such as
3001 * {@link ComponentInfo} to implement retrieval of their associated
3002 * labels and other text.
3003 *
3004 * @param packageName The name of the package that this text is coming from.
kmccormick30498b42013-03-27 17:39:17 -07003005 * Cannot be null.
3006 * @param resid The resource identifier of the desired text. Cannot be 0.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003007 * @param appInfo Overall information about <var>packageName</var>. This
3008 * may be null, in which case the application information will be retrieved
3009 * for you if needed; if you already have this information around, it can
3010 * be much more efficient to supply it here.
3011 *
3012 * @return Returns a CharSequence holding the requested text. Returns null
3013 * if the text could not be found for any reason.
3014 */
3015 public abstract CharSequence getText(String packageName, int resid,
3016 ApplicationInfo appInfo);
3017
3018 /**
3019 * Retrieve an XML file from a package. This is a low-level API used to
3020 * retrieve XML meta data.
3021 *
3022 * @param packageName The name of the package that this xml is coming from.
kmccormick30498b42013-03-27 17:39:17 -07003023 * Cannot be null.
3024 * @param resid The resource identifier of the desired xml. Cannot be 0.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003025 * @param appInfo Overall information about <var>packageName</var>. This
3026 * may be null, in which case the application information will be retrieved
3027 * for you if needed; if you already have this information around, it can
3028 * be much more efficient to supply it here.
3029 *
3030 * @return Returns an XmlPullParser allowing you to parse out the XML
3031 * data. Returns null if the xml resource could not be found for any
3032 * reason.
3033 */
3034 public abstract XmlResourceParser getXml(String packageName, int resid,
3035 ApplicationInfo appInfo);
3036
3037 /**
3038 * Return the label to use for this application.
3039 *
3040 * @return Returns the label associated with this application, or null if
3041 * it could not be found for any reason.
kmccormick30498b42013-03-27 17:39:17 -07003042 * @param info The application to get the label of.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003043 */
3044 public abstract CharSequence getApplicationLabel(ApplicationInfo info);
3045
3046 /**
3047 * Retrieve the resources associated with an activity. Given the full
3048 * name of an activity, retrieves the information about it and calls
3049 * getResources() to return its application's resources. If the activity
kmccormick30498b42013-03-27 17:39:17 -07003050 * cannot be found, NameNotFoundException is thrown.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003051 *
3052 * @param activityName Name of the activity whose resources are to be
3053 * retrieved.
3054 *
3055 * @return Returns the application's Resources.
3056 * @throws NameNotFoundException Thrown if the resources for the given
3057 * application could not be loaded.
3058 *
3059 * @see #getResourcesForApplication(ApplicationInfo)
3060 */
3061 public abstract Resources getResourcesForActivity(ComponentName activityName)
3062 throws NameNotFoundException;
3063
3064 /**
3065 * Retrieve the resources for an application. Throws NameNotFoundException
3066 * if the package is no longer installed.
3067 *
3068 * @param app Information about the desired application.
3069 *
3070 * @return Returns the application's Resources.
3071 * @throws NameNotFoundException Thrown if the resources for the given
3072 * application could not be loaded (most likely because it was uninstalled).
3073 */
3074 public abstract Resources getResourcesForApplication(ApplicationInfo app)
3075 throws NameNotFoundException;
3076
3077 /**
3078 * Retrieve the resources associated with an application. Given the full
3079 * package name of an application, retrieves the information about it and
3080 * calls getResources() to return its application's resources. If the
kmccormick30498b42013-03-27 17:39:17 -07003081 * appPackageName cannot be found, NameNotFoundException is thrown.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003082 *
3083 * @param appPackageName Package name of the application whose resources
3084 * are to be retrieved.
3085 *
3086 * @return Returns the application's Resources.
3087 * @throws NameNotFoundException Thrown if the resources for the given
3088 * application could not be loaded.
3089 *
3090 * @see #getResourcesForApplication(ApplicationInfo)
3091 */
3092 public abstract Resources getResourcesForApplication(String appPackageName)
3093 throws NameNotFoundException;
3094
Amith Yamasani98edc952012-09-25 14:09:27 -07003095 /** @hide */
3096 public abstract Resources getResourcesForApplicationAsUser(String appPackageName, int userId)
3097 throws NameNotFoundException;
3098
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003099 /**
3100 * Retrieve overall information about an application package defined
3101 * in a package archive file
3102 *
3103 * @param archiveFilePath The path to the archive file
3104 * @param flags Additional option flags. Use any combination of
3105 * {@link #GET_ACTIVITIES},
3106 * {@link #GET_GIDS},
3107 * {@link #GET_CONFIGURATIONS},
3108 * {@link #GET_INSTRUMENTATION},
3109 * {@link #GET_PERMISSIONS},
3110 * {@link #GET_PROVIDERS},
3111 * {@link #GET_RECEIVERS},
3112 * {@link #GET_SERVICES},
3113 * {@link #GET_SIGNATURES}, to modify the data returned.
3114 *
3115 * @return Returns the information about the package. Returns
3116 * null if the package could not be successfully parsed.
3117 *
3118 * @see #GET_ACTIVITIES
3119 * @see #GET_GIDS
3120 * @see #GET_CONFIGURATIONS
3121 * @see #GET_INSTRUMENTATION
3122 * @see #GET_PERMISSIONS
3123 * @see #GET_PROVIDERS
3124 * @see #GET_RECEIVERS
3125 * @see #GET_SERVICES
3126 * @see #GET_SIGNATURES
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003127 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003128 */
3129 public PackageInfo getPackageArchiveInfo(String archiveFilePath, int flags) {
Jeff Sharkey275e0852014-06-17 18:18:49 -07003130 final PackageParser parser = new PackageParser();
3131 final File apkFile = new File(archiveFilePath);
Jeff Sharkeyc4858a22014-06-16 10:51:20 -07003132 try {
Jeff Sharkey275e0852014-06-17 18:18:49 -07003133 PackageParser.Package pkg = parser.parseMonolithicPackage(apkFile, 0);
Jeff Sharkeyc4858a22014-06-16 10:51:20 -07003134 if ((flags & GET_SIGNATURES) != 0) {
Jeff Sharkey275e0852014-06-17 18:18:49 -07003135 parser.collectCertificates(pkg, 0);
Jeff Sharkey032f2b22014-06-19 15:48:47 -07003136 parser.collectManifestDigest(pkg);
Jeff Sharkeyc4858a22014-06-16 10:51:20 -07003137 }
3138 PackageUserState state = new PackageUserState();
3139 return PackageParser.generatePackageInfo(pkg, null, flags, 0, 0, null, state);
3140 } catch (PackageParserException e) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003141 return null;
3142 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003143 }
3144
3145 /**
Jeff Sharkeybb580672014-07-10 12:10:25 -07003146 * @hide Install a package. Since this may take a little while, the result
3147 * will be posted back to the given observer. An installation will
3148 * fail if the calling context lacks the
3149 * {@link android.Manifest.permission#INSTALL_PACKAGES} permission, if
3150 * the package named in the package file's manifest is already
3151 * installed, or if there's no space available on the device.
3152 * @param packageURI The location of the package file to install. This can
3153 * be a 'file:' or a 'content:' URI.
3154 * @param observer An observer callback to get notified when the package
3155 * installation is complete.
3156 * {@link IPackageInstallObserver#packageInstalled(String, int)}
3157 * will be called when that happens. This parameter must not be
3158 * null.
Dianne Hackbornade3eca2009-05-11 18:54:45 -07003159 * @param flags - possible values: {@link #INSTALL_FORWARD_LOCK},
Jeff Sharkeybb580672014-07-10 12:10:25 -07003160 * {@link #INSTALL_REPLACE_EXISTING},
3161 * {@link #INSTALL_ALLOW_TEST}.
3162 * @param installerPackageName Optional package name of the application that
3163 * is performing the installation. This identifies which market
3164 * the package came from.
3165 * @deprecated Use {@link #installPackage(Uri, PackageInstallObserver, int,
3166 * String)} instead. This method will continue to be supported
3167 * but the older observer interface will not get additional
3168 * failure details.
Jacek Surazski65e13172009-04-28 15:26:38 +02003169 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07003170 // @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003171 public abstract void installPackage(
Jacek Surazski65e13172009-04-28 15:26:38 +02003172 Uri packageURI, IPackageInstallObserver observer, int flags,
3173 String installerPackageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003174
3175 /**
Kenny Root5ab21572011-07-27 11:11:19 -07003176 * Similar to
3177 * {@link #installPackage(Uri, IPackageInstallObserver, int, String)} but
3178 * with an extra verification file provided.
3179 *
3180 * @param packageURI The location of the package file to install. This can
3181 * be a 'file:' or a 'content:' URI.
3182 * @param observer An observer callback to get notified when the package
3183 * installation is complete.
3184 * {@link IPackageInstallObserver#packageInstalled(String, int)}
Jeff Sharkeybb580672014-07-10 12:10:25 -07003185 * will be called when that happens. This parameter must not be
3186 * null.
Christopher Tateab8a5012014-03-24 16:25:51 -07003187 * @param flags - possible values: {@link #INSTALL_FORWARD_LOCK},
Jeff Sharkeybb580672014-07-10 12:10:25 -07003188 * {@link #INSTALL_REPLACE_EXISTING},
3189 * {@link #INSTALL_ALLOW_TEST}.
Christopher Tateab8a5012014-03-24 16:25:51 -07003190 * @param installerPackageName Optional package name of the application that
3191 * is performing the installation. This identifies which market
3192 * the package came from.
3193 * @param verificationURI The location of the supplementary verification
3194 * file. This can be a 'file:' or a 'content:' URI. May be
3195 * {@code null}.
3196 * @param manifestDigest an object that holds the digest of the package
3197 * which can be used to verify ownership. May be {@code null}.
3198 * @param encryptionParams if the package to be installed is encrypted,
3199 * these parameters describing the encryption and authentication
3200 * used. May be {@code null}.
3201 * @hide
Jeff Sharkeybb580672014-07-10 12:10:25 -07003202 * @deprecated Use {@link #installPackageWithVerification(Uri,
3203 * PackageInstallObserver, int, String, Uri, ManifestDigest,
3204 * ContainerEncryptionParams)} instead. This method will
3205 * continue to be supported but the older observer interface
3206 * will not get additional failure details.
Christopher Tateab8a5012014-03-24 16:25:51 -07003207 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07003208 // @SystemApi
Christopher Tateab8a5012014-03-24 16:25:51 -07003209 public abstract void installPackageWithVerification(Uri packageURI,
3210 IPackageInstallObserver observer, int flags, String installerPackageName,
3211 Uri verificationURI, ManifestDigest manifestDigest,
3212 ContainerEncryptionParams encryptionParams);
3213
3214 /**
3215 * Similar to
3216 * {@link #installPackage(Uri, IPackageInstallObserver, int, String)} but
3217 * with an extra verification information provided.
3218 *
3219 * @param packageURI The location of the package file to install. This can
3220 * be a 'file:' or a 'content:' URI.
3221 * @param observer An observer callback to get notified when the package
3222 * installation is complete.
3223 * {@link IPackageInstallObserver#packageInstalled(String, int)}
Jeff Sharkeybb580672014-07-10 12:10:25 -07003224 * will be called when that happens. This parameter must not be
3225 * null.
Christopher Tateab8a5012014-03-24 16:25:51 -07003226 * @param flags - possible values: {@link #INSTALL_FORWARD_LOCK},
Jeff Sharkeybb580672014-07-10 12:10:25 -07003227 * {@link #INSTALL_REPLACE_EXISTING},
3228 * {@link #INSTALL_ALLOW_TEST}.
Christopher Tatef1977b42014-03-24 16:25:51 -07003229 * @param installerPackageName Optional package name of the application that
3230 * is performing the installation. This identifies which market
3231 * the package came from.
3232 * @param verificationParams an object that holds signal information to
3233 * assist verification. May be {@code null}.
3234 * @param encryptionParams if the package to be installed is encrypted,
3235 * these parameters describing the encryption and authentication
3236 * used. May be {@code null}.
Christopher Tatef1977b42014-03-24 16:25:51 -07003237 * @hide
3238 * @deprecated Use {@link #installPackageWithVerificationAndEncryption(Uri,
Jeff Sharkeybb580672014-07-10 12:10:25 -07003239 * PackageInstallObserver, int, String, VerificationParams,
3240 * ContainerEncryptionParams)} instead. This method will
3241 * continue to be supported but the older observer interface
3242 * will not get additional failure details.
Christopher Tatef1977b42014-03-24 16:25:51 -07003243 */
3244 @Deprecated
3245 public abstract void installPackageWithVerificationAndEncryption(Uri packageURI,
3246 IPackageInstallObserver observer, int flags, String installerPackageName,
3247 VerificationParams verificationParams,
3248 ContainerEncryptionParams encryptionParams);
3249
3250 // Package-install variants that take the new, expanded form of observer interface.
3251 // Note that these *also* take the original observer type and will redundantly
3252 // report the same information to that observer if supplied; but it is not required.
3253
3254 /**
3255 * @hide
3256 *
3257 * Install a package. Since this may take a little while, the result will
3258 * be posted back to the given observer. An installation will fail if the calling context
3259 * lacks the {@link android.Manifest.permission#INSTALL_PACKAGES} permission, if the
3260 * package named in the package file's manifest is already installed, or if there's no space
3261 * available on the device.
3262 *
3263 * @param packageURI The location of the package file to install. This can be a 'file:' or a
3264 * 'content:' URI.
3265 * @param observer An observer callback to get notified when the package installation is
3266 * complete. {@link PackageInstallObserver#packageInstalled(String, Bundle, int)} will be
3267 * called when that happens. This parameter must not be null.
3268 * @param flags - possible values: {@link #INSTALL_FORWARD_LOCK},
3269 * {@link #INSTALL_REPLACE_EXISTING}, {@link #INSTALL_ALLOW_TEST}.
3270 * @param installerPackageName Optional package name of the application that is performing the
3271 * installation. This identifies which market the package came from.
3272 */
3273 public abstract void installPackage(
3274 Uri packageURI, PackageInstallObserver observer,
3275 int flags, String installerPackageName);
3276
3277 /**
3278 * Similar to
3279 * {@link #installPackage(Uri, IPackageInstallObserver, int, String)} but
3280 * with an extra verification file provided.
3281 *
3282 * @param packageURI The location of the package file to install. This can
3283 * be a 'file:' or a 'content:' URI.
3284 * @param observer An observer callback to get notified when the package installation is
3285 * complete. {@link PackageInstallObserver#packageInstalled(String, Bundle, int)} will be
3286 * called when that happens. This parameter must not be null.
3287 * @param flags - possible values: {@link #INSTALL_FORWARD_LOCK},
3288 * {@link #INSTALL_REPLACE_EXISTING}, {@link #INSTALL_ALLOW_TEST}.
3289 * @param installerPackageName Optional package name of the application that
3290 * is performing the installation. This identifies which market
3291 * the package came from.
3292 * @param verificationURI The location of the supplementary verification
3293 * file. This can be a 'file:' or a 'content:' URI. May be
3294 * {@code null}.
3295 * @param manifestDigest an object that holds the digest of the package
3296 * which can be used to verify ownership. May be {@code null}.
3297 * @param encryptionParams if the package to be installed is encrypted,
3298 * these parameters describing the encryption and authentication
3299 * used. May be {@code null}.
3300 * @hide
3301 */
3302 public abstract void installPackageWithVerification(Uri packageURI,
3303 PackageInstallObserver observer, int flags, String installerPackageName,
3304 Uri verificationURI, ManifestDigest manifestDigest,
3305 ContainerEncryptionParams encryptionParams);
3306
3307 /**
3308 * Similar to
3309 * {@link #installPackage(Uri, IPackageInstallObserver, int, String)} but
3310 * with an extra verification information provided.
3311 *
3312 * @param packageURI The location of the package file to install. This can
3313 * be a 'file:' or a 'content:' URI.
3314 * @param observer An observer callback to get notified when the package installation is
3315 * complete. {@link PackageInstallObserver#packageInstalled(String, Bundle, int)} will be
3316 * called when that happens. This parameter must not be null.
3317 * @param flags - possible values: {@link #INSTALL_FORWARD_LOCK},
3318 * {@link #INSTALL_REPLACE_EXISTING}, {@link #INSTALL_ALLOW_TEST}.
Christopher Tateab8a5012014-03-24 16:25:51 -07003319 * @param installerPackageName Optional package name of the application that
3320 * is performing the installation. This identifies which market
3321 * the package came from.
3322 * @param verificationParams an object that holds signal information to
3323 * assist verification. May be {@code null}.
3324 * @param encryptionParams if the package to be installed is encrypted,
3325 * these parameters describing the encryption and authentication
3326 * used. May be {@code null}.
3327 *
3328 * @hide
Christopher Tateab8a5012014-03-24 16:25:51 -07003329 */
Christopher Tateab8a5012014-03-24 16:25:51 -07003330 public abstract void installPackageWithVerificationAndEncryption(Uri packageURI,
Christopher Tatef1977b42014-03-24 16:25:51 -07003331 PackageInstallObserver observer, int flags, String installerPackageName,
3332 VerificationParams verificationParams, ContainerEncryptionParams encryptionParams);
Christopher Tateab8a5012014-03-24 16:25:51 -07003333
rich cannings706e8ba2012-08-20 13:20:14 -07003334 /**
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003335 * If there is already an application with the given package name installed
3336 * on the system for other users, also install it for the calling user.
3337 * @hide
3338 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07003339 // @SystemApi
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003340 public abstract int installExistingPackage(String packageName)
3341 throws NameNotFoundException;
3342
3343 /**
Kenny Root5ab21572011-07-27 11:11:19 -07003344 * Allows a package listening to the
3345 * {@link Intent#ACTION_PACKAGE_NEEDS_VERIFICATION package verification
Kenny Root3a9b5fb2011-09-20 14:15:38 -07003346 * broadcast} to respond to the package manager. The response must include
3347 * the {@code verificationCode} which is one of
3348 * {@link PackageManager#VERIFICATION_ALLOW} or
3349 * {@link PackageManager#VERIFICATION_REJECT}.
Kenny Root5ab21572011-07-27 11:11:19 -07003350 *
3351 * @param id pending package identifier as passed via the
kmccormick30498b42013-03-27 17:39:17 -07003352 * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra.
Kenny Root3a9b5fb2011-09-20 14:15:38 -07003353 * @param verificationCode either {@link PackageManager#VERIFICATION_ALLOW}
3354 * or {@link PackageManager#VERIFICATION_REJECT}.
rich cannings7e671512012-08-27 14:44:16 -07003355 * @throws SecurityException if the caller does not have the
Dianne Hackborn8832c182012-09-17 17:20:24 -07003356 * PACKAGE_VERIFICATION_AGENT permission.
Kenny Root5ab21572011-07-27 11:11:19 -07003357 */
Kenny Root3a9b5fb2011-09-20 14:15:38 -07003358 public abstract void verifyPendingInstall(int id, int verificationCode);
Kenny Root5ab21572011-07-27 11:11:19 -07003359
3360 /**
rich canningsd9ef3e52012-08-22 14:28:05 -07003361 * Allows a package listening to the
3362 * {@link Intent#ACTION_PACKAGE_NEEDS_VERIFICATION package verification
3363 * broadcast} to extend the default timeout for a response and declare what
3364 * action to perform after the timeout occurs. The response must include
3365 * the {@code verificationCodeAtTimeout} which is one of
3366 * {@link PackageManager#VERIFICATION_ALLOW} or
3367 * {@link PackageManager#VERIFICATION_REJECT}.
3368 *
3369 * This method may only be called once per package id. Additional calls
3370 * will have no effect.
3371 *
3372 * @param id pending package identifier as passed via the
kmccormick30498b42013-03-27 17:39:17 -07003373 * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra.
rich canningsd9ef3e52012-08-22 14:28:05 -07003374 * @param verificationCodeAtTimeout either
3375 * {@link PackageManager#VERIFICATION_ALLOW} or
rich canningsd1b5cfc2012-08-29 14:49:51 -07003376 * {@link PackageManager#VERIFICATION_REJECT}. If
3377 * {@code verificationCodeAtTimeout} is neither
3378 * {@link PackageManager#VERIFICATION_ALLOW} or
3379 * {@link PackageManager#VERIFICATION_REJECT}, then
3380 * {@code verificationCodeAtTimeout} will default to
rich canningsd9ef3e52012-08-22 14:28:05 -07003381 * {@link PackageManager#VERIFICATION_REJECT}.
3382 * @param millisecondsToDelay the amount of time requested for the timeout.
3383 * Must be positive and less than
rich canningsd1b5cfc2012-08-29 14:49:51 -07003384 * {@link PackageManager#MAXIMUM_VERIFICATION_TIMEOUT}. If
3385 * {@code millisecondsToDelay} is out of bounds,
3386 * {@code millisecondsToDelay} will be set to the closest in
3387 * bounds value; namely, 0 or
rich canningsd9ef3e52012-08-22 14:28:05 -07003388 * {@link PackageManager#MAXIMUM_VERIFICATION_TIMEOUT}.
rich cannings7e671512012-08-27 14:44:16 -07003389 * @throws SecurityException if the caller does not have the
Dianne Hackborn8832c182012-09-17 17:20:24 -07003390 * PACKAGE_VERIFICATION_AGENT permission.
rich canningsd9ef3e52012-08-22 14:28:05 -07003391 */
3392 public abstract void extendVerificationTimeout(int id,
3393 int verificationCodeAtTimeout, long millisecondsToDelay);
3394
3395 /**
Dianne Hackborn880119b2010-11-18 22:26:40 -08003396 * Change the installer associated with a given package. There are limitations
3397 * on how the installer package can be changed; in particular:
3398 * <ul>
3399 * <li> A SecurityException will be thrown if <var>installerPackageName</var>
3400 * is not signed with the same certificate as the calling application.
3401 * <li> A SecurityException will be thrown if <var>targetPackage</var> already
3402 * has an installer package, and that installer package is not signed with
3403 * the same certificate as the calling application.
3404 * </ul>
3405 *
3406 * @param targetPackage The installed package whose installer will be changed.
3407 * @param installerPackageName The package name of the new installer. May be
3408 * null to clear the association.
3409 */
3410 public abstract void setInstallerPackageName(String targetPackage,
3411 String installerPackageName);
3412
3413 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003414 * Attempts to delete a package. Since this may take a little while, the result will
3415 * be posted back to the given observer. A deletion will fail if the calling context
3416 * lacks the {@link android.Manifest.permission#DELETE_PACKAGES} permission, if the
3417 * named package cannot be found, or if the named package is a "system package".
3418 * (TODO: include pointer to documentation on "system packages")
3419 *
3420 * @param packageName The name of the package to delete
3421 * @param observer An observer callback to get notified when the package deletion is
3422 * complete. {@link android.content.pm.IPackageDeleteObserver#packageDeleted(boolean)} will be
3423 * called when that happens. observer may be null to indicate that no callback is desired.
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003424 * @param flags - possible values: {@link #DELETE_KEEP_DATA},
3425 * {@link #DELETE_ALL_USERS}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003426 *
3427 * @hide
3428 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07003429 // @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003430 public abstract void deletePackage(
3431 String packageName, IPackageDeleteObserver observer, int flags);
Jacek Surazski65e13172009-04-28 15:26:38 +02003432
3433 /**
3434 * Retrieve the package name of the application that installed a package. This identifies
3435 * which market the package came from.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003436 *
Jacek Surazski65e13172009-04-28 15:26:38 +02003437 * @param packageName The name of the package to query
3438 */
3439 public abstract String getInstallerPackageName(String packageName);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003440
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003441 /**
3442 * Attempts to clear the user data directory of an application.
3443 * Since this may take a little while, the result will
3444 * be posted back to the given observer. A deletion will fail if the
3445 * named package cannot be found, or if the named package is a "system package".
3446 *
3447 * @param packageName The name of the package
3448 * @param observer An observer callback to get notified when the operation is finished
3449 * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)}
3450 * will be called when that happens. observer may be null to indicate that
3451 * no callback is desired.
3452 *
3453 * @hide
3454 */
3455 public abstract void clearApplicationUserData(String packageName,
3456 IPackageDataObserver observer);
3457 /**
3458 * Attempts to delete the cache files associated with an application.
3459 * Since this may take a little while, the result will
3460 * be posted back to the given observer. A deletion will fail if the calling context
3461 * lacks the {@link android.Manifest.permission#DELETE_CACHE_FILES} permission, if the
3462 * named package cannot be found, or if the named package is a "system package".
3463 *
3464 * @param packageName The name of the package to delete
3465 * @param observer An observer callback to get notified when the cache file deletion
3466 * is complete.
3467 * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)}
3468 * will be called when that happens. observer may be null to indicate that
3469 * no callback is desired.
3470 *
3471 * @hide
3472 */
3473 public abstract void deleteApplicationCacheFiles(String packageName,
3474 IPackageDataObserver observer);
3475
3476 /**
3477 * Free storage by deleting LRU sorted list of cache files across
3478 * all applications. If the currently available free storage
3479 * on the device is greater than or equal to the requested
3480 * free storage, no cache files are cleared. If the currently
3481 * available storage on the device is less than the requested
3482 * free storage, some or all of the cache files across
3483 * all applications are deleted (based on last accessed time)
3484 * to increase the free storage space on the device to
3485 * the requested value. There is no guarantee that clearing all
3486 * the cache files from all applications will clear up
3487 * enough storage to achieve the desired value.
3488 * @param freeStorageSize The number of bytes of storage to be
3489 * freed by the system. Say if freeStorageSize is XX,
3490 * and the current free storage is YY,
3491 * if XX is less than YY, just return. if not free XX-YY number
3492 * of bytes if possible.
3493 * @param observer call back used to notify when
3494 * the operation is completed
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003495 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003496 * @hide
3497 */
Jeff Brownd5a5b5a2014-06-05 17:14:39 -07003498 // @SystemApi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003499 public abstract void freeStorageAndNotify(long freeStorageSize, IPackageDataObserver observer);
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -07003500
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003501 /**
3502 * Free storage by deleting LRU sorted list of cache files across
3503 * all applications. If the currently available free storage
3504 * on the device is greater than or equal to the requested
3505 * free storage, no cache files are cleared. If the currently
3506 * available storage on the device is less than the requested
3507 * free storage, some or all of the cache files across
3508 * all applications are deleted (based on last accessed time)
3509 * to increase the free storage space on the device to
3510 * the requested value. There is no guarantee that clearing all
3511 * the cache files from all applications will clear up
3512 * enough storage to achieve the desired value.
3513 * @param freeStorageSize The number of bytes of storage to be
3514 * freed by the system. Say if freeStorageSize is XX,
3515 * and the current free storage is YY,
3516 * if XX is less than YY, just return. if not free XX-YY number
3517 * of bytes if possible.
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -07003518 * @param pi IntentSender call back used to
3519 * notify when the operation is completed.May be null
3520 * to indicate that no call back is desired.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003521 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003522 * @hide
3523 */
Suchi Amalapurapubc806f62009-06-17 15:18:19 -07003524 public abstract void freeStorage(long freeStorageSize, IntentSender pi);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003525
3526 /**
3527 * Retrieve the size information for a package.
3528 * Since this may take a little while, the result will
3529 * be posted back to the given observer. The calling context
3530 * should have the {@link android.Manifest.permission#GET_PACKAGE_SIZE} permission.
3531 *
3532 * @param packageName The name of the package whose size information is to be retrieved
Dianne Hackborn0c380492012-08-20 17:23:30 -07003533 * @param userHandle The user whose size information should be retrieved.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003534 * @param observer An observer callback to get notified when the operation
3535 * is complete.
3536 * {@link android.content.pm.IPackageStatsObserver#onGetStatsCompleted(PackageStats, boolean)}
3537 * The observer's callback is invoked with a PackageStats object(containing the
3538 * code, data and cache sizes of the package) and a boolean value representing
3539 * the status of the operation. observer may be null to indicate that
3540 * no callback is desired.
3541 *
3542 * @hide
3543 */
Dianne Hackborn0c380492012-08-20 17:23:30 -07003544 public abstract void getPackageSizeInfo(String packageName, int userHandle,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003545 IPackageStatsObserver observer);
3546
3547 /**
Dianne Hackborn0c380492012-08-20 17:23:30 -07003548 * Like {@link #getPackageSizeInfo(String, int, IPackageStatsObserver)}, but
3549 * returns the size for the calling user.
3550 *
3551 * @hide
3552 */
3553 public void getPackageSizeInfo(String packageName, IPackageStatsObserver observer) {
3554 getPackageSizeInfo(packageName, UserHandle.myUserId(), observer);
3555 }
3556
3557 /**
Dianne Hackborna7ca0e52009-12-01 14:31:55 -08003558 * @deprecated This function no longer does anything; it was an old
kmccormickac66b852013-03-28 15:17:15 -07003559 * approach to managing preferred activities, which has been superseded
3560 * by (and conflicts with) the modern activity-based preferences.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003561 */
Dianne Hackborna7ca0e52009-12-01 14:31:55 -08003562 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003563 public abstract void addPackageToPreferred(String packageName);
3564
3565 /**
Dianne Hackborna7ca0e52009-12-01 14:31:55 -08003566 * @deprecated This function no longer does anything; it was an old
kmccormickac66b852013-03-28 15:17:15 -07003567 * approach to managing preferred activities, which has been superseded
3568 * by (and conflicts with) the modern activity-based preferences.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003569 */
Dianne Hackborna7ca0e52009-12-01 14:31:55 -08003570 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003571 public abstract void removePackageFromPreferred(String packageName);
3572
3573 /**
3574 * Retrieve the list of all currently configured preferred packages. The
3575 * first package on the list is the most preferred, the last is the
3576 * least preferred.
3577 *
3578 * @param flags Additional option flags. Use any combination of
3579 * {@link #GET_ACTIVITIES},
3580 * {@link #GET_GIDS},
3581 * {@link #GET_CONFIGURATIONS},
3582 * {@link #GET_INSTRUMENTATION},
3583 * {@link #GET_PERMISSIONS},
3584 * {@link #GET_PROVIDERS},
3585 * {@link #GET_RECEIVERS},
3586 * {@link #GET_SERVICES},
3587 * {@link #GET_SIGNATURES}, to modify the data returned.
3588 *
3589 * @return Returns a list of PackageInfo objects describing each
3590 * preferred application, in order of preference.
3591 *
3592 * @see #GET_ACTIVITIES
3593 * @see #GET_GIDS
3594 * @see #GET_CONFIGURATIONS
3595 * @see #GET_INSTRUMENTATION
3596 * @see #GET_PERMISSIONS
3597 * @see #GET_PROVIDERS
3598 * @see #GET_RECEIVERS
3599 * @see #GET_SERVICES
3600 * @see #GET_SIGNATURES
3601 */
3602 public abstract List<PackageInfo> getPreferredPackages(int flags);
3603
3604 /**
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08003605 * @deprecated This is a protected API that should not have been available
3606 * to third party applications. It is the platform's responsibility for
kmccormick30498b42013-03-27 17:39:17 -07003607 * assigning preferred activities and this cannot be directly modified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003608 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003609 * Add a new preferred activity mapping to the system. This will be used
3610 * to automatically select the given activity component when
3611 * {@link Context#startActivity(Intent) Context.startActivity()} finds
3612 * multiple matching activities and also matches the given filter.
3613 *
3614 * @param filter The set of intents under which this activity will be
3615 * made preferred.
3616 * @param match The IntentFilter match category that this preference
3617 * applies to.
3618 * @param set The set of activities that the user was picking from when
3619 * this preference was made.
3620 * @param activity The component name of the activity that is to be
3621 * preferred.
3622 */
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08003623 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003624 public abstract void addPreferredActivity(IntentFilter filter, int match,
3625 ComponentName[] set, ComponentName activity);
3626
3627 /**
Amith Yamasania3f133a2012-08-09 17:11:28 -07003628 * Same as {@link #addPreferredActivity(IntentFilter, int,
3629 ComponentName[], ComponentName)}, but with a specific userId to apply the preference
3630 to.
3631 * @hide
3632 */
3633 public void addPreferredActivity(IntentFilter filter, int match,
3634 ComponentName[] set, ComponentName activity, int userId) {
3635 throw new RuntimeException("Not implemented. Must override in a subclass.");
3636 }
3637
3638 /**
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08003639 * @deprecated This is a protected API that should not have been available
3640 * to third party applications. It is the platform's responsibility for
kmccormick30498b42013-03-27 17:39:17 -07003641 * assigning preferred activities and this cannot be directly modified.
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003642 *
Satish Sampath8dbe6122009-06-02 23:35:54 +01003643 * Replaces an existing preferred activity mapping to the system, and if that were not present
3644 * adds a new preferred activity. This will be used
3645 * to automatically select the given activity component when
3646 * {@link Context#startActivity(Intent) Context.startActivity()} finds
3647 * multiple matching activities and also matches the given filter.
3648 *
3649 * @param filter The set of intents under which this activity will be
3650 * made preferred.
3651 * @param match The IntentFilter match category that this preference
3652 * applies to.
3653 * @param set The set of activities that the user was picking from when
3654 * this preference was made.
3655 * @param activity The component name of the activity that is to be
3656 * preferred.
3657 * @hide
3658 */
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08003659 @Deprecated
Satish Sampath8dbe6122009-06-02 23:35:54 +01003660 public abstract void replacePreferredActivity(IntentFilter filter, int match,
3661 ComponentName[] set, ComponentName activity);
3662
3663 /**
Amith Yamasani41c1ded2014-08-05 11:15:05 -07003664 * @hide
3665 */
3666 @Deprecated
3667 public void replacePreferredActivityAsUser(IntentFilter filter, int match,
3668 ComponentName[] set, ComponentName activity, int userId) {
3669 throw new RuntimeException("Not implemented. Must override in a subclass.");
3670 }
3671
3672 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003673 * Remove all preferred activity mappings, previously added with
3674 * {@link #addPreferredActivity}, from the
3675 * system whose activities are implemented in the given package name.
Dianne Hackborn2ee89ea2010-03-10 18:27:09 -08003676 * An application can only clear its own package(s).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003677 *
3678 * @param packageName The name of the package whose preferred activity
3679 * mappings are to be removed.
3680 */
3681 public abstract void clearPackagePreferredActivities(String packageName);
3682
3683 /**
3684 * Retrieve all preferred activities, previously added with
3685 * {@link #addPreferredActivity}, that are
3686 * currently registered with the system.
3687 *
3688 * @param outFilters A list in which to place the filters of all of the
3689 * preferred activities, or null for none.
3690 * @param outActivities A list in which to place the component names of
3691 * all of the preferred activities, or null for none.
3692 * @param packageName An option package in which you would like to limit
3693 * the list. If null, all activities will be returned; if non-null, only
3694 * those activities in the given package are returned.
3695 *
3696 * @return Returns the total number of registered preferred activities
3697 * (the number of distinct IntentFilter records, not the number of unique
3698 * activity components) that were found.
3699 */
3700 public abstract int getPreferredActivities(List<IntentFilter> outFilters,
3701 List<ComponentName> outActivities, String packageName);
3702
3703 /**
Christopher Tatea2a08502013-09-05 16:38:58 -07003704 * Ask for the set of available 'home' activities and the current explicit
3705 * default, if any.
3706 * @hide
3707 */
3708 public abstract ComponentName getHomeActivities(List<ResolveInfo> outActivities);
3709
3710 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003711 * Set the enabled setting for a package component (activity, receiver, service, provider).
3712 * This setting will override any enabled state which may have been set by the component in its
3713 * manifest.
3714 *
3715 * @param componentName The component to enable
3716 * @param newState The new enabled state for the component. The legal values for this state
3717 * are:
3718 * {@link #COMPONENT_ENABLED_STATE_ENABLED},
3719 * {@link #COMPONENT_ENABLED_STATE_DISABLED}
3720 * and
3721 * {@link #COMPONENT_ENABLED_STATE_DEFAULT}
3722 * The last one removes the setting, thereby restoring the component's state to
3723 * whatever was set in it's manifest (or enabled, by default).
3724 * @param flags Optional behavior flags: {@link #DONT_KILL_APP} or 0.
3725 */
3726 public abstract void setComponentEnabledSetting(ComponentName componentName,
3727 int newState, int flags);
3728
3729
3730 /**
Amaury Medeirosdde24262014-06-03 20:06:41 -03003731 * Return the enabled setting for a package component (activity,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003732 * receiver, service, provider). This returns the last value set by
3733 * {@link #setComponentEnabledSetting(ComponentName, int, int)}; in most
3734 * cases this value will be {@link #COMPONENT_ENABLED_STATE_DEFAULT} since
3735 * the value originally specified in the manifest has not been modified.
3736 *
3737 * @param componentName The component to retrieve.
3738 * @return Returns the current enabled state for the component. May
3739 * be one of {@link #COMPONENT_ENABLED_STATE_ENABLED},
3740 * {@link #COMPONENT_ENABLED_STATE_DISABLED}, or
3741 * {@link #COMPONENT_ENABLED_STATE_DEFAULT}. The last one means the
3742 * component's enabled state is based on the original information in
3743 * the manifest as found in {@link ComponentInfo}.
3744 */
3745 public abstract int getComponentEnabledSetting(ComponentName componentName);
3746
3747 /**
3748 * Set the enabled setting for an application
3749 * This setting will override any enabled state which may have been set by the application in
3750 * its manifest. It also overrides the enabled state set in the manifest for any of the
3751 * application's components. It does not override any enabled state set by
3752 * {@link #setComponentEnabledSetting} for any of the application's components.
3753 *
3754 * @param packageName The package name of the application to enable
3755 * @param newState The new enabled state for the component. The legal values for this state
3756 * are:
3757 * {@link #COMPONENT_ENABLED_STATE_ENABLED},
3758 * {@link #COMPONENT_ENABLED_STATE_DISABLED}
3759 * and
3760 * {@link #COMPONENT_ENABLED_STATE_DEFAULT}
3761 * The last one removes the setting, thereby restoring the applications's state to
3762 * whatever was set in its manifest (or enabled, by default).
3763 * @param flags Optional behavior flags: {@link #DONT_KILL_APP} or 0.
3764 */
3765 public abstract void setApplicationEnabledSetting(String packageName,
3766 int newState, int flags);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003767
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003768 /**
Amaury Medeirosdde24262014-06-03 20:06:41 -03003769 * Return the enabled setting for an application. This returns
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003770 * the last value set by
3771 * {@link #setApplicationEnabledSetting(String, int, int)}; in most
3772 * cases this value will be {@link #COMPONENT_ENABLED_STATE_DEFAULT} since
3773 * the value originally specified in the manifest has not been modified.
3774 *
Amaury Medeirosdde24262014-06-03 20:06:41 -03003775 * @param packageName The package name of the application to retrieve.
3776 * @return Returns the current enabled state for the application. May
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003777 * be one of {@link #COMPONENT_ENABLED_STATE_ENABLED},
3778 * {@link #COMPONENT_ENABLED_STATE_DISABLED}, or
3779 * {@link #COMPONENT_ENABLED_STATE_DEFAULT}. The last one means the
3780 * application's enabled state is based on the original information in
3781 * the manifest as found in {@link ComponentInfo}.
Mathew Inwood1b9f8d92011-09-26 13:23:56 +01003782 * @throws IllegalArgumentException if the named package does not exist.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003783 */
3784 public abstract int getApplicationEnabledSetting(String packageName);
3785
3786 /**
Amith Yamasanie5bcff62014-07-19 15:44:09 -07003787 * Puts the package in a hidden state, which is almost like an uninstalled state,
Amith Yamasani655d0e22013-06-12 14:19:10 -07003788 * making the package unavailable, but it doesn't remove the data or the actual
Amith Yamasanie5bcff62014-07-19 15:44:09 -07003789 * package file. Application can be unhidden by either resetting the hidden state
3790 * or by installing it, such as with {@link #installExistingPackage(String)}
Amith Yamasani655d0e22013-06-12 14:19:10 -07003791 * @hide
3792 */
Amith Yamasanie5bcff62014-07-19 15:44:09 -07003793 public abstract boolean setApplicationHiddenSettingAsUser(String packageName, boolean hidden,
Amith Yamasani655d0e22013-06-12 14:19:10 -07003794 UserHandle userHandle);
3795
3796 /**
Amith Yamasanie5bcff62014-07-19 15:44:09 -07003797 * Returns the hidden state of a package.
3798 * @see #setApplicationHiddenSettingAsUser(String, boolean, UserHandle)
Amith Yamasani655d0e22013-06-12 14:19:10 -07003799 * @hide
3800 */
Amith Yamasanie5bcff62014-07-19 15:44:09 -07003801 public abstract boolean getApplicationHiddenSettingAsUser(String packageName,
Amith Yamasani655d0e22013-06-12 14:19:10 -07003802 UserHandle userHandle);
3803
3804 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003805 * Return whether the device has been booted into safe mode.
3806 */
3807 public abstract boolean isSafeMode();
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08003808
3809 /**
dcashman9d2f4412014-06-09 09:27:54 -07003810 * Return the {@link KeySet} associated with the String alias for this
3811 * application.
3812 *
3813 * @param alias The alias for a given {@link KeySet} as defined in the
3814 * application's AndroidManifest.xml.
dcashmanc6f22492014-08-14 09:54:51 -07003815 * @hide
dcashman9d2f4412014-06-09 09:27:54 -07003816 */
3817 public abstract KeySet getKeySetByAlias(String packageName, String alias);
3818
Ihab Awad1ec68882014-09-12 11:09:01 -07003819 /** Return the signing {@link KeySet} for this application.
dcashmanc6f22492014-08-14 09:54:51 -07003820 * @hide
3821 */
dcashman9d2f4412014-06-09 09:27:54 -07003822 public abstract KeySet getSigningKeySet(String packageName);
3823
3824 /**
3825 * Return whether the package denoted by packageName has been signed by all
3826 * of the keys specified by the {@link KeySet} ks. This will return true if
3827 * the package has been signed by additional keys (a superset) as well.
3828 * Compare to {@link #isSignedByExactly(String packageName, KeySet ks)}.
dcashmanc6f22492014-08-14 09:54:51 -07003829 * @hide
dcashman9d2f4412014-06-09 09:27:54 -07003830 */
3831 public abstract boolean isSignedBy(String packageName, KeySet ks);
3832
3833 /**
3834 * Return whether the package denoted by packageName has been signed by all
3835 * of, and only, the keys specified by the {@link KeySet} ks. Compare to
3836 * {@link #isSignedBy(String packageName, KeySet ks)}.
dcashmanc6f22492014-08-14 09:54:51 -07003837 * @hide
dcashman9d2f4412014-06-09 09:27:54 -07003838 */
3839 public abstract boolean isSignedByExactly(String packageName, KeySet ks);
3840
3841 /**
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -08003842 * Attempts to move package resources from internal to external media or vice versa.
3843 * Since this may take a little while, the result will
3844 * be posted back to the given observer. This call may fail if the calling context
3845 * lacks the {@link android.Manifest.permission#MOVE_PACKAGE} permission, if the
3846 * named package cannot be found, or if the named package is a "system package".
3847 *
3848 * @param packageName The name of the package to delete
3849 * @param observer An observer callback to get notified when the package move is
3850 * complete. {@link android.content.pm.IPackageMoveObserver#packageMoved(boolean)} will be
3851 * called when that happens. observer may be null to indicate that no callback is desired.
3852 * @param flags To indicate install location {@link #MOVE_INTERNAL} or
3853 * {@link #MOVE_EXTERNAL_MEDIA}
3854 *
3855 * @hide
3856 */
3857 public abstract void movePackage(
3858 String packageName, IPackageMoveObserver observer, int flags);
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003859
3860 /**
Amith Yamasani13593602012-03-22 16:16:17 -07003861 * Returns the device identity that verifiers can use to associate their scheme to a particular
3862 * device. This should not be used by anything other than a package verifier.
Aravind Akella068b0c02013-10-12 17:39:15 -07003863 *
Kenny Root0aaa0d92011-09-12 16:42:55 -07003864 * @return identity that uniquely identifies current device
3865 * @hide
3866 */
3867 public abstract VerifierDeviceIdentity getVerifierDeviceIdentity();
Amith Yamasani742a6712011-05-04 14:49:28 -07003868
Jeff Sharkey6c833e02014-07-14 22:44:30 -07003869 /**
3870 * Return interface that offers the ability to install, upgrade, and remove
3871 * applications on the device.
3872 */
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07003873 public abstract @NonNull PackageInstaller getPackageInstaller();
Jeff Sharkey3a44f3f2014-04-28 17:36:31 -07003874
Amith Yamasani742a6712011-05-04 14:49:28 -07003875 /**
3876 * Returns the data directory for a particular user and package, given the uid of the package.
3877 * @param uid uid of the package, including the userId and appId
3878 * @param packageName name of the package
3879 * @return the user-specific data directory for the package
3880 * @hide
3881 */
3882 public static String getDataDirForUser(int userId, String packageName) {
3883 // TODO: This should be shared with Installer's knowledge of user directory
3884 return Environment.getDataDirectory().toString() + "/user/" + userId
3885 + "/" + packageName;
3886 }
Nicolas Prevotc79586e2014-05-06 12:47:57 +01003887
3888 /**
Nicolas Prevot81948992014-05-16 18:25:26 +01003889 * Adds a {@link CrossProfileIntentFilter}. After calling this method all intents sent from the
3890 * user with id sourceUserId can also be be resolved by activities in the user with id
3891 * targetUserId if they match the specified intent filter.
Nicolas Prevot3f7777f2014-07-24 15:58:39 +01003892 * @param filter The {@link IntentFilter} the intent has to match
3893 * @param sourceUserId The source user id.
3894 * @param targetUserId The target user id.
3895 * @param flags The only possible value is {@link SKIP_CURRENT_PROFILE}
Nicolas Prevotc79586e2014-05-06 12:47:57 +01003896 * @hide
3897 */
Nicolas Prevot63798c52014-05-27 13:22:38 +01003898 public abstract void addCrossProfileIntentFilter(IntentFilter filter, int sourceUserId,
3899 int targetUserId, int flags);
Nicolas Prevotc79586e2014-05-06 12:47:57 +01003900
3901 /**
Nicolas Prevot63798c52014-05-27 13:22:38 +01003902 * Clearing {@link CrossProfileIntentFilter}s which have the specified user as their
Nicolas Prevot3f7777f2014-07-24 15:58:39 +01003903 * source, and have been set by the app calling this method.
3904 * @param sourceUserId The source user id.
Nicolas Prevotc79586e2014-05-06 12:47:57 +01003905 * @hide
3906 */
Nicolas Prevot81948992014-05-16 18:25:26 +01003907 public abstract void clearCrossProfileIntentFilters(int sourceUserId);
Alexandra Gherghina6e2ae252014-06-12 16:03:58 +01003908
3909 /**
Nicolas Prevot88cc3462014-05-14 14:51:48 +01003910 * @hide
3911 */
Nicolas Prevot7f7b0c72014-06-23 15:59:38 +01003912 public abstract Drawable loadItemIcon(PackageItemInfo itemInfo, ApplicationInfo appInfo);
Jeff Sharkey6c833e02014-07-14 22:44:30 -07003913
3914 /** {@hide} */
3915 public abstract boolean isPackageAvailable(String packageName);
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07003916
3917 /** {@hide} */
Jeff Sharkeya0907432014-08-15 10:23:11 -07003918 public static String installStatusToString(int status, String msg) {
3919 final String str = installStatusToString(status);
3920 if (msg != null) {
3921 return str + ": " + msg;
3922 } else {
3923 return str;
3924 }
3925 }
3926
3927 /** {@hide} */
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07003928 public static String installStatusToString(int status) {
3929 switch (status) {
3930 case INSTALL_SUCCEEDED: return "INSTALL_SUCCEEDED";
3931 case INSTALL_FAILED_ALREADY_EXISTS: return "INSTALL_FAILED_ALREADY_EXISTS";
3932 case INSTALL_FAILED_INVALID_APK: return "INSTALL_FAILED_INVALID_APK";
3933 case INSTALL_FAILED_INVALID_URI: return "INSTALL_FAILED_INVALID_URI";
3934 case INSTALL_FAILED_INSUFFICIENT_STORAGE: return "INSTALL_FAILED_INSUFFICIENT_STORAGE";
3935 case INSTALL_FAILED_DUPLICATE_PACKAGE: return "INSTALL_FAILED_DUPLICATE_PACKAGE";
3936 case INSTALL_FAILED_NO_SHARED_USER: return "INSTALL_FAILED_NO_SHARED_USER";
3937 case INSTALL_FAILED_UPDATE_INCOMPATIBLE: return "INSTALL_FAILED_UPDATE_INCOMPATIBLE";
3938 case INSTALL_FAILED_SHARED_USER_INCOMPATIBLE: return "INSTALL_FAILED_SHARED_USER_INCOMPATIBLE";
3939 case INSTALL_FAILED_MISSING_SHARED_LIBRARY: return "INSTALL_FAILED_MISSING_SHARED_LIBRARY";
3940 case INSTALL_FAILED_REPLACE_COULDNT_DELETE: return "INSTALL_FAILED_REPLACE_COULDNT_DELETE";
3941 case INSTALL_FAILED_DEXOPT: return "INSTALL_FAILED_DEXOPT";
3942 case INSTALL_FAILED_OLDER_SDK: return "INSTALL_FAILED_OLDER_SDK";
3943 case INSTALL_FAILED_CONFLICTING_PROVIDER: return "INSTALL_FAILED_CONFLICTING_PROVIDER";
3944 case INSTALL_FAILED_NEWER_SDK: return "INSTALL_FAILED_NEWER_SDK";
3945 case INSTALL_FAILED_TEST_ONLY: return "INSTALL_FAILED_TEST_ONLY";
3946 case INSTALL_FAILED_CPU_ABI_INCOMPATIBLE: return "INSTALL_FAILED_CPU_ABI_INCOMPATIBLE";
3947 case INSTALL_FAILED_MISSING_FEATURE: return "INSTALL_FAILED_MISSING_FEATURE";
3948 case INSTALL_FAILED_CONTAINER_ERROR: return "INSTALL_FAILED_CONTAINER_ERROR";
3949 case INSTALL_FAILED_INVALID_INSTALL_LOCATION: return "INSTALL_FAILED_INVALID_INSTALL_LOCATION";
3950 case INSTALL_FAILED_MEDIA_UNAVAILABLE: return "INSTALL_FAILED_MEDIA_UNAVAILABLE";
3951 case INSTALL_FAILED_VERIFICATION_TIMEOUT: return "INSTALL_FAILED_VERIFICATION_TIMEOUT";
3952 case INSTALL_FAILED_VERIFICATION_FAILURE: return "INSTALL_FAILED_VERIFICATION_FAILURE";
3953 case INSTALL_FAILED_PACKAGE_CHANGED: return "INSTALL_FAILED_PACKAGE_CHANGED";
3954 case INSTALL_FAILED_UID_CHANGED: return "INSTALL_FAILED_UID_CHANGED";
3955 case INSTALL_FAILED_VERSION_DOWNGRADE: return "INSTALL_FAILED_VERSION_DOWNGRADE";
3956 case INSTALL_PARSE_FAILED_NOT_APK: return "INSTALL_PARSE_FAILED_NOT_APK";
3957 case INSTALL_PARSE_FAILED_BAD_MANIFEST: return "INSTALL_PARSE_FAILED_BAD_MANIFEST";
3958 case INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION: return "INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION";
3959 case INSTALL_PARSE_FAILED_NO_CERTIFICATES: return "INSTALL_PARSE_FAILED_NO_CERTIFICATES";
3960 case INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES: return "INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES";
3961 case INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING: return "INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING";
3962 case INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME: return "INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME";
3963 case INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID: return "INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID";
3964 case INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: return "INSTALL_PARSE_FAILED_MANIFEST_MALFORMED";
3965 case INSTALL_PARSE_FAILED_MANIFEST_EMPTY: return "INSTALL_PARSE_FAILED_MANIFEST_EMPTY";
3966 case INSTALL_FAILED_INTERNAL_ERROR: return "INSTALL_FAILED_INTERNAL_ERROR";
3967 case INSTALL_FAILED_USER_RESTRICTED: return "INSTALL_FAILED_USER_RESTRICTED";
3968 case INSTALL_FAILED_DUPLICATE_PERMISSION: return "INSTALL_FAILED_DUPLICATE_PERMISSION";
3969 case INSTALL_FAILED_NO_MATCHING_ABIS: return "INSTALL_FAILED_NO_MATCHING_ABIS";
Jeff Sharkeyf0600952014-08-07 17:31:53 -07003970 case INSTALL_FAILED_ABORTED: return "INSTALL_FAILED_ABORTED";
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07003971 default: return Integer.toString(status);
3972 }
3973 }
3974
3975 /** {@hide} */
Jeff Sharkeya0907432014-08-15 10:23:11 -07003976 public static int installStatusToPublicStatus(int status) {
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07003977 switch (status) {
Jeff Sharkeya0907432014-08-15 10:23:11 -07003978 case INSTALL_SUCCEEDED: return PackageInstaller.STATUS_SUCCESS;
3979 case INSTALL_FAILED_ALREADY_EXISTS: return PackageInstaller.STATUS_FAILURE_CONFLICT;
3980 case INSTALL_FAILED_INVALID_APK: return PackageInstaller.STATUS_FAILURE_INVALID;
3981 case INSTALL_FAILED_INVALID_URI: return PackageInstaller.STATUS_FAILURE_INVALID;
3982 case INSTALL_FAILED_INSUFFICIENT_STORAGE: return PackageInstaller.STATUS_FAILURE_STORAGE;
3983 case INSTALL_FAILED_DUPLICATE_PACKAGE: return PackageInstaller.STATUS_FAILURE_CONFLICT;
3984 case INSTALL_FAILED_NO_SHARED_USER: return PackageInstaller.STATUS_FAILURE_CONFLICT;
3985 case INSTALL_FAILED_UPDATE_INCOMPATIBLE: return PackageInstaller.STATUS_FAILURE_CONFLICT;
3986 case INSTALL_FAILED_SHARED_USER_INCOMPATIBLE: return PackageInstaller.STATUS_FAILURE_CONFLICT;
3987 case INSTALL_FAILED_MISSING_SHARED_LIBRARY: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
3988 case INSTALL_FAILED_REPLACE_COULDNT_DELETE: return PackageInstaller.STATUS_FAILURE_CONFLICT;
3989 case INSTALL_FAILED_DEXOPT: return PackageInstaller.STATUS_FAILURE_INVALID;
3990 case INSTALL_FAILED_OLDER_SDK: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
3991 case INSTALL_FAILED_CONFLICTING_PROVIDER: return PackageInstaller.STATUS_FAILURE_CONFLICT;
3992 case INSTALL_FAILED_NEWER_SDK: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
3993 case INSTALL_FAILED_TEST_ONLY: return PackageInstaller.STATUS_FAILURE_INVALID;
3994 case INSTALL_FAILED_CPU_ABI_INCOMPATIBLE: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
3995 case INSTALL_FAILED_MISSING_FEATURE: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
3996 case INSTALL_FAILED_CONTAINER_ERROR: return PackageInstaller.STATUS_FAILURE_STORAGE;
3997 case INSTALL_FAILED_INVALID_INSTALL_LOCATION: return PackageInstaller.STATUS_FAILURE_STORAGE;
3998 case INSTALL_FAILED_MEDIA_UNAVAILABLE: return PackageInstaller.STATUS_FAILURE_STORAGE;
3999 case INSTALL_FAILED_VERIFICATION_TIMEOUT: return PackageInstaller.STATUS_FAILURE_ABORTED;
4000 case INSTALL_FAILED_VERIFICATION_FAILURE: return PackageInstaller.STATUS_FAILURE_ABORTED;
4001 case INSTALL_FAILED_PACKAGE_CHANGED: return PackageInstaller.STATUS_FAILURE_INVALID;
4002 case INSTALL_FAILED_UID_CHANGED: return PackageInstaller.STATUS_FAILURE_INVALID;
4003 case INSTALL_FAILED_VERSION_DOWNGRADE: return PackageInstaller.STATUS_FAILURE_INVALID;
4004 case INSTALL_PARSE_FAILED_NOT_APK: return PackageInstaller.STATUS_FAILURE_INVALID;
4005 case INSTALL_PARSE_FAILED_BAD_MANIFEST: return PackageInstaller.STATUS_FAILURE_INVALID;
4006 case INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION: return PackageInstaller.STATUS_FAILURE_INVALID;
4007 case INSTALL_PARSE_FAILED_NO_CERTIFICATES: return PackageInstaller.STATUS_FAILURE_INVALID;
4008 case INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES: return PackageInstaller.STATUS_FAILURE_INVALID;
4009 case INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING: return PackageInstaller.STATUS_FAILURE_INVALID;
4010 case INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME: return PackageInstaller.STATUS_FAILURE_INVALID;
4011 case INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID: return PackageInstaller.STATUS_FAILURE_INVALID;
4012 case INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: return PackageInstaller.STATUS_FAILURE_INVALID;
4013 case INSTALL_PARSE_FAILED_MANIFEST_EMPTY: return PackageInstaller.STATUS_FAILURE_INVALID;
4014 case INSTALL_FAILED_INTERNAL_ERROR: return PackageInstaller.STATUS_FAILURE;
4015 case INSTALL_FAILED_USER_RESTRICTED: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
4016 case INSTALL_FAILED_DUPLICATE_PERMISSION: return PackageInstaller.STATUS_FAILURE_CONFLICT;
4017 case INSTALL_FAILED_NO_MATCHING_ABIS: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE;
4018 case INSTALL_FAILED_ABORTED: return PackageInstaller.STATUS_FAILURE_ABORTED;
4019 default: return PackageInstaller.STATUS_FAILURE;
4020 }
4021 }
4022
4023 /** {@hide} */
4024 public static String deleteStatusToString(int status, String msg) {
4025 final String str = deleteStatusToString(status);
4026 if (msg != null) {
4027 return str + ": " + msg;
4028 } else {
4029 return str;
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07004030 }
4031 }
4032
4033 /** {@hide} */
4034 public static String deleteStatusToString(int status) {
4035 switch (status) {
4036 case DELETE_SUCCEEDED: return "DELETE_SUCCEEDED";
4037 case DELETE_FAILED_INTERNAL_ERROR: return "DELETE_FAILED_INTERNAL_ERROR";
4038 case DELETE_FAILED_DEVICE_POLICY_MANAGER: return "DELETE_FAILED_DEVICE_POLICY_MANAGER";
4039 case DELETE_FAILED_USER_RESTRICTED: return "DELETE_FAILED_USER_RESTRICTED";
4040 case DELETE_FAILED_OWNER_BLOCKED: return "DELETE_FAILED_OWNER_BLOCKED";
Jeff Sharkeyf0600952014-08-07 17:31:53 -07004041 case DELETE_FAILED_ABORTED: return "DELETE_FAILED_ABORTED";
Jeff Sharkey16c8e3f2014-07-24 17:08:17 -07004042 default: return Integer.toString(status);
4043 }
4044 }
Jeff Sharkeyf0600952014-08-07 17:31:53 -07004045
4046 /** {@hide} */
Jeff Sharkeya0907432014-08-15 10:23:11 -07004047 public static int deleteStatusToPublicStatus(int status) {
Jeff Sharkeyf0600952014-08-07 17:31:53 -07004048 switch (status) {
Jeff Sharkeya0907432014-08-15 10:23:11 -07004049 case DELETE_SUCCEEDED: return PackageInstaller.STATUS_SUCCESS;
4050 case DELETE_FAILED_INTERNAL_ERROR: return PackageInstaller.STATUS_FAILURE;
4051 case DELETE_FAILED_DEVICE_POLICY_MANAGER: return PackageInstaller.STATUS_FAILURE_BLOCKED;
4052 case DELETE_FAILED_USER_RESTRICTED: return PackageInstaller.STATUS_FAILURE_BLOCKED;
4053 case DELETE_FAILED_OWNER_BLOCKED: return PackageInstaller.STATUS_FAILURE_BLOCKED;
4054 case DELETE_FAILED_ABORTED: return PackageInstaller.STATUS_FAILURE_ABORTED;
4055 default: return PackageInstaller.STATUS_FAILURE;
Jeff Sharkeyf0600952014-08-07 17:31:53 -07004056 }
4057 }
Jeff Sharkey6c0b9da2014-08-07 22:07:11 -07004058
4059 /** {@hide} */
4060 public static class LegacyPackageInstallObserver extends PackageInstallObserver {
4061 private final IPackageInstallObserver mLegacy;
4062
4063 public LegacyPackageInstallObserver(IPackageInstallObserver legacy) {
4064 mLegacy = legacy;
4065 }
4066
4067 @Override
4068 public void onPackageInstalled(String basePackageName, int returnCode, String msg,
4069 Bundle extras) {
4070 if (mLegacy == null) return;
4071 try {
4072 mLegacy.packageInstalled(basePackageName, returnCode);
4073 } catch (RemoteException ignored) {
4074 }
4075 }
4076 }
4077
4078 /** {@hide} */
4079 public static class LegacyPackageDeleteObserver extends PackageDeleteObserver {
4080 private final IPackageDeleteObserver mLegacy;
4081
4082 public LegacyPackageDeleteObserver(IPackageDeleteObserver legacy) {
4083 mLegacy = legacy;
4084 }
4085
4086 @Override
4087 public void onPackageDeleted(String basePackageName, int returnCode, String msg) {
4088 if (mLegacy == null) return;
4089 try {
4090 mLegacy.packageDeleted(basePackageName, returnCode);
4091 } catch (RemoteException ignored) {
4092 }
4093 }
4094 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004095}