blob: 4c9c278a718ee271c7ca04d185f4c0f263eda304 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2**
3** Copyright 2007, The Android Open Source Project
4**
5** Licensed under the Apache License, Version 2.0 (the "License");
6** you may not use this file except in compliance with the License.
7** You may obtain a copy of the License at
8**
9** http://www.apache.org/licenses/LICENSE-2.0
10**
11** Unless required by applicable law or agreed to in writing, software
12** distributed under the License is distributed on an "AS IS" BASIS,
13** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14** See the License for the specific language governing permissions and
15** limitations under the License.
16*/
17
18package android.content.pm;
19
20import android.content.ComponentName;
21import android.content.Intent;
22import android.content.IntentFilter;
23import android.content.pm.ActivityInfo;
24import android.content.pm.ApplicationInfo;
Anonymous Cowardceb1b0b2012-04-24 10:35:16 -070025import android.content.pm.ContainerEncryptionParams;
Dianne Hackborn49237342009-08-27 20:08:01 -070026import android.content.pm.FeatureInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080027import android.content.pm.IPackageInstallObserver;
28import android.content.pm.IPackageDeleteObserver;
29import android.content.pm.IPackageDataObserver;
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -080030import android.content.pm.IPackageMoveObserver;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080031import android.content.pm.IPackageStatsObserver;
32import android.content.pm.InstrumentationInfo;
33import android.content.pm.PackageInfo;
Kenny Root5ab21572011-07-27 11:11:19 -070034import android.content.pm.ManifestDigest;
Dianne Hackborn7767eac2012-08-23 18:25:40 -070035import android.content.pm.PackageCleanItem;
Kenny Root0e2c0f32011-04-15 17:50:10 -070036import android.content.pm.ParceledListSlice;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080037import android.content.pm.ProviderInfo;
38import android.content.pm.PermissionGroupInfo;
39import android.content.pm.PermissionInfo;
40import android.content.pm.ResolveInfo;
41import android.content.pm.ServiceInfo;
Amith Yamasani0b285492011-04-14 17:35:23 -070042import android.content.pm.UserInfo;
rich cannings706e8ba2012-08-20 13:20:14 -070043import android.content.pm.VerificationParams;
Kenny Root0aaa0d92011-09-12 16:42:55 -070044import android.content.pm.VerifierDeviceIdentity;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080045import android.net.Uri;
Amith Yamasanib8151ec2012-04-18 18:02:48 -070046import android.os.ParcelFileDescriptor;
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -070047import android.content.IntentSender;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080048
49/**
50 * See {@link PackageManager} for documentation on most of the APIs
51 * here.
52 *
53 * {@hide}
54 */
55interface IPackageManager {
Amith Yamasani483f3b02012-03-13 16:08:00 -070056 PackageInfo getPackageInfo(String packageName, int flags, int userId);
57 int getPackageUid(String packageName, int userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080058 int[] getPackageGids(String packageName);
Dianne Hackborn47096932010-02-11 15:57:09 -080059
60 String[] currentToCanonicalPackageNames(in String[] names);
61 String[] canonicalToCurrentPackageNames(in String[] names);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080062
63 PermissionInfo getPermissionInfo(String name, int flags);
64
65 List<PermissionInfo> queryPermissionsByGroup(String group, int flags);
66
67 PermissionGroupInfo getPermissionGroupInfo(String name, int flags);
68
69 List<PermissionGroupInfo> getAllPermissionGroups(int flags);
70
Amith Yamasani483f3b02012-03-13 16:08:00 -070071 ApplicationInfo getApplicationInfo(String packageName, int flags ,int userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080072
Amith Yamasani483f3b02012-03-13 16:08:00 -070073 ActivityInfo getActivityInfo(in ComponentName className, int flags, int userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080074
Amith Yamasani483f3b02012-03-13 16:08:00 -070075 ActivityInfo getReceiverInfo(in ComponentName className, int flags, int userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080076
Amith Yamasani483f3b02012-03-13 16:08:00 -070077 ServiceInfo getServiceInfo(in ComponentName className, int flags, int userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080078
Amith Yamasani483f3b02012-03-13 16:08:00 -070079 ProviderInfo getProviderInfo(in ComponentName className, int flags, int userId);
Dianne Hackborn361199b2010-08-30 17:42:07 -070080
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080081 int checkPermission(String permName, String pkgName);
82
83 int checkUidPermission(String permName, int uid);
84
85 boolean addPermission(in PermissionInfo info);
86
87 void removePermission(String name);
Dianne Hackborne639da72012-02-21 15:11:13 -080088
89 void grantPermission(String packageName, String permissionName);
90
91 void revokePermission(String packageName, String permissionName);
92
Dianne Hackborn854060af2009-07-09 18:14:31 -070093 boolean isProtectedBroadcast(String actionName);
94
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080095 int checkSignatures(String pkg1, String pkg2);
96
Dianne Hackborn766cbfe2009-08-12 18:33:39 -070097 int checkUidSignatures(int uid1, int uid2);
98
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080099 String[] getPackagesForUid(int uid);
100
101 String getNameForUid(int uid);
102
103 int getUidForSharedUser(String sharedUserName);
104
Amith Yamasani483f3b02012-03-13 16:08:00 -0700105 ResolveInfo resolveIntent(in Intent intent, String resolvedType, int flags, int userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800106
107 List<ResolveInfo> queryIntentActivities(in Intent intent,
Amith Yamasani483f3b02012-03-13 16:08:00 -0700108 String resolvedType, int flags, int userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800109
110 List<ResolveInfo> queryIntentActivityOptions(
111 in ComponentName caller, in Intent[] specifics,
112 in String[] specificTypes, in Intent intent,
Amith Yamasani483f3b02012-03-13 16:08:00 -0700113 String resolvedType, int flags, int userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800114
115 List<ResolveInfo> queryIntentReceivers(in Intent intent,
Amith Yamasani483f3b02012-03-13 16:08:00 -0700116 String resolvedType, int flags, int userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800117
118 ResolveInfo resolveService(in Intent intent,
Amith Yamasani483f3b02012-03-13 16:08:00 -0700119 String resolvedType, int flags, int userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800120
121 List<ResolveInfo> queryIntentServices(in Intent intent,
Amith Yamasani483f3b02012-03-13 16:08:00 -0700122 String resolvedType, int flags, int userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800123
Kenny Root0e2c0f32011-04-15 17:50:10 -0700124 /**
125 * This implements getInstalledPackages via a "last returned row"
126 * mechanism that is not exposed in the API. This is to get around the IPC
127 * limit that kicks in when flags are included that bloat up the data
128 * returned.
129 */
Amith Yamasani151ec4c2012-09-07 19:25:16 -0700130 ParceledListSlice getInstalledPackages(int flags, in String lastRead, in int userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800131
Kenny Root0e2c0f32011-04-15 17:50:10 -0700132 /**
Dianne Hackborne7991752013-01-16 17:56:46 -0800133 * This implements getPackagesHoldingPermissions via a "last returned row"
134 * mechanism that is not exposed in the API. This is to get around the IPC
135 * limit that kicks in when flags are included that bloat up the data
136 * returned.
137 */
138 ParceledListSlice getPackagesHoldingPermissions(in String[] permissions,
139 int flags, in String lastRead, int userId);
140
141 /**
Kenny Root0e2c0f32011-04-15 17:50:10 -0700142 * This implements getInstalledApplications via a "last returned row"
143 * mechanism that is not exposed in the API. This is to get around the IPC
144 * limit that kicks in when flags are included that bloat up the data
145 * returned.
146 */
Amith Yamasani483f3b02012-03-13 16:08:00 -0700147 ParceledListSlice getInstalledApplications(int flags, in String lastRead, int userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800148
149 /**
150 * Retrieve all applications that are marked as persistent.
151 *
152 * @return A List&lt;applicationInfo> containing one entry for each persistent
153 * application.
154 */
155 List<ApplicationInfo> getPersistentApplications(int flags);
156
Amith Yamasani483f3b02012-03-13 16:08:00 -0700157 ProviderInfo resolveContentProvider(String name, int flags, int userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800158
159 /**
160 * Retrieve sync information for all content providers.
161 *
162 * @param outNames Filled in with a list of the root names of the content
163 * providers that can sync.
164 * @param outInfo Filled in with a list of the ProviderInfo for each
165 * name in 'outNames'.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800166 */
167 void querySyncProviders(inout List<String> outNames,
168 inout List<ProviderInfo> outInfo);
169
170 List<ProviderInfo> queryContentProviders(
171 String processName, int uid, int flags);
172
173 InstrumentationInfo getInstrumentationInfo(
174 in ComponentName className, int flags);
175
176 List<InstrumentationInfo> queryInstrumentation(
177 String targetPackage, int flags);
178
179 /**
180 * Install a package.
181 *
182 * @param packageURI The location of the package file to install.
183 * @param observer a callback to use to notify when the package installation in finished.
184 * @param flags - possible values: {@link #FORWARD_LOCK_PACKAGE},
185 * {@link #REPLACE_EXISITING_PACKAGE}
Jacek Surazski65e13172009-04-28 15:26:38 +0200186 * @param installerPackageName Optional package name of the application that is performing the
187 * installation. This identifies which market the package came from.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800188 */
Jacek Surazski65e13172009-04-28 15:26:38 +0200189 void installPackage(in Uri packageURI, IPackageInstallObserver observer, int flags,
190 in String installerPackageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800191
Christopher Tate1bb69062010-02-19 17:02:12 -0800192 void finishPackageInstall(int token);
193
Dianne Hackborn880119b2010-11-18 22:26:40 -0800194 void setInstallerPackageName(in String targetPackage, in String installerPackageName);
195
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800196 /**
197 * Delete a package.
198 *
199 * @param packageName The fully qualified name of the package to delete.
200 * @param observer a callback to use to notify when the package deletion in finished.
201 * @param flags - possible values: {@link #DONT_DELETE_DATA}
202 */
203 void deletePackage(in String packageName, IPackageDeleteObserver observer, int flags);
204
Jacek Surazski65e13172009-04-28 15:26:38 +0200205 String getInstallerPackageName(in String packageName);
206
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800207 void addPackageToPreferred(String packageName);
208
209 void removePackageFromPreferred(String packageName);
210
211 List<PackageInfo> getPreferredPackages(int flags);
212
213 void addPreferredActivity(in IntentFilter filter, int match,
Amith Yamasania3f133a2012-08-09 17:11:28 -0700214 in ComponentName[] set, in ComponentName activity, int userId);
Satish Sampath8dbe6122009-06-02 23:35:54 +0100215
216 void replacePreferredActivity(in IntentFilter filter, int match,
217 in ComponentName[] set, in ComponentName activity);
218
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800219 void clearPackagePreferredActivities(String packageName);
Satish Sampath8dbe6122009-06-02 23:35:54 +0100220
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800221 int getPreferredActivities(out List<IntentFilter> outFilters,
222 out List<ComponentName> outActivities, String packageName);
223
224 /**
225 * As per {@link android.content.pm.PackageManager#setComponentEnabledSetting}.
226 */
227 void setComponentEnabledSetting(in ComponentName componentName,
Amith Yamasani483f3b02012-03-13 16:08:00 -0700228 in int newState, in int flags, int userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800229
230 /**
231 * As per {@link android.content.pm.PackageManager#getComponentEnabledSetting}.
232 */
Amith Yamasani483f3b02012-03-13 16:08:00 -0700233 int getComponentEnabledSetting(in ComponentName componentName, int userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800234
235 /**
236 * As per {@link android.content.pm.PackageManager#setApplicationEnabledSetting}.
237 */
Amith Yamasani483f3b02012-03-13 16:08:00 -0700238 void setApplicationEnabledSetting(in String packageName, in int newState, int flags, int userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800239
240 /**
241 * As per {@link android.content.pm.PackageManager#getApplicationEnabledSetting}.
242 */
Amith Yamasani483f3b02012-03-13 16:08:00 -0700243 int getApplicationEnabledSetting(in String packageName, int userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800244
245 /**
Dianne Hackborne7f97212011-02-24 14:40:20 -0800246 * Set whether the given package should be considered stopped, making
247 * it not visible to implicit intents that filter out stopped packages.
248 */
Amith Yamasani483f3b02012-03-13 16:08:00 -0700249 void setPackageStoppedState(String packageName, boolean stopped, int userId);
Dianne Hackborne7f97212011-02-24 14:40:20 -0800250
251 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800252 * Free storage by deleting LRU sorted list of cache files across
253 * all applications. If the currently available free storage
254 * on the device is greater than or equal to the requested
255 * free storage, no cache files are cleared. If the currently
256 * available storage on the device is less than the requested
257 * free storage, some or all of the cache files across
258 * all applications are deleted (based on last accessed time)
259 * to increase the free storage space on the device to
260 * the requested value. There is no guarantee that clearing all
261 * the cache files from all applications will clear up
262 * enough storage to achieve the desired value.
263 * @param freeStorageSize The number of bytes of storage to be
264 * freed by the system. Say if freeStorageSize is XX,
265 * and the current free storage is YY,
266 * if XX is less than YY, just return. if not free XX-YY number
267 * of bytes if possible.
268 * @param observer call back used to notify when
269 * the operation is completed
270 */
271 void freeStorageAndNotify(in long freeStorageSize,
272 IPackageDataObserver observer);
273
274 /**
275 * Free storage by deleting LRU sorted list of cache files across
276 * all applications. If the currently available free storage
277 * on the device is greater than or equal to the requested
278 * free storage, no cache files are cleared. If the currently
279 * available storage on the device is less than the requested
280 * free storage, some or all of the cache files across
281 * all applications are deleted (based on last accessed time)
282 * to increase the free storage space on the device to
283 * the requested value. There is no guarantee that clearing all
284 * the cache files from all applications will clear up
285 * enough storage to achieve the desired value.
286 * @param freeStorageSize The number of bytes of storage to be
287 * freed by the system. Say if freeStorageSize is XX,
288 * and the current free storage is YY,
289 * if XX is less than YY, just return. if not free XX-YY number
290 * of bytes if possible.
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -0700291 * @param pi IntentSender call back used to
292 * notify when the operation is completed.May be null
293 * to indicate that no call back is desired.
294 */
Suchi Amalapurapubc806f62009-06-17 15:18:19 -0700295 void freeStorage(in long freeStorageSize,
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -0700296 in IntentSender pi);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800297
298 /**
299 * Delete all the cache files in an applications cache directory
300 * @param packageName The package name of the application whose cache
301 * files need to be deleted
302 * @param observer a callback used to notify when the deletion is finished.
303 */
304 void deleteApplicationCacheFiles(in String packageName, IPackageDataObserver observer);
305
306 /**
307 * Clear the user data directory of an application.
308 * @param packageName The package name of the application whose cache
309 * files need to be deleted
310 * @param observer a callback used to notify when the operation is completed.
311 */
Amith Yamasani483f3b02012-03-13 16:08:00 -0700312 void clearApplicationUserData(in String packageName, IPackageDataObserver observer, int userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800313
314 /**
315 * Get package statistics including the code, data and cache size for
316 * an already installed package
317 * @param packageName The package name of the application
Dianne Hackborn0c380492012-08-20 17:23:30 -0700318 * @param userHandle Which user the size should be retrieved for
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800319 * @param observer a callback to use to notify when the asynchronous
320 * retrieval of information is complete.
321 */
Dianne Hackborn0c380492012-08-20 17:23:30 -0700322 void getPackageSizeInfo(in String packageName, int userHandle, IPackageStatsObserver observer);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800323
324 /**
325 * Get a list of shared libraries that are available on the
326 * system.
327 */
328 String[] getSystemSharedLibraryNames();
329
Dianne Hackborn49237342009-08-27 20:08:01 -0700330 /**
331 * Get a list of features that are available on the
332 * system.
333 */
334 FeatureInfo[] getSystemAvailableFeatures();
335
Dianne Hackborn039c68e2009-09-26 16:39:23 -0700336 boolean hasSystemFeature(String name);
337
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800338 void enterSafeMode();
339 boolean isSafeMode();
340 void systemReady();
341 boolean hasSystemUidErrors();
Dianne Hackborn661cd522011-08-22 00:26:20 -0700342
343 /**
344 * Ask the package manager to perform boot-time dex-opt of all
345 * existing packages.
346 */
347 void performBootDexOpt();
348
Dianne Hackborn5c1e00b2009-06-18 17:10:57 -0700349 /**
350 * Ask the package manager to perform dex-opt (if needed) on the given
351 * package, if it already hasn't done mode. Only does this if running
352 * in the special development "no pre-dexopt" mode.
353 */
354 boolean performDexOpt(String packageName);
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800355
356 /**
357 * Update status of external media on the package manager to scan and
358 * install packages installed on the external media. Like say the
359 * MountService uses this to call into the package manager to update
360 * status of sdcard.
361 */
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -0700362 void updateExternalMediaStatus(boolean mounted, boolean reportStatus);
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800363
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700364 PackageCleanItem nextPackageToClean(in PackageCleanItem lastPackage);
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -0800365
366 void movePackage(String packageName, IPackageMoveObserver observer, int flags);
Rich Canningse1d7c712012-08-08 12:46:06 -0700367
Dianne Hackbornd7c09682010-03-30 10:42:20 -0700368 boolean addPermissionAsync(in PermissionInfo info);
Suchi Amalapurapu40e47252010-04-07 16:15:50 -0700369
370 boolean setInstallLocation(int loc);
371 int getInstallLocation();
Amith Yamasani0b285492011-04-14 17:35:23 -0700372
Kenny Root5ab21572011-07-27 11:11:19 -0700373 void installPackageWithVerification(in Uri packageURI, in IPackageInstallObserver observer,
374 int flags, in String installerPackageName, in Uri verificationURI,
Rich Canningse1d7c712012-08-08 12:46:06 -0700375 in ManifestDigest manifestDigest, in ContainerEncryptionParams encryptionParams);
Kenny Root5ab21572011-07-27 11:11:19 -0700376
rich cannings706e8ba2012-08-20 13:20:14 -0700377 void installPackageWithVerificationAndEncryption(in Uri packageURI,
378 in IPackageInstallObserver observer, int flags, in String installerPackageName,
379 in VerificationParams verificationParams,
380 in ContainerEncryptionParams encryptionParams);
381
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700382 int installExistingPackage(String packageName);
383
Kenny Root3a9b5fb2011-09-20 14:15:38 -0700384 void verifyPendingInstall(int id, int verificationCode);
rich canningsd9ef3e52012-08-22 14:28:05 -0700385 void extendVerificationTimeout(int id, int verificationCodeAtTimeout, long millisecondsToDelay);
Kenny Root0aaa0d92011-09-12 16:42:55 -0700386
387 VerifierDeviceIdentity getVerifierDeviceIdentity();
Dianne Hackborn58f42a52011-10-10 13:46:34 -0700388
389 boolean isFirstBoot();
Dianne Hackborn13579ed2012-11-28 18:05:36 -0800390 boolean isOnlyCoreApps();
Amith Yamasani742a6712011-05-04 14:49:28 -0700391
Jeff Sharkey5d32e772012-04-12 15:59:23 -0700392 void setPermissionEnforced(String permission, boolean enforced);
393 boolean isPermissionEnforced(String permission);
Jeff Sharkeyf6f7f1d2012-06-12 17:12:08 -0700394
395 /** Reflects current DeviceStorageMonitorService state */
396 boolean isStorageLow();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800397}