blob: bb35c291ace236be9701bbf141ed62f09703ba68 [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;
Dianne Hackborn49237342009-08-27 20:08:01 -070025import android.content.pm.FeatureInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080026import android.content.pm.IPackageInstallObserver;
27import android.content.pm.IPackageDeleteObserver;
28import android.content.pm.IPackageDataObserver;
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -080029import android.content.pm.IPackageMoveObserver;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080030import android.content.pm.IPackageStatsObserver;
31import android.content.pm.InstrumentationInfo;
32import android.content.pm.PackageInfo;
Kenny Root5ab21572011-07-27 11:11:19 -070033import android.content.pm.ManifestDigest;
Kenny Root0e2c0f32011-04-15 17:50:10 -070034import android.content.pm.ParceledListSlice;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080035import android.content.pm.ProviderInfo;
36import android.content.pm.PermissionGroupInfo;
37import android.content.pm.PermissionInfo;
38import android.content.pm.ResolveInfo;
39import android.content.pm.ServiceInfo;
Amith Yamasani0b285492011-04-14 17:35:23 -070040import android.content.pm.UserInfo;
Kenny Root0aaa0d92011-09-12 16:42:55 -070041import android.content.pm.VerifierDeviceIdentity;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080042import android.net.Uri;
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -070043import android.content.IntentSender;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080044
45/**
46 * See {@link PackageManager} for documentation on most of the APIs
47 * here.
48 *
49 * {@hide}
50 */
51interface IPackageManager {
52 PackageInfo getPackageInfo(String packageName, int flags);
53 int getPackageUid(String packageName);
54 int[] getPackageGids(String packageName);
Dianne Hackborn47096932010-02-11 15:57:09 -080055
56 String[] currentToCanonicalPackageNames(in String[] names);
57 String[] canonicalToCurrentPackageNames(in String[] names);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080058
59 PermissionInfo getPermissionInfo(String name, int flags);
60
61 List<PermissionInfo> queryPermissionsByGroup(String group, int flags);
62
63 PermissionGroupInfo getPermissionGroupInfo(String name, int flags);
64
65 List<PermissionGroupInfo> getAllPermissionGroups(int flags);
66
67 ApplicationInfo getApplicationInfo(String packageName, int flags);
68
69 ActivityInfo getActivityInfo(in ComponentName className, int flags);
70
71 ActivityInfo getReceiverInfo(in ComponentName className, int flags);
72
73 ServiceInfo getServiceInfo(in ComponentName className, int flags);
74
Dianne Hackborn361199b2010-08-30 17:42:07 -070075 ProviderInfo getProviderInfo(in ComponentName className, int flags);
76
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080077 int checkPermission(String permName, String pkgName);
78
79 int checkUidPermission(String permName, int uid);
80
81 boolean addPermission(in PermissionInfo info);
82
83 void removePermission(String name);
84
Dianne Hackborn854060af2009-07-09 18:14:31 -070085 boolean isProtectedBroadcast(String actionName);
86
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080087 int checkSignatures(String pkg1, String pkg2);
88
Dianne Hackborn766cbfe2009-08-12 18:33:39 -070089 int checkUidSignatures(int uid1, int uid2);
90
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080091 String[] getPackagesForUid(int uid);
92
93 String getNameForUid(int uid);
94
95 int getUidForSharedUser(String sharedUserName);
96
97 ResolveInfo resolveIntent(in Intent intent, String resolvedType, int flags);
98
99 List<ResolveInfo> queryIntentActivities(in Intent intent,
100 String resolvedType, int flags);
101
102 List<ResolveInfo> queryIntentActivityOptions(
103 in ComponentName caller, in Intent[] specifics,
104 in String[] specificTypes, in Intent intent,
105 String resolvedType, int flags);
106
107 List<ResolveInfo> queryIntentReceivers(in Intent intent,
108 String resolvedType, int flags);
109
110 ResolveInfo resolveService(in Intent intent,
111 String resolvedType, int flags);
112
113 List<ResolveInfo> queryIntentServices(in Intent intent,
114 String resolvedType, int flags);
115
Kenny Root0e2c0f32011-04-15 17:50:10 -0700116 /**
117 * This implements getInstalledPackages via a "last returned row"
118 * mechanism that is not exposed in the API. This is to get around the IPC
119 * limit that kicks in when flags are included that bloat up the data
120 * returned.
121 */
122 ParceledListSlice getInstalledPackages(int flags, in String lastRead);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800123
Kenny Root0e2c0f32011-04-15 17:50:10 -0700124 /**
125 * This implements getInstalledApplications 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 */
130 ParceledListSlice getInstalledApplications(int flags, in String lastRead);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800131
132 /**
133 * Retrieve all applications that are marked as persistent.
134 *
135 * @return A List&lt;applicationInfo> containing one entry for each persistent
136 * application.
137 */
138 List<ApplicationInfo> getPersistentApplications(int flags);
139
140 ProviderInfo resolveContentProvider(String name, int flags);
141
142 /**
143 * Retrieve sync information for all content providers.
144 *
145 * @param outNames Filled in with a list of the root names of the content
146 * providers that can sync.
147 * @param outInfo Filled in with a list of the ProviderInfo for each
148 * name in 'outNames'.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800149 */
150 void querySyncProviders(inout List<String> outNames,
151 inout List<ProviderInfo> outInfo);
152
153 List<ProviderInfo> queryContentProviders(
154 String processName, int uid, int flags);
155
156 InstrumentationInfo getInstrumentationInfo(
157 in ComponentName className, int flags);
158
159 List<InstrumentationInfo> queryInstrumentation(
160 String targetPackage, int flags);
161
162 /**
163 * Install a package.
164 *
165 * @param packageURI The location of the package file to install.
166 * @param observer a callback to use to notify when the package installation in finished.
167 * @param flags - possible values: {@link #FORWARD_LOCK_PACKAGE},
168 * {@link #REPLACE_EXISITING_PACKAGE}
Jacek Surazski65e13172009-04-28 15:26:38 +0200169 * @param installerPackageName Optional package name of the application that is performing the
170 * installation. This identifies which market the package came from.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800171 */
Jacek Surazski65e13172009-04-28 15:26:38 +0200172 void installPackage(in Uri packageURI, IPackageInstallObserver observer, int flags,
173 in String installerPackageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800174
Christopher Tate1bb69062010-02-19 17:02:12 -0800175 void finishPackageInstall(int token);
176
Dianne Hackborn880119b2010-11-18 22:26:40 -0800177 void setInstallerPackageName(in String targetPackage, in String installerPackageName);
178
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800179 /**
180 * Delete a package.
181 *
182 * @param packageName The fully qualified name of the package to delete.
183 * @param observer a callback to use to notify when the package deletion in finished.
184 * @param flags - possible values: {@link #DONT_DELETE_DATA}
185 */
186 void deletePackage(in String packageName, IPackageDeleteObserver observer, int flags);
187
Jacek Surazski65e13172009-04-28 15:26:38 +0200188 String getInstallerPackageName(in String packageName);
189
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800190 void addPackageToPreferred(String packageName);
191
192 void removePackageFromPreferred(String packageName);
193
194 List<PackageInfo> getPreferredPackages(int flags);
195
196 void addPreferredActivity(in IntentFilter filter, int match,
197 in ComponentName[] set, in ComponentName activity);
Satish Sampath8dbe6122009-06-02 23:35:54 +0100198
199 void replacePreferredActivity(in IntentFilter filter, int match,
200 in ComponentName[] set, in ComponentName activity);
201
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800202 void clearPackagePreferredActivities(String packageName);
Satish Sampath8dbe6122009-06-02 23:35:54 +0100203
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800204 int getPreferredActivities(out List<IntentFilter> outFilters,
205 out List<ComponentName> outActivities, String packageName);
206
207 /**
208 * As per {@link android.content.pm.PackageManager#setComponentEnabledSetting}.
209 */
210 void setComponentEnabledSetting(in ComponentName componentName,
211 in int newState, in int flags);
212
213 /**
214 * As per {@link android.content.pm.PackageManager#getComponentEnabledSetting}.
215 */
216 int getComponentEnabledSetting(in ComponentName componentName);
217
218 /**
219 * As per {@link android.content.pm.PackageManager#setApplicationEnabledSetting}.
220 */
221 void setApplicationEnabledSetting(in String packageName, in int newState, int flags);
222
223 /**
224 * As per {@link android.content.pm.PackageManager#getApplicationEnabledSetting}.
225 */
226 int getApplicationEnabledSetting(in String packageName);
227
228 /**
Dianne Hackborne7f97212011-02-24 14:40:20 -0800229 * Set whether the given package should be considered stopped, making
230 * it not visible to implicit intents that filter out stopped packages.
231 */
232 void setPackageStoppedState(String packageName, boolean stopped);
233
234 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800235 * Free storage by deleting LRU sorted list of cache files across
236 * all applications. If the currently available free storage
237 * on the device is greater than or equal to the requested
238 * free storage, no cache files are cleared. If the currently
239 * available storage on the device is less than the requested
240 * free storage, some or all of the cache files across
241 * all applications are deleted (based on last accessed time)
242 * to increase the free storage space on the device to
243 * the requested value. There is no guarantee that clearing all
244 * the cache files from all applications will clear up
245 * enough storage to achieve the desired value.
246 * @param freeStorageSize The number of bytes of storage to be
247 * freed by the system. Say if freeStorageSize is XX,
248 * and the current free storage is YY,
249 * if XX is less than YY, just return. if not free XX-YY number
250 * of bytes if possible.
251 * @param observer call back used to notify when
252 * the operation is completed
253 */
254 void freeStorageAndNotify(in long freeStorageSize,
255 IPackageDataObserver observer);
256
257 /**
258 * Free storage by deleting LRU sorted list of cache files across
259 * all applications. If the currently available free storage
260 * on the device is greater than or equal to the requested
261 * free storage, no cache files are cleared. If the currently
262 * available storage on the device is less than the requested
263 * free storage, some or all of the cache files across
264 * all applications are deleted (based on last accessed time)
265 * to increase the free storage space on the device to
266 * the requested value. There is no guarantee that clearing all
267 * the cache files from all applications will clear up
268 * enough storage to achieve the desired value.
269 * @param freeStorageSize The number of bytes of storage to be
270 * freed by the system. Say if freeStorageSize is XX,
271 * and the current free storage is YY,
272 * if XX is less than YY, just return. if not free XX-YY number
273 * of bytes if possible.
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -0700274 * @param pi IntentSender call back used to
275 * notify when the operation is completed.May be null
276 * to indicate that no call back is desired.
277 */
Suchi Amalapurapubc806f62009-06-17 15:18:19 -0700278 void freeStorage(in long freeStorageSize,
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -0700279 in IntentSender pi);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800280
281 /**
282 * Delete all the cache files in an applications cache directory
283 * @param packageName The package name of the application whose cache
284 * files need to be deleted
285 * @param observer a callback used to notify when the deletion is finished.
286 */
287 void deleteApplicationCacheFiles(in String packageName, IPackageDataObserver observer);
288
289 /**
290 * Clear the user data directory of an application.
291 * @param packageName The package name of the application whose cache
292 * files need to be deleted
293 * @param observer a callback used to notify when the operation is completed.
294 */
295 void clearApplicationUserData(in String packageName, IPackageDataObserver observer);
296
297 /**
298 * Get package statistics including the code, data and cache size for
299 * an already installed package
300 * @param packageName The package name of the application
301 * @param observer a callback to use to notify when the asynchronous
302 * retrieval of information is complete.
303 */
304 void getPackageSizeInfo(in String packageName, IPackageStatsObserver observer);
305
306 /**
307 * Get a list of shared libraries that are available on the
308 * system.
309 */
310 String[] getSystemSharedLibraryNames();
311
Dianne Hackborn49237342009-08-27 20:08:01 -0700312 /**
313 * Get a list of features that are available on the
314 * system.
315 */
316 FeatureInfo[] getSystemAvailableFeatures();
317
Dianne Hackborn039c68e2009-09-26 16:39:23 -0700318 boolean hasSystemFeature(String name);
319
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800320 void enterSafeMode();
321 boolean isSafeMode();
322 void systemReady();
323 boolean hasSystemUidErrors();
Dianne Hackborn661cd522011-08-22 00:26:20 -0700324
325 /**
326 * Ask the package manager to perform boot-time dex-opt of all
327 * existing packages.
328 */
329 void performBootDexOpt();
330
Dianne Hackborn5c1e00b2009-06-18 17:10:57 -0700331 /**
332 * Ask the package manager to perform dex-opt (if needed) on the given
333 * package, if it already hasn't done mode. Only does this if running
334 * in the special development "no pre-dexopt" mode.
335 */
336 boolean performDexOpt(String packageName);
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800337
338 /**
339 * Update status of external media on the package manager to scan and
340 * install packages installed on the external media. Like say the
341 * MountService uses this to call into the package manager to update
342 * status of sdcard.
343 */
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -0700344 void updateExternalMediaStatus(boolean mounted, boolean reportStatus);
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800345
Dianne Hackborne83cefce2010-02-04 17:38:14 -0800346 String nextPackageToClean(String lastPackage);
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -0800347
348 void movePackage(String packageName, IPackageMoveObserver observer, int flags);
Dianne Hackbornd7c09682010-03-30 10:42:20 -0700349
350 boolean addPermissionAsync(in PermissionInfo info);
Suchi Amalapurapu40e47252010-04-07 16:15:50 -0700351
352 boolean setInstallLocation(int loc);
353 int getInstallLocation();
Amith Yamasani0b285492011-04-14 17:35:23 -0700354
355 UserInfo createUser(in String name, int flags);
356 boolean removeUser(int userId);
Kenny Root5ab21572011-07-27 11:11:19 -0700357
358 void installPackageWithVerification(in Uri packageURI, in IPackageInstallObserver observer,
359 int flags, in String installerPackageName, in Uri verificationURI,
360 in ManifestDigest manifestDigest);
361
Kenny Root3a9b5fb2011-09-20 14:15:38 -0700362 void verifyPendingInstall(int id, int verificationCode);
Kenny Root0aaa0d92011-09-12 16:42:55 -0700363
364 VerifierDeviceIdentity getVerifierDeviceIdentity();
Dianne Hackborn58f42a52011-10-10 13:46:34 -0700365
366 boolean isFirstBoot();
Amith Yamasani742a6712011-05-04 14:49:28 -0700367
368 List<UserInfo> getUsers();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800369}